From 8d1e5ffe355b0e0bbb60fa88d306304a1746bc8c Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Sun, 7 Jul 2024 21:56:41 -0400 Subject: kernel/amd64: Add serial debug logging Signed-off-by: Ian Moffett --- sys/kern/init_main.c | 3 +++ sys/kern/kern_syslog.c | 9 +++++++++ 2 files changed, 12 insertions(+) (limited to 'sys/kern') diff --git a/sys/kern/init_main.c b/sys/kern/init_main.c index 02e8705..71763b3 100644 --- a/sys/kern/init_main.c +++ b/sys/kern/init_main.c @@ -60,6 +60,9 @@ start_init(void) int main(void) { + /* Setup serial driver */ + serial_init(); + /* Startup the console */ cons_init(); kprintf("Starting Hyra/%s v%s: %s\n", HYRA_ARCH, HYRA_VERSION, diff --git a/sys/kern/kern_syslog.c b/sys/kern/kern_syslog.c index 6962a69..7f66db0 100644 --- a/sys/kern/kern_syslog.c +++ b/sys/kern/kern_syslog.c @@ -34,6 +34,12 @@ #include #include +#if defined(__SERIAL_DEBUG) +#define SERIAL_DEBUG __SERIAL_DEBUG +#else +#define SERIAL_DEBUG 0 +#endif + /* Global logger lock */ static struct spinlock lock = {0}; @@ -44,6 +50,9 @@ syslog_write(const char *s, size_t len) while (len--) { cons_putch(&g_root_scr, *p); + if (SERIAL_DEBUG) { + serial_putc(*p); + } ++p; } } -- cgit v1.2.3