modstubs.s revision d62bc4badc1c1f1549c961cfb8b420e650e1272b
252N/A * The contents of this file are subject to the terms of the 252N/A * Common Development and Distribution License (the "License"). 252N/A * You may not use this file except in compliance with the License. 252N/A * See the License for the specific language governing permissions 252N/A * and limitations under the License. 252N/A * When distributing Covered Code, include this CDDL HEADER in each 252N/A * If applicable, add the following below this CDDL HEADER, with the 252N/A * fields enclosed by brackets "[]" replaced with your own identifying 252N/A * information: Portions Copyright [yyyy] [name of copyright owner] 252N/A * Copyright 2008 Sun Microsystems, Inc. All rights reserved. 252N/A * Use is subject to license terms. 252N/A#
pragma ident "%Z%%M% %I% %E% SMI" 252N/A * WARNING: there is no check for forgetting to write END_MODULE, 252N/A * and if you do, the kernel will most likely crash. Be careful 252N/A * This file assumes that all of the contributions to the data segment 252N/A * will be contiguous in the output file, even though they are separated 252N/A * by pieces of text. This is safe for all assemblers I know of now... 252N/A * This file uses ansi preprocessor features: 252N/A * 1. #define mac(a) extra_ ## a --> mac(x) expands to extra_a 252N/A * The old version of this is 252N/A * #define mac(a) extra_/.*.*./a 252N/A * but this fails if the argument has spaces "mac ( x )" 252N/A * (Ignore the dots above, I had to put them in to keep this a comment.) 252N/A * 2. #define mac(a) #a --> mac(x) expands to "x" 252N/A * For some reason, the 5.0 preprocessor isn't happy with the above usage. 252N/A * For now, we're not using these ansi features. 252N/A * The reason is that "the 5.0 ANSI preprocessor" is built into the compiler 252N/A * and is a tokenizing preprocessor. This means, when confronted by something 252N/A * other than C token generation rules, strange things occur. In this case, 252N/A * when confronted by an assembly file, it would turn the token ".globl" into 252N/A * two tokens "." and "globl". For this reason, the traditional, non-ANSI 252N/A * preprocessor is used on assembly files. 252N/A * It would be desirable to have a non-tokenizing cpp (accp?) to use for this. 252N/A * This file contains the stubs routines for modules which can be autoloaded. 252N/A * See the 'struct mod_modinfo' definition to see what this structure 252N/A * is trying to achieve here. 252N/A * XX64 - This still needs some repair. 252N/A * (a) define 'pointer alignment' and use it 252N/A * (b) define '.pword' or equivalent, and use it (to mean .word or .xword). 252N/A * "weak stub", don't load on account of this call 252N/A * "non-unloadable stub", don't bother 'holding' module if it's already loaded 252N/A * since the module cannot be unloaded. 252N/A * 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 PCIEHPC (pci-ex hot plug support) module (misc/pciehpc). * 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 dld already depends on mac, these * stubs are needed to avoid circular dependencies. * The following stubs are used by the mac module. * Since dls already depends on mac, these * stubs are needed to avoid circular dependencies. * Stubs for kssl, the kernel SSL proxy