|
|
|
@ -113,17 +113,16 @@ pub fn page_fault_handler(addr: usize) -> bool {
|
|
|
|
|
info!("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()});
|
|
|
|
|
let mut mmsets = memory_set_record();
|
|
|
|
|
/*LAB3 EXERCISE 1: YOUR STUDENT NUMBER
|
|
|
|
|
* handle the frame deallocated
|
|
|
|
|
*/
|
|
|
|
|
match id {
|
|
|
|
|
Some(targetid) => {
|
|
|
|
|
info!("get id from memroy set recorder.");
|
|
|
|
|
let mmset_ptr = mmsets.get(targetid);
|
|
|
|
|
let mmset_ptr = memory_set_record().get(targetid).expect("fail to get mmset_ptr").clone();
|
|
|
|
|
// get current mmset
|
|
|
|
|
|
|
|
|
|
let current_mmset = unsafe{&mut *(mmset_ptr.expect("fail to get mmset_ptr").clone() as *mut MemorySet)};
|
|
|
|
|
let current_mmset = unsafe{&mut *(mmset_ptr as *mut MemorySet)};
|
|
|
|
|
//check whether the vma is legal
|
|
|
|
|
if current_mmset.find_area(addr).is_none(){
|
|
|
|
|
return false;
|
|
|
|
|