aboutsummaryrefslogtreecommitdiff
path: root/benchmarks/common
diff options
context:
space:
mode:
authorAndrew Waterman <waterman@cs.berkeley.edu>2016-05-02 14:29:41 -0700
committerAndrew Waterman <waterman@cs.berkeley.edu>2016-05-02 14:29:41 -0700
commite38b55f9b10204171b74343a5a73d041b7186caf (patch)
treef167e958c2419a78bad21e09c0f53960073a5ec9 /benchmarks/common
parent22742246287feda0be2666ba14ca6f4a6bc73bb2 (diff)
downloadriscv-tests-e38b55f9b10204171b74343a5a73d041b7186caf.zip
riscv-tests-e38b55f9b10204171b74343a5a73d041b7186caf.tar.gz
riscv-tests-e38b55f9b10204171b74343a5a73d041b7186caf.tar.bz2
Stop using tohost/fromhost registers
Diffstat (limited to 'benchmarks/common')
-rw-r--r--benchmarks/common/syscalls.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/benchmarks/common/syscalls.c b/benchmarks/common/syscalls.c
index 4620631..9c72e36 100644
--- a/benchmarks/common/syscalls.c
+++ b/benchmarks/common/syscalls.c
@@ -14,6 +14,9 @@
// initialized in crt.S
int have_vec;
+volatile uint64_t tohost __attribute__((aligned(64)));
+volatile uint64_t fromhost __attribute__((aligned(64)));
+
static long handle_frontend_syscall(long which, long arg0, long arg1, long arg2)
{
volatile uint64_t magic_mem[8] __attribute__((aligned(64)));
@@ -22,8 +25,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 +65,7 @@ static int handle_stats(int enable)
void tohost_exit(long code)
{
- write_csr(mtohost, (code << 1) | 1);
+ tohost = (code << 1) | 1;
while (1);
}