target-arm: Handle 'smc' as an undefined instruction
PATCH 1/1 target-arm: Handle 'smc' as an undefined instruction
Refine check on bkpt so that smc and undefined instruction encodings are handled as an undefined instruction and trap.
Signed-off-by Adam Lackorzynski <[email protected]>
--- target-arm/translate.c | 9 ++++++++- 1 files changed, 8 insertions(+), 1 deletions(-)
target-arm/translate.c +8 -1
@@ -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 );
Signature · 7 lines
1.7.2.3 Adam -- Adam [email protected] Lackorzynski http://os.inf.tu-dresden.de/~adam/
Quoted 5 lines · Adam Lackorzynski
Refine check on bkpt so that smc and undefined instruction encodings are handled as an undefined instruction and trap.
Signed-off-by Adam Lackorzynski <[email protected]>
This patch looks good to me. I note that there's actually an implementation of SMC and at least some of the TrustZone extension in the qemu-meego tree. However, for the moment this patch is correct: SMC should UNDEF on cores without TrustZone (which is what current qemu effectively is).
Acked-by Peter Maydell <[email protected]>
-- PMM