Stack pointer

Can anyone give me complete information while performing this situation,A function is running, it has its own stack pointer, memory area now it invokes another function from this point what changes will be in it's memory area and what other changes in data segment, stack segment, heap segment. I want a complete picture of memory architecture?

Questions by nitin.goel   answers by nitin.goel

Editorial / Best Answer

kalayama  

  • Member Since Sep-2006 | Dec 8th, 2006


There will be a lot of changes in fact. First of all, all the variables the function was suing needs to be pushed into the stack. (we need all these variables when we return from the other function). The Program counter will be pushed to stack too... (When the "return" of second function occurs we should know where to 'return' to)These are the basics which are bound to happen when a function calls another.

Showing Answers 1 - 0 of 0 Answers

prasanth

  • Nov 27th, 2006
 

hi,

         There will be no change in memory area .And all the major part will be taken by the stack pointer.It depends on the calling conventions like pascals convention or any other depending on the parameters passed by the function.

The data is stored in registry.

  Was this answer useful?  Yes

kalayama

  • Dec 8th, 2006
 

There will be a lot of changes in fact. First of all, all the variables the function was suing needs to be pushed into the stack. (we need all these variables when we return from the other function). The Program counter will be pushed to stack too... (When the "return" of second function occurs we should know where to 'return' to)These are the basics which are bound to happen when a function calls another.

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions