git-svn-id: https://spexeah.com:8443/svn/Asuro@372 6dbc8c32-bb84-406f-8558-d1cf31a0ab0c
This commit is contained in:
@@ -71,7 +71,7 @@ end;
|
||||
|
||||
procedure init();
|
||||
begin
|
||||
console.writestringln('BDA: Loaded.');
|
||||
console.outputln('BDA','Loaded.');
|
||||
//TO-DO search for important structures like the MCFG or the EBDA.
|
||||
end;
|
||||
|
||||
|
||||
@@ -42,6 +42,9 @@ procedure writecharln(character : char);
|
||||
procedure writecharex(character : char; attributes : char);
|
||||
procedure writecharlnex(character : char; attributes : char);
|
||||
|
||||
procedure Output(identifier : PChar; str : PChar);
|
||||
procedure Outputln(identifier : PChar; str : PChar);
|
||||
|
||||
procedure writestring(str: PChar);
|
||||
procedure writestringln(str: PChar);
|
||||
procedure writestringex(str: PChar; attributes : char);
|
||||
@@ -57,6 +60,7 @@ procedure writewordln(i: DWORD);
|
||||
procedure writewordex(i: DWORD; attributes : char);
|
||||
procedure writewordlnex(i: DWORD; attributes : char);
|
||||
|
||||
procedure writehexpair(b : uint8);
|
||||
procedure writehex(i: DWORD);
|
||||
procedure writehexln(i: DWORD);
|
||||
procedure writehexex(i : DWORD; attributes : char);
|
||||
@@ -278,6 +282,36 @@ begin
|
||||
console._safeincrement_x();
|
||||
end;
|
||||
|
||||
procedure writehexpair(b : uint8);
|
||||
var
|
||||
bn : Array[0..1] of uint8;
|
||||
i : uint8;
|
||||
|
||||
begin
|
||||
bn[0]:= b SHR 4;
|
||||
bn[1]:= b AND $0F;
|
||||
for i:=0 to 1 do begin
|
||||
case bn[i] of
|
||||
0:writestring('0');
|
||||
1:writestring('1');
|
||||
2:writestring('2');
|
||||
3:writestring('3');
|
||||
4:writestring('4');
|
||||
5:writestring('5');
|
||||
6:writestring('6');
|
||||
7:writestring('7');
|
||||
8:writestring('8');
|
||||
9:writestring('9');
|
||||
10:writestring('A');
|
||||
11:writestring('B');
|
||||
12:writestring('C');
|
||||
13:writestring('D');
|
||||
14:writestring('E');
|
||||
15:writestring('F');
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure writehexex(i : dword; attributes: char); [public, alias: 'console_writehexex'];
|
||||
var
|
||||
Hex : Array[0..7] of Byte;
|
||||
@@ -340,6 +374,20 @@ begin
|
||||
writehexlnex(i, Console_Properties.Default_Attribute);
|
||||
end;
|
||||
|
||||
procedure Output(identifier : PChar; str : PChar);
|
||||
begin
|
||||
writestring('[');
|
||||
writestring(identifier);
|
||||
writestring('] ');
|
||||
writestring(str);
|
||||
end;
|
||||
|
||||
procedure Outputln(identifier : PChar; str : PChar);
|
||||
begin
|
||||
Output(identifier, str);
|
||||
writestringln(' ');
|
||||
end;
|
||||
|
||||
procedure writestringex(str: PChar; attributes: char); [public, alias: 'console_writestringex'];
|
||||
var
|
||||
i : integer;
|
||||
|
||||
@@ -62,7 +62,7 @@ end;
|
||||
function load(ptr : void) : boolean;
|
||||
begin
|
||||
isr33.hook(uint32(@callback));
|
||||
console.writestringln('PS/2 KEYBOARD: LOADED.');
|
||||
console.outputln('PS/2 KEYBOARD', 'LOADED.');
|
||||
load:= true;
|
||||
end;
|
||||
|
||||
@@ -71,7 +71,7 @@ var
|
||||
devid : TDeviceIdentifier;
|
||||
|
||||
begin
|
||||
console.writestringln('PS/2 KEYBOARD: INIT BEGIN.');
|
||||
console.outputln('PS/2 KEYBOARD', 'INIT BEGIN.');
|
||||
if keyboard_layout[1].key_code = 0 then lang_USA();
|
||||
devid.bus:= biUnknown;
|
||||
devid.id0:= 0;
|
||||
@@ -81,7 +81,7 @@ begin
|
||||
devid.id4:= 0;
|
||||
devid.ex:= nil;
|
||||
drivermanagement.register_driver_ex('PS/2 Keyboard', @devid, @load, true);
|
||||
console.writestringln('PS/2 KEYBOARD: INIT END.');
|
||||
console.outputln('PS/2 KEYBOARD', 'INIT END.');
|
||||
end;
|
||||
//2A AA
|
||||
|
||||
|
||||
@@ -107,7 +107,7 @@ end;
|
||||
function load(ptr : void) : boolean;
|
||||
begin
|
||||
isr44.hook(uint32(@callback));
|
||||
console.writestringln('PS/2 MOUSE: LOADED.');
|
||||
console.outputln('PS/2 MOUSE', 'LOADED.');
|
||||
load:= true;
|
||||
end;
|
||||
|
||||
@@ -116,7 +116,7 @@ var
|
||||
devid : TDeviceIdentifier;
|
||||
|
||||
begin
|
||||
console.writestringln('PS/2 MOUSE: INIT BEGIN.');
|
||||
console.outputln('PS/2 MOUSE', 'INIT BEGIN.');
|
||||
devid.bus:= biUnknown;
|
||||
devid.id0:= 0;
|
||||
devid.id1:= 0;
|
||||
@@ -125,7 +125,7 @@ begin
|
||||
devid.id4:= 0;
|
||||
devid.ex:= nil;
|
||||
drivermanagement.register_driver_ex('PS/2 Mouse', @devid, @load, true);
|
||||
console.writestringln('PS/2 MOUSE: INIT END.');
|
||||
console.outputln('PS/2 MOUSE', 'INIT END.');
|
||||
end;
|
||||
|
||||
end.
|
||||
+6
-6
@@ -79,14 +79,14 @@ var
|
||||
current_bus : uint8;
|
||||
|
||||
begin
|
||||
console.writestringln('PCI: Scanning Bus: 0');
|
||||
console.outputln('PCI', 'Scanning Bus: 0');
|
||||
scanBus(0);
|
||||
//while unscanned busses scan busses
|
||||
current_bus := 1;
|
||||
while true do begin
|
||||
if current_bus < bus_count then begin
|
||||
console.writestringln('PCI: Scanning Bus: ');
|
||||
console.writeint(bus_count);
|
||||
console.output('PCI', 'Scanning Bus: ');
|
||||
console.writeintln(bus_count);
|
||||
scanBus(current_bus);
|
||||
current_bus := current_bus + 1;
|
||||
end else break;
|
||||
@@ -99,7 +99,7 @@ var
|
||||
DevID : TDeviceIdentifier;
|
||||
|
||||
begin
|
||||
console.writestringln('PCI: INIT BEGIN.');
|
||||
console.outputln('PCI','INIT BEGIN.');
|
||||
DevID.Bus:= biUnknown;
|
||||
DevID.id0:= 0;
|
||||
DevID.id1:= 0;
|
||||
@@ -107,7 +107,7 @@ begin
|
||||
DevID.id3:= 0;
|
||||
DevID.ex:= nil;
|
||||
drivermanagement.register_driver_ex('PCI Driver', @DevID, @load, true);
|
||||
console.writestringln('PCI: INIT END.');
|
||||
console.outputln('PCI', 'INIT END.');
|
||||
end;
|
||||
|
||||
procedure scanBus(bus : uint8);
|
||||
@@ -315,7 +315,7 @@ begin
|
||||
DevID^.id4:= device.vendor_id;
|
||||
DevID^.ex:= nil;
|
||||
|
||||
console.writestring('PCI: Found Device: ');
|
||||
console.output('PCI', 'Found Device: ');
|
||||
console.writehex(device.header_type);
|
||||
console.writestring(' ');
|
||||
console.writehex(device.device_id);
|
||||
|
||||
@@ -50,12 +50,12 @@ var
|
||||
|
||||
begin
|
||||
devices:= PCI.getDeviceInfo($0C, $03, $10, count);
|
||||
console.writestring('USB-OHCI: Found ');
|
||||
console.output('USB-OHCI Driver', 'Found ');
|
||||
console.writeint(count);
|
||||
console.writestringln(' USB Controller(s).');
|
||||
if count > 0 then begin
|
||||
for i:=0 to count-1 do begin
|
||||
console.writestring('USB: Controller[');
|
||||
console.output('USB-OHCI Driver', 'Controller[');
|
||||
console.writeint(i);
|
||||
console.writestring(']: ');
|
||||
console.writehex(devices[i].device_id);
|
||||
@@ -80,12 +80,12 @@ var
|
||||
|
||||
begin
|
||||
devices:= PCI.getDeviceInfo($0C, $03, $00, count);
|
||||
console.writestring('USB-UHCI: Found ');
|
||||
console.output('USB-UHCI Driver','Found ');
|
||||
console.writeint(count);
|
||||
console.writestringln(' USB Controller(s).');
|
||||
if count > 0 then begin
|
||||
for i:=0 to count-1 do begin
|
||||
console.writestring('USB: Controller[');
|
||||
console.output('USB-UHCI Driver','Controller[');
|
||||
console.writeint(i);
|
||||
console.writestring(']: ');
|
||||
console.writehex(devices[i].device_id);
|
||||
@@ -103,7 +103,7 @@ var
|
||||
UHCI_ID, OHCI_ID : TDeviceIdentifier;
|
||||
|
||||
begin
|
||||
console.writestringln('USB: INIT BEGIN.');
|
||||
console.outputln('USB Driver', 'INIT BEGIN.');
|
||||
|
||||
UHCI_ID.Bus:= biPCI;
|
||||
UHCI_ID.id0:= idANY;
|
||||
@@ -124,7 +124,7 @@ begin
|
||||
drivermanagement.register_driver('USB-UHCI Driver', @UHCI_ID, @loadUHCI);
|
||||
drivermanagement.register_driver('USB-OHCI Driver', @OHCI_ID, @loadOHCI);
|
||||
|
||||
console.writestringln('USB: INIT END.');
|
||||
console.outputln('USB Driver', 'INIT END.');
|
||||
end;
|
||||
|
||||
end.
|
||||
+245
-19
File diff suppressed because it is too large
Load Diff
@@ -11,7 +11,7 @@ implementation
|
||||
|
||||
function load(ptr : void) : boolean;
|
||||
begin
|
||||
console.writestringln('DUMMY DRIVER LOADED.')
|
||||
console.outputln('DUMMY DRIVER', 'LOADED.')
|
||||
end;
|
||||
|
||||
procedure init;
|
||||
|
||||
@@ -307,7 +307,12 @@ begin
|
||||
end;
|
||||
RegList^.Next:= NewReg;
|
||||
end;
|
||||
console.output('Driver Management', 'New Driver Registered: ');
|
||||
console.writestringln(NewReg^.Driver_Name);
|
||||
if force_load then begin
|
||||
console.output('Driver Management', 'Driver (');
|
||||
console.writestring(NewReg^.Driver_Name);
|
||||
console.writestringln(') forced to load.');
|
||||
NewReg^.Loaded:= True;
|
||||
NewReg^.Driver_Load(nil);
|
||||
end;
|
||||
@@ -336,9 +341,18 @@ begin
|
||||
end;
|
||||
dev_list^.Next:= new_dev;
|
||||
end;
|
||||
console.output('Driver Management', 'New Device Registered: ');
|
||||
console.writestringln(new_dev^.Device_Name);
|
||||
while drv <> nil do begin
|
||||
if identifiers_match(drv^.Identifier, DeviceID) then begin
|
||||
console.output('Driver Management', 'Device/Driver Match: ');
|
||||
console.writestring(new_dev^.Device_Name);
|
||||
console.writestring('->');
|
||||
console.writestringln(drv^.Driver_Name);
|
||||
if drv^.Driver_Load(ptr) then begin
|
||||
console.output('Driver Management', 'Driver (');
|
||||
console.writestring(drv^.Driver_Name);
|
||||
console.writestringln(') successfully loaded.');
|
||||
drv^.Loaded:= true;
|
||||
new_dev^.Driver_Loaded:= true;
|
||||
new_dev^.Driver:= drv;
|
||||
|
||||
+5
-5
@@ -58,7 +58,7 @@ end;
|
||||
|
||||
procedure flush;
|
||||
begin
|
||||
console.writestringln('GDT: FLUSH.');
|
||||
console.outputln('GDT','FLUSH.');
|
||||
flush_gdt(uint32(@gdt_pointer));
|
||||
end;
|
||||
|
||||
@@ -70,7 +70,7 @@ end;
|
||||
|
||||
procedure reload;
|
||||
begin
|
||||
console.writestringln('GDT: RELOAD.');
|
||||
console.outputln('GDT','RELOAD.');
|
||||
reload_gdt(uint32(@gdt_pointer));
|
||||
end;
|
||||
|
||||
@@ -90,14 +90,14 @@ begin
|
||||
gdt_entries[Gate_Number].limit_low := (Limit AND $FFFF);
|
||||
gdt_entries[Gate_Number].granularity := ((Limit SHR 16) AND $0F) OR (Granularity AND $F0);
|
||||
gdt_entries[Gate_Number].access := Access;
|
||||
console.writestring('GDT: GATE ');
|
||||
console.output('GDT','GATE ');
|
||||
console.writeint(Gate_Number);
|
||||
console.writestringln(' SET.');
|
||||
end;
|
||||
|
||||
procedure init();
|
||||
begin
|
||||
console.writestringln('GDT: INIT START.');
|
||||
console.outputln('GDT','INIT START.');
|
||||
gdt_pointer.limit:= 0;
|
||||
gdt_pointer.base := uint32(@gdt_entries);
|
||||
set_gate($00, $00, $00, $00, $00); //OFFSET: 0
|
||||
@@ -106,7 +106,7 @@ begin
|
||||
set_gate($03, $00, $FFFFFFFF, $FA, $CF); //OFFSET: 24
|
||||
set_gate($04, $00, $FFFFFFFF, $F2, $CF); //OFFSET: 32
|
||||
flush;
|
||||
console.writestringln('GDT: INIT END.');
|
||||
console.outputln('GDT','INIT END.');
|
||||
end;
|
||||
|
||||
end.
|
||||
+5
-5
@@ -52,7 +52,7 @@ begin
|
||||
IDT_Entries[Number].selector:= Selector;
|
||||
IDT_Entries[Number].flags:= Flags;
|
||||
IDT_Entries[Number].always_0:= $00;
|
||||
console.writestring('IDT: GATE ');
|
||||
console.output('IDT','GATE ');
|
||||
console.writeint(Number);
|
||||
console.writestringln(' SET.');
|
||||
end;
|
||||
@@ -65,14 +65,14 @@ end;
|
||||
|
||||
procedure init();
|
||||
begin
|
||||
console.writestringln('IDT: INIT START.');
|
||||
console.outputln('IDT','INIT START.');
|
||||
IDT_Pointer.limit:= (sizeof(TIDT_Entry) * 256) - 1;
|
||||
IDT_Pointer.base:= uint32(@IDT_Entries);
|
||||
console.writestringln('IDT: CLEAR.');
|
||||
console.outputln('IDT','CLEAR.');
|
||||
util.memset(uint32(@IDT_Entries[0]), 0, sizeof(TIDT_Entry) * 256);
|
||||
console.writestringln('IDT: LOAD.');
|
||||
console.outputln('IDT','LOAD.');
|
||||
load(uint32(@IDT_Pointer));
|
||||
console.writestringln('IDT: INIT END.');
|
||||
console.outputln('IDT','INIT END.');
|
||||
end;
|
||||
|
||||
end.
|
||||
+2
-2
@@ -19,7 +19,7 @@ implementation
|
||||
|
||||
procedure init();
|
||||
begin
|
||||
console.writestringln('IRQ: INIT START.');
|
||||
console.outputln('IRQ','INIT START.');
|
||||
outb($20, $11);
|
||||
outb($A0, $11);
|
||||
outb($21, $20);
|
||||
@@ -30,7 +30,7 @@ begin
|
||||
outb($A1, $01);
|
||||
outb($21, $00);
|
||||
outb($A1, $00);
|
||||
console.writestringln('IRQ: INIT END.');
|
||||
console.outputln('IRQ','INIT END.');
|
||||
end;
|
||||
|
||||
end.
|
||||
+2
-2
@@ -24,7 +24,7 @@ implementation
|
||||
|
||||
procedure init();
|
||||
begin
|
||||
console.writestringln('ISR: INIT START.');
|
||||
console.outputln('ISR','INIT START.');
|
||||
ISR0.register(); // Divide-By-Zero
|
||||
ISR1.register(); // Debug
|
||||
ISR2.register(); // Non-Maskable Inturrupt
|
||||
@@ -49,7 +49,7 @@ begin
|
||||
ISR33.register(); // Keyboard
|
||||
ISR40.register(); // 1024/s Timer
|
||||
ISR44.register(); // Mouse
|
||||
console.writestringln('ISR: INIT END.');
|
||||
console.outputln('ISR','INIT END.');
|
||||
end;
|
||||
|
||||
end.
|
||||
+7
-6
@@ -89,8 +89,8 @@ begin
|
||||
|
||||
if (multibootmagic <> MULTIBOOT_BOOTLOADER_MAGIC) then begin
|
||||
console.setdefaultattribute(console.combinecolors(Red, Black));
|
||||
console.writestringln('Multiboot Compliant Boot-Loader Needed!');
|
||||
console.writestringln('HALTING');
|
||||
console.outputln('KERNEL', 'Multiboot Compliant Boot-Loader Needed!');
|
||||
console.outputln('KERNEL', 'HALTING.');
|
||||
util.halt_and_catch_fire;
|
||||
end;
|
||||
|
||||
@@ -99,9 +99,10 @@ begin
|
||||
MOV dds, CS
|
||||
end;
|
||||
if dds = $08 then begin
|
||||
console.writestringlnex('GDT: LOAD SUCCESS.', console.combinecolors(Green, Black));
|
||||
console.outputln('KERNEL', 'GDT: LOAD SUCCESS.');
|
||||
end else begin
|
||||
console.writestringlnex('GDT: LOAD FAIL.', console.combinecolors(Red, Black));
|
||||
console.outputln('KERNEL', 'GDT: LOAD FAIL.');
|
||||
console.outputln('KERNEL', 'HALTING.');
|
||||
halt_and_catch_fire;
|
||||
end;
|
||||
|
||||
@@ -121,7 +122,7 @@ begin
|
||||
isr32.hook(uint32(@bios_data_area.tick_update));
|
||||
|
||||
//drivers
|
||||
console.writestringln('DRIVERS: INIT BEGIN.');
|
||||
console.outputln('KERNEL', 'DRIVERS: INIT BEGIN.');
|
||||
keyboard.init(keyboard_layout);
|
||||
mouse.init();
|
||||
testdriver.init();
|
||||
@@ -130,7 +131,7 @@ begin
|
||||
//Nothing beyond here
|
||||
USB.init();
|
||||
pci.init();
|
||||
console.writestringln('DRIVERS: INIT END.');
|
||||
console.outputln('KERNEL', 'DRIVERS: INIT END.');
|
||||
|
||||
console.writestringln('');
|
||||
console.setdefaultattribute(console.combinecolors(Green, Black));
|
||||
|
||||
@@ -86,7 +86,7 @@ var
|
||||
i : uint32;
|
||||
|
||||
begin
|
||||
console.writestringln('LMM: INIT BEGIN.');
|
||||
console.outputln('LMM','INIT BEGIN.');
|
||||
Root_Page:= PHeapPage(new_lmm_page);
|
||||
Search_Page:= Root_Page;
|
||||
Root_Page^.Next_Page:= 0;
|
||||
@@ -96,7 +96,7 @@ begin
|
||||
Root_Page^.Entries[i].Root:= False;
|
||||
Root_Page^.Entries[i].Last:= False;
|
||||
end;
|
||||
console.writestringln('LMM: INIT END.');
|
||||
console.outputln('LMM','INIT END.');
|
||||
end;
|
||||
|
||||
function kpalloc(address : uint32) : void;
|
||||
|
||||
@@ -109,15 +109,15 @@ end;
|
||||
|
||||
procedure init;
|
||||
begin
|
||||
console.writestringln('PMM: INIT BEGIN.');
|
||||
console.outputln('PMM','INIT BEGIN.');
|
||||
walk_memory_map;
|
||||
force_alloc_block(0, 0);
|
||||
force_alloc_block(1, 0);
|
||||
force_alloc_block(2, 0); //First 12MiB reserved for Kernel/BIOS.
|
||||
console.writestring('PMM: ');
|
||||
console.output('PMM',' ');
|
||||
console.writeword(nPresent);
|
||||
console.writestringln('/1024 Block Available for Allocation.');
|
||||
console.writestringln('PMM: INIT END.');
|
||||
console.outputln('PMM','INIT END.');
|
||||
end;
|
||||
|
||||
function alloc_block(block : uint16; caller : uint32) : boolean;
|
||||
|
||||
+2
-2
@@ -105,7 +105,7 @@ end;
|
||||
|
||||
procedure init;
|
||||
begin
|
||||
console.writestringln('SCHEDULER: INIT BEGIN.');
|
||||
console.outputln('SCHEDULER','INIT BEGIN.');
|
||||
Root_Task:= PScheduler_Entry(kalloc(sizeof(TScheduler_Entry)));
|
||||
Root_Task^.ThreadID:= 0;
|
||||
Root_Task^.Priority:= 1;
|
||||
@@ -116,7 +116,7 @@ begin
|
||||
Active:= False;
|
||||
isr32.hook(uint32(@delta));
|
||||
terminal.registerCommand('TASKS', @terminal_command_tasks, 'List Active Processes.');
|
||||
console.writestringln('SCHEDULER: INIT END.');
|
||||
console.outputln('SCHEDULER','INIT END.');
|
||||
end;
|
||||
|
||||
end.
|
||||
+2
-2
@@ -79,7 +79,7 @@ var
|
||||
cCR3 : uint32;
|
||||
|
||||
begin
|
||||
console.writestringln('TSS: INIT BEGIN.');
|
||||
console.outputln('TSS','INIT BEGIN.');
|
||||
ptrTaskStateSegment^.ss0:= $08;
|
||||
ptrTaskStateSegment^.iomap:= sizeof(TTaskStateSegment)-1;
|
||||
asm
|
||||
@@ -95,7 +95,7 @@ begin
|
||||
mov AX, 40
|
||||
ltr AX
|
||||
end;
|
||||
console.writestringln('TSS: INIT END.');
|
||||
console.outputln('TSS','INIT END.');
|
||||
end;
|
||||
|
||||
end.
|
||||
@@ -90,13 +90,13 @@ var
|
||||
i : uint32;
|
||||
|
||||
begin
|
||||
console.writestringln('VMM: INIT BEGIN.');
|
||||
console.outputln('VMM','INIT BEGIN.');
|
||||
PageDirectory:= load_current_page_directory;
|
||||
KERNEL_PAGE_DIRECTORY:= PageDirectory;
|
||||
map_page(KERNEL_PAGE_NUMBER + 1, 1);
|
||||
map_page(KERNEL_PAGE_NUMBER + 2, 2);
|
||||
map_page(KERNEL_PAGE_NUMBER + 3, 3);
|
||||
console.writestringln('VMM: INIT END.');
|
||||
console.outputln('VMM','INIT END.');
|
||||
end;
|
||||
|
||||
function map_page_ex(page_number : uint16; block : uint16; PD : PPageDirectory) : boolean;
|
||||
@@ -139,7 +139,7 @@ var
|
||||
rldpd : uint32;
|
||||
|
||||
begin
|
||||
map_page:= false;
|
||||
map_page:= false;
|
||||
PageDirectory^[page_number].Present:= true;
|
||||
addr:= block;
|
||||
PageDirectory^[page_number].Address:= addr SHL 10;
|
||||
|
||||
Reference in New Issue
Block a user