summaryrefslogtreecommitdiffstats
path: root/efi_memtest/MemtestEfi.c
diff options
context:
space:
mode:
authorRegia König2021-06-15 12:54:19 +0200
committerRegia König2021-06-15 12:54:19 +0200
commit74fef130183f1d99db81426c9a9682917d737f7c (patch)
tree685c63d345bb0fbc00c1c7b2348ac6ef3975401e /efi_memtest/MemtestEfi.c
parentRetrieve position (address) where the efi image is loaded (diff)
downloadmemtest86-74fef130183f1d99db81426c9a9682917d737f7c.tar.gz
memtest86-74fef130183f1d99db81426c9a9682917d737f7c.tar.xz
memtest86-74fef130183f1d99db81426c9a9682917d737f7c.zip
Get current return address in UefiMain
Diffstat (limited to 'efi_memtest/MemtestEfi.c')
-rw-r--r--efi_memtest/MemtestEfi.c28
1 files changed, 21 insertions, 7 deletions
diff --git a/efi_memtest/MemtestEfi.c b/efi_memtest/MemtestEfi.c
index 87ea80b..876d825 100644
--- a/efi_memtest/MemtestEfi.c
+++ b/efi_memtest/MemtestEfi.c
@@ -34,14 +34,14 @@ UefiMain (
}
- {
- char log[43] = "Address of UefiMain: ";
- int length = 23;
+ if (logflag) {
+ char log[41] = "Address of UefiMain: ";
+ int length = 21;
int_to_charr((unsigned long)UefiMain, log, &length);
print_log(log, length);
}
- {
+ if (logflag) {
char log[43] = "Address of test_start: ";
int length = 23;
int_to_charr((unsigned long)test_start, log, &length);
@@ -57,24 +57,38 @@ UefiMain (
NULL,
EFI_OPEN_PROTOCOL_GET_PROTOCOL);
if (status != EFI_SUCCESS) {
- print_log("Failed to open LoadedImage.", 27);
+ if (logflag) print_log("Failed to open LoadedImage.", 27);
} else {
VOID *base = ((EFI_LOADED_IMAGE_PROTOCOL *) LoadedImage)->ImageBase;
UINT64 size = ((EFI_LOADED_IMAGE_PROTOCOL *) LoadedImage)->ImageSize;
- {
+ if (logflag) {
char log[31] = "ImageBase: ";
int length = 11;
int_to_charr((unsigned long) base, log, &length);
print_log(log, length);
}
- {
+ if (logflag) {
char log[31] = "ImageSize: ";
int length = 11;
int_to_charr(size, log, &length);
print_log(log, length);
}
}
+
+ if (logflag) {
+ char log[45] = "Address of SystemTable = ";
+ int length = 25;
+ int_to_charr((unsigned long) SystemTable, log, &length);
+ print_log(log, length);
+ }
+
+ if (logflag) {
+ char log[45] = "Current return address = ";
+ int length = 25;
+ int_to_charr((unsigned long) ((unsigned long *) __builtin_return_address(0)), log, &length);
+ print_log(log, length);
+ }
test_start();