X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=linux%2Fhost_dasm.c;h=24af1b8f59480371dcd08082800df3926f150a2c;hb=e0bf794693c1c2384ef704e687df448168cd5170;hp=15597b4647f1f2c560ce2dc1de263dce96a9dab2;hpb=c54d04fd84f59c60c6ecdbd2502fbda5de735b4b;p=libpicofe.git diff --git a/linux/host_dasm.c b/linux/host_dasm.c index 15597b4..24af1b8 100644 --- a/linux/host_dasm.c +++ b/linux/host_dasm.c @@ -22,16 +22,42 @@ extern char **g_argv; static struct disassemble_info di; -#ifdef __arm__ +#if defined __arm__ #define print_insn_func print_insn_little_arm #define BFD_ARCH bfd_arch_arm #define BFD_MACH bfd_mach_arm_unknown #define DASM_OPTS "reg-names-std" -#else +#elif defined __aarch64__ +#define print_insn_func print_insn_aarch64 +#define BFD_ARCH bfd_arch_aarch64 +#define BFD_MACH bfd_mach_aarch64 +#define DASM_OPTS NULL +#elif defined __mips__ +#define print_insn_func print_insn_little_mips +#define BFD_ARCH bfd_arch_mips +#define BFD_MACH bfd_mach_mipsisa32 +#define DASM_OPTS NULL +#elif defined __riscv +#define print_insn_func print_insn_riscv +#define BFD_ARCH bfd_arch_riscv +#define BFD_MACH bfd_mach_riscv64 +#define DASM_OPTS NULL +#elif defined __powerpc__ +#define print_insn_func print_insn_little_powerpc +#define BFD_ARCH bfd_arch_powerpc +#define BFD_MACH bfd_mach_ppc64 +#define DASM_OPTS NULL +#elif defined(__x86_64__) || defined(__i386__) #define print_insn_func print_insn_i386_intel #define BFD_ARCH bfd_arch_i386 +#ifdef __x86_64__ +#define BFD_MACH bfd_mach_x86_64_intel_syntax +#else #define BFD_MACH bfd_mach_i386_i386_intel_syntax +#endif #define DASM_OPTS NULL +#else +#error "missing arch support" #endif /* symbols */ @@ -134,7 +160,7 @@ static int dis_asm_read_memory(bfd_vma memaddr, bfd_byte *myaddr, unsigned int len, struct disassemble_info *info) { - memcpy(myaddr, (void *)(int)memaddr, len); + memcpy(myaddr, (void *)(long)memaddr, len); return 0; } @@ -142,7 +168,7 @@ static void dis_asm_memory_error(int status, bfd_vma memaddr, struct disassemble_info *info) { - fprintf(stderr, "memory_error %p\n", (void *)(int)memaddr); + fprintf(stderr, "memory_error %p\n", (void *)(long)memaddr); } static void