My OS: Linux debian 4.19.0-9-amd64 #1 SMP Debian x86_64 GNU/Linux Compiler: NASM version 2.14
I try play with conditional jumps, function calling and comparing expressions. I wrote something simple, and it seems to by work, but i don't understand what cause error: EnSegmentation fault
For compilation purpose i'm use: nasm -f elf64 sample_file.asm -o sample_file.o and: ld sample_file.o -o sample_file
section .data
msg: db 'Hello world',10
end: db 'Ending program', 10
section .text
global _start
hello_world:
        mov rax, 1
        mov rdi, 1
        mov rsi, msg
        mov rdx , 14
        syscall
        ret
exit:
        mov rax, 1
        mov rdi, 1
        mov rsi, end
        mov rdx, 20
        syscall
        mov rax, 60
        xor rdi, rdi
        syscall
        ret
_start:
        mov rax, 10
        mov rdx, 10
        cmp rax, rdx 
        je hello_world
        jne exit
        call hello_world
        mov rax, 60
        xor rdi,rdi
        syscall
        call exit
But the output is :
Hello world
EnSegmentation fault
 
    