From d52c16e7225a2046c5efa005cd0908e73cde4a83 Mon Sep 17 00:00:00 2001 From: TheBrokenRail Date: Sat, 8 Jun 2024 04:34:46 -0400 Subject: [PATCH] Concessions To Reality --- dependencies/trampoline/src | 2 +- media-layer/trampoline/src/guest/guest.cpp | 26 ++++++++++++++-------- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/dependencies/trampoline/src b/dependencies/trampoline/src index 06e9f4d7..50d94d52 160000 --- a/dependencies/trampoline/src +++ b/dependencies/trampoline/src @@ -1 +1 @@ -Subproject commit 06e9f4d7c8505a1e8c8ec4d65e21e93161eae6f7 +Subproject commit 50d94d52998ba361c5d89d1b21f7eafd972f3f4e diff --git a/media-layer/trampoline/src/guest/guest.cpp b/media-layer/trampoline/src/guest/guest.cpp index 374e941c..3cfedf95 100644 --- a/media-layer/trampoline/src/guest/guest.cpp +++ b/media-layer/trampoline/src/guest/guest.cpp @@ -38,22 +38,30 @@ static uint32_t trampoline_pipe(const uint32_t id, const bool allow_early_return const trampoline_pipe_arguments cmd = { .id = id, .allow_early_return = allow_early_return, - .length = length, - .args_addr = uint32_t(args) + .length = length }; if (write(arguments_pipe, &cmd, sizeof(trampoline_pipe_arguments)) != sizeof(trampoline_pipe_arguments)) { ERR("Unable To Write Trampoline Command"); } - // Return - if (length > 0 || !allow_early_return) { - uint32_t ret; - if (read(return_value_pipe, &ret, sizeof(uint32_t)) != sizeof(uint32_t)) { - ERR("Unable To Read Trampoline Return Value"); + // Write Arguments + size_t position = 0; + while (position < length) { + const ssize_t ret = write(arguments_pipe, args + position, length - position); + if (ret == -1) { + ERR("Unable To Write Trampoline Arguments"); + } else { + position += ret; } - return ret; - } else { + } + if (allow_early_return) { return 0; } + // Return + uint32_t ret; + if (read(return_value_pipe, &ret, sizeof(uint32_t)) != sizeof(uint32_t)) { + ERR("Unable To Read Trampoline Return Value"); + } + return ret; } // Main Function