summaryrefslogtreecommitdiff
path: root/arch/powerpc/include/asm/syscall.h
diff options
context:
space:
mode:
authorNicholas Piggin <npiggin@gmail.com>2020-05-07 22:13:31 +1000
committerMichael Ellerman <mpe@ellerman.id.au>2020-05-15 11:58:54 +1000
commit912237ea166428edcbf3c137adf12cb987c477f2 (patch)
treee5397bfdc0e5723782986aeceb77db3a06de4947 /arch/powerpc/include/asm/syscall.h
parentdb30144b5c9cfb09c6b8b2fa7a9c351c94aa3433 (diff)
powerpc: trap_is_syscall() helper to hide syscall trap number
A new system call interrupt will be added with a new trap number. Hide the explicit 0xc00 test behind an accessor to reduce churn in callers. Signed-off-by: Nicholas Piggin <npiggin@gmail.com> [mpe: Make it a static inline] Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://lore.kernel.org/r/20200507121332.2233629-3-mpe@ellerman.id.au
Diffstat (limited to 'arch/powerpc/include/asm/syscall.h')
-rw-r--r--arch/powerpc/include/asm/syscall.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/arch/powerpc/include/asm/syscall.h b/arch/powerpc/include/asm/syscall.h
index 38d62acfdce7..fd1b518eed17 100644
--- a/arch/powerpc/include/asm/syscall.h
+++ b/arch/powerpc/include/asm/syscall.h
@@ -26,7 +26,10 @@ static inline int syscall_get_nr(struct task_struct *task, struct pt_regs *regs)
* This is important for seccomp so that compat tasks can set r0 = -1
* to reject the syscall.
*/
- return TRAP(regs) == 0xc00 ? regs->gpr[0] : -1;
+ if (trap_is_syscall(regs))
+ return regs->gpr[0];
+ else
+ return -1;
}
static inline void syscall_rollback(struct task_struct *task,