0 votes
in General Knowledge by (744k points)
How does the push instruction work?

What happens if I use a suffix other than q?

How does this change for pop?

1 Answer

0 votes
by (744k points)
Best answer
pushX source

pushX decrements %rsp by the number of bytes in X, and then copies that number of bytes from the source to the memory address in %rsp, essentially putting that value on top of the stack.

If a suffix other than q is used, then that number of bytes is subtracted from %rsp. However, %rsp and %rbp are always references as 8-byte values since they contain addresses.

popX destination is simply the inverse of above.
Welcome to the Answerine , a great place to find, read and share your favorite questions and answers.