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