summaryrefslogtreecommitdiffstats
path: root/src/core/hle/kernel/server_session.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/hle/kernel/server_session.h')
-rw-r--r--src/core/hle/kernel/server_session.h66
1 files changed, 35 insertions, 31 deletions
diff --git a/src/core/hle/kernel/server_session.h b/src/core/hle/kernel/server_session.h
index 738df30f8..d6e48109e 100644
--- a/src/core/hle/kernel/server_session.h
+++ b/src/core/hle/kernel/server_session.h
@@ -1,4 +1,4 @@
-// Copyright 2014 Citra Emulator Project
+// Copyright 2019 yuzu emulator team
// Licensed under GPLv2 or any later version
// Refer to the license.txt file included.
@@ -9,17 +9,22 @@
#include <utility>
#include <vector>
-#include "core/hle/kernel/object.h"
+#include "common/threadsafe_queue.h"
#include "core/hle/kernel/wait_object.h"
#include "core/hle/result.h"
+namespace Memory {
+class Memory;
+}
+
+namespace Core::Timing {
+struct EventType;
+}
+
namespace Kernel {
-class ClientPort;
-class ClientSession;
class HLERequestContext;
class KernelCore;
-class ServerSession;
class Session;
class SessionRequestHandler;
class Thread;
@@ -38,6 +43,15 @@ class Thread;
*/
class ServerSession final : public WaitObject {
public:
+ explicit ServerSession(KernelCore& kernel);
+ ~ServerSession() override;
+
+ friend class Session;
+
+ static ResultVal<std::shared_ptr<ServerSession>> Create(KernelCore& kernel,
+ std::shared_ptr<Session> parent,
+ std::string name = "Unknown");
+
std::string GetTypeName() const override {
return "ServerSession";
}
@@ -59,18 +73,6 @@ public:
return parent.get();
}
- using SessionPair = std::pair<SharedPtr<ServerSession>, SharedPtr<ClientSession>>;
-
- /**
- * Creates a pair of ServerSession and an associated ClientSession.
- * @param kernel The kernal instance to create the session pair under.
- * @param name Optional name of the ports.
- * @param client_port Optional The ClientPort that spawned this session.
- * @return The created session tuple
- */
- static SessionPair CreateSessionPair(KernelCore& kernel, const std::string& name = "Unknown",
- SharedPtr<ClientPort> client_port = nullptr);
-
/**
* Sets the HLE handler for the session. This handler will be called to service IPC requests
* instead of the regular IPC machinery. (The regular IPC machinery is currently not
@@ -82,10 +84,13 @@ public:
/**
* Handle a sync request from the emulated application.
+ *
* @param thread Thread that initiated the request.
+ * @param memory Memory context to handle the sync request under.
+ *
* @returns ResultCode from the operation.
*/
- ResultCode HandleSyncRequest(SharedPtr<Thread> thread);
+ ResultCode HandleSyncRequest(std::shared_ptr<Thread> thread, Memory::Memory& memory);
bool ShouldWait(const Thread* thread) const override;
@@ -118,18 +123,11 @@ public:
}
private:
- explicit ServerSession(KernelCore& kernel);
- ~ServerSession() override;
+ /// Queues a sync request from the emulated application.
+ ResultCode QueueSyncRequest(std::shared_ptr<Thread> thread, Memory::Memory& memory);
- /**
- * Creates a server session. The server session can have an optional HLE handler,
- * which will be invoked to handle the IPC requests that this session receives.
- * @param kernel The kernel instance to create this server session under.
- * @param name Optional name of the server session.
- * @return The created server session
- */
- static ResultVal<SharedPtr<ServerSession>> Create(KernelCore& kernel,
- std::string name = "Unknown");
+ /// Completes a sync request from the emulated application.
+ ResultCode CompleteSyncRequest();
/// Handles a SyncRequest to a domain, forwarding the request to the proper object or closing an
/// object handle.
@@ -147,18 +145,24 @@ private:
/// List of threads that are pending a response after a sync request. This list is processed in
/// a LIFO manner, thus, the last request will be dispatched first.
/// TODO(Subv): Verify if this is indeed processed in LIFO using a hardware test.
- std::vector<SharedPtr<Thread>> pending_requesting_threads;
+ std::vector<std::shared_ptr<Thread>> pending_requesting_threads;
/// Thread whose request is currently being handled. A request is considered "handled" when a
/// response is sent via svcReplyAndReceive.
/// TODO(Subv): Find a better name for this.
- SharedPtr<Thread> currently_handling;
+ std::shared_ptr<Thread> currently_handling;
/// When set to True, converts the session to a domain at the end of the command
bool convert_to_domain{};
/// The name of this session (optional)
std::string name;
+
+ /// Core timing event used to schedule the service request at some point in the future
+ std::shared_ptr<Core::Timing::EventType> request_event;
+
+ /// Queue of scheduled service requests
+ Common::MPSCQueue<std::shared_ptr<Kernel::HLERequestContext>> request_queue;
};
} // namespace Kernel