|
|
@ -20,6 +20,7 @@ use crate::memory::{
|
|
|
|
use crate::sync::{Condvar, SpinNoIrqLock as Mutex};
|
|
|
|
use crate::sync::{Condvar, SpinNoIrqLock as Mutex};
|
|
|
|
|
|
|
|
|
|
|
|
use super::abi::{self, ProcInitInfo};
|
|
|
|
use super::abi::{self, ProcInitInfo};
|
|
|
|
|
|
|
|
use core::mem::uninitialized;
|
|
|
|
use rcore_fs::vfs::INode;
|
|
|
|
use rcore_fs::vfs::INode;
|
|
|
|
|
|
|
|
|
|
|
|
// TODO: avoid pub
|
|
|
|
// TODO: avoid pub
|
|
|
@ -138,9 +139,11 @@ impl Thread {
|
|
|
|
mut args: Vec<String>,
|
|
|
|
mut args: Vec<String>,
|
|
|
|
envs: Vec<String>,
|
|
|
|
envs: Vec<String>,
|
|
|
|
) -> Result<(MemorySet, usize, usize), &'static str> {
|
|
|
|
) -> Result<(MemorySet, usize, usize), &'static str> {
|
|
|
|
// Read data
|
|
|
|
// Read ELF header
|
|
|
|
let data = inode
|
|
|
|
// 0x3c0: magic number from ld-musl.so
|
|
|
|
.read_as_vec()
|
|
|
|
let mut data: [u8; 0x3c0] = unsafe { uninitialized() };
|
|
|
|
|
|
|
|
inode
|
|
|
|
|
|
|
|
.read_at(0, &mut data)
|
|
|
|
.map_err(|_| "failed to read from INode")?;
|
|
|
|
.map_err(|_| "failed to read from INode")?;
|
|
|
|
|
|
|
|
|
|
|
|
// Parse ELF
|
|
|
|
// Parse ELF
|
|
|
|