Changeset 72924 in vbox for trunk/src/VBox/VMM/VMMR0
- Timestamp:
- Jul 5, 2018 4:14:26 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMR0/NEMR0Native-win.cpp
r72918 r72924 82 82 uint32_t cPages, uint32_t fFlags); 83 83 NEM_TMPL_STATIC int nemR0WinUnmapPages(PGVM pGVM, PGVMCPU pGVCpu, RTGCPHYS GCPhys, uint32_t cPages); 84 #if defined(NEM_WIN_WITH_RING0_RUNLOOP) || defined(NEM_WIN_USE_HYPERCALLS_FOR_REGISTERS) 84 85 NEM_TMPL_STATIC int nemR0WinExportState(PGVM pGVM, PGVMCPU pGVCpu, PCPUMCTX pCtx); 85 86 NEM_TMPL_STATIC int nemR0WinImportState(PGVM pGVM, PGVMCPU pGVCpu, PCPUMCTX pCtx, uint64_t fWhat); 86 87 NEM_TMPL_STATIC int nemR0WinQueryCpuTick(PGVM pGVM, PGVMCPU pGVCpu, uint64_t *pcTicks, uint32_t *pcAux); 87 88 NEM_TMPL_STATIC int nemR0WinResumeCpuTickOnAll(PGVM pGVM, PGVMCPU pGVCpu, uint64_t uPausedTscValue); 89 #endif 88 90 DECLINLINE(NTSTATUS) nemR0NtPerformIoControl(PGVM pGVM, uint32_t uFunction, void *pvInput, uint32_t cbInput, 89 91 void *pvOutput, uint32_t cbOutput); … … 93 95 * Instantate the code we share with ring-0. 94 96 */ 97 #ifdef NEM_WIN_WITH_RING0_RUNLOOP 98 # define NEM_WIN_TEMPLATE_MODE_OWN_RUN_API 99 #else 100 # undef NEM_WIN_TEMPLATE_MODE_OWN_RUN_API 101 #endif 95 102 #include "../VMMAll/NEMAllNativeTemplate-win.cpp.h" 103 104 96 105 97 106 /** … … 582 591 583 592 593 #if defined(NEM_WIN_WITH_RING0_RUNLOOP) || defined(NEM_WIN_USE_HYPERCALLS_FOR_REGISTERS) 584 594 /** 585 595 * Worker for NEMR0ExportState. … … 722 732 723 733 /* Segments */ 724 # define COPY_OUT_SEG(a_idx, a_enmName, a_SReg) \734 # define COPY_OUT_SEG(a_idx, a_enmName, a_SReg) \ 725 735 do { \ 726 736 HV_REGISTER_ASSOC_ZERO_PADDING(&pInput->Elements[a_idx]); \ … … 1098 1108 pInput->Elements[iReg].Value.Reg64 = pCtx->msrPAT; 1099 1109 iReg++; 1100 # if 0 /** @todo HvX64RegisterMtrrCap is read only? Seems it's not even readable. */1110 # if 0 /** @todo HvX64RegisterMtrrCap is read only? Seems it's not even readable. */ 1101 1111 HV_REGISTER_ASSOC_ZERO_PADDING_AND_HI64(&pInput->Elements[iReg]); 1102 1112 pInput->Elements[iReg].Name = HvX64RegisterMtrrCap; 1103 1113 pInput->Elements[iReg].Value.Reg64 = CPUMGetGuestIa32MtrrCap(pVCpu); 1104 1114 iReg++; 1105 # endif1115 # endif 1106 1116 1107 1117 PCPUMCTXMSRS pCtxMsrs = CPUMQueryGuestCtxMsrsPtr(pVCpu); … … 1163 1173 iReg++; 1164 1174 1165 # if 0 /** @todo Why can't we write these on Intel systems? Not that we really care... */1175 # if 0 /** @todo Why can't we write these on Intel systems? Not that we really care... */ 1166 1176 const CPUMCPUVENDOR enmCpuVendor = CPUMGetHostCpuVendor(pGVM->pVM); 1167 1177 if (enmCpuVendor != CPUMCPUVENDOR_AMD) … … 1176 1186 iReg++; 1177 1187 } 1178 # endif1188 # endif 1179 1189 } 1180 1190 … … 1260 1270 return VINF_SUCCESS; 1261 1271 } 1272 #endif /* NEM_WIN_WITH_RING0_RUNLOOP || NEM_WIN_USE_HYPERCALLS_FOR_REGISTERS */ 1262 1273 1263 1274 … … 1273 1284 VMMR0_INT_DECL(int) NEMR0ExportState(PGVM pGVM, PVM pVM, VMCPUID idCpu) 1274 1285 { 1286 #if defined(NEM_WIN_WITH_RING0_RUNLOOP) || defined(NEM_WIN_USE_HYPERCALLS_FOR_REGISTERS) 1275 1287 /* 1276 1288 * Validate the call. … … 1289 1301 } 1290 1302 return rc; 1303 #else 1304 RT_NOREF(pGVM, pVM, idCpu); 1305 return VERR_NOT_IMPLEMENTED; 1306 #endif 1291 1307 } 1292 1308 1293 1309 1310 #if defined(NEM_WIN_WITH_RING0_RUNLOOP) || defined(NEM_WIN_USE_HYPERCALLS_FOR_REGISTERS) 1294 1311 /** 1295 1312 * Worker for NEMR0ImportState. … … 1470 1487 } 1471 1488 1472 # ifdef LOG_ENABLED1489 # ifdef LOG_ENABLED 1473 1490 const CPUMCPUVENDOR enmCpuVendor = CPUMGetHostCpuVendor(pGVM->pVM); 1474 # endif1491 # endif 1475 1492 if (fWhat & CPUMCTX_EXTRN_OTHER_MSRS) 1476 1493 { 1477 1494 pInput->Names[iReg++] = HvX64RegisterApicBase; /// @todo APIC BASE 1478 1495 pInput->Names[iReg++] = HvX64RegisterPat; 1479 # if 0 /*def LOG_ENABLED*/ /** @todo something's wrong with HvX64RegisterMtrrCap? (AMD) */1496 # if 0 /*def LOG_ENABLED*/ /** @todo something's wrong with HvX64RegisterMtrrCap? (AMD) */ 1480 1497 pInput->Names[iReg++] = HvX64RegisterMtrrCap; 1481 # endif1498 # endif 1482 1499 pInput->Names[iReg++] = HvX64RegisterMtrrDefType; 1483 1500 pInput->Names[iReg++] = HvX64RegisterMtrrFix64k00000; … … 1493 1510 pInput->Names[iReg++] = HvX64RegisterMtrrFix4kF8000; 1494 1511 pInput->Names[iReg++] = HvX64RegisterTscAux; 1495 # if 0 /** @todo why can't we read HvX64RegisterIa32MiscEnable? */1512 # if 0 /** @todo why can't we read HvX64RegisterIa32MiscEnable? */ 1496 1513 if (enmCpuVendor != CPUMCPUVENDOR_AMD) 1497 1514 pInput->Names[iReg++] = HvX64RegisterIa32MiscEnable; 1498 # endif1499 # ifdef LOG_ENABLED1515 # endif 1516 # ifdef LOG_ENABLED 1500 1517 if (enmCpuVendor != CPUMCPUVENDOR_AMD) 1501 1518 pInput->Names[iReg++] = HvX64RegisterIa32FeatureControl; 1502 # endif1519 # endif 1503 1520 } 1504 1521 … … 1609 1626 1610 1627 /* Segments */ 1611 # define COPY_BACK_SEG(a_idx, a_enmName, a_SReg) \1628 # define COPY_BACK_SEG(a_idx, a_enmName, a_SReg) \ 1612 1629 do { \ 1613 1630 Assert(pInput->Names[a_idx] == a_enmName); \ … … 1989 2006 iReg++; 1990 2007 1991 # if 0 /*def LOG_ENABLED*/ /** @todo something's wrong with HvX64RegisterMtrrCap? (AMD) */2008 # if 0 /*def LOG_ENABLED*/ /** @todo something's wrong with HvX64RegisterMtrrCap? (AMD) */ 1992 2009 Assert(pInput->Names[iReg] == HvX64RegisterMtrrCap); 1993 2010 if (paValues[iReg].Reg64 != CPUMGetGuestIa32MtrrCap(pVCpu)) 1994 2011 Log7(("NEM/%u: MSR MTRR_CAP changed %RX64 -> %RX64 (!!)\n", pVCpu->idCpu, CPUMGetGuestIa32MtrrCap(pVCpu), paValues[iReg].Reg64)); 1995 2012 iReg++; 1996 # endif2013 # endif 1997 2014 1998 2015 PCPUMCTXMSRS pCtxMsrs = CPUMQueryGuestCtxMsrsPtr(pVCpu); … … 2077 2094 iReg++; 2078 2095 2079 # if 0 /** @todo why can't we even read HvX64RegisterIa32MiscEnable? */2096 # if 0 /** @todo why can't we even read HvX64RegisterIa32MiscEnable? */ 2080 2097 if (enmCpuVendor != CPUMCPUVENDOR_AMD) 2081 2098 { … … 2086 2103 iReg++; 2087 2104 } 2088 # endif2089 # ifdef LOG_ENABLED2105 # endif 2106 # ifdef LOG_ENABLED 2090 2107 if (enmCpuVendor != CPUMCPUVENDOR_AMD) 2091 2108 { … … 2095 2112 iReg++; 2096 2113 } 2097 # endif2114 # endif 2098 2115 } 2099 2116 … … 2179 2196 return rc; 2180 2197 } 2198 #endif /* NEM_WIN_WITH_RING0_RUNLOOP || NEM_WIN_USE_HYPERCALLS_FOR_REGISTERS */ 2181 2199 2182 2200 … … 2194 2212 VMMR0_INT_DECL(int) NEMR0ImportState(PGVM pGVM, PVM pVM, VMCPUID idCpu, uint64_t fWhat) 2195 2213 { 2214 #if defined(NEM_WIN_WITH_RING0_RUNLOOP) || defined(NEM_WIN_USE_HYPERCALLS_FOR_REGISTERS) 2196 2215 /* 2197 2216 * Validate the call. … … 2210 2229 } 2211 2230 return rc; 2231 #else 2232 RT_NOREF(pGVM, pVM, idCpu, fWhat); 2233 return VERR_NOT_IMPLEMENTED; 2234 #endif 2212 2235 } 2213 2236 2214 2237 2238 #if defined(NEM_WIN_WITH_RING0_RUNLOOP) || defined(NEM_WIN_USE_HYPERCALLS_FOR_REGISTERS) 2215 2239 /** 2216 2240 * Worker for NEMR0QueryCpuTick and the ring-0 NEMHCQueryCpuTick. … … 2258 2282 return VINF_SUCCESS; 2259 2283 } 2284 #endif /* NEM_WIN_WITH_RING0_RUNLOOP || NEM_WIN_USE_HYPERCALLS_FOR_REGISTERS */ 2260 2285 2261 2286 … … 2271 2296 VMMR0_INT_DECL(int) NEMR0QueryCpuTick(PGVM pGVM, PVM pVM, VMCPUID idCpu) 2272 2297 { 2298 #if defined(NEM_WIN_WITH_RING0_RUNLOOP) || defined(NEM_WIN_USE_HYPERCALLS_FOR_REGISTERS) 2273 2299 /* 2274 2300 * Validate the call. … … 2290 2316 } 2291 2317 return rc; 2318 #else 2319 RT_NOREF(pGVM, pVM, idCpu); 2320 return VERR_NOT_IMPLEMENTED; 2321 #endif 2292 2322 } 2293 2323 2294 2324 2325 #if defined(NEM_WIN_WITH_RING0_RUNLOOP) || defined(NEM_WIN_USE_HYPERCALLS_FOR_REGISTERS) 2295 2326 /** 2296 2327 * Worker for NEMR0ResumeCpuTickOnAll and the ring-0 NEMHCResumeCpuTickOnAll. … … 2360 2391 return VINF_SUCCESS; 2361 2392 } 2393 #endif /* NEM_WIN_WITH_RING0_RUNLOOP || NEM_WIN_USE_HYPERCALLS_FOR_REGISTERS */ 2362 2394 2363 2395 … … 2374 2406 VMMR0_INT_DECL(int) NEMR0ResumeCpuTickOnAll(PGVM pGVM, PVM pVM, VMCPUID idCpu, uint64_t uPausedTscValue) 2375 2407 { 2408 #if defined(NEM_WIN_WITH_RING0_RUNLOOP) || defined(NEM_WIN_USE_HYPERCALLS_FOR_REGISTERS) 2376 2409 /* 2377 2410 * Validate the call. … … 2392 2425 } 2393 2426 return rc; 2427 #else 2428 RT_NOREF(pGVM, pVM, idCpu, uPausedTscValue); 2429 return VERR_NOT_IMPLEMENTED; 2430 #endif 2394 2431 } 2395 2432 … … 2397 2434 VMMR0_INT_DECL(VBOXSTRICTRC) NEMR0RunGuestCode(PGVM pGVM, VMCPUID idCpu) 2398 2435 { 2399 #ifdef NEM_WIN_ USE_OUR_OWN_RUN_API2436 #ifdef NEM_WIN_WITH_RING0_RUNLOOP 2400 2437 PVM pVM = pGVM->pVM; 2401 2438 return nemHCWinRunGC(pVM, &pVM->aCpus[idCpu], pGVM, &pGVM->aCpus[idCpu]);
Note:
See TracChangeset
for help on using the changeset viewer.