Skip to content

Commit

Permalink
arch,traps: handle APIC spurious interrupt
Browse files Browse the repository at this point in the history
Add dummy spurious interrupt handler.

Signed-off-by: Pawel Wieczorkiewicz <[email protected]>
  • Loading branch information
wipawel committed Nov 7, 2023
1 parent 6f9a740 commit 2c37feb
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion arch/x86/apic.c
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ void init_apic(unsigned int cpu_id, apic_mode_t mode) {
vmap_4k(apic_get_base(apic_base), apic_base.base, L1_PROT_NOCACHE);

spiv.reg = apic_read(APIC_SPIV);
spiv.vector = 0xFF;
spiv.vector = APIC_SPI_VECTOR;
spiv.apic_enable = 1;
apic_write(APIC_SPIV, spiv.reg);
}
Expand Down
4 changes: 4 additions & 0 deletions arch/x86/entry.S
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,10 @@ ENTRY(asm_interrupt_handler_\sym)
END_FUNC(asm_interrupt_handler_\sym)
.endm

ENTRY(asm_interrupt_handler_dummy)
IRET
END_FUNC(asm_interrupt_handler_dummy)

ENTRY(handle_exception)
SAVE_ALL_REGS

Expand Down
3 changes: 3 additions & 0 deletions arch/x86/traps.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ extern void asm_interrupt_handler_uart1(void);
extern void asm_interrupt_handler_uart2(void);
extern void asm_interrupt_handler_keyboard(void);
extern void asm_interrupt_handler_timer(void);
extern void asm_interrupt_handler_dummy(void);

extern void terminate_user_task(void);

Expand Down Expand Up @@ -165,6 +166,8 @@ void init_traps(const cpu_t *cpu) {
_ul(asm_interrupt_handler_keyboard), GATE_DPL0, GATE_PRESENT, 0);
set_intr_gate(&percpu->idt[APIC_TIMER_IRQ], __KERN_CS,
_ul(asm_interrupt_handler_timer), GATE_DPL0, GATE_PRESENT, 0);
set_intr_gate(&percpu->idt[APIC_SPI_VECTOR], __KERN_CS,
_ul(asm_interrupt_handler_dummy), GATE_DPL0, GATE_PRESENT, 0);

barrier();
lidt(&percpu->idt_ptr);
Expand Down
2 changes: 2 additions & 0 deletions include/arch/x86/traps.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@
#define KB_PORT2_IRQ KEYBOARD_PORT2_IRQ_VECTOR
#define APIC_TIMER_IRQ APIC_TIMER_IRQ_VECTOR

#define APIC_SPI_VECTOR 0xFF

extern void init_traps(const cpu_t *cpu);
extern void init_boot_traps(void);
extern void init_rmode_traps(void);
Expand Down

0 comments on commit 2c37feb

Please sign in to comment.