Skip to content

Commit

Permalink
Fix spicious pointer scaling
Browse files Browse the repository at this point in the history
solve #136
  • Loading branch information
qwe661234 committed Jun 2, 2023
1 parent b8a2adf commit 2b805d5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/emulate.c
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,9 @@ static uint32_t *csr_get_ptr(riscv_t *rv, uint32_t csr)

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

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

0 comments on commit 2b805d5

Please sign in to comment.