about summary refs log tree commit diff stats
path: root/src/emu
diff options
context:
space:
mode:
authorYang Liu <liuyang22@iscas.ac.cn>2024-02-28 03:44:34 +0800
committerGitHub <noreply@github.com>2024-02-27 20:44:34 +0100
commitd658c47cd02823bee50adebf8580537031ef7026 (patch)
tree13dde73cbf719499a32c874112b4b66fae587059 /src/emu
parent21b06ace43adb3bc8b88eea8d0e1db79110d4e9c (diff)
downloadbox64-d658c47cd02823bee50adebf8580537031ef7026.tar.gz
box64-d658c47cd02823bee50adebf8580537031ef7026.zip
[RV64_DYNAREC] Fixed RDTSC handling (#1291)
* [LIBWRAP] Fixed a typo in the clocksource wrapping

* [RV64_DYNAREC] Added hardware timer support for RDTSC

* [INTERP] Optmize RV64 ReadTSC using rdtime

* [RV64_DYNAREC] Added 0F 01 F9 RDTSCP opcode

* Fixed typo

* Fixed another typo
Diffstat (limited to 'src/emu')
-rw-r--r--src/emu/x64emu.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/emu/x64emu.c b/src/emu/x64emu.c
index 4d8bf629..fc737242 100644
--- a/src/emu/x64emu.c
+++ b/src/emu/x64emu.c
@@ -584,10 +584,14 @@ uint64_t ReadTSC(x64emu_t* emu)
     (void)emu;
     
     // Hardware counter, per architecture
-#ifdef ARM64
+#if defined(ARM64) || defined(RV64)
     if(!box64_rdtsc) {
         uint64_t val;
+#ifdef ARM64
         asm volatile("mrs %0, cntvct_el0" : "=r" (val));
+#else // RV64
+        asm volatile("rdtime %0" : "=r" (val));
+#endif
         return val;
     }
 #endif