X-Git-Url: https://git.libre-soc.org/?p=riscv-tests.git;a=blobdiff_plain;f=benchmarks%2Fcommon%2Fsyscalls.c;h=ce6d6535176ca80f62900ddd865244c2a5b22252;hp=b1c100dd10ce0830bc4ac68c921cd397f8bfd316;hb=d6f8add254375a8005794320ed66d40a58f43dac;hpb=211d78276b07b17f831cefaf79961d3e6dad3c90 diff --git a/benchmarks/common/syscalls.c b/benchmarks/common/syscalls.c index b1c100d..ce6d653 100644 --- a/benchmarks/common/syscalls.c +++ b/benchmarks/common/syscalls.c @@ -22,8 +22,8 @@ static long handle_frontend_syscall(long which, long arg0, long arg1, long arg2) magic_mem[2] = arg1; magic_mem[3] = arg2; __sync_synchronize(); - write_csr(tohost, (long)magic_mem); - while (swap_csr(fromhost, 0) == 0); + write_csr(mtohost, (long)magic_mem); + while (swap_csr(mfromhost, 0) == 0); return magic_mem[0]; } @@ -60,9 +60,9 @@ static int handle_stats(int enable) return 0; } -static void tohost_exit(int code) +void tohost_exit(long code) { - write_csr(tohost, (code << 1) | 1); + write_csr(mtohost, (code << 1) | 1); while (1); } @@ -75,7 +75,7 @@ long handle_trap(long cause, long epc, long regs[32]) if (cause == CAUSE_ILLEGAL_INSTRUCTION && (*(int*)epc & *csr_insn) == *csr_insn) ; - else if (cause != CAUSE_ECALL) + else if (cause != CAUSE_USER_ECALL) tohost_exit(1337); else if (regs[17] == SYS_exit) tohost_exit(regs[10]);