diff options
author | bunnei <bunneidev@gmail.com> | 2015-01-09 18:59:35 +0100 |
---|---|---|
committer | bunnei <bunneidev@gmail.com> | 2015-01-09 18:59:35 +0100 |
commit | 6ae12424df58f0ea171fc75ca4b700ab1fffc192 (patch) | |
tree | 93d87f3cb19d08541c6b8f8a9e0ceb730a2b13d9 /src/core/hle/kernel/address_arbiter.cpp | |
parent | Merge pull request #436 from kevinhartman/system-core (diff) | |
parent | Thread: Fix nullptr access in a logging function (diff) | |
download | yuzu-6ae12424df58f0ea171fc75ca4b700ab1fffc192.tar yuzu-6ae12424df58f0ea171fc75ca4b700ab1fffc192.tar.gz yuzu-6ae12424df58f0ea171fc75ca4b700ab1fffc192.tar.bz2 yuzu-6ae12424df58f0ea171fc75ca4b700ab1fffc192.tar.lz yuzu-6ae12424df58f0ea171fc75ca4b700ab1fffc192.tar.xz yuzu-6ae12424df58f0ea171fc75ca4b700ab1fffc192.tar.zst yuzu-6ae12424df58f0ea171fc75ca4b700ab1fffc192.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; |