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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
//! Rust library with type definitions and parsing functions for Multiboot2
//! headers, as well as a builder to build them at runtime. This library is
//! `no_std` and can be used in bootloaders.
//!
//! # Example: Parsing a Header
//!
//! ```no_run
//! use multiboot2_header::Multiboot2Header;
//!
//! let ptr = 0x1337_0000 as *const u8 /* use real ptr here */;
//! let mb2_hdr = unsafe { Multiboot2Header::load(ptr.cast()) }.unwrap();
//! for _tag in mb2_hdr.iter() {
//!     //
//! }
//! ```
//!
//! ## MSRV
//!
//! The MSRV is 1.70.0 stable.

#![no_std]
#![cfg_attr(feature = "unstable", feature(error_in_core))]
// --- BEGIN STYLE CHECKS ---
#![deny(
    clippy::all,
    clippy::cargo,
    clippy::nursery,
    clippy::must_use_candidate,
    // clippy::restriction,
    // clippy::pedantic
)]
// now allow a few rules which are denied by the above statement
// --> They are either ridiculous, not necessary, or we can't fix them.
#![allow(clippy::multiple_crate_versions)]
#![deny(missing_docs)]
#![deny(missing_debug_implementations)]
#![deny(rustdoc::all)]
// --- END STYLE CHECKS ---

#[cfg(feature = "builder")]
extern crate alloc;

#[cfg_attr(test, macro_use)]
#[cfg(test)]
extern crate std;

/// Iterator over the tags of a Multiboot2 boot information.
pub type TagIter<'a> = multiboot2_common::TagIter<'a, HeaderTagHeader>;

/// A generic version of all boot information tags.
#[cfg(test)]
pub type GenericHeaderTag = multiboot2_common::DynSizedStructure<HeaderTagHeader>;

mod address;
mod console;
mod end;
mod entry_address;
mod entry_efi_32;
mod entry_efi_64;
mod framebuffer;
mod header;
mod information_request;
mod module_align;
mod relocatable;
mod tags;
mod uefi_bs;

#[cfg(feature = "builder")]
mod builder;

pub use multiboot2_common::{DynSizedStructure, MaybeDynSized, Tag};

pub use self::address::*;
pub use self::console::*;
pub use self::end::*;
pub use self::entry_address::*;
pub use self::entry_efi_32::*;
pub use self::entry_efi_64::*;
pub use self::framebuffer::*;
pub use self::header::*;
pub use self::information_request::*;
pub use self::module_align::*;
pub use self::relocatable::*;
pub use self::tags::*;
pub use self::uefi_bs::*;
#[cfg(feature = "builder")]
pub use builder::Builder;

/// Re-export of [`multiboot2::TagType`] from `multiboot2`-crate.
pub use multiboot2::{TagType as MbiTagType, TagTypeId as MbiTagTypeId};