xref: /freebsd/contrib/llvm-project/libc/src/__support/OSUtil/uefi/exit.cpp (revision bb722a7d0f1642bff6487f943ad0427799a6e5bf)
1 //===-------- UEFI implementation of an exit function ------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===-----------------------------------------------------------------===//
8 
9 #include "src/__support/OSUtil/exit.h"
10 #include "config/uefi.h"
11 #include "include/llvm-libc-types/EFI_SYSTEM_TABLE.h"
12 #include "src/__support/macros/config.h"
13 
14 namespace LIBC_NAMESPACE_DECL {
15 namespace internal {
16 
exit(int status)17 [[noreturn]] void exit(int status) {
18   app.system_table->BootServices->Exit(__llvm_libc_efi_image_handle, status, 0,
19                                        nullptr);
20   __builtin_unreachable();
21 }
22 
23 } // namespace internal
24 } // namespace LIBC_NAMESPACE_DECL
25