qemu with hax to log dma reads & writes jcs.org/2018/11/12/vfio

target/microblaze: Add the div-zero-exception property

Add the div-zero-exception property to control if the core
traps divizions by zero.

Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Reviewed-by: Luc Michel <luc.michel@greensocs.com>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@xilinx.com>

+8 -2
+4
target/microblaze/cpu.c
··· 207 207 PVR2_DOPB_BUS_EXC_MASK : 0) | 208 208 (cpu->cfg.iopb_bus_exception ? 209 209 PVR2_IOPB_BUS_EXC_MASK : 0) | 210 + (cpu->cfg.div_zero_exception ? 211 + PVR2_DIV_ZERO_EXC_MASK : 0) | 210 212 (cpu->cfg.illegal_opcode_exception ? 211 213 PVR2_ILL_OPCODE_EXC_MASK : 0) | 212 214 (cpu->cfg.opcode_0_illegal ? ··· 280 282 cfg.iopb_bus_exception, false), 281 283 DEFINE_PROP_BOOL("ill-opcode-exception", MicroBlazeCPU, 282 284 cfg.illegal_opcode_exception, false), 285 + DEFINE_PROP_BOOL("div-zero-exception", MicroBlazeCPU, 286 + cfg.div_zero_exception, false), 283 287 DEFINE_PROP_BOOL("opcode-0x0-illegal", MicroBlazeCPU, 284 288 cfg.opcode_0_illegal, false), 285 289 DEFINE_PROP_STRING("version", MicroBlazeCPU, cfg.version),
+1
target/microblaze/cpu.h
··· 305 305 bool iopb_bus_exception; 306 306 bool illegal_opcode_exception; 307 307 bool opcode_0_illegal; 308 + bool div_zero_exception; 308 309 char *version; 309 310 uint8_t pvr; 310 311 } cfg;
+3 -2
target/microblaze/op_helper.c
··· 132 132 133 133 static inline int div_prepare(CPUMBState *env, uint32_t a, uint32_t b) 134 134 { 135 + MicroBlazeCPU *cpu = env_archcpu(env); 136 + 135 137 if (b == 0) { 136 138 env->sregs[SR_MSR] |= MSR_DZ; 137 139 138 - if ((env->sregs[SR_MSR] & MSR_EE) 139 - && !(env->pvr.regs[2] & PVR2_DIV_ZERO_EXC_MASK)) { 140 + if ((env->sregs[SR_MSR] & MSR_EE) && cpu->cfg.div_zero_exception) { 140 141 env->sregs[SR_ESR] = ESR_EC_DIVZERO; 141 142 helper_raise_exception(env, EXCP_HW_EXCP); 142 143 }