Skip to content

Commit 57bd85d

Browse files
rust-osdev#360: Resolve @phil-opp's concerns (1/5)
1 parent fd818fc commit 57bd85d

File tree

1 file changed

+0
-24
lines changed

1 file changed

+0
-24
lines changed

uefi/src/main.rs

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -136,30 +136,6 @@ fn main_inner(image: Handle, mut st: SystemTable<Boot>) -> Status {
136136
}
137137
);
138138

139-
let _mmap_storage = {
140-
let mut memory_map_size = st.boot_services().memory_map_size();
141-
loop {
142-
let ptr = st
143-
.boot_services()
144-
.allocate_pool(MemoryType::LOADER_DATA, memory_map_size.map_size)
145-
.expect("Failed to allocate memory for mmap storage");
146-
147-
let storage = unsafe { slice::from_raw_parts_mut(ptr, memory_map_size.map_size) };
148-
149-
if st.boot_services().memory_map(storage).is_ok() {
150-
break storage;
151-
}
152-
153-
// By measuring the size here, we can find out exactly how much we need.
154-
// We may hit this code twice, if the map allocation ends up spanning more pages.
155-
memory_map_size = st.boot_services().memory_map_size();
156-
// allocated memory region was not big enough -> free it again
157-
st.boot_services()
158-
.free_pool(ptr)
159-
.expect("Failed to free temporary memory for memory map!");
160-
}
161-
};
162-
163139
log::trace!("exiting boot services");
164140
let (system_table, memory_map) = st.exit_boot_services();
165141

0 commit comments

Comments
 (0)