2016-06-02 Jim Wilson sim/aarch64/ * simulator.c (aarch64_step): New var saved_target_byte_order. Force byte order to BFD_ENDIAN_LITTLE before pc read, then restore saved value. diff --git a/sim/aarch64/simulator.c b/sim/aarch64/simulator.c index 88cb03d..5a1814c 100644 --- a/sim/aarch64/simulator.c +++ b/sim/aarch64/simulator.c @@ -14078,12 +14078,18 @@ static bfd_boolean aarch64_step (sim_cpu *cpu) { uint64_t pc = aarch64_get_PC (cpu); + enum bfd_endian saved_target_byte_order; if (pc == TOP_LEVEL_RETURN_PC) return FALSE; aarch64_set_next_PC (cpu, pc + 4); + + /* Code is always little-endian. */ + saved_target_byte_order = current_target_byte_order; + current_target_byte_order = BFD_ENDIAN_LITTLE; aarch64_get_instr (cpu) = aarch64_get_mem_u32 (cpu, pc); + current_target_byte_order = saved_target_byte_order; TRACE_INSN (cpu, " pc = %" PRIx64 " instr = %08x", pc, aarch64_get_instr (cpu));