aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Waterman <andrew@sifive.com>2017-03-22 03:43:15 -0700
committerAndrew Waterman <andrew@sifive.com>2017-03-22 03:43:15 -0700
commit3f1859129af6d26a3357cc1120c75e89d2aa8aaf (patch)
tree0db00d0f6d90b20ba76f7350fff14dbfcfbb4238
parenta83e3b9243e57a50de283fc07d5b6c81c0443b3d (diff)
downloadriscv-tests-3f1859129af6d26a3357cc1120c75e89d2aa8aaf.zip
riscv-tests-3f1859129af6d26a3357cc1120c75e89d2aa8aaf.tar.gz
riscv-tests-3f1859129af6d26a3357cc1120c75e89d2aa8aaf.tar.bz2
Clean up benchmarks build
-rw-r--r--benchmarks/Makefile2
-rw-r--r--benchmarks/common/syscalls.c38
-rw-r--r--benchmarks/common/util.h5
-rw-r--r--isa/Makefile2
4 files changed, 10 insertions, 37 deletions
diff --git a/benchmarks/Makefile b/benchmarks/Makefile
index 28ba2b7..ca201c9 100644
--- a/benchmarks/Makefile
+++ b/benchmarks/Makefile
@@ -67,8 +67,6 @@ $(bmarks_riscv_out): %.riscv.out: %.riscv
riscv: $(bmarks_riscv_dump)
run: $(bmarks_riscv_out)
- echo; perl -ne 'print " [$$1] $$ARGV \t$$2\n" if /\*{3}(.{8})\*{3}(.*)/' \
- $(bmarks_riscv_out); echo;
junk += $(bmarks_riscv_bin) $(bmarks_riscv_dump) $(bmarks_riscv_hex) $(bmarks_riscv_out)
diff --git a/benchmarks/common/syscalls.c b/benchmarks/common/syscalls.c
index 3f15aac..4940aa2 100644
--- a/benchmarks/common/syscalls.c
+++ b/benchmarks/common/syscalls.c
@@ -8,15 +8,13 @@
#include "util.h"
#define SYS_write 64
-#define SYS_exit 93
-#define SYS_stats 1234
#undef strcmp
extern volatile uint64_t tohost;
extern volatile uint64_t fromhost;
-static uintptr_t handle_frontend_syscall(uintptr_t which, uint64_t arg0, uint64_t arg1, uint64_t arg2)
+static uintptr_t syscall(uintptr_t which, uint64_t arg0, uint64_t arg1, uint64_t arg2)
{
volatile uint64_t magic_mem[8] __attribute__((aligned(64)));
magic_mem[0] = which;
@@ -38,7 +36,7 @@ static uintptr_t handle_frontend_syscall(uintptr_t which, uint64_t arg0, uint64_
static uintptr_t counters[NUM_COUNTERS];
static char* counter_names[NUM_COUNTERS];
-static int handle_stats(int enable)
+void setStats(int enable)
{
int i = 0;
#define READ_CTR(name) do { \
@@ -52,7 +50,6 @@ static int handle_stats(int enable)
READ_CTR(minstret);
#undef READ_CTR
- return 0;
}
void __attribute__((noreturn)) tohost_exit(uintptr_t code)
@@ -61,39 +58,14 @@ void __attribute__((noreturn)) tohost_exit(uintptr_t code)
while (1);
}
-uintptr_t handle_trap(uintptr_t cause, uintptr_t epc, uintptr_t regs[32])
-{
- if (cause != CAUSE_MACHINE_ECALL)
- tohost_exit(1337);
- else if (regs[17] == SYS_exit)
- tohost_exit(regs[10]);
- else if (regs[17] == SYS_stats)
- regs[10] = handle_stats(regs[10]);
- else
- regs[10] = handle_frontend_syscall(regs[17], regs[10], regs[11], regs[12]);
-
- return epc + ((*(unsigned short*)epc & 3) == 3 ? 4 : 2);
-}
-
-static uintptr_t syscall(uintptr_t num, uintptr_t arg0, uintptr_t arg1, uintptr_t arg2)
+uintptr_t __attribute__((weak)) handle_trap(uintptr_t cause, uintptr_t epc, uintptr_t regs[32])
{
- register uintptr_t a7 asm("a7") = num;
- register uintptr_t a0 asm("a0") = arg0;
- register uintptr_t a1 asm("a1") = arg1;
- register uintptr_t a2 asm("a2") = arg2;
- asm volatile ("scall" : "+r"(a0) : "r"(a1), "r"(a2), "r"(a7));
- return a0;
+ tohost_exit(1337);
}
void exit(int code)
{
- syscall(SYS_exit, code, 0, 0);
- while (1);
-}
-
-void setStats(int enable)
-{
- syscall(SYS_stats, enable, 0, 0);
+ tohost_exit(code);
}
void printstr(const char* s)
diff --git a/benchmarks/common/util.h b/benchmarks/common/util.h
index a3e2e8c..081cfd6 100644
--- a/benchmarks/common/util.h
+++ b/benchmarks/common/util.h
@@ -67,6 +67,11 @@ static uint64_t lfsr(uint64_t x)
return (x >> 1) | (bit << 62);
}
+static uintptr_t insn_len(uintptr_t pc)
+{
+ return (*(unsigned short*)pc & 3) ? 4 : 2;
+}
+
#ifdef __riscv
#include "encoding.h"
#endif
diff --git a/isa/Makefile b/isa/Makefile
index 89c2ef9..7f22c53 100644
--- a/isa/Makefile
+++ b/isa/Makefile
@@ -92,8 +92,6 @@ tests_out = $(addsuffix .out, $(spike_tests))
tests32_out = $(addsuffix .out32, $(spike32_tests))
run: $(tests_out) $(tests32_out)
- echo; perl -ne 'print " [$$1] $$ARGV \t$$2\n" if /\*{3}(.{8})\*{3}(.*)/' \
- $(tests_out) $(tests32_out); echo;
junk += $(tests) $(tests_dump) $(tests_hex) $(tests_out) $(tests32_out)