diff options
| author | maufeat <sahyno1996@gmail.com> | 2026-05-05 01:29:46 +0200 |
|---|---|---|
| committer | crueter <crueter@eden-emu.dev> | 2026-05-05 01:29:46 +0200 |
| commit | fee603f0b97d2d8a6ecb793326e844e066d2f4cf (patch) | |
| tree | 4f3e246f426c2a8282856dafcd2d6851f5b46529 /src/core/hle/kernel/k_process.cpp | |
| parent | fc5fa7f1b2dc4a67f5cdff43e499991956692a56 (diff) | |
[kernel, hle] Initial 22.0.0 kernel changes and cmd stubs (#3761)
- KProcess::Run() and CreateThread() SVC now write the current thread handle to TLS+0x110
- KPageTableBase::LockForMapDeviceAddressSpace now checks for a new KPageTableBase boolean, m_allowed_exec_device_mapping
- Stub `am` + `acc` + `settings` cmd module that needs to work for qlaunch
Thanks to: @alula and @yellows8
Source for changes: https://github.com/Atmosphere-NX/Atmosphere/pull/2744, https://switchbrew.org/, https://yls8.mtheall.com/
Co-authored-by: PavelBARABANOV <pavelbarabanov94@gmail.com>
Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/3761
Reviewed-by: CamilleLaVey <camillelavey99@gmail.com>
Diffstat (limited to 'src/core/hle/kernel/k_process.cpp')
| -rw-r--r-- | src/core/hle/kernel/k_process.cpp | 13 |
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 { |
