arm64: dts: allwinner: pinebook: Remove unused AXP803 regulators
[linux/fpc-iii.git] / include / asm-generic / syscall.h
blobf3135e7343877b238c8fef99482653e006ea734a
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 /*
3 * Access to user system call parameters and results
5 * Copyright (C) 2008-2009 Red Hat, Inc. All rights reserved.
7 * This file is a stub providing documentation for what functions
8 * asm-ARCH/syscall.h files need to define. Most arch definitions
9 * will be simple inlines.
11 * All of these functions expect to be called with no locks,
12 * and only when the caller is sure that the task of interest
13 * cannot return to user mode while we are looking at it.
16 #ifndef _ASM_SYSCALL_H
17 #define _ASM_SYSCALL_H 1
19 struct task_struct;
20 struct pt_regs;
22 /**
23 * syscall_get_nr - find what system call a task is executing
24 * @task: task of interest, must be blocked
25 * @regs: task_pt_regs() of @task
27 * If @task is executing a system call or is at system call
28 * tracing about to attempt one, returns the system call number.
29 * If @task is not executing a system call, i.e. it's blocked
30 * inside the kernel for a fault or signal, returns -1.
32 * Note this returns int even on 64-bit machines. Only 32 bits of
33 * system call number can be meaningful. If the actual arch value
34 * is 64 bits, this truncates to 32 bits so 0xffffffff means -1.
36 * It's only valid to call this when @task is known to be blocked.
38 int syscall_get_nr(struct task_struct *task, struct pt_regs *regs);
40 /**
41 * syscall_rollback - roll back registers after an aborted system call
42 * @task: task of interest, must be in system call exit tracing
43 * @regs: task_pt_regs() of @task
45 * It's only valid to call this when @task is stopped for system
46 * call exit tracing (due to TIF_SYSCALL_TRACE or TIF_SYSCALL_AUDIT),
47 * after tracehook_report_syscall_entry() returned nonzero to prevent
48 * the system call from taking place.
50 * This rolls back the register state in @regs so it's as if the
51 * system call instruction was a no-op. The registers containing
52 * the system call number and arguments are as they were before the
53 * system call instruction. This may not be the same as what the
54 * register state looked like at system call entry tracing.
56 void syscall_rollback(struct task_struct *task, struct pt_regs *regs);
58 /**
59 * syscall_get_error - check result of traced system call
60 * @task: task of interest, must be blocked
61 * @regs: task_pt_regs() of @task
63 * Returns 0 if the system call succeeded, or -ERRORCODE if it failed.
65 * It's only valid to call this when @task is stopped for tracing on exit
66 * from a system call, due to %TIF_SYSCALL_TRACE or %TIF_SYSCALL_AUDIT.
68 long syscall_get_error(struct task_struct *task, struct pt_regs *regs);
70 /**
71 * syscall_get_return_value - get the return value of a traced system call
72 * @task: task of interest, must be blocked
73 * @regs: task_pt_regs() of @task
75 * Returns the return value of the successful system call.
76 * This value is meaningless if syscall_get_error() returned nonzero.
78 * It's only valid to call this when @task is stopped for tracing on exit
79 * from a system call, due to %TIF_SYSCALL_TRACE or %TIF_SYSCALL_AUDIT.
81 long syscall_get_return_value(struct task_struct *task, struct pt_regs *regs);
83 /**
84 * syscall_set_return_value - change the return value of a traced system call
85 * @task: task of interest, must be blocked
86 * @regs: task_pt_regs() of @task
87 * @error: negative error code, or zero to indicate success
88 * @val: user return value if @error is zero
90 * This changes the results of the system call that user mode will see.
91 * If @error is zero, the user sees a successful system call with a
92 * return value of @val. If @error is nonzero, it's a negated errno
93 * code; the user sees a failed system call with this errno code.
95 * It's only valid to call this when @task is stopped for tracing on exit
96 * from a system call, due to %TIF_SYSCALL_TRACE or %TIF_SYSCALL_AUDIT.
98 void syscall_set_return_value(struct task_struct *task, struct pt_regs *regs,
99 int error, long val);
102 * syscall_get_arguments - extract system call parameter values
103 * @task: task of interest, must be blocked
104 * @regs: task_pt_regs() of @task
105 * @args: array filled with argument values
107 * Fetches 6 arguments to the system call. First argument is stored in
108 * @args[0], and so on.
110 * It's only valid to call this when @task is stopped for tracing on
111 * entry to a system call, due to %TIF_SYSCALL_TRACE or %TIF_SYSCALL_AUDIT.
113 void syscall_get_arguments(struct task_struct *task, struct pt_regs *regs,
114 unsigned long *args);
117 * syscall_set_arguments - change system call parameter value
118 * @task: task of interest, must be in system call entry tracing
119 * @regs: task_pt_regs() of @task
120 * @args: array of argument values to store
122 * Changes 6 arguments to the system call.
123 * The first argument gets value @args[0], and so on.
125 * It's only valid to call this when @task is stopped for tracing on
126 * entry to a system call, due to %TIF_SYSCALL_TRACE or %TIF_SYSCALL_AUDIT.
128 void syscall_set_arguments(struct task_struct *task, struct pt_regs *regs,
129 const unsigned long *args);
132 * syscall_get_arch - return the AUDIT_ARCH for the current system call
133 * @task: task of interest, must be blocked
135 * Returns the AUDIT_ARCH_* based on the system call convention in use.
137 * It's only valid to call this when @task is stopped on entry to a system
138 * call, due to %TIF_SYSCALL_TRACE, %TIF_SYSCALL_AUDIT, or %TIF_SECCOMP.
140 * Architectures which permit CONFIG_HAVE_ARCH_SECCOMP_FILTER must
141 * provide an implementation of this.
143 int syscall_get_arch(struct task_struct *task);
144 #endif /* _ASM_SYSCALL_H */