public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [patch] opcodes/sparc-opc.c
@ 2000-07-11  9:17 David Taylor
  2000-07-11 10:50 ` Jakub Jelinek
  0 siblings, 1 reply; 3+ messages in thread
From: David Taylor @ 2000-07-11  9:17 UTC (permalink / raw)
  To: binutils; +Cc: Bill Clarke

Well, not actually a patch, but it's obvious from his description how
to change the offending two lines of opcodes/sparc-opc.c.

Date: Tue, 11 Jul 2000 14:56:23 +1000
From: Bill Clarke <llib@computer.org>
To: taylor@cygnus.com
Subject: gdb disassembler bug in sparc v9

g'day david,

i don't have the time to check the fix i describe below; sorry!

problem: "popc" instructions (a SPARC-V9 instruction) are not recognised
by the gdb disassembler.  solaris "as" assembles popc to something that
gdb says is "unknown" (tested with gdb 4.17; since gdb 5.0 has the same
spec for "popc" i presume it'd be wrong as well).

this is the relevant part of opcodes/sparc-opc.c (line 758, gdb version
5.0):
{ "popc",       F3(2, 0x2e, 0), F3(~2, ~0x2e, ~0)|RS2_G0|ASI(~0),"2,d", 0, v9
},
{ "popc",       F3(2, 0x2e, 1), F3(~2, ~0x2e, ~1)|RS2_G0,       "i,d", 0, v9 },

which if you compare parts 3 & 4 of the first line (RS2_G0 and "2") are
clearly incompatible!  (not much point having rs2 in the parameters if
it's forced to be zero)

popc requires RS1 to be zero, so i guess changing both "RS2_G0"'s to
"RS1_G0" should fix this.

here's a test (have to assemble using as -xarch=v8plusa or above i
think):
popc -866,     %o5
popc %i0,     %o5
popc -866,     %i0
popc %i0,     %i0
and its equivalent binary:
        .word 0x9b703c9e
        .word 0x9b700018
        .word 0xb1703c9e
        .word 0xb1700018

in case you were wondering how i found this, i'm working on a sparc-v9
simulator for the CAP project at the ANU, and i've pretty much finished
writing a sparc-v9 instruction syntax specification which i can
transform to produce specialised encoders or decoders.  i've extensively
used gdb to test my code.  as far as i know, this is the only true
mismatch produced so far between gdb and my code (all other mismatches
were bugs in mine!).

cheers,
/lib
-- 
/lib: Bill Clarke CAP Project Dept of Computer Science ANU Australia
http://llib.tsx.org llib@computer.org  tel:+61-2-6249x5687 fax:x0010
GNU SMP unix ML C++ LaTeX MPI tcsh emacs XPilot mozilla XFiles Buffy
DrWho Goodies StarTrek Origami Volleyball Cricket Asimov Bear Clarke
Donaldson Jordan Kay Lackey Martin Stasheff DeepPurple H&C KLF Queen
PinkFloyd: v1.2a s+d>r TW 1/0/pw Gfm 1? pp Animals 9 30 50% 20000501

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

* Re: [patch] opcodes/sparc-opc.c
  2000-07-11  9:17 [patch] opcodes/sparc-opc.c David Taylor
@ 2000-07-11 10:50 ` Jakub Jelinek
  0 siblings, 0 replies; 3+ messages in thread
From: Jakub Jelinek @ 2000-07-11 10:50 UTC (permalink / raw)
  To: David Taylor; +Cc: binutils, Bill Clarke

On Tue, Jul 11, 2000 at 12:16:24PM -0400, David Taylor wrote:
> Well, not actually a patch, but it's obvious from his description how
> to change the offending two lines of opcodes/sparc-opc.c.

Here is a patch, it is an obvious typo, ok to commit?
Actually, if noone else is interested in maintaining SPARC port in binutils, I
could do that.

2000-07-11  Jakub Jelinek  <jakub@redhat.com>

	* sparc-opc.c (sparc_opcodes): popc has 0 in rs1, not rs2.
	Reported by Bill Clarke <llib@computer.org>.

--- opcodes/sparc-opc.c.jj	Fri Apr 14 06:16:58 2000
+++ opcodes/sparc-opc.c	Tue Jul 11 19:30:44 2000
@@ -755,8 +755,8 @@ const struct sparc_opcode sparc_opcodes[
 { "scan",	F3(2, 0x2c, 0), F3(~2, ~0x2c, ~0)|ASI(~0),	"1,2,d", 0, sparclet|sparclite },
 { "scan",	F3(2, 0x2c, 1), F3(~2, ~0x2c, ~1),		"1,i,d", 0, sparclet|sparclite },
 
-{ "popc",	F3(2, 0x2e, 0), F3(~2, ~0x2e, ~0)|RS2_G0|ASI(~0),"2,d", 0, v9 },
-{ "popc",	F3(2, 0x2e, 1), F3(~2, ~0x2e, ~1)|RS2_G0,	"i,d", 0, v9 },
+{ "popc",	F3(2, 0x2e, 0), F3(~2, ~0x2e, ~0)|RS1_G0|ASI(~0),"2,d", 0, v9 },
+{ "popc",	F3(2, 0x2e, 1), F3(~2, ~0x2e, ~1)|RS1_G0,	"i,d", 0, v9 },
 
 { "clr",	F3(2, 0x02, 0), F3(~2, ~0x02, ~0)|RD_G0|RS1_G0|ASI_RS2(~0),	"d", F_ALIAS, v6 }, /* or %g0,%g0,d */
 { "clr",	F3(2, 0x02, 1), F3(~2, ~0x02, ~1)|RS1_G0|SIMM13(~0),		"d", F_ALIAS, v6 }, /* or %g0,0,d	*/


	Jakub

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

* Re: [patch] opcodes/sparc-opc.c
@ 2000-07-11 11:41 Nick Clifton
  0 siblings, 0 replies; 3+ messages in thread
From: Nick Clifton @ 2000-07-11 11:41 UTC (permalink / raw)
  To: jakub; +Cc: taylor, binutils, llib

Hi Jakub,

: Here is a patch, it is an obvious typo, ok to commit?
: 
: 2000-07-11  Jakub Jelinek  <jakub@redhat.com>
: 
: 	* sparc-opc.c (sparc_opcodes): popc has 0 in rs1, not rs2.
: 	Reported by Bill Clarke <llib@computer.org>.

Approved.

: Actually, if noone else is interested in maintaining SPARC port in
: binutils, I could do that.

Great!  Please add yourself to the MAINTAINERS file.

Cheers
	Nick


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

end of thread, other threads:[~2000-07-11 11:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-07-11  9:17 [patch] opcodes/sparc-opc.c David Taylor
2000-07-11 10:50 ` Jakub Jelinek
2000-07-11 11:41 Nick Clifton

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).