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