[libc-commits] [libc] [libc] init uefi os target (PR #120687)
Nick Desaulniers via libc-commits
libc-commits at lists.llvm.org
Mon Jan 6 12:00:45 PST 2025
================
@@ -0,0 +1,80 @@
+#include "file.h"
+#include "hdr/types/FILE.h"
+#include "src/__support/macros/config.h"
+#include <Uefi.h>
+
+#define STDIN_FILENO 0
+#define STDOUT_FILENO 1
+#define STDERR_FILENO 2
+
+namespace LIBC_NAMESPACE_DECL {
+bool File::needsReset() { return handle_type == FileHandleId; }
+
+void File::reset() {
+ if (handle_type != FileHandleId)
+ return;
+
+ if (handle.id == STDIN_FILENO) {
+ handle = (FileHandle){
+ .simple_text_input = efi_system_table->ConIn,
+ };
+ handle_type = FileHandleSimpleTextInput;
+ } else {
+ handle = (FileHandle){
+ .simple_text_output = handle.id == STDERR_FILENO
+ ? efi_system_table->StdErr
+ : efi_system_table->ConOut,
+ };
+ handle_type = FileHandleSimpleTextOutput;
+ }
+}
+
+size_t File::read(void *data, size_t len) {
+ (void)data;
+ (void)len;
----------------
nickdesaulniers wrote:
same thing about unused params: https://godbolt.org/z/54db75bx6
https://github.com/llvm/llvm-project/pull/120687
More information about the libc-commits
mailing list