]> git.saurik.com Git - apple/xnu.git/blame - osfmk/kern/kmod.c
xnu-6153.61.1.tar.gz
[apple/xnu.git] / osfmk / kern / kmod.c
CommitLineData
1c79356b 1/*
cb323159 2 * Copyright (c) 2000-2019 Apple Inc. All rights reserved.
1c79356b 3 *
2d21ac55 4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
0a7de745 5 *
2d21ac55
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 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.
0a7de745 14 *
2d21ac55
A
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
0a7de745 17 *
2d21ac55
A
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
8f6c56a5
A
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
2d21ac55
A
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.
0a7de745 25 *
2d21ac55
A
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
27 */
28/*
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,
32 * Version 2.0.
1c79356b
A
33 */
34/*
0a7de745 35 * Copyright (c) 1999 Apple Inc. All rights reserved.
1c79356b
A
36 *
37 * HISTORY
38 *
39 * 1999 Mar 29 rsulack created.
40 */
41
42#include <mach/mach_types.h>
43#include <mach/vm_types.h>
44#include <mach/kern_return.h>
91447636
A
45#include <mach/host_priv_server.h>
46#include <mach/vm_map.h>
47
1c79356b 48#include <kern/kern_types.h>
1c79356b 49#include <kern/thread.h>
91447636
A
50
51#include <vm/vm_kern.h>
52
b0d623f7
A
53#include <libkern/kernel_mach_header.h>
54
55/*********************************************************************
0a7de745
A
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.
64 *
65 * Some kernel-internal portions have been moved to
66 * libkern/OSKextLib.cpp and libkern/c++/OSKext.cpp.
67 **********************************************************************/
b0d623f7
A
68
69// bsd/sys/proc.h
70extern void proc_selfname(char * buf, int size);
71
72#define NOT_SUPPORTED_USER64() \
73 do { \
0a7de745
A
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); \
b0d623f7
A
78 } while (0)
79
80#define NOT_SUPPORTED_KERNEL() \
81 do { \
0a7de745
A
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); \
b0d623f7
A
86 } while (0)
87
b0d623f7 88#define KMOD_MIG_UNUSED __unused
2d21ac55 89
1c79356b 90
b0d623f7 91/*********************************************************************
0a7de745
A
92 * Old MIG routines that are no longer supported.
93 **********************************************************************
94 * We have to keep these around for ppc, i386, and x86_64. A 32-bit
95 * user-space client might call into the 64-bit kernel. Only
96 * kmod_get_info() retains a functional implementation (ppc/i386).
97 **********************************************************************/
1c79356b 98kern_return_t
b0d623f7 99kmod_create(
0a7de745
A
100 host_priv_t host_priv __unused,
101 vm_address_t addr __unused,
102 kmod_t * id __unused)
1c79356b 103{
0a7de745
A
104 NOT_SUPPORTED_KERNEL();
105 return KERN_NOT_SUPPORTED;
1c79356b
A
106}
107
b0d623f7 108/********************************************************************/
1c79356b 109kern_return_t
b0d623f7 110kmod_destroy(
0a7de745
A
111 host_priv_t host_priv __unused,
112 kmod_t id __unused)
1c79356b 113{
0a7de745
A
114 NOT_SUPPORTED_KERNEL();
115 return KERN_NOT_SUPPORTED;
1c79356b
A
116}
117
b0d623f7 118/********************************************************************/
1c79356b 119kern_return_t
b0d623f7 120kmod_control(
0a7de745
A
121 host_priv_t host_priv __unused,
122 kmod_t id __unused,
123 kmod_control_flavor_t flavor __unused,
124 kmod_args_t * data __unused,
125 mach_msg_type_number_t * dataCount __unused)
1c79356b 126{
0a7de745
A
127 NOT_SUPPORTED_KERNEL();
128 return KERN_NOT_SUPPORTED;
cb323159 129}
1c79356b 130
b0d623f7 131/********************************************************************/
1c79356b 132kern_return_t
b0d623f7 133kmod_get_info(
0a7de745
A
134 host_t host __unused,
135 kmod_info_array_t * kmod_list KMOD_MIG_UNUSED,
136 mach_msg_type_number_t * kmodCount KMOD_MIG_UNUSED);
1c79356b 137kern_return_t
b0d623f7 138kmod_get_info(
0a7de745
A
139 host_t host __unused,
140 kmod_info_array_t * kmod_list KMOD_MIG_UNUSED,
141 mach_msg_type_number_t * kmodCount KMOD_MIG_UNUSED)
1c79356b 142{
0a7de745
A
143 NOT_SUPPORTED_KERNEL();
144 return KERN_NOT_SUPPORTED;
91447636 145}