GUI: Fix Tomato RAF theme for all builds. Compilation typo.
[tomato.git] / release / src-rt-6.x.4708 / linux / linux-2.6.36 / arch / blackfin / include / asm / syscall.h
blob4921a4815cce8cf7101e96bcb6b6236df325766c
1 /*
2 * Magic syscall break down functions
4 * Copyright 2010 Analog Devices Inc.
6 * Licensed under the GPL-2 or later.
7 */
9 #ifndef __ASM_BLACKFIN_SYSCALL_H__
10 #define __ASM_BLACKFIN_SYSCALL_H__
13 * Blackfin syscalls are simple:
14 * enter:
15 * p0: syscall number
16 * r{0,1,2,3,4,5}: syscall args 0,1,2,3,4,5
17 * exit:
18 * r0: return/error value
21 #include <linux/err.h>
22 #include <linux/sched.h>
23 #include <asm/ptrace.h>
25 static inline long
26 syscall_get_nr(struct task_struct *task, struct pt_regs *regs)
28 return regs->p0;
31 static inline void
32 syscall_rollback(struct task_struct *task, struct pt_regs *regs)
34 regs->p0 = regs->orig_p0;
37 static inline long
38 syscall_get_error(struct task_struct *task, struct pt_regs *regs)
40 return IS_ERR_VALUE(regs->r0) ? regs->r0 : 0;
43 static inline long
44 syscall_get_return_value(struct task_struct *task, struct pt_regs *regs)
46 return regs->r0;
49 static inline void
50 syscall_set_return_value(struct task_struct *task, struct pt_regs *regs,
51 int error, long val)
53 regs->r0 = error ? -error : val;
56 /**
57 * syscall_get_arguments()
58 * @task: unused
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
66 static inline void
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 = &regs->r0 - i;
77 BUG_ON(i > 5 || i + n > 6);
79 while (n--)
80 *args++ = *aregs--;
83 /* See syscall_get_arguments() comments */
84 static inline void
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 = &regs->r0 - i;
90 BUG_ON(i > 5 || i + n > 6);
92 while (n--)
93 *aregs-- = *args++;
96 #endif