mirror of
https://github.com/phil-opp/blog_os.git
synced 2025-12-18 23:37:50 +00:00
Format using rustfmt-nightly
This commit is contained in:
@@ -18,7 +18,8 @@ pub struct TemporaryPage {
|
||||
|
||||
impl TemporaryPage {
|
||||
pub fn new<A>(page: Page, allocator: &mut A) -> TemporaryPage
|
||||
where A: FrameAllocator
|
||||
where
|
||||
A: FrameAllocator,
|
||||
{
|
||||
TemporaryPage {
|
||||
page: page,
|
||||
@@ -31,18 +32,21 @@ impl TemporaryPage {
|
||||
pub fn map(&mut self, frame: Frame, active_table: &mut ActivePageTable) -> VirtualAddress {
|
||||
use super::entry::WRITABLE;
|
||||
|
||||
assert!(active_table.translate_page(self.page).is_none(),
|
||||
"temporary page is already mapped");
|
||||
assert!(
|
||||
active_table.translate_page(self.page).is_none(),
|
||||
"temporary page is already mapped"
|
||||
);
|
||||
active_table.map_to(self.page, frame, WRITABLE, &mut self.allocator);
|
||||
self.page.start_address()
|
||||
}
|
||||
|
||||
/// Maps the temporary page to the given page table frame in the active table.
|
||||
/// Returns a reference to the now mapped table.
|
||||
pub fn map_table_frame(&mut self,
|
||||
frame: Frame,
|
||||
active_table: &mut ActivePageTable)
|
||||
-> &mut Table<Level1> {
|
||||
pub fn map_table_frame(
|
||||
&mut self,
|
||||
frame: Frame,
|
||||
active_table: &mut ActivePageTable,
|
||||
) -> &mut Table<Level1> {
|
||||
unsafe { &mut *(self.map(frame, active_table) as *mut Table<Level1>) }
|
||||
}
|
||||
|
||||
@@ -56,7 +60,8 @@ struct TinyAllocator([Option<Frame>; 3]);
|
||||
|
||||
impl TinyAllocator {
|
||||
fn new<A>(allocator: &mut A) -> TinyAllocator
|
||||
where A: FrameAllocator
|
||||
where
|
||||
A: FrameAllocator,
|
||||
{
|
||||
let mut f = || allocator.allocate_frame();
|
||||
let frames = [f(), f(), f()];
|
||||
|
||||
Reference in New Issue
Block a user