]> Zhao Yanbai Git Server - kernel.git/commitdiff
修复AP在调用print相关逻辑时误修改了BSP用到的preempt_count变量导致不能正常切换进程的问题
authoracevest <zhaoyanbai@126.com>
Mon, 26 Jan 2026 07:59:29 +0000 (15:59 +0800)
committeracevest <zhaoyanbai@126.com>
Mon, 26 Jan 2026 07:59:29 +0000 (15:59 +0800)
kernel/printk.c

index 635820d148949c438a376d577742f8e1898da543..8966a61b9621c0ea18db664f46e3054c1569a6fc 100644 (file)
@@ -55,11 +55,15 @@ extern tty_t* const monitor_tty;
 int printlo(unsigned int xpos, unsigned int ypos, const char* fmtstr, ...) {
     static char plobuf[1024];
     char* args = (char*)(((char*)&fmtstr) + 4);
-    ENTER_CRITICAL_ZONE(EFLAGS);
+
+    unsigned long eflags;
+    irq_save(eflags);
+
     int size = vsprintf(plobuf, fmtstr, args);
 
     tty_write_at(monitor_tty, xpos, ypos, plobuf, (size_t)size);
 
-    LEAVE_CRITICAL_ZONE(EFLAGS);
+    irq_restore(eflags);
+
     return 0;
 }