16 |
|
along with this program; if not, write to the Free Software |
17 |
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ |
18 |
|
|
19 |
+ |
#include <stdlib.h> |
20 |
|
#include "dis-asm.h" |
21 |
|
#include "floatformat.h" |
22 |
|
#include "opintl.h" |
23 |
|
|
24 |
|
#include "m68k.h" |
25 |
|
|
25 |
– |
#include "../mon_atraps.h" |
26 |
– |
|
26 |
|
/* Local function prototypes */ |
27 |
|
|
28 |
|
static int |
200 |
|
/* Then create a sorted table of pointers that point into the |
201 |
|
unsorted table. */ |
202 |
|
opc_pointer[0] = ((const struct m68k_opcode **) |
203 |
< |
xmalloc (sizeof (struct m68k_opcode *) |
203 |
> |
malloc (sizeof (struct m68k_opcode *) |
204 |
|
* m68k_numopcodes)); |
205 |
|
opcodes[0] = opc_pointer[0]; |
206 |
|
for (i = 1; i < 16; i++) |
435 |
|
return p - buffer; |
436 |
|
|
437 |
|
invalid: { |
438 |
< |
unsigned long opcode = (buffer[0] << 8) | buffer[1]; |
440 |
< |
const struct atrap_info *p = atraps; |
438 |
> |
extern void print_68k_invalid_opcode(unsigned long, struct disassemble_info *); |
439 |
|
|
440 |
|
/* Handle undefined instructions. */ |
441 |
|
info->fprintf_func = save_printer; |
442 |
|
info->print_address_func = save_print_address; |
443 |
< |
|
446 |
< |
/* Look for MacOS A-Trap */ |
447 |
< |
while (p->word) { |
448 |
< |
if (p->word == opcode) { |
449 |
< |
(*info->fprintf_func) (info->stream, p->name); |
450 |
< |
return 2; |
451 |
< |
} |
452 |
< |
p++; |
453 |
< |
} |
454 |
< |
|
455 |
< |
(*info->fprintf_func) (info->stream, "?"); |
443 |
> |
print_68k_invalid_opcode((buffer[0] << 8) | buffer[1], info); |
444 |
|
return 2; |
445 |
|
} |
446 |
|
} |
1212 |
|
buf[0] = '\0'; |
1213 |
|
} |
1214 |
|
if (outer_disp) |
1215 |
< |
(*info->fprintf_func) (info->stream, "],$%08x", outer_disp); |
1215 |
> |
(*info->fprintf_func) (info->stream, "],$%08x", (uint32)outer_disp); |
1216 |
|
else |
1217 |
< |
(*info->fprintf_func) (info->stream, "]", outer_disp); |
1217 |
> |
(*info->fprintf_func) (info->stream, "]"); |
1218 |
|
if (buf[0] != '\0') |
1219 |
|
(*info->fprintf_func) (info->stream, ",%s", buf); |
1220 |
|
(*info->fprintf_func) (info->stream, ")"); |
1231 |
|
bfd_vma disp; |
1232 |
|
disassemble_info *info; |
1233 |
|
{ |
1234 |
< |
if (regno == -1) |
1235 |
< |
{ |
1236 |
< |
(*info->print_address_func) (disp, info); |
1237 |
< |
(*info->fprintf_func) (info->stream, ",pc"); |
1238 |
< |
} |
1239 |
< |
else |
1240 |
< |
{ |
1241 |
< |
(*info->fprintf_func) (info->stream, "$%08x", disp); |
1242 |
< |
if (regno == -3) |
1243 |
< |
(*info->fprintf_func) (info->stream, ",zpc"); |
1256 |
< |
else if (regno != -2) |
1257 |
< |
(*info->fprintf_func) (info->stream, ",%s", reg_names[regno]); |
1258 |
< |
} |
1234 |
> |
if (regno == -1) |
1235 |
> |
(*info->fprintf_func) (info->stream, "$%08x,pc", disp); |
1236 |
> |
else { |
1237 |
> |
if (regno == -3) |
1238 |
> |
(*info->fprintf_func) (info->stream, "$%08x,zpc", disp); |
1239 |
> |
else if (regno == -2) |
1240 |
> |
(*info->print_address_func) (disp, info); |
1241 |
> |
else |
1242 |
> |
(*info->fprintf_func) (info->stream, "$%08x,%s", disp, reg_names[regno]); |
1243 |
> |
} |
1244 |
|
} |