summaryrefslogtreecommitdiff
path: root/kjarna/start.c
blob: 6a737b3b9109272b4f72d5645a026f4b2cef9168 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#include <efi/types.h>
#include <efi/error.h>
#include <efi/media.h>
#include <efi/tables.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;

	int runtime_result = runtime_start();

	if (runtime_result < 0)
	{
		efi_errno = EFI_ABORTED;
	}

	return _exit(efi_errno);
}