Files
Asuro/src/include/system.pas
Kieron Morris 208bda92c8 Kernel Size Awareness
Modified the linker script + Added an init function to System.pas to be called at system boot, this allows tracking of the Kernel start & end addresses, and thus, allows us to calculate the kernel size.
2022-02-06 13:29:29 +00:00

165 lines
3.8 KiB
ObjectPascal

// Copyright 2021 Kieron Morris & Aaron Hance
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
{
Include->System - Base Types & Structures.
@author(Kieron Morris <kjm@kieronmorris.me>)
@author(Aaron Hance <ah@aaronhance.me>)
}
unit system;
interface
const
KERNEL_VIRTUAL_BASE = $C0000000;
KERNEL_PAGE_NUMBER = KERNEL_VIRTUAL_BASE SHR 22;
BSOD_ENABLE = true;
TRACER_ENABLE = true;
CONSOLE_SLOW_REDRAW = false; //Redraws the Window manager after every character, but slows performance.
type
//internal types
cardinal = 0..$FFFFFFFF;
hresult = cardinal;
dword = cardinal;
integer = longint;
pchar = ^char;
//Standard Types
uInt8 = BYTE;
uInt16 = WORD;
uInt32 = DWORD;
uInt64 = QWORD;
uint128 = packed record
case Integer of
0: (
Hi : uint64;
Lo : uint64;
);
1: (
DWords : array [0..3] of uint32;
);
2: (
Words : array [0..7] of uint16;
);
3: (
Bytes : array [0..15] of uint8;
);
end;
sInt8 = shortint;
sInt16 = smallint;
sInt32 = integer;
sInt64 = longint;
Float = Single;
//Pointer Types
PuByte = ^Byte;
PuInt8 = PuByte;
PuInt16 = ^uInt16;
PuInt32 = ^uInt32;
PuInt64 = ^uInt64;
PuInt128 = ^uint128;
PsInt8 = ^sInt8;
PsInt16 = ^sInt16;
PsInt32 = ^sInt32;
PsInt64 = ^sInt64;
PFloat = ^Float;
PDouble = ^Double;
Void = ^uInt32;
HWND = uint32;
yord = uInt8;
xord = uInt8;
zord = uInt16;
//Alternate Types
UBit1 = 0..(1 shl 01) - 1;
UBit2 = 0..(1 shl 02) - 1;
UBit3 = 0..(1 shl 03) - 1;
UBit4 = 0..(1 shl 04) - 1;
UBit5 = 0..(1 shl 05) - 1;
UBit6 = 0..(1 shl 06) - 1;
UBit7 = 0..(1 shl 07) - 1;
UBit9 = 0..(1 shl 09) - 1;
UBit10 = 0..(1 shl 10) - 1;
UBit11 = 0..(1 shl 11) - 1;
UBit12 = 0..(1 shl 12) - 1;
UBit13 = 0..(1 shl 13) - 1;
UBit14 = 0..(1 shl 14) - 1;
UBit15 = 0..(1 shl 15) - 1;
UBit16 = 0..(1 shl 16) - 1;
UBit17 = 0..(1 shl 17) - 1;
UBit18 = 0..(1 shl 18) - 1;
UBit19 = 0..(1 shl 19) - 1;
UBit20 = 0..(1 shl 20) - 1;
UBit21 = 0..(1 shl 21) - 1;
UBit22 = 0..(1 shl 22) - 1;
UBit23 = 0..(1 shl 23) - 1;
UBit24 = 0..(1 shl 24) - 1;
UBit25 = 0..(1 shl 25) - 1;
UBit26 = 0..(1 shl 26) - 1;
UBit27 = 0..(1 shl 27) - 1;
UBit28 = 0..(1 shl 28) - 1;
UBit30 = 0..(1 shl 30) - 1;
UBit31 = 0..(1 shl 31) - 1;
TBitMask = bitpacked record
b0,b1,b2,b3,b4,b5,b6,b7 : Boolean;
end;
PBitMask = ^TBitMask;
TMask = bitpacked array[0..7] of Boolean;
PMask = ^TMask;
TRGB565 = bitpacked record
B : UBit5;
G : UBit6;
R : UBit5
end;
PRGB565 = ^TRGB565;
TRGB565Pair = bitpacked record
Background : TRGB565;
Foreground : TRGB565;
end;
PRGB565Pair = ^TRGB565Pair;
PText = ^Text;
var
AK_START : uint32; external name 'kernel_start';
AK_END : uint32; external name 'kernel_end';
ASURO_KERNEL_START : uint32;
ASURO_KERNEL_END : uint32;
ASURO_KERNEL_SIZE : uint32;
procedure init();
implementation
procedure init();
begin
ASURO_KERNEL_START := uint32(@AK_START);
ASURO_KERNEL_END := uint32(@AK_END);
ASURO_KERNEL_SIZE:= ASURO_KERNEL_END - ASURO_KERNEL_START;
end;
end.