FreeNOS
ARMPaging.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2015 Niek Linnenbank
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#ifndef __LIBARCH_ARM_PAGING_H
19#define __LIBARCH_ARM_PAGING_H
20
21#include <Types.h>
22#include "MemoryContext.h"
23#include "MemoryMap.h"
24
26class SplitAllocator;
27class ARMFirstTable;
28
44{
45 public:
46
54
62 ARMPaging(MemoryMap *map, Address firstTableAddress, Address kernelBaseAddress);
63
67 virtual ~ARMPaging();
68
74 virtual Result initialize();
75
85 virtual Result activate(bool initializeMMU = false);
86
96 virtual Result map(Address virt, Address phys, Memory::Access access);
97
108 virtual Result unmap(Address virt);
109
118 virtual Result lookup(Address virt, Address *phys) const;
119
128 virtual Result access(Address virt, Memory::Access *access) const;
129
142 virtual Result releaseSection(const Memory::Range & range,
143 const bool tablesOnly = false);
144
152 virtual Result releaseRange(Memory::Range *range);
153
154 private:
155
163 void setupFirstTable(MemoryMap *map, Address firstTableAddress, Address kernelBaseAddress);
164
171
172 private:
173
176
179
182
185};
186
187namespace Arch
188{
190};
191
198#endif /* __LIBARCH_ARM_PAGING_H */
ARMv6 cache management implementation.
Definition ARMCacheV6.h:43
ARM first level page table.
ARM virtual memory implementation.
Definition ARMPaging.h:44
Address m_firstTableAddr
Physical address of the first level page table.
Definition ARMPaging.h:178
virtual Result releaseRange(Memory::Range *range)
Release range of memory.
virtual Result activate(bool initializeMMU=false)
Activate the MemoryContext.
Result enableMMU()
Enable the MMU.
void setupFirstTable(MemoryMap *map, Address firstTableAddress, Address kernelBaseAddress)
Installs default mappings on 1st level page table.
Arch::Cache m_cache
Caching implementation.
Definition ARMPaging.h:184
virtual Result lookup(Address virt, Address *phys) const
Translate virtual address to physical address.
Address m_kernelBaseAddr
Kernel base address.
Definition ARMPaging.h:181
virtual ~ARMPaging()
Destructor.
Definition ARMPaging.cpp:36
virtual Result initialize()
Initialize the MemoryContext.
Definition ARMPaging.cpp:55
virtual Result unmap(Address virt)
Unmap a virtual address.
ARMFirstTable * m_firstTable
Pointer to the first level page table.
Definition ARMPaging.h:175
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.
Virtual memory abstract interface.
Result
Result codes.
Describes virtual memory map layout.
Definition MemoryMap.h:39
Allocator which separates kernel mapped memory at virtual and physical addresses.
unsigned long Address
A memory address.
Definition Types.h:131
ARMPaging Memory
Definition ARMPaging.h:189
Access
Memory access flags.
Definition Memory.h:39
Memory range.
Definition Memory.h:56