IDT Implemented, should be ready for entries.
git-svn-id: https://spexeah.com:8443/svn/Asuro@36 6dbc8c32-bb84-406f-8558-d1cf31a0ab0c
This commit is contained in:
parent
a0b4639ba9
commit
cbd4685407
BIN
bin/kernel.bin
BIN
bin/kernel.bin
Binary file not shown.
Binary file not shown.
BIN
lib/console.ppu
BIN
lib/console.ppu
Binary file not shown.
BIN
lib/kernel.o
BIN
lib/kernel.o
Binary file not shown.
BIN
lib/kernel.ppu
BIN
lib/kernel.ppu
Binary file not shown.
BIN
lib/keyboard.ppu
BIN
lib/keyboard.ppu
Binary file not shown.
Binary file not shown.
BIN
lib/libpkernel.a
BIN
lib/libpkernel.a
Binary file not shown.
BIN
lib/util.ppu
BIN
lib/util.ppu
Binary file not shown.
31
src/idt.pas
31
src/idt.pas
@ -3,8 +3,8 @@ unit idt;
|
|||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
system,
|
types,
|
||||||
types;
|
util;
|
||||||
|
|
||||||
type
|
type
|
||||||
TIDT_Entry = bitpacked record
|
TIDT_Entry = bitpacked record
|
||||||
@ -23,9 +23,34 @@ type
|
|||||||
PIDT_Pointer = ^TIDT_Pointer;
|
PIDT_Pointer = ^TIDT_Pointer;
|
||||||
|
|
||||||
var
|
var
|
||||||
IDT : Array [0..255] of TIDT_Entry;
|
IDT_Entries : Array [0..255] of TIDT_Entry;
|
||||||
IDT_Pointer : TIDT_Pointer;
|
IDT_Pointer : TIDT_Pointer;
|
||||||
|
|
||||||
|
procedure init();
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
|
procedure set_gate(Number : uint8; Base : uint32; Selector : uint16; Flags : uint8);
|
||||||
|
begin
|
||||||
|
IDT_Entries[Number].base_high:= (Base and $FFFF0000) SHR 16;
|
||||||
|
IDT_Entries[Number].base_low:= (Base and $0000FFFF);
|
||||||
|
IDT_Entries[Number].selector:= Selector;
|
||||||
|
IDT_Entries[Number].flags:= Flags;
|
||||||
|
IDT_Entries[Number].always_0:= $00;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure load(idt_pointer : uint32); assembler; nostackframe;
|
||||||
|
asm
|
||||||
|
MOV EAX, idt_pointer
|
||||||
|
LIDT [EAX]
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure init();
|
||||||
|
begin
|
||||||
|
IDT_Pointer.limit:= (sizeof(TIDT_Entry) * 256) - 1;
|
||||||
|
IDT_Pointer.base:= uint32(@IDT_Entries);
|
||||||
|
util.memset(uint32(@IDT_Entries), 0, sizeof(TIDT_Entry) * 256);
|
||||||
|
load(uint32(@IDT_Pointer));
|
||||||
|
end;
|
||||||
|
|
||||||
end.
|
end.
|
@ -7,6 +7,7 @@ uses
|
|||||||
multiboot,
|
multiboot,
|
||||||
util,
|
util,
|
||||||
gdt,
|
gdt,
|
||||||
|
idt,
|
||||||
console,
|
console,
|
||||||
bios_data_area,
|
bios_data_area,
|
||||||
keyboard;
|
keyboard;
|
||||||
@ -26,6 +27,7 @@ begin
|
|||||||
mbi:= mbinfo;
|
mbi:= mbinfo;
|
||||||
mbm:= mbmagic;
|
mbm:= mbmagic;
|
||||||
gdt.init();
|
gdt.init();
|
||||||
|
idt.init();
|
||||||
console.init();
|
console.init();
|
||||||
console.writestringln('Booting Asuro...');
|
console.writestringln('Booting Asuro...');
|
||||||
if (mbm <> MULTIBOOT_BOOTLOADER_MAGIC) then begin
|
if (mbm <> MULTIBOOT_BOOTLOADER_MAGIC) then begin
|
||||||
|
13
src/util.pas
13
src/util.pas
@ -17,6 +17,7 @@ procedure halt_and_catch_fire();
|
|||||||
function inb(port : uint16) : uint8;
|
function inb(port : uint16) : uint8;
|
||||||
function inw(port : uint16) : uint16;
|
function inw(port : uint16) : uint16;
|
||||||
function inl(port : uint16) : uint32;
|
function inl(port : uint16) : uint32;
|
||||||
|
procedure memset(location : uint32; value : uint8; size : uint32);
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
@ -121,4 +122,16 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure memset(location : uint32; value : uint8; size : uint32);
|
||||||
|
var
|
||||||
|
loc : puint8;
|
||||||
|
i : uint32;
|
||||||
|
|
||||||
|
begin
|
||||||
|
for i:=0 to size do begin
|
||||||
|
loc:= puint8(location + i);
|
||||||
|
loc^:= value;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user