From 5e7db80285c70df1fdc5b5a19e487374f9ee7cb2 Mon Sep 17 00:00:00 2001 From: 4lDO2 <4lDO2@protonmail.com> Date: Mon, 8 Jul 2024 13:01:25 +0200 Subject: [PATCH] Fix a bunch of warnings. --- rustfmt.toml | 2 +- src/acpi/mod.rs | 7 +++-- src/arch/aarch64/device/generic_timer.rs | 2 +- src/arch/aarch64/device/irqchip/gic.rs | 6 ++--- src/arch/aarch64/device/irqchip/gicv3.rs | 6 ++--- .../aarch64/device/irqchip/irq_bcm2835.rs | 7 +++-- .../aarch64/device/irqchip/irq_bcm2836.rs | 7 +++-- src/arch/aarch64/device/irqchip/mod.rs | 6 ++--- src/arch/aarch64/device/mod.rs | 2 +- src/arch/aarch64/device/serial.rs | 2 +- src/arch/aarch64/init/device_tree/mod.rs | 15 ++++++++--- src/arch/aarch64/start.rs | 6 ++--- src/arch/x86/start.rs | 6 ++--- src/arch/x86_64/gdt.rs | 3 +-- src/arch/x86_64/interrupt/handler.rs | 2 -- src/arch/x86_64/interrupt/syscall.rs | 2 +- src/arch/x86_64/mod.rs | 1 - src/arch/x86_64/paging/mod.rs | 2 +- src/arch/x86_64/rmm.rs | 3 +-- src/arch/x86_64/start.rs | 10 +++---- src/arch/x86_shared/device/ioapic.rs | 3 +-- src/arch/x86_shared/device/local_apic.rs | 4 +-- src/arch/x86_shared/idt.rs | 2 +- src/arch/x86_shared/interrupt/ipi.rs | 4 --- src/common/unique.rs | 3 --- src/context/arch/aarch64.rs | 2 -- src/context/arch/x86.rs | 2 -- src/context/arch/x86_64.rs | 6 +---- src/context/context.rs | 13 ++-------- src/context/file.rs | 2 +- src/context/list.rs | 2 +- src/context/memory.rs | 7 +++-- src/context/signal.rs | 26 +++++-------------- src/context/switch.rs | 2 +- src/log.rs | 2 -- src/main.rs | 7 ++--- src/memory/mod.rs | 12 +-------- src/scheme/acpi.rs | 6 ++--- src/scheme/debug.rs | 4 +-- src/scheme/event.rs | 2 +- src/scheme/irq.rs | 2 +- src/scheme/mod.rs | 2 +- src/scheme/pipe.rs | 4 +-- src/scheme/proc.rs | 8 +++--- src/scheme/root.rs | 2 +- src/scheme/serio.rs | 2 +- src/scheme/user.rs | 13 +++++----- src/syscall/fs.rs | 2 +- src/syscall/futex.rs | 8 +++--- src/syscall/mod.rs | 4 +-- src/syscall/process.rs | 10 +++---- src/syscall/usercopy.rs | 6 ----- 52 files changed, 105 insertions(+), 166 deletions(-) diff --git a/rustfmt.toml b/rustfmt.toml index 3c4f56848f..80e51d80d6 100644 --- a/rustfmt.toml +++ b/rustfmt.toml @@ -2,7 +2,7 @@ blank_lines_lower_bound = 0 blank_lines_upper_bound = 1 brace_style = "SameLineWhere" disable_all_formatting = false -edition = "2018" +edition = "2021" empty_item_single_line = true fn_single_line = false force_explicit_abi = true diff --git a/src/acpi/mod.rs b/src/acpi/mod.rs index 3ceaa96992..69fb286afb 100644 --- a/src/acpi/mod.rs +++ b/src/acpi/mod.rs @@ -6,10 +6,9 @@ use alloc::{boxed::Box, string::String, vec::Vec}; use hashbrown::HashMap; use spin::{Once, RwLock}; -use crate::{ - log::info, - paging::{KernelMapper, PageFlags, PhysicalAddress, RmmA, RmmArch}, -}; +use log::info; + +use crate::paging::{KernelMapper, PageFlags, PhysicalAddress, RmmA, RmmArch}; use self::{hpet::Hpet, madt::Madt, rsdp::RSDP, rsdt::Rsdt, rxsdt::Rxsdt, sdt::Sdt, xsdt::Xsdt}; diff --git a/src/arch/aarch64/device/generic_timer.rs b/src/arch/aarch64/device/generic_timer.rs index 0a0610e10f..26a501db4a 100644 --- a/src/arch/aarch64/device/generic_timer.rs +++ b/src/arch/aarch64/device/generic_timer.rs @@ -1,4 +1,4 @@ -use crate::log::{debug, info}; +use log::{debug, info}; use alloc::boxed::Box; use crate::{ diff --git a/src/arch/aarch64/device/irqchip/gic.rs b/src/arch/aarch64/device/irqchip/gic.rs index 834e6400fc..bbc515ee34 100644 --- a/src/arch/aarch64/device/irqchip/gic.rs +++ b/src/arch/aarch64/device/irqchip/gic.rs @@ -3,10 +3,8 @@ use core::ptr::{read_volatile, write_volatile}; use byteorder::{ByteOrder, BE}; use fdt::{DeviceTree, Node}; -use crate::{ - init::device_tree::find_compatible_node, - log::{debug, info}, -}; +use crate::init::device_tree::find_compatible_node; +use log::{debug, info}; use syscall::{ error::{Error, EINVAL}, Result, diff --git a/src/arch/aarch64/device/irqchip/gicv3.rs b/src/arch/aarch64/device/irqchip/gicv3.rs index 3b3a4c0ce0..114080cf17 100644 --- a/src/arch/aarch64/device/irqchip/gicv3.rs +++ b/src/arch/aarch64/device/irqchip/gicv3.rs @@ -4,10 +4,8 @@ use core::{arch::asm, ptr::{read_volatile, write_volatile}}; use byteorder::{ByteOrder, BE}; use fdt::{DeviceTree, Node}; -use crate::{ - init::device_tree::find_compatible_node, - log::{debug, info}, -}; +use crate::init::device_tree::find_compatible_node; +use log::{debug, info}; use super::gic::GicDistIf; use syscall::{ error::{Error, EINVAL}, diff --git a/src/arch/aarch64/device/irqchip/irq_bcm2835.rs b/src/arch/aarch64/device/irqchip/irq_bcm2835.rs index d49360cb4d..6a94ae7153 100644 --- a/src/arch/aarch64/device/irqchip/irq_bcm2835.rs +++ b/src/arch/aarch64/device/irqchip/irq_bcm2835.rs @@ -5,10 +5,9 @@ use crate::arch::device::irqchip::IRQ_CHIP; use byteorder::{ByteOrder, BE}; use fdt::{DeviceTree, Node}; -use crate::{ - init::device_tree::find_compatible_node, - log::{debug, error, info}, -}; +use crate::init::device_tree::find_compatible_node; +use log::{debug, error, info}; + use syscall::{ error::{Error, EINVAL}, Result, diff --git a/src/arch/aarch64/device/irqchip/irq_bcm2836.rs b/src/arch/aarch64/device/irqchip/irq_bcm2836.rs index f8488ef369..54b38e1536 100644 --- a/src/arch/aarch64/device/irqchip/irq_bcm2836.rs +++ b/src/arch/aarch64/device/irqchip/irq_bcm2836.rs @@ -6,10 +6,9 @@ use core::{ use byteorder::{ByteOrder, BE}; use fdt::{DeviceTree, Node}; -use crate::{ - init::device_tree::find_compatible_node, - log::{debug, info}, -}; +use crate::init::device_tree::find_compatible_node; +use log::{debug, info}; + use syscall::{ error::{Error, EINVAL}, Result, diff --git a/src/arch/aarch64/device/irqchip/mod.rs b/src/arch/aarch64/device/irqchip/mod.rs index 310589d303..6611fdf7d7 100644 --- a/src/arch/aarch64/device/irqchip/mod.rs +++ b/src/arch/aarch64/device/irqchip/mod.rs @@ -7,10 +7,8 @@ use byteorder::{ByteOrder, BE}; use fdt::DeviceTree; use syscall::Result; -use crate::{ - init::device_tree::travel_interrupt_ctrl, - log::{debug, error}, -}; +use crate::init::device_tree::travel_interrupt_ctrl; +use log::{debug, error}; mod gic; mod gicv3; diff --git a/src/arch/aarch64/device/mod.rs b/src/arch/aarch64/device/mod.rs index b6ffd59b4f..577116ed04 100644 --- a/src/arch/aarch64/device/mod.rs +++ b/src/arch/aarch64/device/mod.rs @@ -2,10 +2,10 @@ use core::arch::asm; use crate::{ dtb::DTB_BINARY, - log::info, memory::Frame, paging::{KernelMapper, Page, PageFlags, PhysicalAddress, VirtualAddress}, }; +use log::info; pub mod cpu; pub mod generic_timer; diff --git a/src/arch/aarch64/device/serial.rs b/src/arch/aarch64/device/serial.rs index 7220fb0ed1..06612683a0 100644 --- a/src/arch/aarch64/device/serial.rs +++ b/src/arch/aarch64/device/serial.rs @@ -5,8 +5,8 @@ use crate::{ device::uart_pl011::SerialPort, init::device_tree, interrupt::irq::trigger, - log::{debug, info}, }; +use log::{debug, info}; use super::irqchip::{register_irq, InterruptHandler, IRQ_CHIP}; use crate::{dtb::DTB_BINARY, init::device_tree::find_compatible_node}; diff --git a/src/arch/aarch64/init/device_tree/mod.rs b/src/arch/aarch64/init/device_tree/mod.rs index c542a72e86..3ea02eff27 100644 --- a/src/arch/aarch64/init/device_tree/mod.rs +++ b/src/arch/aarch64/init/device_tree/mod.rs @@ -2,13 +2,20 @@ extern crate byteorder; extern crate fdt; use self::byteorder::{ByteOrder, BE}; -use crate::{ - log::{debug, info}, - memory::MemoryArea, -}; use core::slice; use fdt::Node; +use log::{info, debug}; + +#[derive(Copy, Clone, Debug, Default)] +#[repr(C)] +pub struct MemoryArea { + pub base_addr: u64, + pub length: u64, + pub _type: u32, + pub acpi: u32, +} + pub static mut MEMORY_MAP: [MemoryArea; 512] = [MemoryArea { base_addr: 0, length: 0, diff --git a/src/arch/aarch64/start.rs b/src/arch/aarch64/start.rs index 2391e76197..d06f754a6d 100644 --- a/src/arch/aarch64/start.rs +++ b/src/arch/aarch64/start.rs @@ -16,9 +16,9 @@ use crate::{ allocator, device, dtb, init::device_tree, interrupt, - log::{self, info}, paging::{self, KernelMapper}, }; +use log::info; /// Test of zero values in BSS. static BSS_TEST_ZERO: usize = 0; @@ -81,7 +81,7 @@ pub unsafe extern "C" fn kstart(args_ptr: *const KernelArgs) -> ! { //graphical_debug::init(env); // Initialize logger - log::init_logger(|r| { + crate::log::init_logger(|r| { use core::fmt::Write; let _ = write!( crate::debug::Writer::new(), @@ -176,7 +176,7 @@ pub unsafe extern "C" fn kstart(args_ptr: *const KernelArgs) -> ! { //graphical_debug::init_heap(); // Activate memory logging - log::init(); + crate::log::init(); dtb::init(Some((crate::PHYS_OFFSET + args.dtb_base, args.dtb_size))); diff --git a/src/arch/x86/start.rs b/src/arch/x86/start.rs index d5fd523a0a..22bc350f3f 100644 --- a/src/arch/x86/start.rs +++ b/src/arch/x86/start.rs @@ -13,11 +13,11 @@ use crate::{ allocator, arch::{flags::*, pti}, device, gdt, idt, interrupt, - log::{self, info}, memory, paging::{self, KernelMapper, PhysicalAddress, RmmA, RmmArch, TableKind}, cpu_set::LogicalCpuId, }; +use log::info; /// Test of zero values in BSS. static BSS_TEST_ZERO: usize = 0; @@ -89,7 +89,7 @@ pub unsafe extern "C" fn kstart(args_ptr: *const KernelArgs) -> ! { device::system76_ec::init(); // Initialize logger - log::init_logger(|r| { + crate::log::init_logger(|r| { use core::fmt::Write; let _ = writeln!( super::debug::Writer::new(), @@ -183,7 +183,7 @@ pub unsafe extern "C" fn kstart(args_ptr: *const KernelArgs) -> ! { idt::init_paging_post_heap(LogicalCpuId::BSP); // Activate memory logging - log::init(); + crate::log::init(); // Initialize devices device::init(); diff --git a/src/arch/x86_64/gdt.rs b/src/arch/x86_64/gdt.rs index dee36266a1..f82eff0e23 100644 --- a/src/arch/x86_64/gdt.rs +++ b/src/arch/x86_64/gdt.rs @@ -1,7 +1,6 @@ //! Global descriptor table -use core::{cell::{Cell, RefCell}, convert::TryInto, mem::{self, size_of}}; -use core::sync::atomic::AtomicBool; +use core::{convert::TryInto, mem::size_of}; use crate::{ cpu_set::LogicalCpuId, diff --git a/src/arch/x86_64/interrupt/handler.rs b/src/arch/x86_64/interrupt/handler.rs index f0cac19176..74a96887b0 100644 --- a/src/arch/x86_64/interrupt/handler.rs +++ b/src/arch/x86_64/interrupt/handler.rs @@ -1,5 +1,3 @@ -use core::mem; - use crate::{memory::ArchIntCtx, syscall::IntRegisters}; use super::super::flags::*; diff --git a/src/arch/x86_64/interrupt/syscall.rs b/src/arch/x86_64/interrupt/syscall.rs index af7043d9c0..b542aaabf3 100644 --- a/src/arch/x86_64/interrupt/syscall.rs +++ b/src/arch/x86_64/interrupt/syscall.rs @@ -1,6 +1,6 @@ use crate::{ arch::{gdt, interrupt::InterruptStack}, - context, ptrace, syscall, + ptrace, syscall, syscall::flag::{PTRACE_FLAG_IGNORE, PTRACE_STOP_POST_SYSCALL, PTRACE_STOP_PRE_SYSCALL}, }; use core::mem::offset_of; diff --git a/src/arch/x86_64/mod.rs b/src/arch/x86_64/mod.rs index 3bc2d411fd..ee5fa059c7 100644 --- a/src/arch/x86_64/mod.rs +++ b/src/arch/x86_64/mod.rs @@ -1,5 +1,4 @@ pub use crate::arch::x86_shared::*; -use crate::cpu_set::LogicalCpuId; pub mod alternative; diff --git a/src/arch/x86_64/paging/mod.rs b/src/arch/x86_64/paging/mod.rs index b41f165ff5..cb74e08d58 100644 --- a/src/arch/x86_64/paging/mod.rs +++ b/src/arch/x86_64/paging/mod.rs @@ -6,7 +6,7 @@ use core::fmt::Debug; use x86::msr; pub use super::CurrentRmmArch as RmmA; -pub use rmm::{Arch as RmmArch, Flusher, PageFlags, PhysicalAddress, TableKind, VirtualAddress}; +pub use rmm::{Arch as RmmArch, PageFlags, PhysicalAddress, TableKind, VirtualAddress}; pub type PageMapper = rmm::PageMapper; pub use crate::rmm::KernelMapper; diff --git a/src/arch/x86_64/rmm.rs b/src/arch/x86_64/rmm.rs index 577f02231d..439df5d046 100644 --- a/src/arch/x86_64/rmm.rs +++ b/src/arch/x86_64/rmm.rs @@ -4,10 +4,9 @@ use core::{ sync::atomic::{self, AtomicUsize, Ordering}, }; use rmm::{ - Arch, BumpAllocator, FrameAllocator, FrameCount, FrameUsage, MemoryArea, PageFlags, PageMapper, + Arch, BumpAllocator, MemoryArea, PageFlags, PageMapper, PhysicalAddress, TableKind, VirtualAddress, KILOBYTE, MEGABYTE, }; -use spin::Mutex; use crate::{cpu_set::LogicalCpuId, memory::TheFrameAllocator}; diff --git a/src/arch/x86_64/start.rs b/src/arch/x86_64/start.rs index 1e185e4463..3f58db179d 100644 --- a/src/arch/x86_64/start.rs +++ b/src/arch/x86_64/start.rs @@ -5,6 +5,8 @@ use core::slice; use core::sync::atomic::{AtomicBool, AtomicU32, AtomicUsize, Ordering}; +use log::info; + #[cfg(feature = "acpi")] use crate::acpi; @@ -12,11 +14,9 @@ use crate::acpi; use crate::devices::graphical_debug; use crate::{ allocator, - arch::{flags::*, pti}, cpu_set::LogicalCpuId, device, gdt, idt, interrupt, - log::{self, info}, - memory, misc, + misc, paging::{self, PhysicalAddress, RmmA, RmmArch, TableKind}, }; @@ -90,7 +90,7 @@ pub unsafe extern "C" fn kstart(args_ptr: *const KernelArgs) -> ! { device::system76_ec::init(); // Initialize logger - log::init_logger(|r| { + crate::log::init_logger(|r| { use core::fmt::Write; let _ = writeln!( super::debug::Writer::new(), @@ -190,7 +190,7 @@ pub unsafe extern "C" fn kstart(args_ptr: *const KernelArgs) -> ! { idt::init_paging_post_heap(LogicalCpuId::BSP); // Activate memory logging - log::init(); + crate::log::init(); // Initialize miscellaneous processor features misc::init(LogicalCpuId::BSP); diff --git a/src/arch/x86_shared/device/ioapic.rs b/src/arch/x86_shared/device/ioapic.rs index 95fbcf3df5..f1f49a6811 100644 --- a/src/arch/x86_shared/device/ioapic.rs +++ b/src/arch/x86_shared/device/ioapic.rs @@ -11,7 +11,6 @@ use crate::{ memory::Frame, paging::{ entry::EntryFlags, KernelMapper, Page, PageFlags, PhysicalAddress, RmmA, RmmArch, - VirtualAddress, }, }; @@ -237,7 +236,7 @@ pub unsafe fn handle_ioapic(mapper: &mut KernelMapper, madt_ioapic: &'static Mad let frame = Frame::containing_address(PhysicalAddress::new(madt_ioapic.address as usize)); #[cfg(target_arch = "x86")] - let page = Page::containing_address(VirtualAddress::new(crate::IOAPIC_OFFSET)); + let page = Page::containing_address(rmm::VirtualAddress::new(crate::IOAPIC_OFFSET)); #[cfg(target_arch = "x86_64")] let page = Page::containing_address(RmmA::phys_to_virt(frame.start_address())); diff --git a/src/arch/x86_shared/device/local_apic.rs b/src/arch/x86_shared/device/local_apic.rs index 211cb8a92e..fa412a4e4e 100644 --- a/src/arch/x86_shared/device/local_apic.rs +++ b/src/arch/x86_shared/device/local_apic.rs @@ -4,7 +4,7 @@ use core::{ }; use x86::msr::*; -use crate::{paging::{KernelMapper, PageFlags, PhysicalAddress, RmmA, RmmArch, VirtualAddress}, ipi::IpiKind}; +use crate::{paging::{KernelMapper, PageFlags, PhysicalAddress, RmmA, RmmArch}, ipi::IpiKind}; use crate::arch::cpuid::cpuid; @@ -50,7 +50,7 @@ impl LocalApic { let physaddr = PhysicalAddress::new(rdmsr(IA32_APIC_BASE) as usize & 0xFFFF_0000); #[cfg(target_arch = "x86")] - let virtaddr = VirtualAddress::new(crate::LAPIC_OFFSET); + let virtaddr = rmm::VirtualAddress::new(crate::LAPIC_OFFSET); #[cfg(target_arch = "x86_64")] let virtaddr = RmmA::phys_to_virt(physaddr); diff --git a/src/arch/x86_shared/idt.rs b/src/arch/x86_shared/idt.rs index f2e1eeb37b..fbd9d6d634 100644 --- a/src/arch/x86_shared/idt.rs +++ b/src/arch/x86_shared/idt.rs @@ -311,10 +311,10 @@ pub unsafe fn init_generic(cpu_id: LogicalCpuId, idt: &mut Idt) { idt.set_reserved_mut(IpiKind::Switch as u8, true); idt.set_reserved_mut(IpiKind::Tlb as u8, true); idt.set_reserved_mut(IpiKind::Pit as u8, true); - let current_idt = &mut idt.entries; #[cfg(target_arch = "x86")] { + let current_idt = &mut idt.entries; // Set syscall function current_idt[0x80].set_func(syscall::syscall); current_idt[0x80].set_flags(IdtFlags::PRESENT | IdtFlags::RING_3 | IdtFlags::INTERRUPT); diff --git a/src/arch/x86_shared/interrupt/ipi.rs b/src/arch/x86_shared/interrupt/ipi.rs index ee84fbaff9..1652211bed 100644 --- a/src/arch/x86_shared/interrupt/ipi.rs +++ b/src/arch/x86_shared/interrupt/ipi.rs @@ -1,7 +1,3 @@ -use core::sync::atomic::Ordering; - -use x86::tlb; - use crate::percpu::PercpuBlock; use crate::{context, device::local_apic::LOCAL_APIC}; diff --git a/src/common/unique.rs b/src/common/unique.rs index 120f1c98eb..49888e9990 100644 --- a/src/common/unique.rs +++ b/src/common/unique.rs @@ -16,9 +16,6 @@ unsafe impl Send for Unique {} unsafe impl Sync for Unique {} impl Unique { - pub fn new(ptr: *mut T) -> Self { - Self(NonNull::new(ptr).expect("Did not expect pointer to be null")) - } pub unsafe fn new_unchecked(ptr: *mut T) -> Self { Self(NonNull::new_unchecked(ptr)) } diff --git a/src/context/arch/aarch64.rs b/src/context/arch/aarch64.rs index 16171244f4..e8cf26f3cb 100644 --- a/src/context/arch/aarch64.rs +++ b/src/context/arch/aarch64.rs @@ -23,8 +23,6 @@ pub static CONTEXT_SWITCH_LOCK: AtomicBool = AtomicBool::new(false); // 512 bytes for registers, extra bytes for fpcr and fpsr pub const KFX_ALIGN: usize = 16; -pub const KSTACK_SIZE: usize = 65536; -pub const KSTACK_ALIGN: usize = 16; #[derive(Clone, Debug)] pub struct Context { diff --git a/src/context/arch/x86.rs b/src/context/arch/x86.rs index f16d72d61f..e5dcb7f105 100644 --- a/src/context/arch/x86.rs +++ b/src/context/arch/x86.rs @@ -21,8 +21,6 @@ pub static CONTEXT_SWITCH_LOCK: AtomicBool = AtomicBool::new(false); const ST_RESERVED: u128 = 0xFFFF_FFFF_FFFF_0000_0000_0000_0000_0000; pub const KFX_ALIGN: usize = 16; -pub const KSTACK_SIZE: usize = 65536; -pub const KSTACK_ALIGN: usize = 16; #[derive(Clone, Debug)] #[repr(C)] diff --git a/src/context/arch/x86_64.rs b/src/context/arch/x86_64.rs index 64cf84cd00..7eb9d3847d 100644 --- a/src/context/arch/x86_64.rs +++ b/src/context/arch/x86_64.rs @@ -22,12 +22,8 @@ pub const KFX_ALIGN: usize = 16; #[cfg(not(cpu_feature_never = "xsave"))] pub const KFX_ALIGN: usize = 64; -pub const KSTACK_SIZE: usize = 65536; -// Why not, helps with guarding etc. -// TODO: Unmap the 63rd page, for stack guarding! Then re-map it onto the kernel heap when freeing. -// Use a RAII guard. -pub const KSTACK_ALIGN: usize = 4096; +// TODO: stack guarding? #[derive(Clone, Debug)] #[repr(C)] diff --git a/src/context/context.rs b/src/context/context.rs index 9105c99775..60f9ea7281 100644 --- a/src/context/context.rs +++ b/src/context/context.rs @@ -1,10 +1,10 @@ use alloc::{borrow::Cow, sync::Arc, vec::Vec}; -use syscall::{SigProcControl, Sigcontrol, SIGKILL, SIGSTOP, AtomicU64}; +use syscall::{SigProcControl, Sigcontrol}; use core::{cmp::Ordering, mem::{self, size_of}, num::NonZeroUsize}; use spin::RwLock; use crate::{ - arch::{interrupt::InterruptStack, paging::PAGE_SIZE}, common::aligned_box::AlignedBox, context::{self, arch, file::FileDescriptor, memory::AddrSpace}, cpu_set::{LogicalCpuId, LogicalCpuSet}, ipi::{ipi, IpiKind, IpiTarget}, memory::{allocate_p2frame, deallocate_p2frame, Enomem, Frame, RaiiFrame}, paging::{RmmA, RmmArch}, percpu::PercpuBlock, scheme::{CallerCtx, FileHandle, SchemeNamespace}, sync::WaitMap, + arch::{interrupt::InterruptStack, paging::PAGE_SIZE}, common::aligned_box::AlignedBox, context::{self, arch, file::FileDescriptor}, cpu_set::{LogicalCpuId, LogicalCpuSet}, ipi::{ipi, IpiKind, IpiTarget}, memory::{allocate_p2frame, deallocate_p2frame, Enomem, Frame, RaiiFrame}, paging::{RmmA, RmmArch}, percpu::PercpuBlock, scheme::{CallerCtx, FileHandle, SchemeNamespace}, sync::WaitMap, }; use crate::syscall::error::{Error, Result, EAGAIN, ESRCH}; @@ -592,15 +592,6 @@ impl Kstack { } } -const _: () = { - if PAGE_SIZE << 4 != arch::KSTACK_SIZE { - panic!(); - } - if arch::KSTACK_ALIGN > (PAGE_SIZE << 4) { - panic!(); - } -}; - impl Drop for Kstack { fn drop(&mut self) { unsafe { diff --git a/src/context/file.rs b/src/context/file.rs index 60ba29bb70..ab174748be 100644 --- a/src/context/file.rs +++ b/src/context/file.rs @@ -2,7 +2,7 @@ use crate::{ event, - scheme::{self, SchemeId, SchemeNamespace}, + scheme::{self, SchemeId}, syscall::error::{Error, Result, EBADF}, }; use alloc::sync::Arc; diff --git a/src/context/list.rs b/src/context/list.rs index 0061fdd629..313f19db77 100644 --- a/src/context/list.rs +++ b/src/context/list.rs @@ -106,7 +106,7 @@ impl ContextList { /// Spawn a context from a function. pub fn spawn(&mut self, userspace_allowed: bool, func: extern "C" fn()) -> Result<&Arc>> { - let mut stack = Kstack::new()?; + let stack = Kstack::new()?; let context_lock = self.new_context()?; { diff --git a/src/context/memory.rs b/src/context/memory.rs index e3bb7dd34c..005a2a9598 100644 --- a/src/context/memory.rs +++ b/src/context/memory.rs @@ -490,12 +490,15 @@ impl AddrSpaceWrapper { frame }; - match get_page_info(frame).expect("missing page info for Allocated grant").add_ref(RefKind::Shared) { + let frame = match get_page_info(frame).expect("missing page info for Allocated grant").add_ref(RefKind::Shared) { Ok(_) => Ok(unsafe { RaiiFrame::new_unchecked(frame) }), Err(AddRefError::RcOverflow) => Err(Error::new(ENOMEM)), Err(AddRefError::SharedToCow) => unreachable!(), Err(AddRefError::CowToShared) => unreachable!("if it was CoW, it was read-only, but in that case we already called correct_inner"), - } + }; + drop(guard); + + frame } } impl AddrSpace { diff --git a/src/context/signal.rs b/src/context/signal.rs index 9986c50746..bd39d168af 100644 --- a/src/context/signal.rs +++ b/src/context/signal.rs @@ -1,19 +1,7 @@ -use alloc::sync::Arc; -use core::{mem::size_of, sync::atomic::Ordering}; -use syscall::{ - flag::{ - PTRACE_FLAG_IGNORE, PTRACE_STOP_SIGNAL, SIGCHLD, SIGCONT, SIGKILL, SIGSTOP, SIGTERM, SIGTSTP, SIGTTIN, SIGTTOU - }, - ptrace_event, IntRegisters, SigcontrolFlags, -}; +use core::sync::atomic::Ordering; -use crate::{ - context::{self, switch, Status, WaitpidKey}, - ptrace, - syscall::usercopy::UserSlice, stop::{kstop, kreset}, -}; - -use super::ContextId; +use crate::context; +use crate::syscall::flag::{SIGKILL, SigcontrolFlags}; pub fn signal_handler() { let context_lock = context::current().expect("running signal handler outside of context"); @@ -31,7 +19,7 @@ pub fn signal_handler() { .and_then(|_| ptrace::next_breakpoint().map(|f| f.contains(PTRACE_FLAG_IGNORE)));*/ // TODO: thumbs_down - let Some((thread_ctl, proc_ctl, st)) = context.sigcontrol() else { + let Some((thread_ctl, _proc_ctl, st)) = context.sigcontrol() else { // Discard signal if sigcontrol is unset. log::trace!("no sigcontrol, returning"); return; @@ -75,11 +63,11 @@ pub fn signal_handler() { thread_ctl.control_flags.store((control_flags | SigcontrolFlags::INHIBIT_DELIVERY).bits(), Ordering::Release); } -pub fn excp_handler(signal: usize) { +pub fn excp_handler(_signal: usize) { let current = context::current().expect("CPU exception but not inside of context!"); - let mut context = current.write(); + let context = current.write(); - let Some(eh) = context.sig.as_ref().and_then(|s| s.excp_handler) else { + let Some(_eh) = context.sig.as_ref().and_then(|s| s.excp_handler) else { drop(context); crate::syscall::process::exit(SIGKILL << 8); }; diff --git a/src/context/switch.rs b/src/context/switch.rs index 9119757145..d0c7bd0370 100644 --- a/src/context/switch.rs +++ b/src/context/switch.rs @@ -8,7 +8,7 @@ use crate::{ context::{arch, contexts, Context}, cpu_set::LogicalCpuId, interrupt, percpu::PercpuBlock, ptrace, time }; -use super::{ContextId, Status}; +use super::ContextId; enum UpdateResult { CanSwitch, diff --git a/src/log.rs b/src/log.rs index d4151bb7dd..387b35fc8c 100644 --- a/src/log.rs +++ b/src/log.rs @@ -73,5 +73,3 @@ static mut LOGGER: RedoxLogger = RedoxLogger { log_func: |_| {}, initialized: AtomicBool::new(false), }; - -pub use log::{debug, error, info, set_max_level, warn}; diff --git a/src/main.rs b/src/main.rs index c101fc05ec..f53186f804 100644 --- a/src/main.rs +++ b/src/main.rs @@ -72,16 +72,16 @@ mod common; /// Architecture-dependent stuff #[macro_use] +#[allow(dead_code)] // TODO mod arch; use crate::arch::*; -use crate::log::info; - /// Heap allocators mod allocator; /// ACPI table parsing #[cfg(all(feature = "acpi", any(target_arch = "x86", target_arch = "x86_64")))] +#[allow(dead_code)] // TODO mod acpi; #[cfg(all(any(target_arch = "aarch64")))] @@ -111,6 +111,7 @@ mod externs; /// Logging mod log; +use ::log::info; /// Memory management mod memory; @@ -263,7 +264,7 @@ pub fn ksignal(signal: usize) { { let contexts = context::contexts(); if let Some(context_lock) = contexts.current() { - let mut context = context_lock.write(); + let context = context_lock.read(); info!("NAME {}", context.name); } } diff --git a/src/memory/mod.rs b/src/memory/mod.rs index 145aa40cf4..0cccecbd6c 100644 --- a/src/memory/mod.rs +++ b/src/memory/mod.rs @@ -19,16 +19,6 @@ use rmm::{ }; use crate::syscall::error::{ENOMEM, Error}; -/// A memory map area -#[derive(Copy, Clone, Debug, Default)] -#[repr(packed)] -pub struct MemoryArea { - pub base_addr: u64, - pub length: u64, - pub _type: u32, - pub acpi: u32, -} - /// Get the number of frames available pub fn free_frames() -> usize { total_frames() - used_frames() @@ -125,7 +115,7 @@ pub unsafe fn deallocate_p2frame(orig_frame: Frame, order: u32) { let sibling = Frame::containing_address(PhysicalAddress::new(current.start_address().data() ^ (PAGE_SIZE << merge_order))); - let Some(_) = get_page_info(current) else { + let Some(_cur_info) = get_page_info(current) else { unreachable!("attempting to free non-allocator-owned page"); }; diff --git a/src/scheme/acpi.rs b/src/scheme/acpi.rs index 9161a949dc..224b708da7 100644 --- a/src/scheme/acpi.rs +++ b/src/scheme/acpi.rs @@ -17,9 +17,9 @@ use crate::syscall::{ error::{Error, Result, EACCES, EBADF, EBADFD, EINTR, EINVAL, EISDIR, ENOENT, ENOTDIR, EROFS}, flag::{ EventFlags, EVENT_READ, MODE_CHR, MODE_DIR, MODE_FILE, O_ACCMODE, O_CREAT, O_DIRECTORY, - O_EXCL, O_RDONLY, O_STAT, O_SYMLINK, SEEK_CUR, SEEK_END, SEEK_SET, + O_EXCL, O_RDONLY, O_STAT, O_SYMLINK, }, - usercopy::{UserSliceRo, UserSliceWo}, + usercopy::UserSliceWo, }; use super::{CallerCtx, GlobalSchemes, KernelScheme, OpenResult}; @@ -186,7 +186,7 @@ impl KernelScheme for AcpiScheme { } Ok(()) } - fn kreadoff(&self, id: usize, dst_buf: UserSliceWo, offset: u64, flags: u32, stored_flags: u32) -> Result { + fn kreadoff(&self, id: usize, dst_buf: UserSliceWo, offset: u64, _flags: u32, _stored_flags: u32) -> Result { let Ok(offset) = usize::try_from(offset) else { return Ok(0); }; diff --git a/src/scheme/debug.rs b/src/scheme/debug.rs index f4baa3556b..75067f1d90 100644 --- a/src/scheme/debug.rs +++ b/src/scheme/debug.rs @@ -7,7 +7,7 @@ use crate::{ scheme::*, sync::WaitQueue, syscall::{ - flag::{EventFlags, EVENT_READ, F_GETFL, F_SETFL, O_ACCMODE, O_NONBLOCK}, + flag::{EventFlags, EVENT_READ, O_NONBLOCK}, usercopy::{UserSliceRo, UserSliceWo}, }, }; @@ -95,7 +95,7 @@ impl KernelScheme for DebugScheme { Ok(()) } fn kread(&self, id: usize, buf: UserSliceWo, flags: u32, _stored_flags: u32) -> Result { - let handle = { + let _handle = { let handles = HANDLES.read(); *handles.get(&id).ok_or(Error::new(EBADF))? }; diff --git a/src/scheme/event.rs b/src/scheme/event.rs index 04c7819106..48e3df1265 100644 --- a/src/scheme/event.rs +++ b/src/scheme/event.rs @@ -41,7 +41,7 @@ impl KernelScheme for EventScheme { queue.read(buf, flags & O_NONBLOCK as u32 == 0) } - fn kwrite(&self, id: usize, buf: UserSliceRo, flags: u32, _stored_flags: u32) -> Result { + fn kwrite(&self, id: usize, buf: UserSliceRo, _flags: u32, _stored_flags: u32) -> Result { let id = EventQueueId::from(id); let queue = { diff --git a/src/scheme/irq.rs b/src/scheme/irq.rs index 93d1d36f56..8eabbb699f 100644 --- a/src/scheme/irq.rs +++ b/src/scheme/irq.rs @@ -353,7 +353,7 @@ impl crate::scheme::KernelScheme for IrqScheme { buf.copy_common_bytes_from_slice(&scheme_path) } - fn kreadoff(&self, file: usize, buffer: UserSliceWo, offset: u64, flags: u32, _stored_flags: u32) -> Result { + fn kreadoff(&self, file: usize, buffer: UserSliceWo, offset: u64, _flags: u32, _stored_flags: u32) -> Result { let handles_guard = HANDLES.read(); let handle = handles_guard.get(&file).ok_or(Error::new(EBADF))?; diff --git a/src/scheme/mod.rs b/src/scheme/mod.rs index 367a7597dd..bc95e88b45 100644 --- a/src/scheme/mod.rs +++ b/src/scheme/mod.rs @@ -10,7 +10,7 @@ use alloc::{boxed::Box, collections::BTreeMap, string::ToString, sync::Arc, vec: use core::sync::atomic::AtomicUsize; use hashbrown::HashMap; use spin::{Once, RwLock, RwLockReadGuard, RwLockWriteGuard}; -use syscall::{EventFlags, MunmapFlags, SendFdFlags, SEEK_CUR, SEEK_END, SEEK_SET}; +use syscall::{EventFlags, MunmapFlags, SendFdFlags}; use crate::{ context::{file::{FileDescription, InternalFlags}, memory::AddrSpaceWrapper}, diff --git a/src/scheme/pipe.rs b/src/scheme/pipe.rs index 4bdd21951a..70187b3e02 100644 --- a/src/scheme/pipe.rs +++ b/src/scheme/pipe.rs @@ -10,9 +10,9 @@ use spin::{Mutex, RwLock}; use crate::{ context::file::InternalFlags, event, sync::WaitCondition, syscall::{ data::Stat, - error::{Error, Result, EAGAIN, EBADF, EINTR, EINVAL, ENOENT, EPIPE, ESPIPE}, + error::{Error, Result, EAGAIN, EBADF, EINTR, EINVAL, ENOENT, EPIPE}, flag::{ - EventFlags, EVENT_READ, EVENT_WRITE, F_GETFL, F_SETFL, MODE_FIFO, O_ACCMODE, O_NONBLOCK, + EventFlags, EVENT_READ, EVENT_WRITE, MODE_FIFO, O_NONBLOCK, }, usercopy::{UserSliceRo, UserSliceWo}, } diff --git a/src/scheme/proc.rs b/src/scheme/proc.rs index 53821fe5ac..59325c332d 100644 --- a/src/scheme/proc.rs +++ b/src/scheme/proc.rs @@ -1,7 +1,7 @@ use crate::{ arch::paging::{Page, RmmA, RmmArch, VirtualAddress}, context::{ - self, context::{HardBlockedReason, SignalState}, file::{FileDescriptor, InternalFlags}, memory::{handle_notify_files, AddrSpace, AddrSpaceWrapper, Grant, PageSpan}, Context, ContextId, Status + self, context::{HardBlockedReason, SignalState}, file::{FileDescriptor, InternalFlags}, memory::{handle_notify_files, AddrSpaceWrapper, Grant, PageSpan}, Context, ContextId, Status }, memory::PAGE_SIZE, ptrace, @@ -729,7 +729,7 @@ impl KernelScheme for ProcScheme { _ => Err(Error::new(EBADF)), } } - fn kreadoff(&self, id: usize, buf: UserSliceWo, offset: u64, read_flags: u32, _stored_flags: u32) -> Result { + fn kreadoff(&self, id: usize, buf: UserSliceWo, offset: u64, _read_flags: u32, _stored_flags: u32) -> Result { // Don't hold a global lock during the context switch later on let info = { let handles = HANDLES.read(); @@ -943,7 +943,7 @@ impl KernelScheme for ProcScheme { _ => Err(Error::new(EBADF)), } } - fn kwriteoff(&self, id: usize, buf: UserSliceRo, _offset: u64, fcntl_flags: u32, _stored_flags: u32) -> Result { + fn kwriteoff(&self, id: usize, buf: UserSliceRo, _offset: u64, _fcntl_flags: u32, _stored_flags: u32) -> Result { // TODO: offset // Don't hold a global lock during the context switch later on @@ -1138,8 +1138,6 @@ impl KernelScheme for ProcScheme { } let state = if data.thread_control_addr != 0 && data.proc_control_addr != 0 { - let offset = u16::try_from(data.thread_control_addr % PAGE_SIZE).unwrap(); - let validate_off = |addr, sz| { let off = addr % PAGE_SIZE; if off % mem::align_of::() == 0 && off + sz <= PAGE_SIZE { diff --git a/src/scheme/root.rs b/src/scheme/root.rs index 1a13adddf2..4c7b0a2e16 100644 --- a/src/scheme/root.rs +++ b/src/scheme/root.rs @@ -5,7 +5,7 @@ use core::{ sync::atomic::{AtomicUsize, Ordering}, }; use hashbrown::HashMap; -use spin::{Mutex, RwLock}; +use spin::RwLock; use crate::{ context::{self, file::InternalFlags}, diff --git a/src/scheme/serio.rs b/src/scheme/serio.rs index 0050e5f87e..5b95a43c86 100644 --- a/src/scheme/serio.rs +++ b/src/scheme/serio.rs @@ -12,7 +12,7 @@ use crate::{ scheme::*, sync::WaitQueue, syscall::{ - flag::{EventFlags, EVENT_READ, F_GETFL, F_SETFL, O_ACCMODE, O_NONBLOCK}, + flag::{EventFlags, EVENT_READ, O_NONBLOCK}, usercopy::UserSliceWo, }, }; diff --git a/src/scheme/user.rs b/src/scheme/user.rs index db114937bc..9a6095fd52 100644 --- a/src/scheme/user.rs +++ b/src/scheme/user.rs @@ -11,18 +11,17 @@ use core::{ sync::atomic::{AtomicBool, Ordering}, usize, }; -use hashbrown::hash_map::{Entry, HashMap}; use spin::{Mutex, RwLock}; use spinning_top::RwSpinlock; use syscall::{ - schemev2::{Cqe, CqeOpcode, Opcode, Sqe, SqeFlags}, FobtainFdFlags, MunmapFlags, SendFdFlags, F_SETFL, KSMSG_CANCEL, MAP_FIXED_NOREPLACE, SIGKILL, SKMSG_FOBTAINFD, SKMSG_FRETURNFD, SKMSG_PROVIDE_MMAP + schemev2::{Cqe, CqeOpcode, Opcode, Sqe, SqeFlags}, FobtainFdFlags, MunmapFlags, SendFdFlags, F_SETFL, KSMSG_CANCEL, MAP_FIXED_NOREPLACE, SKMSG_FOBTAINFD, SKMSG_FRETURNFD, SKMSG_PROVIDE_MMAP }; use crate::{ context::{ self, context::HardBlockedReason, file::{FileDescription, FileDescriptor, InternalFlags}, memory::{ AddrSpace, AddrSpaceWrapper, BorrowedFmapSource, Grant, GrantFileRef, MmapMode, PageSpan, DANGLING - }, BorrowedHtBuf, Context, ContextId, Status + }, BorrowedHtBuf, Context, Status }, event, memory::Frame, @@ -620,7 +619,7 @@ impl UserInner { dst.copy_exactly(&self.translate_sqe_to_packet(&sqe)?)?; bytes_read += size_of::(); } - Err(error) if bytes_read > 0 => return Ok(bytes_read), + Err(_error) if bytes_read > 0 => return Ok(bytes_read), Err(Error { errno: EAGAIN }) if self.unmounting.load(Ordering::SeqCst) => return Ok(bytes_read), Err(error) => return Err(error), } @@ -740,7 +739,7 @@ impl UserInner { pub fn request_fmap( &self, id: usize, - offset: u64, + _offset: u64, required_page_count: usize, flags: MapFlags, ) -> Result<()> { @@ -1200,7 +1199,7 @@ impl KernelScheme for UserScheme { let address = inner.copy_and_capture_tail(path.as_bytes())?; match inner.call_extended(ctx, None, Opcode::Open, [address.base(), address.len(), flags])? { Response::Regular(code, fl) => Ok({ - let fd = Error::demux(code)?; + let _ = Error::demux(code)?; OpenResult::SchemeLocal(code, InternalFlags::from_extra0(fl).ok_or(Error::new(EINVAL))?) }), Response::Fd(desc) => Ok(OpenResult::External(desc)), @@ -1401,7 +1400,7 @@ impl KernelScheme for UserScheme { number: usize, desc: Arc>, flags: SendFdFlags, - arg: u64, + _arg: u64, ) -> Result { let inner = self.inner.upgrade().ok_or(Error::new(ENODEV))?; diff --git a/src/syscall/fs.rs b/src/syscall/fs.rs index 4fc47196da..555a95bada 100644 --- a/src/syscall/fs.rs +++ b/src/syscall/fs.rs @@ -6,7 +6,7 @@ use spin::RwLock; use crate::{ context::{self, file::{FileDescription, FileDescriptor, InternalFlags}, memory::{AddrSpace, PageSpan}}, paging::{Page, VirtualAddress, PAGE_SIZE}, - scheme::{self, CallerCtx, FileHandle, KernelScheme, OpenResult, SchemeId}, + scheme::{self, CallerCtx, FileHandle, KernelScheme, OpenResult}, syscall::{data::Stat, error::*, flag::*}, }; diff --git a/src/syscall/futex.rs b/src/syscall/futex.rs index 6d66c4bcf5..0870e904e9 100644 --- a/src/syscall/futex.rs +++ b/src/syscall/futex.rs @@ -7,7 +7,7 @@ use syscall::EINTR; use core::sync::atomic::{AtomicU32, Ordering}; use rmm::Arch; use spin::RwLock; -use spinning_top::{guard::RwSpinlockUpgradableReadGuard, RwSpinlock}; +use spinning_top::RwSpinlock; use crate::{ context::{self, memory::{AddrSpace, AddrSpaceWrapper}, Context}, @@ -18,8 +18,8 @@ use crate::{ use crate::syscall::{ data::TimeSpec, - error::{Error, Result, EAGAIN, EFAULT, EINVAL, ESRCH, ETIMEDOUT}, - flag::{FUTEX_REQUEUE, FUTEX_WAIT, FUTEX_WAIT64, FUTEX_WAKE}, + error::{Error, Result, EAGAIN, EFAULT, EINVAL, ETIMEDOUT}, + flag::{FUTEX_WAIT, FUTEX_WAIT64, FUTEX_WAKE}, }; use super::usercopy::UserSlice; @@ -60,7 +60,7 @@ fn validate_and_translate_virt(space: &AddrSpace, addr: VirtualAddress) -> Optio Some(frame.add(off)) } -pub fn futex(addr: usize, op: usize, val: usize, val2: usize, addr2: usize) -> Result { +pub fn futex(addr: usize, op: usize, val: usize, val2: usize, _addr2: usize) -> Result { let current_addrsp = AddrSpace::current()?; // Keep the address space locked so we can safely read from the physical address. Unlock it diff --git a/src/syscall/mod.rs b/src/syscall/mod.rs index b48e2f9b8d..707ed2b9d1 100644 --- a/src/syscall/mod.rs +++ b/src/syscall/mod.rs @@ -16,7 +16,7 @@ pub use self::{ use self::{ data::{Map, TimeSpec}, - error::{Error, Result, EINTR, EOVERFLOW, ENOSYS}, + error::{Error, Result, EOVERFLOW, ENOSYS}, flag::{EventFlags, MapFlags, WaitFlags}, number::*, usercopy::UserSlice, @@ -66,7 +66,7 @@ pub fn syscall( d: usize, e: usize, f: usize, - stack: &mut InterruptStack, + _stack: &mut InterruptStack, ) -> usize { #[inline(always)] fn inner( diff --git a/src/syscall/process.rs b/src/syscall/process.rs index 662421d65d..0631f1ebce 100644 --- a/src/syscall/process.rs +++ b/src/syscall/process.rs @@ -6,7 +6,7 @@ use rmm::Arch; use spin::RwLock; use crate::context::{ - memory::{AddrSpace, Grant, PageSpan}, switch::SwitchResult, ContextId, WaitpidKey + memory::{AddrSpace, Grant, PageSpan}, ContextId, WaitpidKey }; use crate::{ @@ -24,7 +24,7 @@ use crate::{ Bootstrap, CurrentRmmArch, }; -use super::usercopy::{UserSliceRo, UserSliceWo, UserSlice}; +use super::usercopy::UserSliceWo; pub fn exit(status: usize) -> ! { ptrace::breakpoint_callback( @@ -106,7 +106,7 @@ pub fn exit(status: usize) -> ! { ptrace::close_tracee(pid); } - let _ = unsafe { context::switch() }; + let _ = context::switch(); unreachable!(); } @@ -187,7 +187,7 @@ pub fn kill(pid: ContextId, sig: usize, parent_sigchld: bool) -> Result { // will additionally ignore, defer, or handle that signal. context.status = context::Status::Runnable; - if let Some((tctl, pctl, st)) = context.sigcontrol() { + if let Some((tctl, pctl, _st)) = context.sigcontrol() { if !pctl.signal_will_ign(SIGCONT, false) { tctl.word[0].fetch_or(sig_bit(SIGCONT), Ordering::Relaxed); } @@ -212,7 +212,7 @@ pub fn kill(pid: ContextId, sig: usize, parent_sigchld: bool) -> Result { // exit() will signal the parent, rather than immediately in kill() SendResult::Succeeded - } else if let Some((tctl, pctl, st)) = context.sigcontrol() && !pctl.signal_will_ign(sig, parent_sigchld) { + } else if let Some((tctl, pctl, _st)) = context.sigcontrol() && !pctl.signal_will_ign(sig, parent_sigchld) { let _was_new = tctl.word[sig_group].fetch_or(sig_bit(sig), Ordering::Relaxed); if (tctl.word[sig_group].load(Ordering::Relaxed) >> 32) & sig_bit(sig) != 0 { context.unblock(); diff --git a/src/syscall/usercopy.rs b/src/syscall/usercopy.rs index d4e1c4f3bd..0a2b752a5a 100644 --- a/src/syscall/usercopy.rs +++ b/src/syscall/usercopy.rs @@ -192,12 +192,6 @@ impl UserSlice { .copy_from_slice(&int.to_ne_bytes())?; Ok(()) } - pub fn write_u64(self, int: u64) -> Result<()> { - self.limit(core::mem::size_of::()) - .ok_or(Error::new(EINVAL))? - .copy_from_slice(&int.to_ne_bytes())?; - Ok(()) - } } impl UserSliceRo {