Support the "subs pc, lr" Thumb-2 exception return instruction.

Signed-off-by: Rabin Vincent <ra...@rab.in>
---
 target-arm/translate.c |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/target-arm/translate.c b/target-arm/translate.c
index 10a516b..f0667e5 100644
--- a/target-arm/translate.c
+++ b/target-arm/translate.c
@@ -8001,8 +8001,17 @@ 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;
+                        }
+
+                        tmp = load_reg(s, rn);
+                        tmp2 = new_tmp();
+                        tcg_gen_movi_i32(tmp2, insn & 0xff);
+                        gen_helper_sub_cc(tmp, tmp, tmp2);
+                        gen_exception_return(s, tmp);
+                        dead_tmp(tmp2);
+                        break;
                     case 6: /* mrs cpsr.  */
                         tmp = new_tmp();
                         if (IS_M(env)) {
-- 
1.6.6



Reply via email to