Changeset 72630 in vbox
- Timestamp:
- Jun 20, 2018 2:10:41 PM (7 years ago)
- svn:sync-xref-src-repo-rev:
- 123132
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/EFI/DevFlash.cpp
r72615 r72630 413 413 414 414 /** @todo this does not really belong here; workaround for EFI failing to init empty flash. */ 415 uint8_t aHdrBegin[] = {415 static const uint8_t aHdrBegin[] = { 416 416 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 417 417 0x8D, 0x2B, 0xF1, 0xFF, 0x96, 0x76, 0x8B, 0x4C, 0xA9, 0x85, 0x27, 0x47, 0x07, 0x5B, 0x4F, 0x50, … … 487 487 return PDMDEV_SET_ERROR(pDevIns, rc, N_("Failed to allocate heap memory")); 488 488 489 memset(pThis->pbFlash, 0xff, pThis->cbFlashSize);490 memcpy(pThis->pbFlash, aHdrBegin, sizeof(aHdrBegin));491 492 489 size_t cbRead = 0; 493 490 rc = RTFileRead(pThis->hFlashFile, pThis->pbFlash, pThis->cbFlashSize, &cbRead); 494 491 if (RT_FAILURE(rc)) 495 492 return PDMDEV_SET_ERROR(pDevIns, rc, N_("Failed to read flash file")); 496 Log(("Read %zu bytes from file (asked for %u).", cbRead, pThis->cbFlashSize)); 493 Log(("Read %zu bytes from file (asked for %u)\n.", cbRead, pThis->cbFlashSize)); 494 495 /* If the file didn't exist, or someone truncated it, we'll initialize 496 * the storage with default contents. 497 */ 497 498 if (cbRead != pThis->cbFlashSize) 498 return PDMDEV_SET_ERROR(pDevIns, VERR_READ_ERROR, N_("Failed to read flash file")); 499 { 500 memset(pThis->pbFlash, 0xff, pThis->cbFlashSize); 501 memcpy(pThis->pbFlash, aHdrBegin, sizeof(aHdrBegin)); 502 LogRel(("Only read %zu bytes from flash file (asked for %u). Initializing with defaults.\n", cbRead, pThis->cbFlashSize)); 503 } 499 504 500 505 /* Reset the dynamic state.*/
Note:
See TracChangeset
for help on using the changeset viewer.