On Wed, May 27, 2009 at 8:37 AM, Mike Gerdts <mgerdts at gmail.com> wrote:
> I'm trying to understand how to interpret SPARC branching instructions
> presented by mdb and am having some troubles.
>
> On snv_111a I see:
>
>> libc.so.1`fclose::dis
> libc.so.1`fclose: ? ? ? ? ? ? ? save ? ? ?%sp, -0x60, %sp
> libc.so.1`fclose+4: ? ? ? ? ? ? orcc ? ? ?%g0, %i0, %i1
> libc.so.1`fclose+8: ? ? ? ? ? ? bne,pn ? ?%icc, +0x10 ? 
> <libc.so.1`fclose+0x18>
> libc.so.1`fclose+0xc: ? ? ? ? ? nop
> libc.so.1`fclose+0x10: ? ? ? ? ?ret
> libc.so.1`fclose+0x14: ? ? ? ? ?restore ? %g0, -0x1, %o0
> libc.so.1`fclose+0x18: ? ? ? ? ?call ? ? ?+0x8 ? ? ? ? 
> ?<libc.so.1`fclose+0x20>
> ...
>
> At fclose+8, the instruction is saying to "branch to fclose+0x18" if
> thingA is not equal to thingB. ?Presumably thingA is %icc (which
> itself is still a mystery to me) but I have no idea what thingB is.
>
> Similar code in s10 looks a bit different. I am not sure how much of
> the differences are due to mdb and how much are due to truly different
> code.
>
>> libc.so.1`fclose::dis
> libc.so.1`fclose: ? ? ? ? ? ? ? save ? ? ?%sp, -0x60, %sp
> libc.so.1`fclose+4: ? ? ? ? ? ? orcc ? ? ?%g0, %i0, %i1
> libc.so.1`fclose+8: ? ? ? ? ? ? bne ? ? ? +0x10 ? ? ? ? 
> <libc.so.1`fclose+0x18>
> libc.so.1`fclose+0xc: ? ? ? ? ? mov ? ? ? %o7, %i3
> libc.so.1`fclose+0x10: ? ? ? ? ?ret
> libc.so.1`fclose+0x14: ? ? ? ? ?restore ? %g0, -0x1, %o0
> libc.so.1`fclose+0x18: ? ? ? ? ?call ? ? ?+0x8 ? ? ? ? 
> ?<libc.so.1`fclose+0x20>
> ...
>
> I assume the lack of ",pn" at fclose+8 in the s10 code is a legitimate
> difference. ?What about the missing %icc? ?Is %icc implied? ?If not,
> what is "thingA" in this case?
>
> Also, if there is a better place to ask questions about SPARC assembly
> language, a pointer would be most appreciated.
>
> Thanks in advance,
> Mike

A good reference would be
http://opensparc-t2.sunsource.net/specs/UA2007-current-draft-HP-EXT.pdf
-- it covers everything the sparcv9 reference does, plus the new bits
for Niagra.  Though I don't believe anything's published for Rock yet
(although you can get a hint if you look at the sparc disassembler
source history).

Reply via email to