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