#include #include EFI_SYSTEM_TABLE *gST; EFI_BOOT_SERVICES *gBS; EFI_RUNTIME_SERVICES *gRT; // Application entrypoint (must be set to 'efi_main' for gnu-efi crt0 compatibility) EFI_STATUS efi_main(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable) { UINTN Event; EFI_STATUS Status; EFI_TIME* Time; gST = SystemTable; gBS = gST->BootServices; gRT = gST->RuntimeServices; #if defined(_GNU_EFI) InitializeLib(ImageHandle, SystemTable); #endif /* * In addition to the standard %-based flags, Print() supports the following: * %N Set output attribute to normal * %H Set output attribute to highlight * %E Set output attribute to error * %B Set output attribute to blue color * %V Set output attribute to green color * %r Human readable version of a status code */ Print(L"\n%H*** Sync Bootloading ***%N\n\n"); Status = gST->ConOut->OutputString(gST->ConOut, L"Hello World\n\r"); if (EFI_ERROR(Status)) return Status; Status = gBS->AllocatePool(EfiBootServicesData, sizeof(EFI_TIME), (VOID**)&Time); if (EFI_ERROR(Status)) return Status; Status = gRT->GetTime(Time, NULL); if (EFI_ERROR(Status)) return Status; Print(L"%EPress any key to exit.%N\n"); SystemTable->ConIn->Reset(SystemTable->ConIn, FALSE); SystemTable->BootServices->WaitForEvent(1, &SystemTable->ConIn->WaitForKey, &Event); #if defined(_DEBUG) // If running in debug mode, use the EFI shut down call to close QEMU SystemTable->RuntimeServices->ResetSystem(EfiResetShutdown, EFI_SUCCESS, 0, NULL); #endif return Status; }