Repos / kernel.git / commitdiff
summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 295b977)
raw | patch | inline | side by side (parent: 295b977)
| author | zhaoyanbai <zhaoyanbai@126.com> | |
| Sun, 9 Aug 2026 09:21:53 +0000 (17:21 +0800) | ||
| committer | zhaoyanbai <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] | patch | blob | history |
| include/printk.h | patch | blob | history | |
| kernel/ap.c | patch | blob | history | |
| kernel/console.c | [moved from drivers/console.c with 100% similarity] | patch | blob | history |
| kernel/printk.c | patch | blob | history |
diff --git a/drivers/console.h b/include/console.h
diff --git a/include/printk.h b/include/printk.h
--- a/include/printk.h
+++ b/include/printk.h
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 {
diff --git a/kernel/ap.c b/kernel/ap.c
--- a/kernel/ap.c
+++ b/kernel/ap.c
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();
//
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();
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];
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, //
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() {
diff --git a/drivers/console.c b/kernel/console.c
diff --git a/kernel/printk.c b/kernel/printk.c
--- a/kernel/printk.c
+++ b/kernel/printk.c
}
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;