From: acevest Date: Sun, 14 Nov 2021 15:05:04 +0000 (+0800) Subject: task的state字段添加volatile关键字修饰 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/zpipe.c?a=commitdiff_plain;h=0e513aa4322411bb5d233a43ce32b6b7d974f23f;p=kernel.git task的state字段添加volatile关键字修饰 --- diff --git a/include/task.h b/include/task.h index ff6559a..2e698dd 100644 --- a/include/task.h +++ b/include/task.h @@ -55,7 +55,7 @@ typedef union task_union { pid_t pid; pid_t ppid; - unsigned int state; + volatile unsigned int state; long exit_code; unsigned long cr3; diff --git a/kernel/init.c b/kernel/init.c index 073c542..4d0707c 100644 --- a/kernel/init.c +++ b/kernel/init.c @@ -155,6 +155,11 @@ void root_task_entry() { // 所以得先清空一下键盘 inb(0x60); + // 继续内核未完成的初始化 + // 这些初始化在开中断的情况下完成 + void setup_under_irq(); + setup_under_irq(); + kernel_task("init", init_task_entry); kernel_task("test", init_task_entry); kernel_task("user", user_task_entry); diff --git a/kernel/setup.c b/kernel/setup.c index bffaa0f..f951102 100644 --- a/kernel/setup.c +++ b/kernel/setup.c @@ -83,9 +83,6 @@ void setup_kernel() { setup_pci(); - void ide_init(); - ide_init(); - detect_cpu(); printk(version); @@ -97,3 +94,9 @@ void setup_kernel() { setup_fs(); } + +// 在开中断的情况下继续初始化的内容 +void setup_under_irq() { + void ide_init(); + ide_init(); +} \ No newline at end of file