Merge branch 'mipsel' of github.com:oscourse-tsinghua/rcore_plus into mipsel

master
Harry Chen 6 years ago
commit 4e72c66087

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

@ -174,7 +174,7 @@ impl Context {
/// The stack pointer will be set to `kstack_top`. /// The stack pointer will be set to `kstack_top`.
/// The SATP register will be set to `satp`. /// 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 { 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 { InitStack {
context: ContextData::new(satp), 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 stack pointer of user and kernel mode will be set to `ustack_top`, `kstack_top`.
/// The SATP register will be set to `satp`. /// 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 { 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 { InitStack {
context: ContextData::new(satp), context: ContextData::new(satp),
@ -207,7 +207,7 @@ impl Context {
tf: { tf: {
let mut tf = tf.clone(); let mut tf = tf.clone();
// fork function's ret value, the new process is 0 // fork function's ret value, the new process is 0
tf.a0 = 0; tf.v0 = 0;
tf tf
}, },
}.push_at(kstack_top) }.push_at(kstack_top)
@ -227,7 +227,7 @@ impl Context {
let mut tf = tf.clone(); let mut tf = tf.clone();
tf.sp = ustack_top; // sp tf.sp = ustack_top; // sp
tf.v1 = tls; // tp tf.v1 = tls; // tp
tf.a0 = 0; // a0 tf.v0 = 0; // a0
tf tf
}, },
}.push_at(kstack_top) }.push_at(kstack_top)

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

Loading…
Cancel
Save