24 , m_alloc(physRange, pageSize)
25 , m_virtRange(virtRange)
26 , m_pageSize(pageSize)
48 }
else if (args.
size % (allocSize)) {
52 for (
Size i = 0; i < args.
size; i += allocSize)
56 alloc_args.
size = allocSize;
97 return phys - mappingDiff;
103 return virt + mappingDiff;
Address base() const
Get memory base address for allocations.
Result
Allocation results.
virtual Result release(const Address chunk)
Release memory chunk.
bool isAllocated(const Address page) const
Check if a chunk is allocated.
virtual Size available() const
Get available memory.
Result allocateAt(const Address addr)
Allocate a specific address.
virtual Result allocate(Range &args)
Allocate memory.
Represents a callback function.
virtual void execute(void *parameter)=0
Execute the callback.
Address toPhysical(const Address virt) const
Convert Address to physical pointer.
virtual Result allocate(Range &args)
Allocate physical memory.
Result allocateSparse(const Range &range, CallbackFunction *function)
Allocate sparse (non-contiguous) physical memory.
bool isAllocated(const Address page) const
Check if a physical page is allocated.
Address toVirtual(const Address phys) const
Convert Address to virtual pointer.
virtual Result release(const Address addr)
Release memory page.
SplitAllocator(const Range physRange, const Range virtRange, const Size pageSize)
Class constructor.
const Size m_pageSize
Size of a memory page.
virtual Size available() const
Get memory available.
const Range m_virtRange
Virtual memory range to manage.
BitAllocator m_alloc
Physical memory allocator.
unsigned long Address
A memory address.
unsigned int Size
Any sane size indicator cannot go negative.
Describes a range of memory.
Size alignment
Alignment in bytes or ZERO for default alignment.
Address address
Starting address of the memory range.
Size size
Amount of memory in bytes.