aboutsummaryrefslogtreecommitdiff
path: root/arch/riscv64/kernel/proc.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/riscv64/kernel/proc.c')
-rw-r--r--arch/riscv64/kernel/proc.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/arch/riscv64/kernel/proc.c b/arch/riscv64/kernel/proc.c
index a4746b4..af4b2f3 100644
--- a/arch/riscv64/kernel/proc.c
+++ b/arch/riscv64/kernel/proc.c
@@ -18,9 +18,8 @@
void run_init(struct tcb *t, vm_t fdt, vm_t initrd)
{
- /** \todo actually map fdt and initrd into the target address space */
csr_write(CSR_SSCRATCH, t);
- csr_write(CSR_SEPC, t->exec);
+ csr_write(CSR_SEPC, t->callback);
/* gcc gives a warning 'the value of the stack pointer after an asm
* statement must be the same as it was before the statement', so this
* is technically speaking undefined behavior, I think.
@@ -31,13 +30,16 @@ void run_init(struct tcb *t, vm_t fdt, vm_t initrd)
vm_t stack_top = t->thread_stack + t->thread_stack_size;
bkl_unlock();
__asm__ volatile ("mv sp, %0\n"
- "mv a0, %1\n"
- "mv a1, %2\n"
+ "li a0, %1\n"
+ "li a1, %2\n"
"mv a2, %3\n"
+ "mv a3, %4\n"
+ "mv a4, %5\n"
"sret\n"
:
- : "r" (stack_top), "r" (t->tid), "r" (fdt),
- "r" (initrd)
+ : "r" (stack_top),
+ "K"(0), "K"(SYS_USER_BOOTED),
+ "r" (t->tid), "r" (fdt), "r" (initrd)
: "memory");
/* we should never reach this */
unreachable();