diff --git a/bochs/cpu/i387.h b/bochs/cpu/i387.h index f93b3ce36..b6c3622b0 100644 --- a/bochs/cpu/i387.h +++ b/bochs/cpu/i387.h @@ -71,6 +71,8 @@ struct bx_fpu_reg_t { } GCC_ATTRIBUTE((aligned(16), packed)); #endif +typedef struct bx_fpu_reg_t FPU_REG; + #define BX_FPU_REG(index) \ (BX_CPU_THIS_PTR the_i387.st_space[index*2]) @@ -80,6 +82,14 @@ struct bx_fpu_reg_t { #define FPU_SW_SUMMARY (0x0080) /* exception summary */ +#ifdef __cplusplus +extern "C" +{ +#endif + int FPU_tagof(FPU_REG *reg) BX_CPP_AttrRegparmN(1); +#ifdef __cplusplus +} +#endif #if BX_SUPPORT_MMX diff --git a/bochs/cpu/sse_move.cc b/bochs/cpu/sse_move.cc index 0cc68bb4c..988212e51 100644 --- a/bochs/cpu/sse_move.cc +++ b/bochs/cpu/sse_move.cc @@ -265,14 +265,7 @@ void BX_CPU_C::FXRSTOR(bxInstruction_c *i) { if(tag_byte & tag_byte_mask) { bx_fpu_reg_t *fpu_reg = (bx_fpu_reg_t *) &(BX_FPU_REG(index)); - - if (fpu_reg->exp == 0) { - if(!(fpu_reg->sigl | fpu_reg->sigh)) twd |= FPU_TAG_ZERO; - else twd |= FPU_TAG_SPECIAL; - } - else if (fpu_reg->exp == 0x7fff) twd |= FPU_TAG_SPECIAL; - else if (fpu_reg->sigh & 0x80000000) twd |= FPU_TAG_VALID; - else twd |= FPU_TAG_SPECIAL; + twd = FPU_tagof(fpu_reg); } else { twd |= FPU_TAG_EMPTY; diff --git a/bochs/fpu/fpu_emu.h b/bochs/fpu/fpu_emu.h index 72c9fccb1..9f98cdbb5 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.19 2003-10-05 12:26:11 sshwarts Exp $ + | $Id: fpu_emu.h,v 1.20 2003-10-25 10:32:54 sshwarts Exp $ | | | Copyright (C) 1992,1993,1994,1997 | | W. Metzenthen, 22 Parker St, Ormond, Vic 3163, | @@ -64,8 +64,6 @@ #include "fpu_system.h" -typedef struct bx_fpu_reg_t FPU_REG; - /* #define RE_ENTRANT_CHECKING */ diff --git a/bochs/fpu/reg_ld_str.c b/bochs/fpu/reg_ld_str.c index 864c72312..8ea65c56b 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.17 2003-10-04 16:47:57 sshwarts Exp $ + | $Id: reg_ld_str.c,v 1.18 2003-10-25 10:32:54 sshwarts Exp $ | | | All of the functions which transfer data between user memory and FPU_REGs.| | | @@ -60,15 +60,12 @@ normalize_no_excep(FPU_REG *r, int exp, int sign) } -int BX_CPP_AttrRegparmN(1) -FPU_tagof(FPU_REG *ptr) +int BX_CPP_AttrRegparmN(1) FPU_tagof(FPU_REG *reg) { - int exp; - - exp = exponent16(ptr) & 0x7fff; + int exp = exponent16(reg) & 0x7fff; if (exp == 0) { - if (!(ptr->sigh | ptr->sigl)) + if (!(reg->sigh | reg->sigl)) { return TAG_Zero; } @@ -82,7 +79,7 @@ FPU_tagof(FPU_REG *ptr) return TAG_Special; } - if (!(ptr->sigh & 0x80000000)) + if (!(reg->sigh & 0x80000000)) { /* Unsupported data type. */ /* Valid numbers have the ms bit set to 1. */ @@ -93,7 +90,6 @@ FPU_tagof(FPU_REG *ptr) return TAG_Valid; } - /* Get a long double from user memory */ int BX_CPP_AttrRegparmN(2) FPU_load_extended(bx_address s, int stnr)