From 4ceb1e5431f6e3f4b53fda9da718afb1bf2c3754 Mon Sep 17 00:00:00 2001 From: acevest Date: Sun, 14 Nov 2021 20:16:40 +0800 Subject: [PATCH] =?utf8?q?fix=20=E5=88=87=E6=8D=A2tty=E5=85=89=E6=A0=87?= =?utf8?q?=E4=BD=8D=E7=BD=AE=E4=B8=8D=E6=AD=A3=E7=A1=AE=E7=9A=84=E9=97=AE?= =?utf8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- drivers/pci.c | 1 - include/printk.h | 1 - kernel/setup.c | 28 +++++++--------------------- kernel/system.c | 12 ------------ kernel/tty.c | 2 ++ 5 files changed, 9 insertions(+), 35 deletions(-) diff --git a/drivers/pci.c b/drivers/pci.c index e1cd00a..156f5a0 100644 --- a/drivers/pci.c +++ b/drivers/pci.c @@ -226,7 +226,6 @@ void setup_pci() { } dump_pci_dev(); - asm("cli;hlt;"); } typedef struct pci_info { diff --git a/include/printk.h b/include/printk.h index 551bf05..bc04ce6 100644 --- a/include/printk.h +++ b/include/printk.h @@ -16,7 +16,6 @@ #pragma once -void switch_printk_screen(); int printk(const char *fmtstr, ...); int printd(const char *fmtstr, ...); int printlo(unsigned int line, unsigned int offset, const char *fmtstr, ...); diff --git a/kernel/setup.c b/kernel/setup.c index f8e6413..df344dd 100644 --- a/kernel/setup.c +++ b/kernel/setup.c @@ -77,8 +77,6 @@ void setup_kernel() { printl(MPL_TITLE, " SYSTEM MONITOR"); printl(MPL_ROOTDEV, "root device %08x", system.root_dev); - system_delay(); - // setup_tasks(); setup_irqs(); @@ -87,29 +85,17 @@ void setup_kernel() { void ide_init(); ide_init(); - while (1) { - asm("sti;hlt;"); - } - extern tty_t monitor_tty; - // tty_switch(&monitor_tty); - // asm("sti"); - // while (1) { /* code */ - // } - - return; - // switch_printk_screen(); + detect_cpu(); - // switch_printk_screen(); - system_delay(); + printk(version); - system_delay(); + extern tty_t monitor_tty; + tty_switch(&monitor_tty); - detect_cpu(); + while (1) { + asm("sti;hlt;"); + } setup_fs(); - - printk(version); - - // switch_printk_screen(); } diff --git a/kernel/system.c b/kernel/system.c index 6d6a5c4..72bfa16 100644 --- a/kernel/system.c +++ b/kernel/system.c @@ -181,15 +181,3 @@ int sysc_reboot(int mode) { return 0; } - -void system_delay() { - unsigned long flags; - irq_save(flags); - unsigned int n = system.delay; - while (n--) { - unsigned long cr0; - asm("movl %%cr0, %%eax;" : "=a"(cr0)); - asm("movl %%eax, %%cr0;" ::"a"(cr0)); - } - irq_restore(flags); -} diff --git a/kernel/tty.c b/kernel/tty.c index 200f771..0a6b5b3 100644 --- a/kernel/tty.c +++ b/kernel/tty.c @@ -236,6 +236,8 @@ void tty_switch(tty_t *tty) { irq_restore(flags); current_tty = tty; + + tty_set_cursor(current_tty); } tty_t *current_tty; \ No newline at end of file -- 2.44.0