I know data in nested function calls go to the Stack.The stack itself implements a step-by-step method for storing and retrieving data from the stack as the functions get called or returns.The name of these methods is most known as Prologue and Epilogue.
I tried with no success to search material on this topic. Do you guys know any resource ( site,video, article ) about how function prologue and epilogue works generally in C ? Or if you can explain would be even better.
P.S : I just want some general view, not too detailed.



There are lots of resources out there that explain this:
to name a few.
Basically, as you somewhat described, "the stack" serves several purposes in the execution of a program:
The prolouge is what happens at the beginning of a function. Its responsibility is to set up the stack frame of the called function. The epilog is the exact opposite: it is what happens last in a function, and its purpose is to restore the stack frame of the calling (parent) function.
In IA-32 (x86) cdecl, the
ebpregister is used by the language to keep track of the function's stack frame. Theespregister is used by the processor to point to the most recent addition (the top value) on the stack. (In optimized code, usingebpas a frame pointer is optional; other ways of unwinding the stack for exceptions are possible, so there's no actual requirement to spend instructions setting it up.)The
callinstruction does two things: First it pushes the return address onto the stack, then it jumps to the function being called. Immediately after thecall,esppoints to the return address on the stack. (So on function entry, things are set up so aretcould execute to pop that return address back into EIP. The prologue points ESP somewhere else, which is part of why we need an epilogue.)Then the prologue is executed:
At this point, we have:
The epilog: