summaryrefslogtreecommitdiff
path: root/kernel/common/log.c
diff options
context:
space:
mode:
authorNathan Lee <me@nwlee.tech>2026-09-20 21:12:49 -0500
committerNathan Lee <me@nwlee.tech>2026-09-20 21:12:49 -0500
commit50e526d72f1fd9cb895d743a1353b54505b48025 (patch)
tree3442b2bd7b3b6ba6db3d972f89cf575ce1201278 /kernel/common/log.c
parent09be8ace254a7f8bb69542d09a6b2013636123a2 (diff)
add x86 supportHEADmaster
Diffstat (limited to 'kernel/common/log.c')
-rw-r--r--kernel/common/log.c10
1 files changed, 10 insertions, 0 deletions
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 <sys/stddef.h>
#include <sys/log.h>
+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";