Removing the tables header. Moving its contents to table headers.

This commit is contained in:
lordtet 2025-06-16 00:52:05 -04:00
parent d32c1fab63
commit 623b9e339f
5 changed files with 40 additions and 46 deletions

25
include/idt.h Normal file
View file

@ -0,0 +1,25 @@
#ifndef IDT_H
#define IDT_H
#include <stdint.h>
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

View file

@ -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 <stdint.h>
// 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

View file

@ -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.

12
src/interrupts.s Normal file
View file

@ -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:

View file

@ -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() {
}