diff options
author | Liam <byteslice@airmail.cc> | 2023-11-28 20:30:39 +0100 |
---|---|---|
committer | Liam <byteslice@airmail.cc> | 2023-12-04 16:37:16 +0100 |
commit | 45c87c7e6e841c11def43e5ab25160006dab6d77 (patch) | |
tree | 04a3ea0bd8c07389e17741aa28615e3b32ace2f7 /src/core/hle/kernel/k_process.cpp | |
parent | Merge pull request #12235 from liamwhite/flip-clip (diff) | |
download | yuzu-45c87c7e6e841c11def43e5ab25160006dab6d77.tar yuzu-45c87c7e6e841c11def43e5ab25160006dab6d77.tar.gz yuzu-45c87c7e6e841c11def43e5ab25160006dab6d77.tar.bz2 yuzu-45c87c7e6e841c11def43e5ab25160006dab6d77.tar.lz yuzu-45c87c7e6e841c11def43e5ab25160006dab6d77.tar.xz yuzu-45c87c7e6e841c11def43e5ab25160006dab6d77.tar.zst yuzu-45c87c7e6e841c11def43e5ab25160006dab6d77.zip |
Diffstat (limited to 'src/core/hle/kernel/k_process.cpp')
-rw-r--r-- | src/core/hle/kernel/k_process.cpp | 40 |
1 files changed, 36 insertions, 4 deletions
diff --git a/src/core/hle/kernel/k_process.cpp b/src/core/hle/kernel/k_process.cpp index 6c29eb72c..3a2635e1f 100644 --- a/src/core/hle/kernel/k_process.cpp +++ b/src/core/hle/kernel/k_process.cpp @@ -13,6 +13,12 @@ #include "core/hle/kernel/k_thread_queue.h" #include "core/hle/kernel/k_worker_task_manager.h" +#include "core/arm/dynarmic/arm_dynarmic_32.h" +#include "core/arm/dynarmic/arm_dynarmic_64.h" +#ifdef HAS_NCE +#include "core/arm/nce/arm_nce.h" +#endif + namespace Kernel { namespace { @@ -957,10 +963,8 @@ Result KProcess::Run(s32 priority, size_t stack_size) { R_TRY(m_handle_table.Add(std::addressof(thread_handle), main_thread)); // Set the thread arguments. - main_thread->GetContext32().cpu_registers[0] = 0; - main_thread->GetContext64().cpu_registers[0] = 0; - main_thread->GetContext32().cpu_registers[1] = thread_handle; - main_thread->GetContext64().cpu_registers[1] = thread_handle; + main_thread->GetContext().r[0] = 0; + main_thread->GetContext().r[1] = thread_handle; // Update our state. this->ChangeState((state == State::Created) ? State::Running : State::RunningAttached); @@ -1199,6 +1203,9 @@ Result KProcess::LoadFromMetadata(const FileSys::ProgramMetadata& metadata, std: m_is_hbl = is_hbl; m_ideal_core_id = metadata.GetMainThreadCore(); + // Set up emulation context. + this->InitializeInterfaces(); + // We succeeded. R_SUCCEED(); } @@ -1227,6 +1234,31 @@ void KProcess::LoadModule(CodeSet code_set, KProcessAddress base_addr) { #endif } +void KProcess::InitializeInterfaces() { + this->GetMemory().SetCurrentPageTable(*this); + +#ifdef HAS_NCE + if (this->Is64Bit() && Settings::IsNceEnabled()) { + for (size_t i = 0; i < Core::Hardware::NUM_CPU_CORES; i++) { + m_arm_interfaces[i] = std::make_unique<Core::ArmNce>(m_kernel.System(), true, i); + } + } else +#endif + if (this->Is64Bit()) { + for (size_t i = 0; i < Core::Hardware::NUM_CPU_CORES; i++) { + m_arm_interfaces[i] = std::make_unique<Core::ArmDynarmic64>( + m_kernel.System(), m_kernel.IsMulticore(), this, + static_cast<Core::DynarmicExclusiveMonitor&>(m_kernel.GetExclusiveMonitor()), i); + } + } else { + for (size_t i = 0; i < Core::Hardware::NUM_CPU_CORES; i++) { + m_arm_interfaces[i] = std::make_unique<Core::ArmDynarmic32>( + m_kernel.System(), m_kernel.IsMulticore(), this, + static_cast<Core::DynarmicExclusiveMonitor&>(m_kernel.GetExclusiveMonitor()), i); + } + } +} + bool KProcess::InsertWatchpoint(KProcessAddress addr, u64 size, DebugWatchpointType type) { const auto watch{std::find_if(m_watchpoints.begin(), m_watchpoints.end(), [&](const auto& wp) { return wp.type == DebugWatchpointType::None; |