2024-09-30 07:01:56 -04:00
|
|
|
#pragma once
|
|
|
|
|
2025-01-27 05:26:15 -05:00
|
|
|
#include "types.h"
|
2024-10-09 11:54:29 -04:00
|
|
|
#include <stdint.h>
|
|
|
|
|
2024-09-30 07:01:56 -04:00
|
|
|
// doc : https://wiki.osdev.org/Interrupt_Descriptor_Table#IDTR
|
2024-09-30 09:44:34 -04:00
|
|
|
struct idt_descriptor {
|
2025-01-27 05:26:15 -05:00
|
|
|
u16 size;
|
|
|
|
u32 offset;
|
2024-09-30 09:44:34 -04:00
|
|
|
} __attribute__((packed));
|
2024-09-30 07:01:56 -04:00
|
|
|
|
2024-10-02 08:15:57 -04:00
|
|
|
struct idt_entry {
|
2025-01-27 05:26:15 -05:00
|
|
|
u16 isr_low; // The lower 16 bits of the ISR's address
|
|
|
|
u16 kernel_cs; // The GDT segment selector that the CPU will load
|
2024-10-02 08:15:57 -04:00
|
|
|
// into CS before calling the ISR
|
2025-01-27 05:26:15 -05:00
|
|
|
u8 reserved; // Set to zero
|
|
|
|
u8 attributes; // Type and attributes; see the IDT page
|
|
|
|
u16 isr_high; // The higher 16 bits of the ISR's address
|
2024-10-02 08:15:57 -04:00
|
|
|
} __attribute__((packed));
|
|
|
|
|
|
|
|
#define IDT_SIZE 256
|
|
|
|
|
2024-10-09 11:54:29 -04:00
|
|
|
void init_idt(void);
|