- Timestamp:
- Jul 3, 2007 3:36:47 PM (17 years ago)
- Location:
- trunk
- Files:
-
- 9 edited
-
include/VBox/sup.h (modified) (8 diffs)
-
src/VBox/HostDrivers/Support/SUPDRV.h (modified) (3 diffs)
-
src/VBox/HostDrivers/Support/SUPDRVIOC.h (modified) (1 diff)
-
src/VBox/HostDrivers/Support/SUPLib.cpp (modified) (6 diffs)
-
src/VBox/HostDrivers/Support/linux/SUPDrv-linux.c (modified) (3 diffs)
-
src/VBox/HostDrivers/Support/win32/SUPDrv-win32.cpp (modified) (3 diffs)
-
src/VBox/Runtime/timesup.cpp (modified) (2 diffs)
-
src/VBox/VMM/TM.cpp (modified) (1 diff)
-
src/VBox/VMM/VMMAll/TMAllVirtual.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/sup.h
r3363 r3393 33 33 */ 34 34 35 /** 35 /** 36 36 * Physical page descriptor. 37 37 */ … … 85 85 /** 86 86 * Per CPU data. 87 * This is only used when 87 * This is only used when 88 88 */ 89 89 typedef struct SUPGIPCPU … … 122 122 /*AssertCompileMemberAlignment(SUPGIPCPU, u64TSC, 8); -fixme */ 123 123 124 /** Pointer to per cpu data. */ 124 /** Pointer to per cpu data. 125 * @remark there is no const version of this typedef, see g_pSUPGlobalInfoPage for details. */ 125 126 typedef SUPGIPCPU *PSUPGIPCPU; 126 /** Pointer to const per cpu data. */127 typedef const SUPGIPCPU *PCSUPGIPCPU;128 127 129 128 /** … … 164 163 /* AssertCompileMemberAlignment(SUPGLOBALINFOPAGE, aCPU, 32); - fixme */ 165 164 166 /** Pointer to the global info page. */ 165 /** Pointer to the global info page. 166 * @remark there is no const version of this typedef, see g_pSUPGlobalInfoPage for details. */ 167 167 typedef SUPGLOBALINFOPAGE *PSUPGLOBALINFOPAGE; 168 /** Const pointer to the global info page. */169 typedef const SUPGLOBALINFOPAGE *PCSUPGLOBALINFOPAGE;170 168 171 169 #pragma pack() /* end of paranoia */ … … 173 171 /** The value of the SUPGLOBALINFOPAGE::u32Magic field. (Soryo Fuyumi) */ 174 172 #define SUPGLOBALINFOPAGE_MAGIC 0x19590106 175 /** The GIP version. 176 * Upper 16 bits is the major version. Major version is only changed with 173 /** The GIP version. 174 * Upper 16 bits is the major version. Major version is only changed with 177 175 * incompatible changes in the GIP. */ 178 176 #define SUPGLOBALINFOPAGE_VERSION 0x00020000 179 177 180 /** 178 /** 181 179 * SUPGLOBALINFOPAGE::u32Mode values. 182 180 */ … … 198 196 * the page must treat this pointer as higly volatile and not trust it beyond 199 197 * one transaction. 198 * 199 * @remark The GIP page is read-only to everyone but the support driver and 200 * is actually mapped read only everywhere but in ring-0. However 201 * it is not marked 'const' as this might confuse compilers into 202 * thinking that values doesn't change even if members are marked 203 * as volatile. Thus, there is no PCSUPGLOBALINFOPAGE type. 200 204 */ 201 205 #if defined(IN_SUP_R0) || defined(IN_SUP_R3) || defined(IN_SUP_GC) 202 extern DECLEXPORT(P CSUPGLOBALINFOPAGE)g_pSUPGlobalInfoPage;206 extern DECLEXPORT(PSUPGLOBALINFOPAGE) g_pSUPGlobalInfoPage; 203 207 #elif defined(IN_RING0) 204 extern DECLIMPORT( const SUPGLOBALINFOPAGE)g_SUPGlobalInfoPage;208 extern DECLIMPORT(SUPGLOBALINFOPAGE) g_SUPGlobalInfoPage; 205 209 # if defined(__GNUC__) && !defined(__DARWIN__) && defined(__AMD64__) 206 210 /** Workaround for ELF+GCC problem on 64-bit hosts. 207 211 * (GCC emits a mov with a R_X86_64_32 reloc, we need R_X86_64_64.) */ 208 DECLINLINE(P CSUPGLOBALINFOPAGE) SUPGetGIP(void)209 { 210 P CSUPGLOBALINFOPAGE pGIP;212 DECLINLINE(PSUPGLOBALINFOPAGE) SUPGetGIP(void) 213 { 214 PSUPGLOBALINFOPAGE pGIP; 211 215 __asm__ __volatile__ ("movabs $g_SUPGlobalInfoPage,%0\n\t" 212 216 : "=a" (pGIP)); 213 217 return pGIP; 214 218 } 215 # define g_pSUPGlobalInfoPage (SUPGetGIP()) 216 # elif defined(__GNUC__) && !defined(__DARWIN__) 217 /** gcc optimizes &g_SUPGlobalInfoPage + offset */ 218 DECLINLINE(PCSUPGLOBALINFOPAGE) SUPGetGIP(void) 219 { 220 PCSUPGLOBALINFOPAGE pGIP; 221 __asm__ __volatile__ ("movl $g_SUPGlobalInfoPage,%0\n\t" 222 : "=a" (pGIP)); 223 return pGIP; 224 } 225 # define g_pSUPGlobalInfoPage (SUPGetGIP()) 219 # define g_pSUPGlobalInfoPage (SUPGetGIP()) 226 220 # else 227 # define g_pSUPGlobalInfoPage (&g_SUPGlobalInfoPage)221 # define g_pSUPGlobalInfoPage (&g_SUPGlobalInfoPage) 228 222 # endif 229 223 #else 230 extern DECLIMPORT(P CSUPGLOBALINFOPAGE)g_pSUPGlobalInfoPage;224 extern DECLIMPORT(PSUPGLOBALINFOPAGE) g_pSUPGlobalInfoPage; 231 225 #endif 232 226 … … 234 228 /** 235 229 * Gets the TSC frequency of the calling CPU. 236 * 230 * 237 231 * @returns TSC frequency. 238 232 * @param pGip The GIP pointer. 239 233 */ 240 DECLINLINE(uint64_t) SUPGetCpuHzFromGIP(P CSUPGLOBALINFOPAGE pGip)234 DECLINLINE(uint64_t) SUPGetCpuHzFromGIP(PSUPGLOBALINFOPAGE pGip) 241 235 { 242 236 unsigned iCpu; … … 581 575 __END_DECLS 582 576 583 584 577 #endif 585 578 -
trunk/src/VBox/HostDrivers/Support/SUPDRV.h
r3189 r3393 545 545 /** The read-only usermode mapping address of the GID. 546 546 * This is NULL if the GIP hasn't been mapped. */ 547 P CSUPGLOBALINFOPAGEpGip;547 PSUPGLOBALINFOPAGE pGip; 548 548 #endif 549 549 /** Set if the session is using the GIP. */ … … 650 650 uint64_t volatile u64LastMonotime; 651 651 /** Set when GIP is suspended to prevent the timers from re-registering themselves). */ 652 uint8_t volatile fGIPSuspended; 652 uint8_t volatile fGIPSuspended; 653 653 # ifdef CONFIG_SMP 654 654 /** Array of per CPU data for SUPGIPMODE_ASYNC_TSC. */ … … 686 686 void VBOXCALL supdrvOSMemGetPages(PSUPDRVMEMREF pMem, PSUPPAGE paPages); 687 687 void VBOXCALL supdrvOSMemFreeOne(PSUPDRVMEMREF pMem); 688 int VBOXCALL supdrvOSGipMap(PSUPDRVDEVEXT pDevExt, P CSUPGLOBALINFOPAGE *ppGip);689 int VBOXCALL supdrvOSGipUnmap(PSUPDRVDEVEXT pDevExt, P CSUPGLOBALINFOPAGE pGip);688 int VBOXCALL supdrvOSGipMap(PSUPDRVDEVEXT pDevExt, PSUPGLOBALINFOPAGE *ppGip); 689 int VBOXCALL supdrvOSGipUnmap(PSUPDRVDEVEXT pDevExt, PSUPGLOBALINFOPAGE pGip); 690 690 void VBOXCALL supdrvOSGipResume(PSUPDRVDEVEXT pDevExt); 691 691 void VBOXCALL supdrvOSGipSuspend(PSUPDRVDEVEXT pDevExt); -
trunk/src/VBox/HostDrivers/Support/SUPDRVIOC.h
r2981 r3393 566 566 { 567 567 /** Pointer to the read-only usermode GIP mapping for this session. */ 568 R3PTRTYPE(P CSUPGLOBALINFOPAGE)pGipR3;568 R3PTRTYPE(PSUPGLOBALINFOPAGE) pGipR3; 569 569 /** Pointer to the supervisor mode GIP mapping. */ 570 R0PTRTYPE(P CSUPGLOBALINFOPAGE)pGipR0;570 R0PTRTYPE(PSUPGLOBALINFOPAGE) pGipR0; 571 571 /** The physical address of the GIP. */ 572 572 RTHCPHYS HCPhysGip; -
trunk/src/VBox/HostDrivers/Support/SUPLib.cpp
r3177 r3393 93 93 * @todo This will probably deserve it's own session or some other good solution... 94 94 */ 95 DECLEXPORT(P CSUPGLOBALINFOPAGE)g_pSUPGlobalInfoPage;95 DECLEXPORT(PSUPGLOBALINFOPAGE) g_pSUPGlobalInfoPage; 96 96 /** Address of the ring-0 mapping of the GIP. */ 97 static P CSUPGLOBALINFOPAGEg_pSUPGlobalInfoPageR0;97 static PSUPGLOBALINFOPAGE g_pSUPGlobalInfoPageR0; 98 98 /** The physical address of the GIP. */ 99 99 static RTHCPHYS g_HCPhysSUPGlobalInfoPage = NIL_RTHCPHYS; … … 254 254 else 255 255 { 256 LogRel(("Support driver version mismatch: SessionVersion=%#x DriverVersion=%#x ClientVersion=%#x\n", 256 LogRel(("Support driver version mismatch: SessionVersion=%#x DriverVersion=%#x ClientVersion=%#x\n", 257 257 Out.u32SessionVersion, Out.u32DriverVersion, SUPDRVIOC_VERSION)); 258 258 rc = VERR_VM_DRIVER_VERSION_MISMATCH; … … 264 264 rc = VERR_VM_DRIVER_VERSION_MISMATCH; 265 265 if (rc == VERR_VM_DRIVER_VERSION_MISMATCH) 266 LogRel(("Support driver version mismatch: DriverVersion=%#x ClientVersion=%#x\n", 266 LogRel(("Support driver version mismatch: DriverVersion=%#x ClientVersion=%#x\n", 267 267 Out.u32DriverVersion, SUPDRVIOC_VERSION)); 268 268 else … … 343 343 344 344 /* fake the GIP. */ 345 g_pSUPGlobalInfoPage = (P CSUPGLOBALINFOPAGE)RTMemPageAlloc(PAGE_SIZE);345 g_pSUPGlobalInfoPage = (PSUPGLOBALINFOPAGE)RTMemPageAlloc(PAGE_SIZE); 346 346 if (g_pSUPGlobalInfoPage) 347 347 { … … 1257 1257 pIn->eEPType = pIn->EP_NOTHING; 1258 1258 pIn->offStrTab = offStrTab; 1259 pIn->cbStrTab = (uint32_t)CalcArgs.cbStrings; 1259 pIn->cbStrTab = (uint32_t)CalcArgs.cbStrings; 1260 1260 AssertRelease(pIn->cbStrTab == CalcArgs.cbStrings); 1261 1261 pIn->offSymbols = offSymTab; … … 1286 1286 } 1287 1287 } 1288 else if (VBOX_SUCCESS(rc) && fIsVMMR0) 1288 else if (VBOX_SUCCESS(rc) && fIsVMMR0) 1289 1289 g_pvVMMR0 = OpenOut.pvImageBase; 1290 1290 } -
trunk/src/VBox/HostDrivers/Support/linux/SUPDrv-linux.c
r3088 r3393 1671 1671 * @param pDevExt Instance data. 1672 1672 */ 1673 int VBOXCALL supdrvOSGipMap(PSUPDRVDEVEXT pDevExt, P CSUPGLOBALINFOPAGE *ppGip)1673 int VBOXCALL supdrvOSGipMap(PSUPDRVDEVEXT pDevExt, PSUPGLOBALINFOPAGE *ppGip) 1674 1674 { 1675 1675 int rc = 0; … … 1722 1722 if (!rc) 1723 1723 { 1724 *ppGip = (P CSUPGLOBALINFOPAGE)ulAddr;1724 *ppGip = (PSUPGLOBALINFOPAGE)ulAddr; 1725 1725 dprintf2(("supdrvOSGipMap: ppGip=%p\n", *ppGip)); 1726 1726 return 0; … … 1748 1748 * @param pDevExt Instance data. 1749 1749 */ 1750 int VBOXCALL supdrvOSGipUnmap(PSUPDRVDEVEXT pDevExt, P CSUPGLOBALINFOPAGE pGip)1750 int VBOXCALL supdrvOSGipUnmap(PSUPDRVDEVEXT pDevExt, PSUPGLOBALINFOPAGE pGip) 1751 1751 { 1752 1752 dprintf2(("supdrvOSGipUnmap: pGip=%p\n", pGip)); -
trunk/src/VBox/HostDrivers/Support/win32/SUPDrv-win32.cpp
r2981 r3393 996 996 * @param pDevExt Instance data. 997 997 */ 998 int VBOXCALL supdrvOSGipMap(PSUPDRVDEVEXT pDevExt, P CSUPGLOBALINFOPAGE *ppGip)998 int VBOXCALL supdrvOSGipMap(PSUPDRVDEVEXT pDevExt, PSUPGLOBALINFOPAGE *ppGip) 999 999 { 1000 1000 dprintf2(("supdrvOSGipMap: ppGip=%p (pDevExt->pGipMdl=%p)\n", ppGip, pDevExt->pGipMdl)); … … 1007 1007 __try 1008 1008 { 1009 *ppGip = (P CSUPGLOBALINFOPAGE)MmMapLockedPagesSpecifyCache(pDevExt->pGipMdl, UserMode, MmCached, NULL, FALSE, NormalPagePriority);1009 *ppGip = (PSUPGLOBALINFOPAGE)MmMapLockedPagesSpecifyCache(pDevExt->pGipMdl, UserMode, MmCached, NULL, FALSE, NormalPagePriority); 1010 1010 } 1011 1011 __except(EXCEPTION_EXECUTE_HANDLER) … … 1027 1027 * @param pDevExt Instance data. 1028 1028 */ 1029 int VBOXCALL supdrvOSGipUnmap(PSUPDRVDEVEXT pDevExt, P CSUPGLOBALINFOPAGE pGip)1029 int VBOXCALL supdrvOSGipUnmap(PSUPDRVDEVEXT pDevExt, PSUPGLOBALINFOPAGE pGip) 1030 1030 { 1031 1031 dprintf2(("supdrvOSGipUnmap: pGip=%p (pGipMdl=%p)\n", pGip, pDevExt->pGipMdl)); -
trunk/src/VBox/Runtime/timesup.cpp
r2981 r3393 70 70 uint32_t u32UpdateIntervalTSC; 71 71 uint32_t u32TransactionId; 72 P CSUPGLOBALINFOPAGE pGip;72 PSUPGLOBALINFOPAGE pGip; 73 73 74 74 /* … … 101 101 { 102 102 /* SUPGIPMODE_ASYNC_TSC */ 103 P CSUPGIPCPU pGipCpu;103 PSUPGIPCPU pGipCpu; 104 104 105 105 uint8_t u8ApicId = ASMGetApicId(); -
trunk/src/VBox/VMM/TM.cpp
r3272 r3393 569 569 */ 570 570 uint64_t u64Hz; 571 P CSUPGLOBALINFOPAGE pGip = g_pSUPGlobalInfoPage;571 PSUPGLOBALINFOPAGE pGip = g_pSUPGlobalInfoPage; 572 572 if ( pGip 573 573 && pGip->u32Magic == SUPGLOBALINFOPAGE_MAGIC) -
trunk/src/VBox/VMM/VMMAll/TMAllVirtual.cpp
r2981 r3393 69 69 { 70 70 uint32_t u32TransactionId; 71 P CSUPGLOBALINFOPAGE pGip = g_pSUPGlobalInfoPage;71 PSUPGLOBALINFOPAGE pGip = g_pSUPGlobalInfoPage; 72 72 #ifdef IN_RING3 73 73 if (RT_UNLIKELY(!pGip || pGip->u32Magic != SUPGLOBALINFOPAGE_MAGIC)) … … 94 94 { 95 95 /* SUPGIPMODE_ASYNC_TSC */ 96 P CSUPGIPCPU pGipCpu;96 PSUPGIPCPU pGipCpu; 97 97 98 98 uint8_t u8ApicId = ASMGetApicId();
Note:
See TracChangeset
for help on using the changeset viewer.

