mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-17 08:40:52 +00:00
server: pass memory buffer to server init
Signed-off-by: Sean Cross <sean@xobs.io>
This commit is contained in:
parent
e48e1820f6
commit
9bba5cbe4d
3 changed files with 19 additions and 9 deletions
|
|
@ -96,6 +96,11 @@ impl Process {
|
||||||
Process { pid: unsafe { PROCESS_TABLE.borrow().current } }
|
Process { pid: unsafe { PROCESS_TABLE.borrow().current } }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Mark this process as running on the current core
|
||||||
|
pub fn activate(&mut self) -> Result<(), xous::Error> {
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
/// Calls the provided function with the current inner process state.
|
/// Calls the provided function with the current inner process state.
|
||||||
pub fn with_inner<F, R>(f: F) -> R
|
pub fn with_inner<F, R>(f: F) -> R
|
||||||
where
|
where
|
||||||
|
|
|
||||||
|
|
@ -168,7 +168,7 @@ impl Server {
|
||||||
new: &mut Option<Server>,
|
new: &mut Option<Server>,
|
||||||
pid: PID,
|
pid: PID,
|
||||||
sid: SID,
|
sid: SID,
|
||||||
// memory_page: MemoryPage,
|
_backing: MemoryRange,
|
||||||
) -> Result<(), xous::Error> {
|
) -> Result<(), xous::Error> {
|
||||||
if new != &None {
|
if new != &None {
|
||||||
return Err(xous::Error::MemoryInUse);
|
return Err(xous::Error::MemoryInUse);
|
||||||
|
|
@ -177,8 +177,8 @@ impl Server {
|
||||||
#[cfg(baremetal)]
|
#[cfg(baremetal)]
|
||||||
let mut queue = unsafe {
|
let mut queue = unsafe {
|
||||||
core::slice::from_raw_parts_mut(
|
core::slice::from_raw_parts_mut(
|
||||||
queue_addr as *mut QueuedMessage,
|
_backing.as_mut_ptr() as *mut QueuedMessage,
|
||||||
queue_size / mem::size_of::<QueuedMessage>(),
|
_backing.len() / mem::size_of::<QueuedMessage>(),
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ use crate::arch;
|
||||||
use crate::arch::mem::MemoryMapping;
|
use crate::arch::mem::MemoryMapping;
|
||||||
pub use crate::arch::process::Process as ArchProcess;
|
pub use crate::arch::process::Process as ArchProcess;
|
||||||
pub use crate::arch::process::Thread;
|
pub use crate::arch::process::Thread;
|
||||||
|
use xous::MemoryRange;
|
||||||
|
|
||||||
use core::cell::RefCell;
|
use core::cell::RefCell;
|
||||||
|
|
||||||
|
|
@ -1277,19 +1278,23 @@ impl SystemServices {
|
||||||
|
|
||||||
for entry in self.servers.iter_mut() {
|
for entry in self.servers.iter_mut() {
|
||||||
if entry == &None {
|
if entry == &None {
|
||||||
|
#[cfg(baremetal)]
|
||||||
|
// Allocate a single page for the server queue
|
||||||
|
let backing = {
|
||||||
|
let mut mm = MemoryManagerHandle::get();
|
||||||
|
(mm.map_zeroed_page(pid, false)?, PAGE_SIZE)
|
||||||
|
};
|
||||||
|
|
||||||
|
#[cfg(not(baremetal))]
|
||||||
|
let backing = MemoryRange::new(4096, 4096).unwrap();
|
||||||
// println!(
|
// println!(
|
||||||
// "KERNEL({}): Found a free slot for a server -- allocating an entry",
|
// "KERNEL({}): Found a free slot for a server -- allocating an entry",
|
||||||
// self.pid.get()
|
// self.pid.get()
|
||||||
// );
|
// );
|
||||||
|
|
||||||
// // Allocate a single page for the server queue
|
|
||||||
// let (addr, size) = {
|
|
||||||
// let mut mm = MemoryManagerHandle::get();
|
|
||||||
// (mm.map_zeroed_page(pid, false)?, PAGE_SIZE)
|
|
||||||
// };
|
|
||||||
|
|
||||||
// Initialize the server with the given memory page.
|
// Initialize the server with the given memory page.
|
||||||
Server::init(entry, pid, sid /*, addr, size*/).map_err(|x| x)?;
|
Server::init(entry, pid, sid, backing).map_err(|x| x)?;
|
||||||
return Ok(sid);
|
return Ok(sid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue