2022-02-22 21:20:57 +02:00
|
|
|
#ifndef _IDT_H
|
|
|
|
#define _IDT_H
|
|
|
|
|
|
|
|
#include <stddef.h>
|
|
|
|
#include <stdint.h>
|
|
|
|
|
|
|
|
#define KERNEL_CODE_SEGMENT_OFFSET 0x08
|
|
|
|
#define INTERRUPT_GATE 0x8e
|
|
|
|
|
|
|
|
// https://wiki.osdev.org/Interrupt_Descriptor_Table
|
2022-02-24 18:11:09 +02:00
|
|
|
struct interrupt_descriptor_32 {
|
2022-02-22 21:20:57 +02:00
|
|
|
uint16_t offset_1; // offset bits 0..15
|
|
|
|
uint16_t selector; // a code segment selector in GDT or LDT
|
|
|
|
uint8_t zero; // unused, set to 0
|
|
|
|
uint8_t type_attributes; // gate type, dpl, and p fields
|
|
|
|
uint16_t offset_2; // offset bits 16..31
|
2022-02-24 18:11:09 +02:00
|
|
|
} __attribute__((__packed__));
|
2022-02-22 21:20:57 +02:00
|
|
|
|
2022-02-24 21:57:59 +02:00
|
|
|
void idt_init(void);
|
2022-02-22 21:20:57 +02:00
|
|
|
void idt_register_handler(uint8_t interrupt, size_t address);
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|