Vulnerability Development mailing list archives
Re: The generated binary code has different main?
From: Mike Frantzen <frantzen () w4g org>
Date: Thu, 5 Sep 2002 00:06:45 -0400
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
Sparc uses register windows. There are eight input registers %i0 through %i7. But %i6 is the frame pointer (actually the previous functions stack pointer. And %i7 is used as the return pointer (which was the previous functions program counter aka instruction pointer). Thus the first six parameters are always passed in registers and the debugger doesn't really have an easy way to determine how many were actually passed or will actually be used. The 20800 is probabley left over from a constructor, _init or the dl hocus pocus. .mike frantzen@(nfr.com | cvs.openbsd.org | w4g.org)
Current thread:
- The generated binary code has different main? Minchu Mo (Sep 04)
- Re: The generated binary code has different main? Jonathon Giffin (Sep 04)
- Re: The generated binary code has different main? Mike Frantzen (Sep 04)
- RE: The generated binary code has different main? Dom De Vitto (Sep 04)
- Re: The generated binary code has different main? Bruce Ediger (Sep 04)