VirtualBox

Changeset 15545 in vbox


Ignore:
Timestamp:
Dec 15, 2008 8:52:30 PM (16 years ago)
Author:
vboxsync
Message:

More paranoia.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMR0/HWVMXR0.cpp

    r15507 r15545  
    7474static void vmxR0FlushVPID(PVM pVM, PVMCPU pVCpu, VMX_FLUSH enmFlush, RTGCPTR GCPtr);
    7575static void vmxR0UpdateExceptionBitmap(PVM pVM, PVMCPU pVCpu, PCPUMCTX pCtx);
    76 
     76#ifdef VBOX_STRICT
     77static bool vmxR0IsValidReadField(uint32_t idxField);
     78static bool vmxR0IsValidWriteField(uint32_t idxField);
     79#endif
    7780
    7881static void VMXR0CheckError(PVM pVM, PVMCPU pVCpu, int rc)
     
    36023605    Assert(pVCpu->hwaccm.s.vmx.VMCSCache.Write.cValidEntries <= RT_ELEMENTS(pVCpu->hwaccm.s.vmx.VMCSCache.Write.aField));
    36033606    Assert(pVCpu->hwaccm.s.vmx.VMCSCache.Read.cValidEntries <= RT_ELEMENTS(pVCpu->hwaccm.s.vmx.VMCSCache.Read.aField));
     3607
     3608#ifdef VBOX_STRICT
     3609    for (unsigned i=0;i<pVCpu->hwaccm.s.vmx.VMCSCache.Write.cValidEntries;i++)
     3610        Assert(vmxR0IsValidWriteField(pVCpu->hwaccm.s.vmx.VMCSCache.Write.aField[i]));
     3611
     3612    for (unsigned i=0;i<pVCpu->hwaccm.s.vmx.VMCSCache.Read.cValidEntries;i++)
     3613        Assert(vmxR0IsValidReadField(pVCpu->hwaccm.s.vmx.VMCSCache.Read.aField[i]));
     3614#endif
    36043615
    36053616    pCpu = HWACCMR0GetCurrentCpu();
     
    37493760
    37503761#endif /* HC_ARCH_BITS == 32 && !VBOX_WITH_2X_4GB_ADDR_SPACE_IN_R0 */
     3762
     3763#ifdef VBOX_STRICT
     3764static bool vmxR0IsValidReadField(uint32_t idxField)
     3765{
     3766    switch(idxField)
     3767    {
     3768    case VMX_VMCS64_GUEST_RIP:
     3769    case VMX_VMCS64_GUEST_RSP:
     3770    case VMX_VMCS_GUEST_RFLAGS:
     3771    case VMX_VMCS32_GUEST_INTERRUPTIBILITY_STATE:
     3772    case VMX_VMCS_CTRL_CR0_READ_SHADOW:
     3773    case VMX_VMCS64_GUEST_CR0:
     3774    case VMX_VMCS_CTRL_CR4_READ_SHADOW:
     3775    case VMX_VMCS64_GUEST_CR4:
     3776    case VMX_VMCS64_GUEST_DR7:
     3777    case VMX_VMCS32_GUEST_SYSENTER_CS:
     3778    case VMX_VMCS64_GUEST_SYSENTER_EIP:
     3779    case VMX_VMCS64_GUEST_SYSENTER_ESP:
     3780    case VMX_VMCS32_GUEST_GDTR_LIMIT:
     3781    case VMX_VMCS64_GUEST_GDTR_BASE:
     3782    case VMX_VMCS32_GUEST_IDTR_LIMIT:
     3783    case VMX_VMCS64_GUEST_IDTR_BASE:
     3784    case VMX_VMCS16_GUEST_FIELD_CS:
     3785    case VMX_VMCS32_GUEST_CS_LIMIT:
     3786    case VMX_VMCS64_GUEST_CS_BASE:
     3787    case VMX_VMCS32_GUEST_CS_ACCESS_RIGHTS:
     3788    case VMX_VMCS16_GUEST_FIELD_DS:
     3789    case VMX_VMCS32_GUEST_DS_LIMIT:
     3790    case VMX_VMCS64_GUEST_DS_BASE:
     3791    case VMX_VMCS32_GUEST_DS_ACCESS_RIGHTS:
     3792    case VMX_VMCS16_GUEST_FIELD_ES:
     3793    case VMX_VMCS32_GUEST_ES_LIMIT:
     3794    case VMX_VMCS64_GUEST_ES_BASE:
     3795    case VMX_VMCS32_GUEST_ES_ACCESS_RIGHTS:
     3796    case VMX_VMCS16_GUEST_FIELD_FS:
     3797    case VMX_VMCS32_GUEST_FS_LIMIT:
     3798    case VMX_VMCS64_GUEST_FS_BASE:
     3799    case VMX_VMCS32_GUEST_FS_ACCESS_RIGHTS:
     3800    case VMX_VMCS16_GUEST_FIELD_GS:
     3801    case VMX_VMCS32_GUEST_GS_LIMIT:
     3802    case VMX_VMCS64_GUEST_GS_BASE:
     3803    case VMX_VMCS32_GUEST_GS_ACCESS_RIGHTS:
     3804    case VMX_VMCS16_GUEST_FIELD_SS:
     3805    case VMX_VMCS32_GUEST_SS_LIMIT:
     3806    case VMX_VMCS64_GUEST_SS_BASE:
     3807    case VMX_VMCS32_GUEST_SS_ACCESS_RIGHTS:
     3808    case VMX_VMCS16_GUEST_FIELD_LDTR:
     3809    case VMX_VMCS32_GUEST_LDTR_LIMIT:
     3810    case VMX_VMCS64_GUEST_LDTR_BASE:
     3811    case VMX_VMCS32_GUEST_LDTR_ACCESS_RIGHTS:
     3812    case VMX_VMCS16_GUEST_FIELD_TR:
     3813    case VMX_VMCS32_GUEST_TR_LIMIT:
     3814    case VMX_VMCS64_GUEST_TR_BASE:
     3815    case VMX_VMCS32_GUEST_TR_ACCESS_RIGHTS:
     3816    case VMX_VMCS32_RO_EXIT_REASON:
     3817    case VMX_VMCS32_RO_VM_INSTR_ERROR:
     3818    case VMX_VMCS32_RO_EXIT_INSTR_LENGTH:
     3819    case VMX_VMCS32_RO_EXIT_INTERRUPTION_ERRCODE:
     3820    case VMX_VMCS32_RO_EXIT_INTERRUPTION_INFO:
     3821    case VMX_VMCS32_RO_EXIT_INSTR_INFO:
     3822    case VMX_VMCS_RO_EXIT_QUALIFICATION:
     3823    case VMX_VMCS32_RO_IDT_INFO:
     3824    case VMX_VMCS32_RO_IDT_ERRCODE:
     3825    case VMX_VMCS64_GUEST_CR3:
     3826    case VMX_VMCS_EXIT_PHYS_ADDR_FULL:
     3827        return true;
     3828    }
     3829    return false;
     3830}
     3831
     3832static bool vmxR0IsValidWriteField(uint32_t idxField)
     3833{
     3834    switch(idxField)
     3835    {
     3836    case VMX_VMCS64_GUEST_LDTR_BASE:
     3837    case VMX_VMCS64_GUEST_TR_BASE:
     3838    case VMX_VMCS64_GUEST_GDTR_BASE:
     3839    case VMX_VMCS64_GUEST_IDTR_BASE:
     3840    case VMX_VMCS64_GUEST_SYSENTER_EIP:
     3841    case VMX_VMCS64_GUEST_SYSENTER_ESP:
     3842    case VMX_VMCS64_GUEST_CR0:
     3843    case VMX_VMCS64_GUEST_CR4:
     3844    case VMX_VMCS64_GUEST_CR3:
     3845    case VMX_VMCS64_GUEST_DR7:
     3846    case VMX_VMCS64_GUEST_RIP:
     3847    case VMX_VMCS64_GUEST_RSP:
     3848    case VMX_VMCS64_GUEST_CS_BASE:
     3849    case VMX_VMCS64_GUEST_DS_BASE:
     3850    case VMX_VMCS64_GUEST_ES_BASE:
     3851    case VMX_VMCS64_GUEST_FS_BASE:
     3852    case VMX_VMCS64_GUEST_GS_BASE:
     3853    case VMX_VMCS64_GUEST_SS_BASE:
     3854        return true;
     3855    }
     3856    return false;
     3857}
     3858
     3859#endif
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