Changeset 99908 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- May 22, 2023 4:59:46 PM (20 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxBFE/VBoxBFE.cpp
r99894 r99908 740 740 rc = pVMM->pfnCFGMR3InsertInteger(pMemRegion, "GCPhysStart", 0); UPDATE_RC(); 741 741 rc = pVMM->pfnCFGMR3InsertInteger(pMemRegion, "Size", 64 * _1M); UPDATE_RC(); 742 if (g_pszLoadMem) 743 { 744 rc = pVMM->pfnCFGMR3InsertString(pMemRegion, "PrepopulateFromFile", g_pszLoadMem); UPDATE_RC(); 745 } 742 746 743 747 rc = pVMM->pfnCFGMR3InsertNode(pMem, "Conventional", &pMemRegion); UPDATE_RC(); 744 748 rc = pVMM->pfnCFGMR3InsertInteger(pMemRegion, "GCPhysStart", DTB_ADDR); UPDATE_RC(); 745 749 rc = pVMM->pfnCFGMR3InsertInteger(pMemRegion, "Size", (uint64_t)g_u32MemorySizeMB * _1M); UPDATE_RC(); 746 750 if (g_pszLoadDtb) 751 { 752 rc = pVMM->pfnCFGMR3InsertString(pMemRegion, "PrepopulateFromFile", g_pszLoadDtb); UPDATE_RC(); 753 754 } 747 755 748 756 /* … … 983 991 984 992 /** 985 * Loads the content of a given file into guest RAM starting at the given guest physical address.986 *987 * @returns VBox status code.988 * @param pszFile The file to load.989 * @param GCPhysStart The physical start address to load the file at.990 */991 static int vboxbfeLoadFileAtGCPhys(const char *pszFile, RTGCPHYS GCPhysStart)992 {993 RTFILE hFile = NIL_RTFILE;994 int rc = RTFileOpen(&hFile, pszFile, RTFILE_O_READ | RTFILE_O_OPEN | RTFILE_O_DENY_WRITE);995 if (RT_SUCCESS(rc))996 {997 uint8_t abRead[GUEST_PAGE_SIZE];998 RTGCPHYS GCPhys = GCPhysStart;999 1000 for (;;)1001 {1002 size_t cbThisRead = 0;1003 rc = RTFileRead(hFile, &abRead[0], sizeof(abRead), &cbThisRead);1004 if (RT_FAILURE(rc))1005 break;1006 1007 rc = g_pVMM->pfnPGMPhysSimpleWriteGCPhys(g_pVM, GCPhys, &abRead[0], cbThisRead);1008 if (RT_FAILURE(rc))1009 break;1010 1011 GCPhys += cbThisRead;1012 if (cbThisRead < sizeof(abRead))1013 break;1014 }1015 1016 RTFileClose(hFile);1017 }1018 else1019 RTPrintf("Loading file %s failed -> %Rrc\n", pszFile, rc);1020 1021 return rc;1022 }1023 1024 1025 /**1026 993 * @interface_method_impl{VMM2USERMETHODS,pfnQueryGenericObject} 1027 994 */ … … 1116 1083 RTPrintf("Error: VMR3AtStateRegister failed with %Rrc.\n", rc); 1117 1084 goto failure; 1118 }1119 1120 /*1121 * Prepopulate the memory?1122 */1123 if (g_pszLoadMem)1124 {1125 rc = vboxbfeLoadFileAtGCPhys(g_pszLoadMem, 0 /*GCPhysStart*/);1126 if (RT_FAILURE(rc))1127 goto failure;1128 }1129 1130 if (g_pszLoadDtb)1131 {1132 rc = vboxbfeLoadFileAtGCPhys(g_pszLoadDtb, DTB_ADDR);1133 if (RT_FAILURE(rc))1134 goto failure;1135 1085 } 1136 1086
Note:
See TracChangeset
for help on using the changeset viewer.