Changeset View
Changeset View
Standalone View
Standalone View
sys/amd64/amd64/apic_vector.S
Show First 20 Lines • Show All 75 Lines • ▼ Show 20 Lines | |||||
* I/O Interrupt Entry Point. Rather than having one entry point for | * I/O Interrupt Entry Point. Rather than having one entry point for | ||||
* each interrupt source, we use one entry point for each 32-bit word | * each interrupt source, we use one entry point for each 32-bit word | ||||
* in the ISR. The handler determines the highest bit set in the ISR, | * in the ISR. The handler determines the highest bit set in the ISR, | ||||
* translates that into a vector, and passes the vector to the | * translates that into a vector, and passes the vector to the | ||||
* lapic_handle_intr() function. | * lapic_handle_intr() function. | ||||
*/ | */ | ||||
.macro ISR_VEC index, vec_name | .macro ISR_VEC index, vec_name | ||||
INTR_HANDLER \vec_name | INTR_HANDLER \vec_name | ||||
FAKE_MCOUNT(TF_RIP(%rsp)) | |||||
cmpl $0,x2apic_mode | cmpl $0,x2apic_mode | ||||
je 1f | je 1f | ||||
movl $(MSR_APIC_ISR0 + \index),%ecx | movl $(MSR_APIC_ISR0 + \index),%ecx | ||||
rdmsr | rdmsr | ||||
jmp 2f | jmp 2f | ||||
1: | 1: | ||||
movq lapic_map, %rdx /* pointer to local APIC */ | movq lapic_map, %rdx /* pointer to local APIC */ | ||||
movl LA_ISR + 16 * (\index)(%rdx), %eax /* load ISR */ | movl LA_ISR + 16 * (\index)(%rdx), %eax /* load ISR */ | ||||
2: | 2: | ||||
bsrl %eax, %eax /* index of highest set bit in ISR */ | bsrl %eax, %eax /* index of highest set bit in ISR */ | ||||
jz 3f | jz 3f | ||||
addl $(32 * \index),%eax | addl $(32 * \index),%eax | ||||
movq %rsp, %rsi | movq %rsp, %rsi | ||||
movl %eax, %edi /* pass the IRQ */ | movl %eax, %edi /* pass the IRQ */ | ||||
call lapic_handle_intr | call lapic_handle_intr | ||||
3: | 3: | ||||
MEXITCOUNT | |||||
jmp doreti | jmp doreti | ||||
.endm | .endm | ||||
/* | /* | ||||
* Handle "spurious INTerrupts". | * Handle "spurious INTerrupts". | ||||
* Notes: | * Notes: | ||||
* This is different than the "spurious INTerrupt" generated by an | * This is different than the "spurious INTerrupt" generated by an | ||||
* 8259 PIC for missing INTs. See the APIC documentation for details. | * 8259 PIC for missing INTs. See the APIC documentation for details. | ||||
Show All 12 Lines | IDTVEC(spuriousint) | ||||
ISR_VEC 5, apic_isr5 | ISR_VEC 5, apic_isr5 | ||||
ISR_VEC 6, apic_isr6 | ISR_VEC 6, apic_isr6 | ||||
ISR_VEC 7, apic_isr7 | ISR_VEC 7, apic_isr7 | ||||
/* | /* | ||||
* Local APIC periodic timer handler. | * Local APIC periodic timer handler. | ||||
*/ | */ | ||||
INTR_HANDLER timerint | INTR_HANDLER timerint | ||||
FAKE_MCOUNT(TF_RIP(%rsp)) | |||||
movq %rsp, %rdi | movq %rsp, %rdi | ||||
call lapic_handle_timer | call lapic_handle_timer | ||||
MEXITCOUNT | |||||
jmp doreti | jmp doreti | ||||
/* | /* | ||||
* Local APIC CMCI handler. | * Local APIC CMCI handler. | ||||
*/ | */ | ||||
INTR_HANDLER cmcint | INTR_HANDLER cmcint | ||||
FAKE_MCOUNT(TF_RIP(%rsp)) | |||||
call lapic_handle_cmc | call lapic_handle_cmc | ||||
MEXITCOUNT | |||||
jmp doreti | jmp doreti | ||||
/* | /* | ||||
* Local APIC error interrupt handler. | * Local APIC error interrupt handler. | ||||
*/ | */ | ||||
INTR_HANDLER errorint | INTR_HANDLER errorint | ||||
FAKE_MCOUNT(TF_RIP(%rsp)) | |||||
call lapic_handle_error | call lapic_handle_error | ||||
MEXITCOUNT | |||||
jmp doreti | jmp doreti | ||||
#ifdef XENHVM | #ifdef XENHVM | ||||
/* | /* | ||||
* Xen event channel upcall interrupt handler. | * Xen event channel upcall interrupt handler. | ||||
* Only used when the hypervisor supports direct vector callbacks. | * Only used when the hypervisor supports direct vector callbacks. | ||||
*/ | */ | ||||
INTR_HANDLER xen_intr_upcall | INTR_HANDLER xen_intr_upcall | ||||
FAKE_MCOUNT(TF_RIP(%rsp)) | |||||
movq %rsp, %rdi | movq %rsp, %rdi | ||||
call xen_intr_handle_upcall | call xen_intr_handle_upcall | ||||
MEXITCOUNT | |||||
jmp doreti | jmp doreti | ||||
#endif | #endif | ||||
#ifdef SMP | #ifdef SMP | ||||
/* | /* | ||||
* Global address space TLB shootdown. | * Global address space TLB shootdown. | ||||
*/ | */ | ||||
.text | .text | ||||
SUPERALIGN_TEXT | SUPERALIGN_TEXT | ||||
/* | /* | ||||
* IPI handler for cache and TLB shootdown | * IPI handler for cache and TLB shootdown | ||||
*/ | */ | ||||
INTR_HANDLER invlop | INTR_HANDLER invlop | ||||
call invlop_handler | call invlop_handler | ||||
call as_lapic_eoi | call as_lapic_eoi | ||||
jmp ld_regs | jmp ld_regs | ||||
/* | /* | ||||
* Handler for IPIs sent via the per-cpu IPI bitmap. | * Handler for IPIs sent via the per-cpu IPI bitmap. | ||||
*/ | */ | ||||
INTR_HANDLER ipi_intr_bitmap_handler | INTR_HANDLER ipi_intr_bitmap_handler | ||||
call as_lapic_eoi | call as_lapic_eoi | ||||
FAKE_MCOUNT(TF_RIP(%rsp)) | |||||
call ipi_bitmap_handler | call ipi_bitmap_handler | ||||
MEXITCOUNT | |||||
jmp doreti | jmp doreti | ||||
/* | /* | ||||
* Executed by a CPU when it receives an IPI_STOP from another CPU. | * Executed by a CPU when it receives an IPI_STOP from another CPU. | ||||
*/ | */ | ||||
INTR_HANDLER cpustop | INTR_HANDLER cpustop | ||||
call as_lapic_eoi | call as_lapic_eoi | ||||
call cpustop_handler | call cpustop_handler | ||||
jmp doreti | jmp doreti | ||||
/* | /* | ||||
* Executed by a CPU when it receives an IPI_SUSPEND from another CPU. | * Executed by a CPU when it receives an IPI_SUSPEND from another CPU. | ||||
*/ | */ | ||||
INTR_HANDLER cpususpend | INTR_HANDLER cpususpend | ||||
call cpususpend_handler | call cpususpend_handler | ||||
call as_lapic_eoi | call as_lapic_eoi | ||||
jmp doreti | jmp doreti | ||||
/* | /* | ||||
* Executed by a CPU when it receives an IPI_SWI. | * Executed by a CPU when it receives an IPI_SWI. | ||||
*/ | */ | ||||
INTR_HANDLER ipi_swi | INTR_HANDLER ipi_swi | ||||
call as_lapic_eoi | call as_lapic_eoi | ||||
FAKE_MCOUNT(TF_RIP(%rsp)) | |||||
call ipi_swi_handler | call ipi_swi_handler | ||||
MEXITCOUNT | |||||
jmp doreti | jmp doreti | ||||
/* | /* | ||||
* Executed by a CPU when it receives a RENDEZVOUS IPI from another CPU. | * Executed by a CPU when it receives a RENDEZVOUS IPI from another CPU. | ||||
* | * | ||||
* - Calls the generic rendezvous action function. | * - Calls the generic rendezvous action function. | ||||
*/ | */ | ||||
INTR_HANDLER rendezvous | INTR_HANDLER rendezvous | ||||
▲ Show 20 Lines • Show All 44 Lines • Show Last 20 Lines |