diff options
| author | 2017-06-21 14:27:03 -0700 | |
|---|---|---|
| committer | 2017-06-21 14:27:03 -0700 | |
| commit | f64d0b3f263c077bc18920f47fe63524fdc6cd94 (patch) | |
| tree | 0a05fac06caecd1c9a310da6a386fb5f84d86099 /src/tests/core/hle/kernel | |
| parent | Merge pull request #2789 from yuriks/misc-kernel (diff) | |
| download | yuzu-f64d0b3f263c077bc18920f47fe63524fdc6cd94.tar.gz yuzu-f64d0b3f263c077bc18920f47fe63524fdc6cd94.tar.xz yuzu-f64d0b3f263c077bc18920f47fe63524fdc6cd94.zip | |
Kernel/IPC: Support translation of null handles
Missed this in my first implementation. Thanks to @wwylele for pointing
out that this was missing.
Diffstat (limited to 'src/tests/core/hle/kernel')
| -rw-r--r-- | src/tests/core/hle/kernel/hle_ipc.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/tests/core/hle/kernel/hle_ipc.cpp b/src/tests/core/hle/kernel/hle_ipc.cpp index e07a28c5b..6feca2ba3 100644 --- a/src/tests/core/hle/kernel/hle_ipc.cpp +++ b/src/tests/core/hle/kernel/hle_ipc.cpp | |||
| @@ -94,6 +94,18 @@ TEST_CASE("HLERequestContext::PopoulateFromIncomingCommandBuffer", "[core][kerne | |||
| 94 | REQUIRE(context.GetIncomingHandle(output[5]) == c); | 94 | REQUIRE(context.GetIncomingHandle(output[5]) == c); |
| 95 | } | 95 | } |
| 96 | 96 | ||
| 97 | SECTION("translates null handles") { | ||
| 98 | const u32_le input[]{ | ||
| 99 | IPC::MakeHeader(0, 0, 2), IPC::MoveHandleDesc(1), 0, | ||
| 100 | }; | ||
| 101 | |||
| 102 | auto result = context.PopulateFromIncomingCommandBuffer(input, *process, handle_table); | ||
| 103 | |||
| 104 | REQUIRE(result == RESULT_SUCCESS); | ||
| 105 | auto* output = context.CommandBuffer(); | ||
| 106 | REQUIRE(context.GetIncomingHandle(output[2]) == nullptr); | ||
| 107 | } | ||
| 108 | |||
| 97 | SECTION("translates CallingPid descriptors") { | 109 | SECTION("translates CallingPid descriptors") { |
| 98 | const u32_le input[]{ | 110 | const u32_le input[]{ |
| 99 | IPC::MakeHeader(0, 0, 2), IPC::CallingPidDesc(), 0x98989898, | 111 | IPC::MakeHeader(0, 0, 2), IPC::CallingPidDesc(), 0x98989898, |
| @@ -171,6 +183,17 @@ TEST_CASE("HLERequestContext::WriteToOutgoingCommandBuffer", "[core][kernel]") { | |||
| 171 | REQUIRE(handle_table.GetGeneric(output[4]) == b); | 183 | REQUIRE(handle_table.GetGeneric(output[4]) == b); |
| 172 | } | 184 | } |
| 173 | 185 | ||
| 186 | SECTION("translates null handles") { | ||
| 187 | input[0] = IPC::MakeHeader(0, 0, 2); | ||
| 188 | input[1] = IPC::MoveHandleDesc(1); | ||
| 189 | input[2] = context.AddOutgoingHandle(nullptr); | ||
| 190 | |||
| 191 | auto result = context.WriteToOutgoingCommandBuffer(output, *process, handle_table); | ||
| 192 | |||
| 193 | REQUIRE(result == RESULT_SUCCESS); | ||
| 194 | REQUIRE(output[2] == 0); | ||
| 195 | } | ||
| 196 | |||
| 174 | SECTION("translates multi-handle descriptors") { | 197 | SECTION("translates multi-handle descriptors") { |
| 175 | auto a = MakeObject(); | 198 | auto a = MakeObject(); |
| 176 | auto b = MakeObject(); | 199 | auto b = MakeObject(); |