Don't use FPU in benchmarks that don't need to use the FPU
[riscv-tests.git] / benchmarks / common / syscalls.c
index 46206310c6aefd6066d5d44b228b7c07c34be5b5..316f2fee67d870bf4cfad394023b2d4c93e2feac 100644 (file)
@@ -11,8 +11,8 @@
 #define SYS_exit 93
 #define SYS_stats 1234
 
-// initialized in crt.S
-int have_vec;
+extern volatile uint64_t tohost;
+extern volatile uint64_t fromhost;
 
 static long handle_frontend_syscall(long which, long arg0, long arg1, long arg2)
 {
@@ -22,8 +22,13 @@ 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(mtohost, (long)magic_mem);
-  while (swap_csr(mfromhost, 0) == 0);
+
+  tohost = (uintptr_t)magic_mem;
+  while (fromhost == 0)
+    ;
+  fromhost = 0;
+
+  __sync_synchronize();
   return magic_mem[0];
 }
 
@@ -57,7 +62,7 @@ static int handle_stats(int enable)
 
 void tohost_exit(long code)
 {
-  write_csr(mtohost, (code << 1) | 1);
+  tohost = (code << 1) | 1;
   while (1);
 }