The Pedigree Project
0.1
src
system
include
pedigree
kernel
processor
MemoryRegion.h
1
/*
2
* Copyright (c) 2008-2014, Pedigree Developers
3
*
4
* Please see the CONTRIB file in the root of the source tree for a full
5
* list of contributors.
6
*
7
* Permission to use, copy, modify, and distribute this software for any
8
* purpose with or without fee is hereby granted, provided that the above
9
* copyright notice and this permission notice appear in all copies.
10
*
11
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18
*/
19
20
#ifndef KERNEL_PROCESSOR_MEMORYREGION_H
21
#define KERNEL_PROCESSOR_MEMORYREGION_H
22
23
#include "pedigree/kernel/compiler.h"
24
#include "pedigree/kernel/processor/types.h"
25
35
class
EXPORTED_PUBLIC
MemoryRegion
{
37
friend
class
X86CommonPhysicalMemoryManager
;
39
friend
class
HostedPhysicalMemoryManager
;
40
friend
class
Arm64PhysicalMemoryManager
;
41
friend
class
Armv7PhysicalMemoryManager
;
42
43
public
:
45
MemoryRegion
(
const
char
* pName);
47
virtual
~MemoryRegion
();
48
49
void
free();
50
55
void
* virtualAddress()
const
;
59
physical_uintptr_t
physicalAddress
()
const
;
62
size_t
size()
const
;
65
const
char
* name()
const
;
66
67
operator
bool()
const
;
68
69
bool
physicalBoundsCheck(physical_uintptr_t address);
70
template
<
typename
T>
71
T* convertPhysicalPointer(physical_uintptr_t address);
72
73
void
setNonRamMemory(
bool
b);
74
bool
getNonRamMemory();
75
void
setForced(
bool
b);
76
bool
getForced();
77
void
setAnonymous(
bool
b);
78
bool
getAnonymous()
const
;
79
80
private
:
83
MemoryRegion
(
const
MemoryRegion
&);
86
MemoryRegion
&
operator=
(
const
MemoryRegion
&);
87
90
void
*
m_VirtualAddress
;
93
physical_uintptr_t
m_PhysicalAddress
;
95
size_t
m_Size
;
97
const
char
*
m_pName
;
98
99
bool
m_bNonRamMemory, m_bForced, m_bPageBacked, m_bAnonymous;
100
};
101
104
template
<
typename
T>
105
T* MemoryRegion::convertPhysicalPointer(physical_uintptr_t address) {
106
return
reinterpret_cast<
T*
>
(
reinterpret_cast<
uintptr_t
>
(
m_VirtualAddress
) +
107
(address -
m_PhysicalAddress
));
108
}
109
110
#endif
Arm64PhysicalMemoryManager
Definition
kernel/core/processor/arm64/PhysicalMemoryManager.h:11
Armv7PhysicalMemoryManager
Definition
kernel/core/processor/armv7/PhysicalMemoryManager.h:11
HostedPhysicalMemoryManager
Implementation of the PhysicalMemoryManager for common x86.
Definition
kernel/core/processor/hosted/PhysicalMemoryManager.h:40
MemoryRegion
Special memory entity in the kernel's virtual address space.
Definition
MemoryRegion.h:35
MemoryRegion::m_VirtualAddress
void * m_VirtualAddress
Definition
MemoryRegion.h:90
MemoryRegion::m_pName
const char * m_pName
Definition
MemoryRegion.h:97
MemoryRegion::operator=
MemoryRegion & operator=(const MemoryRegion &)
MemoryRegion::m_Size
size_t m_Size
Definition
MemoryRegion.h:95
MemoryRegion::MemoryRegion
MemoryRegion(const MemoryRegion &)
MemoryRegion::m_PhysicalAddress
physical_uintptr_t m_PhysicalAddress
Definition
MemoryRegion.h:93
X86CommonPhysicalMemoryManager
Implementation of the PhysicalMemoryManager for common x86.
Definition
kernel/core/processor/x86_common/PhysicalMemoryManager.h:44
physicalAddress
uintptr_t physicalAddress(physical_uintptr_t address) PURE
Definition
utils.h:39
Generated on Sat Oct 3 2026 06:38:07 for The Pedigree Project by
1.9.8