ESP, EBP pointer in stack manipulation

JRPrakash
JRPrakash used Ask the Experts™
on
I often confused with the list of data that is pused into the stack frame when function is invoked.
As for as i know, return address, local variables, parameters are pushed into stack frame. But what i would like to know is the concrete details. Could someone provide ?
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Author

Commented:
Hi Experts,
Can someone give a comment on it ?.  :)
nociSoftware Engineer
Distinguished Expert 2018

Commented:
My guess is, that this is a homework type question so you need to cosult more info for some details.
Pointers to it use are:

SP (ESP for 32bit, RSP for 64bit) is the stackpointer ie. it points to the top of the stack.
  - PUSH AX ==> in microcode = STACK[++SP]=AX

BP is used as a frame pointer most common use at procedure entry:
    PUSH BP
    MOV SP,BP

Now BP can be used to access parameters & local variables.
For more details consult your compilers manual. It's use is language/compiler specific.

There are many "function call convention", each language, each platform and each OS has his own convention. Also in linux you can change the calling convention used, it's called "ABI" (Application binary Interface).
Check these links:
http://en.wikipedia.org/wiki/Calling_conventionhttp://en.wikipedia.org/wiki/Application_Binary_Interface

Hope that helps.

Happy

Author

Commented:
Dont we maintain any documentation inside for such a generic questions ?
evilrixSenior Software Engineer (Avast)

Commented:
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial