Vulnerability Development mailing list archives

Re: The generated binary code has different main?


From: Jonathon Giffin <giffin () cs wisc edu>
Date: Wed, 4 Sep 2002 17:14:24 -0500 (CDT)

Here's my understanding...

When using register windows in SPARC, six registers, %o0 to %o5, are
provided for argument passing.  The called procedure, here "main", 
accesses these registers as %i0 to %i5.  (Further arguments are passed via
the stack).  All that you are seeing are the values of the six argument
registers.  The first three values, the values in %i0, %i1, and %i2, are
as you described.  The remaining three values carry no particular
meaning and are just whatever values happen to be in the registers %i3 to
%i5.

The function main is called by _start, and the registers %o3 to %o5 are
not initialized to any particular values.  You should not expect these
values to contain any meaningful data.  The value you see in %i3 (the
fourth argument) may just be a temporary value _start generated as it was
calculating the values to put in the %o0, %o1, and %o2.

Jon



On 4 Sep 2002, Minchu Mo wrote:

I used cc compiler to compile a simple c code under solaris /sparc. The c 
code has main(int argc, char* argv[]) function as entry point as everybody 
knows.

But when I run the generated code under adb, I found the main function
under adb look like this:

main(2,ffbefd0c,ffbefd18,20800,0,0)

I know that:
2 is the number of arguments, 
ffbefd0c is *argv
ffbefd18 is *envp,
but what are 20800 and 0, 0 for? 

Anybody knows? Thanks 




Current thread: