2018-07-20 15:41:58 +02:00
|
|
|
#pragma once
|
2018-08-06 21:00:58 +02:00
|
|
|
#include "stdarg.h"
|
2018-07-20 15:41:58 +02:00
|
|
|
|
2020-04-22 16:52:54 +02:00
|
|
|
// c.f. intel software-developer-vol-1 6.4.1
|
|
|
|
struct interrupt_frame {
|
2020-04-27 00:14:37 +02:00
|
|
|
uint32_t eip;
|
|
|
|
uint32_t cs;
|
|
|
|
uint32_t eflags;
|
|
|
|
uint32_t esp;
|
|
|
|
uint32_t ss;
|
2020-04-22 16:52:54 +02:00
|
|
|
};
|
|
|
|
|
2020-04-23 23:59:57 +02:00
|
|
|
// Exception
|
|
|
|
#define DECLARE_INTERRUPT(int_nb) \
|
2020-04-27 00:14:37 +02:00
|
|
|
void print_handler_##int_nb(struct interrupt_frame *frame, ulong error_code);
|
2020-04-23 23:59:57 +02:00
|
|
|
|
|
|
|
#define ACCESS_INTERRUPT(int_nb) print_handler_##int_nb
|
|
|
|
|
2018-11-13 18:02:47 +01:00
|
|
|
void pagefault_handler(struct interrupt_frame *frame, ulong error_code);
|
2020-04-23 23:59:57 +02:00
|
|
|
DECLARE_INTERRUPT(EXCEPTION_DOUBLE_FAULT)
|
2020-04-24 23:39:56 +02:00
|
|
|
DECLARE_INTERRUPT(EXCEPTION_DIVIDE_ZERO)
|
|
|
|
DECLARE_INTERRUPT(EXCEPTION_DEBUG)
|
|
|
|
DECLARE_INTERRUPT(EXCEPTION_NMI)
|
|
|
|
DECLARE_INTERRUPT(EXCEPTION_BREAKPOINT)
|
|
|
|
DECLARE_INTERRUPT(EXCEPTION_OVERFLOW)
|
|
|
|
DECLARE_INTERRUPT(EXCEPTION_BOUND_RANGE_EXCEEDED)
|
|
|
|
DECLARE_INTERRUPT(EXCEPTION_INVALID_OPCODE)
|
|
|
|
DECLARE_INTERRUPT(EXCEPTION_DEVICE_NOT_AVAILABLE)
|
|
|
|
DECLARE_INTERRUPT(EXCEPTION_COPRO_OVERRUN)
|
|
|
|
DECLARE_INTERRUPT(EXCEPTION_INVALID_TSS)
|
|
|
|
DECLARE_INTERRUPT(EXCEPTION_SEGMENT_NOT_PRESENT)
|
|
|
|
DECLARE_INTERRUPT(EXCEPTION_STACK_SEGMENT_FAULT)
|
|
|
|
DECLARE_INTERRUPT(EXCEPTION_GENERAL_PROTECTION_FAULT)
|
|
|
|
DECLARE_INTERRUPT(EXCEPTION_PAGE_FAULT)
|
|
|
|
DECLARE_INTERRUPT(EXCEPTION_RESERVED_1)
|
|
|
|
DECLARE_INTERRUPT(EXCEPTION_X87_FP_EXCEPTION)
|
|
|
|
DECLARE_INTERRUPT(EXCEPTION_ALIGNMENT_CHECK)
|
|
|
|
DECLARE_INTERRUPT(EXCEPTION_MACHINE_CHECK)
|
|
|
|
DECLARE_INTERRUPT(EXCEPTION_SIMD_FP)
|
|
|
|
DECLARE_INTERRUPT(EXCEPTION_VIRTUALIZATION)
|
|
|
|
DECLARE_INTERRUPT(EXCEPTION_RESERVED_2)
|
|
|
|
DECLARE_INTERRUPT(EXCEPTION_RESERVED_3)
|
|
|
|
DECLARE_INTERRUPT(EXCEPTION_RESERVED_4)
|
|
|
|
DECLARE_INTERRUPT(EXCEPTION_RESERVED_5)
|
|
|
|
DECLARE_INTERRUPT(EXCEPTION_RESERVED_6)
|
|
|
|
DECLARE_INTERRUPT(EXCEPTION_RESERVED_7)
|
|
|
|
DECLARE_INTERRUPT(EXCEPTION_RESERVED_8)
|
|
|
|
DECLARE_INTERRUPT(EXCEPTION_RESERVED_9)
|
|
|
|
DECLARE_INTERRUPT(EXCEPTION_RESERVED_10)
|
|
|
|
DECLARE_INTERRUPT(EXCEPTION_SECURITY)
|
|
|
|
DECLARE_INTERRUPT(EXCEPTION_RESERVED_11)
|
2018-07-20 15:41:58 +02:00
|
|
|
|
2020-04-22 16:52:54 +02:00
|
|
|
// IRQ
|
2020-04-23 00:49:09 +02:00
|
|
|
void pit_handler(struct interrupt_frame *frame);
|
2018-07-20 15:41:58 +02:00
|
|
|
void keyboard_handler(struct interrupt_frame *frame);
|
|
|
|
void timer_handler(struct interrupt_frame *frame);
|
2018-11-08 21:37:38 +01:00
|
|
|
void serial_handler(struct interrupt_frame *frame);
|