]>
git.saurik.com Git - apple/xnu.git/blob - osfmk/mach/i386/syscall_sw.h
2 * Copyright (c) 2000-2004 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
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.
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
14 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
15 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
17 * License for the specific language governing rights and limitations
20 * @APPLE_LICENSE_HEADER_END@
26 * Mach Operating System
27 * Copyright (c) 1991,1990,1989,1988 Carnegie Mellon University
28 * All Rights Reserved.
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.
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.
40 * Carnegie Mellon requests users of this software to return to
42 * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU
43 * School of Computer Science
44 * Carnegie Mellon University
45 * Pittsburgh PA 15213-3890
47 * any improvements or extensions that they make and grant Carnegie Mellon
48 * the rights to redistribute these changes.
55 #ifndef _MACH_I386_SYSCALL_SW_H_
56 #define _MACH_I386_SYSCALL_SW_H_
58 #include <architecture/i386/asm_help.h>
62 * Software interrupt codes for 32-bit system call entry:
66 #define MACHDEP_INT 0x82
71 * Syscall entry macros for use in libc:
72 * [Note that the nop padding is temporary during 4/4 transition.]
74 #define SYSENTER_PAD nop;nop;
75 #define SYSCALL_PAD nop;nop;nop;nop;nop;
76 #define UNIX_SYSCALL_TRAP \
79 #define MACHDEP_SYSCALL_TRAP \
84 * Macro to generate Mach call stubs in libc:
86 #define kernel_trap(trap_name,trap_number,number_args) \
87 LEAF(_##trap_name,0) ;\
88 movl $##trap_number,%eax ;\
93 #endif /* defined(__i386__) */
95 #if defined(__x86_64__)
99 #define UNIX_SYSCALL_TRAP \
101 #define MACHDEP_SYSCALL_TRAP \
105 * Macro to generate Mach call stubs in Libc.
106 * Existing calls use negative numbers for Mach traps, so
107 * until we change those and change the 32-bit kernel_trap
108 * macro above, we negate those numbers here for the 64-bit
111 #define kernel_trap(trap_name,trap_number,number_args) \
112 LEAF(_##trap_name,0) ;\
114 movl $ SYSCALL_CONSTRUCT_MACH(-##trap_number), %eax ;\
119 #endif /* defined(__x86_64__) */
122 * Syscall classes for 64-bit system call entry.
123 * For 64-bit users, the 32-bit syscall number is partitioned
124 * with the high-order bits representing the class and low-order
125 * bits being the syscall number within that class.
126 * The high-order 32-bits of the 64-bit syscall number are unused.
127 * All system classes enter the kernel via the syscall instruction.
129 * These are not #ifdef'd for x86-64 because they might be used for
130 * 32-bit someday and so the 64-bit comm page in a 32-bit kernel
133 #define SYSCALL_CLASS_SHIFT 24
134 #define SYSCALL_CLASS_MASK (0xFF << SYSCALL_CLASS_SHIFT)
135 #define SYSCALL_NUMBER_MASK (~SYSCALL_CLASS_MASK)
137 #define SYSCALL_CLASS_NONE 0 /* Invalid */
138 #define SYSCALL_CLASS_MACH 1 /* Mach */
139 #define SYSCALL_CLASS_UNIX 2 /* Unix/BSD */
140 #define SYSCALL_CLASS_MDEP 3 /* Machine-dependent */
141 #define SYSCALL_CLASS_DIAG 4 /* Diagnostics */
143 /* Macros to simpllfy constructing syscall numbers. */
144 #define SYSCALL_CONSTRUCT_MACH(syscall_number) \
145 ((SYSCALL_CLASS_MACH << SYSCALL_CLASS_SHIFT) | \
146 (SYSCALL_NUMBER_MASK & (syscall_number)))
147 #define SYSCALL_CONSTRUCT_UNIX(syscall_number) \
148 ((SYSCALL_CLASS_UNIX << SYSCALL_CLASS_SHIFT) | \
149 (SYSCALL_NUMBER_MASK & (syscall_number)))
150 #define SYSCALL_CONSTRUCT_MDEP(syscall_number) \
151 ((SYSCALL_CLASS_MDEP << SYSCALL_CLASS_SHIFT) | \
152 (SYSCALL_NUMBER_MASK & (syscall_number)))
153 #define SYSCALL_CONSTRUCT_DIAG(syscall_number) \
154 ((SYSCALL_CLASS_DIAG << SYSCALL_CLASS_SHIFT) | \
155 (SYSCALL_NUMBER_MASK & (syscall_number)))
157 #endif /* _MACH_I386_SYSCALL_SW_H_ */