cleaner printfs

This commit is contained in:
Cadey Ratio 2019-10-24 10:21:48 -04:00
parent 74b603eb6c
commit 3c3cd08ebb
4 changed files with 8 additions and 10 deletions

View File

@ -28,7 +28,7 @@ pub fn init_heap(
mapper: &mut impl Mapper<Size4KiB>, mapper: &mut impl Mapper<Size4KiB>,
frame_allocator: &mut impl FrameAllocator<Size4KiB>, frame_allocator: &mut impl FrameAllocator<Size4KiB>,
) -> Result<(), MapToError> { ) -> Result<(), MapToError> {
println!("creating heap"); println!("[ ] creating heap");
let page_range = { let page_range = {
let heap_start = VirtAddr::new(HEAP_START as u64); let heap_start = VirtAddr::new(HEAP_START as u64);
let heap_end = heap_start + HEAP_SIZE - 1u64; let heap_end = heap_start + HEAP_SIZE - 1u64;
@ -49,7 +49,7 @@ pub fn init_heap(
super::ALLOCATOR.lock().init(HEAP_START, HEAP_SIZE); super::ALLOCATOR.lock().init(HEAP_START, HEAP_SIZE);
} }
println!("heap created"); println!("[ ] heap created");
Ok(()) Ok(())
} }

View File

@ -30,13 +30,12 @@ use core::panic::PanicInfo;
use bootloader::BootInfo; use bootloader::BootInfo;
pub fn init(boot_info: &'static BootInfo) { pub fn init(boot_info: &'static BootInfo) {
println!("XeOS booting"); println!("XeOS booting:");
gdt::init(); gdt::init();
interrupts::init_idt(); interrupts::init_idt();
unsafe { interrupts::PICS.lock().initialize() }; unsafe { interrupts::PICS.lock().initialize() };
x86_64::instructions::interrupts::enable(); x86_64::instructions::interrupts::enable();
allocator::init(&boot_info); allocator::init(&boot_info);
println!("XeOS booted");
} }
pub fn hlt_loop() -> ! { pub fn hlt_loop() -> ! {

View File

@ -13,17 +13,16 @@ use xe_os::println;
entry_point!(kernel_main); entry_point!(kernel_main);
fn kernel_main(boot_info: &'static BootInfo) -> ! { fn kernel_main(boot_info: &'static BootInfo) -> ! {
println!("booted");
xe_os::init(&boot_info); xe_os::init(&boot_info);
#[cfg(test)] #[cfg(test)]
test_main(); test_main();
println!("It did not crash!"); println!("Running WASM:");
xe_os::wasm::run(); xe_os::wasm::run();
println!("[ ] success");
println!("THE WASM RAN :DDDD");
xe_os::hlt_loop(); xe_os::hlt_loop();
} }

View File

@ -15,7 +15,7 @@ pub fn run() {
let bytes = include_bytes!("../../data/h.wasm"); let bytes = include_bytes!("../../data/h.wasm");
let b: Vec<u8> = bytes.iter().cloned().collect(); let b: Vec<u8> = bytes.iter().cloned().collect();
println!("loaded wasm into a Vec"); println!("[ ] loaded wasm into a Vec");
let module = wasmi::Module::from_buffer(&b).unwrap(); let module = wasmi::Module::from_buffer(&b).unwrap();
let mut imports = ImportsBuilder::new(); let mut imports = ImportsBuilder::new();
@ -25,7 +25,7 @@ pub fn run() {
.expect("failed to load wasm module") .expect("failed to load wasm module")
.assert_no_start(); .assert_no_start();
println!("invoking export"); println!("[ ] invoking export");
let _ = instance.invoke_export("h", &[], &mut H); let _ = instance.invoke_export("h", &[], &mut H);
} }