Rename handle_nmi to handle_02 to be more consistent with other handlers.
Actually register handle_02.
Don't panic in nmi handler - just log by default.
Set the disable nmi bit when accessing the cmos index register.
static inline u8
inb_cmos(u8 reg)
{
+ reg |= NMI_DISABLE_BIT;
outb(reg, PORT_CMOS_INDEX);
return inb(PORT_CMOS_DATA);
}
static inline void
outb_cmos(u8 val, u8 reg)
{
+ reg |= NMI_DISABLE_BIT;
outb(reg, PORT_CMOS_INDEX);
outb(val, PORT_CMOS_DATA);
}
// Debugging levels. If non-zero and CONFIG_DEBUG_LEVEL is greater
// than the specified value, then the corresponding irq handler will
// report every enter event.
-#define DEBUG_ISR_nmi 1
+#define DEBUG_ISR_02 1
#define DEBUG_HDL_05 1
#define DEBUG_ISR_08 20
#define DEBUG_ISR_09 9
// PORT_A20 bitdefs
#define A20_ENABLE_BIT 0x02
+// PORT_CMOS_INDEX nmi disable bit
+#define NMI_DISABLE_BIT 0x80
+
#ifndef __ASSEMBLY__
#include "types.h" // u8
// dont do anything, since the VGA BIOS handles int10h requests
}
+// NMI handler
void VISIBLE16
-handle_nmi()
+handle_02()
{
- debug_isr(DEBUG_ISR_nmi);
- panic("NMI Handler called\n");
+ debug_isr(DEBUG_ISR_02);
}
void
set_irq(i, entry_hwpic2);
// Initialize software handlers.
+ set_irq(0x02, entry_02);
set_irq(0x10, entry_10);
set_irq(0x11, entry_11_official);
set_irq(0x12, entry_12_official);
cld
// Check for restart indicator.
- movl $CMOS_RESET_CODE, %eax
+ movl $CMOS_RESET_CODE|NMI_DISABLE_BIT, %eax
outb %al, $PORT_CMOS_INDEX
inb $PORT_CMOS_DATA, %al
cmpb $0x0, %al
movl %eax, %ebx
// Clear shutdown status register.
- movl $CMOS_RESET_CODE, %eax
+ movl $CMOS_RESET_CODE|NMI_DISABLE_BIT, %eax
outb %al, $PORT_CMOS_INDEX
xorl %eax, %eax
outb %al, $PORT_CMOS_DATA
lidtw %cs:pmode_IDT_info
lgdtw %cs:rombios32_gdt_48
+ // Disable nmi
+ movl $CMOS_RESET_CODE|NMI_DISABLE_BIT, %eax
+ outb %al, $PORT_CMOS_INDEX
+ inb $PORT_CMOS_DATA, %al
+
// Enable protected mode
movl %cr0, %eax
orl $CR0_PE, %eax
jmp entry_post
ORG 0xe2c3
- IRQ_ENTRY nmi
+ IRQ_ENTRY 02
ORG 0xe3fe
.global entry_13_official