-
-
Notifications
You must be signed in to change notification settings - Fork 169
Memory map change #915
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Memory map change #915
Conversation
abea9ce
to
da896c9
Compare
Thanks for the PR! The change to add a I'm a little less sure about the lifetime fix. While I think what you have probably works fine for It seems like there's a conflict here between having the mutable
There may be other options, open to ideas here :) |
The MemoryMapIter get the buffer's location from MemoryMap and keep it's lifetime. So I think that it's equivalent between my code and the current MemoryMapIter implementation in ther master branch. (Use
But I'm not sure if there are some of |
Here's a concrete example showing UB: fn test_mem_map(bt: &BootServices) {
let sizes = bt.memory_map_size();
let mut buffer = vec![0; sizes.map_size * sizes.entry_size];
let mut memory_map = bt.memory_map(&mut buffer).unwrap();
let mut entries = memory_map.entries();
info!("first entry: {:?}", entries.next());
// UB! The data being iterated over is modified while we have a supposedly
// immutable reference to the data.
memory_map.sort();
info!("next entry: {:?}", entries.next());
} In the |
dd439a3
to
fe0a43c
Compare
fe0a43c
to
96fc71d
Compare
96fc71d
to
9c9e206
Compare
9c9e206
to
0d1a9da
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lgtm for the addition of the memory type param, thanks!
Remove the reference type in iterator which results in incorrect lifetime for return value of MemoryMap::entries()Change prototype of exit_boot_services()
For #914
Checklist