Re: [PATCH v5 19/25] xtensa: define syscall_get_* functions

From: Max Filippov
Date: Mon Dec 10 2018 - 00:03:07 EST


Hello,

On Sun, Dec 9, 2018 at 8:30 PM Dmitry V. Levin <ldv@xxxxxxxxxxxx> wrote:
> syscall_get_* functions are required to be implemented on all
> architectures in order to extend the generic ptrace API with
> PTRACE_GET_SYSCALL_INFO request.
>
> This adds all 5 syscall_get_* functions on xtensa as documented
> in asm-generic/syscall.h: syscall_get_nr, syscall_get_arguments,
> syscall_get_error, syscall_get_return_value, and syscall_get_arch.

I have this set of functions plus syscall_set_arguments implemented
for syscall tracing here:
https://github.com/jcmvbkbc/linux-xtensa/commit/0023f56298cc92ce47e61b1b5dd1038f7be4f826

How should we synchronize our changes?

> diff --git a/arch/xtensa/include/asm/syscall.h b/arch/xtensa/include/asm/syscall.h
> index 3673ff1f1bc5..d529c855a144 100644
> --- a/arch/xtensa/include/asm/syscall.h
> +++ b/arch/xtensa/include/asm/syscall.h

[...]

> +static inline void
> +syscall_get_arguments(struct task_struct *task, struct pt_regs *regs,
> + unsigned int i, unsigned int n, unsigned long *args)
> +{
> + switch (i) {
> + case 0:
> + if (!n--)
> + break;
> + *args++ = regs->areg[6];
> + /* fall through */
> + case 1:
> + if (!n--)
> + break;
> + *args++ = regs->areg[3];
> + /* fall through */
> + case 2:
> + if (!n--)
> + break;
> + *args++ = regs->areg[4];
> + /* fall through */
> + case 3:
> + if (!n--)
> + break;
> + *args++ = regs->areg[5];
> + /* fall through */
> + case 4:
> + if (!n--)
> + break;
> + *args++ = regs->areg[8];
> + /* fall through */
> + case 5:
> + if (!n--)
> + break;
> + *args++ = regs->areg[9];
> + /* fall through */
> + case 6:
> + if (!n--)
> + break;
> + /* fall through */
> + default:
> + BUG();

A WARN should be enough.

--
Thanks.
-- Max