From 43e18b498dc35eb7bb4ba0e1ef8660f1c2ea9a71 Mon Sep 17 00:00:00 2001 From: Stephen Marz Date: Sun, 17 May 2020 15:13:53 -0400 Subject: [PATCH] Don't grab the table unless we really need it. --- risc_v/src/syscall.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/risc_v/src/syscall.rs b/risc_v/src/syscall.rs index 637534c..cd54de9 100755 --- a/risc_v/src/syscall.rs +++ b/risc_v/src/syscall.rs @@ -49,14 +49,14 @@ pub unsafe fn do_syscall(mepc: usize, frame: *mut TrapFrame) -> usize { // execv //A0 = path //A1 = argv - let p = get_by_pid((*frame).pid as u16); - let table = ((*p).get_table_address() - as *mut Table) - .as_ref() - .unwrap(); let mut path_addr = (*frame).regs[Registers::A0 as usize]; // If the MMU is turned on, translate. if (*frame).satp >> 60 != 0 { + let p = get_by_pid((*frame).pid as u16); + let table = ((*p).get_table_address() + as *mut Table) + .as_ref() + .unwrap(); path_addr = virt_to_phys(table, path_addr).unwrap(); } let path_bytes = path_addr as *const u8;