1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
//! Multiboot v1 library
//!
//! The main structs to interact with are [`Multiboot`] for the Multiboot information
//! passed from the bootloader to the kernel at runtime and [`Header`] for the static
//! information passed from the kernel to the bootloader in the kernel image.
//!
//!
//!
//! # Additional documentation
//! * https://www.gnu.org/software/grub/manual/multiboot/multiboot.html
//! * http://git.savannah.gnu.org/cgit/grub.git/tree/doc/multiboot.texi?h=multiboot
//!
//! [`Multiboot`]: information/struct.Multiboot.html
//! [`Header`]: header/struct.Header.html
#![no_std]
#![crate_name = "multiboot"]
#![crate_type = "lib"]
macro_rules! round_up {
($num:expr, $s:expr) => {
(($num + $s - 1) / $s) * $s
};
}
macro_rules! flag {
($doc:meta, $fun:ident, $bit:expr) => {
#[$doc]
pub fn $fun(&self) -> bool {
//assert!($bit <= 31);
(self.header.flags & (1 << $bit)) > 0
}
paste::paste! {
#[$doc]
pub fn [< set_ $fun >] (&mut self, flag: bool) {
//assert!($bit <= 31);
self.header.flags = if flag {
self.header.flags | (1 << $bit)
} else {
self.header.flags & !(1 << $bit)
};
}
}
};
}
pub mod header;
pub mod information;
#[cfg(doctest)]
mod test_readme {
macro_rules! external_doc_test {
($x:expr) => {
#[doc = $x]
extern "C" {}
};
}
external_doc_test!(include_str!("../README.md"));
}