42 lines · cpp
1//===---------- UEFI implementation of IO utils ------------*- 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-exception6//7//===-----------------------------------------------------------------===//8 9#include "io.h"10 11#include "Uefi.h"12#include "config/app.h"13#include "src/__support/CPP/string_view.h"14#include "src/__support/macros/config.h"15 16namespace LIBC_NAMESPACE_DECL {17 18ssize_t read_from_stdin([[gnu::unused]] char *buf,19 [[gnu::unused]] size_t size) {20 return 0;21}22 23void write_to_stdout(cpp::string_view msg) {24 // TODO: use mbstowcs once implemented25 for (size_t i = 0; i < msg.size(); i++) {26 char16_t e[2] = {msg[i], 0};27 app.system_table->ConOut->OutputString(28 app.system_table->ConOut, reinterpret_cast<const char16_t *>(&e));29 }30}31 32void write_to_stderr(cpp::string_view msg) {33 // TODO: use mbstowcs once implemented34 for (size_t i = 0; i < msg.size(); i++) {35 char16_t e[2] = {msg[i], 0};36 app.system_table->StdErr->OutputString(37 app.system_table->StdErr, reinterpret_cast<const char16_t *>(&e));38 }39}40 41} // namespace LIBC_NAMESPACE_DECL42