summaryrefslogtreecommitdiffstats
path: root/src/core/loader
diff options
context:
space:
mode:
authorSubv <subv2112@gmail.com>2015-05-12 22:25:15 +0200
committerSubv <subv2112@gmail.com>2015-05-15 05:50:13 +0200
commitd3634d4bf4b1cbd8cc4fe6f22178054803b41e23 (patch)
tree2fa606ebac3e2e77e65e1196878a5f5345acfacf /src/core/loader
parentMerge pull request #762 from yuriks/memmap (diff)
downloadyuzu-d3634d4bf4b1cbd8cc4fe6f22178054803b41e23.tar
yuzu-d3634d4bf4b1cbd8cc4fe6f22178054803b41e23.tar.gz
yuzu-d3634d4bf4b1cbd8cc4fe6f22178054803b41e23.tar.bz2
yuzu-d3634d4bf4b1cbd8cc4fe6f22178054803b41e23.tar.lz
yuzu-d3634d4bf4b1cbd8cc4fe6f22178054803b41e23.tar.xz
yuzu-d3634d4bf4b1cbd8cc4fe6f22178054803b41e23.tar.zst
yuzu-d3634d4bf4b1cbd8cc4fe6f22178054803b41e23.zip
Diffstat (limited to '')
-rw-r--r--src/core/loader/3dsx.cpp4
-rw-r--r--src/core/loader/elf.cpp4
-rw-r--r--src/core/loader/ncch.cpp5
3 files changed, 13 insertions, 0 deletions
diff --git a/src/core/loader/3dsx.cpp b/src/core/loader/3dsx.cpp
index 84b13ee52..ad5e929ce 100644
--- a/src/core/loader/3dsx.cpp
+++ b/src/core/loader/3dsx.cpp
@@ -9,6 +9,7 @@
#include "core/file_sys/archive_romfs.h"
#include "core/hle/kernel/process.h"
+#include "core/hle/kernel/resource_limit.h"
#include "core/hle/service/fs/archive.h"
#include "core/loader/elf.h"
#include "core/loader/ncch.h"
@@ -233,6 +234,9 @@ ResultStatus AppLoader_THREEDSX::Load() {
Kernel::g_current_process = Kernel::Process::Create(filename, 0);
Kernel::g_current_process->svc_access_mask.set();
Kernel::g_current_process->address_mappings = default_address_mappings;
+
+ // Attach the default resource limit (APPLICATION) to the process
+ Kernel::g_current_process->resource_limit = Kernel::ResourceLimit::GetForCategory(Kernel::ResourceLimitCategory::APPLICATION);
Load3DSXFile(*file, Memory::PROCESS_IMAGE_VADDR);
diff --git a/src/core/loader/elf.cpp b/src/core/loader/elf.cpp
index a951bc80f..f00753a79 100644
--- a/src/core/loader/elf.cpp
+++ b/src/core/loader/elf.cpp
@@ -11,6 +11,7 @@
#include "common/symbols.h"
#include "core/hle/kernel/kernel.h"
+#include "core/hle/kernel/resource_limit.h"
#include "core/loader/elf.h"
#include "core/memory.h"
@@ -354,6 +355,9 @@ ResultStatus AppLoader_ELF::Load() {
Kernel::g_current_process->svc_access_mask.set();
Kernel::g_current_process->address_mappings = default_address_mappings;
+ // Attach the default resource limit (APPLICATION) to the process
+ Kernel::g_current_process->resource_limit = Kernel::ResourceLimit::GetForCategory(Kernel::ResourceLimitCategory::APPLICATION);
+
ElfReader elf_reader(&buffer[0]);
elf_reader.LoadInto(Memory::PROCESS_IMAGE_VADDR);
// TODO: Fill application title
diff --git a/src/core/loader/ncch.cpp b/src/core/loader/ncch.cpp
index 36e341fd4..08993c4fa 100644
--- a/src/core/loader/ncch.cpp
+++ b/src/core/loader/ncch.cpp
@@ -11,6 +11,7 @@
#include "common/swap.h"
#include "core/hle/kernel/kernel.h"
+#include "core/hle/kernel/resource_limit.h"
#include "core/loader/ncch.h"
#include "core/memory.h"
@@ -126,6 +127,10 @@ ResultStatus AppLoader_NCCH::LoadExec() const {
u64 program_id = *reinterpret_cast<u64_le const*>(&ncch_header.program_id[0]);
Kernel::g_current_process = Kernel::Process::Create(process_name, program_id);
+ // Attach a resource limit to the process based on the resource limit category
+ Kernel::g_current_process->resource_limit = Kernel::ResourceLimit::GetForCategory(
+ static_cast<Kernel::ResourceLimitCategory>(exheader_header.arm11_system_local_caps.resource_limit_category));
+
// Copy data while converting endianess
std::array<u32, ARRAY_SIZE(exheader_header.arm11_kernel_caps.descriptors)> kernel_caps;
std::copy_n(exheader_header.arm11_kernel_caps.descriptors, kernel_caps.size(), begin(kernel_caps));