FreeNOS
|
ARM first level page table. More...
#include <ARMFirstTable.h>
Public Member Functions | |
MemoryContext::Result | map (Address virt, Address phys, Memory::Access access, SplitAllocator *alloc) |
Map a virtual address to a physical address. More... | |
MemoryContext::Result | mapLarge (Memory::Range range, SplitAllocator *alloc) |
Map a contigous range of virtual memory to physical memory. More... | |
MemoryContext::Result | unmap (Address virt, SplitAllocator *alloc) |
Remove virtual address mapping. More... | |
MemoryContext::Result | translate (Address virt, Address *phys, SplitAllocator *alloc) const |
Translate virtual address to physical address. More... | |
MemoryContext::Result | access (Address virt, Memory::Access *access, SplitAllocator *alloc) const |
Get Access flags for a virtual address. More... | |
MemoryContext::Result | releaseSection (const Memory::Range range, SplitAllocator *alloc, const bool tablesOnly) |
Release memory sections. More... | |
MemoryContext::Result | releaseRange (const Memory::Range range, SplitAllocator *alloc) |
Release range of memory. More... | |
Private Member Functions | |
void | releasePhysical (SplitAllocator *alloc, const Address phys) |
Release a single physical page. More... | |
ARMSecondTable * | getSecondTable (Address virt, SplitAllocator *alloc) const |
Retrieve second level page table. More... | |
u32 | flags (Memory::Access access) const |
Convert Memory::Access to first level page table flags. More... | |
Private Attributes | |
u32 | m_tables [4096] |
Array of page table entries. More... | |
ARM first level page table.
Definition at line 43 of file ARMFirstTable.h.
MemoryContext::Result ARMFirstTable::access | ( | Address | virt, |
Memory::Access * | access, | ||
SplitAllocator * | alloc | ||
) | const |
Get Access flags for a virtual address.
virt | Virtual address to get Access flags for. |
access | MemoryAccess object pointer. |
alloc | Physical memory allocator |
Definition at line 221 of file ARMFirstTable.cpp.
References ARMSecondTable::access(), getSecondTable(), and MemoryContext::InvalidAddress.
Referenced by ARMPaging::access(), flags(), and map().
|
private |
Convert Memory::Access to first level page table flags.
access | Memory access flags to convert |
Definition at line 232 of file ARMFirstTable.cpp.
References access(), Memory::Device, Memory::Executable, PAGE1_AP_SYS, PAGE1_AP_USER, PAGE1_APX, PAGE1_CACHE_WRITEBACK, PAGE1_DEVICE_SHARED, PAGE1_NOEXEC, PAGE1_UNCACHED, Memory::Uncached, Memory::User, and Memory::Writable.
Referenced by mapLarge().
|
private |
Retrieve second level page table.
virt | Virtual address to fetch page table for |
alloc | Physical memory allocator |
Definition at line 113 of file ARMFirstTable.cpp.
References DIRENTRY, entry, m_tables, PAGE1_TABLE, PAGEMASK, SplitAllocator::toVirtual(), and ZERO.
Referenced by access(), map(), releaseRange(), releaseSection(), translate(), and unmap().
MemoryContext::Result ARMFirstTable::map | ( | Address | virt, |
Address | phys, | ||
Memory::Access | access, | ||
SplitAllocator * | alloc | ||
) |
Map a virtual address to a physical address.
virt | Virtual address. |
phys | Physical address. |
access | Memory access flags. |
alloc | Physical memory allocator for extra page tables. |
Definition at line 124 of file ARMFirstTable.cpp.
References access(), Allocator::Range::address, Allocator::Range::alignment, SplitAllocator::allocate(), MemoryContext::AlreadyExists, Cache::cleanData(), DIRENTRY, getSecondTable(), m_tables, ARMSecondTable::map(), MemoryContext::OutOfMemory, PAGE1_SECTION, PAGE1_TABLE, PAGESIZE, MemoryBlock::set(), Allocator::Range::size, and Allocator::Success.
Referenced by ARMPaging::map().
MemoryContext::Result ARMFirstTable::mapLarge | ( | Memory::Range | range, |
SplitAllocator * | alloc | ||
) |
Map a contigous range of virtual memory to physical memory.
This function can map at the granularity of 1 megabyte memory chunks.
range | Virtual to physical memory range. |
alloc | Physical memory allocator for extra page tables. |
Definition at line 158 of file ARMFirstTable.cpp.
References Memory::Range::access, MemoryContext::AlreadyExists, Cache::cleanData(), DIRENTRY, flags(), MemoryContext::InvalidAddress, MemoryContext::InvalidSize, m_tables, MegaByte, PAGE1_SECTION, PAGE1_TABLE, PAGEMASK, Memory::Range::phys, Memory::Range::size, MemoryContext::Success, and Memory::Range::virt.
Referenced by ARMPaging::initialize().
|
inlineprivate |
Release a single physical page.
alloc | Memory allocator to release memory from |
phys | Physical address to release |
Definition at line 249 of file ARMFirstTable.cpp.
References Allocator::base(), SplitAllocator::isAllocated(), SplitAllocator::release(), and Allocator::size().
Referenced by releaseRange(), and releaseSection().
MemoryContext::Result ARMFirstTable::releaseRange | ( | const Memory::Range | range, |
SplitAllocator * | alloc | ||
) |
Release range of memory.
Definition at line 269 of file ARMFirstTable.cpp.
References getSecondTable(), MemoryContext::InvalidAddress, PAGESIZE, releasePhysical(), Memory::Range::size, MemoryContext::Success, ARMSecondTable::translate(), ARMSecondTable::unmap(), Memory::Range::virt, and ZERO.
Referenced by ARMPaging::releaseRange().
MemoryContext::Result ARMFirstTable::releaseSection | ( | const Memory::Range | range, |
SplitAllocator * | alloc, | ||
const bool | tablesOnly | ||
) |
Release memory sections.
range | Memory range of the sections to release |
alloc | Memory allocator to release memory from |
tablesOnly | Set to true to only release page tables and not mapped pages. |
Definition at line 295 of file ARMFirstTable.cpp.
References DIRENTRY, getSecondTable(), MemoryContext::InvalidAddress, m_tables, MegaByte, PAGEMASK, PAGESIZE, SplitAllocator::release(), releasePhysical(), SECTIONMASK, Memory::Range::size, MemoryContext::Success, ARMSecondTable::translate(), and Memory::Range::virt.
Referenced by ARMPaging::releaseSection().
MemoryContext::Result ARMFirstTable::translate | ( | Address | virt, |
Address * | phys, | ||
SplitAllocator * | alloc | ||
) | const |
Translate virtual address to physical address.
virt | Virtual address to lookup as input |
phys | Physical address corresponding to the virtual address |
alloc | Physical memory allocator |
Definition at line 200 of file ARMFirstTable.cpp.
References DIRENTRY, getSecondTable(), MemoryContext::InvalidAddress, m_tables, MegaByte, PAGE1_SECTION, PAGESIZE, SECTIONMASK, MemoryContext::Success, and ARMSecondTable::translate().
Referenced by ARMPaging::lookup().
MemoryContext::Result ARMFirstTable::unmap | ( | Address | virt, |
SplitAllocator * | alloc | ||
) |
Remove virtual address mapping.
virt | Virtual address. |
alloc | Physical memory allocator |
Definition at line 180 of file ARMFirstTable.cpp.
References Cache::cleanData(), DIRENTRY, getSecondTable(), MemoryContext::InvalidAddress, m_tables, PAGE1_NONE, PAGE1_SECTION, MemoryContext::Success, and ARMSecondTable::unmap().
Referenced by ARMPaging::initialize(), and ARMPaging::unmap().
|
private |
Array of page table entries.
Definition at line 170 of file ARMFirstTable.h.
Referenced by getSecondTable(), map(), mapLarge(), releaseSection(), translate(), and unmap().