Fix warnings
This commit is contained in:
parent
f0177d2d4d
commit
583c6860b5
@ -17,8 +17,6 @@ mod panic;
|
|||||||
mod process;
|
mod process;
|
||||||
mod util;
|
mod util;
|
||||||
|
|
||||||
use core::ptr::addr_of;
|
|
||||||
|
|
||||||
use arch::x86_64::interrupts::IDT;
|
use arch::x86_64::interrupts::IDT;
|
||||||
use arch::x86_64::serial::SerialPort;
|
use arch::x86_64::serial::SerialPort;
|
||||||
use boot::{BASE_REVISION, params, *};
|
use boot::{BASE_REVISION, params, *};
|
||||||
@ -27,13 +25,11 @@ use log::*;
|
|||||||
use memory::alloc::{boxed::Box, format, string::String, vec};
|
use memory::alloc::{boxed::Box, format, string::String, vec};
|
||||||
use params::*;
|
use params::*;
|
||||||
|
|
||||||
use x86_64::VirtAddr;
|
|
||||||
use x86_64::structures::paging::PageTable;
|
|
||||||
use lazy_static::lazy_static;
|
use lazy_static::lazy_static;
|
||||||
use limine::firmware_type::FirmwareType;
|
use limine::firmware_type::FirmwareType;
|
||||||
use spin::mutex::Mutex;
|
use spin::mutex::Mutex;
|
||||||
|
|
||||||
use crate::{arch::x86_64::cpuid::{CPUID, virt_supported}, memory::{HHDM_RESPONSE, paging::{PML4, active_level_4_table, iter_table}}};
|
use crate::{arch::x86_64::cpuid::{CPUID, virt_supported}, memory::HHDM_RESPONSE};
|
||||||
|
|
||||||
lazy_static! {
|
lazy_static! {
|
||||||
pub static ref SERIAL_3F8: Mutex<SerialPort> = Mutex::new(
|
pub static ref SERIAL_3F8: Mutex<SerialPort> = Mutex::new(
|
||||||
@ -74,6 +70,9 @@ unsafe extern "C" fn main() -> ! {
|
|||||||
// END OF CRITICAL AREA
|
// END OF CRITICAL AREA
|
||||||
// Fallible code can be placed below this comment
|
// Fallible code can be placed below this comment
|
||||||
|
|
||||||
|
// Initialize all statics so the bootloader memory can be reclaimed
|
||||||
|
memory::init_statics();
|
||||||
|
|
||||||
// Ensure IDT exists
|
// Ensure IDT exists
|
||||||
IDT.load();
|
IDT.load();
|
||||||
|
|
||||||
@ -153,8 +152,9 @@ unsafe extern "C" fn main() -> ! {
|
|||||||
}
|
}
|
||||||
log_info!("Virtualization provider: {:?}", virt_supported());
|
log_info!("Virtualization provider: {:?}", virt_supported());
|
||||||
|
|
||||||
log_info!("Physical address of current L4 table: 0x{:x}", x86_64::registers::control::Cr3::read().0.start_address());
|
let l4_start = x86_64::registers::control::Cr3::read().0.start_address();
|
||||||
log_info!("Virtual address of current L4 table: 0x{:x}", x86_64::registers::control::Cr3::read().0.start_address().as_u64() + HHDM_RESPONSE.offset());
|
log_info!("Physical address of current L4 table: 0x{:x}", l4_start);
|
||||||
|
log_info!("Virtual address of current L4 table: 0x{:x}", l4_start.as_u64() + HHDM_RESPONSE.offset());
|
||||||
|
|
||||||
//iter_table(4, &PML4);
|
//iter_table(4, &PML4);
|
||||||
|
|
||||||
|
|||||||
@ -107,7 +107,7 @@ pub fn log_address() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Have to initialize all of these before reclaiming bootloader memory
|
// Have to initialize all of these before reclaiming bootloader memory
|
||||||
fn init_statics() {
|
pub fn init_statics() {
|
||||||
let _ = EXECUTABLE_FILE_RESPONSE;
|
let _ = EXECUTABLE_FILE_RESPONSE;
|
||||||
let _ = HHDM_RESPONSE;
|
let _ = HHDM_RESPONSE;
|
||||||
let _ = MODULE_RESPONSE;
|
let _ = MODULE_RESPONSE;
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
|
|
||||||
use x86_64::PhysAddr;
|
|
||||||
use x86_64::structures::paging::PageTable;
|
use x86_64::structures::paging::PageTable;
|
||||||
use x86_64::VirtAddr;
|
use x86_64::VirtAddr;
|
||||||
use lazy_static::lazy_static;
|
use lazy_static::lazy_static;
|
||||||
@ -9,6 +8,7 @@ use crate::log::*;
|
|||||||
use crate::memory::format;
|
use crate::memory::format;
|
||||||
use crate::memory::HHDM_RESPONSE;
|
use crate::memory::HHDM_RESPONSE;
|
||||||
|
|
||||||
|
#[allow(dead_code)]
|
||||||
pub unsafe fn active_level_4_table()
|
pub unsafe fn active_level_4_table()
|
||||||
-> &'static mut PageTable
|
-> &'static mut PageTable
|
||||||
{
|
{
|
||||||
@ -27,6 +27,8 @@ lazy_static! {
|
|||||||
pub static ref PML4: &'static mut PageTable = unsafe { active_level_4_table() };
|
pub static ref PML4: &'static mut PageTable = unsafe { active_level_4_table() };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Not used right now, helpful for debugging
|
||||||
|
#[allow(dead_code)]
|
||||||
pub fn iter_table(level: usize, table: &PageTable) {
|
pub fn iter_table(level: usize, table: &PageTable) {
|
||||||
for (i, entry) in table.iter().enumerate() {
|
for (i, entry) in table.iter().enumerate() {
|
||||||
if !entry.is_unused() & entry.flags().contains(PageTableFlags::PRESENT) {
|
if !entry.is_unused() & entry.flags().contains(PageTableFlags::PRESENT) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user