支持多核启动并初始化AP核的Local APIC

This commit is contained in:
fslongjin
2022-04-04 22:54:36 +08:00
parent 2d1965fa2d
commit d9c7ddec66
4 changed files with 39 additions and 6 deletions

View File

@ -381,6 +381,7 @@ switch_seg:
.quad entry64
.global entry64
entry64:
movq $0x10, %rax
@ -391,6 +392,12 @@ entry64:
movq _stack_start(%rip), %rsp //rsp
// apu
movq $0x1b, %rcx // IA32_APIC_BASE.BSP[8]apu
rdmsr
bt $8, %rax
jnc start_smp
setup_IDT:
leaq m_ignore_int(%rip), %rdx // ignore_int8B
movq $(0x08 << 16), %rax // IDT0x100000TI=0,RPL=0
@ -469,6 +476,16 @@ SetUp_TSS64:
go_to_kernel:
.quad Start_Kernel
start_smp:
movq go_to_smp_kernel(%rip), %rax /* movq address */
pushq $0x08
pushq %rax
lretq
go_to_smp_kernel:
.quad smp_ap_start
// ==== / ignore int
m_ignore_int:
// cignore_int
@ -597,7 +614,3 @@ IDT_BASE: .quad IDT_Table
TSS64_Table:
.fill 13, 8, 0
TSS64_END:
TSS64_POINTER:
TSS64_LIMIT: .word TSS64_END - TSS64_Table - 1
TSS64_BASE: .quad TSS64_Table