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

18 lines
425 B
PHP
Raw Permalink Normal View History

2023-12-14 14:12:51 +01:00
; 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