better logging
This commit is contained in:
parent
2a28a7a24d
commit
d8992dc2c2
|
@ -1,4 +1,4 @@
|
|||
use crate::{gdt, hlt_loop, print, println};
|
||||
use crate::{gdt, hlt_loop, println};
|
||||
use lazy_static::lazy_static;
|
||||
use x86_64::structures::idt::{InterruptDescriptorTable, InterruptStackFrame};
|
||||
|
||||
|
|
|
@ -32,9 +32,9 @@ use core::panic::PanicInfo;
|
|||
|
||||
pub fn init(boot_info: &'static BootInfo) {
|
||||
use x86_64::VirtAddr;
|
||||
use self::memory::{self, BootInfoFrameAllocator};
|
||||
use self::memory::BootInfoFrameAllocator;
|
||||
|
||||
println!("XeOS booting:");
|
||||
println!("[ ] XeOS booting");
|
||||
gdt::init();
|
||||
interrupts::init_idt();
|
||||
unsafe { interrupts::PICS.lock().initialize() };
|
||||
|
|
12
src/main.rs
12
src/main.rs
|
@ -21,17 +21,15 @@ fn kernel_main(boot_info: &'static BootInfo) -> ! {
|
|||
|
||||
// Read the rtc date time using this year
|
||||
let now = clock::current_time();
|
||||
println!(" now: {}", now.to_string());
|
||||
println!(" started at {}", now.to_string());
|
||||
|
||||
let mut executor = Executor::new();
|
||||
executor.spawn(Task::new(h_task()));
|
||||
executor.spawn(Task::new(example_task()));
|
||||
executor.spawn(Task::new(keyboard::print_keypresses()));
|
||||
|
||||
println!("[ ] Starting async executor");
|
||||
println!("[a] Starting async executor");
|
||||
executor.run();
|
||||
|
||||
xe_os::hlt_loop();
|
||||
}
|
||||
|
||||
// our existing panic handler
|
||||
|
@ -54,13 +52,13 @@ async fn async_number() -> u32 {
|
|||
}
|
||||
|
||||
async fn example_task() {
|
||||
println!("[ ] Starting number task");
|
||||
println!("[n] Starting number task");
|
||||
let number = async_number().await;
|
||||
println!("async number: {}", number);
|
||||
println!(" async number: {}", number);
|
||||
}
|
||||
|
||||
async fn h_task() {
|
||||
println!("[ ] Running WASM");
|
||||
println!("[w] Running WASM");
|
||||
wasm::run().await;
|
||||
println!(" success");
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ impl Executor {
|
|||
}
|
||||
|
||||
pub fn spawn(&mut self, task: Task) {
|
||||
println!(" Task {:?} started", task.id());
|
||||
println!("[T] Task {:?} started", task.id());
|
||||
self.task_queue.push_back(task)
|
||||
}
|
||||
|
||||
|
@ -37,7 +37,7 @@ impl Executor {
|
|||
match task.poll(&mut context) {
|
||||
Poll::Ready(()) => {
|
||||
// task done -> remove cached waker
|
||||
println!(" Task {:?} done", task_id);
|
||||
println!("[T] Task {:?} done", task_id);
|
||||
self.waker_cache.remove(&task_id);
|
||||
}
|
||||
Poll::Pending => {
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
use crate::{print, println};
|
||||
use alloc::vec::Vec;
|
||||
use wasmi::{
|
||||
Error as InterpreterError, Externals, FuncInstance, FuncRef, ImportsBuilder,
|
||||
ModuleImportResolver, ModuleInstance, RuntimeArgs, RuntimeValue, Signature, Trap, ValueType,
|
||||
|
@ -9,14 +10,16 @@ use crate::{serial_print, serial_println};
|
|||
|
||||
mod hack;
|
||||
|
||||
pub async fn run() {
|
||||
use alloc::vec::Vec;
|
||||
|
||||
async fn load_wasm_module() -> wasmi::Module {
|
||||
let bytes = include_bytes!("../../data/h.wasm");
|
||||
let b: Vec<u8> = bytes.iter().cloned().collect();
|
||||
println!(" loaded wasm into a Vec");
|
||||
|
||||
let module = wasmi::Module::from_buffer(&b).unwrap();
|
||||
wasmi::Module::from_buffer(&b).unwrap()
|
||||
}
|
||||
|
||||
pub async fn run() {
|
||||
let module = load_wasm_module().await;
|
||||
let mut imports = ImportsBuilder::new();
|
||||
imports.push_resolver("h", &H);
|
||||
|
||||
|
|
Loading…
Reference in New Issue