#ifndef ISR_H
#define ISR_H

#include <stdint.h>

#define ERR_MAX 5

static int err_count = 0;

typedef struct {
    struct {
        uint64_t    resv0;
        uint64_t    resv1;
        uint64_t    resv2;
        uint64_t    resv3;
    } broken;

    struct {
        uint64_t    resv0;
        uint64_t    resv1;
        uint64_t    resv2;
        uint64_t    resv3;
        uint64_t    resv4;
        uint64_t    resv5;
    } broken_2;
	
    struct {
        uint64_t    resv0;
        uint64_t    error_code;
        uint64_t    resv1;
        uint64_t    vector;
        uint64_t    resv2;
        uint64_t    resv3;
        uint64_t    resv4;
        uint64_t    resv5;
    } base_frame;
} isr_xframe_t;

/*
List of pushed things in order:
error_code
vector
rbp
rax
rbx
rcx
rdx
rsi
rdi
cr0
cr2
cr3
cr4
ds
0

*/

__attribute__((noreturn))
void exception_handler(isr_xframe_t frame);

__attribute__((noreturn))
void interrupt_handler(isr_xframe_t frame);

#endif