feat(isr): add basic isr wrappers

Signed-off-by: Julien CLEMENT <julien.clement@epita.fr>
This commit is contained in:
Julien CLEMENT 2021-07-16 02:46:07 +02:00
parent 96610353c8
commit 10896fe2e9
2 changed files with 139 additions and 0 deletions

32
k/isr.h Normal file

@ -0,0 +1,32 @@
#ifndef ISR_H
#define ISR_H
struct isr_param
{
uint32_t int_vector;
uint32_t error_code;
} __attribute__ ((packed));
void isr_divide(void);
void isr_debug(void);
void isr_nmi(void);
void isr_breakpoint(void);
void isr_overflow(void);
void isr_bound_range_exceeded(void);
void isr_invalid_opcode(void);
void isr_device_not_available(void);
void isr_double_fault(void);
void isr_coprocessor_segment_overrun(void);
void isr_invalid_tss(void);
void isr_segment_not_present(void);
void isr_stack_segment_fault(void);
void isr_general_protection(void);
void isr_page_fault(void);
void isr_fpu_floating_point_error(void);
void isr_alignment_check(void);
void isr_machine_check(void);
void isr_simd_floating_point_exception(void);
void isr_virtualization_exception(void);
void isr_control_protection_exception(void);
#endif /* !ISR_H */

107
k/isr.s Normal file

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