.m
Objective-C
(text/x-objectivec)
#ifndef IDT_H
#define IDT_H

#include <stdint.h>

#define IDT_ENTRIES 256

/* IDT entry structure for 64-bit mode */
struct idt_entry {
    uint16_t offset_low;
    uint16_t selector;
    uint8_t  ist;          // Interrupt Stack Table offset
    uint8_t  type_attr;
    uint16_t offset_mid;
    uint32_t offset_high;
    uint32_t zero;
} __attribute__((packed));

struct idt_ptr {
    uint16_t limit;
    uint64_t base;
} __attribute__((packed));

/* Declare the IDT and its pointer */
extern struct idt_entry idt[IDT_ENTRIES];
extern struct idt_ptr   idt_descriptor;

/* Functions */
void idt_init(void);
void isr_handler_common(void);
void irq_handler_common(void);

#endif /* IDT_H */