summaryrefslogtreecommitdiffstats
path: root/src/core/hle/kernel/thread.cpp
diff options
context:
space:
mode:
authorFernando Sahmkow <fsahmkow27@gmail.com>2020-03-01 17:14:17 +0100
committerFernando Sahmkow <fsahmkow27@gmail.com>2020-06-27 17:35:58 +0200
commit1567824d2da8e9b49b433f3d1d753d8ad84e65f9 (patch)
treec9553bb3f1693e430054695737d2f87ba4b58955 /src/core/hle/kernel/thread.cpp
parentCore: Refactor ARM Interface. (diff)
downloadyuzu-1567824d2da8e9b49b433f3d1d753d8ad84e65f9.tar
yuzu-1567824d2da8e9b49b433f3d1d753d8ad84e65f9.tar.gz
yuzu-1567824d2da8e9b49b433f3d1d753d8ad84e65f9.tar.bz2
yuzu-1567824d2da8e9b49b433f3d1d753d8ad84e65f9.tar.lz
yuzu-1567824d2da8e9b49b433f3d1d753d8ad84e65f9.tar.xz
yuzu-1567824d2da8e9b49b433f3d1d753d8ad84e65f9.tar.zst
yuzu-1567824d2da8e9b49b433f3d1d753d8ad84e65f9.zip
Diffstat (limited to '')
-rw-r--r--src/core/hle/kernel/thread.cpp35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/core/hle/kernel/thread.cpp b/src/core/hle/kernel/thread.cpp
index 6f8e7a070..58b06aa9e 100644
--- a/src/core/hle/kernel/thread.cpp
+++ b/src/core/hle/kernel/thread.cpp
@@ -13,6 +13,13 @@
#include "common/logging/log.h"
#include "common/thread_queue_list.h"
#include "core/arm/arm_interface.h"
+#ifdef ARCHITECTURE_x86_64
+#include "core/arm/dynarmic/arm_dynarmic_32.h"
+#include "core/arm/dynarmic/arm_dynarmic_64.h"
+#endif
+#include "core/arm/cpu_interrupt_handler.h"
+#include "core/arm/exclusive_monitor.h"
+#include "core/arm/unicorn/arm_unicorn.h"
#include "core/core.h"
#include "core/core_timing.h"
#include "core/core_timing_util.h"
@@ -232,7 +239,27 @@ ResultVal<std::shared_ptr<Thread>> Thread::Create(Core::System& system, ThreadTy
}
// TODO(peachum): move to ScheduleThread() when scheduler is added so selected core is used
// to initialize the context
+ thread->arm_interface.reset();
if ((type_flags & THREADTYPE_HLE) == 0) {
+#ifdef ARCHITECTURE_x86_64
+ if (owner_process && !owner_process->Is64BitProcess()) {
+ thread->arm_interface = std::make_unique<Core::ARM_Dynarmic_32>(
+ system, kernel.Interrupts(), kernel.GetExclusiveMonitor(), processor_id);
+ } else {
+ thread->arm_interface = std::make_unique<Core::ARM_Dynarmic_64>(
+ system, kernel.Interrupts(), kernel.GetExclusiveMonitor(), processor_id);
+ }
+
+#else
+ if (owner_process && !owner_process->Is64BitProcess()) {
+ thread->arm_interface = std::make_shared<Core::ARM_Unicorn>(
+ system, kernel.Interrupts(), ARM_Unicorn::Arch::AArch32, processor_id);
+ } else {
+ thread->arm_interface = std::make_shared<Core::ARM_Unicorn>(
+ system, kernel.Interrupts(), ARM_Unicorn::Arch::AArch64, processor_id);
+ }
+ LOG_WARNING(Core, "CPU JIT requested, but Dynarmic not available");
+#endif
ResetThreadContext32(thread->context_32, static_cast<u32>(stack_top),
static_cast<u32>(entry_point), static_cast<u32>(arg));
ResetThreadContext64(thread->context_64, stack_top, entry_point, arg);
@@ -276,6 +303,14 @@ VAddr Thread::GetCommandBufferAddress() const {
return GetTLSAddress() + command_header_offset;
}
+Core::ARM_Interface& Thread::ArmInterface() {
+ return *arm_interface;
+}
+
+const Core::ARM_Interface& Thread::ArmInterface() const {
+ return *arm_interface;
+}
+
void Thread::SetStatus(ThreadStatus new_status) {
if (new_status == status) {
return;