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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user