aboutsummaryrefslogtreecommitdiff
path: root/target-mips/op.c
diff options
context:
space:
mode:
Diffstat (limited to 'target-mips/op.c')
-rw-r--r--target-mips/op.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/target-mips/op.c b/target-mips/op.c
index aedd7bd..9b0cee0 100644
--- a/target-mips/op.c
+++ b/target-mips/op.c
@@ -289,6 +289,22 @@ void op_store_LO (void)
#undef MEMSUFFIX
#endif
+/* Addresses computation */
+void op_addr_add (void)
+{
+/* For compatibility with 32-bit code, data reference in user mode
+ with Status_UX = 0 should be casted to 32-bit and sign extended.
+ See the MIPS64 PRA manual, section 4.10. */
+#ifdef TARGET_MIPS64
+ if ((env->CP0_Status & (1 << CP0St_UM)) &&
+ !(env->CP0_Status & (1 << CP0St_UX)))
+ T0 = (int64_t)(int32_t)(T0 + T1);
+ else
+#endif
+ T0 += T1;
+ RETURN();
+}
+
/* Arithmetic */
void op_add (void)
{