From 5818dee572deabb1e75a0901b43caa81fb30f419 Mon Sep 17 00:00:00 2001 From: "Edgar E. Iglesias" Date: Tue, 10 Jan 2012 10:27:11 +0100 Subject: microblaze: Emulate the hw stackprotector Signed-off-by: Edgar E. Iglesias --- target-microblaze/op_helper.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'target-microblaze/op_helper.c') diff --git a/target-microblaze/op_helper.c b/target-microblaze/op_helper.c index d99c564375..7232c71998 100644 --- a/target-microblaze/op_helper.c +++ b/target-microblaze/op_helper.c @@ -483,6 +483,17 @@ void helper_memalign(uint32_t addr, uint32_t dr, uint32_t wr, uint32_t mask) } } +void helper_stackprot(uint32_t addr) +{ + if (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; + env->sregs[SR_ESR] = ESR_EC_STACKPROT; + helper_raise_exception(EXCP_HW_EXCP); + } +} + #if !defined(CONFIG_USER_ONLY) /* Writes/reads to the MMU's special regs end up here. */ uint32_t helper_mmu_read(uint32_t rn) -- cgit v1.2.3