Hi,
I'm getting a segmentation fault when exiting from this code
foo.asm
format ELF
public main as 'main'
extrn exit
section '.text' executable
main:
mov edi, hello
call print
mov ebx, 0
call exit
print:
mov ebx, edi
xor ecx, ecx
xor al, al
not ecx
cld
repne scasb
not ecx
dec ecx
mov edx, ecx
mov ecx, ebx
mov eax, 4
mov ebx, 1
int 0x80
ret
section '.data' writable
hello db "Hello, world",10,0
bar.asm
format ELF
public exit
section '.text' executable
exit:
mov eax, 1
call 0x80
ret
$fasm bar.asm
$fasm foo.asm
$ld -e main foo.o bar.o -o foo
Anyone know what the problem is?