From b514c71079535f7140f6044177f1d32923909917 Mon Sep 17 00:00:00 2001 From: Christophe Bothamy Date: Fri, 3 Jan 2003 00:20:05 +0000 Subject: [PATCH] - apply patch [ 658950 ] Bug in FPU Here are comments from the anonymous patch author : I found bug when using the FPU in 16 bit protected mode. When using the fsave command the 32bit structures were used instead of the 16bit ones. It now distinguishes between 16 and 32 bit protected mode which wasn't the case before. Now Ultima8 runs fine:) --- bochs/fpu/wmFPUemu_glue.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/bochs/fpu/wmFPUemu_glue.cc b/bochs/fpu/wmFPUemu_glue.cc index 6ea5cf1d4..c2fe9ce79 100644 --- a/bochs/fpu/wmFPUemu_glue.cc +++ b/bochs/fpu/wmFPUemu_glue.cc @@ -86,6 +86,8 @@ BX_CPU_C::fpu_execute(bxInstruction_c *i) fpu_cpu_ptr = this; current_i387 = &(BX_CPU_THIS_PTR the_i387); + is_32 = BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].cache.u.segment.d_b; + #if 0 addr_modes.default_mode = VM86; addr_modes.default_mode = 0; // FPU_CS == __USER_CS && FPU_DS == __USER_DS @@ -93,7 +95,8 @@ BX_CPU_C::fpu_execute(bxInstruction_c *i) addr_modes.default_mode = PM16; #endif if (protected_mode()) { - addr_modes.default_mode = SEG32; + if (is_32) addr_modes.default_mode = SEG32; + else addr_modes.default_mode = PM16; } else if (v8086_mode()) { addr_modes.default_mode = VM86; @@ -107,7 +110,6 @@ BX_CPU_C::fpu_execute(bxInstruction_c *i) // Mark if instruction used opsize or addrsize prefixes // Actually, addr_modes.override.address_size is not used, // could delete that code. - is_32 = BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].cache.u.segment.d_b; if (i->as32B() == is_32) addr_modes.override.address_size = 0; else