Add rustfmt from relibc and apply it with cargo fmt

This commit is contained in:
Jeremy Soller
2024-01-17 13:52:01 -07:00
parent 73897bd83d
commit 45f1c4e29e
166 changed files with 7353 additions and 3851 deletions
+16 -8
View File
@@ -1,26 +1,34 @@
use crate::paging::{mapper::PageFlushAll, KernelMapper, Page, PageFlags, VirtualAddress};
use rmm::Flusher;
use crate::paging::{KernelMapper, Page, PageFlags, VirtualAddress, mapper::PageFlushAll};
#[cfg(not(feature="slab"))]
#[cfg(not(feature = "slab"))]
pub use self::linked_list::Allocator;
#[cfg(feature="slab")]
#[cfg(feature = "slab")]
pub use self::slab::Allocator;
#[cfg(not(feature="slab"))]
#[cfg(not(feature = "slab"))]
mod linked_list;
#[cfg(feature="slab")]
#[cfg(feature = "slab")]
mod slab;
unsafe fn map_heap(mapper: &mut KernelMapper, offset: usize, size: usize) {
let mapper = mapper.get_mut().expect("failed to obtain exclusive access to KernelMapper while extending heap");
let mapper = mapper
.get_mut()
.expect("failed to obtain exclusive access to KernelMapper while extending heap");
let mut flush_all = PageFlushAll::new();
let heap_start_page = Page::containing_address(VirtualAddress::new(offset));
let heap_end_page = Page::containing_address(VirtualAddress::new(offset + size-1));
let heap_end_page = Page::containing_address(VirtualAddress::new(offset + size - 1));
for page in Page::range_inclusive(heap_start_page, heap_end_page) {
let result = mapper.map(page.start_address(), PageFlags::new().write(true).global(cfg!(not(feature = "pti"))))
let result = mapper
.map(
page.start_address(),
PageFlags::new()
.write(true)
.global(cfg!(not(feature = "pti"))),
)
.expect("failed to map kernel heap");
flush_all.consume(result);
}