mirror of
https://github.com/realmicrosoft/windows.git
synced 2024-08-14 22:46:44 +00:00
Compare commits
No commits in common. "9a5a004243d151fe039240d2d8373faeef68c948" and "4574150d2b1edf59950479d0963f75a074c05153" have entirely different histories.
9a5a004243
...
4574150d2b
4 changed files with 25 additions and 61 deletions
|
@ -1,31 +1,25 @@
|
||||||
|
|
||||||
use core::borrow::{BorrowMut};
|
use core::borrow::{BorrowMut};
|
||||||
use x86_64::registers::control::Cr2;
|
|
||||||
use x86_64::structures::idt::PageFaultErrorCode;
|
|
||||||
|
|
||||||
|
|
||||||
use crate::{InterruptStackFrame, font, println, print};
|
use crate::{InterruptStackFrame, font};
|
||||||
use crate::internals::WhyDoTheyCallItOvenWhenYouOfInTheColdFoodOfOutHotEatTheFood::{COMMUNIST_RED, CUM_WHITE, Colour};
|
use crate::internals::WhyDoTheyCallItOvenWhenYouOfInTheColdFoodOfOutHotEatTheFood::{COMMUNIST_RED, CUM_WHITE, Colour};
|
||||||
use crate::serial::terminal::ST;
|
|
||||||
|
|
||||||
pub extern "x86-interrupt" fn breakpoint_exception(stack_frame: InterruptStackFrame) {
|
pub extern "x86-interrupt" fn breakpoint_exception(stack_frame: InterruptStackFrame) {
|
||||||
println!("---KERNEL WARNING UWU---");
|
/*
|
||||||
println!("breakpoint exception");
|
// cover the screen in a nice communist red (:
|
||||||
println!("stack frame: {:#?}", stack_frame);
|
let mut fb = FACEBOOK.fb_mutex.lock();
|
||||||
}
|
let fb_width = FACEBOOK.fb_width.lock();
|
||||||
|
let fb_height = FACEBOOK.fb_height.lock();
|
||||||
|
|
||||||
pub extern "x86-interrupt" fn double_fault(stack_frame: InterruptStackFrame, _error_code: u64) -> ! {
|
draw_box(0,0,*fb_width,*fb_height, COMMUNIST_RED, fb.borrow_mut());
|
||||||
println!("---KERNEL FUCKY WUKKY UWU---");
|
// draw our funny text
|
||||||
println!("double fault!");
|
draw_horizcentre_string(*fb_width,(*fb_height / 2) - (14 * (8/2)), "OOPSY WOOPSY, THE KERNEL HAD A FUCKY WUCKY UWU", CUM_WHITE, fb.borrow_mut());
|
||||||
println!("stack frame: {:#?}", stack_frame);
|
draw_horizcentre_string(*fb_width,(*fb_height / 2) - (10 * (8/2)), "WHOEVER WAS PROGRAMMING THE KERNEL DECIDED TO LEAVE A BREAKPOINT IN IT, OOPS (:", CUM_WHITE, fb.borrow_mut());
|
||||||
loop {}
|
draw_horizcentre_string(*fb_width,(*fb_height / 2) - (4 * (8/2)), "THE KERNEL IS NOW HALTED, YOU CAN'T DO ANYTHING UNTIL YOU RESTART THE KERNEL", CUM_WHITE, fb.borrow_mut());
|
||||||
}
|
|
||||||
|
|
||||||
pub extern "x86-interrupt" fn page_fault(stack_frame: InterruptStackFrame, error_code: PageFaultErrorCode) -> ! {
|
drop(fb_width);
|
||||||
println!("---KERNEL FUCKY WUKKY UWU---");
|
drop(fb_height);
|
||||||
println!("page fault!");
|
drop(fb);
|
||||||
println!("accessed address: {:?}", Cr2::read());
|
*/
|
||||||
println!("error code: {:?}", error_code);
|
|
||||||
println!("stack frame: {:#?}", stack_frame);
|
|
||||||
loop {}
|
|
||||||
}
|
}
|
24
src/lib.rs
24
src/lib.rs
|
@ -30,15 +30,11 @@ mod internals;
|
||||||
mod allocator;
|
mod allocator;
|
||||||
mod security;
|
mod security;
|
||||||
mod boot;
|
mod boot;
|
||||||
mod memory;
|
|
||||||
mod macros;
|
|
||||||
|
|
||||||
lazy_static! {
|
lazy_static! {
|
||||||
static ref IDT: InterruptDescriptorTable = {
|
static ref IDT: InterruptDescriptorTable = {
|
||||||
let mut idt = InterruptDescriptorTable::new();
|
let mut idt = InterruptDescriptorTable::new();
|
||||||
idt.breakpoint.set_handler_fn(internals::errors::breakpoint_exception);
|
idt.breakpoint.set_handler_fn(internals::errors::breakpoint_exception);
|
||||||
idt.double_fault.set_handler_fn(internals::errors::double_fault);
|
|
||||||
idt.page_fault.set_handler_fn(internals::errors::page_fault);
|
|
||||||
idt
|
idt
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -98,17 +94,17 @@ pub extern fn kernel_main(args: KernelArgs) -> ! {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
println!();
|
ST.logln("");
|
||||||
println!();
|
ST.logln("");
|
||||||
println!();
|
ST.logln("");
|
||||||
println!("welcome to wukkOS!");
|
ST.logln("welcome to wukkOS!");
|
||||||
println!("(c) 2022 Real Microsoft, LLC");
|
ST.logln("(c) 2022 Real Microsoft, LLC");
|
||||||
print!("initialising memory maps...");
|
ST.log("initialising memory maps...");
|
||||||
let mem_areas = kern_info.get_memory_areas();
|
let mem_areas = kern_info.get_memory_areas();
|
||||||
println!("[OK]");
|
ST.logln("[OK]");
|
||||||
println!("memory map:");
|
ST.logln("memory map:");
|
||||||
for area in mem_areas {
|
for area in mem_areas {
|
||||||
println!("{:x} - {:x} : {}", area.start, area.end, match area.area_type {
|
ST.logln(format!("{:x} - {:x} : {}", area.start, area.end, match area.area_type {
|
||||||
boot::MemoryType::Available => "Available",
|
boot::MemoryType::Available => "Available",
|
||||||
boot::MemoryType::Reserved => "Reserved",
|
boot::MemoryType::Reserved => "Reserved",
|
||||||
boot::MemoryType::AcpiReclaimable => "ACPI Reclaimable",
|
boot::MemoryType::AcpiReclaimable => "ACPI Reclaimable",
|
||||||
|
@ -117,7 +113,7 @@ pub extern fn kernel_main(args: KernelArgs) -> ! {
|
||||||
boot::MemoryType::Kernel => "Kernel",
|
boot::MemoryType::Kernel => "Kernel",
|
||||||
boot::MemoryType::Bootloader => "Bootloader",
|
boot::MemoryType::Bootloader => "Bootloader",
|
||||||
boot::MemoryType::Unknown(_) => "Unknown"
|
boot::MemoryType::Unknown(_) => "Unknown"
|
||||||
});
|
}).as_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
loop {}
|
loop {}
|
||||||
|
|
|
@ -1,22 +0,0 @@
|
||||||
use alloc::fmt::format;
|
|
||||||
use core::fmt;
|
|
||||||
use std::fmt::format;
|
|
||||||
use crate::serial::terminal::ST;
|
|
||||||
|
|
||||||
#[macro_export]
|
|
||||||
macro_rules! print {
|
|
||||||
($($arg:tt)*) => ($crate::macros::_print(format_args!($($arg)*)));
|
|
||||||
}
|
|
||||||
|
|
||||||
#[macro_export]
|
|
||||||
macro_rules! println {
|
|
||||||
() => ($crate::print!("\n"));
|
|
||||||
($($arg:tt)*) => ($crate::print!("{}\n", format_args!($($arg)*)));
|
|
||||||
}
|
|
||||||
|
|
||||||
#[doc(hidden)]
|
|
||||||
pub fn _print(args: fmt::Arguments) {
|
|
||||||
use core::fmt::Write;
|
|
||||||
let string = format(args);
|
|
||||||
ST.log(string.as_str());
|
|
||||||
}
|
|
|
@ -1,4 +0,0 @@
|
||||||
#[repr(align(4096))]
|
|
||||||
pub struct PageTable {
|
|
||||||
entries: [PageTableEntry; 512],
|
|
||||||
}
|
|
Loading…
Add table
Add a link
Reference in a new issue