mirror of
https://github.com/torvalds/linux.git
synced 2026-05-30 10:04:04 +02:00
syscalls: Remove start and number from syscall_set_arguments() args
After removing the start and count arguments of syscall_get_arguments() it seems reasonable to remove them from syscall_set_arguments(). Note, as of today, there are no users of syscall_set_arguments(). But we are told that there will be soon. But for now, at least make it consistent with syscall_get_arguments(). Link: http://lkml.kernel.org/r/20190327222014.GA32540@altlinux.org Cc: Oleg Nesterov <oleg@redhat.com> Cc: Kees Cook <keescook@chromium.org> Cc: Andy Lutomirski <luto@amacapital.net> Cc: Dominik Brodowski <linux@dominikbrodowski.net> Cc: Dave Martin <dave.martin@arm.com> Cc: "Dmitry V. Levin" <ldv@altlinux.org> Cc: x86@kernel.org Cc: linux-snps-arc@lists.infradead.org Cc: linux-kernel@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org Cc: linux-c6x-dev@linux-c6x.org Cc: uclinux-h8-devel@lists.sourceforge.jp Cc: linux-hexagon@vger.kernel.org Cc: linux-ia64@vger.kernel.org Cc: linux-mips@vger.kernel.org Cc: nios2-dev@lists.rocketboards.org Cc: openrisc@lists.librecores.org Cc: linux-parisc@vger.kernel.org Cc: linuxppc-dev@lists.ozlabs.org Cc: linux-riscv@lists.infradead.org Cc: linux-s390@vger.kernel.org Cc: linux-sh@vger.kernel.org Cc: sparclinux@vger.kernel.org Cc: linux-um@lists.infradead.org Cc: linux-xtensa@linux-xtensa.org Cc: linux-arch@vger.kernel.org Acked-by: Max Filippov <jcmvbkbc@gmail.com> # For xtensa changes Acked-by: Will Deacon <will.deacon@arm.com> # For the arm64 bits Reviewed-by: Thomas Gleixner <tglx@linutronix.de> # for x86 Reviewed-by: Dmitry V. Levin <ldv@altlinux.org> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
This commit is contained in:
parent
b35f549df1
commit
32d9258662
|
|
@ -65,26 +65,12 @@ static inline void syscall_get_arguments(struct task_struct *task,
|
||||||
|
|
||||||
static inline void syscall_set_arguments(struct task_struct *task,
|
static inline void syscall_set_arguments(struct task_struct *task,
|
||||||
struct pt_regs *regs,
|
struct pt_regs *regs,
|
||||||
unsigned int i, unsigned int n,
|
|
||||||
const unsigned long *args)
|
const unsigned long *args)
|
||||||
{
|
{
|
||||||
if (n == 0)
|
regs->ARM_ORIG_r0 = args[0];
|
||||||
return;
|
args++;
|
||||||
|
|
||||||
if (i + n > SYSCALL_MAX_ARGS) {
|
memcpy(®s->ARM_r0 + 1, args, 5 * sizeof(args[0]));
|
||||||
pr_warn("%s called with max args %d, handling only %d\n",
|
|
||||||
__func__, i + n, SYSCALL_MAX_ARGS);
|
|
||||||
n = SYSCALL_MAX_ARGS - i;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (i == 0) {
|
|
||||||
regs->ARM_ORIG_r0 = args[0];
|
|
||||||
args++;
|
|
||||||
i++;
|
|
||||||
n--;
|
|
||||||
}
|
|
||||||
|
|
||||||
memcpy(®s->ARM_r0 + i, args, n * sizeof(args[0]));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int syscall_get_arch(void)
|
static inline int syscall_get_arch(void)
|
||||||
|
|
|
||||||
|
|
@ -75,26 +75,12 @@ static inline void syscall_get_arguments(struct task_struct *task,
|
||||||
|
|
||||||
static inline void syscall_set_arguments(struct task_struct *task,
|
static inline void syscall_set_arguments(struct task_struct *task,
|
||||||
struct pt_regs *regs,
|
struct pt_regs *regs,
|
||||||
unsigned int i, unsigned int n,
|
|
||||||
const unsigned long *args)
|
const unsigned long *args)
|
||||||
{
|
{
|
||||||
if (n == 0)
|
regs->orig_x0 = args[0];
|
||||||
return;
|
args++;
|
||||||
|
|
||||||
if (i + n > SYSCALL_MAX_ARGS) {
|
memcpy(®s->regs[1], args, 5 * sizeof(args[0]));
|
||||||
pr_warning("%s called with max args %d, handling only %d\n",
|
|
||||||
__func__, i + n, SYSCALL_MAX_ARGS);
|
|
||||||
n = SYSCALL_MAX_ARGS - i;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (i == 0) {
|
|
||||||
regs->orig_x0 = args[0];
|
|
||||||
args++;
|
|
||||||
i++;
|
|
||||||
n--;
|
|
||||||
}
|
|
||||||
|
|
||||||
memcpy(®s->regs[i], args, n * sizeof(args[0]));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
||||||
|
|
@ -59,40 +59,14 @@ static inline void syscall_get_arguments(struct task_struct *task,
|
||||||
|
|
||||||
static inline void syscall_set_arguments(struct task_struct *task,
|
static inline void syscall_set_arguments(struct task_struct *task,
|
||||||
struct pt_regs *regs,
|
struct pt_regs *regs,
|
||||||
unsigned int i, unsigned int n,
|
|
||||||
const unsigned long *args)
|
const unsigned long *args)
|
||||||
{
|
{
|
||||||
switch (i) {
|
regs->a4 = *args++;
|
||||||
case 0:
|
regs->b4 = *args++;
|
||||||
if (!n--)
|
regs->a6 = *args++;
|
||||||
break;
|
regs->b6 = *args++;
|
||||||
regs->a4 = *args++;
|
regs->a8 = *args++;
|
||||||
case 1:
|
regs->a9 = *args;
|
||||||
if (!n--)
|
|
||||||
break;
|
|
||||||
regs->b4 = *args++;
|
|
||||||
case 2:
|
|
||||||
if (!n--)
|
|
||||||
break;
|
|
||||||
regs->a6 = *args++;
|
|
||||||
case 3:
|
|
||||||
if (!n--)
|
|
||||||
break;
|
|
||||||
regs->b6 = *args++;
|
|
||||||
case 4:
|
|
||||||
if (!n--)
|
|
||||||
break;
|
|
||||||
regs->a8 = *args++;
|
|
||||||
case 5:
|
|
||||||
if (!n--)
|
|
||||||
break;
|
|
||||||
regs->a9 = *args++;
|
|
||||||
case 6:
|
|
||||||
if (!n)
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
BUG();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* __ASM_C6X_SYSCALLS_H */
|
#endif /* __ASM_C6X_SYSCALLS_H */
|
||||||
|
|
|
||||||
|
|
@ -52,17 +52,11 @@ syscall_get_arguments(struct task_struct *task, struct pt_regs *regs,
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
syscall_set_arguments(struct task_struct *task, struct pt_regs *regs,
|
syscall_set_arguments(struct task_struct *task, struct pt_regs *regs,
|
||||||
unsigned int i, unsigned int n, const unsigned long *args)
|
const unsigned long *args)
|
||||||
{
|
{
|
||||||
BUG_ON(i + n > 6);
|
regs->orig_a0 = args[0];
|
||||||
if (i == 0) {
|
args++;
|
||||||
regs->orig_a0 = args[0];
|
memcpy(®s->a1, args, 5 * sizeof(regs->a1));
|
||||||
args++;
|
|
||||||
n--;
|
|
||||||
} else {
|
|
||||||
i--;
|
|
||||||
}
|
|
||||||
memcpy(®s->a1 + i, args, n * sizeof(regs->a1));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int
|
static inline int
|
||||||
|
|
|
||||||
|
|
@ -59,23 +59,19 @@ static inline void syscall_set_return_value(struct task_struct *task,
|
||||||
}
|
}
|
||||||
|
|
||||||
extern void ia64_syscall_get_set_arguments(struct task_struct *task,
|
extern void ia64_syscall_get_set_arguments(struct task_struct *task,
|
||||||
struct pt_regs *regs, unsigned int i, unsigned int n,
|
struct pt_regs *regs, unsigned long *args, int rw);
|
||||||
unsigned long *args, int rw);
|
|
||||||
static inline void syscall_get_arguments(struct task_struct *task,
|
static inline void syscall_get_arguments(struct task_struct *task,
|
||||||
struct pt_regs *regs,
|
struct pt_regs *regs,
|
||||||
unsigned long *args)
|
unsigned long *args)
|
||||||
{
|
{
|
||||||
ia64_syscall_get_set_arguments(task, regs, 0, 6, args, 0);
|
ia64_syscall_get_set_arguments(task, regs, args, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void syscall_set_arguments(struct task_struct *task,
|
static inline void syscall_set_arguments(struct task_struct *task,
|
||||||
struct pt_regs *regs,
|
struct pt_regs *regs,
|
||||||
unsigned int i, unsigned int n,
|
|
||||||
unsigned long *args)
|
unsigned long *args)
|
||||||
{
|
{
|
||||||
BUG_ON(i + n > 6);
|
ia64_syscall_get_set_arguments(task, regs, args, 1);
|
||||||
|
|
||||||
ia64_syscall_get_set_arguments(task, regs, i, n, args, 1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int syscall_get_arch(void)
|
static inline int syscall_get_arch(void)
|
||||||
|
|
|
||||||
|
|
@ -2179,12 +2179,11 @@ static void syscall_get_set_args_cb(struct unw_frame_info *info, void *data)
|
||||||
}
|
}
|
||||||
|
|
||||||
void ia64_syscall_get_set_arguments(struct task_struct *task,
|
void ia64_syscall_get_set_arguments(struct task_struct *task,
|
||||||
struct pt_regs *regs, unsigned int i, unsigned int n,
|
struct pt_regs *regs, unsigned long *args, int rw)
|
||||||
unsigned long *args, int rw)
|
|
||||||
{
|
{
|
||||||
struct syscall_get_set_args data = {
|
struct syscall_get_set_args data = {
|
||||||
.i = i,
|
.i = 0,
|
||||||
.n = n,
|
.n = 6,
|
||||||
.args = args,
|
.args = args,
|
||||||
.regs = regs,
|
.regs = regs,
|
||||||
.rw = rw,
|
.rw = rw,
|
||||||
|
|
|
||||||
|
|
@ -93,9 +93,11 @@ static inline void syscall_get_arguments(struct task_struct *task,
|
||||||
|
|
||||||
static inline void syscall_set_arguments(struct task_struct *task,
|
static inline void syscall_set_arguments(struct task_struct *task,
|
||||||
struct pt_regs *regs,
|
struct pt_regs *regs,
|
||||||
unsigned int i, unsigned int n,
|
|
||||||
const unsigned long *args)
|
const unsigned long *args)
|
||||||
{
|
{
|
||||||
|
unsigned int i = 0;
|
||||||
|
unsigned int n = 6;
|
||||||
|
|
||||||
while (n--)
|
while (n--)
|
||||||
microblaze_set_syscall_arg(regs, i++, *args++);
|
microblaze_set_syscall_arg(regs, i++, *args++);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -129,39 +129,20 @@ void syscall_get_arguments(struct task_struct *task, struct pt_regs *regs,
|
||||||
* syscall_set_arguments - change system call parameter value
|
* syscall_set_arguments - change system call parameter value
|
||||||
* @task: task of interest, must be in system call entry tracing
|
* @task: task of interest, must be in system call entry tracing
|
||||||
* @regs: task_pt_regs() of @task
|
* @regs: task_pt_regs() of @task
|
||||||
* @i: argument index [0,5]
|
|
||||||
* @n: number of arguments; n+i must be [1,6].
|
|
||||||
* @args: array of argument values to store
|
* @args: array of argument values to store
|
||||||
*
|
*
|
||||||
* Changes @n arguments to the system call starting with the @i'th argument.
|
* Changes 6 arguments to the system call. The first argument gets value
|
||||||
* Argument @i gets value @args[0], and so on.
|
* @args[0], and so on.
|
||||||
* An arch inline version is probably optimal when @i and @n are constants.
|
|
||||||
*
|
*
|
||||||
* It's only valid to call this when @task is stopped for tracing on
|
* It's only valid to call this when @task is stopped for tracing on
|
||||||
* entry to a system call, due to %TIF_SYSCALL_TRACE or %TIF_SYSCALL_AUDIT.
|
* entry to a system call, due to %TIF_SYSCALL_TRACE or %TIF_SYSCALL_AUDIT.
|
||||||
* It's invalid to call this with @i + @n > 6; we only support system calls
|
|
||||||
* taking up to 6 arguments.
|
|
||||||
*/
|
*/
|
||||||
void syscall_set_arguments(struct task_struct *task, struct pt_regs *regs,
|
void syscall_set_arguments(struct task_struct *task, struct pt_regs *regs,
|
||||||
unsigned int i, unsigned int n,
|
|
||||||
const unsigned long *args)
|
const unsigned long *args)
|
||||||
{
|
{
|
||||||
if (n == 0)
|
regs->orig_r0 = args[0];
|
||||||
return;
|
args++;
|
||||||
|
|
||||||
if (i + n > SYSCALL_MAX_ARGS) {
|
memcpy(®s->uregs[0] + 1, args, 5 * sizeof(args[0]));
|
||||||
pr_warn("%s called with max args %d, handling only %d\n",
|
|
||||||
__func__, i + n, SYSCALL_MAX_ARGS);
|
|
||||||
n = SYSCALL_MAX_ARGS - i;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (i == 0) {
|
|
||||||
regs->orig_r0 = args[0];
|
|
||||||
args++;
|
|
||||||
i++;
|
|
||||||
n--;
|
|
||||||
}
|
|
||||||
|
|
||||||
memcpy(®s->uregs[0] + i, args, n * sizeof(args[0]));
|
|
||||||
}
|
}
|
||||||
#endif /* _ASM_NDS32_SYSCALL_H */
|
#endif /* _ASM_NDS32_SYSCALL_H */
|
||||||
|
|
|
||||||
|
|
@ -69,42 +69,14 @@ static inline void syscall_get_arguments(struct task_struct *task,
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void syscall_set_arguments(struct task_struct *task,
|
static inline void syscall_set_arguments(struct task_struct *task,
|
||||||
struct pt_regs *regs, unsigned int i, unsigned int n,
|
struct pt_regs *regs, const unsigned long *args)
|
||||||
const unsigned long *args)
|
|
||||||
{
|
{
|
||||||
BUG_ON(i + n > 6);
|
regs->r4 = *args++;
|
||||||
|
regs->r5 = *args++;
|
||||||
switch (i) {
|
regs->r6 = *args++;
|
||||||
case 0:
|
regs->r7 = *args++;
|
||||||
if (!n--)
|
regs->r8 = *args++;
|
||||||
break;
|
regs->r9 = *args;
|
||||||
regs->r4 = *args++;
|
|
||||||
case 1:
|
|
||||||
if (!n--)
|
|
||||||
break;
|
|
||||||
regs->r5 = *args++;
|
|
||||||
case 2:
|
|
||||||
if (!n--)
|
|
||||||
break;
|
|
||||||
regs->r6 = *args++;
|
|
||||||
case 3:
|
|
||||||
if (!n--)
|
|
||||||
break;
|
|
||||||
regs->r7 = *args++;
|
|
||||||
case 4:
|
|
||||||
if (!n--)
|
|
||||||
break;
|
|
||||||
regs->r8 = *args++;
|
|
||||||
case 5:
|
|
||||||
if (!n--)
|
|
||||||
break;
|
|
||||||
regs->r9 = *args++;
|
|
||||||
case 6:
|
|
||||||
if (!n)
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
BUG();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -63,11 +63,9 @@ syscall_get_arguments(struct task_struct *task, struct pt_regs *regs,
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
syscall_set_arguments(struct task_struct *task, struct pt_regs *regs,
|
syscall_set_arguments(struct task_struct *task, struct pt_regs *regs,
|
||||||
unsigned int i, unsigned int n, const unsigned long *args)
|
const unsigned long *args)
|
||||||
{
|
{
|
||||||
BUG_ON(i + n > 6);
|
memcpy(®s->gpr[3], args, 6 * sizeof(args[0]));
|
||||||
|
|
||||||
memcpy(®s->gpr[3 + i], args, n * sizeof(args[0]));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int syscall_get_arch(void)
|
static inline int syscall_get_arch(void)
|
||||||
|
|
|
||||||
|
|
@ -86,15 +86,12 @@ static inline void syscall_get_arguments(struct task_struct *task,
|
||||||
|
|
||||||
static inline void syscall_set_arguments(struct task_struct *task,
|
static inline void syscall_set_arguments(struct task_struct *task,
|
||||||
struct pt_regs *regs,
|
struct pt_regs *regs,
|
||||||
unsigned int i, unsigned int n,
|
|
||||||
const unsigned long *args)
|
const unsigned long *args)
|
||||||
{
|
{
|
||||||
BUG_ON(i + n > 6);
|
memcpy(®s->gpr[3], args, 6 * sizeof(args[0]));
|
||||||
memcpy(®s->gpr[3 + i], args, n * sizeof(args[0]));
|
|
||||||
|
|
||||||
/* Also copy the first argument into orig_gpr3 */
|
/* Also copy the first argument into orig_gpr3 */
|
||||||
if (i == 0 && n > 0)
|
regs->orig_gpr3 = args[0];
|
||||||
regs->orig_gpr3 = args[0];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int syscall_get_arch(void)
|
static inline int syscall_get_arch(void)
|
||||||
|
|
|
||||||
|
|
@ -81,18 +81,11 @@ static inline void syscall_get_arguments(struct task_struct *task,
|
||||||
|
|
||||||
static inline void syscall_set_arguments(struct task_struct *task,
|
static inline void syscall_set_arguments(struct task_struct *task,
|
||||||
struct pt_regs *regs,
|
struct pt_regs *regs,
|
||||||
unsigned int i, unsigned int n,
|
|
||||||
const unsigned long *args)
|
const unsigned long *args)
|
||||||
{
|
{
|
||||||
BUG_ON(i + n > 6);
|
regs->orig_a0 = args[0];
|
||||||
if (i == 0) {
|
args++;
|
||||||
regs->orig_a0 = args[0];
|
memcpy(®s->a1, args, 5 * sizeof(regs->a1));
|
||||||
args++;
|
|
||||||
n--;
|
|
||||||
} else {
|
|
||||||
i--;
|
|
||||||
}
|
|
||||||
memcpy(®s->a1 + i, args, n * sizeof(regs->a1));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int syscall_get_arch(void)
|
static inline int syscall_get_arch(void)
|
||||||
|
|
|
||||||
|
|
@ -74,15 +74,14 @@ static inline void syscall_get_arguments(struct task_struct *task,
|
||||||
|
|
||||||
static inline void syscall_set_arguments(struct task_struct *task,
|
static inline void syscall_set_arguments(struct task_struct *task,
|
||||||
struct pt_regs *regs,
|
struct pt_regs *regs,
|
||||||
unsigned int i, unsigned int n,
|
|
||||||
const unsigned long *args)
|
const unsigned long *args)
|
||||||
{
|
{
|
||||||
BUG_ON(i + n > 6);
|
unsigned int n = 6;
|
||||||
|
|
||||||
while (n-- > 0)
|
while (n-- > 0)
|
||||||
if (i + n > 0)
|
if (n > 0)
|
||||||
regs->gprs[2 + i + n] = args[n];
|
regs->gprs[2 + n] = args[n];
|
||||||
if (i == 0)
|
regs->orig_gpr2 = args[0];
|
||||||
regs->orig_gpr2 = args[0];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int syscall_get_arch(void)
|
static inline int syscall_get_arch(void)
|
||||||
|
|
|
||||||
|
|
@ -62,23 +62,14 @@ static inline void syscall_get_arguments(struct task_struct *task,
|
||||||
|
|
||||||
static inline void syscall_set_arguments(struct task_struct *task,
|
static inline void syscall_set_arguments(struct task_struct *task,
|
||||||
struct pt_regs *regs,
|
struct pt_regs *regs,
|
||||||
unsigned int i, unsigned int n,
|
|
||||||
const unsigned long *args)
|
const unsigned long *args)
|
||||||
{
|
{
|
||||||
/* Same note as above applies */
|
regs->regs[1] = args[5];
|
||||||
BUG_ON(i);
|
regs->regs[0] = args[4];
|
||||||
|
regs->regs[7] = args[3];
|
||||||
switch (n) {
|
regs->regs[6] = args[2];
|
||||||
case 6: regs->regs[1] = args[5];
|
regs->regs[5] = args[1];
|
||||||
case 5: regs->regs[0] = args[4];
|
regs->regs[4] = args[0];
|
||||||
case 4: regs->regs[7] = args[3];
|
|
||||||
case 3: regs->regs[6] = args[2];
|
|
||||||
case 2: regs->regs[5] = args[1];
|
|
||||||
case 1: regs->regs[4] = args[0];
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
BUG();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int syscall_get_arch(void)
|
static inline int syscall_get_arch(void)
|
||||||
|
|
|
||||||
|
|
@ -54,11 +54,9 @@ static inline void syscall_get_arguments(struct task_struct *task,
|
||||||
|
|
||||||
static inline void syscall_set_arguments(struct task_struct *task,
|
static inline void syscall_set_arguments(struct task_struct *task,
|
||||||
struct pt_regs *regs,
|
struct pt_regs *regs,
|
||||||
unsigned int i, unsigned int n,
|
|
||||||
const unsigned long *args)
|
const unsigned long *args)
|
||||||
{
|
{
|
||||||
BUG_ON(i + n > 6);
|
memcpy(®s->regs[2], args, 6 * sizeof(args[0]));
|
||||||
memcpy(®s->regs[2 + i], args, n * sizeof(args[0]));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int syscall_get_arch(void)
|
static inline int syscall_get_arch(void)
|
||||||
|
|
|
||||||
|
|
@ -119,13 +119,12 @@ static inline void syscall_get_arguments(struct task_struct *task,
|
||||||
|
|
||||||
static inline void syscall_set_arguments(struct task_struct *task,
|
static inline void syscall_set_arguments(struct task_struct *task,
|
||||||
struct pt_regs *regs,
|
struct pt_regs *regs,
|
||||||
unsigned int i, unsigned int n,
|
|
||||||
const unsigned long *args)
|
const unsigned long *args)
|
||||||
{
|
{
|
||||||
unsigned int j;
|
unsigned int i;
|
||||||
|
|
||||||
for (j = 0; j < n; j++)
|
for (i = 0; i < 6; i++)
|
||||||
regs->u_regs[UREG_I0 + i + j] = args[j];
|
regs->u_regs[UREG_I0 + i] = args[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int syscall_get_arch(void)
|
static inline int syscall_get_arch(void)
|
||||||
|
|
|
||||||
|
|
@ -67,43 +67,16 @@ static inline void syscall_get_arguments(struct task_struct *task,
|
||||||
|
|
||||||
static inline void syscall_set_arguments(struct task_struct *task,
|
static inline void syscall_set_arguments(struct task_struct *task,
|
||||||
struct pt_regs *regs,
|
struct pt_regs *regs,
|
||||||
unsigned int i, unsigned int n,
|
|
||||||
const unsigned long *args)
|
const unsigned long *args)
|
||||||
{
|
{
|
||||||
struct uml_pt_regs *r = ®s->regs;
|
struct uml_pt_regs *r = ®s->regs;
|
||||||
|
|
||||||
switch (i) {
|
UPT_SYSCALL_ARG1(r) = *args++;
|
||||||
case 0:
|
UPT_SYSCALL_ARG2(r) = *args++;
|
||||||
if (!n--)
|
UPT_SYSCALL_ARG3(r) = *args++;
|
||||||
break;
|
UPT_SYSCALL_ARG4(r) = *args++;
|
||||||
UPT_SYSCALL_ARG1(r) = *args++;
|
UPT_SYSCALL_ARG5(r) = *args++;
|
||||||
case 1:
|
UPT_SYSCALL_ARG6(r) = *args;
|
||||||
if (!n--)
|
|
||||||
break;
|
|
||||||
UPT_SYSCALL_ARG2(r) = *args++;
|
|
||||||
case 2:
|
|
||||||
if (!n--)
|
|
||||||
break;
|
|
||||||
UPT_SYSCALL_ARG3(r) = *args++;
|
|
||||||
case 3:
|
|
||||||
if (!n--)
|
|
||||||
break;
|
|
||||||
UPT_SYSCALL_ARG4(r) = *args++;
|
|
||||||
case 4:
|
|
||||||
if (!n--)
|
|
||||||
break;
|
|
||||||
UPT_SYSCALL_ARG5(r) = *args++;
|
|
||||||
case 5:
|
|
||||||
if (!n--)
|
|
||||||
break;
|
|
||||||
UPT_SYSCALL_ARG6(r) = *args++;
|
|
||||||
case 6:
|
|
||||||
if (!n--)
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
BUG();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* See arch/x86/um/asm/syscall.h for syscall_get_arch() definition. */
|
/* See arch/x86/um/asm/syscall.h for syscall_get_arch() definition. */
|
||||||
|
|
|
||||||
|
|
@ -138,63 +138,26 @@ static inline void syscall_get_arguments(struct task_struct *task,
|
||||||
|
|
||||||
static inline void syscall_set_arguments(struct task_struct *task,
|
static inline void syscall_set_arguments(struct task_struct *task,
|
||||||
struct pt_regs *regs,
|
struct pt_regs *regs,
|
||||||
unsigned int i, unsigned int n,
|
|
||||||
const unsigned long *args)
|
const unsigned long *args)
|
||||||
{
|
{
|
||||||
# ifdef CONFIG_IA32_EMULATION
|
# ifdef CONFIG_IA32_EMULATION
|
||||||
if (task->thread_info.status & TS_COMPAT)
|
if (task->thread_info.status & TS_COMPAT) {
|
||||||
switch (i) {
|
regs->bx = *args++;
|
||||||
case 0:
|
regs->cx = *args++;
|
||||||
if (!n--) break;
|
regs->dx = *args++;
|
||||||
regs->bx = *args++;
|
regs->si = *args++;
|
||||||
case 1:
|
regs->di = *args++;
|
||||||
if (!n--) break;
|
regs->bp = *args;
|
||||||
regs->cx = *args++;
|
} else
|
||||||
case 2:
|
|
||||||
if (!n--) break;
|
|
||||||
regs->dx = *args++;
|
|
||||||
case 3:
|
|
||||||
if (!n--) break;
|
|
||||||
regs->si = *args++;
|
|
||||||
case 4:
|
|
||||||
if (!n--) break;
|
|
||||||
regs->di = *args++;
|
|
||||||
case 5:
|
|
||||||
if (!n--) break;
|
|
||||||
regs->bp = *args++;
|
|
||||||
case 6:
|
|
||||||
if (!n--) break;
|
|
||||||
default:
|
|
||||||
BUG();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
# endif
|
# endif
|
||||||
switch (i) {
|
{
|
||||||
case 0:
|
regs->di = *args++;
|
||||||
if (!n--) break;
|
regs->si = *args++;
|
||||||
regs->di = *args++;
|
regs->dx = *args++;
|
||||||
case 1:
|
regs->r10 = *args++;
|
||||||
if (!n--) break;
|
regs->r8 = *args++;
|
||||||
regs->si = *args++;
|
regs->r9 = *args;
|
||||||
case 2:
|
}
|
||||||
if (!n--) break;
|
|
||||||
regs->dx = *args++;
|
|
||||||
case 3:
|
|
||||||
if (!n--) break;
|
|
||||||
regs->r10 = *args++;
|
|
||||||
case 4:
|
|
||||||
if (!n--) break;
|
|
||||||
regs->r8 = *args++;
|
|
||||||
case 5:
|
|
||||||
if (!n--) break;
|
|
||||||
regs->r9 = *args++;
|
|
||||||
case 6:
|
|
||||||
if (!n--) break;
|
|
||||||
default:
|
|
||||||
BUG();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int syscall_get_arch(void)
|
static inline int syscall_get_arch(void)
|
||||||
|
|
|
||||||
|
|
@ -70,24 +70,13 @@ static inline void syscall_get_arguments(struct task_struct *task,
|
||||||
|
|
||||||
static inline void syscall_set_arguments(struct task_struct *task,
|
static inline void syscall_set_arguments(struct task_struct *task,
|
||||||
struct pt_regs *regs,
|
struct pt_regs *regs,
|
||||||
unsigned int i, unsigned int n,
|
|
||||||
const unsigned long *args)
|
const unsigned long *args)
|
||||||
{
|
{
|
||||||
static const unsigned int reg[] = XTENSA_SYSCALL_ARGUMENT_REGS;
|
static const unsigned int reg[] = XTENSA_SYSCALL_ARGUMENT_REGS;
|
||||||
unsigned int j;
|
unsigned int i;
|
||||||
|
|
||||||
if (n == 0)
|
for (i = 0; i < 6; ++i)
|
||||||
return;
|
regs->areg[reg[i]] = args[i];
|
||||||
|
|
||||||
if (WARN_ON_ONCE(i + n > SYSCALL_MAX_ARGS)) {
|
|
||||||
if (i < SYSCALL_MAX_ARGS)
|
|
||||||
n = SYSCALL_MAX_ARGS - i;
|
|
||||||
else
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (j = 0; j < n; ++j)
|
|
||||||
regs->areg[reg[i + j]] = args[j];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
asmlinkage long xtensa_rt_sigreturn(struct pt_regs*);
|
asmlinkage long xtensa_rt_sigreturn(struct pt_regs*);
|
||||||
|
|
|
||||||
|
|
@ -120,21 +120,15 @@ void syscall_get_arguments(struct task_struct *task, struct pt_regs *regs,
|
||||||
* syscall_set_arguments - change system call parameter value
|
* syscall_set_arguments - change system call parameter value
|
||||||
* @task: task of interest, must be in system call entry tracing
|
* @task: task of interest, must be in system call entry tracing
|
||||||
* @regs: task_pt_regs() of @task
|
* @regs: task_pt_regs() of @task
|
||||||
* @i: argument index [0,5]
|
|
||||||
* @n: number of arguments; n+i must be [1,6].
|
|
||||||
* @args: array of argument values to store
|
* @args: array of argument values to store
|
||||||
*
|
*
|
||||||
* Changes @n arguments to the system call starting with the @i'th argument.
|
* Changes 6 arguments to the system call.
|
||||||
* Argument @i gets value @args[0], and so on.
|
* The first argument gets value @args[0], and so on.
|
||||||
* An arch inline version is probably optimal when @i and @n are constants.
|
|
||||||
*
|
*
|
||||||
* It's only valid to call this when @task is stopped for tracing on
|
* It's only valid to call this when @task is stopped for tracing on
|
||||||
* entry to a system call, due to %TIF_SYSCALL_TRACE or %TIF_SYSCALL_AUDIT.
|
* entry to a system call, due to %TIF_SYSCALL_TRACE or %TIF_SYSCALL_AUDIT.
|
||||||
* It's invalid to call this with @i + @n > 6; we only support system calls
|
|
||||||
* taking up to 6 arguments.
|
|
||||||
*/
|
*/
|
||||||
void syscall_set_arguments(struct task_struct *task, struct pt_regs *regs,
|
void syscall_set_arguments(struct task_struct *task, struct pt_regs *regs,
|
||||||
unsigned int i, unsigned int n,
|
|
||||||
const unsigned long *args);
|
const unsigned long *args);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user