Changeset 21999 in vbox
- Timestamp:
- Aug 5, 2009 2:12:58 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/HWACCM.cpp
r21989 r21999 1464 1464 * @returns VBox status code. 1465 1465 * @param pVM The VM to operate on. 1466 * @param idCpu VCPU to execute hwaccmR3RemovePatches on 1466 1467 * @param pPatchMem Patch memory range 1467 1468 * @param cbPatchMem Size of the memory range 1468 1469 */ 1469 VMMR3DECL(int) HWACMMR3EnablePatching(PVM pVM, RTGCPTR pPatchMem, unsigned cbPatchMem) 1470 { 1471 Log(("HWACMMR3EnablePatching %RGv size %x\n", pPatchMem, cbPatchMem)); 1472 1473 /* Current TPR patching only applies to AMD cpus. 1474 * May need to be extended to Intel CPUs without the APIC TPR hardware optimization. 1475 */ 1476 if (CPUMGetCPUVendor(pVM) != CPUMCPUVENDOR_AMD) 1477 return VERR_NOT_SUPPORTED; 1478 1479 int rc = VMMR3EmtRendezvous(pVM, VMMEMTRENDEZVOUS_FLAGS_TYPE_ONE_BY_ONE, hwaccmR3RemovePatches, (void *)VMMGetCpuId(pVM)); 1470 int hwaccmR3EnablePatching(PVM pVM, VMCPUID idCpu, RTRCPTR pPatchMem, unsigned cbPatchMem) 1471 { 1472 int rc = VMMR3EmtRendezvous(pVM, VMMEMTRENDEZVOUS_FLAGS_TYPE_ONE_BY_ONE, hwaccmR3RemovePatches, (void *)idCpu); 1480 1473 AssertRC(rc); 1481 1474 … … 1484 1477 pVM->hwaccm.s.cbGuestPatchMem = cbPatchMem; 1485 1478 return VINF_SUCCESS; 1479 } 1480 1481 /** 1482 * Enable patching in a VT-x/AMD-V guest 1483 * 1484 * @returns VBox status code. 1485 * @param pVM The VM to operate on. 1486 * @param pPatchMem Patch memory range 1487 * @param cbPatchMem Size of the memory range 1488 */ 1489 VMMR3DECL(int) HWACMMR3EnablePatching(PVM pVM, RTGCPTR pPatchMem, unsigned cbPatchMem) 1490 { 1491 Log(("HWACMMR3EnablePatching %RGv size %x\n", pPatchMem, cbPatchMem)); 1492 1493 /* Current TPR patching only applies to AMD cpus. 1494 * Needs to be extended to Intel CPUs without the APIC TPR hardware optimization. 1495 */ 1496 if (CPUMGetCPUVendor(pVM) != CPUMCPUVENDOR_AMD) 1497 return VERR_NOT_SUPPORTED; 1498 1499 if (pVM->cCPUs > 1) 1500 { 1501 /* We own the IOM lock here and could cause a deadlock by waiting for a VCPU that is blocking on the IOM lock. */ 1502 PVMREQ pReq; 1503 int rc = VMR3ReqCallU(pVM->pUVM, VMCPUID_ANY_QUEUE, &pReq, 0, VMREQFLAGS_NO_WAIT, 1504 (PFNRT)hwaccmR3EnablePatching, 4, pVM, VMMGetCpuId(pVM), (RTRCPTR)pPatchMem, cbPatchMem); 1505 AssertRC(rc); 1506 return rc; 1507 } 1508 else 1509 return hwaccmR3EnablePatching(pVM, VMMGetCpuId(pVM), (RTRCPTR)pPatchMem, cbPatchMem); 1486 1510 } 1487 1511
Note:
See TracChangeset
for help on using the changeset viewer.