[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 52/76] target/microblaze: Fix cpu unwind for stackprot
From: |
Richard Henderson |
Subject: |
[PATCH v2 52/76] target/microblaze: Fix cpu unwind for stackprot |
Date: |
Fri, 28 Aug 2020 07:19:05 -0700 |
Restore the correct PC when an exception must be raised.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
target/microblaze/helper.h | 2 +-
target/microblaze/op_helper.c | 6 +++++-
2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/target/microblaze/helper.h b/target/microblaze/helper.h
index 64816c89e1..a473c1867b 100644
--- a/target/microblaze/helper.h
+++ b/target/microblaze/helper.h
@@ -26,7 +26,7 @@ DEF_HELPER_4(mmu_write, void, env, i32, i32, i32)
#endif
DEF_HELPER_5(memalign, void, env, tl, i32, i32, i32)
-DEF_HELPER_2(stackprot, void, env, tl)
+DEF_HELPER_FLAGS_2(stackprot, TCG_CALL_NO_WG, void, env, tl)
DEF_HELPER_2(get, i32, i32, i32)
DEF_HELPER_3(put, void, i32, i32, i32)
diff --git a/target/microblaze/op_helper.c b/target/microblaze/op_helper.c
index 2c59d4492d..a99c467364 100644
--- a/target/microblaze/op_helper.c
+++ b/target/microblaze/op_helper.c
@@ -389,12 +389,16 @@ void helper_memalign(CPUMBState *env, target_ulong addr,
void helper_stackprot(CPUMBState *env, target_ulong addr)
{
if (addr < env->slr || addr > env->shr) {
+ CPUState *cs = env_cpu(env);
+
qemu_log_mask(CPU_LOG_INT, "Stack protector violation at "
TARGET_FMT_lx " %x %x\n",
addr, env->slr, env->shr);
+
env->ear = addr;
env->esr = ESR_EC_STACKPROT;
- helper_raise_exception(env, EXCP_HW_EXCP);
+ cs->exception_index = EXCP_HW_EXCP;
+ cpu_loop_exit_restore(cs, GETPC());
}
}
--
2.25.1
- [PATCH v2 41/76] target/microblaze: Convert dec_mul to decodetree, (continued)
- [PATCH v2 41/76] target/microblaze: Convert dec_mul to decodetree, Richard Henderson, 2020/08/28
- [PATCH v2 45/76] target/microblaze: Convert dec_barrel to decodetree, Richard Henderson, 2020/08/28
- [PATCH v2 43/76] target/microblaze: Unwind properly when raising divide-by-zero, Richard Henderson, 2020/08/28
- [PATCH v2 44/76] target/microblaze: Convert dec_bit to decodetree, Richard Henderson, 2020/08/28
- [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 <=
- [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, 2020/08/28
- [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