diff options
author | Yuri Kunde Schlesner <yuriks@yuriks.net> | 2015-01-11 17:46:49 +0100 |
---|---|---|
committer | Yuri Kunde Schlesner <yuriks@yuriks.net> | 2015-01-30 14:47:06 +0100 |
commit | 38e7122f23424d40e0555fa40daeff55e23e4da4 (patch) | |
tree | 37c52c6f20c49fc1093f9228b5c78406b5cdc6ff /src/core/hle/svc.cpp | |
parent | Kernel: Convert Semaphore to not use Handles (diff) | |
download | yuzu-38e7122f23424d40e0555fa40daeff55e23e4da4.tar yuzu-38e7122f23424d40e0555fa40daeff55e23e4da4.tar.gz yuzu-38e7122f23424d40e0555fa40daeff55e23e4da4.tar.bz2 yuzu-38e7122f23424d40e0555fa40daeff55e23e4da4.tar.lz yuzu-38e7122f23424d40e0555fa40daeff55e23e4da4.tar.xz yuzu-38e7122f23424d40e0555fa40daeff55e23e4da4.tar.zst yuzu-38e7122f23424d40e0555fa40daeff55e23e4da4.zip |
Diffstat (limited to '')
-rw-r--r-- | src/core/hle/svc.cpp | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/src/core/hle/svc.cpp b/src/core/hle/svc.cpp index 6cbe38bc3..b093d0368 100644 --- a/src/core/hle/svc.cpp +++ b/src/core/hle/svc.cpp @@ -247,16 +247,34 @@ static Result WaitSynchronizationN(s32* out, Handle* handles, s32 handle_count, /// Create an address arbiter (to allocate access to shared resources) static Result CreateAddressArbiter(u32* arbiter) { - Handle handle = Kernel::CreateAddressArbiter(); - *arbiter = handle; - return 0; + using Kernel::AddressArbiter; + + ResultVal<SharedPtr<AddressArbiter>> arbiter_res = AddressArbiter::Create(); + if (arbiter_res.Failed()) + return arbiter_res.Code().raw; + + ResultVal<Handle> handle_res = Kernel::g_handle_table.Create(*arbiter_res); + if (handle_res.Failed()) + return handle_res.Code().raw; + + LOG_TRACE(Kernel_SVC, "returned handle=0x%08X", *handle_res); + + *arbiter = *handle_res; + return RESULT_SUCCESS.raw; } /// Arbitrate address -static Result ArbitrateAddress(Handle arbiter, u32 address, u32 type, u32 value, s64 nanoseconds) { - LOG_TRACE(Kernel_SVC, "called handle=0x%08X, address=0x%08X, type=0x%08X, value=0x%08X", arbiter, +static Result ArbitrateAddress(Handle handle, u32 address, u32 type, u32 value, s64 nanoseconds) { + using Kernel::AddressArbiter; + + LOG_TRACE(Kernel_SVC, "called handle=0x%08X, address=0x%08X, type=0x%08X, value=0x%08X", handle, address, type, value); - return Kernel::ArbitrateAddress(arbiter, static_cast<Kernel::ArbitrationType>(type), + + SharedPtr<AddressArbiter> arbiter = Kernel::g_handle_table.Get<AddressArbiter>(handle); + if (arbiter == nullptr) + return InvalidHandle(ErrorModule::Kernel).raw; + + return arbiter->ArbitrateAddress(static_cast<Kernel::ArbitrationType>(type), address, value, nanoseconds).raw; } |