Print this page
re #13613 rb4516 Tunables needs volatile keyword


   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 2009 Sun Microsystems, Inc.  All rights reserved.
  23  * Use is subject to license terms.
  24  */
  25 /*
  26  * Copyright 2011 Bayard G. Bell <buffer.g.overflow@gmail.com>.
  27  * All rights reserved. Use is subject to license terms.
  28  */



  29 
  30 /*
  31  * Kernel's linker/loader
  32  */
  33 
  34 #include <sys/types.h>
  35 #include <sys/param.h>
  36 #include <sys/sysmacros.h>
  37 #include <sys/systm.h>
  38 #include <sys/user.h>
  39 #include <sys/kmem.h>
  40 #include <sys/reboot.h>
  41 #include <sys/bootconf.h>
  42 #include <sys/debug.h>
  43 #include <sys/uio.h>
  44 #include <sys/file.h>
  45 #include <sys/vnode.h>
  46 #include <sys/user.h>
  47 #include <sys/mman.h>
  48 #include <vm/as.h>


 305  * specification in the format string.
 306  */
 307 void (*_kobj_printf)(void *, const char *, ...);        /* printf routine */
 308 
 309 /*
 310  * Standalone function pointers for use within krtld.
 311  * Many platforms implement optimized platmod versions of
 312  * utilities such as bcopy and any such are not yet available
 313  * until the kernel is more completely stitched together.
 314  * See kobj_impl.h
 315  */
 316 void (*kobj_bcopy)(const void *, void *, size_t);
 317 void (*kobj_bzero)(void *, size_t);
 318 size_t (*kobj_strlcat)(char *, const char *, size_t);
 319 
 320 static kobj_stat_t kobj_stat;
 321 
 322 #define MINALIGN        8       /* at least a double-word */
 323 
 324 int
 325 get_weakish_int(int *ip)
 326 {
 327         if (standalone)
 328                 return (0);
 329         return (ip == NULL ? 0 : *ip);
 330 }
 331 
 332 static void *
 333 get_weakish_pointer(void **ptrp)
 334 {
 335         if (standalone)
 336                 return (0);
 337         return (ptrp == NULL ? 0 : *ptrp);
 338 }
 339 
 340 /*
 341  * XXX fix dependencies on "kernel"; this should work
 342  * for other standalone binaries as well.
 343  *
 344  * XXX Fix hashing code to use one pointer to
 345  * hash entries.




   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 2009 Sun Microsystems, Inc.  All rights reserved.
  23  * Use is subject to license terms.
  24  */
  25 /*
  26  * Copyright 2011 Bayard G. Bell <buffer.g.overflow@gmail.com>.
  27  * All rights reserved. Use is subject to license terms.
  28  */
  29 /*
  30  * Copyright 2013 Nexenta Systems, Inc.  All rights reserved.
  31  */
  32 
  33 /*
  34  * Kernel's linker/loader
  35  */
  36 
  37 #include <sys/types.h>
  38 #include <sys/param.h>
  39 #include <sys/sysmacros.h>
  40 #include <sys/systm.h>
  41 #include <sys/user.h>
  42 #include <sys/kmem.h>
  43 #include <sys/reboot.h>
  44 #include <sys/bootconf.h>
  45 #include <sys/debug.h>
  46 #include <sys/uio.h>
  47 #include <sys/file.h>
  48 #include <sys/vnode.h>
  49 #include <sys/user.h>
  50 #include <sys/mman.h>
  51 #include <vm/as.h>


 308  * specification in the format string.
 309  */
 310 void (*_kobj_printf)(void *, const char *, ...);        /* printf routine */
 311 
 312 /*
 313  * Standalone function pointers for use within krtld.
 314  * Many platforms implement optimized platmod versions of
 315  * utilities such as bcopy and any such are not yet available
 316  * until the kernel is more completely stitched together.
 317  * See kobj_impl.h
 318  */
 319 void (*kobj_bcopy)(const void *, void *, size_t);
 320 void (*kobj_bzero)(void *, size_t);
 321 size_t (*kobj_strlcat)(char *, const char *, size_t);
 322 
 323 static kobj_stat_t kobj_stat;
 324 
 325 #define MINALIGN        8       /* at least a double-word */
 326 
 327 int
 328 get_weakish_int(volatile int *ip)
 329 {
 330         if (standalone)
 331                 return (0);
 332         return (ip == NULL ? 0 : *ip);
 333 }
 334 
 335 static void *
 336 get_weakish_pointer(void **ptrp)
 337 {
 338         if (standalone)
 339                 return (0);
 340         return (ptrp == NULL ? 0 : *ptrp);
 341 }
 342 
 343 /*
 344  * XXX fix dependencies on "kernel"; this should work
 345  * for other standalone binaries as well.
 346  *
 347  * XXX Fix hashing code to use one pointer to
 348  * hash entries.