Assembly ATT Syntax Question 1A Consider the following assem
Assembly (AT&T Syntax) Question 1.A:
Consider the following assembly code fragment:
___________________________________________________________
pushl %ebp
movl %esp, %ebp
subl $0x40, %esp
movl %ebx, 0x14(%esp)
movl $1, %ebx
___________________________________________________________
Which one of the choices is able to undo the effects of the fragment above?
A. movl 0x14(%esp), %ebx
movl %ebp, %esp
popl %ebp
B. movl -0x26(%ebp), %ebx
addl $0x40, %esp
movl %ebp, %esp
popl %ebp
C. popl %ebp
movl %ebp, %esp
addl $0x40, %esp
movl 0x14(%esp), %ebx
D. movl 14(%esp), %ebx
addl $40, %esp
movl %ebp, %esp
popl %ebp
Solution
Code :
pushl %ebp
movl %esp, %ebp
subl $0x40, %esp
movl %ebx, 0x14(%esp)
movl $1, %ebx
Undo the effects of the fragment :
movl 14(%esp), %ebx
addl $40, %esp
movl %ebp, %esp
popl %ebp
Option D is correct choice.
