Re: SPARC assembly - a beginner's question...

Jeff Damens <[email protected]>
Newsgroups gmane.comp.security.sun
Message-ID <[email protected]>
> Running my assembly code does not....

>     or %g0, %g0, [%fp-12] ! clear %fp-12
...
> expanding "clr [%fp-12]" to "or %g0, %g0, [%fp-12]"

I think this is where the problem lies.  I don't believe there is an
addressing mode which lets you or two registers into a memory
location.  I think the 'clr' pseudo-op actually expands to
	st %g0, [%fp-12]

(g0 is assumed to contain 0 always).

> If I load the binary into gdb and take a look, a lot of it seems to be
> missing:

Ahhh... 

>     set 0x2F736800, %o0   ! %o0=/sh\0

The \0 terminates the string literal being passed to __asm__ !!!

This may explain why it didn't complain about the or %g0, %g0, [%fp-12].

I hope this helps...


Regards,

Jeff

----------------------------------------------------------------

Jeff Damens                     Unix Systems Administrator
Polytechnic University          [email protected]
6 Metrotech                     (718) 260-3492
Brooklyn, New York 11201
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.