diff --git a/riscv/csr_init.cc b/riscv/csr_init.cc index 5f05e1ee39..f3df89d896 100644 --- a/riscv/csr_init.cc +++ b/riscv/csr_init.cc @@ -268,7 +268,9 @@ void state_t::csr_init(processor_t* const proc, reg_t max_isa) (proc->extension_enabled(EXT_ZICFILP) ? MENVCFG_LPE : 0) | (proc->extension_enabled(EXT_ZICFISS) ? MENVCFG_SSE : 0) | (proc->extension_enabled(EXT_SSDBLTRP) ? MENVCFG_DTE : 0); - menvcfg = std::make_shared(proc, CSR_MENVCFG, menvcfg_mask, 0); + const reg_t menvcfg_init = (proc->extension_enabled(EXT_ZICBOM) ? MENVCFG_CBCFE | MENVCFG_CBIE : 0) | + (proc->extension_enabled(EXT_ZICBOZ) ? MENVCFG_CBZE : 0); + menvcfg = std::make_shared(proc, CSR_MENVCFG, menvcfg_mask, menvcfg_init); if (xlen == 32) { add_user_csr(CSR_MENVCFG, std::make_shared(proc, CSR_MENVCFG, menvcfg)); add_user_csr(CSR_MENVCFGH, std::make_shared(proc, CSR_MENVCFGH, menvcfg)); @@ -290,7 +292,9 @@ void state_t::csr_init(processor_t* const proc, reg_t max_isa) (proc->extension_enabled(EXT_ZICFILP) ? HENVCFG_LPE : 0) | (proc->extension_enabled(EXT_ZICFISS) ? HENVCFG_SSE : 0) | (proc->extension_enabled(EXT_SSDBLTRP) ? HENVCFG_DTE : 0); - henvcfg = std::make_shared(proc, CSR_HENVCFG, henvcfg_mask, 0, menvcfg); + const reg_t henvcfg_init = (proc->extension_enabled(EXT_ZICBOM) ? HENVCFG_CBCFE | HENVCFG_CBIE : 0) | + (proc->extension_enabled(EXT_ZICBOZ) ? HENVCFG_CBZE : 0); + henvcfg = std::make_shared(proc, CSR_HENVCFG, henvcfg_mask, henvcfg_init, menvcfg); if (xlen == 32) { add_hypervisor_csr(CSR_HENVCFG, std::make_shared(proc, CSR_HENVCFG, henvcfg)); add_hypervisor_csr(CSR_HENVCFGH, std::make_shared(proc, CSR_HENVCFGH, henvcfg));