You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This patch adds !findall support for Rust. In addition, it removes
the !loadmodules export as that is wrapped by !findall. Finally, it
also updates the ARM64 PT parsing code to mark when a page has the
access flag set.
if (!ReadPointer (SystemPtrAddr, &SystemPtrAddr)) {
283
+
dprintf ("Failed to read memory at %llx to get system table from ptr\n", SystemPtrAddr);
284
+
return ERROR_NOT_FOUND;
285
+
}
286
+
}
229
287
}
230
288
231
-
if (!ReadPointer (BsPtrAddr, &BsTableAddr)) {
232
-
dprintf ("Failed to find boot services table!\n");
289
+
if (SystemPtrAddr == NULL) {
290
+
// TODO: Add a flag to indicate whether we should scan memory for the system table pointer and then make the
291
+
// scanning better, maybe binary search (though has issues). For now, C DXE has parity with before, Rust has
292
+
// two cases, we don't have the monitor command yet, but that is only true at the initial breakpoint (gets set up
293
+
// very soon after that, before other modules are loaded, so we have already succeeded) or we are in an older Rust
294
+
// core that doesn't support the monitor command
233
295
return ERROR_NOT_FOUND;
234
-
}
235
296
236
-
Result = FindModuleBackwards (BsTableAddr);
237
-
if (Result != S_OK) {
238
-
return Result;
297
+
/*
298
+
// Locate the system table pointer, which is allocated on a 4MB boundary near the top of memory
299
+
// with signature EFI_SYSTEM_TABLE_SIGNATURE SIGNATURE_64 ('I','B','I',' ','S','Y','S','T')
300
+
// and the EFI_SYSTEM_TABLE structure.
301
+
SystemPtrAddr = 0x80000000; // Start at the top of memory, well, as far as we want to go. This is pretty lazy, but it takes a long time to search the entire memory space.
302
+
while (SystemPtrAddr >= 0x400000) { // Stop at 4MB boundary
303
+
if (!ReadPointer(SystemPtrAddr, &Signature)) {
304
+
SystemPtrAddr -= 0x400000; // Move to the next 4MB boundary
305
+
continue;
306
+
}
307
+
308
+
if (Signature == SystemTableSignature) {
309
+
dprintf("Found EFI_SYSTEM_TABLE_SIGNATURE at %llx\n", SystemPtrAddr);
310
+
break;
311
+
}
312
+
313
+
SystemPtrAddr -= 0x400000; // Move to the next 4MB boundary
314
+
}
315
+
316
+
if (SystemPtrAddr < 0x400000) {
317
+
dprintf("Failed to locate EFI_SYSTEM_TABLE_SIGNATURE!\n");
318
+
return ERROR_NOT_FOUND;
319
+
}
320
+
*/
321
+
} else {
322
+
// Check the signature at the system table pointer address
323
+
if (!ReadPointer (SystemPtrAddr, &Signature)) {
324
+
dprintf ("Failed to read memory at %llx to get system table signature\n", SystemPtrAddr);
325
+
return ERROR_NOT_FOUND;
326
+
}
327
+
328
+
if (Signature != SystemTableSignature) {
329
+
dprintf ("Couldn't find EFI_SYSTEM_TABLE_SIGNATURE %llx at %llx, found %llx instead\n", SystemTableSignature, SystemPtrAddr, Signature);
330
+
return ERROR_NOT_FOUND;
331
+
}
239
332
}
240
333
241
-
g_ExtControl->Execute (
242
-
DEBUG_OUTCTL_ALL_CLIENTS,
243
-
"ld *Core",
244
-
DEBUG_EXECUTE_DEFAULT
245
-
);
334
+
// move past the signature to get the EFI_SYSTEM_TABLE structure
335
+
SystemPtrAddr += sizeof (UINT64);
336
+
337
+
if (!ReadPointer (SystemPtrAddr, &SystemTableAddr)) {
0 commit comments