1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 23:47:45 +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

@ -185,7 +185,7 @@ u32 Emulator::virt_syscall(u32 function, u32 arg1, u32 arg2, u32 arg3)
case SC_profiling_disable:
return virt$profiling_disable(arg1);
case SC_profiling_enable:
return virt$profiling_enable(arg1);
return virt$profiling_enable(arg1, arg2);
case SC_purge:
return virt$purge(arg1);
case SC_read:
@ -281,9 +281,9 @@ int Emulator::virt$recvfd(int socket, int options)
return syscall(SC_recvfd, socket, options);
}
int Emulator::virt$profiling_enable(pid_t pid)
int Emulator::virt$profiling_enable(pid_t pid, u64 mask)
{
return syscall(SC_profiling_enable, pid);
return syscall(SC_profiling_enable, pid, mask);
}
int Emulator::virt$profiling_disable(pid_t pid)
@ -474,11 +474,10 @@ int Emulator::virt$get_stack_bounds(FlatPtr base, FlatPtr size)
return 0;
}
int Emulator::virt$ftruncate(int fd, FlatPtr length_addr)
int Emulator::virt$ftruncate(int fd, off_t length)
{
off_t length;
mmu().copy_from_vm(&length, length_addr, sizeof(off_t));
return syscall(SC_ftruncate, fd, &length);
return syscall(SC_ftruncate, fd, length);
}
int Emulator::virt$uname(FlatPtr params_addr)