|
|
1.1 root 1: /*
2: * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
3: *
4: * @APPLE_LICENSE_HEADER_START@
5: *
6: * Portions Copyright (c) 1999 Apple Computer, Inc. All Rights
7: * Reserved. This file contains Original Code and/or Modifications of
8: * Original Code as defined in and that are subject to the Apple Public
9: * Source License Version 1.1 (the "License"). You may not use this file
10: * except in compliance with the License. Please obtain a copy of the
11: * License at http://www.apple.com/publicsource and read it before using
12: * this file.
13: *
14: * The Original Code and all software distributed under the License are
15: * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
16: * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
17: * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
18: * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
19: * License for the specific language governing rights and limitations
20: * under the License.
21: *
22: * @APPLE_LICENSE_HEADER_END@
23: */
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 [email protected]
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: * HISTORY
52: */
53:
54: #include <mach_ipc_compat.h>
55:
56: #include <mach/port.h>
57: #include <mach/kern_return.h>
58: #include <kern/syscall_sw.h>
59:
60: /* Include declarations of the trap functions. */
61: #include <mach/mach_traps.h>
62: #include <mach/message.h>
63: #include <kern/syscall_subr.h>
64: #include <kern/time_stamp.h>
65:
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/ca/syscall_sw.h and ca/trap.c both need
76: * to be modified for it to work successfully on an
77: * RT. Similarly, mach/mips/syscall_sw.h and mips/locore.s
78: * need to be modified before it will work on Pmaxen.
79: *
80: * WARNING: Don't use numbers 0 through -9. They (along with
81: * the positive numbers) are reserved for Unix.
82: */
83:
84: mach_port_t null_port()
85: {
86: return(MACH_PORT_NULL);
87: }
88:
89: kern_return_t kern_invalid()
90: {
91: return(KERN_INVALID_ARGUMENT);
92: }
93:
94:
95:
96: #import <driverkit.h>
97:
98: #if !DRIVERKIT
99: #define device_master_self kern_invalid
100: #endif
101:
102: mach_trap_t mach_trap_table[] = {
103: MACH_TRAP(kern_invalid, 0), /* 0 */ /* Unix */
104: MACH_TRAP(kern_invalid, 0), /* 1 */ /* Unix */
105: MACH_TRAP(kern_invalid, 0), /* 2 */ /* Unix */
106: MACH_TRAP(kern_invalid, 0), /* 3 */ /* Unix */
107: MACH_TRAP(kern_invalid, 0), /* 4 */ /* Unix */
108: MACH_TRAP(kern_invalid, 0), /* 5 */ /* Unix */
109: MACH_TRAP(kern_invalid, 0), /* 6 */ /* Unix */
110: MACH_TRAP(kern_invalid, 0), /* 7 */ /* Unix */
111: MACH_TRAP(kern_invalid, 0), /* 8 */ /* Unix */
112: MACH_TRAP(kern_invalid, 0), /* 9 */ /* Unix */
113:
114: #if MACH_IPC_COMPAT
115: MACH_TRAP(task_self, 0), /* 10 */ /* obsolete */
116: MACH_TRAP(thread_reply, 0), /* 11 */ /* obsolete */
117: MACH_TRAP(task_notify, 0), /* 12 */ /* obsolete */
118: MACH_TRAP(thread_self, 0), /* 13 */ /* obsolete */
119: #else /* MACH_IPC_COMPAT */
120: MACH_TRAP(null_port, 0), /* 10 */
121: MACH_TRAP(null_port, 0), /* 11 */
122: MACH_TRAP(null_port, 0), /* 12 */
123: MACH_TRAP(null_port, 0), /* 13 */
124: #endif /* MACH_IPC_COMPAT */
125: MACH_TRAP(kern_invalid, 0), /* 14 */
126: MACH_TRAP(kern_invalid, 0), /* 15 */
127: MACH_TRAP(kern_invalid, 0), /* 16 */
128: MACH_TRAP(kern_invalid, 0), /* 17 */
129: MACH_TRAP(kern_invalid, 0), /* 18 */
130: MACH_TRAP(kern_invalid, 0), /* 19 */
131:
132: #if MACH_IPC_COMPAT
133: MACH_TRAP_STACK(msg_send_trap, 4), /* 20 */ /* obsolete */
134: MACH_TRAP_STACK(msg_receive_trap, 5), /* 21 */ /* obsolete */
135: MACH_TRAP_STACK(msg_rpc_trap, 6), /* 22 */ /* obsolete */
136: #else /* MACH_IPC_COMPAT */
137: MACH_TRAP(kern_invalid, 0), /* 20 */
138: MACH_TRAP(kern_invalid, 0), /* 21 */
139: MACH_TRAP(kern_invalid, 0), /* 22 */
140: #endif /* MACH_IPC_COMPAT */
141: MACH_TRAP(kern_invalid, 0), /* 23 */
142: MACH_TRAP_STACK(mach_msg_simple_trap, 5),
143: /* 24 */
144: MACH_TRAP_STACK(mach_msg_trap, 7), /* 25 */
145: MACH_TRAP(mach_reply_port, 0), /* 26 */
146: MACH_TRAP(mach_thread_self, 0), /* 27 */
147: MACH_TRAP(mach_task_self, 0), /* 28 */
148: MACH_TRAP(mach_host_self, 0), /* 29 */
149:
150: MACH_TRAP(kern_invalid, 0), /* 30 */
151: MACH_TRAP(kern_invalid, 0), /* 31 */
152: MACH_TRAP_STACK(mach_msg_overwrite_trap, 9), /* 32 */
153: MACH_TRAP(task_by_pid, 1), /* 33 */
154: MACH_TRAP(kern_invalid, 0), /* 34 */
155: MACH_TRAP(_lookupd_port, 1), /* 35 */
156: MACH_TRAP(_lookupd_port1, 1), /* 36 */
157: MACH_TRAP(kern_invalid, 0), /* 37 */
158: MACH_TRAP(kern_invalid, 0), /* 38 */
159:
160: MACH_TRAP(kern_invalid, 0), /* 39 */
161: MACH_TRAP(mach_swapon, 4), /* 40 */
162:
163: MACH_TRAP(init_process, 0), /* 41 */
164: MACH_TRAP(kern_invalid, 0), /* 42 */
165: MACH_TRAP(map_fd, 5), /* 43 */
166: MACH_TRAP(kern_invalid, 0), /* 44 */
167: MACH_TRAP(mach_swapon, 4), /* 45 */
168: MACH_TRAP(kern_invalid, 0), /* 46 */
169: MACH_TRAP(kern_invalid, 0), /* 47 */
170: MACH_TRAP(kern_invalid, 0), /* 48 */
171: MACH_TRAP(kern_invalid, 0), /* 49 */
172:
173: MACH_TRAP(kern_invalid, 0), /* 50 */
174: MACH_TRAP(kern_timestamp, 1), /* 51 */
175: MACH_TRAP(kern_invalid, 0), /* 52 */
176: MACH_TRAP(kern_invalid, 0), /* 53 */
177: MACH_TRAP(kern_invalid, 0), /* 54 */
178: #if MACH_IPC_COMPAT
179: MACH_TRAP(host_self, 0), /* 55 */
180: MACH_TRAP(host_priv_self, 0), /* 56 */
181: #else /* MACH_IPC_COMPAT */
182: MACH_TRAP(null_port, 0), /* 55 */
183: MACH_TRAP(null_port, 0), /* 56 */
184: #endif /* MACH_IPC_COMPAT */
185: MACH_TRAP(kern_invalid, 0), /* 57 */
186: MACH_TRAP(kern_invalid, 0), /* 58 */
187: MACH_TRAP_STACK(swtch_pri, 1), /* 59 */
188:
189: MACH_TRAP_STACK(swtch, 0), /* 60 */
190: MACH_TRAP_STACK(thread_switch, 3), /* 61 */
191: MACH_TRAP(kern_invalid, 0), /* 62 */
192: MACH_TRAP(kern_invalid, 0), /* 63 */
193: MACH_TRAP(kern_invalid, 0), /* 64 */
194: MACH_TRAP(kern_invalid, 0), /* 65 */
195: MACH_TRAP(kern_invalid, 0), /* 66 */
196: MACH_TRAP(kern_invalid, 0), /* 67 */
197: MACH_TRAP(_event_port_by_tag, 1), /* 68 */
198: MACH_TRAP(device_master_self, 0), /* 69 */
199: };
200:
201: int mach_trap_count = (sizeof(mach_trap_table) / sizeof(mach_trap_table[0]));
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.