On 10/1/25 12:32 AM, Anton Johansson wrote:
From my understanding the upper_half argument only indicates whether the
upper or lower 32 bits should be returned, and upper_half will only ever
be set when MXLEN == 32. However, the function also uses upper_half to
determine whether the inhibit flags are located in mcyclecfgh or
mcyclecfg, but this misses the case where MXLEN == 32, upper_half == false
for TARGET_RISCV32 where we would also need to read the upper half field.
Minor simplifications are also made along with some formatting fixes.
Signed-off-by: Anton Johansson <[email protected]>
---
target/riscv/csr.c | 22 ++++++++++------------
1 file changed, 10 insertions(+), 12 deletions(-)
Looks good.
write_mhpmcounterh is indeed available only for riscv32.
Reviewed-by: Pierrick Bouvier <[email protected]>