summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/hle/kernel/hle_ipc.cpp7
-rw-r--r--src/core/hle/kernel/hle_ipc.h8
-rw-r--r--src/core/hle/kernel/server_session.cpp2
-rw-r--r--src/core/hle/service/vi/vi.cpp2
4 files changed, 10 insertions, 9 deletions
diff --git a/src/core/hle/kernel/hle_ipc.cpp b/src/core/hle/kernel/hle_ipc.cpp
index 42d9dd844..f3da525d6 100644
--- a/src/core/hle/kernel/hle_ipc.cpp
+++ b/src/core/hle/kernel/hle_ipc.cpp
@@ -43,7 +43,7 @@ void SessionRequestHandler::ClientDisconnected(const SharedPtr<ServerSession>& s
43} 43}
44 44
45SharedPtr<WritableEvent> HLERequestContext::SleepClientThread( 45SharedPtr<WritableEvent> HLERequestContext::SleepClientThread(
46 SharedPtr<Thread> thread, const std::string& reason, u64 timeout, WakeupCallback&& callback, 46 const std::string& reason, u64 timeout, WakeupCallback&& callback,
47 SharedPtr<WritableEvent> writable_event) { 47 SharedPtr<WritableEvent> writable_event) {
48 // Put the client thread to sleep until the wait event is signaled or the timeout expires. 48 // Put the client thread to sleep until the wait event is signaled or the timeout expires.
49 thread->SetWakeupCallback([context = *this, callback]( 49 thread->SetWakeupCallback([context = *this, callback](
@@ -76,8 +76,9 @@ SharedPtr<WritableEvent> HLERequestContext::SleepClientThread(
76 return writable_event; 76 return writable_event;
77} 77}
78 78
79HLERequestContext::HLERequestContext(SharedPtr<Kernel::ServerSession> server_session) 79HLERequestContext::HLERequestContext(SharedPtr<Kernel::ServerSession> server_session,
80 : server_session(std::move(server_session)) { 80 SharedPtr<Thread> thread)
81 : server_session(std::move(server_session)), thread(std::move(thread)) {
81 cmd_buf[0] = 0; 82 cmd_buf[0] = 0;
82} 83}
83 84
diff --git a/src/core/hle/kernel/hle_ipc.h b/src/core/hle/kernel/hle_ipc.h
index 2bdd9f02c..ccf5e56aa 100644
--- a/src/core/hle/kernel/hle_ipc.h
+++ b/src/core/hle/kernel/hle_ipc.h
@@ -97,7 +97,7 @@ protected:
97 */ 97 */
98class HLERequestContext { 98class HLERequestContext {
99public: 99public:
100 explicit HLERequestContext(SharedPtr<ServerSession> session); 100 explicit HLERequestContext(SharedPtr<ServerSession> session, SharedPtr<Thread> thread);
101 ~HLERequestContext(); 101 ~HLERequestContext();
102 102
103 /// Returns a pointer to the IPC command buffer for this request. 103 /// Returns a pointer to the IPC command buffer for this request.
@@ -119,7 +119,6 @@ public:
119 /** 119 /**
120 * Puts the specified guest thread to sleep until the returned event is signaled or until the 120 * Puts the specified guest thread to sleep until the returned event is signaled or until the
121 * specified timeout expires. 121 * specified timeout expires.
122 * @param thread Thread to be put to sleep.
123 * @param reason Reason for pausing the thread, to be used for debugging purposes. 122 * @param reason Reason for pausing the thread, to be used for debugging purposes.
124 * @param timeout Timeout in nanoseconds after which the thread will be awoken and the callback 123 * @param timeout Timeout in nanoseconds after which the thread will be awoken and the callback
125 * invoked with a Timeout reason. 124 * invoked with a Timeout reason.
@@ -130,8 +129,8 @@ public:
130 * created. 129 * created.
131 * @returns Event that when signaled will resume the thread and call the callback function. 130 * @returns Event that when signaled will resume the thread and call the callback function.
132 */ 131 */
133 SharedPtr<WritableEvent> SleepClientThread(SharedPtr<Thread> thread, const std::string& reason, 132 SharedPtr<WritableEvent> SleepClientThread(const std::string& reason, u64 timeout,
134 u64 timeout, WakeupCallback&& callback, 133 WakeupCallback&& callback,
135 SharedPtr<WritableEvent> writable_event = nullptr); 134 SharedPtr<WritableEvent> writable_event = nullptr);
136 135
137 /// Populates this context with data from the requesting process/thread. 136 /// Populates this context with data from the requesting process/thread.
@@ -268,6 +267,7 @@ private:
268 267
269 std::array<u32, IPC::COMMAND_BUFFER_LENGTH> cmd_buf; 268 std::array<u32, IPC::COMMAND_BUFFER_LENGTH> cmd_buf;
270 SharedPtr<Kernel::ServerSession> server_session; 269 SharedPtr<Kernel::ServerSession> server_session;
270 SharedPtr<Thread> thread;
271 // TODO(yuriks): Check common usage of this and optimize size accordingly 271 // TODO(yuriks): Check common usage of this and optimize size accordingly
272 boost::container::small_vector<SharedPtr<Object>, 8> move_objects; 272 boost::container::small_vector<SharedPtr<Object>, 8> move_objects;
273 boost::container::small_vector<SharedPtr<Object>, 8> copy_objects; 273 boost::container::small_vector<SharedPtr<Object>, 8> copy_objects;
diff --git a/src/core/hle/kernel/server_session.cpp b/src/core/hle/kernel/server_session.cpp
index 696a82cd9..30b2bfb5a 100644
--- a/src/core/hle/kernel/server_session.cpp
+++ b/src/core/hle/kernel/server_session.cpp
@@ -130,7 +130,7 @@ ResultCode ServerSession::HandleSyncRequest(SharedPtr<Thread> thread) {
130 // The ServerSession received a sync request, this means that there's new data available 130 // The ServerSession received a sync request, this means that there's new data available
131 // from its ClientSession, so wake up any threads that may be waiting on a svcReplyAndReceive or 131 // from its ClientSession, so wake up any threads that may be waiting on a svcReplyAndReceive or
132 // similar. 132 // similar.
133 Kernel::HLERequestContext context(this); 133 Kernel::HLERequestContext context(this, thread);
134 u32* cmd_buf = (u32*)Memory::GetPointer(thread->GetTLSAddress()); 134 u32* cmd_buf = (u32*)Memory::GetPointer(thread->GetTLSAddress());
135 context.PopulateFromIncomingCommandBuffer(kernel.CurrentProcess()->GetHandleTable(), cmd_buf); 135 context.PopulateFromIncomingCommandBuffer(kernel.CurrentProcess()->GetHandleTable(), cmd_buf);
136 136
diff --git a/src/core/hle/service/vi/vi.cpp b/src/core/hle/service/vi/vi.cpp
index 4e17249a9..f1fa6ccd1 100644
--- a/src/core/hle/service/vi/vi.cpp
+++ b/src/core/hle/service/vi/vi.cpp
@@ -556,7 +556,7 @@ private:
556 } else { 556 } else {
557 // Wait the current thread until a buffer becomes available 557 // Wait the current thread until a buffer becomes available
558 ctx.SleepClientThread( 558 ctx.SleepClientThread(
559 Kernel::GetCurrentThread(), "IHOSBinderDriver::DequeueBuffer", -1, 559 "IHOSBinderDriver::DequeueBuffer", -1,
560 [=](Kernel::SharedPtr<Kernel::Thread> thread, Kernel::HLERequestContext& ctx, 560 [=](Kernel::SharedPtr<Kernel::Thread> thread, Kernel::HLERequestContext& ctx,
561 Kernel::ThreadWakeupReason reason) { 561 Kernel::ThreadWakeupReason reason) {
562 // Repeat TransactParcel DequeueBuffer when a buffer is available 562 // Repeat TransactParcel DequeueBuffer when a buffer is available