Skip to content

Commit db5e9c8

Browse files
committed
doc: improve description of MemoryMap
1 parent 8264e47 commit db5e9c8

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

uefi/src/table/boot.rs

+11-4
Original file line numberDiff line numberDiff line change
@@ -1793,15 +1793,22 @@ impl MemoryMapMeta {
17931793
}
17941794
}
17951795

1796-
/// An accessory to the UEFI memory map that can be either iterated or indexed
1797-
/// like an array.
1796+
/// An accessory to the UEFI memory map and associated metadata that can be
1797+
/// either iterated or indexed like an array.
17981798
///
17991799
/// A [`MemoryMap`] is always associated with the unique [`MemoryMapKey`]
1800-
/// bundled with the ma.
1800+
/// bundled with the map.
18011801
///
18021802
/// To iterate over the entries, call [`MemoryMap::entries`].
18031803
///
18041804
/// ## UEFI pitfalls
1805+
/// Note that a MemoryMap can quickly become outdated, as soon as any explicit
1806+
/// or hidden allocation happens.
1807+
///
1808+
/// As soon as boot services are excited, all previous obtained memory maps must
1809+
/// be considered as outdated, except if the [`MemoryMapKey`] equals the one
1810+
/// returned by `exit_boot_services()`.
1811+
///
18051812
/// **Please note** that when working with memory maps, the `entry_size` is
18061813
/// usually larger than `size_of::<MemoryDescriptor` [[0]]. So to be safe,
18071814
/// always use `entry_size` as step-size when interfacing with the memory map on
@@ -2455,7 +2462,7 @@ mod tests_mmap_real {
24552462
7, 1048576, 0, 1792, 15, 0, 10, 8388608, 0, 8, 15, 0, 7, 8421376, 0, 3, 15, 0, 10, 8433664,
24562463
0, 1, 15, 0, 7, 8437760, 0, 4, 15, 0, 10, 8454144, 0, 240, 15, 0,
24572464
];
2458-
2465+
24592466
#[test]
24602467
fn basic_functionality() {
24612468
let mut buf = MMAP_RAW;

0 commit comments

Comments
 (0)