summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2019-10-09 13:48:06 +0100
committerNick Clifton <nickc@redhat.com>2019-10-09 13:48:06 +0100
commit1d3787499d6edd07b30f3fc7b26962a1c695b8a4 (patch)
tree1d09c665560e756e49860f513820650db3095226
parent8610e0fd93ea253f9beb9ebb6e50e8807ed83327 (diff)
downloadbinutils-gdb-1d3787499d6edd07b30f3fc7b26962a1c695b8a4.tar.gz
Fix the disassembly of the LDS and STS instructions of the AVR architecture.
PR 25041 opcodes * avr-dis.c (avr_operand): Fix construction of address for lds/sts instructions. gas * testsuite/gas/avr/pr25041.s: New test. * testsuite/gas/avr/pr25041.d: New test driver.
-rw-r--r--gas/ChangeLog6
-rw-r--r--gas/testsuite/gas/avr/pr25041.d9
-rw-r--r--gas/testsuite/gas/avr/pr25041.s4
-rw-r--r--opcodes/ChangeLog6
-rw-r--r--opcodes/avr-dis.c2
5 files changed, 27 insertions, 0 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index 41bcaa33327..3a1183b3742 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,9 @@
+2019-10-09 Nick Clifton <nickc@redhat.com>
+
+ PR 25041
+ * testsuite/gas/avr/pr25041.s: New test.
+ * testsuite/gas/avr/pr25041.d: New test driver.
+
2019-10-07 Jozef Lawrynowicz <jozef.l@mittosystems.com>
* config/tc-msp430.c (md_parse_option): Set lower_data_region_only
diff --git a/gas/testsuite/gas/avr/pr25041.d b/gas/testsuite/gas/avr/pr25041.d
new file mode 100644
index 00000000000..086fe0a15a2
--- /dev/null
+++ b/gas/testsuite/gas/avr/pr25041.d
@@ -0,0 +1,9 @@
+#name: PR 25041 (correct generation of lds/sts addresses)
+#as: -m "attiny10"
+#target: avr-*-*
+#objdump: -Dm"avr:100"
+
+#...
+00000000 <_start>:
+ 0: 00 a0 lds r16, 0x80 ; 0x800080 <_start\+0x800080>
+ 2: 00 a8 sts 0x80, r16 ; 0x800080 <_start\+0x800080>
diff --git a/gas/testsuite/gas/avr/pr25041.s b/gas/testsuite/gas/avr/pr25041.s
new file mode 100644
index 00000000000..b5745b408a9
--- /dev/null
+++ b/gas/testsuite/gas/avr/pr25041.s
@@ -0,0 +1,4 @@
+
+_start:
+ lds r16, 0x80
+ sts 0x80, r16
diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog
index 75167a0c68f..acde7a25313 100644
--- a/opcodes/ChangeLog
+++ b/opcodes/ChangeLog
@@ -1,3 +1,9 @@
+2019-10-09 Nick Clifton <nickc@redhat.com>
+
+ PR 25041
+ * avr-dis.c (avr_operand): Fix construction of address for lds/sts
+ instructions.
+
2019-10-07 Jan Beulich <jbeulich@suse.com>
* opcodes/i386-opc.tbl (movsd): Add Dword and IgnoreSize.
diff --git a/opcodes/avr-dis.c b/opcodes/avr-dis.c
index b847ee993c6..ab38366f64e 100644
--- a/opcodes/avr-dis.c
+++ b/opcodes/avr-dis.c
@@ -198,6 +198,8 @@ avr_operand (unsigned int insn, unsigned int insn2, unsigned int pc, int constra
{
unsigned int val = ((insn & 0xf) | ((insn & 0x600) >> 5)
| ((insn & 0x100) >> 2));
+ if ((insn & 0x100) == 0)
+ val |= 0x80;
*sym = 1;
*sym_addr = val | 0x800000;
sprintf (buf, "0x%02x", val);