aboutsummaryrefslogtreecommitdiff
path: root/src/core/hle/kernel/k_process.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/hle/kernel/k_process.cpp')
-rw-r--r--src/core/hle/kernel/k_process.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/core/hle/kernel/k_process.cpp b/src/core/hle/kernel/k_process.cpp
index bd50f74c27..70e578f22a 100644
--- a/src/core/hle/kernel/k_process.cpp
+++ b/src/core/hle/kernel/k_process.cpp
@@ -341,6 +341,11 @@ Result KProcess::Initialize(const Svc::CreateProcessParameter& params, const KPa
// Initialize capabilities.
R_TRY(m_capabilities.InitializeForKip(caps, std::addressof(m_page_table)));
+ // Enable mapping device pages as executable on legacy processes.
+ if (m_capabilities.GetIntendedKernelMajorVersion() < 26) {
+ m_page_table.AllowDeviceMappingOfExecPages();
+ }
+
// Initialize the process id.
m_process_id = m_kernel.CreateNewUserProcessID();
ASSERT(InitialProcessIdMin <= m_process_id);
@@ -437,6 +442,11 @@ Result KProcess::Initialize(const Svc::CreateProcessParameter& params,
// Initialize capabilities.
R_TRY(m_capabilities.InitializeForUser(user_caps, std::addressof(m_page_table)));
+ // Enable mapping device pages as executable on legacy processes.
+ if (m_capabilities.GetIntendedKernelMajorVersion() < 26) {
+ m_page_table.AllowDeviceMappingOfExecPages();
+ }
+
// Initialize the process id.
m_process_id = m_kernel.CreateNewUserProcessID();
ASSERT(ProcessIdMin <= m_process_id);
@@ -989,6 +999,9 @@ Result KProcess::Run(s32 priority, size_t stack_size) {
main_thread->GetContext().r[0] = 0;
main_thread->GetContext().r[1] = thread_handle;
+ // Pass the thread handle to the thread local region.
+ this->GetMemory().Write32(GetInteger(main_thread->GetTlsAddress()) + 0x110, thread_handle);
+
// Update our state.
this->ChangeState((state == State::Created) ? State::Running : State::RunningAttached);
ON_RESULT_FAILURE_2 {