# 1 "" # 1 "/home/sson/src/cheribsd/lib/libc_cheri/../libmalloc_simple/malloc.c" /*- * Copyright (c) 1983 Regents of the University of California. * Copyright (c) 2015 SRI International * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #if defined(LIBC_SCCS) && !defined(lint) /*static char *sccsid = "from: @(#)malloc.c 5.11 (Berkeley) 2/23/91";*/ static char *rcsid = "$FreeBSD$"; #endif /* LIBC_SCCS and not lint */ # 35 "/home/sson/src/cheribsd/lib/libc_cheri/../libmalloc_simple/malloc.c" /* * malloc.c (Caltech) 2/21/82 * Chris Kingsley, kingsley@cit-20. * * This is a very fast storage allocator. It allocates blocks of a small * number of different sizes, and keeps free lists of each size. Blocks that * don't exactly fit are passed up to the next larger size. In this * implementation, the available sizes are 2^n-4 (or 2^n-10) bytes long. * This is designed for use in a virtual memory environment. */ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 47 "/home/sson/src/cheribsd/lib/libc_cheri/../libmalloc_simple/malloc.c" # 1 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/param.h" 1 3 4 /*- * Copyright (c) 1982, 1986, 1989, 1993 * The Regents of the University of California. All rights reserved. * (c) UNIX System Laboratories, Inc. * All or some portions of this file are derived from material licensed * to the University of California by American Telephone and Telegraph * Co. or Unix System Laboratories, Inc. and are reproduced herein with * the permission of UNIX System Laboratories, Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)param.h 8.3 (Berkeley) 4/4/95 * $FreeBSD$ */ #ifndef _SYS_PARAM_H_ #define _SYS_PARAM_H_ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 41 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/param.h" 3 4 # 1 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/_null.h" 1 3 4 /*- * Copyright (c) 2003 Marcel Moolenaar * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD$ */ #ifndef NULL #if !defined(__cplusplus) #define NULL ((void *)0) #else # 34 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/_null.h" 3 4 #if __cplusplus >= 201103L #define NULL nullptr #elif defined(__GNUG__) && defined(__GNUC__) && __GNUC__ >= 4 # 37 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/_null.h" 3 4 #define NULL __null #else # 39 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/_null.h" 3 4 #if defined(__LP64__) #define NULL (0L) #else # 42 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/_null.h" 3 4 #define NULL 0 #endif /* __LP64__ */ # 44 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/_null.h" 3 4 #endif /* __GNUG__ */ # 45 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/_null.h" 3 4 #endif /* !__cplusplus */ # 46 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/_null.h" 3 4 #endif # 48 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/_null.h" 3 4 # 42 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/param.h" 2 3 4 #define BSD 199506 /* System version (year & month). */ #define BSD4_3 1 #define BSD4_4 1 /* * __FreeBSD_version numbers are documented in the Porter's Handbook. * If you bump the version for any reason, you should update the documentation * there. * Currently this lives here in the doc/ repository: * * head/en_US.ISO8859-1/books/porters-handbook/versions/chapter.xml * * scheme is: Rxx * 'R' is in the range 0 to 4 if this is a release branch or * x.0-CURRENT before RELENG_*_0 is created, otherwise 'R' is * in the range 5 to 9. */ #undef __FreeBSD_version #define __FreeBSD_version 1100097 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, * which by definition is always true on FreeBSD. This macro is also defined * on other systems that use the kernel of FreeBSD, such as GNU/kFreeBSD. * * It is tempting to use this macro in userland code when we want to enable * kernel-specific routines, and in fact it's fine to do this in code that * is part of FreeBSD itself. However, be aware that as presence of this * macro is still not widespread (e.g. older FreeBSD versions, 3rd party * compilers, etc), it is STRONGLY DISCOURAGED to check for this macro in * external applications without also checking for __FreeBSD__ as an * alternative. */ #undef __FreeBSD_kernel__ #define __FreeBSD_kernel__ #ifdef _KERNEL #define P_OSREL_SIGWAIT 700000 #define P_OSREL_SIGSEGV 700004 #define P_OSREL_MAP_ANON 800104 #define P_OSREL_MAP_FSTRICT 1100036 #define P_OSREL_SHUTDOWN_ENOTCONN 1100077 #define P_OSREL_MAJOR(x) ((x) / 100000) #endif # 88 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/param.h" 3 4 #ifndef LOCORE #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 90 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/param.h" 3 4 # 1 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/types.h" 1 3 4 /*- * Copyright (c) 1982, 1986, 1991, 1993, 1994 * The Regents of the University of California. All rights reserved. * (c) UNIX System Laboratories, Inc. * All or some portions of this file are derived from material licensed * to the University of California by American Telephone and Telegraph * Co. or Unix System Laboratories, Inc. and are reproduced herein with * the permission of UNIX System Laboratories, Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)types.h 8.6 (Berkeley) 2/19/95 * $FreeBSD$ */ #ifndef _SYS_TYPES_H_ #define _SYS_TYPES_H_ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 41 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/types.h" 3 4 # 1 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 1 3 4 /*- * Copyright (c) 1991, 1993 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Berkeley Software Design, Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)cdefs.h 8.8 (Berkeley) 1/9/95 * $FreeBSD$ */ #ifndef _SYS_CDEFS_H_ #define _SYS_CDEFS_H_ /* * Testing against Clang-specific extensions. */ #ifndef __has_attribute #define __has_attribute(x) 0 #endif # 45 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 #ifndef __has_extension #define __has_extension __has_feature #endif # 48 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 #ifndef __has_feature #define __has_feature(x) 0 #endif # 51 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 #ifndef __has_include #define __has_include(x) 0 #endif # 54 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 #ifndef __has_builtin #define __has_builtin(x) 0 #endif # 57 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 #if defined(__cplusplus) #define __BEGIN_DECLS extern "C" { #define __END_DECLS } #else # 62 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 #define __BEGIN_DECLS #define __END_DECLS #endif # 65 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 /* * This code has been put in place to help reduce the addition of * compiler specific defines in FreeBSD code. It helps to aid in * having a compiler-agnostic source tree. */ #if defined(__GNUC__) || defined(__INTEL_COMPILER) #if __GNUC__ >= 3 || defined(__INTEL_COMPILER) #define __GNUCLIKE_ASM 3 #define __GNUCLIKE_MATH_BUILTIN_CONSTANTS #else # 78 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 #define __GNUCLIKE_ASM 2 #endif # 80 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 #define __GNUCLIKE___TYPEOF 1 #define __GNUCLIKE___OFFSETOF 1 #define __GNUCLIKE___SECTION 1 #ifndef __INTEL_COMPILER #define __GNUCLIKE_CTOR_SECTION_HANDLING 1 #endif # 87 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 #define __GNUCLIKE_BUILTIN_CONSTANT_P 1 #if defined(__INTEL_COMPILER) && defined(__cplusplus) && \ __INTEL_COMPILER < 800 #undef __GNUCLIKE_BUILTIN_CONSTANT_P #endif # 93 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 #if (__GNUC_MINOR__ > 95 || __GNUC__ >= 3) #define __GNUCLIKE_BUILTIN_VARARGS 1 #define __GNUCLIKE_BUILTIN_STDARG 1 #define __GNUCLIKE_BUILTIN_VAALIST 1 #endif # 99 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 #if defined(__GNUC__) #define __GNUC_VA_LIST_COMPATIBILITY 1 #endif # 103 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 /* * Compiler memory barriers, specific to gcc and clang. */ #if defined(__GNUC__) #define __compiler_membar() __asm __volatile(" " : : : "memory") #endif # 110 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 #ifndef __INTEL_COMPILER #define __GNUCLIKE_BUILTIN_NEXT_ARG 1 #define __GNUCLIKE_MATH_BUILTIN_RELOPS #endif # 115 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 #define __GNUCLIKE_BUILTIN_MEMCPY 1 /* XXX: if __GNUC__ >= 2: not tested everywhere originally, where replaced */ #define __CC_SUPPORTS_INLINE 1 #define __CC_SUPPORTS___INLINE 1 #define __CC_SUPPORTS___INLINE__ 1 #define __CC_SUPPORTS___FUNC__ 1 #define __CC_SUPPORTS_WARNING 1 #define __CC_SUPPORTS_VARADIC_XXX 1 /* see varargs.h */ #define __CC_SUPPORTS_DYNAMIC_ARRAY_INIT 1 #endif /* __GNUC__ || __INTEL_COMPILER */ # 131 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 /* * Macro to test if we're using a specific version of gcc or later. */ #if defined(__GNUC__) && !defined(__INTEL_COMPILER) #define __GNUC_PREREQ__(ma, mi) \ (__GNUC__ > (ma) || __GNUC__ == (ma) && __GNUC_MINOR__ >= (mi)) #else # 139 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 #define __GNUC_PREREQ__(ma, mi) 0 #endif # 141 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 /* * The __CONCAT macro is used to concatenate parts of symbol names, e.g. * with "#define OLD(foo) __CONCAT(old,foo)", OLD(foo) produces oldfoo. * The __CONCAT macro is a bit tricky to use if it must work in non-ANSI * mode -- there must be no spaces between its arguments, and for nested * __CONCAT's, all the __CONCAT's must be at the left. __CONCAT can also * concatenate double-quoted strings produced by the __STRING macro, but * this only works with ANSI C. * * __XSTRING is like __STRING, but it expands any macros in its argument * first. It is only available with ANSI C. */ #if defined(__STDC__) || defined(__cplusplus) #define __P(protos) protos /* full-blown ANSI C */ #define __CONCAT1(x,y) x ## y #define __CONCAT(x,y) __CONCAT1(x,y) #define __STRING(x) #x /* stringify without expanding x */ #define __XSTRING(x) __STRING(x) /* expand x, then stringify */ #define __const const /* define reserved names to standard */ #define __signed signed #define __volatile volatile #if defined(__cplusplus) #define __inline inline /* convert to C++ keyword */ #else # 167 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 #if !(defined(__CC_SUPPORTS___INLINE)) #define __inline /* delete GCC keyword */ #endif /* ! __CC_SUPPORTS___INLINE */ # 170 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 #endif /* !__cplusplus */ # 171 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 #else /* !(__STDC__ || __cplusplus) */ # 173 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 #define __P(protos) () /* traditional C preprocessor */ #define __CONCAT(x,y) x/**/y #define __STRING(x) "x" #if !defined(__CC_SUPPORTS___INLINE) #define __const /* delete pseudo-ANSI C keywords */ #define __inline #define __signed #define __volatile /* * In non-ANSI C environments, new programs will want ANSI-only C keywords * deleted from the program and old programs will want them left alone. * When using a compiler other than gcc, programs using the ANSI C keywords * const, inline etc. as normal identifiers should define -DNO_ANSI_KEYWORDS. * When using "gcc -traditional", we assume that this is the intent; if * __GNUC__ is defined but __STDC__ is not, we leave the new keywords alone. */ #ifndef NO_ANSI_KEYWORDS #define const /* delete ANSI C keywords */ #define inline #define signed #define volatile #endif /* !NO_ANSI_KEYWORDS */ # 196 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 #endif /* !__CC_SUPPORTS___INLINE */ # 197 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 #endif /* !(__STDC__ || __cplusplus) */ # 198 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 /* * Compiler-dependent macros to help declare dead (non-returning) and * pure (no side effects) functions, and unused variables. They are * null except for versions of gcc that are known to support the features * properly (old versions of gcc-2 supported the dead and pure features * in a different (wrong) way). If we do not provide an implementation * for a given compiler, let the compile fail if it is told to use * a feature that we cannot live without. */ #ifdef lint #define __dead2 #define __pure2 #define __unused #define __packed #define __aligned(x) #define __alloc_align(x) #define __alloc_size(x) #define __section(x) #define __weak_symbol #else # 219 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 #define __weak_symbol __attribute__((__weak__)) #if !__GNUC_PREREQ__(2, 5) && !defined(__INTEL_COMPILER) #define __dead2 #define __pure2 #define __unused #endif # 225 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 #if __GNUC__ == 2 && __GNUC_MINOR__ >= 5 && __GNUC_MINOR__ < 7 && !defined(__INTEL_COMPILER) #define __dead2 __attribute__((__noreturn__)) #define __pure2 __attribute__((__const__)) #define __unused /* XXX Find out what to do for __packed, __aligned and __section */ #endif # 231 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 #if __GNUC_PREREQ__(2, 7) || defined(__INTEL_COMPILER) #define __dead2 __attribute__((__noreturn__)) #define __pure2 __attribute__((__const__)) #define __unused __attribute__((__unused__)) #define __used __attribute__((__used__)) #define __packed __attribute__((__packed__)) #define __aligned(x) __attribute__((__aligned__(x))) #define __section(x) __attribute__((__section__(x))) #endif # 240 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 #if __GNUC_PREREQ__(4, 3) || __has_attribute(__alloc_size__) #define __alloc_size(x) __attribute__((__alloc_size__(x))) #else # 243 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 #define __alloc_size(x) #endif # 245 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 #if __GNUC_PREREQ__(4, 9) || __has_attribute(__alloc_align__) #define __alloc_align(x) __attribute__((__alloc_align__(x))) #else # 248 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 #define __alloc_align(x) #endif # 250 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 #endif /* lint */ # 251 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 #if !__GNUC_PREREQ__(2, 95) #define __alignof(x) __offsetof(struct { char __a; x __b; }, __b) #endif # 255 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 /* * Keywords added in C11. */ #if !defined(__STDC_VERSION__) || __STDC_VERSION__ < 201112L || defined(lint) #if !__has_extension(c_alignas) #if (defined(__cplusplus) && __cplusplus >= 201103L) || \ __has_extension(cxx_alignas) #define _Alignas(x) alignas(x) #else # 267 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 /* XXX: Only emulates _Alignas(constant-expression); not _Alignas(type-name). */ #define _Alignas(x) __aligned(x) #endif # 270 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 #endif # 271 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 #if defined(__cplusplus) && __cplusplus >= 201103L #define _Alignof(x) alignof(x) #else # 275 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 #define _Alignof(x) __alignof(x) #endif # 277 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 #if !__has_extension(c_atomic) && !__has_extension(cxx_atomic) /* * No native support for _Atomic(). Place object in structure to prevent * most forms of direct non-atomic access. */ #define _Atomic(T) struct { T volatile __val; } #endif # 285 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 #if defined(__cplusplus) && __cplusplus >= 201103L #define _Noreturn [[noreturn]] #else # 289 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 #define _Noreturn __dead2 #endif # 291 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 #if !__has_extension(c_static_assert) #if (defined(__cplusplus) && __cplusplus >= 201103L) || \ __has_extension(cxx_static_assert) #define _Static_assert(x, y) static_assert(x, y) #elif __GNUC_PREREQ__(4,6) # 297 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 /* Nothing, gcc 4.6 and higher has _Static_assert built-in */ #elif defined(__COUNTER__) # 299 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 #define _Static_assert(x, y) __Static_assert(x, __COUNTER__) #define __Static_assert(x, y) ___Static_assert(x, y) #define ___Static_assert(x, y) typedef char __assert_ ## y[(x) ? 1 : -1] \ __unused #else # 304 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 #define _Static_assert(x, y) struct __hack #endif # 306 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 #endif # 307 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 #if !__has_extension(c_thread_local) /* * XXX: Some compilers (Clang 3.3, GCC 4.7) falsely announce C++11 mode * without actually supporting the thread_local keyword. Don't check for * the presence of C++11 when defining _Thread_local. */ #if /* (defined(__cplusplus) && __cplusplus >= 201103L) || */ \ __has_extension(cxx_thread_local) #define _Thread_local thread_local #else # 318 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 #define _Thread_local __thread #endif # 320 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 #endif # 321 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 #endif /* __STDC_VERSION__ || __STDC_VERSION__ < 201112L */ # 323 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 /* * Emulation of C11 _Generic(). Unlike the previously defined C11 * keywords, it is not possible to implement this using exactly the same * syntax. Therefore implement something similar under the name * __generic(). Unlike _Generic(), this macro can only distinguish * between a single type, so it requires nested invocations to * distinguish multiple cases. */ #if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) || \ __has_extension(c_generic_selections) #define __generic(expr, t, yes, no) \ _Generic(expr, t: yes, default: no) #elif __GNUC_PREREQ__(3, 1) && !defined(__cplusplus) # 338 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 #define __generic(expr, t, yes, no) \ __builtin_choose_expr( \ __builtin_types_compatible_p(__typeof(expr), t), yes, no) #endif # 342 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 #if __GNUC_PREREQ__(2, 96) #define __malloc_like __attribute__((__malloc__)) #define __pure __attribute__((__pure__)) #else # 347 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 #define __malloc_like #define __pure #endif # 350 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 #if __GNUC_PREREQ__(3, 1) || (defined(__INTEL_COMPILER) && __INTEL_COMPILER >= 800) #define __always_inline __attribute__((__always_inline__)) #else # 354 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 #define __always_inline #endif # 356 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 #if __GNUC_PREREQ__(3, 1) #define __noinline __attribute__ ((__noinline__)) #else # 360 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 #define __noinline #endif # 362 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 #if __GNUC_PREREQ__(3, 3) #define __nonnull(x) __attribute__((__nonnull__(x))) #define __nonnull_all __attribute__((__nonnull__)) #else # 367 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 #define __nonnull(x) #define __nonnull_all #endif # 370 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 #if __GNUC_PREREQ__(3, 4) #define __fastcall __attribute__((__fastcall__)) #define __result_use_check __attribute__((__warn_unused_result__)) #else # 375 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 #define __fastcall #define __result_use_check #endif # 378 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 #if __GNUC_PREREQ__(4, 1) #define __returns_twice __attribute__((__returns_twice__)) #else # 382 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 #define __returns_twice #endif # 384 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 #if __GNUC_PREREQ__(4, 6) || __has_builtin(__builtin_unreachable) #define __unreachable() __builtin_unreachable() #else # 388 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 #define __unreachable() ((void)0) #endif # 390 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 /* XXX: should use `#if __STDC_VERSION__ < 199901'. */ #if !__GNUC_PREREQ__(2, 7) && !defined(__INTEL_COMPILER) #define __func__ NULL #endif # 395 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 #if (defined(__INTEL_COMPILER) || (defined(__GNUC__) && __GNUC__ >= 2)) && !defined(__STRICT_ANSI__) || __STDC_VERSION__ >= 199901 #define __LONG_LONG_SUPPORTED #endif # 399 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 /* C++11 exposes a load of C99 stuff */ #if defined(__cplusplus) && __cplusplus >= 201103L #define __LONG_LONG_SUPPORTED #ifndef __STDC_LIMIT_MACROS #define __STDC_LIMIT_MACROS #endif # 406 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 #ifndef __STDC_CONSTANT_MACROS #define __STDC_CONSTANT_MACROS #endif # 409 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 #endif # 410 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 /* * GCC 2.95 provides `__restrict' as an extension to C90 to support the * C99-specific `restrict' type qualifier. We happen to use `__restrict' as * a way to define the `restrict' type qualifier without disturbing older * software that is unaware of C99 keywords. */ #if !(__GNUC__ == 2 && __GNUC_MINOR__ == 95) #if !defined(__STDC_VERSION__) || __STDC_VERSION__ < 199901 || defined(lint) #define __restrict #else # 421 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 #define __restrict restrict #endif # 423 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 #endif # 424 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 /* * GNU C version 2.96 adds explicit branch prediction so that * the CPU back-end can hint the processor and also so that * code blocks can be reordered such that the predicted path * sees a more linear flow, thus improving cache behavior, etc. * * The following two macros provide us with a way to utilize this * compiler feature. Use __predict_true() if you expect the expression * to evaluate to true, and __predict_false() if you expect the * expression to evaluate to false. * * A few notes about usage: * * * Generally, __predict_false() error condition checks (unless * you have some _strong_ reason to do otherwise, in which case * document it), and/or __predict_true() `no-error' condition * checks, assuming you want to optimize for the no-error case. * * * Other than that, if you don't know the likelihood of a test * succeeding from empirical or other `hard' evidence, don't * make predictions. * * * These are meant to be used in places that are run `a lot'. * It is wasteful to make predictions in code that is run * seldomly (e.g. at subsystem initialization time) as the * basic block reordering that this affects can often generate * larger code. */ #if __GNUC_PREREQ__(2, 96) #define __predict_true(exp) __builtin_expect((exp), 1) #define __predict_false(exp) __builtin_expect((exp), 0) #else # 457 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 #define __predict_true(exp) (exp) #define __predict_false(exp) (exp) #endif # 460 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 #if __GNUC_PREREQ__(4, 0) #define __null_sentinel __attribute__((__sentinel__)) #define __exported __attribute__((__visibility__("default"))) #define __hidden __attribute__((__visibility__("hidden"))) #else # 466 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 #define __null_sentinel #define __exported #define __hidden #endif # 470 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 /* * We define this here since , , and * require it. */ #if __GNUC_PREREQ__(4, 1) #define __offsetof(type, field) __builtin_offsetof(type, field) #else # 478 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 #ifndef __cplusplus #define __offsetof(type, field) \ ((__size_t)(__uintptr_t)((const volatile void *)&((type *)0)->field)) #else # 482 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 #define __offsetof(type, field) \ (__offsetof__ (reinterpret_cast <__size_t> \ (&reinterpret_cast \ (static_cast (0)->field)))) #endif # 487 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 #endif # 488 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 #define __rangeof(type, start, end) \ (__offsetof(type, end) - __offsetof(type, start)) /* * Given the pointer x to the member m of the struct s, return * a pointer to the containing structure. When using GCC, we first * assign pointer x to a local variable, to check that its type is * compatible with member m. */ #if __GNUC_PREREQ__(3, 1) #define __containerof(x, s, m) ({ \ const volatile __typeof(((s *)0)->m) *__x = (x); \ __DEQUALIFY(s *, (const volatile char *)__x - __offsetof(s, m));\ }) #else # 503 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 #define __containerof(x, s, m) \ __DEQUALIFY(s *, (const volatile char *)(x) - __offsetof(s, m)) #endif # 506 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 /* * Compiler-dependent macros to declare that functions take printf-like * or scanf-like arguments. They are null except for versions of gcc * that are known to support the features properly (old versions of gcc-2 * didn't permit keeping the keywords out of the application namespace). */ #if !__GNUC_PREREQ__(2, 7) && !defined(__INTEL_COMPILER) #define __printflike(fmtarg, firstvararg) #define __scanflike(fmtarg, firstvararg) #define __format_arg(fmtarg) #define __strfmonlike(fmtarg, firstvararg) #define __strftimelike(fmtarg, firstvararg) #else # 520 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 #define __printflike(fmtarg, firstvararg) \ __attribute__((__format__ (__printf__, fmtarg, firstvararg))) #define __scanflike(fmtarg, firstvararg) \ __attribute__((__format__ (__scanf__, fmtarg, firstvararg))) #define __format_arg(fmtarg) __attribute__((__format_arg__ (fmtarg))) #define __strfmonlike(fmtarg, firstvararg) \ __attribute__((__format__ (__strfmon__, fmtarg, firstvararg))) #define __strftimelike(fmtarg, firstvararg) \ __attribute__((__format__ (__strftime__, fmtarg, firstvararg))) #endif # 530 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 /* * FORTIFY_SOURCE, and perhaps other compiler-specific features, require * the use of non-standard inlining. In general we should try to avoid * using these but GCC-compatible compilers tend to support the extensions * well enough to use them in limited cases. */ #if defined(__GNUC_GNU_INLINE__) || defined(__GNUC_STDC_INLINE__) #if __GNUC_PREREQ__(4, 3) || __has_attribute(__artificial__) #define __gnu_inline __attribute__((__gnu_inline__, __artificial__)) #else # 541 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 #define __gnu_inline __attribute__((__gnu_inline__)) #endif /* artificial */ # 543 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 #else # 544 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 #define __gnu_inline #endif # 546 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 /* Compiler-dependent macros that rely on FreeBSD-specific extensions. */ #if defined(__FreeBSD_cc_version) && __FreeBSD_cc_version >= 300001 && \ defined(__GNUC__) && !defined(__INTEL_COMPILER) #define __printf0like(fmtarg, firstvararg) \ __attribute__((__format__ (__printf0__, fmtarg, firstvararg))) #else # 553 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 #define __printf0like(fmtarg, firstvararg) #endif # 555 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 #if defined(__GNUC__) || defined(__INTEL_COMPILER) #ifndef __INTEL_COMPILER #define __strong_reference(sym,aliassym) \ extern __typeof (sym) aliassym __attribute__ ((__alias__ (#sym))) #endif # 561 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 #ifdef __STDC__ #define __weak_reference(sym,alias) \ __asm__(".weak " #alias); \ __asm__(".equ " #alias ", " #sym) #define __warn_references(sym,msg) \ __asm__(".section .gnu.warning." #sym); \ __asm__(".asciz \"" msg "\""); \ __asm__(".previous") #define __sym_compat(sym,impl,verid) \ __asm__(".symver " #impl ", " #sym "@" #verid) #define __sym_default(sym,impl,verid) \ __asm__(".symver " #impl ", " #sym "@@" #verid) #else # 574 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 #define __weak_reference(sym,alias) \ __asm__(".weak alias"); \ __asm__(".equ alias, sym") #define __warn_references(sym,msg) \ __asm__(".section .gnu.warning.sym"); \ __asm__(".asciz \"msg\""); \ __asm__(".previous") #define __sym_compat(sym,impl,verid) \ __asm__(".symver impl, sym@verid") #define __sym_default(impl,sym,verid) \ __asm__(".symver impl, sym@@verid") #endif /* __STDC__ */ # 586 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 #endif /* __GNUC__ || __INTEL_COMPILER */ # 587 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 #define __GLOBL1(sym) __asm__(".globl " #sym) #define __GLOBL(sym) __GLOBL1(sym) #if defined(__GNUC__) || defined(__INTEL_COMPILER) #define __IDSTRING(name,string) __asm__(".ident\t\"" string "\"") #else # 594 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 /* * The following definition might not work well if used in header files, * but it should be better than nothing. If you want a "do nothing" * version, then it should generate some harmless declaration, such as: * #define __IDSTRING(name,string) struct __hack */ #define __IDSTRING(name,string) static const char name[] __unused = string #endif # 602 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 /* * Embed the rcs id of a source file in the resulting library. Note that in * more recent ELF binutils, we use .ident allowing the ID to be stripped. * Usage: * __FBSDID("$FreeBSD$"); */ #ifndef __FBSDID #if !defined(lint) && !defined(STRIP_FBSDID) #define __FBSDID(s) __IDSTRING(__CONCAT(__rcsid_,__LINE__),s) #else # 613 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 #define __FBSDID(s) struct __hack #endif # 615 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 #endif # 616 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 #ifndef __RCSID #ifndef NO__RCSID #define __RCSID(s) __IDSTRING(__CONCAT(__rcsid_,__LINE__),s) #else # 621 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 #define __RCSID(s) struct __hack #endif # 623 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 #endif # 624 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 #ifndef __RCSID_SOURCE #ifndef NO__RCSID_SOURCE #define __RCSID_SOURCE(s) __IDSTRING(__CONCAT(__rcsid_source_,__LINE__),s) #else # 629 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 #define __RCSID_SOURCE(s) struct __hack #endif # 631 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 #endif # 632 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 #ifndef __SCCSID #ifndef NO__SCCSID #define __SCCSID(s) __IDSTRING(__CONCAT(__sccsid_,__LINE__),s) #else # 637 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 #define __SCCSID(s) struct __hack #endif # 639 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 #endif # 640 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 #ifndef __COPYRIGHT #ifndef NO__COPYRIGHT #define __COPYRIGHT(s) __IDSTRING(__CONCAT(__copyright_,__LINE__),s) #else # 645 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 #define __COPYRIGHT(s) struct __hack #endif # 647 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 #endif # 648 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 #ifndef __DECONST #if !__has_feature(capabilities) #define __DECONST(type, var) ((type)(__uintptr_t)(const void *)(var)) #else # 653 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 #define __DECONST(type, var) ((type)(__intcap_t)(__capability const void *)(var)) #endif # 655 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 #endif # 656 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 #ifndef __DEVOLATILE #if !__has_feature(capabilities) #define __DEVOLATILE(type, var) ((type)(__uintptr_t)(volatile void *)(var)) #else # 661 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 #define __DEVOLATILE(type, var) ((type)(__intcap_t)(__capability volatile void *)(var)) #endif # 663 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 #endif # 664 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 #ifndef __DEQUALIFY #if !__has_feature(capabilities) #define __DEQUALIFY(type, var) ((type)(__uintptr_t)(const volatile void *)(var)) #else # 669 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 #define __DEQUALIFY(type, var) ((type)(__intcap_t)(__capability const volatile void *)(var)) #endif # 671 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 #endif # 672 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 /*- * The following definitions are an extension of the behavior originally * implemented in , but with a different level of granularity. * POSIX.1 requires that the macros we test be defined before any standard * header file is included. * * Here's a quick run-down of the versions: * defined(_POSIX_SOURCE) 1003.1-1988 * _POSIX_C_SOURCE == 1 1003.1-1990 * _POSIX_C_SOURCE == 2 1003.2-1992 C Language Binding Option * _POSIX_C_SOURCE == 199309 1003.1b-1993 * _POSIX_C_SOURCE == 199506 1003.1c-1995, 1003.1i-1995, * and the omnibus ISO/IEC 9945-1: 1996 * _POSIX_C_SOURCE == 200112 1003.1-2001 * _POSIX_C_SOURCE == 200809 1003.1-2008 * * In addition, the X/Open Portability Guide, which is now the Single UNIX * Specification, defines a feature-test macro which indicates the version of * that specification, and which subsumes _POSIX_C_SOURCE. * * Our macros begin with two underscores to avoid namespace screwage. */ /* Deal with IEEE Std. 1003.1-1990, in which _POSIX_C_SOURCE == 1. */ #if defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE == 1 #undef _POSIX_C_SOURCE /* Probably illegal, but beyond caring now. */ #define _POSIX_C_SOURCE 199009 #endif # 701 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 /* Deal with IEEE Std. 1003.2-1992, in which _POSIX_C_SOURCE == 2. */ #if defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE == 2 #undef _POSIX_C_SOURCE #define _POSIX_C_SOURCE 199209 #endif # 707 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 /* Deal with various X/Open Portability Guides and Single UNIX Spec. */ #ifdef _XOPEN_SOURCE #if _XOPEN_SOURCE - 0 >= 700 #define __XSI_VISIBLE 700 #undef _POSIX_C_SOURCE #define _POSIX_C_SOURCE 200809 #elif _XOPEN_SOURCE - 0 >= 600 # 715 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 #define __XSI_VISIBLE 600 #undef _POSIX_C_SOURCE #define _POSIX_C_SOURCE 200112 #elif _XOPEN_SOURCE - 0 >= 500 # 719 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 #define __XSI_VISIBLE 500 #undef _POSIX_C_SOURCE #define _POSIX_C_SOURCE 199506 #endif # 723 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 #endif # 724 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 /* * Deal with all versions of POSIX. The ordering relative to the tests above is * important. */ #if defined(_POSIX_SOURCE) && !defined(_POSIX_C_SOURCE) #define _POSIX_C_SOURCE 198808 #endif # 732 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 #ifdef _POSIX_C_SOURCE #if _POSIX_C_SOURCE >= 200809 #define __POSIX_VISIBLE 200809 #define __ISO_C_VISIBLE 1999 #elif _POSIX_C_SOURCE >= 200112 # 737 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 #define __POSIX_VISIBLE 200112 #define __ISO_C_VISIBLE 1999 #elif _POSIX_C_SOURCE >= 199506 # 740 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 #define __POSIX_VISIBLE 199506 #define __ISO_C_VISIBLE 1990 #elif _POSIX_C_SOURCE >= 199309 # 743 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 #define __POSIX_VISIBLE 199309 #define __ISO_C_VISIBLE 1990 #elif _POSIX_C_SOURCE >= 199209 # 746 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 #define __POSIX_VISIBLE 199209 #define __ISO_C_VISIBLE 1990 #elif _POSIX_C_SOURCE >= 199009 # 749 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 #define __POSIX_VISIBLE 199009 #define __ISO_C_VISIBLE 1990 #else # 752 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 #define __POSIX_VISIBLE 198808 #define __ISO_C_VISIBLE 0 #endif /* _POSIX_C_SOURCE */ # 755 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 #else # 756 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 /*- * Deal with _ANSI_SOURCE: * If it is defined, and no other compilation environment is explicitly * requested, then define our internal feature-test macros to zero. This * makes no difference to the preprocessor (undefined symbols in preprocessing * expressions are defined to have value zero), but makes it more convenient for * a test program to print out the values. * * If a program mistakenly defines _ANSI_SOURCE and some other macro such as * _POSIX_C_SOURCE, we will assume that it wants the broader compilation * environment (and in fact we will never get here). */ #if defined(_ANSI_SOURCE) /* Hide almost everything. */ #define __POSIX_VISIBLE 0 #define __XSI_VISIBLE 0 #define __BSD_VISIBLE 0 #define __ISO_C_VISIBLE 1990 #elif defined(_C99_SOURCE) /* Localism to specify strict C99 env. */ # 774 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 #define __POSIX_VISIBLE 0 #define __XSI_VISIBLE 0 #define __BSD_VISIBLE 0 #define __ISO_C_VISIBLE 1999 #elif defined(_C11_SOURCE) /* Localism to specify strict C11 env. */ # 779 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 #define __POSIX_VISIBLE 0 #define __XSI_VISIBLE 0 #define __BSD_VISIBLE 0 #define __ISO_C_VISIBLE 2011 #else /* Default environment: show everything. */ # 784 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 #define __POSIX_VISIBLE 200809 #define __XSI_VISIBLE 700 #define __BSD_VISIBLE 1 #define __ISO_C_VISIBLE 2011 #endif # 789 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 #endif # 790 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 #if defined(__mips) || defined(__powerpc64__) || defined(__riscv__) #define __NO_TLS 1 #endif # 794 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 /* * Type Safety Checking * * Clang provides additional attributes to enable checking type safety * properties that cannot be enforced by the C type system. */ #if __has_attribute(__argument_with_type_tag__) && \ __has_attribute(__type_tag_for_datatype__) && !defined(lint) #define __arg_type_tag(arg_kind, arg_idx, type_tag_idx) \ __attribute__((__argument_with_type_tag__(arg_kind, arg_idx, type_tag_idx))) #define __datatype_type_tag(kind, type) \ __attribute__((__type_tag_for_datatype__(kind, type))) #else # 809 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 #define __arg_type_tag(arg_kind, arg_idx, type_tag_idx) #define __datatype_type_tag(kind, type) #endif # 812 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 /* * Lock annotations. * * Clang provides support for doing basic thread-safety tests at * compile-time, by marking which locks will/should be held when * entering/leaving a functions. * * Furthermore, it is also possible to annotate variables and structure * members to enforce that they are only accessed when certain locks are * held. */ #if __has_extension(c_thread_safety_attributes) #define __lock_annotate(x) __attribute__((x)) #else # 828 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 #define __lock_annotate(x) #endif # 830 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 /* Structure implements a lock. */ #define __lockable __lock_annotate(lockable) /* Function acquires an exclusive or shared lock. */ #define __locks_exclusive(...) \ __lock_annotate(exclusive_lock_function(__VA_ARGS__)) #define __locks_shared(...) \ __lock_annotate(shared_lock_function(__VA_ARGS__)) /* Function attempts to acquire an exclusive or shared lock. */ #define __trylocks_exclusive(...) \ __lock_annotate(exclusive_trylock_function(__VA_ARGS__)) #define __trylocks_shared(...) \ __lock_annotate(shared_trylock_function(__VA_ARGS__)) /* Function releases a lock. */ #define __unlocks(...) __lock_annotate(unlock_function(__VA_ARGS__)) /* Function asserts that an exclusive or shared lock is held. */ #define __asserts_exclusive(...) \ __lock_annotate(assert_exclusive_lock(__VA_ARGS__)) #define __asserts_shared(...) \ __lock_annotate(assert_shared_lock(__VA_ARGS__)) /* Function requires that an exclusive or shared lock is or is not held. */ #define __requires_exclusive(...) \ __lock_annotate(exclusive_locks_required(__VA_ARGS__)) #define __requires_shared(...) \ __lock_annotate(shared_locks_required(__VA_ARGS__)) #define __requires_unlocked(...) \ __lock_annotate(locks_excluded(__VA_ARGS__)) /* Function should not be analyzed. */ #define __no_lock_analysis __lock_annotate(no_thread_safety_analysis) /* Guard variables and structure members by lock. */ #define __guarded_by(x) __lock_annotate(guarded_by(x)) #define __pt_guarded_by(x) __lock_annotate(pt_guarded_by(x)) #endif /* !_SYS_CDEFS_H_ */ # 871 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4 # 42 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/types.h" 2 3 4 /* Machine type dependent parameters. */ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 44 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/types.h" 3 4 # 1 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/endian.h" 1 3 4 /*- * Copyright (c) 1987, 1991 Regents of the University of California. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)endian.h 7.8 (Berkeley) 4/3/91 * $FreeBSD$ */ #ifndef _MACHINE_ENDIAN_H_ #define _MACHINE_ENDIAN_H_ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 36 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/endian.h" 3 4 # 37 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/endian.h" 3 4 #ifndef __ASSEMBLER__ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 38 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/endian.h" 3 4 # 1 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/_types.h" 1 3 4 /*- * Copyright (c) 2002 Mike Barcroft * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * $FreeBSD$ */ #ifndef _SYS__TYPES_H_ #define _SYS__TYPES_H_ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 32 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/_types.h" 3 4 # 33 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/_types.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 33 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/_types.h" 3 4 # 1 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/_types.h" 1 3 4 /*- * Copyright (c) 2002 Mike Barcroft * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the University of * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * From: @(#)ansi.h 8.2 (Berkeley) 1/4/94 * From: @(#)types.h 8.3 (Berkeley) 1/5/94 * from: src/sys/i386/include/_types.h,v 1.12 2005/07/02 23:13:31 thompsa * $FreeBSD$ */ #ifndef _MACHINE__TYPES_H_ #define _MACHINE__TYPES_H_ #ifndef _SYS_CDEFS_H_ #error this file needs sys/cdefs.h as a prerequisite #endif # 46 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/_types.h" 3 4 /* * Basic types upon which most other types are built. */ typedef signed char __int8_t; typedef unsigned char __uint8_t; typedef short __int16_t; typedef unsigned short __uint16_t; typedef int __int32_t; typedef unsigned int __uint32_t; #ifdef __mips_n64 typedef long __int64_t; typedef unsigned long __uint64_t; #else # 60 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/_types.h" 3 4 #ifndef lint __extension__ #endif # 63 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/_types.h" 3 4 /* LONGLONG */ typedef long long __int64_t; #ifndef lint __extension__ #endif # 68 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/_types.h" 3 4 /* LONGLONG */ typedef unsigned long long __uint64_t; #endif # 71 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/_types.h" 3 4 /* * Standard type definitions. */ typedef __int32_t __clock_t; /* clock()... */ typedef double __double_t; typedef float __float_t; #ifdef __mips_n64 #ifndef __CHERI_PURE_CAPABILITY__ typedef __int64_t __critical_t; typedef __int64_t __intfptr_t; typedef __int64_t __intptr_t; #else # 84 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/_types.h" 3 4 typedef __intcap_t __critical_t; typedef __intcap_t __intfptr_t; typedef __intcap_t __intptr_t; #endif # 88 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/_types.h" 3 4 #else # 89 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/_types.h" 3 4 typedef __int32_t __critical_t; typedef __int32_t __intfptr_t; typedef __int32_t __intptr_t; #endif # 93 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/_types.h" 3 4 typedef __int64_t __intmax_t; typedef __int32_t __int_fast8_t; typedef __int32_t __int_fast16_t; typedef __int32_t __int_fast32_t; typedef __int64_t __int_fast64_t; typedef __int8_t __int_least8_t; typedef __int16_t __int_least16_t; typedef __int32_t __int_least32_t; typedef __int64_t __int_least64_t; #if defined(__mips_n64) || defined(__mips_n32) typedef __int64_t __register_t; typedef __int64_t f_register_t; #else # 106 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/_types.h" 3 4 typedef __int32_t __register_t; typedef __int32_t f_register_t; #endif # 109 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/_types.h" 3 4 #ifdef __mips_n64 typedef __int64_t __ptrdiff_t; typedef __int64_t __segsz_t; typedef __uint64_t __size_t; typedef __int64_t __ssize_t; #ifndef __CHERI_PURE_CAPABILITY__ typedef __uint64_t __uintfptr_t; typedef __uint64_t __uintptr_t; #else # 118 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/_types.h" 3 4 typedef __uintcap_t __uintfptr_t; typedef __uintcap_t __uintptr_t; #endif # 121 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/_types.h" 3 4 #else # 122 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/_types.h" 3 4 typedef __int32_t __ptrdiff_t; /* ptr1 - ptr2 */ typedef __int32_t __segsz_t; /* segment size (in pages) */ typedef __uint32_t __size_t; /* sizeof() */ typedef __int32_t __ssize_t; /* byte count or error */ typedef __uint32_t __uintfptr_t; typedef __uint32_t __uintptr_t; #endif # 129 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/_types.h" 3 4 typedef __int64_t __time_t; /* time()... */ typedef __uint64_t __uintmax_t; typedef __uint32_t __uint_fast8_t; typedef __uint32_t __uint_fast16_t; typedef __uint32_t __uint_fast32_t; typedef __uint64_t __uint_fast64_t; typedef __uint8_t __uint_least8_t; typedef __uint16_t __uint_least16_t; typedef __uint32_t __uint_least32_t; typedef __uint64_t __uint_least64_t; #if defined(__mips_n64) || defined(__mips_n32) typedef __uint64_t __u_register_t; #else # 142 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/_types.h" 3 4 typedef __uint32_t __u_register_t; #endif # 144 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/_types.h" 3 4 #ifdef __mips_n64 typedef __uint64_t __vm_offset_t; typedef __uint64_t __vm_size_t; #else # 148 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/_types.h" 3 4 typedef __uint32_t __vm_offset_t; typedef __uint32_t __vm_size_t; #endif # 151 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/_types.h" 3 4 #if defined(__mips_n64) || defined(__mips_n32) /* PHYSADDR_64_BIT */ typedef __uint64_t __vm_paddr_t; #else # 154 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/_types.h" 3 4 typedef __uint32_t __vm_paddr_t; #endif # 156 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/_types.h" 3 4 typedef __int64_t __vm_ooffset_t; typedef __uint64_t __vm_pindex_t; typedef int ___wchar_t; #define __WCHAR_MIN __INT_MIN /* min value for a wchar_t */ #define __WCHAR_MAX __INT_MAX /* max value for a wchar_t */ /* * Unusual type definitions. */ #ifdef __GNUCLIKE_BUILTIN_VARARGS typedef __builtin_va_list __va_list; /* internally known to gcc */ #else # 170 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/_types.h" 3 4 typedef char * __va_list; #endif /* __GNUCLIKE_BUILTIN_VARARGS */ # 172 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/_types.h" 3 4 #if defined(__GNUC_VA_LIST_COMPATIBILITY) && !defined(__GNUC_VA_LIST) \ && !defined(__NO_GNUC_VA_LIST) #define __GNUC_VA_LIST typedef __va_list __gnuc_va_list; /* compatibility w/GNU headers*/ #endif # 177 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/_types.h" 3 4 #endif /* !_MACHINE__TYPES_H_ */ # 179 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/_types.h" 3 4 # 34 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/_types.h" 2 3 4 /* * Standard type definitions. */ typedef __int32_t __blksize_t; /* file block size */ typedef __int64_t __blkcnt_t; /* file block count */ typedef __int32_t __clockid_t; /* clock_gettime()... */ typedef __uint32_t __fflags_t; /* file flags */ typedef __uint64_t __fsblkcnt_t; typedef __uint64_t __fsfilcnt_t; typedef __uint32_t __gid_t; typedef __int64_t __id_t; /* can hold a gid_t, pid_t, or uid_t */ typedef __uint32_t __ino_t; /* inode number */ typedef long __key_t; /* IPC key (for Sys V IPC) */ typedef __int32_t __lwpid_t; /* Thread ID (a.k.a. LWP) */ typedef __uint16_t __mode_t; /* permissions */ typedef int __accmode_t; /* access permissions */ typedef int __nl_item; typedef __uint16_t __nlink_t; /* link count */ typedef __int64_t __off_t; /* file offset */ typedef __int32_t __pid_t; /* process [group] */ typedef __int64_t __rlim_t; /* resource limit - intentionally */ /* signed, because of legacy code */ /* that uses -1 for RLIM_INFINITY */ typedef __uint8_t __sa_family_t; typedef __uint32_t __socklen_t; typedef long __suseconds_t; /* microseconds (signed) */ typedef struct __timer *__timer_t; /* timer_gettime()... */ typedef struct __mq *__mqd_t; /* mq_open()... */ typedef __uint32_t __uid_t; typedef unsigned int __useconds_t; /* microseconds (unsigned) */ typedef int __cpuwhich_t; /* which parameter for cpuset. */ typedef int __cpulevel_t; /* level parameter for cpuset. */ typedef int __cpusetid_t; /* cpuset identifier. */ /* * Unusual type definitions. */ /* * rune_t is declared to be an ``int'' instead of the more natural * ``unsigned long'' or ``long''. Two things are happening here. It is not * unsigned so that EOF (-1) can be naturally assigned to it and used. Also, * it looks like 10646 will be a 31 bit standard. This means that if your * ints cannot hold 32 bits, you will be in trouble. The reason an int was * chosen over a long is that the is*() and to*() routines take ints (says * ANSI C), but they use __ct_rune_t instead of int. * * NOTE: rune_t is not covered by ANSI nor other standards, and should not * be instantiated outside of lib/libc/locale. Use wchar_t. wint_t and * rune_t must be the same type. Also, wint_t should be able to hold all * members of the largest character set plus one extra value (WEOF), and * must be at least 16 bits. */ typedef int __ct_rune_t; /* arg type for ctype funcs */ typedef __ct_rune_t __rune_t; /* rune_t (see above) */ typedef __ct_rune_t __wint_t; /* wint_t (see above) */ /* Clang already provides these types as built-ins, but only in C++ mode. */ #if !defined(__clang__) || !defined(__cplusplus) typedef __uint_least16_t __char16_t; typedef __uint_least32_t __char32_t; #endif # 96 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/_types.h" 3 4 /* In C++11, char16_t and char32_t are built-in types. */ #if defined(__cplusplus) && __cplusplus >= 201103L #define _CHAR16_T_DECLARED #define _CHAR32_T_DECLARED #endif # 101 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/_types.h" 3 4 typedef __uint32_t __dev_t; /* device number */ typedef __uint32_t __fixpt_t; /* fixed point number */ /* * mbstate_t is an opaque object to keep conversion state during multibyte * stream conversions. */ typedef union { char __mbstate8[128]; __int64_t _mbstateL; /* for alignment */ } __mbstate_t; typedef unsigned long __rman_res_t; #endif /* !_SYS__TYPES_H_ */ # 118 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/_types.h" 3 4 # 39 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/endian.h" 2 3 4 #endif # 40 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/endian.h" 3 4 #ifdef __cplusplus extern "C" { #endif # 44 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/endian.h" 3 4 /* * Definitions for byte order, according to byte significance from low * address to high. */ #define _LITTLE_ENDIAN 1234 /* LSB first: i386, vax */ #define _BIG_ENDIAN 4321 /* MSB first: 68000, ibm, net */ #define _PDP_ENDIAN 3412 /* LSB first in word, MSW first in long */ #ifdef __MIPSEB__ #define _BYTE_ORDER _BIG_ENDIAN #else # 56 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/endian.h" 3 4 #define _BYTE_ORDER _LITTLE_ENDIAN #endif /* __MIBSEB__ */ # 58 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/endian.h" 3 4 /* * Deprecated variants that don't have enough underscores to be useful in more * strict namespaces. */ #if __BSD_VISIBLE #define LITTLE_ENDIAN _LITTLE_ENDIAN #define BIG_ENDIAN _BIG_ENDIAN #define PDP_ENDIAN _PDP_ENDIAN #define BYTE_ORDER _BYTE_ORDER #endif # 69 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/endian.h" 3 4 #ifndef __ASSEMBLER__ #if defined(__GNUCLIKE_BUILTIN_CONSTANT_P) && defined(__OPTIMIZE__) #define __is_constant(x) __builtin_constant_p(x) #else # 74 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/endian.h" 3 4 #define __is_constant(x) 0 #endif # 76 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/endian.h" 3 4 #define __bswap16_const(x) (((x) >> 8) | (((x) << 8) & 0xff00)) #define __bswap32_const(x) (((x) >> 24) | (((x) >> 8) & 0xff00) | \ (((x) << 8) & 0xff0000) | (((x) << 24) & 0xff000000)) #define __bswap64_const(x) (((x) >> 56) | (((x) >> 40) & 0xff00) | \ (((x) >> 24) & 0xff0000) | (((x) >> 8) & 0xff000000) | \ (((x) << 8) & ((__uint64_t)0xff << 32)) | \ (((x) << 24) & ((__uint64_t)0xff << 40)) | \ (((x) << 40) & ((__uint64_t)0xff << 48)) | (((x) << 56))) static __inline __uint16_t __bswap16_var(__uint16_t _x) { return ((_x >> 8) | ((_x << 8) & 0xff00)); } static __inline __uint32_t __bswap32_var(__uint32_t _x) { return ((_x >> 24) | ((_x >> 8) & 0xff00) | ((_x << 8) & 0xff0000) | ((_x << 24) & 0xff000000)); } static __inline __uint64_t __bswap64_var(__uint64_t _x) { return ((_x >> 56) | ((_x >> 40) & 0xff00) | ((_x >> 24) & 0xff0000) | ((_x >> 8) & 0xff000000) | ((_x << 8) & ((__uint64_t)0xff << 32)) | ((_x << 24) & ((__uint64_t)0xff << 40)) | ((_x << 40) & ((__uint64_t)0xff << 48)) | ((_x << 56))); } #define __bswap16(x) ((__uint16_t)(__is_constant((x)) ? \ __bswap16_const((__uint16_t)(x)) : __bswap16_var((__uint16_t)(x)))) #define __bswap32(x) ((__uint32_t)(__is_constant((x)) ? \ __bswap32_const((__uint32_t)(x)) : __bswap32_var((__uint32_t)(x)))) #define __bswap64(x) ((__uint64_t)(__is_constant((x)) ? \ __bswap64_const((__uint64_t)(x)) : __bswap64_var((__uint64_t)(x)))) #ifdef __MIPSEB__ #define __htonl(x) ((__uint32_t)(x)) #define __htons(x) ((__uint16_t)(x)) #define __ntohl(x) ((__uint32_t)(x)) #define __ntohs(x) ((__uint16_t)(x)) /* * Define the order of 32-bit words in 64-bit words. */ /* * XXXMIPS: Additional parentheses to make gcc more happy. */ #define _QUAD_HIGHWORD 0 #define _QUAD_LOWWORD 1 #else # 132 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/endian.h" 3 4 #define _QUAD_HIGHWORD 1 #define _QUAD_LOWWORD 0 #define __ntohl(x) (__bswap32((x))) #define __ntohs(x) (__bswap16((x))) #define __htonl(x) (__bswap32((x))) #define __htons(x) (__bswap16((x))) #endif /* _MIPSEB */ # 139 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/endian.h" 3 4 #endif /* _ASSEMBLER_ */ # 141 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/endian.h" 3 4 #ifdef __cplusplus } #endif # 145 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/endian.h" 3 4 #endif /* !_MACHINE_ENDIAN_H_ */ # 147 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/endian.h" 3 4 # 45 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/types.h" 2 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 45 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/types.h" 3 4 # 46 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/types.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 47 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/types.h" 3 4 # 1 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/_pthreadtypes.h" 1 3 4 /* * Copyright (c) 1993, 1994 by Chris Provenzano, proven@mit.edu * Copyright (c) 1995-1998 by John Birrell * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by Chris Provenzano. * 4. The name of Chris Provenzano may not be used to endorse or promote * products derived from this software without specific prior written * permission. * * THIS SOFTWARE IS PROVIDED BY CHRIS PROVENZANO ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL CHRIS PROVENZANO BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * $FreeBSD$ */ #ifndef _SYS__PTHREADTYPES_H_ #define _SYS__PTHREADTYPES_H_ /* * Forward structure definitions. * * These are mostly opaque to the user. */ struct pthread; struct pthread_attr; struct pthread_cond; struct pthread_cond_attr; struct pthread_mutex; struct pthread_mutex_attr; struct pthread_once; struct pthread_rwlock; struct pthread_rwlockattr; struct pthread_barrier; struct pthread_barrier_attr; struct pthread_spinlock; /* * Primitive system data type definitions required by P1003.1c. * * Note that P1003.1c specifies that there are no defined comparison * or assignment operators for the types pthread_attr_t, pthread_cond_t, * pthread_condattr_t, pthread_mutex_t, pthread_mutexattr_t. */ #ifndef _PTHREAD_T_DECLARED typedef struct pthread *pthread_t; #define _PTHREAD_T_DECLARED #endif # 68 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/_pthreadtypes.h" 3 4 typedef struct pthread_attr *pthread_attr_t; typedef struct pthread_mutex *pthread_mutex_t; typedef struct pthread_mutex_attr *pthread_mutexattr_t; typedef struct pthread_cond *pthread_cond_t; typedef struct pthread_cond_attr *pthread_condattr_t; typedef int pthread_key_t; typedef struct pthread_once pthread_once_t; typedef struct pthread_rwlock *pthread_rwlock_t; typedef struct pthread_rwlockattr *pthread_rwlockattr_t; typedef struct pthread_barrier *pthread_barrier_t; typedef struct pthread_barrierattr *pthread_barrierattr_t; typedef struct pthread_spinlock *pthread_spinlock_t; /* * Additional type definitions: * * Note that P1003.1c reserves the prefixes pthread_ and PTHREAD_ for * use in header symbols. */ typedef void *pthread_addr_t; typedef void *(*pthread_startroutine_t)(void *); /* * Once definitions. */ struct pthread_once { int state; pthread_mutex_t mutex; }; #endif /* ! _SYS__PTHREADTYPES_H_ */ # 99 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/_pthreadtypes.h" 3 4 # 48 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/types.h" 2 3 4 #if __BSD_VISIBLE typedef unsigned char u_char; typedef unsigned short u_short; typedef unsigned int u_int; typedef unsigned long u_long; #ifndef _KERNEL typedef unsigned short ushort; /* Sys V compatibility */ typedef unsigned int uint; /* Sys V compatibility */ #endif # 58 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/types.h" 3 4 #endif # 59 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/types.h" 3 4 /* * XXX POSIX sized integrals that should appear only in . */ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 63 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/types.h" 3 4 # 1 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/_stdint.h" 1 3 4 /*- * Copyright (c) 2011 David E. O'Brien * Copyright (c) 2001 Mike Barcroft * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * $FreeBSD$ */ #ifndef _SYS__STDINT_H_ #define _SYS__STDINT_H_ #ifndef _INT8_T_DECLARED typedef __int8_t int8_t; #define _INT8_T_DECLARED #endif # 37 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/_stdint.h" 3 4 #ifndef _INT16_T_DECLARED typedef __int16_t int16_t; #define _INT16_T_DECLARED #endif # 42 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/_stdint.h" 3 4 #ifndef _INT32_T_DECLARED typedef __int32_t int32_t; #define _INT32_T_DECLARED #endif # 47 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/_stdint.h" 3 4 #ifndef _INT64_T_DECLARED typedef __int64_t int64_t; #define _INT64_T_DECLARED #endif # 52 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/_stdint.h" 3 4 #ifndef _UINT8_T_DECLARED typedef __uint8_t uint8_t; #define _UINT8_T_DECLARED #endif # 57 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/_stdint.h" 3 4 #ifndef _UINT16_T_DECLARED typedef __uint16_t uint16_t; #define _UINT16_T_DECLARED #endif # 62 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/_stdint.h" 3 4 #ifndef _UINT32_T_DECLARED typedef __uint32_t uint32_t; #define _UINT32_T_DECLARED #endif # 67 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/_stdint.h" 3 4 #ifndef _UINT64_T_DECLARED typedef __uint64_t uint64_t; #define _UINT64_T_DECLARED #endif # 72 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/_stdint.h" 3 4 #ifndef _INTPTR_T_DECLARED typedef __intptr_t intptr_t; #define _INTPTR_T_DECLARED #endif # 77 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/_stdint.h" 3 4 #ifndef _UINTPTR_T_DECLARED typedef __uintptr_t uintptr_t; #define _UINTPTR_T_DECLARED #endif # 81 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/_stdint.h" 3 4 #ifndef _INTMAX_T_DECLARED typedef __intmax_t intmax_t; #define _INTMAX_T_DECLARED #endif # 85 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/_stdint.h" 3 4 #ifndef _UINTMAX_T_DECLARED typedef __uintmax_t uintmax_t; #define _UINTMAX_T_DECLARED #endif # 89 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/_stdint.h" 3 4 #ifndef __CHERI_PURE_CAPABILITY__ typedef __uintptr_t vaddr_t; #else # 93 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/_stdint.h" 3 4 typedef __uint64_t vaddr_t; #endif # 95 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/_stdint.h" 3 4 #endif /* !_SYS__STDINT_H_ */ # 97 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/_stdint.h" 3 4 # 64 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/types.h" 2 3 4 typedef __uint8_t u_int8_t; /* unsigned integrals (deprecated) */ typedef __uint16_t u_int16_t; typedef __uint32_t u_int32_t; typedef __uint64_t u_int64_t; typedef __uint64_t u_quad_t; /* quads (deprecated) */ typedef __int64_t quad_t; typedef quad_t * qaddr_t; typedef char * caddr_t; /* core address */ typedef const char * c_caddr_t; /* core address, pointer to const */ #ifndef _BLKSIZE_T_DECLARED typedef __blksize_t blksize_t; #define _BLKSIZE_T_DECLARED #endif # 81 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/types.h" 3 4 typedef __cpuwhich_t cpuwhich_t; typedef __cpulevel_t cpulevel_t; typedef __cpusetid_t cpusetid_t; #ifndef _BLKCNT_T_DECLARED typedef __blkcnt_t blkcnt_t; #define _BLKCNT_T_DECLARED #endif # 90 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/types.h" 3 4 #ifndef _CLOCK_T_DECLARED typedef __clock_t clock_t; #define _CLOCK_T_DECLARED #endif # 95 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/types.h" 3 4 #ifndef _CLOCKID_T_DECLARED typedef __clockid_t clockid_t; #define _CLOCKID_T_DECLARED #endif # 100 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/types.h" 3 4 typedef __critical_t critical_t; /* Critical section value */ typedef __int64_t daddr_t; /* disk address */ #ifndef _DEV_T_DECLARED typedef __dev_t dev_t; /* device number or struct cdev */ #define _DEV_T_DECLARED #endif # 108 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/types.h" 3 4 #ifndef _FFLAGS_T_DECLARED typedef __fflags_t fflags_t; /* file flags */ #define _FFLAGS_T_DECLARED #endif # 113 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/types.h" 3 4 typedef __fixpt_t fixpt_t; /* fixed point number */ #ifndef _FSBLKCNT_T_DECLARED /* for statvfs() */ typedef __fsblkcnt_t fsblkcnt_t; typedef __fsfilcnt_t fsfilcnt_t; #define _FSBLKCNT_T_DECLARED #endif # 121 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/types.h" 3 4 #ifndef _GID_T_DECLARED typedef __gid_t gid_t; /* group id */ #define _GID_T_DECLARED #endif # 126 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/types.h" 3 4 #ifndef _IN_ADDR_T_DECLARED typedef __uint32_t in_addr_t; /* base type for internet address */ #define _IN_ADDR_T_DECLARED #endif # 131 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/types.h" 3 4 #ifndef _IN_PORT_T_DECLARED typedef __uint16_t in_port_t; #define _IN_PORT_T_DECLARED #endif # 136 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/types.h" 3 4 #ifndef _ID_T_DECLARED typedef __id_t id_t; /* can hold a uid_t or pid_t */ #define _ID_T_DECLARED #endif # 141 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/types.h" 3 4 #ifndef _INO_T_DECLARED typedef __ino_t ino_t; /* inode number */ #define _INO_T_DECLARED #endif # 146 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/types.h" 3 4 #ifndef _KEY_T_DECLARED typedef __key_t key_t; /* IPC key (for Sys V IPC) */ #define _KEY_T_DECLARED #endif # 151 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/types.h" 3 4 #ifndef _LWPID_T_DECLARED typedef __lwpid_t lwpid_t; /* Thread ID (a.k.a. LWP) */ #define _LWPID_T_DECLARED #endif # 156 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/types.h" 3 4 #ifndef _MODE_T_DECLARED typedef __mode_t mode_t; /* permissions */ #define _MODE_T_DECLARED #endif # 161 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/types.h" 3 4 #ifndef _ACCMODE_T_DECLARED typedef __accmode_t accmode_t; /* access permissions */ #define _ACCMODE_T_DECLARED #endif # 166 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/types.h" 3 4 #ifndef _NLINK_T_DECLARED typedef __nlink_t nlink_t; /* link count */ #define _NLINK_T_DECLARED #endif # 171 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/types.h" 3 4 #ifndef _OFF_T_DECLARED typedef __off_t off_t; /* file offset */ #define _OFF_T_DECLARED #endif # 176 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/types.h" 3 4 #ifndef _PID_T_DECLARED typedef __pid_t pid_t; /* process id */ #define _PID_T_DECLARED #endif # 181 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/types.h" 3 4 typedef __register_t register_t; #ifndef _RLIM_T_DECLARED typedef __rlim_t rlim_t; /* resource limit */ #define _RLIM_T_DECLARED #endif # 188 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/types.h" 3 4 typedef __int64_t sbintime_t; typedef __segsz_t segsz_t; /* segment size (in pages) */ #ifndef _SIZE_T_DECLARED typedef __size_t size_t; #define _SIZE_T_DECLARED #endif # 197 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/types.h" 3 4 #ifndef _SSIZE_T_DECLARED typedef __ssize_t ssize_t; #define _SSIZE_T_DECLARED #endif # 202 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/types.h" 3 4 #ifndef _SUSECONDS_T_DECLARED typedef __suseconds_t suseconds_t; /* microseconds (signed) */ #define _SUSECONDS_T_DECLARED #endif # 207 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/types.h" 3 4 #ifndef _TIME_T_DECLARED typedef __time_t time_t; #define _TIME_T_DECLARED #endif # 212 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/types.h" 3 4 #ifndef _TIMER_T_DECLARED typedef __timer_t timer_t; #define _TIMER_T_DECLARED #endif # 217 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/types.h" 3 4 #ifndef _MQD_T_DECLARED typedef __mqd_t mqd_t; #define _MQD_T_DECLARED #endif # 222 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/types.h" 3 4 typedef __u_register_t u_register_t; #ifndef _UID_T_DECLARED typedef __uid_t uid_t; /* user id */ #define _UID_T_DECLARED #endif # 229 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/types.h" 3 4 #ifndef _USECONDS_T_DECLARED typedef __useconds_t useconds_t; /* microseconds (unsigned) */ #define _USECONDS_T_DECLARED #endif # 234 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/types.h" 3 4 #ifndef _CAP_IOCTL_T_DECLARED #define _CAP_IOCTL_T_DECLARED typedef unsigned long cap_ioctl_t; #endif # 239 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/types.h" 3 4 #ifndef _CAP_RIGHTS_T_DECLARED #define _CAP_RIGHTS_T_DECLARED struct cap_rights; typedef struct cap_rights cap_rights_t; #endif # 246 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/types.h" 3 4 typedef __vm_offset_t vm_offset_t; typedef __vm_ooffset_t vm_ooffset_t; typedef __vm_paddr_t vm_paddr_t; typedef __vm_pindex_t vm_pindex_t; typedef __vm_size_t vm_size_t; typedef __rman_res_t rman_res_t; #ifdef _KERNEL typedef int boolean_t; typedef struct device *device_t; typedef __intfptr_t intfptr_t; /* * XXX this is fixed width for historical reasons. It should have had type * __int_fast32_t. Fixed-width types should not be used unless binary * compatibility is essential. Least-width types should be used even less * since they provide smaller benefits. * * XXX should be MD. * * XXX this is bogus in -current, but still used for spl*(). */ typedef __uint32_t intrmask_t; /* Interrupt mask (spl, xxx_imask...) */ typedef __uintfptr_t uintfptr_t; typedef __uint64_t uoff_t; typedef char vm_memattr_t; /* memory attribute codes */ typedef struct vm_page *vm_page_t; #if !defined(__bool_true_false_are_defined) && !defined(__cplusplus) #define __bool_true_false_are_defined 1 #define false 0 #define true 1 #if __STDC_VERSION__ < 199901L && __GNUC__ < 3 && !defined(__INTEL_COMPILER) typedef int _Bool; #endif # 284 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/types.h" 3 4 typedef _Bool bool; #endif /* !__bool_true_false_are_defined && !__cplusplus */ # 286 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/types.h" 3 4 #define offsetof(type, field) __offsetof(type, field) #endif /* !_KERNEL */ # 290 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/types.h" 3 4 /* * The following are all things that really shouldn't exist in this header, * since its purpose is to provide typedefs, not miscellaneous doodads. */ #ifdef __POPCNT__ #define __bitcount64(x) __builtin_popcountll((__uint64_t)(x)) #define __bitcount32(x) __builtin_popcount((__uint32_t)(x)) #define __bitcount16(x) __builtin_popcount((__uint16_t)(x)) #define __bitcountl(x) __builtin_popcountl((unsigned long)(x)) #define __bitcount(x) __builtin_popcount((unsigned int)(x)) #else # 303 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/types.h" 3 4 /* * Population count algorithm using SWAR approach * - "SIMD Within A Register". */ static __inline __uint16_t __bitcount16(__uint16_t _x) { _x = (_x & 0x5555) + ((_x & 0xaaaa) >> 1); _x = (_x & 0x3333) + ((_x & 0xcccc) >> 2); _x = (_x + (_x >> 4)) & 0x0f0f; _x = (_x + (_x >> 8)) & 0x00ff; return (_x); } static __inline __uint32_t __bitcount32(__uint32_t _x) { _x = (_x & 0x55555555) + ((_x & 0xaaaaaaaa) >> 1); _x = (_x & 0x33333333) + ((_x & 0xcccccccc) >> 2); _x = (_x + (_x >> 4)) & 0x0f0f0f0f; _x = (_x + (_x >> 8)); _x = (_x + (_x >> 16)) & 0x000000ff; return (_x); } #ifdef __LP64__ static __inline __uint64_t __bitcount64(__uint64_t _x) { _x = (_x & 0x5555555555555555) + ((_x & 0xaaaaaaaaaaaaaaaa) >> 1); _x = (_x & 0x3333333333333333) + ((_x & 0xcccccccccccccccc) >> 2); _x = (_x + (_x >> 4)) & 0x0f0f0f0f0f0f0f0f; _x = (_x + (_x >> 8)); _x = (_x + (_x >> 16)); _x = (_x + (_x >> 32)) & 0x000000ff; return (_x); } #define __bitcountl(x) __bitcount64((unsigned long)(x)) #else # 346 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/types.h" 3 4 static __inline __uint64_t __bitcount64(__uint64_t _x) { return (__bitcount32(_x >> 32) + __bitcount32(_x)); } #define __bitcountl(x) __bitcount32((unsigned long)(x)) #endif # 355 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/types.h" 3 4 #define __bitcount(x) __bitcount32((unsigned int)(x)) #endif # 357 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/types.h" 3 4 #if __BSD_VISIBLE #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 360 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/types.h" 3 4 # 1 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/select.h" 1 3 4 /*- * Copyright (c) 1992, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * $FreeBSD$ */ #ifndef _SYS_SELECT_H_ #define _SYS_SELECT_H_ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 35 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/select.h" 3 4 # 36 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/select.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 36 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/select.h" 3 4 # 37 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/select.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 38 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/select.h" 3 4 # 1 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/_sigset.h" 1 3 4 /*- * Copyright (c) 1982, 1986, 1989, 1991, 1993 * The Regents of the University of California. All rights reserved. * (c) UNIX System Laboratories, Inc. * All or some portions of this file are derived from material licensed * to the University of California by American Telephone and Telegraph * Co. or Unix System Laboratories, Inc. and are reproduced herein with * the permission of UNIX System Laboratories, Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)signal.h 8.4 (Berkeley) 5/4/95 * $FreeBSD$ */ #ifndef _SYS__SIGSET_H_ #define _SYS__SIGSET_H_ /* * sigset_t macros. */ #define _SIG_WORDS 4 #define _SIG_MAXSIG 128 #define _SIG_IDX(sig) ((sig) - 1) #define _SIG_WORD(sig) (_SIG_IDX(sig) >> 5) #define _SIG_BIT(sig) (1 << (_SIG_IDX(sig) & 31)) #define _SIG_VALID(sig) ((sig) <= _SIG_MAXSIG && (sig) > 0) typedef struct __sigset { __uint32_t __bits[_SIG_WORDS]; } __sigset_t; #if defined(_KERNEL) && defined(COMPAT_43) typedef unsigned int osigset_t; #endif # 58 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/_sigset.h" 3 4 #endif /* !_SYS__SIGSET_H_ */ # 60 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/_sigset.h" 3 4 # 39 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/select.h" 2 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 39 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/select.h" 3 4 # 1 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/_timeval.h" 1 3 4 /*- * Copyright (c) 2002 Mike Barcroft * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * $FreeBSD$ */ #ifndef _SYS__TIMEVAL_H_ #define _SYS__TIMEVAL_H_ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 32 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/_timeval.h" 3 4 # 33 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/_timeval.h" 3 4 #ifndef _SUSECONDS_T_DECLARED typedef __suseconds_t suseconds_t; #define _SUSECONDS_T_DECLARED #endif # 38 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/_timeval.h" 3 4 #ifndef _TIME_T_DECLARED typedef __time_t time_t; #define _TIME_T_DECLARED #endif # 43 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/_timeval.h" 3 4 /* * Structure returned by gettimeofday(2) system call, and used in other calls. */ struct timeval { time_t tv_sec; /* seconds */ suseconds_t tv_usec; /* and microseconds */ }; #endif /* !_SYS__TIMEVAL_H_ */ # 53 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/_timeval.h" 3 4 # 40 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/select.h" 2 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 40 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/select.h" 3 4 # 1 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/timespec.h" 1 3 4 /*- * Copyright (c) 1982, 1986, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)time.h 8.5 (Berkeley) 5/4/95 * from: FreeBSD: src/sys/sys/time.h,v 1.43 2000/03/20 14:09:05 phk Exp * $FreeBSD$ */ #ifndef _SYS_TIMESPEC_H_ #define _SYS_TIMESPEC_H_ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 37 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/timespec.h" 3 4 # 38 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/timespec.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 38 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/timespec.h" 3 4 # 1 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/_timespec.h" 1 3 4 /*- * Copyright (c) 1982, 1986, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)time.h 8.5 (Berkeley) 5/4/95 * from: FreeBSD: src/sys/sys/time.h,v 1.43 2000/03/20 14:09:05 phk Exp * $FreeBSD$ */ #ifndef _SYS__TIMESPEC_H_ #define _SYS__TIMESPEC_H_ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 37 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/_timespec.h" 3 4 # 38 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/_timespec.h" 3 4 #ifndef _TIME_T_DECLARED typedef __time_t time_t; #define _TIME_T_DECLARED #endif # 43 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/_timespec.h" 3 4 struct timespec { time_t tv_sec; /* seconds */ long tv_nsec; /* and nanoseconds */ }; #endif /* !_SYS__TIMESPEC_H_ */ # 50 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/_timespec.h" 3 4 # 39 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/timespec.h" 2 3 4 #if __BSD_VISIBLE #define TIMEVAL_TO_TIMESPEC(tv, ts) \ do { \ (ts)->tv_sec = (tv)->tv_sec; \ (ts)->tv_nsec = (tv)->tv_usec * 1000; \ } while (0) #define TIMESPEC_TO_TIMEVAL(tv, ts) \ do { \ (tv)->tv_sec = (ts)->tv_sec; \ (tv)->tv_usec = (ts)->tv_nsec / 1000; \ } while (0) #endif /* __BSD_VISIBLE */ # 53 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/timespec.h" 3 4 /* * Structure defined by POSIX.1b to be like a itimerval, but with * timespecs. Used in the timer_*() system calls. */ struct itimerspec { struct timespec it_interval; struct timespec it_value; }; #endif /* _SYS_TIMESPEC_H_ */ # 64 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/timespec.h" 3 4 # 41 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/select.h" 2 3 4 typedef unsigned long __fd_mask; #if __BSD_VISIBLE typedef __fd_mask fd_mask; #endif # 46 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/select.h" 3 4 #ifndef _SIGSET_T_DECLARED #define _SIGSET_T_DECLARED typedef __sigset_t sigset_t; #endif # 51 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/select.h" 3 4 /* * Select uses bit masks of file descriptors in longs. These macros * manipulate such bit fields (the filesystem macros use chars). * FD_SETSIZE may be defined by the user, but the default here should * be enough for most uses. */ #ifndef FD_SETSIZE #define FD_SETSIZE 1024 #endif # 61 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/select.h" 3 4 #define _NFDBITS (sizeof(__fd_mask) * 8) /* bits per mask */ #if __BSD_VISIBLE #define NFDBITS _NFDBITS #endif # 66 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/select.h" 3 4 #ifndef _howmany #define _howmany(x, y) (((x) + ((y) - 1)) / (y)) #endif # 70 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/select.h" 3 4 typedef struct fd_set { __fd_mask __fds_bits[_howmany(FD_SETSIZE, _NFDBITS)]; } fd_set; #if __BSD_VISIBLE #define fds_bits __fds_bits #endif # 77 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/select.h" 3 4 #define __fdset_mask(n) ((__fd_mask)1 << ((n) % _NFDBITS)) #define FD_CLR(n, p) ((p)->__fds_bits[(n)/_NFDBITS] &= ~__fdset_mask(n)) #if __BSD_VISIBLE #define FD_COPY(f, t) (void)(*(t) = *(f)) #endif # 83 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/select.h" 3 4 #define FD_ISSET(n, p) (((p)->__fds_bits[(n)/_NFDBITS] & __fdset_mask(n)) != 0) #define FD_SET(n, p) ((p)->__fds_bits[(n)/_NFDBITS] |= __fdset_mask(n)) #define FD_ZERO(p) do { \ fd_set *_p; \ __size_t _n; \ \ _p = (p); \ _n = _howmany(FD_SETSIZE, _NFDBITS); \ while (_n > 0) \ _p->__fds_bits[--_n] = 0; \ } while (0) #ifndef _KERNEL __BEGIN_DECLS int pselect(int, fd_set *__restrict, fd_set *__restrict, fd_set *__restrict, const struct timespec *__restrict, const sigset_t *__restrict); #ifndef _SELECT_DECLARED #define _SELECT_DECLARED /* XXX missing restrict type-qualifier */ int select(int, fd_set *, fd_set *, fd_set *, struct timeval *); #endif # 105 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/select.h" 3 4 __END_DECLS #endif /* !_KERNEL */ # 107 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/select.h" 3 4 #endif /* _SYS_SELECT_H_ */ # 109 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/select.h" 3 4 # 361 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/types.h" 2 3 4 /* * minor() gives a cookie instead of an index since we don't want to * change the meanings of bits 0-15 or waste time and space shifting * bits 16-31 for devices that don't use them. */ #define major(x) ((int)(((u_int)(x) >> 8)&0xff)) /* major number */ #define minor(x) ((int)((x)&0xffff00ff)) /* minor number */ #define makedev(x,y) ((dev_t)(((x) << 8) | (y))) /* create dev_t */ /* * These declarations belong elsewhere, but are repeated here and in * to give broken programs a better chance of working with * 64-bit off_t's. */ #ifndef _KERNEL __BEGIN_DECLS #ifndef _FTRUNCATE_DECLARED #define _FTRUNCATE_DECLARED int ftruncate(int, off_t); #endif # 382 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/types.h" 3 4 #ifndef _LSEEK_DECLARED #define _LSEEK_DECLARED off_t lseek(int, off_t, int); #endif # 386 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/types.h" 3 4 #ifndef _MMAP_DECLARED #define _MMAP_DECLARED void * mmap(void *, size_t, int, int, int, off_t); #endif # 390 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/types.h" 3 4 #ifndef _TRUNCATE_DECLARED #define _TRUNCATE_DECLARED int truncate(const char *, off_t); #endif # 394 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/types.h" 3 4 __END_DECLS #endif /* !_KERNEL */ # 396 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/types.h" 3 4 #endif /* __BSD_VISIBLE */ # 398 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/types.h" 3 4 #endif /* !_SYS_TYPES_H_ */ # 400 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/types.h" 3 4 # 91 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/param.h" 2 3 4 #endif # 92 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/param.h" 3 4 /* * Machine-independent constants (some used in following include files). * Redefined constants are from POSIX 1003.1 limits file. * * MAXCOMLEN should be >= sizeof(ac_comm) (see ) */ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 99 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/param.h" 3 4 # 1 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/syslimits.h" 1 3 4 /*- * Copyright (c) 1988, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)syslimits.h 8.1 (Berkeley) 6/2/93 * $FreeBSD$ */ #ifndef _SYS_SYSLIMITS_H_ #define _SYS_SYSLIMITS_H_ #if !defined(_KERNEL) && !defined(_LIMITS_H_) && !defined(_SYS_PARAM_H_) #ifndef _SYS_CDEFS_H_ #error this file needs sys/cdefs.h as a prerequisite #endif # 40 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/syslimits.h" 3 4 #ifdef __CC_SUPPORTS_WARNING #warning "No user-serviceable parts inside." #endif # 43 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/syslimits.h" 3 4 #endif # 44 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/syslimits.h" 3 4 /* * Do not add any new variables here. (See the comment at the end of * the file for why.) */ #define ARG_MAX 262144 /* max bytes for an exec function */ #ifndef CHILD_MAX #define CHILD_MAX 40 /* max simultaneous processes */ #endif # 53 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/syslimits.h" 3 4 #define LINK_MAX 32767 /* max file link count */ #define MAX_CANON 255 /* max bytes in term canon input line */ #define MAX_INPUT 255 /* max bytes in terminal input */ #define NAME_MAX 255 /* max bytes in a file name */ #ifndef NGROUPS_MAX #define NGROUPS_MAX 1023 /* max supplemental group id's */ #endif # 60 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/syslimits.h" 3 4 #ifndef OPEN_MAX #define OPEN_MAX 64 /* max open files per process */ #endif # 63 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/syslimits.h" 3 4 #define PATH_MAX 1024 /* max bytes in pathname */ #define PIPE_BUF 512 /* max bytes for atomic pipe writes */ #define IOV_MAX 1024 /* max elements in i/o vector */ /* * We leave the following values undefined to force applications to either * assume conservative values or call sysconf() to get the current value. * * HOST_NAME_MAX * * (We should do this for most of the values currently defined here, * but many programs are not prepared to deal with this yet.) */ #endif # 77 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/syslimits.h" 3 4 # 100 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/param.h" 2 3 4 #define MAXCOMLEN 19 /* max command name remembered */ #define MAXINTERP PATH_MAX /* max interpreter file name length */ #define MAXLOGNAME 33 /* max login name length (incl. NUL) */ #define MAXUPRC CHILD_MAX /* max simultaneous processes */ #define NCARGS ARG_MAX /* max bytes for an exec function */ #define NGROUPS (NGROUPS_MAX+1) /* max number groups */ #define NOFILE OPEN_MAX /* max open files per process */ #define NOGROUP 65535 /* marker for empty group set member */ #define MAXHOSTNAMELEN 256 /* max hostname size */ #define SPECNAMELEN 63 /* max length of devicename */ /* More types and definitions used throughout the kernel. */ #ifdef _KERNEL #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 114 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/param.h" 3 4 # 115 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/param.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 115 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/param.h" 3 4 # 116 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/param.h" 3 4 #ifndef LOCORE #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 117 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/param.h" 3 4 # 118 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/param.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 118 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/param.h" 3 4 # 119 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/param.h" 3 4 #endif # 120 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/param.h" 3 4 #ifndef FALSE #define FALSE 0 #endif # 124 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/param.h" 3 4 #ifndef TRUE #define TRUE 1 #endif # 127 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/param.h" 3 4 #endif # 128 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/param.h" 3 4 #ifndef _KERNEL /* Signals. */ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 131 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/param.h" 3 4 # 1 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/signal.h" 1 3 4 /*- * Copyright (c) 1982, 1986, 1989, 1991, 1993 * The Regents of the University of California. All rights reserved. * (c) UNIX System Laboratories, Inc. * All or some portions of this file are derived from material licensed * to the University of California by American Telephone and Telegraph * Co. or Unix System Laboratories, Inc. and are reproduced herein with * the permission of UNIX System Laboratories, Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)signal.h 8.4 (Berkeley) 5/4/95 * $FreeBSD$ */ #ifndef _SYS_SIGNAL_H_ #define _SYS_SIGNAL_H_ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 41 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/signal.h" 3 4 # 42 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/signal.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 42 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/signal.h" 3 4 # 43 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/signal.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 43 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/signal.h" 3 4 # 44 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/signal.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include /* __MINSIGSTKSZ */ #endif /* expanded by -frewrite-includes */ # 45 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/signal.h" 3 4 # 1 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/_limits.h" 1 3 4 /*- * Copyright (c) 1988, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)limits.h 8.3 (Berkeley) 1/4/94 * from: src/sys/i386/include/_limits.h,v 1.27 2005/01/06 22:18:15 imp * $FreeBSD$ */ #ifndef _MACHINE__LIMITS_H_ #define _MACHINE__LIMITS_H_ /* * According to ANSI (section 2.2.4.2), the values below must be usable by * #if preprocessing directives. Additionally, the expression must have the * same type as would an expression that is an object of the corresponding * type converted according to the integral promotions. The subtraction for * INT_MIN, etc., is so the value is not unsigned; e.g., 0x80000000 is an * unsigned int for 32-bit two's complement ANSI compilers (section 3.1.3.2). */ #define __CHAR_BIT 8 /* number of bits in a char */ #define __SCHAR_MAX 0x7f /* max value for a signed char */ #define __SCHAR_MIN (-0x7f - 1) /* min value for a signed char */ #define __UCHAR_MAX 0xff /* max value for an unsigned char */ #define __USHRT_MAX 0xffff /* max value for an unsigned short */ #define __SHRT_MAX 0x7fff /* max value for a short */ #define __SHRT_MIN (-0x7fff - 1) /* min value for a short */ #define __UINT_MAX 0xffffffff /* max value for an unsigned int */ #define __INT_MAX 0x7fffffff /* max value for an int */ #define __INT_MIN (-0x7fffffff - 1) /* min value for an int */ #ifdef __mips_n64 #define __ULONG_MAX 0xffffffffffffffff #define __LONG_MAX 0x7fffffffffffffff #define __LONG_MIN (-0x7fffffffffffffff - 1) #define __LONG_BIT 64 #else # 67 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/_limits.h" 3 4 #define __ULONG_MAX 0xffffffffUL /* max value for an unsigned long */ #define __LONG_MAX 0x7fffffffL /* max value for a long */ #define __LONG_MIN (-0x7fffffffL - 1) /* min value for a long */ #define __LONG_BIT 32 #endif # 72 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/_limits.h" 3 4 /* max value for an unsigned long long */ #define __ULLONG_MAX 0xffffffffffffffffULL #define __LLONG_MAX 0x7fffffffffffffffLL /* max value for a long long */ #define __LLONG_MIN (-0x7fffffffffffffffLL - 1) /* min for a long long */ #define __SSIZE_MAX __LONG_MAX /* max value for a ssize_t */ #define __SIZE_T_MAX __ULONG_MAX /* max value for a size_t */ #define __OFF_MAX __LLONG_MAX /* max value for an off_t */ #define __OFF_MIN __LLONG_MIN /* min value for an off_t */ /* Quads and long longs are the same size. Ensure they stay in sync. */ #define __UQUAD_MAX __ULLONG_MAX /* max value for a uquad_t */ #define __QUAD_MAX __LLONG_MAX /* max value for a quad_t */ #define __QUAD_MIN __LLONG_MIN /* min value for a quad_t */ #define __WORD_BIT 32 #define __MINSIGSTKSZ (512 * 4) #endif /* !_MACHINE__LIMITS_H_ */ # 95 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/_limits.h" 3 4 # 46 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/signal.h" 2 3 4 #if 0 /* expanded by -frewrite-includes */ #include /* sig_atomic_t; trap codes; sigcontext */ #endif /* expanded by -frewrite-includes */ # 46 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/signal.h" 3 4 # 1 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/signal.h" 1 3 4 /* $OpenBSD: signal.h,v 1.2 1999/01/27 04:10:03 imp Exp $ */ /* * Copyright (c) 1992, 1993 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Ralph Campbell. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)signal.h 8.1 (Berkeley) 6/10/93 * JNPR: signal.h,v 1.4 2007/01/08 04:58:37 katta * $FreeBSD$ */ #ifndef _MACHINE_SIGNAL_H_ #define _MACHINE_SIGNAL_H_ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 42 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/signal.h" 3 4 # 43 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/signal.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 43 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/signal.h" 3 4 # 44 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/signal.h" 3 4 /* * Machine-dependent signal definitions */ typedef int sig_atomic_t; #if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE) /* * Information pushed on stack when a signal is delivered. * This is used by the kernel to restore state following * execution of the signal handler. It is also made available * to the handler to allow it to restore state properly if * a non-standard exit is performed. */ struct sigcontext { /* * The fields following 'sc_mask' must match the definition * of struct __mcontext. That way we can support * struct sigcontext and ucontext_t at the same * time. */ __sigset_t sc_mask; /* signal mask to restore */ int sc_onstack; /* sigstack state to restore */ __register_t sc_pc; /* pc at time of signal */ __register_t sc_regs[32]; /* processor regs 0 to 31 */ __register_t mullo, mulhi; /* mullo and mulhi registers... */ int sc_fpused; /* fp has been used */ f_register_t sc_fpregs[33]; /* fp regs 0 to 31 and csr */ __register_t sc_fpc_eir; /* fp exception instruction reg */ /* * Optional externally referenced storage for coprocessors. Modeled * on the approach taken for extended FPU state on x86, which leaves * some ABI concerns but appears to work in practice. */ __register_t sc_cp2state; /* Pointer to external state. */ __register_t sc_cp2state_len;/* Length of external state. */ /* * XXXRW: Unfortunately, reserved space in the MIPS sigcontext was * made an 'int' rather than '__register_t', so embedding new pointers * changes the 32-bit vs. 64-bit versions of this structure * differently. */ #if (defined(__mips_n32) || defined(__mips_n64)) int xxx[4]; /* XXX reserved */ #else # 93 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/signal.h" 3 4 int xxx[6]; /* XXX reserved */ #endif # 95 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/signal.h" 3 4 }; #endif /* !_ANSI_SOURCE && !_POSIX_SOURCE */ # 98 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/signal.h" 3 4 #endif /* !_MACHINE_SIGNAL_H_ */ # 100 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/signal.h" 3 4 # 47 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/signal.h" 2 3 4 /* * System defined signals. */ #if __POSIX_VISIBLE || __XSI_VISIBLE #define SIGHUP 1 /* hangup */ #endif # 54 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/signal.h" 3 4 #define SIGINT 2 /* interrupt */ #if __POSIX_VISIBLE || __XSI_VISIBLE #define SIGQUIT 3 /* quit */ #endif # 58 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/signal.h" 3 4 #define SIGILL 4 /* illegal instr. (not reset when caught) */ #if __XSI_VISIBLE #define SIGTRAP 5 /* trace trap (not reset when caught) */ #endif # 62 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/signal.h" 3 4 #define SIGABRT 6 /* abort() */ #if __BSD_VISIBLE #define SIGIOT SIGABRT /* compatibility */ #define SIGEMT 7 /* EMT instruction */ #endif # 67 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/signal.h" 3 4 #define SIGFPE 8 /* floating point exception */ #if __POSIX_VISIBLE || __XSI_VISIBLE #define SIGKILL 9 /* kill (cannot be caught or ignored) */ #endif # 71 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/signal.h" 3 4 #if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE #define SIGBUS 10 /* bus error */ #endif # 74 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/signal.h" 3 4 #define SIGSEGV 11 /* segmentation violation */ #if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE #define SIGSYS 12 /* non-existent system call invoked */ #endif # 78 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/signal.h" 3 4 #if __POSIX_VISIBLE || __XSI_VISIBLE #define SIGPIPE 13 /* write on a pipe with no one to read it */ #define SIGALRM 14 /* alarm clock */ #endif # 82 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/signal.h" 3 4 #define SIGTERM 15 /* software termination signal from kill */ #if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE #define SIGURG 16 /* urgent condition on IO channel */ #endif # 86 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/signal.h" 3 4 #if __POSIX_VISIBLE || __XSI_VISIBLE #define SIGSTOP 17 /* sendable stop signal not from tty */ #define SIGTSTP 18 /* stop signal from tty */ #define SIGCONT 19 /* continue a stopped process */ #define SIGCHLD 20 /* to parent on child stop or exit */ #define SIGTTIN 21 /* to readers pgrp upon background tty read */ #define SIGTTOU 22 /* like TTIN if (tp->t_local<OSTOP) */ #endif # 94 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/signal.h" 3 4 #if __BSD_VISIBLE #define SIGIO 23 /* input/output possible signal */ #endif # 97 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/signal.h" 3 4 #if __XSI_VISIBLE #define SIGXCPU 24 /* exceeded CPU time limit */ #define SIGXFSZ 25 /* exceeded file size limit */ #define SIGVTALRM 26 /* virtual time alarm */ #define SIGPROF 27 /* profiling time alarm */ #endif # 103 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/signal.h" 3 4 #if __BSD_VISIBLE #define SIGWINCH 28 /* window size changes */ #define SIGINFO 29 /* information request */ #endif # 107 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/signal.h" 3 4 #if __POSIX_VISIBLE || __XSI_VISIBLE #define SIGUSR1 30 /* user defined signal 1 */ #define SIGUSR2 31 /* user defined signal 2 */ #endif # 111 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/signal.h" 3 4 #if __BSD_VISIBLE #define SIGTHR 32 /* reserved by thread library. */ #define SIGLWP SIGTHR #define SIGLIBRT 33 /* reserved by real-time library. */ #define SIGPROT 34 /* in-address space security exception. */ #endif # 117 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/signal.h" 3 4 #define SIGRTMIN 65 #define SIGRTMAX 126 #define SIG_DFL ((__sighandler_t *)0) #define SIG_IGN ((__sighandler_t *)1) #define SIG_ERR ((__sighandler_t *)-1) /* #define SIG_CATCH ((__sighandler_t *)2) See signalvar.h */ #define SIG_HOLD ((__sighandler_t *)3) /* * Type of a signal handling function. * * Language spec sez signal handlers take exactly one arg, even though we * actually supply three. Ugh! * * We don't try to hide the difference by leaving out the args because * that would cause warnings about conformant programs. Nonconformant * programs can avoid the warnings by casting to (__sighandler_t *) or * sig_t before calling signal() or assigning to sa_handler or sv_handler. * * The kernel should reverse the cast before calling the function. It * has no way to do this, but on most machines 1-arg and 3-arg functions * have the same calling protocol so there is no problem in practice. * A bit in sa_flags could be used to specify the number of args. */ typedef void __sighandler_t(int); #if __POSIX_VISIBLE || __XSI_VISIBLE #ifndef _SIGSET_T_DECLARED #define _SIGSET_T_DECLARED typedef __sigset_t sigset_t; #endif # 150 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/signal.h" 3 4 #endif # 151 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/signal.h" 3 4 #if __POSIX_VISIBLE >= 199309 || __XSI_VISIBLE >= 500 union sigval { /* Members as suggested by Annex C of POSIX 1003.1b. */ int sival_int; void *sival_ptr; /* 6.0 compatibility */ int sigval_int; void *sigval_ptr; }; #endif # 162 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/signal.h" 3 4 #if __POSIX_VISIBLE >= 199309 struct sigevent { int sigev_notify; /* Notification type */ int sigev_signo; /* Signal number */ union sigval sigev_value; /* Signal value */ union { __lwpid_t _threadid; struct { void (*_function)(union sigval); void *_attribute; /* pthread_attr_t * */ } _sigev_thread; unsigned short _kevent_flags; long __spare__[8]; } _sigev_un; }; #if __BSD_VISIBLE #define sigev_notify_kqueue sigev_signo #define sigev_notify_kevent_flags _sigev_un._kevent_flags #define sigev_notify_thread_id _sigev_un._threadid #endif # 184 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/signal.h" 3 4 #define sigev_notify_function _sigev_un._sigev_thread._function #define sigev_notify_attributes _sigev_un._sigev_thread._attribute #define SIGEV_NONE 0 /* No async notification. */ #define SIGEV_SIGNAL 1 /* Generate a queued signal. */ #define SIGEV_THREAD 2 /* Call back from another pthread. */ #if __BSD_VISIBLE #define SIGEV_KEVENT 3 /* Generate a kevent. */ #define SIGEV_THREAD_ID 4 /* Send signal to a kernel thread. */ #endif # 194 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/signal.h" 3 4 #endif /* __POSIX_VISIBLE >= 199309 */ # 195 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/signal.h" 3 4 #if __POSIX_VISIBLE >= 199309 || __XSI_VISIBLE typedef struct __siginfo { int si_signo; /* signal number */ int si_errno; /* errno association */ /* * Cause of signal, one of the SI_ macros or signal-specific * values, i.e. one of the FPE_... values for SIGFPE. This * value is equivalent to the second argument to an old-style * FreeBSD signal handler. */ int si_code; /* signal code */ __pid_t si_pid; /* sending process */ __uid_t si_uid; /* sender's ruid */ int si_status; /* exit value */ void *si_addr; /* faulting instruction */ union sigval si_value; /* signal value */ union { struct { int _trapno;/* machine specific trap code */ } _fault; struct { int _timerid; int _overrun; } _timer; struct { int _mqd; } _mesgq; struct { long _band; /* band event for SIGPOLL */ } _poll; /* was this ever used ? */ struct { long __spare1__; int __spare2__[7]; } __spare__; } _reason; } siginfo_t; #define si_trapno _reason._fault._trapno #define si_timerid _reason._timer._timerid #define si_overrun _reason._timer._overrun #define si_mqd _reason._mesgq._mqd #define si_band _reason._poll._band /** si_code **/ /* codes for SIGILL */ #define ILL_ILLOPC 1 /* Illegal opcode. */ #define ILL_ILLOPN 2 /* Illegal operand. */ #define ILL_ILLADR 3 /* Illegal addressing mode. */ #define ILL_ILLTRP 4 /* Illegal trap. */ #define ILL_PRVOPC 5 /* Privileged opcode. */ #define ILL_PRVREG 6 /* Privileged register. */ #define ILL_COPROC 7 /* Coprocessor error. */ #define ILL_BADSTK 8 /* Internal stack error. */ /* codes for SIGBUS */ #define BUS_ADRALN 1 /* Invalid address alignment. */ #define BUS_ADRERR 2 /* Nonexistent physical address. */ #define BUS_OBJERR 3 /* Object-specific hardware error. */ /* codes for SIGSEGV */ #define SEGV_MAPERR 1 /* Address not mapped to object. */ #define SEGV_ACCERR 2 /* Invalid permissions for mapped */ /* object. */ /* codes for SIGFPE */ #define FPE_INTOVF 1 /* Integer overflow. */ #define FPE_INTDIV 2 /* Integer divide by zero. */ #define FPE_FLTDIV 3 /* Floating point divide by zero. */ #define FPE_FLTOVF 4 /* Floating point overflow. */ #define FPE_FLTUND 5 /* Floating point underflow. */ #define FPE_FLTRES 6 /* Floating point inexact result. */ #define FPE_FLTINV 7 /* Invalid floating point operation. */ #define FPE_FLTSUB 8 /* Subscript out of range. */ /* codes for SIGTRAP */ #define TRAP_BRKPT 1 /* Process breakpoint. */ #define TRAP_TRACE 2 /* Process trace trap. */ #define TRAP_DTRACE 3 /* DTrace induced trap. */ /* codes for SIGCHLD */ #define CLD_EXITED 1 /* Child has exited */ #define CLD_KILLED 2 /* Child has terminated abnormally but */ /* did not create a core file */ #define CLD_DUMPED 3 /* Child has terminated abnormally and */ /* created a core file */ #define CLD_TRAPPED 4 /* Traced child has trapped */ #define CLD_STOPPED 5 /* Child has stopped */ #define CLD_CONTINUED 6 /* Stopped child has continued */ /* codes for SIGPOLL */ #define POLL_IN 1 /* Data input available */ #define POLL_OUT 2 /* Output buffers available */ #define POLL_MSG 3 /* Input message available */ #define POLL_ERR 4 /* I/O Error */ #define POLL_PRI 5 /* High priority input available */ #define POLL_HUP 6 /* Device disconnected */ #endif # 294 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/signal.h" 3 4 #if __POSIX_VISIBLE || __XSI_VISIBLE struct __siginfo; /* * Signal vector "template" used in sigaction call. */ struct sigaction { union { void (*__sa_handler)(int); void (*__sa_sigaction)(int, struct __siginfo *, void *); } __sigaction_u; /* signal handler */ int sa_flags; /* see signal options below */ sigset_t sa_mask; /* signal mask to apply */ }; #define sa_handler __sigaction_u.__sa_handler #endif # 312 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/signal.h" 3 4 #if __XSI_VISIBLE /* If SA_SIGINFO is set, sa_sigaction must be used instead of sa_handler. */ #define sa_sigaction __sigaction_u.__sa_sigaction #endif # 317 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/signal.h" 3 4 #if __POSIX_VISIBLE || __XSI_VISIBLE #define SA_NOCLDSTOP 0x0008 /* do not generate SIGCHLD on child stop */ #endif /* __POSIX_VISIBLE || __XSI_VISIBLE */ # 321 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/signal.h" 3 4 #if __XSI_VISIBLE #define SA_ONSTACK 0x0001 /* take signal on signal stack */ #define SA_RESTART 0x0002 /* restart system call on signal return */ #define SA_RESETHAND 0x0004 /* reset to SIG_DFL when taking signal */ #define SA_NODEFER 0x0010 /* don't mask the signal we're delivering */ #define SA_NOCLDWAIT 0x0020 /* don't keep zombies around */ #define SA_SIGINFO 0x0040 /* signal handler with SA_SIGINFO args */ #endif # 330 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/signal.h" 3 4 #if __BSD_VISIBLE #define NSIG 35 /* number of old signals (counting 0) */ #endif # 334 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/signal.h" 3 4 #if __POSIX_VISIBLE || __XSI_VISIBLE #define SI_NOINFO 0 /* No signal info besides si_signo. */ #define SI_USER 0x10001 /* Signal sent by kill(). */ #define SI_QUEUE 0x10002 /* Signal sent by the sigqueue(). */ #define SI_TIMER 0x10003 /* Signal generated by expiration of */ /* a timer set by timer_settime(). */ #define SI_ASYNCIO 0x10004 /* Signal generated by completion of */ /* an asynchronous I/O request.*/ #define SI_MESGQ 0x10005 /* Signal generated by arrival of a */ /* message on an empty message queue. */ #define SI_KERNEL 0x10006 #define SI_LWP 0x10007 /* Signal sent by thr_kill */ #endif # 348 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/signal.h" 3 4 #if __BSD_VISIBLE #define SI_UNDEFINED 0 #endif # 351 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/signal.h" 3 4 #if __BSD_VISIBLE typedef __sighandler_t *sig_t; /* type of pointer to a signal function */ typedef void __siginfohandler_t(int, struct __siginfo *, void *); #endif # 356 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/signal.h" 3 4 #if __XSI_VISIBLE /* * Structure used in sigaltstack call. */ #if __BSD_VISIBLE typedef struct sigaltstack { #else # 364 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/signal.h" 3 4 typedef struct { #endif # 366 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/signal.h" 3 4 void *ss_sp; /* signal stack base */ __size_t ss_size; /* signal stack length */ int ss_flags; /* SS_DISABLE and/or SS_ONSTACK */ } stack_t; #define SS_ONSTACK 0x0001 /* take signal on alternate stack */ #define SS_DISABLE 0x0004 /* disable taking signals on alternate stack */ #define MINSIGSTKSZ __MINSIGSTKSZ /* minimum stack size */ #define SIGSTKSZ (MINSIGSTKSZ + 32768) /* recommended stack size */ #endif # 376 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/signal.h" 3 4 #if __BSD_VISIBLE /* * 4.3 compatibility: * Signal vector "template" used in sigvec call. */ struct sigvec { __sighandler_t *sv_handler; /* signal handler */ int sv_mask; /* signal mask to apply */ int sv_flags; /* see signal options below */ }; #define SV_ONSTACK SA_ONSTACK #define SV_INTERRUPT SA_RESTART /* same bit, opposite sense */ #define SV_RESETHAND SA_RESETHAND #define SV_NODEFER SA_NODEFER #define SV_NOCLDSTOP SA_NOCLDSTOP #define SV_SIGINFO SA_SIGINFO #define sv_onstack sv_flags /* isn't compatibility wonderful! */ #endif # 396 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/signal.h" 3 4 /* Keep this in one place only */ #if defined(_KERNEL) && defined(COMPAT_43) && \ !defined(__i386__) struct osigcontext { int _not_used; }; #endif # 404 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/signal.h" 3 4 #if __XSI_VISIBLE /* * Structure used in sigstack call. */ struct sigstack { void *ss_sp; /* signal stack pointer */ int ss_onstack; /* current status */ }; #endif # 414 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/signal.h" 3 4 #if __BSD_VISIBLE || __POSIX_VISIBLE > 0 && __POSIX_VISIBLE <= 200112 /* * Macro for converting signal number to a mask suitable for * sigblock(). */ #define sigmask(m) (1 << ((m)-1)) #endif # 422 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/signal.h" 3 4 #if __BSD_VISIBLE #define BADSIG SIG_ERR #endif # 426 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/signal.h" 3 4 #if __POSIX_VISIBLE || __XSI_VISIBLE /* * Flags for sigprocmask: */ #define SIG_BLOCK 1 /* block specified signal set */ #define SIG_UNBLOCK 2 /* unblock specified signal set */ #define SIG_SETMASK 3 /* set specified signal set */ #endif # 435 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/signal.h" 3 4 /* * For historical reasons; programs expect signal's return value to be * defined by . */ __BEGIN_DECLS __sighandler_t *signal(int, __sighandler_t *); __END_DECLS #endif /* !_SYS_SIGNAL_H_ */ # 445 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/signal.h" 3 4 # 132 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/param.h" 2 3 4 #endif # 133 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/param.h" 3 4 /* Machine type dependent parameters. */ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 135 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/param.h" 3 4 # 1 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/param.h" 1 3 4 /* $OpenBSD: param.h,v 1.11 1998/08/30 22:05:35 millert Exp $ */ /*- * Copyright (c) 1988 University of Utah. * Copyright (c) 1992, 1993 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * the Systems Programming Group of the University of Utah Computer * Science Department and Ralph Campbell. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * from: Utah Hdr: machparam.h 1.11 89/08/14 * from: @(#)param.h 8.1 (Berkeley) 6/10/93 * JNPR: param.h,v 1.6.2.1 2007/09/10 07:49:36 girish * $FreeBSD$ */ #ifndef _MIPS_INCLUDE_PARAM_H_ #define _MIPS_INCLUDE_PARAM_H_ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 45 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/param.h" 3 4 # 1 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/_align.h" 1 3 4 /* $OpenBSD: param.h,v 1.11 1998/08/30 22:05:35 millert Exp $ */ /*- * Copyright (c) 1988 University of Utah. * Copyright (c) 1992, 1993 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * the Systems Programming Group of the University of Utah Computer * Science Department and Ralph Campbell. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * from: Utah Hdr: machparam.h 1.11 89/08/14 * from: @(#)param.h 8.1 (Berkeley) 6/10/93 * JNPR: param.h,v 1.6.2.1 2007/09/10 07:49:36 girish * $FreeBSD$ */ #ifndef _MIPS_INCLUDE__ALIGN_H_ #define _MIPS_INCLUDE__ALIGN_H_ /* * Round p (pointer or byte index) up to a correctly-aligned value for all * data types (int, long, ...). The result is u_long and must be cast to * any desired pointer type. * * XXXCHERI: Changed '7' to 'sizeof(void *) - 1', but likely we also need * to change (u_long) below to (uintptr_t)? */ #define _ALIGNBYTES (sizeof(void *) - 1) #define _ALIGN(p) (((uintptr_t)(p) + _ALIGNBYTES) &~ (uintptr_t)_ALIGNBYTES) #endif /* !_MIPS_INCLUDE__ALIGN_H_ */ # 57 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/_align.h" 3 4 # 46 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/param.h" 2 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 47 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/param.h" 3 4 # 48 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/param.h" 3 4 #ifdef _KERNEL #ifndef _LOCORE #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 50 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/param.h" 3 4 # 51 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/param.h" 3 4 #endif # 52 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/param.h" 3 4 #endif # 53 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/param.h" 3 4 #define __PCI_REROUTE_INTERRUPT #ifndef MACHINE #define MACHINE "mips" #endif # 59 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/param.h" 3 4 #ifndef MACHINE_ARCH #if _BYTE_ORDER == _BIG_ENDIAN #ifdef __mips_n64 #define MACHINE_ARCH "mips64" #ifndef MACHINE_ARCH32 #define MACHINE_ARCH32 "mips" #endif # 66 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/param.h" 3 4 #elif defined(__mips_n32) # 67 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/param.h" 3 4 #define MACHINE_ARCH "mipsn32" #else # 69 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/param.h" 3 4 #define MACHINE_ARCH "mips" #endif # 71 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/param.h" 3 4 #else # 72 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/param.h" 3 4 #ifdef __mips_n64 #define MACHINE_ARCH "mips64el" #ifndef MACHINE_ARCH32 #define MACHINE_ARCH32 "mipsel" #endif # 77 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/param.h" 3 4 #elif defined(__mips_n32) # 78 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/param.h" 3 4 #define MACHINE_ARCH "mipsn32el" #else # 80 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/param.h" 3 4 #define MACHINE_ARCH "mipsel" #endif # 82 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/param.h" 3 4 #endif # 83 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/param.h" 3 4 #endif # 84 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/param.h" 3 4 /* * OBJFORMAT_NAMES is a comma-separated list of the object formats * that are supported on the architecture. */ #define OBJFORMAT_NAMES "elf" #define OBJFORMAT_DEFAULT "elf" #define MID_MACHINE 0 /* None but has to be defined */ #ifdef SMP #define MAXSMPCPU 32 #ifndef MAXCPU #define MAXCPU MAXSMPCPU #endif # 99 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/param.h" 3 4 #else # 100 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/param.h" 3 4 #define MAXSMPCPU 1 #define MAXCPU 1 #endif # 103 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/param.h" 3 4 #ifndef MAXMEMDOM #define MAXMEMDOM 1 #endif # 107 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/param.h" 3 4 /* * Round p (pointer or byte index) up to a correctly-aligned value for all * data types (int, long, ...). The result is u_int and must be cast to * any desired pointer type. */ #define ALIGNBYTES _ALIGNBYTES #define ALIGN(p) _ALIGN(p) /* * ALIGNED_POINTER is a boolean macro that checks whether an address * is valid to fetch data elements of type t from on this architecture. * This does not reflect the optimal alignment, just the possibility * (within reasonable limits). */ #define ALIGNED_POINTER(p, t) ((((unsigned long)(p)) & (sizeof (t) - 1)) == 0) /* * CACHE_LINE_SIZE is the compile-time maximum cache line size for an * architecture. It should be used with appropriate caution. */ #define CACHE_LINE_SHIFT 6 #define CACHE_LINE_SIZE (1 << CACHE_LINE_SHIFT) #define PAGE_SHIFT 12 /* LOG2(PAGE_SIZE) */ #define PAGE_SIZE (1<> (TLBMASK_SHIFT - 1)) \ << TLBMASK_SHIFT) #define KSTACK_GUARD_PAGES ((KSTACK_PAGE_SIZE * 2) / PAGE_SIZE) #else /* ! KSTACK_LARGE_PAGE */ # 180 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/param.h" 3 4 /* * The kernel stack needs to be aligned on a (PAGE_SIZE * 2) boundary. */ #define KSTACK_PAGES 2 /* kernel stack */ #define KSTACK_SIZE (KSTACK_PAGES * PAGE_SIZE) #define KSTACK_PAGE_SIZE PAGE_SIZE #define KSTACK_PAGE_MASK (PAGE_SIZE - 1) #define KSTACK_GUARD_PAGES 2 /* pages of kstack guard; 0 disables */ #endif /* ! KSTACK_LARGE_PAGE */ # 190 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/param.h" 3 4 /* * Mach derived conversion macros */ #define round_page(x) (((x) + PAGE_MASK) & ~PAGE_MASK) #define trunc_page(x) ((x) & ~PAGE_MASK) #define round_2mpage(x) (((x) + PDRMASK) & ~PDRMASK) #define trunc_2mpage(x) ((x) & ~PDRMASK) #define atop(x) ((x) >> PAGE_SHIFT) #define ptoa(x) ((x) << PAGE_SHIFT) #define pgtok(x) ((x) * (PAGE_SIZE / 1024)) #ifdef _KERNEL #define NO_FUEWORD 1 #endif # 207 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/param.h" 3 4 #endif /* !_MIPS_INCLUDE_PARAM_H_ */ # 209 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/param.h" 3 4 # 136 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/param.h" 2 3 4 #ifndef _KERNEL #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 137 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/param.h" 3 4 # 1 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/limits.h" 1 3 4 /*- * Copyright (c) 1988, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * $FreeBSD$ */ #ifndef _SYS_LIMITS_H_ #define _SYS_LIMITS_H_ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 35 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/limits.h" 3 4 # 36 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/limits.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 36 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/limits.h" 3 4 # 37 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/limits.h" 3 4 #define CHAR_BIT __CHAR_BIT /* number of bits in a char */ #define SCHAR_MAX __SCHAR_MAX /* max value for a signed char */ #define SCHAR_MIN __SCHAR_MIN /* min value for a signed char */ #define UCHAR_MAX __UCHAR_MAX /* max value for an unsigned char */ #ifdef __CHAR_UNSIGNED__ #define CHAR_MAX UCHAR_MAX /* max value for a char */ #define CHAR_MIN 0 /* min value for a char */ #else # 49 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/limits.h" 3 4 #define CHAR_MAX SCHAR_MAX #define CHAR_MIN SCHAR_MIN #endif # 52 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/limits.h" 3 4 #define USHRT_MAX __USHRT_MAX /* max value for an unsigned short */ #define SHRT_MAX __SHRT_MAX /* max value for a short */ #define SHRT_MIN __SHRT_MIN /* min value for a short */ #define UINT_MAX __UINT_MAX /* max value for an unsigned int */ #define INT_MAX __INT_MAX /* max value for an int */ #define INT_MIN __INT_MIN /* min value for an int */ #define ULONG_MAX __ULONG_MAX /* max for an unsigned long */ #define LONG_MAX __LONG_MAX /* max for a long */ #define LONG_MIN __LONG_MIN /* min for a long */ #ifdef __LONG_LONG_SUPPORTED #define ULLONG_MAX __ULLONG_MAX /* max for an unsigned long long */ #define LLONG_MAX __LLONG_MAX /* max for a long long */ #define LLONG_MIN __LLONG_MIN /* min for a long long */ #endif # 70 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/limits.h" 3 4 #if __POSIX_VISIBLE || __XSI_VISIBLE #define SSIZE_MAX __SSIZE_MAX /* max value for an ssize_t */ #endif # 74 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/limits.h" 3 4 #if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE #define SIZE_T_MAX __SIZE_T_MAX /* max value for a size_t */ #define OFF_MAX __OFF_MAX /* max value for an off_t */ #define OFF_MIN __OFF_MIN /* min value for an off_t */ #endif # 81 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/limits.h" 3 4 #if __BSD_VISIBLE #define GID_MAX UINT_MAX /* max value for a gid_t */ #define UID_MAX UINT_MAX /* max value for a uid_t */ #define UQUAD_MAX (__UQUAD_MAX) /* max value for a uquad_t */ #define QUAD_MAX (__QUAD_MAX) /* max value for a quad_t */ #define QUAD_MIN (__QUAD_MIN) /* min value for a quad_t */ #endif # 90 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/limits.h" 3 4 #if __XSI_VISIBLE || __POSIX_VISIBLE >= 200809 #define LONG_BIT __LONG_BIT #define WORD_BIT __WORD_BIT #endif # 95 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/limits.h" 3 4 #if __POSIX_VISIBLE #define MQ_PRIO_MAX 64 #endif # 99 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/limits.h" 3 4 #endif /* !_SYS_LIMITS_H_ */ # 101 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/limits.h" 3 4 # 138 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/param.h" 2 3 4 #endif # 139 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/param.h" 3 4 #ifndef DEV_BSHIFT #define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */ #endif # 143 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/param.h" 3 4 #define DEV_BSIZE (1<>PAGE_SHIFT) #endif # 196 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/param.h" 3 4 /* * btodb() is messy and perhaps slow because `bytes' may be an off_t. We * want to shift an unsigned type to avoid sign extension and we don't * want to widen `bytes' unnecessarily. Assume that the result fits in * a daddr_t. */ #ifndef btodb #define btodb(bytes) /* calculates (bytes / DEV_BSIZE) */ \ (sizeof (bytes) > sizeof(long) \ ? (daddr_t)((unsigned long long)(bytes) >> DEV_BSHIFT) \ : (daddr_t)((unsigned long)(bytes) >> DEV_BSHIFT)) #endif # 209 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/param.h" 3 4 #ifndef dbtob #define dbtob(db) /* calculates (db * DEV_BSIZE) */ \ ((off_t)(db) << DEV_BSHIFT) #endif # 214 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/param.h" 3 4 #define PRIMASK 0x0ff #define PCATCH 0x100 /* OR'd with pri for tsleep to check signals */ #define PDROP 0x200 /* OR'd with pri to stop re-entry of interlock mutex */ #define NZERO 0 /* default "nice" */ #define NBBY 8 /* number of bits in a byte */ #define NBPW sizeof(int) /* number of bytes per word (integer) */ #define CMASK 022 /* default file mask: S_IWGRP|S_IWOTH */ #define NODEV (dev_t)(-1) /* non-existent device */ /* * File system parameters and macros. * * MAXBSIZE - Filesystems are made out of blocks of at most MAXBSIZE bytes * per block. MAXBSIZE may be made larger without effecting * any existing filesystems as long as it does not exceed MAXPHYS, * and may be made smaller at the risk of not being able to use * filesystems which require a block size exceeding MAXBSIZE. * * MAXBCACHEBUF - Maximum size of a buffer in the buffer cache. This must * be >= MAXBSIZE and can be set differently for different * architectures by defining it in . * Making this larger allows NFS to do larger reads/writes. * * BKVASIZE - Nominal buffer space per buffer, in bytes. BKVASIZE is the * minimum KVM memory reservation the kernel is willing to make. * Filesystems can of course request smaller chunks. Actual * backing memory uses a chunk size of a page (PAGE_SIZE). * The default value here can be overridden on a per-architecture * basis by defining it in . This should * probably be done to increase its value, when MAXBCACHEBUF is * defined as a larger value in . * * If you make BKVASIZE too small you risk seriously fragmenting * the buffer KVM map which may slow things down a bit. If you * make it too big the kernel will not be able to optimally use * the KVM memory reserved for the buffer cache and will wind * up with too-few buffers. * * The default is 16384, roughly 2x the block size used by a * normal UFS filesystem. */ #define MAXBSIZE 65536 /* must be power of 2 */ #ifndef MAXBCACHEBUF #define MAXBCACHEBUF MAXBSIZE /* must be a power of 2 >= MAXBSIZE */ #endif # 264 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/param.h" 3 4 #ifndef BKVASIZE #define BKVASIZE 16384 /* must be power of 2 */ #endif # 267 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/param.h" 3 4 #define BKVAMASK (BKVASIZE-1) /* * MAXPATHLEN defines the longest permissible path length after expanding * symbolic links. It is used to allocate a temporary buffer from the buffer * pool in which to do the name expansion, hence should be a power of two, * and must be less than or equal to MAXBSIZE. MAXSYMLINKS defines the * maximum number of symbolic links that may be expanded in a path name. * It should be set high enough to allow all legitimate uses, but halt * infinite loops reasonably quickly. */ #define MAXPATHLEN PATH_MAX #define MAXSYMLINKS 32 /* Bit map related macros. */ #define setbit(a,i) (((unsigned char *)(a))[(i)/NBBY] |= 1<<((i)%NBBY)) #define clrbit(a,i) (((unsigned char *)(a))[(i)/NBBY] &= ~(1<<((i)%NBBY))) #define isset(a,i) \ (((const unsigned char *)(a))[(i)/NBBY] & (1<<((i)%NBBY))) #define isclr(a,i) \ ((((const unsigned char *)(a))[(i)/NBBY] & (1<<((i)%NBBY))) == 0) /* Macros for counting and rounding. */ #ifndef howmany #define howmany(x, y) (((x)+((y)-1))/(y)) #endif # 293 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/param.h" 3 4 #define nitems(x) (sizeof((x)) / sizeof((x)[0])) #define rounddown(x, y) (((x)/(y))*(y)) #define rounddown2(x, y) ((x)&(~((y)-1))) /* if y is power of two */ #define roundup(x, y) ((((x)+((y)-1))/(y))*(y)) /* to any y */ #define roundup2(x, y) (((x)+((y)-1))&(~((y)-1))) /* if y is powers of two */ #define powerof2(x) ((((x)-1)&(x))==0) /* Macros for min/max. */ #define MIN(a,b) (((a)<(b))?(a):(b)) #define MAX(a,b) (((a)>(b))?(a):(b)) #ifdef _KERNEL /* * Basic byte order function prototypes for non-inline functions. */ #ifndef LOCORE #ifndef _BYTEORDER_PROTOTYPED #define _BYTEORDER_PROTOTYPED __BEGIN_DECLS __uint32_t htonl(__uint32_t); __uint16_t htons(__uint16_t); __uint32_t ntohl(__uint32_t); __uint16_t ntohs(__uint16_t); __END_DECLS #endif # 318 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/param.h" 3 4 #endif # 319 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/param.h" 3 4 #ifndef lint #ifndef _BYTEORDER_FUNC_DEFINED #define _BYTEORDER_FUNC_DEFINED #define htonl(x) __htonl(x) #define htons(x) __htons(x) #define ntohl(x) __ntohl(x) #define ntohs(x) __ntohs(x) #endif /* !_BYTEORDER_FUNC_DEFINED */ # 328 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/param.h" 3 4 #endif /* lint */ # 329 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/param.h" 3 4 #endif /* _KERNEL */ # 330 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/param.h" 3 4 /* * Scale factor for scaled integers used to count %cpu time and load avgs. * * The number of CPU `tick's that map to a unique `%age' can be expressed * by the formula (1 / (2 ^ (FSHIFT - 11))). The maximum load average that * can be calculated (assuming 32 bits) can be closely approximated using * the formula (2 ^ (2 * (16 - FSHIFT))) for (FSHIFT < 15). * * For the scheduler to maintain a 1:1 mapping of CPU `tick' to `%age', * FSHIFT must be at least 11; this gives us a maximum load avg of ~1024. */ #define FSHIFT 11 /* bits to right of fixed binary point */ #define FSCALE (1<> (PAGE_SHIFT - DEV_BSHIFT)) #define ctodb(db) /* calculates pages to devblks */ \ ((db) << (PAGE_SHIFT - DEV_BSHIFT)) /* * Old spelling of __containerof(). */ #define member2struct(s, m, x) \ ((struct s *)(void *)((char *)(x) - offsetof(struct s, m))) /* * Access a variable length array that has been declared as a fixed * length array. */ #define __PAST_END(array, offset) (((__typeof__(*(array)) *)(array))[offset]) #endif /* _SYS_PARAM_H_ */ # 364 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/sys/param.h" 3 4 # 48 "/home/sson/src/cheribsd/lib/libc_cheri/../libmalloc_simple/malloc.c" 2 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 48 "/home/sson/src/cheribsd/lib/libc_cheri/../libmalloc_simple/malloc.c" # 49 "/home/sson/src/cheribsd/lib/libc_cheri/../libmalloc_simple/malloc.c" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 50 "/home/sson/src/cheribsd/lib/libc_cheri/../libmalloc_simple/malloc.c" # 1 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/cheri.h" 1 3 4 /*- * Copyright (c) 2011-2016 Robert N. M. Watson * Copyright (c) 2015 SRI International * All rights reserved. * * This software was developed by SRI International and the University of * Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237) * ("CTSRD"), as part of the DARPA CRASH research programme. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #ifndef _MIPS_INCLUDE_CHERI_H_ #define _MIPS_INCLUDE_CHERI_H_ #ifdef _KERNEL #if 0 /* expanded by -frewrite-includes */ #include /* SYSCTL_DECL() */ #endif /* expanded by -frewrite-includes */ # 36 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/cheri.h" 3 4 # 37 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/cheri.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include /* CTASSERT() */ #endif /* expanded by -frewrite-includes */ # 37 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/cheri.h" 3 4 # 38 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/cheri.h" 3 4 #endif # 39 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/cheri.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 40 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/cheri.h" 3 4 # 1 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/cherireg.h" 1 3 4 /*- * Copyright (c) 2011-2016 Robert N. M. Watson * All rights reserved. * * This software was developed by SRI International and the University of * Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237) * ("CTSRD"), as part of the DARPA CRASH research programme. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #ifndef _MIPS_INCLUDE_CHERIREG_H_ #define _MIPS_INCLUDE_CHERIREG_H_ /* * The size of in-memory capabilities in bytes; minimum alignment is also * assumed to be this size. */ #if defined(_MIPS_SZCAP) && (_MIPS_SZCAP != 128) && (_MIPS_SZCAP != 256) #error "_MIPS_SZCAP defined but neither 128 nor 256" #endif # 41 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/cherireg.h" 3 4 #if defined(CPU_CHERI128) || (defined(_MIPS_SZCAP) && (_MIPS_SZCAP == 128)) #define CHERICAP_SIZE 16 #else # 45 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/cherireg.h" 3 4 #define CHERICAP_SIZE 32 #endif # 47 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/cherireg.h" 3 4 /* * CHERI ISA-defined constants for capabilities -- suitable for inclusion from * assembly source code. * * XXXRW: CHERI_UNSEALED is not currently considered part of the perms word, * but perhaps it should be. */ #define CHERI_PERM_GLOBAL (1 << 0) /* 0x00000001 */ #define CHERI_PERM_EXECUTE (1 << 1) /* 0x00000002 */ #define CHERI_PERM_LOAD (1 << 2) /* 0x00000004 */ #define CHERI_PERM_STORE (1 << 3) /* 0x00000008 */ #define CHERI_PERM_LOAD_CAP (1 << 4) /* 0x00000010 */ #define CHERI_PERM_STORE_CAP (1 << 5) /* 0x00000020 */ #define CHERI_PERM_STORE_LOCAL_CAP (1 << 6) /* 0x00000040 */ #define CHERI_PERM_SEAL (1 << 7) /* 0x00000080 */ #define CHERI_PERM_RESERVED0 (1 << 8) /* 0x00000100 */ #define CHERI_PERM_RESERVED1 (1 << 9) /* 0x00000200 */ /* * 256-bit CHERI has multiple exception-handling permissions, whereas 128-bit * CHERI has a single exception-handling permission. * * XXXRW: It would be nice to reconcile these lists in the future, as it's not * clear we need this level of granularity on 256-bit CHERI. */ #define CHERI256_PERM_ACCESS_EPCC (1 << 10) /* 0x00000400 */ #define CHERI256_PERM_ACCESS_KDC (1 << 11) /* 0x00000800 */ #define CHERI256_PERM_ACCESS_KCC (1 << 12) /* 0x00001000 */ #define CHERI256_PERM_ACCESS_KR1C (1 << 13) /* 0x00002000 */ #define CHERI256_PERM_ACCESS_KR2C (1 << 14) /* 0x00004000 */ #define CHERI128_PERM_ACCESS_SYSTEM_REGISTERS (1 << 10) /* 0x00000400 */ /* * User-defined permission bits. * * 256-bit CHERI has a substantially larger number of user-defined * permissions. */ #define CHERI256_PERM_USER0 (1 << 15) /* 0x00008000 */ #define CHERI256_PERM_USER1 (1 << 16) /* 0x00010000 */ #define CHERI256_PERM_USER2 (1 << 17) /* 0x00020000 */ #define CHERI256_PERM_USER3 (1 << 18) /* 0x00040000 */ #define CHERI256_PERM_USER4 (1 << 19) /* 0x00080000 */ #define CHERI256_PERM_USER5 (1 << 20) /* 0x00100000 */ #define CHERI256_PERM_USER6 (1 << 21) /* 0x00200000 */ #define CHERI256_PERM_USER7 (1 << 22) /* 0x00400000 */ #define CHERI256_PERM_USER8 (1 << 23) /* 0x00800000 */ #define CHERI256_PERM_USER9 (1 << 24) /* 0x01000000 */ #define CHERI256_PERM_USER10 (1 << 25) /* 0x02000000 */ #define CHERI256_PERM_USER11 (1 << 26) /* 0x04000000 */ #define CHERI256_PERM_USER12 (1 << 27) /* 0x08000000 */ #define CHERI256_PERM_USER13 (1 << 28) /* 0x10000000 */ #define CHERI256_PERM_USER14 (1 << 29) /* 0x20000000 */ #define CHERI256_PERM_USER15 (1 << 30) /* 0x40000000 */ #define CHERI128_PERM_USER0 (1 << 15) /* 0x00008000 */ #define CHERI128_PERM_USER1 (1 << 16) /* 0x00010000 */ #define CHERI128_PERM_USER2 (1 << 17) /* 0x00020000 */ #define CHERI128_PERM_USER3 (1 << 18) /* 0x00040000 */ #if (CHERICAP_SIZE == 32) #define CHERI_PERM_USER0 CHERI256_PERM_USER0 #define CHERI_PERM_USER1 CHERI256_PERM_USER1 #define CHERI_PERM_USER2 CHERI256_PERM_USER2 #define CHERI_PERM_USER3 CHERI256_PERM_USER3 #define CHERI_PERM_USER4 CHERI256_PERM_USER4 #define CHERI_PERM_USER5 CHERI256_PERM_USER5 #define CHERI_PERM_USER6 CHERI256_PERM_USER6 #define CHERI_PERM_USER7 CHERI256_PERM_USER7 #define CHERI_PERM_USER8 CHERI256_PERM_USER8 #define CHERI_PERM_USER9 CHERI256_PERM_USER9 #define CHERI_PERM_USER10 CHERI256_PERM_USER10 #define CHERI_PERM_USER11 CHERI256_PERM_USER11 #define CHERI_PERM_USER12 CHERI256_PERM_USER12 #define CHERI_PERM_USER13 CHERI256_PERM_USER13 #define CHERI_PERM_USER14 CHERI256_PERM_USER14 #define CHERI_PERM_USER15 CHERI256_PERM_USER15 #else /* (!(CHERICAP_SIZE == 32)) */ # 127 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/cherireg.h" 3 4 #define CHERI_PERM_USER0 CHERI128_PERM_USER0 #define CHERI_PERM_USER1 CHERI128_PERM_USER1 #define CHERI_PERM_USER2 CHERI128_PERM_USER2 #define CHERI_PERM_USER3 CHERI128_PERM_USER3 #endif /* (!(CHERICAP_SIZE == 32)) */ # 132 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/cherireg.h" 3 4 /* * The kernel snags one for the user-defined permissions for the purposes of * authorising system calls from $pcc. This is a bit of an oddity: normally, * we check permissions on data capabilities, not code capabilities, but * aligns with 'privilege' checks: e.g., $epcc access. We may wish to switch * to another model, such as having userspace register one or more class * capabilities as suitable for privilege. */ #define CHERI_PERM_SYSCALL CHERI_PERM_USER0 /* * Macros defining initial permission sets for various scenarios; details * depend on the permissions available on 256-bit or 128-bit CHERI: * * CHERI_PERM_USER_PRIVS: Mask of all available user-defined permissions * CHERI_PERM_PRIV: Mask of all available hardware-defined permissions */ #if (CHERICAP_SIZE == 32) #define CHERI_PERM_USER_PRIVS \ (CHERI_PERM_USER0 | CHERI_PERM_USER1 | CHERI_PERM_USER2 | \ CHERI_PERM_USER3 | CHERI_PERM_USER4 | CHERI_PERM_USER5 | \ CHERI_PERM_USER6 | CHERI_PERM_USER7 | CHERI_PERM_USER8 | \ CHERI_PERM_USER9 | CHERI_PERM_USER10 | CHERI_PERM_USER11 | \ CHERI_PERM_USER12 | CHERI_PERM_USER13 | CHERI_PERM_USER14 | \ CHERI_PERM_USER15) #define CHERI_PERM_PRIV \ (CHERI_PERM_GLOBAL | CHERI_PERM_EXECUTE | \ CHERI_PERM_LOAD | CHERI_PERM_STORE | CHERI_PERM_LOAD_CAP | \ CHERI_PERM_STORE_CAP | CHERI_PERM_STORE_LOCAL_CAP | \ CHERI_PERM_SEAL | CHERI_PERM_RESERVED0 | CHERI_PERM_RESERVED1 | \ CHERI_PERM_ACCESS_EPCC | CHERI_PERM_ACCESS_KDC | \ CHERI_PERM_ACCESS_KCC | CHERI_PERM_ACCESS_KR1C | \ CHERI_PERM_ACCESS_KR2C | CHERI_PERM_USER_PRIVS) #else /* (!(CHERICAP_SIZE == 32)) */ # 168 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/cherireg.h" 3 4 #define CHERI_PERM_USER_PRIVS \ (CHERI_PERM_USER0 | CHERI_PERM_USER1 | CHERI_PERM_USER2 | \ CHERI_PERM_USER3) #define CHERI_PERM_PRIV \ (CHERI_PERM_GLOBAL | CHERI_PERM_EXECUTE | \ CHERI_PERM_LOAD | CHERI_PERM_STORE | CHERI_PERM_LOAD_CAP | \ CHERI_PERM_STORE_CAP | CHERI_PERM_STORE_LOCAL_CAP | \ CHERI_PERM_SEAL | CHERI_PERM_RESERVED0 | CHERI_PERM_RESERVED1) #endif /* (!(CHERICAP_SIZE == 32)) */ # 178 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/cherireg.h" 3 4 /* * Basic userspace permission mask; CHERI_PERM_EXECUTE will be added for * executable capabilities ($pcc); CHERI_PERM_STORE, CHERI_PERM_STORE_CAP, * and CHERI_PERM_STORE_LOCAL_CAP will be added for data permissions ($c0). * * No variation required between 256-bit and 128-bit CHERI. */ #define CHERI_PERM_USER \ (CHERI_PERM_GLOBAL | CHERI_PERM_LOAD | CHERI_PERM_LOAD_CAP | \ CHERI_PERM_USER_PRIVS) #define CHERI_PERM_USER_CODE (CHERI_PERM_USER | CHERI_PERM_EXECUTE) #define CHERI_PERM_USER_DATA (CHERI_PERM_USER | CHERI_PERM_STORE | \ CHERI_PERM_STORE_CAP | \ CHERI_PERM_STORE_LOCAL_CAP) /* * Root "object-type" capability -- queried via sysarch(2) when libcheri needs * to allocate types. This can be used neither as a data nor code capability. * * No variation required between 256-bit and 128-bit CHERI. */ #define CHERI_PERM_USER_TYPE (CHERI_PERM_GLOBAL | CHERI_PERM_SEAL) /* * Definition for kernel "privileged" capability able to name the entire * address space. * * No variation required between 256-bit and 128-bit CHERI. */ #define CHERI_CAP_PRIV_PERMS CHERI_PERM_PRIV #define CHERI_CAP_PRIV_OTYPE 0x0 #define CHERI_CAP_PRIV_BASE 0x0 #define CHERI_CAP_PRIV_LENGTH 0xffffffffffffffff #define CHERI_CAP_PRIV_OFFSET 0x0 /* * Definition for userspace "unprivileged" capability able to name the user * portion of the address space. * * No variation required between 256-bit and 128-bit CHERI. */ #define CHERI_CAP_USER_CODE_PERMS CHERI_PERM_USER_CODE #define CHERI_CAP_USER_CODE_OTYPE 0x0 #define CHERI_CAP_USER_CODE_BASE MIPS_XUSEG_START #define CHERI_CAP_USER_CODE_LENGTH (MIPS_XUSEG_END - MIPS_XUSEG_START) #define CHERI_CAP_USER_CODE_OFFSET 0x0 #define CHERI_CAP_USER_DATA_PERMS CHERI_PERM_USER_DATA #define CHERI_CAP_USER_DATA_OTYPE 0x0 #define CHERI_CAP_USER_DATA_BASE MIPS_XUSEG_START #define CHERI_CAP_USER_DATA_LENGTH (MIPS_XUSEG_END - MIPS_XUSEG_START) #define CHERI_CAP_USER_DATA_OFFSET 0x0 #define CHERI_CAP_USER_TYPE_PERMS CHERI_PERM_USER_TYPE #define CHERI_CAP_USER_TYPE_OTYPE 0x0 #define CHERI_CAP_USER_TYPE_BASE MIPS_XUSEG_START #define CHERI_CAP_USER_TYPE_LENGTH (MIPS_XUSEG_END - MIPS_XUSEG_START) #define CHERI_CAP_USER_TYPE_OFFSET 0x0 /* * A blend of hardware and software allocation of capability registers. * Ideally, this list wouldn't exist here, but be purely in the assembler. */ #define CHERI_CR_C0 0 /* MIPS fetch/load/store capability. */ #define CHERI_CR_C1 1 #define CHERI_CR_C2 2 #define CHERI_CR_C3 3 #define CHERI_CR_C4 4 #define CHERI_CR_C5 5 #define CHERI_CR_C6 6 #define CHERI_CR_C7 7 #define CHERI_CR_C8 8 #define CHERI_CR_C9 9 #define CHERI_CR_C10 10 #define CHERI_CR_C11 11 #define CHERI_CR_C12 12 #define CHERI_CR_C13 13 #define CHERI_CR_C14 14 #define CHERI_CR_C15 15 #define CHERI_CR_C16 16 #define CHERI_CR_C17 17 #define CHERI_CR_C18 18 #define CHERI_CR_C19 19 #define CHERI_CR_C20 20 #define CHERI_CR_C21 21 #define CHERI_CR_C22 22 #define CHERI_CR_C23 23 #define CHERI_CR_C24 24 #define CHERI_CR_C25 25 #define CHERI_CR_IDC 26 #define CHERI_CR_KR1C 27 #define CHERI_CR_KR2C 28 #define CHERI_CR_KCC 29 #define CHERI_CR_KDC 30 #define CHERI_CR_EPCC 31 #define CHERI_CR_CTEMP0 CHERI_CR_C11 /* C capability manipulation. */ #define CHERI_CR_CTEMP1 CHERI_CR_C12 /* C capability manipulation. */ #define CHERI_CR_SEC0 CHERI_CR_KR2C /* Saved $c0 in exception handler. */ /* * Offsets of registers in struct cheri_frame when treated as an array of * capabilities -- must match the definition in cheri.h. */ #define CHERIFRAME_OFF_C0 0 #define CHERIFRAME_OFF_C1 1 #define CHERIFRAME_OFF_C2 2 #define CHERIFRAME_OFF_C3 3 #define CHERIFRAME_OFF_C4 4 #define CHERIFRAME_OFF_C5 5 #define CHERIFRAME_OFF_C6 6 #define CHERIFRAME_OFF_C7 7 #define CHERIFRAME_OFF_C8 8 #define CHERIFRAME_OFF_C9 9 #define CHERIFRAME_OFF_C10 10 #define CHERIFRAME_OFF_C11 11 #define CHERIFRAME_OFF_C12 12 #define CHERIFRAME_OFF_C13 13 #define CHERIFRAME_OFF_C14 14 #define CHERIFRAME_OFF_C15 15 #define CHERIFRAME_OFF_C16 16 #define CHERIFRAME_OFF_C17 17 #define CHERIFRAME_OFF_C18 18 #define CHERIFRAME_OFF_C19 19 #define CHERIFRAME_OFF_C20 20 #define CHERIFRAME_OFF_C21 21 #define CHERIFRAME_OFF_C22 22 #define CHERIFRAME_OFF_C23 23 #define CHERIFRAME_OFF_C24 24 #define CHERIFRAME_OFF_C25 25 #define CHERIFRAME_OFF_IDC 26 #define CHERIFRAME_OFF_PCC 27 /* NB: Not register $c27! */ /* * Offset of the capability cause register in struct cheri_kframe -- must * match the definition in cheri.h. Note that although this constant is sized * based on capabilities, in fact the cause register is 64-bit. We may want * to revisit this if we add more 64-bit values. */ #define CHERIFRAME_OFF_CAPCAUSE 28 /* * Offsets of registers in struct cheri_kframe -- must match the definition in * cheri.h. */ #define CHERIKFRAME_OFF_C17 0 #define CHERIKFRAME_OFF_C18 1 #define CHERIKFRAME_OFF_C19 2 #define CHERIKFRAME_OFF_C20 3 #define CHERIKFRAME_OFF_C21 4 #define CHERIKFRAME_OFF_C22 5 #define CHERIKFRAME_OFF_C23 6 #define CHERIKFRAME_OFF_C24 7 /* * List of CHERI capability cause code constants, which are used to * disambiguate various CP2 exceptions. * * XXXRW: I wonder if we really need different permissions for each exception- * handling capability. * * XXXRW: Curiously non-contiguous. * * XXXRW: KDC is listed as 0x1a in the spec, which collides with EPCC. Not * sure what is actually used. */ #define CHERI_EXCCODE_NONE 0x00 #define CHERI_EXCCODE_LENGTH 0x01 #define CHERI_EXCCODE_TAG 0x02 #define CHERI_EXCCODE_SEAL 0x03 #define CHERI_EXCCODE_TYPE 0x04 #define CHERI_EXCCODE_CALL 0x05 #define CHERI_EXCCODE_RETURN 0x06 #define CHERI_EXCCODE_UNDERFLOW 0x07 #define CHERI_EXCCODE_USER_PERM 0x08 #define CHERI_EXCCODE_TLBSTORE 0x09 #define CHERI_EXCCODE_IMPRECISE 0x0a #define _CHERI_EXCCODE_RESERVED0b 0x0b #define _CHERI_EXCCODE_RESERVED0c 0x0c #define _CHERI_EXCCODE_RESERVED0d 0x0d #define _CHERI_EXCCODE_RESERVED0e 0x0e #define _CHERI_EXCCODE_RESERVED0f 0x0f #define CHERI_EXCCODE_GLOBAL 0x10 #define CHERI_EXCCODE_PERM_EXECUTE 0x11 #define CHERI_EXCCODE_PERM_LOAD 0x12 #define CHERI_EXCCODE_PERM_STORE 0x13 #define CHERI_EXCCODE_PERM_LOADCAP 0x14 #define CHERI_EXCCODE_PERM_STORECAP 0x15 #define CHERI_EXCCODE_STORE_LOCALCAP 0x16 #define CHERI_EXCCODE_PERM_SEAL 0x17 #define _CHERI_EXCCODE_RESERVED18 0x18 #define _CHERI_EXCCODE_RESERVED19 0x19 #define CHERI_EXCCODE_ACCESS_EPCC 0x1a #define CHERI_EXCCODE_ACCESS_KDC 0x1b /* XXXRW */ #define CHERI_EXCCODE_ACCESS_KCC 0x1c #define CHERI_EXCCODE_ACCESS_KR1C 0x1d #define CHERI_EXCCODE_ACCESS_KR2C 0x1e #define _CHERI_EXCCODE_RESERVED1f 0x1f /* * User-defined CHERI exception codes are numbered 128...255. */ #define CHERI_EXCCODE_SW_BASE 0x80 #define CHERI_EXCCODE_SW_LOCALARG 0x80 /* Non-global CCall argument. */ #define CHERI_EXCCODE_SW_LOCALRET 0x81 /* Non-global CReturn value. */ #define CHERI_EXCCODE_SW_CCALLREGS 0x82 /* Incorrect CCall registers. */ /* * How to turn the cause register into an exception code and register number. */ #define CHERI_CAPCAUSE_EXCCODE_MASK 0xff00 #define CHERI_CAPCAUSE_EXCCODE_SHIFT 8 #define CHERI_CAPCAUSE_REGNUM_MASK 0xff /* * Location of the CHERI CCall/CReturn software-path exception vector. */ #define CHERI_CCALL_EXC_VEC ((intptr_t)(int32_t)0x80000280) #if CHERICAP_SIZE == 32 #define CHERI_ALIGN_SHIFT(l) 0ULL #define CHERI_SEAL_ALIGN_SHIFT(l) 0ULL #else /* (!(CHERICAP_SIZE == 32)) */ # 403 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/cherireg.h" 3 4 #define CHERI_BASELEN_BITS 20 #define CHERI_SEAL_BASELEN_BITS 5 #define CHERI_SLOP_BITS 2 #define CHERI_ADDR_BITS 64 #define CHERI_ALIGN_SHIFT(l) \ ((flsll(l) <= (CHERI_BASELEN_BITS - CHERI_SLOP_BITS)) ? 0ULL : \ (flsll(l) - (CHERI_BASELEN_BITS - CHERI_SLOP_BITS))) #define CHERI_SEAL_ALIGN_SHIFT(l) \ ((flsll(l) <= (CHERI_SEAL_BASELEN_BITS)) ? 0ULL : \ (flsll(l) - (CHERI_SEAL_BASELEN_BITS))) #endif /* (!(CHERICAP_SIZE == 32)) */ # 416 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/cherireg.h" 3 4 #define CHERI_ALIGN_MASK(l) ~(~0ULL << CHERI_ALIGN_SHIFT(l)) #define CHERI_SEAL_ALIGN_MASK(l) ~(~0ULL << CHERI_SEAL_ALIGN_SHIFT(l)) #endif /* _MIPS_INCLUDE_CHERIREG_H_ */ # 421 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/cherireg.h" 3 4 # 41 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/cheri.h" 2 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 41 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/cheri.h" 3 4 # 42 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/cheri.h" 3 4 /* * Canonical C-language representation of a capability for compilers that * don't support capabilities directly. The in-memory layout is sensitive to * the microarchitecture, and hence treated as opaque. Fields must be * accessed via the ISA. */ struct chericap { uint8_t c_data[CHERICAP_SIZE]; } __packed __aligned(CHERICAP_SIZE); #ifdef _KERNEL CTASSERT(sizeof(struct chericap) == CHERICAP_SIZE); #endif # 55 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/cheri.h" 3 4 /* * Canonical C-language representation of a CHERI object capability -- code * and data capabilities in registers or memory. */ struct cheri_object { #if !defined(_KERNEL) && __has_feature(capabilities) __capability void *co_codecap; __capability void *co_datacap; #else # 65 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/cheri.h" 3 4 struct chericap co_codecap; struct chericap co_datacap; #endif # 68 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/cheri.h" 3 4 }; #if !defined(_KERNEL) && __has_feature(capabilities) #define CHERI_OBJECT_INIT_NULL {NULL, NULL} #define CHERI_OBJECT_ISNULL(co) \ ((co).co_codecap == NULL && (co).co_datacap == NULL) #endif # 75 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/cheri.h" 3 4 /* * Register frame to be preserved on context switching -- very similar to * struct mips_frame. As with mips_frame, the order of save/restore is very * important for both reasons of correctness and security. * * Must match the register offset definitions (CHERIFRAME_OFF_*) in * cherireg.h. */ struct cheri_frame { /* c0 has special properties for MIPS load/store instructions. */ #if !defined(_KERNEL) && __has_feature(capabilities) __capability void *cf_c0; #else # 89 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/cheri.h" 3 4 struct chericap cf_c0; #endif # 91 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/cheri.h" 3 4 /* * General-purpose capabilities -- note, numbering is from v1.7 of the * CHERI ISA spec (ISAv2). */ #if !defined(_KERNEL) && __has_feature(capabilities) __capability void *cf_c1, *cf_c2, *cf_c3, *cf_c4; __capability void *cf_c5, *cf_c6, *cf_c7; __capability void *cf_c8, *cf_c9, *cf_c10, *cf_c11, *cf_c12; __capability void *cf_c13, *cf_c14, *cf_c15, *cf_c16, *cf_c17; __capability void *cf_c18, *cf_c19, *cf_c20, *cf_c21, *cf_c22; __capability void *cf_c23, *cf_c24, *cf_c25, *cf_idc; #else # 104 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/cheri.h" 3 4 struct chericap cf_c1, cf_c2, cf_c3, cf_c4; struct chericap cf_c5, cf_c6, cf_c7; struct chericap cf_c8, cf_c9, cf_c10, cf_c11, cf_c12; struct chericap cf_c13, cf_c14, cf_c15, cf_c16, cf_c17; struct chericap cf_c18, cf_c19, cf_c20, cf_c21, cf_c22; struct chericap cf_c23, cf_c24, cf_c25, cf_idc; #endif # 111 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/cheri.h" 3 4 /* * Program counter capability -- extracted from exception frame EPCC. */ #if !defined(_KERNEL) && __has_feature(capabilities) __capability void *cf_pcc; #else # 118 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/cheri.h" 3 4 struct chericap cf_pcc; #endif # 120 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/cheri.h" 3 4 /* * Padded out non-capability registers. * * XXXRW: The comment below on only updating for CP2 exceptions is * incorrect, but should be made correct. */ register_t cf_capcause; /* Updated only on CP2 exceptions. */ register_t _cf_pad0[1]; #if (defined(CPU_CHERI) && !defined(CPU_CHERI128)) || (defined(_MIPS_SZCAP) && (_MIPS_SZCAP == 256)) register_t _cf_pad1[2]; #endif # 132 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/cheri.h" 3 4 }; #ifdef _KERNEL /* 28 capability registers + capcause + padding. */ CTASSERT(sizeof(struct cheri_frame) == (29 * CHERICAP_SIZE)); #endif # 138 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/cheri.h" 3 4 #ifdef _KERNEL /* * Data structure defining kernel per-thread caller-save state used in * voluntary context switches. This is morally equivalent to pcb_context[]. */ struct cheri_kframe { struct chericap ckf_c17; struct chericap ckf_c18; struct chericap ckf_c19; struct chericap ckf_c20; struct chericap ckf_c21; struct chericap ckf_c22; struct chericap ckf_c23; struct chericap ckf_c24; }; #endif # 155 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/cheri.h" 3 4 /* * Data structure describing CHERI's sigaltstack-like extensions to signal * delivery. In the event that a thread takes a signal when $pcc doesn't hold * CHERI_PERM_SYSCALL, we will need to install new $pcc, $c0, $c11, and $idc * state, and move execution to the per-thread alternative stack, whose * pointer should (presumably) be relative to the c0/c11 defined here. */ struct cheri_signal { #if !defined(_KERNEL) && __has_feature(capabilities) __capability void *csig_pcc; __capability void *csig_c0; __capability void *csig_c11; __capability void *csig_idc; __capability void *csig_default_stack; __capability void *csig_sigcode; #else # 172 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/cheri.h" 3 4 struct chericap csig_pcc; struct chericap csig_c0; struct chericap csig_c11; struct chericap csig_idc; struct chericap csig_default_stack; struct chericap csig_sigcode; #endif # 179 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/cheri.h" 3 4 }; /* * Per-thread CHERI CCall/CReturn stack, which preserves the calling PC/PCC/ * IDC across CCall so that CReturn can restore them. * * XXXRW: This is a very early experiment -- it's not clear if this idea will * persist in its current form, or at all. For more complex userspace * language, there's a reasonable expectation that it, rather than the kernel, * will want to manage the idea of a "trusted stack". * * XXXRW: This is currently part of the kernel-user ABI due to the * CHERI_GET_STACK and CHERI_SET_STACK sysarch() calls. In due course we need * to revise those APIs and differentiate the kernel-internal representation * from the public one. */ struct cheri_stack_frame { register_t _csf_pad0; /* Used to be MIPS program counter. */ register_t _csf_pad1; register_t _csf_pad2; register_t _csf_pad3; #if !defined(_KERNEL) && __has_feature(capabilities) __capability void *csf_pcc; __capability void *csf_idc; #else # 204 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/cheri.h" 3 4 struct chericap csf_pcc; /* XXXRW: Store $pc in here? */ struct chericap csf_idc; #endif # 207 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/cheri.h" 3 4 }; #define CHERI_STACK_DEPTH 8 /* XXXRW: 8 is a nice round number. */ struct cheri_stack { register_t cs_tsp; /* Byte offset, not frame index. */ register_t cs_tsize; /* Stack size, in bytes. */ register_t _cs_pad0; register_t _cs_pad1; struct cheri_stack_frame cs_frames[CHERI_STACK_DEPTH]; } __aligned(CHERICAP_SIZE); #define CHERI_FRAME_SIZE sizeof(struct cheri_stack_frame) #define CHERI_STACK_SIZE (CHERI_STACK_DEPTH * CHERI_FRAME_SIZE) /* * CHERI capability register manipulation macros. */ #define CHERI_CGETBASE(v, cb) do { \ __asm__ __volatile__ ( \ ".set push\n" \ ".set noreorder\n" \ "cgetbase %0, $c%1\n" \ ".set pop\n" \ : "=r" (v) : "i" (cb)); \ } while (0) #define CHERI_CGETLEN(v, cb) do { \ __asm__ __volatile__ ( \ ".set push\n" \ ".set noreorder\n" \ "cgetlen %0, $c%1\n" \ ".set pop\n" \ : "=r" (v) :"i" (cb)); \ } while (0) #define CHERI_CGETOFFSET(v, cb) do { \ __asm__ __volatile__ ( \ ".set push\n" \ ".set noreorder\n" \ "cgetoffset %0, $c%1\n" \ ".set pop\n" \ : "=r" (v) : "i" (cb)); \ } while (0) #define CHERI_CGETTAG(v, cb) do { \ __asm__ __volatile__ ( \ ".set push\n" \ ".set noreorder\n" \ "cgettag %0, $c%1\n" \ ".set pop\n" \ : "=r" (v) : "i" (cb)); \ } while (0) #define CHERI_CGETSEALED(v, cb) do { \ __asm__ __volatile__ ( \ ".set push\n" \ ".set noreorder\n" \ "cgetsealed %0, $c%1\n" \ ".set pop\n" \ : "=r" (v) : "i" (cb)); \ } while (0) #define CHERI_CGETPERM(v, cb) do { \ __asm__ __volatile__ ( \ ".set push\n" \ ".set noreorder\n" \ "cgetperm %0, $c%1\n" \ ".set pop\n" \ : "=r" (v) : "i" (cb)); \ } while (0) #define CHERI_CGETTYPE(v, cb) do { \ __asm__ __volatile__ ( \ ".set push\n" \ ".set noreorder\n" \ "cgettype %0, $c%1\n" \ ".set pop\n" \ : "=r" (v) : "i" (cb)); \ } while (0) #define CHERI_CGETCAUSE(v) do { \ __asm__ __volatile__ ( \ ".set push\n" \ ".set noreorder\n" \ "cgetcause %0\n" \ ".set pop\n" \ : "=r" (v)); \ } while (0) #define CHERI_CTOPTR(v, cb, ct) do { \ __asm__ __volatile__ ( \ ".set push\n" \ ".set noreorder\n" \ "ctoptr %0, $c%1, $c%2\n" \ ".set pop\n" \ : "=r" (v) : "i" (cb), "i" (ct)); \ } while (0) /* * Implement a CToInt similar to CToPtr but without the tag check, which will * be useful to extract integer interpretations of untagged capabilities. One * property of this conversion is that, since the capability might be * untagged, we can't assume that (base + offset) < (max capability address), * and so significant care should be taken -- ideally this variant would only * be used when we know that the capability is untagged and holds a value that * must be an integer (due to types or other compile-time information). * * This may someday be an instruction. If so, it could directly return the * cursor, rather than extract (base, offset). */ #define CHERI_CTOINT(v, cb) do { \ register_t _base, _offset; \ \ CHERI_CGETBASE(_base, cb); \ CHERI_CGETOFFSET(_offset, cb); \ v = (__typeof__(v))(_base + _offset); \ } while (0) /* * Note that despite effectively being a CMove, CGetDefault doesn't require a * memory clobber: if it's writing to $c0, it's a nop; otherwise, it's not * writing to $c0 so no clobber is needed. */ #define CHERI_CGETDEFAULT(cd) do { \ __asm__ __volatile__ ( \ ".set push\n" \ ".set noreorder\n" \ "cgetdefault $c%0\n" \ ".set pop\n" \ : : "i" (cd)); \ } while (0) /* * Instructions that check capability values and could throw exceptions; no * capability-register value changes, so no clobbers required. */ #define CHERI_CCHECKPERM(cs, v) do { \ __asm__ __volatile__ ( \ ".set push\n" \ ".set noreorder\n" \ "ccheckperm $c%0, %1\n" \ ".set pop\n" \ : : "i" (cd), "r" (v)); \ } while (0) #define CHERI_CCHECKTYPE(cs, cb) do { \ __asm__ __volatile__ ( \ ".set push\n" \ ".set noreorder\n" \ "cchecktype $c%0, $c%1\n" \ ".set pop\n" \ : : "i" (cs), "i" (cb)); \ } while (0) /* * Routines that modify or replace values in capability registers that don't * affect memory access via the register. These do not require memory * clobbers. * * XXXRW: Are there now none of these? */ /* * Instructions relating to capability invocation, return, sealing, and * unsealing. Memory clobbers are required for register manipulation when * targeting $c0. They are also required for both CCall and CReturn to ensure * that any memory write-back is done before invocation. * * XXXRW: Is the latter class of cases required? */ #define CHERI_CSEAL(cd, cs, ct) do { \ if ((cd) == 0) \ __asm__ __volatile__ ( \ ".set push\n" \ ".set noreorder\n" \ "cseal $c%0, $c%1, $c%2\n" \ ".set pop\n" \ : : "i" (cd), "i" (cs), "i" (ct) : "memory"); \ else \ __asm__ __volatile__ ( \ ".set push\n" \ ".set noreorder\n" \ "cseal $c%0, $c%1, $c%2\n" \ ".set pop\n" \ : : "i" (cd), "i" (cs), "i" (ct)); \ } while (0) #define CHERI_CUNSEAL(cd, cb, ct) do { \ if ((cd) == 0) \ __asm__ __volatile__ ( \ ".set push\n" \ ".set noreorder\n" \ "cunseal $c%0, $c%1, $c%2\n" \ ".set pop\n" \ : : "i" (cd), "i" (cb), "i" (ct) : "memory"); \ else \ __asm__ __volatile__ ( \ ".set push\n" \ ".set noreorder\n" \ "cunseal $c%0, $c%1, $c%2\n" \ ".set pop\n" \ : : "i" (cd), "i" (cb), "i" (ct)); \ } while (0) #define CHERI_CCALL(cs, cb) do { \ __asm__ __volatile__ ( \ ".set push\n" \ ".set noreorder\n" \ "ccall $c%0, $c%1\n" \ ".set pop\n" \ : : "i" (cs), "i" (cb) : "memory"); \ } while (0) #define CHERI_CRETURN() do { \ __asm__ __volatile__ ( \ ".set push\n" \ ".set noreorder\n" \ "creturn\n" \ ".set pop\n" \ : : : "memory"); \ } while (0) /* * Capability store; while this doesn't muck with c0, it does require a memory * clobber. */ #define CHERI_CSC(cs, cb, regbase, offset) do { \ __asm__ __volatile__ ( \ ".set push\n" \ ".set noreorder\n" \ "csc $c%0, %1, %2($c%3)\n" \ ".set pop\n" \ : : "i" (cs), "r" (regbase), "i" (offset), "i" (cb) : \ "memory"); \ } while (0) /* * Data stores; while these don't muck with c0, they do require memory * clobbers. */ #define CHERI_CSB(rs, rt, offset, cb) do { \ __asm__ __volatile__ ( \ ".set push\n" \ ".set noreorder\n" \ "csb %0, %1, %2($c%3)\n" \ ".set pop\n" \ : : "r" (rs), "r" (rt), "i" (offset), "i" (cb) : "memory"); \ } while (0) #define CHERI_CSH(rs, rt, offset, cb) do { \ __asm__ __volatile__ ( \ ".set push\n" \ ".set noreorder\n" \ "csh %0, %1, %2($c%3)\n" \ ".set pop\n" \ : : "r" (rs), "r" (rt), "i" (offset), "i" (cb) : "memory"); \ } while (0) #define CHERI_CSW(rs, rt, offset, cb) do { \ __asm__ __volatile__ ( \ ".set push\n" \ ".set noreorder\n" \ "csw %0, %1, %2($c%3)\n" \ ".set pop\n" \ : : "r" (rs), "r" (rt), "i" (offset), "i" (cb) : "memory"); \ } while (0) #define CHERI_CSD(rs, rt, offset, cb) do { \ __asm__ __volatile__ ( \ ".set push\n" \ ".set noreorder\n" \ "csd %0, %1, %2($c%3)\n" \ ".set pop\n" \ : : "r" (rs), "r" (rt), "i" (offset), "i" (cb) : "memory"); \ } while (0) /* * Data loads: while these don't much with c0, they do require memory * clobbers. */ #define CHERI_CLB(rd, rt, offset, cb) do { \ __asm__ __volatile__ ( \ ".set push\n" \ ".set noreorder\n" \ "clb %0, %1, %2($c%3)\n" \ ".set pop\n" \ : "=r" (rd) : "r" (rt), "i" (offset),"i" (cb) : "memory"); \ } while (0) #define CHERI_CLH(rd, rt, offset, cb) do { \ __asm__ __volatile__ ( \ ".set push\n" \ ".set noreorder\n" \ "clh %0, %1, %2($c%3)\n" \ ".set pop\n" \ : "=r" (rd) : "r" (rt), "i" (offset), "i" (cb) : "memory"); \ } while (0) #define CHERI_CLW(rd, rt, offset, cb) do { \ __asm__ __volatile__ ( \ ".set push\n" \ ".set noreorder\n" \ "clw %0, %1, %2($c%3)\n" \ ".set pop\n" \ : "=r" (rd) : "r" (rt), "i" (offset), "i" (cb) : "memory"); \ } while (0) #define CHERI_CLD(rd, rt, offset, cb) do { \ __asm__ __volatile__ ( \ ".set push\n" \ ".set noreorder\n" \ "cld %0, %1, %2($c%3)\n" \ ".set pop\n" \ : "=r" (rd) : "r" (rt), "i" (offset), "i" (cb) : "memory"); \ } while (0) #define CHERI_CLBU(rd, rt, offset, cb) do { \ __asm__ __volatile__ ( \ ".set push\n" \ ".set noreorder\n" \ "clbu %0, %1, %2($c%3)\n" \ ".set pop\n" \ : "=r" (rd) : "r" (rt), "i" (offset), "i" (cb) : "memory"); \ } while (0) #define CHERI_CLHU(rd, rt, offset, cb) do { \ __asm__ __volatile__ ( \ ".set push\n" \ ".set noreorder\n" \ "clhu %0, %1, %2($c%3)\n" \ ".set pop\n" \ : "=r" (rd) : "r" (rt), "i" (offset), "i" (cb) : "memory"); \ } while (0) #define CHERI_CLWU(rd, rt, offset, cb) do { \ __asm__ __volatile__ ( \ ".set push\n" \ ".set noreorder\n" \ "clwu %0, %1, %2($c%3)\n" \ ".set pop\n" \ : "=r" (rd) : "r" (rt), "i" (offset), "i" (cb) : "memory"); \ } while (0) /* * Routines that modify or replace values in capability registers, and that if * if used on C0, require the compiler to write registers back to memory, and * reload afterwards, since we may effectively be changing the compiler- * visible address space. This is also necessary for permissions changes as * well, to ensure that write-back occurs before a possible loss of store * permission. */ #define CHERI_CGETPCC(v, cd) do { \ if ((cd) == 0) \ __asm__ __volatile__ ( \ ".set push\n" \ ".set noreorder\n" \ "cgetpcc %0, $c%1\n" \ ".set pop\n" \ : "=r" (v) : "i" (cd) : "memory"); \ else \ __asm__ __volatile__ ( \ ".set push\n" \ ".set noreorder\n" \ "cgetpcc %0, $c%1\n" \ ".set pop\n" \ : "=r" (v) : "i" (cd)); \ } while (0) #define CHERI_CINCBASE(cd, cb, v) do { \ if ((cd) == 0) \ __asm__ __volatile__ ( \ ".set push\n" \ ".set noreorder\n" \ "cincbase $c%0, $c%1, %2\n" \ ".set pop\n" \ : : "i" (cd), "i" (cb), "r" (v) : "memory"); \ else \ __asm__ __volatile__ ( \ ".set push\n" \ ".set noreorder\n" \ "cincbase $c%0, $c%1, %2\n" \ ".set pop\n" \ : : "i" (cd), "i" (cb), "r" (v)); \ } while (0) #define CHERI_CINCOFFSET(cd, cb, v) do { \ if ((cd) == 0) \ __asm__ __volatile__ ( \ ".set push\n" \ ".set noreorder\n" \ "cincoffset $c%0, $c%1, %2\n" \ ".set pop\n" \ : : "i" (cd), "i" (cb), "r" (v) : "memory"); \ else \ __asm__ __volatile__ ( \ ".set push\n" \ ".set noreorder\n" \ "cincoffset $c%0, $c%1, %2\n" \ ".set pop\n" \ : : "i" (cd), "i" (cb), "r" (v)); \ } while (0) #if (defined(CPU_CHERI) && !defined(CPU_CHERI128)) || (defined(_MIPS_SZCAP) && (_MIPS_SZCAP == 256)) #define CHERI_CMOVE(cd, cb) do { \ if ((cd) == 0) \ __asm__ __volatile__ ( \ ".set push\n" \ ".set noreorder\n" \ "cmove $c%0, $c%1\n" \ ".set pop\n" \ : : "i" (cd), "i" (cb) : "memory"); \ else \ __asm__ __volatile__ ( \ ".set push\n" \ ".set noreorder\n" \ "cmove $c%0, $c%1\n" \ ".set pop\n" \ : : "i" (cd), "i" (cb)); \ } while (0) #else /* 128-bit CHERI */ # 627 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/cheri.h" 3 4 #define CHERI_CMOVE(cd, cb) CHERI_CINCOFFSET(cd, cb, 0) #endif /* 128-bit CHERI */ # 629 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/cheri.h" 3 4 #define CHERI_CSETDEFAULT(cb) do { \ __asm__ __volatile__ ( \ ".set push\n" \ ".set noreorder\n" \ "csetdefault %c%0\n" \ ".set pop\n" \ : : "i" (cb) : "memory"); \ } while (0) #define CHERI_CSETLEN(cd, cb, v) do { \ if ((cd) == 0) \ __asm__ __volatile__ ( \ ".set push\n" \ ".set noreorder\n" \ "csetlen $c%0, $c%1, %2\n" \ ".set pop\n" \ : : "i" (cd), "i" (cb), "r" (v) : "memory"); \ else \ __asm__ __volatile__ ( \ ".set push\n" \ ".set noreorder\n" \ "csetlen $c%0, $c%1, %2\n" \ ".set pop\n" \ : : "i" (cd), "i" (cb), "r" (v)); \ } while (0) #define CHERI_CSETOFFSET(cd, cb, v) do { \ if ((cd) == 0) \ __asm__ __volatile__ ( \ ".set push\n" \ ".set noreorder\n" \ "csetoffset $c%0, $c%1, %2\n" \ ".set pop\n" \ : : "i" (cd), "i" (cb), "r" (v) : "memory"); \ else \ __asm__ __volatile__ ( \ ".set push\n" \ ".set noreorder\n" \ "csetoffset $c%0, $c%1, %2\n" \ ".set pop\n" \ : : "i" (cd), "i" (cb), "r" (v)); \ } while (0) #define CHERI_CCLEARTAG(cd, cb) do { \ if ((cd) == 0) \ __asm__ __volatile__ ( \ ".set push\n" \ ".set noreorder\n" \ "ccleartag $c%0, $c%1\n" \ ".set pop\n" \ : : "i" (cd), "i" (cb) : "memory"); \ else \ __asm__ __volatile__ ( \ ".set push\n" \ ".set noreorder\n" \ "ccleartag $c%0, $c%1\n" \ ".set pop\n" \ : : "i" (cd), "i" (cb)); \ } while (0) #define CHERI_CANDPERM(cd, cb, v) do { \ if ((cd) == 0) \ __asm__ __volatile__ ( \ ".set push\n" \ ".set noreorder\n" \ "candperm $c%0, $c%1, %2\n" \ ".set pop\n" \ : : "i" (cd), "i" (cb), "r" (v) : "memory"); \ else \ __asm__ __volatile__ ( \ ".set push\n" \ ".set noreorder\n" \ "candperm $c%0, $c%1, %2\n" \ ".set pop\n" \ : : "i" (cd), "i" (cb), "r" (v)); \ } while (0) #define CHERI_CSETBOUNDS(cd, cb, v) do { \ if ((cd) == 0) \ __asm__ __volatile__ ( \ ".set push\n" \ ".set noreorder\n" \ "csetbounds $c%0, $c%1, %2\n" \ ".set pop\n" \ : : "i" (cd), "i" (cb), "r" (v) : "memory"); \ else \ __asm__ __volatile__ ( \ ".set push\n" \ ".set noreorder\n" \ "csetbounds $c%0, $c%1, %2\n" \ ".set pop\n" \ : : "i" (cd), "i" (cb), "r" (v)); \ } while (0) #define CHERI_CFROMPTR(cd, cb, v) do { \ if ((cd) == 0) \ __asm__ __volatile__ ( \ ".set push\n" \ ".set noreorder\n" \ "cfromptr $c%0, $c%1, %2\n" \ ".set pop\n" \ : : "i" (cd), "i" (cb), "r" (v) : "memory"); \ else \ __asm__ __volatile__ ( \ ".set push\n" \ ".set noreorder\n" \ "cfromptr $c%0, $c%1, %2\n" \ ".set pop\n" \ : : "i" (cd), "i" (cb), "r" (v)); \ } while (0) #define CHERI_CLC(cd, cb, regbase, offset) do { \ if ((cd) == 0) \ __asm__ __volatile__ ( \ ".set push\n" \ ".set noreorder\n" \ "clc $c%0, %1, %2($c%3)\n" \ ".set pop\n" \ : : "i" (cd), "r" (regbase), "i" (offset), "i" (cb) \ : "memory"); \ else \ __asm__ __volatile__ ( \ ".set push\n" \ ".set noreorder\n" \ "clc $c%0, %1, %2($c%3)\n" \ ".set pop\n" \ : : "i" (cd), "r" (regbase), "i" (offset), \ "i" (cb)); \ } while (0) static inline void cheri_capability_load(u_int crn_to, struct chericap *cp) { CHERI_CLC(crn_to, CHERI_CR_KDC, cp, 0); } static inline void cheri_capability_store(u_int crn_from, struct chericap *cp) { CHERI_CSC(crn_from, CHERI_CR_KDC, cp, 0); } /* * Extract a flattened but useful memory representation of a complete * capability register. */ #define CHERI_GETCAPREG(crn, c) do { \ CHERI_CGETPERM((c).c_perms, (crn)); \ CHERI_CGETSEALED((c).c_sealed, (crn)); \ CHERI_CGETTYPE((c).c_otype, (crn)); \ CHERI_CGETBASE((c).c_base, (crn)); \ CHERI_CGETLEN((c).c_length, (crn)); \ } while (0) /* * Routines for measuring time -- depends on a later MIPS userspace cycle * counter. */ static __inline uint32_t cheri_get_cyclecount(void) { uint64_t _time; __asm__ __volatile__ ( ".set push\n" ".set noreorder\n" "rdhwr %0, $2\n" ".set pop\n" : "=r" (_time)); return (_time & 0xffffffff); } /* * Special marker NOPs recognised by analyse_trace.py to start / stop region * of interest in trace. */ #define CHERI_START_TRACE do { \ __asm__ __volatile__("li $0, 0xbeef"); \ } while(0) #define CHERI_STOP_TRACE do { \ __asm__ __volatile__("li $0, 0xdead"); \ } while(0) #ifdef _KERNEL #define CHERI_CAP_PRINT(crn) do { \ uintmax_t c_perms, c_otype, c_base, c_length, c_offset; \ u_int ctag, c_sealed; \ \ CHERI_CGETTAG(ctag, (crn)); \ CHERI_CGETSEALED(c_sealed, (crn)); \ CHERI_CGETPERM(c_perms, (crn)); \ CHERI_CGETTYPE(c_otype, (crn)); \ CHERI_CGETBASE(c_base, (crn)); \ CHERI_CGETLEN(c_length, (crn)); \ CHERI_CGETOFFSET(c_offset, (crn)); \ printf("v:%u s:%u p:%08jx b:%016jx l:%016jx o:%jx t:%jx\n", \ ctag, c_sealed, c_perms, c_base, c_length, c_offset, \ c_otype); \ } while (0) #define CHERI_REG_PRINT(crn, num) do { \ printf("$c%02u: ", num); \ CHERI_CAP_PRINT(crn); \ } while (0) #ifdef DDB #define DB_CHERI_CAP_PRINT(crn) do { \ uintmax_t c_perms, c_otype, c_base, c_length, c_offset; \ u_int ctag, c_sealed; \ \ CHERI_CGETTAG(ctag, (crn)); \ CHERI_CGETSEALED(c_sealed, (crn)); \ CHERI_CGETPERM(c_perms, (crn)); \ CHERI_CGETTYPE(c_otype, (crn)); \ CHERI_CGETBASE(c_base, (crn)); \ CHERI_CGETLEN(c_length, (crn)); \ CHERI_CGETOFFSET(c_offset, (crn)); \ db_printf("v:%u s:%u p:%08jx b:%016jx l:%016jx o:%jx t:%jx\n", \ ctag, c_sealed, c_perms, c_base, c_length, c_offset, \ c_otype); \ } while (0) #define DB_CHERI_REG_PRINT(crn, num) do { \ db_printf("$c%02u: ", num); \ DB_CHERI_CAP_PRINT(crn); \ } while (0) #endif /* !_KERNEL */ # 860 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/cheri.h" 3 4 /* * APIs that act on C language representations of capabilities -- but not * capabilities themselves. */ void cheri_capability_copy(struct chericap *cp_to, struct chericap *cp_from); void cheri_capability_set(struct chericap *cp, uint32_t uperms, void *otype, void *basep, size_t length, off_t off); void cheri_capability_set_null(struct chericap *cp); void cheri_capability_setoffset(struct chericap *cp, register_t offset); /* * CHERI capability utility functions. */ void cheri_bcopy(void *src, void *dst, size_t len); void *cheri_memcpy(void *dst, void *src, size_t len); /* * CHERI context management functions. */ const char *cheri_exccode_string(uint8_t exccode); void cheri_exec_setregs(struct thread *td, u_long entry_addr); void cheri_log_cheri_frame(struct cheri_frame *cheriframe); void cheri_log_exception(struct trapframe *frame, int trap_type); void cheri_log_exception_registers(struct trapframe *frame); int cheri_syscall_authorize(struct thread *td, u_int code, int nargs, register_t *args); int cheri_signal_sandboxed(struct thread *td); void cheri_sendsig(struct thread *td); /* * Functions to set up and manipulate CHERI contexts and stacks. */ struct pcb; struct sysarch_args; void cheri_context_copy(struct pcb *dst, struct pcb *src); void cheri_signal_copy(struct pcb *dst, struct pcb *src); void cheri_stack_copy(struct pcb *dst, struct pcb *src); void cheri_stack_init(struct pcb *pcb); int cheri_stack_unwind(struct thread *td, struct trapframe *tf, int signum); int cheri_sysarch_getstack(struct thread *td, struct sysarch_args *uap); int cheri_sysarch_gettypecap(struct thread *td, struct sysarch_args *uap); int cheri_sysarch_setstack(struct thread *td, struct sysarch_args *uap); void cheri_typecap_copy(struct pcb *dst, struct pcb *src); /* * Global sysctl definitions. */ SYSCTL_DECL(_security_cheri); SYSCTL_DECL(_security_cheri_stats); extern u_int security_cheri_debugger_on_sandbox_signal; extern u_int security_cheri_debugger_on_sandbox_syscall; extern u_int security_cheri_debugger_on_sandbox_unwind; extern u_int security_cheri_debugger_on_sigprot; extern u_int security_cheri_sandboxed_signals; extern u_int security_cheri_syscall_violations; #endif /* !_KERNEL */ # 919 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/cheri.h" 3 4 #endif /* _MIPS_INCLUDE_CHERI_H_ */ # 921 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/cheri.h" 3 4 # 51 "/home/sson/src/cheribsd/lib/libc_cheri/../libmalloc_simple/malloc.c" 2 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 51 "/home/sson/src/cheribsd/lib/libc_cheri/../libmalloc_simple/malloc.c" # 1 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/cheric.h" 1 3 4 /*- * Copyright (c) 2013-2015 Robert N. M. Watson * All rights reserved. * * This software was developed by SRI International and the University of * Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237) * ("CTSRD"), as part of the DARPA CRASH research programme. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #ifndef _MIPS_INCLUDE_CHERIC_H_ #define _MIPS_INCLUDE_CHERIC_H_ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 34 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/cheric.h" 3 4 # 35 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/cheric.h" 3 4 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 36 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/cheric.h" 3 4 # 37 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/cheric.h" 3 4 #if !defined(_KERNEL) && __has_feature(capabilities) /* * Programmer-friendly macros for CHERI-aware C code -- requires use of * CHERI-aware Clang/LLVM, and full CP2 context switching, so not yet usable * in the kernel. */ #define cheri_getlen(x) __builtin_cheri_get_cap_length( \ __DECONST(__capability void *, (x))) #define cheri_getbase(x) __builtin_cheri_get_cap_base( \ __DECONST(__capability void *, (x))) #define cheri_getoffset(x) __builtin_cheri_cap_offset_get( \ __DECONST(__capability void *, (x))) #define cheri_getperm(x) __builtin_cheri_get_cap_perms( \ __DECONST(__capability void *, (x))) #define cheri_getsealed(x) __builtin_cheri_get_cap_sealed( \ __DECONST(__capability void *, (x))) #define cheri_gettag(x) __builtin_cheri_get_cap_tag( \ __DECONST(__capability void *, (x))) #define cheri_gettype(x) __builtin_cheri_get_cap_type( \ __DECONST(__capability void *, (x))) #define cheri_andperm(x, y) __builtin_cheri_and_cap_perms( \ __DECONST(__capability void *, (x)), (y)) #define cheri_cleartag(x) __builtin_cheri_clear_cap_tag( \ __DECONST(__capability void *, (x))) #define cheri_incoffset(x, y) __builtin_cheri_cap_offset_increment( \ __DECONST(__capability void *, (x)), (y)) #define cheri_setoffset(x, y) __builtin_cheri_cap_offset_set( \ __DECONST(__capability void *, (x)), (y)) #define cheri_seal(x, y) __builtin_cheri_seal_cap( \ __DECONST(__capability void *, (x)), \ __DECONST(__capability void *, (y))) #define cheri_unseal(x, y) __builtin_cheri_unseal_cap( \ __DECONST(__capability void *, (x)), \ __DECONST(__capability void *, (y))) #define cheri_getcause() __builtin_cheri_get_cause() #define cheri_setcause(x) __builtin_cheri_set_cause(x) #define cheri_ccheckperm(c, p) __builtin_cheri_check_perms( \ __DECONST(__capability void *, (c)), (p)) #define cheri_cchecktype(c, t) __builtin_cheri_check_type( \ __DECONST(__capability void *, (c)), (t)) #define cheri_getdefault() __builtin_cheri_get_global_data_cap() #define cheri_getidc() __builtin_cheri_get_invoke_data_cap() #define cheri_getkr0c() __builtin_cheri_get_kernel_cap1() #define cheri_getkr1c() __builtin_cheri_get_kernel_cap2() #define cheri_getkcc() __builtin_cheri_get_kernel_code_cap() #define cheri_getkdc() __builtin_cheri_get_kernel_data_cap() #define cheri_getepcc() __builtin_cheri_get_exception_program_counter_cap() #define cheri_getpcc() __builtin_cheri_get_program_counter_cap() #define cheri_getstack() __builtin_memcap_stack_get() #define cheri_local(c) cheri_andperm((c), ~CHERI_PERM_GLOBAL) #define cheri_csetbounds(x, y) __builtin_memcap_bounds_set( \ __DECONST(__capability void *, (x)), (y)) /* * Two variations on cheri_ptr() based on whether we are looking for a code or * data capability. The compiler's use of CFromPtr will be with respect to * $c0 or $pcc depending on the type of the pointer derived, so we need to use * types to differentiate the two versions at compile time. We don't provide * the full set of function variations for code pointers as they haven't * proven necessary as yet. * * XXXRW: Ideally, casting via a function pointer would cause the compiler to * derive the capability using CFromPtr on $pcc rather than on $c0. This * appears not currently to be the case, so manually derive using * cheri_getpcc() for now. */ static __inline __capability void * cheri_codeptr(const void *ptr, size_t len) { #ifdef NOTYET __capability void (*c)(void) = ptr; #else # 117 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/cheric.h" 3 4 __capability void *c = cheri_setoffset(cheri_getpcc(), (register_t)ptr); #endif # 120 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/cheric.h" 3 4 /* Assume CFromPtr without base set, availability of CSetBounds. */ return (cheri_csetbounds(c, len)); } static __inline __capability void * cheri_codeptrperm(const void *ptr, size_t len, register_t perm) { return (cheri_andperm(cheri_codeptr(ptr, len), perm | CHERI_PERM_GLOBAL)); } static __inline __capability void * cheri_ptr(const void *ptr, size_t len) { /* Assume CFromPtr without base set, availability of CSetBounds. */ return (cheri_csetbounds((const __capability void *)ptr, len)); } static __inline __capability void * cheri_ptrperm(const void *ptr, size_t len, register_t perm) { return (cheri_andperm(cheri_ptr(ptr, len), perm | CHERI_PERM_GLOBAL)); } static __inline __capability void * cheri_ptrpermoff(const void *ptr, size_t len, register_t perm, off_t off) { return (cheri_setoffset(cheri_ptrperm(ptr, len, perm), off)); } /* * Construct a capability suitable to describe a type identified by 'ptr'; * set it to zero-length with the offset equal to the base. The caller must * provide a root capability (in the old world order, derived from $c0, but in * the new world order, likely extracted from the kernel using sysarch(2)). * * The caller may wish to assert various properties about the returned * capability, including that CHERI_PERM_SEAL is set. */ static __inline __capability void * cheri_maketype(__capability void *root_type, register_t type) { __capability void *c; c = root_type; c = cheri_setoffset(c, type); /* Set type as desired. */ c = cheri_csetbounds(c, 1); /* ISA implies length of 1. */ c = cheri_andperm(c, CHERI_PERM_GLOBAL | CHERI_PERM_SEAL); /* Perms. */ return (c); } static __inline __capability void * cheri_zerocap(void) { return (__capability void *)0; } #define cheri_getreg(x) ({ \ __capability void *_cap; \ __asm __volatile ("cmove %0, $c" #x : "=C" (_cap)); \ _cap; \ }) #define cheri_setreg(x, cap) do { \ if ((x) == 0) \ __asm __volatile ("cmove $c" #x ", %0" : : "C" (cap) : \ "memory"); \ else \ __asm __volatile ("cmove $c" #x ", %0" : : "C" (cap)); \ } while (0) #endif # 196 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/cheric.h" 3 4 #define CHERI_PRINT_PTR(ptr) \ printf("%s: " #ptr " b:%016jx l:%016zx o:%jx\n", __func__, \ cheri_getbase((const __capability void *)(ptr)), \ cheri_getlen((const __capability void *)(ptr)), \ cheri_getoffset((const __capability void *)(ptr))) #endif /* _MIPS_INCLUDE_CHERIC_H_ */ # 204 "/var/tmp/obj/mips.mips64/home/sson/src/cheribsd/tmp/usr/include/machine/cheric.h" 3 4 # 52 "/home/sson/src/cheribsd/lib/libc_cheri/../libmalloc_simple/malloc.c" 2 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 53 "/home/sson/src/cheribsd/lib/libc_cheri/../libmalloc_simple/malloc.c" # 1 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/assert.h" 1 /*- * Copyright (c) 1992, 1993 * The Regents of the University of California. All rights reserved. * (c) UNIX System Laboratories, Inc. * All or some portions of this file are derived from material licensed * to the University of California by American Telephone and Telegraph * Co. or Unix System Laboratories, Inc. and are reproduced herein with * the permission of UNIX System Laboratories, Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)assert.h 8.2 (Berkeley) 1/21/94 * $FreeBSD$ */ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 38 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/assert.h" # 39 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/assert.h" /* * Unlike other ANSI header files, may usefully be included * multiple times, with and without NDEBUG defined. */ #undef assert #undef _assert #ifdef NDEBUG #define assert(e) ((void)0) #define _assert(e) ((void)0) #else # 52 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/assert.h" #define _assert(e) assert(e) #define assert(e) ((e) ? (void)0 : __assert(__func__, __FILE__, \ __LINE__, #e)) #endif /* NDEBUG */ # 57 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/assert.h" #ifndef _ASSERT_H_ #define _ASSERT_H_ /* * Static assertions. In principle we could define static_assert for * C++ older than C++11, but this breaks if _Static_assert is * implemented as a macro. * * C++ template parameters may contain commas, even if not enclosed in * parentheses, causing the _Static_assert macro to be invoked with more * than two parameters. */ #if __ISO_C_VISIBLE >= 2011 && !defined(__cplusplus) #define static_assert _Static_assert #endif # 73 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/assert.h" __BEGIN_DECLS void __assert(const char *, const char *, int, const char *) __dead2; __END_DECLS #endif /* !_ASSERT_H_ */ # 79 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/assert.h" # 54 "/home/sson/src/cheribsd/lib/libc_cheri/../libmalloc_simple/malloc.c" 2 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 54 "/home/sson/src/cheribsd/lib/libc_cheri/../libmalloc_simple/malloc.c" # 1 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/stdio.h" 1 /*- * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Chris Torek. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)stdio.h 8.5 (Berkeley) 4/29/95 * $FreeBSD$ */ #ifndef _STDIO_H_ #define _STDIO_H_ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 39 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/stdio.h" # 40 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/stdio.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 40 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/stdio.h" # 41 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/stdio.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 41 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/stdio.h" # 42 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/stdio.h" typedef __off_t fpos_t; #ifndef _SIZE_T_DECLARED typedef __size_t size_t; #define _SIZE_T_DECLARED #endif # 49 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/stdio.h" #if __POSIX_VISIBLE >= 200809 #ifndef _OFF_T_DECLARED #define _OFF_T_DECLARED typedef __off_t off_t; #endif # 55 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/stdio.h" #ifndef _SSIZE_T_DECLARED #define _SSIZE_T_DECLARED typedef __ssize_t ssize_t; #endif # 59 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/stdio.h" #endif # 60 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/stdio.h" #if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE #ifndef _VA_LIST_DECLARED typedef __va_list va_list; #define _VA_LIST_DECLARED #endif # 66 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/stdio.h" #endif # 67 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/stdio.h" #define _FSTDIO /* Define for new stdio with functions. */ /* * NB: to fit things in six character monocase externals, the stdio * code uses the prefix `__s' for stdio objects, typically followed * by a three-character attempt at a mnemonic. */ /* stdio buffers */ struct __sbuf { unsigned char *_base; int _size; }; /* * stdio state variables. * * The following always hold: * * if (_flags&(__SLBF|__SWR)) == (__SLBF|__SWR), * _lbfsize is -_bf._size, else _lbfsize is 0 * if _flags&__SRD, _w is 0 * if _flags&__SWR, _r is 0 * * This ensures that the getc and putc macros (or inline functions) never * try to write or read from a file that is in `read' or `write' mode. * (Moreover, they can, and do, automatically switch from read mode to * write mode, and back, on "r+" and "w+" files.) * * _lbfsize is used only to make the inline line-buffered output stream * code as compact as possible. * * _ub, _up, and _ur are used when ungetc() pushes back more characters * than fit in the current _bf, or when ungetc() pushes back a character * that does not match the previous one in _bf. When this happens, * _ub._base becomes non-nil (i.e., a stream has ungetc() data iff * _ub._base!=NULL) and _up and _ur save the current values of _p and _r. * * Certain members of __sFILE are accessed directly via macros or * inline functions. To preserve ABI compat, these members must not * be disturbed. These members are marked below with (*). */ struct __sFILE { unsigned char *_p; /* (*) current position in (some) buffer */ int _r; /* (*) read space left for getc() */ int _w; /* (*) write space left for putc() */ short _flags; /* (*) flags, below; this FILE is free if 0 */ short _file; /* (*) fileno, if Unix descriptor, else -1 */ struct __sbuf _bf; /* (*) the buffer (at least 1 byte, if !NULL) */ int _lbfsize; /* (*) 0 or -_bf._size, for inline putc */ /* operations */ void *_cookie; /* (*) cookie passed to io functions */ int (*_close)(void *); int (*_read)(void *, char *, int); fpos_t (*_seek)(void *, fpos_t, int); int (*_write)(void *, const char *, int); /* separate buffer for long sequences of ungetc() */ struct __sbuf _ub; /* ungetc buffer */ unsigned char *_up; /* saved _p when _p is doing ungetc data */ int _ur; /* saved _r when _r is counting ungetc data */ /* tricks to meet minimum requirements even when malloc() fails */ unsigned char _ubuf[3]; /* guarantee an ungetc() buffer */ unsigned char _nbuf[1]; /* guarantee a getc() buffer */ /* separate buffer for fgetln() when line crosses buffer boundary */ struct __sbuf _lb; /* buffer for fgetln() */ /* Unix stdio files get aligned to block boundaries on fseek() */ int _blksize; /* stat.st_blksize (may be != _bf._size) */ fpos_t _offset; /* current lseek offset */ struct pthread_mutex *_fl_mutex; /* used for MT-safety */ struct pthread *_fl_owner; /* current owner */ int _fl_count; /* recursive lock count */ int _orientation; /* orientation for fwide() */ __mbstate_t _mbstate; /* multibyte conversion state */ int _flags2; /* additional flags */ }; #ifndef _STDFILE_DECLARED #define _STDFILE_DECLARED typedef struct __sFILE FILE; #endif # 153 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/stdio.h" #ifndef _STDSTREAM_DECLARED __BEGIN_DECLS extern FILE *__stdinp; extern FILE *__stdoutp; extern FILE *__stderrp; __END_DECLS #define _STDSTREAM_DECLARED #endif # 161 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/stdio.h" #define __SLBF 0x0001 /* line buffered */ #define __SNBF 0x0002 /* unbuffered */ #define __SRD 0x0004 /* OK to read */ #define __SWR 0x0008 /* OK to write */ /* RD and WR are never simultaneously asserted */ #define __SRW 0x0010 /* open for reading & writing */ #define __SEOF 0x0020 /* found EOF */ #define __SERR 0x0040 /* found error */ #define __SMBF 0x0080 /* _bf._base is from malloc */ #define __SAPP 0x0100 /* fdopen()ed in append mode */ #define __SSTR 0x0200 /* this is an sprintf/snprintf string */ #define __SOPT 0x0400 /* do fseek() optimization */ #define __SNPT 0x0800 /* do not do fseek() optimization */ #define __SOFF 0x1000 /* set iff _offset is in fact correct */ #define __SMOD 0x2000 /* true => fgetln modified _p text */ #define __SALC 0x4000 /* allocate string space dynamically */ #define __SIGN 0x8000 /* ignore this file in _fwalk */ #define __S2OAP 0x0001 /* O_APPEND mode is set */ /* * The following three definitions are for ANSI C, which took them * from System V, which brilliantly took internal interface macros and * made them official arguments to setvbuf(), without renaming them. * Hence, these ugly _IOxxx names are *supposed* to appear in user code. * * Although numbered as their counterparts above, the implementation * does not rely on this. */ #define _IOFBF 0 /* setvbuf should set fully buffered */ #define _IOLBF 1 /* setvbuf should set line buffered */ #define _IONBF 2 /* setvbuf should set unbuffered */ #define BUFSIZ 1024 /* size of buffer used by setbuf */ #define EOF (-1) /* * FOPEN_MAX is a minimum maximum, and is the number of streams that * stdio can provide without attempting to allocate further resources * (which could fail). Do not use this for anything. */ /* must be == _POSIX_STREAM_MAX */ #ifndef FOPEN_MAX #define FOPEN_MAX 20 /* must be <= OPEN_MAX */ #endif # 207 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/stdio.h" #define FILENAME_MAX 1024 /* must be <= PATH_MAX */ /* System V/ANSI C; this is the wrong way to do this, do *not* use these. */ #if __XSI_VISIBLE #define P_tmpdir "/tmp/" #endif # 213 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/stdio.h" #define L_tmpnam 1024 /* XXX must be == PATH_MAX */ #define TMP_MAX 308915776 #ifndef SEEK_SET #define SEEK_SET 0 /* set file offset to offset */ #endif # 219 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/stdio.h" #ifndef SEEK_CUR #define SEEK_CUR 1 /* set file offset to current plus offset */ #endif # 222 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/stdio.h" #ifndef SEEK_END #define SEEK_END 2 /* set file offset to EOF plus offset */ #endif # 225 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/stdio.h" #define stdin __stdinp #define stdout __stdoutp #define stderr __stderrp __BEGIN_DECLS #ifdef _XLOCALE_H_ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 232 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/stdio.h" # 233 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/stdio.h" #endif # 234 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/stdio.h" /* * Functions defined in ANSI C standard. */ void clearerr(FILE *); int fclose(FILE *); int feof(FILE *); int ferror(FILE *); int fflush(FILE *); int fgetc(FILE *); int fgetpos(FILE * __restrict, fpos_t * __restrict); char *fgets(char * __restrict, int, FILE * __restrict); FILE *fopen(const char * __restrict, const char * __restrict); int fprintf(FILE * __restrict, const char * __restrict, ...); int fputc(int, FILE *); int fputs(const char * __restrict, FILE * __restrict); size_t fread(void * __restrict, size_t, size_t, FILE * __restrict); FILE *freopen(const char * __restrict, const char * __restrict, FILE * __restrict); int fscanf(FILE * __restrict, const char * __restrict, ...); int fseek(FILE *, long, int); int fsetpos(FILE *, const fpos_t *); long ftell(FILE *); size_t fwrite(const void * __restrict, size_t, size_t, FILE * __restrict); int getc(FILE *); int getchar(void); char *gets(char *); void perror(const char *); int printf(const char * __restrict, ...); int putc(int, FILE *); int putchar(int); int puts(const char *); int remove(const char *); int rename(const char *, const char *); void rewind(FILE *); int scanf(const char * __restrict, ...); void setbuf(FILE * __restrict, char * __restrict); int setvbuf(FILE * __restrict, char * __restrict, int, size_t); int sprintf(char * __restrict, const char * __restrict, ...); int sscanf(const char * __restrict, const char * __restrict, ...); FILE *tmpfile(void); char *tmpnam(char *); int ungetc(int, FILE *); int vfprintf(FILE * __restrict, const char * __restrict, __va_list); int vprintf(const char * __restrict, __va_list); int vsprintf(char * __restrict, const char * __restrict, __va_list); #if __ISO_C_VISIBLE >= 1999 int snprintf(char * __restrict, size_t, const char * __restrict, ...) __printflike(3, 4); int vfscanf(FILE * __restrict, const char * __restrict, __va_list) __scanflike(2, 0); int vscanf(const char * __restrict, __va_list) __scanflike(1, 0); int vsnprintf(char * __restrict, size_t, const char * __restrict, __va_list) __printflike(3, 0); int vsscanf(const char * __restrict, const char * __restrict, __va_list) __scanflike(2, 0); #endif # 292 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/stdio.h" /* * Functions defined in all versions of POSIX 1003.1. */ #if __BSD_VISIBLE || (__POSIX_VISIBLE && __POSIX_VISIBLE <= 199506) #define L_cuserid 17 /* size for cuserid(3); MAXLOGNAME, legacy */ #endif # 299 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/stdio.h" #if __POSIX_VISIBLE #define L_ctermid 1024 /* size for ctermid(3); PATH_MAX */ char *ctermid(char *); FILE *fdopen(int, const char *); int fileno(FILE *); #endif /* __POSIX_VISIBLE */ # 307 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/stdio.h" #if __POSIX_VISIBLE >= 199209 int pclose(FILE *); FILE *popen(const char *, const char *); #endif # 312 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/stdio.h" #if __POSIX_VISIBLE >= 199506 int ftrylockfile(FILE *); void flockfile(FILE *); void funlockfile(FILE *); /* * These are normally used through macros as defined below, but POSIX * requires functions as well. */ int getc_unlocked(FILE *); int getchar_unlocked(void); int putc_unlocked(int, FILE *); int putchar_unlocked(int); #endif # 327 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/stdio.h" #if __BSD_VISIBLE void clearerr_unlocked(FILE *); int feof_unlocked(FILE *); int ferror_unlocked(FILE *); int fileno_unlocked(FILE *); #endif # 333 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/stdio.h" #if __POSIX_VISIBLE >= 200112 int fseeko(FILE *, __off_t, int); __off_t ftello(FILE *); #endif # 338 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/stdio.h" #if __BSD_VISIBLE || __XSI_VISIBLE > 0 && __XSI_VISIBLE < 600 int getw(FILE *); int putw(int, FILE *); #endif /* BSD or X/Open before issue 6 */ # 343 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/stdio.h" #if __XSI_VISIBLE char *tempnam(const char *, const char *); #endif # 347 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/stdio.h" #if __POSIX_VISIBLE >= 200809 FILE *fmemopen(void * __restrict, size_t, const char * __restrict); ssize_t getdelim(char ** __restrict, size_t * __restrict, int, FILE * __restrict); FILE *open_memstream(char **, size_t *); int renameat(int, const char *, int, const char *); int vdprintf(int, const char * __restrict, __va_list); /* * Every programmer and his dog wrote functions called getline() and dprintf() * before POSIX.1-2008 came along and decided to usurp the names, so we * don't prototype them by default unless one of the following is true: * a) the app has requested them specifically by defining _WITH_GETLINE or * _WITH_DPRINTF, respectively * b) the app has requested a POSIX.1-2008 environment via _POSIX_C_SOURCE * c) the app defines a GNUism such as _BSD_SOURCE or _GNU_SOURCE */ #ifndef _WITH_GETLINE #if defined(_BSD_SOURCE) || defined(_GNU_SOURCE) #define _WITH_GETLINE #elif defined(_POSIX_C_SOURCE) # 369 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/stdio.h" #if _POSIX_C_SOURCE >= 200809 #define _WITH_GETLINE #endif # 372 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/stdio.h" #endif # 373 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/stdio.h" #endif # 374 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/stdio.h" #ifdef _WITH_GETLINE ssize_t getline(char ** __restrict, size_t * __restrict, FILE * __restrict); #endif # 378 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/stdio.h" #ifndef _WITH_DPRINTF #if defined(_BSD_SOURCE) || defined(_GNU_SOURCE) #define _WITH_DPRINTF #elif defined(_POSIX_C_SOURCE) # 383 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/stdio.h" #if _POSIX_C_SOURCE >= 200809 #define _WITH_DPRINTF #endif # 386 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/stdio.h" #endif # 387 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/stdio.h" #endif # 388 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/stdio.h" #ifdef _WITH_DPRINTF int (dprintf)(int, const char * __restrict, ...); #endif # 392 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/stdio.h" #endif /* __POSIX_VISIBLE >= 200809 */ # 394 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/stdio.h" /* * Routines that are purely local. */ #if __BSD_VISIBLE int asprintf(char **, const char *, ...) __printflike(2, 3); char *ctermid_r(char *); void fcloseall(void); int fdclose(FILE *, int *); char *fgetln(FILE *, size_t *); const char *fmtcheck(const char *, const char *) __format_arg(2); int fpurge(FILE *); void setbuffer(FILE *, char *, int); int setlinebuf(FILE *); int vasprintf(char **, const char *, __va_list) __printflike(2, 0); /* * The system error table contains messages for the first sys_nerr * positive errno values. Use strerror() or strerror_r() from * instead. */ extern const int sys_nerr; extern const char * const sys_errlist[]; /* * Stdio function-access interface. */ FILE *funopen(const void *, int (*)(void *, char *, int), int (*)(void *, const char *, int), fpos_t (*)(void *, fpos_t, int), int (*)(void *)); #define fropen(cookie, fn) funopen(cookie, fn, 0, 0, 0) #define fwopen(cookie, fn) funopen(cookie, 0, fn, 0, 0) /* * Portability hacks. See . */ #ifndef _FTRUNCATE_DECLARED #define _FTRUNCATE_DECLARED int ftruncate(int, __off_t); #endif # 437 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/stdio.h" #ifndef _LSEEK_DECLARED #define _LSEEK_DECLARED __off_t lseek(int, __off_t, int); #endif # 441 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/stdio.h" #ifndef _MMAP_DECLARED #define _MMAP_DECLARED void *mmap(void *, size_t, int, int, int, __off_t); #endif # 445 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/stdio.h" #ifndef _TRUNCATE_DECLARED #define _TRUNCATE_DECLARED int truncate(const char *, __off_t); #endif # 449 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/stdio.h" #endif /* __BSD_VISIBLE */ # 450 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/stdio.h" /* * Functions internal to the implementation. */ int __srget(FILE *); int __swbuf(int, FILE *); /* * The __sfoo macros are here so that we can * define function versions in the C library. */ #define __sgetc(p) (--(p)->_r < 0 ? __srget(p) : (int)(*(p)->_p++)) #if defined(__GNUC__) && defined(__STDC__) static __inline int __sputc(int _c, FILE *_p) { if (--_p->_w >= 0 || (_p->_w >= _p->_lbfsize && (char)_c != '\n')) return (*_p->_p++ = _c); else return (__swbuf(_c, _p)); } #else # 470 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/stdio.h" /* * This has been tuned to generate reasonable code on the vax using pcc. */ #define __sputc(c, p) \ (--(p)->_w < 0 ? \ (p)->_w >= (p)->_lbfsize ? \ (*(p)->_p = (c)), *(p)->_p != '\n' ? \ (int)*(p)->_p++ : \ __swbuf('\n', p) : \ __swbuf((int)(c), p) : \ (*(p)->_p = (c), (int)*(p)->_p++)) #endif # 482 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/stdio.h" extern int __isthreaded; #ifndef __cplusplus #define __sfeof(p) (((p)->_flags & __SEOF) != 0) #define __sferror(p) (((p)->_flags & __SERR) != 0) #define __sclearerr(p) ((void)((p)->_flags &= ~(__SERR|__SEOF))) #define __sfileno(p) ((p)->_file) #define feof(p) (!__isthreaded ? __sfeof(p) : (feof)(p)) #define ferror(p) (!__isthreaded ? __sferror(p) : (ferror)(p)) #define clearerr(p) (!__isthreaded ? __sclearerr(p) : (clearerr)(p)) #if __POSIX_VISIBLE #define fileno(p) (!__isthreaded ? __sfileno(p) : (fileno)(p)) #endif # 500 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/stdio.h" #define getc(fp) (!__isthreaded ? __sgetc(fp) : (getc)(fp)) #define putc(x, fp) (!__isthreaded ? __sputc(x, fp) : (putc)(x, fp)) #define getchar() getc(stdin) #define putchar(x) putc(x, stdout) #if __BSD_VISIBLE /* * See ISO/IEC 9945-1 ANSI/IEEE Std 1003.1 Second Edition 1996-07-12 * B.8.2.7 for the rationale behind the *_unlocked() macros. */ #define feof_unlocked(p) __sfeof(p) #define ferror_unlocked(p) __sferror(p) #define clearerr_unlocked(p) __sclearerr(p) #define fileno_unlocked(p) __sfileno(p) #endif # 517 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/stdio.h" #if __POSIX_VISIBLE >= 199506 #define getc_unlocked(fp) __sgetc(fp) #define putc_unlocked(x, fp) __sputc(x, fp) #define getchar_unlocked() getc_unlocked(stdin) #define putchar_unlocked(x) putc_unlocked(x, stdout) #endif # 524 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/stdio.h" #endif /* __cplusplus */ # 525 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/stdio.h" __END_DECLS #endif /* !_STDIO_H_ */ # 528 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/stdio.h" # 55 "/home/sson/src/cheribsd/lib/libc_cheri/../libmalloc_simple/malloc.c" 2 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 55 "/home/sson/src/cheribsd/lib/libc_cheri/../libmalloc_simple/malloc.c" # 1 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/stdlib.h" 1 /*- * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)stdlib.h 8.5 (Berkeley) 5/19/95 * $FreeBSD$ */ #ifndef _STDLIB_H_ #define _STDLIB_H_ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 36 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/stdlib.h" # 37 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/stdlib.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 37 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/stdlib.h" # 38 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/stdlib.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 38 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/stdlib.h" # 39 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/stdlib.h" #if __BSD_VISIBLE #ifndef _RUNE_T_DECLARED typedef __rune_t rune_t; #define _RUNE_T_DECLARED #endif # 45 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/stdlib.h" #endif # 46 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/stdlib.h" #ifndef _SIZE_T_DECLARED typedef __size_t size_t; #define _SIZE_T_DECLARED #endif # 51 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/stdlib.h" #ifndef __cplusplus #ifndef _WCHAR_T_DECLARED typedef ___wchar_t wchar_t; #define _WCHAR_T_DECLARED #endif # 57 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/stdlib.h" #endif # 58 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/stdlib.h" typedef struct { int quot; /* quotient */ int rem; /* remainder */ } div_t; typedef struct { long quot; long rem; } ldiv_t; #define EXIT_FAILURE 1 #define EXIT_SUCCESS 0 #define RAND_MAX 0x7ffffffd __BEGIN_DECLS #ifdef _XLOCALE_H_ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 76 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/stdlib.h" # 77 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/stdlib.h" #endif # 78 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/stdlib.h" extern int __mb_cur_max; extern int ___mb_cur_max(void); #define MB_CUR_MAX (___mb_cur_max()) _Noreturn void abort(void); int abs(int) __pure2; int atexit(void (*)(void)); double atof(const char *); int atoi(const char *); long atol(const char *); void *bsearch(const void *, const void *, size_t, size_t, int (*)(const void *, const void *)); void *calloc(size_t, size_t) __malloc_like __result_use_check __alloc_size(1) __alloc_size(2); div_t div(int, int) __pure2; _Noreturn void exit(int); void free(void *); char *getenv(const char *); long labs(long) __pure2; ldiv_t ldiv(long, long) __pure2; void *malloc(size_t) __malloc_like __result_use_check __alloc_size(1); int mblen(const char *, size_t); size_t mbstowcs(wchar_t * __restrict , const char * __restrict, size_t); int mbtowc(wchar_t * __restrict, const char * __restrict, size_t); void qsort(void *, size_t, size_t, int (*)(const void *, const void *)); int rand(void); void *realloc(void *, size_t) __result_use_check __alloc_size(2); void srand(unsigned); double strtod(const char * __restrict, char ** __restrict); float strtof(const char * __restrict, char ** __restrict); long strtol(const char * __restrict, char ** __restrict, int); long double strtold(const char * __restrict, char ** __restrict); unsigned long strtoul(const char * __restrict, char ** __restrict, int); int system(const char *); int wctomb(char *, wchar_t); size_t wcstombs(char * __restrict, const wchar_t * __restrict, size_t); /* * Functions added in C99 which we make conditionally available in the * BSD^C89 namespace if the compiler supports `long long'. * The #if test is more complicated than it ought to be because * __BSD_VISIBLE implies __ISO_C_VISIBLE == 1999 *even if* `long long' * is not supported in the compilation environment (which therefore means * that it can't really be ISO C99). * * (The only other extension made by C99 in thie header is _Exit().) */ #if __ISO_C_VISIBLE >= 1999 #ifdef __LONG_LONG_SUPPORTED /* LONGLONG */ typedef struct { long long quot; long long rem; } lldiv_t; /* LONGLONG */ long long atoll(const char *); /* LONGLONG */ long long llabs(long long) __pure2; /* LONGLONG */ lldiv_t lldiv(long long, long long) __pure2; /* LONGLONG */ long long strtoll(const char * __restrict, char ** __restrict, int); /* LONGLONG */ unsigned long long strtoull(const char * __restrict, char ** __restrict, int); #endif /* __LONG_LONG_SUPPORTED */ # 151 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/stdlib.h" _Noreturn void _Exit(int); #endif /* __ISO_C_VISIBLE >= 1999 */ # 154 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/stdlib.h" /* * If we're in a mode greater than C99, expose C11 functions. */ #if __ISO_C_VISIBLE >= 2011 || __cplusplus >= 201103L void * aligned_alloc(size_t, size_t) __malloc_like __alloc_align(1) __alloc_size(2); int at_quick_exit(void (*)(void)); _Noreturn void quick_exit(int); #endif /* __ISO_C_VISIBLE >= 2011 */ # 165 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/stdlib.h" /* * Extensions made by POSIX relative to C. */ #if __POSIX_VISIBLE >= 199506 || __XSI_VISIBLE char *realpath(const char * __restrict, char * __restrict); #endif # 171 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/stdlib.h" #if __POSIX_VISIBLE >= 199506 int rand_r(unsigned *); /* (TSF) */ #endif # 174 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/stdlib.h" #if __POSIX_VISIBLE >= 200112 int posix_memalign(void **, size_t, size_t) __nonnull(1) __alloc_align(2) __alloc_size(3); /* (ADV) */ int setenv(const char *, const char *, int); int unsetenv(const char *); #endif # 180 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/stdlib.h" #if __POSIX_VISIBLE >= 200809 || __XSI_VISIBLE int getsubopt(char **, char *const *, char **); #ifndef _MKDTEMP_DECLARED char *mkdtemp(char *); #define _MKDTEMP_DECLARED #endif # 187 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/stdlib.h" #ifndef _MKSTEMP_DECLARED int mkstemp(char *); #define _MKSTEMP_DECLARED #endif # 191 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/stdlib.h" #endif /* __POSIX_VISIBLE >= 200809 || __XSI_VISIBLE */ # 192 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/stdlib.h" /* * The only changes to the XSI namespace in revision 6 were the deletion * of the ttyslot() and valloc() functions, which FreeBSD never declared * in this header. For revision 7, ecvt(), fcvt(), and gcvt(), which * FreeBSD also does not have, and mktemp(), are to be deleted. */ #if __XSI_VISIBLE /* XXX XSI requires pollution from here. We'd rather not. */ long a64l(const char *); double drand48(void); /* char *ecvt(double, int, int * __restrict, int * __restrict); */ double erand48(unsigned short[3]); /* char *fcvt(double, int, int * __restrict, int * __restrict); */ /* char *gcvt(double, int, int * __restrict, int * __restrict); */ int grantpt(int); char *initstate(unsigned long /* XSI requires u_int */, char *, long); long jrand48(unsigned short[3]); char *l64a(long); void lcong48(unsigned short[7]); long lrand48(void); #if !defined(_MKTEMP_DECLARED) && (__BSD_VISIBLE || __XSI_VISIBLE <= 600) char *mktemp(char *); #define _MKTEMP_DECLARED #endif # 217 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/stdlib.h" long mrand48(void); long nrand48(unsigned short[3]); int posix_openpt(int); char *ptsname(int); int putenv(char *); long random(void); unsigned short *seed48(unsigned short[3]); #ifndef _SETKEY_DECLARED int setkey(const char *); #define _SETKEY_DECLARED #endif # 229 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/stdlib.h" char *setstate(/* const */ char *); void srand48(long); void srandom(unsigned long); int unlockpt(int); #endif /* __XSI_VISIBLE */ # 234 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/stdlib.h" #if __BSD_VISIBLE extern const char *malloc_conf; extern void (*malloc_message)(void *, const char *); /* * The alloca() function can't be implemented in C, and on some * platforms it can't be implemented at all as a callable function. * The GNU C compiler provides a built-in alloca() which we can use; * in all other cases, provide a prototype, mainly to pacify various * incarnations of lint. On platforms where alloca() is not in libc, * programs which use it will fail to link when compiled with non-GNU * compilers. */ #if __GNUC__ >= 2 || defined(__INTEL_COMPILER) #undef alloca /* some GNU bits try to get cute and define this on their own */ #define alloca(sz) __builtin_alloca(sz) #elif defined(lint) # 252 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/stdlib.h" void *alloca(size_t); #endif # 254 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/stdlib.h" void abort2(const char *, int, void **) __dead2; __uint32_t arc4random(void); void arc4random_addrandom(unsigned char *, int); void arc4random_buf(void *, size_t); void arc4random_stir(void); __uint32_t arc4random_uniform(__uint32_t); #ifdef __BLOCKS__ int atexit_b(void (^)(void)); void *bsearch_b(const void *, const void *, size_t, size_t, int (^)(const void *, const void *)); #endif # 268 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/stdlib.h" char *getbsize(int *, long *); /* getcap(3) functions */ char *cgetcap(char *, const char *, int); int cgetclose(void); int cgetent(char **, char **, const char *); int cgetfirst(char **, char **); int cgetmatch(const char *, const char *); int cgetnext(char **, char **); int cgetnum(char *, const char *, long *); int cgetset(const char *); int cgetstr(char *, const char *, char **); int cgetustr(char *, const char *, char **); int daemon(int, int); char *devname(__dev_t, __mode_t); char *devname_r(__dev_t, __mode_t, char *, int); char *fdevname(int); char *fdevname_r(int, char *, int); int getloadavg(double [], int); const char * getprogname(void); int heapsort(void *, size_t, size_t, int (*)(const void *, const void *)); #ifdef __BLOCKS__ int heapsort_b(void *, size_t, size_t, int (^)(const void *, const void *)); void qsort_b(void *, size_t, size_t, int (^)(const void *, const void *)); #endif # 296 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/stdlib.h" int l64a_r(long, char *, int); int mergesort(void *, size_t, size_t, int (*)(const void *, const void *)); #ifdef __BLOCKS__ int mergesort_b(void *, size_t, size_t, int (^)(const void *, const void *)); #endif # 301 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/stdlib.h" int mkostemp(char *, int); int mkostemps(char *, int, int); void qsort_r(void *, size_t, size_t, void *, int (*)(void *, const void *, const void *)); int radixsort(const unsigned char **, int, const unsigned char *, unsigned); void *reallocarray(void *, size_t, size_t) __result_use_check __alloc_size(2) __alloc_size(3); void *reallocf(void *, size_t) __alloc_size(2); int rpmatch(const char *); void setprogname(const char *); int sradixsort(const unsigned char **, int, const unsigned char *, unsigned); void sranddev(void); void srandomdev(void); long long strtonum(const char *, long long, long long, const char **); /* Deprecated interfaces, to be removed in FreeBSD 6.0. */ __int64_t strtoq(const char *, char **, int); __uint64_t strtouq(const char *, char **, int); #if __has_feature(capabilities) long strtol_c(__capability const char * __restrict, __capability char ** __restrict, int); long double strtold_c(__capability const char * __restrict, __capability char ** __restrict); #endif # 332 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/stdlib.h" extern char *suboptarg; /* getsubopt(3) external variable */ #endif /* __BSD_VISIBLE */ # 335 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/stdlib.h" __END_DECLS #endif /* !_STDLIB_H_ */ # 338 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/stdlib.h" # 56 "/home/sson/src/cheribsd/lib/libc_cheri/../libmalloc_simple/malloc.c" 2 #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 56 "/home/sson/src/cheribsd/lib/libc_cheri/../libmalloc_simple/malloc.c" # 1 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/string.h" 1 /*- * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)string.h 8.1 (Berkeley) 6/2/93 * $FreeBSD$ */ #ifndef _STRING_H_ #define _STRING_H_ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 36 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/string.h" # 37 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/string.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 37 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/string.h" # 38 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/string.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 38 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/string.h" # 39 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/string.h" /* * Prototype functions which were historically defined in , but * are required by POSIX to be prototyped in . */ #if __BSD_VISIBLE #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 45 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/string.h" # 1 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/strings.h" 1 /*- * Copyright (c) 2002 Mike Barcroft * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * $FreeBSD$ */ #ifndef _STRINGS_H_ #define _STRINGS_H_ #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 32 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/strings.h" # 33 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/strings.h" #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 33 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/strings.h" # 34 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/strings.h" #ifndef _SIZE_T_DECLARED typedef __size_t size_t; #define _SIZE_T_DECLARED #endif # 39 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/strings.h" __BEGIN_DECLS #if __BSD_VISIBLE || __POSIX_VISIBLE <= 200112 int bcmp(const void *, const void *, size_t) __pure; /* LEGACY */ void bcopy(const void *, void *, size_t); /* LEGACY */ void bzero(void *, size_t); /* LEGACY */ #endif # 46 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/strings.h" #if __BSD_VISIBLE void explicit_bzero(void *, size_t); #endif # 49 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/strings.h" #if __XSI_VISIBLE int ffs(int) __pure2; #endif # 52 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/strings.h" #if __BSD_VISIBLE int ffsl(long) __pure2; int ffsll(long long) __pure2; int fls(int) __pure2; int flsl(long) __pure2; int flsll(long long) __pure2; #endif # 59 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/strings.h" #if __BSD_VISIBLE || __POSIX_VISIBLE <= 200112 char *index(const char *, int) __pure; /* LEGACY */ char *rindex(const char *, int) __pure; /* LEGACY */ #endif # 63 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/strings.h" int strcasecmp(const char *, const char *) __pure; int strncasecmp(const char *, const char *, size_t) __pure; #if __POSIX_VISIBLE >= 200809 || defined(_XLOCALE_H_) #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 67 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/strings.h" # 1 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/xlocale/_strings.h" 1 /*- * Copyright (c) 2011, 2012 The FreeBSD Foundation * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * $FreeBSD$ */ #ifndef _LOCALE_T_DEFINED #define _LOCALE_T_DEFINED typedef struct _xlocale *locale_t; #endif # 33 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/xlocale/_strings.h" /* * This file is included from both strings.h and xlocale.h. We need to expose * the declarations unconditionally if we are included from xlocale.h, but only * if we are in POSIX2008 mode if included from string.h. */ #ifndef _XLOCALE_STRINGS1_H #define _XLOCALE_STRINGS1_H /* * POSIX2008 functions */ int strcasecmp_l(const char *, const char *, locale_t); int strncasecmp_l(const char *, const char *, size_t, locale_t); #endif /* _XLOCALE_STRINGS1_H */ # 49 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/xlocale/_strings.h" # 68 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/strings.h" 2 #endif # 69 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/strings.h" __END_DECLS #endif /* _STRINGS_H_ */ # 72 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/strings.h" # 46 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/string.h" 2 #endif # 47 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/string.h" #ifndef _SIZE_T_DECLARED typedef __size_t size_t; #define _SIZE_T_DECLARED #endif # 52 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/string.h" __BEGIN_DECLS #if __XSI_VISIBLE >= 600 void *memccpy(void * __restrict, const void * __restrict, int, size_t); #endif # 57 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/string.h" void *memchr(const void *, int, size_t) __pure; #if __BSD_VISIBLE void *memrchr(const void *, int, size_t) __pure; #endif # 61 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/string.h" int memcmp(const void *, const void *, size_t) __pure; void *memcpy(void * __restrict, const void * __restrict, size_t); #if __BSD_VISIBLE void *memmem(const void *, size_t, const void *, size_t) __pure; #endif # 66 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/string.h" void *memmove(void *, const void *, size_t); void *memset(void *, int, size_t); #if __POSIX_VISIBLE >= 200809 char *stpcpy(char * __restrict, const char * __restrict); char *stpncpy(char * __restrict, const char * __restrict, size_t); #endif # 72 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/string.h" #if __BSD_VISIBLE char *strcasestr(const char *, const char *) __pure; #endif # 75 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/string.h" char *strcat(char * __restrict, const char * __restrict); char *strchr(const char *, int) __pure; #if __BSD_VISIBLE char *strchrnul(const char*, int) __pure; #endif # 80 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/string.h" int strcmp(const char *, const char *) __pure; int strcoll(const char *, const char *); char *strcpy(char * __restrict, const char * __restrict); size_t strcspn(const char *, const char *) __pure; #if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE char *strdup(const char *) __malloc_like; #endif # 87 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/string.h" char *strerror(int); #if __POSIX_VISIBLE >= 200112 int strerror_r(int, char *, size_t); #endif # 91 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/string.h" #if __BSD_VISIBLE size_t strlcat(char * __restrict, const char * __restrict, size_t); size_t strlcpy(char * __restrict, const char * __restrict, size_t); #endif # 95 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/string.h" size_t strlen(const char *) __pure; #if __BSD_VISIBLE void strmode(int, char *); #endif # 99 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/string.h" char *strncat(char * __restrict, const char * __restrict, size_t); int strncmp(const char *, const char *, size_t) __pure; char *strncpy(char * __restrict, const char * __restrict, size_t); #if __POSIX_VISIBLE >= 200809 char *strndup(const char *, size_t) __malloc_like; size_t strnlen(const char *, size_t) __pure; #endif # 106 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/string.h" #if __BSD_VISIBLE char *strnstr(const char *, const char *, size_t) __pure; #endif # 109 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/string.h" char *strpbrk(const char *, const char *) __pure; char *strrchr(const char *, int) __pure; #if __BSD_VISIBLE char *strsep(char **, const char *); #endif # 114 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/string.h" #if __POSIX_VISIBLE >= 200809 char *strsignal(int); #endif # 117 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/string.h" size_t strspn(const char *, const char *) __pure; char *strstr(const char *, const char *) __pure; char *strtok(char * __restrict, const char * __restrict); #if __POSIX_VISIBLE >= 199506 || __XSI_VISIBLE >= 500 char *strtok_r(char *, const char *, char **); #endif # 123 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/string.h" size_t strxfrm(char * __restrict, const char * __restrict, size_t); #if __BSD_VISIBLE #ifndef _SWAB_DECLARED #define _SWAB_DECLARED #ifndef _SSIZE_T_DECLARED typedef __ssize_t ssize_t; #define _SSIZE_T_DECLARED #endif /* _SIZE_T_DECLARED */ # 133 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/string.h" void swab(const void * __restrict, void * __restrict, ssize_t); #endif /* _SWAB_DECLARED */ # 136 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/string.h" #if __has_feature(capabilities) __capability const void * memchr_c_const(__capability const void *, int, size_t) __pure; __capability void *memchr_c(__capability const void *, int, size_t) __pure; int memcmp_c(__capability const void *, __capability const void *, size_t) __pure; __capability void *memcpy_c(__capability void * __restrict, __capability const void * __restrict, size_t); void *memcpy_c_fromcap(void * __restrict, __capability const void * __restrict, size_t); __capability void *memcpy_c_tocap(__capability void * __restrict, const void * __restrict, size_t); __capability void *memmove_c(__capability void * __restrict, __capability const void * __restrict, size_t); __capability void *memset_c(__capability void *, int, size_t); __capability char *strchr_c(__capability const char *, int) __pure; int strcmp_c(__capability const char *, __capability const char *s2) __pure; __capability char *strcpy_c(__capability char * __restrict, __capability const char * __restrict); int strncmp_c(__capability const char *, __capability const char *, size_t) __pure; __capability char *strncpy_c(__capability char * __restrict, __capability const char * __restrict, size_t); char *strncpy_c_fromcap(char * __restrict, __capability const char * __restrict, size_t); __capability char *strncpy_c_tocap(__capability char * __restrict, const char * __restrict, size_t); size_t strnlen_c(__capability const char *, size_t) __pure; #endif # 177 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/string.h" #endif /* __BSD_VISIBLE */ # 179 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/string.h" #if __POSIX_VISIBLE >= 200809 || defined(_XLOCALE_H_) #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 181 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/string.h" # 1 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/xlocale/_string.h" 1 /*- * Copyright (c) 2011, 2012 The FreeBSD Foundation * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * $FreeBSD$ */ #ifndef _LOCALE_T_DEFINED #define _LOCALE_T_DEFINED typedef struct _xlocale *locale_t; #endif # 33 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/xlocale/_string.h" /* * This file is included from both string.h and xlocale.h. We need to expose * the declarations unconditionally if we are included from xlocale.h, but only * if we are in POSIX2008 mode if included from string.h. */ #ifndef _XLOCALE_STRING1_H #define _XLOCALE_STRING1_H /* * POSIX2008 functions */ int strcoll_l(const char *, const char *, locale_t); size_t strxfrm_l(char *, const char *, size_t, locale_t); #endif /* _XLOCALE_STRING1_H */ # 49 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/xlocale/_string.h" /* * xlocale extensions */ #ifdef _XLOCALE_H_ #ifndef _XLOCALE_STRING2_H #define _XLOCALE_STRING2_H char *strcasestr_l(const char *, const char *, locale_t); #endif /* _XLOCALE_STRING2_H */ # 59 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/xlocale/_string.h" #endif /* _XLOCALE_H_ */ # 60 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/xlocale/_string.h" # 182 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/string.h" 2 #endif # 183 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/string.h" __END_DECLS #endif /* _STRING_H_ */ # 186 "/home/sson/src/cheribsd/lib/libc_cheri/../../include/string.h" # 57 "/home/sson/src/cheribsd/lib/libc_cheri/../libmalloc_simple/malloc.c" 2 #if 0 /* expanded by -frewrite-includes */ #include "malloc_heap.h" #endif /* expanded by -frewrite-includes */ # 58 "/home/sson/src/cheribsd/lib/libc_cheri/../libmalloc_simple/malloc.c" # 1 "/home/sson/src/cheribsd/lib/libc_cheri/../libmalloc_simple/malloc_heap.h" 1 /*- * Copyright (c) 2015 SRI International * All rights reserved. * * This software was developed by SRI International and the University of * Cambridge Computer Laboratory under DARPA/AFRL contract FA8750-10-C-0237 * ("CTSRD"), as part of the DARPA CRASH research programme. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #ifndef __MALLOC_HEAP_H__ #define __MALLOC_HEAP_H__ extern caddr_t pagepool_start, pagepool_end; int __morepages(int n); void __init_heap(size_t pagesz); void *__rederive_pointer(void *ptr); #endif /* __MALLOC_HEAP_H__ */ # 41 "/home/sson/src/cheribsd/lib/libc_cheri/../libmalloc_simple/malloc_heap.h" # 59 "/home/sson/src/cheribsd/lib/libc_cheri/../libmalloc_simple/malloc.c" 2 union overhead; static void morecore(int); static void init_pagebucket(void); /* * The overhead on a block is one pointer. When free, this space * contains a pointer to the next free block. When in use, the first * byte is set to MAGIC, and the second byte is the size index. */ union overhead { union overhead *ov_next; /* when free */ struct { u_char ovu_magic; /* magic number */ u_char ovu_index; /* bucket # */ } ovu; #define ov_magic ovu.ovu_magic #define ov_index ovu.ovu_index #define ov_size ovu.ovu_size }; #define MAGIC 0xef /* magic # on accounting info */ /* * nextf[i] is the pointer to the next free block of size 2^(i+3). The * smallest allocatable block is 8 bytes. The overhead information * precedes the data area returned to the user. */ #define NBUCKETS 30 static union overhead *nextf[NBUCKETS]; static size_t pagesz; /* page size */ static int pagebucket; /* page size bucket */ #if defined(MALLOC_DEBUG) || defined(RCHECK) #define ASSERT(p) if (!(p)) botch("p") #if 0 /* expanded by -frewrite-includes */ #include #endif /* expanded by -frewrite-includes */ # 96 "/home/sson/src/cheribsd/lib/libc_cheri/../libmalloc_simple/malloc.c" # 97 "/home/sson/src/cheribsd/lib/libc_cheri/../libmalloc_simple/malloc.c" static void botch(char *s) { fprintf(stderr, "\r\nassertion botched: %s\r\n", s); (void) fflush(stderr); /* just in case user buffered it */ abort(); } #else # 105 "/home/sson/src/cheribsd/lib/libc_cheri/../libmalloc_simple/malloc.c" #define ASSERT(p) #endif # 107 "/home/sson/src/cheribsd/lib/libc_cheri/../libmalloc_simple/malloc.c" void * malloc(size_t nbytes) { union overhead *op; int bucket; size_t amt; /* * First time malloc is called, setup page size and * align break pointer so all data will be page aligned. */ if (pagesz == 0) { pagesz = PAGE_SIZE; init_pagebucket(); __init_heap(pagesz); } assert(pagesz != 0); /* * Convert amount of memory requested into closest block size * stored in hash buckets which satisfies request. * Account for space used per block for accounting. */ if (nbytes <= pagesz - sizeof (*op)) { amt = 32; /* size of first bucket */ bucket = 2; } else { amt = pagesz; bucket = pagebucket; } while (nbytes > (size_t)amt - sizeof(*op)) { amt <<= 1; if (amt == 0) return (NULL); bucket++; } /* * If nothing in hash bucket right now, * request more memory from the system. */ if ((op = nextf[bucket]) == NULL) { morecore(bucket); if ((op = nextf[bucket]) == NULL) return (NULL); } /* remove from linked list */ nextf[bucket] = op->ov_next; op->ov_magic = MAGIC; op->ov_index = bucket; return (cheri_csetbounds(op + 1, nbytes)); } void * calloc(size_t num, size_t size) { void *ret; if (size != 0 && (num * size) / size != num) { /* size_t overflow. */ return (NULL); } if ((ret = malloc(num * size)) != NULL) memset(ret, 0, num * size); return (ret); } /* * Allocate more memory to the indicated bucket. */ static void morecore(int bucket) { char *buf; union overhead *op; size_t sz; /* size of desired block */ int amt; /* amount to allocate */ int nblks; /* how many blocks we get */ /* * sbrk_size <= 0 only for big, FLUFFY, requests (about * 2^30 bytes on a VAX, I think) or for a negative arg. */ sz = 1 << (bucket + 3); #ifdef MALLOC_DEBUG ASSERT(sz > 0); #else # 195 "/home/sson/src/cheribsd/lib/libc_cheri/../libmalloc_simple/malloc.c" if (sz <= 0) return; #endif # 198 "/home/sson/src/cheribsd/lib/libc_cheri/../libmalloc_simple/malloc.c" if (sz < pagesz) { amt = pagesz; nblks = amt / sz; } else { amt = sz + pagesz; nblks = 1; } if (amt > pagepool_end - pagepool_start) if (__morepages(amt/pagesz) == 0) return; buf = cheri_csetbounds(pagepool_start, amt); pagepool_start += amt; /* * Add new memory allocated to that on * free list for this hash bucket. */ nextf[bucket] = op = cheri_csetbounds(buf, sz); while (--nblks > 0) { op->ov_next = (union overhead *)cheri_csetbounds(buf + sz, sz); buf += sz; op = op->ov_next; } } static union overhead * find_overhead(void * cp) { union overhead *op; if (!cheri_gettag(cp)) return (NULL); op = __rederive_pointer(cp); if (op == NULL) { printf("%s: no region found for %#p\n", __func__, cp); return (NULL); } op--; if (op->ov_magic == MAGIC) return (op); /* * XXX: the above will fail if the users calls free or realloc * with a pointer that has had CSetBounds applied to it. We * should save all allocation ranges to allow us to find the * metadata. */ printf("%s: Attempting to free or realloc unallocated memory\n", __func__); CHERI_PRINT_PTR(cp); return (NULL); } void free(void *cp) { int bucket; union overhead *op; if (cp == NULL) return; op = find_overhead(cp); if (op == NULL) return; bucket = op->ov_index; ASSERT(bucket < NBUCKETS); op->ov_next = nextf[bucket]; /* also clobbers ov_magic */ nextf[bucket] = op; } void * realloc(void *cp, size_t nbytes) { size_t cur_space; /* Space in the current bucket */ size_t smaller_space; /* Space in the next smaller bucket */ union overhead *op; char *res; if (cp == NULL) return (malloc(nbytes)); op = find_overhead(cp); if (op == NULL) return (NULL); cur_space = (1 << (op->ov_index + 3)) - sizeof(*op); /* avoid the copy if same size block */ /* * XXX-BD: Arguably we should be tracking the actual allocation * not just the bucket size so that we can do a full malloc+memcpy * when the caller has restricted the length of the pointer passed * realloc() but is growing the buffer within the current bucket. * * As it is, this code contains a leak where realloc recovers access * to the contents in foo: * char *foo = malloc(10); * strcpy(foo, "abcdefghi"); * cheri_csetbouds(foo, 5); * foo = realloc(foo, 10); */ smaller_space = (1 << (op->ov_index + 2)) - sizeof(*op); if (nbytes <= cur_space && nbytes > smaller_space) return (cheri_andperm(cheri_csetbounds(op + 1, nbytes), cheri_getperm(cp))); if ((res = malloc(nbytes)) == NULL) return (NULL); /* * Only copy data the caller had access to even if this is less * than the size of the original allocation. This risks surprise * for some programmers, but to do otherwise risks information leaks. */ memcpy(res, cp, (nbytes <= cheri_getlen(cp)) ? nbytes : cheri_getlen(cp)); res = cheri_andperm(res, cheri_getperm(cp)); free(cp); return (res); } static void init_pagebucket(void) { int bucket; size_t amt; bucket = 0; amt = 8; while ((unsigned)pagesz > amt) { amt <<= 1; bucket++; } pagebucket = bucket; }