public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Fix ColdFire movem with disp16+reg addressing
@ 2011-10-18 10:12 Julian Brown
  2011-10-24 15:47 ` Nick Clifton
  0 siblings, 1 reply; 5+ messages in thread
From: Julian Brown @ 2011-10-18 10:12 UTC (permalink / raw)
  To: binutils; +Cc: schwab

[-- Attachment #1: Type: text/plain, Size: 934 bytes --]

Hi,

Both assembly and disassembly of movem for ColdFire has apparently been
broken since the following patch was applied:

http://sourceware.org/ml/binutils/2011-09/msg00005.html

For assembly, the way the table entries for ColdFire moveml in
m68k-opc.c were merged meant that actual mode5 addresses (i.e.
disp16+reg, with non-zero displacement) were actually emitted as mode 7
-- i.e., with bit 1 of the mode set. That gives an illegal instruction
on ColdFire.

Disassembly of those "mode 7" moveml instructions also didn't work, nor
did disassembly of genuine mode 5 moveml instructions. This patch fixes
both problems, and adds a test case for good measure.

OK to apply?

Thanks,

Julian

ChangeLog

    opcodes/
    * m68k-opc.c (m68k_opcodes): Fix entries for ColdFire moveml.

    gas/testsuite/
    * gas/m68k/all.exp (movem-offset): Add test.
    * gas/m68k/movem-offset.s: New test.
    * gas/m68k/movem-offset.d: New.
    

[-- Attachment #2: coldfire-movem-mode-fix-3.diff --]
[-- Type: text/x-patch, Size: 3066 bytes --]

Index: gas/testsuite/gas/m68k/all.exp
===================================================================
RCS file: /cvs/src/src/gas/testsuite/gas/m68k/all.exp,v
retrieving revision 1.27
diff -u -p -r1.27 all.exp
--- gas/testsuite/gas/m68k/all.exp	7 Sep 2011 20:56:09 -0000	1.27
+++ gas/testsuite/gas/m68k/all.exp	18 Oct 2011 09:32:03 -0000
@@ -52,6 +52,8 @@ if { [istarget m68*-*-*] || [istarget fi
     run_dump_test mcf-movsr
     run_dump_test mode5
     run_dump_test mode5 "{name {cf}} {as {-mcpu=5200}}"
+    run_dump_test movem-offset
+    run_dump_test movem-offset "{name {cf}} {as {-mcpu=5485}}"
     run_dump_test mcf-mac
     run_dump_test mcf-emac
     run_dump_test mcf-coproc
Index: gas/testsuite/gas/m68k/movem-offset.d
===================================================================
RCS file: gas/testsuite/gas/m68k/movem-offset.d
diff -N gas/testsuite/gas/m68k/movem-offset.d
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gas/testsuite/gas/m68k/movem-offset.d	18 Oct 2011 09:32:03 -0000
@@ -0,0 +1,14 @@
+#name: movem-offset
+#objdump: -d
+#as: 
+
+.*:     file format .*
+
+Disassembly of section \.text:
+
+0+ <.text>:
+   0:	4cee 047c ffe8 	moveml %fp@\(-24\),%d2-%d6/%a2
+   6:	48ee 047c 0010 	moveml %d2-%d6/%a2,%fp@\(16\)
+   c:	4cee 03ff ffe8 	moveml %fp@\(-24\),%d0-%a1
+  12:	48ee 03ff 0010 	moveml %d0-%a1,%fp@\(16\)
+	\.\.\.
Index: gas/testsuite/gas/m68k/movem-offset.s
===================================================================
RCS file: gas/testsuite/gas/m68k/movem-offset.s
diff -N gas/testsuite/gas/m68k/movem-offset.s
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ gas/testsuite/gas/m68k/movem-offset.s	18 Oct 2011 09:32:03 -0000
@@ -0,0 +1,8 @@
+
+	| Check that non-zero displacements work for movem.
+	.text
+	movem.l -24(%a6),#1148
+	movem.l #1148,16(%a6)
+	movem.l -24(%a6),%d0-%d7/%a0-%a1
+	movem.l %d0-%d7/%a0-%a1,16(%a6)
+	.p2align 4
Index: opcodes/m68k-opc.c
===================================================================
RCS file: /cvs/src/src/opcodes/m68k-opc.c,v
retrieving revision 1.36
diff -u -p -r1.36 m68k-opc.c
--- opcodes/m68k-opc.c	7 Sep 2011 20:56:09 -0000	1.36
+++ opcodes/m68k-opc.c	18 Oct 2011 09:32:03 -0000
@@ -1553,10 +1553,10 @@ const struct m68k_opcode m68k_opcodes[] 
 {"moveml", 4,	one(0044300),	one(0177700), "#w>s", m68000up },
 {"moveml", 4,	one(0046300),	one(0177700), "<sLw", m68000up },
 {"moveml", 4,	one(0046300),	one(0177700), "<s#w", m68000up },
-{"moveml", 4,	one(0044320),	one(0177770), "Lwys", mcfisa_a },
-{"moveml", 4,	one(0044320),	one(0177770), "#wys", mcfisa_a },
-{"moveml", 4,	one(0046320),	one(0177770), "ysLw", mcfisa_a },
-{"moveml", 4,	one(0046320),	one(0177770), "ys#w", mcfisa_a },
+{"moveml", 4,	one(0044300),	one(0177700), "Lwys", mcfisa_a },
+{"moveml", 4,	one(0044300),	one(0177700), "#wys", mcfisa_a },
+{"moveml", 4,	one(0046300),	one(0177700), "ysLw", mcfisa_a },
+{"moveml", 4,	one(0046300),	one(0177700), "ys#w", mcfisa_a },
 
 {"movepw", 2,	one(0000410),	one(0170770), "dsDd", m68000up },
 {"movepw", 2,	one(0000610),	one(0170770), "Ddds", m68000up },

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Fix ColdFire movem with disp16+reg addressing
  2011-10-18 10:12 [PATCH] Fix ColdFire movem with disp16+reg addressing Julian Brown
@ 2011-10-24 15:47 ` Nick Clifton
  2012-04-20 11:50   ` Sebastian Huber
  0 siblings, 1 reply; 5+ messages in thread
From: Nick Clifton @ 2011-10-24 15:47 UTC (permalink / raw)
  To: Julian Brown; +Cc: binutils, schwab

Hi Julian,

>      opcodes/
>      * m68k-opc.c (m68k_opcodes): Fix entries for ColdFire moveml.
>
>      gas/testsuite/
>      * gas/m68k/all.exp (movem-offset): Add test.
>      * gas/m68k/movem-offset.s: New test.
>      * gas/m68k/movem-offset.d: New.

Approved - please apply.

Cheers
   Nick


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Fix ColdFire movem with disp16+reg addressing
  2011-10-24 15:47 ` Nick Clifton
@ 2012-04-20 11:50   ` Sebastian Huber
  2012-04-23  7:08     ` Tristan Gingold
  0 siblings, 1 reply; 5+ messages in thread
From: Sebastian Huber @ 2012-04-20 11:50 UTC (permalink / raw)
  To: binutils

On 10/24/2011 05:49 PM, Nick Clifton wrote:
> Hi Julian,
>
>> opcodes/
>> * m68k-opc.c (m68k_opcodes): Fix entries for ColdFire moveml.
>>
>> gas/testsuite/
>> * gas/m68k/all.exp (movem-offset): Add test.
>> * gas/m68k/movem-offset.s: New test.
>> * gas/m68k/movem-offset.d: New.
>
> Approved - please apply.

This is not in the 2.22 Binutils release.  Is it possible to include this in a 
potential 2.22.1 release?

-- 
Sebastian Huber, embedded brains GmbH

Address : Obere Lagerstr. 30, D-82178 Puchheim, Germany
Phone   : +49 89 18 90 80 79-6
Fax     : +49 89 18 90 80 79-9
E-Mail  : sebastian.huber@embedded-brains.de
PGP     : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Fix ColdFire movem with disp16+reg addressing
  2012-04-20 11:50   ` Sebastian Huber
@ 2012-04-23  7:08     ` Tristan Gingold
  2012-04-25 13:18       ` Sebastian Huber
  0 siblings, 1 reply; 5+ messages in thread
From: Tristan Gingold @ 2012-04-23  7:08 UTC (permalink / raw)
  To: Sebastian Huber; +Cc: binutils


On Apr 20, 2012, at 12:53 PM, Sebastian Huber wrote:

> On 10/24/2011 05:49 PM, Nick Clifton wrote:
>> Hi Julian,
>> 
>>> opcodes/
>>> * m68k-opc.c (m68k_opcodes): Fix entries for ColdFire moveml.
>>> 
>>> gas/testsuite/
>>> * gas/m68k/all.exp (movem-offset): Add test.
>>> * gas/m68k/movem-offset.s: New test.
>>> * gas/m68k/movem-offset.d: New.
>> 
>> Approved - please apply.
> 
> This is not in the 2.22 Binutils release.  Is it possible to include this in a potential 2.22.1 release?

Yes, you can backport it.

I am currently not sure there will be a 2.22.1 release, however.

Tristan.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Fix ColdFire movem with disp16+reg addressing
  2012-04-23  7:08     ` Tristan Gingold
@ 2012-04-25 13:18       ` Sebastian Huber
  0 siblings, 0 replies; 5+ messages in thread
From: Sebastian Huber @ 2012-04-25 13:18 UTC (permalink / raw)
  To: Tristan Gingold; +Cc: binutils

[-- Attachment #1: Type: text/plain, Size: 1075 bytes --]

On 04/23/2012 08:54 AM, Tristan Gingold wrote:
>
> On Apr 20, 2012, at 12:53 PM, Sebastian Huber wrote:
>
>> On 10/24/2011 05:49 PM, Nick Clifton wrote:
>>> Hi Julian,
>>>
>>>> opcodes/
>>>> * m68k-opc.c (m68k_opcodes): Fix entries for ColdFire moveml.
>>>>
>>>> gas/testsuite/
>>>> * gas/m68k/all.exp (movem-offset): Add test.
>>>> * gas/m68k/movem-offset.s: New test.
>>>> * gas/m68k/movem-offset.d: New.
>>>
>>> Approved - please apply.
>>
>> This is not in the 2.22 Binutils release.  Is it possible to include this in a potential 2.22.1 release?
>
> Yes, you can backport it.
>
> I am currently not sure there will be a 2.22.1 release, however.
>
> Tristan.
>

Please have a look at the attached patch.  Without it Binutils 2.22 + Codefire 
== No.

-- 
Sebastian Huber, embedded brains GmbH

Address : Obere Lagerstr. 30, D-82178 Puchheim, Germany
Phone   : +49 89 18 90 80 79-6
Fax     : +49 89 18 90 80 79-9
E-Mail  : sebastian.huber@embedded-brains.de
PGP     : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.

[-- Attachment #2: m68k-coldfire-moveml.patch --]
[-- Type: text/x-patch, Size: 2618 bytes --]

diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog
index 0631572..dcd935d 100644
--- a/gas/testsuite/ChangeLog
+++ b/gas/testsuite/ChangeLog
@@ -19,6 +19,12 @@
 	* gas/ppc/power6.s: Fix lfdpx first operand.
 	* gas/ppc/power6.d: Adjust expected output.
 
+2011-10-24  Julian Brown  <julian@codesourcery.com>
+
+	* gas/m68k/all.exp (movem-offset): Add test.
+	* gas/m68k/movem-offset.s: New test.
+	* gas/m68k/movem-offset.d: New.
+
 2011-09-21  David S. Miller  <davem@davemloft.net>
 
 	* gas/sparc/hpcvis3.s: Update for fixed fchksum16 mnemonic.
diff --git a/gas/testsuite/gas/m68k/all.exp b/gas/testsuite/gas/m68k/all.exp
index bf06d4e..6035286 100644
--- a/gas/testsuite/gas/m68k/all.exp
+++ b/gas/testsuite/gas/m68k/all.exp
@@ -52,6 +52,8 @@ if { [istarget m68*-*-*] || [istarget fido*-*-*] } then {
     run_dump_test mcf-movsr
     run_dump_test mode5
     run_dump_test mode5 "{name {cf}} {as {-mcpu=5200}}"
+    run_dump_test movem-offset
+    run_dump_test movem-offset "{name {cf}} {as {-mcpu=5485}}"
     run_dump_test mcf-mac
     run_dump_test mcf-emac
     run_dump_test mcf-coproc
diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog
index a445030..8ecd310 100644
--- a/opcodes/ChangeLog
+++ b/opcodes/ChangeLog
@@ -18,6 +18,10 @@
 	mark them as invalid on POWER7. Use FRTp, FRAp, and FRBp repsectively
 	on DFP quad instructions.
 
+2011-10-24  Julian Brown  <julian@codesourcery.com>
+
+	* m68k-opc.c (m68k_opcodes): Fix entries for ColdFire moveml.
+
 2011-09-21  David S. Miller  <davem@davemloft.net>
 
 	* sparc-opc.c (sparc_opcodes): Annotate table with HWCAP flag
diff --git a/opcodes/m68k-opc.c b/opcodes/m68k-opc.c
index 9463668..3c8310a 100644
--- a/opcodes/m68k-opc.c
+++ b/opcodes/m68k-opc.c
@@ -1553,10 +1553,10 @@ const struct m68k_opcode m68k_opcodes[] =
 {"moveml", 4,	one(0044300),	one(0177700), "#w>s", m68000up },
 {"moveml", 4,	one(0046300),	one(0177700), "<sLw", m68000up },
 {"moveml", 4,	one(0046300),	one(0177700), "<s#w", m68000up },
-{"moveml", 4,	one(0044320),	one(0177770), "Lwys", mcfisa_a },
-{"moveml", 4,	one(0044320),	one(0177770), "#wys", mcfisa_a },
-{"moveml", 4,	one(0046320),	one(0177770), "ysLw", mcfisa_a },
-{"moveml", 4,	one(0046320),	one(0177770), "ys#w", mcfisa_a },
+{"moveml", 4,	one(0044300),	one(0177700), "Lwys", mcfisa_a },
+{"moveml", 4,	one(0044300),	one(0177700), "#wys", mcfisa_a },
+{"moveml", 4,	one(0046300),	one(0177700), "ysLw", mcfisa_a },
+{"moveml", 4,	one(0046300),	one(0177700), "ys#w", mcfisa_a },
 
 {"movepw", 2,	one(0000410),	one(0170770), "dsDd", m68000up },
 {"movepw", 2,	one(0000610),	one(0170770), "Ddds", m68000up },

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-04-25  9:15 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-10-18 10:12 [PATCH] Fix ColdFire movem with disp16+reg addressing Julian Brown
2011-10-24 15:47 ` Nick Clifton
2012-04-20 11:50   ` Sebastian Huber
2012-04-23  7:08     ` Tristan Gingold
2012-04-25 13:18       ` Sebastian Huber

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).