Add implementation for GDT & IDT on x32 and QoL fixes

This commit is contained in:
Alex
2023-05-17 03:28:57 +03:00
parent f3044ceb5f
commit d527121883
23 changed files with 1529 additions and 457 deletions

View File

@@ -22,6 +22,48 @@
namespace InterruptDescriptorTable
{
typedef enum _InterruptGateType
{
TASK = 0b101,
INT_16BIT = 0b110,
TRAP_16BIT = 0b111,
INT_32BIT = 0b1110,
TRAP_32BIT = 0b1111,
} InterruptGateType;
typedef enum _InterruptRingType
{
RING0 = 0b0,
RING1 = 0b1,
RING2 = 0b10,
RING3 = 0b11,
} InterruptRingType;
typedef struct _InterruptDescriptorTableEntry
{
uint32_t LowOffset : 16;
uint32_t SegmentSelector : 16;
uint32_t Reserved0 : 5;
uint32_t Flags : 4;
uint32_t Reserved1 : 1;
uint32_t Ring : 2;
uint32_t Present : 1;
uint32_t HighOffset : 16;
} __packed InterruptDescriptorTableEntry;
typedef struct _InterruptDescriptorTableDescriptor
{
uint16_t Length;
InterruptDescriptorTableEntry *Entries;
} __packed InterruptDescriptorTableDescriptor;
void SetEntry(uint8_t Index,
void (*Base)(),
InterruptGateType Gate,
InterruptRingType Ring,
bool Present,
uint16_t SegmentSelector);
void Init(int Core);
}