Fix i686 fork.

This commit is contained in:
4lDO2
2024-07-20 14:42:51 +02:00
parent 35c9485701
commit b71c34dd2d
3 changed files with 8 additions and 3 deletions
+6 -1
View File
@@ -5,6 +5,7 @@ use syscall::*;
use crate::{
proc::{fork_inner, FdGuard},
signal::{inner_fastcall, RtSigarea, SigStack, PROC_CONTROL_STRUCT},
RtTcb,
};
// Setup a stack starting from the very end of the address space, and then growing downwards.
@@ -80,7 +81,11 @@ unsafe extern "cdecl" fn fork_impl(initial_rsp: *mut usize) -> usize {
unsafe extern "cdecl" fn child_hook(cur_filetable_fd: usize, new_pid_fd: usize) {
let _ = syscall::close(cur_filetable_fd);
let _ = syscall::close(new_pid_fd);
// TODO: Currently pidfd == threadfd, but this will not be the case later.
RtTcb::current()
.thr_fd
.get()
.write(Some(FdGuard::new(new_pid_fd)));
}
asmfunction!(__relibc_internal_fork_wrapper -> usize: ["
+1 -1
View File
@@ -91,7 +91,7 @@ unsafe extern "sysv64" fn fork_impl(initial_rsp: *mut usize) -> usize {
unsafe extern "sysv64" fn child_hook(cur_filetable_fd: usize, new_pid_fd: usize) {
let _ = syscall::close(cur_filetable_fd);
// TODO: Currently equivalent, but this will not be the case later.
// TODO: Currently pidfd == threadfd, but this will not be the case later.
RtTcb::current()
.thr_fd
.get()
+1 -1
View File
@@ -481,7 +481,7 @@ pub fn setup_sighandler(tcb: &RtTcb) {
arch.altstack_top = usize::MAX;
arch.altstack_bottom = 0;
// TODO
#[cfg(any(target_arch = "i686", target_arch = "aarch64"))]
#[cfg(any(target_arch = "x86", target_arch = "aarch64"))]
{
arch.pctl = core::ptr::addr_of!(PROC_CONTROL_STRUCT) as usize;
}