Possible Duplicate:
What is default register state when program launches (asm, linux)?
I know the %esp and %eip should set to proper values by the OS kernel, so that the program can run, but other registers including %ebp,%eax,%ebx,%ecx,%edx,%esi,%edi. Does OS kernel initialize them before a program running? What values should they have?
What’s the value should %esp have when a program starts running?
If you ask about a C program – you can’t know, it isn’t your business.
For assembly, I also don’t think they have meaningful values.
The information needed to execute
main– the argument count, argument vector and environment pointer – is all on the stack.See more info in this Linux Gazette article.