57 lines
1.0 KiB
C
57 lines
1.0 KiB
C
#ifndef IDT_H
|
|
#define IDT_H
|
|
|
|
#include <stdint.h>
|
|
|
|
void idt_init();
|
|
|
|
struct interrupt_descriptor
|
|
{
|
|
uint16_t address_low;
|
|
uint16_t selector;
|
|
uint8_t ist;
|
|
uint8_t flags;
|
|
uint16_t address_mid;
|
|
uint32_t address_high;
|
|
uint32_t reserved;
|
|
} __attribute__((packed));
|
|
|
|
struct idtr
|
|
{
|
|
uint16_t limit;
|
|
uint64_t base;
|
|
} __attribute__((packed));
|
|
|
|
// All general-purpose registers (except rsp) as stored on the stack,
|
|
// plus the values we pushed (vector number, error code) and the iret frame
|
|
// In reverse order because the stack grows downwards.
|
|
struct cpu_status_t
|
|
{
|
|
uint64_t r15;
|
|
uint64_t r14;
|
|
uint64_t r13;
|
|
uint64_t r12;
|
|
uint64_t r11;
|
|
uint64_t r10;
|
|
uint64_t r9;
|
|
uint64_t r8;
|
|
uint64_t rbp;
|
|
//uint64_t rsp;
|
|
uint64_t rdi;
|
|
uint64_t rsi;
|
|
uint64_t rdx;
|
|
uint64_t rcx;
|
|
uint64_t rbx;
|
|
uint64_t rax;
|
|
|
|
uint64_t vector_number;
|
|
uint64_t error_code;
|
|
|
|
uint64_t iret_rip;
|
|
uint64_t iret_cs;
|
|
uint64_t iret_flags;
|
|
uint64_t iret_rsp;
|
|
uint64_t iret_ss;
|
|
};
|
|
|
|
#endif |