diff --git a/kernel/standalone-builder/src/bin/main.rs b/kernel/standalone-builder/src/bin/main.rs index 8bb60cbeb..d52f4ecc4 100644 --- a/kernel/standalone-builder/src/bin/main.rs +++ b/kernel/standalone-builder/src/bin/main.rs @@ -14,14 +14,11 @@ // along with this program. If not, see . use std::{ - error, fs, - io::{self, Write as _}, + error, path::{Path, PathBuf}, - process::Command, str::FromStr, }; use structopt::StructOpt; -use tempdir::TempDir; #[derive(Debug, StructOpt)] #[structopt( diff --git a/kernel/standalone-builder/src/build.rs b/kernel/standalone-builder/src/build.rs index e53b34487..e9127b09a 100644 --- a/kernel/standalone-builder/src/build.rs +++ b/kernel/standalone-builder/src/build.rs @@ -14,7 +14,7 @@ // along with this program. If not, see . use std::{ - env, fs, io, + fs, io, path::{Path, PathBuf}, process::Command, }; diff --git a/kernel/standalone-builder/src/emulator.rs b/kernel/standalone-builder/src/emulator.rs index 9088249b7..bbaa417dc 100644 --- a/kernel/standalone-builder/src/emulator.rs +++ b/kernel/standalone-builder/src/emulator.rs @@ -13,12 +13,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -use std::{ - fs, - io::{self, Write as _}, - path::{Path, PathBuf}, - process::Command, -}; +use std::{io, path::Path, process::Command}; use tempdir::TempDir; /// Configuration for running the kernel in an emulator. diff --git a/kernel/standalone-builder/src/image.rs b/kernel/standalone-builder/src/image.rs index 302e0495c..e9093e2b0 100644 --- a/kernel/standalone-builder/src/image.rs +++ b/kernel/standalone-builder/src/image.rs @@ -16,7 +16,7 @@ use std::{ fs, io::{self, Read, Seek, SeekFrom, Write}, - path::{Path, PathBuf}, + path::Path, process::Command, }; use tempdir::TempDir; diff --git a/kernel/standalone/src/arch/x86_64.rs b/kernel/standalone/src/arch/x86_64.rs index 94aec8494..c064bdb7e 100644 --- a/kernel/standalone/src/arch/x86_64.rs +++ b/kernel/standalone/src/arch/x86_64.rs @@ -32,7 +32,7 @@ use core::{ time::Duration, }; use futures::channel::oneshot; -use hashbrown::{hash_map::Entry, HashMap}; +use hashbrown::HashMap; use redshirt_kernel_log_interface::ffi::{FramebufferFormat, FramebufferInfo, KernelLogMethod}; use spinning_top::Spinlock; use x86_64::structures::port::{PortRead as _, PortWrite as _}; diff --git a/kernel/standalone/src/arch/x86_64/ap_boot.rs b/kernel/standalone/src/arch/x86_64/ap_boot.rs index 1f7133aed..b40f97fa5 100644 --- a/kernel/standalone/src/arch/x86_64/ap_boot.rs +++ b/kernel/standalone/src/arch/x86_64/ap_boot.rs @@ -283,7 +283,7 @@ pub unsafe fn boot_associated_processor( // Write the location of marker 2 into the constant at marker 1. let ljmp_target_ptr = (ap_boot_marker1_loc.add(2)) as *mut u32; assert_eq!(ljmp_target_ptr.read_unaligned(), 0xdeaddead); - ljmp_target_ptr.write_unaligned({ u32::try_from(ap_boot_marker2_loc as usize).unwrap() }); + ljmp_target_ptr.write_unaligned(u32::try_from(ap_boot_marker2_loc as usize).unwrap()); // Write the value of our `cr3` register to the constant at marker 3. let pml_addr_ptr = (ap_boot_marker3_loc.add(2)) as *mut u32; diff --git a/kernel/standalone/src/arch/x86_64/apic/local.rs b/kernel/standalone/src/arch/x86_64/apic/local.rs index 32b995398..2adbdefcd 100644 --- a/kernel/standalone/src/arch/x86_64/apic/local.rs +++ b/kernel/standalone/src/arch/x86_64/apic/local.rs @@ -68,7 +68,7 @@ pub unsafe fn init() -> LocalApicsControl { error_interrupt_vector.register_waker(&{ struct ErrWaker; impl futures::task::ArcWake for ErrWaker { - fn wake_by_ref(arc_self: &Arc) { + fn wake_by_ref(_: &Arc) { unsafe { // The errors reported are found in the Error Status Register (ESR). let esr_addr = usize::try_from(APIC_BASE_ADDR + 0xf0).unwrap() as *mut u32; diff --git a/kernel/standalone/src/arch/x86_64/panic.rs b/kernel/standalone/src/arch/x86_64/panic.rs index a66ca887a..b9dd9e593 100644 --- a/kernel/standalone/src/arch/x86_64/panic.rs +++ b/kernel/standalone/src/arch/x86_64/panic.rs @@ -19,7 +19,6 @@ use crate::klog::KLogger; use alloc::sync::Arc; use core::fmt::Write as _; -use redshirt_kernel_log_interface::ffi::{FramebufferFormat, FramebufferInfo, KernelLogMethod}; use spinning_top::Spinlock; /// Modifies the logger to use when printing a panic. diff --git a/kernel/standalone/src/hardware.rs b/kernel/standalone/src/hardware.rs index 7f533854f..36378fa1a 100644 --- a/kernel/standalone/src/hardware.rs +++ b/kernel/standalone/src/hardware.rs @@ -22,7 +22,6 @@ use crate::{arch::PlatformSpecific, future_channel}; use alloc::{boxed::Box, sync::Arc, vec::Vec}; use core::{convert::TryFrom as _, pin::Pin, sync::atomic, task::Poll}; -use crossbeam_queue::SegQueue; use futures::prelude::*; use hashbrown::HashMap; use nohash_hasher::BuildNoHashHasher; diff --git a/kernel/standalone/src/kernel.rs b/kernel/standalone/src/kernel.rs index cd2093cf9..d67d56dbd 100644 --- a/kernel/standalone/src/kernel.rs +++ b/kernel/standalone/src/kernel.rs @@ -25,16 +25,10 @@ use crate::arch::PlatformSpecific; use alloc::{format, string::String, sync::Arc, vec::Vec}; -use core::{ - convert::TryFrom as _, - pin::Pin, - sync::atomic::{AtomicBool, AtomicU64, Ordering}, -}; +use core::{convert::TryFrom as _, pin::Pin, sync::atomic::Ordering}; use futures::prelude::*; use hashbrown::HashSet; -use redshirt_core::{ - build_wasm_module, extrinsics::wasi::WasiExtrinsics, module::ModuleHash, System, -}; +use redshirt_core::{build_wasm_module, extrinsics::wasi::WasiExtrinsics, System}; use spinning_top::Spinlock; /// Main struct of this crate. Runs everything. @@ -69,34 +63,33 @@ where // TODO: don't do this on platforms that don't have PCI? let pci_devices = unsafe { crate::pci::pci::init_cam_pci() }; - let mut system_builder = - redshirt_core::system::SystemBuilder::new(WasiExtrinsics::default()) - .with_native_program(crate::hardware::HardwareHandler::new( - platform_specific.clone(), - )) - .with_native_program(crate::time::TimeHandler::new(platform_specific.clone())) - .with_native_program(crate::random::native::RandomNativeProgram::new( - platform_specific.clone(), - )) - .with_native_program(crate::pci::native::PciNativeProgram::new( - pci_devices, - platform_specific.clone(), - )) - .with_native_program(crate::klog::KernelLogNativeProgram::new( - platform_specific.clone(), - )) - .with_startup_process(build_wasm_module!( - "../../../modules/p2p-loader", - "modules-loader" - )) - .with_startup_process(build_wasm_module!("../../../modules/compositor")) - .with_startup_process(build_wasm_module!("../../../modules/pci-printer")) - .with_startup_process(build_wasm_module!("../../../modules/kernel-debug-printer")) - .with_startup_process(build_wasm_module!("../../../modules/log-to-kernel")) - .with_startup_process(build_wasm_module!("../../../modules/http-server")) - .with_startup_process(build_wasm_module!("../../../modules/hello-world")) - .with_startup_process(build_wasm_module!("../../../modules/network-manager")) - .with_startup_process(build_wasm_module!("../../../modules/e1000")); + let system_builder = redshirt_core::system::SystemBuilder::new(WasiExtrinsics::default()) + .with_native_program(crate::hardware::HardwareHandler::new( + platform_specific.clone(), + )) + .with_native_program(crate::time::TimeHandler::new(platform_specific.clone())) + .with_native_program(crate::random::native::RandomNativeProgram::new( + platform_specific.clone(), + )) + .with_native_program(crate::pci::native::PciNativeProgram::new( + pci_devices, + platform_specific.clone(), + )) + .with_native_program(crate::klog::KernelLogNativeProgram::new( + platform_specific.clone(), + )) + .with_startup_process(build_wasm_module!( + "../../../modules/p2p-loader", + "modules-loader" + )) + .with_startup_process(build_wasm_module!("../../../modules/compositor")) + .with_startup_process(build_wasm_module!("../../../modules/pci-printer")) + .with_startup_process(build_wasm_module!("../../../modules/kernel-debug-printer")) + .with_startup_process(build_wasm_module!("../../../modules/log-to-kernel")) + .with_startup_process(build_wasm_module!("../../../modules/http-server")) + .with_startup_process(build_wasm_module!("../../../modules/hello-world")) + .with_startup_process(build_wasm_module!("../../../modules/network-manager")) + .with_startup_process(build_wasm_module!("../../../modules/e1000")); // TODO: remove the cfg guards once rpi-framebuffer is capable of auto-detecting whether // it should enable itself diff --git a/kernel/standalone/src/klog/native.rs b/kernel/standalone/src/klog/native.rs index ec3c40b9a..c00e165d9 100644 --- a/kernel/standalone/src/klog/native.rs +++ b/kernel/standalone/src/klog/native.rs @@ -19,7 +19,6 @@ use crate::{arch::PlatformSpecific, future_channel}; use alloc::{boxed::Box, sync::Arc}; use core::{pin::Pin, str, sync::atomic, task::Poll}; -use crossbeam_queue::SegQueue; use futures::prelude::*; use redshirt_core::native::{DummyMessageIdWrite, NativeProgramEvent, NativeProgramRef}; use redshirt_core::{Encode as _, EncodedMessage, InterfaceHash, MessageId, Pid}; diff --git a/kernel/standalone/src/pci/native.rs b/kernel/standalone/src/pci/native.rs index 4a8229b85..61f48dc32 100644 --- a/kernel/standalone/src/pci/native.rs +++ b/kernel/standalone/src/pci/native.rs @@ -17,16 +17,9 @@ use crate::{arch::PlatformSpecific, future_channel, pci::pci}; -use alloc::{boxed::Box, collections::VecDeque, sync::Arc, vec, vec::Vec}; -use core::{ - convert::TryFrom as _, - pin::Pin, - sync::atomic, - task::{Context, Poll}, -}; -use crossbeam_queue::SegQueue; +use alloc::{boxed::Box, collections::VecDeque, sync::Arc, vec::Vec}; +use core::{convert::TryFrom as _, pin::Pin, sync::atomic, task::Poll}; use futures::prelude::*; -use rand_core::RngCore as _; use redshirt_core::native::{DummyMessageIdWrite, NativeProgramEvent, NativeProgramRef}; use redshirt_core::{Decode as _, Encode as _, EncodedMessage, InterfaceHash, MessageId, Pid}; use redshirt_pci_interface::ffi; @@ -203,10 +196,10 @@ where memory_space, bus_master, }) => { - let mut locked_devices = self.locked_devices.lock(); - if let Some(dev) = locked_devices - .iter_mut() - .find(|dev| dev.owner == emitter_pid && dev.bdf == location) + let locked_devices = self.locked_devices.lock(); + if locked_devices + .iter() + .any(|dev| dev.owner == emitter_pid && dev.bdf == location) { self.devices .devices() diff --git a/kernel/standalone/src/pci/pci.rs b/kernel/standalone/src/pci/pci.rs index e3a07819e..3a26141a7 100644 --- a/kernel/standalone/src/pci/pci.rs +++ b/kernel/standalone/src/pci/pci.rs @@ -17,9 +17,8 @@ //! //! See https://en.wikipedia.org/wiki/PCI_configuration_space -use alloc::{borrow::Cow, collections::VecDeque, vec::Vec}; +use alloc::{collections::VecDeque, vec::Vec}; use core::{convert::TryFrom as _, iter}; -use fnv::FnvBuildHasher; #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] use x86_64::structures::port::{PortRead as _, PortWrite as _}; @@ -275,7 +274,7 @@ fn scan_function(bdf: &DeviceBdf) -> Option { (bytes[0], bytes[1], bytes[2], bytes[3]) }; - let (_bist, header_ty, latency, cache_line) = { + let (_bist, header_ty, _latency, _cache_line) = { let val = pci_cfg_read_u32(bdf, 0xc); let bytes = val.to_be_bytes(); (bytes[0], bytes[1], bytes[2], bytes[3]) diff --git a/kernel/standalone/src/time.rs b/kernel/standalone/src/time.rs index 0c22e28af..5c3fae315 100644 --- a/kernel/standalone/src/time.rs +++ b/kernel/standalone/src/time.rs @@ -19,7 +19,6 @@ use crate::{arch::PlatformSpecific, future_channel}; use alloc::{boxed::Box, sync::Arc}; use core::{pin::Pin, sync::atomic, task::Poll}; -use crossbeam_queue::SegQueue; use futures::{prelude::*, stream::FuturesUnordered}; use redshirt_core::native::{DummyMessageIdWrite, NativeProgramEvent, NativeProgramRef}; use redshirt_core::{Decode as _, Encode as _, EncodedMessage, InterfaceHash, MessageId, Pid}; @@ -109,7 +108,7 @@ where self, interface: InterfaceHash, message_id: Option, - emitter_pid: Pid, + _emitter_pid: Pid, message: EncodedMessage, ) { debug_assert_eq!(interface, INTERFACE); diff --git a/modules/pci-printer/src/main.rs b/modules/pci-printer/src/main.rs index a3c5edbe3..7e3228ddd 100644 --- a/modules/pci-printer/src/main.rs +++ b/modules/pci-printer/src/main.rs @@ -18,8 +18,7 @@ //! This program is nothing more than a small debugging utility. use fnv::FnvBuildHasher; -use parity_scale_codec::DecodeAll; -use std::{borrow::Cow, convert::TryFrom as _}; +use std::borrow::Cow; include!(concat!(env!("OUT_DIR"), "/build-pci.rs"));