I have a problem about BSP broadcast SIPI(Startup IPI).
In pure64 project's source code(init_smp.asm):
Code: Select all
mov rsi, 0x0000000000005100 ; All Local APIC ID is stored
xor ecx, ecx
mov cx, [cpu_detected] ; Logical CPU number
smp_send_SIPI:
cmp cx, 0
je smp_send_SIPI_done
lodsb
; BSP APIC ID in DL
cmp al, dl ; Is it the BSP?
je smp_send_SIPI_skipcore
; Broadcast 'Startup' IPI to destination using vector 0x08 to specify entry-point is at the memory-address 0x00008000
mov rdi, [os_LocalAPICAddress]
shl eax, 24 ; eax : AP's Local APIC ID
mov dword [rdi+0x310], eax ; Interrupt Command Register (ICR); bits 63-32
mov eax, 0x00004608 ; Vector 0x08
mov dword [rdi+0x300], eax ; Interrupt Command Register (ICR); bits 31-0
smp_send_SIPI_verify:
mov eax, [rdi+0x300] ; Interrupt Command Register (ICR); bits 31-0
bt eax, 12 ; Verify that the command completed
jc smp_send_SIPI_verify
smp_send_SIPI_skipcore:
dec cl
jmp smp_send_SIPI
smp_send_SIPI_done:
Adress 0x8000 is the entry of AP code . The vector 0x08 is set to the DF exception when initialized, it's interrupt handler only outputs some strings and hang.
Why the vectors 0x08 used in the ICR(interrupt comand register) can jump to the address of 0x8000?
My english is not very good , but i am working on it .
Thanks in advance!