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:
kieron 2017-05-16 23:35:52 +00:00
parent a0b4639ba9
commit cbd4685407
13 changed files with 43 additions and 3 deletions

BIN
Asuro.iso

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -3,8 +3,8 @@ unit idt;
interface
uses
system,
types;
types,
util;
type
TIDT_Entry = bitpacked record
@ -23,9 +23,34 @@ type
PIDT_Pointer = ^TIDT_Pointer;
var
IDT : Array [0..255] of TIDT_Entry;
IDT_Entries : Array [0..255] of TIDT_Entry;
IDT_Pointer : TIDT_Pointer;
procedure init();
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.

View File

@ -7,6 +7,7 @@ uses
multiboot,
util,
gdt,
idt,
console,
bios_data_area,
keyboard;
@ -26,6 +27,7 @@ begin
mbi:= mbinfo;
mbm:= mbmagic;
gdt.init();
idt.init();
console.init();
console.writestringln('Booting Asuro...');
if (mbm <> MULTIBOOT_BOOTLOADER_MAGIC) then begin

View File

@ -17,6 +17,7 @@ procedure halt_and_catch_fire();
function inb(port : uint16) : uint8;
function inw(port : uint16) : uint16;
function inl(port : uint16) : uint32;
procedure memset(location : uint32; value : uint8; size : uint32);
implementation
@ -121,4 +122,16 @@ begin
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.