summaryrefslogtreecommitdiffstats
path: root/src/core/hle/kernel/k_process.cpp
diff options
context:
space:
mode:
authorFernando S <fsahmkow27@gmail.com>2023-12-06 14:19:17 +0100
committerGitHub <noreply@github.com>2023-12-06 14:19:17 +0100
commit8a79dd2d6c6445bff63ea1f2f5f1611a6afcd97a (patch)
tree265bf3c7970a570479c6a3ac1250549995f0329c /src/core/hle/kernel/k_process.cpp
parentMerge pull request #12271 from liamwhite/pretext-fix (diff)
parentarm: fix context save of vector regs (diff)
downloadyuzu-8a79dd2d6c6445bff63ea1f2f5f1611a6afcd97a.tar
yuzu-8a79dd2d6c6445bff63ea1f2f5f1611a6afcd97a.tar.gz
yuzu-8a79dd2d6c6445bff63ea1f2f5f1611a6afcd97a.tar.bz2
yuzu-8a79dd2d6c6445bff63ea1f2f5f1611a6afcd97a.tar.lz
yuzu-8a79dd2d6c6445bff63ea1f2f5f1611a6afcd97a.tar.xz
yuzu-8a79dd2d6c6445bff63ea1f2f5f1611a6afcd97a.tar.zst
yuzu-8a79dd2d6c6445bff63ea1f2f5f1611a6afcd97a.zip
Diffstat (limited to 'src/core/hle/kernel/k_process.cpp')
-rw-r--r--src/core/hle/kernel/k_process.cpp40
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;