cregit-Linux how code gets into the kernel

Release 4.11 arch/arm/include/asm/syscall.h

/*
 * Access to user system call parameters and results
 *
 * See asm-generic/syscall.h for descriptions of what we must do here.
 */

#ifndef _ASM_ARM_SYSCALL_H

#define _ASM_ARM_SYSCALL_H

#include <uapi/linux/audit.h> /* for AUDIT_ARCH_* */
#include <linux/elf.h> /* for ELF_EM */
#include <linux/err.h>
#include <linux/sched.h>

#include <asm/unistd.h>


#define NR_syscalls (__NR_syscalls)

extern const unsigned long sys_call_table[];


static inline int syscall_get_nr(struct task_struct *task, struct pt_regs *regs) { return task_thread_info(task)->syscall; }

Contributors

PersonTokensPropCommitsCommitProp
Wade Farnsworth25100.00%1100.00%
Total25100.00%1100.00%


static inline void syscall_rollback(struct task_struct *task, struct pt_regs *regs) { regs->ARM_r0 = regs->ARM_ORIG_r0; }

Contributors

PersonTokensPropCommitsCommitProp
Wade Farnsworth25100.00%1100.00%
Total25100.00%1100.00%


static inline long syscall_get_error(struct task_struct *task, struct pt_regs *regs) { unsigned long error = regs->ARM_r0; return IS_ERR_VALUE(error) ? error : 0; }

Contributors

PersonTokensPropCommitsCommitProp
Wade Farnsworth35100.00%1100.00%
Total35100.00%1100.00%


static inline long syscall_get_return_value(struct task_struct *task, struct pt_regs *regs) { return regs->ARM_r0; }

Contributors

PersonTokensPropCommitsCommitProp
Wade Farnsworth22100.00%1100.00%
Total22100.00%1100.00%


static inline void syscall_set_return_value(struct task_struct *task, struct pt_regs *regs, int error, long val) { regs->ARM_r0 = (long) error ? error : val; }

Contributors

PersonTokensPropCommitsCommitProp
Wade Farnsworth36100.00%1100.00%
Total36100.00%1100.00%

#define SYSCALL_MAX_ARGS 7
static inline void syscall_get_arguments(struct task_struct *task, struct pt_regs *regs, unsigned int i, unsigned int n, unsigned long *args) { if (n == 0) return; if (i + n > SYSCALL_MAX_ARGS) { unsigned long *args_bad = args + SYSCALL_MAX_ARGS - i; unsigned int n_bad = n + i - SYSCALL_MAX_ARGS; pr_warn("%s called with max args %d, handling only %d\n", __func__, i + n, SYSCALL_MAX_ARGS); memset(args_bad, 0, n_bad * sizeof(args[0])); n = SYSCALL_MAX_ARGS - i; } if (i == 0) { args[0] = regs->ARM_ORIG_r0; args++; i++; n--; } memcpy(args, &regs->ARM_r0 + i, n * sizeof(args[0])); }

Contributors

PersonTokensPropCommitsCommitProp
Wade Farnsworth14494.74%133.33%
AKASHI Takahiro74.61%133.33%
Joe Perches10.66%133.33%
Total152100.00%3100.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) { if (n == 0) return; if (i + n > SYSCALL_MAX_ARGS) { 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(&regs->ARM_r0 + i, args, n * sizeof(args[0])); }

Contributors

PersonTokensPropCommitsCommitProp
Wade Farnsworth10793.04%133.33%
AKASHI Takahiro76.09%133.33%
Joe Perches10.87%133.33%
Total115100.00%3100.00%


static inline int syscall_get_arch(void) { /* ARM tasks don't change audit architectures on the fly. */ return AUDIT_ARCH_ARM; }

Contributors

PersonTokensPropCommitsCommitProp
Will Drewry1292.31%150.00%
Eric Paris17.69%150.00%
Total13100.00%2100.00%

#endif /* _ASM_ARM_SYSCALL_H */

Overall Contributors

PersonTokensPropCommitsCommitProp
Wade Farnsworth42691.61%333.33%
Will Drewry194.09%111.11%
AKASHI Takahiro143.01%111.11%
Russell King20.43%111.11%
Joe Perches20.43%111.11%
Eric Paris20.43%222.22%
Total465100.00%9100.00%
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.
Created with cregit.