Populate UEFI entry point.

This commit is contained in:
Curle 2019-07-17 15:17:01 +01:00
parent 51641284bc
commit c59a95ebfa

View File

@ -0,0 +1,52 @@
/************************
*** Team Kitty, 2019 ***
*** Sync ***
***********************/
/* The entry point of the UEFI app.
* When the firmware loads the app,
* it calls the efi_main function.
*
* When it is called, the processor
* is running in 32-bit Protected mode.
* It is given a map of memory, and there
* are a bunch of Boot Services provided
* by the UEFI firmware.
*
* See uefi/docs for more information.
*/
//Example stolen from osdev.org/uefi_bare_bones
#include <efi.h>
#include <efilib.h>
EFI_STATUS efi_main(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable)
{
EFI_STATUS Status;
EFI_INPUT_KEY Key;
/* Store the system table for future use in other functions */
ST = SystemTable;
/* Say hi */
Status = ST->ConOut->OutputString(ST->ConOut, L"Hello World\n\r");
if (EFI_ERROR(Status))
return Status;
/* Now wait for a keystroke before continuing, otherwise your
message will flash off the screen before you see it.
First, we need to empty the console input buffer to flush
out any keystrokes entered before this point */
Status = ST->ConIn->Reset(ST->ConIn, FALSE);
if (EFI_ERROR(Status))
return Status;
/* Now wait until a key becomes available. This is a simple
polling implementation. You could try and use the WaitForKey
event instead if you like */
while ((Status = ST->ConIn->ReadKeyStroke(ST->ConIn, &Key)) == EFI_NOT_READY) ;
return Status;
}