mirror of
https://github.com/rcore-os/rCore.git
synced 2024-11-25 01:16:18 +04:00
Fix compile error after merge for the new processor.
This commit is contained in:
parent
fcdee71f9d
commit
a145909998
@ -53,7 +53,7 @@ pub fn shell() {
|
||||
use process::*;
|
||||
let len = file.borrow().read_at(0, &mut *buf).unwrap();
|
||||
let context = ContextImpl::new_user(&buf[..len]);
|
||||
memory_set_map_swappable(context.get_memory_set_mut());
|
||||
//memory_set_map_swappable(context.get_memory_set_mut());
|
||||
let pid = processor().manager().add(context);
|
||||
//memory_set_map_swappable(processor().get_context_mut(pid).get_memory_set_mut());
|
||||
processor().manager().wait(thread::current().id(), pid);
|
||||
|
@ -7,14 +7,11 @@ use ucore_memory::{*, paging::PageTable};
|
||||
use ucore_memory::cow::CowExt;
|
||||
pub use ucore_memory::memory_set::{MemoryArea, MemoryAttr, MemorySet as MemorySet_, Stack, InactivePageTable};
|
||||
use ucore_memory::swap::*;
|
||||
<<<<<<< HEAD
|
||||
use process::{processor, PROCESSOR};
|
||||
//use process::{processor, PROCESSOR};
|
||||
use process::{process};
|
||||
use sync::{SpinNoIrqLock, SpinNoIrq, MutexGuard};
|
||||
use alloc::collections::VecDeque;
|
||||
|
||||
=======
|
||||
use process::{processor, process};
|
||||
>>>>>>> 87506b000dc9a8f08c0040fee9570f5913bdd5b8
|
||||
|
||||
pub type MemorySet = MemorySet_<InactivePageTable0>;
|
||||
|
||||
@ -121,10 +118,7 @@ impl Drop for KernelStack {
|
||||
pub fn page_fault_handler(addr: usize) -> bool {
|
||||
info!("start handling swap in/out page fault");
|
||||
unsafe { ACTIVE_TABLE_SWAP.force_unlock(); }
|
||||
<<<<<<< HEAD
|
||||
unsafe {PROCESSOR.try().unwrap().force_unlock();}
|
||||
|
||||
let mut temp_proc = processor();
|
||||
debug!("active page table token in pg fault is {:x?}", ActivePageTable::token());
|
||||
let id = memory_set_record().iter()
|
||||
.position(|x| unsafe{(*(x.clone() as *mut MemorySet)).get_page_table_mut().token() == ActivePageTable::token()});
|
||||
@ -140,28 +134,18 @@ pub fn page_fault_handler(addr: usize) -> bool {
|
||||
},
|
||||
None => {
|
||||
debug!("get pt from processor()");
|
||||
let pt = temp_proc.current_context_mut().get_memory_set_mut().get_page_table_mut();
|
||||
let pt = process().get_memory_set_mut().get_page_table_mut();
|
||||
if active_table_swap().page_fault_handler(pt as *mut InactivePageTable0, addr, true, || alloc_frame().unwrap()){
|
||||
return true;
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
// handle the swap in/out
|
||||
//info!("start handling swap in/out page fault");
|
||||
//let mut temp_proc = processor();
|
||||
//let pt = temp_proc.current_context_mut().get_memory_set_mut().get_page_table_mut();
|
||||
//let pt = unsafe { (*(mmset_ptr.unwrap().clone() as *mut MemorySet)).get_page_table_mut() };
|
||||
|
||||
|
||||
|
||||
// Handle copy on write (not being used now)
|
||||
unsafe { ACTIVE_TABLE.force_unlock(); }
|
||||
if active_table().page_fault_handler(addr, || alloc_frame().unwrap()){
|
||||
=======
|
||||
let pt = process().get_memory_set_mut().get_page_table_mut();
|
||||
if active_table_swap().page_fault_handler(pt as *mut InactivePageTable0, addr, || alloc_frame().unwrap()){
|
||||
>>>>>>> 87506b000dc9a8f08c0040fee9570f5913bdd5b8
|
||||
return true;
|
||||
}
|
||||
false
|
||||
|
@ -115,14 +115,16 @@ impl ContextImpl {
|
||||
.position(|x| x.clone() == mmset_ptr).unwrap();
|
||||
memory_set_record().remove(id);
|
||||
|
||||
Box::new(ContextImpl {
|
||||
let mut ret = Box::new(ContextImpl {
|
||||
arch: unsafe {
|
||||
ArchContext::new_user_thread(
|
||||
entry_addr, user_stack_top - 8, kstack.top(), is32, memory_set.token())
|
||||
},
|
||||
memory_set,
|
||||
kstack,
|
||||
})
|
||||
});
|
||||
memory_set_map_swappable(ret.get_memory_set_mut());
|
||||
ret
|
||||
}
|
||||
|
||||
/// Fork
|
||||
@ -159,11 +161,13 @@ impl ContextImpl {
|
||||
.position(|x| x.clone() == mmset_ptr).unwrap();
|
||||
memory_set_record().remove(id);
|
||||
|
||||
Box::new(ContextImpl {
|
||||
let mut ret = Box::new(ContextImpl {
|
||||
arch: unsafe { ArchContext::new_fork(tf, kstack.top(), memory_set.token()) },
|
||||
memory_set,
|
||||
kstack,
|
||||
})
|
||||
});
|
||||
memory_set_map_swappable(ret.get_memory_set_mut());
|
||||
ret
|
||||
}
|
||||
|
||||
pub fn get_memory_set_mut(&mut self) -> &mut MemorySet {
|
||||
|
@ -8,6 +8,8 @@ use thread;
|
||||
use util;
|
||||
|
||||
use process::context::memory_set_map_swappable;
|
||||
use alloc::boxed::Box;
|
||||
use process::context::*;
|
||||
|
||||
/// 系统调用入口点
|
||||
///
|
||||
@ -61,7 +63,7 @@ fn sys_close(fd: usize) -> i32 {
|
||||
/// Fork the current process. Return the child's PID.
|
||||
fn sys_fork(tf: &TrapFrame) -> i32 {
|
||||
let mut context = process().fork(tf);
|
||||
memory_set_map_swappable(context.get_memory_set_mut());
|
||||
//memory_set_map_swappable(context.get_memory_set_mut());
|
||||
let pid = processor().manager().add(context);
|
||||
Process::new_fork(pid, thread::current().id());
|
||||
//memory_set_map_swappable(processor.get_context_mut(pid).get_memory_set_mut());
|
||||
|
Loading…
Reference in New Issue
Block a user