1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 13:07:46 +00:00

Kernel+LibC: Pass 64-bit integers in syscalls by value

Now that support for 32-bit x86 has been removed, we don't have to worry
about the top half of `off_t`/`u64` values being chopped off when we try
to pass them in registers. Therefore, we no longer need the workaround
of pointers to stack-allocated values to syscalls.

Note that this changes the system call ABI, so statically linked
programs will have to be re-linked.
This commit is contained in:
Daniel Bertalan 2023-08-11 10:47:31 +02:00
parent 87f4b0f1c2
commit 286984750e
12 changed files with 22 additions and 37 deletions

View file

@ -337,17 +337,17 @@ public:
ErrorOr<FlatPtr> sys$open(Userspace<Syscall::SC_open_params const*>);
ErrorOr<FlatPtr> sys$close(int fd);
ErrorOr<FlatPtr> sys$read(int fd, Userspace<u8*>, size_t);
ErrorOr<FlatPtr> sys$pread(int fd, Userspace<u8*>, size_t, Userspace<off_t const*>);
ErrorOr<FlatPtr> sys$pread(int fd, Userspace<u8*>, size_t, off_t);
ErrorOr<FlatPtr> sys$readv(int fd, Userspace<const struct iovec*> iov, int iov_count);
ErrorOr<FlatPtr> sys$write(int fd, Userspace<u8 const*>, size_t);
ErrorOr<FlatPtr> sys$pwritev(int fd, Userspace<const struct iovec*> iov, int iov_count, Userspace<off_t const*>);
ErrorOr<FlatPtr> sys$pwritev(int fd, Userspace<const struct iovec*> iov, int iov_count, off_t);
ErrorOr<FlatPtr> sys$fstat(int fd, Userspace<stat*>);
ErrorOr<FlatPtr> sys$stat(Userspace<Syscall::SC_stat_params const*>);
ErrorOr<FlatPtr> sys$annotate_mapping(Userspace<void*>, int flags);
ErrorOr<FlatPtr> sys$lseek(int fd, Userspace<off_t*>, int whence);
ErrorOr<FlatPtr> sys$ftruncate(int fd, Userspace<off_t const*>);
ErrorOr<FlatPtr> sys$ftruncate(int fd, off_t);
ErrorOr<FlatPtr> sys$futimens(Userspace<Syscall::SC_futimens_params const*>);
ErrorOr<FlatPtr> sys$posix_fallocate(int fd, Userspace<off_t const*>, Userspace<off_t const*>);
ErrorOr<FlatPtr> sys$posix_fallocate(int fd, off_t, off_t);
ErrorOr<FlatPtr> sys$kill(pid_t pid_or_pgid, int sig);
[[noreturn]] void sys$exit(int status);
ErrorOr<FlatPtr> sys$sigreturn(RegisterState& registers);
@ -443,7 +443,7 @@ public:
ErrorOr<FlatPtr> sys$getrandom(Userspace<void*>, size_t, unsigned int);
ErrorOr<FlatPtr> sys$getkeymap(Userspace<Syscall::SC_getkeymap_params const*>);
ErrorOr<FlatPtr> sys$setkeymap(Userspace<Syscall::SC_setkeymap_params const*>);
ErrorOr<FlatPtr> sys$profiling_enable(pid_t, Userspace<u64 const*>);
ErrorOr<FlatPtr> sys$profiling_enable(pid_t, u64);
ErrorOr<FlatPtr> profiling_enable(pid_t, u64 event_mask);
ErrorOr<FlatPtr> sys$profiling_disable(pid_t);
ErrorOr<FlatPtr> sys$profiling_free_buffer(pid_t);