|
| 1 | + /** |
| 2 | + Copyright © 2018 Odzhan. All Rights Reserved. |
| 3 | +
|
| 4 | + Redistribution and use in source and binary forms, with or without |
| 5 | + modification, are permitted provided that the following conditions are |
| 6 | + met: |
| 7 | +
|
| 8 | + 1. Redistributions of source code must retain the above copyright |
| 9 | + notice, this list of conditions and the following disclaimer. |
| 10 | +
|
| 11 | + 2. Redistributions in binary form must reproduce the above copyright |
| 12 | + notice, this list of conditions and the following disclaimer in the |
| 13 | + documentation and/or other materials provided with the distribution. |
| 14 | +
|
| 15 | + 3. The name of the author may not be used to endorse or promote products |
| 16 | + derived from this software without specific prior written permission. |
| 17 | +
|
| 18 | + THIS SOFTWARE IS PROVIDED BY AUTHORS "AS IS" AND ANY EXPRESS OR |
| 19 | + IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
| 20 | + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
| 21 | + DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, |
| 22 | + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
| 23 | + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
| 24 | + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
| 25 | + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, |
| 26 | + STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN |
| 27 | + ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
| 28 | + POSSIBILITY OF SUCH DAMAGE. */ |
| 29 | + |
| 30 | + # symbolic constants for Linux/AArch64 |
| 31 | + |
| 32 | + .equ BINSH, 0x0068732F6E69622F |
| 33 | + |
| 34 | + .equ BUFSIZ, 64 |
| 35 | + .equ NULL, 0 |
| 36 | + .equ SIGCHLD, 17 |
| 37 | + |
| 38 | + # sched.h |
| 39 | + .equ CSIGNAL, 0x000000FF # signal mask to be sent at exit |
| 40 | + .equ CLONE_VM, 0x00000100 # set if VM shared between processes |
| 41 | + .equ CLONE_FS, 0x00000200 # set if fs info shared between processes |
| 42 | + .equ CLONE_FILES, 0x00000400 # set if open files shared between processes |
| 43 | + .equ CLONE_SIGHAND, 0x00000800 # set if signal handlers and blocked signals shared |
| 44 | + .equ CLONE_PTRACE, 0x00002000 # set if we want to let tracing continue on the child too |
| 45 | + .equ CLONE_VFORK, 0x00004000 # set if the parent wants the child to wake it up on mm_release |
| 46 | + .equ CLONE_PARENT, 0x00008000 # set if we want to have the same parent as the cloner |
| 47 | + .equ CLONE_THREAD, 0x00010000 # Same thread group? |
| 48 | + .equ CLONE_NEWNS, 0x00020000 # New mount namespace group |
| 49 | + .equ CLONE_SYSVSEM, 0x00040000 # share system V SEM_UNDO semantics |
| 50 | + .equ CLONE_SETTLS, 0x00080000 # create a new TLS for the child |
| 51 | + .equ CLONE_PARENT_SETTID, 0x00100000 # set the TID in the parent |
| 52 | + .equ CLONE_CHILD_CLEARTID, 0x00200000 # clear the TID in the child |
| 53 | + .equ CLONE_DETACHED, 0x00400000 # Unused, ignored |
| 54 | + .equ CLONE_UNTRACED, 0x00800000 # set if the tracing process can't force CLONE_PTRACE |
| 55 | + .equ CLONE_CHILD_SETTID, 0x01000000 # set the TID in the child |
| 56 | + .equ CLONE_NEWCGROUP, 0x02000000 # New cgroup namespace |
| 57 | + .equ CLONE_NEWUTS, 0x04000000 # New utsname namespace |
| 58 | + .equ CLONE_NEWIPC, 0x08000000 # New ipc namespace |
| 59 | + .equ CLONE_NEWUSER, 0x10000000 # New user namespace |
| 60 | + .equ CLONE_NEWPID, 0x20000000 # New pid namespace |
| 61 | + .equ CLONE_NEWNET, 0x40000000 # New network namespace |
| 62 | + .equ CLONE_IO, 0x80000000 # Clone io context |
| 63 | +
|
| 64 | + # fcntl.h |
| 65 | + .equ O_ACCMODE, 00000003 |
| 66 | + .equ O_RDONLY, 00000000 |
| 67 | + .equ O_WRONLY, 00000001 |
| 68 | + .equ O_RDWR, 00000002 |
| 69 | + .equ O_CREAT, 00000100 |
| 70 | + .equ O_EXCL, 00000200 |
| 71 | + .equ O_NOCTTY, 00000400 |
| 72 | + .equ O_TRUNC, 00001000 |
| 73 | + .equ O_APPEND, 00002000 |
| 74 | + .equ O_NONBLOCK,00004000 |
| 75 | + |
| 76 | + .equ SHUT_RDWR, 2 |
| 77 | +
|
| 78 | + .equ STDIN_FILENO, 0 |
| 79 | + .equ STDOUT_FILENO, 1 |
| 80 | + .equ STDERR_FILENO, 2 |
| 81 | +
|
| 82 | + .equ AF_INET, 2 |
| 83 | + .equ SOCK_STREAM, 1 |
| 84 | + .equ IPPROTO_IP, 0 |
| 85 | +
|
| 86 | + # epoll.h |
| 87 | + .equ EPOLLIN, 0x001 |
| 88 | + .equ EPOLLPRI, 0x002 |
| 89 | + .equ EPOLLOUT, 0x004 |
| 90 | + .equ EPOLLERR, 0x008 |
| 91 | + .equ EPOLLHUP, 0x010 |
| 92 | + .equ EPOLLRDNORM, 0x040 |
| 93 | + .equ EPOLLRDBAND, 0x080 |
| 94 | + .equ EPOLLWRNORM, 0x100 |
| 95 | + .equ EPOLLWRBAND, 0x200 |
| 96 | + .equ EPOLLMSG, 0x400 |
| 97 | + |
| 98 | + .equ EPOLLEXCLUSIVE, 1 << 28 |
| 99 | + .equ EPOLLWAKEUP, 1 << 29 |
| 100 | + .equ EPOLLONESHOT, 1 << 30 |
| 101 | + .equ EPOLLET, 1 << 31 |
| 102 | +
|
| 103 | + .equ EPOLL_CTL_ADD, 1 |
| 104 | + .equ EPOLL_CTL_DEL, 2 |
| 105 | + .equ EPOLL_CTL_MOD, 3 |
| 106 | +
|
| 107 | + # Linux/RISC-V system calls |
| 108 | + .equ SYS_epoll_create1, 20 |
| 109 | + .equ SYS_epoll_ctl, 21 |
| 110 | + .equ SYS_epoll_pwait, 22 |
| 111 | + .equ SYS_dup3, 24 |
| 112 | + .equ SYS_fcntl, 25 |
| 113 | + .equ SYS_statfs, 43 |
| 114 | + .equ SYS_faccessat, 48 |
| 115 | + .equ SYS_chroot, 51 |
| 116 | + .equ SYS_fchmodat, 53 |
| 117 | + .equ SYS_openat, 56 |
| 118 | + .equ SYS_close, 57 |
| 119 | + .equ SYS_pipe2, 59 |
| 120 | + .equ SYS_read, 63 |
| 121 | + .equ SYS_write, 64 |
| 122 | + .equ SYS_pselect6, 72 |
| 123 | + .equ SYS_ppoll, 73 |
| 124 | + .equ SYS_splice, 76 |
| 125 | + .equ SYS_exit, 93 |
| 126 | + .equ SYS_futex, 98 |
| 127 | + .equ SYS_kill, 129 |
| 128 | + .equ SYS_reboot, 142 |
| 129 | + .equ SYS_setuid, 146 |
| 130 | + .equ SYS_setsid, 157 |
| 131 | + .equ SYS_uname, 160 |
| 132 | + .equ SYS_getpid, 172 |
| 133 | + .equ SYS_getppid, 173 |
| 134 | + .equ SYS_getuid, 174 |
| 135 | + .equ SYS_getgid, 176 |
| 136 | + .equ SYS_gettid, 178 |
| 137 | + .equ SYS_socket, 198 |
| 138 | + .equ SYS_bind, 200 |
| 139 | + .equ SYS_listen, 201 |
| 140 | + .equ SYS_accept, 202 |
| 141 | + .equ SYS_connect, 203 |
| 142 | + .equ SYS_sendto, 206 |
| 143 | + .equ SYS_recvfrom, 207 |
| 144 | + .equ SYS_setsockopt, 208 |
| 145 | + .equ SYS_getsockopt, 209 |
| 146 | + .equ SYS_shutdown, 210 |
| 147 | + .equ SYS_munmap, 215 |
| 148 | + .equ SYS_clone, 220 |
| 149 | + .equ SYS_execve, 221 |
| 150 | + .equ SYS_mmap, 222 |
| 151 | + .equ SYS_mprotect, 226 |
| 152 | + .equ SYS_wait4, 260 |
| 153 | + .equ SYS_getrandom, 278 |
| 154 | + .equ SYS_memfd_create, 279 |
| 155 | + .equ SYS_access, 1033 |
| 156 | +
|
0 commit comments