Run rustfmt

This commit is contained in:
Philipp Oppermann
2017-03-09 17:50:44 +01:00
parent 844d739379
commit 68dc7447f4
6 changed files with 28 additions and 27 deletions

View File

@@ -115,8 +115,8 @@ pub fn init(memory_controller: &mut MemoryController) {
use x86::shared::segmentation::{SegmentSelector, set_cs}; use x86::shared::segmentation::{SegmentSelector, set_cs};
use x86::shared::task::load_tr; use x86::shared::task::load_tr;
let double_fault_stack = memory_controller.alloc_stack(1) let double_fault_stack =
.expect("could not allocate double fault stack"); memory_controller.alloc_stack(1).expect("could not allocate double fault stack");
let tss = TSS.call_once(|| { let tss = TSS.call_once(|| {
let mut tss = TaskStateSegment::new(); let mut tss = TaskStateSegment::new();

View File

@@ -32,8 +32,11 @@ impl Mapper {
pub fn translate(&self, virtual_address: VirtualAddress) -> Option<PhysicalAddress> { pub fn translate(&self, virtual_address: VirtualAddress) -> Option<PhysicalAddress> {
let offset = virtual_address % PAGE_SIZE; let offset = virtual_address % PAGE_SIZE;
self.translate_page(Page::containing_address(virtual_address)) self.translate_page(Page::containing_address(virtual_address)).map(|frame| {
.map(|frame| frame.number * PAGE_SIZE + offset) frame.number *
PAGE_SIZE +
offset
})
} }
pub fn translate_page(&self, page: Page) -> Option<Frame> { pub fn translate_page(&self, page: Page) -> Option<Frame> {

View File

@@ -188,8 +188,7 @@ pub fn remap_the_kernel<A>(allocator: &mut A, boot_info: &BootInformation) -> Ac
}; };
active_table.with(&mut new_table, &mut temporary_page, |mapper| { active_table.with(&mut new_table, &mut temporary_page, |mapper| {
let elf_sections_tag = boot_info.elf_sections_tag() let elf_sections_tag = boot_info.elf_sections_tag().expect("Memory map tag required");
.expect("Memory map tag required");
// identity map the allocated kernel sections // identity map the allocated kernel sections
for section in elf_sections_tag.sections() { for section in elf_sections_tag.sections() {

View File

@@ -44,13 +44,11 @@ impl<L> Table<L>
} }
pub fn next_table(&self, index: usize) -> Option<&Table<L::NextLevel>> { pub fn next_table(&self, index: usize) -> Option<&Table<L::NextLevel>> {
self.next_table_address(index) self.next_table_address(index).map(|address| unsafe { &*(address as *const _) })
.map(|address| unsafe { &*(address as *const _) })
} }
pub fn next_table_mut(&mut self, index: usize) -> Option<&mut Table<L::NextLevel>> { pub fn next_table_mut(&mut self, index: usize) -> Option<&mut Table<L::NextLevel>> {
self.next_table_address(index) self.next_table_address(index).map(|address| unsafe { &mut *(address as *mut _) })
.map(|address| unsafe { &mut *(address as *mut _) })
} }
pub fn next_table_create<A>(&mut self, pub fn next_table_create<A>(&mut self,

View File

@@ -17,7 +17,8 @@ const BUFFER_WIDTH: usize = 80;
pub static WRITER: Mutex<Writer> = Mutex::new(Writer { pub static WRITER: Mutex<Writer> = Mutex::new(Writer {
column_position: 0, column_position: 0,
color_code: ColorCode::new(Color::LightGreen, Color::Black), color_code: ColorCode::new(Color::LightGreen,
Color::Black),
buffer: unsafe { Unique::new(0xb8000 as *mut _) }, buffer: unsafe { Unique::new(0xb8000 as *mut _) },
}); });