aboutsummaryrefslogtreecommitdiff
path: root/arch/x86_64
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86_64')
-rw-r--r--arch/x86_64/CMakeLists.txt3
-rw-r--r--arch/x86_64/src/io.cpp44
-rw-r--r--arch/x86_64/src/memory.cpp12
-rw-r--r--arch/x86_64/src/system.cpp6
4 files changed, 36 insertions, 29 deletions
diff --git a/arch/x86_64/CMakeLists.txt b/arch/x86_64/CMakeLists.txt
index 431520e..4cb20b6 100644
--- a/arch/x86_64/CMakeLists.txt
+++ b/arch/x86_64/CMakeLists.txt
@@ -6,8 +6,7 @@ target_include_directories("arch-x86_64" PUBLIC
)
target_link_libraries("arch-x86_64" PUBLIC
- "arch::any"
- "os::kern"
+ "api::kapi"
"libs::multiboot2"
)
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
diff --git a/arch/x86_64/src/memory.cpp b/arch/x86_64/src/memory.cpp
index b6901a5..d1c1f03 100644
--- a/arch/x86_64/src/memory.cpp
+++ b/arch/x86_64/src/memory.cpp
@@ -1,6 +1,6 @@
-#include "arch/memory.hpp"
+#include "kapi/memory.hpp"
-#include "kern/error.hpp"
+#include "kapi/system.hpp"
#include "x86_64/boot/boot.hpp"
#include "x86_64/boot/ld.hpp"
@@ -11,7 +11,7 @@
#include <atomic>
-namespace teachos::arch::memory
+namespace teachos::memory
{
using namespace x86_64::memory;
using namespace x86_64::boot;
@@ -36,13 +36,13 @@ namespace teachos::arch::memory
{
if (is_initialized.test_and_set())
{
- teachos::panic("[x86_64] Memory management has already been initialized.");
+ system::panic("[x86_64] Memory management has already been initialized.");
}
auto memory_map = multiboot_information_pointer->maybe_memory_map();
if (!memory_map)
{
- teachos::panic("[x86_64] No memory map available.");
+ system::panic("[x86_64] No memory map available.");
}
auto mem_info = create_memory_information();
@@ -63,4 +63,4 @@ namespace teachos::arch::memory
// video::vga::text::newline();
}
-} // namespace teachos::arch::memory
+} // namespace teachos::memory
diff --git a/arch/x86_64/src/system.cpp b/arch/x86_64/src/system.cpp
index 60ebf0e..2d4c3fe 100644
--- a/arch/x86_64/src/system.cpp
+++ b/arch/x86_64/src/system.cpp
@@ -1,6 +1,6 @@
-#include "arch/system.hpp"
+#include "kapi/system.hpp"
-namespace teachos::arch::system
+namespace teachos::system
{
auto halt() -> void
@@ -9,4 +9,4 @@ namespace teachos::arch::system
__builtin_unreachable();
}
-} // namespace teachos::arch::system
+} // namespace teachos::system