From: Andrew Waterman Date: Mon, 2 May 2016 21:29:41 +0000 (-0700) Subject: Stop using tohost/fromhost registers X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e38b55f9b10204171b74343a5a73d041b7186caf;p=riscv-tests.git Stop using tohost/fromhost registers --- 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); } diff --git a/env b/env index 3d45ca3..b54a6f8 160000 --- a/env +++ b/env @@ -1 +1 @@ -Subproject commit 3d45ca302dbf5ac22cfac8fb025c05c735c35e26 +Subproject commit b54a6f8e11f43ac6df310016723ef6eb2f7d3a33 diff --git a/isa/rv64mi/dirty.S b/isa/rv64mi/dirty.S index 5228129..9de358b 100644 --- a/isa/rv64mi/dirty.S +++ b/isa/rv64mi/dirty.S @@ -76,11 +76,17 @@ stvec_handler: die: RVTEST_FAIL -.data +RVTEST_CODE_END + + .data +RVTEST_DATA_BEGIN + + TEST_DATA + .align 12 page_table_1: .dword (DRAM_BASE/RISCV_PGSIZE << PTE_PPN_SHIFT) | PTE_V | PTE_TYPE_URX_SRX dummy: .dword 0 .align 12 page_table_2: .dword (DRAM_BASE/RISCV_PGSIZE << PTE_PPN_SHIFT) | PTE_V | PTE_TYPE_URWX_SRWX -RVTEST_CODE_END +RVTEST_DATA_END diff --git a/isa/rv64mi/mcsr.S b/isa/rv64mi/mcsr.S index f704827..b66611c 100644 --- a/isa/rv64mi/mcsr.S +++ b/isa/rv64mi/mcsr.S @@ -36,3 +36,10 @@ RVTEST_CODE_BEGIN TEST_PASSFAIL RVTEST_CODE_END + + .data +RVTEST_DATA_BEGIN + + TEST_DATA + +RVTEST_DATA_END