- Timestamp:
- Jul 29, 2019 7:12:29 PM (5 years ago)
- Location:
- trunk/src/VBox/VMM
- Files:
-
- 1 deleted
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMR0/GVMMR0.cpp
r78431 r80047 899 899 const uint32_t cPages = RT_ALIGN_32(cbVM, PAGE_SIZE) >> PAGE_SHIFT; 900 900 RTR0MEMOBJ hVMMemObj = NIL_RTR0MEMOBJ; 901 # if defined(VBOX_WITH_RAW_MODE) || HC_ARCH_BITS == 32902 rc = RTR0MemObjAllocLow(&hVMMemObj, cPages << PAGE_SHIFT, false /* fExecutable */);903 # else904 901 rc = RTR0MemObjAllocPage(&hVMMemObj, cPages << PAGE_SHIFT, false /* fExecutable */); 905 # endif906 902 if (RT_SUCCESS(rc)) 907 903 { … … 1064 1060 pVM->cCpus = cCpus; 1065 1061 pVM->uCpuExecutionCap = 100; /* default is no cap. */ 1066 # ifdef VBOX_WITH_RAW_MODE1067 pVM->offVMCPU = RT_UOFFSETOF_DYN(VM, aCpus);1068 # endif1069 1062 AssertCompileMemberAlignment(VM, cpum, 64); 1070 1063 AssertCompileMemberAlignment(VM, tm, 64); … … 1237 1230 pGVM->cbSelf = sizeof(VM); 1238 1231 pGVM->cbVCpu = sizeof(VMCPU); 1239 # ifdef VBOX_WITH_RAW_MODE1240 pGVM->offVMCPU = RT_UOFFSETOF_DYN(GVM, aCpus); /** @todo set this when mapping the VM structure into raw-mode context */1241 # endif1242 1232 #endif 1243 1233 -
trunk/src/VBox/VMM/VMMR0/HMR0.cpp
r79352 r80047 1663 1663 } 1664 1664 1665 1666 #ifdef VBOX_WITH_RAW_MODE1667 /**1668 * Raw-mode switcher hook - disable VT-x if it's active *and* the current1669 * switcher turns off paging.1670 *1671 * @returns VBox status code.1672 * @param pVM The cross context VM structure.1673 * @param enmSwitcher The switcher we're about to use.1674 * @param pfVTxDisabled Where to store whether VT-x was disabled or not.1675 */1676 VMMR0_INT_DECL(int) HMR0EnterSwitcher(PVM pVM, VMMSWITCHER enmSwitcher, bool *pfVTxDisabled)1677 {1678 NOREF(pVM);1679 1680 Assert(!RTThreadPreemptIsEnabled(NIL_RTTHREAD));1681 1682 *pfVTxDisabled = false;1683 1684 /* No such issues with AMD-V */1685 if (!g_HmR0.hwvirt.u.vmx.fSupported)1686 return VINF_SUCCESS;1687 1688 /* Check if the switching we're up to is safe. */1689 switch (enmSwitcher)1690 {1691 case VMMSWITCHER_32_TO_32:1692 case VMMSWITCHER_PAE_TO_PAE:1693 return VINF_SUCCESS; /* safe switchers as they don't turn off paging */1694 1695 case VMMSWITCHER_32_TO_PAE:1696 case VMMSWITCHER_PAE_TO_32: /* is this one actually used?? */1697 case VMMSWITCHER_AMD64_TO_32:1698 case VMMSWITCHER_AMD64_TO_PAE:1699 break; /* unsafe switchers */1700 1701 default:1702 AssertFailedReturn(VERR_HM_WRONG_SWITCHER);1703 }1704 1705 /* When using SUPR0EnableVTx we must let the host suspend and resume VT-x,1706 regardless of whether we're currently using VT-x or not. */1707 if (g_HmR0.hwvirt.u.vmx.fUsingSUPR0EnableVTx)1708 {1709 *pfVTxDisabled = SUPR0SuspendVTxOnCpu();1710 return VINF_SUCCESS;1711 }1712 1713 /** @todo Check if this code is presumptive wrt other VT-x users on the1714 * system... */1715 1716 /* Nothing to do if we haven't enabled VT-x. */1717 if (!g_HmR0.fEnabled)1718 return VINF_SUCCESS;1719 1720 /* Local init implies the CPU is currently not in VMX root mode. */1721 if (!g_HmR0.fGlobalInit)1722 return VINF_SUCCESS;1723 1724 /* Ok, disable VT-x. */1725 PCHMPHYSCPU pHostCpu = hmR0GetCurrentCpu();1726 AssertReturn( pHostCpu1727 && pHostCpu->hMemObj != NIL_RTR0MEMOBJ1728 && pHostCpu->pvMemObj1729 && pHostCpu->HCPhysMemObj != NIL_RTHCPHYS,1730 VERR_HM_IPE_2);1731 1732 *pfVTxDisabled = true;1733 return VMXR0DisableCpu(pHostCpu->pvMemObj, pHostCpu->HCPhysMemObj);1734 }1735 1736 1737 /**1738 * Raw-mode switcher hook - re-enable VT-x if was active *and* the current1739 * switcher turned off paging.1740 *1741 * @param pVM The cross context VM structure.1742 * @param fVTxDisabled Whether VT-x was disabled or not.1743 */1744 VMMR0_INT_DECL(void) HMR0LeaveSwitcher(PVM pVM, bool fVTxDisabled)1745 {1746 Assert(!ASMIntAreEnabled());1747 1748 if (!fVTxDisabled)1749 return; /* nothing to do */1750 1751 Assert(g_HmR0.hwvirt.u.vmx.fSupported);1752 if (g_HmR0.hwvirt.u.vmx.fUsingSUPR0EnableVTx)1753 SUPR0ResumeVTxOnCpu(fVTxDisabled);1754 else1755 {1756 Assert(g_HmR0.fEnabled);1757 Assert(g_HmR0.fGlobalInit);1758 1759 PHMPHYSCPU pHostCpu = hmR0GetCurrentCpu();1760 AssertReturnVoid( pHostCpu1761 && pHostCpu->hMemObj != NIL_RTR0MEMOBJ1762 && pHostCpu->pvMemObj1763 && pHostCpu->HCPhysMemObj != NIL_RTHCPHYS);1764 1765 VMXR0EnableCpu(pHostCpu, pVM, pHostCpu->pvMemObj, pHostCpu->HCPhysMemObj, false, &g_HmR0.hwvirt.Msrs);1766 }1767 }1768 #endif /* VBOX_WITH_RAW_MODE */1769 1770 1771 1665 #ifdef VBOX_STRICT 1666 1772 1667 /** 1773 1668 * Dumps a descriptor. … … 2038 1933 NOREF(pFpuCtx); 2039 1934 } 1935 2040 1936 #endif /* VBOX_STRICT */ 2041 1937
Note:
See TracChangeset
for help on using the changeset viewer.