]> git.saurik.com Git - apple/xnu.git/blame - osfmk/kern/syscall_sw.c
xnu-1228.15.4.tar.gz
[apple/xnu.git] / osfmk / kern / syscall_sw.c
CommitLineData
1c79356b 1/*
0c530ab8 2 * Copyright (c) 2000-2005 Apple Computer, Inc. All rights reserved.
1c79356b 3 *
2d21ac55 4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
1c79356b 5 *
2d21ac55
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. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
8f6c56a5 14 *
2d21ac55
A
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
17 *
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
8f6c56a5
A
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
2d21ac55
A
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
8f6c56a5 25 *
2d21ac55 26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
1c79356b
A
27 */
28/*
29 * @OSF_COPYRIGHT@
30 */
31/*
32 * Mach Operating System
33 * Copyright (c) 1991,1990,1989,1988,1987 Carnegie Mellon University
34 * All Rights Reserved.
35 *
36 * Permission to use, copy, modify and distribute this software and its
37 * documentation is hereby granted, provided that both the copyright
38 * notice and this permission notice appear in all copies of the
39 * software, derivative works or modified versions, and any portions
40 * thereof, and that both notices appear in supporting documentation.
41 *
42 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
43 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
44 * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
45 *
46 * Carnegie Mellon requests users of this software to return to
47 *
48 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
49 * School of Computer Science
50 * Carnegie Mellon University
51 * Pittsburgh PA 15213-3890
52 *
53 * any improvements or extensions that they make and grant Carnegie Mellon
54 * the rights to redistribute these changes.
55 */
56/*
57 */
58
59#include <mach/mach_types.h>
91447636 60#include <mach/mach_traps.h>
1c79356b
A
61
62#include <kern/syscall_sw.h>
63
64/* Forwards */
91447636 65
1c79356b
A
66
67/*
68 * To add a new entry:
69 * Add an "MACH_TRAP(routine, arg count)" to the table below.
70 *
71 * Add trap definition to mach/syscall_sw.h and
72 * recompile user library.
73 *
74 * WARNING: If you add a trap which requires more than 7
75 * parameters, mach/{machine}/syscall_sw.h and {machine}/trap.c
76 * and/or {machine}/locore.s may need to be modified for it
77 * to work successfully.
78 *
79 * WARNING: Don't use numbers 0 through -9. They (along with
80 * the positive numbers) are reserved for Unix.
81 */
82
83int kern_invalid_debug = 0;
84
85/* Include declarations of the trap functions. */
86
87#include <mach/mach_traps.h>
88#include <mach/mach_syscalls.h>
89#include <kern/syscall_subr.h>
90
91#include <kern/clock.h>
92#include <mach/mk_timer.h>
93
55e303ae 94mach_trap_t mach_trap_table[MACH_TRAP_TABLE_COUNT] = {
91447636
A
95/* 0 */ MACH_TRAP(kern_invalid, 0, NULL, NULL),
96/* 1 */ MACH_TRAP(kern_invalid, 0, NULL, NULL),
97/* 2 */ MACH_TRAP(kern_invalid, 0, NULL, NULL),
98/* 3 */ MACH_TRAP(kern_invalid, 0, NULL, NULL),
99/* 4 */ MACH_TRAP(kern_invalid, 0, NULL, NULL),
100/* 5 */ MACH_TRAP(kern_invalid, 0, NULL, NULL),
101/* 6 */ MACH_TRAP(kern_invalid, 0, NULL, NULL),
102/* 7 */ MACH_TRAP(kern_invalid, 0, NULL, NULL),
103/* 8 */ MACH_TRAP(kern_invalid, 0, NULL, NULL),
104/* 9 */ MACH_TRAP(kern_invalid, 0, NULL, NULL),
105/* 10 */ MACH_TRAP(kern_invalid, 0, NULL, NULL),
106/* 11 */ MACH_TRAP(kern_invalid, 0, NULL, NULL),
107/* 12 */ MACH_TRAP(kern_invalid, 0, NULL, NULL),
108/* 13 */ MACH_TRAP(kern_invalid, 0, NULL, NULL),
109/* 14 */ MACH_TRAP(kern_invalid, 0, NULL, NULL),
110/* 15 */ MACH_TRAP(kern_invalid, 0, NULL, NULL),
111/* 16 */ MACH_TRAP(kern_invalid, 0, NULL, NULL),
112/* 17 */ MACH_TRAP(kern_invalid, 0, NULL, NULL),
113/* 18 */ MACH_TRAP(kern_invalid, 0, NULL, NULL),
114/* 19 */ MACH_TRAP(kern_invalid, 0, NULL, NULL),
115/* 20 */ MACH_TRAP(kern_invalid, 0, NULL, NULL),
116/* 21 */ MACH_TRAP(kern_invalid, 0, NULL, NULL),
117/* 22 */ MACH_TRAP(kern_invalid, 0, NULL, NULL),
118/* 23 */ MACH_TRAP(kern_invalid, 0, NULL, NULL),
119/* 24 */ MACH_TRAP(kern_invalid, 0, NULL, NULL),
120/* 25 */ MACH_TRAP(kern_invalid, 0, NULL, NULL),
121/* 26 */ MACH_TRAP(mach_reply_port, 0, NULL, NULL),
122/* 27 */ MACH_TRAP(thread_self_trap, 0, NULL, NULL),
123/* 28 */ MACH_TRAP(task_self_trap, 0, NULL, NULL),
124/* 29 */ MACH_TRAP(host_self_trap, 0, NULL, NULL),
125/* 30 */ MACH_TRAP(kern_invalid, 0, NULL, NULL),
126/* 31 */ MACH_TRAP(mach_msg_trap, 7, munge_wwwwwww, munge_ddddddd),
127/* 32 */ MACH_TRAP(mach_msg_overwrite_trap, 8, munge_wwwwwwww, munge_dddddddd),
128/* 33 */ MACH_TRAP(semaphore_signal_trap, 1, munge_w, munge_d),
129/* 34 */ MACH_TRAP(semaphore_signal_all_trap, 1, munge_w, munge_d),
130/* 35 */ MACH_TRAP(semaphore_signal_thread_trap, 2, munge_ww, munge_dd),
131/* 36 */ MACH_TRAP(semaphore_wait_trap, 1, munge_w, munge_d),
132/* 37 */ MACH_TRAP(semaphore_wait_signal_trap, 2, munge_ww, munge_dd),
133/* 38 */ MACH_TRAP(semaphore_timedwait_trap, 3, munge_www, munge_ddd),
134/* 39 */ MACH_TRAP(semaphore_timedwait_signal_trap, 4, munge_wwww, munge_dddd),
135/* 40 */ MACH_TRAP(kern_invalid, 0, NULL, NULL),
136/* 41 */ MACH_TRAP(init_process, 0, NULL, NULL),
137/* 42 */ MACH_TRAP(kern_invalid, 0, NULL, NULL),
138/* 43 */ MACH_TRAP(map_fd, 5, munge_wwwww, munge_ddddd),
0c530ab8 139/* 44 */ MACH_TRAP(task_name_for_pid, 3, munge_www, munge_ddd),
91447636
A
140/* 45 */ MACH_TRAP(task_for_pid, 3, munge_www, munge_ddd),
141/* 46 */ MACH_TRAP(pid_for_task, 2, munge_ww,munge_dd),
142/* 47 */ MACH_TRAP(kern_invalid, 0, NULL, NULL),
143/* 48 */ MACH_TRAP(macx_swapon, 4, munge_wwww, munge_dddd),
144/* 49 */ MACH_TRAP(macx_swapoff, 2, munge_ww, munge_dd),
145/* 50 */ MACH_TRAP(kern_invalid, 0, NULL, NULL),
146/* 51 */ MACH_TRAP(macx_triggers, 4, munge_wwww, munge_dddd),
147/* 52 */ MACH_TRAP(macx_backing_store_suspend, 1, munge_w, munge_d),
148/* 53 */ MACH_TRAP(macx_backing_store_recovery, 1, munge_w, munge_d),
149/* 54 */ MACH_TRAP(kern_invalid, 0, NULL, NULL),
150/* 55 */ MACH_TRAP(kern_invalid, 0, NULL, NULL),
151/* 56 */ MACH_TRAP(kern_invalid, 0, NULL, NULL),
152/* 57 */ MACH_TRAP(kern_invalid, 0, NULL, NULL),
153/* 58 */ MACH_TRAP(kern_invalid, 0, NULL, NULL),
154/* 59 */ MACH_TRAP(swtch_pri, 0, NULL, NULL),
155/* 60 */ MACH_TRAP(swtch, 0, NULL, NULL),
156/* 61 */ MACH_TRAP(thread_switch, 3, munge_www, munge_ddd),
157/* 62 */ MACH_TRAP(clock_sleep_trap, 5, munge_wwwww, munge_ddddd),
158/* 63 */ MACH_TRAP(kern_invalid, 0, NULL, NULL),
1c79356b 159/* traps 64 - 95 reserved (debo) */
91447636
A
160/* 64 */ MACH_TRAP(kern_invalid, 0, NULL, NULL),
161/* 65 */ MACH_TRAP(kern_invalid, 0, NULL, NULL),
162/* 66 */ MACH_TRAP(kern_invalid, 0, NULL, NULL),
163/* 67 */ MACH_TRAP(kern_invalid, 0, NULL, NULL),
164/* 68 */ MACH_TRAP(kern_invalid, 0, NULL, NULL),
165/* 69 */ MACH_TRAP(kern_invalid, 0, NULL, NULL),
166/* 70 */ MACH_TRAP(kern_invalid, 0, NULL, NULL),
167/* 71 */ MACH_TRAP(kern_invalid, 0, NULL, NULL),
168/* 72 */ MACH_TRAP(kern_invalid, 0, NULL, NULL),
169/* 73 */ MACH_TRAP(kern_invalid, 0, NULL, NULL),
170/* 74 */ MACH_TRAP(kern_invalid, 0, NULL, NULL),
171/* 75 */ MACH_TRAP(kern_invalid, 0, NULL, NULL),
172/* 76 */ MACH_TRAP(kern_invalid, 0, NULL, NULL),
173/* 77 */ MACH_TRAP(kern_invalid, 0, NULL, NULL),
174/* 78 */ MACH_TRAP(kern_invalid, 0, NULL, NULL),
175/* 79 */ MACH_TRAP(kern_invalid, 0, NULL, NULL),
176/* 80 */ MACH_TRAP(kern_invalid, 0, NULL, NULL),
177/* 81 */ MACH_TRAP(kern_invalid, 0, NULL, NULL),
178/* 82 */ MACH_TRAP(kern_invalid, 0, NULL, NULL),
179/* 83 */ MACH_TRAP(kern_invalid, 0, NULL, NULL),
180/* 84 */ MACH_TRAP(kern_invalid, 0, NULL, NULL),
181/* 85 */ MACH_TRAP(kern_invalid, 0, NULL, NULL),
182/* 86 */ MACH_TRAP(kern_invalid, 0, NULL, NULL),
183/* 87 */ MACH_TRAP(kern_invalid, 0, NULL, NULL),
184/* 88 */ MACH_TRAP(kern_invalid, 0, NULL, NULL),
185/* 89 */ MACH_TRAP(mach_timebase_info_trap, 1, munge_w, munge_d),
186/* 90 */ MACH_TRAP(mach_wait_until_trap, 2, munge_l, munge_d),
187/* 91 */ MACH_TRAP(mk_timer_create_trap, 0, NULL, NULL),
188/* 92 */ MACH_TRAP(mk_timer_destroy_trap, 1, munge_w, munge_d),
189/* 93 */ MACH_TRAP(mk_timer_arm_trap, 3, munge_wl, munge_dd),
190/* 94 */ MACH_TRAP(mk_timer_cancel_trap, 2, munge_ww, munge_dd),
0c530ab8 191/* 95 */ MACH_TRAP(kern_invalid, 0, NULL, NULL),
1c79356b 192/* traps 64 - 95 reserved (debo) */
91447636
A
193/* 96 */ MACH_TRAP(kern_invalid, 0, NULL, NULL),
194/* 97 */ MACH_TRAP(kern_invalid, 0, NULL, NULL),
195/* 98 */ MACH_TRAP(kern_invalid, 0, NULL, NULL),
196/* 99 */ MACH_TRAP(kern_invalid, 0, NULL, NULL),
1c79356b 197/* traps 100-107 reserved for iokit (esb) */
91447636
A
198/* 100 */ MACH_TRAP(iokit_user_client_trap, 8, munge_wwwwwwww, munge_dddddddd),
199/* 101 */ MACH_TRAP(kern_invalid, 0, NULL, NULL),
200/* 102 */ MACH_TRAP(kern_invalid, 0, NULL, NULL),
201/* 103 */ MACH_TRAP(kern_invalid, 0, NULL, NULL),
202/* 104 */ MACH_TRAP(kern_invalid, 0, NULL, NULL),
203/* 105 */ MACH_TRAP(kern_invalid, 0, NULL, NULL),
204/* 106 */ MACH_TRAP(kern_invalid, 0, NULL, NULL),
205/* 107 */ MACH_TRAP(kern_invalid, 0, NULL, NULL),
206/* traps 108-127 unused */
207/* 108 */ MACH_TRAP(kern_invalid, 0, NULL, NULL),
208/* 109 */ MACH_TRAP(kern_invalid, 0, NULL, NULL),
209/* 110 */ MACH_TRAP(kern_invalid, 0, NULL, NULL),
210/* 111 */ MACH_TRAP(kern_invalid, 0, NULL, NULL),
211/* 112 */ MACH_TRAP(kern_invalid, 0, NULL, NULL),
212/* 113 */ MACH_TRAP(kern_invalid, 0, NULL, NULL),
213/* 114 */ MACH_TRAP(kern_invalid, 0, NULL, NULL),
214/* 115 */ MACH_TRAP(kern_invalid, 0, NULL, NULL),
215/* 116 */ MACH_TRAP(kern_invalid, 0, NULL, NULL),
216/* 117 */ MACH_TRAP(kern_invalid, 0, NULL, NULL),
217/* 118 */ MACH_TRAP(kern_invalid, 0, NULL, NULL),
218/* 119 */ MACH_TRAP(kern_invalid, 0, NULL, NULL),
219/* 120 */ MACH_TRAP(kern_invalid, 0, NULL, NULL),
220/* 121 */ MACH_TRAP(kern_invalid, 0, NULL, NULL),
221/* 122 */ MACH_TRAP(kern_invalid, 0, NULL, NULL),
222/* 123 */ MACH_TRAP(kern_invalid, 0, NULL, NULL),
223/* 124 */ MACH_TRAP(kern_invalid, 0, NULL, NULL),
224/* 125 */ MACH_TRAP(kern_invalid, 0, NULL, NULL),
225/* 126 */ MACH_TRAP(kern_invalid, 0, NULL, NULL),
226/* 127 */ MACH_TRAP(kern_invalid, 0, NULL, NULL),
1c79356b
A
227};
228
229int mach_trap_count = (sizeof(mach_trap_table) / sizeof(mach_trap_table[0]));
230
1c79356b 231kern_return_t
91447636
A
232kern_invalid(
233 __unused struct kern_invalid_args *args)
1c79356b
A
234{
235 if (kern_invalid_debug) Debugger("kern_invalid mach trap");
236 return(KERN_INVALID_ARGUMENT);
237}
238