separating: there will be libk and libc

This commit is contained in:
2025-01-07 15:23:14 +01:00
parent b3687d20ee
commit a8582ba343
32 changed files with 29 additions and 31 deletions

34
kernel/idt.c Normal file
View File

@@ -0,0 +1,34 @@
// Interrupt descriptor table setup
// Author: xamidev
// Licensed under the Unlicense. See the repo below.
// https://github.com/xamidev/blankos
#include "idt.h"
#include "system.h"
#include "../libk/stdio.h"
struct idt_entry idt[256];
struct idt_ptr idtp;
extern void idt_load();
void idt_set_gate(unsigned char num, unsigned long base, unsigned short sel, unsigned char flags)
{
idt[num].base_lo = (base & 0xFFFF);
idt[num].base_hi = (base >> 16) & 0xFFFF;
idt[num].sel = sel;
idt[num].always0 = 0;
idt[num].flags = flags;
}
void idt_install()
{
idtp.limit = (sizeof (struct idt_entry)*256) - 1;
idtp.base = (unsigned int)&idt;
memset(&idt, 0, sizeof(struct idt_entry)*256);
idt_load();
printf("[kernel] loaded IDT at idt=0x%x\n", (unsigned int)&idt);
}