🐛 解决了ap处理器无法处理异常的bug(原因是设置错了TSS表)

This commit is contained in:
fslongjin
2022-04-06 18:36:56 +08:00
parent b7df2805ed
commit cc39911d4d
8 changed files with 56 additions and 96 deletions

View File

@ -63,32 +63,28 @@ _apu_code32:
mov %ax, %ss
mov %ax, %fs
mov %ax, %gs
//
leal (_apu_boot_tmp_stack_end - _apu_boot_base)(%esi), %eax
movl %eax, %esp
// 1. PAE
mov %cr4, %eax
or $(1<<5), %eax
mov %eax, %cr4
/*
movl $enter_head_from_ap_boot, %eax
jmpl *%eax
hlt
//
leal (_apu_boot_tmp_stack_end - _apu_boot_base)(%esi), %eax
movl %eax, %esp
*/
// open PAE
movl %cr4, %eax
bts $5, %eax
movl %eax, %cr4
//
movl $pml4, %eax // bsp32
movl %eax, %cr3
// enable long mode
movl $0xC0000080, %ecx
rdmsr
@ -97,8 +93,8 @@ _apu_code32:
// enable PE and paging
mov %cr0, %eax
or $(1<<31), %eax
or $(1<<0), %eax
bts $0, %eax
bts $31, %eax
mov %eax, %cr0
// 64
@ -115,6 +111,7 @@ _apu_code64:
movq %rax, %fs
movq %rax, %gs
//now enable SSE and the like
movq %cr0, %rax
and $0xFFFB, %ax //clear coprocessor emulation CR0.EM