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