Skip to content

Commit 86bdab9

Browse files
committed
unifying variable names and usage
- In `clint_reg_write`, there are two variable names with the same meaning: `lowwer` and `lower`. These should be unified as `lower`. - In `clint_update_interrupts`, although `&hart->time` and `&clint->mtime` are kept in sync, semantically, `&clint->mtime` should be used when comparing against mtimecmp.
1 parent 8b4e34d commit 86bdab9

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

clint.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
void clint_update_interrupts(hart_t *hart, clint_state_t *clint)
77
{
88
uint64_t time_delta =
9-
clint->mtimecmp[hart->mhartid] - semu_timer_get(&hart->time);
9+
clint->mtimecmp[hart->mhartid] - semu_timer_get(&clint->mtime);
1010
if ((int64_t) time_delta <= 0)
1111
hart->sip |= RV_INT_STI_BIT;
1212
else
@@ -50,13 +50,13 @@ static bool clint_reg_write(clint_state_t *clint, uint32_t addr, uint32_t value)
5050
if (addr < 0xBFF8) {
5151
addr -= 0x4000;
5252
int32_t upper = clint->mtimecmp[addr >> 3] >> 32;
53-
int32_t lowwer = clint->mtimecmp[addr >> 3];
53+
int32_t lower = clint->mtimecmp[addr >> 3];
5454
if (addr & 0b100)
5555
upper = value;
5656
else
57-
lowwer = value;
57+
lower = value;
5858

59-
clint->mtimecmp[addr >> 3] = (uint64_t) upper << 32 | lowwer;
59+
clint->mtimecmp[addr >> 3] = (uint64_t) upper << 32 | lower;
6060
return true;
6161
}
6262

0 commit comments

Comments
 (0)