aboutsummaryrefslogtreecommitdiff
path: root/defs/x86_64-linker.ld
diff options
context:
space:
mode:
authorTianhao Wang <shrik3@mailbox.org>2024-05-29 19:53:52 +0200
committerTianhao Wang <shrik3@mailbox.org>2024-06-11 15:17:11 +0200
commitcd658673a35df8b0da3551e819e26d35c18b89f2 (patch)
tree74c209b519290eb43545e800b88ddf9dfa796a7a /defs/x86_64-linker.ld
parent9cf85e88211512b0410f9bb9f2f19ea4ce9a8190 (diff)
mm: add stack based PMA
use 8MiB reserved array to manage up to 4GiB of physical memory (4K Pages only) Signed-off-by: Tianhao Wang <shrik3@mailbox.org>
Diffstat (limited to 'defs/x86_64-linker.ld')
-rw-r--r--defs/x86_64-linker.ld11
1 files changed, 11 insertions, 0 deletions
diff --git a/defs/x86_64-linker.ld b/defs/x86_64-linker.ld
index 39d8876..ac4a86c 100644
--- a/defs/x86_64-linker.ld
+++ b/defs/x86_64-linker.ld
@@ -84,5 +84,16 @@ SECTIONS
}
. = ALIGN(4096);
+ /* reserve space for a premitive stack based physical frame allocator */
+ /* each frame is 4KiB in size and has a 64bit (physical) address. e.g. */
+ /* for every 1 GiB physical memory we need 2 MiB space reserved for the */
+ /* free stack. For a easier bootstraping we are using a fix-sized stack */
+ /* array. Currently using 4GiB, therefore reserve 8MiB. */
+ PROVIDE (___FREE_PAGE_STACK__ = .);
+ .global_free_page_stack ALIGN(4096) (NOLOAD) :
+ {
+ *("..global_free_page_stack")
+ }
+ . = ALIGN(4096);
PROVIDE (___KERNEL_END__ = .);
}