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.
This commit is contained in:
Kieron Morris 2022-02-06 13:29:29 +00:00
parent 346dc4e4c9
commit 208bda92c8
3 changed files with 21 additions and 1 deletions

View File

@ -2,7 +2,7 @@ ENTRY(loader)
SECTIONS SECTIONS
{ {
. = 0xC0100000; . = 0xC0100000;
kernel_start = .;
.text : AT(ADDR(.text) - 0xC0000000) .text : AT(ADDR(.text) - 0xC0000000)
{ {
text = .; _text = .; __text = .; text = .; _text = .; __text = .;
@ -33,4 +33,5 @@ SECTIONS
. = ALIGN(4096); . = ALIGN(4096);
} }
end = .; _end = .; __end = .; end = .; _end = .; __end = .;
kernel_end = .;
} }

View File

@ -143,6 +143,22 @@ type
PText = ^Text; 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 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. end.

View File

@ -125,6 +125,9 @@ var
HM : PHashMap; HM : PHashMap;
begin begin
{ Init the base system unit }
System.init();
{ Serial Init } { Serial Init }
serial.init(); serial.init();