From 7d7f18b5855a21bc1c6d3bc56cfc2f517f865aff Mon Sep 17 00:00:00 2001 From: Stanislav Shwartsman Date: Tue, 19 Jan 2010 14:43:47 +0000 Subject: [PATCH] cleanup --- bochs/cpu/cpu.h | 3 +-- bochs/cpu/ctrl_xfer_pro.cc | 5 +---- bochs/cpu/iret.cc | 4 ++-- bochs/cpu/ret_far.cc | 4 ++-- bochs/cpu/segment_ctrl_pro.cc | 30 ++---------------------------- 5 files changed, 8 insertions(+), 38 deletions(-) diff --git a/bochs/cpu/cpu.h b/bochs/cpu/cpu.h index 5d8a2aeda..4e789a4d6 100644 --- a/bochs/cpu/cpu.h +++ b/bochs/cpu/cpu.h @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////// -// $Id: cpu.h,v 1.634 2009-12-28 09:26:22 sshwarts Exp $ +// $Id: cpu.h,v 1.635 2010-01-19 14:43:46 sshwarts Exp $ ///////////////////////////////////////////////////////////////////////// // // Copyright (C) 2001-2009 The Bochs Project @@ -3186,7 +3186,6 @@ public: // for now... Bit32u *dword1, Bit32u *dword2, Bit32u *dword3, unsigned exception_no); BX_SMF bx_bool fetch_raw_descriptor2_64(const bx_selector_t *selector, Bit32u *dword1, Bit32u *dword2, Bit32u *dword3); - BX_SMF void loadSRegLMNominal(unsigned seg, unsigned selector, unsigned dpl); #endif BX_SMF void push_16(Bit16u value16) BX_CPP_AttrRegparmN(1); BX_SMF void push_32(Bit32u value32) BX_CPP_AttrRegparmN(1); diff --git a/bochs/cpu/ctrl_xfer_pro.cc b/bochs/cpu/ctrl_xfer_pro.cc index 67fd6d336..1ab766e8c 100644 --- a/bochs/cpu/ctrl_xfer_pro.cc +++ b/bochs/cpu/ctrl_xfer_pro.cc @@ -1,5 +1,5 @@ //////////////////////////////////////////////////////////////////////// -// $Id: ctrl_xfer_pro.cc,v 1.80 2009-12-17 11:11:58 sshwarts Exp $ +// $Id: ctrl_xfer_pro.cc,v 1.81 2010-01-19 14:43:47 sshwarts Exp $ ///////////////////////////////////////////////////////////////////////// // // Copyright (C) 2001-2009 The Bochs Project @@ -106,9 +106,6 @@ BX_CPU_C::load_cs(bx_selector_t *selector, bx_descriptor_t *descriptor, Bit8u cp #if BX_SUPPORT_X86_64 if (long_mode()) { - if (descriptor->u.segment.l) { - loadSRegLMNominal(BX_SEG_REG_CS, selector->value, cpl); - } handleCpuModeChange(); } #endif diff --git a/bochs/cpu/iret.cc b/bochs/cpu/iret.cc index 672d11d25..ed9b56356 100755 --- a/bochs/cpu/iret.cc +++ b/bochs/cpu/iret.cc @@ -1,5 +1,5 @@ //////////////////////////////////////////////////////////////////////// -// $Id: iret.cc,v 1.46 2009-10-14 20:45:29 sshwarts Exp $ +// $Id: iret.cc,v 1.47 2010-01-19 14:43:47 sshwarts Exp $ ///////////////////////////////////////////////////////////////////////// // // Copyright (c) 2005-2009 Stanislav Shwartsman @@ -542,7 +542,7 @@ BX_CPU_C::long_iret(bxInstruction_c *i) else { // we are in 64-bit mode ! load_null_selector(&BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS], raw_ss_selector); - loadSRegLMNominal(BX_SEG_REG_SS, raw_ss_selector, cs_selector.rpl); +// loadSRegLMNominal(BX_SEG_REG_SS, raw_ss_selector, cs_selector.rpl); } if (StackAddrSize64()) RSP = new_rsp; diff --git a/bochs/cpu/ret_far.cc b/bochs/cpu/ret_far.cc index 65284632c..12aec5281 100755 --- a/bochs/cpu/ret_far.cc +++ b/bochs/cpu/ret_far.cc @@ -1,5 +1,5 @@ //////////////////////////////////////////////////////////////////////// -// $Id: ret_far.cc,v 1.23 2009-11-19 20:00:35 sshwarts Exp $ +// $Id: ret_far.cc,v 1.24 2010-01-19 14:43:47 sshwarts Exp $ ///////////////////////////////////////////////////////////////////////// // // Copyright (c) 2005-2009 Stanislav Shwartsman @@ -216,7 +216,7 @@ BX_CPU_C::return_protected(bxInstruction_c *i, Bit16u pop_bytes) else { // we are in 64-bit mode ! load_null_selector(&BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS], raw_ss_selector); - loadSRegLMNominal(BX_SEG_REG_SS, raw_ss_selector, cs_selector.rpl); +// loadSRegLMNominal(BX_SEG_REG_SS, raw_ss_selector, cs_selector.rpl); } if (StackAddrSize64()) diff --git a/bochs/cpu/segment_ctrl_pro.cc b/bochs/cpu/segment_ctrl_pro.cc index 1e4eb5b3a..b548a16c3 100644 --- a/bochs/cpu/segment_ctrl_pro.cc +++ b/bochs/cpu/segment_ctrl_pro.cc @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////// -// $Id: segment_ctrl_pro.cc,v 1.126 2009-12-28 09:26:22 sshwarts Exp $ +// $Id: segment_ctrl_pro.cc,v 1.127 2010-01-19 14:43:47 sshwarts Exp $ ///////////////////////////////////////////////////////////////////////// // // Copyright (C) 2001-2009 The Bochs Project @@ -233,21 +233,6 @@ BX_CPU_C::load_null_selector(bx_segment_reg_t *seg, unsigned value) #endif } -#if BX_SUPPORT_X86_64 -void BX_CPU_C::loadSRegLMNominal(unsigned segI, unsigned selector, unsigned dpl) -{ - bx_segment_reg_t *seg = & BX_CPU_THIS_PTR sregs[segI]; - - // Load a segment register in long-mode with nominal values, - // so descriptor cache values are compatible with existing checks. - seg->cache.u.segment.base = 0; - seg->cache.valid = 1; - seg->cache.dpl = dpl; - - seg->selector.value = selector; -} -#endif - BX_CPP_INLINE void BX_CPU_C::validate_seg_reg(unsigned seg) { /* @@ -546,18 +531,7 @@ BX_CPU_C::load_ss(bx_selector_t *selector, bx_descriptor_t *descriptor, Bit8u cp BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].selector = *selector; BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].cache = *descriptor; BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].selector.rpl = cpl; - -#if BX_SUPPORT_X86_64 - if (BX_CPU_THIS_PTR cpu_mode == BX_MODE_LONG_64) { - loadSRegLMNominal(BX_SEG_REG_SS, selector->value, cpl); - return; - } -#endif - if ((BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].selector.value & 0xfffc) == 0) - BX_PANIC(("load_ss(): null selector passed")); - - if (!BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].cache.valid) - BX_PANIC(("load_ss(): invalid selector/descriptor passed.")); + BX_CPU_THIS_PTR sregs[BX_SEG_REG_SS].cache.valid = 1; } void BX_CPU_C::fetch_raw_descriptor(const bx_selector_t *selector,