18#include <FreeNOS/System.h>
32 , m_kernelBaseAddr(
coreInfo.memory.phys)
50 , m_firstTableAddr(firstTableAddress)
51 , m_kernelBaseAddr(kernelBaseAddress)
180 nControl |= (1 << 11) | (1 << 2) | (1 << 12) | (1 << 0) | (1 << 5);
211 mcr(p15, 0, 0, c7, c5, 0);
212 mcr(p15, 0, 0, c7, c10, 0);
213 mcr(p15, 0, 0, c7, c7, 0);
214 mcr(p15, 0, 5, c7, c10, 0);
215 mcr(p15, 0, 4, c7, c10, 0);
280 const bool tablesOnly)
#define isb()
Instruction Synchronisation Barrier (ARMv7 and above)
#define dsb(type)
Data Memory Barrier.
virtual Result cleanInvalidateAddress(Type type, Address addr)
Clean and invalidate one memory page.
virtual Result cleanInvalidate(Type type)
Clean and invalidate entire cache.
ARM System Control Coprocessor (CP15).
void set(SystemControlFlags flags)
Set system control flags in CP15.
void write(Register reg, u32 value)
Write register to the CP15.
u32 read(Register reg) const
Read a register from the CP15.
void unset(SystemControlFlags flags)
Unset system control flags in CP15.
ARM first level page table.
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 releaseSection(const Memory::Range range, SplitAllocator *alloc, const bool tablesOnly)
Release memory sections.
MemoryContext::Result translate(Address virt, Address *phys, SplitAllocator *alloc) const
Translate virtual address to physical address.
MemoryContext::Result releaseRange(const Memory::Range range, SplitAllocator *alloc)
Release range of memory.
MemoryContext::Result access(Address virt, Memory::Access *access, SplitAllocator *alloc) const
Get Access flags for a virtual address.
MemoryContext::Result mapLarge(Memory::Range range, SplitAllocator *alloc)
Map a contigous range of virtual memory to physical memory.
Address m_firstTableAddr
Physical address of the first level page table.
virtual Result releaseRange(Memory::Range *range)
Release range of memory.
virtual Result activate(bool initializeMMU=false)
Activate the MemoryContext.
Result enableMMU()
Enable the MMU.
Arch::Cache m_cache
Caching implementation.
virtual Result lookup(Address virt, Address *phys) const
Translate virtual address to physical address.
ARMPaging(MemoryMap *map, SplitAllocator *alloc)
Constructor.
Address m_kernelBaseAddr
Kernel base address.
virtual ~ARMPaging()
Destructor.
virtual Result initialize()
Initialize the MemoryContext.
virtual Result unmap(Address virt)
Unmap a virtual address.
ARMFirstTable * m_firstTable
Pointer to the first level page table.
virtual Result releaseSection(const Memory::Range &range, const bool tablesOnly=false)
Release memory sections.
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.
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)
#define mcr(coproc, opcode1, opcode2, reg, subReg, value)
Move to CoProcessor from ARM (MCR).
#define tlb_flush_all()
Flushes all Translation Lookaside Buffers (TLB).
CoreInfo coreInfo
Local CoreInfo instance.
unsigned int u32
Unsigned 32-bit number.
unsigned long Address
A memory address.
#define MegaByte(v)
Convert megabytes to bytes.
unsigned int Size
Any sane size indicator cannot go negative.
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.