Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix spicious pointer scaling #138

Merged
merged 1 commit into from
Jun 2, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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