aboutsummaryrefslogtreecommitdiff
path: root/target-arm/translate.c
diff options
context:
space:
mode:
Diffstat (limited to 'target-arm/translate.c')
-rw-r--r--target-arm/translate.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/target-arm/translate.c b/target-arm/translate.c
index 786c3294da..8b3b12d67e 100644
--- a/target-arm/translate.c
+++ b/target-arm/translate.c
@@ -8001,8 +8001,16 @@ static int disas_thumb2_insn(CPUState *env, DisasContext *s, uint16_t insn_hw1)
gen_bx(s, tmp);
break;
case 5: /* Exception return. */
- /* Unpredictable in user mode. */
- goto illegal_op;
+ if (IS_USER(s)) {
+ goto illegal_op;
+ }
+ if (rn != 14 || rd != 15) {
+ goto illegal_op;
+ }
+ tmp = load_reg(s, rn);
+ tcg_gen_subi_i32(tmp, tmp, insn & 0xff);
+ gen_exception_return(s, tmp);
+ break;
case 6: /* mrs cpsr. */
tmp = new_tmp();
if (IS_M(env)) {
@@ -8898,7 +8906,7 @@ static void disas_thumb_insn(CPUState *env, DisasContext *s)
shift = CPSR_A | CPSR_I | CPSR_F;
else
shift = 0;
- gen_set_psr_im(s, shift, 0, ((insn & 7) << 6) & shift);
+ gen_set_psr_im(s, ((insn & 7) << 6), 0, shift);
}
break;