diff options
author | Subv <subv2112@gmail.com> | 2015-01-13 20:49:26 +0100 |
---|---|---|
committer | Subv <subv2112@gmail.com> | 2015-01-13 20:49:26 +0100 |
commit | 9e2ae289b8b269bfe2835356780c160dbccc18f4 (patch) | |
tree | b59563e79befce9d6f366a114ebdbdda2bc166b8 /src/core/hle/kernel | |
parent | Merge pull request #477 from lioncash/vfp (diff) | |
download | yuzu-9e2ae289b8b269bfe2835356780c160dbccc18f4.tar yuzu-9e2ae289b8b269bfe2835356780c160dbccc18f4.tar.gz yuzu-9e2ae289b8b269bfe2835356780c160dbccc18f4.tar.bz2 yuzu-9e2ae289b8b269bfe2835356780c160dbccc18f4.tar.lz yuzu-9e2ae289b8b269bfe2835356780c160dbccc18f4.tar.xz yuzu-9e2ae289b8b269bfe2835356780c160dbccc18f4.tar.zst yuzu-9e2ae289b8b269bfe2835356780c160dbccc18f4.zip |
Diffstat (limited to 'src/core/hle/kernel')
-rw-r--r-- | src/core/hle/kernel/address_arbiter.cpp | 21 | ||||
-rw-r--r-- | src/core/hle/kernel/address_arbiter.h | 2 |
2 files changed, 20 insertions, 3 deletions
diff --git a/src/core/hle/kernel/address_arbiter.cpp b/src/core/hle/kernel/address_arbiter.cpp index 62e3460e1..b7434aaf2 100644 --- a/src/core/hle/kernel/address_arbiter.cpp +++ b/src/core/hle/kernel/address_arbiter.cpp @@ -29,7 +29,7 @@ public: //////////////////////////////////////////////////////////////////////////////////////////////////// /// Arbitrate an address -ResultCode ArbitrateAddress(Handle handle, ArbitrationType type, u32 address, s32 value) { +ResultCode ArbitrateAddress(Handle handle, ArbitrationType type, u32 address, s32 value, u64 nanoseconds) { Object* object = Kernel::g_handle_table.GetGeneric(handle).get(); if (object == nullptr) return InvalidHandle(ErrorModule::Kernel); @@ -55,7 +55,13 @@ ResultCode ArbitrateAddress(Handle handle, ArbitrationType type, u32 address, s3 HLE::Reschedule(__func__); } break; - + case ArbitrationType::WaitIfLessThanWithTimeout: + if ((s32)Memory::Read32(address) <= value) { + Kernel::WaitCurrentThread(WAITTYPE_ARB, object, address); + Kernel::WakeThreadAfterDelay(GetCurrentThread(), nanoseconds); + HLE::Reschedule(__func__); + } + break; case ArbitrationType::DecrementAndWaitIfLessThan: { s32 memory_value = Memory::Read32(address) - 1; @@ -66,6 +72,17 @@ ResultCode ArbitrateAddress(Handle handle, ArbitrationType type, u32 address, s3 } break; } + case ArbitrationType::DecrementAndWaitIfLessThanWithTimeout: + { + s32 memory_value = Memory::Read32(address) - 1; + Memory::Write32(address, memory_value); + if (memory_value <= value) { + Kernel::WaitCurrentThread(WAITTYPE_ARB, object, address); + Kernel::WakeThreadAfterDelay(GetCurrentThread(), nanoseconds); + HLE::Reschedule(__func__); + } + break; + } default: LOG_ERROR(Kernel, "unknown type=%d", type); diff --git a/src/core/hle/kernel/address_arbiter.h b/src/core/hle/kernel/address_arbiter.h index 030e7ad7b..3ffd465a2 100644 --- a/src/core/hle/kernel/address_arbiter.h +++ b/src/core/hle/kernel/address_arbiter.h @@ -28,7 +28,7 @@ enum class ArbitrationType : u32 { }; /// Arbitrate an address -ResultCode ArbitrateAddress(Handle handle, ArbitrationType type, u32 address, s32 value); +ResultCode ArbitrateAddress(Handle handle, ArbitrationType type, u32 address, s32 value, u64 nanoseconds); /// Create an address arbiter Handle CreateAddressArbiter(const std::string& name = "Unknown"); |