aboutsummaryrefslogtreecommitdiff
path: root/opcodes
diff options
context:
space:
mode:
Diffstat (limited to 'opcodes')
-rw-r--r--opcodes/ChangeLog5
-rw-r--r--opcodes/bfin-dis.c10
2 files changed, 14 insertions, 1 deletions
diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog
index fc1b494..48db533 100644
--- a/opcodes/ChangeLog
+++ b/opcodes/ChangeLog
@@ -1,5 +1,10 @@
2014-08-13 Mike Frysinger <vapier@gentoo.org>
+ * bfin-dis.c (ifetch): Do not align pc to 2 bytes.
+ (_print_insn_bfin): Add check for unaligned pc.
+
+2014-08-13 Mike Frysinger <vapier@gentoo.org>
+
* bfin-dis.c (ifetch): New function.
(_print_insn_bfin, print_insn_bfin): Call new ifetch and return
-1 when it errors.
diff --git a/opcodes/bfin-dis.c b/opcodes/bfin-dis.c
index 6991915..8cc4604 100644
--- a/opcodes/bfin-dis.c
+++ b/opcodes/bfin-dis.c
@@ -4645,7 +4645,7 @@ ifetch (bfd_vma pc, disassemble_info *outf, TIword *iw)
bfd_byte buf[2];
int status;
- status = (*outf->read_memory_func) (pc & ~0x01, buf, 2, outf);
+ status = (*outf->read_memory_func) (pc, buf, 2, outf);
if (status != 0)
{
(*outf->memory_error_func) (status, pc, outf);
@@ -4663,6 +4663,14 @@ _print_insn_bfin (bfd_vma pc, disassemble_info *outf)
TIword iw1;
int rv = 0;
+ /* The PC must be 16-bit aligned. */
+ if (pc & 1)
+ {
+ OUTS (outf, "ILLEGAL (UNALIGNED)");
+ /* For people dumping data, just re-align the return value. */
+ return 1;
+ }
+
if (ifetch (pc, outf, &iw0))
return -1;