diff --git a/kernel/Cargo.lock b/kernel/Cargo.lock index 942a0a9..15929e7 100644 --- a/kernel/Cargo.lock +++ b/kernel/Cargo.lock @@ -230,7 +230,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "mips" version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" +source = "git+https://github.com/Harry-Chen/rust-mips#8b8cbacb08aaaef93837d46599ce21759ef481de" +dependencies = [ + "bit_field 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", + "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", +] [[package]] name = "nodrop" @@ -322,7 +326,7 @@ dependencies = [ "isomorphic_drivers 0.1.0 (git+https://github.com/rcore-os/isomorphic_drivers)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", - "mips 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "mips 0.1.0 (git+https://github.com/Harry-Chen/rust-mips)", "once 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)", "pc-keyboard 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "pci 0.0.1 (git+https://github.com/rcore-os/pci-rs)", @@ -622,7 +626,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "e19e8d5c34a3e0e2223db8e060f9e8264aeeb5c5fc64a4ee9965c062211c024b" "checksum log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c84ec4b527950aa83a329754b01dbe3f58361d1c5efacd1f6d68c494d08a17c6" "checksum managed 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "fdcec5e97041c7f0f1c5b7d93f12e57293c831c646f4cc7a5db59460c7ea8de6" -"checksum mips 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f79c54c0ff7e933ffe5b3ec7c3c05037b654c334b0c98e66536d2d8906435394" +"checksum mips 0.1.0 (git+https://github.com/Harry-Chen/rust-mips)" = "" "checksum nodrop 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "2f9667ddcc6cc8a43afc9b7917599d7216aa09c463919ea32c59ed6cac8bc945" "checksum once 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "931fb7a4cf34610cf6cbe58d52a8ca5ef4c726d4e2e178abd0dc13a6551c6d73" "checksum os_bootinfo 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "66481dbeb5e773e7bd85b63cd6042c30786f834338288c5ec4f3742673db360a" diff --git a/kernel/Cargo.toml b/kernel/Cargo.toml index 4e7758c..2ce9880 100644 --- a/kernel/Cargo.toml +++ b/kernel/Cargo.toml @@ -27,9 +27,9 @@ nographic = [] board_raspi3 = ["bcm2837", "link_user"] raspi3_use_generic_timer = ["bcm2837/use_generic_timer"] # for mipsel qemu malta machine -board_malta = [] +board_malta = ["link_user"] # for thinpad -board_thinpad = [] +board_thinpad = ["link_user"] # Hard link user program link_user = [] # Run cmdline instead of user shell, useful for automatic testing @@ -77,7 +77,7 @@ aarch64 = { git = "https://github.com/rcore-os/aarch64" } bcm2837 = { git = "https://github.com/rcore-os/bcm2837", optional = true } [target.'cfg(target_arch = "mips")'.dependencies] -mips = "^0.1.0" +mips = { git = "https://github.com/Harry-Chen/rust-mips" } [package.metadata.bootimage] default-target = "targets/x86_64.json" diff --git a/kernel/src/arch/mipsel/board/malta/fb.rs b/kernel/src/arch/mipsel/board/malta/fb.rs deleted file mode 100644 index f466bfa..0000000 --- a/kernel/src/arch/mipsel/board/malta/fb.rs +++ /dev/null @@ -1,13 +0,0 @@ -//! stub frame buffer driver for malta board - -use spin::Mutex; - -lazy_static! { - pub static ref FRAME_BUFFER: Mutex> = Mutex::new(None); -} - -pub struct Framebuffer {} - -pub struct FramebufferInfo {} - -pub enum ColorDepth {} \ No newline at end of file diff --git a/kernel/src/arch/mipsel/board/malta/mod.rs b/kernel/src/arch/mipsel/board/malta/mod.rs index 0a3f750..f5f892a 100644 --- a/kernel/src/arch/mipsel/board/malta/mod.rs +++ b/kernel/src/arch/mipsel/board/malta/mod.rs @@ -1,6 +1,8 @@ use once::*; +use alloc::string::String; pub mod serial; +#[path = "../../../../drivers/gpu/fb.rs"] pub mod fb; #[path = "../../../../drivers/console/mod.rs"] pub mod console; @@ -16,4 +18,8 @@ pub fn init_serial_early() { pub fn init_driver() { // TODO: add possibly more drivers // timer::init(); +} + +pub fn probe_fb_info(width: u32, height: u32, depth: u32) -> Result<(fb::FramebufferInfo, usize), String> { + Err(String::from("Framebuffer not usable on malta board")) } \ No newline at end of file diff --git a/kernel/src/arch/mipsel/board/malta/serial.rs b/kernel/src/arch/mipsel/board/malta/serial.rs index b9b7fe0..5e9a638 100644 --- a/kernel/src/arch/mipsel/board/malta/serial.rs +++ b/kernel/src/arch/mipsel/board/malta/serial.rs @@ -34,7 +34,7 @@ impl SerialPort { } /// non-blocking version of putchar() - fn putchar(&mut self, c: u8) { + pub fn putchar(&mut self, c: u8) { write(self.base + COM_TX, c); } @@ -88,7 +88,7 @@ fn write(addr: usize, content: T) { fn read(addr: usize) -> T { let cell = (addr) as *const T; - read_volatile(cell); + read_volatile(cell) } diff --git a/kernel/src/arch/mipsel/board/thinpad/mod.rs b/kernel/src/arch/mipsel/board/thinpad/mod.rs index 6c480f4..a290559 100644 --- a/kernel/src/arch/mipsel/board/thinpad/mod.rs +++ b/kernel/src/arch/mipsel/board/thinpad/mod.rs @@ -19,7 +19,7 @@ pub fn init_driver() { // timer::init(); } -pub fn probe_fb_info(width: u32, height: u32, depth: u32) -> Result<(FramebufferInfo, u32), String> { +pub fn probe_fb_info(width: u32, height: u32, depth: u32) -> Result<(FramebufferInfo, usize), String> { let fb_info = FramebufferInfo { xres: 800, yres: 600, diff --git a/kernel/src/arch/mipsel/mod.rs b/kernel/src/arch/mipsel/mod.rs index e8c3fe0..c3f4692 100644 --- a/kernel/src/arch/mipsel/mod.rs +++ b/kernel/src/arch/mipsel/mod.rs @@ -72,7 +72,7 @@ fn others_main() -> ! { crate::kmain(); } -const BOOT_CPU_ID: usize = 0; +const BOOT_CPU_ID: u32 = 0; global_asm!(include_str!("boot/entry.S")); global_asm!(include_str!("boot/trap.S"));