From 7ff6c5a607f5426c6a87ea1a8ec9f3da2b204df2 Mon Sep 17 00:00:00 2001 From: Alex Richardson Date: Mon, 31 Jul 2023 08:51:00 -0700 Subject: [PATCH] [CHERI] Relax an overly strict assertion in cheri_tag_set_many This is currently called by DCZVA with all zero tag bits and was causing assertions while running cheribsdtest in Jenkins. The TLBENTRYCAP_FLAG_TRAP prevents writing non-zero tag bits, but the assertion was triggering for any value of tags, so relax it to actually model the required condition. --- target/cheri-common/cheri_tagmem.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/target/cheri-common/cheri_tagmem.c b/target/cheri-common/cheri_tagmem.c index 602b089fcf..d9670b276a 100644 --- a/target/cheri-common/cheri_tagmem.c +++ b/target/cheri-common/cheri_tagmem.c @@ -679,7 +679,11 @@ void cheri_tag_set_many(CPUArchState *env, uint32_t tags, target_ulong vaddr, cheri_debug_assert(!(tagmem_flags & TLBENTRYCAP_FLAG_CLEAR) && "Unimplemented"); - cheri_debug_assert(!(tagmem_flags & TLBENTRYCAP_FLAG_TRAP)); + /* + * TLBENTRYCAP_FLAG_TRAP prevents writing non-zero tags, and should have + * trapped in probe_cap_write(). + */ + assert(tags == 0 || !(tagmem_flags & TLBENTRYCAP_FLAG_TRAP)); cheri_debug_assert(tagmem);