19#include <FreeNOS/System.h>
28 unsigned int l1_idx =
L1_IDX(virt);
36 unsigned int l1_idx =
L1_IDX(virt);
48 return (*tbl_l2)[*l2_idx];
136 tbl_l2[l2_idx] = val;
160 return table->
unmap(virt);
222 const Size allocSize = alloc->
size();
223 if (phys < allocBase || phys > allocBase + allocSize)
264 const bool tablesOnly)
ARM64 first level page table.
MemoryContext::Result translate(Address virt, Address *phys, SplitAllocator *alloc) const
Translate virtual address to physical address.
MemoryContext::Result unmap(Address virt, SplitAllocator *alloc)
Remove virtual address mapping.
MemoryContext::Result map(Address virt, Address phys, Memory::Access access, SplitAllocator *alloc)
Map a virtual address to a physical address.
u64 get_l2_entry(Address virt, SplitAllocator *alloc, u64 **tbl_l2, unsigned int *l2_idx) const
Get entry of Level 2 table.
u64 m_tables_l1[512]
Array of page table entries.
MemoryContext::Result access(Address virt, Memory::Access *access, SplitAllocator *alloc) const
Get Access flags for a virtual address.
static void initialize(ARM64FirstTable *firstTable)
void releasePhysical(SplitAllocator *alloc, const Address phys)
Release a single physical page.
MemoryContext::Result releaseRange(const Memory::Range range, SplitAllocator *alloc)
Release range of memory.
u32 flags(Memory::Access access) const
Convert Memory::Access to first level page table flags.
ARM64SecondTable * getSecondTable(Address virt, SplitAllocator *alloc) const
Retrieve second level page table.
MemoryContext::Result releaseSection(const Memory::Range range, SplitAllocator *alloc, const bool tablesOnly)
Release memory sections.
MemoryContext::Result mapLarge(Memory::Range range, SplitAllocator *alloc)
Map a contigous range of virtual memory to physical memory.
ARM64 second level page table implementation.
MemoryContext::Result translate(Address virt, Address *phys) const
Translate virtual address to physical address.
MemoryContext::Result unmap(Address virt)
Remove virtual address mapping.
MemoryContext::Result access(Address virt, Memory::Access *access) const
Get Access flags for a virtual address.
MemoryContext::Result map(Address virt, Address phys, Memory::Access)
Map a virtual address to a physical address.
ARMv6 cache management implementation.
Address base() const
Get memory base address for allocations.
virtual Size size() const
Get memory size.
static void * set(void *dest, int ch, unsigned count)
Fill memory with a constant byte.
Allocator which separates kernel mapped memory at virtual and physical addresses.
virtual Result allocate(Range &args)
Allocate 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.
#define IS_PT_BLOCK(entry)
#define PAGESIZE
ARM uses 4K pages.
#define PAGEMASK
Mask to find the page.
#define L2_BLOCK_MASK
Mask for large 2MB block mappings.
#define IS_PT_PAGE_TBL(entry)
#define assert(exp)
Insert program diagnostics.
unsigned int u32
Unsigned 32-bit number.
unsigned long Address
A memory address.
#define GigaByte(v)
Convert gigabytes to bytes.
unsigned int Size
Any sane size indicator cannot go negative.
unsigned long long u64
Unsigned 64-bit number.
Access
Memory access flags.
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.
Size size
Size in number of bytes.
Address phys
Physical address.
Address virt
Virtual address.
Access access
Page access flags.