Tiberiu Chibici
913e65b856
==================================================== + Changed 'align 0x4' line above multiboot header in loader.asm to 'align 4' + Removed -e option for echo in build.sh + Modified build.sh for linux + Fixed triple fault when enabling paging + Fixed page faults at memory manager initialization + Fixed 'mem' console function + Added more info about page fault at crash screen + Added Panic() macro + Added verbose mode for memory manager [ BAD] BUILD 0.1.0.390 DATE 8/27/2011 AT 10:54 PM ==================================================== + Added stdlib routines, separated in different files + Rewritten physical memory manager + Added virtual mem manager + Added memory allocation/freeing + Added memory library + Added temporary allocation (at end of kernel), until paging is started - Removed functionality from debug console function 'mem' - Removed system.h, the one remaining function now in stdio.h
46 lines
1.4 KiB
C
46 lines
1.4 KiB
C
/******************************************************************
|
|
* idt.h - INTERRUPT DESCRIPTOR TABLE *
|
|
* Contains structures and function declarations for IDT *
|
|
******************************************************************/
|
|
#include <stdlib.h>
|
|
#include "idt.h"
|
|
|
|
extern void IdtLoad();
|
|
/* Declare an IDT of 256 entries. */
|
|
struct IdtEntry idt[256];
|
|
struct IdtPointer idtp;
|
|
|
|
/* Use this function to set an entry in the IDT. Alot simpler
|
|
* than twiddling with the GDT ;) */
|
|
void IdtSetGate(unsigned char num, unsigned long base, unsigned short sel, unsigned char flags)
|
|
{
|
|
/* The interrupt routine's base address */
|
|
idt[num].base_lo = (base & 0xFFFF);
|
|
idt[num].base_hi = (base >> 16) & 0xFFFF;
|
|
|
|
/* The segment or 'selector' that this IDT entry will use
|
|
* is set here, along with any access flags */
|
|
idt[num].sel = sel;
|
|
idt[num].always0 = 0;
|
|
idt[num].flags = flags;
|
|
}
|
|
|
|
struct IdtEntry* IdtGetGate(unsigned char num)
|
|
{
|
|
return &idt[num];
|
|
}
|
|
|
|
/* Installs the IDT */
|
|
void IdtInstall()
|
|
{
|
|
/* Sets the special IDT pointer up, just like in 'gdt.c' */
|
|
idtp.limit = (sizeof (struct IdtEntry) * 256) - 1;
|
|
idtp.base = (unsigned int)&idt;
|
|
|
|
/* Clear out the entire IDT, initializing it to zeros */
|
|
memset (&idt, 0, sizeof(struct IdtEntry) * 256);
|
|
|
|
/* Points the processor's internal register to the new IDT */
|
|
IdtLoad();
|
|
}
|