diff options
author | Christian Cunningham <cc@localhost> | 2024-07-13 21:31:36 -0700 |
---|---|---|
committer | Christian Cunningham <cc@localhost> | 2024-07-13 21:31:36 -0700 |
commit | a33f52d00496a7bed8e5b9bac533853a8733e209 (patch) | |
tree | dd76376b66d0962f11616fe6bd3feb3599faee56 | |
parent | 655070b5ab5f7674ef44bd9f79ea01ebe78f370e (diff) |
OS-Aware Globals
-rw-r--r-- | sys.inc | 32 |
1 files changed, 32 insertions, 0 deletions
@@ -0,0 +1,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 |