Frage

ATT syntax.

I've noticed that library routines in C often use the following snippet of assembly code:

call next
next:
popl %eax
  • What value is %eax storing here and why is it getting popped?
  • What's the purpose of this snippet?
War es hilfreich?

Lösung 2

What is the value of %eax after this sequence of instructions?

call next

next: popl %eax

Whatever the address of next is

(the memory address where popl instruction is) Note: this is NOT the PC, but it is related to it

– PC is the address of the next instruction to be executed; %eax now has address of most recently executed instruction (the popl)

See

Andere Tipps

It gives you the current value of the program counter (PC). That is, you get the address of the current instruction that is executing.

Here's an interesting article that talks about using that snippet vs doing it with C: http://blogs.msdn.com/b/oldnewthing/archive/2004/12/16/317157.aspx

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top