diff options
Diffstat (limited to 'GNU_efi_HelloWorld/hello.c')
-rw-r--r-- | GNU_efi_HelloWorld/hello.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/GNU_efi_HelloWorld/hello.c b/GNU_efi_HelloWorld/hello.c new file mode 100644 index 0000000..f135c21 --- /dev/null +++ b/GNU_efi_HelloWorld/hello.c @@ -0,0 +1,37 @@ +#include <efi.h> +#include <efilib.h> + +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"); + + 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); + Print(L"UefiMain: 0x%1x\n", (unsigned long)efi_main); + + DEBUG((D_ERROR, (CHAR8*)"DEBUG_TEST DEBUG_TEST\r\n")); + + DEBUG((D_ERROR, (CHAR8*)"My Entry Point: 0x%08x\r\n",(CHAR16*)efi_main)); + +/* volatile int wait = 1; + while(wait) { + __asm__ __volatile__("pause"); + } +*/ + return EFI_SUCCESS; +} |