summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRabin Vincent <rabin@rab.in>2010-02-15 00:02:35 +0530
committerPaul Brook <paul@codesourcery.com>2010-02-19 13:38:43 +0000
commitb8b45b68f8836c1db8422badf3c0c573a88f8b43 (patch)
treeeafa6de7aa74f40c44b822ff0f69a2cbe0413698
parentfa26df032ec3da7bf0db541e40b2ac1b19aea391 (diff)
downloadqemu-b8b45b68f8836c1db8422badf3c0c573a88f8b43.tar.gz
target-arm: implement Thumb-2 exception return
Support the "subs pc, lr" Thumb-2 exception return instruction. Signed-off-by: Rabin Vincent <rabin@rab.in> Signed-off-by: Paul Brook <paul@codesourcery.com>
-rw-r--r--target-arm/translate.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/target-arm/translate.c b/target-arm/translate.c
index 10a516b909..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)) {