mirror of
https://github.com/wheremyfoodat/Panda3DS.git
synced 2025-04-06 22:25:41 +12:00
[Kernel] Implement getThreadPriority
This commit is contained in:
parent
08a45fc8a3
commit
bb9a50ab31
3 changed files with 20 additions and 0 deletions
|
@ -95,6 +95,7 @@ class Kernel {
|
|||
void getResourceLimitCurrentValues();
|
||||
void getSystemTick();
|
||||
void getThreadID();
|
||||
void getThreadPriority();
|
||||
void releaseMutex();
|
||||
void sendSyncRequest();
|
||||
void signalEvent();
|
||||
|
|
|
@ -24,6 +24,7 @@ void Kernel::serviceSVC(u32 svc) {
|
|||
case 0x02: queryMemory(); break;
|
||||
case 0x08: createThread(); break;
|
||||
case 0x0A: svcSleepThread(); break;
|
||||
case 0x0B: getThreadPriority(); break;
|
||||
case 0x13: createMutex(); break;
|
||||
case 0x14: releaseMutex(); break;
|
||||
case 0x17: createEvent(); break;
|
||||
|
|
|
@ -213,6 +213,24 @@ void Kernel::getThreadID() {
|
|||
regs[1] = thread->getData<Thread>()->index;
|
||||
}
|
||||
|
||||
void Kernel::getThreadPriority() {
|
||||
const Handle handle = regs[1];
|
||||
log("GetThreadPriority (handle = %X)\n", handle);
|
||||
|
||||
if (handle == KernelHandles::CurrentThread) {
|
||||
regs[0] = SVCResult::Success;
|
||||
regs[1] = threads[currentThreadIndex].priority;
|
||||
} else {
|
||||
auto object = getObject(handle, KernelObjectType::Thread);
|
||||
if (object == nullptr) [[unlikely]] {
|
||||
regs[0] = SVCResult::BadHandle;
|
||||
} else {
|
||||
regs[0] = SVCResult::Success;
|
||||
regs[1] = object->getData<Thread>()->priority;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Kernel::createMutex() {
|
||||
bool locked = regs[1] != 0;
|
||||
Helpers::panic("CreateMutex (initially locked: %s)\n", locked ? "yes" : "no");
|
||||
|
|
Loading…
Add table
Reference in a new issue