diff --git a/src/hack.rs b/src/hack.rs deleted file mode 100644 index 21a3427..0000000 --- a/src/hack.rs +++ /dev/null @@ -1,20 +0,0 @@ -#[no_mangle] -extern "C" fn fmod(x: f64, _y: f64) -> f64 { unimplemented!(); } - -#[no_mangle] -extern "C" fn fmodf(x: f32, _y: f32) -> f32 { unimplemented!(); } - -#[no_mangle] -extern "C" fn fmin(x: f64, _y: f64) -> f64 { unimplemented!(); } - -#[no_mangle] -extern "C" fn fminf(x: f32, _y: f32) -> f32 { unimplemented!(); } - -#[no_mangle] -extern "C" fn fmax(x: f64, _y: f64) -> f64 { unimplemented!(); } - -#[no_mangle] -extern "C" fn fmaxf(x: f32, _y: f32) -> f32 { unimplemented!(); } - -#[no_mangle] -extern "C" fn __truncdfsf2(x: f64) -> f32 { unimplemented!(); } diff --git a/src/lib.rs b/src/lib.rs index cfc99e0..09387a8 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -30,11 +30,13 @@ use core::panic::PanicInfo; use bootloader::BootInfo; pub fn init(boot_info: &'static BootInfo) { + println!("XeOS booting"); gdt::init(); interrupts::init_idt(); unsafe { interrupts::PICS.lock().initialize() }; x86_64::instructions::interrupts::enable(); allocator::init(&boot_info); + println!("XeOS booted"); } pub fn hlt_loop() -> ! { diff --git a/src/main.rs b/src/main.rs index 1633f97..56675c3 100644 --- a/src/main.rs +++ b/src/main.rs @@ -5,18 +5,16 @@ #![reexport_test_harness_main = "test_main"] extern crate alloc; -mod hack; use bootloader::{entry_point, BootInfo}; use core::panic::PanicInfo; -use xe_os::{print, println}; +use xe_os::println; entry_point!(kernel_main); fn kernel_main(boot_info: &'static BootInfo) -> ! { println!("booted"); xe_os::init(&boot_info); - println!("Hello World{}", "!"); #[cfg(test)] test_main(); diff --git a/src/wasm/hack.rs b/src/wasm/hack.rs new file mode 100644 index 0000000..1c1cc2b --- /dev/null +++ b/src/wasm/hack.rs @@ -0,0 +1,20 @@ +#[no_mangle] +extern "C" fn fmod(_x: f64, _y: f64) -> f64 { unimplemented!(); } + +#[no_mangle] +extern "C" fn fmodf(_x: f32, _y: f32) -> f32 { unimplemented!(); } + +#[no_mangle] +extern "C" fn fmin(_x: f64, _y: f64) -> f64 { unimplemented!(); } + +#[no_mangle] +extern "C" fn fminf(_x: f32, _y: f32) -> f32 { unimplemented!(); } + +#[no_mangle] +extern "C" fn fmax(_x: f64, _y: f64) -> f64 { unimplemented!(); } + +#[no_mangle] +extern "C" fn fmaxf(_x: f32, _y: f32) -> f32 { unimplemented!(); } + +#[no_mangle] +extern "C" fn __truncdfsf2(_x: f64) -> f32 { unimplemented!(); } diff --git a/src/wasm/mod.rs b/src/wasm/mod.rs index 36c98cd..e2a80ac 100644 --- a/src/wasm/mod.rs +++ b/src/wasm/mod.rs @@ -1,10 +1,15 @@ use wasmi::{ - Error as InterpreterError, Externals, FuncInstance, FuncRef, HostError, ImportsBuilder, - ModuleImportResolver, ModuleInstance, ModuleRef, RuntimeArgs, RuntimeValue, Signature, Trap, + Error as InterpreterError, Externals, FuncInstance, FuncRef, ImportsBuilder, + ModuleImportResolver, ModuleInstance, RuntimeArgs, RuntimeValue, Signature, Trap, ValueType, }; use crate::{print, println}; +#[cfg(test)] +use crate::{serial_print, serial_println}; + +mod hack; + pub fn run() { use alloc::vec::Vec; @@ -24,6 +29,13 @@ pub fn run() { let _ = instance.invoke_export("h", &[], &mut H); } +#[test_case] +fn test_wasm() { + serial_print!("running h example... "); + run(); + serial_println!("[ok]"); +} + struct H; const H_FUNC: usize = 0; diff --git a/tests/heap_allocation.rs b/tests/heap_allocation.rs index 01b6fab..54fc436 100644 --- a/tests/heap_allocation.rs +++ b/tests/heap_allocation.rs @@ -12,10 +12,6 @@ use core::panic::PanicInfo; entry_point!(main); fn main(boot_info: &'static BootInfo) -> ! { - use xe_os::allocator; - use xe_os::memory::{self, BootInfoFrameAllocator}; - use x86_64::VirtAddr; - xe_os::init(boot_info); test_main();