41,7 → 41,8 |
IOAPIC_ARB equ 0x2 |
IOAPIC_REDTBL equ 0x10 |
|
IPI_INIT equ (0x6 shl 8) |
IPI_INIT equ (0x5 shl 8) |
IPI_START equ (0x6 shl 8) |
IPI_LEVEL_ASSERT equ (0x1 shl 14) |
SHORTHAND_ALL_EXCL equ (0x3 shl 18) |
|
129,15 → 130,9 |
;=========================================================== |
align 4 |
LAPIC_init: |
; Check MSR support |
;.... |
; Get LAPIC base address |
;mov ecx, 0x1b |
;rdmsr ; it may be replaced to |
;and ax, 0xf000 ; mov eax, 0xfee00000 |
|
mov [acpi_lapic_base], 0xfee00000 |
; xchg bx, bx |
cmp [LAPIC_BASE], 0 |
jne .done |
|
stdcall map_io_mem, [acpi_lapic_base], 0x1000, PG_SW |
mov [LAPIC_BASE], eax |
211,32 → 206,8 |
; Start (every 0.01 sec) |
; mov dword[esi + APIC_LVT_timer], 0x30020; periodic int 0x20 |
; mov dword[esi + APIC_timer_init], eax |
xchg bx, bx |
|
; mov al, 0x0F |
; out 0x70, al |
; mov al, 0x0A |
; out 0x71, al |
|
; mov [OS_BASE+0x469], word (__ap_start_16) shr 4 |
; mov [OS_BASE+0x469], word 0 |
|
mov [esi+APIC_ICRH], dword 0 |
mov [esi+APIC_ICRL], dword 0xc4500 |
|
mov ecx, 1000 |
@@: |
loop @B |
|
mov [esi+APIC_ICRH], dword 0 |
mov [esi+APIC_ICRL], dword 0xC4600+((0x10000+__ap_start_16) shr 12) |
; mov [esi+APIC_ICRL], dword 0xC4612 |
|
; mov [esi+APIC_ICRH], dword 0 |
; mov [esi+APIC_ICRL], dword CMD_IPI_INIT+IPI_LEVEL_ASSERT+16 |
|
|
|
.done: |
ret |
|
;=========================================================== |
448,7 → 419,35 |
pop ebp |
ret |
|
align 4 |
start_ap: |
;eax= cpu id |
|
; xchg bx, bx |
|
test eax, eax ;do not start self |
jz .exit |
|
cmp eax, [cpu_count] |
ja .exit |
|
mov eax, [smpt+eax*4] |
shl eax, 24 |
|
mov [esi+APIC_ICRH], eax |
mov [esi+APIC_ICRL], dword (IPI_INIT+IPI_LEVEL_ASSERT) |
|
mov ecx, 10000 |
@@: |
loop @B |
|
CMD_IPI_START equ (IPI_START+IPI_LEVEL_ASSERT)+((0x10000+__ap_start_16) shr 12) |
|
mov [esi+APIC_ICRH], eax |
mov [esi+APIC_ICRL], dword CMD_IPI_START |
.exit: |
ret |
|
|
|
|