- Aug 12, 2014
- 522
- 3
- 81
Hello,
What I'm really asking is in assembly is it possible to pop a value off the stack into nothing?
That is, I don't want to pop into a register or memory location; I just want to throw the value away.
Is this possible?
The motivation behind my question is in dealing with the details in returning from a called procedure.
When you call a function, that function's address is loaded into the instruction pointer register.
Also, the address of the next instruction after the call is pushed onto the stack.
When you return, the address of the next instruction is popped into the instruction pointer register.
But what if you've done scratch work in the called function that has placed values on the stack thereby obfuscating the next instruction address?
When you call return, does the processor know to pull the correct value from within the stack, or does it just pop the top value and hope that that is the correct value for the next instruction address?
If I've done scratch work in a called function that has buried the return address, I want to call 'pop into nothing' on all the top values and then call 'return' to pop the correct value into the instruction pointer.
Thanks.
What I'm really asking is in assembly is it possible to pop a value off the stack into nothing?
That is, I don't want to pop into a register or memory location; I just want to throw the value away.
Is this possible?
The motivation behind my question is in dealing with the details in returning from a called procedure.
When you call a function, that function's address is loaded into the instruction pointer register.
Also, the address of the next instruction after the call is pushed onto the stack.
When you return, the address of the next instruction is popped into the instruction pointer register.
But what if you've done scratch work in the called function that has placed values on the stack thereby obfuscating the next instruction address?
When you call return, does the processor know to pull the correct value from within the stack, or does it just pop the top value and hope that that is the correct value for the next instruction address?
If I've done scratch work in a called function that has buried the return address, I want to call 'pop into nothing' on all the top values and then call 'return' to pop the correct value into the instruction pointer.
Thanks.
Last edited: