On 10/1/25 12:33 AM, Anton Johansson wrote:
Widen to 64 bits in size to hold all relevant values.
Signed-off-by: Anton Johansson <[email protected]>
---
target/riscv/cpu.h | 2 +-
target/riscv/cpu_helper.c | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/target/riscv/cpu.h b/target/riscv/cpu.h
index c1fbb67b08..b17aca0e02 100644
--- a/target/riscv/cpu.h
+++ b/target/riscv/cpu.h
@@ -653,7 +653,7 @@ RISCVException smstateen_acc_ok(CPURISCVState *env, int
index, uint64_t bit);
void riscv_cpu_set_mode(CPURISCVState *env, uint8_t newpriv, bool virt_en);
-void riscv_ctr_add_entry(CPURISCVState *env, target_long src, target_long dst,
+void riscv_ctr_add_entry(CPURISCVState *env, uint64_t src, uint64_t dst,
enum CTRType type, uint8_t prev_priv, bool prev_virt);
void riscv_ctr_clear(CPURISCVState *env);
diff --git a/target/riscv/cpu_helper.c b/target/riscv/cpu_helper.c
index 2945a89a9c..4acfccc9d8 100644
--- a/target/riscv/cpu_helper.c
+++ b/target/riscv/cpu_helper.c
@@ -925,8 +925,8 @@ static bool riscv_ctr_check_xte(CPURISCVState *env, uint8_t
src_prv,
* entry = isel - CTR_ENTRIES_FIRST;
* idx = (sctrstatus.WRPTR - entry - 1) & (depth - 1);
*/
-void riscv_ctr_add_entry(CPURISCVState *env, target_long src, target_long dst,
- enum CTRType type, uint8_t src_priv, bool src_virt)
+void riscv_ctr_add_entry(CPURISCVState *env, uint64_t src, uint64_t dst,
+ enum CTRType type, uint8_t src_priv, bool src_virt)
{
bool tgt_virt = env->virt_enabled;
uint64_t src_mask = riscv_ctr_priv_to_mask(src_priv, src_virt);
Watchout, here we have signed values.
However, checking call sites call sites, since we deal with pc, it seems
safe to have uint64_t. Maybe it's worth saying this in commit description.
Reviewed-by: Pierrick Bouvier <[email protected]>