Newer
Older
tree-os / src / include / interrupts.h
#ifndef INTERRUPTS_H
#define INTERRUPTS_H

#include <stdint.h>

typedef struct {
    uint16_t    isr_low;
	uint16_t    codeSegment;
	uint8_t     reserved;
	uint8_t     attributes;
	uint16_t    isr_high;
} __attribute__((packed)) IDTEntry;

typedef struct {
	uint16_t	limit;
	uint32_t	base;
} __attribute__((packed)) IDTR;

typedef struct {
    unsigned int gs, fs, es, ds;
    unsigned int edi, esi, ebp, esp, ebx, edx, ecx, eax;
    unsigned int int_no, err_code;
    unsigned int eip, cs, eflags, useresp, ss;
} __attribute__((packed)) regs;

extern void initInterrupts();
extern void setInterrupt(uint8_t vector, void* callback);

#endif