aboutsummaryrefslogtreecommitdiff
path: root/sys/riscv
diff options
context:
space:
mode:
authorMitchell Horne <mhorne@FreeBSD.org>2020-01-17 17:03:25 +0000
committerMitchell Horne <mhorne@FreeBSD.org>2020-01-17 17:03:25 +0000
commit7fdf7f9183508099458d93fb936d9bf5fc1a6061 (patch)
tree0d20aec7f37f00e5dfa51546c12f8b71e42faba7 /sys/riscv
parent36e33a8ef05e3a13250d3c09d5c14977fa31b0a4 (diff)
Notes
Diffstat (limited to 'sys/riscv')
-rw-r--r--sys/riscv/riscv/locore.S29
1 files changed, 17 insertions, 12 deletions
diff --git a/sys/riscv/riscv/locore.S b/sys/riscv/riscv/locore.S
index 0d4466da610c..8d3b89897c3e 100644
--- a/sys/riscv/riscv/locore.S
+++ b/sys/riscv/riscv/locore.S
@@ -53,6 +53,12 @@
.text
.globl _start
_start:
+ /* Set the global pointer */
+.option push
+.option norelax
+ lla gp, __global_pointer$
+.option pop
+
/* Get the physical address kernel loaded to */
lla t0, virt_map
ld t1, 0(t0)
@@ -168,6 +174,11 @@ _start:
.align 2
va:
+ /* Set the global pointer again, this time with the virtual address. */
+.option push
+.option norelax
+ lla gp, __global_pointer$
+.option pop
/* Setup supervisor trap vector */
la t0, cpu_exception_handler
@@ -177,12 +188,6 @@ va:
li t0, 0
csrw sscratch, t0
- /* Set the global pointer */
-.option push
-.option norelax
- la gp, __global_pointer$
-.option pop
-
/* Initialize stack pointer */
la s3, initstack_end
mv sp, s3
@@ -322,6 +327,12 @@ ENTRY(mpentry)
.align 2
mpva:
+ /* Set the global pointer again, this time with the virtual address. */
+.option push
+.option norelax
+ lla gp, __global_pointer$
+.option pop
+
/* Setup supervisor trap vector */
la t0, cpu_exception_handler
csrw stvec, t0
@@ -330,12 +341,6 @@ mpva:
li t0, 0
csrw sscratch, t0
- /* Set the global pointer */
-.option push
-.option norelax
- la gp, __global_pointer$
-.option pop
-
call init_secondary
END(mpentry)
#endif