Memory Access

MOV

The MOV instruction class has four primary variants: movb, movw, movl, and movq. There also exist zero extension and sign extension variations in the forms of MOVS and MOVZ.

Instruction Operands Effect Description
mov[bwlq] S, D D <- S Move byte/word/double word/quad word
movabsq I, R R <- I Move quad word
movzb[wlq] S, R R <- ZE(S) Move zero-extended byte
movzw[lq] S, R R <- ZE(S) Move zero-extended word
movsb[wlq] S, R R <- SE(S) Move sign-extended byte
movsw[lq] S, R R <- SE(S) Move sign-extended word
movslq S, R R <- SE(S) Move sign-extended double word
cltq %rax <- SE(%eax) Sign-extend %eax to %rax

Notice there is no movzlq instruction. movl covers this functionality since, by convention, instructions moving double words into a 64-bit register automatically zeroes out the upper 32 bits.

PUSH and POP

Instruction Operands Effect Description
pushq S R[%rsp] <- R[%rsp] - 8
M[R[%rsp]] <- S
Push quad word
popq D D <- M[R[%rsp]]
R[%rsp] <- R[%rsp] + 8
Pop quad word

In x86 processors, the stack grows downward, with the "top" of the stack corresponding to lower addresses.

Powered by Forestry.md