1 | //===-- Implementation of crt for UEFI ------------------------------------===// |
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 "config/app.h" |
10 | #include "include/llvm-libc-types/EFI_STATUS.h" |
11 | #include "src/__support/OSUtil/uefi/error.h" |
12 | #include "src/__support/macros/config.h" |
13 | |
14 | namespace LIBC_NAMESPACE_DECL { |
15 | AppProperties app; |
16 | } |
17 | |
18 | extern "C" { |
19 | EFI_HANDLE __llvm_libc_efi_image_handle; |
20 | EFI_SYSTEM_TABLE *__llvm_libc_efi_system_table; |
21 | |
22 | int main(int argc, char **argv, char **envp); |
23 | |
24 | EFI_STATUS EfiMain(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable) { |
25 | LIBC_NAMESPACE::app.image_handle = ImageHandle; |
26 | LIBC_NAMESPACE::app.system_table = SystemTable; |
27 | |
28 | // TODO: we need the EFI_SHELL_PROTOCOL, malloc, free, and UTF16 -> UTF8 |
29 | // conversion. |
30 | return LIBC_NAMESPACE::errno_to_uefi_status(main(0, nullptr, nullptr)); |
31 | } |
32 | } |
33 | |