modstubs.s revision 09011d400721fbca9dc5dfabd23419badcc06fc1
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#include <sys/asm_linkage.h>
#if defined(__lint)
#else /* __lint */
#include "assym.h"
/*
* !!!!!!!! WARNING! WARNING! WARNING! WARNING! WARNING! WARNING! !!!!!!!!
*
* For functions which are either STUBs or WSTUBs the actual function
* need to be called using 'call' instruction because of preamble and
* postamble (i.e mod_hold_stub and mod_release_stub) around the
* function call. Due to this we need to copy arguments for the
* real function. On Intel we can't tell how many arguments are there
* on the stack so we have to either copy everything between esp and
* ebp or copy only a fixed number (MAXNARG - defined here) for
* all the stub functions. Currently we are using MAXNARG (it is a kludge
* but worth it?!).
*
* NOTE: Use NO_UNLOAD_STUBs if the module is NOT unloadable once it is
* loaded.
*/
#define MAXNARG 10
/*
* WARNING: there is no check for forgetting to write END_MODULE,
* and if you do, the kernel will most likely crash. Be careful
*
* This file assumes that all of the contributions to the data segment
* will be contiguous in the output file, even though they are separated
* by pieces of text. This is safe for all assemblers I know of now...
*/
/*
* This file uses ansi preprocessor features:
*
* 1. #define mac(a) extra_ ## a --> mac(x) expands to extra_a
* The old version of this is
* #define mac(a) extra_/.*.*./a
* but this fails if the argument has spaces "mac ( x )"
* (Ignore the dots above, I had to put them in to keep this a comment.)
*
* 2. #define mac(a) #a --> mac(x) expands to "x"
* The old version is
* #define mac(a) "a"
*
* For some reason, the 5.0 preprocessor isn't happy with the above usage.
* For now, we're not using these ansi features.
*
* The reason is that "the 5.0 ANSI preprocessor" is built into the compiler
* and is a tokenizing preprocessor. This means, when confronted by something
* other than C token generation rules, strange things occur. In this case,
* when confronted by an assembly file, it would turn the token ".globl" into
* two tokens "." and "globl". For this reason, the traditional, non-ANSI
* preprocessor is used on assembly files.
*
* It would be desirable to have a non-tokenizing cpp (accp?) to use for this.
*/
/*
* This file contains the stubs routines for modules which can be autoloaded.
*/
#if defined(__amd64)
/*
* See the 'struct mod_modinfo' definition to see what this declaration
* is trying to achieve here.
*/
.data; \
.quad 0 /* storage for modctl pointer */
/* then mod_stub_info structures follow until a mods_func_adr is 0 */
/* this puts a 0 where the next mods_func_adr would be */
#define END_MODULE(module) \
.data; \
.quad 0; \
/*
* The data section in the stub_common macro is the
* mod_stub_info structure for the stub function
*/
.data; \
.long weak; /* 0x20 */ \
.data; \
.long weak; /* 0x20 */ \
/*
* We branch here with the fcnname_info pointer in %rax
*/
/*
* save incoming register arguments
*/
/* (next 4 args, if any, are already on the stack above %rbp) */
.L1:
/*
* copy MAXNARG == 10 incoming arguments
*/
/*
* stack:
* arg9 0x38(%rsp)
* arg8 0x30(%rsp)
* arg7 0x28(%rsp)
* arg6 0x20(%rsp)
* saved %rip 0x18(%rsp)
* saved %rbp 0x10(%rsp)
* <pad> 0x8(%rsp)
* saved %r15 0x0(%rsp)
*/
.L2:
/*
* See the 'struct mod_modinfo' definition to see what this declaration
* is trying to achieve here.
*/
.data; \
.long 0 /* storage for modctl pointer */
/* then mod_stub_info structures follow until a mods_func_adr is 0 */
/* this puts a 0 where the next mods_func_adr would be */
#define END_MODULE(module) \
.data; \
.long 0; \
/*
* The data section in the stub_common macro is the
* mod_stub_info structure for the stub function
*/
/*
* The flag MODS_INSTALLED is stored in the stub data and is used to
* indicate if a module is installed and initialized. This flag is used
* instead of the mod_stub_info->mods_modinfo->mod_installed flag
* to minimize the number of pointer de-references for each function
* call (and also to avoid possible TLB misses which could be induced
* by dereferencing these pointers.)
*/
.data; \
.long install_fcn; \
.long fcnname; \
.long retfcn; \
.long weak; \
.data; \
.long install_fcn; /* 0 */ \
.long fcnname; /* 0x8 */ \
.long retfcn; /* 0xc */ \
.long weak; /* 0x10 */ \
/*
* We branch here with the fcnname_info pointer in %eax
*/
.L1:
.L2:
#endif /* __i386 */
/*
* "weak stub", don't load on account of this call
*/
/*
* "non-unloadable stub", don't bother 'holding' module if it's already loaded
* since the module cannot be unloaded.
*
* User *MUST* guarantee the module is not unloadable (no _fini routine).
*/
/*
* "weak stub" for non-unloadable module, don't load on account of this call
*/
/*
* this is just a marker for the beginning area of text that contains stubs
*/
/*
* WARNING WARNING WARNING!!!!!!
*
* On the MODULE macro you MUST NOT use any spaces!!! They are
* significant to the preprocessor. With ansi c there is a way around this
* but for some reason (yet to be investigated) ansi didn't work for other
* reasons!
*
* When zero is used as the return function, the system will call
* panic if the stub can't be resolved.
*/
/*
* Stubs for devfs. A non-unloadable module.
*/
#ifndef DEVFS_MODULE
#endif
#ifndef DEV_MODULE
#endif
/*
* Stubs for specfs. A non-unloadable module.
*/
#ifndef SPEC_MODULE
#endif
/*
* Stubs for sockfs. A non-unloadable module.
*/
#ifndef SOCK_MODULE
#ifdef _SYSCALL32_IMPL
#endif /* _SYSCALL32_IMPL */
#endif
/*
* IPsec stubs.
*/
#ifndef IPSECAH_MODULE
#endif
#ifndef IPSECESP_MODULE
#endif
#ifndef KEYSOCK_MODULE
#endif
#ifndef SPDSOCK_MODULE
#endif
/*
* Stubs for nfs common code.
* XXX nfs_getvnodeops should go away with removal of kludge in vnode.c
*/
#ifndef NFS_MODULE
#endif
/*
* Stubs for nfs_dlboot (diskless booting).
*/
#ifndef NFS_DLBOOT_MODULE
#endif
/*
* Stubs for nfs server-only code.
*/
#ifndef NFSSRV_MODULE
#endif
/*
* Stubs for kernel lock manager.
*/
#ifndef KLM_MODULE
#endif
#ifndef KLMOPS_MODULE
#endif
/*
* Stubs for kernel TLI module
* XXX currently we never allow this to unload
*/
#ifndef TLI_MODULE
#endif
/*
* Stubs for kernel RPC module
* XXX currently we never allow this to unload
*/
#ifndef RPC_MODULE
#endif
/*
* Stubs for des
*/
#ifndef DES_MODULE
#endif
/*
* Stubs for procfs. A non-unloadable module.
*/
#ifndef PROC_MODULE
#ifdef _SYSCALL32_IMPL
#endif /* _SYSCALL32_IMPL */
#endif
/*
* Stubs for fifofs
*/
#ifndef FIFO_MODULE
#endif
/*
* Stubs for ufs
*
* This is needed to support the old quotactl system call.
* When the old sysent stuff goes away, this will need to be revisited.
*/
#ifndef UFS_MODULE
#endif
/*
* Stubs for zfs
*/
#ifndef ZFS_MODULE
#endif
/*
* Stubs for dcfs
*/
#ifndef DCFS_MODULE
#endif
/*
* Stubs for namefs
*/
#ifndef NAMEFS_MODULE
#endif
/*
* Stubs for ts_dptbl
*/
#ifndef TS_DPTBL_MODULE
#endif
/*
* Stubs for rt_dptbl
*/
#ifndef RT_DPTBL_MODULE
#endif
/*
* Stubs for ia_dptbl
*/
#ifndef IA_DPTBL_MODULE
#endif
/*
* Stubs for FSS scheduler
*/
#ifndef FSS_MODULE
#endif
/*
* Stubs for fx_dptbl
*/
#ifndef FX_DPTBL_MODULE
#endif
/*
* Stubs for bootdev
*/
#ifndef BOOTDEV_MODULE
#endif
/*
* stubs for strplumb...
*/
#ifndef STRPLUMB_MODULE
#endif
/*
* Stubs for console configuration module
*/
#ifndef CONSCONFIG_MODULE
#endif
/*
* Stubs for accounting.
*/
#ifndef SYSACCT_MODULE
#endif
/*
* Stubs for semaphore routines. sem.c
*/
#ifndef SEMSYS_MODULE
#endif
/*
* Stubs for shmem routines. shm.c
*/
#ifndef SHMSYS_MODULE
#endif
/*
* Stubs for doors
*/
#ifndef DOOR_MODULE
#endif
/*
* Stubs for idmap
*/
#ifndef IDMAP_MODULE
#endif
/*
* Stubs for auditing.
*/
#ifndef C2AUDIT_MODULE
#endif
/*
* Stubs for kernel rpc security service module
*/
#ifndef RPCSEC_MODULE
#endif
/*
* Stubs for rpc RPCSEC_GSS security service module
*/
#ifndef RPCSEC_GSS_MODULE
#endif
/*
*/
#ifndef PCICFG_MODULE
#endif
/*
*/
#ifndef PCIEHPC_MODULE
#endif
#ifndef IWSCN_MODULE
#endif
/*
* Stubs for checkpoint-resume module
*/
#ifndef CPR_MODULE
#endif
/*
* Stubs for kernel probes (tnf module). Not unloadable.
*/
#ifndef TNF_MODULE
#endif
/*
* Stubs for i86hvm bootstraping
*/
#ifndef HVM_BOOTSTRAP
#endif
/*
* Clustering: stubs for bootstrapping.
*/
#ifndef CL_BOOTSTRAP
#endif
/*
* Clustering: stubs for cluster infrastructure.
*/
#ifndef CL_COMM_MODULE
#endif
/*
* Clustering: stubs for global file system operations.
*/
#ifndef PXFS_MODULE
#endif
/*
*/
#ifndef KCF_MODULE
#endif
/*
* Stubs for sha1. A non-unloadable module.
*/
#ifndef SHA1_MODULE
#endif
/*
* The following stubs are used by the mac module.
* Since dld already depends on mac, these
* stubs are needed to avoid circular dependencies.
*/
#ifndef DLD_MODULE
#endif
/*
* The following stubs are used by the mac module.
* Since dls already depends on mac, these
* stubs are needed to avoid circular dependencies.
*/
#ifndef DLS_MODULE
#endif
#ifndef SOFTMAC_MODULE
#endif
/*
* Stubs for SDP-IB driver.
*/
#ifndef SDPIB_MODULE
#endif
/*
* Stubs for kssl, the kernel SSL proxy
*/
#ifndef KSSL_MODULE
#endif
/*
* Stubs for dcopy, for Intel IOAT KAPIs
*/
#ifndef DCOPY_MODULE
#endif
#ifndef IPNET_MODULE
#endif
#ifndef IOMMULIB_MODULE
#endif
#endif /* lint */