From c3a73d35795e8b4c87764278f08cb38e7bb163ef Mon Sep 17 00:00:00 2001 From: Stanislav Shwartsman Date: Sun, 31 Jan 2010 18:06:45 +0000 Subject: [PATCH] comment out CS.LIMIT demotion fix - it causes too big slowdown. Need to think about better solution + small optimization --- bochs/cpu/ctrl_xfer_pro.cc | 4 ++-- bochs/cpu/fetchdecode.cc | 15 ++------------- bochs/cpu/fetchdecode64.cc | 25 +++---------------------- bochs/cpu/proc_ctrl.cc | 6 +++--- bochs/cpu/tasking.cc | 4 ++-- bochs/cpu/vmx.cc | 4 ++-- 6 files changed, 14 insertions(+), 44 deletions(-) diff --git a/bochs/cpu/ctrl_xfer_pro.cc b/bochs/cpu/ctrl_xfer_pro.cc index 1ab766e8c..1f899a5cb 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.81 2010-01-19 14:43:47 sshwarts Exp $ +// $Id: ctrl_xfer_pro.cc,v 1.82 2010-01-31 18:06:44 sshwarts Exp $ ///////////////////////////////////////////////////////////////////////// // // Copyright (C) 2001-2009 The Bochs Project @@ -92,7 +92,7 @@ BX_CPU_C::load_cs(bx_selector_t *selector, bx_descriptor_t *descriptor, Bit8u cp touch_segment(selector, descriptor); -#if BX_SUPPORT_TRACE_CACHE +#ifdef BX_SUPPORT_CS_LIMIT_DEMOTION // Handle special case of CS.LIMIT demotion (new descriptor limit is // smaller than current one) if (BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].cache.u.segment.limit_scaled > descriptor->u.segment.limit_scaled) diff --git a/bochs/cpu/fetchdecode.cc b/bochs/cpu/fetchdecode.cc index 0dcebc00c..a80b47466 100644 --- a/bochs/cpu/fetchdecode.cc +++ b/bochs/cpu/fetchdecode.cc @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////// -// $Id: fetchdecode.cc,v 1.242 2010-01-31 09:45:27 sshwarts Exp $ +// $Id: fetchdecode.cc,v 1.243 2010-01-31 18:06:44 sshwarts Exp $ ///////////////////////////////////////////////////////////////////////// // // Copyright (C) 2001-2009 The Bochs Project @@ -141,17 +141,6 @@ static unsigned sreg_mod01or10_rm16[8] = { }; // decoding instructions; accessing seg reg's by index -static unsigned sreg_mod01or10_rm32[8] = { - BX_SEG_REG_DS, - BX_SEG_REG_DS, - BX_SEG_REG_DS, - BX_SEG_REG_DS, - BX_SEG_REG_NULL, // escape to SIB-byte - BX_SEG_REG_SS, - BX_SEG_REG_DS, - BX_SEG_REG_DS -}; - static unsigned sreg_mod0_base32[8] = { BX_SEG_REG_DS, BX_SEG_REG_DS, @@ -2612,7 +2601,7 @@ fetch_b1: // mod==00b, rm!=4, rm!=5 goto modrm_done; } - seg = sreg_mod01or10_rm32[rm]; + seg = sreg_mod1or2_base32[rm]; if (mod == 0x40) { // mod == 01b if (ilen < remain) { // 8 sign extended to 32 diff --git a/bochs/cpu/fetchdecode64.cc b/bochs/cpu/fetchdecode64.cc index 02f5837c2..a05d24d29 100644 --- a/bochs/cpu/fetchdecode64.cc +++ b/bochs/cpu/fetchdecode64.cc @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////// -// $Id: fetchdecode64.cc,v 1.244 2010-01-31 09:45:27 sshwarts Exp $ +// $Id: fetchdecode64.cc,v 1.245 2010-01-31 18:06:44 sshwarts Exp $ ///////////////////////////////////////////////////////////////////////// // // Copyright (C) 2001-2009 The Bochs Project @@ -106,25 +106,6 @@ static const Bit8u BxOpcodeHasModrm64[512] = { // In 64-bit mode the CS, DS, ES, and SS segment overrides are ignored. // decoding instructions; accessing seg reg's by index -static unsigned sreg_mod01or10_rm32[16] = { - BX_SEG_REG_DS, - BX_SEG_REG_DS, - BX_SEG_REG_DS, - BX_SEG_REG_DS, - BX_SEG_REG_NULL, // escape to SIB-byte - BX_SEG_REG_SS, - BX_SEG_REG_DS, - BX_SEG_REG_DS, - BX_SEG_REG_DS, - BX_SEG_REG_DS, - BX_SEG_REG_DS, - BX_SEG_REG_DS, - BX_SEG_REG_NULL, // escape to SIB-byte - BX_SEG_REG_DS, - BX_SEG_REG_DS, - BX_SEG_REG_DS, -}; - static unsigned sreg_mod0_base32[16] = { BX_SEG_REG_DS, BX_SEG_REG_DS, @@ -3543,7 +3524,7 @@ get_32bit_displ: // mod==00b, rm!=4, rm!=5 goto modrm_done; } - seg = sreg_mod01or10_rm32[rm]; + seg = sreg_mod1or2_base32[rm]; if (mod == 0x40) { // mod == 01b get_8bit_displ: if (ilen < remain) { @@ -3605,7 +3586,7 @@ get_8bit_displ: // mod==00b, rm!=4, rm!=5 goto modrm_done; } - seg = sreg_mod01or10_rm32[rm]; + seg = sreg_mod1or2_base32[rm]; if (mod == 0x40) // mod == 01b goto get_8bit_displ; // (mod == 0x80) mod == 10b diff --git a/bochs/cpu/proc_ctrl.cc b/bochs/cpu/proc_ctrl.cc index 161aff601..3376c972a 100644 --- a/bochs/cpu/proc_ctrl.cc +++ b/bochs/cpu/proc_ctrl.cc @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////// -// $Id: proc_ctrl.cc,v 1.309 2009-12-04 16:53:12 sshwarts Exp $ +// $Id: proc_ctrl.cc,v 1.310 2010-01-31 18:06:44 sshwarts Exp $ ///////////////////////////////////////////////////////////////////////// // // Copyright (C) 2001-2009 The Bochs Project @@ -1274,14 +1274,14 @@ void BX_CPU_C::handleAlignmentCheck(void) if (BX_CPU_THIS_PTR alignment_check_mask == 0) { BX_CPU_THIS_PTR alignment_check_mask = 0xF; BX_INFO(("Enable alignment check (#AC exception)")); - BX_CPU_THIS_PTR iCache.flushICacheEntries(); +// BX_CPU_THIS_PTR iCache.flushICacheEntries(); } } else { if (BX_CPU_THIS_PTR alignment_check_mask != 0) { BX_CPU_THIS_PTR alignment_check_mask = 0; BX_INFO(("Disable alignment check (#AC exception)")); - BX_CPU_THIS_PTR iCache.flushICacheEntries(); +// BX_CPU_THIS_PTR iCache.flushICacheEntries(); } } } diff --git a/bochs/cpu/tasking.cc b/bochs/cpu/tasking.cc index a9e0f0f33..ef6f29776 100644 --- a/bochs/cpu/tasking.cc +++ b/bochs/cpu/tasking.cc @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////// -// $Id: tasking.cc,v 1.78 2009-12-17 11:11:58 sshwarts Exp $ +// $Id: tasking.cc,v 1.79 2010-01-31 18:06:45 sshwarts Exp $ ///////////////////////////////////////////////////////////////////////// // // Copyright (C) 2001-2009 The Bochs Project @@ -647,7 +647,7 @@ void BX_CPU_C::task_switch(bxInstruction_c *i, bx_selector_t *tss_selector, touch_segment(&cs_selector, &cs_descriptor); -#if BX_SUPPORT_TRACE_CACHE +#ifdef BX_SUPPORT_CS_LIMIT_DEMOTION // Handle special case of CS.LIMIT demotion (new descriptor limit is // smaller than current one) if (BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].cache.u.segment.limit_scaled > cs_descriptor.u.segment.limit_scaled) diff --git a/bochs/cpu/vmx.cc b/bochs/cpu/vmx.cc index d012e9e54..3abd4aa1b 100755 --- a/bochs/cpu/vmx.cc +++ b/bochs/cpu/vmx.cc @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////// -// $Id: vmx.cc,v 1.28 2009-12-17 11:11:58 sshwarts Exp $ +// $Id: vmx.cc,v 1.29 2010-01-31 18:06:45 sshwarts Exp $ ///////////////////////////////////////////////////////////////////////// // // Copyright (c) 2009 Stanislav Shwartsman @@ -1298,7 +1298,7 @@ Bit32u BX_CPU_C::VMenterLoadCheckGuestState(Bit64u *qualification) BX_CPU_THIS_PTR eflags = (Bit32u) guest.rflags; BX_CPU_THIS_PTR lf_flags_status = 0; // OSZAPC flags are known. -#if BX_SUPPORT_TRACE_CACHE +#ifdef BX_SUPPORT_CS_LIMIT_DEMOTION // Handle special case of CS.LIMIT demotion (new descriptor limit is // smaller than current one) if (BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].cache.u.segment.limit_scaled > guest.sregs[BX_SEG_REG_CS].cache.u.segment.limit_scaled)