Skip to content

Commit

Permalink
Merge pull request #77 from phip1611/mb2-magic-num
Browse files Browse the repository at this point in the history
add multiboot2 magic number
  • Loading branch information
IsaacWoods authored Jul 16, 2021
2 parents 87f8b58 + 6f4b9e9 commit bd8ad01
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@ use core::marker::PhantomData;
use core::fmt::{Debug, Formatter};
use core::cmp::Ordering;

/// Magic number that a multiboot2-compliant boot loader will store in `eax` register
/// right before handoff to the payload (the kernel). This value can be used to check,
/// that the kernel was indeed booted via multiboot2.
///
/// Caution: You might need some assembly code (e.g. GAS or NASM) first, which
/// moves `eax` to another register, like `edi`. Otherwise it probably happens,
/// that the Rust compiler output changes `eax` before you can access it.
pub const MB2_MAGIC: u32 = 0x36d76289;

/// Possible Types of a [`Tag`]. The names and values are taken from the example C code
/// at the bottom of the Multiboot2 specification.
#[repr(u32)]
Expand Down
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ pub use elf_sections::{
};
pub use framebuffer::{FramebufferColor, FramebufferField, FramebufferTag, FramebufferType};
use header::{Tag, TagIter, TagType};
pub use header::MB2_MAGIC;
pub use memory_map::{
EFIMemoryAreaType, EFIMemoryDesc, EFIMemoryMapTag, MemoryArea, MemoryAreaIter, MemoryAreaType,
MemoryMapTag,
Expand Down

0 comments on commit bd8ad01

Please sign in to comment.