From 50e526d72f1fd9cb895d743a1353b54505b48025 Mon Sep 17 00:00:00 2001 From: Nathan Lee Date: Sun, 20 Sep 2026 21:12:49 -0500 Subject: add x86 support --- kernel/common/log.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'kernel/common') diff --git a/kernel/common/log.c b/kernel/common/log.c index f65c165..5f470f1 100644 --- a/kernel/common/log.c +++ b/kernel/common/log.c @@ -1,15 +1,21 @@ #include #include +void stub(char c) { + (void)c; +} + __attribute__((section(".ringbuf"), aligned(64))) volatile char log_ring[RINGBUF_SIZE]; static int pos = 0; +static console_callback_t console_callback = stub; void put_char(char c) { log_ring[pos++] = c; if (pos >= RINGBUF_SIZE) pos = 0; + console_callback(c); } void put_string(const char *s) { @@ -17,6 +23,10 @@ void put_string(const char *s) { put_char(*s++); } +void register_console_callback(console_callback_t callback) { + console_callback = callback; +} + void put_uint(unsigned int value, unsigned int radix) { char tmp[16]; const char digits[] = "0123456789abcdef"; -- cgit v1.2.3