2
1
Fork 0
mirror of https://github.com/yuzu-emu/yuzu.git synced 2024-07-04 23:31:19 +01:00

kernel: additional style fixes to KThread, KProcess

This commit is contained in:
Liam 2023-03-11 10:38:33 -05:00
parent 9775a73d1a
commit c352381ce9
2 changed files with 27 additions and 27 deletions

View file

@ -137,16 +137,16 @@ u64 KProcess::GetTotalPhysicalMemoryAvailable() {
}
u64 KProcess::GetTotalPhysicalMemoryAvailableWithoutSystemResource() {
return GetTotalPhysicalMemoryAvailable() - GetSystemResourceSize();
return this->GetTotalPhysicalMemoryAvailable() - this->GetSystemResourceSize();
}
u64 KProcess::GetTotalPhysicalMemoryUsed() {
return m_image_size + m_main_thread_stack_size + m_page_table.GetNormalMemorySize() +
GetSystemResourceSize();
this->GetSystemResourceSize();
}
u64 KProcess::GetTotalPhysicalMemoryUsedWithoutSystemResource() {
return GetTotalPhysicalMemoryUsed() - GetSystemResourceUsage();
return this->GetTotalPhysicalMemoryUsed() - this->GetSystemResourceUsage();
}
bool KProcess::ReleaseUserException(KThread* thread) {
@ -182,7 +182,7 @@ void KProcess::PinCurrentThread(s32 core_id) {
// If the thread isn't terminated, pin it.
if (!cur_thread->IsTerminationRequested()) {
// Pin it.
PinThread(core_id, cur_thread);
this->PinThread(core_id, cur_thread);
cur_thread->Pin(core_id);
// An update is needed.
@ -199,7 +199,7 @@ void KProcess::UnpinCurrentThread(s32 core_id) {
// Unpin it.
cur_thread->Unpin();
UnpinThread(core_id, cur_thread);
this->UnpinThread(core_id, cur_thread);
// An update is needed.
KScheduler::SetSchedulerUpdateNeeded(m_kernel);
@ -212,7 +212,7 @@ void KProcess::UnpinThread(KThread* thread) {
const auto core_id = thread->GetActiveCore();
// Unpin it.
UnpinThread(core_id, thread);
this->UnpinThread(core_id, thread);
thread->Unpin();
// An update is needed.
@ -330,7 +330,7 @@ Result KProcess::SetActivity(ProcessActivity activity) {
}
// Set ourselves as suspended.
SetSuspended(true);
this->SetSuspended(true);
} else {
ASSERT(activity == ProcessActivity::Runnable);
@ -343,7 +343,7 @@ Result KProcess::SetActivity(ProcessActivity activity) {
}
// Set ourselves as resumed.
SetSuspended(false);
this->SetSuspended(false);
}
R_SUCCEED();
@ -457,7 +457,7 @@ void KProcess::PrepareForTermination() {
m_main_thread_stack_size + m_image_size);
}
ChangeState(State::Terminated);
this->ChangeState(State::Terminated);
}
void KProcess::Finalize() {
@ -489,7 +489,7 @@ void KProcess::Finalize() {
m_page_table.Finalize();
// Perform inherited finalization.
KAutoObjectWithSlabHeapAndContainer<KProcess, KWorkerTask>::Finalize();
KSynchronizationObject::Finalize();
}
Result KProcess::CreateThreadLocalRegion(VAddr* out) {

View file

@ -206,7 +206,7 @@ Result KThread::Initialize(KThreadFunction func, uintptr_t arg, VAddr user_stack
m_argument = arg;
// Clear our stack parameters.
std::memset(static_cast<void*>(std::addressof(GetStackParameters())), 0,
std::memset(static_cast<void*>(std::addressof(this->GetStackParameters())), 0,
sizeof(StackParameters));
// Set parent, if relevant.
@ -774,13 +774,13 @@ void KThread::WaitCancel() {
void KThread::TrySuspend() {
ASSERT(KScheduler::IsSchedulerLockedByCurrentThread(m_kernel));
ASSERT(IsSuspendRequested());
ASSERT(this->IsSuspendRequested());
// Ensure that we have no waiters.
if (GetNumKernelWaiters() > 0) {
if (this->GetNumKernelWaiters() > 0) {
return;
}
ASSERT(GetNumKernelWaiters() == 0);
ASSERT(this->GetNumKernelWaiters() == 0);
// Perform the suspend.
this->UpdateState();
@ -916,7 +916,7 @@ Result KThread::GetThreadContext3(std::vector<u8>& out) {
KScopedSchedulerLock sl{m_kernel};
// Verify that we're suspended.
R_UNLESS(IsSuspendRequested(SuspendType::Thread), ResultInvalidState);
R_UNLESS(this->IsSuspendRequested(SuspendType::Thread), ResultInvalidState);
// If we're not terminating, get the thread's user context.
if (!this->IsTerminationRequested()) {
@ -951,14 +951,14 @@ void KThread::AddHeldLock(LockWithPriorityInheritanceInfo* lock_info) {
m_held_lock_info_list.push_front(*lock_info);
}
KThread::LockWithPriorityInheritanceInfo* KThread::FindHeldLock(VAddr address_key_,
bool is_kernel_address_key_) {
KThread::LockWithPriorityInheritanceInfo* KThread::FindHeldLock(VAddr address_key,
bool is_kernel_address_key) {
ASSERT(KScheduler::IsSchedulerLockedByCurrentThread(m_kernel));
// Try to find an existing held lock.
for (auto& held_lock : m_held_lock_info_list) {
if (held_lock.GetAddressKey() == address_key_ &&
held_lock.GetIsKernelAddressKey() == is_kernel_address_key_) {
if (held_lock.GetAddressKey() == address_key &&
held_lock.GetIsKernelAddressKey() == is_kernel_address_key) {
return std::addressof(held_lock);
}
}
@ -1166,7 +1166,7 @@ Result KThread::Run() {
// If we're not a kernel thread and we've been asked to suspend, suspend ourselves.
if (KProcess* owner = this->GetOwnerProcess(); owner != nullptr) {
if (IsUserThread() && IsSuspended()) {
if (this->IsUserThread() && this->IsSuspended()) {
this->UpdateState();
}
owner->IncrementRunningThreadCount();
@ -1201,7 +1201,7 @@ void KThread::Exit() {
m_suspend_allowed_flags = 0;
// Start termination.
StartTermination();
this->StartTermination();
// Register the thread as a work task.
KWorkerTaskManager::AddTask(m_kernel, KWorkerTaskManager::WorkerType::Exit, this);
@ -1285,7 +1285,7 @@ Result KThread::Sleep(s64 timeout) {
ASSERT(this == GetCurrentThreadPointer(m_kernel));
ASSERT(timeout > 0);
ThreadQueueImplForKThreadSleep wait_queue_(m_kernel);
ThreadQueueImplForKThreadSleep wait_queue(m_kernel);
KHardwareTimer* timer{};
{
// Setup the scheduling lock and sleep.
@ -1298,9 +1298,9 @@ Result KThread::Sleep(s64 timeout) {
}
// Wait for the sleep to end.
wait_queue_.SetHardwareTimer(timer);
this->BeginWait(std::addressof(wait_queue_));
SetWaitReasonForDebugging(ThreadWaitReasonForDebugging::Sleep);
wait_queue.SetHardwareTimer(timer);
this->BeginWait(std::addressof(wait_queue));
this->SetWaitReasonForDebugging(ThreadWaitReasonForDebugging::Sleep);
}
R_SUCCEED();
@ -1335,7 +1335,7 @@ void KThread::DummyThreadEndWait() {
void KThread::BeginWait(KThreadQueue* queue) {
// Set our state as waiting.
SetState(ThreadState::Waiting);
this->SetState(ThreadState::Waiting);
// Set our wait queue.
m_wait_queue = queue;
@ -1381,7 +1381,7 @@ void KThread::SetState(ThreadState state) {
KScopedSchedulerLock sl{m_kernel};
// Clear debugging state
SetWaitReasonForDebugging({});
this->SetWaitReasonForDebugging({});
const ThreadState old_state = m_thread_state.load(std::memory_order_relaxed);
m_thread_state.store(