Files
x86-bare-metal-examples/idt_zero_divide.S
2018-12-04 09:46:27 +00:00

26 lines
511 B
ArmAsm

/* https://github.com/cirosantilli/x86-bare-metal-examples#idt-divide-by-zero */
#include "common.h"
BEGIN
STAGE2
CLEAR
PROTECTED_MODE
IDT_SETUP_ENTRY $0, $handler
lidt idt_descriptor
mov $0, %edx
mov $1, %eax
mov $0, %ecx
/* The iret jumps back here. */
div %ecx
jmp .
IDT_START
IDT_ENTRY
IDT_END
handler:
VGA_PRINT_STRING $message
/* If we don't do this, we get an infinite loop. */
mov $1, %ecx
iret
message:
.asciz "division by zero handled"