This is based on https://www.simtec.co.uk/products/SWLINUX/files/booting_article.html#appendix_tag_reference. Please open a pull request for missing tags.
To get started with this crate, create a [Atags
] struct with a given memory position. The iter()
method will return an iterator that returns [Atag
] entries.
```rust use atags::{Atag, Atags};
let mut buffer = [ // Core tag 0x00, 0x00, 0x00, 0x05, // size 0x54, 0x41, 0x00, 0x01, // tag 0x00, 0x00, 0x00, 0x01, // flags 0x00, 0x00, 0x10, 0x00, // pagesize 0x12, 0x34, 0x56, 0x78, // rootdevice_number
// Empty tag
0x0, 0x0, 0x0, 0x0, // size
0x0, 0x0, 0x0, 0x0, // tag
]; let ptr = core::ptr::NonNull::new(buffer.asmutptr()).unwrap(); let tags = unsafe { Atags::new(ptr.cast()) };
for tag in tags.iter() { // first tag is a core tag match tag { Atag::Core(core) => { asserteq!(core.flags, 1); asserteq!(core.pagesize, 0x1000); asserteq!(core.rootdevicenumber, 0x12345678); }, // Do something with the other tags // In this example we only get 1 core tag and nothing else _ => panic!("Unknown tag {:?}", tag), } } ```
nightly
Will enable the nightly strict_provenance
feature in this crate.
- Core docs
- Tracking issue