2 * Copyright (c) 2018 The strace developers.
5 * SPDX-License-Identifier: LGPL-2.1-or-later
11 * Fetch indirect syscall arguments that are provided as an array.
12 * Return a pointer to a static array of kernel_ulong_t elements,
13 * or NULL in case of fetch failure.
16 fetch_indirect_syscall_args(struct tcb *const tcp,
17 const kernel_ulong_t addr,
18 const unsigned int n_args)
20 static kernel_ulong_t u_arg[MAX_ARGS];
22 if (current_wordsize == sizeof(*u_arg)) {
23 if (umoven(tcp, addr, sizeof(*u_arg) * n_args, u_arg))
26 uint32_t narrow_arg[ARRAY_SIZE(u_arg)];
28 if (umoven(tcp, addr, sizeof(*narrow_arg) * n_args, narrow_arg))
30 for (unsigned int i = 0; i < n_args; ++i)
31 u_arg[i] = narrow_arg[i];