Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions uefi/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# uefi - [Unreleased]

## Added
- Made memory map types `#[repr(C)]`

## Changed

Expand Down
4 changes: 4 additions & 0 deletions uefi/src/mem/memory_map/impl_.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ impl core::error::Error for MemoryMapError {}

/// Implementation of [`MemoryMap`] for the given buffer.
#[derive(Debug)]
#[repr(C)]
pub struct MemoryMapRef<'a> {
buf: &'a [u8],
meta: MemoryMapMeta,
Expand Down Expand Up @@ -107,6 +108,7 @@ impl Index<usize> for MemoryMapRef<'_> {

/// Implementation of [`MemoryMapMut`] for the given buffer.
#[derive(Debug)]
#[repr(C)]
pub struct MemoryMapRefMut<'a> {
buf: &'a mut [u8],
meta: MemoryMapMeta,
Expand Down Expand Up @@ -287,6 +289,7 @@ impl IndexMut<usize> for MemoryMapRefMut<'_> {
///
/// [`boot::get_memory_map`]: crate::boot::get_memory_map
#[derive(Debug)]
#[repr(C)]
pub(crate) struct MemoryMapBackingMemory(NonNull<[u8]>);

impl MemoryMapBackingMemory {
Expand Down Expand Up @@ -386,6 +389,7 @@ impl Drop for MemoryMapBackingMemory {

/// Implementation of [`MemoryMapMut`] that owns the buffer on the UEFI heap.
#[derive(Debug)]
#[repr(C)]
pub struct MemoryMapOwned {
/// Backing memory, properly initialized at this point.
pub(crate) buf: MemoryMapBackingMemory,
Expand Down
1 change: 1 addition & 0 deletions uefi/src/mem/memory_map/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ pub struct MemoryMapKey(pub(crate) usize);
/// called. All following invocations (hidden, subtle, and asynchronous ones)
/// will likely invalidate this.
#[derive(Copy, Clone, Debug)]
#[repr(C)]
pub struct MemoryMapMeta {
/// The actual size of the map.
pub map_size: usize,
Expand Down