summaryrefslogtreecommitdiff
path: root/src/core/hle/kernel
diff options
context:
space:
mode:
authorGravatar GPUCode2023-11-20 15:52:18 +0200
committerGravatar t8952023-11-25 00:47:36 -0500
commit3ec3cca4d8d4e1733cbc337b0499ad3bdcdf52b0 (patch)
tree4f8cb57560d4aa06d73a799537945b5a842460b2 /src/core/hle/kernel
parentcommon: Enforce fastmem for nce usage (diff)
downloadyuzu-3ec3cca4d8d4e1733cbc337b0499ad3bdcdf52b0.tar.gz
yuzu-3ec3cca4d8d4e1733cbc337b0499ad3bdcdf52b0.tar.xz
yuzu-3ec3cca4d8d4e1733cbc337b0499ad3bdcdf52b0.zip
core: Define HAS_NCE macro
Diffstat (limited to 'src/core/hle/kernel')
-rw-r--r--src/core/hle/kernel/code_set.h5
-rw-r--r--src/core/hle/kernel/k_address_space_info.cpp2
-rw-r--r--src/core/hle/kernel/k_page_table_base.cpp2
-rw-r--r--src/core/hle/kernel/k_process.h6
-rw-r--r--src/core/hle/kernel/physical_core.cpp4
5 files changed, 14 insertions, 5 deletions
diff --git a/src/core/hle/kernel/code_set.h b/src/core/hle/kernel/code_set.h
index d53da82f4..4d2d0098e 100644
--- a/src/core/hle/kernel/code_set.h
+++ b/src/core/hle/kernel/code_set.h
@@ -75,6 +75,7 @@ struct CodeSet final {
75 return segments[2]; 75 return segments[2];
76 } 76 }
77 77
78#ifdef HAS_NCE
78 Segment& PatchSegment() { 79 Segment& PatchSegment() {
79 return patch_segment; 80 return patch_segment;
80 } 81 }
@@ -82,13 +83,17 @@ struct CodeSet final {
82 const Segment& PatchSegment() const { 83 const Segment& PatchSegment() const {
83 return patch_segment; 84 return patch_segment;
84 } 85 }
86#endif
85 87
86 /// The overall data that backs this code set. 88 /// The overall data that backs this code set.
87 Kernel::PhysicalMemory memory; 89 Kernel::PhysicalMemory memory;
88 90
89 /// The segments that comprise this code set. 91 /// The segments that comprise this code set.
90 std::array<Segment, 3> segments; 92 std::array<Segment, 3> segments;
93
94#ifdef HAS_NCE
91 Segment patch_segment; 95 Segment patch_segment;
96#endif
92 97
93 /// The entry point address for this code set. 98 /// The entry point address for this code set.
94 KProcessAddress entrypoint = 0; 99 KProcessAddress entrypoint = 0;
diff --git a/src/core/hle/kernel/k_address_space_info.cpp b/src/core/hle/kernel/k_address_space_info.cpp
index 3235a7a37..23258071e 100644
--- a/src/core/hle/kernel/k_address_space_info.cpp
+++ b/src/core/hle/kernel/k_address_space_info.cpp
@@ -25,7 +25,7 @@ constexpr std::array<KAddressSpaceInfo, 13> AddressSpaceInfos{{
25 { .bit_width = 36, .address = 2_GiB , .size = 64_GiB - 2_GiB , .type = KAddressSpaceInfo::Type::MapLarge, }, 25 { .bit_width = 36, .address = 2_GiB , .size = 64_GiB - 2_GiB , .type = KAddressSpaceInfo::Type::MapLarge, },
26 { .bit_width = 36, .address = Size_Invalid, .size = 8_GiB , .type = KAddressSpaceInfo::Type::Heap, }, 26 { .bit_width = 36, .address = Size_Invalid, .size = 8_GiB , .type = KAddressSpaceInfo::Type::Heap, },
27 { .bit_width = 36, .address = Size_Invalid, .size = 6_GiB , .type = KAddressSpaceInfo::Type::Alias, }, 27 { .bit_width = 36, .address = Size_Invalid, .size = 6_GiB , .type = KAddressSpaceInfo::Type::Alias, },
28#ifdef ARCHITECTURE_arm64 28#ifdef HAS_NCE
29 // With NCE, we use a 38-bit address space due to memory limitations. This should (safely) truncate ASLR region. 29 // With NCE, we use a 38-bit address space due to memory limitations. This should (safely) truncate ASLR region.
30 { .bit_width = 39, .address = 128_MiB , .size = 256_GiB - 128_MiB, .type = KAddressSpaceInfo::Type::Map39Bit, }, 30 { .bit_width = 39, .address = 128_MiB , .size = 256_GiB - 128_MiB, .type = KAddressSpaceInfo::Type::Map39Bit, },
31#else 31#else
diff --git a/src/core/hle/kernel/k_page_table_base.cpp b/src/core/hle/kernel/k_page_table_base.cpp
index f7f1e8a3b..2b5e77ccf 100644
--- a/src/core/hle/kernel/k_page_table_base.cpp
+++ b/src/core/hle/kernel/k_page_table_base.cpp
@@ -96,7 +96,7 @@ constexpr Common::MemoryPermission ConvertToMemoryPermission(KMemoryPermission p
96 if (True(perm & KMemoryPermission::UserWrite)) { 96 if (True(perm & KMemoryPermission::UserWrite)) {
97 perms |= Common::MemoryPermission::Write; 97 perms |= Common::MemoryPermission::Write;
98 } 98 }
99#ifdef ARCHITECTURE_arm64 99#ifdef HAS_NCE
100 if (True(perm & KMemoryPermission::UserExecute)) { 100 if (True(perm & KMemoryPermission::UserExecute)) {
101 perms |= Common::MemoryPermission::Execute; 101 perms |= Common::MemoryPermission::Execute;
102 } 102 }
diff --git a/src/core/hle/kernel/k_process.h b/src/core/hle/kernel/k_process.h
index e5f796ac7..d8cd0fdde 100644
--- a/src/core/hle/kernel/k_process.h
+++ b/src/core/hle/kernel/k_process.h
@@ -112,7 +112,6 @@ private:
112 std::array<KThread*, Core::Hardware::NUM_CPU_CORES> m_pinned_threads{}; 112 std::array<KThread*, Core::Hardware::NUM_CPU_CORES> m_pinned_threads{};
113 std::array<DebugWatchpoint, Core::Hardware::NUM_WATCHPOINTS> m_watchpoints{}; 113 std::array<DebugWatchpoint, Core::Hardware::NUM_WATCHPOINTS> m_watchpoints{};
114 std::map<KProcessAddress, u64> m_debug_page_refcounts{}; 114 std::map<KProcessAddress, u64> m_debug_page_refcounts{};
115 std::unordered_map<u64, u64> m_post_handlers{};
116 std::atomic<s64> m_cpu_time{}; 115 std::atomic<s64> m_cpu_time{};
117 std::atomic<s64> m_num_process_switches{}; 116 std::atomic<s64> m_num_process_switches{};
118 std::atomic<s64> m_num_thread_switches{}; 117 std::atomic<s64> m_num_thread_switches{};
@@ -121,6 +120,9 @@ private:
121 std::atomic<s64> m_num_ipc_messages{}; 120 std::atomic<s64> m_num_ipc_messages{};
122 std::atomic<s64> m_num_ipc_replies{}; 121 std::atomic<s64> m_num_ipc_replies{};
123 std::atomic<s64> m_num_ipc_receives{}; 122 std::atomic<s64> m_num_ipc_receives{};
123#ifdef HAS_NCE
124 std::unordered_map<u64, u64> m_post_handlers{};
125#endif
124 126
125private: 127private:
126 Result StartTermination(); 128 Result StartTermination();
@@ -468,9 +470,11 @@ public:
468 470
469 static void Switch(KProcess* cur_process, KProcess* next_process); 471 static void Switch(KProcess* cur_process, KProcess* next_process);
470 472
473#ifdef HAS_NCE
471 std::unordered_map<u64, u64>& GetPostHandlers() noexcept { 474 std::unordered_map<u64, u64>& GetPostHandlers() noexcept {
472 return m_post_handlers; 475 return m_post_handlers;
473 } 476 }
477#endif
474 478
475public: 479public:
476 // Attempts to insert a watchpoint into a free slot. Returns false if none are available. 480 // Attempts to insert a watchpoint into a free slot. Returns false if none are available.
diff --git a/src/core/hle/kernel/physical_core.cpp b/src/core/hle/kernel/physical_core.cpp
index 15434212e..073039825 100644
--- a/src/core/hle/kernel/physical_core.cpp
+++ b/src/core/hle/kernel/physical_core.cpp
@@ -4,7 +4,7 @@
4#include "common/settings.h" 4#include "common/settings.h"
5#include "core/arm/dynarmic/arm_dynarmic_32.h" 5#include "core/arm/dynarmic/arm_dynarmic_32.h"
6#include "core/arm/dynarmic/arm_dynarmic_64.h" 6#include "core/arm/dynarmic/arm_dynarmic_64.h"
7#ifdef ARCHITECTURE_arm64 7#ifdef HAS_NCE
8#include "core/arm/nce/arm_nce.h" 8#include "core/arm/nce/arm_nce.h"
9#endif 9#endif
10#include "core/core.h" 10#include "core/core.h"
@@ -33,7 +33,7 @@ PhysicalCore::PhysicalCore(std::size_t core_index, Core::System& system, KSchedu
33PhysicalCore::~PhysicalCore() = default; 33PhysicalCore::~PhysicalCore() = default;
34 34
35void PhysicalCore::Initialize(bool is_64_bit) { 35void PhysicalCore::Initialize(bool is_64_bit) {
36#if defined(ARCHITECTURE_arm64) 36#if defined(HAS_NCE)
37 if (Settings::IsNceEnabled()) { 37 if (Settings::IsNceEnabled()) {
38 m_arm_interface = std::make_unique<Core::ARM_NCE>(m_system, m_system.Kernel().IsMulticore(), 38 m_arm_interface = std::make_unique<Core::ARM_NCE>(m_system, m_system.Kernel().IsMulticore(),
39 m_core_index); 39 m_core_index);