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 <vector>
#include "core/hle/ipc.h"
#include "core/hle/kernel/handle_table.h"
#include "core/hle/kernel/hle_ipc.h"
#include "core/hle/kernel/kernel.h"
@ -18,7 +17,7 @@ namespace IPC {
class RequestHelperBase {
protected:
Kernel::HLERequestContext* context = nullptr;
Kernel::HLERequestContext* context;
u32* cmdbuf;
ptrdiff_t index = 1;
Header header;
@ -27,9 +26,6 @@ public:
RequestHelperBase(Kernel::HLERequestContext& context, 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
size_t TotalSize() const {
return 1 /* command header */ + header.normal_params_size + header.translate_params_size;
@ -62,19 +58,6 @@ public:
: RequestBuilder(
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
~RequestBuilder() {
ValidateHeader();
@ -217,27 +200,13 @@ public:
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,
bool validateHeader = true) {
if (validateHeader)
ValidateHeader();
Header builderHeader{MakeHeader(static_cast<u16>(header.command_id), normal_params_size,
translate_params_size)};
if (context != nullptr)
return {*context, builderHeader};
else
return {cmdbuf, builderHeader};
return {*context, builderHeader};
}
template <typename T>

View file

@ -9,6 +9,7 @@
#include "common/string_util.h"
#include "core/hle/ipc.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/server_port.h"
#include "core/hle/kernel/server_session.h"