disas: Use qemu/bswap.h for bfd endian loads

Use the routines we have already instead of open-coding.

Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
This commit is contained in:
Richard Henderson 2020-09-13 14:33:57 -07:00
parent 12b6e9b27d
commit 86944d1d11
2 changed files with 27 additions and 60 deletions

View file

@ -466,11 +466,33 @@ int print_insn_rx(bfd_vma, disassemble_info *);
/* from libbfd */
bfd_vma bfd_getl64 (const bfd_byte *addr);
bfd_vma bfd_getl32 (const bfd_byte *addr);
bfd_vma bfd_getb32 (const bfd_byte *addr);
bfd_vma bfd_getl16 (const bfd_byte *addr);
bfd_vma bfd_getb16 (const bfd_byte *addr);
#include "qemu/bswap.h"
static inline bfd_vma bfd_getl64(const bfd_byte *addr)
{
return ldq_le_p(addr);
}
static inline bfd_vma bfd_getl32(const bfd_byte *addr)
{
return (uint32_t)ldl_le_p(addr);
}
static inline bfd_vma bfd_getl16(const bfd_byte *addr)
{
return lduw_le_p(addr);
}
static inline bfd_vma bfd_getb32(const bfd_byte *addr)
{
return (uint32_t)ldl_be_p(addr);
}
static inline bfd_vma bfd_getb16(const bfd_byte *addr)
{
return lduw_be_p(addr);
}
typedef bool bfd_boolean;
#endif /* DISAS_DIS_ASM_H */