Skip to content

AdrianDanis/rust-multiboot

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

51 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Multiboot Build Status Crates.io

This is a multiboot (v1) library written entirely in rust. The code depends only on libcore.

How-to use

/// Translate a physical memory address and size into a slice
pub unsafe fn paddr_to_slice<'a>(p: PAddr, sz: usize) -> Option<&'a [u8]> {
    let ptr = mem::transmute(p + KERNEL_BASE);
    Some(slice::from_raw_parts(ptr, sz)
}

/// mboot_ptr is the initial pointer to the multiboot structure
/// provided in %ebx on start-up.
pub fn use_multiboot(mboot_ptr: PAddr) {
    Multiboot::new(mboot_ptr,  paddr_to_slice).map(|mb| {
        mb.memory_regions().map(|regions| {
            for region in regions {
                println!("Found {:?}", region);
            }
        });

        mb.modules().map(|modules| {
            for module in modules {
                println!("Found {:?}", module);
            }
        });
    });
}

Functionality is still not complete and patches are welcome!

Documentation

About

Multiboot library written in rust.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Rust 100.0%