diff options
Diffstat (limited to 'arch')
| -rw-r--r-- | arch/riscv64/kernel/entry.S | 6 | ||||
| -rw-r--r-- | arch/riscv64/kernel/proc.c | 7 |
2 files changed, 6 insertions, 7 deletions
diff --git a/arch/riscv64/kernel/entry.S b/arch/riscv64/kernel/entry.S index 8ff642a..db662bb 100644 --- a/arch/riscv64/kernel/entry.S +++ b/arch/riscv64/kernel/entry.S @@ -87,7 +87,8 @@ handle_syscall: * twice */ csrr s0, CSR_SEPC addi s0, s0, 4 - csrw CSR_SEPC, s0 + /* store execution continuation point */ + sr s0, 0(tp) /* allocate space for sys_ret structure on stack and shift argument * registers down one to make room for the pointer to this structure */ addi sp, sp, -sizeof_sys_ret @@ -112,6 +113,9 @@ handle_syscall: /* get associated kernel stack */ mv sp, tp addi sp, sp, -sizeof_registers + /* set execution continuation */ + lr s0, 0(tp) + csrw CSR_SEPC, s0 /* restore system call result */ j restore_noreturn diff --git a/arch/riscv64/kernel/proc.c b/arch/riscv64/kernel/proc.c index ab833b2..f85f597 100644 --- a/arch/riscv64/kernel/proc.c +++ b/arch/riscv64/kernel/proc.c @@ -15,6 +15,7 @@ stat_t 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); __asm__ volatile ("mv sp, %0\n" : : "r" (t->thread_stack_top) : "memory"); __asm__ volatile ("mv a0, %0\n" : : "r" (fdt) : ); __asm__ volatile ("sret\n" ::: "memory"); @@ -22,12 +23,6 @@ stat_t run_init(struct tcb *t, void *fdt) return ERR_ADDR; } -stat_t set_return(vm_t v) -{ - csr_write(CSR_SEPC, v); - return OK; -} - stat_t set_ipc(struct tcb *t, id_t pid, id_t tid) { struct riscv_regs *r = (struct riscv_regs *)(--t); |
