Fix for user

master
WangRunji 6 years ago
parent 6022ec8efc
commit 776dc976c9

@ -202,7 +202,7 @@ impl<T: Context, S: Scheduler> Processor_<T, S> {
if let Some(waiter) = self.find_waiter(pid) {
info!(" then wakeup {}", waiter);
self.set_status(waiter, Status::Ready);
self.switch_to(waiter); // yield
self.next = Some(waiter);
}
}

@ -50,7 +50,7 @@ impl PageTable for ActivePageTable {
fn get_entry(&mut self, addr: usize) -> &mut PageEntry {
let page = Page::of_addr(VirtAddr::new(addr));
assert!(self.0.translate_page(page).is_some(), "page table entry not exist");
let _ = self.0.translate_page(page);
let entry_addr = ((addr >> 10) & 0x003ffffc) | (RECURSIVE_PAGE_PML4 << 22);
unsafe { &mut *(entry_addr as *mut PageEntry) }
}

@ -58,8 +58,6 @@ impl PageTable for ActivePageTable {
}
fn get_entry(&mut self, addr: usize) -> &mut PageEntry {
assert!(self.0.translate_page(Page::of_addr(addr)).is_some(),
"page table entry not exist");
let entry_addr = ((addr >> 9) & 0o777_777_777_7770) | 0xffffff80_00000000;
unsafe { &mut *(entry_addr as *mut PageEntry) }
}

@ -53,7 +53,6 @@ impl Log for SimpleLogger {
}
fn log(&self, record: &Record) {
static DISABLED_TARGET: &[&str] = &[
"rust_ucore::process::scheduler::rr",
];
if self.enabled(record.metadata()) && !DISABLED_TARGET.contains(&record.target()) {
// let target = record.target();

@ -27,7 +27,7 @@ pub fn syscall(id: usize, args: [usize; 6], tf: &TrapFrame) -> i32 {
SYS_PUTC => sys_putc(args[0] as u8 as char),
_ => {
error!("unknown syscall id: {:#x?}, args: {:x?}", id, args);
-1
::trap::error(tf);
}
}
}

@ -12,12 +12,14 @@ pub fn before_return() {
}
}
pub fn error(tf: &TrapFrame) {
pub fn error(tf: &TrapFrame) -> ! {
if let Some(processor) = PROCESSOR.try() {
let mut processor = processor.lock();
let pid = processor.current_pid();
error!("Process {} error:\n{:#x?}", pid, tf);
processor.exit(pid, 0x100); // TODO: Exit code for error
processor.schedule();
unreachable!();
} else {
panic!("Exception when processor not inited\n{:#x?}", tf);
}

Loading…
Cancel
Save