aboutsummaryrefslogtreecommitdiffstats
path: root/arch/riscv/kernel/head.S
diff options
context:
space:
mode:
authorSean Anderson <seanga2@gmail.com>2020-10-22 16:30:12 -0400
committerPalmer Dabbelt <palmerdabbelt@google.com>2020-11-05 17:32:27 -0800
commit79605f1394261995c2b955c906a5a20fb27cdc84 (patch)
tree9cdc800e4ee872c9985f755c98c9e10cab2e855d /arch/riscv/kernel/head.S
parentRISC-V: Remove any memblock representing unusable memory area (diff)
downloadlinux-dev-79605f1394261995c2b955c906a5a20fb27cdc84.tar.xz
linux-dev-79605f1394261995c2b955c906a5a20fb27cdc84.zip
riscv: Set text_offset correctly for M-Mode
M-Mode Linux is loaded at the start of RAM, not 2MB later. Perhaps this should be calculated based on PAGE_OFFSET somehow? Even better would be to deprecate text_offset and instead introduce something absolute. Signed-off-by: Sean Anderson <seanga2@gmail.com> Signed-off-by: Palmer Dabbelt <palmerdabbelt@google.com>
Diffstat (limited to '')
-rw-r--r--arch/riscv/kernel/head.S5
1 files changed, 5 insertions, 0 deletions
diff --git a/arch/riscv/kernel/head.S b/arch/riscv/kernel/head.S
index 11e2a4fe66e0..7e849797c9c3 100644
--- a/arch/riscv/kernel/head.S
+++ b/arch/riscv/kernel/head.S
@@ -35,6 +35,10 @@ ENTRY(_start)
.word 0
#endif
.balign 8
+#ifdef CONFIG_RISCV_M_MODE
+ /* Image load offset (0MB) from start of RAM for M-mode */
+ .dword 0
+#else
#if __riscv_xlen == 64
/* Image load offset(2MB) from start of RAM */
.dword 0x200000
@@ -42,6 +46,7 @@ ENTRY(_start)
/* Image load offset(4MB) from start of RAM */
.dword 0x400000
#endif
+#endif
/* Effective size of kernel image */
.dword _end - _start
.dword __HEAD_FLAGS