summaryrefslogtreecommitdiff
path: root/target/openrisc/exception_helper.c
diff options
context:
space:
mode:
authorRichard Henderson <rth@twiddle.net>2015-04-07 13:31:50 -0700
committerRichard Henderson <rth@twiddle.net>2017-02-14 08:14:59 +1100
commit9ecaa27e7123211f45ca723a736ffae14f6c1f42 (patch)
treec8bf8f3ba1f9c636c86ad110c9269425dc82f734 /target/openrisc/exception_helper.c
parent6da544a6c4572ed11931218e940f45d00b1fe3a7 (diff)
downloadqemu-9ecaa27e7123211f45ca723a736ffae14f6c1f42.tar.gz
target/openrisc: Streamline arithmetic and OVE
Fix incorrect overflow calculation. Move overflow exception check to a helper function, to eliminate inline branches. Remove some incorrect special casing of R0. Implement multiply inline. Reviewed-by: Bastian Koppelmann <kbastian@mail.uni-paderborn.de> Signed-off-by: Richard Henderson <rth@twiddle.net>
Diffstat (limited to 'target/openrisc/exception_helper.c')
-rw-r--r--target/openrisc/exception_helper.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/target/openrisc/exception_helper.c b/target/openrisc/exception_helper.c
index 329a9e400b..7e54c978be 100644
--- a/target/openrisc/exception_helper.c
+++ b/target/openrisc/exception_helper.c
@@ -20,6 +20,7 @@
#include "qemu/osdep.h"
#include "cpu.h"
#include "exec/helper-proto.h"
+#include "exec/exec-all.h"
#include "exception.h"
void HELPER(exception)(CPUOpenRISCState *env, uint32_t excp)
@@ -28,3 +29,14 @@ void HELPER(exception)(CPUOpenRISCState *env, uint32_t excp)
raise_exception(cpu, excp);
}
+
+void HELPER(ove)(CPUOpenRISCState *env, target_ulong test)
+{
+ if (unlikely(test) && (env->sr & SR_OVE)) {
+ OpenRISCCPU *cpu = openrisc_env_get_cpu(env);
+ CPUState *cs = CPU(cpu);
+
+ cs->exception_index = EXCP_RANGE;
+ cpu_loop_exit_restore(cs, GETPC());
+ }
+}