Commit 7c08dbf325fc301e4889fd352222d94d9d6b0451
1 parent
9bf05444
endianness fix
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1055 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
1 changed file
with
9 additions
and
4 deletions
ppc-dis.c
... | ... | @@ -3076,15 +3076,20 @@ static int print_insn_powerpc(FILE *, uint32_t insn, unsigned memaddr, int diale |
3076 | 3076 | int print_insn_ppc (bfd_vma pc, disassemble_info *info) |
3077 | 3077 | { |
3078 | 3078 | uint32_t opc; |
3079 | - | |
3080 | - (*info->read_memory_func)(pc, (bfd_byte *)(&opc), 4, info); | |
3081 | - return print_insn_powerpc (info->stream, tswap32(opc), pc, | |
3079 | + bfd_byte buf[4]; | |
3080 | + | |
3081 | + (*info->read_memory_func)(pc, buf, 4, info); | |
3082 | + if (info->endian == BFD_ENDIAN_BIG) | |
3083 | + opc = bfd_getb32(buf); | |
3084 | + else | |
3085 | + opc = bfd_getl32(buf); | |
3086 | + return print_insn_powerpc (info->stream, opc, pc, | |
3082 | 3087 | PPC | B32 | M601); |
3083 | 3088 | } |
3084 | 3089 | |
3085 | 3090 | /* Print a PowerPC or POWER instruction. */ |
3086 | 3091 | |
3087 | -int | |
3092 | +static int | |
3088 | 3093 | print_insn_powerpc (FILE *out, uint32_t insn, unsigned memaddr, |
3089 | 3094 | int dialect) |
3090 | 3095 | { | ... | ... |