* Add support for ppc64 disassembler

This commit is contained in:
pancake 2011-01-23 18:19:03 +01:00
parent c79c75c9e7
commit afb634f97d
4 changed files with 16 additions and 12 deletions

5
TODO
View File

@ -7,6 +7,7 @@ pancake
-------
- mount /mnt/ must chop last '/'
earada
------
- fix instruction navigation (earada)
@ -14,6 +15,10 @@ earada
- use 'jk' with bwdisasm to go up to previous opcode.
- r_asm can reduce cpu without disasm on fixed size ops archs.
nibble
------
- not identified as cmp instruction by analysis. (85f6 test esi, esi)
0.7 release
===========
* GMP

View File

@ -1,4 +1,4 @@
/* radare - LGPL - Copyright 2009-2010 pancake<@nopcode.org> */
/* radare - LGPL - Copyright 2009-2011 pancake<@nopcode.org> */
#include <stdio.h>
#include <r_asm.h>

View File

@ -12,7 +12,6 @@
#include "dis-asm.h"
static int ppc_mode = 0;
static unsigned long Offset = 0;
static char *buf_global = NULL;
static unsigned char bytes[4];
@ -44,11 +43,11 @@ static int buf_fprintf(void *stream, const char *format, ...) {
char *tmp;
if (buf_global == NULL)
return 0;
va_start(ap, format);
tmp = alloca(strlen(format)+strlen(buf_global)+2);
sprintf(tmp, "%s%s", buf_global, format);
vsprintf(buf_global, tmp, ap);
va_end(ap);
va_start (ap, format);
tmp = alloca (strlen (format)+strlen (buf_global)+2);
sprintf (tmp, "%s%s", buf_global, format);
vsprintf (buf_global, tmp, ap);
va_end (ap);
return 0;
}
@ -60,8 +59,8 @@ static int disassemble(struct r_asm_t *a, struct r_asm_aop_t *aop, ut8 *buf, ut6
memcpy (bytes, buf, 4); // TODO handle thumb
/* prepare disassembler */
memset (&disasm_obj, '\0', sizeof(struct disassemble_info));
ppc_mode = a->bits;
memset (&disasm_obj, '\0', sizeof (struct disassemble_info));
disasm_obj.disassembler_options=(a->bits==64)?"64":"";
disasm_obj.buffer = bytes;
disasm_obj.read_memory_func = &ppc_buffer_read_memory;
disasm_obj.symbol_at_address_func = &symbol_at_address;
@ -85,7 +84,7 @@ static int disassemble(struct r_asm_t *a, struct r_asm_aop_t *aop, ut8 *buf, ut6
RAsmPlugin r_asm_plugin_ppc = {
.name = "ppc",
.arch = "ppc",
.bits = (int[]){ 32, 0 },
.bits = (int[]){ 32, 64, 0 },
.desc = "PPC disassembly plugin",
.init = NULL,
.fini = NULL,

View File

@ -314,8 +314,8 @@ R_API ut64 r_io_seek(struct r_io_t *io, ut64 offset, int whence) {
// r_io_sundo_push (io);
ret = (!io->debug && io->va && !list_empty (&io->sections))?
r_io_section_offset_to_vaddr (io, io->off) : io->off;
} else eprintf ("r_io_seek: cannot seek to %"PFMT64x"\n", offset);
} else { eprintf ("r_io_seek: null fd\n"); asm("int3"); }
} //else eprintf ("r_io_seek: cannot seek to %"PFMT64x"\n", offset);
} //else { eprintf ("r_io_seek: null fd\n"); }
return ret;
}