72 lines
1.3 KiB
PHP
72 lines
1.3 KiB
PHP
include "macros.inc"
|
|
|
|
STDOUT equ 1
|
|
STDERR equ 2
|
|
|
|
SYS_read equ 0
|
|
;; ssize_t read(int fd, void buf[.count], size_t count);
|
|
macro read fd,buf,count
|
|
{
|
|
syscall3 SYS_read, fd, buf, count
|
|
}
|
|
|
|
SYS_write equ 1
|
|
;; ssize_t write(int fd, const void buf[.count], size_t count);
|
|
macro write fd,buf,count
|
|
{
|
|
syscall3 SYS_write, fd, buf, count
|
|
}
|
|
|
|
SYS_open equ 2
|
|
;; int open(const char *pathname, int flags);
|
|
macro open pathname, flags
|
|
{
|
|
syscall2 SYS_open, pathname, flags
|
|
}
|
|
|
|
SYS_close equ 3
|
|
;; int close(int fd);
|
|
macro close fd
|
|
{
|
|
syscall1 SYS_close, fd
|
|
}
|
|
|
|
SYS_stat equ 4
|
|
;; int stat(const char *restrict pathname
|
|
;; struct stat *restrict statbuf);
|
|
macro stat pathname, statbuf
|
|
{
|
|
syscall2 SYS_stat, pathname, statbuf
|
|
}
|
|
|
|
|
|
PROT_READ equ 1
|
|
MAP_PRIVATE = 2
|
|
SYS_mmap equ 9
|
|
;; void *mmap(void addr[.length], size_t length, int prot, int flags,
|
|
;; int fd, off_t offset);
|
|
macro mmap addr, length, prot, flags, fd, offset
|
|
{
|
|
syscall6 SYS_mmap, addr, length, prot, flags, fd, offset
|
|
}
|
|
|
|
SYS_munmap equ 11
|
|
;; int munmap(void addr[.length], size_t length);
|
|
macro munmap addr, length
|
|
{
|
|
syscall2 SYS_munmap, addr, length
|
|
}
|
|
|
|
SYS_alarm equ 37
|
|
;; unsigned int alarm(unsigned int seconds);
|
|
macro alarm seconds
|
|
{
|
|
syscall1 SYS_alarm, seconds
|
|
}
|
|
|
|
SYS_exit equ 60
|
|
;; [[noreturn]] void _exit(int status);
|
|
macro exit status
|
|
{
|
|
syscall1 SYS_exit, status
|
|
} |