2 * Copyright (c) 2000-2008 Apple Inc. All rights reserved.
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
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.
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
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
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
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.
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
29 * NOTICE: This file was modified by McAfee Research in 2004 to introduce
30 * support for mandatory and extensible security protections. This notice
31 * is included in support of clause 2.2 (b) of the Apple Public License,
35 * Copyright (c) 1999 Apple Inc. All rights reserved.
39 * 1999 Mar 29 rsulack created.
42 #include <mach/mach_types.h>
43 #include <mach/vm_types.h>
44 #include <mach/kern_return.h>
45 #include <mach/host_priv_server.h>
46 #include <mach/vm_map.h>
48 #include <kern/kern_types.h>
49 #include <kern/thread.h>
51 #include <vm/vm_kern.h>
53 #include <libkern/kernel_mach_header.h>
55 /*********************************************************************
56 **********************************************************************
57 *** KMOD INTERFACE DEPRECATED AS OF SNOWLEOPARD ***
58 **********************************************************************
59 **********************************************************************
60 * Except for kmod_get_info(), which continues to work for K32 with
61 * 32-bit clients, all remaining functions in this module remain
62 * for symbol linkage or MIG support only,
63 * and return KERN_NOT_SUPPORTED.
65 * Some kernel-internal portions have been moved to
66 * libkern/OSKextLib.cpp and libkern/c++/OSKext.cpp.
67 **********************************************************************/
70 extern void proc_selfname(char * buf
, int size
);
72 #define NOT_SUPPORTED_USER64() \
74 char procname[64] = "unknown"; \
75 proc_selfname(procname, sizeof(procname)); \
76 printf("%s is not supported for 64-bit clients (called from %s)\n", \
77 __FUNCTION__, procname); \
80 #define NOT_SUPPORTED_KERNEL() \
82 char procname[64] = "unknown"; \
83 proc_selfname(procname, sizeof(procname)); \
84 printf("%s is not supported on this kernel architecture (called from %s)\n", \
85 __FUNCTION__, procname); \
88 #if __ppc__ || __i386__
89 // in libkern/OSKextLib.cpp
90 extern kern_return_t
kext_get_kmod_info(
91 kmod_info_array_t
* kmod_list
,
92 mach_msg_type_number_t
* kmodCount
);
93 #define KMOD_MIG_UNUSED
95 #define KMOD_MIG_UNUSED __unused
96 #endif /* __ppc__ || __i386__ */
99 /*********************************************************************
100 * Old MIG routines that are no longer supported.
101 **********************************************************************
102 * We have to keep these around for ppc, i386, and x86_64. A 32-bit
103 * user-space client might call into the 64-bit kernel. Only
104 * kmod_get_info() retains a functional implementation (ppc/i386).
105 **********************************************************************/
108 host_priv_t host_priv __unused
,
109 vm_address_t addr __unused
,
110 kmod_t
* id __unused
)
112 NOT_SUPPORTED_KERNEL();
113 return KERN_NOT_SUPPORTED
;
116 /********************************************************************/
119 host_priv_t host_priv __unused
,
122 NOT_SUPPORTED_KERNEL();
123 return KERN_NOT_SUPPORTED
;
126 /********************************************************************/
129 host_priv_t host_priv __unused
,
131 kmod_control_flavor_t flavor __unused
,
132 kmod_args_t
* data __unused
,
133 mach_msg_type_number_t
* dataCount __unused
)
135 NOT_SUPPORTED_KERNEL();
136 return KERN_NOT_SUPPORTED
;
139 /********************************************************************/
142 host_t host __unused
,
143 kmod_info_array_t
* kmod_list KMOD_MIG_UNUSED
,
144 mach_msg_type_number_t
* kmodCount KMOD_MIG_UNUSED
);
147 host_t host __unused
,
148 kmod_info_array_t
* kmod_list KMOD_MIG_UNUSED
,
149 mach_msg_type_number_t
* kmodCount KMOD_MIG_UNUSED
)
151 #if __ppc__ || __i386__
152 if (current_task() != kernel_task
&& task_has_64BitAddr(current_task())) {
153 NOT_SUPPORTED_USER64();
154 return KERN_NOT_SUPPORTED
;
156 return kext_get_kmod_info(kmod_list
, kmodCount
);
158 NOT_SUPPORTED_KERNEL();
159 return KERN_NOT_SUPPORTED
;
160 #endif /* __ppc__ || __i386__ */