Skip to content

Commit b7f256b

Browse files
authored
Merge pull request #906 from nicholasbishop/bishop-drop-memmove
Drop `memmove` and `set_mem` from boot services
2 parents e6163a5 + d0372e9 commit b7f256b

File tree

3 files changed

+4
-43
lines changed

3 files changed

+4
-43
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@
1616
- `MpService::startup_all_aps` and `MpService::startup_this_ap` now accept an
1717
optional `event` parameter to allow non-blocking operation.
1818

19+
### Removed
20+
- `BootServices::memmove` and `BootServices::set_mem` have been removed, use
21+
standard functions like `core::ptr::copy` and `core::ptr::write_bytes` instead.
22+
1923
## uefi-macros - [Unreleased]
2024

2125
## uefi-services - [Unreleased]

uefi-test-runner/src/boot/memory.rs

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ pub fn test(bt: &BootServices) {
88
allocate_pages(bt);
99
vec_alloc();
1010
alloc_alignment();
11-
memmove(bt);
1211

1312
memory_map(bt);
1413
}
@@ -57,28 +56,6 @@ fn alloc_alignment() {
5756
assert_eq!(value.as_ptr() as usize % 0x100, 0, "Wrong alignment");
5857
}
5958

60-
// Test that the `memmove` / `set_mem` functions work.
61-
fn memmove(bt: &BootServices) {
62-
info!("Testing the `memmove` / `set_mem` functions");
63-
64-
let src = [1, 2, 3, 4];
65-
let mut dest = [0u8; 4];
66-
67-
// Fill the buffer with a value
68-
unsafe {
69-
bt.set_mem(dest.as_mut_ptr(), dest.len(), 1);
70-
}
71-
72-
assert_eq!(dest, [1; 4], "Failed to set memory");
73-
74-
// Copy other values on it
75-
unsafe {
76-
bt.memmove(dest.as_mut_ptr(), src.as_ptr(), dest.len());
77-
}
78-
79-
assert_eq!(dest, src, "Failed to copy memory");
80-
}
81-
8259
fn memory_map(bt: &BootServices) {
8360
info!("Testing memory map functions");
8461

uefi/src/table/boot.rs

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1320,26 +1320,6 @@ impl BootServices {
13201320
})
13211321
}
13221322

1323-
/// Copies memory from source to destination. The buffers can overlap.
1324-
///
1325-
/// # Safety
1326-
///
1327-
/// This function is unsafe as it can be used to violate most safety
1328-
/// invariants of the Rust type system.
1329-
pub unsafe fn memmove(&self, dest: *mut u8, src: *const u8, size: usize) {
1330-
(self.0.copy_mem)(dest, src, size);
1331-
}
1332-
1333-
/// Sets a buffer to a certain value.
1334-
///
1335-
/// # Safety
1336-
///
1337-
/// This function is unsafe as it can be used to violate most safety
1338-
/// invariants of the Rust type system.
1339-
pub unsafe fn set_mem(&self, buffer: *mut u8, size: usize, value: u8) {
1340-
(self.0.set_mem)(buffer, size, value);
1341-
}
1342-
13431323
/// Retrieves a [`SimpleFileSystem`] protocol associated with the device the given
13441324
/// image was loaded from.
13451325
///

0 commit comments

Comments
 (0)