summaryrefslogtreecommitdiffstats
path: root/GNU_efi_HelloWorld/hello.c
diff options
context:
space:
mode:
Diffstat (limited to 'GNU_efi_HelloWorld/hello.c')
-rw-r--r--GNU_efi_HelloWorld/hello.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/GNU_efi_HelloWorld/hello.c b/GNU_efi_HelloWorld/hello.c
index 817c135..171db1e 100644
--- a/GNU_efi_HelloWorld/hello.c
+++ b/GNU_efi_HelloWorld/hello.c
@@ -5,11 +5,28 @@ EFI_STATUS
EFIAPI
efi_main (EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable) {
+ EFI_LOADED_IMAGE *loaded_image = NULL;
+ EFI_STATUS status;
+
InitializeLib(ImageHandle, SystemTable);
Print(L"Hello, world!\n");
- // TODO: get SystemTable-> ... -> ImageBase
- // Print ImageBase
+ status = uefi_call_wrapper(SystemTable->BootServices->HandleProtocol,
+ 3,
+ ImageHandle,
+ &LoadedImageProtocol,
+ (void **)&loaded_image);
+
+ if (EFI_ERROR(status)) {
+ Print(L"handleprotocol: %r\n", status);
+ }
+
+ Print(L"Image base: 0x%lx\n", loaded_image->ImageBase);
+
+ int wait = 1;
+ while(wait) {
+ __asm__ __volatile__("pause");
+ }
return EFI_SUCCESS;
}