Skip to content

Commit 4396721

Browse files
committed
multiboot2: Get a mutable reference to the basic memory information tag
1 parent c277fb8 commit 4396721

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

multiboot2/src/lib.rs

+6
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,12 @@ impl BootInformation {
249249
self.get_tag::<BasicMemoryInfoTag, _>(TagType::BasicMeminfo)
250250
}
251251

252+
/// Search for the basic memory info tag, return a mutable reference.
253+
pub fn basic_memory_info_tag_mut(&mut self) -> Option<&mut BasicMemoryInfoTag> {
254+
self.get_tag_mut(TagType::BasicMeminfo)
255+
.map(|tag| unsafe { &mut *(tag as *mut Tag as *mut BasicMemoryInfoTag) })
256+
}
257+
252258
/// Search for the ELF Sections.
253259
///
254260
/// # Examples

0 commit comments

Comments
 (0)