This repository has been archived on 2024-06-25. You can view files and clone it, but cannot push or open issues or pull requests.
rockOS/kernel/include/rockos/idt.h

47 lines
1.3 KiB
C
Raw Normal View History

2022-07-20 02:23:23 +03:00
#ifndef _ROCKOS_IDT_H
#define _ROCKOS_IDT_H
2022-07-18 22:37:43 +03:00
#include <stdint.h>
#define IDT_MAX_DESCRIPTORS 256
2022-07-18 22:37:43 +03:00
typedef struct {
uint16_t isr_low; // lower 16-bits of ISR address
uint16_t kernel_cs; // The GDT selector that the CPU will load into CS before calling ISR
uint8_t reserved; // set to zero
uint8_t flags; // Type and attributes
uint16_t isr_high; // Higher 16-bits of ISR address
} __attribute__((packed)) idt_entry_t;
typedef struct {
uint16_t limit;
uint32_t base;
} __attribute__((packed)) idtr_t;
2022-07-18 22:37:43 +03:00
static idtr_t idtptr;
static char* err_msg[] = {
"#DE Divide Error!",
"#DB Debug Exception!",
"NMI Interrupt!",
"#BP Breakpoint!",
"#OF Overflow!",
"#BR Bound Range Exceeded!",
"#Invalid Opcode (Undefined Opcode)!",
"#NM Device Not Available (No Math Coprocessor)!",
"#DF Double Fault!",
"Coprocessor Segment Overrun (reserved)!",
"#TS Invalid TSS!",
"#NP Segment Not Present!",
"#SS Stack-Segment Fault!",
"#GP General Protection!",
"#PF Page Fault!",
"Unknown Reserved Fault 15!",
"#MF x87 FPU Floating-Point Error (Math Fault)!",
"#AC Alignment Check!",
"#MC Machine Check!",
"#XM SIMD Floating-Point Exception!",
"#VE Virtualization Exception!",
"#CP Control Protection Exception!"
};
2022-07-18 22:37:43 +03:00
#endif