1 |
|
/* |
2 |
|
* mon_disass.cpp - Disassemblers |
3 |
|
* |
4 |
< |
* cxmon (C) 1997-2002 Christian Bauer, Marc Hellwig |
4 |
> |
* cxmon (C) 1997-2004 Christian Bauer, Marc Hellwig |
5 |
|
* |
6 |
|
* This program is free software; you can redistribute it and/or modify |
7 |
|
* it under the terms of the GNU General Public License as published by |
40 |
|
extern "C" { |
41 |
|
#include "disass/dis-asm.h" |
42 |
|
|
43 |
< |
int buffer_read_memory(bfd_vma from, bfd_byte *to, int length, struct disassemble_info *info) |
43 |
> |
int buffer_read_memory(bfd_vma from, bfd_byte *to, unsigned int length, struct disassemble_info *info) |
44 |
|
{ |
45 |
|
while (length--) |
46 |
|
*to++ = mon_read_byte(from++); |
166 |
|
return num; |
167 |
|
} |
168 |
|
|
169 |
< |
int disass_x86(FILE *f, uint32 adr, bool i8086) |
169 |
> |
int disass_x86(FILE *f, uint32 adr, uint32 bits) |
170 |
|
{ |
171 |
|
// Initialize info for GDB disassembler |
172 |
|
disassemble_info info; |
175 |
|
sfile.buffer = buf; |
176 |
|
sfile.current = buf; |
177 |
|
INIT_DISASSEMBLE_INFO(info, (FILE *)&sfile, (fprintf_ftype)mon_sprintf); |
178 |
< |
if (i8086) |
178 |
> |
if (bits == 16) |
179 |
|
info.mach = bfd_mach_i386_i8086; |
180 |
+ |
else if (bits == 64) |
181 |
+ |
info.mach = bfd_mach_x86_64; |
182 |
|
|
183 |
|
// Disassemble instruction |
184 |
|
lookup_lowmem = false; |
185 |
< |
int num = print_insn_i386(adr, &info); |
185 |
> |
int num = print_insn_i386_att(adr, &info); |
186 |
|
|
187 |
|
for (int i=0; i<6; i++) { |
188 |
|
if (num > i) |