Skip to content

Commit 0d1a9da

Browse files
committed
uefi: Update exit_boot_services() prototype
1 parent 83bb2dc commit 0d1a9da

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
- `MpService::startup_all_aps` and `MpService::startup_this_ap` now accept an
1818
optional `event` parameter to allow non-blocking operation.
1919
- Added `core::error::Error` implementations to all error types.
20+
- `SystemTable::exit_boot_services` now takes one param `memory_type` to ensure
21+
the memory type of memory map.
2022

2123
### Removed
2224
- `BootServices::memmove` and `BootServices::set_mem` have been removed, use

uefi-test-runner/src/main.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ extern crate alloc;
99
use alloc::string::ToString;
1010
use uefi::prelude::*;
1111
use uefi::proto::console::serial::Serial;
12+
use uefi::table::boot::MemoryType;
1213
use uefi::Result;
1314
use uefi_services::{print, println};
1415

@@ -163,7 +164,7 @@ fn shutdown(mut st: SystemTable<Boot>) -> ! {
163164
send_request_to_host(st.boot_services(), HostRequest::TestsComplete);
164165

165166
// Exit boot services as a proof that it works :)
166-
let (st, _iter) = st.exit_boot_services();
167+
let (st, _iter) = st.exit_boot_services(MemoryType::LOADER_DATA);
167168

168169
#[cfg(target_arch = "x86_64")]
169170
{

uefi/src/table/system.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -194,8 +194,8 @@ impl SystemTable<Boot> {
194194
/// restricted `SystemTable<Runtime>` view as an output.
195195
///
196196
/// The memory map at the time of exiting boot services is also
197-
/// returned. The map is backed by a [`MemoryType::LOADER_DATA`]
198-
/// allocation. Since the boot services function to free that memory is no
197+
/// returned. The map is backed by a allocation with given `memory_type`.
198+
/// Since the boot services function to free that memory is no
199199
/// longer available after calling `exit_boot_services`, the allocation is
200200
/// live until the program ends. The lifetime of the memory map is therefore
201201
/// `'static`.
@@ -221,7 +221,10 @@ impl SystemTable<Boot> {
221221
/// [`Logger::disable`]: crate::logger::Logger::disable
222222
/// [`uefi_services::init`]: https://docs.rs/uefi-services/latest/uefi_services/fn.init.html
223223
#[must_use]
224-
pub fn exit_boot_services(self) -> (SystemTable<Runtime>, MemoryMap<'static>) {
224+
pub fn exit_boot_services(
225+
self,
226+
memory_type: MemoryType,
227+
) -> (SystemTable<Runtime>, MemoryMap<'static>) {
225228
let boot_services = self.boot_services();
226229

227230
// Reboot the device.
@@ -236,7 +239,7 @@ impl SystemTable<Boot> {
236239

237240
// Allocate a byte slice to hold the memory map. If the
238241
// allocation fails treat it as an unrecoverable error.
239-
let buf: *mut u8 = match boot_services.allocate_pool(MemoryType::LOADER_DATA, buf_size) {
242+
let buf: *mut u8 = match boot_services.allocate_pool(memory_type, buf_size) {
240243
Ok(buf) => buf,
241244
Err(err) => reset(err.status()),
242245
};

0 commit comments

Comments
 (0)