git-svn-id: https://spexeah.com:8443/svn/Asuro@496 6dbc8c32-bb84-406f-8558-d1cf31a0ab0c

This commit is contained in:
kieron 2018-04-11 17:11:13 +00:00
parent 7303cb9dd7
commit 82a497430f
67 changed files with 96 additions and 10 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.

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.

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.

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.

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.

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

@ -37,6 +37,8 @@ procedure init();
procedure clear(); procedure clear();
procedure setdefaultattribute(attribute : char); procedure setdefaultattribute(attribute : char);
procedure disable_cursor;
procedure writechar(character : char); procedure writechar(character : char);
procedure writecharln(character : char); procedure writecharln(character : char);
procedure writecharex(character : char; attributes : char); procedure writecharex(character : char; attributes : char);
@ -121,6 +123,12 @@ var
Console_Matrix : P2DVideoMemory = P2DVideoMemory($C00b8000); Console_Matrix : P2DVideoMemory = P2DVideoMemory($C00b8000);
Console_Cursor : TCoord; Console_Cursor : TCoord;
procedure disable_cursor;
begin
outb($3D4, $0A);
outb($3D5, $20);
end;
procedure init(); [public, alias: 'console_init']; procedure init(); [public, alias: 'console_init'];
Begin Begin
Console_Properties.Default_Attribute:= console.combinecolors(White, Black); Console_Properties.Default_Attribute:= console.combinecolors(White, Black);

View File

@ -3,6 +3,7 @@ unit USB;
interface interface
uses uses
tracer,
Console, Console,
PCI, PCI,
drivertypes, drivertypes,
@ -49,6 +50,7 @@ var
MMR : POHCI_MMR; MMR : POHCI_MMR;
begin begin
push_trace('USB.loadOHCI');
devices:= PCI.getDeviceInfo($0C, $03, $10, count); devices:= PCI.getDeviceInfo($0C, $03, $10, count);
console.output('USB-OHCI Driver', 'Found '); console.output('USB-OHCI Driver', 'Found ');
console.writeint(count); console.writeint(count);
@ -70,6 +72,7 @@ begin
end; end;
end; end;
loadOHCI:= true; loadOHCI:= true;
pop_trace;
end; end;
function loadUHCI(ptr : void) : boolean; function loadUHCI(ptr : void) : boolean;
@ -79,6 +82,7 @@ var
i : uint32; i : uint32;
begin begin
push_trace('USB.loadUHCI');
devices:= PCI.getDeviceInfo($0C, $03, $00, count); devices:= PCI.getDeviceInfo($0C, $03, $00, count);
console.output('USB-UHCI Driver','Found '); console.output('USB-UHCI Driver','Found ');
console.writeint(count); console.writeint(count);
@ -96,6 +100,7 @@ begin
end; end;
end; end;
loadUHCI:= true; loadUHCI:= true;
pop_trace;
end; end;
procedure init; procedure init;
@ -103,6 +108,7 @@ var
UHCI_ID, OHCI_ID : TDeviceIdentifier; UHCI_ID, OHCI_ID : TDeviceIdentifier;
begin begin
push_trace('USB.init');
console.outputln('USB Driver', 'INIT BEGIN.'); console.outputln('USB Driver', 'INIT BEGIN.');
UHCI_ID.Bus:= biPCI; UHCI_ID.Bus:= biPCI;
@ -125,6 +131,7 @@ begin
drivermanagement.register_driver('USB-OHCI Driver', @OHCI_ID, @loadOHCI); drivermanagement.register_driver('USB-OHCI Driver', @OHCI_ID, @loadOHCI);
console.outputln('USB Driver', 'INIT END.'); console.outputln('USB Driver', 'INIT END.');
pop_trace;
end; end;
end. end.

View File

@ -3,7 +3,7 @@ unit testdriver;
interface interface
uses uses
console, drivermanagement; tracer, console, drivermanagement;
procedure init; procedure init;
@ -11,7 +11,9 @@ implementation
function load(ptr : void) : boolean; function load(ptr : void) : boolean;
begin begin
console.outputln('DUMMY DRIVER', 'LOADED.') push_trace('testdriver.load');
console.outputln('DUMMY DRIVER', 'LOADED.');
pop_trace;
end; end;
procedure init; procedure init;
@ -19,6 +21,7 @@ var
devID : TDeviceIdentifier; devID : TDeviceIdentifier;
begin begin
push_trace('testdriver.init');
devID.bus:= biPCI; { PCI BUS } devID.bus:= biPCI; { PCI BUS }
devID.id0:= idANY; { ANY DEVICE ID } devID.id0:= idANY; { ANY DEVICE ID }
devID.id1:= $00000006; { CLASS } devID.id1:= $00000006; { CLASS }
@ -27,6 +30,7 @@ begin
devID.id4:= idANY; devID.id4:= idANY;
devID.ex:= nil; { NO EXTENDED INFO } devID.ex:= nil; { NO EXTENDED INFO }
drivermanagement.register_driver('DUMMY DRIVER', @devID, @load); drivermanagement.register_driver('DUMMY DRIVER', @devID, @load);
pop_trace;
end; end;
end. end.

View File

@ -45,6 +45,12 @@ procedure set_gate(Number : uint8; Base : uint32; Selector : uint16; Flags : uin
implementation implementation
procedure load(idt_pointer : uint32); assembler; nostackframe;
asm
MOV EAX, idt_pointer
LIDT [EAX]
end;
procedure set_gate(Number : uint8; Base : uint32; Selector : uint16; Flags : uint8); procedure set_gate(Number : uint8; Base : uint32; Selector : uint16; Flags : uint8);
begin begin
IDT_Entries[Number].base_high:= (Base and $FFFF0000) SHR 16; IDT_Entries[Number].base_high:= (Base and $FFFF0000) SHR 16;
@ -55,12 +61,7 @@ begin
console.output('IDT','GATE '); console.output('IDT','GATE ');
console.writeint(Number); console.writeint(Number);
console.writestringln(' SET.'); console.writestringln(' SET.');
end; load(uint32(@IDT_Pointer));
procedure load(idt_pointer : uint32); assembler; nostackframe;
asm
MOV EAX, idt_pointer
LIDT [EAX]
end; end;
procedure init(); procedure init();

View File

@ -16,6 +16,7 @@ interface
uses uses
bios_data_area, tracer; bios_data_area, tracer;
function INTE : boolean;
procedure CLI(); procedure CLI();
procedure STI(); procedure STI();
procedure GPF(); procedure GPF();
@ -32,6 +33,7 @@ procedure outl(port : uint16; val : uint32);
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 io_wait;
procedure memset(location : uint32; value : uint8; size : uint32); procedure memset(location : uint32; value : uint8; size : uint32);
procedure memcpy(source : uint32; dest : uint32; size : uint32); procedure memcpy(source : uint32; dest : uint32; size : uint32);
@ -52,6 +54,38 @@ implementation
uses uses
console; console;
function INTE : boolean;
var
flags : uint32;
begin
asm
PUSH EAX
PUSHF
POP EAX
MOV flags, EAX
POP EAX
end;
INTE:= (flags AND (1 SHL 9)) > 0;
end;
procedure io_wait;
var
port : uint8;
val : uint8;
begin
port:= $80;
val:= 0;
asm
PUSH EAX
PUSH EDX
MOV DX, port
MOV AL, val
OUT DX, AL
POP EDX
POP EAX
end;
end;
procedure printmemory(source : uint32; length : uint32; col : uint32; delim : PChar; offset_row : boolean); procedure printmemory(source : uint32; length : uint32; col : uint32; delim : PChar; offset_row : boolean);
var var
buf : puint8; buf : puint8;
@ -269,6 +303,7 @@ var
z : uint32; z : uint32;
begin begin
disable_cursor;
if not BSOD_ENABLE then exit; if not BSOD_ENABLE then exit;
console.setdefaultattribute(console.combinecolors(white, Red)); console.setdefaultattribute(console.combinecolors(white, Red));
console.clear; console.clear;

View File

@ -21,15 +21,25 @@ procedure init();
begin begin
console.outputln('IRQ','INIT START.'); console.outputln('IRQ','INIT START.');
outb($20, $11); outb($20, $11);
io_wait;
outb($A0, $11); outb($A0, $11);
io_wait;
outb($21, $20); outb($21, $20);
io_wait;
outb($A1, $28); outb($A1, $28);
io_wait;
outb($21, $04); outb($21, $04);
io_wait;
outb($A1, $02); outb($A1, $02);
io_wait;
outb($21, $01); outb($21, $01);
io_wait;
outb($A1, $01); outb($A1, $01);
io_wait;
outb($21, $00); outb($21, $00);
io_wait;
outb($A1, $00); outb($A1, $00);
io_wait;
console.outputln('IRQ','INIT END.'); console.outputln('IRQ','INIT END.');
end; end;

View File

@ -97,9 +97,11 @@ var
begin begin
{ Store Multiboot info }
multibootinfo:= mbinfo; multibootinfo:= mbinfo;
multibootmagic:= mbmagic; multibootmagic:= mbmagic;
{ Ensure tracer is frozen }
tracer.freeze(); tracer.freeze();
{ Console Init } { Console Init }
@ -144,16 +146,25 @@ begin
tss.init(); tss.init();
scheduler.init(); scheduler.init();
{ Management Interfaces } { Call Tracer }
tracer.init(); tracer.init();
{ Management Interfaces }
tracer.push_trace('kmain.DRVMGMT');
drivermanagement.init(); drivermanagement.init();
tracer.pop_trace;
tracer.push_trace('kmain.STRMGMT');
storagemanagement.init(); storagemanagement.init();
tracer.pop_trace;
{ Hook Timer for Ticks } { Hook Timer for Ticks }
tracer.push_trace('kmain.TMR');
STI; STI;
isr32.hook(uint32(@bios_data_area.tick_update)); isr32.hook(uint32(@bios_data_area.tick_update));
tracer.pop_trace;
{ Device Drivers } { Device Drivers }
tracer.push_trace('kmain.DEVDRV');
console.outputln('KERNEL', 'DEVICE DRIVERS: INIT BEGIN.'); console.outputln('KERNEL', 'DEVICE DRIVERS: INIT BEGIN.');
keyboard.init(keyboard_layout); keyboard.init(keyboard_layout);
mouse.init(); mouse.init();
@ -161,26 +172,36 @@ begin
E1000.init(); E1000.init();
IDE.init(); IDE.init();
console.outputln('KERNEL', 'DEVICE DRIVERS: INIT END.'); console.outputln('KERNEL', 'DEVICE DRIVERS: INIT END.');
tracer.pop_trace;
{ Bus Drivers } { Bus Drivers }
tracer.push_trace('kmain.BUSDRV');
console.outputln('KERNEL', 'BUS DRIVERS: INIT BEGIN.'); console.outputln('KERNEL', 'BUS DRIVERS: INIT BEGIN.');
USB.init(); USB.init();
pci.init(); pci.init();
console.outputln('KERNEL', 'BUS DRIVERS: INIT END.'); console.outputln('KERNEL', 'BUS DRIVERS: INIT END.');
tracer.pop_trace;
{ Network Stack } { Network Stack }
tracer.push_trace('kmain.NETDRV');
net.init; net.init;
tracer.pop_trace;
{ End of Boot } { End of Boot }
tracer.push_trace('kmain.EOB');
console.writestringln(''); console.writestringln('');
console.setdefaultattribute(console.combinecolors(Green, Black)); console.setdefaultattribute(console.combinecolors(Green, Black));
console.writestringln('Asuro Booted Correctly!'); console.writestringln('Asuro Booted Correctly!');
console.setdefaultattribute(console.combinecolors(White, Black)); console.setdefaultattribute(console.combinecolors(White, Black));
console.writestringln(''); console.writestringln('');
console.writestringln('Press any key to boot in to Asuro Terminal...'); console.writestringln('Press any key to boot in to Asuro Terminal...');
tracer.pop_trace;
tracer.push_trace('kmain.KEYHOOK');
keyboard.hook(@temphook); keyboard.hook(@temphook);
tracer.pop_trace;
tracer.push_trace('kmain.END');
util.halt_and_dont_catch_fire; util.halt_and_dont_catch_fire;
end; end;