From b091e008995c7b3fc615c597de7974a87797b030 Mon Sep 17 00:00:00 2001 From: Stanislav Shwartsman Date: Sat, 4 Oct 2003 12:32:56 +0000 Subject: [PATCH] Exclude INTERNAL FPU errors handling outside of standart FPU exceptions handler CVS ---------------------------------------------------------------------- --- bochs/fpu/div_Xsig.c | 10 +- bochs/fpu/errors.c | 82 ++----- bochs/fpu/exception.h | 4 +- bochs/fpu/fpu_emu.h | 6 +- bochs/fpu/fpu_entry.c | 4 +- bochs/fpu/fpu_etc.c | 4 +- bochs/fpu/fpu_proto.h | 5 +- bochs/fpu/fpu_trig.c | 508 ++++++++++++++++++++-------------------- bochs/fpu/load_store.c | 20 +- bochs/fpu/poly_2xm1.c | 4 +- bochs/fpu/poly_atan.c | 4 +- bochs/fpu/poly_sin.c | 6 +- bochs/fpu/reg_add_sub.c | 6 +- bochs/fpu/reg_compare.c | 8 +- bochs/fpu/reg_convert.c | 4 +- bochs/fpu/reg_divide.c | 4 +- bochs/fpu/reg_ld_str.c | 6 +- bochs/fpu/reg_mul.c | 4 +- bochs/fpu/reg_round.c | 14 +- bochs/fpu/reg_u_add.c | 4 +- bochs/fpu/reg_u_div.c | 14 +- bochs/fpu/reg_u_mul.c | 4 +- bochs/fpu/reg_u_sub.c | 10 +- bochs/fpu/wm_sqrt.c | 10 +- 24 files changed, 344 insertions(+), 401 deletions(-) diff --git a/bochs/fpu/div_Xsig.c b/bochs/fpu/div_Xsig.c index a4cf0a572..995aea3f9 100644 --- a/bochs/fpu/div_Xsig.c +++ b/bochs/fpu/div_Xsig.c @@ -1,6 +1,6 @@ /*---------------------------------------------------------------------------+ | div_Xsig.S | - | $Id: div_Xsig.c,v 1.2 2001-10-06 03:53:46 bdenney Exp $ + | $Id: div_Xsig.c,v 1.3 2003-10-04 12:32:55 sshwarts Exp $ | | | Division subroutine for 96 bit quantities | | | @@ -40,7 +40,7 @@ void div_Xsig(const Xsig *aa, const Xsig *b, Xsig *dest) #ifdef PARANOID if ( (b->msw & 0x80000000) == 0 ) { - EXCEPTION(EX_INTERNAL|0x240); + INTERNAL(0x240); return; } #endif @@ -85,7 +85,7 @@ void div_Xsig(const Xsig *aa, const Xsig *b, Xsig *dest) #ifdef PARANOID if ( a.msw > 1 ) { - EXCEPTION(EX_INTERNAL|0x241); + INTERNAL(0x241); } #endif @@ -139,7 +139,7 @@ void div_Xsig(const Xsig *aa, const Xsig *b, Xsig *dest) #ifdef PARANOID if ( a.midw > 1 ) { - EXCEPTION(EX_INTERNAL|0x242); + INTERNAL(0x242); } #endif @@ -172,7 +172,7 @@ void div_Xsig(const Xsig *aa, const Xsig *b, Xsig *dest) #ifdef PARANOID if ( a.lsw > 2 ) { - EXCEPTION(EX_INTERNAL|0x243); + INTERNAL(0x243); } #endif diff --git a/bochs/fpu/errors.c b/bochs/fpu/errors.c index abdaeedfc..201362882 100644 --- a/bochs/fpu/errors.c +++ b/bochs/fpu/errors.c @@ -1,6 +1,6 @@ /*---------------------------------------------------------------------------+ | errors.c | - | $Id: errors.c,v 1.11 2003-08-28 19:25:23 sshwarts Exp $ + | $Id: errors.c,v 1.12 2003-10-04 12:32:55 sshwarts Exp $ | | | The error handling functions for wm-FPU-emu | | | @@ -156,7 +156,6 @@ static struct { { EX_ZeroDiv, "divide by zero" }, { EX_Denormal, "denormalized operand" }, { EX_Invalid, "invalid operation" }, - { EX_INTERNAL, "INTERNAL BUG in "FPU_VERSION }, { 0, NULL } }; @@ -209,68 +208,36 @@ static struct { 0x171 in fpu_tags.c 0x172 in fpu_tags.c 0x180 in reg_convert.c - 0x2nn in an *.S file: - 0x201 in reg_u_add.S - 0x202 in reg_u_div.S - 0x203 in reg_u_div.S - 0x204 in reg_u_div.S - 0x205 in reg_u_mul.S - 0x206 in reg_u_sub.S - 0x207 in wm_sqrt.S - 0x208 in reg_div.S - 0x209 in reg_u_sub.S - 0x210 in reg_u_sub.S - 0x211 in reg_u_sub.S - 0x212 in reg_u_sub.S - 0x213 in wm_sqrt.S - 0x214 in wm_sqrt.S - 0x215 in wm_sqrt.S - 0x220 in reg_norm.S - 0x221 in reg_norm.S - 0x230 in reg_round.S - 0x231 in reg_round.S - 0x232 in reg_round.S - 0x233 in reg_round.S - 0x234 in reg_round.S - 0x235 in reg_round.S - 0x236 in reg_round.S - 0x240 in div_Xsig.S - 0x241 in div_Xsig.S - 0x242 in div_Xsig.S */ +void FPU_internal(int type) +{ + printk("FPU emulator: Internal error type 0x%04x\n", type); +} + void FPU_exception(int n) { int i, int_type; int_type = 0; /* Needed only to stop compiler warnings */ - if ( n & EX_INTERNAL ) - { - int_type = n - EX_INTERNAL; - n = EX_INTERNAL; - /* Set lots of exception bits! */ - FPU_partial_status |= (SW_Exc_Mask | SW_Summary | SW_Backward); - } - else - { - /* Extract only the bits which we use to set the status word */ - n &= (SW_Exc_Mask); - /* Set the corresponding exception bit */ - FPU_partial_status |= n; - /* Set summary bits iff exception isn't masked */ - if ( FPU_partial_status & ~FPU_control_word & CW_Exceptions ) + + /* Extract only the bits which we use to set the status word */ + n &= (SW_Exc_Mask); + /* Set the corresponding exception bit */ + FPU_partial_status |= n; + /* Set summary bits iff exception isn't masked */ + if (FPU_partial_status & ~FPU_control_word & CW_Exceptions) FPU_partial_status |= (SW_Summary | SW_Backward); - if ( n & (SW_Stack_Fault | EX_Precision) ) - { - if ( !(n & SW_C1) ) - /* This bit distinguishes over- from underflow for a stack fault, - and roundup from round-down for precision loss. */ - FPU_partial_status &= ~SW_C1; - } - } + if (n & (SW_Stack_Fault | EX_Precision)) + { + if (!(n & SW_C1)) + /* This bit distinguishes over- from underflow for a stack fault, + and roundup from round-down for precision loss. */ + FPU_partial_status &= ~SW_C1; + } RE_ENTRANT_CHECK_OFF; - if ( (~FPU_control_word & n & CW_Exceptions) || (n == EX_INTERNAL) ) + if (~FPU_control_word & n & CW_Exceptions) { /* Get a name string for error reporting */ for (i=0; exception_names[i].type; i++) @@ -285,11 +252,6 @@ void FPU_exception(int n) } else printk("FPU emulator: Unknown Exception: 0x%04x!\n", n); - - if ( n == EX_INTERNAL ) - { - printk("FPU emulator: Internal error type 0x%04x\n", int_type); - } /* * The 80486 generates an interrupt on the next non-control FPU @@ -411,7 +373,7 @@ int real_2op_NaN(FPU_REG const *b, u_char tagb, else { signalling = 0; - EXCEPTION(EX_INTERNAL|0x113); + INTERNAL(0x113); x = &CONST_QNaN; } #endif /* PARANOID */ diff --git a/bochs/fpu/exception.h b/bochs/fpu/exception.h index 295c4a558..47d81c9b1 100644 --- a/bochs/fpu/exception.h +++ b/bochs/fpu/exception.h @@ -1,6 +1,6 @@ /*---------------------------------------------------------------------------+ | exception.h | - | $Id: exception.h,v 1.4 2003-07-31 17:39:24 sshwarts Exp $ + | $Id: exception.h,v 1.5 2003-10-04 12:32:55 sshwarts Exp $ | | | Copyright (C) 1992 W. Metzenthen, 22 Parker St, Ormond, Vic 3163, | | Australia. E-mail billm@vaxc.cc.monash.edu.au | @@ -17,7 +17,6 @@ #define FPU_BUSY (0x8000) /* FPU busy bit (8087 compatibility) */ #define EX_ErrorSummary (0x0080) /* Error summary status */ /* Special exceptions: */ -#define EX_INTERNAL (0x8000) /* Internal error in wm-FPU-emu */ #define EX_StackOver (0x0041|SW_C1) /* stack overflow */ #define EX_StackUnder (0x0041) /* stack underflow */ /* Exception flags: */ @@ -32,5 +31,6 @@ #define PRECISION_LOST_DOWN (EX_Precision) #define EXCEPTION(x) FPU_exception(x) +#define INTERNAL(x) FPU_internal(x) #endif /* _EXCEPTION_H_ */ diff --git a/bochs/fpu/fpu_emu.h b/bochs/fpu/fpu_emu.h index 51b22862d..fa9110460 100644 --- a/bochs/fpu/fpu_emu.h +++ b/bochs/fpu/fpu_emu.h @@ -1,6 +1,6 @@ /*---------------------------------------------------------------------------+ | fpu_emu.h | - | $Id: fpu_emu.h,v 1.15 2003-10-03 17:39:04 sshwarts Exp $ + | $Id: fpu_emu.h,v 1.16 2003-10-04 12:32:56 sshwarts Exp $ | | | Copyright (C) 1992,1993,1994,1997 | | W. Metzenthen, 22 Parker St, Ormond, Vic 3163, | @@ -155,10 +155,6 @@ typedef struct { overrides override; #define PM16 (SIXTEEN | PROTECTED) #define SEG32 PROTECTED -#ifndef USE_WITH_CPU_SIM -extern u_char const data_sizes_16[32]; -#endif - #define fpu_register(x) ( * ((FPU_REG *)(FPU_register_base + sizeof(FPU_REG) * (x & 7) ))) #define st(x) ( * ((FPU_REG *)(FPU_register_base + sizeof(FPU_REG) * ((FPU_tos+x) & 7) ))) diff --git a/bochs/fpu/fpu_entry.c b/bochs/fpu/fpu_entry.c index 507513d6e..100fd99ef 100644 --- a/bochs/fpu/fpu_entry.c +++ b/bochs/fpu/fpu_entry.c @@ -1,6 +1,6 @@ /*---------------------------------------------------------------------------+ | fpu_entry.c | - | $Id: fpu_entry.c,v 1.16 2003-08-01 16:57:59 sshwarts Exp $ + | $Id: fpu_entry.c,v 1.17 2003-10-04 12:32:56 sshwarts Exp $ | | | The entry functions for wm-FPU-emu | | | @@ -395,7 +395,7 @@ do_the_FPU_interrupt: FPU_illegal(); goto FPU_instruction_done; default: - EXCEPTION(EX_INTERNAL|0x111); + INTERNAL(0x111); goto FPU_instruction_done; } (*st_instr_table[(int) instr_index])(); diff --git a/bochs/fpu/fpu_etc.c b/bochs/fpu/fpu_etc.c index 2df86b98d..ecb3bdb4a 100644 --- a/bochs/fpu/fpu_etc.c +++ b/bochs/fpu/fpu_etc.c @@ -1,6 +1,6 @@ /*---------------------------------------------------------------------------+ | fpu_etc.c | - | $Id: fpu_etc.c,v 1.4 2001-10-06 03:53:46 bdenney Exp $ + | $Id: fpu_etc.c,v 1.5 2003-10-04 12:32:56 sshwarts Exp $ | | | Implement a few FPU instructions. | | | @@ -85,7 +85,7 @@ static void ftst_(FPU_REG *st0_ptr, u_char st0tag) break; default: setcc(SW_C0|SW_C2|SW_C3); /* Operand is not comparable */ - EXCEPTION(EX_INTERNAL|0x14); + INTERNAL(0x14); break; } break; diff --git a/bochs/fpu/fpu_proto.h b/bochs/fpu/fpu_proto.h index 207c52184..d03730004 100644 --- a/bochs/fpu/fpu_proto.h +++ b/bochs/fpu/fpu_proto.h @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////// -// $Id: fpu_proto.h,v 1.10 2003-08-01 09:32:33 sshwarts Exp $ +// $Id: fpu_proto.h,v 1.11 2003-10-04 12:32:56 sshwarts Exp $ ///////////////////////////////////////////////////////////////////////// // // Copyright (C) 2001 MandrakeSoft S.A. @@ -38,6 +38,7 @@ extern void Un_impl(void); extern void FPU_illegal(void); asmlinkage void FPU_exception(int n); +asmlinkage void FPU_internal(int n); extern int real_1op_NaN(FPU_REG *a); extern int real_2op_NaN(FPU_REG const *b, u_char tagb, int deststnr, FPU_REG const *defaultNaN); @@ -166,5 +167,5 @@ extern int FPU_mul(FPU_REG const *b, u_char tagb, int deststnr, int control_w); extern int FPU_div(int flags, FPU_REG *regrm, int control_w); // bbd: changed arg2 from int to FPU_REG* /* reg_convert.c */ extern int FPU_to_exp16(FPU_REG const *a, FPU_REG *x) BX_CPP_AttrRegparmN(2); -#endif /* _FPU_PROTO_H */ +#endif /* _FPU_PROTO_H */ diff --git a/bochs/fpu/fpu_trig.c b/bochs/fpu/fpu_trig.c index 1bfa8980b..7b2673360 100644 --- a/bochs/fpu/fpu_trig.c +++ b/bochs/fpu/fpu_trig.c @@ -1,6 +1,6 @@ /*---------------------------------------------------------------------------+ | fpu_trig.c | - | $Id: fpu_trig.c,v 1.7 2003-07-31 21:07:38 sshwarts Exp $ + | $Id: fpu_trig.c,v 1.8 2003-10-04 12:32:56 sshwarts Exp $ | | | Implementation of the FPU "transcendental" functions. | | | @@ -39,13 +39,13 @@ static int trig_arg(FPU_REG *st0_ptr, int flags) int old_cw = FPU_control_word, saved_status = FPU_partial_status; int tag, st0_tag = TAG_Valid; - if ( exponent(st0_ptr) >= 63 ) + if (exponent(st0_ptr) >= 63) { FPU_partial_status |= SW_C2; /* Reduction incomplete. */ return -1; } - if ( flags & FPTAN ) + if (flags & FPTAN) st0_ptr->exp ++; /* Effectively base the following upon pi/4 */ FPU_control_word &= ~CW_RC; @@ -60,7 +60,7 @@ static int trig_arg(FPU_REG *st0_ptr, int flags) to 2^64 */ q = significand(&tmp); - if ( q ) + if (q) { rem_kernel(significand(st0_ptr), &significand(&tmp), @@ -74,7 +74,7 @@ static int trig_arg(FPU_REG *st0_ptr, int flags) FPU_copy_to_reg0(&tmp, st0_tag); } - if ( ((flags & FCOS) && !(q & 1)) || (!(flags & FCOS) && (q & 1)) ) + if (((flags & FCOS) && !(q & 1)) || (!(flags & FCOS) && (q & 1))) { st0_tag = FPU_sub(REV|LOADED|TAG_Valid, &CONST_PI2, FULL_PRECISION); @@ -83,7 +83,7 @@ static int trig_arg(FPU_REG *st0_ptr, int flags) precision approximation to pi/2. The technique used now is equivalent to using an approximation to pi/2 which is accurate to about 128 bits. */ - if ( (exponent(st0_ptr) <= exponent(&CONST_PI2extra) + 64) || (q > 1) ) + if ((exponent(st0_ptr) <= exponent(&CONST_PI2extra) + 64) || (q > 1)) { /* This code gives the effect of having pi/2 to better than 128 bits precision. */ @@ -98,7 +98,7 @@ static int trig_arg(FPU_REG *st0_ptr, int flags) exponent(&CONST_PI2extra) + exponent(&tmp)); setsign(&tmp, getsign(&CONST_PI2extra)); st0_tag = FPU_add(&tmp, tmptag, 0, FULL_PRECISION); - if ( signnegative(st0_ptr) && !(flags & FPTAN) ) + if (signnegative(st0_ptr) && !(flags & FPTAN)) { /* CONST_PI2extra is negative, so the result of the addition can be negative. This means that the argument is actually @@ -119,9 +119,9 @@ static int trig_arg(FPU_REG *st0_ptr, int flags) precision approximation to pi/2. The technique used now is equivalent to using an approximation to pi/2 which is accurate to about 128 bits. */ - if ( ((q > 0) + if (((q > 0) && (exponent(st0_ptr) <= exponent(&CONST_PI2extra) + 64)) - || (q > 1) ) + || (q > 1)) { /* This code gives the effect of having p/2 to better than 128 bits precision. */ @@ -138,10 +138,10 @@ static int trig_arg(FPU_REG *st0_ptr, int flags) setsign(&tmp, getsign(&CONST_PI2extra)); st0_tag = FPU_sub(LOADED|(tmptag & 0x0f), &tmp, FULL_PRECISION); - if ( (exponent(st0_ptr) == exponent(&CONST_PI2)) && + if ((exponent(st0_ptr) == exponent(&CONST_PI2)) && ((st0_ptr->sigh > CONST_PI2.sigh) || ((st0_ptr->sigh == CONST_PI2.sigh) - && (st0_ptr->sigl > CONST_PI2.sigl))) ) + && (st0_ptr->sigl > CONST_PI2.sigl)))) { /* CONST_PI2extra is negative, so the result of the subtraction can be larger than pi/2. This means @@ -162,7 +162,7 @@ static int trig_arg(FPU_REG *st0_ptr, int flags) FPU_control_word = old_cw; FPU_partial_status = saved_status & ~SW_C2; /* Reduction complete. */ - if ( flags & FPTAN ) + if (flags & FPTAN) { st0_ptr->exp --; return q & 7; @@ -205,13 +205,13 @@ static void convert_l2reg(s32 const *arg, int deststnr) static void single_arg_error(FPU_REG *st0_ptr, u_char st0_tag) { - if ( st0_tag == TAG_Empty ) + if (st0_tag == TAG_Empty) FPU_stack_underflow(); /* Puts a QNaN in st(0) */ - else if ( st0_tag == TW_NaN ) + else if (st0_tag == TW_NaN) real_1op_NaN(st0_ptr); /* return with a NaN in st(0) */ #ifdef PARANOID else - EXCEPTION(EX_INTERNAL|0x0112); + INTERNAL(0x0112); #endif /* PARANOID */ } @@ -220,14 +220,14 @@ static void single_arg_2_error(FPU_REG *st0_ptr, u_char st0_tag) { int isNaN; - switch ( st0_tag ) + switch (st0_tag) { case TW_NaN: isNaN = (exponent(st0_ptr) == EXP_OVER) && (st0_ptr->sigh & 0x80000000); - if ( isNaN && !(st0_ptr->sigh & 0x40000000) ) /* Signaling ? */ + if (isNaN && !(st0_ptr->sigh & 0x40000000)) /* Signaling ? */ { EXCEPTION(EX_Invalid); - if ( FPU_control_word & CW_Invalid ) + if (FPU_control_word & CW_Invalid) { /* The masked response */ /* Convert to a QNaN */ @@ -236,7 +236,7 @@ static void single_arg_2_error(FPU_REG *st0_ptr, u_char st0_tag) FPU_copy_to_reg0(st0_ptr, TAG_Special); } } - else if ( isNaN ) + else if (isNaN) { /* A QNaN */ push(); @@ -246,7 +246,7 @@ static void single_arg_2_error(FPU_REG *st0_ptr, u_char st0_tag) { /* pseudoNaN or other unsupported */ EXCEPTION(EX_Invalid); - if ( FPU_control_word & CW_Invalid ) + if (FPU_control_word & CW_Invalid) { /* The masked response */ FPU_copy_to_reg0(&CONST_QNaN, TAG_Special); @@ -257,7 +257,7 @@ static void single_arg_2_error(FPU_REG *st0_ptr, u_char st0_tag) break; /* return with a NaN in st(0) */ #ifdef PARANOID default: - EXCEPTION(EX_INTERNAL|0x0112); + INTERNAL(0x0112); #endif /* PARANOID */ } } @@ -271,10 +271,10 @@ static void f2xm1(FPU_REG *st0_ptr, u_char tag) clear_C1(); - if ( tag == TAG_Valid ) + if (tag == TAG_Valid) { /* For an 80486 FPU, the result is undefined if the arg is >= 1.0 */ - if ( exponent(st0_ptr) < 0 ) + if (exponent(st0_ptr) < 0) { denormal_arg: @@ -287,20 +287,20 @@ static void f2xm1(FPU_REG *st0_ptr, u_char tag) return; } - if ( tag == TAG_Zero ) + if (tag == TAG_Zero) return; - if ( tag == TAG_Special ) + if (tag == TAG_Special) tag = FPU_Special(st0_ptr); - switch ( tag ) + switch (tag) { case TW_Denormal: - if ( denormal_operand() < 0 ) + if (denormal_operand() < 0) return; goto denormal_arg; case TW_Infinity: - if ( signnegative(st0_ptr) ) + if (signnegative(st0_ptr)) { /* -infinity gives -1 (p16-10) */ FPU_copy_to_reg0(&CONST_1, TAG_Valid); @@ -321,10 +321,10 @@ static void fptan(FPU_REG *st0_ptr, u_char st0_tag) int invert[] = { 0, 1, 1, 0, 0, 1, 1, 0 }; /* Stack underflow has higher priority */ - if ( st0_tag == TAG_Empty ) + if (st0_tag == TAG_Empty) { FPU_stack_underflow(); /* Puts a QNaN in st(0) */ - if ( FPU_control_word & CW_Invalid ) + if (FPU_control_word & CW_Invalid) { st_new_ptr = &st(-1); push(); @@ -333,14 +333,14 @@ static void fptan(FPU_REG *st0_ptr, u_char st0_tag) return; } - if ( STACK_OVERFLOW ) + if (STACK_OVERFLOW) { FPU_stack_overflow(); return; } - if ( st0_tag == TAG_Valid ) + if (st0_tag == TAG_Valid) { - if ( exponent(st0_ptr) > -40 ) + if (exponent(st0_ptr) > -40) { - if ( (q = trig_arg(st0_ptr, FPTAN)) == -1 ) + if ((q = trig_arg(st0_ptr, FPTAN)) == -1) { /* Operand is out of range */ return; @@ -367,7 +367,7 @@ static void fptan(FPU_REG *st0_ptr, u_char st0_tag) return; } - if ( st0_tag == TAG_Zero ) + if (st0_tag == TAG_Zero) { push(); FPU_copy_to_reg0(&CONST_1, TAG_Valid); @@ -375,21 +375,21 @@ static void fptan(FPU_REG *st0_ptr, u_char st0_tag) return; } - if ( st0_tag == TAG_Special ) + if (st0_tag == TAG_Special) st0_tag = FPU_Special(st0_ptr); - if ( st0_tag == TW_Denormal ) + if (st0_tag == TW_Denormal) { - if ( denormal_operand() < 0 ) + if (denormal_operand() < 0) return; goto denormal_arg; } - if ( st0_tag == TW_Infinity ) + if (st0_tag == TW_Infinity) { /* The 80486 treats infinity as an invalid operand */ - if ( arith_invalid(0) >= 0 ) + if (arith_invalid(0) >= 0) { st_new_ptr = &st(-1); push(); @@ -408,12 +408,12 @@ static void fxtract(FPU_REG *st0_ptr, u_char st0_tag) u_char sign; register FPU_REG *st1_ptr = st0_ptr; /* anticipate */ - if ( STACK_OVERFLOW ) + if (STACK_OVERFLOW) { FPU_stack_overflow(); return; } clear_C1(); - if ( st0_tag == TAG_Valid ) + if (st0_tag == TAG_Valid) { s32 e; @@ -431,11 +431,11 @@ static void fxtract(FPU_REG *st0_ptr, u_char st0_tag) FPU_settag0(TAG_Valid); /* Needed if arg was a denormal */ return; } - else if ( st0_tag == TAG_Zero ) + else if (st0_tag == TAG_Zero) { sign = getsign(st0_ptr); - if ( FPU_divide_by_zero(0, SIGN_NEG) < 0 ) + if (FPU_divide_by_zero(0, SIGN_NEG) < 0) return; push(); @@ -444,12 +444,12 @@ static void fxtract(FPU_REG *st0_ptr, u_char st0_tag) return; } - if ( st0_tag == TAG_Special ) + if (st0_tag == TAG_Special) st0_tag = FPU_Special(st0_ptr); - if ( st0_tag == TW_Denormal ) + if (st0_tag == TW_Denormal) { - if (denormal_operand() < 0 ) + if (denormal_operand() < 0) return; push(); @@ -457,7 +457,7 @@ static void fxtract(FPU_REG *st0_ptr, u_char st0_tag) FPU_to_exp16(st1_ptr, st_new_ptr); goto denormal_arg; } - else if ( st0_tag == TW_Infinity ) + else if (st0_tag == TW_Infinity) { sign = getsign(st0_ptr); setpositive(st0_ptr); @@ -466,19 +466,19 @@ static void fxtract(FPU_REG *st0_ptr, u_char st0_tag) setsign(st_new_ptr, sign); return; } - else if ( st0_tag == TW_NaN ) + else if (st0_tag == TW_NaN) { - if ( real_1op_NaN(st0_ptr) < 0 ) + if (real_1op_NaN(st0_ptr) < 0) return; push(); FPU_copy_to_reg0(st0_ptr, TAG_Special); return; } - else if ( st0_tag == TAG_Empty ) + else if (st0_tag == TAG_Empty) { /* Is this the correct behaviour? */ - if ( FPU_control_word & EX_Invalid ) + if (FPU_control_word & EX_Invalid) { FPU_stack_underflow(); push(); @@ -489,7 +489,7 @@ static void fxtract(FPU_REG *st0_ptr, u_char st0_tag) } #ifdef PARANOID else - EXCEPTION(EX_INTERNAL | 0x119); + INTERNAL(0x119); #endif /* PARANOID */ } @@ -513,7 +513,7 @@ static void fsqrt_(FPU_REG *st0_ptr, u_char st0_tag) clear_C1(); - if ( st0_tag == TAG_Valid ) + if (st0_tag == TAG_Valid) { u_char tag; @@ -537,19 +537,19 @@ static void fsqrt_(FPU_REG *st0_ptr, u_char st0_tag) return; } - if ( st0_tag == TAG_Zero ) + if (st0_tag == TAG_Zero) return; - if ( st0_tag == TAG_Special ) + if (st0_tag == TAG_Special) st0_tag = FPU_Special(st0_ptr); - if ( st0_tag == TW_Infinity ) + if (st0_tag == TW_Infinity) { - if ( signnegative(st0_ptr) ) + if (signnegative(st0_ptr)) arith_invalid(0); /* sqrt(-Infinity) is invalid */ return; } - else if ( st0_tag == TW_Denormal ) + else if (st0_tag == TW_Denormal) { if (signnegative(st0_ptr)) { @@ -557,7 +557,7 @@ static void fsqrt_(FPU_REG *st0_ptr, u_char st0_tag) return; } - if ( denormal_operand() < 0 ) + if (denormal_operand() < 0) return; FPU_to_exp16(st0_ptr, st0_ptr); @@ -576,7 +576,7 @@ static void frndint_(FPU_REG *st0_ptr, u_char st0_tag) { int flags, tag; - if ( st0_tag == TAG_Valid ) + if (st0_tag == TAG_Valid) { u_char sign; @@ -587,14 +587,14 @@ static void frndint_(FPU_REG *st0_ptr, u_char st0_tag) if (exponent(st0_ptr) > 63) return; - if ( st0_tag == TW_Denormal ) + if (st0_tag == TW_Denormal) { - if (denormal_operand() < 0 ) + if (denormal_operand() < 0) return; } /* Fortunately, this can't overflow to 2^64 */ - if ( (flags = FPU_round_to_int(st0_ptr, st0_tag)) ) + if ((flags = FPU_round_to_int(st0_ptr, st0_tag))) set_precision_flag(flags); setexponent16(st0_ptr, 63); @@ -606,15 +606,15 @@ static void frndint_(FPU_REG *st0_ptr, u_char st0_tag) return; } - if ( st0_tag == TAG_Zero ) + if (st0_tag == TAG_Zero) return; - if ( st0_tag == TAG_Special ) + if (st0_tag == TAG_Special) st0_tag = FPU_Special(st0_ptr); - if ( st0_tag == TW_Denormal ) + if (st0_tag == TW_Denormal) goto denormal_arg; - else if ( st0_tag == TW_Infinity ) + else if (st0_tag == TW_Infinity) return; else single_arg_error(st0_ptr, st0_tag); @@ -625,13 +625,13 @@ static int fsin(FPU_REG *st0_ptr, u_char tag) { u_char arg_sign = getsign(st0_ptr); - if ( tag == TAG_Valid ) + if (tag == TAG_Valid) { u32 q; - if ( exponent(st0_ptr) > -40 ) + if (exponent(st0_ptr) > -40) { - if ( (q = trig_arg(st0_ptr, 0)) == -1 ) + if ((q = trig_arg(st0_ptr, 0)) == -1) { /* Operand is out of range */ return 1; @@ -656,18 +656,18 @@ static int fsin(FPU_REG *st0_ptr, u_char tag) } } - if ( tag == TAG_Zero ) + if (tag == TAG_Zero) { setcc(0); return 0; } - if ( tag == TAG_Special ) + if (tag == TAG_Special) tag = FPU_Special(st0_ptr); - if ( tag == TW_Denormal ) + if (tag == TW_Denormal) { - if ( denormal_operand() < 0 ) + if (denormal_operand() < 0) return 1; /* For a small arg, the result == the argument */ @@ -680,7 +680,7 @@ static int fsin(FPU_REG *st0_ptr, u_char tag) return 0; } - else if ( tag == TW_Infinity ) + else if (tag == TW_Infinity) { /* The 80486 treats infinity as an invalid operand */ arith_invalid(0); @@ -700,15 +700,15 @@ static int f_cos(FPU_REG *st0_ptr, u_char tag) st0_sign = getsign(st0_ptr); - if ( tag == TAG_Valid ) + if (tag == TAG_Valid) { u32 q; - if ( exponent(st0_ptr) > -40 ) + if (exponent(st0_ptr) > -40) { - if ( (exponent(st0_ptr) < 0) + if ((exponent(st0_ptr) < 0) || ((exponent(st0_ptr) == 0) - && (significand(st0_ptr) <= BX_CONST64(0xc90fdaa22168c234))) ) + && (significand(st0_ptr) <= BX_CONST64(0xc90fdaa22168c234)))) { poly_cos(st0_ptr); @@ -717,7 +717,7 @@ static int f_cos(FPU_REG *st0_ptr, u_char tag) return 0; } - else if ( (q = trig_arg(st0_ptr, FCOS)) != -1 ) + else if ((q = trig_arg(st0_ptr, FCOS)) != -1) { poly_sine(st0_ptr); @@ -749,24 +749,24 @@ static int f_cos(FPU_REG *st0_ptr, u_char tag) return 0; } } - else if ( tag == TAG_Zero ) + else if (tag == TAG_Zero) { FPU_copy_to_reg0(&CONST_1, TAG_Valid); setcc(0); return 0; } - if ( tag == TAG_Special ) + if (tag == TAG_Special) tag = FPU_Special(st0_ptr); - if ( tag == TW_Denormal ) + if (tag == TW_Denormal) { - if ( denormal_operand() < 0 ) + if (denormal_operand() < 0) return 1; goto denormal_arg; } - else if ( tag == TW_Infinity ) + else if (tag == TW_Infinity) { /* The 80486 treats infinity as an invalid operand */ arith_invalid(0); @@ -793,10 +793,10 @@ static void fsincos(FPU_REG *st0_ptr, u_char st0_tag) u_char tag; /* Stack underflow has higher priority */ - if ( st0_tag == TAG_Empty ) + if (st0_tag == TAG_Empty) { FPU_stack_underflow(); /* Puts a QNaN in st(0) */ - if ( FPU_control_word & CW_Invalid ) + if (FPU_control_word & CW_Invalid) { st_new_ptr = &st(-1); push(); @@ -805,23 +805,23 @@ static void fsincos(FPU_REG *st0_ptr, u_char st0_tag) return; } - if ( STACK_OVERFLOW ) + if (STACK_OVERFLOW) { FPU_stack_overflow(); return; } - if ( st0_tag == TAG_Special ) + if (st0_tag == TAG_Special) tag = FPU_Special(st0_ptr); else tag = st0_tag; - if ( tag == TW_NaN ) + if (tag == TW_NaN) { single_arg_2_error(st0_ptr, TW_NaN); return; } - else if ( tag == TW_Infinity ) + else if (tag == TW_Infinity) { /* The 80486 treats infinity as an invalid operand */ - if ( arith_invalid(0) >= 0 ) + if (arith_invalid(0) >= 0) { /* Masked response */ push(); @@ -831,7 +831,7 @@ static void fsincos(FPU_REG *st0_ptr, u_char st0_tag) } reg_copy(st0_ptr, &arg); - if ( !fsin(st0_ptr, st0_tag) ) + if (!fsin(st0_ptr, st0_tag)) { push(); FPU_copy_to_reg0(&arg, st0_tag); @@ -912,7 +912,7 @@ static void do_fprem(FPU_REG *st0_ptr, u_char st0_tag, int round) FPU_REG *st1_ptr = &st(1); u_char st1_tag = FPU_gettagi(1); - if ( !((st0_tag ^ TAG_Valid) | (st1_tag ^ TAG_Valid)) ) + if (!((st0_tag ^ TAG_Valid) | (st1_tag ^ TAG_Valid))) { FPU_REG tmp, st0, st1; u_char st0_sign, st1_sign; @@ -939,11 +939,11 @@ static void do_fprem(FPU_REG *st0_ptr, u_char st0_tag, int round) FPU_control_word &= ~CW_RC; FPU_control_word |= RC_CHOP; - if ( expdif < 64 ) + if (expdif < 64) { /* This should be the most common case */ - if ( expdif > -2 ) + if (expdif > -2) { u_char sign = st0_sign ^ st1_sign; tag = FPU_u_div(&st0, &st1, &tmp, @@ -951,7 +951,7 @@ static void do_fprem(FPU_REG *st0_ptr, u_char st0_tag, int round) sign); setsign(&tmp, sign); - if ( exponent(&tmp) >= 0 ) + if (exponent(&tmp) >= 0) { FPU_round_to_int(&tmp, tag); /* Fortunately, this can't overflow to 2^64 */ @@ -970,21 +970,21 @@ static void do_fprem(FPU_REG *st0_ptr, u_char st0_tag, int round) q = 0; } - if ( (round == RC_RND) && (tmp.sigh & 0xc0000000) ) + if ((round == RC_RND) && (tmp.sigh & 0xc0000000)) { /* We may need to subtract st(1) once more, to get a result <= 1/2 of st(1). */ u64 x; expdif = exponent16(&st1) - exponent16(&tmp); - if ( expdif <= 1 ) + if (expdif <= 1) { - if ( expdif == 0 ) + if (expdif == 0) x = significand(&st1) - significand(&tmp); else /* expdif is 1 */ x = (significand(&st1) << 1) - significand(&tmp); - if ( (x < significand(&tmp)) || + if ((x < significand(&tmp)) || /* or equi-distant (from 0 & st(1)) and q is odd */ - ((x == significand(&tmp)) && (q & 1) ) ) + ((x == significand(&tmp)) && (q & 1))) { st0_sign = ! st0_sign; significand(&tmp) = x; @@ -1006,7 +1006,7 @@ static void do_fprem(FPU_REG *st0_ptr, u_char st0_tag, int round) } else { - /* There is a large exponent difference ( >= 64 ) */ + /* There is a large exponent difference (>= 64) */ /* To make much sense, the code in this section should be done at high precision. */ int exp_1, N; @@ -1036,7 +1036,7 @@ static void do_fprem(FPU_REG *st0_ptr, u_char st0_tag, int round) significand(&st1), significand(&tmp), exponent(&tmp) - ); + ); setexponent16(&tmp, exp_1 + expdif); /* It is possible for the operation to be complete here. @@ -1044,7 +1044,7 @@ static void do_fprem(FPU_REG *st0_ptr, u_char st0_tag, int round) implies that the operation will never be completed at this point, and the behaviour of a real 80486 confirms this. */ - if ( !(tmp.sigh | tmp.sigl) ) + if (!(tmp.sigh | tmp.sigl)) { /* The result is zero */ FPU_control_word = old_cw; @@ -1068,8 +1068,8 @@ static void do_fprem(FPU_REG *st0_ptr, u_char st0_tag, int round) /* The only condition to be looked for is underflow, and it can occur here only if underflow is unmasked. */ - if ( (exponent16(&tmp) <= EXP_UNDER) && (tag != TAG_Zero) - && !(FPU_control_word & CW_Underflow) ) + if ((exponent16(&tmp) <= EXP_UNDER) && (tag != TAG_Zero) + && !(FPU_control_word & CW_Underflow)) { setcc(cc); tag = arith_underflow(st0_ptr); @@ -1077,7 +1077,7 @@ static void do_fprem(FPU_REG *st0_ptr, u_char st0_tag, int round) FPU_settag0(tag); return; } - else if ( (exponent16(&tmp) > EXP_UNDER) || (tag == TAG_Zero) ) + else if ((exponent16(&tmp) > EXP_UNDER) || (tag == TAG_Zero)) { stdexp(st0_ptr); setsign(st0_ptr, st0_sign); @@ -1092,64 +1092,64 @@ static void do_fprem(FPU_REG *st0_ptr, u_char st0_tag, int round) return; } - if ( st0_tag == TAG_Special ) + if (st0_tag == TAG_Special) st0_tag = FPU_Special(st0_ptr); - if ( st1_tag == TAG_Special ) + if (st1_tag == TAG_Special) st1_tag = FPU_Special(st1_ptr); - if ( ((st0_tag == TAG_Valid) && (st1_tag == TW_Denormal)) + if (((st0_tag == TAG_Valid) && (st1_tag == TW_Denormal)) || ((st0_tag == TW_Denormal) && (st1_tag == TAG_Valid)) - || ((st0_tag == TW_Denormal) && (st1_tag == TW_Denormal)) ) + || ((st0_tag == TW_Denormal) && (st1_tag == TW_Denormal))) { - if ( denormal_operand() < 0 ) + if (denormal_operand() < 0) return; goto fprem_valid; } - else if ( (st0_tag == TAG_Empty) | (st1_tag == TAG_Empty) ) + else if ((st0_tag == TAG_Empty) | (st1_tag == TAG_Empty)) { FPU_stack_underflow(); return; } - else if ( st0_tag == TAG_Zero ) + else if (st0_tag == TAG_Zero) { - if ( st1_tag == TAG_Valid ) + if (st1_tag == TAG_Valid) { setcc(0); return; } - else if ( st1_tag == TW_Denormal ) + else if (st1_tag == TW_Denormal) { - if ( denormal_operand() < 0 ) + if (denormal_operand() < 0) return; setcc(0); return; } - else if ( st1_tag == TAG_Zero ) + else if (st1_tag == TAG_Zero) { arith_invalid(0); return; } /* fprem(?,0) always invalid */ - else if ( st1_tag == TW_Infinity ) + else if (st1_tag == TW_Infinity) { setcc(0); return; } } - else if ( (st0_tag == TAG_Valid) || (st0_tag == TW_Denormal) ) + else if ((st0_tag == TAG_Valid) || (st0_tag == TW_Denormal)) { - if ( st1_tag == TAG_Zero ) + if (st1_tag == TAG_Zero) { arith_invalid(0); /* fprem(Valid,Zero) is invalid */ return; } - else if ( st1_tag != TW_NaN ) + else if (st1_tag != TW_NaN) { - if ( ((st0_tag == TW_Denormal) || (st1_tag == TW_Denormal)) - && (denormal_operand() < 0) ) + if (((st0_tag == TW_Denormal) || (st1_tag == TW_Denormal)) + && (denormal_operand() < 0)) return; - if ( st1_tag == TW_Infinity ) + if (st1_tag == TW_Infinity) { /* fprem(Valid,Infinity) is o.k. */ setcc(0); return; } } } - else if ( st0_tag == TW_Infinity ) + else if (st0_tag == TW_Infinity) { - if ( st1_tag != TW_NaN ) + if (st1_tag != TW_NaN) { arith_invalid(0); /* fprem(Infinity,?) is invalid */ return; @@ -1159,8 +1159,8 @@ static void do_fprem(FPU_REG *st0_ptr, u_char st0_tag, int round) /* One of the registers must contain a NaN if we got here. */ #ifdef PARANOID - if ( (st0_tag != TW_NaN) && (st1_tag != TW_NaN) ) - EXCEPTION(EX_INTERNAL | 0x118); + if ((st0_tag != TW_NaN) && (st1_tag != TW_NaN)) + INTERNAL(0x118); #endif /* PARANOID */ real_2op_NaN(st1_ptr, st1_tag, 0, st1_ptr); @@ -1178,24 +1178,24 @@ static void fyl2x(FPU_REG *st0_ptr, u_char st0_tag) clear_C1(); - if ( (st0_tag == TAG_Valid) && (st1_tag == TAG_Valid) ) + if ((st0_tag == TAG_Valid) && (st1_tag == TAG_Valid)) { both_valid: /* Both regs are Valid or Denormal */ - if ( signpositive(st0_ptr) ) + if (signpositive(st0_ptr)) { - if ( st0_tag == TW_Denormal ) + if (st0_tag == TW_Denormal) FPU_to_exp16(st0_ptr, st0_ptr); else /* Convert st(0) for internal use. */ setexponent16(st0_ptr, exponent(st0_ptr)); - if ( (st0_ptr->sigh == 0x80000000) && (st0_ptr->sigl == 0) ) + if ((st0_ptr->sigh == 0x80000000) && (st0_ptr->sigl == 0)) { /* Special case. The result can be precise. */ u_char esign; e = exponent16(st0_ptr); - if ( e >= 0 ) + if (e >= 0) { exponent.sigh = e; esign = SIGN_POS; @@ -1211,14 +1211,14 @@ static void fyl2x(FPU_REG *st0_ptr, u_char st0_tag) stdexp(&exponent); setsign(&exponent, esign); tag = FPU_mul(&exponent, tag, 1, FULL_PRECISION); - if ( tag >= 0 ) + if (tag >= 0) FPU_settagi(1, tag); } else { /* The usual case */ sign = getsign(st1_ptr); - if ( st1_tag == TW_Denormal ) + if (st1_tag == TW_Denormal) FPU_to_exp16(st1_ptr, st1_ptr); else /* Convert st(1) for internal use. */ @@ -1229,7 +1229,7 @@ static void fyl2x(FPU_REG *st0_ptr, u_char st0_tag) else { /* negative */ - if ( arith_invalid(1) < 0 ) + if (arith_invalid(1) < 0) return; } @@ -1238,53 +1238,53 @@ static void fyl2x(FPU_REG *st0_ptr, u_char st0_tag) return; } - if ( st0_tag == TAG_Special ) + if (st0_tag == TAG_Special) st0_tag = FPU_Special(st0_ptr); - if ( st1_tag == TAG_Special ) + if (st1_tag == TAG_Special) st1_tag = FPU_Special(st1_ptr); - if ( (st0_tag == TAG_Empty) || (st1_tag == TAG_Empty) ) + if ((st0_tag == TAG_Empty) || (st1_tag == TAG_Empty)) { FPU_stack_underflow_pop(1); return; } - else if ( (st0_tag <= TW_Denormal) && (st1_tag <= TW_Denormal) ) + else if ((st0_tag <= TW_Denormal) && (st1_tag <= TW_Denormal)) { - if ( st0_tag == TAG_Zero ) + if (st0_tag == TAG_Zero) { - if ( st1_tag == TAG_Zero ) + if (st1_tag == TAG_Zero) { /* Both args zero is invalid */ - if ( arith_invalid(1) < 0 ) + if (arith_invalid(1) < 0) return; } else { u_char sign; sign = getsign(st1_ptr)^SIGN_NEG; - if ( FPU_divide_by_zero(1, sign) < 0 ) + if (FPU_divide_by_zero(1, sign) < 0) return; setsign(st1_ptr, sign); } } - else if ( st1_tag == TAG_Zero ) + else if (st1_tag == TAG_Zero) { /* st(1) contains zero, st(0) valid <> 0 */ /* Zero is the valid answer */ sign = getsign(st1_ptr); - if ( signnegative(st0_ptr) ) + if (signnegative(st0_ptr)) { /* log(negative) */ - if ( arith_invalid(1) < 0 ) + if (arith_invalid(1) < 0) return; } - else if ( (st0_tag == TW_Denormal) && (denormal_operand() < 0) ) + else if ((st0_tag == TW_Denormal) && (denormal_operand() < 0)) return; else { - if ( exponent(st0_ptr) < 0 ) + if (exponent(st0_ptr) < 0) sign ^= SIGN_NEG; FPU_copy_to_reg1(&CONST_Z, TAG_Zero); @@ -1294,30 +1294,30 @@ static void fyl2x(FPU_REG *st0_ptr, u_char st0_tag) else { /* One or both operands are denormals. */ - if ( denormal_operand() < 0 ) + if (denormal_operand() < 0) return; goto both_valid; } } - else if ( (st0_tag == TW_NaN) || (st1_tag == TW_NaN) ) + else if ((st0_tag == TW_NaN) || (st1_tag == TW_NaN)) { - if ( real_2op_NaN(st0_ptr, st0_tag, 1, st0_ptr) < 0 ) + if (real_2op_NaN(st0_ptr, st0_tag, 1, st0_ptr) < 0) return; } /* One or both arg must be an infinity */ - else if ( st0_tag == TW_Infinity ) + else if (st0_tag == TW_Infinity) { - if ( (signnegative(st0_ptr)) || (st1_tag == TAG_Zero) ) + if ((signnegative(st0_ptr)) || (st1_tag == TAG_Zero)) { /* log(-infinity) or 0*log(infinity) */ - if ( arith_invalid(1) < 0 ) + if (arith_invalid(1) < 0) return; } else { u_char sign = getsign(st1_ptr); - if ( (st1_tag == TW_Denormal) && (denormal_operand() < 0) ) + if ((st1_tag == TW_Denormal) && (denormal_operand() < 0)) return; FPU_copy_to_reg1(&CONST_INF, TAG_Special); @@ -1325,18 +1325,18 @@ static void fyl2x(FPU_REG *st0_ptr, u_char st0_tag) } } /* st(1) must be infinity here */ - else if ( ((st0_tag == TAG_Valid) || (st0_tag == TW_Denormal)) - && ( signpositive(st0_ptr) ) ) + else if (((st0_tag == TAG_Valid) || (st0_tag == TW_Denormal)) + && (signpositive(st0_ptr))) { - if ( exponent(st0_ptr) >= 0 ) + if (exponent(st0_ptr) >= 0) { - if ( (exponent(st0_ptr) == 0) && + if ((exponent(st0_ptr) == 0) && (st0_ptr->sigh == 0x80000000) && - (st0_ptr->sigl == 0) ) + (st0_ptr->sigl == 0)) { /* st(0) holds 1.0 */ /* infinity*log(1) */ - if ( arith_invalid(1) < 0 ) + if (arith_invalid(1) < 0) return; } /* else st(0) is positive and > 1.0 */ @@ -1345,7 +1345,7 @@ static void fyl2x(FPU_REG *st0_ptr, u_char st0_tag) { /* st(0) is positive and < 1.0 */ - if ( (st0_tag == TW_Denormal) && (denormal_operand() < 0) ) + if ((st0_tag == TW_Denormal) && (denormal_operand() < 0)) return; changesign(st1_ptr); @@ -1354,19 +1354,19 @@ static void fyl2x(FPU_REG *st0_ptr, u_char st0_tag) else { /* st(0) must be zero or negative */ - if ( st0_tag == TAG_Zero ) + if (st0_tag == TAG_Zero) { /* This should be invalid, but a real 80486 is happy with it. */ #ifndef PECULIAR_486 sign = getsign(st1_ptr); - if ( FPU_divide_by_zero(1, sign) < 0 ) + if (FPU_divide_by_zero(1, sign) < 0) return; #endif /* PECULIAR_486 */ changesign(st1_ptr); } - else if ( arith_invalid(1) < 0 ) /* log(negative) */ + else if (arith_invalid(1) < 0) /* log(negative) */ return; } @@ -1381,7 +1381,7 @@ static void fpatan(FPU_REG *st0_ptr, u_char st0_tag) int tag; clear_C1(); - if ( !((st0_tag ^ TAG_Valid) | (st1_tag ^ TAG_Valid)) ) + if (!((st0_tag ^ TAG_Valid) | (st1_tag ^ TAG_Valid))) { valid_atan: @@ -1392,39 +1392,39 @@ static void fpatan(FPU_REG *st0_ptr, u_char st0_tag) return; } - if ( st0_tag == TAG_Special ) + if (st0_tag == TAG_Special) st0_tag = FPU_Special(st0_ptr); - if ( st1_tag == TAG_Special ) + if (st1_tag == TAG_Special) st1_tag = FPU_Special(st1_ptr); - if ( ((st0_tag == TAG_Valid) && (st1_tag == TW_Denormal)) + if (((st0_tag == TAG_Valid) && (st1_tag == TW_Denormal)) || ((st0_tag == TW_Denormal) && (st1_tag == TAG_Valid)) - || ((st0_tag == TW_Denormal) && (st1_tag == TW_Denormal)) ) + || ((st0_tag == TW_Denormal) && (st1_tag == TW_Denormal))) { - if ( denormal_operand() < 0 ) + if (denormal_operand() < 0) return; goto valid_atan; } - else if ( (st0_tag == TAG_Empty) || (st1_tag == TAG_Empty) ) + else if ((st0_tag == TAG_Empty) || (st1_tag == TAG_Empty)) { FPU_stack_underflow_pop(1); return; } - else if ( (st0_tag == TW_NaN) || (st1_tag == TW_NaN) ) + else if ((st0_tag == TW_NaN) || (st1_tag == TW_NaN)) { - if ( real_2op_NaN(st0_ptr, st0_tag, 1, st0_ptr) >= 0 ) + if (real_2op_NaN(st0_ptr, st0_tag, 1, st0_ptr) >= 0) FPU_pop(); return; } - else if ( (st0_tag == TW_Infinity) || (st1_tag == TW_Infinity) ) + else if ((st0_tag == TW_Infinity) || (st1_tag == TW_Infinity)) { u_char sign = getsign(st1_ptr); - if ( st0_tag == TW_Infinity ) + if (st0_tag == TW_Infinity) { - if ( st1_tag == TW_Infinity ) + if (st1_tag == TW_Infinity) { - if ( signpositive(st0_ptr) ) + if (signpositive(st0_ptr)) { FPU_copy_to_reg1(&CONST_PI4, TAG_Valid); } @@ -1434,16 +1434,16 @@ static void fpatan(FPU_REG *st0_ptr, u_char st0_tag) tag = FPU_u_add(&CONST_PI4, &CONST_PI2, st1_ptr, FULL_PRECISION, SIGN_POS, exponent(&CONST_PI4), exponent(&CONST_PI2)); - if ( tag >= 0 ) + if (tag >= 0) FPU_settagi(1, tag); } } else { - if ( (st1_tag == TW_Denormal) && (denormal_operand() < 0) ) + if ((st1_tag == TW_Denormal) && (denormal_operand() < 0)) return; - if ( signpositive(st0_ptr) ) + if (signpositive(st0_ptr)) { FPU_copy_to_reg1(&CONST_Z, TAG_Zero); setsign(st1_ptr, sign); /* An 80486 preserves the sign */ @@ -1459,22 +1459,22 @@ static void fpatan(FPU_REG *st0_ptr, u_char st0_tag) else { /* st(1) is infinity, st(0) not infinity */ - if ( (st0_tag == TW_Denormal) && (denormal_operand() < 0) ) + if ((st0_tag == TW_Denormal) && (denormal_operand() < 0)) return; FPU_copy_to_reg1(&CONST_PI2, TAG_Valid); } setsign(st1_ptr, sign); } - else if ( st1_tag == TAG_Zero ) + else if (st1_tag == TAG_Zero) { /* st(0) must be valid or zero */ u_char sign = getsign(st1_ptr); - if ( (st0_tag == TW_Denormal) && (denormal_operand() < 0) ) + if ((st0_tag == TW_Denormal) && (denormal_operand() < 0)) return; - if ( signpositive(st0_ptr) ) + if (signpositive(st0_ptr)) { /* An 80486 preserves the sign */ FPU_pop(); @@ -1484,12 +1484,12 @@ static void fpatan(FPU_REG *st0_ptr, u_char st0_tag) FPU_copy_to_reg1(&CONST_PI, TAG_Valid); setsign(st1_ptr, sign); } - else if ( st0_tag == TAG_Zero ) + else if (st0_tag == TAG_Zero) { /* st(1) must be TAG_Valid here */ u_char sign = getsign(st1_ptr); - if ( (st1_tag == TW_Denormal) && (denormal_operand() < 0) ) + if ((st1_tag == TW_Denormal) && (denormal_operand() < 0)) return; FPU_copy_to_reg1(&CONST_PI2, TAG_Valid); @@ -1497,7 +1497,7 @@ static void fpatan(FPU_REG *st0_ptr, u_char st0_tag) } #ifdef PARANOID else - EXCEPTION(EX_INTERNAL | 0x125); + INTERNAL(0x125); #endif /* PARANOID */ FPU_pop(); @@ -1524,7 +1524,7 @@ static void fyl2xp1(FPU_REG *st0_ptr, u_char st0_tag) u_char st1_tag = FPU_gettagi(1); clear_C1(); - if ( !((st0_tag ^ TAG_Valid) | (st1_tag ^ TAG_Valid)) ) + if (!((st0_tag ^ TAG_Valid) | (st1_tag ^ TAG_Valid))) { valid_yl2xp1: @@ -1534,38 +1534,38 @@ static void fyl2xp1(FPU_REG *st0_ptr, u_char st0_tag) FPU_to_exp16(st0_ptr, &a); FPU_to_exp16(st1_ptr, &b); - if ( poly_l2p1(sign, sign1, &a, &b, st1_ptr) ) + if (poly_l2p1(sign, sign1, &a, &b, st1_ptr)) return; FPU_pop(); return; } - if ( st0_tag == TAG_Special ) + if (st0_tag == TAG_Special) st0_tag = FPU_Special(st0_ptr); - if ( st1_tag == TAG_Special ) + if (st1_tag == TAG_Special) st1_tag = FPU_Special(st1_ptr); - if ( ((st0_tag == TAG_Valid) && (st1_tag == TW_Denormal)) + if (((st0_tag == TAG_Valid) && (st1_tag == TW_Denormal)) || ((st0_tag == TW_Denormal) && (st1_tag == TAG_Valid)) - || ((st0_tag == TW_Denormal) && (st1_tag == TW_Denormal)) ) + || ((st0_tag == TW_Denormal) && (st1_tag == TW_Denormal))) { - if ( denormal_operand() < 0 ) + if (denormal_operand() < 0) return; goto valid_yl2xp1; } - else if ( (st0_tag == TAG_Empty) | (st1_tag == TAG_Empty) ) + else if ((st0_tag == TAG_Empty) | (st1_tag == TAG_Empty)) { FPU_stack_underflow_pop(1); return; } - else if ( st0_tag == TAG_Zero ) + else if (st0_tag == TAG_Zero) { - switch ( st1_tag ) + switch (st1_tag) { case TW_Denormal: - if ( denormal_operand() < 0 ) + if (denormal_operand() < 0) return; case TAG_Zero: @@ -1576,114 +1576,114 @@ static void fyl2xp1(FPU_REG *st0_ptr, u_char st0_tag) case TW_Infinity: /* Infinity*log(1) */ - if ( arith_invalid(1) < 0 ) + if (arith_invalid(1) < 0) return; break; case TW_NaN: - if ( real_2op_NaN(st0_ptr, st0_tag, 1, st0_ptr) < 0 ) + if (real_2op_NaN(st0_ptr, st0_tag, 1, st0_ptr) < 0) return; break; default: #ifdef PARANOID - EXCEPTION(EX_INTERNAL | 0x116); + INTERNAL(0x116); return; #endif /* PARANOID */ } } - else if ( (st0_tag == TAG_Valid) || (st0_tag == TW_Denormal) ) + else if ((st0_tag == TAG_Valid) || (st0_tag == TW_Denormal)) { - switch ( st1_tag ) + switch (st1_tag) { case TAG_Zero: - if ( signnegative(st0_ptr) ) + if (signnegative(st0_ptr)) { - if ( exponent(st0_ptr) >= 0 ) + if (exponent(st0_ptr) >= 0) { /* st(0) holds <= -1.0 */ #ifdef PECULIAR_486 /* Stupid 80486 doesn't worry about log(negative). */ changesign(st1_ptr); #else - if ( arith_invalid(1) < 0 ) + if (arith_invalid(1) < 0) return; #endif /* PECULIAR_486 */ } - else if ( (st0_tag == TW_Denormal) && (denormal_operand() < 0) ) + else if ((st0_tag == TW_Denormal) && (denormal_operand() < 0)) return; else changesign(st1_ptr); } - else if ( (st0_tag == TW_Denormal) && (denormal_operand() < 0) ) + else if ((st0_tag == TW_Denormal) && (denormal_operand() < 0)) return; break; case TW_Infinity: - if ( signnegative(st0_ptr) ) + if (signnegative(st0_ptr)) { - if ( (exponent(st0_ptr) >= 0) && + if ((exponent(st0_ptr) >= 0) && !((st0_ptr->sigh == 0x80000000) && - (st0_ptr->sigl == 0)) ) + (st0_ptr->sigl == 0))) { /* st(0) holds < -1.0 */ #ifdef PECULIAR_486 /* Stupid 80486 doesn't worry about log(negative). */ changesign(st1_ptr); #else - if ( arith_invalid(1) < 0 ) return; + if (arith_invalid(1) < 0) return; #endif /* PECULIAR_486 */ } - else if ( (st0_tag == TW_Denormal) && (denormal_operand() < 0) ) + else if ((st0_tag == TW_Denormal) && (denormal_operand() < 0)) return; else changesign(st1_ptr); } - else if ( (st0_tag == TW_Denormal) && (denormal_operand() < 0) ) + else if ((st0_tag == TW_Denormal) && (denormal_operand() < 0)) return; break; case TW_NaN: - if ( real_2op_NaN(st0_ptr, st0_tag, 1, st0_ptr) < 0 ) + if (real_2op_NaN(st0_ptr, st0_tag, 1, st0_ptr) < 0) return; } } - else if ( st0_tag == TW_NaN ) + else if (st0_tag == TW_NaN) { - if ( real_2op_NaN(st0_ptr, st0_tag, 1, st0_ptr) < 0 ) + if (real_2op_NaN(st0_ptr, st0_tag, 1, st0_ptr) < 0) return; } - else if ( st0_tag == TW_Infinity ) + else if (st0_tag == TW_Infinity) { - if ( st1_tag == TW_NaN ) + if (st1_tag == TW_NaN) { - if ( real_2op_NaN(st0_ptr, st0_tag, 1, st0_ptr) < 0 ) + if (real_2op_NaN(st0_ptr, st0_tag, 1, st0_ptr) < 0) return; } - else if ( signnegative(st0_ptr) ) + else if (signnegative(st0_ptr)) { #ifndef PECULIAR_486 /* This should have higher priority than denormals, but... */ - if ( arith_invalid(1) < 0 ) /* log(-infinity) */ + if (arith_invalid(1) < 0) /* log(-infinity) */ return; #endif /* PECULIAR_486 */ - if ( (st1_tag == TW_Denormal) && (denormal_operand() < 0) ) + if ((st1_tag == TW_Denormal) && (denormal_operand() < 0)) return; #ifdef PECULIAR_486 /* Denormal operands actually get higher priority */ - if ( arith_invalid(1) < 0 ) /* log(-infinity) */ + if (arith_invalid(1) < 0) /* log(-infinity) */ return; #endif /* PECULIAR_486 */ } - else if ( st1_tag == TAG_Zero ) + else if (st1_tag == TAG_Zero) { /* log(infinity) */ - if ( arith_invalid(1) < 0 ) + if (arith_invalid(1) < 0) return; } /* st(1) must be valid here. */ - else if ( (st1_tag == TW_Denormal) && (denormal_operand() < 0) ) + else if ((st1_tag == TW_Denormal) && (denormal_operand() < 0)) return; /* The Manual says that log(Infinity) is invalid, but a real @@ -1698,7 +1698,7 @@ static void fyl2xp1(FPU_REG *st0_ptr, u_char st0_tag) #ifdef PARANOID else { - EXCEPTION(EX_INTERNAL | 0x117); + INTERNAL(0x117); return; } #endif /* PARANOID */ @@ -1717,7 +1717,7 @@ static void fscale(FPU_REG *st0_ptr, u_char st0_tag) u_char sign = getsign(st0_ptr); clear_C1(); - if ( !((st0_tag ^ TAG_Valid) | (st1_tag ^ TAG_Valid)) ) + if (!((st0_tag ^ TAG_Valid) | (st1_tag ^ TAG_Valid))) { s32 scale; FPU_REG tmp; @@ -1727,11 +1727,11 @@ static void fscale(FPU_REG *st0_ptr, u_char st0_tag) valid_scale: - if ( exponent(st1_ptr) > 30 ) + if (exponent(st1_ptr) > 30) { /* 2^31 is far too large, would require 2^(2^30) or 2^(-2^30) */ - if ( signpositive(st1_ptr) ) + if (signpositive(st1_ptr)) { EXCEPTION(EX_Overflow); FPU_copy_to_reg0(&CONST_INF, TAG_Special); @@ -1761,25 +1761,25 @@ static void fscale(FPU_REG *st0_ptr, u_char st0_tag) return; } - if ( st0_tag == TAG_Special ) + if (st0_tag == TAG_Special) st0_tag = FPU_Special(st0_ptr); - if ( st1_tag == TAG_Special ) + if (st1_tag == TAG_Special) st1_tag = FPU_Special(st1_ptr); - if ( (st0_tag == TAG_Valid) || (st0_tag == TW_Denormal) ) + if ((st0_tag == TAG_Valid) || (st0_tag == TW_Denormal)) { - switch ( st1_tag ) + switch (st1_tag) { case TAG_Valid: /* st(0) must be a denormal */ - if ( (st0_tag == TW_Denormal) && (denormal_operand() < 0) ) + if ((st0_tag == TW_Denormal) && (denormal_operand() < 0)) return; FPU_to_exp16(st0_ptr, st0_ptr); /* Will not be left on stack */ goto valid_scale; case TAG_Zero: - if ( st0_tag == TW_Denormal ) + if (st0_tag == TW_Denormal) denormal_operand(); return; @@ -1788,10 +1788,10 @@ static void fscale(FPU_REG *st0_ptr, u_char st0_tag) return; case TW_Infinity: - if ( (st0_tag == TW_Denormal) && (denormal_operand() < 0) ) + if ((st0_tag == TW_Denormal) && (denormal_operand() < 0)) return; - if ( signpositive(st1_ptr) ) + if (signpositive(st1_ptr)) FPU_copy_to_reg0(&CONST_INF, TAG_Special); else FPU_copy_to_reg0(&CONST_Z, TAG_Zero); @@ -1803,9 +1803,9 @@ static void fscale(FPU_REG *st0_ptr, u_char st0_tag) return; } } - else if ( st0_tag == TAG_Zero ) + else if (st0_tag == TAG_Zero) { - switch ( st1_tag ) + switch (st1_tag) { case TAG_Valid: case TAG_Zero: @@ -1816,7 +1816,7 @@ static void fscale(FPU_REG *st0_ptr, u_char st0_tag) return; case TW_Infinity: - if ( signpositive(st1_ptr) ) + if (signpositive(st1_ptr)) arith_invalid(0); /* Zero scaled by +Infinity */ return; @@ -1825,9 +1825,9 @@ static void fscale(FPU_REG *st0_ptr, u_char st0_tag) return; } } - else if ( st0_tag == TW_Infinity ) + else if (st0_tag == TW_Infinity) { - switch ( st1_tag ) + switch (st1_tag) { case TAG_Valid: case TAG_Zero: @@ -1838,7 +1838,7 @@ static void fscale(FPU_REG *st0_ptr, u_char st0_tag) return; case TW_Infinity: - if ( signnegative(st1_ptr) ) + if (signnegative(st1_ptr)) arith_invalid(0); /* Infinity scaled by -Infinity */ return; @@ -1847,16 +1847,16 @@ static void fscale(FPU_REG *st0_ptr, u_char st0_tag) return; } } - else if ( st0_tag == TW_NaN ) + else if (st0_tag == TW_NaN) { - if ( st1_tag != TAG_Empty ) + if (st1_tag != TAG_Empty) { real_2op_NaN(st1_ptr, st1_tag, 0, st0_ptr); return; } } #ifdef PARANOID - if ( !((st0_tag == TAG_Empty) || (st1_tag == TAG_Empty)) ) + if (!((st0_tag == TAG_Empty) || (st1_tag == TAG_Empty))) { - EXCEPTION(EX_INTERNAL | 0x115); + INTERNAL(0x115); return; } #endif diff --git a/bochs/fpu/load_store.c b/bochs/fpu/load_store.c index d01ba597f..ecc74159f 100644 --- a/bochs/fpu/load_store.c +++ b/bochs/fpu/load_store.c @@ -1,6 +1,6 @@ /*---------------------------------------------------------------------------+ | load_store.c | - | $Id: load_store.c,v 1.11 2003-08-01 09:32:33 sshwarts Exp $ + | $Id: load_store.c,v 1.12 2003-10-04 12:32:56 sshwarts Exp $ | | | This file contains most of the code to interpret the FPU instructions | | which load and store from user memory. | @@ -45,22 +45,6 @@ static u_char const type_table[32] = { _NONE_, _REG0_, _NONE_, _REG0_ }; -#ifndef USE_WITH_CPU_SIM -u_char const data_sizes_16[32] = { - 4, 4, 8, 2, 0, 0, 0, 0, - 4, 4, 8, 2, 4, 4, 8, 2, - 14, 0, 94, 10, 2, 10, 0, 8, - 14, 0, 94, 10, 2, 10, 2, 8 -}; - -u_char const data_sizes_32[32] = { - 4, 4, 8, 2, 0, 0, 0, 0, - 4, 4, 8, 2, 4, 4, 8, 2, - 28, 0,108, 10, 2, 10, 0, 8, - 28, 0,108, 10, 2, 10, 2, 8 -}; -#endif - int FPU_load_store(u_char type, fpu_addr_modes addr_modes, bx_address data_address) { @@ -93,7 +77,7 @@ int FPU_load_store(u_char type, fpu_addr_modes addr_modes, return 0; #ifdef PARANOID default: - EXCEPTION(EX_INTERNAL|0x141); + INTERNAL(0x141); return 0; #endif /* PARANOID */ } diff --git a/bochs/fpu/poly_2xm1.c b/bochs/fpu/poly_2xm1.c index 3c7fe6317..996d2bdbe 100644 --- a/bochs/fpu/poly_2xm1.c +++ b/bochs/fpu/poly_2xm1.c @@ -1,6 +1,6 @@ /*---------------------------------------------------------------------------+ | poly_2xm1.c | - | $Id: poly_2xm1.c,v 1.4 2001-10-06 03:53:46 bdenney Exp $ + | $Id: poly_2xm1.c,v 1.5 2003-10-04 12:32:56 sshwarts Exp $ | | | Function to compute 2^x-1 by a polynomial approximation. | | | @@ -65,7 +65,7 @@ int poly_2xm1(u_char sign, FPU_REG *arg, FPU_REG *result) if ( exponent >= 0 ) /* Don't want a |number| >= 1.0 */ { /* Number negative, too large, or not Valid. */ - EXCEPTION(EX_INTERNAL|0x127); + INTERNAL(0x127); return 1; } #endif /* PARANOID */ diff --git a/bochs/fpu/poly_atan.c b/bochs/fpu/poly_atan.c index c958a522a..3e892df41 100644 --- a/bochs/fpu/poly_atan.c +++ b/bochs/fpu/poly_atan.c @@ -1,6 +1,6 @@ /*---------------------------------------------------------------------------+ | poly_atan.c | - | $Id: poly_atan.c,v 1.4 2001-10-06 03:53:46 bdenney Exp $ + | $Id: poly_atan.c,v 1.5 2003-10-04 12:32:56 sshwarts Exp $ | | | Compute the arctan of a FPU_REG, using a polynomial approximation. | | | @@ -121,7 +121,7 @@ void poly_atan(FPU_REG *st0_ptr, u_char st0_tag, (argSignif.lsw == 0) && (argSignif.midw == 0) && (argSignif.msw == 0x80000000) ) ) { - EXCEPTION(EX_INTERNAL|0x104); /* There must be a logic error */ + INTERNAL(0x104); /* There must be a logic error */ return; } #endif /* PARANOID */ diff --git a/bochs/fpu/poly_sin.c b/bochs/fpu/poly_sin.c index d9010b639..8d1a85606 100644 --- a/bochs/fpu/poly_sin.c +++ b/bochs/fpu/poly_sin.c @@ -1,6 +1,6 @@ /*---------------------------------------------------------------------------+ | poly_sin.c | - | $Id: poly_sin.c,v 1.4 2001-10-06 03:53:46 bdenney Exp $ + | $Id: poly_sin.c,v 1.5 2003-10-04 12:32:56 sshwarts Exp $ | | | Computation of an approximation of the sin function and the cosine | | function by a polynomial. | @@ -198,7 +198,7 @@ void poly_sine(FPU_REG *st0_ptr) if ( (exponent(&result) >= 0) && (significand(&result) > BX_CONST64(0x8000000000000000)) ) { - EXCEPTION(EX_INTERNAL|0x150); + INTERNAL(0x150); } #endif /* PARANOID */ @@ -391,7 +391,7 @@ void poly_cos(FPU_REG *st0_ptr) if ( (exponent(&result) >= 0) && (significand(&result) > BX_CONST64(0x8000000000000000)) ) { - EXCEPTION(EX_INTERNAL|0x151); + INTERNAL(0x151); } #endif /* PARANOID */ diff --git a/bochs/fpu/reg_add_sub.c b/bochs/fpu/reg_add_sub.c index 0a073d5b8..878df2f82 100644 --- a/bochs/fpu/reg_add_sub.c +++ b/bochs/fpu/reg_add_sub.c @@ -1,6 +1,6 @@ /*---------------------------------------------------------------------------+ | reg_add_sub.c | - | $Id: reg_add_sub.c,v 1.7 2003-05-24 15:04:55 vruppert Exp $ + | $Id: reg_add_sub.c,v 1.8 2003-10-04 12:32:56 sshwarts Exp $ | | | Functions to add or subtract two registers and put the result in a third. | | | @@ -232,7 +232,7 @@ int FPU_sub(int flags, FPU_REG *rm, u16 control_w) break; #ifdef PARANOID default: - EXCEPTION(EX_INTERNAL|0x111); + INTERNAL(0x111); return -1; #endif } @@ -373,7 +373,7 @@ int add_sub_specials_core(FPU_REG const *a, u_char taga, u_char signa, } #ifdef PARANOID - EXCEPTION(EX_INTERNAL|0x101); + INTERNAL(0x101); #endif return FPU_Exception; diff --git a/bochs/fpu/reg_compare.c b/bochs/fpu/reg_compare.c index 40d8dffd0..48653438d 100644 --- a/bochs/fpu/reg_compare.c +++ b/bochs/fpu/reg_compare.c @@ -1,6 +1,6 @@ /*---------------------------------------------------------------------------+ | reg_compare.c | - | $Id: reg_compare.c,v 1.5 2003-07-31 21:07:38 sshwarts Exp $ + | $Id: reg_compare.c,v 1.6 2003-10-04 12:32:56 sshwarts Exp $ | | | Compare two floating point registers | | | @@ -201,7 +201,7 @@ int FPU_compare_st_data(FPU_REG const *loaded_data, u_char loaded_tag) break; #ifdef PARANOID default: - EXCEPTION(EX_INTERNAL|0x121); + INTERNAL(0x121); f = SW_C3 | SW_C2 | SW_C0; break; #endif /* PARANOID */ @@ -253,7 +253,7 @@ static int compare_st_st(int nr) break; #ifdef PARANOID default: - EXCEPTION(EX_INTERNAL|0x122); + INTERNAL(0x122); f = SW_C3 | SW_C2 | SW_C0; break; #endif /* PARANOID */ @@ -310,7 +310,7 @@ static int compare_u_st_st(int nr) break; #ifdef PARANOID default: - EXCEPTION(EX_INTERNAL|0x123); + INTERNAL(0x123); f = SW_C3 | SW_C2 | SW_C0; break; #endif /* PARANOID */ diff --git a/bochs/fpu/reg_convert.c b/bochs/fpu/reg_convert.c index 07797aca0..3dafb762c 100644 --- a/bochs/fpu/reg_convert.c +++ b/bochs/fpu/reg_convert.c @@ -1,6 +1,6 @@ /*---------------------------------------------------------------------------+ | reg_convert.c | - | $Id: reg_convert.c,v 1.4 2003-03-04 21:46:49 cbothamy Exp $ + | $Id: reg_convert.c,v 1.5 2003-10-04 12:32:56 sshwarts Exp $ | | | Convert register representation. | | | @@ -51,7 +51,7 @@ FPU_to_exp16(FPU_REG const *a, FPU_REG *x) if ( !(x->sigh & 0x80000000) ) { - EXCEPTION(EX_INTERNAL | 0x180); + INTERNAL(0x180); } return sign; diff --git a/bochs/fpu/reg_divide.c b/bochs/fpu/reg_divide.c index 8ccac6bb8..835b370a6 100644 --- a/bochs/fpu/reg_divide.c +++ b/bochs/fpu/reg_divide.c @@ -1,6 +1,6 @@ /*---------------------------------------------------------------------------+ | reg_divide.c | - | $Id: reg_divide.c,v 1.4 2001-10-06 03:53:46 bdenney Exp $ + | $Id: reg_divide.c,v 1.5 2003-10-04 12:32:56 sshwarts Exp $ | | | Divide one FPU_REG by another and put the result in a destination FPU_REG.| | | @@ -201,7 +201,7 @@ int FPU_div(int flags, FPU_REG *rm, int control_w) #ifdef PARANOID else { - EXCEPTION(EX_INTERNAL|0x102); + INTERNAL(0x102); return FPU_Exception; } #endif /* PARANOID */ diff --git a/bochs/fpu/reg_ld_str.c b/bochs/fpu/reg_ld_str.c index 064dbbcf0..20cd8fdb3 100644 --- a/bochs/fpu/reg_ld_str.c +++ b/bochs/fpu/reg_ld_str.c @@ -1,6 +1,6 @@ /*---------------------------------------------------------------------------+ | reg_ld_str.c | - | $Id: reg_ld_str.c,v 1.15 2003-10-03 17:39:04 sshwarts Exp $ + | $Id: reg_ld_str.c,v 1.16 2003-10-04 12:32:56 sshwarts Exp $ | | | All of the functions which transfer data between user memory and FPU_REGs.| | | @@ -867,7 +867,7 @@ FPU_store_single(FPU_REG *st0_ptr, u_char st0_tag, bx_address single) #ifdef PARANOID else { - EXCEPTION(EX_INTERNAL|0x164); + INTERNAL(0x164); return 0; } #endif @@ -892,7 +892,7 @@ FPU_store_single(FPU_REG *st0_ptr, u_char st0_tag, bx_address single) #ifdef PARANOID else { - EXCEPTION(EX_INTERNAL|0x163); + INTERNAL(0x163); return 0; } #endif diff --git a/bochs/fpu/reg_mul.c b/bochs/fpu/reg_mul.c index 96d830df4..0633fd3c7 100644 --- a/bochs/fpu/reg_mul.c +++ b/bochs/fpu/reg_mul.c @@ -1,6 +1,6 @@ /*---------------------------------------------------------------------------+ | reg_mul.c | - | $Id: reg_mul.c,v 1.3 2001-10-06 03:53:46 bdenney Exp $ + | $Id: reg_mul.c,v 1.4 2003-10-04 12:32:56 sshwarts Exp $ | | | Multiply one FPU_REG by another, put the result in a destination FPU_REG. | | | @@ -124,7 +124,7 @@ int FPU_mul(FPU_REG const *b, u_char tagb, int deststnr, int control_w) #ifdef PARANOID else { - EXCEPTION(EX_INTERNAL|0x102); + INTERNAL(0x102); return FPU_Exception; } #endif /* PARANOID */ diff --git a/bochs/fpu/reg_round.c b/bochs/fpu/reg_round.c index 01e7056c5..9e793548d 100644 --- a/bochs/fpu/reg_round.c +++ b/bochs/fpu/reg_round.c @@ -1,6 +1,6 @@ /*---------------------------------------------------------------------------+ | reg_round.c | - | $Id: reg_round.c,v 1.5 2003-05-15 16:11:29 sshwarts Exp $ + | $Id: reg_round.c,v 1.6 2003-10-04 12:32:56 sshwarts Exp $ | | | Rounding/truncation/etc for FPU basic arithmetic functions. | | | @@ -234,7 +234,7 @@ int FPU_round(FPU_REG *x, u32 extent, int dummy, u16 control_w, u8 sign) /* With the precision control bits set to 01 "(reserved)", a real 80486 behaves as if the precision control bits were set to 11 "64 bits" */ #ifdef PARANOID - EXCEPTION(EX_INTERNAL|0x236); + INTERNAL(0x236); return -1; #endif #endif @@ -295,7 +295,7 @@ int FPU_round(FPU_REG *x, u32 extent, int dummy, u16 control_w, u8 sign) break; default: - EXCEPTION(EX_INTERNAL|0x231); + INTERNAL(0x231); return -1; } } @@ -366,7 +366,7 @@ int FPU_round(FPU_REG *x, u32 extent, int dummy, u16 control_w, u8 sign) break; default: - EXCEPTION(EX_INTERNAL|0x231); + INTERNAL(0x231); return -1; } } @@ -439,7 +439,7 @@ int FPU_round(FPU_REG *x, u32 extent, int dummy, u16 control_w, u8 sign) break; default: - EXCEPTION(EX_INTERNAL|0x231); + INTERNAL(0x231); return -1; } } @@ -449,7 +449,7 @@ int FPU_round(FPU_REG *x, u32 extent, int dummy, u16 control_w, u8 sign) default: #ifdef PARANOID - EXCEPTION(EX_INTERNAL|0x230); + INTERNAL(0x230); return -1; #endif break; @@ -473,7 +473,7 @@ int FPU_round(FPU_REG *x, u32 extent, int dummy, u16 control_w, u8 sign) { if (x->exp != EXP_UNDER+1) { - EXCEPTION(EX_INTERNAL|0x234); + INTERNAL(0x234); } if ((x->sigh == 0) && (x->sigl == 0)) { diff --git a/bochs/fpu/reg_u_add.c b/bochs/fpu/reg_u_add.c index d532c671e..6dfd6841d 100644 --- a/bochs/fpu/reg_u_add.c +++ b/bochs/fpu/reg_u_add.c @@ -1,6 +1,6 @@ /*---------------------------------------------------------------------------+ | reg_u_add.c | - | $Id: reg_u_add.c,v 1.4 2003-04-20 19:20:08 sshwarts Exp $ + | $Id: reg_u_add.c,v 1.5 2003-10-04 12:32:56 sshwarts Exp $ | | | Add two valid (TAG_Valid) FPU_REG numbers, of the same sign, and put the | | result in a destination FPU_REG. | @@ -52,7 +52,7 @@ int FPU_u_add(const FPU_REG *arg1, const FPU_REG *arg2, FPU_REG *answ, #ifdef PARANOID if (!(arg1->sigh & 0x80000000) || !(arg2->sigh & 0x80000000)) { - EXCEPTION(EX_INTERNAL|0x201); + INTERNAL(0x201); return -1; } #endif diff --git a/bochs/fpu/reg_u_div.c b/bochs/fpu/reg_u_div.c index 99c19e61a..5114abc4d 100644 --- a/bochs/fpu/reg_u_div.c +++ b/bochs/fpu/reg_u_div.c @@ -1,6 +1,6 @@ /*---------------------------------------------------------------------------+ | reg_u_div.c | - | $Id: reg_u_div.c,v 1.4 2003-04-20 19:20:08 sshwarts Exp $ + | $Id: reg_u_div.c,v 1.5 2003-10-04 12:32:56 sshwarts Exp $ | | | Divide one FPU_REG by another and put the result in a destination FPU_REG.| | | @@ -46,7 +46,7 @@ int FPU_u_div(const FPU_REG *a, const FPU_REG *b, FPU_REG *dest, #ifdef PARANOID if (!(b->sigh & 0x80000000)) { - EXCEPTION(EX_INTERNAL|0x202); + INTERNAL(0x202); } #endif @@ -122,7 +122,7 @@ int FPU_u_div(const FPU_REG *a, const FPU_REG *b, FPU_REG *dest, #ifdef PARANOID if (work32 != 1) { - EXCEPTION(EX_INTERNAL|0x203); + INTERNAL(0x203); } #endif @@ -137,7 +137,7 @@ int FPU_u_div(const FPU_REG *a, const FPU_REG *b, FPU_REG *dest, #ifdef PARANOID if ((accum64 >> 32)) { - EXCEPTION(EX_INTERNAL|0x203); + INTERNAL(0x203); } #endif } @@ -177,7 +177,7 @@ int FPU_u_div(const FPU_REG *a, const FPU_REG *b, FPU_REG *dest, #ifdef PARANOID if (work32 != 1) { - EXCEPTION(EX_INTERNAL|0x203); + INTERNAL(0x203); } #endif @@ -194,7 +194,7 @@ int FPU_u_div(const FPU_REG *a, const FPU_REG *b, FPU_REG *dest, #ifdef PARANOID if ((accum64 >> 32)) { - EXCEPTION(EX_INTERNAL|0x203); + INTERNAL(0x203); } #endif } @@ -214,7 +214,7 @@ int FPU_u_div(const FPU_REG *a, const FPU_REG *b, FPU_REG *dest, /* No overflow should be possible here */ if (rat1 == 0) { - EXCEPTION(EX_INTERNAL|0x203); + INTERNAL(0x203); } } #endif diff --git a/bochs/fpu/reg_u_mul.c b/bochs/fpu/reg_u_mul.c index 8ec0c1cbd..3c17dc821 100644 --- a/bochs/fpu/reg_u_mul.c +++ b/bochs/fpu/reg_u_mul.c @@ -1,6 +1,6 @@ /*---------------------------------------------------------------------------+ | reg_u_mul.c | - | $Id: reg_u_mul.c,v 1.5 2003-05-15 16:11:29 sshwarts Exp $ + | $Id: reg_u_mul.c,v 1.6 2003-10-04 12:32:56 sshwarts Exp $ | | | Core multiplication routine | | | @@ -33,7 +33,7 @@ int FPU_u_mul(const FPU_REG *a, const FPU_REG *b, FPU_REG *c, u16 cw, #ifdef PARANOID if (! (a->sigh & 0x80000000) || ! (b->sigh & 0x80000000)) { - EXCEPTION(EX_INTERNAL|0x205); + INTERNAL(0x205); } #endif diff --git a/bochs/fpu/reg_u_sub.c b/bochs/fpu/reg_u_sub.c index 74b249bd7..ac09ab8cf 100644 --- a/bochs/fpu/reg_u_sub.c +++ b/bochs/fpu/reg_u_sub.c @@ -1,6 +1,6 @@ /*---------------------------------------------------------------------------+ | reg_u_sub.c | - | $Id: reg_u_sub.c,v 1.5 2003-05-15 16:11:29 sshwarts Exp $ + | $Id: reg_u_sub.c,v 1.6 2003-10-04 12:32:56 sshwarts Exp $ | | | Core floating point subtraction routine. | | | @@ -39,7 +39,7 @@ int FPU_u_sub(const FPU_REG *arg1, const FPU_REG *arg2, FPU_REG *dest, #ifdef PARANOID if (ediff < 0) { - EXCEPTION(EX_INTERNAL|0x206); + INTERNAL(0x206); return -1; } #endif @@ -49,7 +49,7 @@ int FPU_u_sub(const FPU_REG *arg1, const FPU_REG *arg2, FPU_REG *dest, #ifdef PARANOID if (!(arg1->sigh & 0x80000000) || !(arg2->sigh & 0x80000000)) { - EXCEPTION(EX_INTERNAL|0x209); + INTERNAL(0x209); return -1; } #endif @@ -147,7 +147,7 @@ int FPU_u_sub(const FPU_REG *arg1, const FPU_REG *arg2, FPU_REG *dest, if (borrow) { /* This can only occur if the code is bugged */ - EXCEPTION(EX_INTERNAL|0x212); + INTERNAL(0x212); return -1; } #endif @@ -184,7 +184,7 @@ int FPU_u_sub(const FPU_REG *arg1, const FPU_REG *arg2, FPU_REG *dest, if (extent != 0x80000000) { /* This can only occur if the code is bugged */ - EXCEPTION(EX_INTERNAL|0x210); + INTERNAL(0x210); return -1; } dest->sigh = extent; diff --git a/bochs/fpu/wm_sqrt.c b/bochs/fpu/wm_sqrt.c index f24926b4b..da65a7a03 100644 --- a/bochs/fpu/wm_sqrt.c +++ b/bochs/fpu/wm_sqrt.c @@ -1,6 +1,6 @@ /*---------------------------------------------------------------------------+ | wm_sqrt.c | - | $Id: wm_sqrt.c,v 1.3 2001-10-06 03:53:46 bdenney Exp $ + | $Id: wm_sqrt.c,v 1.4 2003-10-04 12:32:56 sshwarts Exp $ | | | Fixed point arithmetic square root evaluation. | | | @@ -100,7 +100,7 @@ int wm_sqrt(FPU_REG *n, s32 dummy1, s32 dummy2, u16 control_w, u8 sign) #ifdef PARANOID if ( (n->sigh != 0xffffffff) && (n->sigl != 0xffffffff) ) { - EXCEPTION(EX_INTERNAL|0x213); + INTERNAL(0x213); } #endif /* We know the answer here. */ @@ -155,7 +155,7 @@ int wm_sqrt(FPU_REG *n, s32 dummy1, s32 dummy2, u16 control_w, u8 sign) #ifdef PARANOID if ( (diff >> 32) != 0 ) { - EXCEPTION(EX_INTERNAL|0x207); + INTERNAL(0x207); } #endif @@ -255,7 +255,7 @@ int wm_sqrt(FPU_REG *n, s32 dummy1, s32 dummy2, u16 control_w, u8 sign) #ifdef PARANOID if ( ((s32)work32 > 3*ERR_MARGIN) || ((s32)work32 < -3*ERR_MARGIN) ) { - EXCEPTION(EX_INTERNAL|0x214); + INTERNAL(0x214); } #endif @@ -315,7 +315,7 @@ int wm_sqrt(FPU_REG *n, s32 dummy1, s32 dummy2, u16 control_w, u8 sign) #ifdef PARANOID if ( ((s32)work32 > 4*3*ERR_MARGIN) || ((s32)work32 < -4*3*ERR_MARGIN) ) { - EXCEPTION(EX_INTERNAL|0x215); + INTERNAL(0x215); } #endif