From dc5c25133f7fed482ca51bc193b591dbe24df0ee Mon Sep 17 00:00:00 2001 From: Stanislav Shwartsman Date: Tue, 13 Nov 2007 21:07:08 +0000 Subject: [PATCH] Fixes in registers read/write -> fixed zero upper of register in POP_Ed --- bochs/cpu/arith16.cc | 6 +++--- bochs/cpu/arith32.cc | 6 +++--- bochs/cpu/flag_ctrl.cc | 5 +---- bochs/cpu/stack16.cc | 6 +++--- bochs/cpu/stack32.cc | 6 +++--- 5 files changed, 13 insertions(+), 16 deletions(-) diff --git a/bochs/cpu/arith16.cc b/bochs/cpu/arith16.cc index 90861ea79..5b94d73a1 100644 --- a/bochs/cpu/arith16.cc +++ b/bochs/cpu/arith16.cc @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////// -// $Id: arith16.cc,v 1.48 2007-11-08 18:21:37 sshwarts Exp $ +// $Id: arith16.cc,v 1.49 2007-11-13 21:07:07 sshwarts Exp $ ///////////////////////////////////////////////////////////////////////// // // Copyright (C) 2001 MandrakeSoft S.A. @@ -33,13 +33,13 @@ void BX_CPU_C::INC_RX(bxInstruction_c *i) { - Bit16u rx = ++ BX_CPU_THIS_PTR gen_reg[i->opcodeReg()].word.rx; + Bit16u rx = ++BX_READ_16BIT_REG(i->opcodeReg()); SET_FLAGS_OSZAP_RESULT_16(rx, BX_INSTR_INC16); } void BX_CPU_C::DEC_RX(bxInstruction_c *i) { - Bit16u rx = -- BX_CPU_THIS_PTR gen_reg[i->opcodeReg()].word.rx; + Bit16u rx = --BX_READ_16BIT_REG(i->opcodeReg()); SET_FLAGS_OSZAP_RESULT_16(rx, BX_INSTR_DEC16); } diff --git a/bochs/cpu/arith32.cc b/bochs/cpu/arith32.cc index 7003804d3..ee13f1080 100644 --- a/bochs/cpu/arith32.cc +++ b/bochs/cpu/arith32.cc @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////// -// $Id: arith32.cc,v 1.54 2007-11-06 08:39:25 sshwarts Exp $ +// $Id: arith32.cc,v 1.55 2007-11-13 21:07:07 sshwarts Exp $ ///////////////////////////////////////////////////////////////////////// // // Copyright (C) 2001 MandrakeSoft S.A. @@ -43,7 +43,7 @@ void BX_CPU_C::INC_ERX(bxInstruction_c *i) { unsigned opcodeReg = i->opcodeReg(); - Bit32u erx = ++ BX_CPU_THIS_PTR gen_reg[opcodeReg].dword.erx; + Bit32u erx = ++ BX_READ_32BIT_REG(opcodeReg); SET_FLAGS_OSZAP_RESULT_32(erx, BX_INSTR_INC32); BX_CLEAR_64BIT_HIGH(opcodeReg); @@ -53,7 +53,7 @@ void BX_CPU_C::DEC_ERX(bxInstruction_c *i) { unsigned opcodeReg = i->opcodeReg(); - Bit32u erx = -- BX_CPU_THIS_PTR gen_reg[opcodeReg].dword.erx; + Bit32u erx = -- BX_READ_32BIT_REG(opcodeReg); SET_FLAGS_OSZAP_RESULT_32(erx, BX_INSTR_DEC32); BX_CLEAR_64BIT_HIGH(opcodeReg); diff --git a/bochs/cpu/flag_ctrl.cc b/bochs/cpu/flag_ctrl.cc index 0a1e38d02..3f23e043c 100644 --- a/bochs/cpu/flag_ctrl.cc +++ b/bochs/cpu/flag_ctrl.cc @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////// -// $Id: flag_ctrl.cc,v 1.28 2007-11-07 10:40:40 sshwarts Exp $ +// $Id: flag_ctrl.cc,v 1.29 2007-11-13 21:07:07 sshwarts Exp $ ///////////////////////////////////////////////////////////////////////// // // Copyright (C) 2002 MandrakeSoft S.A. @@ -214,7 +214,6 @@ void BX_CPU_C::POPF_Fw(bxInstruction_c *i) if ((BX_CPU_THIS_PTR get_IOPL() < 3) && (CR4_VME_ENABLED == 0)) { BX_DEBUG(("POPFW: #GP(0) in v8086 (no VME) mode")); exception(BX_GP_EXCEPTION, 0, 0); - return; } pop_16(&flags16); #if BX_SUPPORT_VME @@ -252,7 +251,6 @@ void BX_CPU_C::PUSHF_Fd(bxInstruction_c *i) if (v8086_mode() && (BX_CPU_THIS_PTR get_IOPL()<3)) { BX_DEBUG(("PUSHFD: #GP(0) in v8086 mode")); exception(BX_GP_EXCEPTION, 0, 0); - return; } // VM & RF flags cleared in image stored on the stack @@ -284,7 +282,6 @@ void BX_CPU_C::POPF_Fd(bxInstruction_c *i) if (BX_CPU_THIS_PTR get_IOPL() < 3) { BX_DEBUG(("POPFD: #GP(0) in v8086 mode")); exception(BX_GP_EXCEPTION, 0, 0); - return; } pop_32(&flags32); // v8086-mode: VM, IOPL, VIP, VIF are unaffected diff --git a/bochs/cpu/stack16.cc b/bochs/cpu/stack16.cc index b56a4d567..66d1aa691 100644 --- a/bochs/cpu/stack16.cc +++ b/bochs/cpu/stack16.cc @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////// -// $Id: stack16.cc,v 1.21 2007-03-02 21:03:23 sshwarts Exp $ +// $Id: stack16.cc,v 1.22 2007-11-13 21:07:07 sshwarts Exp $ ///////////////////////////////////////////////////////////////////////// // // Copyright (C) 2001 MandrakeSoft S.A. @@ -33,7 +33,7 @@ void BX_CPU_C::PUSH_RX(bxInstruction_c *i) { - push_16(BX_CPU_THIS_PTR gen_reg[i->opcodeReg()].word.rx); + push_16(BX_READ_16BIT_REG(i->opcodeReg())); } void BX_CPU_C::PUSH16_CS(bxInstruction_c *i) @@ -113,7 +113,7 @@ void BX_CPU_C::POP_RX(bxInstruction_c *i) { Bit16u rx; pop_16(&rx); - BX_CPU_THIS_PTR gen_reg[i->opcodeReg()].word.rx = rx; + BX_WRITE_16BIT_REG(i->opcodeReg(), rx) } void BX_CPU_C::POP_Ew(bxInstruction_c *i) diff --git a/bochs/cpu/stack32.cc b/bochs/cpu/stack32.cc index e24e12589..cb99a8c33 100644 --- a/bochs/cpu/stack32.cc +++ b/bochs/cpu/stack32.cc @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////// -// $Id: stack32.cc,v 1.34 2007-03-02 21:03:25 sshwarts Exp $ +// $Id: stack32.cc,v 1.35 2007-11-13 21:07:08 sshwarts Exp $ ///////////////////////////////////////////////////////////////////////// // // Copyright (C) 2001 MandrakeSoft S.A. @@ -54,14 +54,14 @@ void BX_CPU_C::POP_Ed(bxInstruction_c *i) void BX_CPU_C::PUSH_ERX(bxInstruction_c *i) { - push_32(BX_CPU_THIS_PTR gen_reg[i->opcodeReg()].dword.erx); + push_32(BX_READ_32BIT_REG(i->opcodeReg())); } void BX_CPU_C::POP_ERX(bxInstruction_c *i) { Bit32u erx; pop_32(&erx); - BX_CPU_THIS_PTR gen_reg[i->opcodeReg()].dword.erx = erx; + BX_WRITE_32BIT_REGZ(i->opcodeReg(), erx) } void BX_CPU_C::PUSH32_CS(bxInstruction_c *i)