18 #ifndef __FENNIX_API_SYSCALLS_LIST_H__
19 #define __FENNIX_API_SYSCALLS_LIST_H__
21 #pragma region Syscall Wrappers
23 #define scarg __UINTPTR_TYPE__
36 __asm__ __volatile__(
"syscall"
39 :
"rcx",
"r11",
"memory");
55 __asm__ __volatile__(
"syscall"
57 :
"a"(syscall),
"D"(arg1)
58 :
"rcx",
"r11",
"memory");
75 __asm__ __volatile__(
"syscall"
77 :
"a"(syscall),
"D"(arg1),
"S"(arg2)
78 :
"rcx",
"r11",
"memory");
96 __asm__ __volatile__(
"syscall"
98 :
"a"(syscall),
"D"(arg1),
"S"(arg2),
"d"(arg3)
99 :
"rcx",
"r11",
"memory");
118 register scarg r10 __asm__(
"r10") = arg4;
119 __asm__ __volatile__(
"syscall"
121 :
"a"(syscall),
"D"(arg1),
"S"(arg2),
"d"(arg3),
"r"(r10)
122 :
"rcx",
"r11",
"memory");
142 register scarg r10 __asm__(
"r10") = arg4;
143 register scarg r8 __asm__(
"r8") = arg5;
144 __asm__ __volatile__(
"syscall"
146 :
"a"(syscall),
"D"(arg1),
"S"(arg2),
"d"(arg3),
"r"(r10),
"r"(r8)
147 :
"rcx",
"r11",
"memory");
168 register scarg r10 __asm__(
"r10") = arg4;
169 register scarg r8 __asm__(
"r8") = arg5;
170 register scarg r9 __asm__(
"r9") = arg6;
171 __asm__ __volatile__(
"syscall"
173 :
"a"(syscall),
"D"(arg1),
"S"(arg2),
"d"(arg3),
"r"(r10),
"r"(r8),
"r"(r9)
174 :
"rcx",
"r11",
"memory");
178 #pragma endregion Syscall Wrappers
187 #define __SYS_NULL ((void *)0)
1409 #define call_api_version(version) syscall1(SYS_API_VERSION, (scarg)version)
1414 #define call_read(fd, buf, count) syscall3(SYS_READ, (scarg)fd, (scarg)buf, (scarg)count)
1417 #define call_pread(fd, buf, count, offset) syscall4(SYS_PREAD, (scarg)fd, (scarg)buf, (scarg)count, (scarg)offset)
1420 #define call_write(fd, buf, count) syscall3(SYS_WRITE, (scarg)fd, (scarg)buf, (scarg)count)
1423 #define call_pwrite(fd, buf, count, offset) syscall4(SYS_PWRITE, (scarg)fd, (scarg)buf, (scarg)count, (scarg)offset)
1426 #define call_open(pathname, flags, mode) syscall3(SYS_OPEN, (scarg)pathname, (scarg)flags, (scarg)mode)
1429 #define call_close(fd) syscall1(SYS_CLOSE, fd)
1432 #define call_ioctl(fd, request, argp) syscall3(SYS_IOCTL, (scarg)fd, (scarg)request, (scarg)argp)
1437 #define call_stat(pathname, statbuf) syscall2(SYS_STAT, (scarg)pathname, (scarg)statbuf)
1440 #define call_fstat(fd, statbuf) syscall2(SYS_FSTAT, (scarg)fd, (scarg)statbuf)
1443 #define call_lstat(pathname, statbuf) syscall2(SYS_LSTAT, (scarg)pathname, (scarg)statbuf)
1446 #define call_access(pathname, mode) syscall2(SYS_ACCESS, (scarg)pathname, (scarg)mode)
1449 #define call_truncate(pathname, length) syscall2(SYS_TRUNCATE, (scarg)pathname, (scarg)length)
1452 #define call_ftruncate(fd, length) syscall2(SYS_FTRUNCATE, (scarg)fd, (scarg)length)
1455 #define call_tell(fd) syscall1(SYS_TELL, (scarg)fd)
1458 #define call_seek(fd, offset, whence) syscall3(SYS_SEEK, (scarg)fd, (scarg)offset, (scarg)whence)
1463 #define call_exit(status) syscall1(SYS_EXIT, (scarg)status)
1466 #define call_fork() syscall0(SYS_FORK)
1469 #define call_execve(pathname, argv, envp) syscall3(SYS_EXECVE, (scarg)pathname, (scarg)argv, (scarg)envp)
1472 #define call_getpid() syscall0(SYS_GETPID)
1475 #define call_getppid() syscall0(SYS_GETPPID)
1478 #define call_waitpid(pid, wstatus, options) syscall3(SYS_WAITPID, (scarg)pid, (scarg)wstatus, (scarg)options)
1481 #define call_kill(pid, sig) syscall2(SYS_KILL, (scarg)pid, (scarg)sig)
1484 #define call_prctl(option, arg1, arg2, arg3, arg4) syscall5(SYS_PRCTL, (scarg)option, (scarg)arg1, (scarg)arg2, (scarg)arg3, (scarg)arg4)
1489 #define call_brk(end_data) syscall1(SYS_BRK, (scarg)end_data)
1492 #define call_mmap(addr, length, prot, flags, fd, offset) syscall6(SYS_MMAP, (scarg)addr, (scarg)length, (scarg)prot, (scarg)flags, (scarg)fd, (scarg)offset)
1495 #define call_munmap(addr, length) syscall2(SYS_MUNMAP, (scarg)addr, (scarg)length)
1498 #define call_mprotect(addr, length, prot) syscall3(SYS_MPROTECT, (scarg)addr, (scarg)length, (scarg)prot)
1501 #define call_madvise(addr, length, advice) syscall3(SYS_MADVISE, (scarg)addr, (scarg)length, (scarg)advice)
1506 #define call_pipe(pipefd) syscall1(SYS_PIPE, (scarg)pipefd)
1509 #define call_dup(oldfd) syscall1(SYS_DUP, (scarg)oldfd)
1512 #define call_dup2(oldfd, newfd) syscall2(SYS_DUP2, (scarg)oldfd, (scarg)newfd)
1515 #define call_socket(domain, type, protocol) syscall3(SYS_SOCKET, (scarg)domain, (scarg)type, (scarg)protocol)
1518 #define call_bind(sockfd, addr, addrlen) syscall3(SYS_BIND, (scarg)sockfd, (scarg)addr, (scarg)addrlen)
1521 #define call_connect(sockfd, addr, addrlen) syscall3(SYS_CONNECT, (scarg)sockfd, (scarg)addr, (scarg)addrlen)
1524 #define call_listen(sockfd, backlog) syscall2(SYS_LISTEN, (scarg)sockfd, (scarg)backlog)
1527 #define call_accept(sockfd, addr, addrlen) syscall3(SYS_ACCEPT, (scarg)sockfd, (scarg)addr, (scarg)addrlen)
1530 #define call_send(sockfd, buf, len, flags) syscall4(SYS_SEND, (scarg)sockfd, (scarg)buf, (scarg)len, (scarg)flags)
1533 #define call_recv(sockfd, buf, len, flags) syscall4(SYS_RECV, (scarg)sockfd, (scarg)buf, (scarg)len, (scarg)flags)
1536 #define call_shutdown(sockfd, how) syscall2(SYS_SHUTDOWN, (scarg)sockfd, (scarg)how)
1541 #define call_time(t) syscall1(SYS_TIME, t)
1544 #define call_clock_gettime(clockid, tp) syscall2(SYS_CLOCK_GETTIME, (scarg)clockid, (scarg)tp)
1547 #define call_clock_settime(clockid, tp) syscall2(SYS_CLOCK_SETTIME, (scarg)clockid, (scarg)tp)
1550 #define call_nanosleep(req, rem) syscall2(SYS_NANOSLEEP, (scarg)req, (scarg)rem)
1555 #define call_getcwd(buf, size) syscall2(SYS_GETCWD, (scarg)buf, (scarg)size)
1558 #define call_chdir(path) syscall1(SYS_CHDIR, (scarg)path)
1561 #define call_mkdir(path, mode) syscall2(SYS_MKDIR, (scarg)path, (scarg)mode)
1564 #define call_rmdir(path) syscall1(SYS_RMDIR, (scarg)path)
1567 #define call_unlink(pathname) syscall1(SYS_UNLINK, (scarg)pathname)
1570 #define call_rename(oldpath, newpath) syscall2(SYS_RENAME, (scarg)oldpath, (scarg)newpath)
_Static_assert((int) __SYS_SIG_IGN==(int) ___SYS_SIG_IGN, "SIG_IGN values do not match")
unsigned int __SYS_socklen_t
syscall_signal_disposition_t
syscalls_t
List of syscalls.
@ SYS_UNLINK
Remove a file.
@ SYS_MMAP
Map files or devices into memory.
@ SYS_SHUTDOWN
Shut down part of a full-duplex connection.
@ SYS_RECV
Receive data on a socket.
@ SYS_MAX
Max number of syscalls.
@ SYS_STAT
Retrieve file status.
@ SYS_WRITE
Write to a file descriptor.
@ SYS_NANOSLEEP
Sleep for a specified time.
@ SYS_TELL
Get the current file offset.
@ SYS_TRUNCATE
Change the size of a file.
@ SYS_RMDIR
Remove an empty directory.
@ SYS_READ
Read from a file descriptor.
@ SYS_GETPPID
Get the parent process ID.
@ SYS_CLOSE
Close a file descriptor.
@ SYS_MADVISE
Provide advice about memory usage.
@ SYS_EXECVE
Execute a program.
@ SYS_LISTEN
Listen for incoming connections on a socket.
@ SYS_WAITPID
Wait for a child process to change state.
@ SYS_BRK
Set the program break.
@ SYS_MUNMAP
Unmap a mapped memory region.
@ SYS_EXIT
Terminate the calling process.
@ SYS_CONNECT
Connect to a remote address.
@ SYS_IOCTL
Control a device.
@ SYS_PREAD
Read from a file descriptor.
@ SYS_RENAME
Rename a file or directory.
@ SYS_GETPID
Get the process ID of the calling process.
@ SYS_FSTAT
Retrieve file status for an open file descriptor.
@ SYS_PWRITE
Write to a file descriptor.
@ SYS_BIND
Bind a socket to a local address.
@ SYS_TIME
Get the current time.
@ SYS_DUP
Duplicate a file descriptor.
@ SYS_SOCKET
Create an endpoint for communication.
@ SYS_CLOCK_SETTIME
Set the current time of a specific clock.
@ SYS_API_VERSION
Set syscall version.
@ SYS_FORK
Create a child process.
@ SYS_SEND
Send data on a socket.
@ SYS_PRCTL
Process/Thread Control.
@ SYS_LSTAT
Retrieve file status with symbolic link resolution.
@ SYS_DUP2
Duplicate a file descriptor to a specific value.
@ SYS_KILL
Send a signal to a process.
@ SYS_MPROTECT
Change memory protection.
@ SYS_MKDIR
Create a new directory.
@ SYS_CHDIR
Change the current working directory.
@ SYS_ACCEPT
Accept an incoming connection on a socket.
@ SYS_FTRUNCATE
Change the size of a file referred by a file descriptor.
@ SYS_SEEK
Set the file offset.
@ SYS_GETCWD
Get the current working directory.
@ SYS_CLOCK_GETTIME
Get the current time of a specific clock.
@ SYS_ACCESS
Check a file's accessibility.
static scarg syscall6(scarg syscall, scarg arg1, scarg arg2, scarg arg3, scarg arg4, scarg arg5, scarg arg6)
Syscall wrapper with 6 arguments.
@ __SYS_CLOCK_PROCESS_CPUTIME_ID
@ __SYS_CLOCK_THREAD_CPUTIME_ID
static scarg syscall5(scarg syscall, scarg arg1, scarg arg2, scarg arg3, scarg arg4, scarg arg5)
Syscall wrapper with 5 arguments.
static scarg syscall4(scarg syscall, scarg arg1, scarg arg2, scarg arg3, scarg arg4)
Syscall wrapper with 4 arguments.
static scarg syscall1(scarg syscall, scarg arg1)
Syscall wrapper with 1 argument.
static scarg syscall0(scarg syscall)
Syscall wrapper with 0 arguments.
syscall_signal_action_flags_t
static scarg syscall2(scarg syscall, scarg arg1, scarg arg2)
Syscall wrapper with 2 arguments.
syscall_signal_action_disposition_t
static scarg syscall3(scarg syscall, scarg arg1, scarg arg2, scarg arg3)
Syscall wrapper with 3 arguments.