Reach init fork

This commit is contained in:
4lDO2
2024-12-27 16:32:19 +01:00
parent 26399569de
commit ad5efd0f11
11 changed files with 111 additions and 60 deletions
+12 -1
View File
@@ -2,6 +2,7 @@
use alloc::{boxed::Box, vec::Vec};
use core::{intrinsics, ptr};
use generic_rt::ExpectTlsFree;
use crate::{
header::{libgen, stdio, stdlib},
@@ -141,8 +142,18 @@ pub unsafe extern "C" fn relibc_start(sp: &'static Stack) -> ! {
// Ensure correct host system before executing more system calls
relibc_verify_host();
#[cfg(target_os = "redox")]
let thr_fd = redox_rt::proc::FdGuard::new(
crate::platform::get_auxv_raw(sp.auxv().cast(), redox_rt::auxv_defs::AT_REDOX_THR_FD)
.expect_notls("no thread fd present"),
);
// Initialize TLS, if necessary
ld_so::init(sp);
ld_so::init(
sp,
#[cfg(target_os = "redox")]
thr_fd,
);
// Set up the right allocator...
// if any memory rust based memory allocation happen before this step .. we are doomed.