mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-13 07:48:30 +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 } }
|
||||
}
|
||||
|
||||
/// 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.
|
||||
pub fn with_inner<F, R>(f: F) -> R
|
||||
where
|
||||
|
|
|
|||
|
|
@ -168,7 +168,7 @@ impl Server {
|
|||
new: &mut Option<Server>,
|
||||
pid: PID,
|
||||
sid: SID,
|
||||
// memory_page: MemoryPage,
|
||||
_backing: MemoryRange,
|
||||
) -> Result<(), xous::Error> {
|
||||
if new != &None {
|
||||
return Err(xous::Error::MemoryInUse);
|
||||
|
|
@ -177,8 +177,8 @@ impl Server {
|
|||
#[cfg(baremetal)]
|
||||
let mut queue = unsafe {
|
||||
core::slice::from_raw_parts_mut(
|
||||
queue_addr as *mut QueuedMessage,
|
||||
queue_size / mem::size_of::<QueuedMessage>(),
|
||||
_backing.as_mut_ptr() as *mut QueuedMessage,
|
||||
_backing.len() / mem::size_of::<QueuedMessage>(),
|
||||
)
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ use crate::arch;
|
|||
use crate::arch::mem::MemoryMapping;
|
||||
pub use crate::arch::process::Process as ArchProcess;
|
||||
pub use crate::arch::process::Thread;
|
||||
use xous::MemoryRange;
|
||||
|
||||
use core::cell::RefCell;
|
||||
|
||||
|
|
@ -1277,19 +1278,23 @@ impl SystemServices {
|
|||
|
||||
for entry in self.servers.iter_mut() {
|
||||
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!(
|
||||
// "KERNEL({}): Found a free slot for a server -- allocating an entry",
|
||||
// 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.
|
||||
Server::init(entry, pid, sid /*, addr, size*/).map_err(|x| x)?;
|
||||
Server::init(entry, pid, sid, backing).map_err(|x| x)?;
|
||||
return Ok(sid);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue