Each of the following lines of code generates an error messa
Each of the following lines of code generates an error message when we invoke the assembler. Explain what is wrong with each line. Movb $0xF, (%b1) mov1 %ax, (%esp) movw (%eax), 4(%esp) movb %ah, %sh movl %eax, $0x123 movl %eax, %dx movb %si, 8(%ebp)
Solution
Solution:
1.movb $0xF, (%ebx): memory references in x86-64 are always given with quad word registers. Cannot use %ebx; should use %rbx
2.movl %rax, (%rsp): Mismatch between instruction suffix and register ID
3.movw (%rax), 4(%rsp): Cannot move from memory to memory
4.movb %al, %sl: No register named %sl
5.movq %rax, $0x123: Cannot have immediate as destination
6.movl %eax, %rdx: Destination operand incorrect size
7.movb %si, 8(%rbp): Mismatch between instruction suffix and register ID
