diff options
| author | 2019-10-28 10:53:27 +1100 | |
|---|---|---|
| committer | 2019-10-28 10:53:27 +1100 | |
| commit | 4c5731c34f0915457a31c60c9f70a2f169ea575d (patch) | |
| tree | 7f03a7f892370b59e56ae06c6c74514f1cc44998 /src/core/gdbstub/gdbstub.cpp | |
| parent | Merge pull request #3034 from ReinUsesLisp/w4244-maxwell3d (diff) | |
| parent | Kernel Thread: Cleanup THREADPROCESSORID_DONT_UPDATE. (diff) | |
| download | yuzu-4c5731c34f0915457a31c60c9f70a2f169ea575d.tar.gz yuzu-4c5731c34f0915457a31c60c9f70a2f169ea575d.tar.xz yuzu-4c5731c34f0915457a31c60c9f70a2f169ea575d.zip | |
Merge pull request #2971 from FernandoS27/new-scheduler-v2
Kernel: Implement a New Thread Scheduler V2
Diffstat (limited to 'src/core/gdbstub/gdbstub.cpp')
| -rw-r--r-- | src/core/gdbstub/gdbstub.cpp | 32 |
1 files changed, 13 insertions, 19 deletions
diff --git a/src/core/gdbstub/gdbstub.cpp b/src/core/gdbstub/gdbstub.cpp index db51d722f..20bb50868 100644 --- a/src/core/gdbstub/gdbstub.cpp +++ b/src/core/gdbstub/gdbstub.cpp | |||
| @@ -202,13 +202,11 @@ void RegisterModule(std::string name, VAddr beg, VAddr end, bool add_elf_ext) { | |||
| 202 | } | 202 | } |
| 203 | 203 | ||
| 204 | static Kernel::Thread* FindThreadById(s64 id) { | 204 | static Kernel::Thread* FindThreadById(s64 id) { |
| 205 | for (u32 core = 0; core < Core::NUM_CPU_CORES; core++) { | 205 | const auto& threads = Core::System::GetInstance().GlobalScheduler().GetThreadList(); |
| 206 | const auto& threads = Core::System::GetInstance().Scheduler(core).GetThreadList(); | 206 | for (auto& thread : threads) { |
| 207 | for (auto& thread : threads) { | 207 | if (thread->GetThreadID() == static_cast<u64>(id)) { |
| 208 | if (thread->GetThreadID() == static_cast<u64>(id)) { | 208 | current_core = thread->GetProcessorID(); |
| 209 | current_core = core; | 209 | return thread.get(); |
| 210 | return thread.get(); | ||
| 211 | } | ||
| 212 | } | 210 | } |
| 213 | } | 211 | } |
| 214 | return nullptr; | 212 | return nullptr; |
| @@ -647,11 +645,9 @@ static void HandleQuery() { | |||
| 647 | SendReply(buffer.c_str()); | 645 | SendReply(buffer.c_str()); |
| 648 | } else if (strncmp(query, "fThreadInfo", strlen("fThreadInfo")) == 0) { | 646 | } else if (strncmp(query, "fThreadInfo", strlen("fThreadInfo")) == 0) { |
| 649 | std::string val = "m"; | 647 | std::string val = "m"; |
| 650 | for (u32 core = 0; core < Core::NUM_CPU_CORES; core++) { | 648 | const auto& threads = Core::System::GetInstance().GlobalScheduler().GetThreadList(); |
| 651 | const auto& threads = Core::System::GetInstance().Scheduler(core).GetThreadList(); | 649 | for (const auto& thread : threads) { |
| 652 | for (const auto& thread : threads) { | 650 | val += fmt::format("{:x},", thread->GetThreadID()); |
| 653 | val += fmt::format("{:x},", thread->GetThreadID()); | ||
| 654 | } | ||
| 655 | } | 651 | } |
| 656 | val.pop_back(); | 652 | val.pop_back(); |
| 657 | SendReply(val.c_str()); | 653 | SendReply(val.c_str()); |
| @@ -661,13 +657,11 @@ static void HandleQuery() { | |||
| 661 | std::string buffer; | 657 | std::string buffer; |
| 662 | buffer += "l<?xml version=\"1.0\"?>"; | 658 | buffer += "l<?xml version=\"1.0\"?>"; |
| 663 | buffer += "<threads>"; | 659 | buffer += "<threads>"; |
| 664 | for (u32 core = 0; core < Core::NUM_CPU_CORES; core++) { | 660 | const auto& threads = Core::System::GetInstance().GlobalScheduler().GetThreadList(); |
| 665 | const auto& threads = Core::System::GetInstance().Scheduler(core).GetThreadList(); | 661 | for (const auto& thread : threads) { |
| 666 | for (const auto& thread : threads) { | 662 | buffer += |
| 667 | buffer += | 663 | fmt::format(R"*(<thread id="{:x}" core="{:d}" name="Thread {:x}"></thread>)*", |
| 668 | fmt::format(R"*(<thread id="{:x}" core="{:d}" name="Thread {:x}"></thread>)*", | 664 | thread->GetThreadID(), thread->GetProcessorID(), thread->GetThreadID()); |
| 669 | thread->GetThreadID(), core, thread->GetThreadID()); | ||
| 670 | } | ||
| 671 | } | 665 | } |
| 672 | buffer += "</threads>"; | 666 | buffer += "</threads>"; |
| 673 | SendReply(buffer.c_str()); | 667 | SendReply(buffer.c_str()); |