From bc78d650cfe0b759a48afba17686671ac67c9387 Mon Sep 17 00:00:00 2001 From: Regia König Date: Wed, 17 Aug 2022 10:49:27 +0200 Subject: Expand analyzation script --- GNU_efi_HelloWorld/Makefile | 1 + GNU_efi_HelloWorld/analyse_hello.sh | 8 -------- GNU_efi_HelloWorld/hello.c | 5 ++++- GNU_efi_HelloWorld/hello.efi | Bin 46888 -> 46888 bytes GNU_efi_HelloWorld/hello.o | Bin 2112 -> 2112 bytes GNU_efi_HelloWorld/hello.so | Bin 2171456 -> 2171456 bytes documentation/GDB commands | 2 ++ test_code/OVMF_VARS.fd | Bin 540672 -> 540672 bytes test_code/analyse_hello.sh | 13 +++++++++++++ 9 files changed, 20 insertions(+), 9 deletions(-) delete mode 100755 GNU_efi_HelloWorld/analyse_hello.sh create mode 100755 test_code/analyse_hello.sh diff --git a/GNU_efi_HelloWorld/Makefile b/GNU_efi_HelloWorld/Makefile index 31195ee..448e3f7 100644 --- a/GNU_efi_HelloWorld/Makefile +++ b/GNU_efi_HelloWorld/Makefile @@ -20,6 +20,7 @@ LDFLAGS = -nostdlib -znocombreloc -T $(EFI_LDS) -shared \ -Bsymbolic -L $(EFILIB) $(EFI_CRT_OBJS) all: $(TARGET) + cp hello.efi ../test_code/hda-contents/ hello.so: $(OBJS) ld $(LDFLAGS) $(OBJS) -o $@ -lefi -lgnuefi diff --git a/GNU_efi_HelloWorld/analyse_hello.sh b/GNU_efi_HelloWorld/analyse_hello.sh deleted file mode 100755 index c8b3103..0000000 --- a/GNU_efi_HelloWorld/analyse_hello.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash - -echo "objdump -h hello.efi" -objdump -h hello.efi - -echo "########################################################################" -echo "peinfo hello.efi | grep text -A 5" -./peinfo hello.efi | grep text -A 5 diff --git a/GNU_efi_HelloWorld/hello.c b/GNU_efi_HelloWorld/hello.c index 171db1e..f40df6e 100644 --- a/GNU_efi_HelloWorld/hello.c +++ b/GNU_efi_HelloWorld/hello.c @@ -1,5 +1,6 @@ #include #include +#include EFI_STATUS EFIAPI @@ -23,7 +24,9 @@ efi_main (EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable) { Print(L"Image base: 0x%lx\n", loaded_image->ImageBase); - int wait = 1; + DEBUG((D_ERROR, "AllocatePool: out of pool %x\n", status)); + + volatile int wait = 1; while(wait) { __asm__ __volatile__("pause"); } diff --git a/GNU_efi_HelloWorld/hello.efi b/GNU_efi_HelloWorld/hello.efi index c8399c0..f8ea7e2 100755 Binary files a/GNU_efi_HelloWorld/hello.efi and b/GNU_efi_HelloWorld/hello.efi differ diff --git a/GNU_efi_HelloWorld/hello.o b/GNU_efi_HelloWorld/hello.o index 21583fe..37f6971 100644 Binary files a/GNU_efi_HelloWorld/hello.o and b/GNU_efi_HelloWorld/hello.o differ diff --git a/GNU_efi_HelloWorld/hello.so b/GNU_efi_HelloWorld/hello.so index b64f729..089f3f7 100755 Binary files a/GNU_efi_HelloWorld/hello.so and b/GNU_efi_HelloWorld/hello.so differ diff --git a/documentation/GDB commands b/documentation/GDB commands index 3316a38..1cbd2ac 100644 --- a/documentation/GDB commands +++ b/documentation/GDB commands @@ -96,3 +96,5 @@ gdb --tui - tui disable - next + + - ctrl+x o || change active window diff --git a/test_code/OVMF_VARS.fd b/test_code/OVMF_VARS.fd index 852d584..d1888bc 100644 Binary files a/test_code/OVMF_VARS.fd and b/test_code/OVMF_VARS.fd differ diff --git a/test_code/analyse_hello.sh b/test_code/analyse_hello.sh new file mode 100755 index 0000000..2e9187f --- /dev/null +++ b/test_code/analyse_hello.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +echo "#### \$objdump -h hello.efi" +objdump -h hda-contents/hello.efi + +echo "########################################################################" +echo "#### \$peinfo hello.efi | grep text -A 5" +./peinfo hda-contents/hello.efi | grep text -A 5 + + +echo "########################################################################" +echo "#### \$cat debug.log | grep hello -A 5" +cat debug.log | grep hello -A 5 -- cgit v1.2.3-55-g7522