citra-emu
/
citra-canary
Archived
1
0
Fork 0

ipc_helper: remove interface for operating on command buffer directly

Now IPC helpers are only supposed to use on top of ServiceFramework
This commit is contained in:
wwylele 2018-03-10 13:25:22 +02:00
parent b179b86f14
commit ea82203780
No known key found for this signature in database
GPG Key ID: 0E87F3187357C16C
2 changed files with 3 additions and 33 deletions

View File

@ -10,7 +10,6 @@
#include <utility> #include <utility>
#include <vector> #include <vector>
#include "core/hle/ipc.h" #include "core/hle/ipc.h"
#include "core/hle/kernel/handle_table.h"
#include "core/hle/kernel/hle_ipc.h" #include "core/hle/kernel/hle_ipc.h"
#include "core/hle/kernel/kernel.h" #include "core/hle/kernel/kernel.h"
@ -18,7 +17,7 @@ namespace IPC {
class RequestHelperBase { class RequestHelperBase {
protected: protected:
Kernel::HLERequestContext* context = nullptr; Kernel::HLERequestContext* context;
u32* cmdbuf; u32* cmdbuf;
ptrdiff_t index = 1; ptrdiff_t index = 1;
Header header; Header header;
@ -27,9 +26,6 @@ public:
RequestHelperBase(Kernel::HLERequestContext& context, Header desired_header) RequestHelperBase(Kernel::HLERequestContext& context, Header desired_header)
: context(&context), cmdbuf(context.CommandBuffer()), header(desired_header) {} : context(&context), cmdbuf(context.CommandBuffer()), header(desired_header) {}
RequestHelperBase(u32* command_buffer, Header command_header)
: cmdbuf(command_buffer), header(command_header) {}
/// Returns the total size of the request in words /// Returns the total size of the request in words
size_t TotalSize() const { size_t TotalSize() const {
return 1 /* command header */ + header.normal_params_size + header.translate_params_size; return 1 /* command header */ + header.normal_params_size + header.translate_params_size;
@ -62,19 +58,6 @@ public:
: RequestBuilder( : RequestBuilder(
context, Header{MakeHeader(command_id, normal_params_size, translate_params_size)}) {} context, Header{MakeHeader(command_id, normal_params_size, translate_params_size)}) {}
RequestBuilder(u32* command_buffer, Header command_header)
: RequestHelperBase(command_buffer, command_header) {
cmdbuf[0] = header.raw;
}
explicit RequestBuilder(u32* command_buffer, u32 command_header)
: RequestBuilder(command_buffer, Header{command_header}) {}
RequestBuilder(u32* command_buffer, u16 command_id, unsigned normal_params_size,
unsigned translate_params_size)
: RequestBuilder(command_buffer,
MakeHeader(command_id, normal_params_size, translate_params_size)) {}
// Validate on destruction, as there shouldn't be any case where we don't want it // Validate on destruction, as there shouldn't be any case where we don't want it
~RequestBuilder() { ~RequestBuilder() {
ValidateHeader(); ValidateHeader();
@ -217,27 +200,13 @@ public:
Header{MakeHeader(command_id, normal_params_size, translate_params_size)}) { Header{MakeHeader(command_id, normal_params_size, translate_params_size)}) {
} }
RequestParser(u32* command_buffer, Header command_header)
: RequestHelperBase(command_buffer, command_header) {}
explicit RequestParser(u32* command_buffer, u32 command_header)
: RequestParser(command_buffer, Header{command_header}) {}
RequestParser(u32* command_buffer, u16 command_id, unsigned normal_params_size,
unsigned translate_params_size)
: RequestParser(command_buffer,
MakeHeader(command_id, normal_params_size, translate_params_size)) {}
RequestBuilder MakeBuilder(u32 normal_params_size, u32 translate_params_size, RequestBuilder MakeBuilder(u32 normal_params_size, u32 translate_params_size,
bool validateHeader = true) { bool validateHeader = true) {
if (validateHeader) if (validateHeader)
ValidateHeader(); ValidateHeader();
Header builderHeader{MakeHeader(static_cast<u16>(header.command_id), normal_params_size, Header builderHeader{MakeHeader(static_cast<u16>(header.command_id), normal_params_size,
translate_params_size)}; translate_params_size)};
if (context != nullptr) return {*context, builderHeader};
return {*context, builderHeader};
else
return {cmdbuf, builderHeader};
} }
template <typename T> template <typename T>

View File

@ -9,6 +9,7 @@
#include "common/string_util.h" #include "common/string_util.h"
#include "core/hle/ipc.h" #include "core/hle/ipc.h"
#include "core/hle/kernel/client_port.h" #include "core/hle/kernel/client_port.h"
#include "core/hle/kernel/handle_table.h"
#include "core/hle/kernel/process.h" #include "core/hle/kernel/process.h"
#include "core/hle/kernel/server_port.h" #include "core/hle/kernel/server_port.h"
#include "core/hle/kernel/server_session.h" #include "core/hle/kernel/server_session.h"