kernel: add space for message reply pointer

With this, we now have enough space to store the return context
information for when `message_reply()` is called.

Signed-off-by: Sean Cross <sean@xobs.io>
This commit is contained in:
Sean Cross 2020-03-23 09:10:19 +08:00
parent 537e9da79d
commit a31c4722fa
2 changed files with 7 additions and 4 deletions

View file

@ -13,13 +13,12 @@ pub struct Process {
scratch: usize,
/// The index into the `contexts` list. This must never be 0.
context_nr: usize,
context_nr: u16,
/// The previous context number prior to banking
banked_context_nr: usize,
banked_context_nr: u16,
_hash: [usize; 8],
_padding: [usize; 14],
/// Global parameters used by the operating system
pub inner: ProcessInner,
@ -49,7 +48,7 @@ pub struct ProcessContext {
impl Process {
pub fn current_context(&mut self) -> &mut ProcessContext {
// println!("current_context({:?}", self);
&mut self.contexts[self.context_nr - 1]
&mut self.contexts[self.context_nr as usize - 1]
}
pub fn trap_context(&mut self) -> &mut ProcessContext {

View file

@ -90,6 +90,9 @@ pub struct ProcessInner {
/// Maximum size of the heap
pub mem_heap_max: usize,
/// Which context to return to when `reply_message()` is called
pub ctx_reply: [(PID, u8); 30],
}
impl Default for ProcessInner {
@ -102,6 +105,7 @@ impl Default for ProcessInner {
mem_heap_base: arch::mem::DEFAULT_HEAP_BASE,
mem_heap_size: 0,
mem_heap_max: 524288,
ctx_reply: [(0, 0); 30],
}
}
}