insert updateFetchModeMask into handleCpuModeChange - avoid bugs in future

This commit is contained in:
Stanislav Shwartsman 2009-03-10 22:28:08 +00:00
parent 08de514d9c
commit 2bdc6ff231
4 changed files with 10 additions and 15 deletions

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// $Id: proc_ctrl.cc,v 1.289 2009-02-27 20:00:02 sshwarts Exp $ // $Id: proc_ctrl.cc,v 1.290 2009-03-10 22:28:08 sshwarts Exp $
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2001 MandrakeSoft S.A. // Copyright (C) 2001 MandrakeSoft S.A.
@ -1112,7 +1112,6 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::LOADALL(bxInstruction_c *i)
BX_PANIC(("loadall: CS invalid")); BX_PANIC(("loadall: CS invalid"));
} }
updateFetchModeMask();
handleCpuModeChange(); handleCpuModeChange();
/* ES */ /* ES */
@ -1221,6 +1220,8 @@ void BX_CPU_C::handleCpuModeChange(void)
} }
} }
updateFetchModeMask();
if (mode != BX_CPU_THIS_PTR cpu_mode) { if (mode != BX_CPU_THIS_PTR cpu_mode) {
BX_DEBUG(("%s activated", cpu_mode_string(BX_CPU_THIS_PTR cpu_mode))); BX_DEBUG(("%s activated", cpu_mode_string(BX_CPU_THIS_PTR cpu_mode)));
#if BX_DEBUGGER #if BX_DEBUGGER
@ -1820,10 +1821,10 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::SYSENTER(bxInstruction_c *i)
BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].cache.u.segment.l = long_mode(); BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].cache.u.segment.l = long_mode();
#endif #endif
updateFetchModeMask();
#if BX_SUPPORT_X86_64 #if BX_SUPPORT_X86_64
handleCpuModeChange(); // mode change could happen only when in long_mode() handleCpuModeChange(); // mode change could happen only when in long_mode()
#else
updateFetchModeMask();
#endif #endif
#if BX_CPU_LEVEL >= 4 && BX_SUPPORT_ALIGNMENT_CHECK #if BX_CPU_LEVEL >= 4 && BX_SUPPORT_ALIGNMENT_CHECK
@ -1941,10 +1942,10 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::SYSEXIT(bxInstruction_c *i)
EIP = EDX; EIP = EDX;
} }
updateFetchModeMask();
#if BX_SUPPORT_X86_64 #if BX_SUPPORT_X86_64
handleCpuModeChange(); // mode change could happen only when in long_mode() handleCpuModeChange(); // mode change could happen only when in long_mode()
#else
updateFetchModeMask();
#endif #endif
#if BX_CPU_LEVEL >= 4 && BX_SUPPORT_ALIGNMENT_CHECK #if BX_CPU_LEVEL >= 4 && BX_SUPPORT_ALIGNMENT_CHECK
@ -2019,7 +2020,6 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::SYSCALL(bxInstruction_c *i)
BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].cache.u.segment.l = 1; /* 64-bit code */ BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].cache.u.segment.l = 1; /* 64-bit code */
BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].cache.u.segment.avl = 0; /* available for use by system */ BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].cache.u.segment.avl = 0; /* available for use by system */
updateFetchModeMask();
handleCpuModeChange(); // mode change could only happen when in long_mode() handleCpuModeChange(); // mode change could only happen when in long_mode()
#if BX_CPU_LEVEL >= 4 && BX_SUPPORT_ALIGNMENT_CHECK #if BX_CPU_LEVEL >= 4 && BX_SUPPORT_ALIGNMENT_CHECK
@ -2170,7 +2170,6 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::SYSRET(bxInstruction_c *i)
temp_RIP = ECX; temp_RIP = ECX;
} }
updateFetchModeMask();
handleCpuModeChange(); // mode change could only happen when in long64 mode handleCpuModeChange(); // mode change could only happen when in long64 mode
#if BX_CPU_LEVEL >= 4 && BX_SUPPORT_ALIGNMENT_CHECK #if BX_CPU_LEVEL >= 4 && BX_SUPPORT_ALIGNMENT_CHECK

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// $Id: smm.cc,v 1.57 2009-02-17 19:20:47 sshwarts Exp $ // $Id: smm.cc,v 1.58 2009-03-10 22:28:08 sshwarts Exp $
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// //
// Copyright (c) 2006 Stanislav Shwartsman // Copyright (c) 2006 Stanislav Shwartsman
@ -172,7 +172,6 @@ void BX_CPU_C::enter_system_management_mode(void)
BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].cache.u.segment.l = 0; /* 16bit default size */ BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].cache.u.segment.l = 0; /* 16bit default size */
#endif #endif
updateFetchModeMask();
handleCpuModeChange(); handleCpuModeChange();
#if BX_CPU_LEVEL >= 4 && BX_SUPPORT_ALIGNMENT_CHECK #if BX_CPU_LEVEL >= 4 && BX_SUPPORT_ALIGNMENT_CHECK

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// $Id: vm8086.cc,v 1.52 2009-01-16 18:18:59 sshwarts Exp $ // $Id: vm8086.cc,v 1.53 2009-03-10 22:28:08 sshwarts Exp $
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2001 MandrakeSoft S.A. // Copyright (C) 2001 MandrakeSoft S.A.
@ -222,7 +222,6 @@ void BX_CPU_C::init_v8086_mode(void)
BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].cache.u.segment.avl = 0; BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].cache.u.segment.avl = 0;
BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].selector.rpl = 3; BX_CPU_THIS_PTR sregs[BX_SEG_REG_CS].selector.rpl = 3;
updateFetchModeMask();
handleCpuModeChange(); handleCpuModeChange();
#if BX_CPU_LEVEL >= 4 && BX_SUPPORT_ALIGNMENT_CHECK #if BX_CPU_LEVEL >= 4 && BX_SUPPORT_ALIGNMENT_CHECK

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// $Id: vmx.cc,v 1.9 2009-02-20 08:12:51 sshwarts Exp $ // $Id: vmx.cc,v 1.10 2009-03-10 22:28:08 sshwarts Exp $
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
// //
// Copyright (c) 2009 Stanislav Shwartsman // Copyright (c) 2009 Stanislav Shwartsman
@ -1213,7 +1213,6 @@ Bit32u BX_CPU_C::VMenterLoadCheckGuestState(Bit64u *qualification)
invalidate_prefetch_q(); invalidate_prefetch_q();
handleAlignmentCheck(); handleAlignmentCheck();
updateFetchModeMask();
handleCpuModeChange(); handleCpuModeChange();
return VMXERR_NO_ERROR; return VMXERR_NO_ERROR;
@ -1564,7 +1563,6 @@ void BX_CPU_C::VMexitLoadHostState(void)
invalidate_prefetch_q(); invalidate_prefetch_q();
handleAlignmentCheck(); handleAlignmentCheck();
updateFetchModeMask();
handleCpuModeChange(); handleCpuModeChange();
} }