mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-17 08:40:52 +00:00
kernel: services: format document
Signed-off-by: Sean Cross <sean@xobs.io>
This commit is contained in:
parent
8c994e0397
commit
e7744b25ec
2 changed files with 19 additions and 30 deletions
|
|
@ -367,7 +367,11 @@ impl Server {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Destructure the PID and context ID from the `pid_tid` field
|
// Destructure the PID and context ID from the `pid_tid` field
|
||||||
klog!("taking waiting message and returning to pid: {} tid: {}", pid, tid);
|
klog!(
|
||||||
|
"taking waiting message and returning to pid: {} tid: {}",
|
||||||
|
pid,
|
||||||
|
tid
|
||||||
|
);
|
||||||
|
|
||||||
if !is_memory {
|
if !is_memory {
|
||||||
return Ok(WaitingMessage::ScalarMessage(
|
return Ok(WaitingMessage::ScalarMessage(
|
||||||
|
|
@ -419,7 +423,8 @@ impl Server {
|
||||||
let sender = SenderID {
|
let sender = SenderID {
|
||||||
idx: self.queue_tail,
|
idx: self.queue_tail,
|
||||||
sidx,
|
sidx,
|
||||||
}.into();
|
}
|
||||||
|
.into();
|
||||||
let (result, response) = match self.queue[self.queue_tail] {
|
let (result, response) = match self.queue[self.queue_tail] {
|
||||||
QueuedMessage::Empty => return None,
|
QueuedMessage::Empty => return None,
|
||||||
QueuedMessage::WaitingReturnMemory(_, _, _, _, _) => return None,
|
QueuedMessage::WaitingReturnMemory(_, _, _, _, _) => return None,
|
||||||
|
|
|
||||||
|
|
@ -323,7 +323,8 @@ impl SystemServices {
|
||||||
// Set up our handle with a bogus sp and pc. These will get updated
|
// Set up our handle with a bogus sp and pc. These will get updated
|
||||||
// once a context switch _away_ from the kernel occurs, however we need
|
// once a context switch _away_ from the kernel occurs, however we need
|
||||||
// to make sure other fields such as "thread number" are all valid.
|
// to make sure other fields such as "thread number" are all valid.
|
||||||
ArchProcess::setup_process(PID::new(1).unwrap(), ThreadInit::default()).expect("couldn't setup process");
|
ArchProcess::setup_process(PID::new(1).unwrap(), ThreadInit::default())
|
||||||
|
.expect("couldn't setup process");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Add a new entry to the process table. This results in a new address space
|
/// Add a new entry to the process table. This results in a new address space
|
||||||
|
|
@ -865,7 +866,7 @@ impl SystemServices {
|
||||||
ProcessState::Allocated => {
|
ProcessState::Allocated => {
|
||||||
ArchProcess::with_inner_mut(|process_inner| process_inner.pid = new_pid);
|
ArchProcess::with_inner_mut(|process_inner| process_inner.pid = new_pid);
|
||||||
ProcessState::Running(0)
|
ProcessState::Running(0)
|
||||||
},
|
}
|
||||||
ProcessState::Free => panic!("process was suddenly Free"),
|
ProcessState::Free => panic!("process was suddenly Free"),
|
||||||
ProcessState::Ready(x) | ProcessState::Running(x) => {
|
ProcessState::Ready(x) | ProcessState::Running(x) => {
|
||||||
ProcessState::Running(x & !(1 << new_tid))
|
ProcessState::Running(x & !(1 << new_tid))
|
||||||
|
|
@ -941,7 +942,7 @@ impl SystemServices {
|
||||||
previous_pid, new.state
|
previous_pid, new.state
|
||||||
) /*,
|
) /*,
|
||||||
}*/
|
}*/
|
||||||
;
|
;
|
||||||
// if advance_thread {
|
// if advance_thread {
|
||||||
// new.current_thread += 1;
|
// new.current_thread += 1;
|
||||||
// if new.current_thread as TID > arch::process::MAX_CONTEXT {
|
// if new.current_thread as TID > arch::process::MAX_CONTEXT {
|
||||||
|
|
@ -1277,7 +1278,7 @@ impl SystemServices {
|
||||||
ProcessState::Allocated => {
|
ProcessState::Allocated => {
|
||||||
ArchProcess::with_inner_mut(|process_inner| process_inner.pid = pid);
|
ArchProcess::with_inner_mut(|process_inner| process_inner.pid = pid);
|
||||||
ProcessState::Ready(1 << new_tid)
|
ProcessState::Ready(1 << new_tid)
|
||||||
},
|
}
|
||||||
|
|
||||||
other => panic!(
|
other => panic!(
|
||||||
"error spawning thread: process was in an invalid state {:?}",
|
"error spawning thread: process was in an invalid state {:?}",
|
||||||
|
|
@ -1508,28 +1509,6 @@ impl SystemServices {
|
||||||
result
|
result
|
||||||
}
|
}
|
||||||
|
|
||||||
// /// Obtain the connection ID of the server from within the server process.
|
|
||||||
// pub fn server_cid(&mut self, sidx: usize) -> Result<CID, xous_kernel::Error> {
|
|
||||||
// let current_pid = self.current_pid();
|
|
||||||
// let result = {
|
|
||||||
// let server = self
|
|
||||||
// .server_from_sidx(sidx)
|
|
||||||
// .ok_or(xous_kernel::Error::ServerNotFound)?;
|
|
||||||
// let server_pid = server.pid;
|
|
||||||
// let sid = server.sid;
|
|
||||||
// {
|
|
||||||
// let server_process = self.get_process(server_pid)?;
|
|
||||||
// server_process.mapping.activate().unwrap();
|
|
||||||
// }
|
|
||||||
// self.connect_to_server(sid)
|
|
||||||
// };
|
|
||||||
// let current_process = self
|
|
||||||
// .get_process(current_pid)
|
|
||||||
// .expect("couldn't restore previous process");
|
|
||||||
// current_process.mapping.activate()?;
|
|
||||||
// result
|
|
||||||
// }
|
|
||||||
|
|
||||||
/// Switch to the server's address space and add a "remember this address"
|
/// Switch to the server's address space and add a "remember this address"
|
||||||
/// entry to its server queue, then switch back to the original address space.
|
/// entry to its server queue, then switch back to the original address space.
|
||||||
pub fn remember_server_message(
|
pub fn remember_server_message(
|
||||||
|
|
@ -1552,8 +1531,13 @@ impl SystemServices {
|
||||||
.server_from_sidx_mut(sidx)
|
.server_from_sidx_mut(sidx)
|
||||||
.expect("couldn't re-discover server index");
|
.expect("couldn't re-discover server index");
|
||||||
let result = server.queue_response(current_pid, current_thread, message, client_address);
|
let result = server.queue_response(current_pid, current_thread, message, client_address);
|
||||||
let current_process = self.get_process(current_pid).expect("couldn't find old process");
|
let current_process = self
|
||||||
current_process.mapping.activate().expect("couldn't switch back to previous address space");
|
.get_process(current_pid)
|
||||||
|
.expect("couldn't find old process");
|
||||||
|
current_process
|
||||||
|
.mapping
|
||||||
|
.activate()
|
||||||
|
.expect("couldn't switch back to previous address space");
|
||||||
result
|
result
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue