Skip to content

Commit 722c410

Browse files
[libc] implement uefi exit()
1 parent a1f0016 commit 722c410

File tree

4 files changed

+8
-4
lines changed

4 files changed

+8
-4
lines changed

libc/include/llvm-libc-types/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,7 @@ add_header(EFI_BOOT_SERVICES
245245
.EFI_MEMORY_TYPE
246246
.EFI_OPEN_PROTOCOL_INFORMATION_ENTRY
247247
.EFI_PHYSICAL_ADDRESS
248+
.EFI_STATUS
248249
.EFI_TABLE_HEADER
249250
.EFI_TIMER_DELAY
250251
.EFI_TPL

libc/include/llvm-libc-types/EFI_BOOT_SERVICES.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include "EFI_MEMORY_TYPE.h"
2121
#include "EFI_OPEN_PROTOCOL_INFORMATION_ENTRY.h"
2222
#include "EFI_PHYSICAL_ADDRESS.h"
23+
#include "EFI_STATUS.h"
2324
#include "EFI_TABLE_HEADER.h"
2425
#include "EFI_TIMER_DELAY.h"
2526
#include "EFI_TPL.h"

libc/src/__support/OSUtil/uefi/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ add_object_library(
66
HDRS
77
io.h
88
DEPENDS
9+
libc.include.uefi
910
libc.src.__support.common
1011
libc.src.__support.CPP.string_view
1112
)

libc/src/__support/OSUtil/uefi/exit.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,17 @@
77
//===----------------------------------------------------------------------===//
88

99
#include "src/__support/OSUtil/exit.h"
10+
#include "include/llvm-libc-macros/stdlib-macros.h"
1011
#include "src/__support/macros/config.h"
12+
#include <Uefi.h>
1113

1214
namespace LIBC_NAMESPACE_DECL {
1315
namespace internal {
1416

1517
[[noreturn]] void exit(int status) {
16-
(void)status;
17-
// TODO: call boot services to exit
18-
while (true) {
19-
}
18+
efi_system_table->BootServices->Exit(efi_image_handle, status, 0, NULL);
19+
while (true)
20+
;
2021
}
2122

2223
} // namespace internal

0 commit comments

Comments
 (0)