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
//! 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
//!
//! ```rust
//! use multiboot2_header::builder::{InformationRequestHeaderTagBuilder, HeaderBuilder};
//! use multiboot2_header::{HeaderTagFlag, HeaderTagISA, MbiTagType, RelocatableHeaderTag, RelocatableHeaderTagPreference, Multiboot2Header};
//!
//! // Small example that creates a Multiboot2 header and parses it afterwards.
//!
//! // We create a Multiboot2 header during runtime here. A practical example is that your
//! // program gets the header from a file and parses it afterwards.
//! let mb2_hdr_bytes = HeaderBuilder::new(HeaderTagISA::I386)
//!     .relocatable_tag(RelocatableHeaderTag::new(
//!         HeaderTagFlag::Required,
//!         0x1337,
//!         0xdeadbeef,
//!         4096,
//!         RelocatableHeaderTagPreference::None,
//!     ))
//!     .information_request_tag(
//!         InformationRequestHeaderTagBuilder::new(HeaderTagFlag::Required)
//!             .add_irs(&[MbiTagType::Cmdline, MbiTagType::BootLoaderName]),
//!     )
//!     .build();
//!
//! // Cast bytes in vector to Multiboot2 information structure
//! let mb2_hdr = unsafe { Multiboot2Header::load(mb2_hdr_bytes.as_ptr().cast()) };
//! println!("{:#?}", mb2_hdr);
//!
//! ```
//!
//! ## MSRV
//!
//! The MSRV is 1.69.0 stable.

#![no_std]
#![cfg_attr(feature = "unstable", feature(error_in_core))]
#![deny(rustdoc::all)]
#![deny(clippy::all)]
#![deny(clippy::missing_const_for_fn)]
#![deny(missing_debug_implementations)]

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

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

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")]
pub mod builder;

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::*;

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