Fix benchmark compilation/execution on RV32
[riscv-tests.git] / benchmarks / common / syscalls.c
index c8688ebe279eaf86009c4ff78fc1cf87a7b32b35..4c494f1b253807ee2fe36a0dcce9661d2aed3126 100644 (file)
@@ -1,3 +1,5 @@
+// See LICENSE for license details.
+
 #include <stdint.h>
 #include <string.h>
 #include <stdarg.h>
@@ -64,7 +66,7 @@ static void tohost_exit(int code)
   while (1);
 }
 
-long handle_trap(long cause, long epc, long regs[32])
+long handle_trap(long cause, long epc, long long regs[32])
 {
   int* csr_insn;
   asm ("jal %0, 1f; csrr a0, stats; 1:" : "=r"(csr_insn));
@@ -73,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_SYSCALL)
+  else if (cause != CAUSE_ECALL)
     tohost_exit(1337);
   else if (regs[17] == SYS_exit)
     tohost_exit(regs[10]);