mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2025-05-09 11:51:58 -04:00
kern: refactor to use m_ for member variables
This commit is contained in:
parent
0bf2ade76f
commit
968f50bc07
135 changed files with 3727 additions and 3734 deletions
|
@ -96,44 +96,44 @@ namespace ams::kern {
|
|||
|
||||
struct QueueEntry {
|
||||
private:
|
||||
KThread *prev;
|
||||
KThread *next;
|
||||
KThread *m_prev;
|
||||
KThread *m_next;
|
||||
public:
|
||||
constexpr QueueEntry() : prev(nullptr), next(nullptr) { /* ... */ }
|
||||
constexpr QueueEntry() : m_prev(nullptr), m_next(nullptr) { /* ... */ }
|
||||
|
||||
constexpr void Initialize() {
|
||||
this->prev = nullptr;
|
||||
this->next = nullptr;
|
||||
m_prev = nullptr;
|
||||
m_next = nullptr;
|
||||
}
|
||||
|
||||
constexpr KThread *GetPrev() const { return this->prev; }
|
||||
constexpr KThread *GetNext() const { return this->next; }
|
||||
constexpr void SetPrev(KThread *t) { this->prev = t; }
|
||||
constexpr void SetNext(KThread *t) { this->next = t; }
|
||||
constexpr KThread *GetPrev() const { return m_prev; }
|
||||
constexpr KThread *GetNext() const { return m_next; }
|
||||
constexpr void SetPrev(KThread *t) { m_prev = t; }
|
||||
constexpr void SetNext(KThread *t) { m_next = t; }
|
||||
};
|
||||
|
||||
using WaiterList = util::IntrusiveListBaseTraits<KThread>::ListType;
|
||||
private:
|
||||
static constexpr size_t PriorityInheritanceCountMax = 10;
|
||||
union SyncObjectBuffer {
|
||||
KSynchronizationObject *sync_objects[ams::svc::ArgumentHandleCountMax];
|
||||
ams::svc::Handle handles[ams::svc::ArgumentHandleCountMax * (sizeof(KSynchronizationObject *) / sizeof(ams::svc::Handle))];
|
||||
KSynchronizationObject *m_sync_objects[ams::svc::ArgumentHandleCountMax];
|
||||
ams::svc::Handle m_handles[ams::svc::ArgumentHandleCountMax * (sizeof(KSynchronizationObject *) / sizeof(ams::svc::Handle))];
|
||||
|
||||
constexpr SyncObjectBuffer() : sync_objects() { /* ... */ }
|
||||
constexpr SyncObjectBuffer() : m_sync_objects() { /* ... */ }
|
||||
};
|
||||
static_assert(sizeof(SyncObjectBuffer::sync_objects) == sizeof(SyncObjectBuffer::handles));
|
||||
static_assert(sizeof(SyncObjectBuffer::m_sync_objects) == sizeof(SyncObjectBuffer::m_handles));
|
||||
|
||||
struct ConditionVariableComparator {
|
||||
struct LightCompareType {
|
||||
uintptr_t cv_key;
|
||||
s32 priority;
|
||||
uintptr_t m_cv_key;
|
||||
s32 m_priority;
|
||||
|
||||
constexpr ALWAYS_INLINE uintptr_t GetConditionVariableKey() const {
|
||||
return this->cv_key;
|
||||
return m_cv_key;
|
||||
}
|
||||
|
||||
constexpr ALWAYS_INLINE s32 GetPriority() const {
|
||||
return this->priority;
|
||||
return m_priority;
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -158,65 +158,65 @@ namespace ams::kern {
|
|||
private:
|
||||
static inline std::atomic<u64> s_next_thread_id = 0;
|
||||
private:
|
||||
alignas(16) KThreadContext thread_context{};
|
||||
util::IntrusiveListNode process_list_node{};
|
||||
util::IntrusiveRedBlackTreeNode condvar_arbiter_tree_node{};
|
||||
s32 priority{};
|
||||
alignas(16) KThreadContext m_thread_context{};
|
||||
util::IntrusiveListNode m_process_list_node{};
|
||||
util::IntrusiveRedBlackTreeNode m_condvar_arbiter_tree_node{};
|
||||
s32 m_priority{};
|
||||
|
||||
using ConditionVariableThreadTreeTraits = util::IntrusiveRedBlackTreeMemberTraitsDeferredAssert<&KThread::condvar_arbiter_tree_node>;
|
||||
using ConditionVariableThreadTreeTraits = util::IntrusiveRedBlackTreeMemberTraitsDeferredAssert<&KThread::m_condvar_arbiter_tree_node>;
|
||||
using ConditionVariableThreadTree = ConditionVariableThreadTreeTraits::TreeType<ConditionVariableComparator>;
|
||||
|
||||
ConditionVariableThreadTree *condvar_tree{};
|
||||
uintptr_t condvar_key{};
|
||||
u64 virtual_affinity_mask{};
|
||||
KAffinityMask physical_affinity_mask{};
|
||||
u64 thread_id{};
|
||||
std::atomic<s64> cpu_time{};
|
||||
KSynchronizationObject *synced_object{};
|
||||
KProcessAddress address_key{};
|
||||
KProcess *parent{};
|
||||
void *kernel_stack_top{};
|
||||
u32 *light_ipc_data{};
|
||||
KProcessAddress tls_address{};
|
||||
void *tls_heap_address{};
|
||||
KLightLock activity_pause_lock{};
|
||||
SyncObjectBuffer sync_object_buffer{};
|
||||
s64 schedule_count{};
|
||||
s64 last_scheduled_tick{};
|
||||
QueueEntry per_core_priority_queue_entry[cpu::NumCores]{};
|
||||
KLightLock *waiting_lock{};
|
||||
ConditionVariableThreadTree *m_condvar_tree{};
|
||||
uintptr_t m_condvar_key{};
|
||||
u64 m_virtual_affinity_mask{};
|
||||
KAffinityMask m_physical_affinity_mask{};
|
||||
u64 m_thread_id{};
|
||||
std::atomic<s64> m_cpu_time{};
|
||||
KSynchronizationObject *m_synced_object{};
|
||||
KProcessAddress m_address_key{};
|
||||
KProcess *m_parent{};
|
||||
void *m_kernel_stack_top{};
|
||||
u32 *m_light_ipc_data{};
|
||||
KProcessAddress m_tls_address{};
|
||||
void *m_tls_heap_address{};
|
||||
KLightLock m_activity_pause_lock{};
|
||||
SyncObjectBuffer m_sync_object_buffer{};
|
||||
s64 m_schedule_count{};
|
||||
s64 m_last_scheduled_tick{};
|
||||
QueueEntry m_per_core_priority_queue_entry[cpu::NumCores]{};
|
||||
KLightLock *m_waiting_lock{};
|
||||
|
||||
KThreadQueue *sleeping_queue{};
|
||||
KThreadQueue *m_sleeping_queue{};
|
||||
|
||||
WaiterList waiter_list{};
|
||||
WaiterList pinned_waiter_list{};
|
||||
KThread *lock_owner{};
|
||||
uintptr_t debug_params[3]{};
|
||||
u32 address_key_value{};
|
||||
u32 suspend_request_flags{};
|
||||
u32 suspend_allowed_flags{};
|
||||
Result wait_result;
|
||||
Result debug_exception_result;
|
||||
s32 base_priority{};
|
||||
s32 physical_ideal_core_id{};
|
||||
s32 virtual_ideal_core_id{};
|
||||
s32 num_kernel_waiters{};
|
||||
s32 current_core_id{};
|
||||
s32 core_id{};
|
||||
KAffinityMask original_physical_affinity_mask{};
|
||||
s32 original_physical_ideal_core_id{};
|
||||
s32 num_core_migration_disables{};
|
||||
ThreadState thread_state{};
|
||||
std::atomic<bool> termination_requested{};
|
||||
bool wait_cancelled{};
|
||||
bool cancellable{};
|
||||
bool signaled{};
|
||||
bool initialized{};
|
||||
bool debug_attached{};
|
||||
s8 priority_inheritance_count{};
|
||||
bool resource_limit_release_hint{};
|
||||
WaiterList m_waiter_list{};
|
||||
WaiterList m_pinned_waiter_list{};
|
||||
KThread *m_lock_owner{};
|
||||
uintptr_t m_debug_params[3]{};
|
||||
u32 m_address_key_value{};
|
||||
u32 m_suspend_request_flags{};
|
||||
u32 m_suspend_allowed_flags{};
|
||||
Result m_wait_result;
|
||||
Result m_debug_exception_result;
|
||||
s32 m_base_priority{};
|
||||
s32 m_physical_ideal_core_id{};
|
||||
s32 m_virtual_ideal_core_id{};
|
||||
s32 m_num_kernel_waiters{};
|
||||
s32 m_current_core_id{};
|
||||
s32 m_core_id{};
|
||||
KAffinityMask m_original_physical_affinity_mask{};
|
||||
s32 m_original_physical_ideal_core_id{};
|
||||
s32 m_num_core_migration_disables{};
|
||||
ThreadState m_thread_state{};
|
||||
std::atomic<bool> m_termination_requested{};
|
||||
bool m_wait_cancelled{};
|
||||
bool m_cancellable{};
|
||||
bool m_signaled{};
|
||||
bool m_initialized{};
|
||||
bool m_debug_attached{};
|
||||
s8 m_priority_inheritance_count{};
|
||||
bool m_resource_limit_release_hint{};
|
||||
public:
|
||||
constexpr KThread() : wait_result(svc::ResultNoSynchronizationObject()), debug_exception_result(ResultSuccess()) { /* ... */ }
|
||||
constexpr KThread() : m_wait_result(svc::ResultNoSynchronizationObject()), m_debug_exception_result(ResultSuccess()) { /* ... */ }
|
||||
|
||||
virtual ~KThread() { /* ... */ }
|
||||
|
||||
|
@ -240,15 +240,15 @@ namespace ams::kern {
|
|||
static void ResumeThreadsSuspendedForInit();
|
||||
private:
|
||||
StackParameters &GetStackParameters() {
|
||||
return *(reinterpret_cast<StackParameters *>(this->kernel_stack_top) - 1);
|
||||
return *(reinterpret_cast<StackParameters *>(m_kernel_stack_top) - 1);
|
||||
}
|
||||
|
||||
const StackParameters &GetStackParameters() const {
|
||||
return *(reinterpret_cast<const StackParameters *>(this->kernel_stack_top) - 1);
|
||||
return *(reinterpret_cast<const StackParameters *>(m_kernel_stack_top) - 1);
|
||||
}
|
||||
public:
|
||||
StackParameters &GetStackParametersForExceptionSvcPermission() {
|
||||
return *(reinterpret_cast<StackParameters *>(this->kernel_stack_top) - 1);
|
||||
return *(reinterpret_cast<StackParameters *>(m_kernel_stack_top) - 1);
|
||||
}
|
||||
public:
|
||||
ALWAYS_INLINE s32 GetDisableDispatchCount() const {
|
||||
|
@ -272,15 +272,15 @@ namespace ams::kern {
|
|||
void Unpin();
|
||||
|
||||
ALWAYS_INLINE void SaveDebugParams(uintptr_t param1, uintptr_t param2, uintptr_t param3) {
|
||||
this->debug_params[0] = param1;
|
||||
this->debug_params[1] = param2;
|
||||
this->debug_params[2] = param3;
|
||||
m_debug_params[0] = param1;
|
||||
m_debug_params[1] = param2;
|
||||
m_debug_params[2] = param3;
|
||||
}
|
||||
|
||||
ALWAYS_INLINE void RestoreDebugParams(uintptr_t *param1, uintptr_t *param2, uintptr_t *param3) {
|
||||
*param1 = this->debug_params[0];
|
||||
*param2 = this->debug_params[1];
|
||||
*param3 = this->debug_params[2];
|
||||
*param1 = m_debug_params[0];
|
||||
*param2 = m_debug_params[1];
|
||||
*param3 = m_debug_params[2];
|
||||
}
|
||||
|
||||
NOINLINE void DisableCoreMigration();
|
||||
|
@ -336,157 +336,157 @@ namespace ams::kern {
|
|||
void StartTermination();
|
||||
void FinishTermination();
|
||||
public:
|
||||
constexpr u64 GetThreadId() const { return this->thread_id; }
|
||||
constexpr u64 GetThreadId() const { return m_thread_id; }
|
||||
|
||||
constexpr KThreadContext &GetContext() { return this->thread_context; }
|
||||
constexpr const KThreadContext &GetContext() const { return this->thread_context; }
|
||||
constexpr KThreadContext &GetContext() { return m_thread_context; }
|
||||
constexpr const KThreadContext &GetContext() const { return m_thread_context; }
|
||||
|
||||
constexpr u64 GetVirtualAffinityMask() const { return this->virtual_affinity_mask; }
|
||||
constexpr const KAffinityMask &GetAffinityMask() const { return this->physical_affinity_mask; }
|
||||
constexpr u64 GetVirtualAffinityMask() const { return m_virtual_affinity_mask; }
|
||||
constexpr const KAffinityMask &GetAffinityMask() const { return m_physical_affinity_mask; }
|
||||
|
||||
Result GetCoreMask(int32_t *out_ideal_core, u64 *out_affinity_mask);
|
||||
Result SetCoreMask(int32_t ideal_core, u64 affinity_mask);
|
||||
|
||||
Result GetPhysicalCoreMask(int32_t *out_ideal_core, u64 *out_affinity_mask);
|
||||
|
||||
constexpr ThreadState GetState() const { return static_cast<ThreadState>(this->thread_state & ThreadState_Mask); }
|
||||
constexpr ThreadState GetRawState() const { return this->thread_state; }
|
||||
constexpr ThreadState GetState() const { return static_cast<ThreadState>(m_thread_state & ThreadState_Mask); }
|
||||
constexpr ThreadState GetRawState() const { return m_thread_state; }
|
||||
NOINLINE void SetState(ThreadState state);
|
||||
|
||||
NOINLINE KThreadContext *GetContextForSchedulerLoop();
|
||||
|
||||
constexpr uintptr_t GetConditionVariableKey() const { return this->condvar_key; }
|
||||
constexpr uintptr_t GetAddressArbiterKey() const { return this->condvar_key; }
|
||||
constexpr uintptr_t GetConditionVariableKey() const { return m_condvar_key; }
|
||||
constexpr uintptr_t GetAddressArbiterKey() const { return m_condvar_key; }
|
||||
|
||||
constexpr void SetConditionVariable(ConditionVariableThreadTree *tree, KProcessAddress address, uintptr_t cv_key, u32 value) {
|
||||
this->condvar_tree = tree;
|
||||
this->condvar_key = cv_key;
|
||||
this->address_key = address;
|
||||
this->address_key_value = value;
|
||||
m_condvar_tree = tree;
|
||||
m_condvar_key = cv_key;
|
||||
m_address_key = address;
|
||||
m_address_key_value = value;
|
||||
}
|
||||
|
||||
constexpr void ClearConditionVariable() {
|
||||
this->condvar_tree = nullptr;
|
||||
m_condvar_tree = nullptr;
|
||||
}
|
||||
|
||||
constexpr bool IsWaitingForConditionVariable() const {
|
||||
return this->condvar_tree != nullptr;
|
||||
return m_condvar_tree != nullptr;
|
||||
}
|
||||
|
||||
constexpr void SetAddressArbiter(ConditionVariableThreadTree *tree, uintptr_t address) {
|
||||
this->condvar_tree = tree;
|
||||
this->condvar_key = address;
|
||||
m_condvar_tree = tree;
|
||||
m_condvar_key = address;
|
||||
}
|
||||
|
||||
constexpr void ClearAddressArbiter() {
|
||||
this->condvar_tree = nullptr;
|
||||
m_condvar_tree = nullptr;
|
||||
}
|
||||
|
||||
constexpr bool IsWaitingForAddressArbiter() const {
|
||||
return this->condvar_tree != nullptr;
|
||||
return m_condvar_tree != nullptr;
|
||||
}
|
||||
|
||||
constexpr s32 GetIdealVirtualCore() const { return this->virtual_ideal_core_id; }
|
||||
constexpr s32 GetIdealPhysicalCore() const { return this->physical_ideal_core_id; }
|
||||
constexpr s32 GetIdealVirtualCore() const { return m_virtual_ideal_core_id; }
|
||||
constexpr s32 GetIdealPhysicalCore() const { return m_physical_ideal_core_id; }
|
||||
|
||||
constexpr s32 GetActiveCore() const { return this->core_id; }
|
||||
constexpr void SetActiveCore(s32 core) { this->core_id = core; }
|
||||
constexpr s32 GetActiveCore() const { return m_core_id; }
|
||||
constexpr void SetActiveCore(s32 core) { m_core_id = core; }
|
||||
|
||||
constexpr ALWAYS_INLINE s32 GetCurrentCore() const { return this->current_core_id; }
|
||||
constexpr void SetCurrentCore(s32 core) { this->current_core_id = core; }
|
||||
constexpr ALWAYS_INLINE s32 GetCurrentCore() const { return m_current_core_id; }
|
||||
constexpr void SetCurrentCore(s32 core) { m_current_core_id = core; }
|
||||
|
||||
constexpr s32 GetPriority() const { return this->priority; }
|
||||
constexpr void SetPriority(s32 prio) { this->priority = prio; }
|
||||
constexpr s32 GetPriority() const { return m_priority; }
|
||||
constexpr void SetPriority(s32 prio) { m_priority = prio; }
|
||||
|
||||
constexpr s32 GetBasePriority() const { return this->base_priority; }
|
||||
constexpr s32 GetBasePriority() const { return m_base_priority; }
|
||||
|
||||
constexpr QueueEntry &GetPriorityQueueEntry(s32 core) { return this->per_core_priority_queue_entry[core]; }
|
||||
constexpr const QueueEntry &GetPriorityQueueEntry(s32 core) const { return this->per_core_priority_queue_entry[core]; }
|
||||
constexpr QueueEntry &GetPriorityQueueEntry(s32 core) { return m_per_core_priority_queue_entry[core]; }
|
||||
constexpr const QueueEntry &GetPriorityQueueEntry(s32 core) const { return m_per_core_priority_queue_entry[core]; }
|
||||
|
||||
constexpr void SetSleepingQueue(KThreadQueue *q) { this->sleeping_queue = q; }
|
||||
constexpr void SetSleepingQueue(KThreadQueue *q) { m_sleeping_queue = q; }
|
||||
|
||||
constexpr ConditionVariableThreadTree *GetConditionVariableTree() const { return this->condvar_tree; }
|
||||
constexpr ConditionVariableThreadTree *GetConditionVariableTree() const { return m_condvar_tree; }
|
||||
|
||||
constexpr s32 GetNumKernelWaiters() const { return this->num_kernel_waiters; }
|
||||
constexpr s32 GetNumKernelWaiters() const { return m_num_kernel_waiters; }
|
||||
|
||||
void AddWaiter(KThread *thread);
|
||||
void RemoveWaiter(KThread *thread);
|
||||
KThread *RemoveWaiterByKey(s32 *out_num_waiters, KProcessAddress key);
|
||||
|
||||
constexpr KProcessAddress GetAddressKey() const { return this->address_key; }
|
||||
constexpr u32 GetAddressKeyValue() const { return this->address_key_value; }
|
||||
constexpr void SetAddressKey(KProcessAddress key) { this->address_key = key; }
|
||||
constexpr void SetAddressKey(KProcessAddress key, u32 val) { this->address_key = key; this->address_key_value = val; }
|
||||
constexpr KProcessAddress GetAddressKey() const { return m_address_key; }
|
||||
constexpr u32 GetAddressKeyValue() const { return m_address_key_value; }
|
||||
constexpr void SetAddressKey(KProcessAddress key) { m_address_key = key; }
|
||||
constexpr void SetAddressKey(KProcessAddress key, u32 val) { m_address_key = key; m_address_key_value = val; }
|
||||
|
||||
constexpr void SetLockOwner(KThread *owner) { this->lock_owner = owner; }
|
||||
constexpr KThread *GetLockOwner() const { return this->lock_owner; }
|
||||
constexpr void SetLockOwner(KThread *owner) { m_lock_owner = owner; }
|
||||
constexpr KThread *GetLockOwner() const { return m_lock_owner; }
|
||||
|
||||
constexpr void SetSyncedObject(KSynchronizationObject *obj, Result wait_res) {
|
||||
MESOSPHERE_ASSERT_THIS();
|
||||
|
||||
this->synced_object = obj;
|
||||
this->wait_result = wait_res;
|
||||
m_synced_object = obj;
|
||||
m_wait_result = wait_res;
|
||||
}
|
||||
|
||||
constexpr Result GetWaitResult(KSynchronizationObject **out) const {
|
||||
MESOSPHERE_ASSERT_THIS();
|
||||
|
||||
*out = this->synced_object;
|
||||
return this->wait_result;
|
||||
*out = m_synced_object;
|
||||
return m_wait_result;
|
||||
}
|
||||
|
||||
constexpr void SetDebugExceptionResult(Result result) {
|
||||
MESOSPHERE_ASSERT_THIS();
|
||||
this->debug_exception_result = result;
|
||||
m_debug_exception_result = result;
|
||||
}
|
||||
|
||||
constexpr Result GetDebugExceptionResult() const {
|
||||
MESOSPHERE_ASSERT_THIS();
|
||||
return this->debug_exception_result;
|
||||
return m_debug_exception_result;
|
||||
}
|
||||
|
||||
void WaitCancel();
|
||||
|
||||
bool IsWaitCancelled() const { return this->wait_cancelled; }
|
||||
void ClearWaitCancelled() { this->wait_cancelled = false; }
|
||||
bool IsWaitCancelled() const { return m_wait_cancelled; }
|
||||
void ClearWaitCancelled() { m_wait_cancelled = false; }
|
||||
|
||||
void ClearCancellable() { this->cancellable = false; }
|
||||
void SetCancellable() { this->cancellable = true; }
|
||||
void ClearCancellable() { m_cancellable = false; }
|
||||
void SetCancellable() { m_cancellable = true; }
|
||||
|
||||
constexpr u32 *GetLightSessionData() const { return this->light_ipc_data; }
|
||||
constexpr void SetLightSessionData(u32 *data) { this->light_ipc_data = data; }
|
||||
constexpr u32 *GetLightSessionData() const { return m_light_ipc_data; }
|
||||
constexpr void SetLightSessionData(u32 *data) { m_light_ipc_data = data; }
|
||||
|
||||
bool HasWaiters() const { return !this->waiter_list.empty(); }
|
||||
bool HasWaiters() const { return !m_waiter_list.empty(); }
|
||||
|
||||
constexpr s64 GetLastScheduledTick() const { return this->last_scheduled_tick; }
|
||||
constexpr void SetLastScheduledTick(s64 tick) { this->last_scheduled_tick = tick; }
|
||||
constexpr s64 GetLastScheduledTick() const { return m_last_scheduled_tick; }
|
||||
constexpr void SetLastScheduledTick(s64 tick) { m_last_scheduled_tick = tick; }
|
||||
|
||||
constexpr s64 GetYieldScheduleCount() const { return this->schedule_count; }
|
||||
constexpr void SetYieldScheduleCount(s64 count) { this->schedule_count = count; }
|
||||
constexpr s64 GetYieldScheduleCount() const { return m_schedule_count; }
|
||||
constexpr void SetYieldScheduleCount(s64 count) { m_schedule_count = count; }
|
||||
|
||||
constexpr KProcess *GetOwnerProcess() const { return this->parent; }
|
||||
constexpr bool IsUserThread() const { return this->parent != nullptr; }
|
||||
constexpr KProcess *GetOwnerProcess() const { return m_parent; }
|
||||
constexpr bool IsUserThread() const { return m_parent != nullptr; }
|
||||
|
||||
constexpr KProcessAddress GetThreadLocalRegionAddress() const { return this->tls_address; }
|
||||
constexpr void *GetThreadLocalRegionHeapAddress() const { return this->tls_heap_address; }
|
||||
constexpr KProcessAddress GetThreadLocalRegionAddress() const { return m_tls_address; }
|
||||
constexpr void *GetThreadLocalRegionHeapAddress() const { return m_tls_heap_address; }
|
||||
|
||||
constexpr KSynchronizationObject **GetSynchronizationObjectBuffer() { return std::addressof(this->sync_object_buffer.sync_objects[0]); }
|
||||
constexpr ams::svc::Handle *GetHandleBuffer() { return std::addressof(this->sync_object_buffer.handles[sizeof(this->sync_object_buffer.sync_objects) / sizeof(ams::svc::Handle) - ams::svc::ArgumentHandleCountMax]); }
|
||||
constexpr KSynchronizationObject **GetSynchronizationObjectBuffer() { return std::addressof(m_sync_object_buffer.m_sync_objects[0]); }
|
||||
constexpr ams::svc::Handle *GetHandleBuffer() { return std::addressof(m_sync_object_buffer.m_handles[sizeof(m_sync_object_buffer.m_sync_objects) / sizeof(ams::svc::Handle) - ams::svc::ArgumentHandleCountMax]); }
|
||||
|
||||
u16 GetUserDisableCount() const { return static_cast<ams::svc::ThreadLocalRegion *>(this->tls_heap_address)->disable_count; }
|
||||
void SetInterruptFlag() const { static_cast<ams::svc::ThreadLocalRegion *>(this->tls_heap_address)->interrupt_flag = 1; }
|
||||
void ClearInterruptFlag() const { static_cast<ams::svc::ThreadLocalRegion *>(this->tls_heap_address)->interrupt_flag = 0; }
|
||||
u16 GetUserDisableCount() const { return static_cast<ams::svc::ThreadLocalRegion *>(m_tls_heap_address)->disable_count; }
|
||||
void SetInterruptFlag() const { static_cast<ams::svc::ThreadLocalRegion *>(m_tls_heap_address)->interrupt_flag = 1; }
|
||||
void ClearInterruptFlag() const { static_cast<ams::svc::ThreadLocalRegion *>(m_tls_heap_address)->interrupt_flag = 0; }
|
||||
|
||||
constexpr void SetDebugAttached() { this->debug_attached = true; }
|
||||
constexpr bool IsAttachedToDebugger() const { return this->debug_attached; }
|
||||
constexpr void SetDebugAttached() { m_debug_attached = true; }
|
||||
constexpr bool IsAttachedToDebugger() const { return m_debug_attached; }
|
||||
|
||||
void AddCpuTime(s32 core_id, s64 amount) {
|
||||
this->cpu_time += amount;
|
||||
m_cpu_time += amount;
|
||||
/* TODO: Debug kernels track per-core tick counts. Should we? */
|
||||
MESOSPHERE_UNUSED(core_id);
|
||||
}
|
||||
|
||||
s64 GetCpuTime() const { return this->cpu_time; }
|
||||
s64 GetCpuTime() const { return m_cpu_time; }
|
||||
|
||||
s64 GetCpuTime(s32 core_id) const {
|
||||
MESOSPHERE_ABORT_UNLESS(0 <= core_id && core_id < static_cast<s32>(cpu::NumCores));
|
||||
|
@ -495,10 +495,10 @@ namespace ams::kern {
|
|||
return 0;
|
||||
}
|
||||
|
||||
constexpr u32 GetSuspendFlags() const { return this->suspend_allowed_flags & this->suspend_request_flags; }
|
||||
constexpr u32 GetSuspendFlags() const { return m_suspend_allowed_flags & m_suspend_request_flags; }
|
||||
constexpr bool IsSuspended() const { return this->GetSuspendFlags() != 0; }
|
||||
constexpr bool IsSuspendRequested(SuspendType type) const { return (this->suspend_request_flags & (1u << (ThreadState_SuspendShift + type))) != 0; }
|
||||
constexpr bool IsSuspendRequested() const { return this->suspend_request_flags != 0; }
|
||||
constexpr bool IsSuspendRequested(SuspendType type) const { return (m_suspend_request_flags & (1u << (ThreadState_SuspendShift + type))) != 0; }
|
||||
constexpr bool IsSuspendRequested() const { return m_suspend_request_flags != 0; }
|
||||
void RequestSuspend(SuspendType type);
|
||||
void Resume(SuspendType type);
|
||||
void TrySuspend();
|
||||
|
@ -526,11 +526,11 @@ namespace ams::kern {
|
|||
|
||||
Result Sleep(s64 timeout);
|
||||
|
||||
ALWAYS_INLINE void *GetStackTop() const { return reinterpret_cast<StackParameters *>(this->kernel_stack_top) - 1; }
|
||||
ALWAYS_INLINE void *GetKernelStackTop() const { return this->kernel_stack_top; }
|
||||
ALWAYS_INLINE void *GetStackTop() const { return reinterpret_cast<StackParameters *>(m_kernel_stack_top) - 1; }
|
||||
ALWAYS_INLINE void *GetKernelStackTop() const { return m_kernel_stack_top; }
|
||||
|
||||
ALWAYS_INLINE bool IsTerminationRequested() const {
|
||||
return this->termination_requested || this->GetRawState() == ThreadState_Terminated;
|
||||
return m_termination_requested || this->GetRawState() == ThreadState_Terminated;
|
||||
}
|
||||
|
||||
size_t GetKernelStackUsage() const;
|
||||
|
@ -538,8 +538,8 @@ namespace ams::kern {
|
|||
/* Overridden parent functions. */
|
||||
virtual u64 GetId() const override final { return this->GetThreadId(); }
|
||||
|
||||
virtual bool IsInitialized() const override { return this->initialized; }
|
||||
virtual uintptr_t GetPostDestroyArgument() const override { return reinterpret_cast<uintptr_t>(this->parent) | (this->resource_limit_release_hint ? 1 : 0); }
|
||||
virtual bool IsInitialized() const override { return m_initialized; }
|
||||
virtual uintptr_t GetPostDestroyArgument() const override { return reinterpret_cast<uintptr_t>(m_parent) | (m_resource_limit_release_hint ? 1 : 0); }
|
||||
|
||||
static void PostDestroy(uintptr_t arg);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue