Skip to content

Commit 9d9e283

Browse files
committed
CHERI riscv: PTE load-side caveats for non-LCG behaviors
1 parent 38609db commit 9d9e283

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

target/riscv/cpu_helper.c

+7-2
Original file line numberDiff line numberDiff line change
@@ -706,8 +706,13 @@ static int get_physical_address(CPURISCVState *env, hwaddr *physical,
706706
*prot |= PAGE_WRITE;
707707
}
708708
#if defined(TARGET_CHERI) && !defined(TARGET_RISCV32)
709-
if ((pte & PTE_LC) == 0)
710-
*prot |= PAGE_LC_CLEAR;
709+
if ((pte & PTE_LC) == 0) {
710+
if ((pte & PTE_LCM) == 0) {
711+
*prot |= PAGE_LC_CLEAR;
712+
} else {
713+
*prot |= PAGE_LC_TRAP;
714+
}
715+
}
711716
#endif
712717
return TRANSLATE_SUCCESS;
713718
}

0 commit comments

Comments
 (0)