System BIOS Programming Guidelines
|
| ; | ||
; InitLocalAPIC( ) |
| ; | ||
|
| ; | ||
; |
|
|
| ; |
; | Initialize the local APIC to virtual wire mode. | ; | ||
; |
|
|
| ; |
|
| ; | ||
SVR |
| equ | 0FEE000F0H |
|
LVT1 |
| equ | 0FEE00350H |
|
LVT2 |
| equ | 0FEE00360H |
|
APIC_ENABLED | equ | 000000100H |
| |
| public | InitLocalAPIC |
| |
InitLocalAPIC | proc | near |
| |
| push | ds | ; save regs used for APIC init |
|
| push | es |
|
|
| push | esi |
|
|
| mov | al,080h | ; ensure NMI disabled |
|
| out | 070h,al |
|
|
| in | al,021h | ; read primary imr |
|
| push | ax | ; save settings |
|
| mov | al,0ffh | ; mask all off |
|
| out | 021h,al |
|
|
| in | al,0a1h | ; read secondary imr |
|
| push | ax | ; save settings |
|
| mov | al,0ffh | ; mask all off |
|
| out | 0a1h,al |
|
|
| extrn | pmode_on : near |
| |
| call | pmode_on | ; switch into real big mode |
|
;
;The APIC spurious interrupt must point to a vector whose lower
;nibble is 0F, that is 0xF, where x is 0 - F. Here we use Int 00FH,
;which handles spurious interrupts and supplies the necessary IRET.
;This vector is assumed to have already been initialized in memory.
;Enable the APIC via SVR and set the spurious interrupt to use Int 00F
mov esi,SVR
mov | eax,[esi] | ; read SVR | ||
and | eax,0FFFFFF0FH | ; clear | spurious vector (use vector | |
|
|
| 00FH) |
|
or | eax,APIC_ENABLED | ; | bit 8 | = 1 |
mov | [esi],eax | ; | write | SVR |
;
;Program LVT1 as ExtInt, which delivers the signal to the INTR signal of all
;processors' cores listed in the destination as an interrupt that originated
;in an
;
Example A-1. Programming Local APIC for Virtual Wire Mode
Version 1.4 |