sfl-examples/slide-examples/macros.asm.inc

18 lines
425 B
PHP

; sys_write(fd, buf, buflen)
%macro sys_write 3
mov rax,1 ; system call number
mov rdi,%1 ; arg1: fd
mov rsi,%2 ; arg2: buffer
mov rdx,%3 ; arg3: buflen
syscall
%endmacro
; sys_read(fd, buf, buflen)
%macro sys_read 3
mov rax,0 ; system call number
mov rdi,%1 ; arg1: fd
mov rsi,%2 ; arg2: buffer
mov rdx,%3 ; arg3: buflen
syscall
%endmacro