|
@@ -3,7 +3,12 @@
|
|
|
use alloc::{borrow::ToOwned, boxed::Box, collections::BTreeMap, string::String, vec::Vec};
|
|
|
|
|
|
use crate::{
|
|
|
- c_str::CStr, header::unistd, platform::types::c_char, start::Stack, sync::mutex::Mutex,
|
|
|
+ c_str::CStr,
|
|
|
+ header::unistd,
|
|
|
+ platform::{new_mspace, types::c_char},
|
|
|
+ start::Stack,
|
|
|
+ sync::mutex::Mutex,
|
|
|
+ ALLOCATOR,
|
|
|
};
|
|
|
|
|
|
use super::{
|
|
@@ -116,7 +121,9 @@ unsafe fn adjust_stack(sp: &'static mut Stack) {
|
|
|
}
|
|
|
#[no_mangle]
|
|
|
pub extern "C" fn relibc_ld_so_start(sp: &'static mut Stack, ld_entry: usize) -> usize {
|
|
|
- // first we get the arguments, the environment, and the auxilary vector
|
|
|
+ // First thing we initialize the mspace
|
|
|
+ ALLOCATOR.set_book_keeper(new_mspace());
|
|
|
+ // next we get the arguments, the environment, and the auxilary vector
|
|
|
let (argv, envs, auxv) = unsafe {
|
|
|
let argv_start = sp.argv() as *mut usize;
|
|
|
let (argv, argv_end) = get_argv(argv_start);
|
|
@@ -210,6 +217,7 @@ pub extern "C" fn relibc_ld_so_start(sp: &'static mut Stack, ld_entry: usize) ->
|
|
|
}
|
|
|
if let Some(tcb) = unsafe { Tcb::current() } {
|
|
|
tcb.linker_ptr = Box::into_raw(Box::new(Mutex::new(linker)));
|
|
|
+ tcb.mspace = ALLOCATOR.get_book_keeper();
|
|
|
}
|
|
|
if is_manual {
|
|
|
eprintln!("ld.so: entry '{}': {:#x}", path, entry);
|