Patchwork target-arm: Handle 'smc' as an undefined instruction

login
register
mail settings
Submitter Adam Lackorzynski
Date Sept. 25, 2010, 8:50 a.m.
Message ID <20100925085028.GA5265@os.inf.tu-dresden.de>
Download mbox | patch
Permalink /patch/65739/
State New
Headers show

Comments

Adam Lackorzynski - Sept. 25, 2010, 8:50 a.m.
Refine check on bkpt so that smc and undefined instruction encodings are
handled as an undefined instruction and trap.

Signed-off-by: Adam Lackorzynski <adam@os.inf.tu-dresden.de>
---
 target-arm/translate.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

Patch

diff --git a/target-arm/translate.c b/target-arm/translate.c
index 6fcdd7e..9ac1f8b 100644
--- a/target-arm/translate.c
+++ b/target-arm/translate.c
@@ -6346,7 +6346,14 @@  static void disas_arm_insn(CPUState * env, DisasContext *s)
             dead_tmp(tmp2);
             store_reg(s, rd, tmp);
             break;
-        case 7: /* bkpt */
+        case 7:
+            /* SMC instruction (op1 == 3)
+               and undefined instructions (op1 == 0 || op1 == 2)
+               will trap */
+            if (op1 != 1) {
+                goto illegal_op;
+            }
+            /* bkpt */
             gen_set_condexec(s);
             gen_set_pc_im(s->pc - 4);
             gen_exception(EXCP_BKPT);