Skip to content

Commit 21585ba

Browse files
[libc] add os util out and err writes for uefi
1 parent 254fcd4 commit 21585ba

File tree

1 file changed

+11
-2
lines changed
  • libc/src/__support/OSUtil/uefi

1 file changed

+11
-2
lines changed

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

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
#include "src/__support/CPP/string_view.h"
1212
#include "src/__support/macros/config.h"
13+
#include <Uefi.h>
1314

1415
namespace LIBC_NAMESPACE_DECL {
1516

@@ -19,8 +20,16 @@ ssize_t read_from_stdin(char *buf, size_t size) {
1920
return 0;
2021
}
2122

22-
void write_to_stdout(cpp::string_view msg) { (void)msg; }
23+
void write_to_stdout(cpp::string_view msg) {
24+
// TODO: use mbstowcs once implemented
25+
efi_system_table->ConOut->OutputString(
26+
efi_system_table->ConOut, reinterpret_cast<const char16_t *>(msg.data()));
27+
}
2328

24-
void write_to_stderr(cpp::string_view msg) { (void)msg; }
29+
void write_to_stderr(cpp::string_view msg) {
30+
// TODO: use mbstowcs once implemented
31+
efi_system_table->StdErr->OutputString(
32+
efi_system_table->StdErr, reinterpret_cast<const char16_t *>(msg.data()));
33+
}
2534

2635
} // namespace LIBC_NAMESPACE_DECL

0 commit comments

Comments
 (0)