VirtualBox

Changeset 24027 in vbox for trunk


Ignore:
Timestamp:
Oct 23, 2009 12:17:23 PM (16 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
53872
Message:

Fail if VT-x or AMD-V are already enabled (Windows 7)

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/err.h

    r23906 r24027  
    13891389/** Unable to start VM execution. */
    13901390#define VERR_SVM_UNABLE_TO_START_VM                 (-4050)
    1391 /** SVM bit not set in K6_EFER MSR */
     1391/** AMD-V bit not set in K6_EFER MSR */
    13921392#define VERR_SVM_ILLEGAL_EFER_MSR                   (-4051)
    1393 /** SVM CPU extension not available. */
     1393/** AMD-V CPU extension not available. */
    13941394#define VERR_SVM_NO_SVM                             (-4052)
    1395 /** SVM CPU extension disabled (by BIOS). */
     1395/** AMD-V CPU extension disabled (by BIOS). */
    13961396#define VERR_SVM_DISABLED                           (-4053)
     1397/** AMD-V CPU extension in-use. */
     1398#define VERR_SVM_IN_USE                             (-4054)
    13971399/** @} */
    13981400
  • trunk/src/VBox/VMM/VMMR0/HWSVMR0.cpp

    r23553 r24027  
    8383#endif
    8484
     85    uint64_t val = ASMRdMsr(MSR_K6_EFER);
     86    if (val & MSR_K6_EFER_SVME)
     87        return VERR_SVM_IN_USE;
     88
    8589    /* Turn on AMD-V in the EFER MSR. */
    86     uint64_t val = ASMRdMsr(MSR_K6_EFER);
    87     if (!(val & MSR_K6_EFER_SVME))
    88         ASMWrMsr(MSR_K6_EFER, val | MSR_K6_EFER_SVME);
     90    ASMWrMsr(MSR_K6_EFER, val | MSR_K6_EFER_SVME);
    8991
    9092    /* Write the physical page address where the CPU will store the host state while executing the VM. */
  • trunk/src/VBox/VMM/VMMR0/HWVMXR0.cpp

    r23983 r24027  
    123123     * (which can have very bad consequences!!!)
    124124     */
     125
     126    if (ASMGetCR4() & X86_CR4_VMXE))
     127        return VERR_VMX_IN_VMX_ROOT_MODE;
    125128
    126129    /* Make sure the VMX instructions don't cause #UD faults. */
Note: See TracChangeset for help on using the changeset viewer.

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