能进入用户态程序,但无法正确进行系统调用

This commit is contained in:
fslongjin
2022-04-10 23:53:07 +08:00
parent d78db8225c
commit c09c6d4e66
6 changed files with 19 additions and 10 deletions

View File

@ -31,7 +31,7 @@ void smp_init()
//*(uchar *)0x20000 = 0xf4; // 在内存的0x20000处写入HLT指令(AP处理器会执行物理地址0x20000的代码)
// 将引导程序复制到物理地址0x20000处
memcpy((unsigned char *)phys_2_virt(0x20000), _apu_boot_start, (unsigned long)&_apu_boot_end - (unsigned long)&_apu_boot_start);
// 设置多核IPI中断门
for (int i = 200; i < 210; ++i)
set_intr_gate(i, 2, SMP_interrupt_table[i - 200]);
@ -73,7 +73,7 @@ void smp_init()
// 由于ap处理器初始化过程需要用到0x00处的地址因此初始化完毕后才取消内存地址的重映射
//todo: 取消低0-2M的地址映射
for (int i = 1; i < 128; ++i)
for (int i = 0; i < 128; ++i)
{
*(ul *)(phys_2_virt(global_CR3) + i) = 0UL;
@ -112,7 +112,7 @@ void smp_ap_start()
sti();
kdebug("IDT_addr = %#018lx", phys_2_virt(IDT_Table));
memset(current_pcb, 0, sizeof(struct process_control_block));
spin_unlock(&multi_core_starting_lock);
while (1) // 这里要循环hlt原因是当收到中断后核心会被唤醒处理完中断之后不会自动hlt
hlt();