title: Hello World program in Nasm x86-64 prints Hello World continuously
body: <p>Could you please help me on this code. On execution, the program prints Hello World continuously and does not exit. I want to use this code as shellcode in C program too, hence I have not defined Hello String in data section. Please let me know where is the issue.</p>
  
  <pre><code>SECTION .text       ; Code section
      global _start       ; Make label available to linker 
  
  _start:             ; Standard ld entry point
  
  jmp callback    ; Jump to the end to get our current address
  
  dowork:
  
      pop     rsi     ;
      mov rax,4       ; System call number for write
      mov     rdi,1   ; 1 for stdout
      mov     rdx,12  ; length of Hello World
      syscall         ; Switch to the kernel mode
  
      mov     rax,1   ;
      xor rdi,rdi     ;
      syscall         ;
  
  callback:
     call dowork        ; Pushes the address of "Hello World" onto the stack
     db 'Hello World',0xA  ; The string we want to print
  </code></pre>