2 * Magic syscall break down functions
4 * Copyright 2010 Analog Devices Inc.
6 * Licensed under the GPL-2 or later.
9 #ifndef __ASM_BLACKFIN_SYSCALL_H__
10 #define __ASM_BLACKFIN_SYSCALL_H__
13 * Blackfin syscalls are simple:
16 * r{0,1,2,3,4,5}: syscall args 0,1,2,3,4,5
18 * r0: return/error value
21 #include <linux/err.h>
22 #include <linux/sched.h>
23 #include <asm/ptrace.h>
26 syscall_get_nr(struct task_struct *task, struct pt_regs *regs)
32 syscall_rollback(struct task_struct *task, struct pt_regs *regs)
34 regs->p0 = regs->orig_p0;
38 syscall_get_error(struct task_struct *task, struct pt_regs *regs)
40 return IS_ERR_VALUE(regs->r0) ? regs->r0 : 0;
44 syscall_get_return_value(struct task_struct *task, struct pt_regs *regs)
50 syscall_set_return_value(struct task_struct *task, struct pt_regs *regs,
53 regs->r0 = error ? -error : val;
57 * syscall_get_arguments()
59 * @regs: the register layout to extract syscall arguments from
60 * @i: first syscall argument to extract
61 * @n: number of syscall arguments to extract
62 * @args: array to return the syscall arguments in
64 * args[0] gets i'th argument, args[n - 1] gets the i+n-1'th argument
67 syscall_get_arguments(struct task_struct *task, struct pt_regs *regs,
68 unsigned int i, unsigned int n, unsigned long *args)
71 * Assume the ptrace layout doesn't change -- r5 is first in memory,
72 * then r4, ..., then r0. So we simply reverse the ptrace register
73 * array in memory to store into the args array.
75 long *aregs = ®s->r0 - i;
77 BUG_ON(i > 5 || i + n > 6);
83 /* See syscall_get_arguments() comments */
85 syscall_set_arguments(struct task_struct *task, struct pt_regs *regs,
86 unsigned int i, unsigned int n, const unsigned long *args)
88 long *aregs = ®s->r0 - i;
90 BUG_ON(i > 5 || i + n > 6);