main.rs 764 B

12345678910111213141516171819202122232425262728
  1. #![no_main]
  2. #![no_std]
  3. #![feature(error_in_core)]
  4. mod loader;
  5. mod multiboot;
  6. extern crate alloc;
  7. #[macro_use]
  8. extern crate util;
  9. use util::init_environment;
  10. core::arch::global_asm!(include_str!("start.S"), options(att_syntax));
  11. /// Entry into the Rust code from assembly using the x86 SystemV calling
  12. /// convention.
  13. #[no_mangle]
  14. fn rust_entry(multiboot_magic: u32, multiboot_hdr: *const u32) -> ! {
  15. init_environment();
  16. let x = 0.12 + 0.56;
  17. log::debug!("{x}");
  18. log::debug!("multiboot_hdr={multiboot_hdr:x?}, multiboot_magic=0x{multiboot_magic:x?}");
  19. let mbi = multiboot::get_mbi(multiboot_magic, multiboot_hdr as u32).unwrap();
  20. let module_iter = mbi.modules().expect("Should provide modules");
  21. loader::load_module(module_iter);
  22. }