Compare commits
No commits in common. "b02c34fd1dd205c171dcd6cbaa8cf0c1c2d955cd" and "c2f9343bbfc145cbc829755aa7872effa4e321b3" have entirely different histories.
b02c34fd1d
...
c2f9343bbf
@ -5,5 +5,3 @@ timeout: 0
|
|||||||
kernel_path: boot():/boot/${ARCH}/gila
|
kernel_path: boot():/boot/${ARCH}/gila
|
||||||
cmdline: -loglevel=Trace -logdev=display,serial -initramfs=/boot/${ARCH}/initramfs.tar.lzma
|
cmdline: -loglevel=Trace -logdev=display,serial -initramfs=/boot/${ARCH}/initramfs.tar.lzma
|
||||||
module_path: boot():/boot/${ARCH}/initramfs.tar.lzma
|
module_path: boot():/boot/${ARCH}/initramfs.tar.lzma
|
||||||
kaslr: yes
|
|
||||||
randomize_hhdm_base: yes
|
|
||||||
|
|||||||
@ -3,12 +3,8 @@
|
|||||||
|
|
||||||
#![allow(dead_code)]
|
#![allow(dead_code)]
|
||||||
|
|
||||||
use crate::{LOGGER, LogLevel, format, log_info, memory::HHDM_RESPONSE};
|
use crate::{LOGGER, LogLevel, format, log_info};
|
||||||
use x86_64::{
|
use x86_64::registers::control::*;
|
||||||
PhysAddr, VirtAddr,
|
|
||||||
registers::control::*,
|
|
||||||
structures::paging::{PageTable, PageTableFlags},
|
|
||||||
};
|
|
||||||
|
|
||||||
pub fn get_mappings() {
|
pub fn get_mappings() {
|
||||||
log_info!("Paging: {}", Cr0::read().contains(Cr0Flags::PAGING));
|
log_info!("Paging: {}", Cr0::read().contains(Cr0Flags::PAGING));
|
||||||
@ -32,8 +28,8 @@ pub fn get_mappings() {
|
|||||||
_ => unreachable!(),
|
_ => unreachable!(),
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
let pml4_phys_addr = Cr3::read_raw().0.start_address();
|
let pml4_addr = Cr3::read_raw().0.start_address();
|
||||||
log_info!("Page Map Level 4 Address: 0x{:x}", pml4_phys_addr.as_u64());
|
log_info!("Page Map Level 4 Address: 0x{:x}", pml4_addr.as_u64());
|
||||||
log_info!(
|
log_info!(
|
||||||
"Page-Level Write-Through: {}",
|
"Page-Level Write-Through: {}",
|
||||||
Cr3::read().1.contains(Cr3Flags::PAGE_LEVEL_WRITETHROUGH)
|
Cr3::read().1.contains(Cr3Flags::PAGE_LEVEL_WRITETHROUGH)
|
||||||
@ -42,38 +38,4 @@ pub fn get_mappings() {
|
|||||||
"Page-Level Cache Disable: {}",
|
"Page-Level Cache Disable: {}",
|
||||||
Cr3::read().1.contains(Cr3Flags::PAGE_LEVEL_CACHE_DISABLE)
|
Cr3::read().1.contains(Cr3Flags::PAGE_LEVEL_CACHE_DISABLE)
|
||||||
);
|
);
|
||||||
let pml4: &'static mut PageTable = table_from_phys_addr(pml4_phys_addr);
|
|
||||||
|
|
||||||
iter_table(pml4, 4);
|
|
||||||
}
|
|
||||||
|
|
||||||
fn table_from_phys_addr(address: PhysAddr) -> &'static mut PageTable {
|
|
||||||
let virt_addr: VirtAddr = VirtAddr::new(address.as_u64() + HHDM_RESPONSE.offset());
|
|
||||||
let ptr: *mut PageTable = virt_addr.as_mut_ptr();
|
|
||||||
unsafe { &mut *ptr }
|
|
||||||
}
|
|
||||||
|
|
||||||
fn iter_table(table: &'static mut PageTable, level: usize) {
|
|
||||||
if level == 1 {
|
|
||||||
for page_entry in table.iter() {
|
|
||||||
if page_entry.flags().contains(PageTableFlags::PRESENT) {
|
|
||||||
log_info!(
|
|
||||||
"Page entry: 0x{:x}, flags: {:?}",
|
|
||||||
page_entry.addr(),
|
|
||||||
page_entry.flags()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
for table_entry in table.iter() {
|
|
||||||
if table_entry.flags().contains(PageTableFlags::PRESENT) {
|
|
||||||
log_info!(
|
|
||||||
"Table entry: 0x{:x}, flags: {:?}",
|
|
||||||
table_entry.addr(),
|
|
||||||
table_entry.flags()
|
|
||||||
);
|
|
||||||
iter_table(table_from_phys_addr(table_entry.addr()), level - 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -79,7 +79,7 @@ pub enum TriggerLevel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[repr(u8)]
|
#[repr(u8)]
|
||||||
#[derive(FromPrimitive, PartialEq, Eq)]
|
#[derive(FromPrimitive)]
|
||||||
pub enum InterruptState {
|
pub enum InterruptState {
|
||||||
ModemStatus = 0b00,
|
ModemStatus = 0b00,
|
||||||
TransmitterEmpty = 0b01,
|
TransmitterEmpty = 0b01,
|
||||||
@ -123,7 +123,6 @@ pub enum ModemStatus {
|
|||||||
DataCarrierDetect = 0b10000000,
|
DataCarrierDetect = 0b10000000,
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Ensure we don't clobber the tx buffer and prevent some data from getting printed
|
|
||||||
impl SerialPort {
|
impl SerialPort {
|
||||||
pub fn log_write(&mut self, msg: &str) {
|
pub fn log_write(&mut self, msg: &str) {
|
||||||
if self.crlf == Crlf::Crlf {
|
if self.crlf == Crlf::Crlf {
|
||||||
@ -140,10 +139,6 @@ impl SerialPort {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn is_transmit_empty(&mut self) -> bool {
|
|
||||||
self.get_interrupt_state() != InterruptState::TransmitterEmpty
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn log_writeln(&mut self, msg: &str) {
|
pub fn log_writeln(&mut self, msg: &str) {
|
||||||
self.log_write(msg);
|
self.log_write(msg);
|
||||||
self.log_write("\n");
|
self.log_write("\n");
|
||||||
|
|||||||
@ -77,7 +77,7 @@ pub static ASCII_LOGO: [&str; 6] = [
|
|||||||
" / __ `/ / / __ `/",
|
" / __ `/ / / __ `/",
|
||||||
"/ /_/ / / / /_/ / ",
|
"/ /_/ / / / /_/ / ",
|
||||||
"\\__, /_/_/\\__,_/ ",
|
"\\__, /_/_/\\__,_/ ",
|
||||||
"/___/ ",
|
"/____/ ",
|
||||||
];
|
];
|
||||||
|
|
||||||
// FUCKING ADD CONST UNWRAP!!!
|
// FUCKING ADD CONST UNWRAP!!!
|
||||||
|
|||||||
@ -150,5 +150,8 @@ unsafe extern "C" fn main() -> ! {
|
|||||||
}
|
}
|
||||||
log_info!("Virtualization provider: {:?}", virt_supported());
|
log_info!("Virtualization provider: {:?}", virt_supported());
|
||||||
|
|
||||||
panic!("Finished boot, but cannot start init because processes not implemented!");
|
log_info!("Done boot!");
|
||||||
|
loop {
|
||||||
|
arch::asm::nop();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user