i'm trying assemble small piece of x86 code. i'm on 32 bit machine , have written following code. should add values eax , return. realize there not output. when compile using
gcc main.s -o main
it compiles no errors. when run seg faults (gdb claims segfaults on first movl instruction). main.s has following code in it. doing wrong?
.text .globl main main: pushl %ebp movl %esp, %ebp movl 0, %eax addl $3, %eax addl $3, %eax leave ret
not first, second movl
movl 0,%eax
isn't using literal $0
address 0. produce segfault!
Comments
Post a Comment