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

This commit is contained in:
kieron
2018-05-22 03:33:51 +00:00
parent 4a1d7a942d
commit 8066634367
97 changed files with 422 additions and 123 deletions

View File

@ -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

9
src/include/types.pas Normal file
View File

@ -0,0 +1,9 @@
unit types;
interface
{ THIS IS JUST HERE SO THAT VM PLAYS NICE WITHOUT CHANGES }
implementation
end.

View File

@ -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);