summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Liam2023-12-18 00:49:46 -0500
committerGravatar Liam2023-12-22 21:52:49 -0500
commitdb7b2bc8f136868ea5251d5a504bd9f89d993c67 (patch)
tree74a01823219cd4248cea08f42b52110702ad5426 /src
parentgeneral: properly support multiple memory instances (diff)
downloadyuzu-db7b2bc8f136868ea5251d5a504bd9f89d993c67.tar.gz
yuzu-db7b2bc8f136868ea5251d5a504bd9f89d993c67.tar.xz
yuzu-db7b2bc8f136868ea5251d5a504bd9f89d993c67.zip
kernel: restrict nce to applications
Diffstat (limited to 'src')
-rw-r--r--src/core/hle/kernel/k_process.cpp4
-rw-r--r--src/core/hle/kernel/svc/svc_info.cpp1
-rw-r--r--src/core/loader/deconstructed_rom_directory.cpp7
3 files changed, 6 insertions, 6 deletions
diff --git a/src/core/hle/kernel/k_process.cpp b/src/core/hle/kernel/k_process.cpp
index 2bfb71b3a..d6869c228 100644
--- a/src/core/hle/kernel/k_process.cpp
+++ b/src/core/hle/kernel/k_process.cpp
@@ -1233,7 +1233,7 @@ void KProcess::LoadModule(CodeSet code_set, KProcessAddress base_addr) {
1233 ReprotectSegment(code_set.DataSegment(), Svc::MemoryPermission::ReadWrite); 1233 ReprotectSegment(code_set.DataSegment(), Svc::MemoryPermission::ReadWrite);
1234 1234
1235#ifdef HAS_NCE 1235#ifdef HAS_NCE
1236 if (Settings::IsNceEnabled()) { 1236 if (this->IsApplication() && Settings::IsNceEnabled()) {
1237 auto& buffer = m_kernel.System().DeviceMemory().buffer; 1237 auto& buffer = m_kernel.System().DeviceMemory().buffer;
1238 const auto& code = code_set.CodeSegment(); 1238 const auto& code = code_set.CodeSegment();
1239 const auto& patch = code_set.PatchSegment(); 1239 const auto& patch = code_set.PatchSegment();
@@ -1249,7 +1249,7 @@ void KProcess::InitializeInterfaces() {
1249 Core::MakeExclusiveMonitor(this->GetMemory(), Core::Hardware::NUM_CPU_CORES); 1249 Core::MakeExclusiveMonitor(this->GetMemory(), Core::Hardware::NUM_CPU_CORES);
1250 1250
1251#ifdef HAS_NCE 1251#ifdef HAS_NCE
1252 if (this->Is64Bit() && Settings::IsNceEnabled()) { 1252 if (this->IsApplication() && Settings::IsNceEnabled()) {
1253 for (size_t i = 0; i < Core::Hardware::NUM_CPU_CORES; i++) { 1253 for (size_t i = 0; i < Core::Hardware::NUM_CPU_CORES; i++) {
1254 m_arm_interfaces[i] = std::make_unique<Core::ArmNce>(m_kernel.System(), true, i); 1254 m_arm_interfaces[i] = std::make_unique<Core::ArmNce>(m_kernel.System(), true, i);
1255 } 1255 }
diff --git a/src/core/hle/kernel/svc/svc_info.cpp b/src/core/hle/kernel/svc/svc_info.cpp
index ada998772..231e4d0e1 100644
--- a/src/core/hle/kernel/svc/svc_info.cpp
+++ b/src/core/hle/kernel/svc/svc_info.cpp
@@ -118,7 +118,6 @@ Result GetInfo(Core::System& system, u64* result, InfoType info_id_type, Handle
118 R_SUCCEED(); 118 R_SUCCEED();
119 119
120 case InfoType::IsApplication: 120 case InfoType::IsApplication:
121 LOG_WARNING(Kernel_SVC, "(STUBBED) Assuming process is application");
122 *result = process->IsApplication(); 121 *result = process->IsApplication();
123 R_SUCCEED(); 122 R_SUCCEED();
124 123
diff --git a/src/core/loader/deconstructed_rom_directory.cpp b/src/core/loader/deconstructed_rom_directory.cpp
index 60ee78e89..c9f8707b7 100644
--- a/src/core/loader/deconstructed_rom_directory.cpp
+++ b/src/core/loader/deconstructed_rom_directory.cpp
@@ -129,9 +129,10 @@ AppLoader_DeconstructedRomDirectory::LoadResult AppLoader_DeconstructedRomDirect
129 } 129 }
130 metadata.Print(); 130 metadata.Print();
131 131
132 // Enable NCE only for programs with 39-bit address space. 132 // Enable NCE only for applications with 39-bit address space.
133 const bool is_39bit = 133 const bool is_39bit =
134 metadata.GetAddressSpaceType() == FileSys::ProgramAddressSpaceType::Is39Bit; 134 metadata.GetAddressSpaceType() == FileSys::ProgramAddressSpaceType::Is39Bit;
135 const bool is_application = metadata.GetPoolPartition() == FileSys::PoolPartition::Application;
135 Settings::SetNceEnabled(is_39bit); 136 Settings::SetNceEnabled(is_39bit);
136 137
137 const std::array static_modules = {"rtld", "main", "subsdk0", "subsdk1", "subsdk2", 138 const std::array static_modules = {"rtld", "main", "subsdk0", "subsdk1", "subsdk2",
@@ -147,7 +148,7 @@ AppLoader_DeconstructedRomDirectory::LoadResult AppLoader_DeconstructedRomDirect
147 148
148 const auto GetPatcher = [&](size_t i) -> Core::NCE::Patcher* { 149 const auto GetPatcher = [&](size_t i) -> Core::NCE::Patcher* {
149#ifdef HAS_NCE 150#ifdef HAS_NCE
150 if (Settings::IsNceEnabled()) { 151 if (is_application && Settings::IsNceEnabled()) {
151 return &module_patchers[i]; 152 return &module_patchers[i];
152 } 153 }
153#endif 154#endif
@@ -175,7 +176,7 @@ AppLoader_DeconstructedRomDirectory::LoadResult AppLoader_DeconstructedRomDirect
175 176
176 // Enable direct memory mapping in case of NCE. 177 // Enable direct memory mapping in case of NCE.
177 const u64 fastmem_base = [&]() -> size_t { 178 const u64 fastmem_base = [&]() -> size_t {
178 if (Settings::IsNceEnabled()) { 179 if (is_application && Settings::IsNceEnabled()) {
179 auto& buffer = system.DeviceMemory().buffer; 180 auto& buffer = system.DeviceMemory().buffer;
180 buffer.EnableDirectMappedAddress(); 181 buffer.EnableDirectMappedAddress();
181 return reinterpret_cast<u64>(buffer.VirtualBasePointer()); 182 return reinterpret_cast<u64>(buffer.VirtualBasePointer());