From 122374c362ba8bb9082385da3c82e264ab594f15 Mon Sep 17 00:00:00 2001 From: Kimplul Date: Sun, 7 Jul 2024 07:00:43 +0300 Subject: 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. --- arch/riscv64/kernel/start.S | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'arch/riscv64/kernel/start.S') diff --git a/arch/riscv64/kernel/start.S b/arch/riscv64/kernel/start.S index 73a442e..5a2ed61 100644 --- a/arch/riscv64/kernel/start.S +++ b/arch/riscv64/kernel/start.S @@ -24,12 +24,11 @@ ret .section .text -/* a0 is fdt, a1 is load_addr, a2 is d, a3 is ram_base, a4 is DMAP */ +/* a0 is fdt, a1 is load_addr, a2 is d, a3 is ram_base */ .global to_kernelspace to_kernelspace: -lla t0, kernel -add t0, t0, a4 -sub t0, t0, a3 -add sp, sp, a4 -sub sp, sp, a3 +li t1, VM_DMAP +add sp, sp, t1 +lui t0, %hi(kernel) +addi t0, t0, %lo(kernel) jr t0 -- cgit v1.3