Skip to content

Commit b0f7b65

Browse files
committed
Fix spicious pointer scaling
solve #135
1 parent b8a2adf commit b0f7b65

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/emulate.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,9 +144,9 @@ static uint32_t *csr_get_ptr(riscv_t *rv, uint32_t csr)
144144

145145
/* Machine Counter/Timers */
146146
case CSR_CYCLE: /* Cycle counter for RDCYCLE instruction */
147-
return (uint32_t *) (&rv->csr_cycle) + 0;
147+
return &((uint32_t *) &rv->csr_cycle)[0];
148148
case CSR_CYCLEH: /* Upper 32 bits of cycle */
149-
return (uint32_t *) (&rv->csr_cycle) + 1;
149+
return &((uint32_t *) &rv->csr_cycle)[0];
150150

151151
/* TIME/TIMEH - very roughly about 1 ms per tick */
152152
case CSR_TIME: { /* Timer for RDTIME instruction */

0 commit comments

Comments
 (0)