diff --git a/hypervisor/arch/x86/idt.S b/hypervisor/arch/x86/idt.S index c6f346b8d..798a94f85 100644 --- a/hypervisor/arch/x86/idt.S +++ b/hypervisor/arch/x86/idt.S @@ -110,9 +110,9 @@ excp_debug: .align 8 excp_nmi: - - - + pushq $0x0 /* pseudo error code */ + pushq $0x2 + jmp nmi_save_frame .align 8 excp_breakpoint: @@ -330,6 +330,19 @@ excp_rsvd: iretq +/* + * Common entry point for NMI interrupts + */ +.align 8 +nmi_save_frame: + save_frame + + call handle_nmi + + restore_frame + + iretq + /* * Common entry point for defined interrupts. diff --git a/hypervisor/arch/x86/irq.c b/hypervisor/arch/x86/irq.c index 6a55418c5..158165d67 100644 --- a/hypervisor/arch/x86/irq.c +++ b/hypervisor/arch/x86/irq.c @@ -382,6 +382,14 @@ void dispatch_exception(struct intr_excp_ctx *ctx) cpu_dead(); } +void handle_nmi(__unused struct intr_excp_ctx *ctx) +{ + /* + * Just ignore the NMI here for now. + * TODO: implement specific NMI handling function. + */ +} + static void init_irq_descs(void) { uint32_t i; diff --git a/hypervisor/include/arch/x86/irq.h b/hypervisor/include/arch/x86/irq.h index 8f8f39679..cb8a7c612 100644 --- a/hypervisor/include/arch/x86/irq.h +++ b/hypervisor/include/arch/x86/irq.h @@ -302,6 +302,15 @@ uint32_t irq_to_vector(uint32_t irq); */ void dispatch_interrupt(const struct intr_excp_ctx *ctx); +/** + * @brief Handle NMI + * + * To handle an NMI + * + * @param ctx Pointer to interrupt exception context + */ +void handle_nmi(__unused struct intr_excp_ctx *ctx); + /** * @brief Initialize interrupt *