Why does my code have a segmentation fault? How can I solve it?
Please help!
section .data
hello db 'Hello, world!',10
helloLen equ $ - hello
fileName db '/home/fateme/Desktop/text.txt',0
handler dd 10
section .bss
fileContent resb 100000
section .text
global _start
_start:
pop ebx
pop ebx
pop ebx
mov eax,8
mov ebx,fileName
mov ecx,00644Q
int 80h
test eax,eax
js skipWrite
call fileWrite
call readfile
call write
Exit:
mov eax,1
mov ebx,0
int 80h
skipWrite:
mov ebx,eax
mov eax,1
int 80h
fileWrite:
mov [handler],eax
mov ebx,[handler]
mov eax,4
mov ecx,hello
mov edx,helloLen
int 80h
readfile:
mov edx,100000
mov ecx,fileContent
mov ebx,[handler]
mov eax,3
int 80h
write:
mov edx,eax
mov ecx,fileContent
mov ebx,1
mov eax,4
int 80h