summaryrefslogtreecommitdiff
path: root/target-s390x/misc_helper.c
diff options
context:
space:
mode:
authorRichard Henderson <rth@twiddle.net>2012-09-05 17:27:40 -0700
committerRichard Henderson <rth@twiddle.net>2013-01-05 12:18:37 -0800
commitb4e2bd3563af75ba5b9fe809c8cf79d2d34aecf3 (patch)
tree12581341f19e99c46c25d27b8941bfadb534c082 /target-s390x/misc_helper.c
parent891452e5e274967ffb87d10791620154f2cdc303 (diff)
downloadqemu-b4e2bd3563af75ba5b9fe809c8cf79d2d34aecf3.tar.gz
target-s390: Send signals for divide
Signed-off-by: Richard Henderson <rth@twiddle.net>
Diffstat (limited to 'target-s390x/misc_helper.c')
-rw-r--r--target-s390x/misc_helper.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/target-s390x/misc_helper.c b/target-s390x/misc_helper.c
index 2aa1ed0b5e..6dca0ebabd 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)
{