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