pub struct PhysBox { /* private fields */ }
Expand description

An RAII guard of a physical memory allocation. Currently all physically allocated memory are page-aligned and take up at least 4k of space (on x86_64).

Implementations

Construct a PhysBox from an address and a size.

Safety

This function is unsafe because when dropping, Self has to a valid allocation.

Retrieve the byte address in physical memory, of this allocation.

Retrieve the size in bytes of the alloc.

Allocate physical memory that must reside in 32-bit space.

“Partially” allocate physical memory, in the sense that the allocation may be smaller than expected, but still with a minimum limit. This is particularly useful when the physical memory space is fragmented, and a device supports scatter-gather I/O. In that case, the driver can optimistically request e.g. 1 alloc of 1 MiB, with the minimum of 512 KiB. If that first allocation only returns half the size, the driver can do another allocation and then let the device use both buffers.

Trait Implementations

Formats the value using the given formatter. Read more

Executes the destructor for this type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.