19#include <FreeNOS/System.h>
32 , m_kernelBaseAddr(
coreInfo.memory.phys)
50 , m_firstTableAddr(firstTableAddress)
51 , m_kernelBaseAddr(kernelBaseAddress)
198 asm volatile (
"dsb ishst\ntlbi vmalle1is\n");
246 const bool tablesOnly)
#define isb()
Instruction Synchronisation Barrier (ARMv7 and above)
#define dsb(type)
Data Memory Barrier.
#define MAIR_FIELD(val, idx)
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.
MemoryContext::Result access(Address virt, Memory::Access *access, SplitAllocator *alloc) const
Get Access flags for a virtual address.
static void initialize(ARM64FirstTable *firstTable)
MemoryContext::Result releaseRange(const Memory::Range range, SplitAllocator *alloc)
Release range of memory.
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.
Address m_kernelBaseAddr
Kernel base address.
virtual Result lookup(Address virt, Address *phys) const
Translate virtual address to physical address.
ARM64FirstTable * m_firstTable
Pointer to the first level page table.
ARM64Paging(MemoryMap *map, SplitAllocator *alloc)
Constructor.
virtual ~ARM64Paging()
Destructor.
Address m_firstTableAddr
Physical address of the first level page table.
virtual Result unmap(Address virt)
Unmap a virtual address.
virtual Result releaseSection(const Memory::Range &range, const bool tablesOnly=false)
Release memory sections.
MemoryContext::Result allocPageTable(Allocator::Range &phys, Allocator::Range &virt)
virtual Result activate(bool initializeMMU=false)
Activate the MemoryContext.
virtual Result releaseRange(Memory::Range *range)
Release range of memory.
virtual Result map(Address virt, Address phys, Memory::Access access)
Map a physical page to a virtual address.
virtual Result access(Address virt, Memory::Access *access) const
Get Access flags for a virtual address.
virtual Result initialize()
Initialize the MemoryContext.
Result enableMMU()
Enable the MMU.
static void * set(void *dest, int ch, unsigned count)
Fill memory with a constant byte.
Virtual memory abstract interface.
MemoryMap * m_map
Virtual memory layout.
SplitAllocator * m_alloc
Physical memory allocator.
static MemoryContext * m_current
The currently active MemoryContext.
Describes virtual memory map layout.
@ KernelData
< Kernel program data from libexec, e.g.
Memory::Range range(Region region) const
Get memory range for the given region.
Allocator which separates kernel mapped memory at virtual and physical addresses.
virtual Result allocate(Range &args)
Allocate physical memory.
virtual Result release(const Address addr)
Release memory page.
#define PAGESIZE
ARM uses 4K pages.
#define tlb_invalidate(page)
CoreInfo coreInfo
Local CoreInfo instance.
unsigned long Address
A memory address.
#define MegaByte(v)
Convert megabytes to bytes.
unsigned int Size
Any sane size indicator cannot go negative.
unsigned long long u64
Unsigned 64-bit number.
u64 read(Register reg)
Read a register from the CP15.
void write(Register reg, u64 value)
Write register to the CP15.
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.