Changeset 81458 in vbox
- Timestamp:
- Oct 22, 2019 4:50:13 PM (5 years ago)
- Location:
- trunk/src/VBox/Devices
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/EFI/DevEFI.cpp
r81455 r81458 173 173 174 174 /** The system EFI ROM data. */ 175 uint8_t *pu8EfiRom; 175 uint8_t const *pu8EfiRom; 176 /** The system EFI ROM data pointer to be passed to RTFileReadAllFree. */ 177 uint8_t *pu8EfiRomFree; 176 178 /** The size of the system EFI ROM. */ 177 179 uint64_t cbEfiRom; … … 314 316 /** The EfiSystemNvDataFv GUID for NVRAM storage. */ 315 317 static const RTUUID g_UuidNvDataFv = { { 0x8d, 0x2b, 0xf1, 0xff, 0x96, 0x76, 0x8b, 0x4c, 0xa9, 0x85, 0x27, 0x47, 0x07, 0x5b, 0x4f, 0x50} }; 318 319 #ifdef VBOX_WITH_EFI_IN_DD2 320 /** Special file name value for indicating the 32-bit built-in EFI firmware. */ 321 static const char g_szEfiBuiltin32[] = "VBoxEFI32.fd"; 322 /** Special file name value for indicating the 64-bit built-in EFI firmware. */ 323 static const char g_szEfiBuiltin64[] = "VBoxEFI64.fd"; 324 #endif 325 316 326 317 327 … … 1942 1952 } 1943 1953 1944 if (pThis->pu8EfiRom )1945 { 1946 RTFileReadAllFree(pThis->pu8EfiRom , (size_t)pThis->cbEfiRom + pThis->offEfiRom);1947 pThis->pu8EfiRom = NULL;1954 if (pThis->pu8EfiRomFree) 1955 { 1956 RTFileReadAllFree(pThis->pu8EfiRomFree, (size_t)pThis->cbEfiRom + pThis->offEfiRom); 1957 pThis->pu8EfiRomFree = NULL; 1948 1958 } 1949 1959 … … 2079 2089 * Read the entire firmware volume into memory. 2080 2090 */ 2081 void *pvFile; 2082 size_t cbFile; 2083 int rc = RTFileReadAllEx(pThis->pszEfiRomFile, 2091 int rc; 2092 #ifdef VBOX_WITH_EFI_IN_DD2 2093 if (RTStrCmp(pThis->pszEfiRomFile, g_szEfiBuiltin32) == 0) 2094 { 2095 pThis->pu8EfiRomFree = NULL; 2096 pThis->pu8EfiRom = g_abEfiFirmware32; 2097 pThis->cbEfiRom = g_cbEfiFirmware32; 2098 } 2099 else if (RTStrCmp(pThis->pszEfiRomFile, g_szEfiBuiltin64) == 0) 2100 { 2101 pThis->pu8EfiRomFree = NULL; 2102 pThis->pu8EfiRom = g_abEfiFirmware64; 2103 pThis->cbEfiRom = g_cbEfiFirmware64; 2104 } 2105 else 2106 #endif 2107 { 2108 void *pvFile; 2109 size_t cbFile; 2110 rc = RTFileReadAllEx(pThis->pszEfiRomFile, 2084 2111 0 /*off*/, 2085 2112 RTFOFF_MAX /*cbMax*/, … … 2087 2114 &pvFile, 2088 2115 &cbFile); 2089 if (RT_FAILURE(rc)) 2090 return PDMDevHlpVMSetError(pThis->pDevIns, rc, RT_SRC_POS, 2091 N_("Loading the EFI firmware volume '%s' failed with rc=%Rrc"), 2092 pThis->pszEfiRomFile, rc); 2093 pThis->pu8EfiRom = (uint8_t *)pvFile; 2094 pThis->cbEfiRom = cbFile; 2116 if (RT_FAILURE(rc)) 2117 return PDMDevHlpVMSetError(pThis->pDevIns, rc, RT_SRC_POS, 2118 N_("Loading the EFI firmware volume '%s' failed with rc=%Rrc"), 2119 pThis->pszEfiRomFile, rc); 2120 pThis->pu8EfiRomFree = (uint8_t *)pvFile; 2121 pThis->pu8EfiRom = (uint8_t *)pvFile; 2122 pThis->cbEfiRom = cbFile; 2123 } 2095 2124 2096 2125 /* … … 2403 2432 * Get the system EFI ROM file name. 2404 2433 */ 2434 #ifdef VBOX_WITH_EFI_IN_DD2 2435 rc = CFGMR3QueryStringAllocDef(pCfg, "EfiRom", &pThis->pszEfiRomFile, g_szEfiBuiltin32); 2436 if (RT_FAILURE(rc)) 2437 #else 2405 2438 rc = CFGMR3QueryStringAlloc(pCfg, "EfiRom", &pThis->pszEfiRomFile); 2406 2439 if (rc == VERR_CFGM_VALUE_NOT_FOUND) 2407 2440 { 2408 2441 pThis->pszEfiRomFile = (char *)PDMDevHlpMMHeapAlloc(pDevIns, RTPATH_MAX); 2409 if (!pThis->pszEfiRomFile) 2410 return VERR_NO_MEMORY; 2411 2442 AssertReturn(pThis->pszEfiRomFile, VERR_NO_MEMORY); 2412 2443 rc = RTPathAppPrivateArchTop(pThis->pszEfiRomFile, RTPATH_MAX); 2413 2444 AssertRCReturn(rc, rc); … … 2416 2447 } 2417 2448 else if (RT_FAILURE(rc)) 2449 #endif 2418 2450 return PDMDevHlpVMSetError(pDevIns, rc, RT_SRC_POS, 2419 2451 N_("Configuration error: Querying \"EfiRom\" as a string failed")); 2420 else if (!*pThis->pszEfiRomFile)2421 {2422 MMR3HeapFree(pThis->pszEfiRomFile);2423 pThis->pszEfiRomFile = NULL;2424 }2425 2426 2452 2427 2453 /* -
trunk/src/VBox/Devices/EFI/FlashCore.cpp
r81266 r81458 284 284 } 285 285 286 DECLHIDDEN(int) flashR3LoadFromBuf(PFLASHCORE pThis, void *pvBuf, size_t cbBuf)286 DECLHIDDEN(int) flashR3LoadFromBuf(PFLASHCORE pThis, void const *pvBuf, size_t cbBuf) 287 287 { 288 288 AssertReturn(pThis->cbFlashSize >= cbBuf, VERR_BUFFER_OVERFLOW); -
trunk/src/VBox/Devices/EFI/FlashCore.h
r81250 r81458 148 148 * @param cbBuf Size of the buffer in bytes. 149 149 */ 150 DECLHIDDEN(int) flashR3LoadFromBuf(PFLASHCORE pThis, void *pvBuf, size_t cbBuf);150 DECLHIDDEN(int) flashR3LoadFromBuf(PFLASHCORE pThis, void const *pvBuf, size_t cbBuf); 151 151 152 152 /** -
trunk/src/VBox/Devices/Makefile.kmk
r81450 r81458 1064 1064 VBoxDD2_LDFLAGS.darwin = -install_name $(VBOX_DYLD_EXECUTABLE_PATH)/VBoxDD2.dylib 1065 1065 VBoxDD2_LDFLAGS.linux = $(VBOX_GCC_NO_UNDEFINED) 1066 if 0 1066 if defined(VBOX_WITH_EFI) && 0 ## @todo need to update installers. 1067 VBoxDD_DEFS += VBOX_WITH_EFI_IN_DD2 1068 VBoxDD2_DEFS += VBOX_WITH_EFI 1067 1069 VBoxDD2_SOURCES += \ 1068 1070 EFI/DevEFI-binaries.asm -
trunk/src/VBox/Devices/build/VBoxDD2.h
r80531 r81458 45 45 extern DECLEXPORT(const unsigned) g_cbNetBiosBinary; 46 46 # endif 47 # ifdef VBOX_WITH_EFI_IN_DD2 48 extern DECLEXPORT(const unsigned char) g_abEfiFirmware32[]; 49 extern DECLEXPORT(const unsigned) g_cbEfiFirmware32; 50 extern DECLEXPORT(const unsigned char) g_abEfiFirmware64[]; 51 extern DECLEXPORT(const unsigned) g_cbEfiFirmware64; 52 # endif 47 53 #else /* !IN_VBOXDD2 */ 48 54 extern DECLIMPORT(const unsigned char) g_abPcBiosBinary386[]; … … 62 68 extern DECLIMPORT(const unsigned) g_cbNetBiosBinary; 63 69 # endif 70 # ifdef VBOX_WITH_EFI_IN_DD2 71 extern DECLIMPORT(const unsigned char) g_abEfiFirmware32[]; 72 extern DECLIMPORT(const unsigned) g_cbEfiFirmware32; 73 extern DECLIMPORT(const unsigned char) g_abEfiFirmware64[]; 74 extern DECLIMPORT(const unsigned) g_cbEfiFirmware64; 75 # endif 64 76 #endif /* !IN_VBOXDD2 */ 65 77
Note:
See TracChangeset
for help on using the changeset viewer.