Changeset 55490 in vbox for trunk/src/VBox/VMM
- Timestamp:
- Apr 28, 2015 3:42:11 PM (10 years ago)
- svn:sync-xref-src-repo-rev:
- 99839
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/VMMR3/PDMLdr.cpp
r52213 r55490 102 102 PVM pVM = pUVM->pVM; AssertPtr(pVM); 103 103 if (!HMIsEnabled(pVM)) 104 return PDMR3LdrLoadRC(pVM, NULL, VMMGC_MAIN_MODULE_NAME); 104 { 105 int rc = PDMR3LdrLoadRC(pVM, NULL, VMMGC_MAIN_MODULE_NAME); 106 if (RT_FAILURE(rc)) 107 return rc; 108 } 105 109 #endif 106 110 return VINF_SUCCESS; … … 246 250 * Validate input. 247 251 */ 248 AssertMsg( PDMCritSectIsInitialized(&pUVM->pVM->pdm.s.CritSect), ("bad init order!\n"));252 AssertMsg(RTCritSectIsInitialized(&pUVM->pdm.s.ListCritSect), ("bad init order!\n")); 249 253 Assert(pszFilename); 250 254 size_t cchFilename = strlen(pszFilename); … … 439 443 * 440 444 * @returns VBox status code. 445 * @retval VINF_PDM_ALREADY_LOADED if the module is already loaded (name + 446 * filename match). 447 * @retval VERR_PDM_MODULE_NAME_CLASH if a different file has already been 448 * loaded with the name module name. 449 * 441 450 * @param pVM The VM to load it into. 442 451 * @param pszFilename Filename of the module binary. … … 448 457 * Validate input. 449 458 */ 450 AssertMsg( PDMCritSectIsInitialized(&pVM->pdm.s.CritSect), ("bad init order!\n"));459 AssertMsg(MMR3IsInitialized(pVM), ("bad init order!\n")); 451 460 AssertReturn(!HMIsEnabled(pVM), VERR_PDM_HM_IPE); 452 453 PUVM pUVM = pVM->pUVM;454 RTCritSectEnter(&pUVM->pdm.s.ListCritSect);455 PPDMMOD pCur = pUVM->pdm.s.pModules;456 while (pCur)457 {458 if (!strcmp(pCur->szName, pszName))459 {460 RTCritSectLeave(&pUVM->pdm.s.ListCritSect);461 AssertMsgFailed(("We've already got a module '%s' loaded!\n", pszName));462 return VERR_PDM_MODULE_NAME_CLASH;463 }464 /* next */465 pCur = pCur->pNext;466 }467 461 468 462 /* … … 474 468 475 469 /* 470 * Check if a module by that name is already loaded. 471 */ 472 int rc; 473 PUVM pUVM = pVM->pUVM; 474 RTCritSectEnter(&pUVM->pdm.s.ListCritSect); 475 PPDMMOD pCur = pUVM->pdm.s.pModules; 476 while (pCur) 477 { 478 if (!strcmp(pCur->szName, pszName)) 479 { 480 /* Name clash. Hopefully due to it being the same file. */ 481 if (!strcmp(pCur->szFilename, pszFilename)) 482 rc = VINF_PDM_ALREADY_LOADED; 483 else 484 { 485 rc = VERR_PDM_MODULE_NAME_CLASH; 486 AssertMsgFailed(("We've already got a module '%s' loaded!\n", pszName)); 487 } 488 RTCritSectLeave(&pUVM->pdm.s.ListCritSect); 489 RTMemTmpFree(pszFile); 490 return rc; 491 } 492 /* next */ 493 pCur = pCur->pNext; 494 } 495 496 /* 476 497 * Allocate the module list node. 477 498 */ 478 PPDMMOD 499 PPDMMOD pModule = (PPDMMOD)RTMemAllocZ(sizeof(*pModule) + strlen(pszFilename)); 479 500 if (!pModule) 480 501 { … … 495 516 RTERRINFOSTATIC ErrInfo; 496 517 RTErrInfoInitStatic(&ErrInfo); 497 intrc = SUPR3HardenedVerifyPlugIn(pszFilename, &ErrInfo.Core);518 rc = SUPR3HardenedVerifyPlugIn(pszFilename, &ErrInfo.Core); 498 519 if (RT_SUCCESS(rc)) 499 520 { … … 727 748 AssertPtr(pszModule); 728 749 AssertPtr(ppvValue); 729 AssertMsg(PDMCritSectIsInitialized(&pVM->pdm.s.CritSect), ("bad init order!\n")); 750 PUVM pUVM = pVM->pUVM; 751 AssertMsg(RTCritSectIsInitialized(&pUVM->pdm.s.ListCritSect), ("bad init order!\n")); 730 752 731 753 /* 732 754 * Find the module. 733 755 */ 734 PUVM pUVM = pVM->pUVM;735 756 RTCritSectEnter(&pUVM->pdm.s.ListCritSect); 736 757 for (PPDMMOD pModule = pUVM->pdm.s.pModules; pModule; pModule = pModule->pNext) … … 786 807 AssertPtrNull(pszModule); 787 808 AssertPtr(ppvValue); 788 AssertMsg(PDMCritSectIsInitialized(&pVM->pdm.s.CritSect), ("bad init order!\n")); 809 PUVM pUVM = pVM->pUVM; 810 AssertMsg(RTCritSectIsInitialized(&pUVM->pdm.s.ListCritSect), ("bad init order!\n")); 789 811 790 812 if (!pszModule) … … 794 816 * Find the module. 795 817 */ 796 PUVM pUVM = pVM->pUVM;797 818 RTCritSectEnter(&pUVM->pdm.s.ListCritSect); 798 819 for (PPDMMOD pModule = pUVM->pdm.s.pModules; pModule; pModule = pModule->pNext) … … 842 863 AssertPtrNull(pszModule); 843 864 AssertPtr(ppvValue); 844 AssertMsg(PDMCritSectIsInitialized(&pVM->pdm.s.CritSect), ("bad init order!\n")); 865 PUVM pUVM = pVM->pUVM; 866 AssertMsg(RTCritSectIsInitialized(&pUVM->pdm.s.ListCritSect), ("bad init order!\n")); 845 867 846 868 /* … … 851 873 { 852 874 AssertMsgReturn(!strpbrk(pszModule, "/\\:\n\r\t"), ("pszModule=%s\n", pszModule), VERR_INVALID_PARAMETER); 853 PUVM pUVM = pVM->pUVM;854 875 PPDMMOD pModule; 855 876 RTCritSectEnter(&pUVM->pdm.s.ListCritSect); … … 894 915 AssertPtrNull(pszModule); 895 916 AssertPtr(pRCPtrValue); 896 AssertMsg( PDMCritSectIsInitialized(&pVM->pdm.s.CritSect), ("bad init order!\n"));917 AssertMsg(MMR3IsInitialized(pVM), ("bad init order!\n")); 897 918 898 919 if (!pszModule) … … 959 980 AssertPtrNull(pszModule); 960 981 AssertPtr(pRCPtrValue); 961 AssertMsg( PDMCritSectIsInitialized(&pVM->pdm.s.CritSect), ("bad init order!\n"));982 AssertMsg(MMR3IsInitialized(pVM), ("bad init order!\n")); 962 983 963 984 /*
Note:
See TracChangeset
for help on using the changeset viewer.