Some fixes for X86-64 OFF mode

This commit is contained in:
Stanislav Shwartsman 2009-02-04 16:05:47 +00:00
parent 26fda0626d
commit 7c0582e4ea
3 changed files with 13 additions and 11 deletions

View File

@ -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. // 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 eaddr = BX_CPU_CALL_METHODR(i->ResolveModrm, (i));
bx_address laddr = get_laddr(i->seg(), eaddr); bx_address laddr = get_laddr(i->seg(), eaddr);
#if BX_SUPPORT_VMX
VMexit_INVLPG(i, laddr);
#endif
#if BX_SUPPORT_X86_64 #if BX_SUPPORT_X86_64
if (! IsCanonical(laddr)) { if (! IsCanonical(laddr)) {
BX_ERROR(("INVLPG: non-canonical access !")); BX_ERROR(("INVLPG: non-canonical access !"));
@ -620,10 +624,6 @@ void BX_CPP_AttrRegparmN(1) BX_CPU_C::INVLPG(bxInstruction_c* i)
} }
#endif #endif
#if BX_SUPPORT_VMX
VMexit_INVLPG(i, laddr);
#endif
BX_INSTR_TLB_CNTRL(BX_CPU_ID, BX_INSTR_INVLPG, laddr); BX_INSTR_TLB_CNTRL(BX_CPU_ID, BX_INSTR_INVLPG, laddr);
TLB_invlpg(laddr); TLB_invlpg(laddr);
#else #else

View File

@ -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. // Copyright (C) 2001 MandrakeSoft S.A.
@ -1275,14 +1275,16 @@ bx_address BX_CPU_C::read_CR4(void)
return cr4_val; 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")); BX_ERROR(("SetCR0: GP(0) when trying to set CR0 > 32 bits"));
return 0; return 0;
} }
#endif
Bit32u val_32 = GET32L(val_64); Bit32u val_32 = GET32L(val);
bx_bool pe = val_32 & 0x1; bx_bool pe = val_32 & 0x1;
bx_bool nw = (val_32 >> 29) & 0x1; bx_bool nw = (val_32 >> 29) & 0x1;

View File

@ -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 // 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) if (x86_64_guest && guest.sregs[BX_SEG_REG_CS].cache.u.segment.l)
continue; continue;
} }
#endif
if (n < BX_SEG_REG_FS) { if (n < BX_SEG_REG_FS) {
if (GET32H(base) != 0) { if (GET32H(base) != 0) {
@ -790,6 +789,7 @@ Bit32u BX_CPU_C::VMenterLoadCheckGuestState(Bit64u *qualification)
return VMX_VMEXIT_VMENTRY_FAILURE_GUEST_STATE; return VMX_VMEXIT_VMENTRY_FAILURE_GUEST_STATE;
} }
} }
#endif
if (! guest.sregs[n].cache.segment) { if (! guest.sregs[n].cache.segment) {
BX_ERROR(("VMENTER FAIL: VMCS guest %s not segment", segname[n])); BX_ERROR(("VMENTER FAIL: VMCS guest %s not segment", segname[n]));