From e25f1e7a8f8f2320546ad4950464713d85b47785 Mon Sep 17 00:00:00 2001 From: Kimplul Date: Mon, 21 Nov 2022 18:01:25 +0200 Subject: fix llvm --- arch/riscv64/kernel/proc.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'arch/riscv64/kernel/proc.c') diff --git a/arch/riscv64/kernel/proc.c b/arch/riscv64/kernel/proc.c index 1990523..0f19789 100644 --- a/arch/riscv64/kernel/proc.c +++ b/arch/riscv64/kernel/proc.c @@ -20,9 +20,16 @@ void run_init(struct tcb *t, void *fdt) /** \todo actually map fdt 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 + * statement must be the same as it was before the statement', so this + * is technically speaking undefined behavior, I think. + * + * 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) : ); - __asm__ volatile ("mv a1, %0\n" : : "r" (fdt) : ); + __asm__ volatile ("mv a0, %0\n" : : "r" (t->tid) : "a0"); + __asm__ volatile ("mv a1, %0\n" : : "r" (fdt) : "a1"); __asm__ volatile ("sret\n" ::: "memory"); /* we should never reach this */ unreachable(); -- cgit v1.3