Assembly stack persistency

Posted by user246100 on Stack Overflow See other posts from Stack Overflow or by user246100
Published on 2010-04-11T18:57:10Z Indexed on 2010/04/11 19:03 UTC
Read the original article Hit count: 365

Filed under:

Hello. I would like to know if after calling functions the data I have in the stack is persistent. Like, I would like to know if (assuming cdecl convention) can I do this (independently of function X and independently of optimizations):

push 1
push 2
push 3
call X
call X
call X
add 12 esp

?

Also, let's say that before the calls I save the address of where the pushed values are in a global variable. Can I, inside X, alter the values it contain by acessing the global variable? Like, for some reason I want that in X I'm able to alter the values in stack so that the second and third call to X receive different values.

© Stack Overflow or respective owner

Related posts about assembly