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/mips/include/stdarg.h

Version: -  FREEBSD  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-2  -  FREEBSD-11-1  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-4  -  FREEBSD-10-3  -  FREEBSD-10-2  -  FREEBSD-10-1  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-3  -  FREEBSD-9-2  -  FREEBSD-9-1  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-4  -  FREEBSD-8-3  -  FREEBSD-8-2  -  FREEBSD-8-1  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-4  -  FREEBSD-7-3  -  FREEBSD-7-2  -  FREEBSD-7-1  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-4  -  FREEBSD-6-3  -  FREEBSD-6-2  -  FREEBSD-6-1  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-5  -  FREEBSD-5-4  -  FREEBSD-5-3  -  FREEBSD-5-2  -  FREEBSD-5-1  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  linux-2.6  -  linux-2.4.22  -  MK83  -  MK84  -  PLAN9  -  DFBSD  -  NETBSD  -  NETBSD5  -  NETBSD4  -  NETBSD3  -  NETBSD20  -  OPENBSD  -  xnu-517  -  xnu-792  -  xnu-792.6.70  -  xnu-1228  -  xnu-1456.1.26  -  xnu-1699.24.8  -  xnu-2050.18.24  -  OPENSOLARIS  -  minix-3-1-1 
SearchContext: -  none  -  3  -  10 

    1 /*
    2  *      JNPR: stdarg.h,v 1.3 2006/09/15 12:52:34 katta
    3  * $FreeBSD: releng/8.4/sys/mips/include/stdarg.h 215938 2010-11-27 12:26:40Z jchandra $
    4  */
    5 
    6 #ifndef _MACHINE_STDARG_H_
    7 #define _MACHINE_STDARG_H_
    8 #include <sys/cdefs.h>
    9 #include <sys/_types.h>
   10 
   11 
   12 #if __GNUC__ >= 3
   13 
   14 #ifndef _VA_LIST_DECLARED
   15 #define _VA_LIST_DECLARED
   16 typedef __va_list       va_list;
   17 #endif
   18 #define va_start(v,l)   __builtin_va_start((v),l)
   19 #define va_end          __builtin_va_end
   20 #define va_arg          __builtin_va_arg
   21 #define va_copy         __builtin_va_copy
   22 
   23 #else  /* __GNUC__ */
   24 
   25 
   26 /* ---------------------------------------- */
   27 /*           VARARGS  for MIPS/GNU CC       */
   28 /* ---------------------------------------- */
   29 
   30 #include <machine/endian.h>
   31 
   32 /* These macros implement varargs for GNU C--either traditional or ANSI.  */
   33 
   34 /* Define __gnuc_va_list.  */
   35 
   36 #ifndef __GNUC_VA_LIST
   37 #define __GNUC_VA_LIST
   38 
   39 typedef char * __gnuc_va_list;
   40 typedef __gnuc_va_list va_list;
   41 
   42 #endif /* ! __GNUC_VA_LIST */
   43 
   44 /* If this is for internal libc use, don't define anything but
   45    __gnuc_va_list.  */
   46 
   47 #ifndef _VA_MIPS_H_ENUM
   48 #define _VA_MIPS_H_ENUM
   49 enum {
   50         __no_type_class = -1,
   51         __void_type_class,
   52         __integer_type_class,
   53         __char_type_class,
   54         __enumeral_type_class,
   55         __boolean_type_class,
   56         __pointer_type_class,
   57         __reference_type_class,
   58         __offset_type_class,
   59         __real_type_class,
   60         __complex_type_class,
   61         __function_type_class,
   62         __method_type_class,
   63         __record_type_class,
   64         __union_type_class,
   65         __array_type_class,
   66         __string_type_class,
   67         __set_type_class,
   68         __file_type_class,
   69         __lang_type_class
   70 };
   71 #endif
   72 
   73 /* In GCC version 2, we want an ellipsis at the end of the declaration
   74    of the argument list.  GCC version 1 can't parse it.  */
   75 
   76 #if __GNUC__ > 1
   77 #define __va_ellipsis ...
   78 #else
   79 #define __va_ellipsis
   80 #endif
   81 
   82 
   83 #define va_start(__AP, __LASTARG) \
   84         (__AP = (__gnuc_va_list) __builtin_next_arg (__LASTARG))
   85 
   86 #define va_end(__AP)    ((void)0)
   87 
   88 
   89 /* We cast to void * and then to TYPE * because this avoids
   90    a warning about increasing the alignment requirement.  */
   91 /* The __mips64 cases are reversed from the 32 bit cases, because the standard
   92    32 bit calling convention left-aligns all parameters smaller than a word,
   93    whereas the __mips64 calling convention does not (and hence they are
   94    right aligned).  */
   95 
   96 #ifdef __mips64
   97 
   98 #define __va_rounded_size(__TYPE)       (((sizeof (__TYPE) + 8 - 1) / 8) * 8)
   99 
  100 #define __va_reg_size                   8
  101 
  102 #if defined(__MIPSEB__) || (BYTE_ORDER == BIG_ENDIAN)
  103 #define va_arg(__AP, __type)                                            \
  104         ((__type *) (void *) (__AP = (char *)                           \
  105             ((((__PTRDIFF_TYPE__)__AP + 8 - 1) & -8)                    \
  106             + __va_rounded_size (__type))))[-1]
  107 #else   /* ! __MIPSEB__ && !BYTE_ORDER == BIG_ENDIAN */
  108 #define va_arg(__AP, __type)                                            \
  109         ((__AP = (char *) ((((__PTRDIFF_TYPE__)__AP + 8 - 1) & -8)      \
  110             + __va_rounded_size (__type))),                             \
  111             *(__type *) (void *) (__AP - __va_rounded_size (__type)))
  112 #endif  /* ! __MIPSEB__ && !BYTE_ORDER == BIG_ENDIAN */
  113 
  114 #else   /* ! __mips64 */
  115 
  116 #define __va_rounded_size(__TYPE)                                       \
  117         (((sizeof (__TYPE) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))
  118 
  119 #define __va_reg_size 4
  120 
  121 #if defined(__MIPSEB__) || (BYTE_ORDER == BIG_ENDIAN)
  122 /* For big-endian machines.  */
  123 #define va_arg(__AP, __type)                                    \
  124         ((__AP = (char *) ((__alignof__ (__type) > 4            \
  125             ? ((__PTRDIFF_TYPE__)__AP + 8 - 1) & -8             \
  126             : ((__PTRDIFF_TYPE__)__AP + 4 - 1) & -4)            \
  127             + __va_rounded_size (__type))),                     \
  128         *(__type *) (void *) (__AP - __va_rounded_size (__type)))
  129 #else   /* ! __MIPSEB__ && !BYTE_ORDER == BIG_ENDIAN */
  130 /* For little-endian machines.  */
  131 #define va_arg(__AP, __type)                                            \
  132         ((__type *) (void *) (__AP = (char *) ((__alignof__(__type) > 4 \
  133             ? ((__PTRDIFF_TYPE__)__AP + 8 - 1) & -8                     \
  134             : ((__PTRDIFF_TYPE__)__AP + 4 - 1) & -4)                    \
  135             + __va_rounded_size(__type))))[-1]
  136 #endif  /* ! __MIPSEB__ && !BYTE_ORDER == BIG_ENDIAN */
  137 #endif  /* ! __mips64 */
  138 
  139 /* Copy __gnuc_va_list into another variable of this type.  */
  140 #define __va_copy(dest, src)    (dest) = (src)
  141 #define va_copy(dest, src)      (dest) = (src)
  142 
  143 #endif /* __GNUC__ */
  144 #endif /* _MACHINE_STDARG_H_ */

Cache object: 4f21478d707d6a3e7580aa5bf5a17030


[ 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.