hippOS/cpu/idt.h
2022-02-22 21:20:57 +02:00

23 lines
647 B
C

#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
struct __attribute__((__packed__)) interrupt_descriptor_32 {
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
};
void idt_init();
void idt_register_handler(uint8_t interrupt, size_t address);
#endif