On 2/17/23 10:34, Daniel Henrique Barboza wrote:
+void helper_cbo_zero(CPURISCVState *env, target_ulong address) +{ + RISCVCPU *cpu = env_archcpu(env); + uintptr_t ra = GETPC(); + uint16_t cbozlen; + void *mem; + + check_zicbo_envcfg(env, MENVCFG_CBZE, ra); + + /* Get the size of the cache block for zero instructions. */ + cbozlen = cpu->cfg.cboz_blocksize; + + /* Mask off low-bits to align-down to the cache-block. */ + address &= ~(cbozlen - 1); + + mem = tlb_vaddr_to_host(env, address, MMU_DATA_STORE, + cpu_mmu_index(env, false)); + + if (likely(mem)) { + /* Zero the block */ + memset(mem, 0, cbozlen); + } +}
Not correct. This fails to zero the block at all under a number of conditions. Please have a closer look at the feedback on v5. r~