From: acevest Date: Sun, 14 Nov 2021 12:16:40 +0000 (+0800) Subject: fix 切换tty光标位置不正确的问题 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/zpipe.c?a=commitdiff_plain;h=4ceb1e5431f6e3f4b53fda9da718afb1bf2c3754;p=kernel.git fix 切换tty光标位置不正确的问题 --- 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