kernel_api/allocator/
vmm.rs1use crate::memory::RawPage;
2use crate::allocator::AllocError;
3
4pub trait Vmm {
6 fn allocate_contiguous(&self, len: usize) -> Result<RawPage, AllocError>;
7 fn allocate_contiguous_at(&self, at: RawPage, len: usize) -> Result<RawPage, AllocError>;
8 fn deallocate_contiguous(&self, base: RawPage, len: usize);
9}
10
11impl Vmm for ! {
12 fn allocate_contiguous(&self, _len: usize) -> Result<RawPage, AllocError> {
13 *self
14 }
15
16 fn allocate_contiguous_at(&self, _at: RawPage, _len: usize) -> Result<RawPage, AllocError> {
17 *self
18 }
19
20 fn deallocate_contiguous(&self, _base: RawPage, _len: usize) {}
21}