Skip to content

Commit

Permalink
Merge pull request wheremyfoodat#360 from wheremyfoodat/helpme
Browse files Browse the repository at this point in the history
Implement SVC 0x3B (GetThreadContext)
  • Loading branch information
wheremyfoodat authored Jan 2, 2024
2 parents 49ab77c + 1430f1c commit 281a7ee
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions include/kernel/kernel.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ class Kernel {
void getResourceLimitCurrentValues();
void getSystemInfo();
void getSystemTick();
void getThreadContext();
void getThreadID();
void getThreadIdealProcessor();
void getThreadPriority();
Expand Down
1 change: 1 addition & 0 deletions src/core/kernel/kernel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ void Kernel::serviceSVC(u32 svc) {
case 0x38: getResourceLimit(); break;
case 0x39: getResourceLimitLimitValues(); break;
case 0x3A: getResourceLimitCurrentValues(); break;
case 0x3B: getThreadContext(); break;
case 0x3D: outputDebugString(); break;
default: Helpers::panic("Unimplemented svc: %X @ %08X", svc, regs[15]); break;
}
Expand Down
7 changes: 7 additions & 0 deletions src/core/kernel/threads.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,13 @@ void Kernel::getThreadIdealProcessor() {
regs[1] = static_cast<u32>(ProcessorID::AppCore);
}

void Kernel::getThreadContext() {
Helpers::warn("Stubbed Kernel::GetThreadContext");

// TODO: Decompile this from Kernel11. 3DBrew says function is stubbed.
regs[0] = Result::Success;
}

void Kernel::setThreadPriority() {
const Handle handle = regs[0];
const u32 priority = regs[1];
Expand Down

0 comments on commit 281a7ee

Please sign in to comment.