1 |
|
/* |
2 |
|
* mon_disass.cpp - Disassemblers |
3 |
|
* |
4 |
< |
* cxmon (C) 1997-2003 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 |
20 |
|
|
21 |
|
#include "sysdeps.h" |
22 |
|
|
23 |
+ |
#include <assert.h> |
24 |
|
#include <stdarg.h> |
25 |
|
|
26 |
|
#include "mon.h" |
85 |
|
} |
86 |
|
} |
87 |
|
} |
88 |
< |
info->fprintf_func(info->stream, "$%08x", addr); |
88 |
> |
if (addr >= UVAL64(0x100000000)) |
89 |
> |
info->fprintf_func(info->stream, "$%08x%08x", (uint32)(addr >> 32), (uint32)addr); |
90 |
> |
else |
91 |
> |
info->fprintf_func(info->stream, "$%08x", (uint32)addr); |
92 |
|
} |
93 |
|
|
94 |
|
int generic_symbol_at_address(bfd_vma addr, struct disassemble_info *info) |
169 |
|
|
170 |
|
return num; |
171 |
|
} |
172 |
+ |
|
173 |
+ |
int disass_mips(FILE *f, uint32 adr, int little_endian) |
174 |
+ |
{ |
175 |
+ |
// Initialize info for GDB disassembler |
176 |
+ |
disassemble_info info; |
177 |
+ |
char buf[1024]; |
178 |
+ |
SFILE sfile = {buf, buf}; |
179 |
+ |
sfile.buffer = buf; |
180 |
+ |
sfile.current = buf; |
181 |
+ |
INIT_DISASSEMBLE_INFO(info, (FILE *)&sfile, (fprintf_ftype)mon_sprintf); |
182 |
+ |
|
183 |
+ |
// Disassemble instruction |
184 |
+ |
lookup_lowmem = false; |
185 |
+ |
int num = little_endian ? print_insn_little_mips(adr, &info) : print_insn_big_mips(adr, &info); |
186 |
+ |
|
187 |
+ |
assert(num == 4); |
188 |
+ |
for (int i=0; i<4; i++) |
189 |
+ |
fprintf(f, " %02x", mon_read_byte(adr + i)); |
190 |
+ |
|
191 |
+ |
fprintf(f, " %s\n", buf); |
192 |
+ |
|
193 |
+ |
return num; |
194 |
+ |
} |
195 |
|
|
196 |
|
int disass_x86(FILE *f, uint32 adr, uint32 bits) |
197 |
|
{ |