Speed!
This commit is contained in:
parent
06e9f4d7c8
commit
50d94d5299
@ -16,7 +16,6 @@ struct trampoline_pipe_arguments {
|
|||||||
uint32_t id;
|
uint32_t id;
|
||||||
uint32_t allow_early_return;
|
uint32_t allow_early_return;
|
||||||
uint32_t length;
|
uint32_t length;
|
||||||
uint32_t args_addr;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Function Types
|
// Function Types
|
||||||
|
@ -47,12 +47,16 @@ void init_pipe_host(pid_t guest_pid) {
|
|||||||
trampoline_pipe_arguments cmd = {};
|
trampoline_pipe_arguments cmd = {};
|
||||||
while (read(arguments_pipe[PIPE_READ], &cmd, sizeof(trampoline_pipe_arguments)) > 0) {
|
while (read(arguments_pipe[PIPE_READ], &cmd, sizeof(trampoline_pipe_arguments)) > 0) {
|
||||||
static unsigned char args[MAX_TRAMPOLINE_ARGS_SIZE];
|
static unsigned char args[MAX_TRAMPOLINE_ARGS_SIZE];
|
||||||
memory_reader(cmd.args_addr, args, cmd.length);
|
size_t position = 0;
|
||||||
uint32_t ret = 0;
|
while (position < cmd.length) {
|
||||||
if (cmd.allow_early_return && cmd.length > 0) {
|
ssize_t ret = read(arguments_pipe[PIPE_READ], args + position, cmd.length - position);
|
||||||
write(return_value_pipe[PIPE_WRITE], &ret, sizeof(uint32_t));
|
if (ret == -1) {
|
||||||
|
ERR("Unable To Read Trampoline Arguments");
|
||||||
|
} else {
|
||||||
|
position += ret;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
ret = trampoline(cmd.id, args);
|
uint32_t ret = trampoline(cmd.id, args);
|
||||||
if (!cmd.allow_early_return) {
|
if (!cmd.allow_early_return) {
|
||||||
write(return_value_pipe[PIPE_WRITE], &ret, sizeof(uint32_t));
|
write(return_value_pipe[PIPE_WRITE], &ret, sizeof(uint32_t));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user