pub struct Memory {
pub ptr: *mut u8,
pub len: usize,
/* private fields */
}Expand description
A managed memory region.
Represents an allocated memory block with pointer, length, and physical frame number (PFN) offset information for address translation.
Fields§
§ptr: *mut u8Block pointer
len: usizeBlock length in bytes
Implementations§
Source§impl Memory
impl Memory
Sourcepub fn new(ptr: *mut u8, len: usize) -> Self
pub fn new(ptr: *mut u8, len: usize) -> Self
Creates a new memory block with the given pointer and length.
Sourcepub fn new_with_parts(ptr: *mut u8, len: usize, pfn_offset: PfnOffset) -> Self
pub fn new_with_parts(ptr: *mut u8, len: usize, pfn_offset: PfnOffset) -> Self
Creates a new memory block with specified PFN offset.
§Arguments
ptr- Pointer to the memory blocklen- Length in bytespfn_offset- Physical frame number offset configuration
Trait Implementations§
Source§impl BytePointer for Memory
impl BytePointer for Memory
Source§impl GetConsecPfns for Memory
impl GetConsecPfns for Memory
impl Send for Memory
Auto Trait Implementations§
impl Freeze for Memory
impl !RefUnwindSafe for Memory
impl !Sync for Memory
impl Unpin for Memory
impl UnwindSafe for Memory
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> PfnOffsetResolver for Twhere
T: BytePointer + CachedPfnOffset,
impl<T> PfnOffsetResolver for Twhere
T: BytePointer + CachedPfnOffset,
Source§fn pfn_offset(
&self,
mem_config: &MemConfiguration,
conflict_threshold: u64,
timer: &dyn MemoryTupleTimer,
progress: Option<&MultiProgress>,
) -> Option<usize>
fn pfn_offset( &self, mem_config: &MemConfiguration, conflict_threshold: u64, timer: &dyn MemoryTupleTimer, progress: Option<&MultiProgress>, ) -> Option<usize>
Find the PFN-VA offset in rows.
This is brute force, simply trying all row offsets from 0…row_offsets (determined using mem_config) There probably is a more sophisticated way to implement this, e.g., by examing the bank orders and filtering for possible “bank periods” after each iteration, but this here should be fast enough for now. WARNING: This function initializes pfn_offset with the provided mem_config. Calling #pfn_offset(…) with different arguments afterward WILL NOT reset the OnceCell, potentially causing unintended behavior.