Major libk restructuring, also rewrote drivers/serial.h

This commit is contained in:
2024-10-27 10:23:56 +01:00
parent 4079049242
commit e8a55d72a5
62 changed files with 334 additions and 380 deletions
+28
View File
@@ -0,0 +1,28 @@
#ifndef _CPU_IDT_H
#define _CPU_IDT_H
#include <stdint.h>
#define IDT_ENTRIES 256
#define TRAP_GATE_FLAGS 0x8f // P = 1, DPL = 00, S = 0, Type = 1111 (32-bit Trap gate)
#define INT_GATE_FLAGS 0x8e // P = 1, DPL = 00, S = 0, Type = 1110 (32-bit Int gate)
#define USR_INT_GATE_FLAGS 0xee // P = 1, DPL = 11, S = 0, Type = 1110 (32-bit Int gate)
typedef struct {
uint16_t offsetLow;
uint16_t selector;
uint8_t zero;
uint8_t typeAttr;
uint16_t offsetHigh;
} __attribute__ ((packed)) idtEntry_t;
typedef struct {
uint16_t limit;
uint32_t base;
} __attribute__ ((packed)) idtp_t;
void idtSetGate(uint8_t i, void* handler, uint8_t flags);
void setupIdt();
#endif