Kernel/IPC: Support translation of null handles

Missed this in my first implementation. Thanks to @wwylele for pointing
out that this was missing.
This commit is contained in:
Yuri Kunde Schlesner 2017-06-21 14:27:03 -07:00
parent c4f0927a62
commit f64d0b3f26
2 changed files with 35 additions and 7 deletions

View file

@ -94,6 +94,18 @@ TEST_CASE("HLERequestContext::PopoulateFromIncomingCommandBuffer", "[core][kerne
REQUIRE(context.GetIncomingHandle(output[5]) == c);
}
SECTION("translates null handles") {
const u32_le input[]{
IPC::MakeHeader(0, 0, 2), IPC::MoveHandleDesc(1), 0,
};
auto result = context.PopulateFromIncomingCommandBuffer(input, *process, handle_table);
REQUIRE(result == RESULT_SUCCESS);
auto* output = context.CommandBuffer();
REQUIRE(context.GetIncomingHandle(output[2]) == nullptr);
}
SECTION("translates CallingPid descriptors") {
const u32_le input[]{
IPC::MakeHeader(0, 0, 2), IPC::CallingPidDesc(), 0x98989898,
@ -171,6 +183,17 @@ TEST_CASE("HLERequestContext::WriteToOutgoingCommandBuffer", "[core][kernel]") {
REQUIRE(handle_table.GetGeneric(output[4]) == b);
}
SECTION("translates null handles") {
input[0] = IPC::MakeHeader(0, 0, 2);
input[1] = IPC::MoveHandleDesc(1);
input[2] = context.AddOutgoingHandle(nullptr);
auto result = context.WriteToOutgoingCommandBuffer(output, *process, handle_table);
REQUIRE(result == RESULT_SUCCESS);
REQUIRE(output[2] == 0);
}
SECTION("translates multi-handle descriptors") {
auto a = MakeObject();
auto b = MakeObject();