Fix the disassembly of the LDS and STS instructions of the AVR architecture.
authorNick Clifton <nickc@redhat.com>
Wed, 9 Oct 2019 12:48:06 +0000 (13:48 +0100)
committerNick Clifton <nickc@redhat.com>
Wed, 9 Oct 2019 12:48:06 +0000 (13:48 +0100)
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.

gas/ChangeLog
gas/testsuite/gas/avr/pr25041.d [new file with mode: 0644]
gas/testsuite/gas/avr/pr25041.s [new file with mode: 0644]
opcodes/ChangeLog
opcodes/avr-dis.c

index 41bcaa33327cea53745099368fca9e6e27faeaa5..3a1183b3742332b2947ad6ee57b970ac05cd2024 100644 (file)
@@ -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 (file)
index 0000000..086fe0a
--- /dev/null
@@ -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 (file)
index 0000000..b5745b4
--- /dev/null
@@ -0,0 +1,4 @@
+
+_start:
+       lds r16, 0x80
+       sts 0x80, r16
index 75167a0c68f3621f6dbf36eb33e877f123517006..acde7a25313d96930a7bd55152844192b5f3cc24 100644 (file)
@@ -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.
index b847ee993c6197904f28e09626c1a4f3a6b5cbde..ab38366f64e89119defe74c0469fa4730e3c71ea 100644 (file)
@@ -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);
This page took 0.027883 seconds and 4 git commands to generate.