diff --git a/kernel/Cargo.lock b/kernel/Cargo.lock index a4eacbc..7ca71d5 100644 --- a/kernel/Cargo.lock +++ b/kernel/Cargo.lock @@ -393,9 +393,9 @@ dependencies = [ "riscv 0.5.0 (git+https://github.com/rcore-os/riscv)", "smoltcp 0.5.0 (git+https://github.com/rcore-os/smoltcp)", "spin 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", - "uart_16550 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "uart_16550 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "volatile 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", - "x86_64 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", + "x86_64 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)", "xmas-elf 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -555,11 +555,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "uart_16550" -version = "0.1.0" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)", - "x86_64 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", + "x86_64 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -615,18 +615,6 @@ dependencies = [ "raw-cpuid 6.1.0 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "x86_64" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -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)", - "os_bootinfo 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "usize_conversions 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", - "ux 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "x86_64" version = "0.3.6" @@ -642,7 +630,7 @@ dependencies = [ [[package]] name = "x86_64" -version = "0.5.3" +version = "0.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "array-init 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)", @@ -734,7 +722,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum tempdir 0.3.7 (registry+https://github.com/rust-lang/crates.io-index)" = "15f2b5fb00ccdf689e0149d1b1b3c03fead81c2b37735d812fa8bddbbf41b6d8" "checksum tock-registers 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3a385d94f3f62e60445a0adb9ff8d9621faa272234530d4c0f848ec98f88e316" "checksum typenum 1.10.0 (registry+https://github.com/rust-lang/crates.io-index)" = "612d636f949607bdf9b123b4a6f6d966dedf3ff669f7f045890d3a4a73948169" -"checksum uart_16550 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "269f953d8de3226f7c065c589c7b4a3e83d10a419c7c3b5e2e0f197e6acc966e" +"checksum uart_16550 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "5b9392f60931fe3bf8f24e0a15ee4f51528770f1d64c48768ab66571334d95b0" "checksum unicode-width 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "882386231c45df4700b275c7ff55b6f3698780a650026380e72dabe76fa46526" "checksum unicode-xid 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "fc72304796d0818e357ead4e000d19c9c174ab23dc11093ac919054d20a6a7fc" "checksum usize_conversions 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f70329e2cbe45d6c97a5112daad40c34cd9a4e18edb5a2a18fefeb584d8d25e5" @@ -744,8 +732,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum winapi-i686-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" "checksum winapi-x86_64-pc-windows-gnu 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" "checksum x86 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)" = "841e1ca5a87068718a2a26f2473c6f93cf3b8119f9778fa0ae4b39b664d9e66a" -"checksum x86_64 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "2bd647af1614659e1febec1d681231aea4ebda4818bf55a578aff02f3e4db4b4" "checksum x86_64 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "f9258d7e2dd25008d69e8c9e9ee37865887a5e1e3d06a62f1cb3f6c209e6f177" -"checksum x86_64 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8f7e92e985f4052118fd69f2b366c67e91288c0f01f4ae52610dce236425dfa0" +"checksum x86_64 0.5.4 (registry+https://github.com/rust-lang/crates.io-index)" = "1d0a8201f52d2c7b373c7243dcdfb27c0dd5012f221ef6a126f507ee82005204" "checksum xmas-elf 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "22678df5df766e8d1e5d609da69f0c3132d794edf6ab5e75e7abcd2270d4cf58" "checksum zero 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "5f1bc8a6b2005884962297587045002d8cfb8dcec9db332f4ca216ddc5de82c5" diff --git a/kernel/Cargo.toml b/kernel/Cargo.toml index a0de505..a226293 100644 --- a/kernel/Cargo.toml +++ b/kernel/Cargo.toml @@ -70,7 +70,7 @@ bootloader = { git = "https://github.com/rcore-os/bootloader" } apic = { git = "https://github.com/rcore-os/apic-rs" } x86_64 = "0.5" raw-cpuid = "6.0" -uart_16550 = "0.1" +uart_16550 = "0.2" pc-keyboard = "0.5" [target.'cfg(any(target_arch = "riscv32", target_arch = "riscv64"))'.dependencies] diff --git a/kernel/src/arch/x86_64/driver/serial.rs b/kernel/src/arch/x86_64/driver/serial.rs index ce84af5..68655e2 100644 --- a/kernel/src/arch/x86_64/driver/serial.rs +++ b/kernel/src/arch/x86_64/driver/serial.rs @@ -1,5 +1,3 @@ -// Copy from Redox - use once::*; use spin::Mutex; use uart_16550::SerialPort; @@ -7,8 +5,8 @@ use x86_64::instructions::port::Port; use crate::arch::interrupt::{consts, enable_irq}; -pub static COM1: Mutex = Mutex::new(SerialPort::new(0x3F8)); -pub static COM2: Mutex = Mutex::new(SerialPort::new(0x2F8)); +pub static COM1: Mutex = Mutex::new(unsafe { SerialPort::new(0x3F8) }); +pub static COM2: Mutex = Mutex::new(unsafe { SerialPort::new(0x2F8) }); pub fn init() { assert_has_not_been_called!("serial::init must be called only once"); @@ -27,7 +25,6 @@ impl SerialRead for SerialPort { fn receive(&mut self) -> u8 { unsafe { let ports = self as *mut _ as *mut [Port; 6]; - let _line_sts = &(*ports)[5]; let data = &(*ports)[0]; data.read() } diff --git a/kernel/src/arch/x86_64/driver/vga.rs b/kernel/src/arch/x86_64/driver/vga.rs index 7055661..41f6b9f 100644 --- a/kernel/src/arch/x86_64/driver/vga.rs +++ b/kernel/src/arch/x86_64/driver/vga.rs @@ -206,11 +206,11 @@ impl AsciiConsole for VgaWriter { CSI::CursorMove(dx, dy) => { let x = (self.pos.row.0 as i8 + dx).max(0) as u8; let y = (self.pos.col.0 as i8 + dy).max(0) as u8; - self.set_pos(Position::new(Row(x), Col(y))); + self.set_pos(Position::new(Row(x), Col(y))).unwrap(); } CSI::CursorMoveLine(dx) => { let x = (self.pos.row.0 as i8 + dx).max(0) as u8; - self.set_pos(Position::new(Row(x), Col(0))); + self.set_pos(Position::new(Row(x), Col(0))).unwrap(); } _ => {} } diff --git a/kernel/src/lib.rs b/kernel/src/lib.rs index 779b75f..fa5f0a6 100644 --- a/kernel/src/lib.rs +++ b/kernel/src/lib.rs @@ -6,6 +6,7 @@ #![feature(optin_builtin_traits)] #![feature(panic_info_message)] #![feature(global_asm)] +#![deny(unused_must_use)] #![no_std] // just keep it ...