Changeset 93484 in vbox for trunk/src/bldprogs
- Timestamp:
- Jan 29, 2022 12:18:12 AM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bldprogs/VBoxDef2LazyLoad.cpp
r93115 r93484 1027 1027 "; Thunks.\n" 1028 1028 ";\n" 1029 ".section __TEXT,__text,regular,pure_instructions\n" 1030 ".p2align 2\n"); 1029 ".section __TEXT,__text,regular,pure_instructions\n"); 1031 1030 for (PMYEXPORT pExp = g_pExpHead; pExp; pExp = pExp->pNext) 1032 1031 fprintf(pOutput, 1032 ".p2align 3\n" 1033 1033 ".globl %s%s\n" 1034 1034 "%s%s:\n" 1035 " ldr x9, =g_pfn%s\n" 1036 " blr x9\n", 1037 pszNmPfx, pExp->szName, pszNmPfx, pExp->szName, pExp->szName); 1035 " adrp x9, %sg_pfn%s@PAGE\n" 1036 " ldr x9, [x9, %sg_pfn%s@PAGEOFF]\n" 1037 " br x9\n", 1038 pszNmPfx, pExp->szName, pszNmPfx, pExp->szName, pszNmPfx, pExp->szName, pszNmPfx, pExp->szName); 1038 1039 fprintf(pOutput, 1039 1040 "\n" … … 1048 1049 ";\n" 1049 1050 ".section __DATA,__data\n" 1050 ".p2align 2\n"1051 ".p2align 3\n" 1051 1052 "g_apfnImports:\n"); 1052 1053 for (PMYEXPORT pExp = g_pExpHead; pExp; pExp = pExp->pNext) … … 1103 1104 ";\n" 1104 1105 ".section __TEXT,__text,regular,pure_instructions\n" 1105 ".p2align 2\n");1106 ".p2align 3\n"); 1106 1107 for (PMYEXPORT pExp = g_pExpHead; pExp; pExp = pExp->pNext) 1107 1108 { … … 1109 1110 fprintf(pOutput, 1110 1111 "___LazyLoad___%s:\n" 1111 " ldr x9, =g_sz%s\n" 1112 " ldr x10, =g_pfn%s\n" 1112 " adrp x9, g_sz%s@PAGE\n" 1113 " add x9, x9, g_sz%s@PAGEOFF\n" 1114 " adrp x10, %sg_pfn%s@PAGE\n" 1115 " add x10, x10, %sg_pfn%s@PAGEOFF\n" 1113 1116 " bl LazyLoadResolver\n" 1114 , pExp->pszExportedNm, pExp->pszExportedNm, pExp->pszExportedNm); 1117 , pExp->pszExportedNm, 1118 pExp->pszExportedNm, pExp->pszExportedNm, 1119 pszNmPfx, pExp->pszExportedNm, pszNmPfx, pExp->pszExportedNm); 1115 1120 else 1116 1121 fprintf(pOutput, 1117 1122 "___LazyLoad___%s:\n" 1118 1123 " movk w9, #%u\n" 1119 " ldr x10, =g_pfn%s\n" 1120 " bl LazyLoadResolver\n" 1121 , pExp->pszExportedNm, pExp->uOrdinal, pExp->pszExportedNm); 1124 " adrp x10, %sg_pfn%s@PAGE\n" 1125 " add x10, x10, %sg_pfn%s@PAGEOFF\n" 1126 , pExp->pszExportedNm, 1127 pExp->uOrdinal, 1128 pszNmPfx, pExp->pszExportedNm, pszNmPfx, pExp->pszExportedNm); 1122 1129 fprintf(pOutput, " b %s%s\n", pszNmPfx, pExp->szName); 1123 1130 fprintf(pOutput, "\n"); … … 1150 1157 ";\n" 1151 1158 ".section __TEXT,__text,regular,pure_instructions\n" 1152 ".p2align 2\n"1159 ".p2align 3\n" 1153 1160 "LazyLoadResolver:\n" 1154 1161 " .cfi_startproc\n" … … 1193 1200 "\n" 1194 1201 " ; Get the module handle and call RTLdrGetSymbol(RTLDRMOD hLdrMod, const char *pszSymbol, void **ppvValue)\n" 1195 " ldr x0, =g_hMod\n"1196 " ldr x0, [x0 ]\n"1202 " adrp x0, g_hMod@PAGE\n" 1203 " ldr x0, [x0, g_hMod@PAGEOFF]\n" 1197 1204 " cmp x0, #0\n" 1198 1205 " b.eq LazyLoading\n" … … 1206 1213 "Lbadsym: ; Call sRTAssertMsg2Weak. Variadic (...) arguments are passed on the stack it seems.\n" 1207 1214 " mov x3, x0\n" 1208 " ldr x2, =g_szLibrary\n" 1215 " adrp x2, g_szLibrary@PAGE\n" 1216 " add x2, x2, g_szLibrary@PAGEOFF\n" 1209 1217 " mov x1, x19\n" 1210 " ldr x0, =g_szFailLoadFmt\n" 1218 " adrp x0, g_szFailLoadFmt@PAGE\n" 1219 " add x0, x0, g_szFailLoadFmt@PAGEOFF\n" 1211 1220 " stp x1, x2, [sp]\n" 1212 1221 " str x3, [sp, #16]\n" … … 1276 1285 " mov x3, #0\n" 1277 1286 " mov x2, #0\n" 1278 " ldr x1, =g_hMod\n" 1279 " ldr x0, =g_szLibrary\n" 1287 " adrp x1, g_hMod@PAGE\n" 1288 " add x1, x1, g_hMod@PAGEOFF\n" 1289 " adrp x0, g_szLibrary@PAGE\n" 1290 " add x0, x0, g_szLibrary@PAGEOFF\n" 1280 1291 " bl %sSUPR3HardenedLdrLoadAppPriv\n" 1281 1292 , pszNmPfx); … … 1283 1294 fprintf(pOutput, 1284 1295 " ; Call RTLdrLoadSystem(const char *pszFilename, bool fNoUnload, PRTLDRMOD phLdrMod);\n" 1285 " ldr x2, =g_hMod\n" 1296 " adrp x2, g_hMod@PAGE\n" 1297 " add x2, x2, g_hMod@PAGEOFF\n" 1286 1298 " mov x1, #1\n" 1287 " ldr x0, =g_szLibrary\n" 1299 " adrp x0, g_szLibrary@PAGE\n" 1300 " add x0, x0, g_szLibrary@PAGEOFF\n" 1288 1301 " bl %sRTLdrLoadSystem\n" 1289 1302 , pszNmPfx); … … 1295 1308 "Lbadload: ; Call sRTAssertMsg2Weak. Variadic (...) arguments are passed on the stack it seems.\n" 1296 1309 " mov x2, x0\n" 1297 " ldr x1, =g_szLibrary\n" 1298 " ldr x0, =g_szFailResolveFmt\n" 1310 " adrp x1, g_szLibrary@PAGE\n" 1311 " add x1, x1, g_szLibrary@PAGEOFF\n" 1312 " adrp x0, g_szFailResolveFmt@PAGE\n" 1313 " add x0, x0, g_szFailResolveFmt@PAGEOFF\n" 1299 1314 " stp x1, x2, [sp]\n" 1300 1315 " bl %sRTAssertMsg2Weak\n" … … 1303 1318 " b Lbadloadloop\n" 1304 1319 "Lload_return:\n" 1305 " ldr x0, =g_hMod\n"1306 " ldr x0, [x0 ]\n"1320 " adrp x0, g_hMod@PAGE\n" 1321 " ldr x0, [x0, g_hMod@PAGEOFF]\n" 1307 1322 " ldp x29, x30, [sp, #48]\n" 1308 1323 " .cfi_restore x29\n" … … 1333 1348 ";\n" 1334 1349 ".section __TEXT,__text,regular,pure_instructions\n" 1335 ".p2align 2\n"1336 ".globl ExplicitlyLoad%.*s\n"1337 " ExplicitlyLoad%.*s:\n"1350 ".p2align 3\n" 1351 ".globl %sExplicitlyLoad%.*s\n" 1352 "%sExplicitlyLoad%.*s:\n" 1338 1353 " .cfi_startproc\n" 1339 1354 " ; Create frame.\n" … … 1359 1374 " ; Is the module already loaded?\n" 1360 1375 " ;\n" 1361 " ldr x0, =g_hMod\n"1362 " ldr x0, [x0 ]\n"1376 " adrp x0, g_hMod@PAGE\n" 1377 " ldr x0, [x0, g_hMod@PAGEOFF]\n" 1363 1378 " cmp x0, #0\n" 1364 1379 " b.ne Lexplicit_loaded_module\n" … … 1366 1381 , 1367 1382 cchLibBaseName, g_pszLibrary, 1368 cchLibBaseName, g_pszLibrary,1369 cchLibBaseName, g_pszLibrary);1383 pszNmPfx, cchLibBaseName, g_pszLibrary, 1384 pszNmPfx, cchLibBaseName, g_pszLibrary); 1370 1385 fprintf(pOutput, 1371 1386 "Lexplicit_load_module:\n" … … 1373 1388 " mov x3, #0\n" 1374 1389 " mov x2, #0\n" 1375 " ldr x1, =g_hMod\n" 1376 " ldr x0, =g_szLibrary\n" 1390 " adrp x1, g_hMod@PAGE\n" 1391 " add x1, x1, g_hMod@PAGEOFF\n" 1392 " adrp x0, g_szLibrary@PAGE\n" 1393 " add x0, x0, g_szLibrary@PAGEOFF\n" 1377 1394 " bl %sSUPR3HardenedLdrLoadAppPriv\n" 1378 1395 " cmp x0, #0\n" … … 1389 1406 " b.eq Lexplicit_load_return\n" 1390 1407 "\n" 1391 " ldr x22, =g_szzNames\n" 1392 " ldr x23, =g_apfnImports\n" 1408 " adrp x22, g_szzNames@PAGE\n" 1409 " add x22, x22, g_szzNames@PAGEOFF\n" 1410 " adrp x23, g_apfnImports@PAGE\n" 1411 " add x23, x23, g_apfnImports@PAGEOFF\n" 1393 1412 "Lexplicit_load_next_import:\n" 1394 1413 " ldr x0, [x23]\n" … … 1397 1416 "\n" 1398 1417 " ; Get the module handle and call RTLdrGetSymbol(RTLDRMOD hLdrMod, const char *pszSymbol, void **ppvValue)\n" 1399 " ldr x0, =g_hMod\n"1400 " ldr x0, [x0 ]\n"1418 " adrp x0, g_hMod@PAGE\n" 1419 " ldr x0, [x0, g_hMod@PAGEOFF]\n" 1401 1420 " mov x1, x22\n" 1402 1421 " mov x2, x23\n"
Note:
See TracChangeset
for help on using the changeset viewer.