diff options
author | Yuri Kunde Schlesner <yuriks@yuriks.net> | 2014-12-22 14:07:22 +0100 |
---|---|---|
committer | Yuri Kunde Schlesner <yuriks@yuriks.net> | 2015-01-09 07:02:15 +0100 |
commit | 9bf8462b96d34b30f62b8aca745dd558e7f0a450 (patch) | |
tree | 32606d5176a82daa4e59bb47bede34d4a941780a /src/core/hle/kernel/address_arbiter.cpp | |
parent | Kernel: Move Thread's definition to the header file (diff) | |
download | yuzu-9bf8462b96d34b30f62b8aca745dd558e7f0a450.tar yuzu-9bf8462b96d34b30f62b8aca745dd558e7f0a450.tar.gz yuzu-9bf8462b96d34b30f62b8aca745dd558e7f0a450.tar.bz2 yuzu-9bf8462b96d34b30f62b8aca745dd558e7f0a450.tar.lz yuzu-9bf8462b96d34b30f62b8aca745dd558e7f0a450.tar.xz yuzu-9bf8462b96d34b30f62b8aca745dd558e7f0a450.tar.zst yuzu-9bf8462b96d34b30f62b8aca745dd558e7f0a450.zip |
Diffstat (limited to '')
-rw-r--r-- | src/core/hle/kernel/address_arbiter.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/core/hle/kernel/address_arbiter.cpp b/src/core/hle/kernel/address_arbiter.cpp index 736bbc36a..28adc5500 100644 --- a/src/core/hle/kernel/address_arbiter.cpp +++ b/src/core/hle/kernel/address_arbiter.cpp @@ -30,24 +30,28 @@ public: /// Arbitrate an address ResultCode ArbitrateAddress(Handle handle, ArbitrationType type, u32 address, s32 value) { + Object* object = Kernel::g_handle_table.GetGeneric(handle); + if (object == nullptr) + return InvalidHandle(ErrorModule::Kernel); + switch (type) { // Signal thread(s) waiting for arbitrate address... case ArbitrationType::Signal: // Negative value means resume all threads if (value < 0) { - ArbitrateAllThreads(handle, address); + ArbitrateAllThreads(object, address); } else { // Resume first N threads for(int i = 0; i < value; i++) - ArbitrateHighestPriorityThread(handle, address); + ArbitrateHighestPriorityThread(object, address); } break; // Wait current thread (acquire the arbiter)... case ArbitrationType::WaitIfLessThan: if ((s32)Memory::Read32(address) <= value) { - Kernel::WaitCurrentThread(WAITTYPE_ARB, handle, address); + Kernel::WaitCurrentThread(WAITTYPE_ARB, object, address); HLE::Reschedule(__func__); } break; @@ -57,7 +61,7 @@ ResultCode ArbitrateAddress(Handle handle, ArbitrationType type, u32 address, s3 s32 memory_value = Memory::Read32(address) - 1; Memory::Write32(address, memory_value); if (memory_value <= value) { - Kernel::WaitCurrentThread(WAITTYPE_ARB, handle, address); + Kernel::WaitCurrentThread(WAITTYPE_ARB, object, address); HLE::Reschedule(__func__); } break; |