summaryrefslogtreecommitdiff
path: root/arch/arm64/kernel/tashaboot.lds
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm64/kernel/tashaboot.lds')
-rw-r--r--arch/arm64/kernel/tashaboot.lds24
1 files changed, 24 insertions, 0 deletions
diff --git a/arch/arm64/kernel/tashaboot.lds b/arch/arm64/kernel/tashaboot.lds
index 4f8dfb1..e2b7954 100644
--- a/arch/arm64/kernel/tashaboot.lds
+++ b/arch/arm64/kernel/tashaboot.lds
@@ -12,6 +12,14 @@ ENTRY(_start)
SECTIONS
{
+ /*
+ * the first 64 bytes are the arm64 Image header: code0 'b' over
+ * it, magic ARM\x64, text_offset 0. qemu -kernel parses the
+ * header, loads the file at 0x40000000 and enters at
+ * 0x40000000, where the branch lands on reset at 0x40000040.
+ * without the header qemu guesses text_offset 0x80000 and runs
+ * the whole loader from the wrong address.
+ */
. = 0x40000000;
__image_copy_start = .;
@@ -21,6 +29,12 @@ SECTIONS
{
arch/arm64/kernel/start.o (.text.boot)
*(.text.boot)
+
+ /* the Image header, code0 branches over it */
+ . = ALIGN(64);
+ *(.text.imgheader)
+ . = ALIGN(64);
+
*(.text*)
}
@@ -52,6 +66,16 @@ SECTIONS
. = ALIGN(8);
__bss_end = .;
+ /*
+ * the stack lives in its own region, clear of bss. page tables
+ * and buffers are bss objects, a stack sharing their address
+ * space grows down into them and the first deep call crushes
+ * whatever it meets.
+ */
+ . = ALIGN(4096);
+ __stack_bottom = .;
+ . += 0x4000;
+ __stack_top = .;
__image_copy_end = .;
/DISCARD/ : { *(.dynsym) }