mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-20 09:03:28 +00:00
xous: process: specify stack, entrypoint, and base
Specify both the stack range and the process entrypoint, as well as the load address of the text image. Signed-off-by: Sean Cross <sean@xobs.io>
This commit is contained in:
parent
6fc7d153b9
commit
806a31974a
1 changed files with 25 additions and 3 deletions
|
|
@ -6,11 +6,33 @@ use core::convert::TryFrom;
|
||||||
#[derive(Debug, Clone, Copy, PartialEq)]
|
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||||
pub struct ProcessArgs<'a> {
|
pub struct ProcessArgs<'a> {
|
||||||
stub: &'a [u8],
|
stub: &'a [u8],
|
||||||
|
stack: crate::MemoryRange,
|
||||||
|
load_address: crate::MemoryAddress,
|
||||||
|
entrypoint: crate::MemoryAddress,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> ProcessArgs<'a> {
|
impl<'a> ProcessArgs<'a> {
|
||||||
pub fn new(stub: &[u8]) -> ProcessArgs {
|
pub fn new(
|
||||||
ProcessArgs { stub }
|
stub: &[u8],
|
||||||
|
load_address: crate::MemoryAddress,
|
||||||
|
entrypoint: crate::MemoryAddress,
|
||||||
|
) -> ProcessArgs {
|
||||||
|
ProcessArgs {
|
||||||
|
load_address,
|
||||||
|
entrypoint,
|
||||||
|
stub,
|
||||||
|
stack: unsafe { crate::MemoryRange::new(0x8000_0000 - 131072, 131072).unwrap() },
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn stack_base(mut self, base: crate::MemoryAddress) -> ProcessArgs<'a> {
|
||||||
|
self.stack.addr = base;
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn stack_size(mut self, length: crate::MemorySize) -> ProcessArgs<'a> {
|
||||||
|
self.stack.size = length;
|
||||||
|
self
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -133,7 +155,7 @@ pub fn create_process_pre(args: &ProcessArgs) -> core::result::Result<ProcessIni
|
||||||
}
|
}
|
||||||
Ok(ProcessInit {
|
Ok(ProcessInit {
|
||||||
// 0,1 -- Stack Base, Stack Size
|
// 0,1 -- Stack Base, Stack Size
|
||||||
stack: unsafe { crate::MemoryRange::new(0x7000_0000, 131072)? },
|
stack: args.stack,
|
||||||
// 2,3 -- Text Start, Text Size
|
// 2,3 -- Text Start, Text Size
|
||||||
text: spawn_memory,
|
text: spawn_memory,
|
||||||
// 4 -- Text destination address
|
// 4 -- Text destination address
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue