From 2140ec6bef6cf21a86850757f6f26f9f9357463d Mon Sep 17 00:00:00 2001 From: Yuhao Zhou Date: Tue, 30 Apr 2019 06:34:34 +0800 Subject: [PATCH] Add thinpad settings. --- kernel/src/arch/mipsel/board/thinpad/consts.rs | 2 +- kernel/src/arch/mipsel/interrupt.rs | 8 ++++++++ kernel/src/shell.rs | 17 ++++++++++++++++- 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/kernel/src/arch/mipsel/board/thinpad/consts.rs b/kernel/src/arch/mipsel/board/thinpad/consts.rs index b59309a8..db1971f7 100644 --- a/kernel/src/arch/mipsel/board/thinpad/consts.rs +++ b/kernel/src/arch/mipsel/board/thinpad/consts.rs @@ -1,3 +1,3 @@ /// board specific constants pub const MEMORY_END: usize = 0x8080_0000; -pub const KERNEL_HEAP_SIZE: usize = 0x0020_0000; +pub const KERNEL_HEAP_SIZE: usize = 0x0038_0000; diff --git a/kernel/src/arch/mipsel/interrupt.rs b/kernel/src/arch/mipsel/interrupt.rs index 56757c43..60abde3a 100644 --- a/kernel/src/arch/mipsel/interrupt.rs +++ b/kernel/src/arch/mipsel/interrupt.rs @@ -29,6 +29,9 @@ pub fn init() { status.enable_soft_int1(); // Enable clock interrupt status.enable_hard_int5(); + // Enable serial interrupt + #[cfg(feature = "board_thinpad")] + status.enable_hard_int0(); cp0::status::write(status); } @@ -209,6 +212,11 @@ fn reserved_inst(tf: &mut TrapFrame) -> bool { let sel = (inst >> 6) & 0b111; let format = inst & 0b111111; + if inst == 0x42000020 { + // ignore WAIT + return true; + } + if opcode == 0b011111 && format == 0b111011 { // RDHWR if rd == 29 && sel == 0 { diff --git a/kernel/src/shell.rs b/kernel/src/shell.rs index 000ad633..74b63305 100644 --- a/kernel/src/shell.rs +++ b/kernel/src/shell.rs @@ -6,7 +6,7 @@ use crate::process::*; use alloc::string::String; use alloc::vec::Vec; -#[cfg(not(feature = "run_cmdline"))] +#[cfg(not(any(feature = "run_cmdline", feature = "board_thinpad")))] pub fn run_user_shell() { if let Ok(inode) = ROOT_INODE.lookup("busybox") { let data = inode.read_as_vec().unwrap(); @@ -21,6 +21,21 @@ pub fn run_user_shell() { } } +#[cfg(feature = "board_thinpad")] +pub fn run_user_shell() { + if let Ok(inode) = ROOT_INODE.lookup("sh") { + let data = inode.read_as_vec().unwrap(); + processor().manager().add(Thread::new_user( + data.as_slice(), + "sh", + vec!["sh".into()], + Vec::new(), + )); + } else { + processor().manager().add(Thread::new_kernel(shell, 0)); + } +} + #[cfg(feature = "run_cmdline")] pub fn run_user_shell() { let cmdline = CMDLINE.read();