Fix various kernel warnings.
This commit is contained in:
@@ -4,7 +4,7 @@ use alloc::string::ToString;
|
||||
use alloc::vec::Vec;
|
||||
use alloc::collections::BTreeMap;
|
||||
|
||||
use core::fmt::{Debug, Formatter, Error};
|
||||
use core::fmt::Debug;
|
||||
use core::str::FromStr;
|
||||
|
||||
use super::termlist::parse_term_list;
|
||||
|
||||
@@ -39,12 +39,12 @@ impl Dmar {
|
||||
DmarEntry::Drhd(dmar_drhd) => {
|
||||
let drhd = dmar_drhd.get(active_table);
|
||||
|
||||
println!("VER: {:X}", drhd.version);
|
||||
println!("CAP: {:X}", drhd.cap);
|
||||
println!("EXT_CAP: {:X}", drhd.ext_cap);
|
||||
println!("GCMD: {:X}", drhd.gl_cmd);
|
||||
println!("GSTS: {:X}", drhd.gl_sts);
|
||||
println!("RT: {:X}", drhd.root_table);
|
||||
println!("VER: {:X}", {drhd.version});
|
||||
println!("CAP: {:X}", {drhd.cap});
|
||||
println!("EXT_CAP: {:X}", {drhd.ext_cap});
|
||||
println!("GCMD: {:X}", {drhd.gl_cmd});
|
||||
println!("GSTS: {:X}", {drhd.gl_sts});
|
||||
println!("RT: {:X}", {drhd.root_table});
|
||||
},
|
||||
_ => ()
|
||||
}
|
||||
@@ -77,11 +77,9 @@ impl Dmar {
|
||||
}
|
||||
}
|
||||
|
||||
///
|
||||
|
||||
/// DMAR DMA Remapping Hardware Unit Definition
|
||||
// TODO: Implement iterator on DmarDrhd scope
|
||||
#[derive(Debug)]
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
#[repr(packed)]
|
||||
pub struct DmarDrhd {
|
||||
kind: u16,
|
||||
@@ -102,7 +100,7 @@ impl DmarDrhd {
|
||||
|
||||
/// DMAR Reserved Memory Region Reporting
|
||||
// TODO: Implement iterator on DmarRmrr scope
|
||||
#[derive(Debug)]
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
#[repr(packed)]
|
||||
pub struct DmarRmrr {
|
||||
kind: u16,
|
||||
@@ -115,7 +113,7 @@ pub struct DmarRmrr {
|
||||
|
||||
/// DMAR Root Port ATS Capability Reporting
|
||||
// TODO: Implement iterator on DmarAtsr scope
|
||||
#[derive(Debug)]
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
#[repr(packed)]
|
||||
pub struct DmarAtsr {
|
||||
kind: u16,
|
||||
@@ -126,7 +124,7 @@ pub struct DmarAtsr {
|
||||
}
|
||||
|
||||
/// DMAR Remapping Hardware Static Affinity
|
||||
#[derive(Debug)]
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
#[repr(packed)]
|
||||
pub struct DmarRhsa {
|
||||
kind: u16,
|
||||
@@ -138,7 +136,7 @@ pub struct DmarRhsa {
|
||||
|
||||
/// DMAR ACPI Name-space Device Declaration
|
||||
// TODO: Implement iterator on DmarAndd object name
|
||||
#[derive(Debug)]
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
#[repr(packed)]
|
||||
pub struct DmarAndd {
|
||||
kind: u16,
|
||||
|
||||
@@ -6,7 +6,7 @@ use super::{ACPI_TABLE, SDT_POINTERS, get_sdt, find_sdt, get_sdt_signature, load
|
||||
use crate::paging::ActivePageTable;
|
||||
|
||||
#[repr(packed)]
|
||||
#[derive(Debug)]
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
pub struct Fadt {
|
||||
pub header: Sdt,
|
||||
pub firmware_ctrl: u32,
|
||||
@@ -108,7 +108,7 @@ impl Fadt {
|
||||
};
|
||||
|
||||
if let Some(fadt) = fadt {
|
||||
println!(" FACP: {:X}", fadt.dsdt);
|
||||
println!(" FACP: {:X}", {fadt.dsdt});
|
||||
|
||||
let dsdt_sdt = get_sdt(fadt.dsdt as usize, active_table);
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ pub struct GenericAddressStructure {
|
||||
}
|
||||
|
||||
#[repr(packed)]
|
||||
#[derive(Debug)]
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
pub struct Hpet {
|
||||
pub header: Sdt,
|
||||
|
||||
|
||||
@@ -169,10 +169,8 @@ impl Madt {
|
||||
}
|
||||
}
|
||||
|
||||
///
|
||||
|
||||
/// MADT Local APIC
|
||||
#[derive(Debug)]
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
#[repr(packed)]
|
||||
pub struct MadtLocalApic {
|
||||
/// Processor ID
|
||||
@@ -184,7 +182,7 @@ pub struct MadtLocalApic {
|
||||
}
|
||||
|
||||
/// MADT I/O APIC
|
||||
#[derive(Debug)]
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
#[repr(packed)]
|
||||
pub struct MadtIoApic {
|
||||
/// I/O APIC ID
|
||||
@@ -198,7 +196,7 @@ pub struct MadtIoApic {
|
||||
}
|
||||
|
||||
/// MADT Interrupt Source Override
|
||||
#[derive(Debug)]
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
#[repr(packed)]
|
||||
pub struct MadtIntSrcOverride {
|
||||
/// Bus Source
|
||||
|
||||
@@ -135,7 +135,7 @@ pub unsafe fn init(active_table: &mut ActivePageTable, already_supplied_rsdps: O
|
||||
}
|
||||
println!(":");
|
||||
|
||||
let rxsdt: Box<Rxsdt + Send + Sync> = if let Some(rsdt) = Rsdt::new(rxsdt) {
|
||||
let rxsdt: Box<dyn Rxsdt + Send + Sync> = if let Some(rsdt) = Rsdt::new(rxsdt) {
|
||||
Box::new(rsdt)
|
||||
} else if let Some(xsdt) = Xsdt::new(rxsdt) {
|
||||
Box::new(xsdt)
|
||||
|
||||
@@ -18,7 +18,7 @@ impl Rsdt {
|
||||
}
|
||||
|
||||
impl Rxsdt for Rsdt {
|
||||
fn iter(&self) -> Box<Iterator<Item = usize>> {
|
||||
fn iter(&self) -> Box<dyn Iterator<Item = usize>> {
|
||||
Box::new(RsdtIter {
|
||||
sdt: self.0,
|
||||
i: 0
|
||||
|
||||
@@ -6,7 +6,7 @@ use super::sdt::Sdt;
|
||||
use super::get_sdt;
|
||||
|
||||
pub trait Rxsdt {
|
||||
fn iter(&self) -> Box<Iterator<Item = usize>>;
|
||||
fn iter(&self) -> Box<dyn Iterator<Item = usize>>;
|
||||
|
||||
fn map_all(&self, active_table: &mut ActivePageTable) {
|
||||
for sdt in self.iter() {
|
||||
|
||||
@@ -18,7 +18,7 @@ impl Xsdt {
|
||||
}
|
||||
|
||||
impl Rxsdt for Xsdt {
|
||||
fn iter(&self) -> Box<Iterator<Item = usize>> {
|
||||
fn iter(&self) -> Box<dyn Iterator<Item = usize>> {
|
||||
Box::new(XsdtIter {
|
||||
sdt: self.0,
|
||||
i: 0
|
||||
|
||||
@@ -9,7 +9,6 @@ use crate::acpi::madt::{self, Madt, MadtEntry, MadtIoApic, MadtIntSrcOverride};
|
||||
use crate::arch::interrupt::irq;
|
||||
use crate::memory::Frame;
|
||||
use crate::paging::{ActivePageTable, entry::EntryFlags, Page, PhysicalAddress, VirtualAddress};
|
||||
use crate::syscall::io::Mmio;
|
||||
|
||||
use super::pic;
|
||||
|
||||
@@ -243,7 +242,7 @@ pub unsafe fn handle_ioapic(active_table: &mut ActivePageTable, madt_ioapic: &'s
|
||||
result.flush(active_table);
|
||||
|
||||
let ioapic_registers = page.start_address().get() as *const u32;
|
||||
let mut ioapic = IoApic::new(ioapic_registers, madt_ioapic.gsi_base);
|
||||
let ioapic = IoApic::new(ioapic_registers, madt_ioapic.gsi_base);
|
||||
|
||||
assert_eq!(ioapic.regs.lock().id(), madt_ioapic.id, "mismatched ACPI MADT I/O APIC ID, and the ID reported by the I/O APIC");
|
||||
|
||||
@@ -283,7 +282,7 @@ pub unsafe fn handle_src_override(src_override: &'static MadtIntSrcOverride) {
|
||||
}
|
||||
|
||||
pub unsafe fn init(active_table: &mut ActivePageTable) {
|
||||
let mut bsp_apic_id = x86::cpuid::CpuId::new().get_feature_info().unwrap().initial_local_apic_id(); // TODO
|
||||
let bsp_apic_id = x86::cpuid::CpuId::new().get_feature_info().unwrap().initial_local_apic_id(); // TODO
|
||||
|
||||
// search the madt for all IOAPICs.
|
||||
#[cfg(feature = "acpi")]
|
||||
|
||||
@@ -14,7 +14,7 @@ pub unsafe fn init(active_table: &mut ActivePageTable) {
|
||||
pic::init();
|
||||
local_apic::init(active_table);
|
||||
}
|
||||
pub unsafe fn init_after_acpi(active_table: &mut ActivePageTable) {
|
||||
pub unsafe fn init_after_acpi(_active_table: &mut ActivePageTable) {
|
||||
// this will disable the IOAPIC if needed.
|
||||
//ioapic::init(active_table);
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ pub static PIT_TICKS: AtomicUsize = AtomicUsize::new(0);
|
||||
// reading the status register is not done atomically with reading the data. This is not possible
|
||||
// from userspace, so we do this minimal part of the PS2 driver in the kernel.
|
||||
#[inline(always)]
|
||||
unsafe fn ps2_interrupt(index: usize) {
|
||||
unsafe fn ps2_interrupt(_index: usize) {
|
||||
use crate::scheme::serio::serio_input;
|
||||
|
||||
let data: u8;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
/// It must create the IDT with the correct entries, those entries are
|
||||
/// defined in other files inside of the `arch` module
|
||||
|
||||
use core::{mem, slice};
|
||||
use core::slice;
|
||||
use core::sync::atomic::{AtomicBool, AtomicUsize, Ordering};
|
||||
|
||||
use crate::allocator;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use core::convert::{TryFrom, TryInto};
|
||||
use core::convert::TryInto;
|
||||
use core::fmt::Write;
|
||||
use core::str;
|
||||
use core::sync::atomic::{self, AtomicUsize};
|
||||
@@ -239,7 +239,7 @@ impl Scheme for AcpiScheme {
|
||||
}
|
||||
Handle::Tables(0)
|
||||
} else {
|
||||
if (flags & O_DIRECTORY != 0 && flags & O_STAT == 0) {
|
||||
if flags & O_DIRECTORY != 0 && flags & O_STAT == 0 {
|
||||
return Err(Error::new(ENOTDIR));
|
||||
}
|
||||
if flags & O_ACCMODE == O_WRONLY || flags & O_ACCMODE == O_RDWR {
|
||||
@@ -448,7 +448,7 @@ impl Scheme for AcpiScheme {
|
||||
}
|
||||
}
|
||||
}
|
||||
fn write(&self, id: usize, buf: &[u8]) -> Result<usize> {
|
||||
fn write(&self, _id: usize, _buf: &[u8]) -> Result<usize> {
|
||||
Err(Error::new(EBADF))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -155,7 +155,7 @@ impl Scheme for IrqScheme {
|
||||
use core::fmt::Write;
|
||||
|
||||
for cpu_id in &self.cpus {
|
||||
writeln!(bytes, "cpu-{:02x}", cpu_id);
|
||||
writeln!(bytes, "cpu-{:02x}", cpu_id).unwrap();
|
||||
}
|
||||
|
||||
if bsp_apic_id().is_some() {
|
||||
@@ -186,7 +186,7 @@ impl Scheme for IrqScheme {
|
||||
if Some(u32::from(cpu_id)) == bsp_apic_id() && irq < BASE_IRQ_COUNT {
|
||||
continue;
|
||||
}
|
||||
writeln!(data, "{}", irq);
|
||||
writeln!(data, "{}", irq).unwrap();
|
||||
}
|
||||
|
||||
Handle::Avail(cpu_id, data.into_bytes(), AtomicUsize::new(0))
|
||||
|
||||
@@ -66,9 +66,9 @@ impl Scheme for SerioScheme {
|
||||
}
|
||||
|
||||
let index = str::from_utf8(path)
|
||||
.map_err(|err| Error::new(ENOENT))?
|
||||
.or(Err(Error::new(ENOENT)))?
|
||||
.parse::<usize>()
|
||||
.map_err(|err| Error::new(ENOENT))?;
|
||||
.or(Err(Error::new(ENOENT)))?;
|
||||
if index >= INPUT.len() {
|
||||
return Err(Error::new(ENOENT));
|
||||
}
|
||||
|
||||
@@ -81,7 +81,7 @@ pub fn clone(flags: CloneFlags, stack_base: usize) -> Result<ContextId> {
|
||||
let ens;
|
||||
let umask;
|
||||
let sigmask;
|
||||
let mut cpu_id_opt = None;
|
||||
let cpu_id_opt = None;
|
||||
let arch;
|
||||
let vfork;
|
||||
let mut kfx_opt = None;
|
||||
|
||||
Reference in New Issue
Block a user