|
ReXGlue SDK
|
#include <rex/kernel/guest_allocator.h>
Classes | |
| struct | AllocatorStats |
Public Member Functions | |
| GuestAllocator (Key, GuestAddressSpace &memory, u32 base, u32 size, void *state, GuestPool pool) | |
| u32 | GetBase () const |
| u32 | GetSize () const |
| GuestPool | GetPool () const |
| bool | Contains (u32 address) const |
| void * | Allocate (u32 size) |
| void * | Reallocate (void *block, u32 size) |
| void | Free (void *block) |
| AllocatorStats | GetStats () const |
| bool | IsConsistent () const |
Static Public Member Functions | |
| static Result< std::unique_ptr< GuestAllocator > > | Create (rex::kernel::GuestMemory &memory, u32 size, u32 alignment, bool physical, u32 page_size, u32 flags, GuestPool pool) |
| static const char * | GetPoolPlotName (GuestPool pool) |
Static Public Attributes | |
| static constexpr u32 | kBlockAlignment = 16 |
Friends | |
| class | rex::kernel::shim::GuestHeap |
Additional Inherited Members | |
| Protected Member Functions inherited from rex::NonCopyable | |
| NonCopyable (const NonCopyable &)=delete | |
| NonCopyable & | operator= (const NonCopyable &)=delete |
Reserves and commits a range of guest memory and serves blocks from it. The shim heap is its user.
| rex::kernel::GuestAllocator::GuestAllocator | ( | Key | , |
| GuestAddressSpace & | memory, | ||
| u32 | base, | ||
| u32 | size, | ||
| void * | state, | ||
| GuestPool | pool ) |
Wraps a committed range. Only Create can make the key.
| state | The allocator state that Create built over the range. |
| pool | The pool the blocks are reported to. |
|
nodiscard |
Allocates a block.
|
staticnodiscard |
Reserves and commits a range and starts the allocator over it.
| memory | Guest memory, which must outlive the allocator. |
| physical | True to take the range from the physical heap, false for the virtual heap. |
| page_size | The page size that selects the heap, in bytes. |
| flags | Allocation type flags added to reserve and commit. |
| pool | The pool the blocks are reported to. |
| void rex::kernel::GuestAllocator::Free | ( | void * | block | ) |
Frees a block.
| block | A pointer from Allocate, null for none. |
|
staticnodiscard |
Returns the name of the profiler graph that plots a pool, a string with static storage.
|
nodiscard |
Resizes a block, moving it when it cannot grow in place.
| block | A pointer from Allocate. |
|
staticconstexpr |
Alignment of every block in bytes.