git-svn-id: https://spexeah.com:8443/svn/Asuro@746 6dbc8c32-bb84-406f-8558-d1cf31a0ab0c
This commit is contained in:
1 parent
4a1d7a942d
commit
8066634367
97 files changed
+422
-123
No files matched your search
+20
-80
File diff suppressed because it is too large.
Load diff
@@ -3,7 +3,7 @@ unit serial;
|
||||
interface
|
||||
|
||||
uses
|
||||
util, isrmanager;
|
||||
util, isrmanager, strings;
|
||||
|
||||
const
|
||||
COM1 = $3F8;
|
||||
@@ -14,6 +14,7 @@ const
|
||||
procedure init();
|
||||
function receive(PORT : uint16; timeout : uint32) : uint8;
|
||||
function send(PORT : uint16; data : uint8; timeout : uint32) : boolean;
|
||||
function sendString(str : pchar) : boolean;
|
||||
|
||||
implementation
|
||||
|
||||
@@ -85,4 +86,17 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function sendString(str : pchar) : boolean;
|
||||
var
|
||||
i : uint32;
|
||||
|
||||
begin
|
||||
sendString:= true;
|
||||
for i:=0 to StringSize(str)-1 do begin
|
||||
sendString:= sendString AND send(COM1, uint8(str[i]), 10000);
|
||||
end;
|
||||
sendString:= sendString AND send(COM1, uint8(13), 10000);
|
||||
sendString:= sendString AND send(COM1, uint8(10), 10000);
|
||||
end;
|
||||
|
||||
end.
|
||||
+16
-12
@@ -22,6 +22,7 @@ function MACToIIPv4(mac : puint8) : puint8;
|
||||
procedure sendGratuitous;
|
||||
procedure sendRequest(ip : puint8);
|
||||
procedure send(hType : uint16; pType : uint16; op : uint16; p_context : PPacketContext);
|
||||
function resolveIP(ip : puint8) : puint8;
|
||||
|
||||
implementation
|
||||
|
||||
@@ -67,18 +68,6 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function findCacheRecord(ip : puint8) : PARPCacheRecord;
|
||||
var
|
||||
CacheRecord : PARPCacheRecord;
|
||||
|
||||
begin
|
||||
CacheRecord:= findCacheRecordByIP(ip);
|
||||
if CacheRecord = nil then begin
|
||||
|
||||
end;
|
||||
findCacheRecord:= CacheRecord;
|
||||
end;
|
||||
|
||||
procedure send(hType : uint16; pType : uint16; op : uint16; p_context : PPacketContext);
|
||||
var
|
||||
buf : void;
|
||||
@@ -171,6 +160,21 @@ begin
|
||||
sendRequestGateway(ip);
|
||||
end;
|
||||
|
||||
function resolveIP(ip : puint8) : puint8;
|
||||
var
|
||||
CacheRecord : PARPCacheRecord;
|
||||
|
||||
begin
|
||||
CacheRecord:= findCacheRecordByIP(ip);
|
||||
resolveIP:= nil;
|
||||
if CacheRecord = nil then begin
|
||||
sendRequest(ip);
|
||||
sendRequestGateway(ip);
|
||||
end else begin
|
||||
resolveIP:= @CacheRecord^.MAC[0];
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure recv(p_data : void; p_len : uint16; p_context : PPacketContext);
|
||||
var
|
||||
Header : PARPHeader;
|
||||
|
||||
+179
-4
File diff suppressed because it is too large.
Load diff
@@ -45,9 +45,7 @@ procedure register();
|
||||
begin
|
||||
if not registered then begin
|
||||
asm
|
||||
mov al, $36
|
||||
out $46, al
|
||||
mov ax, 1165
|
||||
mov ax, 1193
|
||||
out $40, al
|
||||
mov al, ah
|
||||
out $40, al
|
||||
|
||||
@@ -3,20 +3,20 @@ unit asuro;
|
||||
interface
|
||||
|
||||
const
|
||||
VERSION = '1.0.1-728ia';
|
||||
VERSION = '1.0.1-745ia';
|
||||
VERSION_MAJOR = '1';
|
||||
VERSION_MINOR = '0';
|
||||
VERSION_SUB = '1';
|
||||
REVISION = '728';
|
||||
REVISION = '745';
|
||||
RELEASE = 'ia';
|
||||
LINE_COUNT = 28522;
|
||||
FILE_COUNT = 90;
|
||||
LINE_COUNT = 29372;
|
||||
FILE_COUNT = 110;
|
||||
DRIVER_COUNT = 32;
|
||||
FPC_VERSION = '2.6.4';
|
||||
NASM_VERSION = '2.10.09';
|
||||
MAKE_VERSION = '3.81';
|
||||
COMPILE_DATE = '13/05/18';
|
||||
COMPILE_TIME = '16:34:39';
|
||||
COMPILE_DATE = '22/05/18';
|
||||
COMPILE_TIME = '04:31:53';
|
||||
|
||||
implementation
|
||||
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
unit types;
|
||||
|
||||
interface
|
||||
|
||||
{ THIS IS JUST HERE SO THAT VM PLAYS NICE WITHOUT CHANGES }
|
||||
|
||||
implementation
|
||||
|
||||
end.
|
||||
@@ -53,6 +53,8 @@ function get32bitcounter : uint32;
|
||||
function get64bitcounter : uint64;
|
||||
function getTSC : uint64;
|
||||
|
||||
function div6432(dividend : uint64; divisor : uint32) : uint64;
|
||||
|
||||
function BCDToUint8(bcd : uint8) : uint8;
|
||||
|
||||
function HexCharToDecimal(hex : char) : uint8;
|
||||
@@ -61,6 +63,8 @@ procedure resetSystem();
|
||||
|
||||
function getESP : uint32;
|
||||
|
||||
function MsSinceSystemBoot : uint64;
|
||||
|
||||
var
|
||||
endptr : uint32; external name '__end';
|
||||
stack : uint32; external name 'KERNEL_STACK';
|
||||
@@ -70,6 +74,33 @@ implementation
|
||||
uses
|
||||
console, RTC, cpu;
|
||||
|
||||
function MsSinceSystemBoot : uint64;
|
||||
begin
|
||||
MsSinceSystemBoot:= div6432(getTSC, (CPUID.ClockSpeed.Hz div 1000));
|
||||
end;
|
||||
|
||||
function div6432(dividend : uint64; divisor : uint32) : uint64;
|
||||
var
|
||||
d0, d4 : uint32;
|
||||
r0, r4 : uint32;
|
||||
|
||||
begin
|
||||
d4:= dividend SHR 32;
|
||||
d0:= dividend AND $FFFFFFFF;
|
||||
asm
|
||||
PUSHAD
|
||||
xor edx, edx
|
||||
mov eax, d4
|
||||
div divisor
|
||||
mov r4, eax
|
||||
mov eax, d0
|
||||
div divisor
|
||||
mov r0, eax
|
||||
POPAD
|
||||
end;
|
||||
div6432:= (r0 SHL 32) OR r4;
|
||||
end;
|
||||
|
||||
function switchendian32(b : uint32) : uint32;
|
||||
begin
|
||||
switchendian32:= ((b AND $FF000000) SHR 24) OR
|
||||
@@ -254,6 +285,7 @@ begin
|
||||
POP EDX
|
||||
POP EAX
|
||||
end;
|
||||
io_wait;
|
||||
end;
|
||||
|
||||
procedure outw(port : uint16; val : uint16); [public, alias: 'util_outw'];
|
||||
@@ -267,6 +299,7 @@ begin
|
||||
POP EDX
|
||||
POP EAX
|
||||
end;
|
||||
io_wait;
|
||||
end;
|
||||
|
||||
procedure outb(port : uint16; val : uint8); [public, alias: 'util_outb'];
|
||||
@@ -280,6 +313,7 @@ begin
|
||||
POP EDX
|
||||
POP EAX
|
||||
end;
|
||||
io_wait;
|
||||
end;
|
||||
|
||||
procedure halt_and_catch_fire(); [public, alias: 'util_halt_and_catch_fire'];
|
||||
@@ -307,6 +341,7 @@ begin
|
||||
POP EDX
|
||||
POP EAX
|
||||
end;
|
||||
io_wait;
|
||||
end;
|
||||
|
||||
function inw(port : uint16) : uint16; [public, alias: 'util_inw'];
|
||||
@@ -320,6 +355,7 @@ begin
|
||||
POP EDX
|
||||
POP EAX
|
||||
end;
|
||||
io_wait;
|
||||
end;
|
||||
|
||||
function inb(port : uint16) : uint8; [public, alias: 'util_inb'];
|
||||
@@ -333,6 +369,7 @@ begin
|
||||
POP EDX
|
||||
POP EAX
|
||||
end;
|
||||
io_wait;
|
||||
end;
|
||||
|
||||
procedure memset(location : uint32; value : uint8; size : uint32);
|
||||
|
||||
+42
-14
@@ -43,7 +43,9 @@ uses
|
||||
splash,
|
||||
cpu,
|
||||
themer,
|
||||
netlog;
|
||||
netlog,
|
||||
vmlog,
|
||||
vm;
|
||||
|
||||
procedure kmain(mbinfo: Pmultiboot_info_t; mbmagic: uint32); stdcall;
|
||||
|
||||
@@ -97,6 +99,9 @@ var
|
||||
l : PLinkedListBase;
|
||||
|
||||
begin
|
||||
{ Serial Init }
|
||||
serial.init();
|
||||
|
||||
{ Store Multiboot info }
|
||||
multibootinfo:= mbinfo;
|
||||
multibootmagic:= mbmagic;
|
||||
@@ -133,6 +138,15 @@ begin
|
||||
BSOD('GDT', 'Failed to load the GDT correctly.');
|
||||
end;
|
||||
|
||||
console.output('MULTIBOOT', 'Assigned Framebuffer: ');
|
||||
console.writehexln(multibootinfo^.framebuffer_addr);
|
||||
console.output('MULTIBOOT', 'Assigned Framebuffer Metrics: ');
|
||||
console.writeint(multibootinfo^.framebuffer_width);
|
||||
console.writestring('x');
|
||||
console.writeint(multibootinfo^.framebuffer_height);
|
||||
console.writestring('x');
|
||||
console.writeintln(multibootinfo^.framebuffer_bpp);
|
||||
|
||||
{ Memory/CPU Init }
|
||||
idt.init();
|
||||
irq.init();
|
||||
@@ -151,9 +165,6 @@ begin
|
||||
{ CPUID }
|
||||
cpu.init();
|
||||
|
||||
{ Serial Init }
|
||||
serial.init();
|
||||
|
||||
{ Call Tracer }
|
||||
tracer.init();
|
||||
|
||||
@@ -184,7 +195,7 @@ begin
|
||||
{ Bus Drivers }
|
||||
tracer.push_trace('kmain.BUSDRV');
|
||||
console.outputln('KERNEL', 'BUS DRIVERS: INIT BEGIN.');
|
||||
USB.init();
|
||||
//USB.init();
|
||||
pci.init();
|
||||
console.outputln('KERNEL', 'BUS DRIVERS: INIT END.');
|
||||
|
||||
@@ -192,26 +203,43 @@ begin
|
||||
tracer.push_trace('kmain.NETDRV');
|
||||
net.init;
|
||||
|
||||
tracer.push_trace('kmain.VMINIT');
|
||||
vm.init();
|
||||
|
||||
{ Init Progs }
|
||||
tracer.push_trace('kmain.SHELLINIT');
|
||||
shell.init();
|
||||
tracer.push_trace('kmain.MEMVIEWINIT');
|
||||
memview.init();
|
||||
tracer.push_trace('kmain.THEMERINIT');
|
||||
themer.init();
|
||||
tracer.push_trace('kmain.NETLOGINIT');
|
||||
netlog.init();
|
||||
tracer.push_trace('kmain.VMLOGINIT');
|
||||
vmlog.init();
|
||||
|
||||
terminal.run();
|
||||
|
||||
{ Init Splash }
|
||||
tracer.push_trace('kmain.SPLASHINIT');
|
||||
splash.init();
|
||||
|
||||
{ End of Boot }
|
||||
tracer.push_trace('kmain.EOB');
|
||||
|
||||
console.writestringln('');
|
||||
console.setdefaultattribute(console.combinecolors($17E0, $0000));
|
||||
console.writestringln('Asuro Booted Correctly!');
|
||||
console.setdefaultattribute(console.combinecolors($FFFF, $0000));
|
||||
|
||||
{ Init Progs }
|
||||
shell.init();
|
||||
memview.init();
|
||||
themer.init();
|
||||
netlog.init();
|
||||
|
||||
{ Init Splash }
|
||||
splash.init();
|
||||
|
||||
tracer.push_trace('kmain.END');
|
||||
|
||||
tracer.push_trace('kmain.TICK');
|
||||
while true do begin
|
||||
tracer.push_trace('kmain.RedrawWindows');
|
||||
console.redrawWindows;
|
||||
tracer.push_trace('kmain.VMTick');
|
||||
vm.tick();
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
@@ -125,7 +125,7 @@ begin
|
||||
force_alloc_block(2, 0); //First 12MiB reserved for Kernel/BIOS.
|
||||
force_alloc_block(3, 0);
|
||||
console.output('PMM',' ');
|
||||
console.writeword(nPresent);
|
||||
console.writeint(nPresent);
|
||||
console.writestringln('/1024 Block Available for Allocation.');
|
||||
console.outputln('PMM','INIT END.');
|
||||
pop_trace;
|
||||
|
||||
@@ -27,6 +27,8 @@ procedure run(Params : PParamList);
|
||||
begin
|
||||
if Handle = 0 then begin
|
||||
Handle:= newWindow(20, 40, 63, 14, 'NETLOG');
|
||||
clearWND(Handle);
|
||||
registerEventHandler(Handle, EVENT_CLOSE, void(@OnClose));
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
+15
-1
@@ -3,7 +3,7 @@ unit shell;
|
||||
interface
|
||||
|
||||
uses
|
||||
Console, RTC, terminal, strings, asuro;
|
||||
Console, RTC, terminal, strings, asuro, tracer;
|
||||
|
||||
procedure init();
|
||||
function getTaskbarColorsPtr : puint32;
|
||||
@@ -197,24 +197,38 @@ end;
|
||||
|
||||
procedure init();
|
||||
begin
|
||||
tracer.push_trace('shell.init.1');
|
||||
Takbar_Colors:= console.combinecolors($0000, $FFFF);
|
||||
tracer.push_trace('shell.init.2');
|
||||
Explore_Colors:= console.combinecolors($01C3, $07EE);
|
||||
tracer.push_trace('shell.init.3');
|
||||
Desktop_Colors:= console.combinecolors($FFFF, $34DB);
|
||||
|
||||
tracer.push_trace('shell.init.4');
|
||||
DesktopHandle:= Console.newWindow(0, 0, 159, 63, 'DESKTOP');
|
||||
tracer.push_trace('shell.init.5');
|
||||
TaskBarHandle:= Console.newWindow(0, 63, 159, 1, 'SHELL');
|
||||
|
||||
tracer.push_trace('shell.init.6');
|
||||
console.bordersEnabled(TaskBarHandle, false);
|
||||
tracer.push_trace('shell.init.7');
|
||||
console.setShellWindow(TaskBarHandle, false);
|
||||
|
||||
tracer.push_trace('shell.init.8');
|
||||
console.bordersEnabled(DesktopHandle, false);
|
||||
tracer.push_trace('shell.init.9');
|
||||
console.setShellWindow(DesktopHandle, false);
|
||||
|
||||
tracer.push_trace('shell.init.10');
|
||||
console.registerEventHandler(TaskBarHandle, EVENT_DRAW, void(@Draw));
|
||||
tracer.push_trace('shell.init.11');
|
||||
console.registerEventHandler(TaskBarHandle, EVENT_MOUSE_CLICK, void(@OnMouseClick));
|
||||
tracer.push_trace('shell.init.12');
|
||||
console.registerEventHandler(DesktopHandle, EVENT_DRAW, void(@onBaseDraw));
|
||||
|
||||
tracer.push_trace('shell.init.13');
|
||||
terminal.registerCommand('BACKGROUND', @Command_Background, 'Hide/Show background - usage: BACKGROUND <hide/show>');
|
||||
tracer.push_trace('shell.init.14');
|
||||
terminal.registerCommand('COLORS', @Command_Colors, 'Set the desktop colors');
|
||||
end;
|
||||
|
||||
|
||||
+23
-1
@@ -71,7 +71,7 @@ function done(id : uint32) : boolean;
|
||||
implementation
|
||||
|
||||
uses
|
||||
RTC;
|
||||
RTC, cpu;
|
||||
|
||||
var
|
||||
TERMINAL_HWND : HWND = 0;
|
||||
@@ -520,6 +520,27 @@ begin
|
||||
terminal.halt(555, @teapot_halt);
|
||||
end;
|
||||
|
||||
var
|
||||
c1, c2 : uint64;
|
||||
first : boolean = true;
|
||||
|
||||
procedure testt(Params : PParamList);
|
||||
var
|
||||
diff : uint32;
|
||||
|
||||
begin
|
||||
if first then begin
|
||||
c1:= Counters.c64;
|
||||
first:= false;
|
||||
end else begin
|
||||
c2:= Counters.c64;
|
||||
diff:= c2 - c1;
|
||||
writeIntWND(diff, getTerminalHWND);
|
||||
writeStringlnWND('ms', getTerminalHWND);
|
||||
c1:= c2;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure init;
|
||||
begin
|
||||
console.writestringln('TERMINAL: INIT BEGIN.');
|
||||
@@ -533,6 +554,7 @@ begin
|
||||
registerCommandEx('SERIAL', @SendSerial, 'Send ''helloworld'' through COM1.', true);
|
||||
registerCommand('REBOOT', @Reboot, 'Reboot the system.');
|
||||
registerCommandEx('LOLWUT', @teapot, '?', true);
|
||||
registerCommandEx('TEST', @testt, '?', true);
|
||||
console.writestringln('TERMINAL: INIT END.');
|
||||
end;
|
||||
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
unit vmlog;
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
console, terminal, keyboard, util, strings, tracer;
|
||||
|
||||
procedure init();
|
||||
function getVMLogHWND : HWND;
|
||||
|
||||
implementation
|
||||
|
||||
var
|
||||
Handle : HWND = 0;
|
||||
|
||||
function getVMLogHWND : HWND;
|
||||
begin
|
||||
getVMLogHWND:= Handle;
|
||||
end;
|
||||
|
||||
procedure OnClose();
|
||||
begin
|
||||
Handle:= 0;
|
||||
end;
|
||||
|
||||
procedure run(Params : PParamList);
|
||||
begin
|
||||
if Handle = 0 then begin
|
||||
Handle:= newWindow(20, 40, 63, 14, 'VMLOG');
|
||||
clearWND(Handle);
|
||||
registerEventHandler(Handle, EVENT_CLOSE, void(@OnClose));
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure init();
|
||||
begin
|
||||
tracer.push_trace('vmlog.init');
|
||||
terminal.registerCommand('VMLOG', @Run, 'View virtual-machine event log.');
|
||||
end;
|
||||
|
||||
end.
|
||||
Reference in new issue
Block a user