To illustrate the popl instruction suppose the current stack frame is as we left it:
R[%esp] = 0x08002ffc R[%ebp] = 0x080030a4 R[%eax] = 20
0x08002ffc | 10 |
0x08003000 | 5 |
Rest of Stack Frame | |
0x080030a4 |
Now execute: popl %eax The change to registers and the stack:
R[%esp] = 0x08003000 R[%ebp] = 0x080030a4 R[%eax] = 10
0x08003000 | 5 |
Rest of Stack Frame | |
0x080030a4 |