Go to the documentation of this file.
18 #include <FreeNOS/System.h>
33 #define PAGE1_TABLE (1 << 0)
34 #define PAGE1_SECTION (1 << 1)
55 #define PAGE1_UNCACHED (PAGE1_TEX)
58 #define PAGE1_CACHE_WRITEBACK (PAGE1_TEX | PAGE1_CACHE | PAGE1_BUFFER)
61 #define PAGE1_CACHE_WRITETHROUGH (PAGE1_CACHE)
64 #define PAGE1_DEVICE_PRIV ((1 << 13))
67 #define PAGE1_DEVICE_SHARED (PAGE1_BUFFER)
69 #define PAGE1_TEX (1 << 12)
70 #define PAGE1_CACHE (1 << 3)
71 #define PAGE1_BUFFER (1 << 2)
72 #define PAGE1_SHARED (1 << 16)
84 #define PAGE1_NOEXEC (1 << 4)
88 #define PAGE1_APX (1 << 15)
90 #define PAGE1_APX (1 << 9)
94 #define PAGE1_AP_USER (1 << 11)
97 #define PAGE1_AP_SYS (1 << 10)
110 #define DIRENTRY(vaddr) \
111 ((vaddr) >> DIRSHIFT)
163 if (range.
size & 0xfffff)
197 return table->
unmap(virt);
255 const Size allocSize = alloc->
size();
256 if (phys < allocBase || phys > allocBase + allocSize)
297 const bool tablesOnly)
virtual Result allocate(Range &args)
Allocate physical memory.
ARMSecondTable * getSecondTable(Address virt, SplitAllocator *alloc) const
Retrieve second level page table.
#define SECTIONMASK
Mask for large 1MiB section mappings.
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.
#define PAGE1_UNCACHED
Disable all caching.
static void * set(void *dest, int ch, unsigned count)
Fill memory with a constant byte.
#define PAGEMASK
Mask to find the page.
MemoryContext::Result access(Address virt, Memory::Access *access) const
Get Access flags for a virtual address.
#define PAGESIZE
ARM uses 4K pages.
u32 m_tables[4096]
Array of page table entries.
unsigned long Address
A memory address.
MemoryContext::Result mapLarge(Memory::Range range, SplitAllocator *alloc)
Map a contigous range of virtual memory to physical memory.
Address address
Starting address of the memory range.
Size alignment
Alignment in bytes or ZERO for default alignment.
#define DIRENTRY(vaddr)
Entry inside the page directory of a given virtual address.
u32 flags(Memory::Access access) const
Convert Memory::Access to first level page table flags.
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.
MemoryContext::Result unmap(Address virt)
Remove virtual address mapping.
void releasePhysical(SplitAllocator *alloc, const Address phys)
Release a single physical page.
Address phys
Physical address.
ARMv6 cache management implementation.
ARM second level page table implementation.
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.
unsigned int Size
Any sane size indicator cannot go negative.
virtual Result cleanData(Address addr)
Clean one data page.
virtual Size size() const
Get memory size.
MemoryContext::Result releaseRange(const Memory::Range range, SplitAllocator *alloc)
Release range of memory.
Access
Memory access flags.
Address base() const
Get memory base address for allocations.
MemoryContext::Result releaseSection(const Memory::Range range, SplitAllocator *alloc, const bool tablesOnly)
Release memory sections.
MemoryContext::Result translate(Address virt, Address *phys) const
Translate virtual address to physical address.
Describes a range of memory.
#define PAGE1_CACHE_WRITEBACK
Outer and Inner Write-Back.
virtual Result release(const Address addr)
Release memory page.
#define PAGE1_DEVICE_SHARED
Memory Mapped Device (Shared)
Address virt
Virtual address.
MemoryContext::Result map(Address virt, Address phys, Memory::Access)
Map a virtual address to a physical address.
Size size
Size in number of bytes.
Access access
Page access flags.
bool isAllocated(const Address page) const
Check if a physical page is allocated.
#define PAGE1_NOEXEC
No-execution flag.
Address toVirtual(const Address phys) const
Convert Address to virtual pointer.
MemoryContext::Result unmap(Address virt, SplitAllocator *alloc)
Remove virtual address mapping.