O'Reilly logo

Windows Debugging: Practical Foundations by Dmitry Vostokov

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 9. Memory and Stacks

Stack: A Definition

A stack is a simple computational device with two operations, push and pop, that allows us to pile up data to remember it in LIFO (Last In First Out) manner and help in easy retrieval of the last piled data item as shown on Picture 9.1.

Picture 9.1

Figure 9.1. Picture 9.1

Stack Implementation in Memory

CPU ESP register (Stack Pointer) points to the top of a stack. As shown on Picture 9.2 a stack grows towards lower memory addresses with every push instruction and this is implemented as ESP register decrement by 4. We can read the top stack value using the following instruction: mov eax, [esp].

Figure 9.2. Picture ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required