summaryrefslogtreecommitdiffstats
path: root/src/core/hle/kernel/svc/svc_lock.cpp
diff options
context:
space:
mode:
authorLiam <byteslice@airmail.cc>2023-03-07 06:13:05 +0100
committerLiam <byteslice@airmail.cc>2023-03-13 03:09:08 +0100
commit91fd4e30f2a12868201b08e73de299db1c3d116a (patch)
treeac85044f0554995ef6af3a3d9a4508286c2b95b3 /src/core/hle/kernel/svc/svc_lock.cpp
parentkernel: convert miscellaneous (diff)
downloadyuzu-91fd4e30f2a12868201b08e73de299db1c3d116a.tar
yuzu-91fd4e30f2a12868201b08e73de299db1c3d116a.tar.gz
yuzu-91fd4e30f2a12868201b08e73de299db1c3d116a.tar.bz2
yuzu-91fd4e30f2a12868201b08e73de299db1c3d116a.tar.lz
yuzu-91fd4e30f2a12868201b08e73de299db1c3d116a.tar.xz
yuzu-91fd4e30f2a12868201b08e73de299db1c3d116a.tar.zst
yuzu-91fd4e30f2a12868201b08e73de299db1c3d116a.zip
Diffstat (limited to 'src/core/hle/kernel/svc/svc_lock.cpp')
-rw-r--r--src/core/hle/kernel/svc/svc_lock.cpp27
1 files changed, 6 insertions, 21 deletions
diff --git a/src/core/hle/kernel/svc/svc_lock.cpp b/src/core/hle/kernel/svc/svc_lock.cpp
index f3d3e140b..3681279d6 100644
--- a/src/core/hle/kernel/svc/svc_lock.cpp
+++ b/src/core/hle/kernel/svc/svc_lock.cpp
@@ -14,17 +14,10 @@ Result ArbitrateLock(Core::System& system, Handle thread_handle, VAddr address,
thread_handle, address, tag);
// Validate the input address.
- if (IsKernelAddress(address)) {
- LOG_ERROR(Kernel_SVC, "Attempting to arbitrate a lock on a kernel address (address={:08X})",
- address);
- return ResultInvalidCurrentMemory;
- }
- if (!Common::IsAligned(address, sizeof(u32))) {
- LOG_ERROR(Kernel_SVC, "Input address must be 4 byte aligned (address: {:08X})", address);
- return ResultInvalidAddress;
- }
+ R_UNLESS(!IsKernelAddress(address), ResultInvalidCurrentMemory);
+ R_UNLESS(Common::IsAligned(address, sizeof(u32)), ResultInvalidAddress);
- return GetCurrentProcess(system.Kernel()).WaitForAddress(thread_handle, address, tag);
+ R_RETURN(GetCurrentProcess(system.Kernel()).WaitForAddress(thread_handle, address, tag));
}
/// Unlock a mutex
@@ -32,18 +25,10 @@ Result ArbitrateUnlock(Core::System& system, VAddr address) {
LOG_TRACE(Kernel_SVC, "called address=0x{:X}", address);
// Validate the input address.
- if (IsKernelAddress(address)) {
- LOG_ERROR(Kernel_SVC,
- "Attempting to arbitrate an unlock on a kernel address (address={:08X})",
- address);
- return ResultInvalidCurrentMemory;
- }
- if (!Common::IsAligned(address, sizeof(u32))) {
- LOG_ERROR(Kernel_SVC, "Input address must be 4 byte aligned (address: {:08X})", address);
- return ResultInvalidAddress;
- }
+ R_UNLESS(!IsKernelAddress(address), ResultInvalidCurrentMemory);
+ R_UNLESS(Common::IsAligned(address, sizeof(u32)), ResultInvalidAddress);
- return GetCurrentProcess(system.Kernel()).SignalToAddress(address);
+ R_RETURN(GetCurrentProcess(system.Kernel()).SignalToAddress(address));
}
Result ArbitrateLock64(Core::System& system, Handle thread_handle, uint64_t address, uint32_t tag) {