Changeset 78431 in vbox for trunk/src/VBox
- Timestamp:
- May 7, 2019 2:01:45 PM (6 years ago)
- Location:
- trunk/src/VBox
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostDrivers/Support/testcase/tstInt.cpp
r76553 r78431 98 98 AssertRelease(pVM->pSession == pSession); 99 99 AssertRelease(pVM->cCpus == 1); 100 #ifdef VBOX_WITH_RAW_MODE 100 101 AssertRelease(pVM->offVMCPU == RT_UOFFSETOF(VM, aCpus)); 102 #endif 101 103 pVM->enmVMState = VMSTATE_CREATED; 102 104 PVMR0 const pVMR0 = pVM->pVMR0; -
trunk/src/VBox/VMM/Config.kmk
r76553 r78431 82 82 VMM_COMMON_DEFS += VBOX_WITH_MORE_RING0_MEM_MAPPINGS 83 83 endif 84 ifdef VBOX_BUGREF_9217 85 VMM_COMMON_DEFS += VBOX_BUGREF_9217 86 endif 84 87 85 88 # VMM_COMMON_DEFS += VBOX_WITH_NS_ACCOUNTING_STATS -
trunk/src/VBox/VMM/VMMR0/CPUMR0.cpp
r76886 r78431 24 24 #include "CPUMInternal.h" 25 25 #include <VBox/vmm/vm.h> 26 #include <VBox/vmm/gvm.h> 26 27 #include <VBox/err.h> 27 28 #include <VBox/log.h> … … 334 335 if (u32DR7 & X86_DR7_ENABLED_MASK) 335 336 { 337 #ifdef VBOX_BUGREF_9217 338 PGVM pGVM = (PGVM)pVM; 339 for (VMCPUID i = 0; i < pGVM->cCpusSafe; i++) 340 pGVM->aCpus[i].cpum.s.fUseFlags |= CPUM_USE_DEBUG_REGS_HOST; 341 #else 336 342 for (VMCPUID i = 0; i < pVM->cCpus; i++) 337 343 pVM->aCpus[i].cpum.s.fUseFlags |= CPUM_USE_DEBUG_REGS_HOST; 344 #endif 338 345 Log(("CPUMR0Init: host uses debug registers (dr7=%x)\n", u32DR7)); 339 346 } -
trunk/src/VBox/VMM/VMMR0/EMR0.cpp
r76553 r78431 39 39 * @param pVM The cross context VM structure. 40 40 */ 41 #ifdef VBOX_BUGREF_9217 42 VMMR0_INT_DECL(int) EMR0InitVM(PGVM pGVM) 43 # define pVM pGVM /* temp hack */ 44 #else 41 45 VMMR0_INT_DECL(int) EMR0InitVM(PGVM pGVM, PVM pVM) 46 #endif 42 47 { 43 48 /* … … 50 55 && pVM->aCpus[0].em.s.fExitOptimizationEnabledR0PreemptDisabled 51 56 && RTThreadPreemptIsPendingTrusty(); 57 #ifdef VBOX_BUGREF_9217 58 for (VMCPUID i = 0; i < pGVM->cCpusSafe; i++) 59 #else 52 60 for (VMCPUID i = 0; i < pGVM->cCpus; i++) 61 #endif 53 62 { 54 63 pVM->aCpus[i].em.s.fExitOptimizationEnabledR0 = fEnabledR0; -
trunk/src/VBox/VMM/VMMR0/GVMMR0.cpp
r77126 r78431 360 360 * Internal Functions * 361 361 *********************************************************************************************************************************/ 362 #ifdef VBOX_BUGREF_9217 363 static void gvmmR0InitPerVMData(PGVM pGVM, int16_t hSelf, VMCPUID cCpus, PSUPDRVSESSION pSession); 364 #else 362 365 static void gvmmR0InitPerVMData(PGVM pGVM); 366 #endif 363 367 static DECLCALLBACK(void) gvmmR0HandleObjDestructor(void *pvObj, void *pvGVMM, void *pvHandle); 364 368 static int gvmmR0ByGVMandVM(PGVM pGVM, PVM pVM, PGVMM *ppGVMM, bool fTakeUsedLock); … … 888 892 if (RT_SUCCESS(rc)) 889 893 { 894 #ifdef VBOX_BUGREF_9217 895 /* 896 * Allocate memory for the VM structure (combined VM + GVM). 897 */ 898 const uint32_t cbVM = RT_UOFFSETOF_DYN(GVM, aCpus[cCpus]); 899 const uint32_t cPages = RT_ALIGN_32(cbVM, PAGE_SIZE) >> PAGE_SHIFT; 900 RTR0MEMOBJ hVMMemObj = NIL_RTR0MEMOBJ; 901 # if defined(VBOX_WITH_RAW_MODE) || HC_ARCH_BITS == 32 902 rc = RTR0MemObjAllocLow(&hVMMemObj, cPages << PAGE_SHIFT, false /* fExecutable */); 903 # else 904 rc = RTR0MemObjAllocPage(&hVMMemObj, cPages << PAGE_SHIFT, false /* fExecutable */); 905 # endif 906 if (RT_SUCCESS(rc)) 907 { 908 PGVM pGVM = (PGVM)RTR0MemObjAddress(hVMMemObj); 909 AssertPtr(pGVM); 910 911 /* 912 * Initialise the structure. 913 */ 914 RT_BZERO(pGVM, cPages << PAGE_SHIFT); 915 gvmmR0InitPerVMData(pGVM, iHandle, cCpus, pSession); 916 GMMR0InitPerVMData(pGVM); 917 pGVM->gvmm.s.VMMemObj = hVMMemObj; 918 919 /* 920 * Allocate page array. 921 * This currently have to be made available to ring-3, but this is should change eventually. 922 */ 923 rc = RTR0MemObjAllocPage(&pGVM->gvmm.s.VMPagesMemObj, cPages * sizeof(SUPPAGE), false /* fExecutable */); 924 if (RT_SUCCESS(rc)) 925 { 926 PSUPPAGE paPages = (PSUPPAGE)RTR0MemObjAddress(pGVM->gvmm.s.VMPagesMemObj); AssertPtr(paPages); 927 for (uint32_t iPage = 0; iPage < cPages; iPage++) 928 { 929 paPages[iPage].uReserved = 0; 930 paPages[iPage].Phys = RTR0MemObjGetPagePhysAddr(pGVM->gvmm.s.VMMemObj, iPage); 931 Assert(paPages[iPage].Phys != NIL_RTHCPHYS); 932 } 933 934 /* 935 * Map the page array, VM and VMCPU structures into ring-3. 936 */ 937 AssertCompileSizeAlignment(VM, PAGE_SIZE); 938 rc = RTR0MemObjMapUserEx(&pGVM->gvmm.s.VMMapObj, pGVM->gvmm.s.VMMemObj, (RTR3PTR)-1, 0, 939 RTMEM_PROT_READ | RTMEM_PROT_WRITE, NIL_RTR0PROCESS, 940 0 /*offSub*/, sizeof(VM)); 941 for (VMCPUID i = 0; i < cCpus && RT_SUCCESS(rc); i++) 942 { 943 AssertCompileSizeAlignment(VMCPU, PAGE_SIZE); 944 rc = RTR0MemObjMapUserEx(&pGVM->aCpus[i].gvmm.s.VMCpuMapObj, pGVM->gvmm.s.VMMemObj, 945 (RTR3PTR)-1, 0, RTMEM_PROT_READ | RTMEM_PROT_WRITE, NIL_RTR0PROCESS, 946 RT_UOFFSETOF_DYN(GVM, aCpus[i]), sizeof(VMCPU)); 947 } 948 if (RT_SUCCESS(rc)) 949 rc = RTR0MemObjMapUser(&pGVM->gvmm.s.VMPagesMapObj, pGVM->gvmm.s.VMPagesMemObj, (RTR3PTR)-1, 950 0 /* uAlignment */, RTMEM_PROT_READ | RTMEM_PROT_WRITE, 951 NIL_RTR0PROCESS); 952 if (RT_SUCCESS(rc)) 953 { 954 /* 955 * Initialize all the VM pointer. 956 */ 957 PVMR3 pVMR3 = RTR0MemObjAddressR3(pGVM->gvmm.s.VMMapObj); 958 AssertPtr((void *)pVMR3); 959 960 for (VMCPUID i = 0; i < cCpus; i++) 961 { 962 pGVM->aCpus[i].pVMR0 = pGVM; 963 pGVM->aCpus[i].pVMR3 = pVMR3; 964 pGVM->apCpus[i] = RTR0MemObjAddressR3(pGVM->aCpus[i].gvmm.s.VMCpuMapObj); 965 AssertPtr((void *)pGVM->apCpus[i]); 966 } 967 968 pGVM->paVMPagesR3 = RTR0MemObjAddressR3(pGVM->gvmm.s.VMPagesMapObj); 969 AssertPtr((void *)pGVM->paVMPagesR3); 970 971 /* 972 * Complete the handle - take the UsedLock sem just to be careful. 973 */ 974 rc = GVMMR0_USED_EXCLUSIVE_LOCK(pGVMM); 975 AssertRC(rc); 976 977 pHandle->pVM = pGVM; 978 pHandle->pGVM = pGVM; 979 pHandle->hEMT0 = hEMT0; 980 pHandle->ProcId = ProcId; 981 pGVM->pVMR3 = pVMR3; 982 pGVM->aCpus[0].hEMT = hEMT0; 983 pGVM->aCpus[0].hNativeThreadR0 = hEMT0; 984 pGVMM->cEMTs += cCpus; 985 986 /* Associate it with the session and create the context hook for EMT0. */ 987 rc = SUPR0SetSessionVM(pSession, pGVM, pGVM); 988 if (RT_SUCCESS(rc)) 989 { 990 rc = VMMR0ThreadCtxHookCreateForEmt(&pGVM->aCpus[0]); 991 if (RT_SUCCESS(rc)) 992 { 993 /* 994 * Done! 995 */ 996 VBOXVMM_R0_GVMM_VM_CREATED(pGVM, pGVM, ProcId, (void *)hEMT0, cCpus); 997 998 GVMMR0_USED_EXCLUSIVE_UNLOCK(pGVMM); 999 gvmmR0CreateDestroyUnlock(pGVMM); 1000 1001 CPUMR0RegisterVCpuThread(&pGVM->aCpus[0]); 1002 1003 *ppVM = pGVM; 1004 Log(("GVMMR0CreateVM: pVMR3=%p pGVM=%p hGVM=%d\n", pVMR3, pGVM, iHandle)); 1005 return VINF_SUCCESS; 1006 } 1007 1008 SUPR0SetSessionVM(pSession, NULL, NULL); 1009 } 1010 GVMMR0_USED_EXCLUSIVE_UNLOCK(pGVMM); 1011 } 1012 1013 /* Cleanup mappings. */ 1014 if (pGVM->gvmm.s.VMMapObj != NIL_RTR0MEMOBJ) 1015 { 1016 RTR0MemObjFree(pGVM->gvmm.s.VMMapObj, false /* fFreeMappings */); 1017 pGVM->gvmm.s.VMMapObj = NIL_RTR0MEMOBJ; 1018 } 1019 for (VMCPUID i = 0; i < cCpus; i++) 1020 if (pGVM->aCpus[i].gvmm.s.VMCpuMapObj != NIL_RTR0MEMOBJ) 1021 { 1022 RTR0MemObjFree(pGVM->aCpus[i].gvmm.s.VMCpuMapObj, false /* fFreeMappings */); 1023 pGVM->aCpus[i].gvmm.s.VMCpuMapObj = NIL_RTR0MEMOBJ; 1024 } 1025 if (pGVM->gvmm.s.VMPagesMapObj != NIL_RTR0MEMOBJ) 1026 { 1027 RTR0MemObjFree(pGVM->gvmm.s.VMPagesMapObj, false /* fFreeMappings */); 1028 pGVM->gvmm.s.VMPagesMapObj = NIL_RTR0MEMOBJ; 1029 } 1030 } 1031 } 1032 1033 #else 890 1034 /* 891 1035 * Allocate the global VM structure (GVM) and initialize it. … … 920 1064 pVM->cCpus = cCpus; 921 1065 pVM->uCpuExecutionCap = 100; /* default is no cap. */ 1066 # ifdef VBOX_WITH_RAW_MODE 922 1067 pVM->offVMCPU = RT_UOFFSETOF_DYN(VM, aCpus); 1068 # endif 923 1069 AssertCompileMemberAlignment(VM, cpum, 64); 924 1070 AssertCompileMemberAlignment(VM, tm, 64); … … 1022 1168 } 1023 1169 } 1170 #endif 1024 1171 } 1025 1172 /* else: The user wasn't permitted to create this VM. */ … … 1035 1182 SUPR0ObjRelease(pvObj, pSession); 1036 1183 1037 SUPR0Printf("GVMMR0CreateVM: failed, rc=% d\n", rc);1184 SUPR0Printf("GVMMR0CreateVM: failed, rc=%Rrc\n", rc); 1038 1185 return rc; 1039 1186 } … … 1052 1199 1053 1200 1201 #ifdef VBOX_BUGREF_9217 1054 1202 /** 1055 1203 * Initializes the per VM data belonging to GVMM. … … 1057 1205 * @param pGVM Pointer to the global VM structure. 1058 1206 */ 1207 static void gvmmR0InitPerVMData(PGVM pGVM, int16_t hSelf, VMCPUID cCpus, PSUPDRVSESSION pSession) 1208 #else 1209 /** 1210 * Initializes the per VM data belonging to GVMM. 1211 * 1212 * @param pGVM Pointer to the global VM structure. 1213 */ 1059 1214 static void gvmmR0InitPerVMData(PGVM pGVM) 1215 #endif 1060 1216 { 1061 1217 AssertCompile(RT_SIZEOFMEMB(GVM,gvmm.s) <= RT_SIZEOFMEMB(GVM,gvmm.padding)); 1062 1218 AssertCompile(RT_SIZEOFMEMB(GVMCPU,gvmm.s) <= RT_SIZEOFMEMB(GVMCPU,gvmm.padding)); 1063 pGVM->gvmm.s.VMMemObj = NIL_RTR0MEMOBJ; 1064 pGVM->gvmm.s.VMMapObj = NIL_RTR0MEMOBJ; 1065 pGVM->gvmm.s.VMPagesMemObj = NIL_RTR0MEMOBJ; 1066 pGVM->gvmm.s.VMPagesMapObj = NIL_RTR0MEMOBJ; 1219 #ifdef VBOX_BUGREF_9217 1220 AssertCompileMemberAlignment(VM, cpum, 64); 1221 AssertCompileMemberAlignment(VM, tm, 64); 1222 1223 /* GVM: */ 1224 pGVM->u32Magic = GVM_MAGIC; 1225 pGVM->hSelfSafe = hSelf; 1226 pGVM->cCpusSafe = cCpus; 1227 pGVM->pSessionSafe = pSession; 1228 1229 /* VM: */ 1230 pGVM->enmVMState = VMSTATE_CREATING; 1231 pGVM->pVMR0 = pGVM; 1232 pGVM->pSession = pSession; 1233 pGVM->hSelf = hSelf; 1234 pGVM->cCpus = cCpus; 1235 pGVM->uCpuExecutionCap = 100; /* default is no cap. */ 1236 pGVM->uStructVersion = 1; 1237 pGVM->cbSelf = sizeof(VM); 1238 pGVM->cbVCpu = sizeof(VMCPU); 1239 # ifdef VBOX_WITH_RAW_MODE 1240 pGVM->offVMCPU = RT_UOFFSETOF_DYN(GVM, aCpus); /** @todo set this when mapping the VM structure into raw-mode context */ 1241 # endif 1242 #endif 1243 1244 /* GVMM: */ 1245 pGVM->gvmm.s.VMMemObj = NIL_RTR0MEMOBJ; 1246 pGVM->gvmm.s.VMMapObj = NIL_RTR0MEMOBJ; 1247 pGVM->gvmm.s.VMPagesMemObj = NIL_RTR0MEMOBJ; 1248 pGVM->gvmm.s.VMPagesMapObj = NIL_RTR0MEMOBJ; 1067 1249 pGVM->gvmm.s.fDoneVMMR0Init = false; 1068 1250 pGVM->gvmm.s.fDoneVMMR0Term = false; 1069 1251 1252 /* 1253 * Per virtual CPU. 1254 */ 1070 1255 for (VMCPUID i = 0; i < pGVM->cCpus; i++) 1071 1256 { 1072 1257 pGVM->aCpus[i].idCpu = i; 1258 #ifdef VBOX_BUGREF_9217 1259 pGVM->aCpus[i].idCpuSafe = i; 1260 #endif 1073 1261 pGVM->aCpus[i].gvmm.s.HaltEventMulti = NIL_RTSEMEVENTMULTI; 1262 #ifdef VBOX_BUGREF_9217 1263 pGVM->aCpus[i].gvmm.s.VMCpuMapObj = NIL_RTR0MEMOBJ; 1264 #endif 1074 1265 pGVM->aCpus[i].hEMT = NIL_RTNATIVETHREAD; 1075 1266 pGVM->aCpus[i].pGVM = pGVM; 1267 #ifndef VBOX_BUGREF_9217 1076 1268 pGVM->aCpus[i].pVCpu = NULL; 1077 1269 pGVM->aCpus[i].pVM = NULL; 1270 #endif 1271 #ifdef VBOX_BUGREF_9217 1272 pGVM->aCpus[i].idHostCpu = NIL_RTCPUID; 1273 pGVM->aCpus[i].iHostCpuSet = UINT32_MAX; 1274 pGVM->aCpus[i].hNativeThread = NIL_RTNATIVETHREAD; 1275 pGVM->aCpus[i].hNativeThreadR0 = NIL_RTNATIVETHREAD; 1276 pGVM->aCpus[i].enmState = VMCPUSTATE_STOPPED; 1277 #endif 1078 1278 } 1079 1279 } … … 1172 1372 AssertPtrReturn(pVM, VERR_INVALID_POINTER); 1173 1373 AssertReturn(!((uintptr_t)pVM & PAGE_OFFSET_MASK), VERR_INVALID_POINTER); 1374 #ifdef VBOX_BUGREF_9217 1375 AssertReturn(pGVM == pVM, VERR_INVALID_POINTER); 1376 #else 1174 1377 AssertReturn(pGVM->pVM == pVM, VERR_INVALID_POINTER); 1378 #endif 1175 1379 AssertMsgReturn(pVM->enmVMState >= VMSTATE_CREATING && pVM->enmVMState <= VMSTATE_TERMINATED, ("%d\n", pVM->enmVMState), 1176 1380 VERR_WRONG_ORDER); … … 1250 1454 { 1251 1455 if ( pGVM->gvmm.s.VMMemObj != NIL_RTR0MEMOBJ 1252 && RTR0MemObjAddress(pGVM->gvmm.s.VMMemObj) == pGVM->pVM) 1456 #ifdef VBOX_BUGREF_9217 1457 && RTR0MemObjAddress(pGVM->gvmm.s.VMMemObj) == pGVM 1458 #else 1459 && RTR0MemObjAddress(pGVM->gvmm.s.VMMemObj) == pGVM->pVM 1460 #endif 1461 ) 1253 1462 { 1254 1463 LogFlow(("gvmmR0CleanupVM: Calling VMMR0TermVM\n")); 1464 #ifdef VBOX_BUGREF_9217 1465 VMMR0TermVM(pGVM, pGVM, NIL_VMCPUID); 1466 #else 1255 1467 VMMR0TermVM(pGVM, pGVM->pVM, NIL_VMCPUID); 1468 #endif 1256 1469 } 1257 1470 else 1471 #ifdef VBOX_BUGREF_9217 1472 AssertMsgFailed(("gvmmR0CleanupVM: VMMemObj=%p pGVM=%p\n", pGVM->gvmm.s.VMMemObj, pGVM)); 1473 #else 1258 1474 AssertMsgFailed(("gvmmR0CleanupVM: VMMemObj=%p pVM=%p\n", pGVM->gvmm.s.VMMemObj, pGVM->pVM)); 1475 #endif 1259 1476 } 1260 1477 … … 1265 1482 1266 1483 AssertCompile(NIL_RTTHREADCTXHOOK == (RTTHREADCTXHOOK)0); /* Depends on zero initialized memory working for NIL at the moment. */ 1484 #ifdef VBOX_BUGREF_9217 1485 for (VMCPUID idCpu = 0; idCpu < pGVM->cCpusSafe; idCpu++) 1486 #else 1267 1487 for (VMCPUID idCpu = 0; idCpu < pGVM->cCpus; idCpu++) 1488 #endif 1268 1489 { 1269 1490 /** @todo Can we busy wait here for all thread-context hooks to be … … 1271 1492 * solution for not deregistering hooks everytime we're leaving HMR0 1272 1493 * context. */ 1494 #ifdef VBOX_BUGREF_9217 1495 VMMR0ThreadCtxHookDestroyForEmt(&pGVM->aCpus[idCpu]); 1496 #else 1273 1497 VMMR0ThreadCtxHookDestroyForEmt(&pGVM->pVM->aCpus[idCpu]); 1498 #endif 1274 1499 } 1275 1500 } … … 1397 1622 } 1398 1623 1624 #ifndef VBOX_BUGREF_9217 1399 1625 if (pGVM->gvmm.s.VMMemObj != NIL_RTR0MEMOBJ) 1400 1626 { … … 1402 1628 pGVM->gvmm.s.VMMemObj = NIL_RTR0MEMOBJ; 1403 1629 } 1630 #endif 1404 1631 1405 1632 for (VMCPUID i = 0; i < pGVM->cCpus; i++) … … 1410 1637 pGVM->aCpus[i].gvmm.s.HaltEventMulti = NIL_RTSEMEVENTMULTI; 1411 1638 } 1639 #ifdef VBOX_BUGREF_9217 1640 if (pGVM->aCpus[i].gvmm.s.VMCpuMapObj != NIL_RTR0MEMOBJ) 1641 { 1642 rc = RTR0MemObjFree(pGVM->aCpus[i].gvmm.s.VMCpuMapObj, false /* fFreeMappings */); AssertRC(rc); 1643 pGVM->aCpus[i].gvmm.s.VMCpuMapObj = NIL_RTR0MEMOBJ; 1644 } 1645 #endif 1412 1646 } 1413 1647 1414 1648 /* the GVM structure itself. */ 1415 1649 pGVM->u32Magic |= UINT32_C(0x80000000); 1650 #ifdef VBOX_BUGREF_9217 1651 Assert(pGVM->gvmm.s.VMMemObj != NIL_RTR0MEMOBJ); 1652 rc = RTR0MemObjFree(pGVM->gvmm.s.VMMemObj, true /*fFreeMappings*/); AssertRC(rc); 1653 #else 1416 1654 RTMemFree(pGVM); 1655 #endif 1656 pGVM = NULL; 1417 1657 1418 1658 /* Re-acquire the UsedLock before freeing the handle since we're updating handle fields. */ … … 1466 1706 if (pGVM->aCpus[idCpu].hEMT == NIL_RTNATIVETHREAD) 1467 1707 { 1708 #ifdef VBOX_BUGREF_9217 1709 Assert(pGVM->aCpus[idCpu].hNativeThreadR0 == NIL_RTNATIVETHREAD); 1710 #else 1468 1711 Assert(pVM->aCpus[idCpu].hNativeThreadR0 == NIL_RTNATIVETHREAD); 1712 #endif 1469 1713 1470 1714 /* A thread may only be one EMT. */ … … 1477 1721 * Do the assignment, then try setup the hook. Undo if that fails. 1478 1722 */ 1723 #ifdef VBOX_BUGREF_9217 1724 pGVM->aCpus[idCpu].hNativeThreadR0 = pGVM->aCpus[idCpu].hEMT = RTThreadNativeSelf(); 1725 1726 rc = VMMR0ThreadCtxHookCreateForEmt(&pGVM->aCpus[idCpu]); 1727 if (RT_SUCCESS(rc)) 1728 CPUMR0RegisterVCpuThread(&pGVM->aCpus[idCpu]); 1729 else 1730 pGVM->aCpus[idCpu].hNativeThreadR0 = pGVM->aCpus[idCpu].hEMT = NIL_RTNATIVETHREAD; 1731 #else 1479 1732 pVM->aCpus[idCpu].hNativeThreadR0 = pGVM->aCpus[idCpu].hEMT = RTThreadNativeSelf(); 1480 1733 … … 1484 1737 else 1485 1738 pVM->aCpus[idCpu].hNativeThreadR0 = pGVM->aCpus[idCpu].hEMT = NIL_RTNATIVETHREAD; 1739 #endif 1486 1740 } 1487 1741 } … … 1531 1785 * Do per-EMT cleanups. 1532 1786 */ 1787 #ifdef VBOX_BUGREF_9217 1788 VMMR0ThreadCtxHookDestroyForEmt(&pGVM->aCpus[idCpu]); 1789 #else 1533 1790 VMMR0ThreadCtxHookDestroyForEmt(&pVM->aCpus[idCpu]); 1791 #endif 1534 1792 1535 1793 /* … … 1539 1797 AssertCompile(~(RTNATIVETHREAD)1 != NIL_RTNATIVETHREAD); 1540 1798 pGVM->aCpus[idCpu].hEMT = ~(RTNATIVETHREAD)1; 1799 #ifdef VBOX_BUGREF_9217 1800 pGVM->aCpus[idCpu].hNativeThreadR0 = NIL_RTNATIVETHREAD; 1801 #else 1541 1802 pVM->aCpus[idCpu].hNativeThreadR0 = NIL_RTNATIVETHREAD; 1803 #endif 1542 1804 } 1543 1805 … … 1573 1835 PGVM pGVM = pHandle->pGVM; 1574 1836 AssertPtrReturn(pGVM, NULL); 1837 #ifdef VBOX_BUGREF_9217 1838 AssertReturn(pGVM == pHandle->pVM, NULL); 1839 #else 1575 1840 AssertReturn(pGVM->pVM == pHandle->pVM, NULL); 1841 #endif 1576 1842 1577 1843 return pHandle->pGVM; … … 1630 1896 1631 1897 pGVM = pHandle->pGVM; 1898 #ifdef VBOX_BUGREF_9217 1899 if (RT_UNLIKELY( pHandle->pVM != pVM 1900 || pHandle->ProcId != ProcId 1901 || !VALID_PTR(pHandle->pvObj) 1902 || !VALID_PTR(pGVM) 1903 || pGVM != pVM)) 1904 #else 1632 1905 if (RT_UNLIKELY( pHandle->pVM != pVM 1633 1906 || pHandle->ProcId != ProcId … … 1635 1908 || !VALID_PTR(pGVM) 1636 1909 || pGVM->pVM != pVM)) 1910 #endif 1637 1911 { 1638 1912 GVMMR0_USED_SHARED_UNLOCK(pGVMM); … … 1652 1926 if (RT_UNLIKELY(!VALID_PTR(pGVM))) 1653 1927 return VERR_INVALID_HANDLE; 1928 #ifdef VBOX_BUGREF_9217 1929 if (RT_UNLIKELY(pGVM != pVM)) 1930 #else 1654 1931 if (RT_UNLIKELY(pGVM->pVM != pVM)) 1932 #endif 1655 1933 return VERR_INVALID_HANDLE; 1656 1934 } … … 1697 1975 PGVM pGVM = pHandle->pGVM; 1698 1976 AssertPtrReturn(pGVM, NULL); 1977 #ifdef VBOX_BUGREF_9217 1978 AssertReturn(pGVM == pVM, NULL); 1979 #else 1699 1980 AssertReturn(pGVM->pVM == pVM, NULL); 1981 #endif 1700 1982 1701 1983 return pGVM; … … 1732 2014 && ((uintptr_t)pVM & PAGE_OFFSET_MASK) == 0)) 1733 2015 { 2016 #ifdef VBOX_BUGREF_9217 2017 if (RT_LIKELY(pGVM == pVM)) 2018 #else 1734 2019 if (RT_LIKELY(pGVM->pVM == pVM)) 2020 #endif 1735 2021 { 1736 2022 /* … … 1810 2096 AssertPtrReturn(pVM, VERR_INVALID_POINTER); 1811 2097 AssertReturn(((uintptr_t)pVM & PAGE_OFFSET_MASK) == 0, VERR_INVALID_POINTER); 2098 #ifdef VBOX_BUGREF_9217 2099 AssertReturn(pGVM == pVM, VERR_INVALID_VM_HANDLE); 2100 #else 1812 2101 AssertReturn(pGVM->pVM == pVM, VERR_INVALID_VM_HANDLE); 2102 #endif 1813 2103 1814 2104 … … 2489 2779 { 2490 2780 if (idCpu < pGVM->cCpus) 2781 #ifdef VBOX_BUGREF_9217 2782 rc = gvmmR0SchedPokeOne(pGVM, &pGVM->aCpus[idCpu]); 2783 #else 2491 2784 rc = gvmmR0SchedPokeOne(pGVM, &pVM->aCpus[idCpu]); 2785 #endif 2492 2786 else 2493 2787 rc = VERR_INVALID_CPU_ID; … … 2543 2837 { 2544 2838 if (idCpu < pGVM->cCpus) 2839 #ifdef VBOX_BUGREF_9217 2840 rc = gvmmR0SchedPokeOne(pGVM, &pGVM->aCpus[idCpu]); 2841 #else 2545 2842 rc = gvmmR0SchedPokeOne(pGVM, &pVM->aCpus[idCpu]); 2843 #endif 2546 2844 else 2547 2845 rc = VERR_INVALID_CPU_ID; … … 2593 2891 else if (VMCPUSET_IS_PRESENT(pPokeSet, idCpu)) 2594 2892 { 2893 #ifdef VBOX_BUGREF_9217 2894 gvmmR0SchedPokeOne(pGVM, &pGVM->aCpus[idCpu]); 2895 #else 2595 2896 gvmmR0SchedPokeOne(pGVM, &pVM->aCpus[idCpu]); 2897 #endif 2596 2898 GVMM_CHECK_SMAP_CHECK2(pVM, RT_NOTHING); 2597 2899 } -
trunk/src/VBox/VMM/VMMR0/GVMMR0Internal.h
r76585 r78431 34 34 /** The event semaphore the EMT thread is blocking on. */ 35 35 RTSEMEVENTMULTI HaltEventMulti; 36 #ifdef VBOX_BUGREF_9217 37 /** The ring-3 mapping of the VMCPU structure. */ 38 RTR0MEMOBJ VMCpuMapObj; 39 #endif 36 40 /** The APIC ID of the CPU that EMT was scheduled on the last time we checked. */ 37 41 uint8_t iCpuEmt; -
trunk/src/VBox/VMM/VMMR0/PDMR0Device.cpp
r76553 r78431 27 27 #include <VBox/vmm/mm.h> 28 28 #include <VBox/vmm/vm.h> 29 #include <VBox/vmm/gvm.h> 29 30 #include <VBox/vmm/vmm.h> 30 31 #include <VBox/vmm/patm.h> … … 458 459 { 459 460 PDMDEV_ASSERT_DEVINS(pDevIns); 461 #ifdef VBOX_BUGREF_9217 462 PGVM pGVM = (PGVM)pDevIns->Internal.s.pVMR0; 463 PVMCPU pVCpu = &pGVM->aCpus[0]; /* for PIC we always deliver to CPU 0, MP use APIC */ 464 #else 460 465 PVM pVM = pDevIns->Internal.s.pVMR0; 461 466 PVMCPU pVCpu = &pVM->aCpus[0]; /* for PIC we always deliver to CPU 0, MP use APIC */ 467 #endif 462 468 /** @todo r=ramshankar: Propagating rcRZ and make all callers handle it? */ 463 469 APICLocalInterrupt(pVCpu, 0 /* u8Pin */, 1 /* u8Level */, VINF_SUCCESS /* rcRZ */); … … 469 475 { 470 476 PDMDEV_ASSERT_DEVINS(pDevIns); 477 #ifdef VBOX_BUGREF_9217 478 PGVM pGVM = (PGVM)pDevIns->Internal.s.pVMR0; 479 PVMCPU pVCpu = &pGVM->aCpus[0]; /* for PIC we always deliver to CPU 0, MP use APIC */ 480 #else 471 481 PVM pVM = pDevIns->Internal.s.pVMR0; 472 482 PVMCPU pVCpu = &pVM->aCpus[0]; /* for PIC we always deliver to CPU 0, MP use APIC */ 483 #endif 473 484 /** @todo r=ramshankar: Propagating rcRZ and make all callers handle it? */ 474 485 APICLocalInterrupt(pVCpu, 0 /* u8Pin */, 0 /* u8Level */, VINF_SUCCESS /* rcRZ */); -
trunk/src/VBox/VMM/VMMR0/PGMR0.cpp
r76553 r78431 24 24 #include <VBox/vmm/pgm.h> 25 25 #include <VBox/vmm/gmm.h> 26 #include <VBox/vmm/gvm.h>27 26 #include "PGMInternal.h" 28 27 #include <VBox/vmm/vm.h> 28 #include <VBox/vmm/gvm.h> 29 29 #include "PGMInline.h" 30 30 #include <VBox/log.h> … … 78 78 AssertReturn(idCpu < pGVM->cCpus, VERR_INVALID_CPU_ID); /* caller already checked this, but just to be sure. */ 79 79 AssertReturn(pGVM->aCpus[idCpu].hEMT == RTThreadNativeSelf(), VERR_NOT_OWNER); 80 #ifdef VBOX_BUGREF_9217 81 PGM_LOCK_ASSERT_OWNER_EX(pVM, &pGVM->aCpus[idCpu]); 82 #else 80 83 PGM_LOCK_ASSERT_OWNER_EX(pVM, &pVM->aCpus[idCpu]); 84 #endif 81 85 82 86 /* … … 201 205 AssertReturn(idCpu < pGVM->cCpus, VERR_INVALID_CPU_ID); /* caller already checked this, but just to be sure. */ 202 206 AssertReturn(pGVM->aCpus[idCpu].hEMT == RTThreadNativeSelf(), VERR_NOT_OWNER); 207 #ifdef VBOX_BUGREF_9217 208 PGM_LOCK_ASSERT_OWNER_EX(pVM, &pGVM->aCpus[idCpu]); 209 #else 203 210 PGM_LOCK_ASSERT_OWNER_EX(pVM, &pVM->aCpus[idCpu]); 211 #endif 204 212 205 213 /* … … 241 249 AssertReturn(idCpu < pGVM->cCpus, VERR_INVALID_CPU_ID); /* caller already checked this, but just to be sure. */ 242 250 AssertReturn(pGVM->aCpus[idCpu].hEMT == RTThreadNativeSelf(), VERR_NOT_OWNER); 251 #ifdef VBOX_BUGREF_9217 252 PGM_LOCK_ASSERT_OWNER_EX(pVM, &pGVM->aCpus[idCpu]); 253 #else 243 254 PGM_LOCK_ASSERT_OWNER_EX(pVM, &pVM->aCpus[idCpu]); 255 #endif 244 256 Assert(!pVM->pgm.s.cLargeHandyPages); 245 257 -
trunk/src/VBox/VMM/VMMR0/PGMR0SharedPage.cpp
r76553 r78431 25 25 #include "PGMInternal.h" 26 26 #include <VBox/vmm/vm.h> 27 #include <VBox/vmm/gvm.h> 27 28 #include "PGMInline.h" 28 29 #include <VBox/log.h> … … 50 51 VMMR0DECL(int) PGMR0SharedModuleCheck(PVM pVM, PGVM pGVM, VMCPUID idCpu, PGMMSHAREDMODULE pModule, PCRTGCPTR64 paRegionsGCPtrs) 51 52 { 53 #ifdef VBOX_BUGREF_9217 54 PVMCPU pVCpu = &pGVM->aCpus[idCpu]; 55 #else 52 56 PVMCPU pVCpu = &pVM->aCpus[idCpu]; 57 #endif 53 58 int rc = VINF_SUCCESS; 54 59 bool fFlushTLBs = false; … … 162 167 163 168 if (fFlushRemTLBs) 169 #ifdef VBOX_BUGREF_9217 170 for (VMCPUID idCurCpu = 0; idCurCpu < pGVM->cCpus; idCurCpu++) 171 CPUMSetChangedFlags(&pGVM->aCpus[idCurCpu], CPUM_CHANGED_GLOBAL_TLB_FLUSH); 172 #else 164 173 for (VMCPUID idCurCpu = 0; idCurCpu < pVM->cCpus; idCurCpu++) 165 174 CPUMSetChangedFlags(&pVM->aCpus[idCurCpu], CPUM_CHANGED_GLOBAL_TLB_FLUSH); 175 #endif 166 176 167 177 return rc; -
trunk/src/VBox/VMM/VMMR0/VMMR0.cpp
r76553 r78431 395 395 * Register the EMT R0 logger instance for VCPU 0. 396 396 */ 397 #ifdef VBOX_BUGREF_9217 398 PVMCPU pVCpu = &pGVM->aCpus[0]; 399 #else 397 400 PVMCPU pVCpu = &pVM->aCpus[0]; 401 #endif 398 402 399 403 PVMMR0LOGGER pR0Logger = pVCpu->vmm.s.pR0LoggerR0; … … 471 475 { 472 476 VMM_CHECK_SMAP_CHECK2(pVM, RT_NOTHING); 477 #ifdef VBOX_BUGREF_9217 478 rc = EMR0InitVM(pGVM); 479 #else 473 480 rc = EMR0InitVM(pGVM, pVM); 481 #endif 474 482 if (RT_SUCCESS(rc)) 475 483 { … … 536 544 * Registration of ring 0 loggers. 537 545 */ 546 #ifdef VBOX_BUGREF_9217 547 PVMCPU pVCpu = &pGVM->aCpus[idCpu]; 548 #else 538 549 PVMCPU pVCpu = &pVM->aCpus[idCpu]; 550 #endif 539 551 PVMMR0LOGGER pR0Logger = pVCpu->vmm.s.pR0LoggerR0; 540 552 if ( pR0Logger … … 717 729 static int vmmR0DoHalt(PGVM pGVM, PVM pVM, PGVMCPU pGVCpu, PVMCPU pVCpu) 718 730 { 731 #ifdef VBOX_BUGREF_9217 732 Assert(pVCpu == pGVCpu); 733 #else 719 734 Assert(pVCpu == pGVCpu->pVCpu); 735 #endif 720 736 721 737 /* … … 1300 1316 1301 1317 PGVMCPU pGVCpu = &pGVM->aCpus[idCpu]; 1318 #ifdef VBOX_BUGREF_9217 1319 PVMCPU pVCpu = pGVCpu; 1320 #else 1302 1321 PVMCPU pVCpu = &pVM->aCpus[idCpu]; 1322 #endif 1303 1323 RTNATIVETHREAD const hNativeThread = RTThreadNativeSelf(); 1304 1324 if (RT_LIKELY( pGVCpu->hEMT == hNativeThread … … 1754 1774 } 1755 1775 1776 #ifdef VBOX_BUGREF_9217 1777 if (RT_LIKELY(pGVM == pVM)) 1778 #else 1756 1779 if (RT_LIKELY(pGVM->pVM == pVM)) 1780 #endif 1757 1781 { /* likely */ } 1758 1782 else 1759 1783 { 1784 #ifdef VBOX_BUGREF_9217 1785 SUPR0Printf("vmmR0EntryExWorker: pVM mismatch: got %p, pGVM/pVM=%p\n", pVM, pGVM); 1786 #else 1760 1787 SUPR0Printf("vmmR0EntryExWorker: pVM mismatch: got %p, pGVM->pVM=%p\n", pVM, pGVM->pVM); 1788 #endif 1761 1789 return VERR_INVALID_PARAMETER; 1762 1790 } … … 1942 1970 if (RT_UNLIKELY(pVM->cCpus != 1)) 1943 1971 return VERR_INVALID_PARAMETER; 1972 # ifdef VBOX_BUGREF_9217 1973 PVMCPU pVCpu = &pGVM->aCpus[idCpu]; 1974 # else 1944 1975 PVMCPU pVCpu = &pVM->aCpus[idCpu]; 1976 # endif 1945 1977 # ifndef VBOX_WITH_2X_4GB_ADDR_SPACE_IN_R0 1946 1978 if (RT_UNLIKELY(!PGMGetHyperCR3(pVCpu))) … … 2513 2545 { 2514 2546 PGVMCPU pGVCpu = &pGVM->aCpus[idCpu]; 2547 #ifdef VBOX_BUGREF_9217 2548 PVMCPU pVCpu = pGVCpu; 2549 #else 2515 2550 PVMCPU pVCpu = &pVM->aCpus[idCpu]; 2551 #endif 2516 2552 RTNATIVETHREAD hNativeThread = RTThreadNativeSelf(); 2517 2553 if (RT_LIKELY( pGVCpu->hEMT == hNativeThread … … 2696 2732 if (pGVCpu) 2697 2733 { 2734 #ifdef VBOX_BUGREF_9217 2735 PVMCPU pVCpu = pGVCpu; 2736 #else 2698 2737 PVMCPU pVCpu = pGVCpu->pVCpu; 2738 #endif 2699 2739 if (RT_VALID_PTR(pVCpu)) 2700 2740 { … … 2703 2743 { 2704 2744 if ( pVmmLogger->fCreated 2705 && pVmmLogger->pVM == pGVCpu->pVM) 2745 #ifdef VBOX_BUGREF_9217 2746 && pVmmLogger->pVM == pGVCpu->pGVM 2747 #else 2748 && pVmmLogger->pVM == pGVCpu->pVM 2749 #endif 2750 ) 2706 2751 { 2707 2752 if (pVmmLogger->Logger.fFlags & RTLOGFLAGS_DISABLED) -
trunk/src/VBox/VMM/VMMR3/VM.cpp
r77196 r78431 593 593 AssertRelease(pVM->cCpus == cCpus); 594 594 AssertRelease(pVM->uCpuExecutionCap == 100); 595 #ifdef VBOX_WITH_RAW_MODE 595 596 AssertRelease(pVM->offVMCPU == RT_UOFFSETOF(VM, aCpus)); 597 #endif 596 598 AssertCompileMemberAlignment(VM, cpum, 64); 597 599 AssertCompileMemberAlignment(VM, tm, 64);
Note:
See TracChangeset
for help on using the changeset viewer.