Fix braces + init_paging args

This commit is contained in:
2026-03-11 19:58:00 +01:00
parent 9d409317e2
commit 8e2a612d88
29 changed files with 147 additions and 229 deletions

View File

@@ -53,8 +53,7 @@ void idt_load(void* idt_addr)
void idt_init()
{
// Hardcoded...
for (size_t i=0; i<=33; i++)
{
for (size_t i=0; i<=KERNEL_IDT_ENTRIES; i++) {
// Each vector handler is 16-byte aligned, so <vector_no>*16 = address of that handler
idt_set_entry(i, vector_0_handler + (i*16), 0);
}
@@ -98,8 +97,7 @@ static void gp_fault_handler(struct cpu_status_t* ctx)
(ctx->error_code == 0) ? "NOT_SEGMENT_RELATED" : "SEGMENT_RELATED");
// Segment-related
if (ctx->error_code != 0)
{
if (ctx->error_code != 0) {
bool is_external = CHECK_BIT(ctx->error_code, 0);
// is it IDT, GDT, LDT?
uint8_t table = ctx->error_code & 0x6; // 0b110 (isolate table)
@@ -118,13 +116,11 @@ static void gp_fault_handler(struct cpu_status_t* ctx)
struct cpu_status_t* interrupt_dispatch(struct cpu_status_t* context)
{
if (context == NULL)
{
if (context == NULL) {
panic(NULL, "Interrupt dispatch recieved NULL context!");
}
switch(context->vector_number)
{
switch(context->vector_number) {
case 0:
panic(context, "Divide Error");
break;
@@ -197,15 +193,13 @@ struct cpu_status_t* interrupt_dispatch(struct cpu_status_t* context)
// Send an EOI so that we can continue having interrupts
outb(0x20, 0x20);
if (ticks % SCHEDULER_QUANTUM == 0)
{
if (ticks % SCHEDULER_QUANTUM == 0) {
return scheduler_schedule(context);
}
break;
case 33:
DEBUG("Keyboard Interrupt");
case 33: // Keyboard Interrupt
keyboard_handler();
outb(0x20, 0x20);
break;