initial commit
[azan.git] / macros.s
blobcb420a24900a74cc3b87fd95c9ab122ec1904a49
1 ; See LICENSE file for copyright and license details.
3 %ifndef MACROS_S
4 %define MACROS_S
6 %define EXIT_SUCCESS 0
7 %define EXIT_FAILURE 1
8 %define STDOUT 1
9 %define STDERR 2
11 section .rodata
12 failure_msg: db 0x5b, 0x1b, 0x5b, 0x33, 0x31, 0x6d, 0x46\
13 0x41, 0x49, 0x4c, 0x45, 0x44, 0x1b, 0x5b\
14 0x30, 0x6d, 0x5d, 0x20, 0x00
15 failure_msglen: equ $ - failure_msg
16 julian_msg: db "Julian must be greader than offset.", 10, 0
17 julian_msglen: equ $ - julian_msg
19 %macro CHECK_OPENBSD 0
20 %ifdef OpenBSD
21 section .note.openbsd.ident note
22 dd 8, 4, 1
23 db "OpenBSD", 0
24 dd 0
25 %endif
26 %endmacro
28 %macro EEXIT 1
29 mov rax, SYS_exit
30 mov rdi, %1
31 syscall
32 %endmacro
34 %macro FAIL_MSG 0
35 mov rax, SYS_write
36 mov rdi, STDERR
37 mov rsi, failure_msg
38 mov rdx, failure_msglen
39 syscall
40 %endmacro
42 %macro FAILJULIAN 0
43 FAIL_MSG
44 mov rax, SYS_write
45 mov rdi, STDERR
46 mov rsi, julian_msg
47 mov rdx, julian_msglen
48 syscall
49 EEXIT EXIT_FAILURE
50 %endmacro
52 %endif ;MACROS_S