aboutsummaryrefslogtreecommitdiff
path: root/arch/riscv64/kernel/core_bringup.S
diff options
context:
space:
mode:
authorKimplul <kimi.h.kuparinen@gmail.com>2024-07-07 07:00:43 +0300
committerKimplul <kimi.h.kuparinen@gmail.com>2024-07-07 07:00:43 +0300
commit122374c362ba8bb9082385da3c82e264ab594f15 (patch)
tree0123fad5464aaf64f522d48f5069b35b90207aae /arch/riscv64/kernel/core_bringup.S
parent03e12129927b0deba537a11bb5575bef93c57d0f (diff)
downloadkmi-122374c362ba8bb9082385da3c82e264ab594f15.tar.gz
kmi-122374c362ba8bb9082385da3c82e264ab594f15.zip
smp now seems to work
+ Had some minor issues with a wraparound of size_t that effectively meant that some regions were allocated twice. Also, booting should be a bit more reliable now, turned out that the previous iteration of the booting was just accidentally working due to the kernel being placed 'close enough' in RAM to where it was linked to. Fixed by allocating a vmem of O1 that maps the kernel to a 2MiB boundary at boot, pretty nifty.
Diffstat (limited to 'arch/riscv64/kernel/core_bringup.S')
-rw-r--r--arch/riscv64/kernel/core_bringup.S9
1 files changed, 7 insertions, 2 deletions
diff --git a/arch/riscv64/kernel/core_bringup.S b/arch/riscv64/kernel/core_bringup.S
index 83b017c..8a5a6f5 100644
--- a/arch/riscv64/kernel/core_bringup.S
+++ b/arch/riscv64/kernel/core_bringup.S
@@ -12,12 +12,17 @@ riscv_bringup:
sfence.vma
/* fetch the stack allocated to us at our hart index in smp_init_stacks */
- lla t0, smp_init_stacks
+ lui t0, %hi(smp_init_stacks)
+ addi t0, t0, %lo(smp_init_stacks)
slli t1, a0, RW_SHIFT
add t0, t0, t1
lr sp, 0(t0)
mv tp, sp
+ /* calculate actual address in kernelspace where we should jump to */
+ /* a0 has RAM base */
+ lui t0, %hi(core_bringup)
+ addi t0, t0, %lo(core_bringup)
+
/* jump to C to handle rest of bringup */
- lla t0, core_bringup
jr t0