summaryrefslogtreecommitdiff
path: root/src/core/hle/kernel/svc.cpp
diff options
context:
space:
mode:
authorGravatar bunnei2019-03-12 17:54:48 -0400
committerGravatar GitHub2019-03-12 17:54:48 -0400
commit3bfd199497bd016e79ba27f338c0dd77923080d1 (patch)
treea34b9dd33b3250026d9164037d2266593b5af568 /src/core/hle/kernel/svc.cpp
parentMerge pull request #2222 from lioncash/cstr (diff)
parentkernel: Make the address arbiter instance per-process (diff)
downloadyuzu-3bfd199497bd016e79ba27f338c0dd77923080d1.tar.gz
yuzu-3bfd199497bd016e79ba27f338c0dd77923080d1.tar.xz
yuzu-3bfd199497bd016e79ba27f338c0dd77923080d1.zip
Merge pull request #2211 from lioncash/arbiter
kernel: Make the address arbiter instance per-process
Diffstat (limited to 'src/core/hle/kernel/svc.cpp')
-rw-r--r--src/core/hle/kernel/svc.cpp39
1 files changed, 8 insertions, 31 deletions
diff --git a/src/core/hle/kernel/svc.cpp b/src/core/hle/kernel/svc.cpp
index 7f5c0cc86..77d0e3d96 100644
--- a/src/core/hle/kernel/svc.cpp
+++ b/src/core/hle/kernel/svc.cpp
@@ -1479,21 +1479,10 @@ static ResultCode WaitForAddress(VAddr address, u32 type, s32 value, s64 timeout
1479 return ERR_INVALID_ADDRESS; 1479 return ERR_INVALID_ADDRESS;
1480 } 1480 }
1481 1481
1482 auto& address_arbiter = Core::System::GetInstance().Kernel().AddressArbiter(); 1482 const auto arbitration_type = static_cast<AddressArbiter::ArbitrationType>(type);
1483 switch (static_cast<AddressArbiter::ArbitrationType>(type)) { 1483 auto& address_arbiter =
1484 case AddressArbiter::ArbitrationType::WaitIfLessThan: 1484 Core::System::GetInstance().Kernel().CurrentProcess()->GetAddressArbiter();
1485 return address_arbiter.WaitForAddressIfLessThan(address, value, timeout, false); 1485 return address_arbiter.WaitForAddress(address, arbitration_type, value, timeout);
1486 case AddressArbiter::ArbitrationType::DecrementAndWaitIfLessThan:
1487 return address_arbiter.WaitForAddressIfLessThan(address, value, timeout, true);
1488 case AddressArbiter::ArbitrationType::WaitIfEqual:
1489 return address_arbiter.WaitForAddressIfEqual(address, value, timeout);
1490 default:
1491 LOG_ERROR(Kernel_SVC,
1492 "Invalid arbitration type, expected WaitIfLessThan, DecrementAndWaitIfLessThan "
1493 "or WaitIfEqual but got {}",
1494 type);
1495 return ERR_INVALID_ENUM_VALUE;
1496 }
1497} 1486}
1498 1487
1499// Signals to an address (via Address Arbiter) 1488// Signals to an address (via Address Arbiter)
@@ -1511,22 +1500,10 @@ static ResultCode SignalToAddress(VAddr address, u32 type, s32 value, s32 num_to
1511 return ERR_INVALID_ADDRESS; 1500 return ERR_INVALID_ADDRESS;
1512 } 1501 }
1513 1502
1514 auto& address_arbiter = Core::System::GetInstance().Kernel().AddressArbiter(); 1503 const auto signal_type = static_cast<AddressArbiter::SignalType>(type);
1515 switch (static_cast<AddressArbiter::SignalType>(type)) { 1504 auto& address_arbiter =
1516 case AddressArbiter::SignalType::Signal: 1505 Core::System::GetInstance().Kernel().CurrentProcess()->GetAddressArbiter();
1517 return address_arbiter.SignalToAddress(address, num_to_wake); 1506 return address_arbiter.SignalToAddress(address, signal_type, value, num_to_wake);
1518 case AddressArbiter::SignalType::IncrementAndSignalIfEqual:
1519 return address_arbiter.IncrementAndSignalToAddressIfEqual(address, value, num_to_wake);
1520 case AddressArbiter::SignalType::ModifyByWaitingCountAndSignalIfEqual:
1521 return address_arbiter.ModifyByWaitingCountAndSignalToAddressIfEqual(address, value,
1522 num_to_wake);
1523 default:
1524 LOG_ERROR(Kernel_SVC,
1525 "Invalid signal type, expected Signal, IncrementAndSignalIfEqual "
1526 "or ModifyByWaitingCountAndSignalIfEqual but got {}",
1527 type);
1528 return ERR_INVALID_ENUM_VALUE;
1529 }
1530} 1507}
1531 1508
1532/// This returns the total CPU ticks elapsed since the CPU was powered-on 1509/// This returns the total CPU ticks elapsed since the CPU was powered-on