The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/contrib/openzfs/include/os/linux/spl/sys/ia32/asm_linkage.h

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*
    2  * CDDL HEADER START
    3  *
    4  * The contents of this file are subject to the terms of the
    5  * Common Development and Distribution License (the "License").
    6  * You may not use this file except in compliance with the License.
    7  *
    8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
    9  * or https://opensource.org/licenses/CDDL-1.0.
   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 /*
   23  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
   24  * Use is subject to license terms.
   25  */
   26 
   27 #ifndef _IA32_SYS_ASM_LINKAGE_H
   28 #define _IA32_SYS_ASM_LINKAGE_H
   29 
   30 #if defined(_KERNEL) && defined(__linux__)
   31 #include <linux/linkage.h>
   32 #endif
   33 
   34 #ifndef ENDBR
   35 #if defined(__ELF__) && defined(__CET__) && defined(__has_include)
   36 /* CSTYLED */
   37 #if __has_include(<cet.h>)
   38 
   39 #include <cet.h>
   40 
   41 #ifdef _CET_ENDBR
   42 #define ENDBR   _CET_ENDBR
   43 #endif /* _CET_ENDBR */
   44 
   45 #endif /* <cet.h> */
   46 #endif /* __ELF__ && __CET__ && __has_include */
   47 #endif /* !ENDBR */
   48 
   49 #ifndef ENDBR
   50 #define ENDBR
   51 #endif
   52 #ifndef RET
   53 #define RET     ret
   54 #endif
   55 
   56 /* You can set to nothing on Unix platforms */
   57 #undef ASMABI
   58 #define ASMABI  __attribute__((sysv_abi))
   59 
   60 #define SECTION_TEXT .text
   61 #define SECTION_STATIC .section .rodata
   62 
   63 #ifdef  __cplusplus
   64 extern "C" {
   65 #endif
   66 
   67 #ifdef _ASM     /* The remainder of this file is only for assembly files */
   68 
   69 /*
   70  * make annoying differences in assembler syntax go away
   71  */
   72 
   73 /*
   74  * D16 and A16 are used to insert instructions prefixes; the
   75  * macros help the assembler code be slightly more portable.
   76  */
   77 #if !defined(__GNUC_AS__)
   78 /*
   79  * /usr/ccs/bin/as prefixes are parsed as separate instructions
   80  */
   81 #define D16     data16;
   82 #define A16     addr16;
   83 
   84 /*
   85  * (There are some weird constructs in constant expressions)
   86  */
   87 #define _CONST(const)           [const]
   88 #define _BITNOT(const)          -1!_CONST(const)
   89 #define _MUL(a, b)              _CONST(a \* b)
   90 
   91 #else
   92 /*
   93  * Why not use the 'data16' and 'addr16' prefixes .. well, the
   94  * assembler doesn't quite believe in real mode, and thus argues with
   95  * us about what we're trying to do.
   96  */
   97 #define D16     .byte   0x66;
   98 #define A16     .byte   0x67;
   99 
  100 #define _CONST(const)           (const)
  101 #define _BITNOT(const)          ~_CONST(const)
  102 #define _MUL(a, b)              _CONST(a * b)
  103 
  104 #endif
  105 
  106 /*
  107  * C pointers are different sizes between i386 and amd64.
  108  * These constants can be used to compute offsets into pointer arrays.
  109  */
  110 #if defined(__amd64)
  111 #define CLONGSHIFT      3
  112 #define CLONGSIZE       8
  113 #define CLONGMASK       7
  114 #elif defined(__i386)
  115 #define CLONGSHIFT      2
  116 #define CLONGSIZE       4
  117 #define CLONGMASK       3
  118 #endif
  119 
  120 /*
  121  * Since we know we're either ILP32 or LP64 ..
  122  */
  123 #define CPTRSHIFT       CLONGSHIFT
  124 #define CPTRSIZE        CLONGSIZE
  125 #define CPTRMASK        CLONGMASK
  126 
  127 #if CPTRSIZE != (1 << CPTRSHIFT) || CLONGSIZE != (1 << CLONGSHIFT)
  128 #error  "inconsistent shift constants"
  129 #endif
  130 
  131 #if CPTRMASK != (CPTRSIZE - 1) || CLONGMASK != (CLONGSIZE - 1)
  132 #error  "inconsistent mask constants"
  133 #endif
  134 
  135 #define ASM_ENTRY_ALIGN 16
  136 
  137 /*
  138  * SSE register alignment and save areas
  139  */
  140 
  141 #define XMM_SIZE        16
  142 #define XMM_ALIGN       16
  143 
  144 /*
  145  * ENTRY provides the standard procedure entry code and an easy way to
  146  * insert the calls to mcount for profiling. ENTRY_NP is identical, but
  147  * never calls mcount.
  148  */
  149 #undef ENTRY
  150 #define ENTRY(x) \
  151         .text; \
  152         .balign ASM_ENTRY_ALIGN; \
  153         .globl  x; \
  154         .type   x, @function; \
  155 x:      MCOUNT(x)
  156 
  157 #define ENTRY_NP(x) \
  158         .text; \
  159         .balign ASM_ENTRY_ALIGN; \
  160         .globl  x; \
  161         .type   x, @function; \
  162 x:
  163 
  164 #define ENTRY_ALIGN(x, a) \
  165         .text; \
  166         .balign a; \
  167         .globl  x; \
  168         .type   x, @function; \
  169 x:
  170 
  171 #define FUNCTION(x) \
  172         .type   x, @function; \
  173 x:
  174 
  175 /*
  176  * ENTRY2 is identical to ENTRY but provides two labels for the entry point.
  177  */
  178 #define ENTRY2(x, y) \
  179         .text;  \
  180         .balign ASM_ENTRY_ALIGN; \
  181         .globl  x, y; \
  182         .type   x, @function; \
  183         .type   y, @function; \
  184 x:; \
  185 y:      MCOUNT(x)
  186 
  187 #define ENTRY_NP2(x, y) \
  188         .text; \
  189         .balign ASM_ENTRY_ALIGN; \
  190         .globl  x, y; \
  191         .type   x, @function; \
  192         .type   y, @function; \
  193 x:; \
  194 y:
  195 
  196 
  197 /*
  198  * SET_SIZE trails a function and set the size for the ELF symbol table.
  199  */
  200 #define SET_SIZE(x) \
  201         .size   x, [.-x]
  202 
  203 #define SET_OBJ(x) .type        x, @object
  204 
  205 
  206 #endif /* _ASM */
  207 
  208 #ifdef  __cplusplus
  209 }
  210 #endif
  211 
  212 #endif  /* _IA32_SYS_ASM_LINKAGE_H */

Cache object: 23471dbac9ced144d40de7604e966aec


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.