]> Zhao Yanbai Git Server - kernel.git/commitdiff
rename printlxy to ap_printlxy
authoracevest <zhaoyanbai@126.com>
Sun, 9 Aug 2026 09:21:53 +0000 (17:21 +0800)
committeracevest <zhaoyanbai@126.com>
Sun, 9 Aug 2026 09:21:53 +0000 (17:21 +0800)
include/console.h [moved from drivers/console.h with 100% similarity]
include/printk.h
kernel/ap.c
kernel/console.c [moved from drivers/console.c with 100% similarity]
kernel/printk.c

similarity index 100%
rename from drivers/console.h
rename to include/console.h
index 4cbed8355eda7dd86dc2a88820be18b79a3c90b3..458d6acadb7eb90ec68a772972e6bf473be39211 100644 (file)
 
 int printk(const char* fmtstr, ...);
 int printd(const char* fmtstr, ...);
-int printlo(unsigned int line, unsigned int offset, const char* fmtstr, ...);
+int ap_print(unsigned int xpos, unsigned int ypos, const char* fmtstr, ...);
+
+#define ap_printl(line, fmt, args...) ap_print(1, line, fmt, ##args)
+#define ap_printll(line, fmt, args...) ap_print(0, line, fmt, ##args)
+#define ap_printlr(line, fmt, args...) ap_print(40, line, fmt, ##args)
+#define ap_printlxy(line, offset, fmt, args...) ap_print(offset, line, fmt, ##args)
 
-#define printl(line, fmt, args...) printlo(1, line, fmt, ##args)
-#define printll(line, fmt, args...) printlo(0, line, fmt, ##args)
-#define printlr(line, fmt, args...) printlo(40, line, fmt, ##args)
-#define printlxy(line, offset, fmt, args...) printlo(offset, line, fmt, ##args)
 
 // monitor print line
 enum {
index 36b2be1a5620a1ac4c13fac5b94cde4170a45264..36fb6d466ca389334093722816814ec2cad83ecc 100644 (file)
@@ -225,7 +225,7 @@ void ap_kernel_entry() {
     asm("sti;");
 
     const char* title = "KERNEL MONITOR";
-    printlxy(MPL_TITLE, (80 - strlen(title)) / 2, title);
+    ap_printlxy(MPL_TITLE, (80 - strlen(title)) / 2, title);
 
     void system_monitor();
     system_monitor();
@@ -263,19 +263,19 @@ void _system_monitor() {
     //
     extern volatile uint64_t jiffies;
     // extern volatile uint64_t hpet_ticks;  // jiffies 和 hpet_ticks 是同一个东西
-    printlxy(MPL_IRQ, MPO_HPET, "HPET: %lu", jiffies);
+    ap_printlxy(MPL_IRQ, MPO_HPET, "HPET: %lu", jiffies);
 
     //
     extern volatile uint8_t kbd_scan_code;
     extern volatile uint64_t kbd_irq_cnt;
-    printlxy(MPL_IRQ, MPO_KEYBOARD, "KBD: %02x %lu", kbd_scan_code, kbd_irq_cnt);
+    ap_printlxy(MPL_IRQ, MPO_KEYBOARD, "KBD: %02x %lu", kbd_scan_code, kbd_irq_cnt);
 
     //
-    printlxy(MPL_IRQ, MPO_AP_CLOCK, "AP: %lu", ap_lapic_ticks);
+    ap_printlxy(MPL_IRQ, MPO_AP_CLOCK, "AP: %lu", ap_lapic_ticks);
 
     extern disk_request_queue_t disk_request_queue;
     disk_request_queue_t* drq = &disk_request_queue;
-    printlxy(MPL_IRQ, MPO_DISK, "DISK: %lu/%u/%lu", drq->req_count, drq->pending_count, drq->completed_count);
+    ap_printlxy(MPL_IRQ, MPO_DISK, "DISK: %lu/%u/%lu", drq->req_count, drq->pending_count, drq->completed_count);
 
     //
     void print_all_tasks();
@@ -312,7 +312,7 @@ const char* task_state(unsigned int state) {
 void print_all_tasks() {
     extern task_t* monitor_tasks[];
 
-    printl(MPL_TASK_TITLE, "         NAME      STATE TK/PI REASON     SCHED     KEEP");
+    ap_printl(MPL_TASK_TITLE, "         NAME      STATE TK/PI REASON     SCHED     KEEP");
 
     for (int i = 0; i < 10; i++) {
         task_t* p = monitor_tasks[i];
@@ -321,7 +321,7 @@ void print_all_tasks() {
             continue;
         }
 
-        printl(MPL_TASK_0 + p->pid, "%08x %-6s:%u %s %02d/%02u %-10s %-9u %-9u",
+        ap_printl(MPL_TASK_0 + p->pid, "%08x %-6s:%u %s %02d/%02u %-10s %-9u %-9u",
                p,                     //
                p->name,               //
                p->pid,                //
@@ -345,7 +345,7 @@ void ide_stat_print(ide_pci_controller_t* ide_ctrl) {
     int i = atomic_read(&(ide_ctrl->irq_cnt));
     int c = atomic_read(&(ide_ctrl->consumed_cnt));
     int channel = ide_ctrl->channel;
-    printlxy(MPL_IDE0 + channel, MPO_IDE, "IDE%d req %u irq %u consumed %u", channel, r, i, c);
+    ap_printlxy(MPL_IDE0 + channel, MPO_IDE, "IDE%d req %u irq %u consumed %u", channel, r, i, c);
 }
 
 void print_all_ides() {
similarity index 100%
rename from drivers/console.c
rename to kernel/console.c
index 663bbfa6e088db90c70b0ed2a9eb3feb050b845b..c227225a61a46023ee22f6ac3ceac448d596ea59 100644 (file)
@@ -86,7 +86,7 @@ int printd(const char* fmtstr, ...) {
 }
 
 extern tty_t* const monitor_tty;
-int printlo(unsigned int xpos, unsigned int ypos, const char* fmtstr, ...) {
+int ap_print(unsigned int xpos, unsigned int ypos, const char* fmtstr, ...) {
     static char plobuf[1024];
 
     va_list args;