Disassembler fixup for CRIS (still wip)

This commit is contained in:
pancake 2014-12-08 13:31:49 +01:00
parent db28d502d0
commit 95ddbeb2ec
2 changed files with 10 additions and 9 deletions

View File

@ -102,7 +102,7 @@ static int cris_constraint
/* Parse disassembler options and store state in info. FIXME: For the
time being, we abuse static variables. */
static bfd_boolean
bfd_boolean
cris_parse_disassembler_options (disassemble_info *info,
enum cris_disass_family distype)
{
@ -1389,7 +1389,7 @@ print_with_operands (const struct cris_opcode *opcodep,
length of the instruction, in bytes. Prefix register names with `$' if
WITH_REG_PREFIX. */
static int
int
print_insn_cris_generic (bfd_vma memaddr,
disassemble_info *info,
bfd_boolean with_reg_prefix)
@ -1602,7 +1602,7 @@ print_insn_crisv32_with_register_prefix (bfd_vma vma,
/* Disassemble, prefixing register names with `$'.
Common v10 and v32 subset. */
static int
int
print_insn_crisv10_v32_with_register_prefix (bfd_vma vma,
disassemble_info *info)
{
@ -1626,7 +1626,7 @@ print_insn_cris_without_register_prefix (bfd_vma vma,
/* Disassemble, no prefixes on register names. CRIS v32. */
static int
int
print_insn_crisv32_without_register_prefix (bfd_vma vma,
disassemble_info *info)
{
@ -1639,7 +1639,7 @@ print_insn_crisv32_without_register_prefix (bfd_vma vma,
/* Disassemble, no prefixes on register names.
Common v10 and v32 subset. */
static int
int
print_insn_crisv10_v32_without_register_prefix (bfd_vma vma,
disassemble_info *info)
{

View File

@ -57,6 +57,9 @@ static int buf_fprintf(void *stream, const char *format, ...) {
return 0;
}
//static int print_insn_crisv10_v32_with_register_prefix (bfd_vma vma, disassemble_info *info);
int print_insn_crisv10_v32_without_register_prefix (bfd_vma vma, disassemble_info *info);
static int disassemble(RAsm *a, RAsmOp *op, const ut8 *buf, int len) {
struct disassemble_info disasm_obj;
op->buf_asm[0]='\0';
@ -64,7 +67,7 @@ static int disassemble(RAsm *a, RAsmOp *op, const ut8 *buf, int len) {
return -1;
buf_global = op->buf_asm;
Offset = a->pc;
memcpy (bytes, buf, 4); // TODO handle thumb
memcpy (bytes, buf, R_MIN (len, 8)); // TODO handle thumb
/* prepare disassembler */
memset (&disasm_obj, '\0', sizeof (struct disassemble_info));
@ -78,9 +81,7 @@ static int disassemble(RAsm *a, RAsmOp *op, const ut8 *buf, int len) {
disasm_obj.fprintf_func = &buf_fprintf;
disasm_obj.stream = stdout;
if (a->big_endian)
op->size = print_insn_big_powerpc((bfd_vma)Offset, &disasm_obj);
else op->size = print_insn_little_powerpc((bfd_vma)Offset, &disasm_obj);
op->size = print_insn_crisv10_v32_without_register_prefix ((bfd_vma)Offset, &disasm_obj);
if (op->size == -1)
strncpy (op->buf_asm, " (data)", R_ASM_BUFSIZE);