45 lines
850 B
C
45 lines
850 B
C
|
#ifndef ISR_H
|
||
|
#define ISR_H
|
||
|
|
||
|
#include <stdint.h>
|
||
|
|
||
|
#define ERR_MAX 5
|
||
|
|
||
|
static int err_count = 0;
|
||
|
|
||
|
typedef struct {
|
||
|
struct {
|
||
|
uint64_t cr4;
|
||
|
uint64_t cr3;
|
||
|
uint64_t cr2;
|
||
|
uint64_t cr0;
|
||
|
} control_registers;
|
||
|
|
||
|
struct {
|
||
|
uint64_t rdi;
|
||
|
uint64_t rsi;
|
||
|
uint64_t rdx;
|
||
|
uint64_t rcx;
|
||
|
uint64_t rbx;
|
||
|
uint64_t rax;
|
||
|
} general_registers;
|
||
|
|
||
|
struct {
|
||
|
uint64_t rbp;
|
||
|
uint64_t vector;
|
||
|
uint64_t error_code;
|
||
|
uint64_t rip;
|
||
|
uint64_t cs;
|
||
|
uint64_t rflags;
|
||
|
uint64_t rsp;
|
||
|
uint64_t dss;
|
||
|
} base_frame;
|
||
|
} isr_xframe_t;
|
||
|
|
||
|
__attribute__((noreturn))
|
||
|
void exception_handler(isr_xframe_t frame);
|
||
|
|
||
|
__attribute__((noreturn))
|
||
|
void interrupt_handler(isr_xframe_t frame);
|
||
|
|
||
|
#endif
|