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

login
register
mail settings
Submitter Adam Lackorzynski
Date Sept. 2, 2010, 8:27 p.m.
Message ID <20100902202731.GA23301@os.inf.tu-dresden.de>
Download mbox | patch
Permalink /patch/63551/
State New
Headers show

Comments

Adam Lackorzynski - Sept. 2, 2010, 8:27 p.m.
Handle smc as an undefined instruction instead of having it wrongly
interpreted as some other one.

Signed-off-by: Adam Lackorzynski <adam@os.inf.tu-dresden.de>
---
 target-arm/translate.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
Stefan Weil - Sept. 2, 2010, 9:19 p.m.
Am 02.09.2010 22:27, schrieb Adam Lackorzynski:
> Handle smc as an undefined instruction instead of having it wrongly
> interpreted as some other one.
>
> Signed-off-by: Adam Lackorzynski<adam@os.inf.tu-dresden.de>
> ---
>   target-arm/translate.c |    6 +++++-
>   1 files changed, 5 insertions(+), 1 deletions(-)
>
> diff --git a/target-arm/translate.c b/target-arm/translate.c
> index 6fcdd7e..9b5d650 100644
> --- a/target-arm/translate.c
> +++ b/target-arm/translate.c
> @@ -6346,7 +6346,11 @@ static void disas_arm_insn(CPUState * env, DisasContext *s)
>               dead_tmp(tmp2);
>               store_reg(s, rd, tmp);
>               break;
> -        case 7: /* bkpt */
> +        case 7:
> +            /* SMC? */
> +            if ((insn&  0xfffffff0) == 0xe1600070)
> +              goto illegal_op;
>    

QEMU's CODING_STYLE requires {} here.


> +            /* bkpt */
>               gen_set_condexec(s);
>               gen_set_pc_im(s->pc - 4);
>               gen_exception(EXCP_BKPT);
>

Patch

diff --git a/target-arm/translate.c b/target-arm/translate.c
index 6fcdd7e..9b5d650 100644
--- a/target-arm/translate.c
+++ b/target-arm/translate.c
@@ -6346,7 +6346,11 @@  static void disas_arm_insn(CPUState * env, DisasContext *s)
             dead_tmp(tmp2);
             store_reg(s, rd, tmp);
             break;
-        case 7: /* bkpt */
+        case 7:
+            /* SMC? */
+            if ((insn & 0xfffffff0) == 0xe1600070)
+              goto illegal_op;
+            /* bkpt */
             gen_set_condexec(s);
             gen_set_pc_im(s->pc - 4);
             gen_exception(EXCP_BKPT);