aboutsummaryrefslogtreecommitdiff
path: root/kernel_stage2.ld
diff options
context:
space:
mode:
authorWojtek Kosior <kwojtus@protonmail.com>2019-12-28 21:54:42 +0100
committerWojtek Kosior <kwojtus@protonmail.com>2019-12-28 21:54:42 +0100
commit700f4c412d42c9b9811269045c0e363a0331bba9 (patch)
tree260feed1ca657843d993c1ae73e93f25a17cede1 /kernel_stage2.ld
parent80c9af17330ac442a4c3d6d55b4041cbe923e9b4 (diff)
downloadrpi-MMU-example-700f4c412d42c9b9811269045c0e363a0331bba9.tar.gz
rpi-MMU-example-700f4c412d42c9b9811269045c0e363a0331bba9.zip
split kernel into 2 stages; second stage gets copied to 0x0 and runs from there
Diffstat (limited to 'kernel_stage2.ld')
-rw-r--r--kernel_stage2.ld52
1 files changed, 52 insertions, 0 deletions
diff --git a/kernel_stage2.ld b/kernel_stage2.ld
new file mode 100644
index 0000000..d3a23bf
--- /dev/null
+++ b/kernel_stage2.ld
@@ -0,0 +1,52 @@
+/* This sesond stage of the kernel is run from address 0x0 */
+
+TRANSLATION_TABLE_SIZE = 4096 * 4;
+MMU_SECTION_SIZE = 1 << 20;
+
+SECTIONS
+{
+
+ . = 0x0;
+
+ __start = .;
+ .kernel_stage2 :
+ {
+ KEEP(interrupt_vector.o)
+ . = ALIGN(4);
+ ramfs_embeddable.o
+ (*)
+ }
+ __end = .;
+
+ . = ALIGN(1 << 14);
+
+ .translation_table (NOLOAD) :
+ {
+ _translation_table_start = .;
+
+ . = . + TRANSLATION_TABLE_SIZE;
+
+ _translation_table_end = .;
+ }
+
+ . = ALIGN(1 << 20);
+ . = . + MMU_SECTION_SIZE;
+
+ .stack (NOLOAD) :
+ {
+ _stack_start = .;
+
+ . = . + MMU_SECTION_SIZE;
+
+ _stack_top = .;
+ }
+
+ .unprivileged_memory (NOLOAD) :
+ {
+ _unprivileged_memory_start = .;
+
+ . = . + MMU_SECTION_SIZE;
+
+ _unprivileged_memory_end = .;
+ }
+}