12 releases (6 breaking)

Uses old Rust 2015

0.8.0 Apr 25, 2022
0.7.0 Mar 11, 2021
0.6.0 Nov 25, 2020
0.4.0 Jul 14, 2018
0.0.3 Mar 19, 2015

#259 in Operating systems

Download history 944/week @ 2024-07-19 948/week @ 2024-07-26 793/week @ 2024-08-02 641/week @ 2024-08-09 681/week @ 2024-08-16 1036/week @ 2024-08-23 786/week @ 2024-08-30 529/week @ 2024-09-06 868/week @ 2024-09-13 430/week @ 2024-09-20 868/week @ 2024-09-27 669/week @ 2024-10-04 590/week @ 2024-10-11 573/week @ 2024-10-18 517/week @ 2024-10-25 509/week @ 2024-11-01

2,324 downloads per month
Used in 3 crates

MIT license

47KB
904 lines

Multiboot Crates.io Build

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

How-to use

extern crate core;

use multiboot::information::{MemoryManagement, Multiboot, PAddr};
use core::{slice, mem};

struct Mem;

impl MemoryManagement for Mem {
    unsafe fn paddr_to_slice(&self, addr: PAddr, size: usize) -> Option<&'static [u8]> {
        let ptr = mem::transmute(addr);
        Some(slice::from_raw_parts(ptr, size))
    }
    
    // If you only want to read fields, you can simply return `None`.
    unsafe fn allocate(&mut self, _length: usize) -> Option<(PAddr, &mut [u8])> {
        None
    }
    
    unsafe fn deallocate(&mut self, addr: PAddr) {
        if addr != 0 {
            unimplemented!()
        }
    }
}

static mut MEM: Mem = Mem;

/// mboot_ptr is the initial pointer to the multiboot structure
/// provided in %ebx on start-up.
pub fn use_multiboot(mboot_ptr: PAddr) -> Option<Multiboot<'static, 'static>> {
    unsafe {
        Multiboot::from_ptr(mboot_ptr, &mut MEM)
    }
}

Functionality is still not complete and patches are welcome!

Documentation

Dependencies