Changeset 1840 in vbox for trunk/src/VBox
- Timestamp:
- Mar 30, 2007 6:42:46 PM (18 years ago)
- svn:sync-xref-src-repo-rev:
- 20028
- Location:
- trunk/src/VBox/HostDrivers/Support
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostDrivers/Support/SUPDRVIOC.h
r1480 r1840 169 169 170 170 171 /** SUPCOOKIE_IN magic word. */ 172 #define SUPCOOKIE_MAGIC "The Magic Word!" 173 /** Current interface version. 174 * The upper 16-bit is the major version, the the lower the minor version. 175 * When incompatible changes are made, the upper major number has to be changed. */ 176 #define SUPDRVIOC_VERSION 0x00040002 177 171 178 /** SUP_IOCTL_COOKIE Input. */ 172 179 typedef struct SUPCOOKIE_IN … … 174 181 /** Magic word. */ 175 182 char szMagic[16]; 176 /** The requested version number. */ 177 uint32_t u32Version; 183 /** The requested interface version number. */ 184 uint32_t u32ReqVersion; 185 /** The minimum interface version number. */ 186 uint32_t u32MinVersion; 178 187 } SUPCOOKIE_IN, *PSUPCOOKIE_IN; 179 180 /** SUPCOOKIE_IN magic word. */181 #define SUPCOOKIE_MAGIC "The Magic Word!"182 /** Current interface version. */183 #define SUPDRVIOC_VERSION 0x00040001184 188 185 189 /** SUP_IOCTL_COOKIE Output. */ … … 190 194 /** Session cookie. */ 191 195 uint32_t u32SessionCookie; 192 /** Interface version. High word(=uint16) is major, low word is minor. */ 193 uint32_t u32Version; 196 /** Interface version for this session. */ 197 uint32_t u32SessionVersion; 198 /** The actual interface version in the driver. */ 199 uint32_t u32DriverVersion; 194 200 /** Number of functions available for the SUP_IOCTL_QUERY_FUNCS request. */ 195 201 uint32_t cFunctions; 196 202 /** Session handle. */ 197 PSUPDRVSESSIONpSession;203 R0PTRTYPE(PSUPDRVSESSION) pSession; 198 204 } SUPCOOKIE_OUT, *PSUPCOOKIE_OUT; 205 206 199 207 200 208 /** SUP_IOCTL_QUERY_FUNCS Input. */ … … 202 210 { 203 211 /** Cookie. */ 204 uint32_t u32Cookie;205 /** Session cookie. */ 206 uint32_t u32SessionCookie;212 uint32_t u32Cookie; 213 /** Session cookie. */ 214 uint32_t u32SessionCookie; 207 215 } SUPQUERYFUNCS_IN, *PSUPQUERYFUNCS_IN; 208 216 … … 211 219 { 212 220 /** Name - mangled. */ 213 char szName[32];221 char szName[32]; 214 222 /** Address. */ 215 void *pfn;223 RTR0PTR pfn; 216 224 } SUPFUNC, *PSUPFUNC; 217 225 … … 220 228 { 221 229 /** Number of functions returned. */ 222 uint32_t cFunctions;230 uint32_t cFunctions; 223 231 /** Array of functions. */ 224 SUPFUNC aFunctions[1];232 SUPFUNC aFunctions[1]; 225 233 } SUPQUERYFUNCS_OUT, *PSUPQUERYFUNCS_OUT; 234 226 235 227 236 … … 230 239 { 231 240 /** Cookie. */ 232 uint32_t u32Cookie;233 /** Session cookie. */ 234 uint32_t u32SessionCookie;241 uint32_t u32Cookie; 242 /** Session cookie. */ 243 uint32_t u32SessionCookie; 235 244 } SUPIDTINSTALL_IN, *PSUPIDTINSTALL_IN; 236 245 … … 239 248 { 240 249 /** Cookie. */ 241 uint8_t u8Idt;250 uint8_t u8Idt; 242 251 } SUPIDTINSTALL_OUT, *PSUPIDTINSTALL_OUT; 243 252 … … 248 257 { 249 258 /** Cookie. */ 250 uint32_t u32Cookie;251 /** Session cookie. */ 252 uint32_t u32SessionCookie;259 uint32_t u32Cookie; 260 /** Session cookie. */ 261 uint32_t u32SessionCookie; 253 262 } SUPIDTREMOVE_IN, *PSUPIDTREMOVE_IN; 254 263 … … 259 268 { 260 269 /** Cookie. */ 261 uint32_t u32Cookie;262 /** Session cookie. */ 263 uint32_t u32SessionCookie;270 uint32_t u32Cookie; 271 /** Session cookie. */ 272 uint32_t u32SessionCookie; 264 273 /** Start of page range. Must be PAGE aligned. */ 265 RTR3PTR pvR3;274 RTR3PTR pvR3; 266 275 /** Size of the range. Must be PAGE aligned. */ 267 uint32_t cb;276 uint32_t cb; 268 277 } SUPPINPAGES_IN, *PSUPPINPAGES_IN; 269 278 … … 272 281 { 273 282 /** Array of pages. */ 274 SUPPAGE aPages[1];283 SUPPAGE aPages[1]; 275 284 } SUPPINPAGES_OUT, *PSUPPINPAGES_OUT; 276 285 … … 281 290 { 282 291 /** Cookie. */ 283 uint32_t u32Cookie;284 /** Session cookie. */ 285 uint32_t u32SessionCookie;292 uint32_t u32Cookie; 293 /** Session cookie. */ 294 uint32_t u32SessionCookie; 286 295 /** Start of page range of a range previuosly pinned. */ 287 RTR3PTR pvR3;296 RTR3PTR pvR3; 288 297 } SUPUNPINPAGES_IN, *PSUPUNPINPAGES_IN; 298 289 299 290 300 … … 293 303 { 294 304 /** Cookie. */ 295 uint32_t u32Cookie;296 /** Session cookie. */ 297 uint32_t u32SessionCookie;305 uint32_t u32Cookie; 306 /** Session cookie. */ 307 uint32_t u32SessionCookie; 298 308 /** Number of bytes to allocate. */ 299 uint32_t cb;309 uint32_t cb; 300 310 } SUPCONTALLOC_IN, *PSUPCONTALLOC_IN; 311 301 312 302 313 … … 305 316 { 306 317 /** The address of the ring-0 mapping of the allocated memory. */ 307 RTR0PTR pvR0;318 RTR0PTR pvR0; 308 319 /** The address of the ring-3 mapping of the allocated memory. */ 309 RTR3PTR pvR3;320 RTR3PTR pvR3; 310 321 /** The physical address of the allocation. */ 311 RTHCPHYS HCPhys;322 RTHCPHYS HCPhys; 312 323 } SUPCONTALLOC_OUT, *PSUPCONTALLOC_OUT; 324 313 325 314 326 … … 317 329 { 318 330 /** Cookie. */ 319 uint32_t u32Cookie;320 /** Session cookie. */ 321 uint32_t u32SessionCookie;331 uint32_t u32Cookie; 332 /** Session cookie. */ 333 uint32_t u32SessionCookie; 322 334 /** The ring-3 address of the memory to free. */ 323 RTR3PTR pvR3;335 RTR3PTR pvR3; 324 336 } SUPCONTFREE_IN, *PSUPCONTFREE_IN; 337 325 338 326 339 … … 329 342 { 330 343 /** Cookie. */ 331 uint32_t u32Cookie;332 /** Session cookie. */ 333 uint32_t u32SessionCookie;344 uint32_t u32Cookie; 345 /** Session cookie. */ 346 uint32_t u32SessionCookie; 334 347 /** Size of the image we'll be loading. */ 335 uint32_t cbImage;348 uint32_t cbImage; 336 349 /** Image name. 337 350 * This is the NAME of the image, not the file name. It is used 338 351 * to share code with other processes. (Max len is 32 chars!) */ 339 char szName[32];352 char szName[32]; 340 353 } SUPLDROPEN_IN, *PSUPLDROPEN_IN; 341 354 … … 344 357 { 345 358 /** The base address of the image. */ 346 void *pvImageBase;359 RTR0PTR pvImageBase; 347 360 /** Indicate whether or not the image requires loading. */ 348 bool fNeedsLoading;361 bool fNeedsLoading; 349 362 } SUPLDROPEN_OUT, *PSUPLDROPEN_OUT; 363 350 364 351 365 … … 359 373 typedef DECLCALLBACK(int) FNR0MODULEINIT(void); 360 374 /** Pointer to a FNR0MODULEINIT(). */ 361 typedef FNR0MODULEINIT *PFNR0MODULEINIT;375 typedef R0PTRTYPE(FNR0MODULEINIT *) PFNR0MODULEINIT; 362 376 363 377 /** … … 367 381 typedef DECLCALLBACK(void) FNR0MODULETERM(void); 368 382 /** Pointer to a FNR0MODULETERM(). */ 369 typedef FNR0MODULETERM *PFNR0MODULETERM;383 typedef R0PTRTYPE(FNR0MODULETERM *) PFNR0MODULETERM; 370 384 371 385 /** … … 397 411 { 398 412 /** The module handle (i.e. address). */ 399 void *pvVMMR0;413 RTR0PTR pvVMMR0; 400 414 /** Address of VMMR0Entry function. */ 401 void *pvVMMR0Entry;415 RTR0PTR pvVMMR0Entry; 402 416 } VMMR0; 403 } EP;417 } EP; 404 418 /** Address. */ 405 void *pvImageBase;419 RTR0PTR pvImageBase; 406 420 /** Entry point type. */ 407 421 enum { EP_NOTHING, EP_VMMR0 } 408 422 eEPType; 409 423 /** The offset of the symbol table. */ 410 uint32_t offSymbols;424 uint32_t offSymbols; 411 425 /** The number of entries in the symbol table. */ 412 uint32_t cSymbols;426 uint32_t cSymbols; 413 427 /** The offset of the string table. */ 414 uint32_t offStrTab;428 uint32_t offStrTab; 415 429 /** Size of the string table. */ 416 uint32_t cbStrTab;430 uint32_t cbStrTab; 417 431 /** Size of image (including string and symbol tables). */ 418 uint32_t cbImage;432 uint32_t cbImage; 419 433 /** The image data. */ 420 char achImage[1];434 char achImage[1]; 421 435 } SUPLDRLOAD_IN, *PSUPLDRLOAD_IN; 436 422 437 423 438 … … 426 441 { 427 442 /** Cookie. */ 428 uint32_t u32Cookie;429 /** Session cookie. */ 430 uint32_t u32SessionCookie;443 uint32_t u32Cookie; 444 /** Session cookie. */ 445 uint32_t u32SessionCookie; 431 446 /** Address. */ 432 void *pvImageBase;447 RTR0PTR pvImageBase; 433 448 } SUPLDRFREE_IN, *PSUPLDRFREE_IN; 449 434 450 435 451 … … 438 454 { 439 455 /** Cookie. */ 440 uint32_t u32Cookie;441 /** Session cookie. */ 442 uint32_t u32SessionCookie;456 uint32_t u32Cookie; 457 /** Session cookie. */ 458 uint32_t u32SessionCookie; 443 459 /** Address. */ 444 void *pvImageBase;460 RTR0PTR pvImageBase; 445 461 /** The symbol name (variable length). */ 446 char szSymbol[1];462 char szSymbol[1]; 447 463 } SUPLDRGETSYMBOL_IN, *PSUPLDRGETSYMBOL_IN; 448 464 … … 451 467 { 452 468 /** The symbol address. */ 453 void *pvSymbol;469 RTR0PTR pvSymbol; 454 470 } SUPLDRGETSYMBOL_OUT, *PSUPLDRGETSYMBOL_OUT; 471 455 472 456 473 … … 459 476 { 460 477 /** Cookie. */ 461 uint32_t u32Cookie;462 /** Session cookie. */ 463 uint32_t u32SessionCookie;478 uint32_t u32Cookie; 479 /** Session cookie. */ 480 uint32_t u32SessionCookie; 464 481 /** The VM handle. */ 465 PVMR0 pVMR0;482 PVMR0 pVMR0; 466 483 /** Which operation to execute. */ 467 uint32_t uOperation;484 uint32_t uOperation; 468 485 /** The size of the buffer pointed to by pvArg. */ 469 uint32_t cbArg;486 uint32_t cbArg; 470 487 /** Argument to that operation. */ 471 void *pvArg;488 RTR3PTR pvArg; 472 489 } SUPCALLVMMR0_IN, *PSUPCALLVMMR0_IN; 473 490 … … 476 493 { 477 494 /** The VBox status code for the operation. */ 478 int32_t rc;495 int32_t rc; 479 496 } SUPCALLVMMR0_OUT, *PSUPCALLVMMR0_OUT; 497 480 498 481 499 … … 484 502 { 485 503 /** Cookie. */ 486 uint32_t u32Cookie;487 /** Session cookie. */ 488 uint32_t u32SessionCookie;504 uint32_t u32Cookie; 505 /** Session cookie. */ 506 uint32_t u32SessionCookie; 489 507 } SUPGETPAGINGMODE_IN, *PSUPGETPAGINGMODE_IN; 490 508 … … 493 511 { 494 512 /** The paging mode. */ 495 SUPPAGINGMODE enmMode;513 SUPPAGINGMODE enmMode; 496 514 } SUPGETPAGINGMODE_OUT, *PSUPGETPAGINGMODE_OUT; 515 497 516 498 517 … … 501 520 { 502 521 /** Cookie. */ 503 uint32_t u32Cookie;504 /** Session cookie. */ 505 uint32_t u32SessionCookie;522 uint32_t u32Cookie; 523 /** Session cookie. */ 524 uint32_t u32SessionCookie; 506 525 /** Number of pages to allocate. */ 507 uint32_t cPages;526 uint32_t cPages; 508 527 } SUPLOWALLOC_IN, *PSUPLOWALLOC_IN; 509 528 … … 512 531 { 513 532 /** The ring-3 address of the allocated memory. */ 514 RTR3PTR pvR3;533 RTR3PTR pvR3; 515 534 /** The ring-0 address of the allocated memory. */ 516 RTR0PTR pvR0;535 RTR0PTR pvR0; 517 536 /** Array of pages. */ 518 SUPPAGE aPages[1];537 SUPPAGE aPages[1]; 519 538 } SUPLOWALLOC_OUT, *PSUPLOWALLOC_OUT; 539 520 540 521 541 … … 524 544 { 525 545 /** Cookie. */ 526 uint32_t u32Cookie;527 /** Session cookie. */ 528 uint32_t u32SessionCookie;546 uint32_t u32Cookie; 547 /** Session cookie. */ 548 uint32_t u32SessionCookie; 529 549 /** The ring-3 address of the memory to free. */ 530 RTR3PTR pvR3;550 RTR3PTR pvR3; 531 551 } SUPLOWFREE_IN, *PSUPLOWFREE_IN; 552 532 553 533 554 … … 536 557 { 537 558 /** Cookie. */ 538 uint32_t u32Cookie;539 /** Session cookie. */ 540 uint32_t u32SessionCookie;559 uint32_t u32Cookie; 560 /** Session cookie. */ 561 uint32_t u32SessionCookie; 541 562 } SUPGIPMAP_IN, *PSUPGIPMAP_IN; 542 563 … … 545 566 { 546 567 /** Pointer to the read-only usermode GIP mapping for this session. */ 547 PCSUPGLOBALINFOPAGEpGipR3;568 R3PTRTYPE(PCSUPGLOBALINFOPAGE) pGipR3; 548 569 /** Pointer to the supervisor mode GIP mapping. */ 549 PCSUPGLOBALINFOPAGEpGipR0;570 R0PTRTYPE(PCSUPGLOBALINFOPAGE) pGipR0; 550 571 /** The physical address of the GIP. */ 551 RTHCPHYS HCPhysGip;572 RTHCPHYS HCPhysGip; 552 573 } SUPGIPMAP_OUT, *PSUPGIPMAP_OUT; 574 553 575 554 576 … … 557 579 { 558 580 /** Cookie. */ 559 uint32_t u32Cookie;560 /** Session cookie. */ 561 uint32_t u32SessionCookie;581 uint32_t u32Cookie; 582 /** Session cookie. */ 583 uint32_t u32SessionCookie; 562 584 } SUPGIPUNMAP_IN, *PSUPGIPUNMAP_IN; 585 563 586 564 587 … … 567 590 { 568 591 /** Cookie. */ 569 uint32_t u32Cookie;570 /** Session cookie. */ 571 uint32_t u32SessionCookie;592 uint32_t u32Cookie; 593 /** Session cookie. */ 594 uint32_t u32SessionCookie; 572 595 /** The ring-0 VM handle (pointer). */ 573 PVMR0 pVMR0;596 PVMR0 pVMR0; 574 597 } SUPSETVMFORFAST_IN, *PSUPSETVMFORFAST_IN; 575 598 -
trunk/src/VBox/HostDrivers/Support/SUPDRVShared.c
r1672 r1840 644 644 || cbOut != sizeof(*pOut)) 645 645 { 646 dprintf(("SUP_IOCTL_COOKIE: Invalid input/output sizes. cbIn=%ld expected %ld. cbOut=%ld expected %ld.\n",647 (long)cbIn, (long)sizeof(*pIn), (long)cbOut, (long)sizeof(*pOut)));646 OSDBGPRINT(("SUP_IOCTL_COOKIE: Invalid input/output sizes. cbIn=%ld expected %ld. cbOut=%ld expected %ld.\n", 647 (long)cbIn, (long)sizeof(*pIn), (long)cbOut, (long)sizeof(*pOut))); 648 648 return SUPDRV_ERR_INVALID_PARAM; 649 649 } 650 650 if (strncmp(pIn->szMagic, SUPCOOKIE_MAGIC, sizeof(pIn->szMagic))) 651 651 { 652 dprintf(("SUP_IOCTL_COOKIE: invalid magic %.16s\n", pIn->szMagic));652 OSDBGPRINT(("SUP_IOCTL_COOKIE: invalid magic %.16s\n", pIn->szMagic)); 653 653 return SUPDRV_ERR_INVALID_MAGIC; 654 654 } 655 if (pIn->u32Version != SUPDRVIOC_VERSION) 656 { 657 dprintf(("SUP_IOCTL_COOKIE: Version mismatch. Requested: %#x Current: %#x\n", pIn->u32Version, SUPDRVIOC_VERSION)); 655 656 /* 657 * Match the version. 658 * The current logic is very simple, match the major interface version. 659 */ 660 if ( pIn->u32MinVersion > SUPDRVIOC_VERSION 661 || (pIn->u32ReqVersion & 0xffff0000) != (SUPDRVIOC_VERSION & 0xffff0000)) 662 { 663 OSDBGPRINT(("SUP_IOCTL_COOKIE: Version mismatch. Requested: %#x Min: %#x Current: %#x\n", 664 pIn->u32ReqVersion, pIn->u32MinVersion, SUPDRVIOC_VERSION)); 665 pOut->u32Cookie = 0xffffffff; 666 pOut->u32SessionCookie = 0xffffffff; 667 pOut->u32SessionVersion = 0xffffffff; 668 pOut->u32DriverVersion = SUPDRVIOC_VERSION; 669 pOut->pSession = NULL; 670 pOut->cFunctions = 0; 671 *pcbReturned = sizeof(*pOut); 658 672 return SUPDRV_ERR_VERSION_MISMATCH; 659 673 } … … 662 676 * Fill in return data and be gone. 663 677 */ 664 /** @todo secure cookie negotiation? */678 /** @todo A more secure cookie negotiation? */ 665 679 pOut->u32Cookie = pDevExt->u32Cookie; 666 680 pOut->u32SessionCookie = pSession->u32Cookie; 667 pOut->u32Version = SUPDRVIOC_VERSION; 681 pOut->u32SessionVersion = SUPDRVIOC_VERSION; 682 pOut->u32DriverVersion = SUPDRVIOC_VERSION; 668 683 pOut->pSession = pSession; 669 684 pOut->cFunctions = sizeof(g_aFunctions) / sizeof(g_aFunctions[0]); … … 1146 1161 * Execute. 1147 1162 */ 1148 pOut->rc = pDevExt->pfnVMMR0Entry(pIn->pVMR0, pIn->uOperation, pIn->pvArg);1163 pOut->rc = pDevExt->pfnVMMR0Entry(pIn->pVMR0, pIn->uOperation, (void *)pIn->pvArg); /** @todo address the pvArg problem! */ 1149 1164 *pcbReturned = sizeof(*pOut); 1150 1165 return 0; … … 2232 2247 * @returns SUPDRV_ERR_* on failure. 2233 2248 * @param pSession Session to which the GIP mapping should belong. 2234 * @param ppGip Where to store the address of themapping. (optional)2249 * @param ppGipR3 Where to store the address of the ring-3 mapping. (optional) 2235 2250 * @param pHCPhysGip Where to store the physical address. (optional) 2236 2251 * … … 2239 2254 * and remove the session as a GIP user. 2240 2255 */ 2241 SUPR0DECL(int) SUPR0GipMap(PSUPDRVSESSION pSession, P CSUPGLOBALINFOPAGE *ppGip, PRTHCPHYS pHCPhysGid)2242 { 2243 int 2244 PSUPDRVDEVEXT 2245 PCSUPGLOBALINFOPAGE pGip = NULL;2246 RTHCPHYS 2247 dprintf(("SUPR0GipMap: pSession=%p ppGip =%p pHCPhysGid=%p\n", pSession, ppGip, pHCPhysGid));2256 SUPR0DECL(int) SUPR0GipMap(PSUPDRVSESSION pSession, PRTR3PTR ppGipR3, PRTHCPHYS pHCPhysGid) 2257 { 2258 int rc = 0; 2259 PSUPDRVDEVEXT pDevExt = pSession->pDevExt; 2260 RTR3PTR pGip = NIL_RTR3PTR; 2261 RTHCPHYS HCPhys = NIL_RTHCPHYS; 2262 dprintf(("SUPR0GipMap: pSession=%p ppGipR3=%p pHCPhysGid=%p\n", pSession, ppGipR3, pHCPhysGid)); 2248 2263 2249 2264 /* 2250 2265 * Validate 2251 2266 */ 2252 if (!ppGip && !pHCPhysGid)2267 if (!ppGipR3 && !pHCPhysGid) 2253 2268 return 0; 2254 2269 … … 2259 2274 * Map it? 2260 2275 */ 2261 if (ppGip )2276 if (ppGipR3) 2262 2277 { 2263 2278 #ifdef USE_NEW_OS_INTERFACE … … 2267 2282 if (RT_SUCCESS(rc)) 2268 2283 { 2269 pGip = ( PCSUPGLOBALINFOPAGE)RTR0MemObjAddress(pSession->GipMapObjR3);2284 pGip = (RTR3PTR)RTR0MemObjAddress(pSession->GipMapObjR3); 2270 2285 rc = VINF_SUCCESS; /** @todo remove this and replace the !rc below with RT_SUCCESS(rc). */ 2271 2286 } … … 2274 2289 rc = supdrvOSGipMap(pSession->pDevExt, &pSession->pGip); 2275 2290 if (!rc) 2276 pGip = pSession->pGip;2291 pGip = (RTR3PTR)pSession->pGip; 2277 2292 #endif /* !USE_NEW_OS_INTERFACE */ 2278 2293 } … … 2323 2338 if (pHCPhysGid) 2324 2339 *pHCPhysGid = HCPhys; 2325 if (ppGip )2326 *ppGip = pGip;2327 2328 dprintf(("SUPR0GipMap: returns %d *pHCPhysGid=%lx *ppGip =%p\n", rc, (unsigned long)HCPhys,pGip));2340 if (ppGipR3) 2341 *ppGipR3 = pGip; 2342 2343 dprintf(("SUPR0GipMap: returns %d *pHCPhysGid=%lx *ppGipR3=%p\n", rc, (unsigned long)HCPhys, (void *)(uintptr_t)pGip)); 2329 2344 return rc; 2330 2345 } -
trunk/src/VBox/HostDrivers/Support/SUPLib.cpp
r1480 r1840 115 115 #endif 116 116 /** VMMR0 Load Address. */ 117 static void *g_pvVMMR0 = NULL;117 static RTR0PTR g_pvVMMR0 = NIL_RTR0PTR; 118 118 /** Init counter. */ 119 119 static unsigned g_cInits = 0; … … 183 183 */ 184 184 SUPCOOKIE_IN In; 185 SUPCOOKIE_OUT Out = {0,0 };185 SUPCOOKIE_OUT Out = {0,0,0,0,0,NIL_RTR0PTR}; 186 186 strcpy(In.szMagic, SUPCOOKIE_MAGIC); 187 In.u32Version = SUPDRVIOC_VERSION; 187 In.u32ReqVersion = SUPDRVIOC_VERSION; 188 if (SUPDRVIOC_VERSION < 0x00050000) 189 In.u32MinVersion = 0x00040002; 190 else 191 In.u32MinVersion = SUPDRVIOC_VERSION & 0xffff0000; 188 192 rc = suplibOsIOCtl(SUP_IOCTL_COOKIE, &In, sizeof(In), &Out, sizeof(Out)); 189 193 if (VBOX_SUCCESS(rc)) 190 194 { 191 if ( Out.u32Version == SUPDRVIOC_VERSION)195 if ((Out.u32SessionVersion & 0xffff0000) == (SUPDRVIOC_VERSION & 0xffff0000)) 192 196 { 193 197 /* … … 239 243 } 240 244 else 245 { 246 LogRel(("Support driver version mismatch: SessionVersion=%#x DriverVersion=%#x ClientVersion=%#x\n", 247 Out.u32SessionVersion, Out.u32DriverVersion, SUPDRVIOC_VERSION)); 241 248 rc = VERR_VM_DRIVER_VERSION_MISMATCH; 249 } 250 } 251 else 252 { 253 if (rc == VERR_INVALID_PARAMETER) /* for pre 0x00040002 drivers */ 254 rc = VERR_VM_DRIVER_VERSION_MISMATCH; 255 if (rc == VERR_VM_DRIVER_VERSION_MISMATCH) 256 LogRel(("Support driver version mismatch: DriverVersion=%#x ClientVersion=%#x\n", 257 Out.u32DriverVersion, SUPDRVIOC_VERSION)); 258 else 259 LogRel(("Support driver version/Cookie negotiations error: rc=%Vrc\n", rc)); 242 260 } 243 261 … … 259 277 { 260 278 /* name function */ 261 { "SUPR0ObjRegister", (void *)0xefef0000 },262 { "SUPR0ObjAddRef", (void *)0xefef0001 },263 { "SUPR0ObjRelease", (void *)0xefef0002 },264 { "SUPR0ObjVerifyAccess", (void *)0xefef0003 },265 { "SUPR0LockMem", (void *)0xefef0004 },266 { "SUPR0UnlockMem", (void *)0xefef0005 },267 { "SUPR0ContAlloc", (void *)0xefef0006 },268 { "SUPR0ContFree", (void *)0xefef0007 },269 { "SUPR0MemAlloc", (void *)0xefef0008 },270 { "SUPR0MemGetPhys", (void *)0xefef0009 },271 { "SUPR0MemFree", (void *)0xefef000a },272 { "SUPR0Printf", (void *)0xefef000b },273 { "RTMemAlloc", (void *)0xefef000c },274 { "RTMemAllocZ", (void *)0xefef000d },275 { "RTMemFree", (void *)0xefef000e },276 { "RTSemFastMutexCreate", (void *)0xefef000f },277 { "RTSemFastMutexDestroy", (void *)0xefef0010 },278 { "RTSemFastMutexRequest", (void *)0xefef0011 },279 { "RTSemFastMutexRelease", (void *)0xefef0012 },280 { "RTSemEventCreate", (void *)0xefef0013 },281 { "RTSemEventSignal", (void *)0xefef0014 },282 { "RTSemEventWait", (void *)0xefef0015 },283 { "RTSemEventDestroy", (void *)0xefef0016 },284 { "RTSpinlockCreate", (void *)0xefef0017 },285 { "RTSpinlockDestroy", (void *)0xefef0018 },286 { "RTSpinlockAcquire", (void *)0xefef0019 },287 { "RTSpinlockRelease", (void *)0xefef001a },288 { "RTSpinlockAcquireNoInts", (void *)0xefef001b },289 { "RTSpinlockReleaseNoInts", (void *)0xefef001c },290 { "RTThreadNativeSelf", (void *)0xefef001d },291 { "RTThreadSleep", (void *)0xefef001e },292 { "RTThreadYield", (void *)0xefef001f },293 { "RTLogDefaultInstance", (void *)0xefef0020 },294 { "RTLogRelDefaultInstance", (void *)0xefef0021 },295 { "RTLogSetDefaultInstanceThread", (void *)0xefef0022 },296 { "RTLogLogger", (void *)0xefef0023 },297 { "RTLogLoggerEx", (void *)0xefef0024 },298 { "RTLogLoggerExV", (void *)0xefef0025 },299 { "AssertMsg1", (void *)0xefef0026 },300 { "AssertMsg2", (void *)0xefef0027 },279 { "SUPR0ObjRegister", 0xefef0000 }, 280 { "SUPR0ObjAddRef", 0xefef0001 }, 281 { "SUPR0ObjRelease", 0xefef0002 }, 282 { "SUPR0ObjVerifyAccess", 0xefef0003 }, 283 { "SUPR0LockMem", 0xefef0004 }, 284 { "SUPR0UnlockMem", 0xefef0005 }, 285 { "SUPR0ContAlloc", 0xefef0006 }, 286 { "SUPR0ContFree", 0xefef0007 }, 287 { "SUPR0MemAlloc", 0xefef0008 }, 288 { "SUPR0MemGetPhys", 0xefef0009 }, 289 { "SUPR0MemFree", 0xefef000a }, 290 { "SUPR0Printf", 0xefef000b }, 291 { "RTMemAlloc", 0xefef000c }, 292 { "RTMemAllocZ", 0xefef000d }, 293 { "RTMemFree", 0xefef000e }, 294 { "RTSemFastMutexCreate", 0xefef000f }, 295 { "RTSemFastMutexDestroy", 0xefef0010 }, 296 { "RTSemFastMutexRequest", 0xefef0011 }, 297 { "RTSemFastMutexRelease", 0xefef0012 }, 298 { "RTSemEventCreate", 0xefef0013 }, 299 { "RTSemEventSignal", 0xefef0014 }, 300 { "RTSemEventWait", 0xefef0015 }, 301 { "RTSemEventDestroy", 0xefef0016 }, 302 { "RTSpinlockCreate", 0xefef0017 }, 303 { "RTSpinlockDestroy", 0xefef0018 }, 304 { "RTSpinlockAcquire", 0xefef0019 }, 305 { "RTSpinlockRelease", 0xefef001a }, 306 { "RTSpinlockAcquireNoInts", 0xefef001b }, 307 { "RTSpinlockReleaseNoInts", 0xefef001c }, 308 { "RTThreadNativeSelf", 0xefef001d }, 309 { "RTThreadSleep", 0xefef001e }, 310 { "RTThreadYield", 0xefef001f }, 311 { "RTLogDefaultInstance", 0xefef0020 }, 312 { "RTLogRelDefaultInstance", 0xefef0021 }, 313 { "RTLogSetDefaultInstanceThread", 0xefef0022 }, 314 { "RTLogLogger", 0xefef0023 }, 315 { "RTLogLoggerEx", 0xefef0024 }, 316 { "RTLogLoggerExV", 0xefef0025 }, 317 { "AssertMsg1", 0xefef0026 }, 318 { "AssertMsg2", 0xefef0027 }, 301 319 }; 302 320 … … 1013 1031 /** @todo call the SUPLoadModule caller.... */ 1014 1032 /** @todo proper reference counting and such. */ 1015 if (g_pvVMMR0 )1033 if (g_pvVMMR0 != NIL_RTR0PTR) 1016 1034 { 1017 1035 void *pvValue; 1018 if (!SUPGetSymbolR0( g_pvVMMR0, pszSymbol, &pvValue))1036 if (!SUPGetSymbolR0((void *)g_pvVMMR0, pszSymbol, &pvValue)) 1019 1037 { 1020 1038 *pValue = (uintptr_t)pvValue; … … 1162 1180 { 1163 1181 OpenOut.fNeedsLoading = true; 1164 OpenOut.pvImageBase = (void *)0xef423420;1165 } 1166 *ppvImageBase = OpenOut.pvImageBase;1182 OpenOut.pvImageBase = 0xef423420; 1183 } 1184 *ppvImageBase = (void *)OpenOut.pvImageBase; 1167 1185 if ( VBOX_SUCCESS(rc) 1168 1186 && OpenOut.fNeedsLoading) … … 1220 1238 pIn->u32Cookie = g_u32Cookie; 1221 1239 pIn->u32SessionCookie = g_u32SessionCookie; 1222 pIn->pfnModuleInit = ( PFNR0MODULEINIT)(uintptr_t)ModuleInit;1223 pIn->pfnModuleTerm = ( PFNR0MODULETERM)(uintptr_t)ModuleTerm;1240 pIn->pfnModuleInit = (RTR0PTR)ModuleInit; 1241 pIn->pfnModuleTerm = (RTR0PTR)ModuleTerm; 1224 1242 if (fIsVMMR0) 1225 1243 { 1226 1244 pIn->eEPType = pIn->EP_VMMR0; 1227 1245 pIn->EP.VMMR0.pvVMMR0 = OpenOut.pvImageBase; 1228 pIn->EP.VMMR0.pvVMMR0Entry = ( void *)(uintptr_t)VMMR0Entry;1246 pIn->EP.VMMR0.pvVMMR0Entry = (RTR0PTR)VMMR0Entry; 1229 1247 } 1230 1248 else … … 1274 1292 * first unload will free it. 1275 1293 */ 1276 if ( pvImageBase == g_pvVMMR0)1294 if ((RTR0PTR)pvImageBase == g_pvVMMR0) 1277 1295 { 1278 1296 /* … … 1287 1305 g_pfnCallVMMR0 = NULL; 1288 1306 #endif 1289 g_pvVMMR0 = N ULL;1307 g_pvVMMR0 = NIL_RTR0PTR; 1290 1308 return VINF_SUCCESS; 1291 1309 } … … 1315 1333 In.u32Cookie = g_u32Cookie; 1316 1334 In.u32SessionCookie = g_u32SessionCookie; 1317 In.pvImageBase = pvImageBase;1335 In.pvImageBase = (RTR0PTR)pvImageBase; 1318 1336 int rc = VINF_SUCCESS; 1319 1337 if (!g_u32FakeMode) 1320 1338 rc = suplibOsIOCtl(SUP_IOCTL_LDR_FREE, &In, sizeof(In), NULL, 0); 1321 1339 if ( VBOX_SUCCESS(rc) 1322 && pvImageBase == g_pvVMMR0)1323 g_pvVMMR0 = N ULL;1340 && (RTR0PTR)pvImageBase == g_pvVMMR0) 1341 g_pvVMMR0 = NIL_RTR0PTR; 1324 1342 return rc; 1325 1343 } … … 1335 1353 size_t cchSymbol = strlen(pszSymbol); 1336 1354 const size_t cbIn = RT_OFFSETOF(SUPLDRGETSYMBOL_IN, szSymbol[cchSymbol + 1]); 1337 SUPLDRGETSYMBOL_OUT Out = { N ULL};1355 SUPLDRGETSYMBOL_OUT Out = { NIL_RTR0PTR }; 1338 1356 PSUPLDRGETSYMBOL_IN pIn = (PSUPLDRGETSYMBOL_IN)alloca(cbIn); 1339 1357 pIn->u32Cookie = g_u32Cookie; 1340 1358 pIn->u32SessionCookie = g_u32SessionCookie; 1341 pIn->pvImageBase = pvImageBase;1359 pIn->pvImageBase = (RTR0PTR)pvImageBase; 1342 1360 memcpy(pIn->szSymbol, pszSymbol, cchSymbol + 1); 1343 1361 int rc; … … 1347 1365 { 1348 1366 rc = VINF_SUCCESS; 1349 Out.pvSymbol = (void *)0xdeadf00d;1367 Out.pvSymbol = 0xdeadf00d; 1350 1368 } 1351 1369 if (VBOX_SUCCESS(rc)) 1352 *ppvValue = Out.pvSymbol;1370 *ppvValue = (void *)Out.pvSymbol; 1353 1371 return rc; 1354 1372 } … … 1364 1382 SUPR3DECL(int) SUPUnloadVMM(void) 1365 1383 { 1366 return SUPFreeModule( g_pvVMMR0);1384 return SUPFreeModule((void*)g_pvVMMR0); 1367 1385 } 1368 1386
Note:
See TracChangeset
for help on using the changeset viewer.