xref: /illumos-gate/usr/src/uts/sparc/ml/modstubs.S (revision 3bc69b1d22f55fce8569ab14be68200e8b5185ef)
1/*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21
22/*
23 * Copyright (c) 1990, 2010, Oracle and/or its affiliates. All rights reserved.
24 * Copyright 2016 Nexenta Systems, Inc.
25 * Copyright (c) 2017, Joyent, Inc. All rights reserved.
26 * Copyright 2022 Garrett D'Amore <garrett@damore.org>
27 */
28
29#include "assym.h"
30
31#include <sys/asm_linkage.h>
32
33/*
34 * WARNING: there is no check for forgetting to write END_MODULE,
35 * and if you do, the kernel will most likely crash.  Be careful
36 *
37 * This file assumes that all of the contributions to the data segment
38 * will be contiguous in the output file, even though they are separated
39 * by pieces of text.  This is safe for all assemblers I know of now...
40 */
41
42/*
43 * This file contains the stubs routines for modules which can be autoloaded.
44 */
45
46
47/*
48 * See the 'struct mod_modinfo' definition to see what this structure
49 * is trying to achieve here.
50 */
51/*
52 * XX64 - This still needs some repair.
53 * (a) define 'pointer alignment' and use it
54 * (b) define '.pword' or equivalent, and use it (to mean .word or .xword).
55 */
56#define	MODULE(module,namespace)		\
57	.seg	".data";			\
58module##_modname:				\
59	.ascii	#namespace;			\
60	.ascii	"/";				\
61	.asciz  #module;			\
62	.align	CPTRSIZE;			\
63	.global	module##_modinfo;		\
64	.type	module##_modinfo, #object;	\
65	.size	module##_modinfo, 16;		\
66module##_modinfo:				\
67	.word 0;				\
68	.word module##_modname;			\
69	.word 0;				\
70	.word 0;
71
72#define	END_MODULE(module)		\
73	.align 8; .word 0; .word 0	/* FIXME: .xword 0 */
74
75
76#define STUB(module, fcnname, retfcn)	\
77    STUB_COMMON(module, fcnname, mod_hold_stub, retfcn, 0)
78
79/*
80 * "weak stub", don't load on account of this call
81 */
82#define WSTUB(module, fcnname, retfcn)	\
83    STUB_COMMON(module, fcnname, retfcn, retfcn, MODS_WEAK)
84
85/*
86 * "non-unloadable stub", don't bother 'holding' module if it's already loaded
87 * since the module cannot be unloaded.
88 *
89 * User *MUST* guarantee the module is not unloadable (no _fini routine).
90 */
91#define NO_UNLOAD_STUB(module, fcnname, retfcn)	\
92    STUB_NO_UNLOADABLE(module, fcnname, retfcn, retfcn, MODS_NOUNLOAD)
93
94/*
95 * Macro for modstubbed system calls whose modules are not unloadable.
96 *
97 * System call modstubs needs special handling for the case where
98 * the modstub is a system call, because %fp comes from user frame.
99 */
100#define	SCALL_NU_STUB(module, fcnname, retfcn)	\
101    SCALL_NO_UNLOADABLE(module, fcnname, retfcn, retfcn, MODS_NOUNLOAD)
102/* "weak stub" for non-unloadable module, don't load on account of this call */
103#define NO_UNLOAD_WSTUB(module, fcnname, retfcn) \
104    STUB_NO_UNLOADABLE(module, fcnname, retfcn, retfcn, MODS_NOUNLOAD|MODS_WEAK)
105
106#define	STUB_DATA(module, fcnname, install_fcn, retfcn, weak)		\
107	.seg	".data";						\
108	.align	8;							\
109fcnname##_info:							\
110	.word	0;			/* 0 */				\
111	.word	install_fcn;		/* 4 */				\
112	.word	0;			/* 8 */				\
113	.word	module##_modinfo;	/* c */				\
114	.word	0;			/* 10 */			\
115	.word	fcnname;		/* 14 */			\
116	.word	0;			/* 18 */			\
117	.word	retfcn;			/* 1c */			\
118	.word   weak			/* 20 */
119
120/*
121 * The flag MODS_INSTALLED is stored in the stub data and is used to
122 * indicate if a module is installed and initialized.  This flag is used
123 * instead of the mod_stub_info->mods_modinfo->mod_installed flag
124 * to minimize the number of pointer de-references for each function
125 * call (and also to avoid possible TLB misses which could be induced
126 * by dereferencing these pointers.)
127 */
128
129#define STUB_COMMON(module, fcnname, install_fcn, retfcn, weak)		\
130	ENTRY_NP(fcnname);						\
131	save	%sp, -SA(MINFRAME), %sp;/* new window */		\
132	set	fcnname##_info, %l5;					\
133	ld	[%l5 + MODS_FLAG], %l1;	/* weak?? */			\
134	cmp	%l1, 0;							\
135	be,a	1f;			/* not weak */			\
136	restore;							\
137	btst	MODS_INSTALLED, %l1;	/* installed?? */		\
138 	bne,a,pt %xcc, 1f;		/* yes, do mod_hold thing */	\
139 	restore;							\
140 	ldn	[%l5 + MODS_RETFCN], %g1;				\
141	jmp	%g1;			/* no, just jump to retfcn */	\
142	restore;							\
1431:	sub	%sp, %fp, %g1;	/* get (-)size of callers stack */	\
144	save	%sp, %g1, %sp;	/* create new frame same size */	\
145	sub	%g0, %g1, %l4;  /* size of stack frame */		\
146	sethi	%hi(fcnname##_info), %l5;				\
147	b	stubs_common_code;					\
148	or	%l5, %lo(fcnname##_info), %l5;			\
149	SET_SIZE(fcnname);						\
150	STUB_DATA(module, fcnname, install_fcn, retfcn, weak)
151
152#define STUB_NO_UNLOADABLE(module, fcnname, install_fcn, retfcn, weak)	\
153	ENTRY_NP(fcnname);						\
154	save	%sp, -SA(MINFRAME), %sp;	/* new window */	\
155	set	fcnname##_info, %l5;					\
156	ld	[%l5 + MODS_FLAG], %l1;					\
157	btst	MODS_INSTALLED, %l1;		/* installed?? */	\
158	bne,a	%xcc, 1f;			/* yes */		\
159	ldn	[%l5], %g1;						\
160	btst	MODS_WEAK, %l1;			/* weak?? */		\
161	be,a	2f;				/* no, load module */	\
162	restore;							\
163	ldn	[%l5 + MODS_RETFCN], %g1;				\
1641:	jmp	%g1;				/* off we go */		\
165	restore;							\
1662:	sub	%sp, %fp, %g1;	/* get (-)size of callers frame */	\
167	save	%sp, %g1, %sp;	/* create new frame same size */	\
168	sub	%g0, %g1, %l4;  /* size of stack frame */		\
169	sethi	%hi(fcnname##_info), %l5;				\
170	b	stubs_common_code;					\
171	or	%l5, %lo(fcnname##_info), %l5;			\
172	SET_SIZE(fcnname);						\
173	STUB_DATA(module, fcnname, install_fcn, retfcn, weak)
174
175#define SCALL_NO_UNLOADABLE(module, fcnname, install_fcn, retfcn, weak)	\
176	ENTRY_NP(fcnname);						\
177	save	%sp, -SA(MINFRAME), %sp;	/* new window */	\
178	set	fcnname##_info, %l5;					\
179	ld	[%l5 + MODS_FLAG], %l1;		/* installed?? */	\
180	btst	MODS_INSTALLED, %l1;					\
181	be,a	%xcc, 1f;			/* no, load module */	\
182	restore;							\
183 	ldn	[%l5], %g1;						\
184	jmp	%g1;				/* yes, off we go */	\
185	restore;							\
1861:	save	%sp, -SA(MINFRAME), %sp;/* new frame */			\
187	sub	%g0, -SA(MINFRAME), %l4;/* size of stack frame */	\
188	sethi	%hi(fcnname##_info), %l5;				\
189	b	stubs_common_code;					\
190	or	%l5, %lo(fcnname##_info), %l5;			\
191	SET_SIZE(fcnname);						\
192	STUB_DATA(module, fcnname, install_fcn, retfcn, weak)
193
194	.section	".text"
195
196	/*
197	 * We branch here with the fcnname_info pointer in l5
198	 * and the frame size in %l4.
199	 */
200	ENTRY_NP(stubs_common_code)
201	cmp	%l4, SA(MINFRAME)
202	ble,a,pn %xcc, 2f
203	nop
204
205	sub	%l4, 0x80, %l4		/* skip locals and outs */
206	add	%sp, 0x80, %l0
207	add	%fp, 0x80, %l1		/* get original sp before save */
2081:
209	/* Copy stack frame */
210	ldn	[%l1 + STACK_BIAS], %l2
211	inc	8, %l1
212	stn	%l2, [%l0 + STACK_BIAS]
213	deccc	8, %l4
214	bg,a	1b
215	inc	8, %l0
2162:
217	call	mod_hold_stub		/* Hold the module */
218	mov	%l5, %o0
219	cmp	%o0, -1			/* if error then return error */
220	bne,a	1f
221	nop
222	ldn	[%l5 + MODS_RETFCN], %i0
223	call	%i0
224	nop
225	ret
226	restore	%o0, 0, %o0
2271:
228	ldn	[%l5], %g1
229	mov	%i0, %o0	/* copy over incoming args, if number of */
230	mov	%i1, %o1	/* args is > 6 then we copied them above */
231	mov	%i2, %o2
232	mov	%i3, %o3
233	mov	%i4, %o4
234	call	%g1		/* jump to the stub function */
235	mov	%i5, %o5
236	mov	%o0, %i0	/* copy any return values */
237	mov	%o1, %i1
238	call	mod_release_stub	/* release hold on module */
239	mov	%l5, %o0
240	ret			/* return to caller */
241	restore
242	SET_SIZE(stubs_common_code)
243
244! this is just a marker for the area of text that contains stubs
245	.seg ".text"
246	.global stubs_base
247stubs_base:
248	nop
249
250/*
251 * WARNING WARNING WARNING!!!!!!
252 *
253 * On the MODULE macro you MUST NOT use any spaces!!! They are
254 * significant to the preprocessor.  With ansi c there is a way around this
255 * but for some reason (yet to be investigated) ansi didn't work for other
256 * reasons!
257 *
258 * When zero is used as the return function, the system will call
259 * panic if the stub can't be resolved.
260 */
261
262/*
263 * Stubs for devfs. A non-unloadable module.
264 */
265#ifndef DEVFS_MODULE
266	MODULE(devfs,fs);
267	NO_UNLOAD_STUB(devfs, devfs_clean,		nomod_minus_one);
268	NO_UNLOAD_STUB(devfs, devfs_lookupname,		nomod_minus_one);
269	NO_UNLOAD_STUB(devfs, devfs_walk,		nomod_minus_one);
270	NO_UNLOAD_STUB(devfs, devfs_devpolicy,		nomod_minus_one);
271	NO_UNLOAD_STUB(devfs, devfs_reset_perm,		nomod_minus_one);
272	NO_UNLOAD_STUB(devfs, devfs_remdrv_cleanup,	nomod_minus_one);
273	END_MODULE(devfs);
274#endif
275
276/*
277 * Stubs for /dev fs.
278 */
279#ifndef DEV_MODULE
280	MODULE(dev, fs);
281	NO_UNLOAD_STUB(dev, sdev_modctl_readdir,	nomod_minus_one);
282	NO_UNLOAD_STUB(dev, sdev_modctl_readdir_free,	nomod_minus_one);
283	NO_UNLOAD_STUB(dev, devname_filename_register,	nomod_minus_one);
284	NO_UNLOAD_STUB(dev, sdev_modctl_devexists,	nomod_minus_one);
285	NO_UNLOAD_STUB(dev, devname_profile_update,	nomod_minus_one);
286	NO_UNLOAD_STUB(dev, sdev_devstate_change,	nomod_minus_one);
287	NO_UNLOAD_STUB(dev, devvt_getvnodeops,		nomod_minus_one);
288	NO_UNLOAD_STUB(dev, devpts_getvnodeops,		nomod_zero);
289	END_MODULE(dev);
290#endif
291
292/*
293 * Stubs for specfs. A non-unloadable module.
294 */
295
296#ifndef SPEC_MODULE
297	MODULE(specfs,fs);
298	NO_UNLOAD_STUB(specfs, common_specvp,  	nomod_zero);
299	NO_UNLOAD_STUB(specfs, makectty,		nomod_zero);
300	NO_UNLOAD_STUB(specfs, makespecvp,      	nomod_zero);
301	NO_UNLOAD_STUB(specfs, smark,           	nomod_zero);
302	NO_UNLOAD_STUB(specfs, spec_segmap,     	nomod_einval);
303	NO_UNLOAD_STUB(specfs, specfind,        	nomod_zero);
304	NO_UNLOAD_STUB(specfs, specvp,          	nomod_zero);
305	NO_UNLOAD_STUB(specfs, devi_stillreferenced,	nomod_zero);
306	NO_UNLOAD_STUB(specfs, spec_getvnodeops,	nomod_zero);
307	NO_UNLOAD_STUB(specfs, spec_char_map,		nomod_zero);
308	NO_UNLOAD_STUB(specfs, specvp_devfs,  		nomod_zero);
309	NO_UNLOAD_STUB(specfs, spec_assoc_vp_with_devi,	nomod_void);
310	NO_UNLOAD_STUB(specfs, spec_hold_devi_by_vp,	nomod_zero);
311	NO_UNLOAD_STUB(specfs, spec_snode_walk,		nomod_void);
312	NO_UNLOAD_STUB(specfs, spec_devi_open_count,	nomod_minus_one);
313	NO_UNLOAD_STUB(specfs, spec_is_clone,		nomod_zero);
314	NO_UNLOAD_STUB(specfs, spec_is_selfclone,	nomod_zero);
315	NO_UNLOAD_STUB(specfs, spec_fence_snode,	nomod_minus_one);
316	NO_UNLOAD_STUB(specfs, spec_unfence_snode,	nomod_minus_one);
317	END_MODULE(specfs);
318#endif
319
320
321/*
322 * Stubs for sockfs. A non-unloadable module.
323 */
324#ifndef SOCK_MODULE
325	MODULE(sockfs, fs);
326	SCALL_NU_STUB(sockfs, so_socket,  	nomod_zero);
327	SCALL_NU_STUB(sockfs, so_socketpair,	nomod_zero);
328	SCALL_NU_STUB(sockfs, bind,  		nomod_zero);
329	SCALL_NU_STUB(sockfs, listen,  		nomod_zero);
330	SCALL_NU_STUB(sockfs, accept,  		nomod_zero);
331	SCALL_NU_STUB(sockfs, connect,  	nomod_zero);
332	SCALL_NU_STUB(sockfs, shutdown,  	nomod_zero);
333	SCALL_NU_STUB(sockfs, recv,  		nomod_zero);
334	SCALL_NU_STUB(sockfs, recvfrom,  	nomod_zero);
335	SCALL_NU_STUB(sockfs, recvmsg,  	nomod_zero);
336	SCALL_NU_STUB(sockfs, send,  		nomod_zero);
337	SCALL_NU_STUB(sockfs, sendmsg,  	nomod_zero);
338	SCALL_NU_STUB(sockfs, sendto, 		nomod_zero);
339#ifdef _SYSCALL32_IMPL
340	SCALL_NU_STUB(sockfs, recv32,  		nomod_zero);
341	SCALL_NU_STUB(sockfs, recvfrom32,  	nomod_zero);
342	SCALL_NU_STUB(sockfs, send32,  		nomod_zero);
343	SCALL_NU_STUB(sockfs, sendto32, 	nomod_zero);
344#endif /* _SYSCALL32_IMPL */
345	SCALL_NU_STUB(sockfs, getpeername,  	nomod_zero);
346	SCALL_NU_STUB(sockfs, getsockname,  	nomod_zero);
347	SCALL_NU_STUB(sockfs, getsockopt,  	nomod_zero);
348	SCALL_NU_STUB(sockfs, setsockopt,  	nomod_zero);
349	SCALL_NU_STUB(sockfs, sockconfig,  	nomod_zero);
350	NO_UNLOAD_STUB(sockfs, sock_getmsg,  	nomod_zero);
351	NO_UNLOAD_STUB(sockfs, sock_putmsg,  	nomod_zero);
352	NO_UNLOAD_STUB(sockfs, sosendfile64,  	nomod_zero);
353	NO_UNLOAD_STUB(sockfs, snf_segmap,  	nomod_einval);
354	NO_UNLOAD_STUB(sockfs, sock_getfasync,  nomod_zero);
355	NO_UNLOAD_STUB(sockfs, sotpi_sototpi,  nomod_zero);
356	NO_UNLOAD_STUB(sockfs, socket_sendmblk,	nomod_zero);
357	NO_UNLOAD_STUB(sockfs, socket_setsockopt,	nomod_zero);
358	END_MODULE(sockfs);
359#endif
360
361/*
362 * IPsec stubs.
363 */
364
365#ifndef	IPSECAH_MODULE
366	MODULE(ipsecah,drv);
367	WSTUB(ipsecah,	ipsec_construct_inverse_acquire,	nomod_zero);
368	WSTUB(ipsecah,	sadb_acquire,		nomod_zero);
369	WSTUB(ipsecah,	ipsecah_algs_changed,	nomod_zero);
370	WSTUB(ipsecah,	sadb_alg_update,	nomod_zero);
371	WSTUB(ipsecah,	sadb_unlinkassoc,	nomod_zero);
372	WSTUB(ipsecah,	sadb_insertassoc,	nomod_zero);
373	WSTUB(ipsecah,	ipsecah_in_assocfailure,	nomod_zero);
374	WSTUB(ipsecah,	sadb_set_lpkt,		nomod_zero);
375	WSTUB(ipsecah,	ipsecah_icmp_error,	nomod_zero);
376	END_MODULE(ipsecah);
377#endif
378
379#ifndef	IPSECESP_MODULE
380	MODULE(ipsecesp,drv);
381	WSTUB(ipsecesp,	ipsecesp_fill_defs,	nomod_zero);
382	WSTUB(ipsecesp,	ipsecesp_algs_changed,	nomod_zero);
383	WSTUB(ipsecesp, ipsecesp_in_assocfailure,	nomod_zero);
384	WSTUB(ipsecesp, ipsecesp_init_funcs,	nomod_zero);
385	WSTUB(ipsecesp,	ipsecesp_icmp_error,	nomod_zero);
386	WSTUB(ipsecesp,	ipsecesp_send_keepalive,	nomod_zero);
387	END_MODULE(ipsecesp);
388#endif
389
390#ifndef KEYSOCK_MODULE
391	MODULE(keysock,drv);
392	WSTUB(keysock,	keysock_spdsock_wput_iocdata,	nomod_void);
393	WSTUB(keysock,	keysock_plumb_ipsec,	nomod_zero);
394	WSTUB(keysock,	keysock_extended_reg,	nomod_zero);
395	WSTUB(keysock,	keysock_next_seq,	nomod_zero);
396	END_MODULE(keysock);
397#endif
398
399#ifndef SPDSOCK_MODULE
400	MODULE(spdsock,drv);
401	WSTUB(spdsock,	spdsock_update_pending_algs,	nomod_zero);
402	END_MODULE(spdsock);
403#endif
404
405/*
406 * Stubs for nfs common code.
407 * XXX nfs_getvnodeops should go away with removal of kludge in vnode.c
408 */
409#ifndef NFS_MODULE
410	MODULE(nfs,fs);
411	WSTUB(nfs,	nfs_getvnodeops,	nomod_zero);
412	WSTUB(nfs,	nfs_perror,		nomod_zero);
413	WSTUB(nfs,	nfs_cmn_err,		nomod_zero);
414	WSTUB(nfs,	clcleanup_zone,		nomod_zero);
415	WSTUB(nfs,	clcleanup4_zone,	nomod_zero);
416	END_MODULE(nfs);
417#endif
418
419/*
420 * Stubs for nfs_dlboot (diskless booting).
421 */
422#ifndef NFS_DLBOOT_MODULE
423	MODULE(nfs_dlboot,misc);
424	STUB(nfs_dlboot,	mount_root,	nomod_minus_one);
425	STUB(nfs_dlboot,        dhcpinit,       nomod_minus_one);
426	END_MODULE(nfs_dlboot);
427#endif
428
429/*
430 * Stubs for nfs server-only code.
431 */
432#ifndef NFSSRV_MODULE
433	MODULE(nfssrv,misc);
434	STUB(nfssrv,		exportfs,	nomod_minus_one);
435	STUB(nfssrv,		nfs_getfh,	nomod_minus_one);
436	STUB(nfssrv,		nfsl_flush,	nomod_minus_one);
437	STUB(nfssrv,		rfs4_check_delegated, nomod_zero);
438	STUB(nfssrv,		mountd_args,	nomod_minus_one);
439	NO_UNLOAD_STUB(nfssrv,	rdma_start,	nomod_zero);
440	NO_UNLOAD_STUB(nfssrv,	nfs_svc,	nomod_zero);
441	END_MODULE(nfssrv);
442#endif
443
444/*
445 * Stubs for kernel lock manager.
446 */
447#ifndef KLM_MODULE
448	MODULE(klmmod,misc);
449	NO_UNLOAD_STUB(klmmod, lm_svc,		nomod_zero);
450	NO_UNLOAD_STUB(klmmod, lm_shutdown,	nomod_zero);
451	NO_UNLOAD_STUB(klmmod, lm_unexport,	nomod_zero);
452	NO_UNLOAD_STUB(klmmod, lm_cprresume,	nomod_zero);
453	NO_UNLOAD_STUB(klmmod, lm_cprsuspend,	nomod_zero);
454	NO_UNLOAD_STUB(klmmod, lm_safelock, nomod_zero);
455	NO_UNLOAD_STUB(klmmod, lm_safemap, nomod_zero);
456	NO_UNLOAD_STUB(klmmod, lm_has_sleep, nomod_zero);
457	NO_UNLOAD_STUB(klmmod, lm_free_config, nomod_zero);
458	NO_UNLOAD_STUB(klmmod, lm_vp_active, nomod_zero);
459	NO_UNLOAD_STUB(klmmod, lm_get_sysid, nomod_zero);
460	NO_UNLOAD_STUB(klmmod, lm_rel_sysid, nomod_zero);
461	NO_UNLOAD_STUB(klmmod, lm_alloc_sysidt, nomod_minus_one);
462	NO_UNLOAD_STUB(klmmod, lm_free_sysidt, nomod_zero);
463	NO_UNLOAD_STUB(klmmod, lm_sysidt, nomod_minus_one);
464	END_MODULE(klmmod);
465#endif
466
467#ifndef KLMOPS_MODULE
468	MODULE(klmops,misc);
469	NO_UNLOAD_STUB(klmops, lm_frlock,	nomod_zero);
470	NO_UNLOAD_STUB(klmops, lm4_frlock,	nomod_zero);
471	NO_UNLOAD_STUB(klmops, lm_shrlock,	nomod_zero);
472	NO_UNLOAD_STUB(klmops, lm4_shrlock,	nomod_zero);
473	NO_UNLOAD_STUB(klmops, lm_nlm_dispatch,	nomod_zero);
474	NO_UNLOAD_STUB(klmops, lm_nlm4_dispatch,	nomod_zero);
475	NO_UNLOAD_STUB(klmops, lm_nlm_reclaim,	nomod_zero);
476	NO_UNLOAD_STUB(klmops, lm_nlm4_reclaim,	nomod_zero);
477	NO_UNLOAD_STUB(klmops, lm_register_lock_locally, nomod_zero);
478	END_MODULE(klmops);
479#endif
480
481/*
482 * Stubs for kernel TLI module
483 *   XXX currently we never allow this to unload
484 */
485#ifndef TLI_MODULE
486	MODULE(tlimod,misc);
487	NO_UNLOAD_STUB(tlimod, t_kopen,		nomod_minus_one);
488	NO_UNLOAD_STUB(tlimod, t_kunbind,  	nomod_zero);
489	NO_UNLOAD_STUB(tlimod, t_kadvise,  	nomod_zero);
490	NO_UNLOAD_STUB(tlimod, t_krcvudata,  	nomod_zero);
491	NO_UNLOAD_STUB(tlimod, t_ksndudata,  	nomod_zero);
492	NO_UNLOAD_STUB(tlimod, t_kalloc,  	nomod_zero);
493	NO_UNLOAD_STUB(tlimod, t_kbind,  	nomod_zero);
494	NO_UNLOAD_STUB(tlimod, t_kclose,  	nomod_zero);
495	NO_UNLOAD_STUB(tlimod, t_kspoll,  	nomod_zero);
496	NO_UNLOAD_STUB(tlimod, t_kfree,  	nomod_zero);
497	NO_UNLOAD_STUB(tlimod, t_koptmgmt,	nomod_zero);
498	END_MODULE(tlimod);
499#endif
500
501/*
502 * Stubs for kernel RPC module
503 *   XXX currently we never allow this to unload
504 */
505#ifndef RPC_MODULE
506	MODULE(rpcmod,strmod);
507	NO_UNLOAD_STUB(rpcmod, clnt_tli_kcreate,	nomod_minus_one);
508	NO_UNLOAD_STUB(rpcmod, svc_tli_kcreate,		nomod_minus_one);
509	NO_UNLOAD_STUB(rpcmod, bindresvport,		nomod_minus_one);
510	NO_UNLOAD_STUB(rpcmod, rdma_register_mod,	nomod_minus_one);
511	NO_UNLOAD_STUB(rpcmod, rdma_unregister_mod,	nomod_minus_one);
512	NO_UNLOAD_STUB(rpcmod, svc_queuereq,		nomod_minus_one);
513	NO_UNLOAD_STUB(rpcmod, clist_add,		nomod_minus_one);
514	END_MODULE(rpcmod);
515#endif
516
517/*
518 * Stubs for des
519 */
520#ifndef DES_MODULE
521	MODULE(des,misc);
522	STUB(des, cbc_crypt, 	 	nomod_zero);
523	STUB(des, ecb_crypt, 		nomod_zero);
524	STUB(des, _des_crypt,		nomod_zero);
525	END_MODULE(des);
526#endif
527
528/*
529 * Stubs for procfs. A non-unloadable module.
530 */
531#ifndef PROC_MODULE
532	MODULE(procfs,fs);
533	NO_UNLOAD_STUB(procfs, prfree,		nomod_zero);
534	NO_UNLOAD_STUB(procfs, prexit,		nomod_zero);
535	NO_UNLOAD_STUB(procfs, prlwpfree,	nomod_zero);
536	NO_UNLOAD_STUB(procfs, prlwpexit,	nomod_zero);
537	NO_UNLOAD_STUB(procfs, prinvalidate,	nomod_zero);
538	NO_UNLOAD_STUB(procfs, prnsegs,		nomod_zero);
539	NO_UNLOAD_STUB(procfs, prgetcred,	nomod_zero);
540	NO_UNLOAD_STUB(procfs, prgetpriv,	nomod_zero);
541	NO_UNLOAD_STUB(procfs, prgetprivsize,	nomod_zero);
542	NO_UNLOAD_STUB(procfs, prgetsecflags,	nomod_zero);
543	NO_UNLOAD_STUB(procfs, prgetstatus,	nomod_zero);
544	NO_UNLOAD_STUB(procfs, prgetlwpstatus,	nomod_zero);
545	NO_UNLOAD_STUB(procfs, prgetpsinfo,	nomod_zero);
546	NO_UNLOAD_STUB(procfs, prgetlwpsinfo,	nomod_zero);
547	NO_UNLOAD_STUB(procfs, oprgetstatus,	nomod_zero);
548	NO_UNLOAD_STUB(procfs, oprgetpsinfo,	nomod_zero);
549#ifdef _SYSCALL32_IMPL
550	NO_UNLOAD_STUB(procfs, prgetstatus32,	nomod_zero);
551	NO_UNLOAD_STUB(procfs, prgetlwpstatus32, nomod_zero);
552	NO_UNLOAD_STUB(procfs, prgetpsinfo32,	nomod_zero);
553	NO_UNLOAD_STUB(procfs, prgetlwpsinfo32,	nomod_zero);
554	NO_UNLOAD_STUB(procfs, oprgetstatus32,	nomod_zero);
555	NO_UNLOAD_STUB(procfs, oprgetpsinfo32,	nomod_zero);
556	NO_UNLOAD_STUB(procfs, psinfo_kto32,	nomod_zero);
557	NO_UNLOAD_STUB(procfs, lwpsinfo_kto32,	nomod_zero);
558#endif	/* _SYSCALL32_IMPL */
559	NO_UNLOAD_STUB(procfs, prnotify,	nomod_zero);
560	NO_UNLOAD_STUB(procfs, prexecstart,	nomod_zero);
561	NO_UNLOAD_STUB(procfs, prexecend,	nomod_zero);
562	NO_UNLOAD_STUB(procfs, prrelvm,		nomod_zero);
563	NO_UNLOAD_STUB(procfs, prbarrier,	nomod_zero);
564	NO_UNLOAD_STUB(procfs, estimate_msacct,	nomod_zero);
565	NO_UNLOAD_STUB(procfs, pr_getprot,	nomod_zero);
566	NO_UNLOAD_STUB(procfs, pr_getprot_done,	nomod_zero);
567	NO_UNLOAD_STUB(procfs, pr_getsegsize,	nomod_zero);
568	NO_UNLOAD_STUB(procfs, pr_isobject,	nomod_zero);
569	NO_UNLOAD_STUB(procfs, pr_isself,	nomod_zero);
570	NO_UNLOAD_STUB(procfs, pr_allstopped,	nomod_zero);
571	NO_UNLOAD_STUB(procfs, pr_free_watched_pages, nomod_zero);
572	END_MODULE(procfs);
573#endif
574
575/*
576 * Stubs for fifofs
577 */
578#ifndef FIFO_MODULE
579	MODULE(fifofs,fs);
580	NO_UNLOAD_STUB(fifofs, fifovp,      	nomod_zero);
581	NO_UNLOAD_STUB(fifofs, fifo_getinfo,	nomod_zero);
582	NO_UNLOAD_STUB(fifofs, fifo_vfastoff,	nomod_zero);
583	END_MODULE(fifofs);
584#endif
585
586/*
587 * Stubs for ufs
588 *
589 * This is needed to support the old quotactl system call.
590 * When the old sysent stuff goes away, this will need to be revisited.
591 */
592#ifndef UFS_MODULE
593	MODULE(ufs,fs);
594	STUB(ufs, quotactl, nomod_minus_one);
595	END_MODULE(ufs);
596#endif
597
598/*
599 * Stubs for zfs
600 */
601#ifndef ZFS_MODULE
602	MODULE(zfs,fs);
603	STUB(zfs, dsl_prop_get, nomod_minus_one);
604	STUB(zfs, spa_boot_init, nomod_minus_one);
605	STUB(zfs, zfs_prop_to_name, nomod_zero);
606	END_MODULE(zfs);
607#endif
608
609/*
610 * Stubs for dcfs
611 */
612#ifndef DCFS_MODULE
613	MODULE(dcfs,fs);
614	STUB(dcfs, decompvp, 0);
615	END_MODULE(dcfs);
616#endif
617
618/*
619 * Stubs for namefs
620 */
621#ifndef NAMEFS_MODULE
622	MODULE(namefs,fs);
623	STUB(namefs, nm_unmountall, 	0);
624	END_MODULE(namefs);
625#endif
626
627/*
628 * Stubs for sysdc
629 */
630#ifndef SDC_MODULE
631	MODULE(SDC,sched);
632	NO_UNLOAD_STUB(SDC, sysdc_thread_enter,		nomod_zero);
633	END_MODULE(SDC);
634#endif
635
636/*
637 * Stubs for ts_dptbl
638 */
639#ifndef TS_DPTBL_MODULE
640	MODULE(TS_DPTBL,sched);
641	STUB(TS_DPTBL, ts_getdptbl,		0);
642	STUB(TS_DPTBL, ts_getkmdpris,		0);
643	STUB(TS_DPTBL, ts_getmaxumdpri,	0);
644	END_MODULE(TS_DPTBL);
645#endif
646
647/*
648 * Stubs for rt_dptbl
649 */
650#ifndef RT_DPTBL_MODULE
651	MODULE(RT_DPTBL,sched);
652	STUB(RT_DPTBL, rt_getdptbl,		0);
653	END_MODULE(RT_DPTBL);
654#endif
655
656/*
657 * Stubs for ia_dptbl
658 */
659#ifndef IA_DPTBL_MODULE
660	MODULE(IA_DPTBL,sched);
661	STUB(IA_DPTBL, ia_getdptbl,		0);
662	STUB(IA_DPTBL, ia_getkmdpris,		0);
663	STUB(IA_DPTBL, ia_getmaxumdpri,	0);
664	END_MODULE(IA_DPTBL);
665#endif
666
667/*
668 * Stubs for FSS scheduler
669 */
670#ifndef	FSS_MODULE
671	MODULE(FSS,sched);
672	WSTUB(FSS, fss_allocbuf,		nomod_zero);
673	WSTUB(FSS, fss_freebuf,			nomod_zero);
674	WSTUB(FSS, fss_changeproj,		nomod_zero);
675	WSTUB(FSS, fss_changepset,		nomod_zero);
676	END_MODULE(FSS);
677#endif
678
679/*
680 * Stubs for fx_dptbl
681 */
682#ifndef FX_DPTBL_MODULE
683	MODULE(FX_DPTBL,sched);
684	STUB(FX_DPTBL, fx_getdptbl,		0);
685	STUB(FX_DPTBL, fx_getmaxumdpri,		0);
686	END_MODULE(FX_DPTBL);
687#endif
688
689/*
690 * Stubs for swapgeneric
691 */
692#ifndef SWAPGENERIC_MODULE
693	MODULE(swapgeneric,misc);
694	STUB(swapgeneric, rootconf,     0);
695	STUB(swapgeneric, getrootdev,   0);
696	STUB(swapgeneric, getfsname,    0);
697	STUB(swapgeneric, loadrootmodules, 0);
698	END_MODULE(swapgeneric);
699#endif
700
701/*
702 * Stubs for bootdev
703 */
704#ifndef BOOTDEV_MODULE
705	MODULE(bootdev,misc);
706	STUB(bootdev, i_devname_to_promname, 0);
707	STUB(bootdev, i_promname_to_devname, 0);
708	STUB(bootdev, i_convert_boot_device_name, 0);
709	END_MODULE(bootdev);
710#endif
711
712/*
713 * stubs for strplumb...
714 */
715#ifndef STRPLUMB_MODULE
716	MODULE(strplumb,misc);
717	STUB(strplumb, strplumb,     0);
718	STUB(strplumb, strplumb_load, 0);
719	STUB(strplumb, strplumb_get_netdev_path, 0)
720	END_MODULE(strplumb);
721#endif
722
723/*
724 * Stubs for console configuration module
725 */
726#ifndef CONSCONFIG_MODULE
727	MODULE(consconfig,misc);
728	STUB(consconfig, consconfig,	0);
729	STUB(consconfig, consconfig_get_usb_kb_path,	0);
730	STUB(consconfig, consconfig_get_usb_ms_path,	0);
731	STUB(consconfig, consconfig_console_is_ready,	0);
732	END_MODULE(consconfig);
733#endif
734
735/*
736 * Stubs for zs (uart) module
737 */
738#ifndef ZS_MODULE
739	MODULE(zs,drv);
740	STUB(zs, zsgetspeed,		0);
741	END_MODULE(zs);
742#endif
743
744/*
745 * Stubs for accounting.
746 */
747#ifndef SYSACCT_MODULE
748	MODULE(sysacct,sys);
749	NO_UNLOAD_WSTUB(sysacct, acct,  		nomod_zero);
750	NO_UNLOAD_WSTUB(sysacct, acct_fs_in_use,	nomod_zero);
751	END_MODULE(sysacct);
752#endif
753
754/*
755 * Stubs for semaphore routines. sem.c
756 */
757#ifndef SEMSYS_MODULE
758	MODULE(semsys,sys);
759	NO_UNLOAD_WSTUB(semsys, semexit,		nomod_zero);
760	END_MODULE(semsys);
761#endif
762
763/*
764 * Stubs for shmem routines. shm.c
765 */
766#ifndef SHMSYS_MODULE
767	MODULE(shmsys,sys);
768	NO_UNLOAD_WSTUB(shmsys, shmexit,		nomod_zero);
769	NO_UNLOAD_WSTUB(shmsys, shmfork,		nomod_zero);
770	NO_UNLOAD_WSTUB(shmsys, shmgetid,		nomod_minus_one);
771	END_MODULE(shmsys);
772#endif
773
774/*
775 * Stubs for doors
776 */
777#ifndef DOORFS_MODULE
778	MODULE(doorfs,sys);
779	NO_UNLOAD_WSTUB(doorfs, door_slam,		nomod_zero);
780	NO_UNLOAD_WSTUB(doorfs, door_exit,		nomod_zero);
781	NO_UNLOAD_WSTUB(doorfs, door_revoke_all,	nomod_zero);
782	NO_UNLOAD_WSTUB(doorfs, door_fork,		nomod_zero);
783	NO_UNLOAD_STUB(doorfs, door_upcall,		nomod_einval);
784	NO_UNLOAD_STUB(doorfs, door_ki_create,		nomod_einval);
785	NO_UNLOAD_STUB(doorfs, door_ki_open,		nomod_einval);
786	NO_UNLOAD_STUB(doorfs, door_ki_lookup,		nomod_zero);
787	NO_UNLOAD_WSTUB(doorfs, door_ki_upcall,		nomod_einval);
788	NO_UNLOAD_WSTUB(doorfs, door_ki_upcall_limited,	nomod_einval);
789	NO_UNLOAD_WSTUB(doorfs, door_ki_hold,		nomod_zero);
790	NO_UNLOAD_WSTUB(doorfs, door_ki_rele,		nomod_zero);
791	NO_UNLOAD_WSTUB(doorfs, door_ki_info,		nomod_einval);
792	END_MODULE(doorfs);
793#endif
794
795/*
796 * Stubs for idmap
797 */
798#ifndef IDMAP_MODULE
799	MODULE(idmap,misc);
800	STUB(idmap, kidmap_batch_getgidbysid,	nomod_zero);
801	STUB(idmap, kidmap_batch_getpidbysid,	nomod_zero);
802	STUB(idmap, kidmap_batch_getsidbygid,	nomod_zero);
803	STUB(idmap, kidmap_batch_getsidbyuid,	nomod_zero);
804	STUB(idmap, kidmap_batch_getuidbysid,	nomod_zero);
805	STUB(idmap, kidmap_get_create,		nomod_zero);
806	STUB(idmap, kidmap_get_destroy,		nomod_zero);
807	STUB(idmap, kidmap_get_mappings,	nomod_zero);
808	STUB(idmap, kidmap_getgidbysid,		nomod_zero);
809	STUB(idmap, kidmap_getpidbysid,		nomod_zero);
810	STUB(idmap, kidmap_getsidbygid,		nomod_zero);
811	STUB(idmap, kidmap_getsidbyuid,		nomod_zero);
812	STUB(idmap, kidmap_getuidbysid,		nomod_zero);
813	STUB(idmap, idmap_get_door,		nomod_einval);
814	STUB(idmap, idmap_unreg_dh,		nomod_einval);
815	STUB(idmap, idmap_reg_dh,		nomod_einval);
816	STUB(idmap, idmap_purge_cache,		nomod_einval);
817	END_MODULE(idmap);
818#endif
819
820/*
821 * Stubs for dma routines. dmaga.c
822 * (These are only needed for cross-checks, not autoloading)
823 */
824#ifndef DMA_MODULE
825	MODULE(dma,drv);
826	WSTUB(dma, dma_alloc,		nomod_zero); /* (DMAGA *)0 */
827	WSTUB(dma, dma_free,		nomod_zero); /* (DMAGA *)0 */
828	END_MODULE(dma);
829#endif
830
831/*
832 * Stubs for auditing.
833 */
834#ifndef C2AUDIT_MODULE
835	MODULE(c2audit,sys);
836	NO_UNLOAD_STUB(c2audit, audit_init_module,	nomod_zero);
837	NO_UNLOAD_STUB(c2audit, audit_start, 		nomod_zero);
838	NO_UNLOAD_STUB(c2audit, audit_finish,		nomod_zero);
839	NO_UNLOAD_STUB(c2audit, audit,			nomod_zero);
840	NO_UNLOAD_STUB(c2audit, auditdoor,		nomod_zero);
841	NO_UNLOAD_STUB(c2audit, audit_closef,		nomod_zero);
842	NO_UNLOAD_STUB(c2audit, audit_core_start,	nomod_zero);
843	NO_UNLOAD_STUB(c2audit, audit_core_finish,	nomod_zero);
844	NO_UNLOAD_STUB(c2audit, audit_strputmsg,	nomod_zero);
845	NO_UNLOAD_STUB(c2audit, audit_savepath,		nomod_zero);
846	NO_UNLOAD_STUB(c2audit, audit_anchorpath,	nomod_zero);
847	NO_UNLOAD_STUB(c2audit, audit_exit,		nomod_zero);
848	NO_UNLOAD_STUB(c2audit, audit_exec,		nomod_zero);
849	NO_UNLOAD_STUB(c2audit, audit_symlink,		nomod_zero);
850	NO_UNLOAD_STUB(c2audit, audit_symlink_create,	nomod_zero);
851	NO_UNLOAD_STUB(c2audit, audit_vncreate_start,	nomod_zero);
852	NO_UNLOAD_STUB(c2audit, audit_vncreate_finish,	nomod_zero);
853	NO_UNLOAD_STUB(c2audit, audit_enterprom,	nomod_zero);
854	NO_UNLOAD_STUB(c2audit, audit_exitprom,		nomod_zero);
855	NO_UNLOAD_STUB(c2audit, audit_chdirec,		nomod_zero);
856	NO_UNLOAD_STUB(c2audit, audit_setf,		nomod_zero);
857	NO_UNLOAD_STUB(c2audit, audit_sock,		nomod_zero);
858	NO_UNLOAD_STUB(c2audit, audit_strgetmsg,	nomod_zero);
859	NO_UNLOAD_STUB(c2audit, audit_ipc,		nomod_zero);
860	NO_UNLOAD_STUB(c2audit, audit_ipcget,		nomod_zero);
861	NO_UNLOAD_STUB(c2audit, audit_fdsend,		nomod_zero);
862	NO_UNLOAD_STUB(c2audit, audit_fdrecv,		nomod_zero);
863	NO_UNLOAD_STUB(c2audit, audit_priv,		nomod_zero);
864	NO_UNLOAD_STUB(c2audit, audit_setppriv,		nomod_zero);
865	NO_UNLOAD_STUB(c2audit, audit_psecflags,	nomod_zero);
866	NO_UNLOAD_STUB(c2audit, audit_devpolicy,	nomod_zero);
867	NO_UNLOAD_STUB(c2audit, audit_setfsat_path,	nomod_zero);
868	NO_UNLOAD_STUB(c2audit, audit_cryptoadm,	nomod_zero);
869	NO_UNLOAD_STUB(c2audit, audit_pf_policy,	nomod_zero);
870	NO_UNLOAD_STUB(c2audit, au_doormsg,		nomod_zero);
871	NO_UNLOAD_STUB(c2audit, au_uwrite,		nomod_zero);
872	NO_UNLOAD_STUB(c2audit, au_to_arg32,		nomod_zero);
873	NO_UNLOAD_STUB(c2audit, au_free_rec,		nomod_zero);
874	END_MODULE(c2audit);
875#endif
876
877/*
878 * Stubs for kernel rpc security service module
879 */
880#ifndef RPCSEC_MODULE
881	MODULE(rpcsec,misc);
882	NO_UNLOAD_STUB(rpcsec, sec_clnt_revoke,		nomod_zero);
883	NO_UNLOAD_STUB(rpcsec, authkern_create,		nomod_zero);
884	NO_UNLOAD_STUB(rpcsec, sec_svc_msg,		nomod_zero);
885	NO_UNLOAD_STUB(rpcsec, sec_svc_control,		nomod_zero);
886	END_MODULE(rpcsec);
887#endif
888
889/*
890 * Stubs for rpc RPCSEC_GSS security service module
891 */
892#ifndef RPCSEC_GSS_MODULE
893	MODULE(rpcsec_gss,misc);
894	NO_UNLOAD_STUB(rpcsec_gss, __svcrpcsec_gss,		nomod_zero);
895	NO_UNLOAD_STUB(rpcsec_gss, rpc_gss_getcred,		nomod_zero);
896	NO_UNLOAD_STUB(rpcsec_gss, rpc_gss_set_callback,	nomod_zero);
897	NO_UNLOAD_STUB(rpcsec_gss, rpc_gss_secget,		nomod_zero);
898	NO_UNLOAD_STUB(rpcsec_gss, rpc_gss_secfree,		nomod_zero);
899	NO_UNLOAD_STUB(rpcsec_gss, rpc_gss_seccreate,		nomod_zero);
900	NO_UNLOAD_STUB(rpcsec_gss, rpc_gss_set_defaults,	nomod_zero);
901	NO_UNLOAD_STUB(rpcsec_gss, rpc_gss_revauth,		nomod_zero);
902	NO_UNLOAD_STUB(rpcsec_gss, rpc_gss_secpurge,		nomod_zero);
903	NO_UNLOAD_STUB(rpcsec_gss, rpc_gss_cleanup,		nomod_zero);
904	NO_UNLOAD_STUB(rpcsec_gss, rpc_gss_get_versions,	nomod_zero);
905	NO_UNLOAD_STUB(rpcsec_gss, rpc_gss_max_data_length,	nomod_zero);
906	NO_UNLOAD_STUB(rpcsec_gss, rpc_gss_svc_max_data_length,	nomod_zero);
907	NO_UNLOAD_STUB(rpcsec_gss, rpc_gss_get_service_type,	nomod_zero);
908	END_MODULE(rpcsec_gss);
909#endif
910
911#ifndef IWSCN_MODULE
912	MODULE(iwscn,drv);
913	STUB(iwscn, srpop, 0);
914	END_MODULE(iwscn);
915#endif
916
917/*
918 * Stubs for checkpoint-resume module
919 */
920#ifndef CPR_MODULE
921        MODULE(cpr,misc);
922        STUB(cpr, cpr, 0);
923        END_MODULE(cpr);
924#endif
925
926/*
927 * Stubs for VIS module
928 */
929#ifndef VIS_MODULE
930        MODULE(vis,misc);
931        STUB(vis, vis_fpu_simulator, 0);
932        STUB(vis, vis_fldst, 0);
933        STUB(vis, vis_rdgsr, 0);
934        STUB(vis, vis_wrgsr, 0);
935        END_MODULE(vis);
936#endif
937
938/*
939 * Clustering: stubs for bootstrapping.
940 */
941#ifndef CL_BOOTSTRAP
942	MODULE(cl_bootstrap,misc);
943	NO_UNLOAD_WSTUB(cl_bootstrap, clboot_modload, nomod_minus_one);
944	NO_UNLOAD_WSTUB(cl_bootstrap, clboot_loadrootmodules, nomod_zero);
945	NO_UNLOAD_WSTUB(cl_bootstrap, clboot_rootconf, nomod_zero);
946	NO_UNLOAD_WSTUB(cl_bootstrap, clboot_mountroot, nomod_zero);
947	NO_UNLOAD_WSTUB(cl_bootstrap, clconf_init, nomod_zero);
948	NO_UNLOAD_WSTUB(cl_bootstrap, clconf_get_nodeid, nomod_zero);
949	NO_UNLOAD_WSTUB(cl_bootstrap, clconf_maximum_nodeid, nomod_zero);
950	NO_UNLOAD_WSTUB(cl_bootstrap, cluster, nomod_zero);
951	END_MODULE(cl_bootstrap);
952#endif
953
954/*
955 * Clustering: stubs for cluster infrastructure.
956 */
957#ifndef CL_COMM_MODULE
958	MODULE(cl_comm,misc);
959	NO_UNLOAD_STUB(cl_comm, cladmin, nomod_minus_one);
960	END_MODULE(cl_comm);
961#endif
962
963/*
964 * Clustering: stubs for global file system operations.
965 */
966#ifndef PXFS_MODULE
967	MODULE(pxfs,fs);
968	NO_UNLOAD_WSTUB(pxfs, clpxfs_aio_read, nomod_zero);
969	NO_UNLOAD_WSTUB(pxfs, clpxfs_aio_write, nomod_zero);
970	NO_UNLOAD_WSTUB(pxfs, cl_flk_state_transition_notify, nomod_zero);
971	END_MODULE(pxfs);
972#endif
973
974/*
975 * Stubs for PCI configurator module (misc/pcicfg).
976 */
977#ifndef	PCICFG_MODULE
978	MODULE(pcicfg,misc);
979	STUB(pcicfg, pcicfg_configure, 0);
980	STUB(pcicfg, pcicfg_unconfigure, 0);
981	END_MODULE(pcicfg);
982#endif
983
984#ifndef PCIHP_MODULE
985	MODULE(pcihp,misc);
986	WSTUB(pcihp, pcihp_init, nomod_minus_one);
987	WSTUB(pcihp, pcihp_uninit, nomod_minus_one);
988	WSTUB(pcihp, pcihp_info, nomod_minus_one);
989	WSTUB(pcihp, pcihp_get_cb_ops, nomod_zero);
990	END_MODULE(pcihp);
991#endif
992
993/*
994 * Stubs for kernel cryptographic framework module (misc/kcf).
995 */
996#ifndef KCF_MODULE
997	MODULE(kcf,misc);
998	NO_UNLOAD_STUB(kcf, crypto_mech2id, nomod_minus_one);
999	NO_UNLOAD_STUB(kcf, crypto_register_provider, nomod_minus_one);
1000	NO_UNLOAD_STUB(kcf, crypto_unregister_provider, nomod_minus_one);
1001	NO_UNLOAD_STUB(kcf, crypto_provider_notification, nomod_minus_one);
1002	NO_UNLOAD_STUB(kcf, crypto_op_notification, nomod_minus_one);
1003	NO_UNLOAD_STUB(kcf, crypto_kmflag, nomod_minus_one);
1004	NO_UNLOAD_STUB(kcf, crypto_digest, nomod_minus_one);
1005	NO_UNLOAD_STUB(kcf, crypto_digest_prov, nomod_minus_one);
1006	NO_UNLOAD_STUB(kcf, crypto_digest_init, nomod_minus_one);
1007	NO_UNLOAD_STUB(kcf, crypto_digest_init_prov, nomod_minus_one);
1008	NO_UNLOAD_STUB(kcf, crypto_digest_update, nomod_minus_one);
1009	NO_UNLOAD_STUB(kcf, crypto_digest_final, nomod_minus_one);
1010	NO_UNLOAD_STUB(kcf, crypto_digest_key_prov, nomod_minus_one);
1011	NO_UNLOAD_STUB(kcf, crypto_encrypt, nomod_minus_one);
1012	NO_UNLOAD_STUB(kcf, crypto_encrypt_prov, nomod_minus_one);
1013	NO_UNLOAD_STUB(kcf, crypto_encrypt_init, nomod_minus_one);
1014	NO_UNLOAD_STUB(kcf, crypto_encrypt_init_prov, nomod_minus_one);
1015	NO_UNLOAD_STUB(kcf, crypto_encrypt_update, nomod_minus_one);
1016	NO_UNLOAD_STUB(kcf, crypto_encrypt_final, nomod_minus_one);
1017	NO_UNLOAD_STUB(kcf, crypto_decrypt, nomod_minus_one);
1018	NO_UNLOAD_STUB(kcf, crypto_decrypt_prov, nomod_minus_one);
1019	NO_UNLOAD_STUB(kcf, crypto_decrypt_init, nomod_minus_one);
1020	NO_UNLOAD_STUB(kcf, crypto_decrypt_init_prov, nomod_minus_one);
1021	NO_UNLOAD_STUB(kcf, crypto_decrypt_update, nomod_minus_one);
1022	NO_UNLOAD_STUB(kcf, crypto_decrypt_final, nomod_minus_one);
1023	NO_UNLOAD_STUB(kcf, crypto_get_all_mech_info, nomod_minus_one);
1024	NO_UNLOAD_STUB(kcf, crypto_key_check, nomod_minus_one);
1025	NO_UNLOAD_STUB(kcf, crypto_key_check_prov, nomod_minus_one);
1026	NO_UNLOAD_STUB(kcf, crypto_key_derive, nomod_minus_one);
1027	NO_UNLOAD_STUB(kcf, crypto_key_generate, nomod_minus_one);
1028	NO_UNLOAD_STUB(kcf, crypto_key_generate_pair, nomod_minus_one);
1029	NO_UNLOAD_STUB(kcf, crypto_key_unwrap, nomod_minus_one);
1030	NO_UNLOAD_STUB(kcf, crypto_key_wrap, nomod_minus_one);
1031	NO_UNLOAD_STUB(kcf, crypto_mac, nomod_minus_one);
1032	NO_UNLOAD_STUB(kcf, crypto_mac_prov, nomod_minus_one);
1033	NO_UNLOAD_STUB(kcf, crypto_mac_verify, nomod_minus_one);
1034	NO_UNLOAD_STUB(kcf, crypto_mac_verify_prov, nomod_minus_one);
1035	NO_UNLOAD_STUB(kcf, crypto_mac_init, nomod_minus_one);
1036	NO_UNLOAD_STUB(kcf, crypto_mac_init_prov, nomod_minus_one);
1037	NO_UNLOAD_STUB(kcf, crypto_mac_update, nomod_minus_one);
1038	NO_UNLOAD_STUB(kcf, crypto_mac_final, nomod_minus_one);
1039	NO_UNLOAD_STUB(kcf, crypto_mac_decrypt, nomod_minus_one);
1040	NO_UNLOAD_STUB(kcf, crypto_mac_decrypt_prov, nomod_minus_one);
1041	NO_UNLOAD_STUB(kcf, crypto_mac_verify_decrypt, nomod_minus_one);
1042	NO_UNLOAD_STUB(kcf, crypto_mac_verify_decrypt_prov, nomod_minus_one);
1043	NO_UNLOAD_STUB(kcf, crypto_mac_decrypt_init, nomod_minus_one);
1044	NO_UNLOAD_STUB(kcf, crypto_mac_decrypt_init_prov, nomod_minus_one);
1045	NO_UNLOAD_STUB(kcf, crypto_mac_decrypt_update, nomod_minus_one);
1046	NO_UNLOAD_STUB(kcf, crypto_mac_decrypt_final, nomod_minus_one);
1047	NO_UNLOAD_STUB(kcf, crypto_object_copy, nomod_minus_one);
1048	NO_UNLOAD_STUB(kcf, crypto_object_create, nomod_minus_one);
1049	NO_UNLOAD_STUB(kcf, crypto_object_destroy, nomod_minus_one);
1050	NO_UNLOAD_STUB(kcf, crypto_object_find_final, nomod_minus_one);
1051	NO_UNLOAD_STUB(kcf, crypto_object_find_init, nomod_minus_one);
1052	NO_UNLOAD_STUB(kcf, crypto_object_find, nomod_minus_one);
1053	NO_UNLOAD_STUB(kcf, crypto_object_get_attribute_value, nomod_minus_one);
1054	NO_UNLOAD_STUB(kcf, crypto_object_get_size, nomod_minus_one);
1055	NO_UNLOAD_STUB(kcf, crypto_object_set_attribute_value, nomod_minus_one);
1056	NO_UNLOAD_STUB(kcf, crypto_session_close, nomod_minus_one);
1057	NO_UNLOAD_STUB(kcf, crypto_session_login, nomod_minus_one);
1058	NO_UNLOAD_STUB(kcf, crypto_session_logout, nomod_minus_one);
1059	NO_UNLOAD_STUB(kcf, crypto_session_open, nomod_minus_one);
1060	NO_UNLOAD_STUB(kcf, crypto_encrypt_mac, nomod_minus_one);
1061	NO_UNLOAD_STUB(kcf, crypto_encrypt_mac_prov, nomod_minus_one);
1062	NO_UNLOAD_STUB(kcf, crypto_encrypt_mac_init, nomod_minus_one);
1063	NO_UNLOAD_STUB(kcf, crypto_encrypt_mac_init_prov, nomod_minus_one);
1064	NO_UNLOAD_STUB(kcf, crypto_encrypt_mac_update, nomod_minus_one);
1065	NO_UNLOAD_STUB(kcf, crypto_encrypt_mac_final, nomod_minus_one);
1066	NO_UNLOAD_STUB(kcf, crypto_create_ctx_template, nomod_minus_one);
1067	NO_UNLOAD_STUB(kcf, crypto_destroy_ctx_template, nomod_minus_one);
1068	NO_UNLOAD_STUB(kcf, crypto_get_mech_list, nomod_minus_one);
1069	NO_UNLOAD_STUB(kcf, crypto_free_mech_list, nomod_minus_one);
1070	NO_UNLOAD_STUB(kcf, crypto_cancel_req, nomod_minus_one);
1071	NO_UNLOAD_STUB(kcf, crypto_cancel_ctx, nomod_minus_one);
1072	NO_UNLOAD_STUB(kcf, crypto_bufcall_alloc, nomod_minus_one);
1073	NO_UNLOAD_STUB(kcf, crypto_bufcall_free, nomod_minus_one);
1074	NO_UNLOAD_STUB(kcf, crypto_bufcall, nomod_minus_one);
1075	NO_UNLOAD_STUB(kcf, crypto_unbufcall, nomod_minus_one);
1076	NO_UNLOAD_STUB(kcf, crypto_notify_events, nomod_minus_one);
1077	NO_UNLOAD_STUB(kcf, crypto_unnotify_events, nomod_minus_one);
1078	NO_UNLOAD_STUB(kcf, crypto_get_provider, nomod_minus_one);
1079	NO_UNLOAD_STUB(kcf, crypto_get_provinfo, nomod_minus_one);
1080	NO_UNLOAD_STUB(kcf, crypto_release_provider, nomod_minus_one);
1081	NO_UNLOAD_STUB(kcf, crypto_sign, nomod_minus_one);
1082	NO_UNLOAD_STUB(kcf, crypto_sign_prov, nomod_minus_one);
1083	NO_UNLOAD_STUB(kcf, crypto_sign_init, nomod_minus_one);
1084	NO_UNLOAD_STUB(kcf, crypto_sign_init_prov, nomod_minus_one);
1085	NO_UNLOAD_STUB(kcf, crypto_sign_update, nomod_minus_one);
1086	NO_UNLOAD_STUB(kcf, crypto_sign_final, nomod_minus_one);
1087	NO_UNLOAD_STUB(kcf, crypto_sign_recover, nomod_minus_one);
1088	NO_UNLOAD_STUB(kcf, crypto_sign_recover_prov, nomod_minus_one);
1089	NO_UNLOAD_STUB(kcf, crypto_sign_recover_init_prov, nomod_minus_one);
1090	NO_UNLOAD_STUB(kcf, crypto_verify, nomod_minus_one);
1091	NO_UNLOAD_STUB(kcf, crypto_verify_prov, nomod_minus_one);
1092	NO_UNLOAD_STUB(kcf, crypto_verify_init, nomod_minus_one);
1093	NO_UNLOAD_STUB(kcf, crypto_verify_init_prov, nomod_minus_one);
1094	NO_UNLOAD_STUB(kcf, crypto_verify_update, nomod_minus_one);
1095	NO_UNLOAD_STUB(kcf, crypto_verify_final, nomod_minus_one);
1096	NO_UNLOAD_STUB(kcf, crypto_verify_recover, nomod_minus_one);
1097	NO_UNLOAD_STUB(kcf, crypto_verify_recover_prov, nomod_minus_one);
1098	NO_UNLOAD_STUB(kcf, crypto_verify_recover_init_prov, nomod_minus_one);
1099	NO_UNLOAD_STUB(kcf, random_add_entropy, nomod_minus_one);
1100	NO_UNLOAD_STUB(kcf, random_add_pseudo_entropy, nomod_minus_one);
1101	NO_UNLOAD_STUB(kcf, random_get_blocking_bytes, nomod_minus_one);
1102	NO_UNLOAD_STUB(kcf, random_get_bytes, nomod_minus_one);
1103	NO_UNLOAD_STUB(kcf, random_get_pseudo_bytes, nomod_minus_one);
1104	END_MODULE(kcf);
1105#endif
1106
1107/*
1108 * Stubs for sha1. A non-unloadable module.
1109 */
1110#ifndef SHA1_MODULE
1111	MODULE(sha1,crypto);
1112	NO_UNLOAD_STUB(sha1, SHA1Init, nomod_void);
1113	NO_UNLOAD_STUB(sha1, SHA1Update, nomod_void);
1114	NO_UNLOAD_STUB(sha1, SHA1Final,	nomod_void);
1115	END_MODULE(sha1);
1116#endif
1117
1118/*
1119 * The following stubs are used by the mac module.
1120 * Since dld already depends on mac, these
1121 * stubs are needed to avoid circular dependencies.
1122 */
1123#ifndef	DLD_MODULE
1124	MODULE(dld,drv);
1125	STUB(dld, dld_init_ops, nomod_void);
1126	STUB(dld, dld_fini_ops, nomod_void);
1127	STUB(dld, dld_autopush, nomod_minus_one);
1128	STUB(dld, dld_devt_to_instance, nomod_minus_one);
1129	STUB(dld, dld_ioc_register, nomod_einval);
1130	STUB(dld, dld_ioc_unregister, nomod_void);
1131	END_MODULE(dld);
1132#endif
1133
1134/*
1135 * The following stubs are used by the mac module.
1136 * Since dls already depends on mac, these
1137 * stubs are needed to avoid circular dependencies.
1138 */
1139#ifndef	DLS_MODULE
1140	MODULE(dls,misc);
1141	STUB(dls, dls_devnet_mac, nomod_zero);
1142	STUB(dls, dls_devnet_hold_tmp, nomod_einval);
1143	STUB(dls, dls_devnet_rele_tmp, nomod_void);
1144	STUB(dls, dls_devnet_hold_link, nomod_einval);
1145	STUB(dls, dls_devnet_rele_link, nomod_void);
1146	STUB(dls, dls_devnet_prop_task_wait, nomod_void);
1147	STUB(dls, dls_mgmt_get_linkid, nomod_einval);
1148	STUB(dls, dls_devnet_macname2linkid, nomod_einval);
1149	STUB(dls, dls_mgmt_get_linkinfo, nomod_einval);
1150	END_MODULE(dls);
1151#endif
1152
1153#ifndef SOFTMAC_MODULE
1154	MODULE(softmac,drv);
1155	STUB(softmac, softmac_hold_device, nomod_einval);
1156	STUB(softmac, softmac_rele_device, nomod_void);
1157	STUB(softmac, softmac_recreate, nomod_void);
1158	END_MODULE(softmac);
1159#endif
1160
1161#ifndef IPTUN_MODULE
1162	MODULE(iptun,drv);
1163	STUB(iptun, iptun_create, nomod_einval);
1164	STUB(iptun, iptun_delete, nomod_einval);
1165	STUB(iptun, iptun_set_policy, nomod_einval);
1166	END_MODULE(iptun);
1167#endif
1168
1169/*
1170 * Stubs for dcopy, for Intel IOAT KAPIs
1171 */
1172#ifndef DCOPY_MODULE
1173	MODULE(dcopy,misc);
1174	NO_UNLOAD_STUB(dcopy, dcopy_query, nomod_minus_one);
1175	NO_UNLOAD_STUB(dcopy, dcopy_query_channel, nomod_minus_one);
1176	NO_UNLOAD_STUB(dcopy, dcopy_alloc, nomod_minus_one);
1177	NO_UNLOAD_STUB(dcopy, dcopy_free, nomod_minus_one);
1178	NO_UNLOAD_STUB(dcopy, dcopy_cmd_alloc, nomod_minus_one);
1179	NO_UNLOAD_STUB(dcopy, dcopy_cmd_free, nomod_void);
1180	NO_UNLOAD_STUB(dcopy, dcopy_cmd_post, nomod_minus_one);
1181	NO_UNLOAD_STUB(dcopy, dcopy_cmd_poll, nomod_minus_one);
1182	END_MODULE(dcopy);
1183#endif
1184
1185#ifndef IPNET_MODULE
1186	MODULE(ipnet,drv);
1187	STUB(ipnet, ipnet_if_getdev, nomod_zero);
1188	STUB(ipnet, ipnet_walk_if, nomod_zero);
1189	END_MODULE(ipnet);
1190#endif
1191
1192/*
1193 * Stubs for kernel socket, for iscsi
1194 */
1195#ifndef KSOCKET_MODULE
1196	MODULE(ksocket, misc);
1197	NO_UNLOAD_STUB(ksocket, ksocket_setsockopt, nomod_minus_one);
1198	NO_UNLOAD_STUB(ksocket, ksocket_getsockopt, nomod_minus_one);
1199	NO_UNLOAD_STUB(ksocket, ksocket_getpeername, nomod_minus_one);
1200	NO_UNLOAD_STUB(ksocket, ksocket_getsockname, nomod_minus_one);
1201	NO_UNLOAD_STUB(ksocket, ksocket_socket, nomod_minus_one);
1202	NO_UNLOAD_STUB(ksocket, ksocket_bind, nomod_minus_one);
1203	NO_UNLOAD_STUB(ksocket, ksocket_listen, nomod_minus_one);
1204	NO_UNLOAD_STUB(ksocket, ksocket_accept, nomod_minus_one);
1205	NO_UNLOAD_STUB(ksocket, ksocket_connect, nomod_minus_one);
1206	NO_UNLOAD_STUB(ksocket, ksocket_recv, nomod_minus_one);
1207	NO_UNLOAD_STUB(ksocket, ksocket_recvfrom, nomod_minus_one);
1208	NO_UNLOAD_STUB(ksocket, ksocket_recvmsg, nomod_minus_one);
1209	NO_UNLOAD_STUB(ksocket, ksocket_send, nomod_minus_one);
1210	NO_UNLOAD_STUB(ksocket, ksocket_sendto, nomod_minus_one);
1211	NO_UNLOAD_STUB(ksocket, ksocket_sendmsg, nomod_minus_one);
1212	NO_UNLOAD_STUB(ksocket, ksocket_ioctl, nomod_minus_one);
1213	NO_UNLOAD_STUB(ksocket, ksocket_setcallbacks, nomod_minus_one);
1214	NO_UNLOAD_STUB(ksocket, ksocket_hold, nomod_minus_one);
1215	NO_UNLOAD_STUB(ksocket, ksocket_rele, nomod_minus_one);
1216	NO_UNLOAD_STUB(ksocket, ksocket_shutdown, nomod_minus_one);
1217	NO_UNLOAD_STUB(ksocket, ksocket_close, nomod_minus_one);
1218	END_MODULE(ksocket);
1219#endif
1220
1221/*
1222 * Stubs for elfexec
1223 */
1224#ifndef ELFEXEC_MODULE
1225	MODULE(elfexec,exec);
1226	STUB(elfexec, elfexec,      	nomod_einval);
1227	STUB(elfexec, elf32exec,	nomod_einval);
1228	STUB(elfexec, mapexec_brand,	nomod_einval);
1229	STUB(elfexec, mapexec32_brand,	nomod_einval);
1230	END_MODULE(elfexec);
1231#endif
1232
1233! this is just a marker for the area of text that contains stubs
1234	.seg ".text"
1235	.global stubs_end
1236stubs_end:
1237	nop
1238