FreeCalypso > hg > freecalypso-reveng
changeset 114:ca8e43288836
tiobjd: ARM_B reloc handling
author | Michael Spacefalcon <msokolov@ivan.Harhan.ORG> |
---|---|
date | Thu, 03 Apr 2014 06:42:39 +0000 |
parents | d97fbe98600b |
children | 2f23301d2f86 |
files | ticoff/armdis.c ticoff/disasm.c |
diffstat | 2 files changed, 31 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/ticoff/armdis.c Thu Apr 03 06:20:06 2014 +0000 +++ b/ticoff/armdis.c Thu Apr 03 06:42:39 2014 +0000 @@ -497,3 +497,26 @@ return; } } + +void +arm_branch_reloc(sec, rel) + struct internal_scnhdr *sec; + struct internal_reloc *rel; +{ + unsigned word, dest; + + word = get_u32(filemap + sec->data_offset + rel->location); + printf("%08x R\t", word); + if ((word & 0x0E000000) != 0x0A000000) { + printf("<invalid ARM_B reloc: opcode not B or BL>\n"); + return; + } + dest = (word & 0x00FFFFFF) << 2; + if (dest & 0x02000000) + dest |= 0xFC000000; + dest += rel->location + 8; + printf("b%s%s\t", word&0x1000000 ? "l" : "", + condition_decode[word>>28]); + disasm_reloc_target(sec, rel, dest); + putchar('\n'); +}
--- a/ticoff/disasm.c Thu Apr 03 06:20:06 2014 +0000 +++ b/ticoff/disasm.c Thu Apr 03 06:42:39 2014 +0000 @@ -121,8 +121,14 @@ printf("MISALIGNED pos in CODE32 state, aborting\n"); return; } - /* reloc handling to be added */ - arm_disasm_line(sec, pos); + if (rel) { + if (rel->type != RTYPE_ARM_B) { + printf("Wrong reloc type in CODE32 state, aborting\n"); + return; + } + arm_branch_reloc(sec, rel); + } else + arm_disasm_line(sec, pos); incr = 4; break; case 1: /* Thumb */