root/kernel/FPU-emu/fpu_emu.h

/* [previous][next][first][last][top][bottom][index][help] */

INCLUDED FROM


   1 /*---------------------------------------------------------------------------+
   2  |  fpu_emu.h                                                                |
   3  |                                                                           |
   4  | Copyright (C) 1992    W. Metzenthen, 22 Parker St, Ormond, Vic 3163,      |
   5  |                       Australia.  E-mail apm233m@vaxc.cc.monash.edu.au    |
   6  |                                                                           |
   7  +---------------------------------------------------------------------------*/
   8 
   9 
  10 #ifndef _FPU_EMU_H_
  11 #define _FPU_EMU_H_
  12 
  13 #ifdef __ASSEMBLER__
  14 #include "fpu_asm.h"
  15 #define Const(x)        $##x
  16 #else
  17 #define Const(x)        x
  18 #endif
  19 
  20 #define EXP_BIAS        Const(0)
  21 #define EXP_OVER        Const(0x4000)    /* smallest invalid large exponent */
  22 /* #define EXP_MAX              Const(16384) */
  23 #define EXP_UNDER       Const(-0x3fff)   /* largest invalid small exponent */
  24 /* #define      EXP_MIN         Const(-16384) */
  25 
  26 #define SIGN_POS        Const(0)
  27 #define SIGN_NEG        Const(1)
  28 
  29 /* Keep the order TW_Valid, TW_Zero, TW_Denormal */
  30 #define TW_Valid        Const(0)        /* valid */
  31 #define TW_Zero         Const(1)        /* zero */
  32 /* The following fold to 2 (Special) in the Tag Word */
  33 #define TW_Denormal     Const(4)        /* De-normal */
  34 #define TW_Infinity     Const(5)        /* + or - infinity */
  35 #define TW_NaN          Const(6)        /* Not a Number */
  36 
  37 #define TW_Empty        Const(7)        /* empty */
  38 
  39 
  40 
  41 #ifndef __ASSEMBLER__
  42 
  43 #include <linux/math_emu.h>
  44 
  45 #ifdef PARANOID
  46 extern char emulating;
  47 #  define RE_ENTRANT_CHECK_OFF emulating = 0;
  48 #  define RE_ENTRANT_CHECK_ON emulating = 1;
  49 #else
  50 #  define RE_ENTRANT_CHECK_OFF
  51 #  define RE_ENTRANT_CHECK_ON
  52 #endif PARANOID
  53 
  54 typedef void (*FUNC)();
  55 typedef struct fpu_reg FPU_REG;
  56 
  57 #define st(x)   ( regs[((top+x) &7 )] )
  58 
  59 #define STACK_OVERFLOW  (st_new_ptr = &st(-1), st_new_ptr->tag != TW_Empty)
  60 #define NOT_EMPTY(i)    (st(i).tag != TW_Empty)
  61 #define NOT_EMPTY_0     (FPU_st0_tag ^ TW_Empty)
  62 
  63 extern unsigned char FPU_rm;
  64 
  65 extern  char    FPU_st0_tag;
  66 extern  FPU_REG *FPU_st0_ptr;
  67 
  68 extern void  *FPU_data_address;
  69 
  70 extern  FPU_REG  FPU_loaded_data;
  71 
  72 #define pop()   { FPU_st0_ptr->tag = TW_Empty; top++; }
  73 
  74 /* push() does not affect the tags */
  75 #define push()  { top--; FPU_st0_ptr = st_new_ptr; }
  76 
  77 
  78 #define reg_move(x, y) { \
  79                  *(short *)&((y)->sign) = *(short *)&((x)->sign); \
  80                  *(long *)&((y)->exp) = *(long *)&((x)->exp); \
  81                  *(long long *)&((y)->sigl) = *(long long *)&((x)->sigl); }
  82 
  83 
  84 /*----- Prototypes for functions written in assembler -----*/
  85 /* extern void reg_move(FPU_REG *a, FPU_REG *b); */
  86 
  87 extern void mul64(long long *a, long long *b, long long *result);
  88 extern void poly_div2(long long *x);
  89 extern void poly_div4(long long *x);
  90 extern void poly_div16(long long *x);
  91 extern void polynomial(unsigned accum[], unsigned x[],
  92                        unsigned short terms[][4], int n);
  93 extern void normalize(FPU_REG *x);
  94 extern void reg_div(FPU_REG *arg1, FPU_REG *arg2, FPU_REG *answ);
  95 extern void reg_u_sub(FPU_REG *arg1, FPU_REG *arg2, FPU_REG *answ);
  96 extern void reg_u_mul(FPU_REG *arg1, FPU_REG *arg2, FPU_REG *answ);
  97 extern void reg_u_div(long long *arg1, long long *arg2, FPU_REG *answ);
  98 extern void reg_u_add(FPU_REG *arg1, FPU_REG *arg2, FPU_REG *answ);
  99 extern void wm_sqrt(FPU_REG *n);
 100 extern unsigned shrx(void *l, unsigned x);
 101 extern unsigned shrxs(void *v, unsigned x);
 102 extern unsigned long div_small(unsigned long long *x, unsigned long y);
 103 
 104 #ifndef MAKING_PROTO
 105 #include "fpu_proto.h"
 106 #endif
 107 
 108 #endif __ASSEMBLER__
 109 
 110 #endif _FPU_EMU_H_

/* [previous][next][first][last][top][bottom][index][help] */