From 7c0582e4ea134f966e78a40d1ae63c785ca23732 Mon Sep 17 00:00:00 2001 From: Stanislav Shwartsman Date: Wed, 4 Feb 2009 16:05:47 +0000 Subject: [PATCH] Some fixes for X86-64 OFF mode --- bochs/cpu/paging.cc | 10 +++++----- bochs/cpu/proc_ctrl.cc | 10 ++++++---- bochs/cpu/vmx.cc | 4 ++-- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/bochs/cpu/paging.cc b/bochs/cpu/paging.cc index c519c7f38..1ac52a479 100644 --- a/bochs/cpu/paging.cc +++ b/bochs/cpu/paging.cc @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////// -// $Id: paging.cc,v 1.167 2009-01-31 10:43:23 sshwarts Exp $ +// $Id: paging.cc,v 1.168 2009-02-04 16:05:47 sshwarts Exp $ ///////////////////////////////////////////////////////////////////////// // // Copyright (C) 2001 MandrakeSoft S.A. @@ -613,6 +613,10 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::INVLPG(bxInstruction_c* i) bx_address eaddr = BX_CPU_CALL_METHODR(i->ResolveModrm, (i)); bx_address laddr = get_laddr(i->seg(), eaddr); +#if BX_SUPPORT_VMX + VMexit_INVLPG(i, laddr); +#endif + #if BX_SUPPORT_X86_64 if (! IsCanonical(laddr)) { BX_ERROR(("INVLPG: non-canonical access !")); @@ -620,10 +624,6 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::INVLPG(bxInstruction_c* i) } #endif -#if BX_SUPPORT_VMX - VMexit_INVLPG(i, laddr); -#endif - BX_INSTR_TLB_CNTRL(BX_CPU_ID, BX_INSTR_INVLPG, laddr); TLB_invlpg(laddr); #else diff --git a/bochs/cpu/proc_ctrl.cc b/bochs/cpu/proc_ctrl.cc index d0ed503fb..005b90a90 100644 --- a/bochs/cpu/proc_ctrl.cc +++ b/bochs/cpu/proc_ctrl.cc @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////// -// $Id: proc_ctrl.cc,v 1.282 2009-02-03 21:11:31 sshwarts Exp $ +// $Id: proc_ctrl.cc,v 1.283 2009-02-04 16:05:47 sshwarts Exp $ ///////////////////////////////////////////////////////////////////////// // // Copyright (C) 2001 MandrakeSoft S.A. @@ -1275,14 +1275,16 @@ bx_address BX_CPU_C::read_CR4(void) return cr4_val; } -bx_bool BX_CPP_AttrRegparmN(1) BX_CPU_C::SetCR0(bx_address val_64) +bx_bool BX_CPP_AttrRegparmN(1) BX_CPU_C::SetCR0(bx_address val) { - if (GET32H(val_64)) { +#if BX_SUPPORT_X86_64 + if (GET32H(val)) { BX_ERROR(("SetCR0: GP(0) when trying to set CR0 > 32 bits")); return 0; } +#endif - Bit32u val_32 = GET32L(val_64); + Bit32u val_32 = GET32L(val); bx_bool pe = val_32 & 0x1; bx_bool nw = (val_32 >> 29) & 0x1; diff --git a/bochs/cpu/vmx.cc b/bochs/cpu/vmx.cc index 25e37951b..6bc1b9472 100755 --- a/bochs/cpu/vmx.cc +++ b/bochs/cpu/vmx.cc @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////// -// $Id: vmx.cc,v 1.5 2009-02-03 19:17:15 sshwarts Exp $ +// $Id: vmx.cc,v 1.6 2009-02-04 16:05:47 sshwarts Exp $ ///////////////////////////////////////////////////////////////////////// // // Copyright (c) 2009 Stanislav Shwartsman @@ -782,7 +782,6 @@ Bit32u BX_CPU_C::VMenterLoadCheckGuestState(Bit64u *qualification) if (x86_64_guest && guest.sregs[BX_SEG_REG_CS].cache.u.segment.l) continue; } -#endif if (n < BX_SEG_REG_FS) { if (GET32H(base) != 0) { @@ -790,6 +789,7 @@ Bit32u BX_CPU_C::VMenterLoadCheckGuestState(Bit64u *qualification) return VMX_VMEXIT_VMENTRY_FAILURE_GUEST_STATE; } } +#endif if (! guest.sregs[n].cache.segment) { BX_ERROR(("VMENTER FAIL: VMCS guest %s not segment", segname[n]));