aboutsummaryrefslogtreecommitdiff
path: root/sys.inc
blob: eef65731b1a9b526804f8e6e955a2f39c189e469 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
%ifndef SYS_INC
%define SYS_INC
%ifidn __OUTPUT_FORMAT__, macho64
	%define SYS_EXIT 0x02000001
	%define SYS_READ 0x02000003
	%define SYS_WRITE 0x02000004
	%define SYS_OPEN 0x02000005
	%define SYS_CLOSE 0x02000006
	%define SYS_MUNMAP 0x02000049
	%define SYS_MMAP 0x020000C5
	%define SYS_LSEEK 0x020000C7
%elifidn __OUTPUT_FORMAT__, elf64
	%define SYS_READ 0
	%define SYS_WRITE 1
	%define SYS_OPEN 2
	%define SYS_CLOSE 3
	%define SYS_LSEEK 8
	%define SYS_MMAP 9
	%define SYS_MUNMAP 11
	%define SYS_EXIT  60
%endif

%macro exit_prog	0-1 0
	mov	rax,	SYS_EXIT
	%if %1 != 0
	mov	rdi,	%1
	%else
	xor	rdi,	rdi
	%endif
	syscall
%endm
%endif