Browse Source

some warning cleanup

master
3moon 8 years ago
parent
commit
200e1a167b
5 changed files with 9 additions and 15 deletions
  1. +2
    -4
      src/arch/x86_64/memory/paging/mapper.rs
  2. +5
    -7
      src/arch/x86_64/memory/paging/mod.rs
  3. +1
    -1
      src/arch/x86_64/memory/paging/temporary_page.rs
  4. +0
    -2
      src/lib.rs
  5. +1
    -1
      src/logger.rs

+ 2
- 4
src/arch/x86_64/memory/paging/mapper.rs View File

@ -2,7 +2,7 @@ use core::ptr::Unique;
use arch::x86_64::memory::{PAGE_SIZE, Frame, FrameAllocator};
use super::entry::*;
use super::{PhysicalAddress, VirtualAddress, Page, ENTRY_COUNT};
use super::table::{self, Table, Level1, Level4};
use super::table::{self, Table, Level4};
/// Owns the top-level active page table (P4).
pub struct Mapper {
@ -131,9 +131,7 @@ impl Mapper {
p1[page.p1_index()].set_unused();
use ::x86::instructions::tlb;
unsafe {
tlb::flush(::x86::VirtualAddress(page.start_address()));
}
tlb::flush(::x86::VirtualAddress(page.start_address()));
// TODO free p(1,2,3) table if empty
// allocator.dealloc_frame(frame);


+ 5
- 7
src/arch/x86_64/memory/paging/mod.rs View File

@ -14,7 +14,7 @@ mod mapper;
mod temporary_page;
pub use self::entry::*;
use self::table::{Table, Level4};
use self::table::Table;
use self::temporary_page::TemporaryPage;
use self::mapper::Mapper;
@ -53,23 +53,21 @@ impl ActivePageTable {
{
// Backup the original P4 pointer
let backup = Frame::containing_address(
unsafe {control_regs::cr3().0 as usize}
);
let backup = Frame::containing_address(control_regs::cr3().0 as usize);
// Map a scratch page to the current p4 table
let p4_table = scratch_page.map_table_frame(backup.clone(), self);
// Overwrite main P4 recursive mapping
self.p4_mut()[511].set(table.p4_frame.clone(), PRESENT | WRITABLE);
unsafe {tlb::flush_all();} // flush *all* TLBs to prevent fuckiness
tlb::flush_all(); // flush *all* TLBs to prevent fuckiness
// Execute f in context of the new page table
f(self);
// Restore the original pointer to P4
p4_table[511].set(backup, PRESENT | WRITABLE);
unsafe {tlb::flush_all();} // prevent fuckiness
tlb::flush_all(); // prevent fuckiness
}
scratch_page.unmap(self);
@ -83,7 +81,7 @@ impl ActivePageTable {
use x86::registers::control_regs;
let old_table = InactivePageTable {
p4_frame: Frame::containing_address(unsafe {control_regs::cr3().0 as usize}),
p4_frame: Frame::containing_address(control_regs::cr3().0 as usize),
};
unsafe {


+ 1
- 1
src/arch/x86_64/memory/paging/temporary_page.rs View File

@ -1,6 +1,6 @@
use arch::x86_64::memory::{Frame, FrameAllocator};
use super::{Page, Table, ActivePageTable};
use super::table::{Level1, Level4};
use super::table::Level1;
use super::{VirtualAddress};
pub struct TemporaryPage {


+ 0
- 2
src/lib.rs View File

@ -32,10 +32,8 @@ mod misc;
mod logger;
mod arch;
use arch::x86_64;
use arch::x86_64::device::vga_console;
use arch::x86_64::memory;
use arch::x86_64::memory::FrameAllocator;
use arch::x86_64::interrupts;
use alloca::Allocator;
use alloc::boxed::Box;


+ 1
- 1
src/logger.rs View File

@ -1,7 +1,7 @@
//! A basic console logging backend for the `log` crate.
use log;
use log::{Log, LogRecord, LogLevel, LogLevelFilter, LogMetadata};
use log::{Log, LogRecord, LogLevelFilter, LogMetadata};
use log::{SetLoggerError};
/// Initializes the VGA console logger at kernel boot.


Loading…
Cancel
Save