Print this page
8956 Implement KPTI
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
Reviewed by: Robert Mustacchi <rm@joyent.com>


  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 /*      Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T     */
  22 /*        All Rights Reserved   */
  23 
  24 
  25 /*
  26  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
  27  * Use is subject to license terms.
  28  *
  29  * Copyright 2013 Nexenta Systems, Inc.  All rights reserved.


  30  */
  31 
  32 #ifndef _SYS_SYSMACROS_H
  33 #define _SYS_SYSMACROS_H
  34 
  35 #include <sys/param.h>
  36 #include <sys/stddef.h>
  37 
  38 #ifdef  __cplusplus
  39 extern "C" {
  40 #endif
  41 
  42 /*
  43  * Some macros for units conversion
  44  */
  45 /*
  46  * Disk blocks (sectors) and bytes.
  47  */
  48 #define dtob(DD)        ((DD) << DEV_BSHIFT)
  49 #define btod(BB)        (((BB) + DEV_BSIZE - 1) >> DEV_BSHIFT)


 350         uint8_t _a, _b, _c, _d, _e, _f, _g, _h
 351 #elif defined(_BIT_FIELDS_HTOL)
 352 #define DECL_BITFIELD2(_a, _b)                          \
 353         uint8_t _b, _a
 354 #define DECL_BITFIELD3(_a, _b, _c)                      \
 355         uint8_t _c, _b, _a
 356 #define DECL_BITFIELD4(_a, _b, _c, _d)                  \
 357         uint8_t _d, _c, _b, _a
 358 #define DECL_BITFIELD5(_a, _b, _c, _d, _e)              \
 359         uint8_t _e, _d, _c, _b, _a
 360 #define DECL_BITFIELD6(_a, _b, _c, _d, _e, _f)          \
 361         uint8_t _f, _e, _d, _c, _b, _a
 362 #define DECL_BITFIELD7(_a, _b, _c, _d, _e, _f, _g)      \
 363         uint8_t _g, _f, _e, _d, _c, _b, _a
 364 #define DECL_BITFIELD8(_a, _b, _c, _d, _e, _f, _g, _h)  \
 365         uint8_t _h, _g, _f, _e, _d, _c, _b, _a
 366 #else
 367 #error  One of _BIT_FIELDS_LTOH or _BIT_FIELDS_HTOL must be defined
 368 #endif  /* _BIT_FIELDS_LTOH */
 369 
 370 /* avoid any possibility of clashing with <stddef.h> version */
 371 #if (defined(_KERNEL) || defined(_FAKE_KERNEL)) && !defined(_KMEMUSER)
 372 
 373 #define ARRAY_SIZE(x)   (sizeof (x) / sizeof (x[0]))

 374 
 375 #endif /* _KERNEL, !_KMEMUSER */
 376 
 377 #ifdef  __cplusplus
 378 }
 379 #endif
 380 
 381 #endif  /* _SYS_SYSMACROS_H */


  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 /*      Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T     */
  22 /*        All Rights Reserved   */
  23 
  24 
  25 /*
  26  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
  27  * Use is subject to license terms.
  28  *
  29  * Copyright 2013 Nexenta Systems, Inc.  All rights reserved.
  30  *
  31  * Copyright 2018 Joyent Inc.
  32  */
  33 
  34 #ifndef _SYS_SYSMACROS_H
  35 #define _SYS_SYSMACROS_H
  36 
  37 #include <sys/param.h>
  38 #include <sys/stddef.h>
  39 
  40 #ifdef  __cplusplus
  41 extern "C" {
  42 #endif
  43 
  44 /*
  45  * Some macros for units conversion
  46  */
  47 /*
  48  * Disk blocks (sectors) and bytes.
  49  */
  50 #define dtob(DD)        ((DD) << DEV_BSHIFT)
  51 #define btod(BB)        (((BB) + DEV_BSIZE - 1) >> DEV_BSHIFT)


 352         uint8_t _a, _b, _c, _d, _e, _f, _g, _h
 353 #elif defined(_BIT_FIELDS_HTOL)
 354 #define DECL_BITFIELD2(_a, _b)                          \
 355         uint8_t _b, _a
 356 #define DECL_BITFIELD3(_a, _b, _c)                      \
 357         uint8_t _c, _b, _a
 358 #define DECL_BITFIELD4(_a, _b, _c, _d)                  \
 359         uint8_t _d, _c, _b, _a
 360 #define DECL_BITFIELD5(_a, _b, _c, _d, _e)              \
 361         uint8_t _e, _d, _c, _b, _a
 362 #define DECL_BITFIELD6(_a, _b, _c, _d, _e, _f)          \
 363         uint8_t _f, _e, _d, _c, _b, _a
 364 #define DECL_BITFIELD7(_a, _b, _c, _d, _e, _f, _g)      \
 365         uint8_t _g, _f, _e, _d, _c, _b, _a
 366 #define DECL_BITFIELD8(_a, _b, _c, _d, _e, _f, _g, _h)  \
 367         uint8_t _h, _g, _f, _e, _d, _c, _b, _a
 368 #else
 369 #error  One of _BIT_FIELDS_LTOH or _BIT_FIELDS_HTOL must be defined
 370 #endif  /* _BIT_FIELDS_LTOH */
 371 
 372 #if !defined(ARRAY_SIZE)


 373 #define ARRAY_SIZE(x)   (sizeof (x) / sizeof (x[0]))
 374 #endif
 375 


 376 #ifdef  __cplusplus
 377 }
 378 #endif
 379 
 380 #endif  /* _SYS_SYSMACROS_H */