modstubs.s revision 894b27768c68091df4918b3219c91ed77d2d4054
2N/A * The contents of this file are subject to the terms of the 2N/A * Common Development and Distribution License, Version 1.0 only 2N/A * (the "License"). You may not use this file except in compliance 2N/A * See the License for the specific language governing permissions 2N/A * and limitations under the License. 2N/A * When distributing Covered Code, include this CDDL HEADER in each 2N/A * If applicable, add the following below this CDDL HEADER, with the 2N/A * fields enclosed by brackets "[]" replaced with your own identifying 2N/A * information: Portions Copyright [yyyy] [name of copyright owner] 2N/A * Copyright 2005 Sun Microsystems, Inc. All rights reserved. 2N/A * Use is subject to license terms. 2N/A#
pragma ident "%Z%%M% %I% %E% SMI" 2N/A * WARNING: there is no check for forgetting to write END_MODULE, 2N/A * and if you do, the kernel will most likely crash. Be careful 2N/A * This file assumes that all of the contributions to the data segment 2N/A * will be contiguous in the output file, even though they are separated 2N/A * by pieces of text. This is safe for all assemblers I know of now... 2N/A * This file uses ansi preprocessor features: 2N/A * 1. #define mac(a) extra_ ## a --> mac(x) expands to extra_a 2N/A * The old version of this is 2N/A * #define mac(a) extra_/.*.*./a 2N/A * but this fails if the argument has spaces "mac ( x )" 2N/A * (Ignore the dots above, I had to put them in to keep this a comment.) 2N/A * 2. #define mac(a) #a --> mac(x) expands to "x" 2N/A * The old version is 2N/A * #define mac(a) "a" 2N/A * For some reason, the 5.0 preprocessor isn't happy with the above usage. 2N/A * For now, we're not using these ansi features. 2N/A * The reason is that "the 5.0 ANSI preprocessor" is built into the compiler 2N/A * and is a tokenizing preprocessor. This means, when confronted by something 2N/A * other than C token generation rules, strange things occur. In this case, 2N/A * when confronted by an assembly file, it would turn the token ".globl" into 2N/A * two tokens "." and "globl". For this reason, the traditional, non-ANSI 2N/A * 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. * See the 'struct mod_modinfo' definition to see what this structure * is trying to achieve here. * XX64 - This still needs some repair. * (a) define 'pointer alignment' and use it * (b) define '.pword' or equivalent, and use it (to mean .word or .xword). * "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). * Macro for modstubbed system calls whose modules are not unloadable. * System call modstubs needs special handling for the case where * the modstub is a system call, because %fp comes from user frame. /* "weak stub" for non-unloadable module, don't load on account of this call */ * 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.) be,a
1f;
/* not weak */ \
bne,a,
pt %
xcc,
1f;
/* yes, do mod_hold thing */ \
jmp %
g1;
/* no, just jump to retfcn */ \
1:
sub %
sp, %
fp, %
g1;
/* get (-)size of callers stack */ \
save %
sp, %
g1, %
sp;
/* create new frame same size */ \
sub %
g0, %
g1, %
l4;
/* size of stack frame */ \
be,a
2f;
/* no, load module */ \
1:
jmp %
g1;
/* off we go */ \
2:
sub %
sp, %
fp, %
g1;
/* get (-)size of callers frame */ \
save %
sp, %
g1, %
sp;
/* create new frame same size */ \
sub %
g0, %
g1, %
l4;
/* size of stack frame */ \
be,a %
xcc,
1f;
/* no, load module */ \
jmp %
g1;
/* yes, off we go */ \
* We branch here with the fcnname_info pointer in l5 * and the frame size in %l4. sub %
l4,
0x80, %
l4 /* skip locals and outs */ add %
fp,
0x80, %
l1 /* get original sp before save */ cmp %
o0, -
1 /* if error then return error */ mov %
i0, %
o0 /* copy over incoming args, if number of */ mov %
i1, %
o1 /* args is > 6 then we copied them above */ call %
g1 /* jump to the stub function */ mov %
o0, %
i0 /* copy any return values */ ret /* return to caller */ * 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 * 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. * Stubs for specfs. A non-unloadable module. * Stubs for sockfs. A non-unloadable module. #
endif /* _SYSCALL32_IMPL */ * Stubs for nfs common code. * XXX nfs_getvnodeops should go away with removal of kludge in vnode.c * Stubs for nfs_dlboot (diskless booting). * Stubs for nfs server-only code. * Stubs for kernel lock manager. * Stubs for kernel TLI module * XXX currently we never allow this to unload * Stubs for kernel RPC module * XXX currently we never allow this to unload * Stubs for procfs. A non-unloadable module. #
endif /* _SYSCALL32_IMPL */ * This is needed to support the old quotactl system call. * When the old sysent stuff goes away, this will need to be revisited. * Stubs for FSS scheduler * Stubs for kb (only needed for 'win') * Stubs for console configuration module * Stubs for zs (uart) module * Stubs for semaphore routines. sem.c * Stubs for shmem routines. shm.c * (These are only needed for cross-checks, not autoloading) * Stubs for kernel rpc security service module * Stubs for rpc RPCSEC_GSS security service module * Stubs for checkpoint-resume module * Stubs for kernel probes (tnf module). Not unloadable. * Clustering: stubs for bootstrapping. * Clustering: stubs for cluster infrastructure. * Clustering: stubs for global file system operations. * Stubs for PCI configurator module (misc/pcicfg). * Stubs for kernel cryptographic framework module (misc/kcf). * Stubs for sha1. A non-unloadable module. * The following stubs are used by the mac module. * Since dls and dld already depend on mac, these * stubs are needed to avoid circular dependencies. * Stubs for kssl, the kernel SSL proxy