Skip to content

Commit

Permalink
ia64 disas support
Browse files Browse the repository at this point in the history
Taken from binutils SVN, using last GPLv2 version.

Signed-off-by: Aurelien Jarno <[email protected]>
  • Loading branch information
aurel32 committed Apr 1, 2010
1 parent 45d679d commit 903ec55
Show file tree
Hide file tree
Showing 5 changed files with 10,625 additions and 0 deletions.
1 change: 1 addition & 0 deletions Makefile.objs
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@ libdis-$(CONFIG_ARM_DIS) += arm-dis.o
libdis-$(CONFIG_CRIS_DIS) += cris-dis.o
libdis-$(CONFIG_HPPA_DIS) += hppa-dis.o
libdis-$(CONFIG_I386_DIS) += i386-dis.o
libdis-$(CONFIG_IA64_DIS) += ia64-dis.o
libdis-$(CONFIG_M68K_DIS) += m68k-dis.o
libdis-$(CONFIG_MICROBLAZE_DIS) += microblaze-dis.o
libdis-$(CONFIG_MIPS_DIS) += mips-dis.o
Expand Down
4 changes: 4 additions & 0 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -2658,6 +2658,10 @@ for i in $ARCH $TARGET_BASE_ARCH ; do
echo "CONFIG_I386_DIS=y" >> $config_target_mak
echo "CONFIG_I386_DIS=y" >> $libdis_config_mak
;;
ia64*)
echo "CONFIG_IA64_DIS=y" >> $config_target_mak
echo "CONFIG_IA64_DIS=y" >> $libdis_config_mak
;;
m68k)
echo "CONFIG_M68K_DIS=y" >> $config_target_mak
echo "CONFIG_M68K_DIS=y" >> $libdis_config_mak
Expand Down
5 changes: 5 additions & 0 deletions dis-asm.h
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,9 @@ enum bfd_architecture
#define bfd_mach_cris_v32 32
#define bfd_mach_cris_v10_v32 1032
bfd_arch_microblaze, /* Xilinx MicroBlaze. */
bfd_arch_ia64, /* HP/Intel ia64 */
#define bfd_mach_ia64_elf64 64
#define bfd_mach_ia64_elf32 32
bfd_arch_last
};
#define bfd_mach_s390_31 31
Expand Down Expand Up @@ -401,6 +404,7 @@ extern int print_insn_ppc (bfd_vma, disassemble_info*);
extern int print_insn_s390 (bfd_vma, disassemble_info*);
extern int print_insn_crisv32 (bfd_vma, disassemble_info*);
extern int print_insn_microblaze (bfd_vma, disassemble_info*);
extern int print_insn_ia64 (bfd_vma, disassemble_info*);

#if 0
/* Fetch the disassembler for a given BFD, if that support is available. */
Expand Down Expand Up @@ -468,6 +472,7 @@ extern int generic_symbol_at_address (bfd_vma, struct 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);
Expand Down
17 changes: 17 additions & 0 deletions disas.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,21 @@ generic_symbol_at_address (bfd_vma addr, struct disassemble_info *info)
return 1;
}

bfd_vma bfd_getl64 (const bfd_byte *addr)
{
unsigned long long v;

v = (unsigned long long) addr[0];
v |= (unsigned long long) addr[1] << 8;
v |= (unsigned long long) addr[2] << 16;
v |= (unsigned long long) addr[3] << 24;
v |= (unsigned long long) addr[4] << 32;
v |= (unsigned long long) addr[5] << 40;
v |= (unsigned long long) addr[6] << 48;
v |= (unsigned long long) addr[7] << 56;
return (bfd_vma) v;
}

bfd_vma bfd_getl32 (const bfd_byte *addr)
{
unsigned long v;
Expand Down Expand Up @@ -278,6 +293,8 @@ void disas(FILE *out, void *code, unsigned long size)
print_insn = print_insn_s390;
#elif defined(__hppa__)
print_insn = print_insn_hppa;
#elif defined(__ia64__)
print_insn = print_insn_ia64;
#else
fprintf(out, "0x%lx: Asm output not supported on this arch\n",
(long) code);
Expand Down
Loading

0 comments on commit 903ec55

Please sign in to comment.