aboutsummaryrefslogtreecommitdiff
path: root/src/core/hle/kernel/k_thread.cpp
diff options
context:
space:
mode:
authormaufeat <sahyno1996@gmail.com>2026-05-05 01:29:46 +0200
committercrueter <crueter@eden-emu.dev>2026-05-05 01:29:46 +0200
commitfee603f0b97d2d8a6ecb793326e844e066d2f4cf (patch)
tree4f3e246f426c2a8282856dafcd2d6851f5b46529 /src/core/hle/kernel/k_thread.cpp
parentfc5fa7f1b2dc4a67f5cdff43e499991956692a56 (diff)
[kernel, hle] Initial 22.0.0 kernel changes and cmd stubs (#3761)
- KProcess::Run() and CreateThread() SVC now write the current thread handle to TLS+0x110 - KPageTableBase::LockForMapDeviceAddressSpace now checks for a new KPageTableBase boolean, m_allowed_exec_device_mapping - Stub `am` + `acc` + `settings` cmd module that needs to work for qlaunch Thanks to: @alula and @yellows8 Source for changes: https://github.com/Atmosphere-NX/Atmosphere/pull/2744, https://switchbrew.org/, https://yls8.mtheall.com/ Co-authored-by: PavelBARABANOV <pavelbarabanov94@gmail.com> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/3761 Reviewed-by: CamilleLaVey <camillelavey99@gmail.com>
Diffstat (limited to 'src/core/hle/kernel/k_thread.cpp')
-rw-r--r--src/core/hle/kernel/k_thread.cpp38
1 files changed, 20 insertions, 18 deletions
diff --git a/src/core/hle/kernel/k_thread.cpp b/src/core/hle/kernel/k_thread.cpp
index ea9b7eb114..0af315d726 100644
--- a/src/core/hle/kernel/k_thread.cpp
+++ b/src/core/hle/kernel/k_thread.cpp
@@ -76,11 +76,13 @@ namespace Kernel {
std::atomic_uint16_t interrupt_flag;
std::atomic_uint8_t cache_maintenance_flag;
std::atomic_int64_t thread_cpu_time;
+ std::atomic_uint32_t current_thread_handle;
};
static_assert(offsetof(ThreadLocalRegion, disable_count) == 0x100);
static_assert(offsetof(ThreadLocalRegion, interrupt_flag) == 0x102);
static_assert(offsetof(ThreadLocalRegion, cache_maintenance_flag) == 0x104);
static_assert(offsetof(ThreadLocalRegion, thread_cpu_time) == 0x108);
+ static_assert(offsetof(ThreadLocalRegion, current_thread_handle) == 0x110);
class ThreadQueueImplForKThreadSleep final : public KThreadQueueWithoutEndWait {
public:
@@ -128,24 +130,24 @@ namespace Kernel {
// Next, assert things based on the type.
switch (type) {
- case ThreadType::Main:
- ASSERT(arg == 0);
- [[fallthrough]];
- case ThreadType::User:
- ASSERT(((owner == nullptr) ||
- (owner->GetCoreMask() | (1ULL << virt_core)) == owner->GetCoreMask()));
- ASSERT(((owner == nullptr) || (prio > Svc::LowestThreadPriority) ||
- (owner->GetPriorityMask() | (1ULL << prio)) == owner->GetPriorityMask()));
- break;
- case ThreadType::HighPriority:
- case ThreadType::Dummy:
- break;
- case ThreadType::Kernel:
- UNIMPLEMENTED();
- break;
- default:
- ASSERT_MSG(false, "KThread::Initialize: Unknown ThreadType {}", static_cast<u32>(type));
- break;
+ case ThreadType::Main:
+ ASSERT(arg == 0);
+ [[fallthrough]];
+ case ThreadType::User:
+ ASSERT(((owner == nullptr) ||
+ (owner->GetCoreMask() | (1ULL << virt_core)) == owner->GetCoreMask()));
+ ASSERT(((owner == nullptr) || (prio > Svc::LowestThreadPriority) ||
+ (owner->GetPriorityMask() | (1ULL << prio)) == owner->GetPriorityMask()));
+ break;
+ case ThreadType::HighPriority:
+ case ThreadType::Dummy:
+ break;
+ case ThreadType::Kernel:
+ UNIMPLEMENTED();
+ break;
+ default:
+ ASSERT_MSG(false, "KThread::Initialize: Unknown ThreadType {}", static_cast<u32>(type));
+ break;
}
m_thread_type = type;