handler_##n: ;\
cli; \
PUSH_REGS \
- movl 72(%rsp), %edi ;\
- call handler ;\
+ mov 72(%rsp), %rdi ;\
+ handler ;\
movq $0xB0, %rdi;\
movq $0, %rsi;\
call set_APIC_reg_asm; \
- sti; \
POP_REGS \
addq $8, %rsp;\
+ sti; \
iretq
#define HANDLER_NOERRCODE(n, handler) \
.globl handler_##n ;\
handler_##n: ;\
cli; \
PUSH_REGS \
- call handler ;\
+ handler ;\
movq $0xB0, %rdi;\
movq $0, %rsi;\
call set_APIC_reg_asm; \
sti; \
iretq
-HANDLER_NOERRCODE(0x00, int_div_by_0)
-HANDLER_NOERRCODE(0x01, int_debug)
-HANDLER_NOERRCODE(0x02, int_NMI)
-HANDLER_NOERRCODE(0x03, int_breakpoint)
-HANDLER_NOERRCODE(0x04, int_overflow)
-HANDLER_NOERRCODE(0x05, int_bound_range_exceeded)
-HANDLER_NOERRCODE(0x06, int_invalid_opcode)
-HANDLER_NOERRCODE(0x07, int_device_not_available)
-HANDLER_ERRCODE (0x08, int_double_fault)
-HANDLER_NOERRCODE(0x09, int_coprocessor_segment_overrun)
-HANDLER_ERRCODE (0x0a, int_invalid_TSS)
-HANDLER_ERRCODE (0x0b, int_segment_not_present)
-HANDLER_ERRCODE (0x0c, int_stack_segment_fault)
-HANDLER_ERRCODE (0x0d, int_general_protection_fault)
-.globl handler_0x0e
- handler_0x0e:
- cli
- PUSH_REGS
- movl 72(%rsp), %edi
- movq %cr2, %rsi
- call int_page_fault
- movq $0xB0, %rdi
- movq $0, %rsi
- call set_APIC_reg_asm
- sti
- POP_REGS
- addq $8, %rsp
- iretq
-HANDLER_NOERRCODE(0x0f, int_default)
-HANDLER_NOERRCODE(0x10, int_x87_floating_point_exception)
-HANDLER_ERRCODE (0x11, int_alignment_check)
-HANDLER_NOERRCODE(0x12, int_machine_check)
-HANDLER_NOERRCODE(0x13, int_SIMD_floating_point_exception)
-HANDLER_NOERRCODE(0x14, int_virtualization_exception)
-HANDLER_ERRCODE (0x15, int_control_protection_exception)
-HANDLER_NOERRCODE(0x16, int_default)
-HANDLER_NOERRCODE(0x17, int_default)
-HANDLER_NOERRCODE(0x18, int_default)
-HANDLER_NOERRCODE(0x19, int_default)
-HANDLER_NOERRCODE(0x1a, int_default)
-HANDLER_NOERRCODE(0x1b, int_default)
-HANDLER_NOERRCODE(0x1c, int_hypervisor_injection_exception)
-HANDLER_ERRCODE (0x1d, int_VMM_communication_exception)
-HANDLER_ERRCODE (0x1e, int_security_exception)
-HANDLER_NOERRCODE(0x1f, int_default)
+#define COMMA ,
+
+HANDLER_NOERRCODE(0x00, call int_div_by_0)
+HANDLER_NOERRCODE(0x01, call int_debug)
+HANDLER_NOERRCODE(0x02, call int_NMI)
+HANDLER_NOERRCODE(0x03, call int_breakpoint)
+HANDLER_NOERRCODE(0x04, call int_overflow)
+HANDLER_NOERRCODE(0x05, call int_bound_range_exceeded)
+HANDLER_NOERRCODE(0x06, call int_invalid_opcode)
+HANDLER_NOERRCODE(0x07, call int_device_not_available)
+HANDLER_ERRCODE (0x08, call int_double_fault)
+HANDLER_NOERRCODE(0x09, call int_coprocessor_segment_overrun)
+HANDLER_ERRCODE (0x0a, call int_invalid_TSS)
+HANDLER_ERRCODE (0x0b, call int_segment_not_present)
+HANDLER_ERRCODE (0x0c, call int_stack_segment_fault)
+HANDLER_ERRCODE (0x0d, call int_general_protection_fault)
+HANDLER_ERRCODE (0x0e, movq %cr2 COMMA %rsi; call int_page_fault)
+HANDLER_NOERRCODE(0x0f, call int_default)
+HANDLER_NOERRCODE(0x10, call int_x87_floating_point_exception)
+HANDLER_ERRCODE (0x11, call int_alignment_check)
+HANDLER_NOERRCODE(0x12, call int_machine_check)
+HANDLER_NOERRCODE(0x13, call int_SIMD_floating_point_exception)
+HANDLER_NOERRCODE(0x14, call int_virtualization_exception)
+HANDLER_ERRCODE (0x15, call int_control_protection_exception)
+HANDLER_NOERRCODE(0x16, call int_default)
+HANDLER_NOERRCODE(0x17, call int_default)
+HANDLER_NOERRCODE(0x18, call int_default)
+HANDLER_NOERRCODE(0x19, call int_default)
+HANDLER_NOERRCODE(0x1a, call int_default)
+HANDLER_NOERRCODE(0x1b, call int_default)
+HANDLER_NOERRCODE(0x1c, call int_hypervisor_injection_exception)
+HANDLER_ERRCODE (0x1d, call int_VMM_communication_exception)
+HANDLER_ERRCODE (0x1e, call int_security_exception)
+HANDLER_NOERRCODE(0x1f, call int_default)