From 6e925289cf029ee71da3bfb6db3a8cb78fa20a5f Mon Sep 17 00:00:00 2001 From: Philipp Schuster Date: Sun, 14 Jun 2026 21:42:11 +0200 Subject: [PATCH 1/2] deps: bump uart_16550 to 0.6.0 --- Cargo.lock | 92 ++++++------------- Cargo.toml | 1 + common/Cargo.toml | 2 +- common/src/serial.rs | 15 ++- examples/basic/Cargo.lock | 26 +----- examples/basic/kernel/Cargo.toml | 2 +- examples/basic/kernel/src/main.rs | 9 +- examples/basic/src/main.rs | 6 +- tests/test_kernels/Cargo.lock | 54 ++++------- tests/test_kernels/config_file/Cargo.toml | 2 +- tests/test_kernels/config_file/src/lib.rs | 10 +- .../test_kernels/default_settings/Cargo.toml | 2 +- .../test_kernels/default_settings/src/lib.rs | 10 +- .../fixed_kernel_address/Cargo.toml | 2 +- .../fixed_kernel_address/src/lib.rs | 9 +- tests/test_kernels/higher_half/Cargo.toml | 2 +- tests/test_kernels/higher_half/src/lib.rs | 9 +- .../test_kernels/lower_memory_free/Cargo.toml | 2 +- .../test_kernels/lower_memory_free/src/lib.rs | 10 +- tests/test_kernels/lto/Cargo.toml | 2 +- tests/test_kernels/lto/src/lib.rs | 10 +- tests/test_kernels/map_phys_mem/Cargo.toml | 2 +- tests/test_kernels/map_phys_mem/src/lib.rs | 9 +- tests/test_kernels/min_stack/Cargo.toml | 2 +- tests/test_kernels/min_stack/src/lib.rs | 10 +- tests/test_kernels/pie/Cargo.toml | 2 +- tests/test_kernels/pie/src/lib.rs | 10 +- tests/test_kernels/ramdisk/Cargo.toml | 2 +- tests/test_kernels/ramdisk/src/lib.rs | 10 +- tests/test_kernels/stack_address/Cargo.toml | 2 +- tests/test_kernels/stack_address/src/lib.rs | 9 +- .../write_usable_memory/Cargo.toml | 2 +- .../write_usable_memory/src/lib.rs | 10 +- 33 files changed, 148 insertions(+), 199 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index bcb31226..435c2ba9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -138,7 +138,7 @@ dependencies = [ "rsdp", "serde-json-core", "usize_conversions", - "x86_64 0.15.2", + "x86_64", ] [[package]] @@ -154,9 +154,9 @@ dependencies = [ "rand_hc", "raw-cpuid", "spinning_top", - "uart_16550 0.3.2", + "uart_16550", "usize_conversions", - "x86_64 0.15.2", + "x86_64", "xmas-elf", ] @@ -170,7 +170,7 @@ dependencies = [ "log", "serde-json-core", "uefi", - "x86_64 0.15.2", + "x86_64", ] [[package]] @@ -780,8 +780,8 @@ name = "test_kernel_config_file" version = "0.1.0" dependencies = [ "bootloader_api", - "uart_16550 0.2.18", - "x86_64 0.15.2", + "uart_16550", + "x86_64", ] [[package]] @@ -789,8 +789,8 @@ name = "test_kernel_default_settings" version = "0.1.0" dependencies = [ "bootloader_api", - "uart_16550 0.2.18", - "x86_64 0.15.2", + "uart_16550", + "x86_64", ] [[package]] @@ -798,8 +798,8 @@ name = "test_kernel_fixed_kernel_address" version = "0.1.0" dependencies = [ "bootloader_api", - "uart_16550 0.2.18", - "x86_64 0.15.2", + "uart_16550", + "x86_64", ] [[package]] @@ -807,8 +807,8 @@ name = "test_kernel_higher_half" version = "0.1.0" dependencies = [ "bootloader_api", - "uart_16550 0.2.18", - "x86_64 0.15.2", + "uart_16550", + "x86_64", ] [[package]] @@ -816,8 +816,8 @@ name = "test_kernel_lower_memory_free" version = "0.1.0" dependencies = [ "bootloader_api", - "uart_16550 0.2.18", - "x86_64 0.15.2", + "uart_16550", + "x86_64", ] [[package]] @@ -825,8 +825,8 @@ name = "test_kernel_map_phys_mem" version = "0.1.0" dependencies = [ "bootloader_api", - "uart_16550 0.2.18", - "x86_64 0.15.2", + "uart_16550", + "x86_64", ] [[package]] @@ -834,8 +834,8 @@ name = "test_kernel_min_stack" version = "0.1.0" dependencies = [ "bootloader_api", - "uart_16550 0.2.18", - "x86_64 0.15.2", + "uart_16550", + "x86_64", ] [[package]] @@ -843,8 +843,8 @@ name = "test_kernel_pie" version = "0.1.0" dependencies = [ "bootloader_api", - "uart_16550 0.2.18", - "x86_64 0.15.2", + "uart_16550", + "x86_64", ] [[package]] @@ -852,8 +852,8 @@ name = "test_kernel_ramdisk" version = "0.1.0" dependencies = [ "bootloader_api", - "uart_16550 0.2.18", - "x86_64 0.15.2", + "uart_16550", + "x86_64", ] [[package]] @@ -861,8 +861,8 @@ name = "test_kernel_stack_address" version = "0.1.0" dependencies = [ "bootloader_api", - "uart_16550 0.2.18", - "x86_64 0.15.2", + "uart_16550", + "x86_64", ] [[package]] @@ -870,8 +870,8 @@ name = "test_kernel_write_usable_memory" version = "0.1.0" dependencies = [ "bootloader_api", - "uart_16550 0.2.18", - "x86_64 0.15.2", + "uart_16550", + "x86_64", ] [[package]] @@ -896,24 +896,11 @@ dependencies = [ [[package]] name = "uart_16550" -version = "0.2.18" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b074eb9300ad949edd74c529c0e8d451625af71bb948e6b65fe69f72dc1363d9" -dependencies = [ - "bitflags 1.3.2", - "rustversion", - "x86_64 0.14.13", -] - -[[package]] -name = "uart_16550" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e492212ac378a5e00da953718dafb1340d9fbaf4f27d6f3c5cab03d931d1c049" +checksum = "22ee77075ecbc5e1c9b1236d03ff013dd77c7bb06da181c5c44f1f39b6cf3ff2" dependencies = [ "bitflags 2.11.1", - "rustversion", - "x86", ] [[package]] @@ -1185,29 +1172,6 @@ dependencies = [ "tap", ] -[[package]] -name = "x86" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2781db97787217ad2a2845c396a5efe286f87467a5810836db6d74926e94a385" -dependencies = [ - "bit_field", - "bitflags 1.3.2", - "raw-cpuid", -] - -[[package]] -name = "x86_64" -version = "0.14.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c101112411baafbb4bf8d33e4c4a80ab5b02d74d2612331c61e8192fc9710491" -dependencies = [ - "bit_field", - "bitflags 2.11.1", - "rustversion", - "volatile", -] - [[package]] name = "x86_64" version = "0.15.2" diff --git a/Cargo.toml b/Cargo.toml index d51c3938..fa53e96b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,6 +19,7 @@ members = [ "tests/runner", ] exclude = ["examples/basic", "examples/test_framework", "tests/test_kernels/*"] +resolver = "3" [workspace.package] # don't forget to update `workspace.dependencies` below diff --git a/common/Cargo.toml b/common/Cargo.toml index a3217ca5..9018ea72 100644 --- a/common/Cargo.toml +++ b/common/Cargo.toml @@ -19,7 +19,7 @@ xmas-elf = "0.8.0" raw-cpuid = "10.2.0" rand = { version = "0.8.6", default-features = false } rand_hc = "0.3.1" -uart_16550 = "0.3.2" +uart_16550 = "0.6.0" log = "0.4.17" [dependencies.noto-sans-mono-bitmap] diff --git a/common/src/serial.rs b/common/src/serial.rs index 8435c8e1..5c950a9f 100644 --- a/common/src/serial.rs +++ b/common/src/serial.rs @@ -1,7 +1,10 @@ use core::fmt; +use uart_16550::backend::PioBackend; +// TODO this type can be replaced with Uart16550Tty but using it currently panics +// in the new constructor. pub struct SerialPort { - port: uart_16550::SerialPort, + port: uart_16550::Uart16550, } impl SerialPort { @@ -9,8 +12,10 @@ impl SerialPort { /// /// unsafe because this function must only be called once pub unsafe fn init() -> Self { - let mut port = unsafe { uart_16550::SerialPort::new(0x3F8) }; - port.init(); + let mut port = + unsafe { uart_16550::Uart16550::new_port(0x3F8) }.expect("should be valid port"); + port.init(uart_16550::Config::default()) + .expect("should init successfully"); Self { port } } } @@ -19,8 +24,8 @@ impl fmt::Write for SerialPort { fn write_str(&mut self, s: &str) -> fmt::Result { for char in s.bytes() { match char { - b'\n' => self.port.write_str("\r\n").unwrap(), - byte => self.port.send(byte), + b'\n' => self.port.send_bytes_exact(b"\r\n"), + byte => self.port.send_bytes_exact(&[byte]), } } Ok(()) diff --git a/examples/basic/Cargo.lock b/examples/basic/Cargo.lock index d7fee030..981c3240 100644 --- a/examples/basic/Cargo.lock +++ b/examples/basic/Cargo.lock @@ -516,15 +516,6 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09" -[[package]] -name = "raw-cpuid" -version = "10.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c297679cb867470fa8c9f67dbba74a78d78e3e98d7cf2b08d6d71540f797332" -dependencies = [ - "bitflags 1.3.2", -] - [[package]] name = "redox_syscall" version = "0.7.3" @@ -752,13 +743,11 @@ checksum = "562d481066bde0658276a35467c4af00bdc6ee726305698a55b86e61d7ad82bb" [[package]] name = "uart_16550" -version = "0.4.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94d293f51425981fdb1b766beae254dbb711a17e8c4b549dc69b9b7ee0d478d5" +checksum = "22ee77075ecbc5e1c9b1236d03ff013dd77c7bb06da181c5c44f1f39b6cf3ff2" dependencies = [ "bitflags 2.11.0", - "rustversion", - "x86", ] [[package]] @@ -1118,17 +1107,6 @@ dependencies = [ "tap", ] -[[package]] -name = "x86" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2781db97787217ad2a2845c396a5efe286f87467a5810836db6d74926e94a385" -dependencies = [ - "bit_field", - "bitflags 1.3.2", - "raw-cpuid", -] - [[package]] name = "x86_64" version = "0.15.4" diff --git a/examples/basic/kernel/Cargo.toml b/examples/basic/kernel/Cargo.toml index 5672bb7a..d2d53a5b 100644 --- a/examples/basic/kernel/Cargo.toml +++ b/examples/basic/kernel/Cargo.toml @@ -5,5 +5,5 @@ edition = "2024" [dependencies] bootloader_api = "0.11.12" -uart_16550 = "0.4.0" +uart_16550 = "0.6.0" x86_64 = "0.15.2" diff --git a/examples/basic/kernel/src/main.rs b/examples/basic/kernel/src/main.rs index df1eb848..29dc7d62 100644 --- a/examples/basic/kernel/src/main.rs +++ b/examples/basic/kernel/src/main.rs @@ -3,6 +3,8 @@ use bootloader_api::{BootInfo, entry_point}; use core::fmt::Write; +use uart_16550::backend::PioBackend; +use uart_16550::{Config, Uart16550Tty}; #[derive(Debug, Clone, Copy, PartialEq, Eq)] #[repr(u32)] @@ -24,10 +26,9 @@ pub fn exit_qemu(exit_code: QemuExitCode) -> ! { } } -pub fn serial() -> uart_16550::SerialPort { - let mut port = unsafe { uart_16550::SerialPort::new(0x3F8) }; - port.init(); - port +pub fn serial() -> Uart16550Tty { + unsafe { Uart16550Tty::new_port(0x3F8, Config::default()) } + .expect("should initialize serial device from valid config and valid port") } entry_point!(kernel_main); diff --git a/examples/basic/src/main.rs b/examples/basic/src/main.rs index 4ef3713d..65684c8a 100644 --- a/examples/basic/src/main.rs +++ b/examples/basic/src/main.rs @@ -62,8 +62,8 @@ fn main() { let mut child = cmd.spawn().expect("failed to start qemu-system-x86_64"); let status = child.wait().expect("failed to wait on qemu"); match status.code().unwrap_or(1) { - 0x10 => 0, // success - 0x11 => 1, // failure - _ => 2, // unknown fault + 0x10 => 0, // success + 0x11 => 1, // failure + _ => 2, // unknown fault }; } diff --git a/tests/test_kernels/Cargo.lock b/tests/test_kernels/Cargo.lock index 06e534c4..209b5fd7 100644 --- a/tests/test_kernels/Cargo.lock +++ b/tests/test_kernels/Cargo.lock @@ -10,15 +10,9 @@ checksum = "dc827186963e592360843fb5ba4b973e145841266c1357f7180c43526f2e5b61" [[package]] name = "bitflags" -version = "1.3.2" +version = "2.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" - -[[package]] -name = "bitflags" -version = "2.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f68f53c83ab957f72c32642f3868eec03eb974d1fb82e453128456482613d36" +checksum = "b4388bee8683e3d04af747c73422af53102d2bd24d9eadb6cbc100baef4b43f8" [[package]] name = "bootloader_api" @@ -36,7 +30,7 @@ version = "0.1.0" dependencies = [ "bootloader_api", "uart_16550", - "x86_64 0.15.2", + "x86_64", ] [[package]] @@ -45,7 +39,7 @@ version = "0.1.0" dependencies = [ "bootloader_api", "uart_16550", - "x86_64 0.15.2", + "x86_64", ] [[package]] @@ -54,7 +48,7 @@ version = "0.1.0" dependencies = [ "bootloader_api", "uart_16550", - "x86_64 0.15.2", + "x86_64", ] [[package]] @@ -63,7 +57,7 @@ version = "0.1.0" dependencies = [ "bootloader_api", "uart_16550", - "x86_64 0.15.2", + "x86_64", ] [[package]] @@ -72,7 +66,7 @@ version = "0.1.0" dependencies = [ "bootloader_api", "uart_16550", - "x86_64 0.15.2", + "x86_64", ] [[package]] @@ -81,7 +75,7 @@ version = "0.1.0" dependencies = [ "bootloader_api", "uart_16550", - "x86_64 0.15.2", + "x86_64", ] [[package]] @@ -90,7 +84,7 @@ version = "0.1.0" dependencies = [ "bootloader_api", "uart_16550", - "x86_64 0.15.2", + "x86_64", ] [[package]] @@ -99,7 +93,7 @@ version = "0.1.0" dependencies = [ "bootloader_api", "uart_16550", - "x86_64 0.15.2", + "x86_64", ] [[package]] @@ -108,7 +102,7 @@ version = "0.1.0" dependencies = [ "bootloader_api", "uart_16550", - "x86_64 0.15.2", + "x86_64", ] [[package]] @@ -117,7 +111,7 @@ version = "0.1.0" dependencies = [ "bootloader_api", "uart_16550", - "x86_64 0.15.2", + "x86_64", ] [[package]] @@ -126,18 +120,16 @@ version = "0.1.0" dependencies = [ "bootloader_api", "uart_16550", - "x86_64 0.15.2", + "x86_64", ] [[package]] name = "uart_16550" -version = "0.2.19" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "614ff2a87880d4bd4374722268598a970bbad05ced8bf630439417347254ab2e" +checksum = "22ee77075ecbc5e1c9b1236d03ff013dd77c7bb06da181c5c44f1f39b6cf3ff2" dependencies = [ - "bitflags 1.3.2", - "rustversion", - "x86_64 0.14.13", + "bitflags", ] [[package]] @@ -146,18 +138,6 @@ version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "442887c63f2c839b346c192d047a7c87e73d0689c9157b00b53dcc27dd5ea793" -[[package]] -name = "x86_64" -version = "0.14.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c101112411baafbb4bf8d33e4c4a80ab5b02d74d2612331c61e8192fc9710491" -dependencies = [ - "bit_field", - "bitflags 2.8.0", - "rustversion", - "volatile", -] - [[package]] name = "x86_64" version = "0.15.2" @@ -165,7 +145,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0f042214de98141e9c8706e8192b73f56494087cc55ebec28ce10f26c5c364ae" dependencies = [ "bit_field", - "bitflags 2.8.0", + "bitflags", "rustversion", "volatile", ] diff --git a/tests/test_kernels/config_file/Cargo.toml b/tests/test_kernels/config_file/Cargo.toml index 57cc20eb..1cbe41d9 100644 --- a/tests/test_kernels/config_file/Cargo.toml +++ b/tests/test_kernels/config_file/Cargo.toml @@ -9,4 +9,4 @@ bootloader_api = { path = "../../../api" } x86_64 = { version = "0.15.2", default-features = false, features = [ "instructions", ] } -uart_16550 = "0.2.10" +uart_16550 = "0.6.0" diff --git a/tests/test_kernels/config_file/src/lib.rs b/tests/test_kernels/config_file/src/lib.rs index 4e46fdb6..c1536470 100644 --- a/tests/test_kernels/config_file/src/lib.rs +++ b/tests/test_kernels/config_file/src/lib.rs @@ -1,5 +1,8 @@ #![no_std] +use uart_16550::backend::PioBackend; +use uart_16550::{Config, Uart16550Tty}; + #[derive(Debug, Clone, Copy, PartialEq, Eq)] #[repr(u32)] pub enum QemuExitCode { @@ -20,8 +23,7 @@ pub fn exit_qemu(exit_code: QemuExitCode) -> ! { } } -pub fn serial() -> uart_16550::SerialPort { - let mut port = unsafe { uart_16550::SerialPort::new(0x3F8) }; - port.init(); - port +pub fn serial() -> Uart16550Tty { + unsafe { Uart16550Tty::new_port(0x3F8, Config::default()) } + .expect("should initialize serial device from valid config and valid port") } diff --git a/tests/test_kernels/default_settings/Cargo.toml b/tests/test_kernels/default_settings/Cargo.toml index 276ff900..d78fa605 100644 --- a/tests/test_kernels/default_settings/Cargo.toml +++ b/tests/test_kernels/default_settings/Cargo.toml @@ -9,4 +9,4 @@ bootloader_api = { path = "../../../api" } x86_64 = { version = "0.15.2", default-features = false, features = [ "instructions", ] } -uart_16550 = "0.2.10" +uart_16550 = "0.6.0" diff --git a/tests/test_kernels/default_settings/src/lib.rs b/tests/test_kernels/default_settings/src/lib.rs index 4e46fdb6..c1536470 100644 --- a/tests/test_kernels/default_settings/src/lib.rs +++ b/tests/test_kernels/default_settings/src/lib.rs @@ -1,5 +1,8 @@ #![no_std] +use uart_16550::backend::PioBackend; +use uart_16550::{Config, Uart16550Tty}; + #[derive(Debug, Clone, Copy, PartialEq, Eq)] #[repr(u32)] pub enum QemuExitCode { @@ -20,8 +23,7 @@ pub fn exit_qemu(exit_code: QemuExitCode) -> ! { } } -pub fn serial() -> uart_16550::SerialPort { - let mut port = unsafe { uart_16550::SerialPort::new(0x3F8) }; - port.init(); - port +pub fn serial() -> Uart16550Tty { + unsafe { Uart16550Tty::new_port(0x3F8, Config::default()) } + .expect("should initialize serial device from valid config and valid port") } diff --git a/tests/test_kernels/fixed_kernel_address/Cargo.toml b/tests/test_kernels/fixed_kernel_address/Cargo.toml index 4d8a872c..ab28d7a3 100644 --- a/tests/test_kernels/fixed_kernel_address/Cargo.toml +++ b/tests/test_kernels/fixed_kernel_address/Cargo.toml @@ -8,4 +8,4 @@ bootloader_api = { path = "../../../api" } x86_64 = { version = "0.15.2", default-features = false, features = [ "instructions", ] } -uart_16550 = "0.2.10" +uart_16550 = "0.6.0" diff --git a/tests/test_kernels/fixed_kernel_address/src/lib.rs b/tests/test_kernels/fixed_kernel_address/src/lib.rs index 9a8212e2..b9e342e8 100644 --- a/tests/test_kernels/fixed_kernel_address/src/lib.rs +++ b/tests/test_kernels/fixed_kernel_address/src/lib.rs @@ -1,6 +1,8 @@ #![no_std] use bootloader_api::{BootloaderConfig, config::Mapping}; +use uart_16550::backend::PioBackend; +use uart_16550::{Config, Uart16550Tty}; pub const KERNEL_ADDR: u64 = 0x1987_6543_0000; @@ -30,8 +32,7 @@ pub fn exit_qemu(exit_code: QemuExitCode) -> ! { } } -pub fn serial() -> uart_16550::SerialPort { - let mut port = unsafe { uart_16550::SerialPort::new(0x3F8) }; - port.init(); - port +pub fn serial() -> Uart16550Tty { + unsafe { Uart16550Tty::new_port(0x3F8, Config::default()) } + .expect("should initialize serial device from valid config and valid port") } diff --git a/tests/test_kernels/higher_half/Cargo.toml b/tests/test_kernels/higher_half/Cargo.toml index c215c8b3..16720551 100644 --- a/tests/test_kernels/higher_half/Cargo.toml +++ b/tests/test_kernels/higher_half/Cargo.toml @@ -11,6 +11,6 @@ bootloader_api = { path = "../../../api" } x86_64 = { version = "0.15.2", default-features = false, features = [ "instructions", ] } -uart_16550 = "0.2.10" +uart_16550 = "0.6.0" # set to higher half through profile.test.rustflags key in top-level Cargo.toml diff --git a/tests/test_kernels/higher_half/src/lib.rs b/tests/test_kernels/higher_half/src/lib.rs index 99ae71dc..47636f04 100644 --- a/tests/test_kernels/higher_half/src/lib.rs +++ b/tests/test_kernels/higher_half/src/lib.rs @@ -1,6 +1,8 @@ #![no_std] use bootloader_api::BootloaderConfig; +use uart_16550::backend::PioBackend; +use uart_16550::{Config, Uart16550Tty}; pub const BOOTLOADER_CONFIG: BootloaderConfig = { let mut config = BootloaderConfig::new_default(); @@ -28,8 +30,7 @@ pub fn exit_qemu(exit_code: QemuExitCode) -> ! { } } -pub fn serial() -> uart_16550::SerialPort { - let mut port = unsafe { uart_16550::SerialPort::new(0x3F8) }; - port.init(); - port +pub fn serial() -> Uart16550Tty { + unsafe { Uart16550Tty::new_port(0x3F8, Config::default()) } + .expect("should initialize serial device from valid config and valid port") } diff --git a/tests/test_kernels/lower_memory_free/Cargo.toml b/tests/test_kernels/lower_memory_free/Cargo.toml index 643c33fe..1f51ef8e 100644 --- a/tests/test_kernels/lower_memory_free/Cargo.toml +++ b/tests/test_kernels/lower_memory_free/Cargo.toml @@ -8,4 +8,4 @@ bootloader_api = { path = "../../../api" } x86_64 = { version = "0.15.2", default-features = false, features = [ "instructions", ] } -uart_16550 = "0.2.10" +uart_16550 = "0.6.0" diff --git a/tests/test_kernels/lower_memory_free/src/lib.rs b/tests/test_kernels/lower_memory_free/src/lib.rs index 4e46fdb6..c1536470 100644 --- a/tests/test_kernels/lower_memory_free/src/lib.rs +++ b/tests/test_kernels/lower_memory_free/src/lib.rs @@ -1,5 +1,8 @@ #![no_std] +use uart_16550::backend::PioBackend; +use uart_16550::{Config, Uart16550Tty}; + #[derive(Debug, Clone, Copy, PartialEq, Eq)] #[repr(u32)] pub enum QemuExitCode { @@ -20,8 +23,7 @@ pub fn exit_qemu(exit_code: QemuExitCode) -> ! { } } -pub fn serial() -> uart_16550::SerialPort { - let mut port = unsafe { uart_16550::SerialPort::new(0x3F8) }; - port.init(); - port +pub fn serial() -> Uart16550Tty { + unsafe { Uart16550Tty::new_port(0x3F8, Config::default()) } + .expect("should initialize serial device from valid config and valid port") } diff --git a/tests/test_kernels/lto/Cargo.toml b/tests/test_kernels/lto/Cargo.toml index 0f8e4e3c..8cd8d2cb 100644 --- a/tests/test_kernels/lto/Cargo.toml +++ b/tests/test_kernels/lto/Cargo.toml @@ -9,4 +9,4 @@ bootloader_api = { path = "../../../api" } x86_64 = { version = "0.15.2", default-features = false, features = [ "instructions", ] } -uart_16550 = "0.2.10" +uart_16550 = "0.6.0" diff --git a/tests/test_kernels/lto/src/lib.rs b/tests/test_kernels/lto/src/lib.rs index 4e46fdb6..c1536470 100644 --- a/tests/test_kernels/lto/src/lib.rs +++ b/tests/test_kernels/lto/src/lib.rs @@ -1,5 +1,8 @@ #![no_std] +use uart_16550::backend::PioBackend; +use uart_16550::{Config, Uart16550Tty}; + #[derive(Debug, Clone, Copy, PartialEq, Eq)] #[repr(u32)] pub enum QemuExitCode { @@ -20,8 +23,7 @@ pub fn exit_qemu(exit_code: QemuExitCode) -> ! { } } -pub fn serial() -> uart_16550::SerialPort { - let mut port = unsafe { uart_16550::SerialPort::new(0x3F8) }; - port.init(); - port +pub fn serial() -> Uart16550Tty { + unsafe { Uart16550Tty::new_port(0x3F8, Config::default()) } + .expect("should initialize serial device from valid config and valid port") } diff --git a/tests/test_kernels/map_phys_mem/Cargo.toml b/tests/test_kernels/map_phys_mem/Cargo.toml index 7850d9f3..fcb3d83b 100644 --- a/tests/test_kernels/map_phys_mem/Cargo.toml +++ b/tests/test_kernels/map_phys_mem/Cargo.toml @@ -9,4 +9,4 @@ bootloader_api = { path = "../../../api" } x86_64 = { version = "0.15.2", default-features = false, features = [ "instructions", ] } -uart_16550 = "0.2.10" +uart_16550 = "0.6.0" diff --git a/tests/test_kernels/map_phys_mem/src/lib.rs b/tests/test_kernels/map_phys_mem/src/lib.rs index 86301304..5b8ba446 100644 --- a/tests/test_kernels/map_phys_mem/src/lib.rs +++ b/tests/test_kernels/map_phys_mem/src/lib.rs @@ -1,6 +1,8 @@ #![no_std] use bootloader_api::{BootloaderConfig, config::Mapping}; +use uart_16550::backend::PioBackend; +use uart_16550::{Config, Uart16550Tty}; pub const BOOTLOADER_CONFIG: BootloaderConfig = { let mut config = BootloaderConfig::new_default(); @@ -28,8 +30,7 @@ pub fn exit_qemu(exit_code: QemuExitCode) -> ! { } } -pub fn serial() -> uart_16550::SerialPort { - let mut port = unsafe { uart_16550::SerialPort::new(0x3F8) }; - port.init(); - port +pub fn serial() -> Uart16550Tty { + unsafe { Uart16550Tty::new_port(0x3F8, Config::default()) } + .expect("should initialize serial device from valid config and valid port") } diff --git a/tests/test_kernels/min_stack/Cargo.toml b/tests/test_kernels/min_stack/Cargo.toml index b2864ee8..6e59ef40 100644 --- a/tests/test_kernels/min_stack/Cargo.toml +++ b/tests/test_kernels/min_stack/Cargo.toml @@ -9,4 +9,4 @@ bootloader_api = { path = "../../../api" } x86_64 = { version = "0.15.2", default-features = false, features = [ "instructions", ] } -uart_16550 = "0.2.10" +uart_16550 = "0.6.0" diff --git a/tests/test_kernels/min_stack/src/lib.rs b/tests/test_kernels/min_stack/src/lib.rs index 4e46fdb6..c1536470 100644 --- a/tests/test_kernels/min_stack/src/lib.rs +++ b/tests/test_kernels/min_stack/src/lib.rs @@ -1,5 +1,8 @@ #![no_std] +use uart_16550::backend::PioBackend; +use uart_16550::{Config, Uart16550Tty}; + #[derive(Debug, Clone, Copy, PartialEq, Eq)] #[repr(u32)] pub enum QemuExitCode { @@ -20,8 +23,7 @@ pub fn exit_qemu(exit_code: QemuExitCode) -> ! { } } -pub fn serial() -> uart_16550::SerialPort { - let mut port = unsafe { uart_16550::SerialPort::new(0x3F8) }; - port.init(); - port +pub fn serial() -> Uart16550Tty { + unsafe { Uart16550Tty::new_port(0x3F8, Config::default()) } + .expect("should initialize serial device from valid config and valid port") } diff --git a/tests/test_kernels/pie/Cargo.toml b/tests/test_kernels/pie/Cargo.toml index 93f71abd..40e18bab 100644 --- a/tests/test_kernels/pie/Cargo.toml +++ b/tests/test_kernels/pie/Cargo.toml @@ -9,4 +9,4 @@ bootloader_api = { path = "../../../api" } x86_64 = { version = "0.15.2", default-features = false, features = [ "instructions", ] } -uart_16550 = "0.2.10" +uart_16550 = "0.6.0" diff --git a/tests/test_kernels/pie/src/lib.rs b/tests/test_kernels/pie/src/lib.rs index 4e46fdb6..c1536470 100644 --- a/tests/test_kernels/pie/src/lib.rs +++ b/tests/test_kernels/pie/src/lib.rs @@ -1,5 +1,8 @@ #![no_std] +use uart_16550::backend::PioBackend; +use uart_16550::{Config, Uart16550Tty}; + #[derive(Debug, Clone, Copy, PartialEq, Eq)] #[repr(u32)] pub enum QemuExitCode { @@ -20,8 +23,7 @@ pub fn exit_qemu(exit_code: QemuExitCode) -> ! { } } -pub fn serial() -> uart_16550::SerialPort { - let mut port = unsafe { uart_16550::SerialPort::new(0x3F8) }; - port.init(); - port +pub fn serial() -> Uart16550Tty { + unsafe { Uart16550Tty::new_port(0x3F8, Config::default()) } + .expect("should initialize serial device from valid config and valid port") } diff --git a/tests/test_kernels/ramdisk/Cargo.toml b/tests/test_kernels/ramdisk/Cargo.toml index cc48a77e..69e8cff4 100644 --- a/tests/test_kernels/ramdisk/Cargo.toml +++ b/tests/test_kernels/ramdisk/Cargo.toml @@ -9,4 +9,4 @@ bootloader_api = { path = "../../../api" } x86_64 = { version = "0.15.2", default-features = false, features = [ "instructions", ] } -uart_16550 = "0.2.10" +uart_16550 = "0.6.0" diff --git a/tests/test_kernels/ramdisk/src/lib.rs b/tests/test_kernels/ramdisk/src/lib.rs index 00ea92a6..b8185d92 100644 --- a/tests/test_kernels/ramdisk/src/lib.rs +++ b/tests/test_kernels/ramdisk/src/lib.rs @@ -1,5 +1,8 @@ #![no_std] +use uart_16550::backend::PioBackend; +use uart_16550::{Config, Uart16550Tty}; + #[derive(Debug, Clone, Copy, PartialEq, Eq)] #[repr(u32)] pub enum QemuExitCode { @@ -22,8 +25,7 @@ pub fn exit_qemu(exit_code: QemuExitCode) -> ! { } } -pub fn serial() -> uart_16550::SerialPort { - let mut port = unsafe { uart_16550::SerialPort::new(0x3F8) }; - port.init(); - port +pub fn serial() -> Uart16550Tty { + unsafe { Uart16550Tty::new_port(0x3F8, Config::default()) } + .expect("should initialize serial device from valid config and valid port") } diff --git a/tests/test_kernels/stack_address/Cargo.toml b/tests/test_kernels/stack_address/Cargo.toml index 28b59198..3f2614ab 100644 --- a/tests/test_kernels/stack_address/Cargo.toml +++ b/tests/test_kernels/stack_address/Cargo.toml @@ -8,4 +8,4 @@ bootloader_api = { path = "../../../api" } x86_64 = { version = "0.15.2", default-features = false, features = [ "instructions", ] } -uart_16550 = "0.2.10" +uart_16550 = "0.6.0" diff --git a/tests/test_kernels/stack_address/src/lib.rs b/tests/test_kernels/stack_address/src/lib.rs index 9a8212e2..b9e342e8 100644 --- a/tests/test_kernels/stack_address/src/lib.rs +++ b/tests/test_kernels/stack_address/src/lib.rs @@ -1,6 +1,8 @@ #![no_std] use bootloader_api::{BootloaderConfig, config::Mapping}; +use uart_16550::backend::PioBackend; +use uart_16550::{Config, Uart16550Tty}; pub const KERNEL_ADDR: u64 = 0x1987_6543_0000; @@ -30,8 +32,7 @@ pub fn exit_qemu(exit_code: QemuExitCode) -> ! { } } -pub fn serial() -> uart_16550::SerialPort { - let mut port = unsafe { uart_16550::SerialPort::new(0x3F8) }; - port.init(); - port +pub fn serial() -> Uart16550Tty { + unsafe { Uart16550Tty::new_port(0x3F8, Config::default()) } + .expect("should initialize serial device from valid config and valid port") } diff --git a/tests/test_kernels/write_usable_memory/Cargo.toml b/tests/test_kernels/write_usable_memory/Cargo.toml index 1a9d1f96..1aa122ce 100644 --- a/tests/test_kernels/write_usable_memory/Cargo.toml +++ b/tests/test_kernels/write_usable_memory/Cargo.toml @@ -8,4 +8,4 @@ bootloader_api = { path = "../../../api" } x86_64 = { version = "0.15.2", default-features = false, features = [ "instructions", ] } -uart_16550 = "0.2.10" +uart_16550 = "0.6.0" diff --git a/tests/test_kernels/write_usable_memory/src/lib.rs b/tests/test_kernels/write_usable_memory/src/lib.rs index 4e46fdb6..c1536470 100644 --- a/tests/test_kernels/write_usable_memory/src/lib.rs +++ b/tests/test_kernels/write_usable_memory/src/lib.rs @@ -1,5 +1,8 @@ #![no_std] +use uart_16550::backend::PioBackend; +use uart_16550::{Config, Uart16550Tty}; + #[derive(Debug, Clone, Copy, PartialEq, Eq)] #[repr(u32)] pub enum QemuExitCode { @@ -20,8 +23,7 @@ pub fn exit_qemu(exit_code: QemuExitCode) -> ! { } } -pub fn serial() -> uart_16550::SerialPort { - let mut port = unsafe { uart_16550::SerialPort::new(0x3F8) }; - port.init(); - port +pub fn serial() -> Uart16550Tty { + unsafe { Uart16550Tty::new_port(0x3F8, Config::default()) } + .expect("should initialize serial device from valid config and valid port") } From d5935c0a7602e964215bd31df1336d9a6b08af53 Mon Sep 17 00:00:00 2001 From: Philipp Schuster Date: Sun, 14 Jun 2026 22:28:27 +0200 Subject: [PATCH 2/2] tests: increase stack size for min_stack test Uart16550 has a layout of (32 /* size*/, 4 /* align*/) whereas the old SerialPort had (2, 2). The test shows that this small change is sufficient to fail the test with the old stack size. We slightly increase the stack therefore. --- tests/test_kernels/min_stack/src/bin/basic_boot.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_kernels/min_stack/src/bin/basic_boot.rs b/tests/test_kernels/min_stack/src/bin/basic_boot.rs index 54aff95d..e92dedf4 100644 --- a/tests/test_kernels/min_stack/src/bin/basic_boot.rs +++ b/tests/test_kernels/min_stack/src/bin/basic_boot.rs @@ -7,7 +7,7 @@ use test_kernel_min_stack::{QemuExitCode, exit_qemu, serial}; const BOOTLOADER_CONFIG: BootloaderConfig = { let mut config = BootloaderConfig::new_default(); - config.kernel_stack_size = 3000; + config.kernel_stack_size = 4000; config }; entry_point!(kernel_main, config = &BOOTLOADER_CONFIG);