summaryrefslogtreecommitdiff
path: root/software
diff options
context:
space:
mode:
authorPalmer Dabbelt <palmer@dabbelt.com>2017-06-10 12:06:01 -0700
committerPalmer Dabbelt <palmer@dabbelt.com>2017-06-10 12:06:01 -0700
commit2c5694f5f6f45884a4c3ed3aa1202f303a45ce42 (patch)
treea6a994c04e86001867d789380928aae61f1e05d2 /software
parent323592969d8d60a5c262aba34c2d75980208dab8 (diff)
We no longer define __riscv64, we define __riscv_xlen=64
Diffstat (limited to 'software')
-rw-r--r--software/performance_counters/performance_counters.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/software/performance_counters/performance_counters.c b/software/performance_counters/performance_counters.c
index 115ab49..8094128 100644
--- a/software/performance_counters/performance_counters.c
+++ b/software/performance_counters/performance_counters.c
@@ -18,7 +18,7 @@
// rollover with this routine as suggested by the
// RISC-V Priviledged Architecture Specification.
-#ifdef __riscv64
+#if __riscv_xlen == 64
#define rdmcycle(x) { \
uint64_t hi; \
__asm__ __volatile__ ("1:\n\t" \
@@ -44,13 +44,13 @@
// Freedom E platforms use RV32, we must access it as
// 2 32-bit registers, same as for mcycle.
-#ifdef __riscv64
-#define rdminstret(x) { \
- uint64_t hi; \
- __asm__ __volatile__ ("1:\n\t" \
- "csrr %0, minstret\n\t" \
- : "=r" (hi), "=r" (lo), "=r" (hi2)) ; \
- *(x) = lo | ((uint64_t) hi << 32); \
+#if __riscv_xlen == 64
+#define rdminstret(x) { \
+ uint64_t hi; \
+ __asm__ __volatile__ ("1:\n\t" \
+ "csrr %0, minstret\n\t" \
+ : "=r" (hi)) ; \
+ *(x) = hi; \
}
#else
#define rdminstret(x) { \
@@ -111,7 +111,7 @@ int main()
write_csr(mcycle, 0);
write_csr(minstret, 0);
-#ifndef __riscv64
+#if __riscv_xlen == 32
write_csr(mcycleh, 0);
write_csr(minstreth, 0);
#endif