diff options
Diffstat (limited to 'gitlab/issues/target_riscv/host_missing/accel_missing/1735.toml')
| -rw-r--r-- | gitlab/issues/target_riscv/host_missing/accel_missing/1735.toml | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/gitlab/issues/target_riscv/host_missing/accel_missing/1735.toml b/gitlab/issues/target_riscv/host_missing/accel_missing/1735.toml new file mode 100644 index 000000000..36bd003cd --- /dev/null +++ b/gitlab/issues/target_riscv/host_missing/accel_missing/1735.toml @@ -0,0 +1,41 @@ +id = 1735 +title = "[riscv-pmp] Pmp_hart_has_privs local variable name easily misunderstood" +state = "closed" +created_at = "2023-06-27T06:25:07.275Z" +closed_at = "2023-07-20T23:59:01.166Z" +labels = ["target: riscv", "workflow::Triaged"] +url = "https://gitlab.com/qemu-project/qemu/-/issues/1735" +host-os = "n/a" +host-arch = "n/a" +qemu-version = "n/a" +guest-os = "n/a" +guest-arch = "n/a" +description = "n/a" +reproduce = "n/a" +additional = """```c +// int => bool +static int pmp_is_in_range(CPURISCVState *env, int pmp_index, + target_ulong addr); + +bool pmp_hart_has_privs(CPURISCVState *env, target_ulong addr, + target_ulong size, pmp_priv_t privs, + pmp_priv_t *allowed_privs, target_ulong mode) +{ + int i = 0; + int pmp_size = 0; + // easily misunderstood local variable + target_ulong s = 0; + target_ulong e = 0; + + for (i = 0; i < MAX_RISCV_PMPS; i++) { + s = pmp_is_in_range(env, i, addr); + e = pmp_is_in_range(env, i, addr + pmp_size - 1); + + /* partially inside */ + if ((s + e) == 1) { + + } + + /* fully inside */ + if ((s + e) == 2) { +```""" |