feat(isr): use macro to create isr wrappers

Signed-off-by: Julien CLEMENT <julien.clement@epita.fr>
This commit is contained in:
Julien CLEMENT 2021-07-18 00:08:00 +02:00
parent b52f4fde48
commit 51107d84c8

145
k/isr.S

@ -3,127 +3,44 @@
isr: isr:
pushal pushal
pushl %esp pushl %esp
add $32, (%esp) addl $32, (%esp)
call interrupt_handler call interrupt_handler
add $4, %esp add $4, %esp
popal popal
add $8, %esp add $8, %esp
iret iret
.global isr_divide #define isr_callback_error(NAME, VECTOR)\
isr_divide: .global NAME; \
pushl $0 // error code padding NAME: \
pushl $0 // int vector pushl $VECTOR; \
jmp isr jmp isr
.global isr_debug #define isr_callback_no_error(NAME, VECTOR)\
isr_debug: .global NAME ; \
pushl $0 // error code padding NAME: \
pushl $1 // int vector pushl $0; \
pushl $VECTOR; \
jmp isr jmp isr
.global isr_nmi isr_callback_no_error(isr_divide, 0)
isr_nmi: isr_callback_no_error(isr_debug, 1)
pushl $0 // error code padding isr_callback_no_error(isr_nmi, 2)
pushl $2 // int vector isr_callback_no_error(isr_breakpoint, 3)
jmp isr isr_callback_no_error(isr_overflow, 4)
isr_callback_no_error(isr_bound_range_exceeded, 5)
.global isr_breakpoint isr_callback_no_error(isr_invalid_opcode, 6)
isr_breakpoint: isr_callback_no_error(isr_device_not_available, 7)
pushl $0 // error code padding isr_callback_no_error(isr_double_fault, 8)
pushl $3 // int vector isr_callback_no_error(isr_coprocessor_segment_overrun, 9)
jmp isr isr_callback_error(isr_invalid_tss, 10)
isr_callback_error(isr_segment_not_present, 11)
.global isr_overflow isr_callback_error(isr_stack_segment_fault, 12)
isr_overflow: isr_callback_error(isr_general_protection, 13)
pushl $0 // error code padding isr_callback_error(isr_page_fault, 14)
pushl $4 // int vector isr_callback_no_error(isr_fpu_floating_point_error, 16)
jmp isr isr_callback_error(isr_alignment_check, 17)
isr_callback_no_error(isr_machine_check, 18)
.global isr_bound_range_exceeded isr_callback_no_error(isr_simd_floating_point_exception, 19)
isr_bound_range_exceeded: isr_callback_no_error(isr_virtualization_exception, 20)
pushl $0 // error code padding isr_callback_error(isr_control_protection_exception, 21)
pushl $5 // int vector
jmp isr
.global isr_invalid_opcode
isr_invalid_opcode:
pushl $0 // error code padding
pushl $6 // int vector
jmp isr
.global isr_device_not_available
isr_device_not_available:
pushl $0 // error code padding
pushl $7 // int vector
jmp isr
.global isr_double_fault
isr_double_fault:
pushl $8 // int vector
jmp isr
.global isr_coprocessor_segment_overrun
isr_coprocessor_segment_overrun:
pushl $0 // error code padding
pushl $9 // int vector
jmp isr
.global isr_invalid_tss
isr_invalid_tss:
pushl $10 // int vector
jmp isr
.global isr_segment_not_present
isr_segment_not_present:
pushl $11 // int vector
jmp isr
.global isr_stack_segment_fault
isr_stack_segment_fault:
pushl $12 // int vector
jmp isr
.global isr_general_protection
isr_general_protection:
pushl $13 // int vector
jmp isr
.global isr_page_fault
isr_page_fault:
pushl $14 // int vector
jmp isr
.global isr_fpu_floating_point_error
isr_fpu_floating_point_error:
pushl $0 // error code padding
pushl $16 // int vector
jmp isr
.global isr_alignment_check
isr_alignment_check:
pushl $17 // int vector
jmp isr
.global isr_machine_check
isr_machine_check:
pushl $0 // error code padding
pushl $18 // int vector
jmp isr
.global isr_simd_floating_point_exception
isr_simd_floating_point_exception:
pushl $0 // error code padding
pushl $19 // int vector
jmp isr
.global isr_virtualization_exception
isr_virtualization_exception:
pushl $0 // error code padding
pushl $20 // int vector
jmp isr
.global isr_control_protection_exception
isr_control_protection_exception:
pushl $21 // int vector
jmp isr