Assembler Developer

Moderators: None (Apply to moderate this forum)
Number of threads: 1030
Number of posts: 1826

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
segmentation fault Posted by manjaba on 6 Aug 2011 at 1:43 PM
Just starting to study assembly. The following code runs but I'm also getting a notice 'Segmentation fault'. I thought it might have to do with the number of bytes but that doesn't seem to be the issue.

the code:

#HelloWorld.s my second assembly program

.data

HelloWorldString: #label
.ascii "Hello World\n"

.text

.globl_start

_start:
#load all the arguments for write()

movl $4, %eax
movl $1, %ebx
movl $HelloWorldString, %ecx
movl $12, %edx
int $0x80

Thanks
Report
Re: segmentation fault Posted by anthrax11 on 8 Sept 2011 at 3:54 AM
I think you are missing an exit command, add this to the end:
movl $1, %eax
int $0x80



 

Recent Jobs