FreeNOS
ARMFirstTable.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_FIRSTTABLE_H
19 #define __LIBARCH_ARM_FIRSTTABLE_H
20 
21 #include <FreeNOS/System.h>
22 #include <Types.h>
23 #include <MemoryContext.h>
24 #include "ARMSecondTable.h"
25 
27 class SplitAllocator;
28 
44 {
45  public:
46 
58  Address phys,
60  SplitAllocator *alloc);
61 
73  SplitAllocator *alloc);
74 
84  SplitAllocator *alloc);
85 
96  Address *phys,
97  SplitAllocator *alloc) const;
98 
110  SplitAllocator *alloc) const;
111 
122  SplitAllocator *alloc,
123  const bool tablesOnly);
124 
134  SplitAllocator *alloc);
135 
136  private:
137 
144  inline void releasePhysical(SplitAllocator *alloc,
145  const Address phys);
146 
156  SplitAllocator *alloc) const;
157 
166 
167  private:
168 
170  u32 m_tables[4096];
171 };
172 
179 #endif /* __LIBARCH_ARM_FIRSTTABLE_H */
ARMFirstTable::getSecondTable
ARMSecondTable * getSecondTable(Address virt, SplitAllocator *alloc) const
Retrieve second level page table.
Definition: ARMFirstTable.cpp:113
Memory::Range
Memory range.
Definition: Memory.h:55
ARMFirstTable::map
MemoryContext::Result map(Address virt, Address phys, Memory::Access access, SplitAllocator *alloc)
Map a virtual address to a physical address.
Definition: ARMFirstTable.cpp:124
Types.h
ARMFirstTable::translate
MemoryContext::Result translate(Address virt, Address *phys, SplitAllocator *alloc) const
Translate virtual address to physical address.
Definition: ARMFirstTable.cpp:200
ARMFirstTable::m_tables
u32 m_tables[4096]
Array of page table entries.
Definition: ARMFirstTable.h:170
ARMFirstTable
ARM first level page table.
Definition: ARMFirstTable.h:43
Address
unsigned long Address
A memory address.
Definition: Types.h:131
ARMFirstTable::mapLarge
MemoryContext::Result mapLarge(Memory::Range range, SplitAllocator *alloc)
Map a contigous range of virtual memory to physical memory.
Definition: ARMFirstTable.cpp:158
ARMFirstTable::flags
u32 flags(Memory::Access access) const
Convert Memory::Access to first level page table flags.
Definition: ARMFirstTable.cpp:232
SplitAllocator
Allocator which separates kernel mapped memory at virtual and physical addresses.
Definition: SplitAllocator.h:37
ARMFirstTable::releasePhysical
void releasePhysical(SplitAllocator *alloc, const Address phys)
Release a single physical page.
Definition: ARMFirstTable.cpp:249
MemoryContext::Result
Result
Result codes.
Definition: MemoryContext.h:49
ARMSecondTable
ARM second level page table implementation.
Definition: ARMSecondTable.h:39
u32
unsigned int u32
Unsigned 32-bit number.
Definition: Types.h:53
ARMFirstTable::access
MemoryContext::Result access(Address virt, Memory::Access *access, SplitAllocator *alloc) const
Get Access flags for a virtual address.
Definition: ARMFirstTable.cpp:221
ARMFirstTable::releaseRange
MemoryContext::Result releaseRange(const Memory::Range range, SplitAllocator *alloc)
Release range of memory.
Definition: ARMFirstTable.cpp:269
Memory::Access
Access
Memory access flags.
Definition: Memory.h:38
ARMFirstTable::releaseSection
MemoryContext::Result releaseSection(const Memory::Range range, SplitAllocator *alloc, const bool tablesOnly)
Release memory sections.
Definition: ARMFirstTable.cpp:295
ARMSecondTable.h
MemoryContext.h
ARMFirstTable::unmap
MemoryContext::Result unmap(Address virt, SplitAllocator *alloc)
Remove virtual address mapping.
Definition: ARMFirstTable.cpp:180