diff --git a/Asuro.iso b/Asuro.iso index 87783d83..836b0a85 100644 Binary files a/Asuro.iso and b/Asuro.iso differ diff --git a/bin/kernel.bin b/bin/kernel.bin index dea6f544..49e125c4 100755 Binary files a/bin/kernel.bin and b/bin/kernel.bin differ diff --git a/iso/boot/asuro.bin b/iso/boot/asuro.bin index dea6f544..49e125c4 100755 Binary files a/iso/boot/asuro.bin and b/iso/boot/asuro.bin differ diff --git a/lib/PCI.ppu b/lib/PCI.ppu index 0eb8253b..647adb0e 100644 Binary files a/lib/PCI.ppu and b/lib/PCI.ppu differ diff --git a/lib/console.ppu b/lib/console.ppu index b46f9f8a..d7c7cbb8 100644 Binary files a/lib/console.ppu and b/lib/console.ppu differ diff --git a/lib/kernel.ppu b/lib/kernel.ppu index 139ef09d..361f6889 100644 Binary files a/lib/kernel.ppu and b/lib/kernel.ppu differ diff --git a/lib/libpconsole.a b/lib/libpconsole.a index f223ed6f..3b6445d0 100644 Binary files a/lib/libpconsole.a and b/lib/libpconsole.a differ diff --git a/lib/libpmultiboot.a b/lib/libpmultiboot.a index 6b675a98..ea4dec4b 100644 Binary files a/lib/libpmultiboot.a and b/lib/libpmultiboot.a differ diff --git a/lib/libpsystem.a b/lib/libpsystem.a index 23da724a..e1a70ee0 100644 Binary files a/lib/libpsystem.a and b/lib/libpsystem.a differ diff --git a/lib/scheduler.ppu b/lib/scheduler.ppu index 372da0c7..1da47fe8 100644 Binary files a/lib/scheduler.ppu and b/lib/scheduler.ppu differ diff --git a/src/kernel.pas b/src/kernel.pas index 97a45b50..d5bf8944 100644 --- a/src/kernel.pas +++ b/src/kernel.pas @@ -40,6 +40,19 @@ begin Terminal.run; end; +procedure terminal_command_meminfo(buffer : TCommandBuffer); +begin + console.writestring('Lower Memory = '); + console.writeint(multibootinfo^.mem_lower); + console.writestringln('KB'); + console.writestring('Higher Memory = '); + console.writeint(multibootinfo^.mem_upper); + console.writestringln('KB'); + console.writestring('Total Memory = '); + console.writeint(((multibootinfo^.mem_upper + 1000) div 1024) + 1); + console.writestringln('MB'); +end; + procedure kmain(mbinfo: Pmultiboot_info_t; mbmagic: uint32); stdcall; [public, alias: 'kmain']; var c : uint8; @@ -55,6 +68,9 @@ begin multibootinfo:= mbinfo; multibootmagic:= mbmagic; + terminal.init(); + terminal.registerCommand('MEMINFO', @terminal_command_meminfo, 'Print Simple Memory Information.'); + console.init(); console.writestringln('Booting Asuro...'); @@ -103,13 +119,13 @@ begin console.writestringln(''); console.setdefaultattribute(console.combinecolors(White, Black)); console.writestring('Lower Memory = '); - console.writeint(mbinfo^.mem_lower); + console.writeint(multibootinfo^.mem_lower); console.writestringln('KB'); console.writestring('Higher Memory = '); - console.writeint(mbinfo^.mem_upper); + console.writeint(multibootinfo^.mem_upper); console.writestringln('KB'); console.writestring('Total Memory = '); - console.writeint(((mbinfo^.mem_upper + 1000) div 1024) + 1); + console.writeint(((multibootinfo^.mem_upper + 1000) div 1024) + 1); console.writestringln('MB'); console.setdefaultattribute(console.combinecolors(White, Black)); console.writestringln(''); diff --git a/src/scheduler.pas b/src/scheduler.pas index 4739ad82..de42aa4f 100644 --- a/src/scheduler.pas +++ b/src/scheduler.pas @@ -14,7 +14,8 @@ interface uses console, isr32, - lmemorymanager; + lmemorymanager, + terminal; const Quantum = 64; @@ -79,6 +80,29 @@ begin end; end; +procedure terminal_command_tasks(buffer : TCommandBuffer); +var + list : PScheduler_Entry; + +begin + console.writestringln('ThreadID - Priority - Delta'); + list:= Root_Task; + console.writeint(list^.ThreadID); + console.writestring(' - '); + console.writeint(list^.Priority); + console.writestring(' - '); + console.writeintln(list^.Delta); + list:= PScheduler_Entry(list^.Next); + while list <> Root_Task do begin + console.writeint(list^.ThreadID); + console.writestring(' - '); + console.writeint(list^.Priority); + console.writestring(' - '); + console.writeintln(list^.Delta); + list:= PScheduler_Entry(list^.Next); + end; +end; + procedure init; begin console.writestringln('SCHEDULER: INIT BEGIN.'); @@ -91,6 +115,7 @@ begin Tick:= 0; Active:= False; isr32.hook(uint32(@delta)); + terminal.registerCommand('TASKS', @terminal_command_tasks, 'List Active Processes.'); console.writestringln('SCHEDULER: INIT END.'); end; diff --git a/src/terminal.pas b/src/terminal.pas index 2248ff1b..255493a2 100644 --- a/src/terminal.pas +++ b/src/terminal.pas @@ -11,9 +11,10 @@ type TCommandBuffer = array[0..1023] of byte; TCommandMethod = procedure(buf : TCommandBuffer); TCommand = record - registered : boolean; - command : pchar; - method : TCommandMethod; + registered : boolean; + command : pchar; + method : TCommandMethod; + description : pchar; end; var @@ -22,16 +23,37 @@ var Commands : array[0..65534] of TCommand; procedure run; -procedure registerCommand(command : pchar; method : TCommandMethod); +procedure init; +procedure registerCommand(command : pchar; method : TCommandMethod; description : pchar); implementation -procedure version(buffer : TCommandBuffer); +procedure clear(buffer : TCommandBuffer); begin - writestringln('Asuro v1.0'); + console.clear(); end; -procedure registerCommand(command : pchar; method : TCommandMethod); +procedure version(buffer : TCommandBuffer); +begin + console.writestringln('Asuro v1.0'); +end; + +procedure help(buffer : TCommandBuffer); +var + i : uint32; +begin + console.writestringln('Registered Commands: '); + for i:=0 to 65534 do begin + if Commands[i].Registered then begin + console.writestring(' '); + console.writestring(Commands[i].command); + console.writestring(' - '); + console.writestringln(Commands[i].description); + end; + end; +end; + +procedure registerCommand(command : pchar; method : TCommandMethod; description : pchar); var index : uint32; @@ -41,6 +63,7 @@ begin Commands[index].registered:= true; Commands[index].Command:= command; Commands[index].method:= method; + Commands[index].description:= description; end; procedure upper; @@ -63,7 +86,10 @@ var begin isCommand:= true; for i:=0 to bIndex do begin - if char(buffer[i]) = ' ' then exit; + if char(buffer[i]) = ' ' then begin + if i = 0 then isCommand:= false; + exit; + end; if char(buffer[i]) <> char(command[i]) then begin isCommand:= false; exit; @@ -117,11 +143,17 @@ begin end; end; -procedure run; +procedure init; begin memset(uint32(@Commands[0]), 0, 65535*sizeof(TCommand)); memset(uint32(@buffer[0]), 0, 1024); - registerCommand('VERSION', @version); + registerCommand('VERSION', @version, 'Display the running version of Asuro.'); + registerCommand('CLEAR', @clear, 'Clear the Screen.'); + registerCommand('HELP', @help, 'Lists all registered commands and their description.') +end; + +procedure run; +begin keyboard.hook(@key_event); console.clear(); console.writestring('Asuro#> ');