From 1767d390fbf3d0c65389de46caf0b6d43ef3b6ad Mon Sep 17 00:00:00 2001 From: Richard Qin Date: Fri, 10 Jul 2026 11:24:56 +0800 Subject: feat: establish bootable new architecture checkpoint Replace the compressed boot path with a relocatable higher-half RISC-V entry, expand memory and SMP support, and add the driver, TTY, VFS, exec, signal, syscall, initramfs, and self-test infrastructure needed for a bootable kernel checkpoint. --- na/lib/klog.cc | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'na/lib/klog.cc') diff --git a/na/lib/klog.cc b/na/lib/klog.cc index bf081de..86c67f8 100644 --- a/na/lib/klog.cc +++ b/na/lib/klog.cc @@ -166,9 +166,7 @@ static void ring_drop_oldest(uint32 needed) static void console_emit(const char* s, int len) { - for (int i = 0; i < len; ++i) { - early_putc(s[i]); - } + console_write_all(s, len); } static int klog_format_line(char* out, int out_size, @@ -329,12 +327,20 @@ static void klog_vex(KlogLevel level, KlogSubsys subsys, ring_write_bytes(msg, hdr.len); if (do_console) { g_klog.console_tail = g_klog.head; + /* Emit to UART while holding the lock to prevent + * interleaved output from concurrent CPUs. */ + char line[KLOG_LINE_MAX + 64]; + int line_len = klog_format_line(line, sizeof(line), + hdr, msg, hdr.len); + if (line_len > 0) { + console_emit(line, line_len); + } } - } - - if (do_console) { + } else if (do_console) { + /* Pre-init or panic mode: emit without lock */ char line[KLOG_LINE_MAX + 64]; - int line_len = klog_format_line(line, sizeof(line), hdr, msg, hdr.len); + int line_len = klog_format_line(line, sizeof(line), + hdr, msg, hdr.len); if (line_len > 0) { console_emit(line, line_len); } -- cgit v1.2.3