I wrote the following assembly program to get the opcode of various registers:
.section .text
.globl _start
_start:
add $1,%eax
add $1,%ebx
add $1,%ecx
add $1,%edx
add $1,%esp
add $1,%ebp
add $1,%esi
add $1,%edi
int $0x80
I compile and link with:
gcc -c prog.s && ld prog.o
and the object dump is:
0000000000400078 <_start>: 400078: 83 c0 01 add $0x1,%eax 40007b: 83 c3 01 add $0x1,%ebx 40007e: 83 c1 01 add $0x1,%ecx 400081: 83 c2 01 add $0x1,%edx 400084: 83 c4 01 add $0x1,%esp 400087: 83 c5 01 add $0x1,%ebp 40008a: 83 c6 01 add $0x1,%esi 40008d: 83 c7 01 add $0x1,%edi 400090: cd 80 int $0x80
I would expect %ebx to have opcode c1, which is is not the case. So my question is: why is c3 the opcode of %ebx for these add instrucions?