fix(console): route background daemon startup logs to dmesg to keep interactive terminal pristine
This commit is contained in:
@@ -240,7 +240,16 @@ pub extern "C" fn kernel_syscall_dispatcher(regs: &mut SyscallRegisters) {
|
||||
if !msg_ptr.is_null() && len > 0 && len < 4096 {
|
||||
let slice = unsafe { core::slice::from_raw_parts(msg_ptr, len) };
|
||||
if let Ok(s) = core::str::from_utf8(slice) {
|
||||
SerialPort.write_str(s);
|
||||
let is_daemon = unsafe {
|
||||
let sched = &*core::ptr::addr_of!(SCHEDULER);
|
||||
let name = sched.threads[sched.current_tid].name;
|
||||
name.starts_with("gui") || name.starts_with("proc") || name.starts_with("init")
|
||||
};
|
||||
if is_daemon {
|
||||
crate::drivers::dmesg::append_log(slice);
|
||||
} else {
|
||||
SerialPort.write_str(s);
|
||||
}
|
||||
regs.rax = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
+3
-1
@@ -603,10 +603,12 @@ static void handle_command(char *cmd) {
|
||||
}
|
||||
|
||||
extern "C" void _start() {
|
||||
for (int i = 0; i < 6; i++) {
|
||||
// Yield until initial boot modules finish their startup messages
|
||||
for (int i = 0; i < 15; i++) {
|
||||
sys_yield();
|
||||
}
|
||||
|
||||
// Clean screen after all boot logs are finished
|
||||
sys_log_debug("\033[2J\033[H", 7);
|
||||
print_fastfetch();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user