summaryrefslogtreecommitdiff
path: root/src/core/hle/svc.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/hle/svc.cpp')
-rw-r--r--src/core/hle/svc.cpp30
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,
247 247
248/// Create an address arbiter (to allocate access to shared resources) 248/// Create an address arbiter (to allocate access to shared resources)
249static Result CreateAddressArbiter(u32* arbiter) { 249static Result CreateAddressArbiter(u32* arbiter) {
250 Handle handle = Kernel::CreateAddressArbiter(); 250 using Kernel::AddressArbiter;
251 *arbiter = handle; 251
252 return 0; 252 ResultVal<SharedPtr<AddressArbiter>> arbiter_res = AddressArbiter::Create();
253 if (arbiter_res.Failed())
254 return arbiter_res.Code().raw;
255
256 ResultVal<Handle> handle_res = Kernel::g_handle_table.Create(*arbiter_res);
257 if (handle_res.Failed())
258 return handle_res.Code().raw;
259
260 LOG_TRACE(Kernel_SVC, "returned handle=0x%08X", *handle_res);
261
262 *arbiter = *handle_res;
263 return RESULT_SUCCESS.raw;
253} 264}
254 265
255/// Arbitrate address 266/// Arbitrate address
256static Result ArbitrateAddress(Handle arbiter, u32 address, u32 type, u32 value, s64 nanoseconds) { 267static Result ArbitrateAddress(Handle handle, u32 address, u32 type, u32 value, s64 nanoseconds) {
257 LOG_TRACE(Kernel_SVC, "called handle=0x%08X, address=0x%08X, type=0x%08X, value=0x%08X", arbiter, 268 using Kernel::AddressArbiter;
269
270 LOG_TRACE(Kernel_SVC, "called handle=0x%08X, address=0x%08X, type=0x%08X, value=0x%08X", handle,
258 address, type, value); 271 address, type, value);
259 return Kernel::ArbitrateAddress(arbiter, static_cast<Kernel::ArbitrationType>(type), 272
273 SharedPtr<AddressArbiter> arbiter = Kernel::g_handle_table.Get<AddressArbiter>(handle);
274 if (arbiter == nullptr)
275 return InvalidHandle(ErrorModule::Kernel).raw;
276
277 return arbiter->ArbitrateAddress(static_cast<Kernel::ArbitrationType>(type),
260 address, value, nanoseconds).raw; 278 address, value, nanoseconds).raw;
261} 279}
262 280