linux-user: Make cpu_env accessible in strace.c

Variable "cpu_env" is used in file "syscall.c" to store
the information about the cpu environment. This variable
is used because values of some syscalls can vary between
cpu architectures. This patch makes the "cpu_env" accessible
in "strace.c" so it can enable aproppriate "-strace" argument
printing for these syscalls. This will be a useful addition
for future "-strace" implementation in QEMU.

Implementation notes:

    Functions "print_syscall()" and "print_syscall_ret()" which
    are stated and defined in "qemu.h" and "strace.c" respectively
    are used to print syscall arguments before and after syscall
    execution. These functions were changed with addition of a
    new argument "void *cpu_env". Strucute "struct syscallname"
    in "strace.c" is used to store the information about syscalls.
    Fields "call" and "result" represent pointers to functions which
    are used to print syscall arguments before and after execution.
    These fields were also changed with addition of a new "void *"
    argumetn.
    Also, all defined "print_*" and "print_syscall_ret*" functions
    in "strace.c" were changed to have the new "void *cpu_env".
    This was done to not cause build errors (even though none of
    these functions use this argument).

Signed-off-by: Filip Bozuta <Filip.Bozuta@syrmia.com>
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <20200811164553.27713-2-Filip.Bozuta@syrmia.com>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
This commit is contained in:
Filip Bozuta 2020-08-11 18:45:49 +02:00 committed by Laurent Vivier
parent 913b03c264
commit e400e11941
3 changed files with 247 additions and 241 deletions

View File

@ -400,10 +400,10 @@ extern long safe_syscall_base(int *pending, long number, ...);
int host_to_target_waitstatus(int status);
/* strace.c */
void print_syscall(int num,
void print_syscall(void *cpu_env, int num,
abi_long arg1, abi_long arg2, abi_long arg3,
abi_long arg4, abi_long arg5, abi_long arg6);
void print_syscall_ret(int num, abi_long ret,
void print_syscall_ret(void *cpu_env, int num, abi_long ret,
abi_long arg1, abi_long arg2, abi_long arg3,
abi_long arg4, abi_long arg5, abi_long arg6);
/**

File diff suppressed because it is too large Load Diff

View File

@ -12769,14 +12769,15 @@ abi_long do_syscall(void *cpu_env, int num, abi_long arg1,
arg2, arg3, arg4, arg5, arg6, arg7, arg8);
if (unlikely(qemu_loglevel_mask(LOG_STRACE))) {
print_syscall(num, arg1, arg2, arg3, arg4, arg5, arg6);
print_syscall(cpu_env, num, arg1, arg2, arg3, arg4, arg5, arg6);
}
ret = do_syscall1(cpu_env, num, arg1, arg2, arg3, arg4,
arg5, arg6, arg7, arg8);
if (unlikely(qemu_loglevel_mask(LOG_STRACE))) {
print_syscall_ret(num, ret, arg1, arg2, arg3, arg4, arg5, arg6);
print_syscall_ret(cpu_env, num, ret, arg1, arg2,
arg3, arg4, arg5, arg6);
}
record_syscall_return(cpu, num, ret);