Changeset 4161 in vbox
- Timestamp:
- Aug 15, 2007 9:24:10 PM (17 years ago)
- Location:
- trunk/src/VBox/HostDrivers/Support
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostDrivers/Support/SUPDRV.h
r4156 r4161 28 28 #include <iprt/asm.h> 29 29 #include <VBox/sup.h> 30 #if defined(USE_NEW_OS_INTERFACE) || defined(USB_NEW_OS_INTERFACE_FOR_LOW) 30 #ifdef USE_NEW_OS_INTERFACE 31 # define USE_NEW_OS_INTERFACE_FOR_MM 32 # define USE_NEW_OS_INTERFACE_FOR_GIP 33 # undef USE_NEW_OS_INTERFACE_FOR_LOW 34 #endif 35 #if defined(USE_NEW_OS_INTERFACE) || defined(USE_NEW_OS_INTERFACE_FOR_LOW) || defined(USE_NEW_OS_INTERFACE_FOR_MM) || defined(USE_NEW_OS_INTERFACE_FOR_GIP) 31 36 # include <iprt/memobj.h> 32 37 # include <iprt/time.h> … … 362 367 typedef struct SUPDRVMEMREF 363 368 { 364 #ifdef USE_NEW_OS_INTERFACE 369 #ifdef USE_NEW_OS_INTERFACE_FOR_MM 365 370 /** The memory object handle. */ 366 371 RTR0MEMOBJ MemObj; … … 370 375 SUPDRVMEMREFTYPE eType; 371 376 372 #else /* !USE_NEW_OS_INTERFACE */377 #else /* !USE_NEW_OS_INTERFACE_FOR_MM */ 373 378 /** Pointer to the R0 mapping of the memory. 374 379 * Set to NULL if N/A. */ … … 424 429 #endif 425 430 } mem; 426 #if defined(US B_NEW_OS_INTERFACE_FOR_LOW)431 #if defined(USE_NEW_OS_INTERFACE_FOR_LOW) 427 432 struct 428 433 { … … 434 439 #endif 435 440 } u; 436 #endif /* !USE_NEW_OS_INTERFACE */441 #endif /* !USE_NEW_OS_INTERFACE_FOR_MM */ 437 442 } SUPDRVMEMREF, *PSUPDRVMEMREF; 438 443 … … 566 571 /** Spinlock protecting the bundles and the GIP members. */ 567 572 RTSPINLOCK Spinlock; 568 #ifdef USE_NEW_OS_INTERFACE 573 #ifdef USE_NEW_OS_INTERFACE_FOR_GIP 569 574 /** The ring-3 mapping of the GIP (readonly). */ 570 575 RTR0MEMOBJ GipMapObjR3; … … 651 656 * (The updates are suspend while cGipUsers is 0.)*/ 652 657 uint32_t volatile cGipUsers; 653 #ifdef USE_NEW_OS_INTERFACE 658 #ifdef USE_NEW_OS_INTERFACE_FOR_GIP 654 659 /** The ring-0 memory object handle for the GIP page. */ 655 660 RTR0MEMOBJ GipMemObj; … … 703 708 void VBOXCALL supdrvOSObjInitCreator(PSUPDRVOBJ pObj, PSUPDRVSESSION pSession); 704 709 bool VBOXCALL supdrvOSObjCanAccess(PSUPDRVOBJ pObj, PSUPDRVSESSION pSession, const char *pszObjName, int *prc); 705 #ifndef USE_NEW_OS_INTERFACE 710 #ifndef USE_NEW_OS_INTERFACE_FOR_MM 706 711 int VBOXCALL supdrvOSLockMemOne(PSUPDRVMEMREF pMem, PSUPPAGE paPages); 707 712 void VBOXCALL supdrvOSUnlockMemOne(PSUPDRVMEMREF pMem); … … 713 718 void VBOXCALL supdrvOSMemGetPages(PSUPDRVMEMREF pMem, PSUPPAGE paPages); 714 719 void VBOXCALL supdrvOSMemFreeOne(PSUPDRVMEMREF pMem); 720 #endif 721 #ifndef USE_NEW_OS_INTERFACE_FOR_GIP 715 722 int VBOXCALL supdrvOSGipMap(PSUPDRVDEVEXT pDevExt, PSUPGLOBALINFOPAGE *ppGip); 716 723 int VBOXCALL supdrvOSGipUnmap(PSUPDRVDEVEXT pDevExt, PSUPGLOBALINFOPAGE pGip); -
trunk/src/VBox/HostDrivers/Support/SUPDRVShared.c
r4138 r4161 160 160 static int supdrvIOCtl_GetPagingMode(PSUPGETPAGINGMODE_OUT pOut); 161 161 static SUPGIPMODE supdrvGipDeterminTscMode(void); 162 #ifdef USE_NEW_OS_INTERFACE 162 #ifdef USE_NEW_OS_INTERFACE_FOR_GIP 163 163 static int supdrvGipCreate(PSUPDRVDEVEXT pDevExt); 164 164 static int supdrvGipDestroy(PSUPDRVDEVEXT pDevExt); … … 192 192 if (!rc) 193 193 { 194 #ifdef USE_NEW_OS_INTERFACE 194 #ifdef USE_NEW_OS_INTERFACE_FOR_GIP 195 195 rc = supdrvGipCreate(pDevExt); 196 196 if (RT_SUCCESS(rc)) … … 277 277 } 278 278 279 #ifdef USE_NEW_OS_INTERFACE 279 #ifdef USE_NEW_OS_INTERFACE_FOR_GIP 280 280 /* kill the GIP */ 281 281 supdrvGipDestroy(pDevExt); … … 456 456 for (i = 0; i < sizeof(pBundle->aMem) / sizeof(pBundle->aMem[0]); i++) 457 457 { 458 #ifdef USE_NEW_OS_INTERFACE 458 #ifdef USE_NEW_OS_INTERFACE_FOR_MM 459 459 if (pBundle->aMem[i].MemObj != NIL_RTR0MEMOBJ) 460 460 { … … 472 472 } 473 473 474 #else /* !USE_NEW_OS_INTERFACE */474 #else /* !USE_NEW_OS_INTERFACE_FOR_MM */ 475 475 if ( pBundle->aMem[i].pvR0 476 476 || pBundle->aMem[i].pvR3) … … 497 497 pBundle->aMem[i].eType = MEMREF_TYPE_UNUSED; 498 498 } 499 #endif /* !USE_NEW_OS_INTERFACE */499 #endif /* !USE_NEW_OS_INTERFACE_FOR_MM */ 500 500 } 501 501 … … 542 542 */ 543 543 dprintf2(("umapping GIP:\n")); 544 #ifdef USE_NEW_OS_INTERFACE 544 #ifdef USE_NEW_OS_INTERFACE_FOR_GIP 545 545 if (pSession->GipMapObjR3 != NIL_RTR0MEMOBJ) 546 546 #else … … 549 549 { 550 550 SUPR0GipUnmap(pSession); 551 #ifndef USE_NEW_OS_INTERFACE 551 #ifndef USE_NEW_OS_INTERFACE_FOR_GIP 552 552 pSession->pGip = NULL; 553 553 #endif … … 1767 1767 } 1768 1768 1769 #ifdef USE_NEW_OS_INTERFACE 1769 #ifdef USE_NEW_OS_INTERFACE_FOR_MM 1770 1770 /* 1771 1771 * Let IPRT do the job. … … 1775 1775 if (RT_SUCCESS(rc)) 1776 1776 { 1777 unsigned iPage = cPages; 1777 1778 AssertMsg(RTR0MemObjAddressR3(Mem.MemObj) == pvR3, ("%p == %p\n", RTR0MemObjAddressR3(Mem.MemObj), pvR3)); 1778 1779 AssertMsg(RTR0MemObjSize(Mem.MemObj) == cb, ("%x == %x\n", RTR0MemObjSize(Mem.MemObj), cb)); 1779 1780 1780 unsigned iPage = cPages;1781 1781 while (iPage-- > 0) 1782 1782 { … … 1799 1799 } 1800 1800 1801 #else /* !USE_NEW_OS_INTERFACE */1801 #else /* !USE_NEW_OS_INTERFACE_FOR_MM */ 1802 1802 1803 1803 /* … … 1818 1818 if (rc) 1819 1819 supdrvOSUnlockMemOne(&Mem); 1820 #endif /* !USE_NEW_OS_INTERFACE */1820 #endif /* !USE_NEW_OS_INTERFACE_FOR_MM */ 1821 1821 return rc; 1822 1822 } … … 1872 1872 } 1873 1873 1874 #ifdef USE_NEW_OS_INTERFACE 1874 #ifdef USE_NEW_OS_INTERFACE_FOR_MM 1875 1875 /* 1876 1876 * Let IPRT do the job. … … 1901 1901 } 1902 1902 1903 #else /* !USE_NEW_OS_INTERFACE */1903 #else /* !USE_NEW_OS_INTERFACE_FOR_MM */ 1904 1904 1905 1905 /* … … 1922 1922 if (rc) 1923 1923 supdrvOSContFreeOne(&Mem); 1924 #endif /* !USE_NEW_OS_INTERFACE */1924 #endif /* !USE_NEW_OS_INTERFACE_FOR_MM */ 1925 1925 1926 1926 return rc; … … 1977 1977 } 1978 1978 1979 #ifdef USE_NEW_OS_INTERFACE 1979 #ifdef USE_NEW_OS_INTERFACE_FOR_MM 1980 1980 /* 1981 1981 * Let IPRT do the work. … … 2012 2012 } 2013 2013 2014 #else /* !USE_NEW_OS_INTERFACE */2014 #else /* !USE_NEW_OS_INTERFACE_FOR_MM */ 2015 2015 2016 2016 /* … … 2035 2035 if (rc) 2036 2036 supdrvOSLowFreeOne(&Mem); 2037 #endif /* !USE_NEW_OS_INTERFACE */2037 #endif /* !USE_NEW_OS_INTERFACE_FOR_MM */ 2038 2038 return rc; 2039 2039 } … … 2088 2088 } 2089 2089 2090 #ifdef USE_NEW_OS_INTERFACE 2090 #ifdef USE_NEW_OS_INTERFACE_FOR_MM 2091 2091 /* 2092 2092 * Let IPRT do the work. … … 2116 2116 } 2117 2117 2118 #else /* !USE_NEW_OS_INTERFACE */2118 #else /* !USE_NEW_OS_INTERFACE_FOR_MM */ 2119 2119 2120 2120 /* … … 2137 2137 if (rc) 2138 2138 supdrvOSMemFreeOne(&Mem); 2139 #endif /* !USE_NEW_OS_INTERFACE */2139 #endif /* !USE_NEW_OS_INTERFACE_FOR_MM */ 2140 2140 return rc; 2141 2141 } … … 2182 2182 for (i = 0; i < sizeof(pBundle->aMem) / sizeof(pBundle->aMem[0]); i++) 2183 2183 { 2184 #ifdef USE_NEW_OS_INTERFACE 2184 #ifdef USE_NEW_OS_INTERFACE_FOR_MM 2185 2185 if ( pBundle->aMem[i].eType == MEMREF_TYPE_MEM 2186 2186 && pBundle->aMem[i].MemObj != NIL_RTR0MEMOBJ … … 2201 2201 return 0; 2202 2202 } 2203 #else /* !USE_NEW_OS_INTERFACE */2203 #else /* !USE_NEW_OS_INTERFACE_FOR_MM */ 2204 2204 if ( pBundle->aMem[i].eType == MEMREF_TYPE_MEM 2205 2205 && ( (RTHCUINTPTR)pBundle->aMem[i].pvR0 == uPtr … … 2270 2270 if (ppGipR3) 2271 2271 { 2272 #ifdef USE_NEW_OS_INTERFACE 2272 #ifdef USE_NEW_OS_INTERFACE_FOR_GIP 2273 2273 if (pSession->GipMapObjR3 == NIL_RTR0MEMOBJ) 2274 2274 rc = RTR0MemObjMapUser(&pSession->GipMapObjR3, pDevExt->GipMemObj, (RTR3PTR)-1, 0, … … 2279 2279 rc = VINF_SUCCESS; /** @todo remove this and replace the !rc below with RT_SUCCESS(rc). */ 2280 2280 } 2281 #else /* !USE_NEW_OS_INTERFACE */2281 #else /* !USE_NEW_OS_INTERFACE_FOR_GIP */ 2282 2282 if (!pSession->pGip) 2283 2283 rc = supdrvOSGipMap(pSession->pDevExt, &pSession->pGip); 2284 2284 if (!rc) 2285 2285 pGip = (RTR3PTR)pSession->pGip; 2286 #endif /* !USE_NEW_OS_INTERFACE */2286 #endif /* !USE_NEW_OS_INTERFACE_FOR_GIP */ 2287 2287 } 2288 2288 … … 2311 2311 ASMAtomicXchgU64(&pGip->u64NanoTSLastUpdateHz, 0); 2312 2312 2313 #ifdef USE_NEW_OS_INTERFACE 2313 #ifdef USE_NEW_OS_INTERFACE_FOR_GIP 2314 2314 rc = RTTimerStart(pDevExt->pGipTimer, 0); 2315 2315 AssertRC(rc); rc = 0; … … 2370 2370 * Unmap anything? 2371 2371 */ 2372 #ifdef USE_NEW_OS_INTERFACE 2372 #ifdef USE_NEW_OS_INTERFACE_FOR_GIP 2373 2373 if (pSession->GipMapObjR3 != NIL_RTR0MEMOBJ) 2374 2374 { … … 2397 2397 { 2398 2398 dprintf(("SUPR0GipUnmap: Suspends GIP updating\n")); 2399 #ifdef USE_NEW_OS_INTERFACE 2399 #ifdef USE_NEW_OS_INTERFACE_FOR_GIP 2400 2400 rc = RTTimerStop(pDevExt->pGipTimer); AssertRC(rc); rc = 0; 2401 2401 #else … … 2436 2436 for (i = 0; i < sizeof(pBundle->aMem) / sizeof(pBundle->aMem[0]); i++) 2437 2437 { 2438 #ifdef USE_NEW_OS_INTERFACE 2438 #ifdef USE_NEW_OS_INTERFACE_FOR_MM 2439 2439 if (pBundle->aMem[i].MemObj == NIL_RTR0MEMOBJ) 2440 #else /* !USE_NEW_OS_INTERFACE */2440 #else /* !USE_NEW_OS_INTERFACE_FOR_MM */ 2441 2441 if ( !pBundle->aMem[i].pvR0 2442 2442 && !pBundle->aMem[i].pvR3) 2443 #endif /* !USE_NEW_OS_INTERFACE */2443 #endif /* !USE_NEW_OS_INTERFACE_FOR_MM */ 2444 2444 { 2445 2445 pBundle->cUsed++; … … 2515 2515 for (i = 0; i < sizeof(pBundle->aMem) / sizeof(pBundle->aMem[0]); i++) 2516 2516 { 2517 #ifdef USE_NEW_OS_INTERFACE 2517 #ifdef USE_NEW_OS_INTERFACE_FOR_MM 2518 2518 if ( pBundle->aMem[i].eType == eType 2519 2519 && pBundle->aMem[i].MemObj != NIL_RTR0MEMOBJ … … 2542 2542 return 0; 2543 2543 } 2544 #else /* !USE_NEW_OS_INTERFACE */2544 #else /* !USE_NEW_OS_INTERFACE_FOR_MM */ 2545 2545 if ( pBundle->aMem[i].eType == eType 2546 2546 && ( (RTHCUINTPTR)pBundle->aMem[i].pvR0 == uPtr … … 2576 2576 return 0; 2577 2577 } 2578 #endif /* !USE_NEW_OS_INTERFACE */2578 #endif /* !USE_NEW_OS_INTERFACE_FOR_MM */ 2579 2579 } 2580 2580 } … … 3848 3848 3849 3849 3850 #if !defined(SUPDRV_OS_HAVE_LOW) && !defined(USE_NEW_OS_INTERFACE ) /* Use same backend as the contiguous stuff */3850 #if !defined(SUPDRV_OS_HAVE_LOW) && !defined(USE_NEW_OS_INTERFACE_FOR_MM) /* Use same backend as the contiguous stuff */ 3851 3851 /** 3852 3852 * OS Specific code for allocating page aligned memory with fixed … … 3863 3863 int VBOXCALL supdrvOSLowAllocOne(PSUPDRVMEMREF pMem, PRTR0PTR ppvR0, PRTR3PTR ppvR3, PSUPPAGE paPagesOut) 3864 3864 { 3865 #if defined(US B_NEW_OS_INTERFACE_FOR_LOW) /* a temp hack */3865 #if defined(USE_NEW_OS_INTERFACE_FOR_LOW) /* a temp hack */ 3866 3866 int rc = RTR0MemObjAllocLow(&pMem->u.iprt.MemObj, pMem->cb, true /* executable ring-0 mapping */); 3867 3867 if (RT_SUCCESS(rc)) … … 3922 3922 void VBOXCALL supdrvOSLowFreeOne(PSUPDRVMEMREF pMem) 3923 3923 { 3924 # if defined(US B_NEW_OS_INTERFACE_FOR_LOW)3924 # if defined(USE_NEW_OS_INTERFACE_FOR_LOW) 3925 3925 if (pMem->u.iprt.MapObjR3) 3926 3926 { … … 3937 3937 # endif 3938 3938 } 3939 #endif /* !SUPDRV_OS_HAVE_LOW */3940 3941 3942 #ifdef USE_NEW_OS_INTERFACE 3939 #endif /* !SUPDRV_OS_HAVE_LOW && !USE_NEW_OS_INTERFACE_FOR_MM */ 3940 3941 3942 #ifdef USE_NEW_OS_INTERFACE_FOR_GIP 3943 3943 /** 3944 3944 * Creates the GIP. … … 4079 4079 supdrvGipUpdate(pDevExt->pGip, RTTimeSystemNanoTS()); 4080 4080 } 4081 #endif /* USE_NEW_OS_INTERFACE */4081 #endif /* USE_NEW_OS_INTERFACE_FOR_GIP */ 4082 4082 4083 4083 … … 4152 4152 static SUPGIPMODE supdrvGipDeterminTscMode(void) 4153 4153 { 4154 #ifndef USE_NEW_OS_INTERFACE 4154 #ifndef USE_NEW_OS_INTERFACE_FOR_GIP 4155 4155 /* 4156 4156 * The problem here is that AMD processors with power management features
Note:
See TracChangeset
for help on using the changeset viewer.