This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

[patch] opcodes/sparc-opc.c


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]