[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 56/76] target/microblaze: Fix no-op mb_cpu_transaction_failed
From: |
Richard Henderson |
Subject: |
[PATCH v2 56/76] target/microblaze: Fix no-op mb_cpu_transaction_failed |
Date: |
Fri, 28 Aug 2020 07:19:09 -0700 |
Do not call cpu_restore_state when no exception will be
delivered. This can lead to inconsistent cpu state.
Reported-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
target/microblaze/op_helper.c | 25 +++++++++++++------------
1 file changed, 13 insertions(+), 12 deletions(-)
diff --git a/target/microblaze/op_helper.c b/target/microblaze/op_helper.c
index a99c467364..e6dcc79243 100644
--- a/target/microblaze/op_helper.c
+++ b/target/microblaze/op_helper.c
@@ -419,32 +419,33 @@ void mb_cpu_transaction_failed(CPUState *cs, hwaddr
physaddr, vaddr addr,
int mmu_idx, MemTxAttrs attrs,
MemTxResult response, uintptr_t retaddr)
{
- MicroBlazeCPU *cpu;
- CPUMBState *env;
+ MicroBlazeCPU *cpu = MICROBLAZE_CPU(cs);
+ CPUMBState *env = &cpu->env;
+
qemu_log_mask(CPU_LOG_INT, "Transaction failed: vaddr 0x%" VADDR_PRIx
" physaddr 0x" TARGET_FMT_plx " size %d access type %s\n",
addr, physaddr, size,
access_type == MMU_INST_FETCH ? "INST_FETCH" :
(access_type == MMU_DATA_LOAD ? "DATA_LOAD" : "DATA_STORE"));
- cpu = MICROBLAZE_CPU(cs);
- env = &cpu->env;
- cpu_restore_state(cs, retaddr, true);
if (!(env->msr & MSR_EE)) {
return;
}
- env->ear = addr;
if (access_type == MMU_INST_FETCH) {
- if ((env->pvr.regs[2] & PVR2_IOPB_BUS_EXC_MASK)) {
- env->esr = ESR_EC_INSN_BUS;
- helper_raise_exception(env, EXCP_HW_EXCP);
+ if (!cpu->cfg.iopb_bus_exception) {
+ return;
}
+ env->esr = ESR_EC_INSN_BUS;
} else {
- if ((env->pvr.regs[2] & PVR2_DOPB_BUS_EXC_MASK)) {
- env->esr = ESR_EC_DATA_BUS;
- helper_raise_exception(env, EXCP_HW_EXCP);
+ if (!cpu->cfg.dopb_bus_exception) {
+ return;
}
+ env->esr = ESR_EC_DATA_BUS;
}
+
+ env->ear = addr;
+ cs->exception_index = EXCP_HW_EXCP;
+ cpu_loop_exit_restore(cs, retaddr);
}
#endif
--
2.25.1
- [PATCH v2 46/76] target/microblaze: Convert dec_imm to decodetree, (continued)
- [PATCH v2 46/76] target/microblaze: Convert dec_imm to decodetree, Richard Henderson, 2020/08/28
- [PATCH v2 47/76] target/microblaze: Convert dec_fpu to decodetree, Richard Henderson, 2020/08/28
- [PATCH v2 49/76] target/microblaze: Mark fpu helpers TCG_CALL_NO_WG, Richard Henderson, 2020/08/28
- [PATCH v2 48/76] target/microblaze: Fix cpu unwind for fpu exceptions, Richard Henderson, 2020/08/28
- [PATCH v2 50/76] target/microblaze: Replace MSR_EE_FLAG with MSR_EE, Richard Henderson, 2020/08/28
- [PATCH v2 51/76] target/microblaze: Cache mem_index in DisasContext, Richard Henderson, 2020/08/28
- [PATCH v2 52/76] target/microblaze: Fix cpu unwind for stackprot, Richard Henderson, 2020/08/28
- [PATCH v2 54/76] target/microblaze: Assert no overlap in flags making up tb_flags, Richard Henderson, 2020/08/28
- [PATCH v2 53/76] target/microblaze: Convert dec_load and dec_store to decodetree, Richard Henderson, 2020/08/28
- [PATCH v2 56/76] target/microblaze: Fix no-op mb_cpu_transaction_failed,
Richard Henderson <=
- [PATCH v2 57/76] target/microblaze: Store "current" iflags in insn_start, Richard Henderson, 2020/08/28
- [PATCH v2 58/76] tcg: Add tcg_get_insn_start_param, Richard Henderson, 2020/08/28
- [PATCH v2 55/76] target/microblaze: Move bimm to BIMM_FLAG, Richard Henderson, 2020/08/28
- [PATCH v2 59/76] target/microblaze: Use cc->do_unaligned_access, Richard Henderson, 2020/08/28
- [PATCH v2 60/76] target/microblaze: Replace clear_imm with tb_flags_to_set, Richard Henderson, 2020/08/28
- [PATCH v2 63/76] target/microblaze: Convert brk and brki to decodetree, Richard Henderson, 2020/08/28
- [PATCH v2 64/76] target/microblaze: Convert mbar to decodetree, Richard Henderson, 2020/08/28
- [PATCH v2 62/76] target/microblaze: Tidy mb_cpu_dump_state, Richard Henderson, 2020/08/28