FreeNOS
IntelPaging.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_INTEL_PAGING_H
19#define __LIBARCH_INTEL_PAGING_H
20
21#include <Types.h>
22#include "MemoryContext.h"
23#include "MemoryMap.h"
24#include "IntelPageDirectory.h"
25
27class SplitAllocator;
28
44{
45 public:
46
56
67 IntelPaging(MemoryMap *map, Address pageDirectory, SplitAllocator *alloc);
68
72 virtual ~IntelPaging();
73
79 virtual Result initialize();
80
90 virtual Result activate(bool initializeMMU = false);
91
101 virtual Result map(Address virt, Address phys, Memory::Access access);
102
113 virtual Result unmap(Address virt);
114
123 virtual Result lookup(Address virt, Address *phys) const;
124
133 virtual Result access(Address virt, Memory::Access *access) const;
134
147 virtual Result releaseSection(const Memory::Range & range,
148 const bool tablesOnly = false);
149
157 virtual Result releaseRange(Memory::Range *range);
158
159 private:
160
163
166
169};
170
171namespace Arch
172{
173 typedef IntelPaging Memory;
174};
175
182#endif /* __LIBARCH_INTEL_PAGING_H */
Intel page directory implementation.
Intel virtual memory implementation.
Definition IntelPaging.h:44
virtual ~IntelPaging()
Destructor.
virtual Result lookup(Address virt, Address *phys) const
Translate virtual address to physical address.
Address m_pageDirectoryAddr
Physical address of the page directory.
bool m_pageDirectoryAllocated
Set to true if page directory was allocated by this class.
virtual Result map(Address virt, Address phys, Memory::Access access)
Map a physical page to a virtual address.
virtual Result initialize()
Initialize the MemoryContext.
IntelPageDirectory * m_pageDirectory
Pointer to page directory in kernel's virtual memory.
virtual Result releaseSection(const Memory::Range &range, const bool tablesOnly=false)
Release memory sections.
virtual Result activate(bool initializeMMU=false)
Activate the MemoryContext.
virtual Result access(Address virt, Memory::Access *access) const
Get Access flags for a virtual address.
virtual Result unmap(Address virt)
Unmap a virtual address.
virtual Result releaseRange(Memory::Range *range)
Release range of memory.
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