From 14eeb9432644abc00e3b771be0685f2a72387d20 Mon Sep 17 00:00:00 2001 From: Gliniak Date: Mon, 25 Jan 2021 08:49:48 +0100 Subject: [PATCH] [Kernel/IO] IoCompletion: Removed !wait_ticks check - Marked IoCompletion as frequently used functions - Added correct behaviour to wait_ticks 0 --- src/xenia/kernel/xboxkrnl/xboxkrnl_io.cc | 10 +++++++--- src/xenia/kernel/xiocompletion.cc | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/xenia/kernel/xboxkrnl/xboxkrnl_io.cc b/src/xenia/kernel/xboxkrnl/xboxkrnl_io.cc index 7a2d797e8..62d07e12c 100644 --- a/src/xenia/kernel/xboxkrnl/xboxkrnl_io.cc +++ b/src/xenia/kernel/xboxkrnl/xboxkrnl_io.cc @@ -458,7 +458,8 @@ dword_result_t NtSetIoCompletion(dword_t handle, dword_t key_context, port->QueueNotification(notification); return X_STATUS_SUCCESS; } -DECLARE_XBOXKRNL_EXPORT1(NtSetIoCompletion, kFileSystem, kImplemented); +DECLARE_XBOXKRNL_EXPORT2(NtSetIoCompletion, kFileSystem, kImplemented, + kHighFrequency); // Dequeues a packet from the completion port. dword_result_t NtRemoveIoCompletion( @@ -473,7 +474,9 @@ dword_result_t NtRemoveIoCompletion( status = X_STATUS_INVALID_HANDLE; } - uint64_t timeout_ticks = timeout ? static_cast(*timeout) : 0u; + uint64_t timeout_ticks = + timeout ? static_cast(*timeout) + : static_cast(std::numeric_limits::min()); XIOCompletion::IONotification notification; if (port->WaitForNotification(timeout_ticks, ¬ification)) { if (key_context) { @@ -493,7 +496,8 @@ dword_result_t NtRemoveIoCompletion( return status; } -DECLARE_XBOXKRNL_EXPORT1(NtRemoveIoCompletion, kFileSystem, kImplemented); +DECLARE_XBOXKRNL_EXPORT2(NtRemoveIoCompletion, kFileSystem, kImplemented, + kHighFrequency); dword_result_t NtQueryFullAttributesFile( pointer_t obj_attribs, diff --git a/src/xenia/kernel/xiocompletion.cc b/src/xenia/kernel/xiocompletion.cc index 94d49a5f5..638a0a3ef 100644 --- a/src/xenia/kernel/xiocompletion.cc +++ b/src/xenia/kernel/xiocompletion.cc @@ -30,7 +30,7 @@ bool XIOCompletion::WaitForNotification(uint64_t wait_ticks, IONotification* notify) { auto ms = std::chrono::milliseconds(TimeoutTicksToMs(wait_ticks)); auto res = threading::Wait(notification_semaphore_.get(), false, ms); - if (res == threading::WaitResult::kSuccess || !wait_ticks) { + if (res == threading::WaitResult::kSuccess) { std::unique_lock lock(notification_lock_); assert_false(notifications_.empty());