Advertisement
MichaelPetch

64-bit system call "Hello, world"

Nov 9th, 2020 (edited)
253
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. .text
  2. .global main
  3.  
  4. .func main
  5. main:
  6. mov $len, %edx # message length
  7. lea msg(%rip), %rsi # message to write (RIP relative addressing)
  8. mov $1, %edi # file descriptor (stdout)
  9. mov %edi, %eax # system call number (sys_write)
  10. syscall
  11.  
  12. ret
  13.  
  14. .data
  15. msg: .ascii "Hello, world!\n"
  16. len = . - msg # length of the msg string
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement