mirror of
https://github.com/yuzu-emu/yuzu-android.git
synced 2024-11-23 00:25:47 +01:00
Kernel/IPC: Make HLERequestContext usable from outside kernel
This commit is contained in:
parent
d0888f8548
commit
0dfafdbe59
@ -23,6 +23,11 @@ void SessionRequestHandler::ClientDisconnected(SharedPtr<ServerSession> server_s
|
|||||||
boost::range::remove_erase(connected_sessions, server_session);
|
boost::range::remove_erase(connected_sessions, server_session);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HLERequestContext::HLERequestContext(SharedPtr<ServerSession> session)
|
||||||
|
: session(std::move(session)) {
|
||||||
|
cmd_buf[0] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
HLERequestContext::~HLERequestContext() = default;
|
HLERequestContext::~HLERequestContext() = default;
|
||||||
|
|
||||||
SharedPtr<Object> HLERequestContext::GetIncomingHandle(u32 id_from_cmdbuf) const {
|
SharedPtr<Object> HLERequestContext::GetIncomingHandle(u32 id_from_cmdbuf) const {
|
||||||
|
@ -84,6 +84,7 @@ protected:
|
|||||||
*/
|
*/
|
||||||
class HLERequestContext {
|
class HLERequestContext {
|
||||||
public:
|
public:
|
||||||
|
HLERequestContext(SharedPtr<ServerSession> session);
|
||||||
~HLERequestContext();
|
~HLERequestContext();
|
||||||
|
|
||||||
/// Returns a pointer to the IPC command buffer for this request.
|
/// Returns a pointer to the IPC command buffer for this request.
|
||||||
@ -118,14 +119,14 @@ public:
|
|||||||
*/
|
*/
|
||||||
void ClearIncomingObjects();
|
void ClearIncomingObjects();
|
||||||
|
|
||||||
private:
|
/// Populates this context with data from the requesting process/thread.
|
||||||
friend class Service::ServiceFrameworkBase;
|
|
||||||
|
|
||||||
ResultCode PopulateFromIncomingCommandBuffer(const u32_le* src_cmdbuf, Process& src_process,
|
ResultCode PopulateFromIncomingCommandBuffer(const u32_le* src_cmdbuf, Process& src_process,
|
||||||
HandleTable& src_table);
|
HandleTable& src_table);
|
||||||
|
/// Writes data from this context back to the requesting process/thread.
|
||||||
ResultCode WriteToOutgoingCommandBuffer(u32_le* dst_cmdbuf, Process& dst_process,
|
ResultCode WriteToOutgoingCommandBuffer(u32_le* dst_cmdbuf, Process& dst_process,
|
||||||
HandleTable& dst_table) const;
|
HandleTable& dst_table) const;
|
||||||
|
|
||||||
|
private:
|
||||||
std::array<u32, IPC::COMMAND_BUFFER_LENGTH> cmd_buf;
|
std::array<u32, IPC::COMMAND_BUFFER_LENGTH> cmd_buf;
|
||||||
SharedPtr<ServerSession> session;
|
SharedPtr<ServerSession> session;
|
||||||
// TODO(yuriks): Check common usage of this and optimize size accordingly
|
// TODO(yuriks): Check common usage of this and optimize size accordingly
|
||||||
|
@ -173,8 +173,7 @@ void ServiceFrameworkBase::HandleSyncRequest(SharedPtr<ServerSession> server_ses
|
|||||||
|
|
||||||
// TODO(yuriks): The kernel should be the one handling this as part of translation after
|
// TODO(yuriks): The kernel should be the one handling this as part of translation after
|
||||||
// everything else is migrated
|
// everything else is migrated
|
||||||
Kernel::HLERequestContext context;
|
Kernel::HLERequestContext context(std::move(server_session));
|
||||||
context.session = std::move(server_session);
|
|
||||||
context.PopulateFromIncomingCommandBuffer(cmd_buf, *Kernel::g_current_process,
|
context.PopulateFromIncomingCommandBuffer(cmd_buf, *Kernel::g_current_process,
|
||||||
Kernel::g_handle_table);
|
Kernel::g_handle_table);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user