diff --git a/src/main.rs b/src/main.rs index 2dd78cb..fd8d94a 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,5 +1,5 @@ #![no_std] -#![no_main] +#![no_main] // overwriting rusts' entry point #![feature(custom_test_frameworks)] #![test_runner(orust_os::test_runner)] #![reexport_test_harness_main = "test_main"] @@ -18,24 +18,11 @@ pub trait Testable { fn run(&self); } -entry_point!(kernel_main); - -fn kernel_main(boot_info: &'static BootInfo) -> ! { - use orust_os::allocator; - use orust_os::memory::{self, BootInfoFrameAllocator}; - use x86_64::VirtAddr; - +#[no_mangle] +pub extern "C" fn _start() -> ! { println!("Hello, Welcome to the ORUST Operating System{}", "!"); - orust_os::init(); - let phys_mem_offset = VirtAddr::new(boot_info.physical_memory_offset); - let mut mapper = unsafe { memory::init(phys_mem_offset) }; - let mut frame_allocator = unsafe { - BootInfoFrameAllocator::init(&boot_info.memory_map) - }; - - allocator::init_heap(&mut mapper, &mut frame_allocator) - .expect("heap initialization failed"); + orust_os::init(); #[cfg(test)] test_main(); @@ -55,16 +42,8 @@ fn panic(info: &PanicInfo) -> ! { } #[cfg(test)] +// function called on panic. #[panic_handler] fn panic(info: &PanicInfo) -> ! { orust_os::test_panic_handler(info) -} - -async fn async_number() -> u32 { - 42 -} - -async fn example_task() { - let number = async_number().await; - println!("async number: {}", number); } \ No newline at end of file