Xenomai  3.0.8
syscall.h
1 /*
2  * Copyright (C) 2005 Philippe Gerum <rpm@xenomai.org>.
3  *
4  * Xenomai is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published
6  * by the Free Software Foundation; either version 2 of the License,
7  * or (at your option) any later version.
8  *
9  * Xenomai is distributed in the hope that it will be useful, but
10  * WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with Xenomai; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
17  * 02111-1307, USA.
18  */
19 #ifndef _COBALT_BLACKFIN_ASM_SYSCALL_H
20 #define _COBALT_BLACKFIN_ASM_SYSCALL_H
21 
22 #include <linux/errno.h>
23 #include <asm/ptrace.h>
24 #include <asm-generic/xenomai/syscall.h>
25 
26 #define __xn_reg_sys(__regs) ((__regs)->orig_p0)
27 #define __xn_syscall_p(__regs) (__xn_reg_sys(__regs) & __COBALT_SYSCALL_BIT)
28 #define __xn_syscall(__regs) (__xn_reg_sys(__regs) & ~__COBALT_SYSCALL_BIT)
29 
30 #define __xn_reg_rval(__regs) ((__regs)->r0)
31 #define __xn_reg_arg1(__regs) ((__regs)->r0)
32 #define __xn_reg_arg2(__regs) ((__regs)->r1)
33 #define __xn_reg_arg3(__regs) ((__regs)->r2)
34 #define __xn_reg_arg4(__regs) ((__regs)->r3)
35 #define __xn_reg_arg5(__regs) ((__regs)->r4)
36 
37 /*
38  * Returns the syscall number depending on the handling core. Cobalt
39  * and Linux syscall numbers can be fetched from P0, masking out the
40  * __COBALT_SYSCALL_BIT marker.
41  */
42 static inline long __xn_get_syscall_nr(struct pt_regs *regs)
43 {
44  return __xn_syscall(regs);
45 }
46 
47 static inline void __xn_error_return(struct pt_regs *regs, int v)
48 {
49  __xn_reg_rval(regs) = v;
50 }
51 
52 static inline void __xn_status_return(struct pt_regs *regs, long v)
53 {
54  __xn_reg_rval(regs) = v;
55 }
56 
57 static inline int __xn_interrupted_p(struct pt_regs *regs)
58 {
59  return __xn_reg_rval(regs) == -EINTR;
60 }
61 
62 int xnarch_local_syscall(unsigned long a1, unsigned long a2,
63  unsigned long a3, unsigned long a4,
64  unsigned long a5);
65 
66 #endif /* !_COBALT_BLACKFIN_ASM_SYSCALL_H */