Release 4.14 arch/sparc/include/asm/syscall.h
/* SPDX-License-Identifier: GPL-2.0 */
#ifndef __ASM_SPARC_SYSCALL_H
#define __ASM_SPARC_SYSCALL_H
#include <uapi/linux/audit.h>
#include <linux/kernel.h>
#include <linux/compat.h>
#include <linux/sched.h>
#include <asm/ptrace.h>
#include <asm/thread_info.h>
/*
* The syscall table always contains 32 bit pointers since we know that the
* address of the function to be called is (way) below 4GB. So the "int"
* type here is what we want [need] for both 32 bit and 64 bit systems.
*/
extern const unsigned int sys_call_table[];
/* The system call number is given by the user in %g1 */
static inline long syscall_get_nr(struct task_struct *task,
struct pt_regs *regs)
{
int syscall_p = pt_regs_is_syscall(regs);
return (syscall_p ? regs->u_regs[UREG_G1] : -1L);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
David S. Miller | 40 | 100.00% | 1 | 100.00% |
Total | 40 | 100.00% | 1 | 100.00% |
static inline void syscall_rollback(struct task_struct *task,
struct pt_regs *regs)
{
/* XXX This needs some thought. On Sparc we don't
* XXX save away the original %o0 value somewhere.
* XXX Instead we hold it in register %l5 at the top
* XXX level trap frame and pass this down to the signal
* XXX dispatch code which is the only place that value
* XXX ever was needed.
*/
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
David S. Miller | 18 | 100.00% | 1 | 100.00% |
Total | 18 | 100.00% | 1 | 100.00% |
#ifdef CONFIG_SPARC32
static inline bool syscall_has_error(struct pt_regs *regs)
{
return (regs->psr & PSR_C) ? true : false;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
David S. Miller | 25 | 100.00% | 1 | 100.00% |
Total | 25 | 100.00% | 1 | 100.00% |
static inline void syscall_set_error(struct pt_regs *regs)
{
regs->psr |= PSR_C;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
David S. Miller | 18 | 100.00% | 1 | 100.00% |
Total | 18 | 100.00% | 1 | 100.00% |
static inline void syscall_clear_error(struct pt_regs *regs)
{
regs->psr &= ~PSR_C;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
David S. Miller | 19 | 100.00% | 1 | 100.00% |
Total | 19 | 100.00% | 1 | 100.00% |
#else
static inline bool syscall_has_error(struct pt_regs *regs)
{
return (regs->tstate & (TSTATE_XCARRY | TSTATE_ICARRY)) ? true : false;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
David S. Miller | 29 | 100.00% | 1 | 100.00% |
Total | 29 | 100.00% | 1 | 100.00% |
static inline void syscall_set_error(struct pt_regs *regs)
{
regs->tstate |= (TSTATE_XCARRY | TSTATE_ICARRY);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
David S. Miller | 22 | 100.00% | 1 | 100.00% |
Total | 22 | 100.00% | 1 | 100.00% |
static inline void syscall_clear_error(struct pt_regs *regs)
{
regs->tstate &= ~(TSTATE_XCARRY | TSTATE_ICARRY);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
David S. Miller | 23 | 100.00% | 1 | 100.00% |
Total | 23 | 100.00% | 1 | 100.00% |
#endif
static inline long syscall_get_error(struct task_struct *task,
struct pt_regs *regs)
{
long val = regs->u_regs[UREG_I0];
return (syscall_has_error(regs) ? -val : 0);
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
David S. Miller | 40 | 100.00% | 1 | 100.00% |
Total | 40 | 100.00% | 1 | 100.00% |
static inline long syscall_get_return_value(struct task_struct *task,
struct pt_regs *regs)
{
long val = regs->u_regs[UREG_I0];
return val;
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
David S. Miller | 30 | 100.00% | 1 | 100.00% |
Total | 30 | 100.00% | 1 | 100.00% |
static inline void syscall_set_return_value(struct task_struct *task,
struct pt_regs *regs,
int error, long val)
{
if (error) {
syscall_set_error(regs);
regs->u_regs[UREG_I0] = -error;
} else {
syscall_clear_error(regs);
regs->u_regs[UREG_I0] = val;
}
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
David S. Miller | 61 | 100.00% | 1 | 100.00% |
Total | 61 | 100.00% | 1 | 100.00% |
static inline void syscall_get_arguments(struct task_struct *task,
struct pt_regs *regs,
unsigned int i, unsigned int n,
unsigned long *args)
{
int zero_extend = 0;
unsigned int j;
#ifdef CONFIG_SPARC64
if (test_tsk_thread_flag(task, TIF_32BIT))
zero_extend = 1;
#endif
for (j = 0; j < n; j++) {
unsigned long val = regs->u_regs[UREG_I0 + i + j];
if (zero_extend)
args[j] = (u32) val;
else
args[j] = val;
}
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
David S. Miller | 109 | 100.00% | 1 | 100.00% |
Total | 109 | 100.00% | 1 | 100.00% |
static inline void syscall_set_arguments(struct task_struct *task,
struct pt_regs *regs,
unsigned int i, unsigned int n,
const unsigned long *args)
{
unsigned int j;
for (j = 0; j < n; j++)
regs->u_regs[UREG_I0 + i + j] = args[j];
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
David S. Miller | 64 | 100.00% | 1 | 100.00% |
Total | 64 | 100.00% | 1 | 100.00% |
static inline int syscall_get_arch(void)
{
#if defined(CONFIG_SPARC64) && defined(CONFIG_COMPAT)
return in_compat_syscall() ? AUDIT_ARCH_SPARC : AUDIT_ARCH_SPARC64;
#elif defined(CONFIG_SPARC64)
return AUDIT_ARCH_SPARC64;
#else
return AUDIT_ARCH_SPARC;
#endif
}
Contributors
Person | Tokens | Prop | Commits | CommitProp |
Andrew Lutomirski | 28 | 63.64% | 1 | 33.33% |
Eric Paris | 16 | 36.36% | 2 | 66.67% |
Total | 44 | 100.00% | 3 | 100.00% |
#endif /* __ASM_SPARC_SYSCALL_H */
Overall Contributors
Person | Tokens | Prop | Commits | CommitProp |
David S. Miller | 524 | 89.42% | 1 | 16.67% |
Andrew Lutomirski | 31 | 5.29% | 1 | 16.67% |
Eric Paris | 22 | 3.75% | 2 | 33.33% |
Mike Frysinger | 8 | 1.37% | 1 | 16.67% |
Greg Kroah-Hartman | 1 | 0.17% | 1 | 16.67% |
Total | 586 | 100.00% | 6 | 100.00% |
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.