I'm trying to do an assignment for my assembly class, and the teacher's example has the line
movl (%eax),%ebx
My code uses this exact same line, but whenever gdb reaches it, i have a seg fault. I don't understand why. Please help me. This is the whole code, running via QEMU on 32 bit Linux.
.text
.byte 12, 0x12, 012
.word 34, 0x34, 034
L1:
.long 23, 0x23, 023
.global _start
_start:
# do not change, remove or add anything other than specifying the underscores
movl $0x1700121C,%eax #hex for 385880604
movl (%eax),%ebx #moving contents of eax into ebx, long to long
movw 0x17,%bx #attemtping to move via memory location (probably buggy)
movb $0x12,%bh
# at this point, %ebx should have the value of 385880604
checkHere:
movl $1,%eax
movl $0,%ebx
int $0x80
Please help. Thanks for your time.