From 623b9e339f285363f9b566ac10f4b7d84a5519b8 Mon Sep 17 00:00:00 2001 From: lordtet Date: Mon, 16 Jun 2025 00:52:05 -0400 Subject: [PATCH] Removing the tables header. Moving its contents to table headers. --- include/idt.h | 25 +++++++++++++++++++++++++ include/{kdtables.h => tss.h} | 23 ++--------------------- src/idt.s | 6 +----- src/interrupts.s | 12 ++++++++++++ src/kdtables.c | 20 -------------------- 5 files changed, 40 insertions(+), 46 deletions(-) create mode 100644 include/idt.h rename include/{kdtables.h => tss.h} (64%) create mode 100644 src/interrupts.s delete mode 100644 src/kdtables.c diff --git a/include/idt.h b/include/idt.h new file mode 100644 index 0000000..671d5f0 --- /dev/null +++ b/include/idt.h @@ -0,0 +1,25 @@ +#ifndef IDT_H +#define IDT_H +#include + +typedef struct InterruptDescriptor_s { + uint16_t offset_1; + uint16_t selector; + uint8_t reserved; + uint8_t attributes; + uint16_t offset_2; +} InterruptDescriptor_t; + +typedef struct IDTR_s { + uint16_t size; + InterruptDescriptor_t* IDT; +} IDTR_t; + +extern IDTR_t idtr; +extern InterruptDescriptor_t* idt_start; + +void setup_idt(); +void write_descriptors(); +void load_idt(); + +#endif diff --git a/include/kdtables.h b/include/tss.h similarity index 64% rename from include/kdtables.h rename to include/tss.h index 93a7506..9f8a78b 100644 --- a/include/kdtables.h +++ b/include/tss.h @@ -4,8 +4,8 @@ * Contains GDT, IDT, and any relevant functions and structs pertaining to them * */ -#ifndef KDTABLES_H -#define KDTABLES_H +#ifndef TSS_H +#define TSS_H #include // TSS @@ -40,25 +40,6 @@ typedef struct tss_s { extern tss_t tss; -//IDT -typedef struct InterruptDescriptor_s { - uint16_t offset_1; - uint16_t selector; - uint8_t reserved; - uint8_t attributes; - uint16_t offset_2; -} InterruptDescriptor_t; - -typedef struct IDTR_s { - uint16_t size; - InterruptDescriptor_t* IDT; -} IDTR_t; - -extern IDTR_t idtr; - -void setup_idt(); -void write_descriptors(); -void load_idt(); #endif diff --git a/src/idt.s b/src/idt.s index 80a27b1..3693c09 100644 --- a/src/idt.s +++ b/src/idt.s @@ -1,4 +1,4 @@ -global idtr +global idtr, idt_start section .idtr idtr: dw idt_end - idt_start @@ -9,7 +9,3 @@ section .idt nobits resb 256 * 8 ;idt technically has 256 entries by the spec, so i'm reserving that much space... even if i dont implement that many. idt_end: - -;Sigh... ISRs essentially MUST be insanely verbose. - - diff --git a/src/interrupts.s b/src/interrupts.s new file mode 100644 index 0000000..6fb1d2f --- /dev/null +++ b/src/interrupts.s @@ -0,0 +1,12 @@ +; Interrupts.s - Implementations of IA32 interrupts. + +;Let's make an interrupt pointer table so C can reference it and build the IDT. + + + +isr_table: + %assign i 0 + %rep 21 + isr_stub_ %+ i: + + diff --git a/src/kdtables.c b/src/kdtables.c deleted file mode 100644 index 6d3e0de..0000000 --- a/src/kdtables.c +++ /dev/null @@ -1,20 +0,0 @@ -/* kdtables.c -* Kernel Descriptor Tables -* -* Contains GDT, IDT, and any relevant functions and structs pertaining to them -*/ -#include "kdtables.h" - - -void setup_idt() { - write_descriptors(); - load_idt(); -} - -void write_descriptors() { - -} - -void load_idt() { - -}