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