summaryrefslogtreecommitdiff
path: root/boot/efi/start.c
diff options
context:
space:
mode:
Diffstat (limited to 'boot/efi/start.c')
-rw-r--r--boot/efi/start.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/boot/efi/start.c b/boot/efi/start.c
new file mode 100644
index 0000000..8ef8cbe
--- /dev/null
+++ b/boot/efi/start.c
@@ -0,0 +1,32 @@
+#include <efi/types.h>
+#include <efi/error.h>
+#include <efi/media.h>
+#include <efi/tables.h>
+
+#include "../kjarna.h"
+#include "kjarna_efi.h"
+
+struct efi_context const *efi_context;
+EFI_STATUS efi_errno = EFI_SUCCESS;
+
+EFI_STATUS _exit(EFI_STATUS status)
+{
+ return gBS->Exit(efi_context->handle, status, 0, nullptr);
+}
+
+EFI_STATUS _start(EFI_HANDLE handle, EFI_SYSTEM_TABLE *system_table)
+{
+ struct efi_context app_context = { handle, system_table };
+ efi_context = &app_context;
+
+ system_table->ConOut->ClearScreen(system_table->ConOut);
+
+ if (main(0, nullptr) != 0)
+ {
+ efi_errno = EFI_ABORTED;
+ }
+
+
+ return _exit(efi_errno);
+}
+