mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-07-07 15:52:59 +12:00
Add thread debugger
This commit is contained in:
parent
228068901b
commit
9932e58bf0
10 changed files with 172 additions and 14 deletions
|
@ -1,4 +1,5 @@
|
|||
#include <cstring>
|
||||
|
||||
#include "arm_defs.hpp"
|
||||
#include "kernel.hpp"
|
||||
|
||||
|
@ -35,13 +36,14 @@ void Kernel::setupIdleThread() {
|
|||
if (!vaddr.has_value() || vaddr.value() != codeAddress) {
|
||||
Helpers::panic("Failed to setup idle thread");
|
||||
}
|
||||
|
||||
|
||||
// Copy idle thread code to the allocated FCRAM
|
||||
std::memcpy(&mem.getFCRAM()[fcramIndex], idleThreadCode, sizeof(idleThreadCode));
|
||||
|
||||
t.entrypoint = codeAddress;
|
||||
t.initialSP = 0;
|
||||
t.tlsBase = 0;
|
||||
t.gprs[13] = 0; // Set SP & LR to 0 just in case. The idle thread should never access memory, but let's be safe
|
||||
t.gprs[13] = 0; // Set SP & LR to 0 just in case. The idle thread should never access memory, but let's be safe
|
||||
t.gprs[14] = 0;
|
||||
t.gprs[15] = codeAddress;
|
||||
t.cpsr = CPSR::UserMode;
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
#include <algorithm>
|
||||
#include <bit>
|
||||
#include <cassert>
|
||||
#include <cstring>
|
||||
|
@ -697,3 +698,18 @@ bool Kernel::shouldWaitOnObject(KernelObject* object) {
|
|||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<Thread> Kernel::getMainProcessThreads() {
|
||||
// Sort the thread indices so that they appear nicer in the debugger
|
||||
auto indices = threadIndices;
|
||||
std::sort(indices.begin(), indices.end());
|
||||
|
||||
std::vector<Thread> ret;
|
||||
ret.reserve(indices.size());
|
||||
|
||||
for (const auto& index : indices) {
|
||||
ret.push_back(threads[index]);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue