From b4e2bd3563af75ba5b9fe809c8cf79d2d34aecf3 Mon Sep 17 00:00:00 2001 From: Richard Henderson Date: Wed, 5 Sep 2012 17:27:40 -0700 Subject: target-s390: Send signals for divide Signed-off-by: Richard Henderson --- target-s390x/misc_helper.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'target-s390x/misc_helper.c') diff --git a/target-s390x/misc_helper.c b/target-s390x/misc_helper.c index 2aa1ed0..6dca0eb 100644 --- a/target-s390x/misc_helper.c +++ b/target-s390x/misc_helper.c @@ -41,6 +41,26 @@ #define HELPER_LOG(x...) #endif +/* Raise an exception dynamically from a helper function. */ +void QEMU_NORETURN runtime_exception(CPUS390XState *env, int excp, + uintptr_t retaddr) +{ + int t; + + env->exception_index = EXCP_PGM; + env->int_pgm_code = excp; + + /* Use the (ultimate) callers address to find the insn that trapped. */ + cpu_restore_state(env, retaddr); + + /* Advance past the insn. */ + t = cpu_ldub_code(env, env->psw.addr); + env->int_pgm_ilen = t = get_ilen(t); + env->psw.addr += 2 * t; + + cpu_loop_exit(env); +} + /* Raise an exception statically from a TB. */ void HELPER(exception)(CPUS390XState *env, uint32_t excp) { -- cgit v1.1