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