getting starting address of a stack in assembly programming
Question
is it possible to get the effective starting address of a stack after completing stack operations like push and pop in assembly programming?
Solution
The convention is to save (E)SP to (E)BP in the beginning of your function, and use (E)BP for local variable addressing.
OTHER TIPS
simplest case is just to save initial stack pointer to some variable to access it when needed. If it not the case, use platform specific API, for example VirtualQuery on Windows, using current SP value as first parameter. base address will be in BaseAddress field of MEMORY_BASIC_INFORMATION structure. On posix task can be done using pthread functions
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow