From e210393184b27ae2984f66bffc936d10cd828e97 Mon Sep 17 00:00:00 2001 From: Josh Junon Date: Wed, 11 Sep 2024 22:20:37 +0200 Subject: [PATCH] mem: combine `PageFrameAllocate` and `PageFrameFree` into `Alloc` --- oro-arch-aarch64/src/boot/memory.rs | 2 +- oro-arch-aarch64/src/boot/secondary.rs | 6 +++--- oro-arch-aarch64/src/mem/address_space.rs | 10 +++++----- oro-arch-aarch64/src/mem/segment.rs | 16 +++++++-------- oro-arch-x86_64/src/boot/memory.rs | 2 +- oro-arch-x86_64/src/boot/secondary.rs | 4 ++-- oro-arch-x86_64/src/mem/address_space.rs | 12 ++++-------- oro-arch-x86_64/src/mem/segment.rs | 18 ++++++++--------- oro-boot/src/pfa.rs | 8 ++------ oro-boot/src/target/aarch64.rs | 4 ++-- oro-boot/src/target/x86_64.rs | 4 ++-- oro-kernel/src/lib.rs | 10 +++++----- oro-kernel/src/registry.rs | 24 +++++++---------------- oro-mem/src/mapper.rs | 19 ++++++++---------- oro-mem/src/pfa/alloc.rs | 14 +------------ oro-mem/src/pfa/filo.rs | 13 ++---------- 16 files changed, 62 insertions(+), 104 deletions(-) diff --git a/oro-arch-aarch64/src/boot/memory.rs b/oro-arch-aarch64/src/boot/memory.rs index 0b9baeb5..102de1ac 100644 --- a/oro-arch-aarch64/src/boot/memory.rs +++ b/oro-arch-aarch64/src/boot/memory.rs @@ -16,7 +16,7 @@ use oro_boot_protocol::{memory_map::MemoryMapKind, MemoryMapEntry, MemoryMapEntr use oro_debug::{dbg, dbg_warn}; use oro_macro::assert; use oro_mem::{ - pfa::{alloc::PageFrameFree, filo::FiloPageFrameAllocator}, + pfa::{alloc::Alloc, filo::FiloPageFrameAllocator}, translate::{OffsetTranslator, Translator}, }; diff --git a/oro-arch-aarch64/src/boot/secondary.rs b/oro-arch-aarch64/src/boot/secondary.rs index 830ee3a1..945436fc 100644 --- a/oro-arch-aarch64/src/boot/secondary.rs +++ b/oro-arch-aarch64/src/boot/secondary.rs @@ -12,7 +12,7 @@ use oro_dtb::{FdtHeader, FdtPathFilter, FdtToken}; use oro_macro::{asm_buffer, assert}; use oro_mem::{ mapper::{AddressSegment, AddressSpace, MapError}, - pfa::alloc::PageFrameFree, + pfa::alloc::Alloc, translate::{OffsetTranslator, Translator}, }; use oro_type::Be; @@ -26,7 +26,7 @@ use oro_type::Be; /// This function is inherently unsafe and must only be called /// once at kernel boot by the bootstrap processor (primary core). pub unsafe fn boot_secondaries( - pfa: &mut impl PageFrameFree, + pfa: &mut impl Alloc, pat: &OffsetTranslator, stack_pages: usize, ) -> usize { @@ -317,7 +317,7 @@ const SECONDARY_BOOT_STUB: &[u8] = &asm_buffer! { /// Attempts to boot a single secondary core. unsafe fn boot_secondary( - pfa: &mut impl PageFrameFree, + pfa: &mut impl Alloc, pat: &OffsetTranslator, psci: PsciMethod, cpu_id: u64, diff --git a/oro-arch-aarch64/src/mem/address_space.rs b/oro-arch-aarch64/src/mem/address_space.rs index a362024a..58f52ff6 100644 --- a/oro-arch-aarch64/src/mem/address_space.rs +++ b/oro-arch-aarch64/src/mem/address_space.rs @@ -12,7 +12,7 @@ use crate::{ }, reg::tcr_el1::TcrEl1, }; -use oro_mem::{mapper::AddressSpace, pfa::alloc::PageFrameAllocate, translate::Translator}; +use oro_mem::{mapper::AddressSpace, pfa::alloc::Alloc, translate::Translator}; /// A lightweight handle to an address space. pub struct AddressSpaceHandle { @@ -180,7 +180,7 @@ impl AddressSpaceLayout { virt_start: usize, ) -> Option where - A: PageFrameAllocate, + A: Alloc, P: Translator, { let base_phys = alloc.allocate()?; @@ -205,7 +205,7 @@ impl AddressSpaceLayout { translator: &P, ) -> Option<::SupervisorHandle> where - A: PageFrameAllocate, + A: Alloc, P: Translator, { unsafe { Self::new_supervisor_space_with_start(alloc, translator, 0) } @@ -265,7 +265,7 @@ unsafe impl AddressSpace for AddressSpaceLayout { fn new_supervisor_space(alloc: &mut A, translator: &P) -> Option where - A: PageFrameAllocate, + A: Alloc, P: Translator, { // NOTE(qix-): We currently specify that the kernel uses `TCR_EL1.TnSZ=16`, @@ -281,7 +281,7 @@ unsafe impl AddressSpace for AddressSpaceLayout { translator: &P, ) -> Option where - A: PageFrameAllocate, + A: Alloc, P: Translator, { let base_phys = alloc.allocate()?; diff --git a/oro-arch-aarch64/src/mem/segment.rs b/oro-arch-aarch64/src/mem/segment.rs index f54fa5e0..f5945cdd 100644 --- a/oro-arch-aarch64/src/mem/segment.rs +++ b/oro-arch-aarch64/src/mem/segment.rs @@ -20,7 +20,7 @@ use core::panic; use oro_macro::unlikely; use oro_mem::{ mapper::{AddressSegment, MapError, UnmapError}, - pfa::alloc::{PageFrameAllocate, PageFrameFree}, + pfa::alloc::Alloc, translate::Translator, }; @@ -67,7 +67,7 @@ impl Segment { virt: usize, ) -> Result<&'a mut PageTableEntry, MapError> where - A: PageFrameAllocate, + A: Alloc, P: Translator, { let virt = virt @@ -189,7 +189,7 @@ impl Segment { virt: usize, ) -> Result, UnmapError> where - A: PageFrameAllocate + PageFrameFree, + A: Alloc, P: Translator, { let virt = virt @@ -315,7 +315,7 @@ unsafe impl AddressSegment for &'static Segment { translator: &P, ) -> Result<(), MapError> where - A: PageFrameAllocate + PageFrameFree, + A: Alloc, P: Translator, { let top_level = unsafe { &mut *translator.translate_mut::(space.base_phys) }; @@ -346,7 +346,7 @@ unsafe impl AddressSegment for &'static Segment { phys: u64, ) -> Result<(), MapError> where - A: PageFrameAllocate + PageFrameFree, + A: Alloc, P: Translator, { // NOTE(qix-): The mapper doesn't actually free anything, @@ -363,7 +363,7 @@ unsafe impl AddressSegment for &'static Segment { phys: u64, ) -> Result<(), MapError> where - A: PageFrameAllocate, + A: Alloc, P: Translator, { let l3_entry = self.entry(space, alloc, translator, virt)?; @@ -397,7 +397,7 @@ unsafe impl AddressSegment for &'static Segment { virt: usize, ) -> Result where - A: PageFrameAllocate + PageFrameFree, + A: Alloc, P: Translator, { let phys = unsafe { self.try_unmap(space, alloc, translator, virt)? }; @@ -414,7 +414,7 @@ unsafe impl AddressSegment for &'static Segment { phys: u64, ) -> Result, MapError> where - A: PageFrameAllocate + PageFrameFree, + A: Alloc, P: Translator, { let l3_entry = self.entry(space, alloc, translator, virt)?; diff --git a/oro-arch-x86_64/src/boot/memory.rs b/oro-arch-x86_64/src/boot/memory.rs index ca53683a..6b0f53ac 100644 --- a/oro-arch-x86_64/src/boot/memory.rs +++ b/oro-arch-x86_64/src/boot/memory.rs @@ -14,7 +14,7 @@ use oro_debug::{dbg, dbg_warn}; use oro_macro::assert; use oro_mem::{ mapper::AddressSegment as _, - pfa::{alloc::PageFrameFree, filo::FiloPageFrameAllocator}, + pfa::{alloc::Alloc, filo::FiloPageFrameAllocator}, translate::{OffsetTranslator, Translator}, }; diff --git a/oro-arch-x86_64/src/boot/secondary.rs b/oro-arch-x86_64/src/boot/secondary.rs index 8423c3ed..067ebfda 100644 --- a/oro-arch-x86_64/src/boot/secondary.rs +++ b/oro-arch-x86_64/src/boot/secondary.rs @@ -14,7 +14,7 @@ use oro_debug::{dbg, dbg_err}; use oro_macro::{asm_buffer, assert}; use oro_mem::{ mapper::{AddressSegment, AddressSpace, MapError, UnmapError}, - pfa::alloc::{PageFrameAllocate, PageFrameFree}, + pfa::alloc::Alloc, translate::{OffsetTranslator, Translator}, }; @@ -46,7 +46,7 @@ pub enum BootError { /// /// Caller must ensure these pages are mapped (via the PAT) and accessible. #[expect(clippy::missing_docs_in_private_items)] -pub unsafe fn boot_secondary( +pub unsafe fn boot_secondary( primary_handle: &AddressSpaceHandle, pfa: &mut A, pat: &OffsetTranslator, diff --git a/oro-arch-x86_64/src/mem/address_space.rs b/oro-arch-x86_64/src/mem/address_space.rs index 13b95dea..28eb5276 100644 --- a/oro-arch-x86_64/src/mem/address_space.rs +++ b/oro-arch-x86_64/src/mem/address_space.rs @@ -7,7 +7,7 @@ use crate::{ asm::cr3, mem::{paging::PageTableEntry, segment::AddressSegment}, }; -use oro_mem::{mapper::AddressSpace, pfa::alloc::PageFrameAllocate, translate::Translator}; +use oro_mem::{mapper::AddressSpace, pfa::alloc::Alloc, translate::Translator}; /// A handle to an address space for the x86_64 architecture. /// @@ -174,7 +174,7 @@ unsafe impl AddressSpace for AddressSpaceLayout { fn new_supervisor_space(alloc: &mut A, translator: &P) -> Option where - A: PageFrameAllocate, + A: Alloc, P: Translator, { let base_phys = alloc.allocate()?; @@ -189,15 +189,11 @@ unsafe impl AddressSpace for AddressSpaceLayout { }) } - fn duplicate_supervisor_space_shallow( + fn duplicate_supervisor_space_shallow( space: &Self::SupervisorHandle, alloc: &mut A, translator: &P, - ) -> Option - where - A: PageFrameAllocate, - P: Translator, - { + ) -> Option { let base_phys = alloc.allocate()?; unsafe { diff --git a/oro-arch-x86_64/src/mem/segment.rs b/oro-arch-x86_64/src/mem/segment.rs index 9ff597c1..5cf2ed3e 100644 --- a/oro-arch-x86_64/src/mem/segment.rs +++ b/oro-arch-x86_64/src/mem/segment.rs @@ -7,7 +7,7 @@ use crate::mem::{paging::PageTableEntry, paging_level::PagingLevel}; use oro_macro::unlikely; use oro_mem::{ mapper::{AddressSegment as Segment, MapError, UnmapError}, - pfa::alloc::{PageFrameAllocate, PageFrameFree}, + pfa::alloc::Alloc, translate::Translator, }; @@ -71,7 +71,7 @@ impl AddressSegment { virt: usize, ) -> Result<&'a mut PageTableEntry, MapError> where - A: PageFrameAllocate, + A: Alloc, P: Translator, { if unlikely!(virt & 0xFFF != 0) { @@ -142,7 +142,7 @@ impl AddressSegment { virt: usize, ) -> Result, UnmapError> where - A: PageFrameAllocate + PageFrameFree, + A: Alloc, P: Translator, { if unlikely!(virt & 0xFFF != 0) { @@ -236,7 +236,7 @@ impl AddressSegment { virt: usize, ) -> Result, UnmapError> where - A: PageFrameAllocate + PageFrameFree, + A: Alloc, P: Translator, { if unlikely!(virt & 0xFFF != 0) { @@ -381,7 +381,7 @@ unsafe impl Segment for &'static AddressSegment { translator: &P, ) -> Result<(), MapError> where - A: PageFrameAllocate + PageFrameFree, + A: Alloc, P: Translator, { let top_level = unsafe { &mut *translator.translate_mut::(space.base_phys()) }; @@ -412,7 +412,7 @@ unsafe impl Segment for &'static AddressSegment { phys: u64, ) -> Result<(), MapError> where - A: PageFrameAllocate + PageFrameFree, + A: Alloc, P: Translator, { // NOTE(qix-): The current implementation of `entry()` doesn't @@ -429,7 +429,7 @@ unsafe impl Segment for &'static AddressSegment { phys: u64, ) -> Result<(), MapError> where - A: PageFrameAllocate, + A: Alloc, P: Translator, { let entry = unsafe { self.entry(space, alloc, translator, virt)? }; @@ -451,7 +451,7 @@ unsafe impl Segment for &'static AddressSegment { virt: usize, ) -> Result where - A: PageFrameAllocate + PageFrameFree, + A: Alloc, P: Translator, { let phys = unsafe { @@ -472,7 +472,7 @@ unsafe impl Segment for &'static AddressSegment { phys: u64, ) -> Result, MapError> where - A: PageFrameAllocate + PageFrameFree, + A: Alloc, P: Translator, { let entry = unsafe { self.entry(space, alloc, translator, virt)? }; diff --git a/oro-boot/src/pfa.rs b/oro-boot/src/pfa.rs index 001b4cea..7fea901e 100644 --- a/oro-boot/src/pfa.rs +++ b/oro-boot/src/pfa.rs @@ -188,17 +188,13 @@ impl + Clone, I: Iterator + Clone> PrebootPfa } } -unsafe impl + Clone, I: Iterator + Clone> - oro_mem::pfa::alloc::PageFrameAllocate for PrebootPfa +unsafe impl + Clone, I: Iterator + Clone> oro_mem::pfa::alloc::Alloc + for PrebootPfa { fn allocate(&mut self) -> Option { self.allocate_page() } -} -unsafe impl + Clone, I: Iterator + Clone> - oro_mem::pfa::alloc::PageFrameFree for PrebootPfa -{ unsafe fn free(&mut self, _frame: u64) { panic!("preboot PFA cannot free frames"); } diff --git a/oro-boot/src/target/aarch64.rs b/oro-boot/src/target/aarch64.rs index c1eca227..22771297 100644 --- a/oro-boot/src/target/aarch64.rs +++ b/oro-boot/src/target/aarch64.rs @@ -16,7 +16,7 @@ pub use oro_arch_aarch64::{ELF_CLASS, ELF_ENDIANNESS, ELF_MACHINE}; use oro_macro::asm_buffer; use oro_mem::{ mapper::{AddressSegment, MapError}, - pfa::alloc::{PageFrameAllocate, PageFrameFree}, + pfa::alloc::Alloc, translate::Translator, }; @@ -71,7 +71,7 @@ const STUBS: &[u8] = &asm_buffer! { /// Prepares the system for a transfer. Called before the memory map /// is written, after which `transfer` is called. -pub unsafe fn prepare_transfer( +pub unsafe fn prepare_transfer( mapper: &mut AddressSpaceHandle, alloc: &mut A, pat: &P, diff --git a/oro-boot/src/target/x86_64.rs b/oro-boot/src/target/x86_64.rs index 7091ec90..31989d6e 100644 --- a/oro-boot/src/target/x86_64.rs +++ b/oro-boot/src/target/x86_64.rs @@ -12,7 +12,7 @@ pub use oro_arch_x86_64::{ELF_CLASS, ELF_ENDIANNESS, ELF_MACHINE}; use oro_macro::asm_buffer; use oro_mem::{ mapper::{AddressSegment as _, AddressSpace as _, MapError, UnmapError}, - pfa::alloc::{PageFrameAllocate, PageFrameFree}, + pfa::alloc::Alloc, translate::Translator, }; @@ -57,7 +57,7 @@ pub fn target_address() -> usize { /// Prepares the system for a transfer. Called before the memory map /// is written, after which `transfer` is called. #[expect(clippy::unnecessary_wraps)] -pub unsafe fn prepare_transfer( +pub unsafe fn prepare_transfer( mapper: &mut AddressSpaceHandle, alloc: &mut A, pat: &P, diff --git a/oro-kernel/src/lib.rs b/oro-kernel/src/lib.rs index 6e0e70a3..8a89d5b6 100644 --- a/oro-kernel/src/lib.rs +++ b/oro-kernel/src/lib.rs @@ -11,7 +11,7 @@ use oro_mem::{ mapper::{AddressSpace, MapError}, - pfa::alloc::{PageFrameAllocate, PageFrameFree}, + pfa::alloc::Alloc, translate::Translator, }; use oro_sync::spinlock::unfair_critical::{InterruptController, UnfairCriticalSpinlock}; @@ -29,7 +29,7 @@ pub mod ring; /// and re-created on core powerdown/subsequent bringup). pub struct Kernel where - Pfa: PageFrameAllocate + PageFrameFree + 'static, + Pfa: Alloc + 'static, Pat: Translator, AddrSpace: AddressSpace + 'static, IntCtrl: InterruptController + 'static, @@ -40,7 +40,7 @@ where impl Kernel where - Pfa: PageFrameAllocate + PageFrameFree + 'static, + Pfa: Alloc + 'static, Pat: Translator, AddrSpace: AddressSpace, IntCtrl: InterruptController, @@ -71,7 +71,7 @@ where /// core boot/powerdown/bringup cycles. pub struct KernelState where - Pfa: PageFrameAllocate + PageFrameFree, + Pfa: Alloc, Pat: Translator, AddrSpace: AddressSpace, IntCtrl: InterruptController, @@ -85,7 +85,7 @@ where impl KernelState where - Pfa: PageFrameAllocate + PageFrameFree, + Pfa: Alloc, Pat: Translator, AddrSpace: AddressSpace, IntCtrl: InterruptController, diff --git a/oro-kernel/src/registry.rs b/oro-kernel/src/registry.rs index 3bfd707f..ecb655d3 100644 --- a/oro-kernel/src/registry.rs +++ b/oro-kernel/src/registry.rs @@ -29,7 +29,7 @@ use core::{ use oro_macro::unlikely; use oro_mem::{ mapper::{AddressSegment, AddressSpace, MapError}, - pfa::alloc::{PageFrameAllocate, PageFrameFree}, + pfa::alloc::Alloc, translate::Translator, }; use oro_sync::spinlock::unfair_critical::{InterruptController, UnfairCriticalSpinlock}; @@ -135,15 +135,11 @@ where /// /// Typically, this function should be called once /// at boot time. - pub fn new( + pub fn new( pat: Pat, pfa: &mut Pfa, segment: AddrSpace::SupervisorSegment, - ) -> Result - where - Pat: Translator, - Pfa: PageFrameAllocate + PageFrameFree, - { + ) -> Result { // SAFETY(qix-): We can more or less guarantee that this registry // SAFETY(qix-): is being constructed in the supervisor space. // SAFETY(qix-): Further, we can't guarantee that the segment is @@ -177,14 +173,11 @@ where /// # Safety /// Marked unsafe because misuse of this function can lead to /// memory leaks. You probably want to use [`Self::insert()`] instead. - pub unsafe fn insert_permanent( + pub unsafe fn insert_permanent( &self, pfa: &UnfairCriticalSpinlock, item: T, - ) -> Result - where - Pfa: PageFrameAllocate + PageFrameFree, - { + ) -> Result { // SAFETY(qix-): We don't panic in this function. let mut bk = unsafe { self.bookkeeping.lock::() }; @@ -256,14 +249,11 @@ where /// /// Takes a reference to the spinlock itself, since not all allocations require /// locking the PFA. - pub fn insert( + pub fn insert( &'static self, pfa: &UnfairCriticalSpinlock, item: T, - ) -> Result, MapError> - where - Pfa: PageFrameAllocate + PageFrameFree, - { + ) -> Result, MapError> { // SAFETY(qix-): `insert_permanent` simply creates a new item // SAFETY(qix-): with a user count of 1, but doesn't return a handle // SAFETY(qix-): to it. Since this is the only other place that diff --git a/oro-mem/src/mapper.rs b/oro-mem/src/mapper.rs index 243e3d24..13b0d101 100644 --- a/oro-mem/src/mapper.rs +++ b/oro-mem/src/mapper.rs @@ -6,10 +6,7 @@ //! The kernel will allocate memory into specific regions, leaving the //! architecture to properly set up all flags and other necessary controls //! for those regions to behave as the kernel expects. -use crate::{ - pfa::alloc::{PageFrameAllocate, PageFrameFree}, - translate::Translator, -}; +use crate::{pfa::alloc::Alloc, translate::Translator}; /// A const trait that provides descriptors for the layout of an address space /// for the underlying architecture. @@ -53,7 +50,7 @@ pub unsafe trait AddressSpace: 'static { /// Returns `None` if any allocation(s) fail. fn new_supervisor_space(alloc: &mut A, translator: &P) -> Option where - A: PageFrameAllocate, + A: Alloc, P: Translator; /// Duplicates the given supervisor address space handle. @@ -68,7 +65,7 @@ pub unsafe trait AddressSpace: 'static { translator: &P, ) -> Option where - A: PageFrameAllocate, + A: Alloc, P: Translator; /// Returns the layout descriptor for the kernel code segment. @@ -178,7 +175,7 @@ pub unsafe trait AddressSegment: 'static { translator: &P, ) -> Result<(), MapError> where - A: PageFrameAllocate + PageFrameFree, + A: Alloc, P: Translator; /// Maps a physical address into the segment at the given virtual address. @@ -196,7 +193,7 @@ pub unsafe trait AddressSegment: 'static { phys: u64, ) -> Result<(), MapError> where - A: PageFrameAllocate + PageFrameFree, + A: Alloc, P: Translator; /// Maps a physical address into the segment at the given virtual address, @@ -221,7 +218,7 @@ pub unsafe trait AddressSegment: 'static { phys: u64, ) -> Result<(), MapError> where - A: PageFrameAllocate, + A: Alloc, P: Translator; /// Unmaps a physical address from the segment at the given virtual address. @@ -235,7 +232,7 @@ pub unsafe trait AddressSegment: 'static { virt: usize, ) -> Result where - A: PageFrameAllocate + PageFrameFree, + A: Alloc, P: Translator; /// Maps the given physical address into the segment at the given virtual address. @@ -250,7 +247,7 @@ pub unsafe trait AddressSegment: 'static { phys: u64, ) -> Result, MapError> where - A: PageFrameAllocate + PageFrameFree, + A: Alloc, P: Translator; } diff --git a/oro-mem/src/pfa/alloc.rs b/oro-mem/src/pfa/alloc.rs index 294fd140..928ed639 100644 --- a/oro-mem/src/pfa/alloc.rs +++ b/oro-mem/src/pfa/alloc.rs @@ -4,9 +4,6 @@ /// A page frame is a contiguous block of physical memory that is a multiple of /// the requested page size (e.g. 4 KiB). /// -/// Page allocators that support freeing page frames should also implement the -/// [`PageFrameFree`] trait. -/// /// Consumers of this trait must ensure proper synchronization if the allocator /// is shared between multiple processors. Implementations **should not** provide any /// thread safety. @@ -20,20 +17,11 @@ /// - not overlapping with any other allocated frame. /// /// Any and all bookkeeping operations must be safe and **MUST NOT panic**. -pub unsafe trait PageFrameAllocate { +pub unsafe trait Alloc { /// Allocates a new page frame, returning the physical address of the page frame /// that was allocated. If `None` is returned, the system is out of memory. fn allocate(&mut self) -> Option; -} -/// A page frame allocator that supports freeing page frames. -/// -/// # Safety -/// Implementations of this trait must ensure that all memory accesses are safe and valid -/// during any bookkeeping operations. -/// -/// Any and all bookkeeping operations must be safe and **MUST NOT panic**. -pub unsafe trait PageFrameFree: PageFrameAllocate { /// Frees a page frame. /// /// # Safety diff --git a/oro-mem/src/pfa/filo.rs b/oro-mem/src/pfa/filo.rs index 860eae57..6d39cef3 100644 --- a/oro-mem/src/pfa/filo.rs +++ b/oro-mem/src/pfa/filo.rs @@ -2,10 +2,7 @@ //! whereby page frames form a linked list of free pages. See [`FiloPageFrameAllocator`] //! for more information. -use crate::{ - pfa::alloc::{PageFrameAllocate, PageFrameFree}, - translate::Translator, -}; +use crate::{pfa::alloc::Alloc, translate::Translator}; /// First in, last out (FILO) page frame allocator. /// @@ -72,7 +69,7 @@ where } } -unsafe impl PageFrameAllocate for FiloPageFrameAllocator +unsafe impl Alloc for FiloPageFrameAllocator where M: FiloPageFrameManager, { @@ -89,13 +86,7 @@ where Some(page_frame) } } -} -unsafe impl PageFrameFree for FiloPageFrameAllocator -where - M: FiloPageFrameManager, -{ - #[inline] unsafe fn free(&mut self, frame: u64) { assert_eq!(frame % 4096, 0, "frame is not page-aligned"); #[cfg(debug_assertions)]