aboutsummaryrefslogtreecommitdiff
path: root/machine/emulation.c
diff options
context:
space:
mode:
authorAndrew Waterman <waterman@cs.berkeley.edu>2016-04-29 10:54:40 -0700
committerAndrew Waterman <waterman@cs.berkeley.edu>2016-04-29 10:54:40 -0700
commit66776bbc3efce7fb4176ca03fb949f556c2c2d57 (patch)
treea05be0f4527f9c58fadc934b652a59457d009561 /machine/emulation.c
parentde16a763e6bf266ad49384fa131a502a6174e7ba (diff)
downloadpk-66776bbc3efce7fb4176ca03fb949f556c2c2d57.zip
pk-66776bbc3efce7fb4176ca03fb949f556c2c2d57.tar.gz
pk-66776bbc3efce7fb4176ca03fb949f556c2c2d57.tar.bz2
Remove mtime/mtimecmp
Diffstat (limited to 'machine/emulation.c')
-rw-r--r--machine/emulation.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/machine/emulation.c b/machine/emulation.c
index dad86f9..70169fd 100644
--- a/machine/emulation.c
+++ b/machine/emulation.c
@@ -91,7 +91,7 @@ static inline int emulate_read_csr(int num, uintptr_t mstatus, uintptr_t* result
switch (num)
{
case CSR_TIME:
- *result = read_csr(mtime) + HLS()->utime_delta;
+ *result = *mtime + HLS()->utime_delta;
return 0;
case CSR_CYCLE:
*result = read_csr(mcycle) + HLS()->ucycle_delta;
@@ -100,7 +100,7 @@ static inline int emulate_read_csr(int num, uintptr_t mstatus, uintptr_t* result
*result = read_csr(minstret) + HLS()->uinstret_delta;
return 0;
case CSR_STIME:
- *result = read_csr(mtime) + HLS()->stime_delta;
+ *result = *mtime + HLS()->stime_delta;
return 0;
case CSR_SCYCLE:
*result = read_csr(mcycle) + HLS()->scycle_delta;
@@ -110,8 +110,7 @@ static inline int emulate_read_csr(int num, uintptr_t mstatus, uintptr_t* result
return 0;
#ifdef __riscv32
case CSR_TIMEH:
- *result = (((uint64_t)read_csr(mtimeh) << 32) + read_csr(mtime)
- + HLS()->stime_delta) >> 32;
+ *result = (*mtime + HLS()->stime_delta) >> 32;
return 0;
case CSR_CYCLEH:
*result = (((uint64_t)read_csr(mcycleh) << 32) + read_csr(mcycle)