Still a lot of bugs :(
This commit is contained in:
parent
704eae3bb0
commit
26f44233f6
27 changed files with 308 additions and 95 deletions
|
@ -1,20 +1,19 @@
|
|||
use super::id::TaskUserRes;
|
||||
use super::{kstack_alloc, KernelStack, ProcessControlBlock, TaskContext};
|
||||
use crate::trap::TrapContext;
|
||||
use crate::{mm::PhysPageNum, sync::UPSafeCell};
|
||||
use crate::{mm::PhysPageNum, sync::{UPIntrFreeCell, UPIntrRefMut}};
|
||||
use alloc::sync::{Arc, Weak};
|
||||
use core::cell::RefMut;
|
||||
|
||||
pub struct TaskControlBlock {
|
||||
// immutable
|
||||
pub process: Weak<ProcessControlBlock>,
|
||||
pub kstack: KernelStack,
|
||||
// mutable
|
||||
inner: UPSafeCell<TaskControlBlockInner>,
|
||||
inner: UPIntrFreeCell<TaskControlBlockInner>,
|
||||
}
|
||||
|
||||
impl TaskControlBlock {
|
||||
pub fn inner_exclusive_access(&self) -> RefMut<'_, TaskControlBlockInner> {
|
||||
pub fn inner_exclusive_access(&self) -> UPIntrRefMut<'_, TaskControlBlockInner> {
|
||||
self.inner.exclusive_access()
|
||||
}
|
||||
|
||||
|
@ -58,7 +57,7 @@ impl TaskControlBlock {
|
|||
process: Arc::downgrade(&process),
|
||||
kstack,
|
||||
inner: unsafe {
|
||||
UPSafeCell::new(TaskControlBlockInner {
|
||||
UPIntrFreeCell::new(TaskControlBlockInner {
|
||||
res: Some(res),
|
||||
trap_cx_ppn,
|
||||
task_cx: TaskContext::goto_trap_return(kstack_top),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue