aboutsummaryrefslogtreecommitdiff
path: root/arch/x86_64/src/io.cpp
diff options
context:
space:
mode:
authorFelix Morgner <felix.morgner@ost.ch>2025-07-24 15:31:31 +0000
committerFelix Morgner <felix.morgner@ost.ch>2025-07-24 15:31:31 +0000
commit4edbe94ce1266c9acc6a695fedf1d2edd4ce11cd (patch)
tree6738e5ab071075c15beccc59b3f79f53477f477d /arch/x86_64/src/io.cpp
parent2b8fafa2bddc48ddec047de517115c8e65ee61e8 (diff)
downloadteachos-4edbe94ce1266c9acc6a695fedf1d2edd4ce11cd.tar.xz
teachos-4edbe94ce1266c9acc6a695fedf1d2edd4ce11cd.zip
build: factor out kernel API
Diffstat (limited to 'arch/x86_64/src/io.cpp')
-rw-r--r--arch/x86_64/src/io.cpp44
1 files changed, 26 insertions, 18 deletions
diff --git a/arch/x86_64/src/io.cpp b/arch/x86_64/src/io.cpp
index 8e9e411..eab6473 100644
--- a/arch/x86_64/src/io.cpp
+++ b/arch/x86_64/src/io.cpp
@@ -1,28 +1,36 @@
-#include "kern/print.hpp"
+#include "kapi/io.hpp"
+
#include "x86_64/vga/text.hpp"
-namespace teachos::arch::io
+namespace teachos::io
{
auto init() -> void
{
+ x86_64::vga::text::clear();
x86_64::vga::text::cursor(false);
+ }
+
+ auto print(std::string_view text) -> void
+ {
+ x86_64::vga::text::write(text, x86_64::vga::text::common_attributes::green_on_black);
+ }
+
+ auto println(std::string_view text) -> void
+ {
+ x86_64::vga::text::write(text, x86_64::vga::text::common_attributes::green_on_black);
+ x86_64::vga::text::newline();
+ }
+
+ auto print_error(std::string_view text) -> void
+ {
+ x86_64::vga::text::write(text, x86_64::vga::text::common_attributes::red_on_black);
+ }
- teachos::set_print_handler(
- [](auto text) { return x86_64::vga::text::write(text, x86_64::vga::text::common_attributes::green_on_black); });
- teachos::set_println_handler([](auto text) {
- x86_64::vga::text::write(text, x86_64::vga::text::common_attributes::green_on_black);
- x86_64::vga::text::newline();
- });
-
- teachos::set_print_error_handler(
- [](auto text) { return x86_64::vga::text::write(text, x86_64::vga::text::common_attributes::red_on_black); });
- teachos::set_println_error_handler([](auto text) {
- x86_64::vga::text::write(text, x86_64::vga::text::common_attributes::red_on_black);
- x86_64::vga::text::newline();
- });
-
- teachos::println("[x86-64] Basic VGA text output initialized.");
+ auto println_error(std::string_view text) -> void
+ {
+ x86_64::vga::text::write(text, x86_64::vga::text::common_attributes::red_on_black);
+ x86_64::vga::text::newline();
}
-} // namespace teachos::arch::io
+} // namespace teachos::io