Concessions To Reality

This commit is contained in:
TheBrokenRail 2024-06-08 04:34:46 -04:00
parent 2d9659f273
commit d52c16e722
2 changed files with 18 additions and 10 deletions

@ -1 +1 @@
Subproject commit 06e9f4d7c8505a1e8c8ec4d65e21e93161eae6f7
Subproject commit 50d94d52998ba361c5d89d1b21f7eafd972f3f4e

View File

@ -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");
}
// 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;
}
}
if (allow_early_return) {
return 0;
}
// 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");
}
return ret;
} else {
return 0;
}
}
// Main Function