summaryrefslogtreecommitdiffstats
path: root/src/core/hle/kernel/svc/svc_synchronization.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/core/hle/kernel/svc/svc_synchronization.cpp70
1 files changed, 47 insertions, 23 deletions
diff --git a/src/core/hle/kernel/svc/svc_synchronization.cpp b/src/core/hle/kernel/svc/svc_synchronization.cpp
index 1bf6a612a..1a8f7e191 100644
--- a/src/core/hle/kernel/svc/svc_synchronization.cpp
+++ b/src/core/hle/kernel/svc/svc_synchronization.cpp
@@ -14,22 +14,18 @@ Result CloseHandle(Core::System& system, Handle handle) {
LOG_TRACE(Kernel_SVC, "Closing handle 0x{:08X}", handle);
// Remove the handle.
- R_UNLESS(system.Kernel().CurrentProcess()->GetHandleTable().Remove(handle),
+ R_UNLESS(GetCurrentProcess(system.Kernel()).GetHandleTable().Remove(handle),
ResultInvalidHandle);
return ResultSuccess;
}
-Result CloseHandle32(Core::System& system, Handle handle) {
- return CloseHandle(system, handle);
-}
-
/// Clears the signaled state of an event or process.
Result ResetSignal(Core::System& system, Handle handle) {
LOG_DEBUG(Kernel_SVC, "called handle 0x{:08X}", handle);
// Get the current handle table.
- const auto& handle_table = system.Kernel().CurrentProcess()->GetHandleTable();
+ const auto& handle_table = GetCurrentProcess(system.Kernel()).GetHandleTable();
// Try to reset as readable event.
{
@@ -52,10 +48,6 @@ Result ResetSignal(Core::System& system, Handle handle) {
return ResultInvalidHandle;
}
-Result ResetSignal32(Core::System& system, Handle handle) {
- return ResetSignal(system, handle);
-}
-
/// Wait for the given handles to synchronize, timeout after the specified nanoseconds
Result WaitSynchronization(Core::System& system, s32* index, VAddr handles_address, s32 num_handles,
s64 nano_seconds) {
@@ -67,7 +59,7 @@ Result WaitSynchronization(Core::System& system, s32* index, VAddr handles_addre
auto& kernel = system.Kernel();
std::vector<KSynchronizationObject*> objs(num_handles);
- const auto& handle_table = kernel.CurrentProcess()->GetHandleTable();
+ const auto& handle_table = GetCurrentProcess(kernel).GetHandleTable();
Handle* handles = system.Memory().GetPointer<Handle>(handles_address);
// Copy user handles.
@@ -93,19 +85,13 @@ Result WaitSynchronization(Core::System& system, s32* index, VAddr handles_addre
nano_seconds);
}
-Result WaitSynchronization32(Core::System& system, u32 timeout_low, u32 handles_address,
- s32 num_handles, u32 timeout_high, s32* index) {
- const s64 nano_seconds{(static_cast<s64>(timeout_high) << 32) | static_cast<s64>(timeout_low)};
- return WaitSynchronization(system, index, handles_address, num_handles, nano_seconds);
-}
-
/// Resumes a thread waiting on WaitSynchronization
Result CancelSynchronization(Core::System& system, Handle handle) {
LOG_TRACE(Kernel_SVC, "called handle=0x{:X}", handle);
// Get the thread from its handle.
KScopedAutoObject thread =
- system.Kernel().CurrentProcess()->GetHandleTable().GetObject<KThread>(handle);
+ GetCurrentProcess(system.Kernel()).GetHandleTable().GetObject<KThread>(handle);
R_UNLESS(thread.IsNotNull(), ResultInvalidHandle);
// Cancel the thread's wait.
@@ -113,10 +99,6 @@ Result CancelSynchronization(Core::System& system, Handle handle) {
return ResultSuccess;
}
-Result CancelSynchronization32(Core::System& system, Handle handle) {
- return CancelSynchronization(system, handle);
-}
-
void SynchronizePreemptionState(Core::System& system) {
auto& kernel = system.Kernel();
@@ -124,7 +106,7 @@ void SynchronizePreemptionState(Core::System& system) {
KScopedSchedulerLock sl{kernel};
// If the current thread is pinned, unpin it.
- KProcess* cur_process = system.Kernel().CurrentProcess();
+ KProcess* cur_process = GetCurrentProcessPointer(kernel);
const auto core_id = GetCurrentCoreId(kernel);
if (cur_process->GetPinnedThread(core_id) == GetCurrentThreadPointer(kernel)) {
@@ -136,4 +118,46 @@ void SynchronizePreemptionState(Core::System& system) {
}
}
+Result CloseHandle64(Core::System& system, Handle handle) {
+ R_RETURN(CloseHandle(system, handle));
+}
+
+Result ResetSignal64(Core::System& system, Handle handle) {
+ R_RETURN(ResetSignal(system, handle));
+}
+
+Result WaitSynchronization64(Core::System& system, int32_t* out_index, uint64_t handles,
+ int32_t num_handles, int64_t timeout_ns) {
+ R_RETURN(WaitSynchronization(system, out_index, handles, num_handles, timeout_ns));
+}
+
+Result CancelSynchronization64(Core::System& system, Handle handle) {
+ R_RETURN(CancelSynchronization(system, handle));
+}
+
+void SynchronizePreemptionState64(Core::System& system) {
+ SynchronizePreemptionState(system);
+}
+
+Result CloseHandle64From32(Core::System& system, Handle handle) {
+ R_RETURN(CloseHandle(system, handle));
+}
+
+Result ResetSignal64From32(Core::System& system, Handle handle) {
+ R_RETURN(ResetSignal(system, handle));
+}
+
+Result WaitSynchronization64From32(Core::System& system, int32_t* out_index, uint32_t handles,
+ int32_t num_handles, int64_t timeout_ns) {
+ R_RETURN(WaitSynchronization(system, out_index, handles, num_handles, timeout_ns));
+}
+
+Result CancelSynchronization64From32(Core::System& system, Handle handle) {
+ R_RETURN(CancelSynchronization(system, handle));
+}
+
+void SynchronizePreemptionState64From32(Core::System& system) {
+ SynchronizePreemptionState(system);
+}
+
} // namespace Kernel::Svc