baremetal: fix heap and stack position in preparation for CLI arguments

This commit is contained in:
Ciro Santilli 六四事件 法轮功
2020-04-01 02:00:01 +00:00
parent 6bb20c0386
commit e25e79c26b
9 changed files with 58 additions and 11 deletions

View File

@@ -1,3 +1,4 @@
/* https://cirosantilli.com/linux-kernel-module-cheat#baremetal-linker-script */
ENTRY(_start)
SECTIONS
{
@@ -10,10 +11,18 @@ SECTIONS
}
/* gem5 uses the bss as a measure of the kernel size. */
.bss : { *(.bss) }
heap_low = .;
/* Fix the addresses of everything that comes after, no matter
* the exact size of the code present in .text. This allows us to
* place CLI arguments in memory at a known location! */
. = ADDR(.text) + 0x1000000;
lkmc_heap_low = .;
. = . + 0x1000000;
heap_top = .;
lkmc_heap_top = .;
. = . + 0x1000000;
stack_top = .;
lkmc_stack_top = .;
. = . + 0x1000000;
lkmc_argv = .;
. = . + 0x4;
lkmc_argc = .;
}