aboutsummaryrefslogtreecommitdiff
path: root/arch/riscv64/kernel/proc.c
diff options
context:
space:
mode:
authorKimplul <kimi.h.kuparinen@gmail.com>2024-01-10 17:45:09 +0200
committerKimplul <kimi.h.kuparinen@gmail.com>2024-01-10 17:45:09 +0200
commita5cfead3bd0761ba22a07a4e168670dfb7c9fb84 (patch)
tree8081f1ba46f93b6788b94c167e16cba700b9fbb1 /arch/riscv64/kernel/proc.c
parent23207f0393be1776fdcc224248b7e7d88c1bf622 (diff)
downloadkmi-a5cfead3bd0761ba22a07a4e168670dfb7c9fb84.tar.gz
kmi-a5cfead3bd0761ba22a07a4e168670dfb7c9fb84.zip
some kmx alleviations
Diffstat (limited to 'arch/riscv64/kernel/proc.c')
-rw-r--r--arch/riscv64/kernel/proc.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/arch/riscv64/kernel/proc.c b/arch/riscv64/kernel/proc.c
index a7721e2..4e4d7ec 100644
--- a/arch/riscv64/kernel/proc.c
+++ b/arch/riscv64/kernel/proc.c
@@ -15,9 +15,9 @@
#include "regs.h"
#include "csr.h"
-void run_init(struct tcb *t, void *fdt)
+void run_init(struct tcb *t, void *fdt, void *initrd)
{
- /** \todo actually map fdt into the target address space */
+ /** \todo actually map fdt and initrd into the target address space */
csr_write(CSR_SSCRATCH, t);
csr_write(CSR_SEPC, t->exec);
/* gcc gives a warning 'the value of the stack pointer after an asm
@@ -27,10 +27,15 @@ void run_init(struct tcb *t, void *fdt)
* Could be fixed with a separate pure asm run_init, but I guess this
* works for now.
*/
- __asm__ volatile ("mv sp, %0\n" : : "r" (t->thread_stack_top) : "memory");
- __asm__ volatile ("mv a0, %0\n" : : "r" (t->tid) : "a0");
- __asm__ volatile ("mv a1, %0\n" : : "r" (fdt) : "a1");
- __asm__ volatile ("sret\n" ::: "memory");
+ __asm__ volatile ("mv sp, %0\n"
+ "mv a0, %1\n"
+ "mv a1, %2\n"
+ "mv a2, %3\n"
+ "sret\n"
+ :
+ : "r" (t->thread_stack_top), "r" (t->tid), "r" (fdt),
+ "r" (initrd)
+ : "memory");
/* we should never reach this */
unreachable();
}