aboutsummaryrefslogtreecommitdiff
path: root/arch/x86_64/include
diff options
context:
space:
mode:
authorFelix Morgner <felix.morgner@ost.ch>2026-01-15 15:46:54 +0100
committerFelix Morgner <felix.morgner@ost.ch>2026-01-15 15:46:54 +0100
commit1799e1ba1b825eda639141b0597a1783576b69da (patch)
treeb63fef64c38eea6667ceae97bce809a6639e2fcb /arch/x86_64/include
parent213274bdd6ea6267143594b71fbfd6a38eba350b (diff)
downloadteachos-1799e1ba1b825eda639141b0597a1783576b69da.tar.xz
teachos-1799e1ba1b825eda639141b0597a1783576b69da.zip
x86_64/debug: implement debug port detection
Diffstat (limited to 'arch/x86_64/include')
-rw-r--r--arch/x86_64/include/x86_64/debug/qemu_output.hpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/arch/x86_64/include/x86_64/debug/qemu_output.hpp b/arch/x86_64/include/x86_64/debug/qemu_output.hpp
index 6ff4da6..61b47d6 100644
--- a/arch/x86_64/include/x86_64/debug/qemu_output.hpp
+++ b/arch/x86_64/include/x86_64/debug/qemu_output.hpp
@@ -15,13 +15,13 @@ namespace teachos::debug::x86_64
//! This device implements output to the port 0xE9 debug console present in QEMU in Bochs. It is designed to wrap a
//! different output device (e.g. a VGA text output device) and forwards the written data accordingly.
//!
- //! @note Support for the device has to be enabled when the emulator is started. Since there is no reliable way to
- //! detect the presence of the port, writes will still happen even if the device is not enabled in the emulator. It is
- //! thus possible that the output is simply lost.
+ //! @note Support for the device has to be enabled when the emulator is started. The device will try to detect if the
+ //! port is available. If the port is detected, any output to the device will be written to port before being
+ //! forwarded to the lower device.
struct qemu_output : cio::output_device
{
//! The port to write to.
- using dbg = io::x86_64::port<0xE9, char, io::x86_64::port_write>;
+ using port = io::x86_64::port<0xE9, unsigned char, io::x86_64::port_write, io::x86_64::port_read>;
//! Construct a new debug device wrapper for the given output device.
//!
@@ -34,6 +34,8 @@ namespace teachos::debug::x86_64
private:
//! The device to forward the output to.
output_device & m_lower;
+ //! Whether the device has been detected.
+ bool m_present;
};
} // namespace teachos::debug::x86_64