Go to the documentation of this file.
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)
virtual Result activate(bool initializeMMU=false)
Activate the MemoryContext.
virtual Result cleanInvalidate(Type type)
Clean and invalidate entire cache.
void isb()
Instruction Synchronisation Barrier (ARMv7 and above)
void unset(SystemControlFlags flags)
Unset system control flags in CP15.
virtual Result allocate(Range &args)
Allocate physical memory.
Virtual memory abstract interface.
Arch::Cache m_cache
Caching implementation.
MemoryContext::Result map(Address virt, Address phys, Memory::Access access, SplitAllocator *alloc)
Map a virtual address to a physical address.
MemoryContext::Result translate(Address virt, Address *phys, SplitAllocator *alloc) const
Translate virtual address to physical address.
static void * set(void *dest, int ch, unsigned count)
Fill memory with a constant byte.
void write(Register reg, u32 value)
Write register to the CP15.
ARMPaging(MemoryMap *map, SplitAllocator *alloc)
Constructor.
#define mcr(coproc, opcode1, opcode2, reg, subReg, value)
Move to CoProcessor from ARM (MCR).
void dsb()
Data Synchronisation Barrier.
virtual Result releaseRange(Memory::Range *range)
Release range of memory.
#define PAGESIZE
ARM uses 4K pages.
void tlb_flush_all()
Flush the entire Translation Lookaside Buffer.
ARM first level page table.
unsigned long Address
A memory address.
MemoryContext::Result mapLarge(Memory::Range range, SplitAllocator *alloc)
Map a contigous range of virtual memory to physical memory.
virtual Result initialize()
Initialize the MemoryContext.
Address address
Starting address of the memory range.
Size alignment
Alignment in bytes or ZERO for default alignment.
virtual ~ARMPaging()
Destructor.
ARMFirstTable * m_firstTable
Pointer to the first level page table.
Address m_kernelBaseAddr
Kernel base address.
Size size
Amount of memory in bytes.
Allocator which separates kernel mapped memory at virtual and physical addresses.
#define MegaByte(v)
Convert megabytes to bytes.
virtual Result lookup(Address virt, Address *phys) const
Translate virtual address to physical address.
virtual Result cleanInvalidateAddress(Type type, Address addr)
Clean and invalidate one memory page.
ARM System Control Coprocessor (CP15).
Address phys
Physical address.
Memory::Range range(Region region) const
Get memory range for the given region.
#define tlb_invalidate(page)
unsigned int u32
Unsigned 32-bit number.
MemoryContext::Result access(Address virt, Memory::Access *access, SplitAllocator *alloc) const
Get Access flags for a virtual address.
Describes virtual memory map layout.
unsigned int Size
Any sane size indicator cannot go negative.
virtual Result access(Address virt, Memory::Access *access) const
Get Access flags for a virtual address.
MemoryContext::Result releaseRange(const Memory::Range range, SplitAllocator *alloc)
Release range of memory.
Access
Memory access flags.
CoreInfo coreInfo
Local CoreInfo instance.
MemoryContext::Result releaseSection(const Memory::Range range, SplitAllocator *alloc, const bool tablesOnly)
Release memory sections.
Describes a range of memory.
Address m_firstTableAddr
Physical address of the first level page table.
virtual Result map(Address virt, Address phys, Memory::Access access)
Map a physical page to a virtual address.
virtual Result releaseSection(const Memory::Range &range, const bool tablesOnly=false)
Release memory sections.
virtual Result release(const Address addr)
Release memory page.
void set(SystemControlFlags flags)
Set system control flags in CP15.
static MemoryContext * m_current
The currently active MemoryContext.
Result enableMMU()
Enable the MMU.
Address virt
Virtual address.
Size size
Size in number of bytes.
Access access
Page access flags.
virtual Result unmap(Address virt)
Unmap a virtual address.
@ KernelData
< Kernel program data from libexec, e.g.
SplitAllocator * m_alloc
Physical memory allocator.
MemoryMap * m_map
Virtual memory layout.
u32 read(Register reg) const
Read a register from the CP15.
MemoryContext::Result unmap(Address virt, SplitAllocator *alloc)
Remove virtual address mapping.