Go to the documentation of this file.
18 #ifndef __LIBARCH_MEMORYCONTEXT_H
19 #define __LIBARCH_MEMORYCONTEXT_H
198 const bool tablesOnly =
false) = 0;
virtual Result initialize()=0
Initialize the MemoryContext.
Memory::Range * m_savedRange
Saved range input for use in the mapRangeSparse Callback.
Virtual memory abstract interface.
virtual Result unmapRange(Memory::Range *range)
Unmaps a range of virtual memory.
virtual Result access(Address virt, Memory::Access *access) const =0
Get Access flags for a virtual address.
virtual Result releaseRange(Memory::Range *range)=0
Release a range of physical memory by its virtual memory pages.
MemoryContext(MemoryMap *map, SplitAllocator *alloc)
Constructor.
virtual Result release(Address virt)
Release a memory page mapping.
virtual Result map(Address virt, Address phys, Memory::Access access)=0
Map a physical page to a virtual address.
unsigned long Address
A memory address.
virtual Result unmap(Address virt)=0
Unmap a virtual address.
Allocator which separates kernel mapped memory at virtual and physical addresses.
virtual Result lookup(Address virt, Address *phys) const =0
Translate virtual address to physical address.
virtual Result activate(bool initializeMMU=false)=0
Activate the MemoryContext.
Callback< MemoryContext, Address > m_mapRangeSparseCallback
Callback object for mapRangeSparseCallback function.
virtual void mapRangeSparseCallback(Address *phys)
Callback to provide intermediate Range object during mapRangeSparse()
virtual Result findFree(Size size, MemoryMap::Region region, Address *virt) const
Find unused memory.
Describes virtual memory map layout.
unsigned int Size
Any sane size indicator cannot go negative.
Access
Memory access flags.
static MemoryContext * getCurrent()
Get currently active MemoryContext.
Size m_numSparsePages
Number of pages allocated via mapRangeSparse Callback.
static MemoryContext * m_current
The currently active MemoryContext.
virtual ~MemoryContext()
Destructor.
virtual Result releaseSection(const Memory::Range &range, const bool tablesOnly=false)=0
Release memory sections.
SplitAllocator * m_alloc
Physical memory allocator.
virtual Result mapRangeContiguous(Memory::Range *range)
Map a range of contiguous physical pages to virtual addresses.
virtual Result mapRangeSparse(Memory::Range *range)
Map and allocate a range of sparse (non-contiguous) physical pages to virtual addresses.
MemoryMap * m_map
Virtual memory layout.