VirtualBox

Changeset 9383 in vbox for trunk


Ignore:
Timestamp:
Jun 4, 2008 12:22:45 PM (17 years ago)
Author:
vboxsync
Message:

VT-x/AMD-V updates for 64 bits guests

Location:
trunk/src/VBox/VMM
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/HWACCM.cpp

    r9375 r9383  
    4646#include <iprt/string.h>
    4747#include <iprt/thread.h>
    48 
    49 /* Uncomment to enable experimental nested paging. */
    50 //#define VBOX_WITH_NESTED_PAGING
    51 /* Uncomment to enable 64 bits guest support. */
    52 //#define VBOX_ENABLE_64_BITS_GUESTS
    5348
    5449/*******************************************************************************
  • trunk/src/VBox/VMM/HWACCMInternal.h

    r9116 r9383  
    3434#include <iprt/mp.h>
    3535
     36/* Uncomment to enable experimental nested paging. */
     37//#define VBOX_WITH_NESTED_PAGING
     38/* Uncomment to enable 64 bits guest support. */
     39//#define VBOX_ENABLE_64_BITS_GUESTS
     40
    3641__BEGIN_DECLS
    3742
     
    105110 */
    106111#ifdef VBOX_STRICT
    107 #define HWACCM_VMX_TRAP_MASK                RT_BIT(0) | RT_BIT(7) | RT_BIT(14) | RT_BIT(6) | RT_BIT(11) | RT_BIT(12) | RT_BIT(13) | RT_BIT(16)
     112#define HWACCM_VMX_TRAP_MASK                RT_BIT(X86_XCPT_DE) | RT_BIT(X86_XCPT_NM) | RT_BIT(X86_XCPT_PF) | RT_BIT(X86_XCPT_UD) | RT_BIT(X86_XCPT_NP) | RT_BIT(X86_XCPT_SS) | RT_BIT(X86_XCPT_GP) | RT_BIT(X86_XCPT_MF)
    108113#define HWACCM_SVM_TRAP_MASK                HWACCM_VMX_TRAP_MASK
    109114#else
    110 #define HWACCM_VMX_TRAP_MASK                RT_BIT(7) | RT_BIT(14)
     115#define HWACCM_VMX_TRAP_MASK                RT_BIT(X86_XCPT_NM) | RT_BIT(X86_XCPT_PF)
    111116#define HWACCM_SVM_TRAP_MASK                HWACCM_VMX_TRAP_MASK
    112117#endif
  • trunk/src/VBox/VMM/PGM.cpp

    r9148 r9383  
    31493149        //case PGMMODE_AMD64_NX:
    31503150        case PGMMODE_AMD64:
    3151             GCPhysCR3 = CPUMGetGuestCR3(pVM) & 0xfffffffffffff000ULL; /** @todo define this mask and make CR3 64-bit in this case! */
     3151            GCPhysCR3 = CPUMGetGuestCR3(pVM) & 0xfffffffffffff000ULL; /** @todo define this mask! */
    31523152            rc = PGM_GST_NAME_AMD64(Enter)(pVM, GCPhysCR3);
    31533153            switch (pVM->pgm.s.enmShadowMode)
  • trunk/src/VBox/VMM/VMMR0/HWSVMR0.cpp

    r9212 r9383  
    644644            case PGMMODE_AMD64:         /* 64-bit AMD paging (long mode). */
    645645            case PGMMODE_AMD64_NX:      /* 64-bit AMD paging (long mode) with NX enabled. */
     646#ifdef VBOX_ENABLE_64_BITS_GUESTS
     647                break;
     648#else
    646649                AssertFailed();
    647650                return VERR_PGM_UNSUPPORTED_HOST_PAGING_MODE;
     651#endif
    648652
    649653            default:                    /* shut up gcc */
     
    671675
    672676    /* EIP, ESP and EFLAGS */
    673     pVMCB->guest.u64RIP    = pCtx->eip;
    674     pVMCB->guest.u64RSP    = pCtx->esp;
    675     pVMCB->guest.u64RFlags = pCtx->eflags.u32;
     677    pVMCB->guest.u64RIP    = pCtx->rip;
     678    pVMCB->guest.u64RSP    = pCtx->rsp;
     679    pVMCB->guest.u64RFlags = pCtx->rflags.u64;
    676680
    677681    /* Set CPL */
     
    679683
    680684    /* RAX/EAX too, as VMRUN uses RAX as an implicit parameter. */
    681     pVMCB->guest.u64RAX    = pCtx->eax;
     685    pVMCB->guest.u64RAX    = pCtx->rax;
    682686
    683687    /* vmrun will fail without MSR_K6_EFER_SVME. */
     
    10311035
    10321036    /* Let's first sync back eip, esp, and eflags. */
    1033     pCtx->eip        = pVMCB->guest.u64RIP;
    1034     pCtx->esp        = pVMCB->guest.u64RSP;
    1035     pCtx->eflags.u32 = pVMCB->guest.u64RFlags;
     1037    pCtx->rip        = pVMCB->guest.u64RIP;
     1038    pCtx->rsp        = pVMCB->guest.u64RSP;
     1039    pCtx->rflags.u64 = pVMCB->guest.u64RFlags;
    10361040    /* eax is saved/restore across the vmrun instruction */
    1037     pCtx->eax        = pVMCB->guest.u64RAX;
     1041    pCtx->rax        = pVMCB->guest.u64RAX;
    10381042
    10391043    /* Guest CPU context: ES, CS, SS, DS, FS, GS. */
  • trunk/src/VBox/VMM/VMMR0/HWVMXR0.cpp

    r9212 r9383  
    784784                if (!pVM->hwaccm.s.fFPUOldStyleOverride)
    785785                {
    786                     rc = VMXWriteVMCS(VMX_VMCS_CTRL_EXCEPTION_BITMAP, HWACCM_VMX_TRAP_MASK | RT_BIT(16));
     786                    rc = VMXWriteVMCS(VMX_VMCS_CTRL_EXCEPTION_BITMAP, HWACCM_VMX_TRAP_MASK | RT_BIT(X86_XCPT_MF));
    787787                    AssertRC(rc);
    788788                    pVM->hwaccm.s.fFPUOldStyleOverride = true;
     
    837837        case PGMMODE_AMD64:         /* 64-bit AMD paging (long mode). */
    838838        case PGMMODE_AMD64_NX:      /* 64-bit AMD paging (long mode) with NX enabled. */
     839#ifdef VBOX_ENABLE_64_BITS_GUESTS
     840            break;
     841#else
    839842            AssertFailed();
    840843            return VERR_PGM_UNSUPPORTED_HOST_PAGING_MODE;
    841 
     844#endif
    842845        default:                   /* shut up gcc */
    843846            AssertFailed();
     
    896899
    897900    /* EIP, ESP and EFLAGS */
    898     rc  = VMXWriteVMCS(VMX_VMCS_GUEST_RIP,              pCtx->eip);
    899     rc |= VMXWriteVMCS(VMX_VMCS_GUEST_RSP,              pCtx->esp);
     901    rc  = VMXWriteVMCS(VMX_VMCS_GUEST_RIP,              pCtx->rip);
     902    rc |= VMXWriteVMCS(VMX_VMCS_GUEST_RSP,              pCtx->rsp);
    900903    AssertRC(rc);
    901904
     
    978981{
    979982    int         rc = VINF_SUCCESS;
    980     RTCCUINTREG val, valShadow;
    981     RTCCUINTREG exitReason, instrError, cbInstr;
    982     RTGCUINTPTR exitQualification;
    983     RTGCUINTPTR intInfo = 0; /* shut up buggy gcc 4 */
    984     RTGCUINTPTR errCode, instrInfo, uInterruptState;
     983    uint64_t    val, valShadow;
     984    uint64_t    exitReason, instrError, cbInstr;
     985    uint64_t    exitQualification;
     986    uint64_t    intInfo = 0; /* shut up buggy gcc 4 */
     987    uint64_t    errCode, instrInfo, uInterruptState;
    985988    bool        fGuestStateSynced = false;
    986989    unsigned    cResume = 0;
     
    13501353    rc = VMXReadVMCS(VMX_VMCS_GUEST_RIP,              &val);
    13511354    AssertRC(rc);
    1352     pCtx->eip               = val;
     1355    pCtx->rip               = val;
    13531356    rc = VMXReadVMCS(VMX_VMCS_GUEST_RSP,              &val);
    13541357    AssertRC(rc);
    1355     pCtx->esp               = val;
     1358    pCtx->rsp               = val;
    13561359    rc = VMXReadVMCS(VMX_VMCS_GUEST_RFLAGS,           &val);
    13571360    AssertRC(rc);
    1358     pCtx->eflags.u32        = val;
     1361    pCtx->rflags.u64        = val;
    13591362
    13601363    /* Real mode emulation using v86 mode with CR4.VME (interrupt redirection using the int bitmap in the TSS) */
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette