diff options
| author | 2020-07-15 13:13:31 -0400 | |
|---|---|---|
| committer | 2020-07-15 13:28:05 -0400 | |
| commit | 4ad69ca96e747c2ed23edf7f35c5fedda28b2008 (patch) | |
| tree | 113da68e222da4ff4276e8f307e00b57a7eacb99 /src/core/hle/kernel | |
| parent | Merge pull request #4342 from lioncash/endian (diff) | |
| download | yuzu-4ad69ca96e747c2ed23edf7f35c5fedda28b2008.tar.gz yuzu-4ad69ca96e747c2ed23edf7f35c5fedda28b2008.tar.xz yuzu-4ad69ca96e747c2ed23edf7f35c5fedda28b2008.zip | |
kernel/thread: Remove global GetCurrentThread()
This is only used in one place, so we can fold it into the calling code,
eliminating a place for the global system instance to be used.
Diffstat (limited to 'src/core/hle/kernel')
| -rw-r--r-- | src/core/hle/kernel/handle_table.cpp | 3 | ||||
| -rw-r--r-- | src/core/hle/kernel/thread.cpp | 22 | ||||
| -rw-r--r-- | src/core/hle/kernel/thread.h | 5 |
3 files changed, 7 insertions, 23 deletions
diff --git a/src/core/hle/kernel/handle_table.cpp b/src/core/hle/kernel/handle_table.cpp index 35448b576..aaf048243 100644 --- a/src/core/hle/kernel/handle_table.cpp +++ b/src/core/hle/kernel/handle_table.cpp | |||
| @@ -8,6 +8,7 @@ | |||
| 8 | #include "core/core.h" | 8 | #include "core/core.h" |
| 9 | #include "core/hle/kernel/errors.h" | 9 | #include "core/hle/kernel/errors.h" |
| 10 | #include "core/hle/kernel/handle_table.h" | 10 | #include "core/hle/kernel/handle_table.h" |
| 11 | #include "core/hle/kernel/scheduler.h" | ||
| 11 | #include "core/hle/kernel/process.h" | 12 | #include "core/hle/kernel/process.h" |
| 12 | #include "core/hle/kernel/thread.h" | 13 | #include "core/hle/kernel/thread.h" |
| 13 | 14 | ||
| @@ -103,7 +104,7 @@ bool HandleTable::IsValid(Handle handle) const { | |||
| 103 | 104 | ||
| 104 | std::shared_ptr<Object> HandleTable::GetGeneric(Handle handle) const { | 105 | std::shared_ptr<Object> HandleTable::GetGeneric(Handle handle) const { |
| 105 | if (handle == CurrentThread) { | 106 | if (handle == CurrentThread) { |
| 106 | return SharedFrom(GetCurrentThread()); | 107 | return SharedFrom(Core::System::GetInstance().CurrentScheduler().GetCurrentThread()); |
| 107 | } else if (handle == CurrentProcess) { | 108 | } else if (handle == CurrentProcess) { |
| 108 | return SharedFrom(Core::System::GetInstance().CurrentProcess()); | 109 | return SharedFrom(Core::System::GetInstance().CurrentProcess()); |
| 109 | } | 110 | } |
diff --git a/src/core/hle/kernel/thread.cpp b/src/core/hle/kernel/thread.cpp index 2b1092697..67148fa6d 100644 --- a/src/core/hle/kernel/thread.cpp +++ b/src/core/hle/kernel/thread.cpp | |||
| @@ -13,16 +13,8 @@ | |||
| 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/arm/unicorn/arm_unicorn.h" |
| 23 | #include "core/core.h" | 17 | #include "core/core.h" |
| 24 | #include "core/core_timing.h" | ||
| 25 | #include "core/core_timing_util.h" | ||
| 26 | #include "core/cpu_manager.h" | 18 | #include "core/cpu_manager.h" |
| 27 | #include "core/hardware_properties.h" | 19 | #include "core/hardware_properties.h" |
| 28 | #include "core/hle/kernel/errors.h" | 20 | #include "core/hle/kernel/errors.h" |
| @@ -36,6 +28,11 @@ | |||
| 36 | #include "core/hle/result.h" | 28 | #include "core/hle/result.h" |
| 37 | #include "core/memory.h" | 29 | #include "core/memory.h" |
| 38 | 30 | ||
| 31 | #ifdef ARCHITECTURE_x86_64 | ||
| 32 | #include "core/arm/dynarmic/arm_dynarmic_32.h" | ||
| 33 | #include "core/arm/dynarmic/arm_dynarmic_64.h" | ||
| 34 | #endif | ||
| 35 | |||
| 39 | namespace Kernel { | 36 | namespace Kernel { |
| 40 | 37 | ||
| 41 | bool Thread::ShouldWait(const Thread* thread) const { | 38 | bool Thread::ShouldWait(const Thread* thread) const { |
| @@ -540,13 +537,4 @@ ResultCode Thread::SetCoreAndAffinityMask(s32 new_core, u64 new_affinity_mask) { | |||
| 540 | return RESULT_SUCCESS; | 537 | return RESULT_SUCCESS; |
| 541 | } | 538 | } |
| 542 | 539 | ||
| 543 | //////////////////////////////////////////////////////////////////////////////////////////////////// | ||
| 544 | |||
| 545 | /** | ||
| 546 | * Gets the current thread | ||
| 547 | */ | ||
| 548 | Thread* GetCurrentThread() { | ||
| 549 | return Core::System::GetInstance().CurrentScheduler().GetCurrentThread(); | ||
| 550 | } | ||
| 551 | |||
| 552 | } // namespace Kernel | 540 | } // namespace Kernel |
diff --git a/src/core/hle/kernel/thread.h b/src/core/hle/kernel/thread.h index c0342c462..9808767e5 100644 --- a/src/core/hle/kernel/thread.h +++ b/src/core/hle/kernel/thread.h | |||
| @@ -680,9 +680,4 @@ private: | |||
| 680 | std::string name; | 680 | std::string name; |
| 681 | }; | 681 | }; |
| 682 | 682 | ||
| 683 | /** | ||
| 684 | * Gets the current thread | ||
| 685 | */ | ||
| 686 | Thread* GetCurrentThread(); | ||
| 687 | |||
| 688 | } // namespace Kernel | 683 | } // namespace Kernel |