This is a multiboot (v1) library written in rust to be used in kernel level code. The code depends only on libcore.
```rust /// Translate a physical memory address into a kernel addressable location. pub fn paddrtokernelvaddr(p: PAddr) -> VAddr { (p + KERNELBASE) as VAddr }
/// mbootptr is the initial pointer to the multiboot structure /// provided in %ebx on start-up. pub fn usemultiboot(mbootptr: PAddr) { // Create a new instance of the Multiboot struct let multiboot = Multiboot::new(mbootptr, paddrtokernel_vaddr);
// Find all available memory regions:
let cb = | base, size, mtype | {
println!("Found new memory region: {:x} -- {:x}, base, base+size);
};
multiboot.find_memory(cb);
// Find all multiboot provided modules:
let mod_cb = | name, start, end | {
log!("Found module {}: {:x} - {:x}", name, start, end);
}
multiboot.find_modules(mod_cb);
} ```
Functionality is still not complete and Patches are welcome!