Fix syscall return register.

master
Yuhao Zhou 6 years ago
parent 12598a07bf
commit 684a2c5dd8

@ -200,7 +200,7 @@ prefix := riscv64-unknown-elf-
else ifeq ($(arch), riscv64)
prefix := riscv64-unknown-elf-
else ifeq ($(arch), mipsel)
prefix ?= mipsel-linux-gnu-
prefix ?= mipsel-linux-musln32-
else ifeq ($(arch), aarch64)
prefix ?= aarch64-none-elf-
ifeq (,$(shell which $(prefix)ld))

@ -174,7 +174,7 @@ impl Context {
/// The stack pointer will be set to `kstack_top`.
/// The SATP register will be set to `satp`.
pub unsafe fn new_kernel_thread(entry: extern fn(usize) -> !, arg: usize, kstack_top: usize, satp: usize) -> Self {
trace!("New kernel thread @ {:x}, stack = {:x}", entry as usize, kstack_top);
info!("New kernel thread @ {:x}, stack = {:x}", entry as usize, kstack_top);
InitStack {
context: ContextData::new(satp),
@ -188,7 +188,7 @@ impl Context {
/// The stack pointer of user and kernel mode will be set to `ustack_top`, `kstack_top`.
/// The SATP register will be set to `satp`.
pub unsafe fn new_user_thread(entry_addr: usize, ustack_top: usize, kstack_top: usize, _is32: bool, satp: usize) -> Self {
trace!("New user thread @ {:x}, stack = {:x}", entry_addr, kstack_top);
info!("New user thread @ {:x}, stack = {:x}", entry_addr, kstack_top);
InitStack {
context: ContextData::new(satp),
@ -207,7 +207,7 @@ impl Context {
tf: {
let mut tf = tf.clone();
// fork function's ret value, the new process is 0
tf.a0 = 0;
tf.v0 = 0;
tf
},
}.push_at(kstack_top)
@ -227,7 +227,7 @@ impl Context {
let mut tf = tf.clone();
tf.sp = ustack_top; // sp
tf.v1 = tls; // tp
tf.a0 = 0; // a0
tf.v0 = 0; // a0
tf
},
}.push_at(kstack_top)

@ -156,8 +156,10 @@ fn page_fault(tf: &mut TrapFrame) {
let tlb_result = root_table.lookup(addr);
match tlb_result {
Ok(tlb_entry) => tlb::write_tlb_random(tlb_entry),
Err(()) => if !crate::memory::handle_page_fault(addr) {
crate::trap::error(tf);
Err(()) => {
if !crate::memory::handle_page_fault(addr) {
crate::trap::error(tf);
}
}
}
}

Loading…
Cancel
Save