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

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