]> git.saurik.com Git - apple/libc.git/blob - ppc/sys/SYS.h
Libc-262.3.2.tar.gz
[apple/libc.git] / ppc / sys / SYS.h
1 /*
2 * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
7 *
8 * This file contains Original Code and/or Modifications of Original Code
9 * as defined in and that are subject to the Apple Public Source License
10 * Version 2.0 (the 'License'). You may not use this file except in
11 * compliance with the License. Please obtain a copy of the License at
12 * http://www.opensource.apple.com/apsl/ and read it before using this
13 * file.
14 *
15 * The Original Code and all software distributed under the License are
16 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
17 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
18 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
20 * Please see the License for the specific language governing rights and
21 * limitations under the License.
22 *
23 * @APPLE_LICENSE_HEADER_END@
24 */
25 /* Copyright (c) 1992 NeXT Computer, Inc. All rights reserved.
26 *
27 * File: SYS.h
28 *
29 * Definition of the user side of the UNIX system call interface
30 * for M98K.
31 *
32 * Errors are flagged by the location of the trap return (ie., which
33 * instruction is executed upon rfi):
34 *
35 * SC PC + 4: Error (typically branch to cerror())
36 * SC PC + 8: Success
37 *
38 * HISTORY
39 * 18-Nov-92 Ben Fathi (benf@next.com)
40 * Ported to m98k.
41 *
42 * 9-Jan-92 Peter King (king@next.com)
43 * Created.
44 */
45
46 #define KERNEL_PRIVATE 1
47 /*
48 * Header files.
49 */
50 #import <architecture/ppc/asm_help.h>
51 #import <architecture/ppc/pseudo_inst.h>
52 #import <mach/ppc/exception.h>
53 #import <sys/syscall.h>
54
55 /* From rhapsody kernel mach/ppc/syscall_sw.h */
56 #define kernel_trap_args_0
57 #define kernel_trap_args_1
58 #define kernel_trap_args_2
59 #define kernel_trap_args_3
60 #define kernel_trap_args_4
61 #define kernel_trap_args_5
62 #define kernel_trap_args_6
63 #define kernel_trap_args_7
64
65 /*
66 * simple_kernel_trap -- Mach system calls with 8 or less args
67 * Args are passed in a0 - a7, system call number in r0.
68 * Do a "sc" instruction to enter kernel.
69 */
70 #define simple_kernel_trap(trap_name, trap_number) \
71 .globl _##trap_name @\
72 _##trap_name: @\
73 li r0,trap_number @\
74 sc @\
75 blr @\
76 END(trap_name)
77
78 #define kernel_trap_0(trap_name,trap_number) \
79 simple_kernel_trap(trap_name,trap_number)
80
81 #define kernel_trap_1(trap_name,trap_number) \
82 simple_kernel_trap(trap_name,trap_number)
83
84 #define kernel_trap_2(trap_name,trap_number) \
85 simple_kernel_trap(trap_name,trap_number)
86
87 #define kernel_trap_3(trap_name,trap_number) \
88 simple_kernel_trap(trap_name,trap_number)
89
90 #define kernel_trap_4(trap_name,trap_number) \
91 simple_kernel_trap(trap_name,trap_number)
92
93 #define kernel_trap_5(trap_name,trap_number) \
94 simple_kernel_trap(trap_name,trap_number)
95
96 #define kernel_trap_6(trap_name,trap_number) \
97 simple_kernel_trap(trap_name,trap_number)
98
99 #define kernel_trap_7(trap_name,trap_number) \
100 simple_kernel_trap(trap_name,trap_number)
101
102 #define kernel_trap_8(trap_name,trap_number) \
103 simple_kernel_trap(trap_name,trap_number)
104
105 #define kernel_trap_9(trap_name,trap_number) \
106 simple_kernel_trap(trap_name,trap_number)
107
108 /* End of rhapsody kernel mach/ppc/syscall_sw.h */
109
110 /*
111 * Macros.
112 */
113
114 #define SYSCALL(name, nargs) \
115 .globl cerror @\
116 LEAF(_##name) @\
117 kernel_trap_args_##nargs @\
118 li r0,SYS_##name @\
119 sc @\
120 b 1f @\
121 b 2f @\
122 1: BRANCH_EXTERN(cerror) @\
123 .text \
124 2: nop
125
126 #define SYSCALL_NONAME(name, nargs) \
127 .globl cerror @\
128 kernel_trap_args_##nargs @\
129 li r0,SYS_##name @\
130 sc @\
131 b 1f @\
132 b 2f @\
133 1: BRANCH_EXTERN(cerror) @\
134 .text \
135 2: nop
136
137 #define PSEUDO(pseudo, name, nargs) \
138 LEAF(_##pseudo) @\
139 SYSCALL_NONAME(name, nargs)
140
141
142 #undef END
143 #import <mach/ppc/syscall_sw.h>
144
145 #if !defined(SYS_getdirentriesattr)
146 #define SYS_getdirentriesattr 222
147 #endif
148
149 #if !defined(SYS_semsys)
150 #define SYS_semsys 251
151 #define SYS_msgsys 252
152 #define SYS_shmsys 253
153 #define SYS_semctl 254
154 #define SYS_semget 255
155 #define SYS_semop 256
156 #define SYS_semconfig 257
157 #define SYS_msgctl 258
158 #define SYS_msgget 259
159 #define SYS_msgsnd 260
160 #define SYS_msgrcv 261
161 #define SYS_shmat 262
162 #define SYS_shmctl 263
163 #define SYS_shmdt 264
164 #define SYS_shmget 265
165 #endif
166