/* SPDX-License-Identifier: GPL-2.0-only */ /* * Access to user system call parameters and results * * Copyright (C) 2008 Red Hat, Inc. All rights reserved. * * See asm-generic/syscall.h for descriptions of what we must do here.
*/
staticinlineint syscall_get_nr(struct task_struct *task, struct pt_regs *regs)
{ /* * Note that we are returning an int here. That means 0xffffffff, ie. * 32-bit negative 1, will be interpreted as -1 on a 64-bit kernel. * This is important for seccomp so that compat tasks can set r0 = -1 * to reject the syscall.
*/ if (trap_is_syscall(regs)) return regs->gpr[0]; else return -1;
}
staticinlinevoid syscall_set_nr(struct task_struct *task, struct pt_regs *regs, int nr)
{ /* * Unlike syscall_get_nr(), syscall_set_nr() can be called only when * the target task is stopped for tracing on entering syscall, so * there is no need to have the same check syscall_get_nr() has.
*/
regs->gpr[0] = nr;
}
staticinlinevoid syscall_set_return_value(struct task_struct *task, struct pt_regs *regs, int error, long val)
{ if (trap_is_scv(regs)) {
regs->gpr[3] = (long) error ?: val;
} else { /* * In the general case it's not obvious that we must deal with * CCR here, as the syscall exit path will also do that for us. * However there are some places, eg. the signal code, which * check ccr to decide if the value in r3 is actually an error.
*/ if (error) {
regs->ccr |= 0x10000000L;
regs->gpr[3] = error;
} else {
regs->ccr &= ~0x10000000L;
regs->gpr[3] = val;
}
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.