Fix warnings
This commit is contained in:
@@ -11,10 +11,10 @@ use super::{ACPI_TABLE, find_sdt};
|
||||
#[repr(packed)]
|
||||
#[derive(Clone, Copy, Debug, Default)]
|
||||
pub struct GenericAddressStructure {
|
||||
address_space: u8,
|
||||
bit_width: u8,
|
||||
bit_offset: u8,
|
||||
access_size: u8,
|
||||
_address_space: u8,
|
||||
_bit_width: u8,
|
||||
_bit_offset: u8,
|
||||
_access_size: u8,
|
||||
pub address: u64,
|
||||
}
|
||||
|
||||
|
||||
@@ -212,7 +212,7 @@ pub struct MadtIoApic {
|
||||
/// I/O APIC ID
|
||||
pub id: u8,
|
||||
/// reserved
|
||||
reserved: u8,
|
||||
_reserved: u8,
|
||||
/// I/O APIC address
|
||||
pub address: u32,
|
||||
/// Global system interrupt base
|
||||
|
||||
@@ -50,7 +50,7 @@ pub fn get_sdt(sdt_address: usize, mapper: &mut KernelMapper) -> &'static Sdt {
|
||||
const SDT_SIZE: usize = core::mem::size_of::<Sdt>();
|
||||
map_linearly(physaddr, SDT_SIZE, mapper);
|
||||
|
||||
sdt = unsafe { &*(RmmA::phys_to_virt(physaddr).data() as *const Sdt) };
|
||||
sdt = &*(RmmA::phys_to_virt(physaddr).data() as *const Sdt);
|
||||
|
||||
map_linearly(physaddr.add(SDT_SIZE), sdt.length as usize - SDT_SIZE, mapper);
|
||||
}
|
||||
|
||||
@@ -9,14 +9,14 @@ use crate::paging::{KernelMapper, Page, PageFlags, PhysicalAddress, VirtualAddre
|
||||
#[repr(packed)]
|
||||
pub struct RSDP {
|
||||
signature: [u8; 8],
|
||||
checksum: u8,
|
||||
oemid: [u8; 6],
|
||||
_checksum: u8,
|
||||
_oemid: [u8; 6],
|
||||
revision: u8,
|
||||
rsdt_address: u32,
|
||||
length: u32,
|
||||
_length: u32,
|
||||
xsdt_address: u64,
|
||||
extended_checksum: u8,
|
||||
reserved: [u8; 3]
|
||||
_extended_checksum: u8,
|
||||
_reserved: [u8; 3]
|
||||
}
|
||||
|
||||
impl RSDP {
|
||||
|
||||
@@ -8,7 +8,7 @@ pub fn cpu_info<W: Write>(w: &mut W) -> Result {
|
||||
let cpuid = CpuId::new();
|
||||
|
||||
if let Some(info) = cpuid.get_vendor_info() {
|
||||
writeln!(w, "Vendor: {}", info.as_string())?;
|
||||
writeln!(w, "Vendor: {}", info.as_str())?;
|
||||
}
|
||||
|
||||
if let Some(brand) = cpuid.get_processor_brand_string() {
|
||||
|
||||
@@ -69,7 +69,7 @@ pub unsafe fn init(hpet: &mut Hpet) -> bool {
|
||||
}
|
||||
|
||||
pub unsafe fn debug(hpet: &mut Hpet) {
|
||||
println!("HPET @ {:#x}", hpet.base_address.address);
|
||||
println!("HPET @ {:#x}", { hpet.base_address.address });
|
||||
|
||||
let capability = hpet.base_address.read_u64(CAPABILITY_OFFSET);
|
||||
{
|
||||
|
||||
@@ -293,7 +293,7 @@ pub struct IdtEntry {
|
||||
attribute: u8,
|
||||
offsetm: u16,
|
||||
offseth: u32,
|
||||
zero2: u32
|
||||
_zero2: u32
|
||||
}
|
||||
|
||||
impl IdtEntry {
|
||||
@@ -305,7 +305,7 @@ impl IdtEntry {
|
||||
attribute: 0,
|
||||
offsetm: 0,
|
||||
offseth: 0,
|
||||
zero2: 0
|
||||
_zero2: 0
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -140,8 +140,8 @@ unsafe fn inner<A: Arch>(
|
||||
}
|
||||
|
||||
let mut identity_map = |base, size_aligned| {
|
||||
// Map stack with identity mapping
|
||||
for i in 0..size / A::PAGE_SIZE {
|
||||
// Map with identity mapping
|
||||
for i in 0..size_aligned / A::PAGE_SIZE {
|
||||
let phys = PhysicalAddress::new(base + i * A::PAGE_SIZE);
|
||||
let virt = A::phys_to_virt(phys);
|
||||
let flags = page_flags::<A>(virt);
|
||||
@@ -154,7 +154,6 @@ unsafe fn inner<A: Arch>(
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
identity_map(stack_base, stack_size_aligned);
|
||||
identity_map(env_base, env_size_aligned);
|
||||
identity_map(acpi_base, acpi_size_aligned);
|
||||
@@ -365,7 +364,7 @@ pub unsafe fn init(
|
||||
// Copy memory map from bootloader location, and page align it
|
||||
let mut area_i = 0;
|
||||
for bootloader_area in bootloader_areas.iter() {
|
||||
if bootloader_area.kind != BootloaderMemoryKind::Free {
|
||||
if { bootloader_area.kind } != BootloaderMemoryKind::Free {
|
||||
// Not a free area
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -106,13 +106,13 @@ pub unsafe extern fn kstart(args_ptr: *const KernelArgs) -> ! {
|
||||
});
|
||||
|
||||
info!("Redox OS starting...");
|
||||
info!("Kernel: {:X}:{:X}", args.kernel_base, args.kernel_base + args.kernel_size);
|
||||
info!("Stack: {:X}:{:X}", args.stack_base, args.stack_base + args.stack_size);
|
||||
info!("Env: {:X}:{:X}", args.env_base, args.env_base + args.env_size);
|
||||
info!("RSDPs: {:X}:{:X}", args.acpi_rsdps_base, args.acpi_rsdps_base + args.acpi_rsdps_size);
|
||||
info!("Areas: {:X}:{:X}", args.areas_base, args.areas_base + args.areas_size);
|
||||
info!("Bootstrap: {:X}:{:X}", args.bootstrap_base, args.bootstrap_base + args.bootstrap_size);
|
||||
info!("Bootstrap entry point: {:X}", args.bootstrap_entry);
|
||||
info!("Kernel: {:X}:{:X}", { args.kernel_base }, { args.kernel_base } + { args.kernel_size });
|
||||
info!("Stack: {:X}:{:X}", { args.stack_base }, { args.stack_base } + { args.stack_size });
|
||||
info!("Env: {:X}:{:X}", { args.env_base }, { args.env_base } + { args.env_size });
|
||||
info!("RSDPs: {:X}:{:X}", { args.acpi_rsdps_base }, { args.acpi_rsdps_base } + { args.acpi_rsdps_size });
|
||||
info!("Areas: {:X}:{:X}", { args.areas_base }, { args.areas_base } + { args.areas_size });
|
||||
info!("Bootstrap: {:X}:{:X}", { args.bootstrap_base }, { args.bootstrap_base } + { args.bootstrap_size });
|
||||
info!("Bootstrap entry point: {:X}", { args.bootstrap_entry });
|
||||
|
||||
// Set up GDT before paging
|
||||
gdt::init();
|
||||
|
||||
@@ -281,7 +281,7 @@ impl UserGrants {
|
||||
// MAP_FIXED/MAP_FIXED_NOREPLACE.
|
||||
// TODO: Allow explicitly allocating guard pages?
|
||||
|
||||
let (hole_start, hole_size) = self.holes.iter()
|
||||
let (hole_start, _hole_size) = self.holes.iter()
|
||||
.skip_while(|(hole_offset, hole_size)| hole_offset.data() + **hole_size <= min)
|
||||
.find(|(hole_offset, hole_size)| {
|
||||
let avail_size = if hole_offset.data() <= min && min <= hole_offset.data() + **hole_size {
|
||||
@@ -313,7 +313,7 @@ impl UserGrants {
|
||||
}
|
||||
|
||||
|
||||
if let Some(grant) = self.conflicts(requested).next() {
|
||||
if let Some(_grant) = self.conflicts(requested).next() {
|
||||
// ... but it already exists
|
||||
|
||||
if flags.contains(MapFlags::MAP_FIXED_NOREPLACE) {
|
||||
@@ -684,7 +684,7 @@ impl Grant {
|
||||
|
||||
for index in 0..page_count {
|
||||
let src_page = src_base.next_by(index);
|
||||
let (address, entry_flags) = if unmap {
|
||||
let (address, _entry_flags) = if unmap {
|
||||
let (entry, entry_flags, flush) = unsafe { src_mapper.unmap_phys(src_page.start_address(), true).expect("grant references unmapped memory") };
|
||||
src_flusher.consume(flush);
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ pub unsafe fn debugger(target_id: Option<crate::context::ContextId>) {
|
||||
}
|
||||
}
|
||||
}
|
||||
if let Some(regs) = unsafe { crate::ptrace::regs_for(&context) } {
|
||||
if let Some(regs) = crate::ptrace::regs_for(&context) {
|
||||
println!("regs:");
|
||||
regs.dump();
|
||||
|
||||
|
||||
@@ -45,8 +45,6 @@ pub fn init(env: &[u8]) {
|
||||
println!("Framebuffer {}x{} at {:X}", width, height, physbaseptr);
|
||||
|
||||
{
|
||||
let size = width * height * 4;
|
||||
|
||||
let virtbaseptr = physbaseptr + crate::PHYS_OFFSET;
|
||||
|
||||
let display = Display::new(width, height, virtbaseptr as *mut u32);
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
//! The Redox OS Kernel is a microkernel that supports `x86_64` systems and
|
||||
//! provides Unix-like syscalls for primarily Rust applications
|
||||
|
||||
//TODO: fix the need to generate references to packed fields
|
||||
#![allow(unaligned_references)]
|
||||
// Useful for adding comments about different branches
|
||||
#![allow(clippy::if_same_then_else)]
|
||||
// Useful in the syscall function
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
use crate::{
|
||||
arch::paging::{mapper::InactiveFlusher, Page, VirtualAddress},
|
||||
context::{self, Context, ContextId, Status, file::{FileDescription, FileDescriptor}, memory::{AddrSpace, Grant, new_addrspace, map_flags, page_flags, Region}},
|
||||
context::{self, Context, ContextId, Status, file::{FileDescription, FileDescriptor}, memory::{AddrSpace, Grant, new_addrspace, map_flags, Region}},
|
||||
memory::PAGE_SIZE,
|
||||
ptrace,
|
||||
scheme::{self, FileHandle, KernelScheme, SchemeId},
|
||||
@@ -65,7 +65,7 @@ where
|
||||
}
|
||||
callback(&mut context)
|
||||
}
|
||||
fn try_stop_context<F, T>(pid: ContextId, mut callback: F) -> Result<T>
|
||||
fn try_stop_context<F, T>(pid: ContextId, callback: F) -> Result<T>
|
||||
where
|
||||
F: FnOnce(&mut Context) -> Result<T>,
|
||||
{
|
||||
@@ -1222,7 +1222,7 @@ impl KernelScheme for ProcScheme {
|
||||
if let Some(before) = before { src_addr_space.grants.insert(before); }
|
||||
if let Some(after) = after { src_addr_space.grants.insert(after); }
|
||||
|
||||
dst_addr_space.mmap(requested_dst_page, grant_page_count, map.flags, |dst_page, flags, dst_mapper, dst_flusher| Ok(Grant::transfer(middle, dst_page, src_mapper, dst_mapper, InactiveFlusher::new(), dst_flusher)?))?
|
||||
dst_addr_space.mmap(requested_dst_page, grant_page_count, map.flags, |dst_page, _flags, dst_mapper, dst_flusher| Ok(Grant::transfer(middle, dst_page, src_mapper, dst_mapper, InactiveFlusher::new(), dst_flusher)?))?
|
||||
} else {
|
||||
dst_addr_space.mmap(requested_dst_page, grant_page_count, map.flags, |dst_page, flags, dst_mapper, flusher| Ok(Grant::borrow(Page::containing_address(src_grant_region.start_address()), dst_page, grant_page_count, flags, None, src_mapper, dst_mapper, flusher)?))?
|
||||
};
|
||||
|
||||
@@ -163,7 +163,7 @@ pub fn futex(addr: usize, op: usize, val: usize, val2: usize, addr2: usize) -> R
|
||||
Ok(woken)
|
||||
},
|
||||
FUTEX_REQUEUE => {
|
||||
let (addr2_physaddr, _) = unsafe {
|
||||
let (addr2_physaddr, _) = {
|
||||
let addr2_virt = VirtualAddress::new(addr2);
|
||||
|
||||
if !crate::CurrentRmmArch::virt_is_valid(addr2_virt) {
|
||||
|
||||
@@ -420,8 +420,8 @@ fn reap(pid: ContextId) -> Result<ContextId> {
|
||||
let mut contexts = context::contexts_mut();
|
||||
let context_lock = contexts.remove(pid).ok_or(Error::new(ESRCH))?;
|
||||
{
|
||||
let mut context = context_lock.write();
|
||||
context = empty(&context_lock, context, true);
|
||||
let context = context_lock.write();
|
||||
empty(&context_lock, context, true);
|
||||
}
|
||||
drop(context_lock);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user