From 4492b7e9d674b20cb3296ce6ac5069944b74b0e6 Mon Sep 17 00:00:00 2001 From: Julien CLEMENT Date: Fri, 16 Jul 2021 03:03:20 +0200 Subject: [PATCH] feat(isr): learnt to do assembly Signed-off-by: Julien CLEMENT --- k/isr.S | 128 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ k/isr.s | 107 ---------------------------------------------- 2 files changed, 128 insertions(+), 107 deletions(-) create mode 100644 k/isr.S delete mode 100644 k/isr.s diff --git a/k/isr.S b/k/isr.S new file mode 100644 index 0000000..184cdd5 --- /dev/null +++ b/k/isr.S @@ -0,0 +1,128 @@ +.section .text + +isr: + pushal + pushl %esp + add $32, (%esp) + call interrupt_handler + add $4, %esp + popal + iret + +.global isr_divide +isr_divide: + pushl $0 // error code padding + pushl $0 // int vector + jmp isr + +.global isr_debug +isr_debug: + pushl $0 // error code padding + pushl $1 // int vector + jmp isr + +.global isr_nmi +isr_nmi: + pushl $0 // error code padding + pushl $2 // int vector + jmp isr + +.global isr_breakpoint +isr_breakpoint: + pushl $0 // error code padding + pushl $3 // int vector + jmp isr + +.global isr_overflow +isr_overflow: + pushl $0 // error code padding + pushl $4 // int vector + jmp isr + +.global isr_bound_range_exceeded +isr_bound_range_exceeded: + pushl $0 // error code padding + 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 diff --git a/k/isr.s b/k/isr.s deleted file mode 100644 index 3b1eeb1..0000000 --- a/k/isr.s +++ /dev/null @@ -1,107 +0,0 @@ -.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