x64-httpd/hello.s
2025-05-04 11:19:41 +00:00

27 lines
518 B
ArmAsm

global _start
; constants
SYS_WRITE equ 1
SYS_EXIT equ 60
STDOUT equ 1
SECTION .data
hello db "Hello world!", 0x0a
hello_len equ $ - hello
SECTION .text
_start:
; syscall(SYS_WRITE, STDOUT, hello, hello_len);
mov rax, SYS_WRITE
mov rdi, STDOUT
mov rsi, hello
mov rdx, hello_len
syscall
push rax
; syscall(SYS_EXIT, <sys_write return value> - hello_len);
mov rax, SYS_EXIT
pop rdi
sub rdi, hello_len
syscall