diff options
| author | Kimplul <kimi.h.kuparinen@gmail.com> | 2023-08-04 20:50:41 +0300 |
|---|---|---|
| committer | Kimplul <kimi.h.kuparinen@gmail.com> | 2023-08-04 20:50:41 +0300 |
| commit | e16f5f81dfb2e97a554ec19b941ec05a7942fd2d (patch) | |
| tree | 46f0609b5be009d4d1057fa02ece4461732941e0 /arch/riscv64/kernel/core_bringup.S | |
| parent | 5f30284181fcfe5b16dfb94d4fba9a9ed4a2dc6a (diff) | |
| download | kmi-e16f5f81dfb2e97a554ec19b941ec05a7942fd2d.tar.gz kmi-e16f5f81dfb2e97a554ec19b941ec05a7942fd2d.zip | |
add initial smp bringup
Diffstat (limited to 'arch/riscv64/kernel/core_bringup.S')
| -rw-r--r-- | arch/riscv64/kernel/core_bringup.S | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/arch/riscv64/kernel/core_bringup.S b/arch/riscv64/kernel/core_bringup.S new file mode 100644 index 0000000..aff9b0b --- /dev/null +++ b/arch/riscv64/kernel/core_bringup.S @@ -0,0 +1,23 @@ +#include "asm.h" + +/* pic forces core_bringup to be placed in .got that we can access both from + * direct mapped and virtual memory. Which is kind of strange, as core_bringup() + * is fixed in place by the VM, so it could be possible to just load the address + * directly into a register, but apparently that's annoying to do */ +.option pic +.global riscv_bringup +riscv_bringup: + /* immediately switch to virtual memory through argument in a1 */ + csrw satp, a1 + sfence.vma + + /* fetch the stack allocated to us at our hart index in smp_init_stacks */ + la t0, smp_init_stacks + slli t1, a0, RW_SHIFT + add t0, t0, t1 + lr sp, 0(t0) + mv tp, sp + + /* jump to C to handle rest of bringup */ + la t0, core_bringup + jr t0 |
