Fix paging bug.

master
Yuhao Zhou 6 years ago
parent 6e2947ac56
commit fb08410cb5

@ -15,9 +15,9 @@ SECTIONS
.text : {
stext = .;
*(.text.entry)
*(.text .text.*)
. = ALIGN(4K);
*(.text.ebase)
*(.text .text.*)
. = ALIGN(4K);
etext = .;
}

@ -15,6 +15,7 @@ pub fn init() {
unsafe {
// Set the exception vector address
cp0::ebase::write_u32(trap_entry as u32);
println!("Set ebase = {:x}", trap_entry as u32);
let mut status = cp0::status::read();
// Enable IPI
@ -127,6 +128,10 @@ fn syscall(tf: &mut TrapFrame) {
tf.v0 = ret as usize;
}
extern {
static root_page_table_ptr : *mut usize;
}
fn page_fault(tf: &mut TrapFrame) {
// TODO: set access/dirty bit
let addr = tf.vaddr;
@ -135,4 +140,6 @@ fn page_fault(tf: &mut TrapFrame) {
if !crate::memory::handle_page_fault(addr) {
crate::trap::error(tf);
}
}

@ -107,9 +107,12 @@ impl InactivePageTable for InactivePageTable0 {
fn new_bare() -> Self {
let target = alloc_frame().expect("failed to allocate frame");
let frame = Frame::of_addr(PhysAddr::new(target));
active_table().with_temporary_map(target, |_, table: &mut MIPSPageTable| {
let table = unsafe {
&mut *(target as *mut MIPSPageTable)
};
table.zero();
});
InactivePageTable0 { root_frame: frame }
}

Loading…
Cancel
Save