pl: add debug_read

This commit is contained in:
Loïc Grégoire
2026-06-27 16:29:55 -04:00
parent c10f5a6984
commit 020a6c7d60
2 changed files with 12 additions and 0 deletions
+7
View File
@@ -102,6 +102,13 @@ pub fn debug_write(c: u8) void {
com1_write(c);
}
pub fn debug_read() u8 {
while ((amd64.inb(com1 + 0x5) & 0x01) == 0) {
std.atomic.spinLoopHint();
}
return amd64.inb(com1);
}
pub fn arm_timer(deadline: r.Nanoseconds) void {
apic.arm_timer(deadline);
}
+5
View File
@@ -27,6 +27,11 @@ pub inline fn debug_write(c: u8) void {
return impl.debug_write(c);
}
/// Read a single character from the debug console.
pub inline fn debug_read() u8 {
return impl.debug_read();
}
/// Arm a one-shot timer to fire in `ns` nanoseconds.
pub inline fn arm_timer(ns: u64) void {
return impl.arm_timer(ns);