Microblaze stack protection is configurable and isn't always enabled. This patch allows the stack protection to be disabled from the CPU properties.
Signed-off-by: Alistair Francis <alistair.fran...@xilinx.com> --- target-microblaze/cpu-qom.h | 5 +++++ target-microblaze/cpu.c | 2 ++ target-microblaze/op_helper.c | 4 +++- 3 files changed, 10 insertions(+), 1 deletions(-) diff --git a/target-microblaze/cpu-qom.h b/target-microblaze/cpu-qom.h index e3e0701..7bc5b81 100644 --- a/target-microblaze/cpu-qom.h +++ b/target-microblaze/cpu-qom.h @@ -59,6 +59,11 @@ typedef struct MicroBlazeCPU { uint32_t base_vectors; /*< public >*/ + /* Microblaze Configuration Settings */ + struct { + bool stackproc; + } cfg; + CPUMBState env; } MicroBlazeCPU; diff --git a/target-microblaze/cpu.c b/target-microblaze/cpu.c index 67e3182..c08da19 100644 --- a/target-microblaze/cpu.c +++ b/target-microblaze/cpu.c @@ -152,6 +152,8 @@ static const VMStateDescription vmstate_mb_cpu = { static Property mb_properties[] = { DEFINE_PROP_UINT32("xlnx.base-vectors", MicroBlazeCPU, base_vectors, 0), + DEFINE_PROP_BOOL("xlnx.use-stack-protection", MicroBlazeCPU, cfg.stackproc, + true), DEFINE_PROP_END_OF_LIST(), }; diff --git a/target-microblaze/op_helper.c b/target-microblaze/op_helper.c index d2b3624..24df538 100644 --- a/target-microblaze/op_helper.c +++ b/target-microblaze/op_helper.c @@ -467,7 +467,9 @@ void helper_memalign(CPUMBState *env, uint32_t addr, uint32_t dr, uint32_t wr, void helper_stackprot(CPUMBState *env, uint32_t addr) { - if (addr < env->slr || addr > env->shr) { + MicroBlazeCPU *cpu = mb_env_get_cpu(env); + + if (cpu->cfg.stackproc && (addr < env->slr || addr > env->shr)) { qemu_log("Stack protector violation at %x %x %x\n", addr, env->slr, env->shr); env->sregs[SR_EAR] = addr; -- 1.7.1