blob: dcdf0777e9235c9266b2e54f6ad17aa108483b1b (
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
#pragma once
#include <loader/shim.h>
#include <efi.h>
#ifdef __ELF__
#define EFIEXPORT __attribute__((visibility("default")))
#else
#define EFIEXPORT __declspec(dllexport)
#endif
#define OsVendorMemoryType(t) ((EFI_MEMORY_TYPE)(0x80000000|t))
#define SystemMemoryType OsVendorMemoryType(1)
struct efi_loader_image
{
CHAR16 *path;
EFI_SYSTEM_TABLE *system_table;
EFI_FILE_PROTOCOL *root;
EFI_FILE_PROTOCOL *file;
EFI_PHYSICAL_ADDRESS buffer_base;
UINTN buffer_size;
};
typedef EFI_STATUS (EFIAPI *efi_image_func)(struct efi_loader_image *image);
typedef EFI_STATUS (EFIAPI *efi_page_alloc_func)(
EFI_MEMORY_TYPE type,
UINTN size,
EFI_PHYSICAL_ADDRESS *base);
typedef EFI_STATUS (EFIAPI *efi_page_free_func)(
EFI_PHYSICAL_ADDRESS base,
UINTN size);
struct efi_loader_interface
{
EFI_HANDLE image_handle;
EFI_SYSTEM_TABLE *system_table;
efi_page_alloc_func page_alloc;
efi_page_free_func page_free;
efi_image_func image_open;
efi_image_func image_alloc;
efi_image_func image_load;
};
typedef EFI_STATUS
(__attribute__((sysv_abi)) *efi_shim_entry_func)(struct efi_loader_interface *interface);
|