diff options
author | Liam <byteslice@airmail.cc> | 2023-03-07 06:13:05 +0100 |
---|---|---|
committer | Liam <byteslice@airmail.cc> | 2023-03-13 03:09:08 +0100 |
commit | 91fd4e30f2a12868201b08e73de299db1c3d116a (patch) | |
tree | ac85044f0554995ef6af3a3d9a4508286c2b95b3 /src/core/hle/kernel/svc/svc_address_arbiter.cpp | |
parent | kernel: convert miscellaneous (diff) | |
download | yuzu-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 '')
-rw-r--r-- | src/core/hle/kernel/svc/svc_address_arbiter.cpp | 45 |
1 files changed, 14 insertions, 31 deletions
diff --git a/src/core/hle/kernel/svc/svc_address_arbiter.cpp b/src/core/hle/kernel/svc/svc_address_arbiter.cpp index 998bd3f22..22071731b 100644 --- a/src/core/hle/kernel/svc/svc_address_arbiter.cpp +++ b/src/core/hle/kernel/svc/svc_address_arbiter.cpp @@ -43,18 +43,9 @@ Result WaitForAddress(Core::System& system, VAddr address, ArbitrationType arb_t address, arb_type, value, timeout_ns); // Validate input. - if (IsKernelAddress(address)) { - LOG_ERROR(Kernel_SVC, "Attempting to wait on kernel address (address={:08X})", address); - return ResultInvalidCurrentMemory; - } - if (!Common::IsAligned(address, sizeof(s32))) { - LOG_ERROR(Kernel_SVC, "Wait address must be 4 byte aligned (address={:08X})", address); - return ResultInvalidAddress; - } - if (!IsValidArbitrationType(arb_type)) { - LOG_ERROR(Kernel_SVC, "Invalid arbitration type specified (type={})", arb_type); - return ResultInvalidEnumValue; - } + R_UNLESS(!IsKernelAddress(address), ResultInvalidCurrentMemory); + R_UNLESS(Common::IsAligned(address, sizeof(s32)), ResultInvalidAddress); + R_UNLESS(IsValidArbitrationType(arb_type), ResultInvalidEnumValue); // Convert timeout from nanoseconds to ticks. s64 timeout{}; @@ -72,7 +63,8 @@ Result WaitForAddress(Core::System& system, VAddr address, ArbitrationType arb_t timeout = timeout_ns; } - return GetCurrentProcess(system.Kernel()).WaitAddressArbiter(address, arb_type, value, timeout); + R_RETURN( + GetCurrentProcess(system.Kernel()).WaitAddressArbiter(address, arb_type, value, timeout)); } // Signals to an address (via Address Arbiter) @@ -82,41 +74,32 @@ Result SignalToAddress(Core::System& system, VAddr address, SignalType signal_ty address, signal_type, value, count); // Validate input. - if (IsKernelAddress(address)) { - LOG_ERROR(Kernel_SVC, "Attempting to signal to a kernel address (address={:08X})", address); - return ResultInvalidCurrentMemory; - } - if (!Common::IsAligned(address, sizeof(s32))) { - LOG_ERROR(Kernel_SVC, "Signaled address must be 4 byte aligned (address={:08X})", address); - return ResultInvalidAddress; - } - if (!IsValidSignalType(signal_type)) { - LOG_ERROR(Kernel_SVC, "Invalid signal type specified (type={})", signal_type); - return ResultInvalidEnumValue; - } + R_UNLESS(!IsKernelAddress(address), ResultInvalidCurrentMemory); + R_UNLESS(Common::IsAligned(address, sizeof(s32)), ResultInvalidAddress); + R_UNLESS(IsValidSignalType(signal_type), ResultInvalidEnumValue); - return GetCurrentProcess(system.Kernel()) - .SignalAddressArbiter(address, signal_type, value, count); + R_RETURN(GetCurrentProcess(system.Kernel()) + .SignalAddressArbiter(address, signal_type, value, count)); } Result WaitForAddress64(Core::System& system, VAddr address, ArbitrationType arb_type, s32 value, s64 timeout_ns) { - return WaitForAddress(system, address, arb_type, value, timeout_ns); + R_RETURN(WaitForAddress(system, address, arb_type, value, timeout_ns)); } Result SignalToAddress64(Core::System& system, VAddr address, SignalType signal_type, s32 value, s32 count) { - return SignalToAddress(system, address, signal_type, value, count); + R_RETURN(SignalToAddress(system, address, signal_type, value, count)); } Result WaitForAddress64From32(Core::System& system, u32 address, ArbitrationType arb_type, s32 value, s64 timeout_ns) { - return WaitForAddress(system, address, arb_type, value, timeout_ns); + R_RETURN(WaitForAddress(system, address, arb_type, value, timeout_ns)); } Result SignalToAddress64From32(Core::System& system, u32 address, SignalType signal_type, s32 value, s32 count) { - return SignalToAddress(system, address, signal_type, value, count); + R_RETURN(SignalToAddress(system, address, signal_type, value, count)); } } // namespace Kernel::Svc |