diff options
Diffstat (limited to 'src/core/hle/kernel/thread.cpp')
| -rw-r--r-- | src/core/hle/kernel/thread.cpp | 35 |
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 @@ | |||
| 13 | #include "common/logging/log.h" | 13 | #include "common/logging/log.h" |
| 14 | #include "common/thread_queue_list.h" | 14 | #include "common/thread_queue_list.h" |
| 15 | #include "core/arm/arm_interface.h" | 15 | #include "core/arm/arm_interface.h" |
| 16 | #ifdef ARCHITECTURE_x86_64 | ||
| 17 | #include "core/arm/dynarmic/arm_dynarmic_32.h" | ||
| 18 | #include "core/arm/dynarmic/arm_dynarmic_64.h" | ||
| 19 | #endif | ||
| 20 | #include "core/arm/cpu_interrupt_handler.h" | ||
| 21 | #include "core/arm/exclusive_monitor.h" | ||
| 22 | #include "core/arm/unicorn/arm_unicorn.h" | ||
| 16 | #include "core/core.h" | 23 | #include "core/core.h" |
| 17 | #include "core/core_timing.h" | 24 | #include "core/core_timing.h" |
| 18 | #include "core/core_timing_util.h" | 25 | #include "core/core_timing_util.h" |
| @@ -232,7 +239,27 @@ ResultVal<std::shared_ptr<Thread>> Thread::Create(Core::System& system, ThreadTy | |||
| 232 | } | 239 | } |
| 233 | // TODO(peachum): move to ScheduleThread() when scheduler is added so selected core is used | 240 | // TODO(peachum): move to ScheduleThread() when scheduler is added so selected core is used |
| 234 | // to initialize the context | 241 | // to initialize the context |
| 242 | thread->arm_interface.reset(); | ||
| 235 | if ((type_flags & THREADTYPE_HLE) == 0) { | 243 | if ((type_flags & THREADTYPE_HLE) == 0) { |
| 244 | #ifdef ARCHITECTURE_x86_64 | ||
| 245 | if (owner_process && !owner_process->Is64BitProcess()) { | ||
| 246 | thread->arm_interface = std::make_unique<Core::ARM_Dynarmic_32>( | ||
| 247 | system, kernel.Interrupts(), kernel.GetExclusiveMonitor(), processor_id); | ||
| 248 | } else { | ||
| 249 | thread->arm_interface = std::make_unique<Core::ARM_Dynarmic_64>( | ||
| 250 | system, kernel.Interrupts(), kernel.GetExclusiveMonitor(), processor_id); | ||
| 251 | } | ||
| 252 | |||
| 253 | #else | ||
| 254 | if (owner_process && !owner_process->Is64BitProcess()) { | ||
| 255 | thread->arm_interface = std::make_shared<Core::ARM_Unicorn>( | ||
| 256 | system, kernel.Interrupts(), ARM_Unicorn::Arch::AArch32, processor_id); | ||
| 257 | } else { | ||
| 258 | thread->arm_interface = std::make_shared<Core::ARM_Unicorn>( | ||
| 259 | system, kernel.Interrupts(), ARM_Unicorn::Arch::AArch64, processor_id); | ||
| 260 | } | ||
| 261 | LOG_WARNING(Core, "CPU JIT requested, but Dynarmic not available"); | ||
| 262 | #endif | ||
| 236 | ResetThreadContext32(thread->context_32, static_cast<u32>(stack_top), | 263 | ResetThreadContext32(thread->context_32, static_cast<u32>(stack_top), |
| 237 | static_cast<u32>(entry_point), static_cast<u32>(arg)); | 264 | static_cast<u32>(entry_point), static_cast<u32>(arg)); |
| 238 | ResetThreadContext64(thread->context_64, stack_top, entry_point, arg); | 265 | ResetThreadContext64(thread->context_64, stack_top, entry_point, arg); |
| @@ -276,6 +303,14 @@ VAddr Thread::GetCommandBufferAddress() const { | |||
| 276 | return GetTLSAddress() + command_header_offset; | 303 | return GetTLSAddress() + command_header_offset; |
| 277 | } | 304 | } |
| 278 | 305 | ||
| 306 | Core::ARM_Interface& Thread::ArmInterface() { | ||
| 307 | return *arm_interface; | ||
| 308 | } | ||
| 309 | |||
| 310 | const Core::ARM_Interface& Thread::ArmInterface() const { | ||
| 311 | return *arm_interface; | ||
| 312 | } | ||
| 313 | |||
| 279 | void Thread::SetStatus(ThreadStatus new_status) { | 314 | void Thread::SetStatus(ThreadStatus new_status) { |
| 280 | if (new_status == status) { | 315 | if (new_status == status) { |
| 281 | return; | 316 | return; |