Skip to content

Commit a1f0016

Browse files
[libc] save efi image handle and system table in crt1
1 parent f35c1fe commit a1f0016

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

libc/hdrgen/yaml/Uefi.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,8 @@ types:
88
- type_name: EFI_SYSTEM_TABLE
99
enums: []
1010
functions: []
11-
objects: []
11+
objects:
12+
- object_name: efi_system_table
13+
object_type: EFI_SYSTEM_TABLE *
14+
- object_name: efi_image_handle
15+
object_type: EFI_HANDLE

libc/startup/uefi/crt1.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,16 @@
1212
#include "include/llvm-libc-types/EFI_SYSTEM_TABLE.h"
1313
#include "src/__support/macros/config.h"
1414

15+
EFI_HANDLE efi_image_handle;
16+
EFI_SYSTEM_TABLE *efi_system_table;
17+
1518
extern "C" int main(int argc, char **argv, char **envp);
1619

1720
extern "C" EFI_STATUS EfiMain(EFI_HANDLE ImageHandle,
1821
EFI_SYSTEM_TABLE *SystemTable) {
19-
(void)ImageHandle;
20-
(void)SystemTable;
22+
efi_image_handle = ImageHandle;
23+
efi_system_table = SystemTable;
24+
2125
main(0, NULL, NULL);
2226
// TODO: convert the return value of main to EFI_STATUS
2327
return 0; // TODO: EFI_SUCCESS

0 commit comments

Comments
 (0)