GamefanA
GamefanA

Reputation: 1643

Push a local variable onto the stack

Lately I have been doing a lot of assembly programming to boost my skills, and I came to realize that it is possible to push a local variable onto the stack like this pushl 8(%esp) however, I got confused on that part because it seems that instead of doing the operation in the following order:

decrement stack pointer -> fetch value 8(%esp) -> put on stack, it seems to do this instead

fetch value 8(%esp) -> decrement stack pointer -> put on stack, can someone conform this, as I don't want my future endeavors to be based off of a false assumption This was done on the gcc compiler! thanks!!

Upvotes: 0

Views: 101

Answers (1)

Craig S. Anderson
Craig S. Anderson

Reputation: 7374

Assuming this is x86 code, yes, it fetches the value, decrements the stack pointer, then puts the value on the stack top. Reference here.

Upvotes: 1

Related Questions