From 7d239df065dc344c29d8c277835db9fef81e37d9 Mon Sep 17 00:00:00 2001 From: lizzie Date: Sun, 16 Nov 2025 22:15:09 +0100 Subject: [hle, kernel] Add support for FW21 and kernel changes (#3004) - Adapts kernel changes from atmosphere for firmware 21.0.0. - Fixes launch error of firmware 21.0.0 applets. - Adds new commands for `prepo` (New `SaveSystemReport` & `SaveSystemReportWithUser`). - Adds new commands for `IReadOnlyApplicationControlDataInterface` (cmd 19; incomplete!) - Adds `{12010, nullptr, "SetButtonConfigLeft"},` undocumented IHidServer. - Adds new commands for `ngc:u` (`Mask2` and `Check2`) - Adds new commands for system settings server (GetHttpAuthConfig) for webapplet - Removes incompatible firmware popup warning. Signed-off-by: lizzie lizzie@eden-emu.dev Co-authored by: maufeat sahyno1996@gmail.com Co-authored-by: crueter Co-authored-by: JPikachu Co-authored-by: Maufeat Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/3004 Reviewed-by: Maufeat Reviewed-by: crueter Reviewed-by: MaranBr Co-authored-by: lizzie Co-committed-by: lizzie --- src/core/hle/kernel/k_condition_variable.cpp | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) (limited to 'src/core/hle/kernel/k_condition_variable.cpp') diff --git a/src/core/hle/kernel/k_condition_variable.cpp b/src/core/hle/kernel/k_condition_variable.cpp index 94ea3527ab..1a7431df07 100644 --- a/src/core/hle/kernel/k_condition_variable.cpp +++ b/src/core/hle/kernel/k_condition_variable.cpp @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2021 yuzu Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later @@ -23,8 +26,8 @@ bool ReadFromUser(KernelCore& kernel, u32* out, KProcessAddress address) { return true; } -bool WriteToUser(KernelCore& kernel, KProcessAddress address, const u32* p) { - GetCurrentMemory(kernel).Write32(GetInteger(address), *p); +bool WriteToUser(KernelCore& kernel, KProcessAddress address, u32 val) { + GetCurrentMemory(kernel).Write32(GetInteger(address), val); return true; } @@ -133,7 +136,7 @@ Result KConditionVariable::SignalToAddress(KernelCore& kernel, KProcessAddress a // Write the value to userspace. Result result{ResultSuccess}; - if (WriteToUser(kernel, addr, std::addressof(next_value))) [[likely]] { + if (WriteToUser(kernel, addr, next_value)) { result = ResultSuccess; } else { result = ResultInvalidCurrentMemory; @@ -207,13 +210,13 @@ void KConditionVariable::SignalImpl(KThread* thread) { // TODO(bunnei): We should call CanAccessAtomic(..) here. can_access = true; - if (can_access) [[likely]] { + if (can_access) { UpdateLockAtomic(m_kernel, std::addressof(prev_tag), address, own_tag, Svc::HandleWaitMask); } } - if (can_access) [[likely]] { + if (can_access) { if (prev_tag == Svc::InvalidHandle) { // If nobody held the lock previously, we're all good. thread->EndWait(ResultSuccess); @@ -225,7 +228,7 @@ void KConditionVariable::SignalImpl(KThread* thread) { static_cast(prev_tag & ~Svc::HandleWaitMask)) .ReleasePointerUnsafe(); - if (owner_thread) [[likely]] { + if (owner_thread) { // Add the thread as a waiter on the owner. owner_thread->AddWaiter(thread); owner_thread->Close(); @@ -261,8 +264,8 @@ void KConditionVariable::Signal(u64 cv_key, s32 count) { // If we have no waiters, clear the has waiter flag. if (it == m_tree.end() || it->GetConditionVariableKey() != cv_key) { - const u32 has_waiter_flag{}; - WriteToUser(m_kernel, cv_key, std::addressof(has_waiter_flag)); + constexpr u32 HasNoWaiterFlag = 0; + WriteToUser(m_kernel, cv_key, HasNoWaiterFlag); } } } @@ -305,13 +308,13 @@ Result KConditionVariable::Wait(KProcessAddress addr, u64 key, u32 value, s64 ti // Write to the cv key. { - const u32 has_waiter_flag = 1; - WriteToUser(m_kernel, key, std::addressof(has_waiter_flag)); + constexpr u32 HasWaiterFlag = 1; + WriteToUser(m_kernel, key, HasWaiterFlag); std::atomic_thread_fence(std::memory_order_seq_cst); } // Write the value to userspace. - if (!WriteToUser(m_kernel, addr, std::addressof(next_value))) { + if (!WriteToUser(m_kernel, addr, next_value)) { slp.CancelSleep(); R_THROW(ResultInvalidCurrentMemory); } -- cgit v1.2.3