Initial commit

This commit is contained in:
2021-01-28 22:59:39 +01:00
commit d7f0e8dd36
30 changed files with 2092 additions and 0 deletions

23
kernel/cpu/idt.c Normal file
View File

@@ -0,0 +1,23 @@
//
// Created by rick on 8/18/19.
//
#include "idt.h"
idt_gate_t idt[IDT_REGISTERS];
idt_register_t idt_reg;
void set_idt_gate(int n, u32 handler) {
idt[n].low_offset = handler & 0xffff;
idt[n].sel = KERNEL_CS;
idt[n].always0 = 0;
idt[n].flags = 0x8E;
idt[n].high_offset = handler >> 16 & 0xFFFF;
}
void set_idt() {
idt_reg.base = (u32) &idt;
idt_reg.limit = IDT_REGISTERS * sizeof(idt_gate_t) - 1;
__asm__ __volatile__("lidtl (%0)" : : "r" (&idt_reg));
}