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