From 14ade10f840deec02d32530e5a64bd5ec275adbd Mon Sep 17 00:00:00 2001 From: Alexander Graf Date: Tue, 3 Sep 2013 20:12:10 +0100 Subject: target-arm: Add AArch64 translation stub We should translate AArch64 mode separately from AArch32 mode. In AArch64 mode, registers look vastly different, instruction encoding is completely different, basically the system turns into a different machine. So let's do a simple if() in translate.c to decide whether we can handle the current code in the legacy AArch32 code or in the new AArch64 code. So far, the translation always complains about unallocated instructions. There is no emulator functionality in this patch! Signed-off-by: Alexander Graf Signed-off-by: John Rigby Signed-off-by: Peter Maydell Message-id: 1378235544-22290-11-git-send-email-peter.maydell@linaro.org Message-id: 1368505980-17151-5-git-send-email-john.rigby@linaro.org [PMM: * provide no-op versions of a64 functions ifndef TARGET_AARCH64; this lets us avoid #ifdefs in translate.c * insert the missing call to disas_a64_insn() * stash the insn in the DisasContext rather than reloading it in real_unallocated_encoding() ] Signed-off-by: Peter Maydell --- target-arm/translate.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'target-arm/translate.c') diff --git a/target-arm/translate.c b/target-arm/translate.c index db7a1d4..998bde2 100644 --- a/target-arm/translate.c +++ b/target-arm/translate.c @@ -114,6 +114,8 @@ void arm_translate_init(void) offsetof(CPUARMState, exclusive_info), "exclusive_info"); #endif + a64_translate_init(); + #define GEN_HELPER 2 #include "helper.h" } @@ -907,7 +909,11 @@ DO_GEN_ST(st32) static inline void gen_set_pc_im(DisasContext *s, target_ulong val) { - tcg_gen_movi_i32(cpu_R[15], val); + if (s->aarch64) { + gen_a64_set_pc_im(val); + } else { + tcg_gen_movi_i32(cpu_R[15], val); + } } /* Force a TB lookup after an instruction that changes the CPU state. */ @@ -10099,7 +10105,7 @@ static inline void gen_intermediate_code_internal(ARMCPU *cpu, do { #ifdef CONFIG_USER_ONLY /* Intercept jump to the magic kernel page. */ - if (dc->pc >= 0xffff0000) { + if (!dc->aarch64 && dc->pc >= 0xffff0000) { /* We always get here via a jump, so know we are not in a conditional execution block. */ gen_exception(EXCP_KERNEL_TRAP); @@ -10147,7 +10153,9 @@ static inline void gen_intermediate_code_internal(ARMCPU *cpu, tcg_gen_debug_insn_start(dc->pc); } - if (dc->thumb) { + if (dc->aarch64) { + disas_a64_insn(env, dc); + } else if (dc->thumb) { disas_thumb_insn(env, dc); if (dc->condexec_mask) { dc->condexec_cond = (dc->condexec_cond & 0xe) -- cgit v1.1