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 
27 class SplitAllocator;
28 
43 class IntelPaging : public MemoryContext
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 
171 namespace Arch
172 {
173  typedef IntelPaging Memory;
174 };
175 
182 #endif /* __LIBARCH_INTEL_PAGING_H */
IntelPaging
Intel virtual memory implementation.
Definition: IntelPaging.h:43
IntelPaging::access
virtual Result access(Address virt, Memory::Access *access) const
Get Access flags for a virtual address.
Definition: IntelPaging.cpp:130
Memory::Range
Memory range.
Definition: Memory.h:55
IntelPaging::releaseSection
virtual Result releaseSection(const Memory::Range &range, const bool tablesOnly=false)
Release memory sections.
Definition: IntelPaging.cpp:135
MemoryContext
Virtual memory abstract interface.
Definition: MemoryContext.h:42
Types.h
Arch
Definition: ARMCacheV6.h:103
Address
unsigned long Address
A memory address.
Definition: Types.h:131
IntelPaging::m_pageDirectoryAllocated
bool m_pageDirectoryAllocated
Set to true if page directory was allocated by this class.
Definition: IntelPaging.h:168
SplitAllocator
Allocator which separates kernel mapped memory at virtual and physical addresses.
Definition: SplitAllocator.h:37
IntelPaging::m_pageDirectoryAddr
Address m_pageDirectoryAddr
Physical address of the page directory.
Definition: IntelPaging.h:165
IntelPaging::m_pageDirectory
IntelPageDirectory * m_pageDirectory
Pointer to page directory in kernel's virtual memory.
Definition: IntelPaging.h:162
IntelPaging::unmap
virtual Result unmap(Address virt)
Unmap a virtual address.
Definition: IntelPaging.cpp:114
IntelPaging::releaseRange
virtual Result releaseRange(Memory::Range *range)
Release range of memory.
Definition: IntelPaging.cpp:141
MemoryContext::Result
Result
Result codes.
Definition: MemoryContext.h:49
IntelPaging::map
virtual Result map(Address virt, Address phys, Memory::Access access)
Map a physical page to a virtual address.
Definition: IntelPaging.cpp:103
MemoryMap
Describes virtual memory map layout.
Definition: MemoryMap.h:38
MemoryMap.h
Memory::Access
Access
Memory access flags.
Definition: Memory.h:38
IntelPaging::~IntelPaging
virtual ~IntelPaging()
Destructor.
Definition: IntelPaging.cpp:39
IntelPageDirectory
Intel page directory implementation.
Definition: IntelPageDirectory.h:42
Arch::Memory
ARMPaging Memory
Definition: ARMPaging.h:189
IntelPaging::initialize
virtual Result initialize()
Initialize the MemoryContext.
Definition: IntelPaging.cpp:47
IntelPaging::activate
virtual Result activate(bool initializeMMU=false)
Activate the MemoryContext.
Definition: IntelPaging.cpp:95
IntelPageDirectory.h
MemoryContext.h
IntelPaging::lookup
virtual Result lookup(Address virt, Address *phys) const
Translate virtual address to physical address.
Definition: IntelPaging.cpp:125
IntelPaging::IntelPaging
IntelPaging(MemoryMap *map, SplitAllocator *alloc)
Constructor.
Definition: IntelPaging.cpp:23