mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-17 08:40:52 +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
f4558dac9e
commit
884edfb36d
1 changed files with 25 additions and 3 deletions
|
|
@ -6,11 +6,33 @@ use core::convert::TryFrom;
|
|||
#[derive(Debug, Clone, Copy, PartialEq)]
|
||||
pub struct ProcessArgs<'a> {
|
||||
stub: &'a [u8],
|
||||
stack: crate::MemoryRange,
|
||||
load_address: crate::MemoryAddress,
|
||||
entrypoint: crate::MemoryAddress,
|
||||
}
|
||||
|
||||
impl<'a> ProcessArgs<'a> {
|
||||
pub fn new(stub: &[u8]) -> ProcessArgs {
|
||||
ProcessArgs { stub }
|
||||
pub fn new(
|
||||
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 {
|
||||
// 0,1 -- Stack Base, Stack Size
|
||||
stack: unsafe { crate::MemoryRange::new(0x7000_0000, 131072)? },
|
||||
stack: args.stack,
|
||||
// 2,3 -- Text Start, Text Size
|
||||
text: spawn_memory,
|
||||
// 4 -- Text destination address
|
||||
|
|
|
|||
Loading…
Reference in a new issue