Print this page
fixup .text where possible
7127  remove -Wno-missing-braces from Makefile.uts


  10  * or http://www.opensolaris.org/os/licensing.
  11  * See the License for the specific language governing permissions
  12  * and limitations under the License.
  13  *
  14  * When distributing Covered Code, include this CDDL HEADER in each
  15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  16  * If applicable, add the following below this CDDL HEADER, with the
  17  * fields enclosed by brackets "[]" replaced with your own identifying
  18  * information: Portions Copyright [yyyy] [name of copyright owner]
  19  *
  20  * CDDL HEADER END
  21  */
  22 /*
  23  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
  24  * Use is subject to license terms.
  25  */
  26 
  27 #ifndef _SYS_MODEL_H
  28 #define _SYS_MODEL_H
  29 
  30 #pragma ident   "%Z%%M% %I%     %E% SMI"
  31 

  32 #ifdef  __cplusplus
  33 extern "C" {
  34 #endif
  35 
  36 #if defined(_KERNEL) && !defined(_ASM)
  37 #include <sys/debug.h>
  38 #endif /* _KERNEL && !_ASM */
  39 
  40 #include <sys/isa_defs.h>
  41 
  42 #if defined(_KERNEL) || defined(_KMEMUSER)
  43 
  44 /*
  45  * These bits are used in various places to specify the data model
  46  * of the originator (and/or consumer) of data items.  See <sys/conf.h>
  47  * <sys/file.h>, <sys/stream.h> and <sys/sunddi.h>.
  48  *
  49  * This state should only be known to the kernel implementation.
  50  */
  51 #define DATAMODEL_MASK  0x0FF00000


  74  */
  75 typedef unsigned int model_t;
  76 
  77 #endif  /* _ASM */
  78 
  79 #if defined(_KERNEL) && !defined(_ASM)
  80 /*
  81  * These macros allow two views of the same piece of memory depending
  82  * on the originating user-mode program's data model.  See the STRUCT_DECL(9F)
  83  * man page.
  84  */
  85 #if defined(_LP64)
  86 
  87 #define STRUCT_HANDLE(struct_type, handle)                              \
  88         struct {                                                        \
  89                 union {                                                 \
  90                         struct struct_type##32  *m32;                   \
  91                         struct struct_type      *m64;                   \
  92                 }       ptr;                                            \
  93                 model_t model;                                          \
  94         } handle = { NULL, DATAMODEL_ILP32 }
  95 
  96 #define STRUCT_DECL(struct_type, handle)                                \
  97         struct struct_type __##handle##_buf;                            \
  98         STRUCT_HANDLE(struct_type, handle)
  99 
 100 #define STRUCT_SET_HANDLE(handle, umodel, addr)                         \
 101         (handle).model = (model_t)(umodel) & DATAMODEL_MASK;                \
 102         ASSERT(((umodel) & DATAMODEL_MASK) != DATAMODEL_NONE);              \
 103         ((handle).ptr.m64) = (addr)
 104 
 105 #define STRUCT_INIT(handle, umodel)                                     \
 106         STRUCT_SET_HANDLE(handle, umodel, &__##handle##_buf)
 107 
 108 #define STRUCT_SIZE(handle)                                             \
 109         ((handle).model == DATAMODEL_ILP32 ?                            \
 110             sizeof (*(handle).ptr.m32) :                                \
 111             sizeof (*(handle).ptr.m64))
 112 
 113 /*
 114  * In STRUCT_FADDR and STRUCT_FGETP a sleight of hand is employed to make




  10  * or http://www.opensolaris.org/os/licensing.
  11  * See the License for the specific language governing permissions
  12  * and limitations under the License.
  13  *
  14  * When distributing Covered Code, include this CDDL HEADER in each
  15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  16  * If applicable, add the following below this CDDL HEADER, with the
  17  * fields enclosed by brackets "[]" replaced with your own identifying
  18  * information: Portions Copyright [yyyy] [name of copyright owner]
  19  *
  20  * CDDL HEADER END
  21  */
  22 /*
  23  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
  24  * Use is subject to license terms.
  25  */
  26 
  27 #ifndef _SYS_MODEL_H
  28 #define _SYS_MODEL_H
  29 

  30 
  31 
  32 #ifdef  __cplusplus
  33 extern "C" {
  34 #endif
  35 
  36 #if defined(_KERNEL) && !defined(_ASM)
  37 #include <sys/debug.h>
  38 #endif /* _KERNEL && !_ASM */
  39 
  40 #include <sys/isa_defs.h>
  41 
  42 #if defined(_KERNEL) || defined(_KMEMUSER)
  43 
  44 /*
  45  * These bits are used in various places to specify the data model
  46  * of the originator (and/or consumer) of data items.  See <sys/conf.h>
  47  * <sys/file.h>, <sys/stream.h> and <sys/sunddi.h>.
  48  *
  49  * This state should only be known to the kernel implementation.
  50  */
  51 #define DATAMODEL_MASK  0x0FF00000


  74  */
  75 typedef unsigned int model_t;
  76 
  77 #endif  /* _ASM */
  78 
  79 #if defined(_KERNEL) && !defined(_ASM)
  80 /*
  81  * These macros allow two views of the same piece of memory depending
  82  * on the originating user-mode program's data model.  See the STRUCT_DECL(9F)
  83  * man page.
  84  */
  85 #if defined(_LP64)
  86 
  87 #define STRUCT_HANDLE(struct_type, handle)                              \
  88         struct {                                                        \
  89                 union {                                                 \
  90                         struct struct_type##32  *m32;                   \
  91                         struct struct_type      *m64;                   \
  92                 }       ptr;                                            \
  93                 model_t model;                                          \
  94         } handle = { { NULL }, DATAMODEL_ILP32 }
  95 
  96 #define STRUCT_DECL(struct_type, handle)                                \
  97         struct struct_type __##handle##_buf;                            \
  98         STRUCT_HANDLE(struct_type, handle)
  99 
 100 #define STRUCT_SET_HANDLE(handle, umodel, addr)                         \
 101         (handle).model = (model_t)(umodel) & DATAMODEL_MASK;                \
 102         ASSERT(((umodel) & DATAMODEL_MASK) != DATAMODEL_NONE);              \
 103         ((handle).ptr.m64) = (addr)
 104 
 105 #define STRUCT_INIT(handle, umodel)                                     \
 106         STRUCT_SET_HANDLE(handle, umodel, &__##handle##_buf)
 107 
 108 #define STRUCT_SIZE(handle)                                             \
 109         ((handle).model == DATAMODEL_ILP32 ?                            \
 110             sizeof (*(handle).ptr.m32) :                                \
 111             sizeof (*(handle).ptr.m64))
 112 
 113 /*
 114  * In STRUCT_FADDR and STRUCT_FGETP a sleight of hand is employed to make