for (i = 0; i < sizeof(target_ulong); i++) {
cfg_val = (val >> 8 * i) & 0xff;
pmp_write_cfg(env, (reg_index * sizeof(target_ulong)) + i,
cfg_val);
}
RV64 PMP config register is pmpcfg0/pmpcfg2 not pmpcfg0/pmpcfg1.
So under RV64, needs to convert the register index to 0/1.
If not do that will overflow.
reg_index * sizeof(target_ulong) + i will between [0, 8) / [16, 24)
RV64 PMP config register is pmpcfg0/pmpcfg2 not pmpcfg0/pmpcfg1. So under RV64, needs to convert the register index to 0/1. If not do that will overflow. reg_index * sizeof(target_ulong) + i will between [0, 8) / [16, 24)