Wednesday, 15 July 2015

x86 - Decribing pop in Assembly -



x86 - Decribing pop in Assembly -

i studying on ia32. when think popl dest instruction doing think following:

movl (%esp), dest addl $4, %esp

but started sec guessing myself when thought popl %esp. though pointless instruction, think there improve way think of describing popl dest instruction. how describe it?

here's little portion of pseudo code pop instruction intel's documentation:

if stackaddrsize = 32 if operandsize = 32 dest ← ss:esp; (* re-create doubleword *) esp ← esp + 4; else (* operandsize = 16*) ... fi; ...

but here's says pop xsp:

the pop esp instruction increments stack pointer (esp) before info @ old top of stack written destination.

this means sequence

push esp pop esp

does nil out of ordinary, one:

push eax pop eax

similarly, there's text on push xsp:

the force esp instruction pushes value of esp register existed before instruction executed. if force instruction uses memory operand in esp register used computing operand address, address of operand computed before esp register decremented.

assembly x86 cpu-registers pop ia-32

No comments:

Post a Comment