Skip to content

Commit 2e7f888

Browse files
francois141CharlyCst
authored andcommitted
SailBugfix: pmp_cfg_idx must be multiplied by two
The pmpcfg registers have a stride of two, therefore we also need to multiply the pmp_cfg_idx by two.
1 parent 7f6abd2 commit 2e7f888

File tree

2 files changed

+2
-5
lines changed

2 files changed

+2
-5
lines changed

model_checking/src/lib.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -158,10 +158,7 @@ pub fn fences() {
158158
#[cfg_attr(kani, kani::proof)]
159159
#[cfg_attr(test, test)]
160160
pub fn read_csr() {
161-
let (mut ctx, mctx, mut sail_ctx) = symbolic::new_symbolic_contexts();
162-
163-
// Infinite number of pmps for the formal verification
164-
ctx.nb_pmp = usize::MAX;
161+
let (ctx, mctx, mut sail_ctx) = symbolic::new_symbolic_contexts();
165162

166163
let csr_register = generate_csr_register();
167164

src/virt/csr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ impl RegisterContextGetter<Csr> for VirtContext {
9191
log::warn!("Invalid pmpcfg {}", pmp_cfg_idx);
9292
return 0;
9393
}
94-
if pmp_cfg_idx >= self.nb_pmp / 8 {
94+
if pmp_cfg_idx >= 2 * self.nb_pmp / 8 {
9595
// This PMP is not emulated
9696
return 0;
9797
}

0 commit comments

Comments
 (0)