mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-06-07 19:41:38 +12:00
Add status variable to threads
This commit is contained in:
parent
1ac9417d50
commit
0d9088eddc
5 changed files with 20 additions and 8 deletions
|
@ -46,7 +46,7 @@ void Kernel::arbitrateAddress() {
|
|||
return;
|
||||
}
|
||||
|
||||
if (address & 3) {
|
||||
if (address & 3) [[unlikely]] {
|
||||
Helpers::panic("ArbitrateAddres:: Unaligned address");
|
||||
}
|
||||
|
||||
|
|
|
@ -74,7 +74,7 @@ void Kernel::reset() {
|
|||
currentProcess = makeProcess();
|
||||
// Make main thread object. We do not have to set the entrypoint and SP for it as the ROM loader does.
|
||||
// Main thread seems to have a priority of 0x30
|
||||
mainThread = makeThread(0, 0, 0x30, 0);
|
||||
mainThread = makeThread(0, 0, 0x30, 0, ThreadStatus::Running);
|
||||
currentThread = mainThread;
|
||||
|
||||
// Create global service manager port
|
||||
|
|
|
@ -2,14 +2,14 @@
|
|||
#include "resource_limits.hpp"
|
||||
|
||||
// Internal OS function to spawn a thread
|
||||
Handle Kernel::makeThread(u32 entrypoint, u32 initialSP, u32 priority, u32 id) {
|
||||
Handle Kernel::makeThread(u32 entrypoint, u32 initialSP, u32 priority, u32 id, ThreadStatus status) {
|
||||
if (threadCount >= appResourceLimits.maxThreads) {
|
||||
Helpers::panic("Overflowed the number of threads");
|
||||
}
|
||||
threadCount++;
|
||||
|
||||
Handle ret = makeObject(KernelObjectType::Thread);
|
||||
objects[ret].data = new Thread(initialSP, entrypoint, priority, id);
|
||||
objects[ret].data = new Thread(initialSP, entrypoint, priority, id, status);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -23,7 +23,7 @@ void Kernel::createThread() {
|
|||
printf("CreateThread(entry = %08X, stacktop = %08X, priority = %X, processor ID = %d)\n", entrypoint,
|
||||
initialSP, priority, id);
|
||||
|
||||
if (!(priority <= 0x3F)) [[unlikely]] {
|
||||
if (priority > 0x3F) [[unlikely]] {
|
||||
Helpers::panic("Created thread with bad priority value %X", priority);
|
||||
regs[0] = SVCResult::BadThreadPriority;
|
||||
return;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue