summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar bunnei2021-02-18 16:38:30 -0800
committerGravatar bunnei2021-03-21 14:45:02 -0700
commitc17beefe3d1e4850b3518a45892c0c5c6e11c95a (patch)
treebd4a0f20b6f95f0394a7777e86ceffd1dcd9ba10 /src
parenthle: kernel: KMemoryRegion: Derive region values. (diff)
downloadyuzu-c17beefe3d1e4850b3518a45892c0c5c6e11c95a.tar.gz
yuzu-c17beefe3d1e4850b3518a45892c0c5c6e11c95a.tar.xz
yuzu-c17beefe3d1e4850b3518a45892c0c5c6e11c95a.zip
hle: kernel: Add architecture and board specific memory regions.
Diffstat (limited to 'src')
-rw-r--r--src/core/hle/kernel/arch/arm64/k_memory_region_device_types.inc20
-rw-r--r--src/core/hle/kernel/board/nintendo/nx/k_memory_region_device_types.inc52
2 files changed, 72 insertions, 0 deletions
diff --git a/src/core/hle/kernel/arch/arm64/k_memory_region_device_types.inc b/src/core/hle/kernel/arch/arm64/k_memory_region_device_types.inc
new file mode 100644
index 000000000..857b512ba
--- /dev/null
+++ b/src/core/hle/kernel/arch/arm64/k_memory_region_device_types.inc
@@ -0,0 +1,20 @@
1// Copyright 2021 yuzu Emulator Project
2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included.
4
5// All architectures must define NumArchitectureDeviceRegions.
6constexpr inline const auto NumArchitectureDeviceRegions = 3;
7
8constexpr inline const auto KMemoryRegionType_Uart =
9 KMemoryRegionType_ArchDeviceBase.DeriveSparse(0, NumArchitectureDeviceRegions, 0);
10constexpr inline const auto KMemoryRegionType_InterruptCpuInterface =
11 KMemoryRegionType_ArchDeviceBase.DeriveSparse(0, NumArchitectureDeviceRegions, 1)
12 .SetAttribute(KMemoryRegionAttr_NoUserMap);
13constexpr inline const auto KMemoryRegionType_InterruptDistributor =
14 KMemoryRegionType_ArchDeviceBase.DeriveSparse(0, NumArchitectureDeviceRegions, 2)
15 .SetAttribute(KMemoryRegionAttr_NoUserMap);
16static_assert(KMemoryRegionType_Uart.GetValue() == (0x1D));
17static_assert(KMemoryRegionType_InterruptCpuInterface.GetValue() ==
18 (0x2D | KMemoryRegionAttr_NoUserMap));
19static_assert(KMemoryRegionType_InterruptDistributor.GetValue() ==
20 (0x4D | KMemoryRegionAttr_NoUserMap));
diff --git a/src/core/hle/kernel/board/nintendo/nx/k_memory_region_device_types.inc b/src/core/hle/kernel/board/nintendo/nx/k_memory_region_device_types.inc
new file mode 100644
index 000000000..58d6c0b16
--- /dev/null
+++ b/src/core/hle/kernel/board/nintendo/nx/k_memory_region_device_types.inc
@@ -0,0 +1,52 @@
1// Copyright 2021 yuzu Emulator Project
2// Licensed under GPLv2 or any later version
3// Refer to the license.txt file included.
4
5// All architectures must define NumBoardDeviceRegions.
6constexpr inline const auto NumBoardDeviceRegions = 6;
7// UNUSED: .Derive(NumBoardDeviceRegions, 0);
8constexpr inline const auto KMemoryRegionType_MemoryController =
9 KMemoryRegionType_BoardDeviceBase.Derive(NumBoardDeviceRegions, 1)
10 .SetAttribute(KMemoryRegionAttr_NoUserMap);
11constexpr inline const auto KMemoryRegionType_MemoryController1 =
12 KMemoryRegionType_BoardDeviceBase.Derive(NumBoardDeviceRegions, 2)
13 .SetAttribute(KMemoryRegionAttr_NoUserMap);
14constexpr inline const auto KMemoryRegionType_MemoryController0 =
15 KMemoryRegionType_BoardDeviceBase.Derive(NumBoardDeviceRegions, 3)
16 .SetAttribute(KMemoryRegionAttr_NoUserMap);
17constexpr inline const auto KMemoryRegionType_PowerManagementController =
18 KMemoryRegionType_BoardDeviceBase.Derive(NumBoardDeviceRegions, 4).DeriveTransition();
19constexpr inline const auto KMemoryRegionType_LegacyLpsDevices =
20 KMemoryRegionType_BoardDeviceBase.Derive(NumBoardDeviceRegions, 5);
21static_assert(KMemoryRegionType_MemoryController.GetValue() ==
22 (0x55 | KMemoryRegionAttr_NoUserMap));
23static_assert(KMemoryRegionType_MemoryController1.GetValue() ==
24 (0x65 | KMemoryRegionAttr_NoUserMap));
25static_assert(KMemoryRegionType_MemoryController0.GetValue() ==
26 (0x95 | KMemoryRegionAttr_NoUserMap));
27static_assert(KMemoryRegionType_PowerManagementController.GetValue() == (0x1A5));
28
29static_assert(KMemoryRegionType_LegacyLpsDevices.GetValue() == 0xC5);
30
31constexpr inline const auto NumLegacyLpsDevices = 7;
32constexpr inline const auto KMemoryRegionType_LegacyLpsExceptionVectors =
33 KMemoryRegionType_LegacyLpsDevices.Derive(NumLegacyLpsDevices, 0);
34constexpr inline const auto KMemoryRegionType_LegacyLpsIram =
35 KMemoryRegionType_LegacyLpsDevices.Derive(NumLegacyLpsDevices, 1);
36constexpr inline const auto KMemoryRegionType_LegacyLpsFlowController =
37 KMemoryRegionType_LegacyLpsDevices.Derive(NumLegacyLpsDevices, 2);
38constexpr inline const auto KMemoryRegionType_LegacyLpsPrimaryICtlr =
39 KMemoryRegionType_LegacyLpsDevices.Derive(NumLegacyLpsDevices, 3);
40constexpr inline const auto KMemoryRegionType_LegacyLpsSemaphore =
41 KMemoryRegionType_LegacyLpsDevices.Derive(NumLegacyLpsDevices, 4);
42constexpr inline const auto KMemoryRegionType_LegacyLpsAtomics =
43 KMemoryRegionType_LegacyLpsDevices.Derive(NumLegacyLpsDevices, 5);
44constexpr inline const auto KMemoryRegionType_LegacyLpsClkRst =
45 KMemoryRegionType_LegacyLpsDevices.Derive(NumLegacyLpsDevices, 6);
46static_assert(KMemoryRegionType_LegacyLpsExceptionVectors.GetValue() == 0x3C5);
47static_assert(KMemoryRegionType_LegacyLpsIram.GetValue() == 0x5C5);
48static_assert(KMemoryRegionType_LegacyLpsFlowController.GetValue() == 0x6C5);
49static_assert(KMemoryRegionType_LegacyLpsPrimaryICtlr.GetValue() == 0x9C5);
50static_assert(KMemoryRegionType_LegacyLpsSemaphore.GetValue() == 0xAC5);
51static_assert(KMemoryRegionType_LegacyLpsAtomics.GetValue() == 0xCC5);
52static_assert(KMemoryRegionType_LegacyLpsClkRst.GetValue() == 0x11C5);