Why does popl %eax can used to set address of popl instruction?

233 Views Asked by At

The code as following

    call next
next:
    popl %eax
  1. To what value does register %eax get set?
  2. Explain why there's no matching ret instruction to this call?
  3. What usful purpose does this code fragment serve?

The answer from book are the following. Which I don't understand. Is there any more detailed explainatio of this part of code?

  1. %eax is set to the address of popl instruction.
  2. This is not a true subroutine call, since the control folloe the same ordering as the instructions and the return address is popped from the stack.
  3. This is the only way in IA32 to get value of the program counter into an integer register.
0

There are 0 best solutions below