Stage1 clear! All applications work but now they are based on threads.

This commit is contained in:
Yifan Wu 2021-09-30 14:36:33 -07:00
parent ad0a7bcaa1
commit 4fa4e9cab4
8 changed files with 21 additions and 22 deletions

View file

@ -47,7 +47,6 @@ pub fn enable_timer_interrupt() {
#[no_mangle]
pub fn trap_handler() -> ! {
println!("into trap!");
set_kernel_trap_entry();
let scause = scause::read();
let stval = stval::read();
@ -55,7 +54,6 @@ pub fn trap_handler() -> ! {
Trap::Exception(Exception::UserEnvCall) => {
// jump to next instruction anyway
let mut cx = current_trap_cx();
println!("syscall #{}", cx.x[17]);
cx.sepc += 4;
// get system call return value
let result = syscall(cx.x[17], [cx.x[10], cx.x[11], cx.x[12]]);
@ -96,11 +94,9 @@ pub fn trap_handler() -> ! {
#[no_mangle]
pub fn trap_return() -> ! {
println!("into trap_return!");
set_user_trap_entry();
let trap_cx_user_va = current_trap_cx_user_va();
let user_satp = current_user_token();
println!("trap_cx = {:#x}, user_satp = {:#x}", trap_cx_user_va, user_satp);
extern "C" {
fn __alltraps();
fn __restore();