aboutsummaryrefslogtreecommitdiff
path: root/arch/x86_64/src
diff options
context:
space:
mode:
authorFelix Morgner <felix.morgner@ost.ch>2026-01-15 14:36:25 +0100
committerFelix Morgner <felix.morgner@ost.ch>2026-01-15 14:36:25 +0100
commit693cedc76b061810dfc0dc55e3966d6bf849f397 (patch)
tree5aba1768b822b6d4e70207fdd0a1d8eae9ffc262 /arch/x86_64/src
parent42f9eaea885fa0744d2138a773702327e26f6b7b (diff)
downloadteachos-693cedc76b061810dfc0dc55e3966d6bf849f397.tar.xz
teachos-693cedc76b061810dfc0dc55e3966d6bf849f397.zip
x86_64/debug: add support for QEMU debug console
Diffstat (limited to 'arch/x86_64/src')
-rw-r--r--arch/x86_64/src/debug/qemu_output.cpp24
-rw-r--r--arch/x86_64/src/kapi/cio.cpp7
2 files changed, 28 insertions, 3 deletions
diff --git a/arch/x86_64/src/debug/qemu_output.cpp b/arch/x86_64/src/debug/qemu_output.cpp
new file mode 100644
index 0000000..773306f
--- /dev/null
+++ b/arch/x86_64/src/debug/qemu_output.cpp
@@ -0,0 +1,24 @@
+#include "x86_64/debug/qemu_output.hpp"
+
+#include "kapi/cio.hpp"
+
+#include <string_view>
+
+namespace teachos::debug::x86_64
+{
+
+ qemu_output::qemu_output(output_device & lower)
+ : m_lower{lower}
+ {}
+
+ auto qemu_output::write(cio::output_stream stream, std::string_view text) -> void
+ {
+ for (auto c : text)
+ {
+ dbg::write(c);
+ }
+
+ m_lower.write(stream, text);
+ }
+
+} // namespace teachos::debug::x86_64
diff --git a/arch/x86_64/src/kapi/cio.cpp b/arch/x86_64/src/kapi/cio.cpp
index 617146e..5594fcc 100644
--- a/arch/x86_64/src/kapi/cio.cpp
+++ b/arch/x86_64/src/kapi/cio.cpp
@@ -1,5 +1,6 @@
#include "kapi/cio.hpp"
+#include "x86_64/debug/qemu_output.hpp"
#include "x86_64/vga/text.hpp"
#include <optional>
@@ -8,12 +9,12 @@ namespace teachos::cio
{
auto static constinit vga_device = std::optional<vga::x86_64::text::device>{};
+ auto static constinit dbg_device = std::optional<debug::x86_64::qemu_output>{};
auto init() -> void
{
- vga_device.emplace();
- vga_device->cursor(false);
- set_output_device(*vga_device);
+ vga_device.emplace().cursor(false);
+ set_output_device(dbg_device.emplace(*vga_device));
}
} // namespace teachos::cio