hle: Eliminate need to specify command headers for IPC. (#6678)

This commit is contained in:
Steveice10 2023-07-14 17:32:59 -07:00 committed by GitHub
parent 0bedb28bdc
commit e043caac27
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
96 changed files with 2691 additions and 2707 deletions

View file

@ -46,7 +46,7 @@ using CecOpenMode = Module::CecOpenMode;
using CecSystemInfoType = Module::CecSystemInfoType;
void Module::Interface::Open(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0x01, 3, 2);
IPC::RequestParser rp(ctx);
const u32 ncch_program_id = rp.Pop<u32>();
const CecDataPathType path_type = rp.PopEnum<CecDataPathType>();
CecOpenMode open_mode;
@ -129,7 +129,7 @@ void Module::Interface::Open(Kernel::HLERequestContext& ctx) {
}
void Module::Interface::Read(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0x02, 1, 2);
IPC::RequestParser rp(ctx);
const u32 write_buffer_size = rp.Pop<u32>();
auto& write_buffer = rp.PopMappedBuffer();
@ -171,7 +171,7 @@ void Module::Interface::Read(Kernel::HLERequestContext& ctx) {
}
void Module::Interface::ReadMessage(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0x03, 4, 4);
IPC::RequestParser rp(ctx);
const u32 ncch_program_id = rp.Pop<u32>();
const bool is_outbox = rp.Pop<bool>();
const u32 message_id_size = rp.Pop<u32>();
@ -240,7 +240,7 @@ void Module::Interface::ReadMessage(Kernel::HLERequestContext& ctx) {
}
void Module::Interface::ReadMessageWithHMAC(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0x04, 4, 6);
IPC::RequestParser rp(ctx);
const u32 ncch_program_id = rp.Pop<u32>();
const bool is_outbox = rp.Pop<bool>();
const u32 message_id_size = rp.Pop<u32>();
@ -334,7 +334,7 @@ void Module::Interface::ReadMessageWithHMAC(Kernel::HLERequestContext& ctx) {
}
void Module::Interface::Write(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0x05, 1, 2);
IPC::RequestParser rp(ctx);
const u32 read_buffer_size = rp.Pop<u32>();
auto& read_buffer = rp.PopMappedBuffer();
@ -382,7 +382,7 @@ void Module::Interface::Write(Kernel::HLERequestContext& ctx) {
}
void Module::Interface::WriteMessage(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0x06, 4, 4);
IPC::RequestParser rp(ctx);
const u32 ncch_program_id = rp.Pop<u32>();
const bool is_outbox = rp.Pop<bool>();
const u32 message_id_size = rp.Pop<u32>();
@ -452,7 +452,7 @@ void Module::Interface::WriteMessage(Kernel::HLERequestContext& ctx) {
}
void Module::Interface::WriteMessageWithHMAC(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0x07, 4, 6);
IPC::RequestParser rp(ctx);
const u32 ncch_program_id = rp.Pop<u32>();
const bool is_outbox = rp.Pop<bool>();
const u32 message_id_size = rp.Pop<u32>();
@ -540,7 +540,7 @@ void Module::Interface::WriteMessageWithHMAC(Kernel::HLERequestContext& ctx) {
}
void Module::Interface::Delete(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0x08, 4, 2);
IPC::RequestParser rp(ctx);
const u32 ncch_program_id = rp.Pop<u32>();
const CecDataPathType path_type = rp.PopEnum<CecDataPathType>();
const bool is_outbox = rp.Pop<bool>();
@ -584,7 +584,7 @@ void Module::Interface::Delete(Kernel::HLERequestContext& ctx) {
}
void Module::Interface::SetData(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0x09, 3, 2);
IPC::RequestParser rp(ctx);
const u32 ncch_program_id = rp.Pop<u32>();
const u32 buffer_size = rp.Pop<u32>();
const u32 option = rp.Pop<u32>();
@ -619,7 +619,7 @@ void Module::Interface::SetData(Kernel::HLERequestContext& ctx) {
}
void Module::Interface::ReadData(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0x0A, 3, 4);
IPC::RequestParser rp(ctx);
const u32 dest_buffer_size = rp.Pop<u32>();
const CecSystemInfoType info_type = rp.PopEnum<CecSystemInfoType>();
const u32 param_buffer_size = rp.Pop<u32>();
@ -658,7 +658,7 @@ void Module::Interface::ReadData(Kernel::HLERequestContext& ctx) {
}
void Module::Interface::Start(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0x0B, 1, 0);
IPC::RequestParser rp(ctx);
const CecCommand command = rp.PopEnum<CecCommand>();
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
@ -668,7 +668,7 @@ void Module::Interface::Start(Kernel::HLERequestContext& ctx) {
}
void Module::Interface::Stop(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0x0C, 1, 0);
IPC::RequestParser rp(ctx);
const CecCommand command = rp.PopEnum<CecCommand>();
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
@ -678,7 +678,7 @@ void Module::Interface::Stop(Kernel::HLERequestContext& ctx) {
}
void Module::Interface::GetCecInfoBuffer(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0x0D, 2, 2);
IPC::RequestParser rp(ctx);
const u32 buffer_size = rp.Pop<u32>();
const u32 possible_info_type = rp.Pop<u32>();
auto& buffer = rp.PopMappedBuffer();
@ -692,7 +692,7 @@ void Module::Interface::GetCecInfoBuffer(Kernel::HLERequestContext& ctx) {
}
void Module::Interface::GetCecdState(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0x0E, 0, 0);
IPC::RequestParser rp(ctx);
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
rb.Push(RESULT_SUCCESS);
@ -702,7 +702,7 @@ void Module::Interface::GetCecdState(Kernel::HLERequestContext& ctx) {
}
void Module::Interface::GetCecInfoEventHandle(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0x0F, 0, 0);
IPC::RequestParser rp(ctx);
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
rb.Push(RESULT_SUCCESS);
@ -712,7 +712,7 @@ void Module::Interface::GetCecInfoEventHandle(Kernel::HLERequestContext& ctx) {
}
void Module::Interface::GetChangeStateEventHandle(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0x10, 0, 0);
IPC::RequestParser rp(ctx);
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
rb.Push(RESULT_SUCCESS);
@ -722,7 +722,7 @@ void Module::Interface::GetChangeStateEventHandle(Kernel::HLERequestContext& ctx
}
void Module::Interface::OpenAndWrite(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0x11, 4, 4);
IPC::RequestParser rp(ctx);
const u32 buffer_size = rp.Pop<u32>();
const u32 ncch_program_id = rp.Pop<u32>();
const CecDataPathType path_type = rp.PopEnum<CecDataPathType>();
@ -782,7 +782,7 @@ void Module::Interface::OpenAndWrite(Kernel::HLERequestContext& ctx) {
}
void Module::Interface::OpenAndRead(Kernel::HLERequestContext& ctx) {
IPC::RequestParser rp(ctx, 0x12, 4, 4);
IPC::RequestParser rp(ctx);
const u32 buffer_size = rp.Pop<u32>();
const u32 ncch_program_id = rp.Pop<u32>();
const CecDataPathType path_type = rp.PopEnum<CecDataPathType>();

View file

@ -13,10 +13,10 @@ CECD_NDM::CECD_NDM(std::shared_ptr<Module> cecd)
: Module::Interface(std::move(cecd), "cecd:ndm", DefaultMaxSessions) {
static const FunctionInfo functions[] = {
// clang-format off
{IPC::MakeHeader(0x0001, 0, 0), nullptr, "Initialize"},
{IPC::MakeHeader(0x0002, 0, 0), nullptr, "Deinitialize"},
{IPC::MakeHeader(0x0003, 0, 0), nullptr, "ResumeDaemon"},
{IPC::MakeHeader(0x0004, 1, 0), nullptr, "SuspendDaemon"},
{0x0001, nullptr, "Initialize"},
{0x0002, nullptr, "Deinitialize"},
{0x0003, nullptr, "ResumeDaemon"},
{0x0004, nullptr, "SuspendDaemon"},
// clang-format on
};

View file

@ -14,28 +14,28 @@ CECD_S::CECD_S(std::shared_ptr<Module> cecd)
static const FunctionInfo functions[] = {
// cecd:u shared commands
// clang-format off
{IPC::MakeHeader(0x0001, 3, 2), &CECD_S::Open, "Open"},
{IPC::MakeHeader(0x0002, 1, 2), &CECD_S::Read, "Read"},
{IPC::MakeHeader(0x0003, 4, 4), &CECD_S::ReadMessage, "ReadMessage"},
{IPC::MakeHeader(0x0004, 4, 6), &CECD_S::ReadMessageWithHMAC, "ReadMessageWithHMAC"},
{IPC::MakeHeader(0x0005, 1, 2), &CECD_S::Write, "Write"},
{IPC::MakeHeader(0x0006, 4, 4), &CECD_S::WriteMessage, "WriteMessage"},
{IPC::MakeHeader(0x0007, 4, 6), &CECD_S::WriteMessageWithHMAC, "WriteMessageWithHMAC"},
{IPC::MakeHeader(0x0008, 4, 2), &CECD_S::Delete, "Delete"},
{IPC::MakeHeader(0x0009, 3, 2), &CECD_S::SetData, "SetData"},
{IPC::MakeHeader(0x000A, 3, 4), &CECD_S::ReadData, "ReadData"},
{IPC::MakeHeader(0x000B, 1, 0), &CECD_S::Start, "Start"},
{IPC::MakeHeader(0x000C, 1, 0), &CECD_S::Stop, "Stop"},
{IPC::MakeHeader(0x000D, 2, 2), &CECD_S::GetCecInfoBuffer, "GetCecInfoBuffer"},
{IPC::MakeHeader(0x000E, 0, 0), &CECD_S::GetCecdState, "GetCecdState"},
{IPC::MakeHeader(0x000F, 0, 0), &CECD_S::GetCecInfoEventHandle, "GetCecInfoEventHandle"},
{IPC::MakeHeader(0x0010, 0, 0), &CECD_S::GetChangeStateEventHandle, "GetChangeStateEventHandle"},
{IPC::MakeHeader(0x0011, 4, 4), &CECD_S::OpenAndWrite, "OpenAndWrite"},
{IPC::MakeHeader(0x0012, 4, 4), &CECD_S::OpenAndRead, "OpenAndRead"},
{IPC::MakeHeader(0x001E, 2, 2), nullptr, "GetEventLog"},
{IPC::MakeHeader(0x001F, 0, 0), nullptr, "GetEventLogStart"},
{0x0001, &CECD_S::Open, "Open"},
{0x0002, &CECD_S::Read, "Read"},
{0x0003, &CECD_S::ReadMessage, "ReadMessage"},
{0x0004, &CECD_S::ReadMessageWithHMAC, "ReadMessageWithHMAC"},
{0x0005, &CECD_S::Write, "Write"},
{0x0006, &CECD_S::WriteMessage, "WriteMessage"},
{0x0007, &CECD_S::WriteMessageWithHMAC, "WriteMessageWithHMAC"},
{0x0008, &CECD_S::Delete, "Delete"},
{0x0009, &CECD_S::SetData, "SetData"},
{0x000A, &CECD_S::ReadData, "ReadData"},
{0x000B, &CECD_S::Start, "Start"},
{0x000C, &CECD_S::Stop, "Stop"},
{0x000D, &CECD_S::GetCecInfoBuffer, "GetCecInfoBuffer"},
{0x000E, &CECD_S::GetCecdState, "GetCecdState"},
{0x000F, &CECD_S::GetCecInfoEventHandle, "GetCecInfoEventHandle"},
{0x0010, &CECD_S::GetChangeStateEventHandle, "GetChangeStateEventHandle"},
{0x0011, &CECD_S::OpenAndWrite, "OpenAndWrite"},
{0x0012, &CECD_S::OpenAndRead, "OpenAndRead"},
{0x001E, nullptr, "GetEventLog"},
{0x001F, nullptr, "GetEventLogStart"},
// cecd:s commands
{IPC::MakeHeader(0x0402, 0, 2), nullptr, "GetCecInfoEventHandleSys"},
{0x0402, nullptr, "GetCecInfoEventHandleSys"},
// clang-format on
};

View file

@ -14,26 +14,26 @@ CECD_U::CECD_U(std::shared_ptr<Module> cecd)
static const FunctionInfo functions[] = {
// cecd:u shared commands
// clang-format off
{IPC::MakeHeader(0x0001, 3, 2), &CECD_U::Open, "Open"},
{IPC::MakeHeader(0x0002, 1, 2), &CECD_U::Read, "Read"},
{IPC::MakeHeader(0x0003, 4, 4), &CECD_U::ReadMessage, "ReadMessage"},
{IPC::MakeHeader(0x0004, 4, 6), &CECD_U::ReadMessageWithHMAC, "ReadMessageWithHMAC"},
{IPC::MakeHeader(0x0005, 1, 2), &CECD_U::Write, "Write"},
{IPC::MakeHeader(0x0006, 4, 4), &CECD_U::WriteMessage, "WriteMessage"},
{IPC::MakeHeader(0x0007, 4, 6), &CECD_U::WriteMessageWithHMAC, "WriteMessageWithHMAC"},
{IPC::MakeHeader(0x0008, 4, 2), &CECD_U::Delete, "Delete"},
{IPC::MakeHeader(0x0009, 3, 2), &CECD_U::SetData, "SetData"},
{IPC::MakeHeader(0x000A, 3, 4), &CECD_U::ReadData, "ReadData"},
{IPC::MakeHeader(0x000B, 1, 0), &CECD_U::Start, "Start"},
{IPC::MakeHeader(0x000C, 1, 0), &CECD_U::Stop, "Stop"},
{IPC::MakeHeader(0x000D, 2, 2), &CECD_U::GetCecInfoBuffer, "GetCecInfoBuffer"},
{IPC::MakeHeader(0x000E, 0, 0), &CECD_U::GetCecdState, "GetCecdState"},
{IPC::MakeHeader(0x000F, 0, 0), &CECD_U::GetCecInfoEventHandle, "GetCecInfoEventHandle"},
{IPC::MakeHeader(0x0010, 0, 0), &CECD_U::GetChangeStateEventHandle, "GetChangeStateEventHandle"},
{IPC::MakeHeader(0x0011, 4, 4), &CECD_U::OpenAndWrite, "OpenAndWrite"},
{IPC::MakeHeader(0x0012, 4, 4), &CECD_U::OpenAndRead, "OpenAndRead"},
{IPC::MakeHeader(0x001E, 2, 2), nullptr, "GetEventLog"},
{IPC::MakeHeader(0x001F, 0, 0), nullptr, "GetEventLogStart"},
{0x0001, &CECD_U::Open, "Open"},
{0x0002, &CECD_U::Read, "Read"},
{0x0003, &CECD_U::ReadMessage, "ReadMessage"},
{0x0004, &CECD_U::ReadMessageWithHMAC, "ReadMessageWithHMAC"},
{0x0005, &CECD_U::Write, "Write"},
{0x0006, &CECD_U::WriteMessage, "WriteMessage"},
{0x0007, &CECD_U::WriteMessageWithHMAC, "WriteMessageWithHMAC"},
{0x0008, &CECD_U::Delete, "Delete"},
{0x0009, &CECD_U::SetData, "SetData"},
{0x000A, &CECD_U::ReadData, "ReadData"},
{0x000B, &CECD_U::Start, "Start"},
{0x000C, &CECD_U::Stop, "Stop"},
{0x000D, &CECD_U::GetCecInfoBuffer, "GetCecInfoBuffer"},
{0x000E, &CECD_U::GetCecdState, "GetCecdState"},
{0x000F, &CECD_U::GetCecInfoEventHandle, "GetCecInfoEventHandle"},
{0x0010, &CECD_U::GetChangeStateEventHandle, "GetChangeStateEventHandle"},
{0x0011, &CECD_U::OpenAndWrite, "OpenAndWrite"},
{0x0012, &CECD_U::OpenAndRead, "OpenAndRead"},
{0x001E, nullptr, "GetEventLog"},
{0x001F, nullptr, "GetEventLogStart"},
// clang-format on
};