diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/hle/kernel/memory/memory_layout.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/core/hle/kernel/memory/memory_layout.h b/src/core/hle/kernel/memory/memory_layout.h index 9b3d6267a..c7c0b2f49 100644 --- a/src/core/hle/kernel/memory/memory_layout.h +++ b/src/core/hle/kernel/memory/memory_layout.h | |||
| @@ -5,9 +5,28 @@ | |||
| 5 | #pragma once | 5 | #pragma once |
| 6 | 6 | ||
| 7 | #include "common/common_types.h" | 7 | #include "common/common_types.h" |
| 8 | #include "core/device_memory.h" | ||
| 8 | 9 | ||
| 9 | namespace Kernel::Memory { | 10 | namespace Kernel::Memory { |
| 10 | 11 | ||
| 12 | constexpr std::size_t KernelAslrAlignment = 2 * 1024 * 1024; | ||
| 13 | constexpr std::size_t KernelVirtualAddressSpaceWidth = 1ULL << 39; | ||
| 14 | constexpr std::size_t KernelPhysicalAddressSpaceWidth = 1ULL << 48; | ||
| 15 | constexpr std::size_t KernelVirtualAddressSpaceBase = 0ULL - KernelVirtualAddressSpaceWidth; | ||
| 16 | constexpr std::size_t KernelVirtualAddressSpaceEnd = | ||
| 17 | KernelVirtualAddressSpaceBase + (KernelVirtualAddressSpaceWidth - KernelAslrAlignment); | ||
| 18 | constexpr std::size_t KernelVirtualAddressSpaceLast = KernelVirtualAddressSpaceEnd - 1; | ||
| 19 | constexpr std::size_t KernelVirtualAddressSpaceSize = | ||
| 20 | KernelVirtualAddressSpaceEnd - KernelVirtualAddressSpaceBase; | ||
| 21 | |||
| 22 | constexpr bool IsKernelAddressKey(VAddr key) { | ||
| 23 | return KernelVirtualAddressSpaceBase <= key && key <= KernelVirtualAddressSpaceLast; | ||
| 24 | } | ||
| 25 | |||
| 26 | constexpr bool IsKernelAddress(VAddr address) { | ||
| 27 | return KernelVirtualAddressSpaceBase <= address && address < KernelVirtualAddressSpaceEnd; | ||
| 28 | } | ||
| 29 | |||
| 11 | class MemoryRegion final { | 30 | class MemoryRegion final { |
| 12 | friend class MemoryLayout; | 31 | friend class MemoryLayout; |
| 13 | 32 | ||