· 9 years ago · Nov 23, 2016, 02:46 PM
1# 1 "<built-in>"
2# 1 "/home/alr48/cheri/sources/cheribsd/bin/cheritest/cheritest_registers.c"
3/*-
4 * Copyright (c) 2012-2016 Robert N. M. Watson
5 * Copyright (c) 2014 SRI International
6 * All rights reserved.
7 *
8 * This software was developed by SRI International and the University of
9 * Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237)
10 * ("CTSRD"), as part of the DARPA CRASH research programme.
11 *
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions
14 * are met:
15 * 1. Redistributions of source code must retain the above copyright
16 * notice, this list of conditions and the following disclaimer.
17 * 2. Redistributions in binary form must reproduce the above copyright
18 * notice, this list of conditions and the following disclaimer in the
19 * documentation and/or other materials provided with the distribution.
20 *
21 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
22 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 */
33
34#if 0 /* expanded by -frewrite-includes */
35#include <sys/cdefs.h>
36#endif /* expanded by -frewrite-includes */
37# 32 "/home/alr48/cheri/sources/cheribsd/bin/cheritest/cheritest_registers.c"
38# 1 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 1 3 4
39/*-
40 * Copyright (c) 1991, 1993
41 * The Regents of the University of California. All rights reserved.
42 *
43 * This code is derived from software contributed to Berkeley by
44 * Berkeley Software Design, Inc.
45 *
46 * Redistribution and use in source and binary forms, with or without
47 * modification, are permitted provided that the following conditions
48 * are met:
49 * 1. Redistributions of source code must retain the above copyright
50 * notice, this list of conditions and the following disclaimer.
51 * 2. Redistributions in binary form must reproduce the above copyright
52 * notice, this list of conditions and the following disclaimer in the
53 * documentation and/or other materials provided with the distribution.
54 * 4. Neither the name of the University nor the names of its contributors
55 * may be used to endorse or promote products derived from this software
56 * without specific prior written permission.
57 *
58 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
59 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
60 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
61 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
62 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
63 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
64 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
65 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
66 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
67 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
68 * SUCH DAMAGE.
69 *
70 * @(#)cdefs.h 8.8 (Berkeley) 1/9/95
71 * $FreeBSD$
72 */
73
74#ifndef _SYS_CDEFS_H_
75#define _SYS_CDEFS_H_
76
77/*
78 * Testing against Clang-specific extensions.
79 */
80#ifndef __has_attribute
81#define __has_attribute(x) 0
82#endif
83# 45 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
84#ifndef __has_extension
85#define __has_extension __has_feature
86#endif
87# 48 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
88#ifndef __has_feature
89#define __has_feature(x) 0
90#endif
91# 51 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
92#ifndef __has_include
93#define __has_include(x) 0
94#endif
95# 54 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
96#ifndef __has_builtin
97#define __has_builtin(x) 0
98#endif
99# 57 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
100
101#if defined(__cplusplus)
102#define __BEGIN_DECLS extern "C" {
103#define __END_DECLS }
104#else
105# 62 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
106#define __BEGIN_DECLS
107#define __END_DECLS
108#endif
109# 65 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
110
111/*
112 * This code has been put in place to help reduce the addition of
113 * compiler specific defines in FreeBSD code. It helps to aid in
114 * having a compiler-agnostic source tree.
115 */
116
117#if defined(__GNUC__) || defined(__INTEL_COMPILER)
118
119#if __GNUC__ >= 3 || defined(__INTEL_COMPILER)
120#define __GNUCLIKE_ASM 3
121#define __GNUCLIKE_MATH_BUILTIN_CONSTANTS
122#else
123# 78 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
124#define __GNUCLIKE_ASM 2
125#endif
126# 80 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
127#define __GNUCLIKE___TYPEOF 1
128#define __GNUCLIKE___OFFSETOF 1
129#define __GNUCLIKE___SECTION 1
130
131#ifndef __INTEL_COMPILER
132#define __GNUCLIKE_CTOR_SECTION_HANDLING 1
133#endif
134# 87 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
135
136#define __GNUCLIKE_BUILTIN_CONSTANT_P 1
137#if defined(__INTEL_COMPILER) && defined(__cplusplus) && \
138 __INTEL_COMPILER < 800
139#undef __GNUCLIKE_BUILTIN_CONSTANT_P
140#endif
141# 93 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
142
143#if (__GNUC_MINOR__ > 95 || __GNUC__ >= 3)
144#define __GNUCLIKE_BUILTIN_VARARGS 1
145#define __GNUCLIKE_BUILTIN_STDARG 1
146#define __GNUCLIKE_BUILTIN_VAALIST 1
147#endif
148# 99 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
149
150#if defined(__GNUC__)
151#define __GNUC_VA_LIST_COMPATIBILITY 1
152#endif
153# 103 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
154
155/*
156 * Compiler memory barriers, specific to gcc and clang.
157 */
158#if defined(__GNUC__)
159#define __compiler_membar() __asm __volatile(" " : : : "memory")
160#endif
161# 110 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
162
163#ifndef __INTEL_COMPILER
164#define __GNUCLIKE_BUILTIN_NEXT_ARG 1
165#define __GNUCLIKE_MATH_BUILTIN_RELOPS
166#endif
167# 115 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
168
169#define __GNUCLIKE_BUILTIN_MEMCPY 1
170
171/* XXX: if __GNUC__ >= 2: not tested everywhere originally, where replaced */
172#define __CC_SUPPORTS_INLINE 1
173#define __CC_SUPPORTS___INLINE 1
174#define __CC_SUPPORTS___INLINE__ 1
175
176#define __CC_SUPPORTS___FUNC__ 1
177#define __CC_SUPPORTS_WARNING 1
178
179#define __CC_SUPPORTS_VARADIC_XXX 1 /* see varargs.h */
180
181#define __CC_SUPPORTS_DYNAMIC_ARRAY_INIT 1
182
183#endif /* __GNUC__ || __INTEL_COMPILER */
184# 131 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
185
186/*
187 * Macro to test if we're using a specific version of gcc or later.
188 */
189#if defined(__GNUC__) && !defined(__INTEL_COMPILER)
190#define __GNUC_PREREQ__(ma, mi) \
191 (__GNUC__ > (ma) || __GNUC__ == (ma) && __GNUC_MINOR__ >= (mi))
192#else
193# 139 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
194#define __GNUC_PREREQ__(ma, mi) 0
195#endif
196# 141 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
197
198/*
199 * The __CONCAT macro is used to concatenate parts of symbol names, e.g.
200 * with "#define OLD(foo) __CONCAT(old,foo)", OLD(foo) produces oldfoo.
201 * The __CONCAT macro is a bit tricky to use if it must work in non-ANSI
202 * mode -- there must be no spaces between its arguments, and for nested
203 * __CONCAT's, all the __CONCAT's must be at the left. __CONCAT can also
204 * concatenate double-quoted strings produced by the __STRING macro, but
205 * this only works with ANSI C.
206 *
207 * __XSTRING is like __STRING, but it expands any macros in its argument
208 * first. It is only available with ANSI C.
209 */
210#if defined(__STDC__) || defined(__cplusplus)
211#define __P(protos) protos /* full-blown ANSI C */
212#define __CONCAT1(x,y) x ## y
213#define __CONCAT(x,y) __CONCAT1(x,y)
214#define __STRING(x) #x /* stringify without expanding x */
215#define __XSTRING(x) __STRING(x) /* expand x, then stringify */
216
217#define __const const /* define reserved names to standard */
218#define __signed signed
219#define __volatile volatile
220#if defined(__cplusplus)
221#define __inline inline /* convert to C++ keyword */
222#else
223# 167 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
224#if !(defined(__CC_SUPPORTS___INLINE))
225#define __inline /* delete GCC keyword */
226#endif /* ! __CC_SUPPORTS___INLINE */
227# 170 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
228#endif /* !__cplusplus */
229# 171 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
230
231#else /* !(__STDC__ || __cplusplus) */
232# 173 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
233#define __P(protos) () /* traditional C preprocessor */
234#define __CONCAT(x,y) x/**/y
235#define __STRING(x) "x"
236
237#if !defined(__CC_SUPPORTS___INLINE)
238#define __const /* delete pseudo-ANSI C keywords */
239#define __inline
240#define __signed
241#define __volatile
242/*
243 * In non-ANSI C environments, new programs will want ANSI-only C keywords
244 * deleted from the program and old programs will want them left alone.
245 * When using a compiler other than gcc, programs using the ANSI C keywords
246 * const, inline etc. as normal identifiers should define -DNO_ANSI_KEYWORDS.
247 * When using "gcc -traditional", we assume that this is the intent; if
248 * __GNUC__ is defined but __STDC__ is not, we leave the new keywords alone.
249 */
250#ifndef NO_ANSI_KEYWORDS
251#define const /* delete ANSI C keywords */
252#define inline
253#define signed
254#define volatile
255#endif /* !NO_ANSI_KEYWORDS */
256# 196 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
257#endif /* !__CC_SUPPORTS___INLINE */
258# 197 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
259#endif /* !(__STDC__ || __cplusplus) */
260# 198 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
261
262/*
263 * Compiler-dependent macros to help declare dead (non-returning) and
264 * pure (no side effects) functions, and unused variables. They are
265 * null except for versions of gcc that are known to support the features
266 * properly (old versions of gcc-2 supported the dead and pure features
267 * in a different (wrong) way). If we do not provide an implementation
268 * for a given compiler, let the compile fail if it is told to use
269 * a feature that we cannot live without.
270 */
271#ifdef lint
272#define __dead2
273#define __pure2
274#define __unused
275#define __packed
276#define __aligned(x)
277#define __alloc_align(x)
278#define __alloc_size(x)
279#define __section(x)
280#define __weak_symbol
281#else
282# 219 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
283#define __weak_symbol __attribute__((__weak__))
284#if !__GNUC_PREREQ__(2, 5) && !defined(__INTEL_COMPILER)
285#define __dead2
286#define __pure2
287#define __unused
288#endif
289# 225 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
290#if __GNUC__ == 2 && __GNUC_MINOR__ >= 5 && __GNUC_MINOR__ < 7 && !defined(__INTEL_COMPILER)
291#define __dead2 __attribute__((__noreturn__))
292#define __pure2 __attribute__((__const__))
293#define __unused
294/* XXX Find out what to do for __packed, __aligned and __section */
295#endif
296# 231 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
297#if __GNUC_PREREQ__(2, 7) || defined(__INTEL_COMPILER)
298#define __dead2 __attribute__((__noreturn__))
299#define __pure2 __attribute__((__const__))
300#define __unused __attribute__((__unused__))
301#define __used __attribute__((__used__))
302#define __packed __attribute__((__packed__))
303#define __aligned(x) __attribute__((__aligned__(x)))
304#define __section(x) __attribute__((__section__(x)))
305#endif
306# 240 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
307#if __GNUC_PREREQ__(4, 3) || __has_attribute(__alloc_size__)
308#define __alloc_size(x) __attribute__((__alloc_size__(x)))
309#else
310# 243 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
311#define __alloc_size(x)
312#endif
313# 245 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
314#if __GNUC_PREREQ__(4, 9) || __has_attribute(__alloc_align__)
315#define __alloc_align(x) __attribute__((__alloc_align__(x)))
316#else
317# 248 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
318#define __alloc_align(x)
319#endif
320# 250 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
321#endif /* lint */
322# 251 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
323
324#if !__GNUC_PREREQ__(2, 95)
325#define __alignof(x) __offsetof(struct { char __a; x __b; }, __b)
326#endif
327# 255 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
328
329/*
330 * Keywords added in C11.
331 */
332
333#if !defined(__STDC_VERSION__) || __STDC_VERSION__ < 201112L || defined(lint)
334
335#if !__has_extension(c_alignas)
336#if (defined(__cplusplus) && __cplusplus >= 201103L) || \
337 __has_extension(cxx_alignas)
338#define _Alignas(x) alignas(x)
339#else
340# 267 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
341/* XXX: Only emulates _Alignas(constant-expression); not _Alignas(type-name). */
342#define _Alignas(x) __aligned(x)
343#endif
344# 270 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
345#endif
346# 271 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
347
348#if defined(__cplusplus) && __cplusplus >= 201103L
349#define _Alignof(x) alignof(x)
350#else
351# 275 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
352#define _Alignof(x) __alignof(x)
353#endif
354# 277 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
355
356#if !defined(__cplusplus) && !__has_extension(c_atomic) && \
357 !__has_extension(cxx_atomic)
358/*
359 * No native support for _Atomic(). Place object in structure to prevent
360 * most forms of direct non-atomic access.
361 */
362#define _Atomic(T) struct { T volatile __val; }
363#endif
364# 286 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
365
366#if defined(__cplusplus) && __cplusplus >= 201103L
367#define _Noreturn [[noreturn]]
368#else
369# 290 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
370#define _Noreturn __dead2
371#endif
372# 292 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
373
374#if !__has_extension(c_static_assert)
375#if (defined(__cplusplus) && __cplusplus >= 201103L) || \
376 __has_extension(cxx_static_assert)
377#define _Static_assert(x, y) static_assert(x, y)
378#elif __GNUC_PREREQ__(4,6)
379# 298 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
380/* Nothing, gcc 4.6 and higher has _Static_assert built-in */
381#elif defined(__COUNTER__)
382# 300 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
383#define _Static_assert(x, y) __Static_assert(x, __COUNTER__)
384#define __Static_assert(x, y) ___Static_assert(x, y)
385#define ___Static_assert(x, y) typedef char __assert_ ## y[(x) ? 1 : -1] \
386 __unused
387#else
388# 305 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
389#define _Static_assert(x, y) struct __hack
390#endif
391# 307 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
392#endif
393# 308 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
394
395#if !__has_extension(c_thread_local)
396/*
397 * XXX: Some compilers (Clang 3.3, GCC 4.7) falsely announce C++11 mode
398 * without actually supporting the thread_local keyword. Don't check for
399 * the presence of C++11 when defining _Thread_local.
400 */
401#if /* (defined(__cplusplus) && __cplusplus >= 201103L) || */ \
402 __has_extension(cxx_thread_local)
403#define _Thread_local thread_local
404#else
405# 319 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
406#define _Thread_local __thread
407#endif
408# 321 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
409#endif
410# 322 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
411
412#endif /* __STDC_VERSION__ || __STDC_VERSION__ < 201112L */
413# 324 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
414
415/*
416 * Emulation of C11 _Generic(). Unlike the previously defined C11
417 * keywords, it is not possible to implement this using exactly the same
418 * syntax. Therefore implement something similar under the name
419 * __generic(). Unlike _Generic(), this macro can only distinguish
420 * between a single type, so it requires nested invocations to
421 * distinguish multiple cases.
422 */
423
424#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) || \
425 __has_extension(c_generic_selections)
426#define __generic(expr, t, yes, no) \
427 _Generic(expr, t: yes, default: no)
428#elif __GNUC_PREREQ__(3, 1) && !defined(__cplusplus)
429# 339 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
430#define __generic(expr, t, yes, no) \
431 __builtin_choose_expr( \
432 __builtin_types_compatible_p(__typeof(expr), t), yes, no)
433#endif
434# 343 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
435
436/*
437 * C99 Static array indices in function parameter declarations. Syntax such as:
438 * void bar(int myArray[static 10]);
439 * is allowed in C99 but not in C++. Define __min_size appropriately so
440 * headers using it can be compiled in either language. Use like this:
441 * void bar(int myArray[__min_size(10)]);
442 */
443#if !defined(__cplusplus) && \
444 (!defined(__STDC_VERSION) || (__STDC_VERSION__ >= 199901))
445#define __min_size(x) static (x)
446#else
447# 355 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
448#define __min_size(x) (x)
449#endif
450# 357 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
451
452#if __GNUC_PREREQ__(2, 96)
453#define __malloc_like __attribute__((__malloc__))
454#define __pure __attribute__((__pure__))
455#else
456# 362 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
457#define __malloc_like
458#define __pure
459#endif
460# 365 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
461
462#if __GNUC_PREREQ__(3, 1) || (defined(__INTEL_COMPILER) && __INTEL_COMPILER >= 800)
463#define __always_inline __attribute__((__always_inline__))
464#else
465# 369 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
466#define __always_inline
467#endif
468# 371 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
469
470#if __GNUC_PREREQ__(3, 1)
471#define __noinline __attribute__ ((__noinline__))
472#else
473# 375 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
474#define __noinline
475#endif
476# 377 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
477
478#if __GNUC_PREREQ__(3, 3)
479#define __nonnull(x) __attribute__((__nonnull__(x)))
480#define __nonnull_all __attribute__((__nonnull__))
481#else
482# 382 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
483#define __nonnull(x)
484#define __nonnull_all
485#endif
486# 385 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
487
488#if __GNUC_PREREQ__(3, 4)
489#define __fastcall __attribute__((__fastcall__))
490#define __result_use_check __attribute__((__warn_unused_result__))
491#else
492# 390 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
493#define __fastcall
494#define __result_use_check
495#endif
496# 393 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
497
498#if __GNUC_PREREQ__(4, 1)
499#define __returns_twice __attribute__((__returns_twice__))
500#else
501# 397 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
502#define __returns_twice
503#endif
504# 399 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
505
506#if __GNUC_PREREQ__(4, 6) || __has_builtin(__builtin_unreachable)
507#define __unreachable() __builtin_unreachable()
508#else
509# 403 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
510#define __unreachable() ((void)0)
511#endif
512# 405 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
513
514/* XXX: should use `#if __STDC_VERSION__ < 199901'. */
515#if !__GNUC_PREREQ__(2, 7) && !defined(__INTEL_COMPILER)
516#define __func__ NULL
517#endif
518# 410 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
519
520#if (defined(__INTEL_COMPILER) || (defined(__GNUC__) && __GNUC__ >= 2)) && !defined(__STRICT_ANSI__) || __STDC_VERSION__ >= 199901
521#define __LONG_LONG_SUPPORTED
522#endif
523# 414 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
524
525/* C++11 exposes a load of C99 stuff */
526#if defined(__cplusplus) && __cplusplus >= 201103L
527#define __LONG_LONG_SUPPORTED
528#ifndef __STDC_LIMIT_MACROS
529#define __STDC_LIMIT_MACROS
530#endif
531# 421 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
532#ifndef __STDC_CONSTANT_MACROS
533#define __STDC_CONSTANT_MACROS
534#endif
535# 424 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
536#endif
537# 425 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
538
539/*
540 * GCC 2.95 provides `__restrict' as an extension to C90 to support the
541 * C99-specific `restrict' type qualifier. We happen to use `__restrict' as
542 * a way to define the `restrict' type qualifier without disturbing older
543 * software that is unaware of C99 keywords.
544 */
545#if !(__GNUC__ == 2 && __GNUC_MINOR__ == 95)
546#if !defined(__STDC_VERSION__) || __STDC_VERSION__ < 199901 || defined(lint)
547#define __restrict
548#else
549# 436 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
550#define __restrict restrict
551#endif
552# 438 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
553#endif
554# 439 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
555
556/*
557 * GNU C version 2.96 adds explicit branch prediction so that
558 * the CPU back-end can hint the processor and also so that
559 * code blocks can be reordered such that the predicted path
560 * sees a more linear flow, thus improving cache behavior, etc.
561 *
562 * The following two macros provide us with a way to utilize this
563 * compiler feature. Use __predict_true() if you expect the expression
564 * to evaluate to true, and __predict_false() if you expect the
565 * expression to evaluate to false.
566 *
567 * A few notes about usage:
568 *
569 * * Generally, __predict_false() error condition checks (unless
570 * you have some _strong_ reason to do otherwise, in which case
571 * document it), and/or __predict_true() `no-error' condition
572 * checks, assuming you want to optimize for the no-error case.
573 *
574 * * Other than that, if you don't know the likelihood of a test
575 * succeeding from empirical or other `hard' evidence, don't
576 * make predictions.
577 *
578 * * These are meant to be used in places that are run `a lot'.
579 * It is wasteful to make predictions in code that is run
580 * seldomly (e.g. at subsystem initialization time) as the
581 * basic block reordering that this affects can often generate
582 * larger code.
583 */
584#if __GNUC_PREREQ__(2, 96)
585#define __predict_true(exp) __builtin_expect((exp), 1)
586#define __predict_false(exp) __builtin_expect((exp), 0)
587#else
588# 472 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
589#define __predict_true(exp) (exp)
590#define __predict_false(exp) (exp)
591#endif
592# 475 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
593
594#if __GNUC_PREREQ__(4, 0)
595#define __null_sentinel __attribute__((__sentinel__))
596#define __exported __attribute__((__visibility__("default")))
597#define __hidden __attribute__((__visibility__("hidden")))
598#else
599# 481 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
600#define __null_sentinel
601#define __exported
602#define __hidden
603#endif
604# 485 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
605
606/*
607 * We define this here since <stddef.h>, <sys/queue.h>, and <sys/types.h>
608 * require it.
609 */
610#if __GNUC_PREREQ__(4, 1)
611#define __offsetof(type, field) __builtin_offsetof(type, field)
612#else
613# 493 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
614#ifndef __cplusplus
615#define __offsetof(type, field) \
616 ((__size_t)(__uintptr_t)((const volatile void *)&((type *)0)->field))
617#else
618# 497 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
619#define __offsetof(type, field) \
620 (__offsetof__ (reinterpret_cast <__size_t> \
621 (&reinterpret_cast <const volatile char &> \
622 (static_cast<type *> (0)->field))))
623#endif
624# 502 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
625#endif
626# 503 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
627#define __rangeof(type, start, end) \
628 (__offsetof(type, end) - __offsetof(type, start))
629
630/*
631 * Given the pointer x to the member m of the struct s, return
632 * a pointer to the containing structure. When using GCC, we first
633 * assign pointer x to a local variable, to check that its type is
634 * compatible with member m.
635 */
636#if __GNUC_PREREQ__(3, 1)
637#define __containerof(x, s, m) ({ \
638 const volatile __typeof(((s *)0)->m) *__x = (x); \
639 __DEQUALIFY(s *, (const volatile char *)__x - __offsetof(s, m));\
640})
641#else
642# 518 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
643#define __containerof(x, s, m) \
644 __DEQUALIFY(s *, (const volatile char *)(x) - __offsetof(s, m))
645#endif
646# 521 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
647
648/*
649 * Compiler-dependent macros to declare that functions take printf-like
650 * or scanf-like arguments. They are null except for versions of gcc
651 * that are known to support the features properly (old versions of gcc-2
652 * didn't permit keeping the keywords out of the application namespace).
653 */
654#if !__GNUC_PREREQ__(2, 7) && !defined(__INTEL_COMPILER)
655#define __printflike(fmtarg, firstvararg)
656#define __scanflike(fmtarg, firstvararg)
657#define __format_arg(fmtarg)
658#define __strfmonlike(fmtarg, firstvararg)
659#define __strftimelike(fmtarg, firstvararg)
660#else
661# 535 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
662#define __printflike(fmtarg, firstvararg) \
663 __attribute__((__format__ (__printf__, fmtarg, firstvararg)))
664#define __scanflike(fmtarg, firstvararg) \
665 __attribute__((__format__ (__scanf__, fmtarg, firstvararg)))
666#define __format_arg(fmtarg) __attribute__((__format_arg__ (fmtarg)))
667#define __strfmonlike(fmtarg, firstvararg) \
668 __attribute__((__format__ (__strfmon__, fmtarg, firstvararg)))
669#define __strftimelike(fmtarg, firstvararg) \
670 __attribute__((__format__ (__strftime__, fmtarg, firstvararg)))
671#endif
672# 545 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
673
674/*
675 * FORTIFY_SOURCE, and perhaps other compiler-specific features, require
676 * the use of non-standard inlining. In general we should try to avoid
677 * using these but GCC-compatible compilers tend to support the extensions
678 * well enough to use them in limited cases.
679 */
680#if defined(__GNUC_GNU_INLINE__) || defined(__GNUC_STDC_INLINE__)
681#if __GNUC_PREREQ__(4, 3) || __has_attribute(__artificial__)
682#define __gnu_inline __attribute__((__gnu_inline__, __artificial__))
683#else
684# 556 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
685#define __gnu_inline __attribute__((__gnu_inline__))
686#endif /* artificial */
687# 558 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
688#else
689# 559 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
690#define __gnu_inline
691#endif
692# 561 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
693
694/* Compiler-dependent macros that rely on FreeBSD-specific extensions. */
695#if defined(__FreeBSD_cc_version) && __FreeBSD_cc_version >= 300001 && \
696 defined(__GNUC__) && !defined(__INTEL_COMPILER)
697#define __printf0like(fmtarg, firstvararg) \
698 __attribute__((__format__ (__printf0__, fmtarg, firstvararg)))
699#else
700# 568 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
701#define __printf0like(fmtarg, firstvararg)
702#endif
703# 570 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
704
705#if defined(__GNUC__) || defined(__INTEL_COMPILER)
706#ifndef __INTEL_COMPILER
707#define __strong_reference(sym,aliassym) \
708 extern __typeof (sym) aliassym __attribute__ ((__alias__ (#sym)))
709#endif
710# 576 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
711#ifdef __STDC__
712#define __weak_reference(sym,alias) \
713 __asm__(".weak " #alias); \
714 __asm__(".equ " #alias ", " #sym)
715#define __warn_references(sym,msg) \
716 __asm__(".section .gnu.warning." #sym); \
717 __asm__(".asciz \"" msg "\""); \
718 __asm__(".previous")
719#define __sym_compat(sym,impl,verid) \
720 __asm__(".symver " #impl ", " #sym "@" #verid)
721#define __sym_default(sym,impl,verid) \
722 __asm__(".symver " #impl ", " #sym "@@" #verid)
723#else
724# 589 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
725#define __weak_reference(sym,alias) \
726 __asm__(".weak alias"); \
727 __asm__(".equ alias, sym")
728#define __warn_references(sym,msg) \
729 __asm__(".section .gnu.warning.sym"); \
730 __asm__(".asciz \"msg\""); \
731 __asm__(".previous")
732#define __sym_compat(sym,impl,verid) \
733 __asm__(".symver impl, sym@verid")
734#define __sym_default(impl,sym,verid) \
735 __asm__(".symver impl, sym@@verid")
736#endif /* __STDC__ */
737# 601 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
738#endif /* __GNUC__ || __INTEL_COMPILER */
739# 602 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
740
741#define __GLOBL1(sym) __asm__(".globl " #sym)
742#define __GLOBL(sym) __GLOBL1(sym)
743
744#if defined(__GNUC__) || defined(__INTEL_COMPILER)
745#define __IDSTRING(name,string) __asm__(".ident\t\"" string "\"")
746#else
747# 609 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
748/*
749 * The following definition might not work well if used in header files,
750 * but it should be better than nothing. If you want a "do nothing"
751 * version, then it should generate some harmless declaration, such as:
752 * #define __IDSTRING(name,string) struct __hack
753 */
754#define __IDSTRING(name,string) static const char name[] __unused = string
755#endif
756# 617 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
757
758/*
759 * Embed the rcs id of a source file in the resulting library. Note that in
760 * more recent ELF binutils, we use .ident allowing the ID to be stripped.
761 * Usage:
762 * __FBSDID("$FreeBSD$");
763 */
764#ifndef __FBSDID
765#if !defined(lint) && !defined(STRIP_FBSDID)
766#define __FBSDID(s) __IDSTRING(__CONCAT(__rcsid_,__LINE__),s)
767#else
768# 628 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
769#define __FBSDID(s) struct __hack
770#endif
771# 630 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
772#endif
773# 631 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
774
775#ifndef __RCSID
776#ifndef NO__RCSID
777#define __RCSID(s) __IDSTRING(__CONCAT(__rcsid_,__LINE__),s)
778#else
779# 636 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
780#define __RCSID(s) struct __hack
781#endif
782# 638 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
783#endif
784# 639 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
785
786#ifndef __RCSID_SOURCE
787#ifndef NO__RCSID_SOURCE
788#define __RCSID_SOURCE(s) __IDSTRING(__CONCAT(__rcsid_source_,__LINE__),s)
789#else
790# 644 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
791#define __RCSID_SOURCE(s) struct __hack
792#endif
793# 646 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
794#endif
795# 647 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
796
797#ifndef __SCCSID
798#ifndef NO__SCCSID
799#define __SCCSID(s) __IDSTRING(__CONCAT(__sccsid_,__LINE__),s)
800#else
801# 652 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
802#define __SCCSID(s) struct __hack
803#endif
804# 654 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
805#endif
806# 655 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
807
808#ifndef __COPYRIGHT
809#ifndef NO__COPYRIGHT
810#define __COPYRIGHT(s) __IDSTRING(__CONCAT(__copyright_,__LINE__),s)
811#else
812# 660 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
813#define __COPYRIGHT(s) struct __hack
814#endif
815# 662 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
816#endif
817# 663 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
818
819#ifndef __DECONST
820#if !__has_feature(capabilities)
821#define __DECONST(type, var) ((type)(__uintptr_t)(const void *)(var))
822#else
823# 668 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
824#define __DECONST(type, var) ((type)(__intcap_t)(__capability const void *)(var))
825#endif
826# 670 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
827#endif
828# 671 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
829
830#ifndef __DEVOLATILE
831#if !__has_feature(capabilities)
832#define __DEVOLATILE(type, var) ((type)(__uintptr_t)(volatile void *)(var))
833#else
834# 676 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
835#define __DEVOLATILE(type, var) ((type)(__intcap_t)(__capability volatile void *)(var))
836#endif
837# 678 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
838#endif
839# 679 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
840
841#ifndef __DEQUALIFY
842#if !__has_feature(capabilities)
843#define __DEQUALIFY(type, var) ((type)(__uintptr_t)(const volatile void *)(var))
844#else
845# 684 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
846#define __DEQUALIFY(type, var) ((type)(__intcap_t)(__capability const volatile void *)(var))
847#endif
848# 686 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
849#endif
850# 687 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
851
852/*-
853 * The following definitions are an extension of the behavior originally
854 * implemented in <sys/_posix.h>, but with a different level of granularity.
855 * POSIX.1 requires that the macros we test be defined before any standard
856 * header file is included.
857 *
858 * Here's a quick run-down of the versions:
859 * defined(_POSIX_SOURCE) 1003.1-1988
860 * _POSIX_C_SOURCE == 1 1003.1-1990
861 * _POSIX_C_SOURCE == 2 1003.2-1992 C Language Binding Option
862 * _POSIX_C_SOURCE == 199309 1003.1b-1993
863 * _POSIX_C_SOURCE == 199506 1003.1c-1995, 1003.1i-1995,
864 * and the omnibus ISO/IEC 9945-1: 1996
865 * _POSIX_C_SOURCE == 200112 1003.1-2001
866 * _POSIX_C_SOURCE == 200809 1003.1-2008
867 *
868 * In addition, the X/Open Portability Guide, which is now the Single UNIX
869 * Specification, defines a feature-test macro which indicates the version of
870 * that specification, and which subsumes _POSIX_C_SOURCE.
871 *
872 * Our macros begin with two underscores to avoid namespace screwage.
873 */
874
875/* Deal with IEEE Std. 1003.1-1990, in which _POSIX_C_SOURCE == 1. */
876#if defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE == 1
877#undef _POSIX_C_SOURCE /* Probably illegal, but beyond caring now. */
878#define _POSIX_C_SOURCE 199009
879#endif
880# 716 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
881
882/* Deal with IEEE Std. 1003.2-1992, in which _POSIX_C_SOURCE == 2. */
883#if defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE == 2
884#undef _POSIX_C_SOURCE
885#define _POSIX_C_SOURCE 199209
886#endif
887# 722 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
888
889/* Deal with various X/Open Portability Guides and Single UNIX Spec. */
890#ifdef _XOPEN_SOURCE
891#if _XOPEN_SOURCE - 0 >= 700
892#define __XSI_VISIBLE 700
893#undef _POSIX_C_SOURCE
894#define _POSIX_C_SOURCE 200809
895#elif _XOPEN_SOURCE - 0 >= 600
896# 730 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
897#define __XSI_VISIBLE 600
898#undef _POSIX_C_SOURCE
899#define _POSIX_C_SOURCE 200112
900#elif _XOPEN_SOURCE - 0 >= 500
901# 734 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
902#define __XSI_VISIBLE 500
903#undef _POSIX_C_SOURCE
904#define _POSIX_C_SOURCE 199506
905#endif
906# 738 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
907#endif
908# 739 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
909
910/*
911 * Deal with all versions of POSIX. The ordering relative to the tests above is
912 * important.
913 */
914#if defined(_POSIX_SOURCE) && !defined(_POSIX_C_SOURCE)
915#define _POSIX_C_SOURCE 198808
916#endif
917# 747 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
918#ifdef _POSIX_C_SOURCE
919#if _POSIX_C_SOURCE >= 200809
920#define __POSIX_VISIBLE 200809
921#define __ISO_C_VISIBLE 1999
922#elif _POSIX_C_SOURCE >= 200112
923# 752 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
924#define __POSIX_VISIBLE 200112
925#define __ISO_C_VISIBLE 1999
926#elif _POSIX_C_SOURCE >= 199506
927# 755 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
928#define __POSIX_VISIBLE 199506
929#define __ISO_C_VISIBLE 1990
930#elif _POSIX_C_SOURCE >= 199309
931# 758 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
932#define __POSIX_VISIBLE 199309
933#define __ISO_C_VISIBLE 1990
934#elif _POSIX_C_SOURCE >= 199209
935# 761 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
936#define __POSIX_VISIBLE 199209
937#define __ISO_C_VISIBLE 1990
938#elif _POSIX_C_SOURCE >= 199009
939# 764 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
940#define __POSIX_VISIBLE 199009
941#define __ISO_C_VISIBLE 1990
942#else
943# 767 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
944#define __POSIX_VISIBLE 198808
945#define __ISO_C_VISIBLE 0
946#endif /* _POSIX_C_SOURCE */
947# 770 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
948#else
949# 771 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
950/*-
951 * Deal with _ANSI_SOURCE:
952 * If it is defined, and no other compilation environment is explicitly
953 * requested, then define our internal feature-test macros to zero. This
954 * makes no difference to the preprocessor (undefined symbols in preprocessing
955 * expressions are defined to have value zero), but makes it more convenient for
956 * a test program to print out the values.
957 *
958 * If a program mistakenly defines _ANSI_SOURCE and some other macro such as
959 * _POSIX_C_SOURCE, we will assume that it wants the broader compilation
960 * environment (and in fact we will never get here).
961 */
962#if defined(_ANSI_SOURCE) /* Hide almost everything. */
963#define __POSIX_VISIBLE 0
964#define __XSI_VISIBLE 0
965#define __BSD_VISIBLE 0
966#define __ISO_C_VISIBLE 1990
967#elif defined(_C99_SOURCE) /* Localism to specify strict C99 env. */
968# 789 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
969#define __POSIX_VISIBLE 0
970#define __XSI_VISIBLE 0
971#define __BSD_VISIBLE 0
972#define __ISO_C_VISIBLE 1999
973#elif defined(_C11_SOURCE) /* Localism to specify strict C11 env. */
974# 794 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
975#define __POSIX_VISIBLE 0
976#define __XSI_VISIBLE 0
977#define __BSD_VISIBLE 0
978#define __ISO_C_VISIBLE 2011
979#else /* Default environment: show everything. */
980# 799 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
981#define __POSIX_VISIBLE 200809
982#define __XSI_VISIBLE 700
983#define __BSD_VISIBLE 1
984#define __ISO_C_VISIBLE 2011
985#endif
986# 804 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
987#endif
988# 805 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
989
990#if defined(__mips) || defined(__powerpc64__) || defined(__riscv__)
991#define __NO_TLS 1
992#endif
993# 809 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
994
995/*
996 * Old versions of GCC use non-standard ARM arch symbols; acle-compat.h
997 * translates them to __ARM_ARCH and the modern feature symbols defined by ARM.
998 */
999#if defined(__arm__) && !defined(__ARM_ARCH)
1000#if 0 /* expanded by -frewrite-includes */
1001#include <machine/acle-compat.h>
1002#endif /* expanded by -frewrite-includes */
1003# 815 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
1004# 816 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
1005#endif
1006# 817 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
1007
1008/*
1009 * Type Safety Checking
1010 *
1011 * Clang provides additional attributes to enable checking type safety
1012 * properties that cannot be enforced by the C type system.
1013 */
1014
1015#if __has_attribute(__argument_with_type_tag__) && \
1016 __has_attribute(__type_tag_for_datatype__) && !defined(lint)
1017#define __arg_type_tag(arg_kind, arg_idx, type_tag_idx) \
1018 __attribute__((__argument_with_type_tag__(arg_kind, arg_idx, type_tag_idx)))
1019#define __datatype_type_tag(kind, type) \
1020 __attribute__((__type_tag_for_datatype__(kind, type)))
1021#else
1022# 832 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
1023#define __arg_type_tag(arg_kind, arg_idx, type_tag_idx)
1024#define __datatype_type_tag(kind, type)
1025#endif
1026# 835 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
1027
1028/*
1029 * Lock annotations.
1030 *
1031 * Clang provides support for doing basic thread-safety tests at
1032 * compile-time, by marking which locks will/should be held when
1033 * entering/leaving a functions.
1034 *
1035 * Furthermore, it is also possible to annotate variables and structure
1036 * members to enforce that they are only accessed when certain locks are
1037 * held.
1038 */
1039
1040#if __has_extension(c_thread_safety_attributes)
1041#define __lock_annotate(x) __attribute__((x))
1042#else
1043# 851 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
1044#define __lock_annotate(x)
1045#endif
1046# 853 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
1047
1048/* Structure implements a lock. */
1049#define __lockable __lock_annotate(lockable)
1050
1051/* Function acquires an exclusive or shared lock. */
1052#define __locks_exclusive(...) \
1053 __lock_annotate(exclusive_lock_function(__VA_ARGS__))
1054#define __locks_shared(...) \
1055 __lock_annotate(shared_lock_function(__VA_ARGS__))
1056
1057/* Function attempts to acquire an exclusive or shared lock. */
1058#define __trylocks_exclusive(...) \
1059 __lock_annotate(exclusive_trylock_function(__VA_ARGS__))
1060#define __trylocks_shared(...) \
1061 __lock_annotate(shared_trylock_function(__VA_ARGS__))
1062
1063/* Function releases a lock. */
1064#define __unlocks(...) __lock_annotate(unlock_function(__VA_ARGS__))
1065
1066/* Function asserts that an exclusive or shared lock is held. */
1067#define __asserts_exclusive(...) \
1068 __lock_annotate(assert_exclusive_lock(__VA_ARGS__))
1069#define __asserts_shared(...) \
1070 __lock_annotate(assert_shared_lock(__VA_ARGS__))
1071
1072/* Function requires that an exclusive or shared lock is or is not held. */
1073#define __requires_exclusive(...) \
1074 __lock_annotate(exclusive_locks_required(__VA_ARGS__))
1075#define __requires_shared(...) \
1076 __lock_annotate(shared_locks_required(__VA_ARGS__))
1077#define __requires_unlocked(...) \
1078 __lock_annotate(locks_excluded(__VA_ARGS__))
1079
1080/* Function should not be analyzed. */
1081#define __no_lock_analysis __lock_annotate(no_thread_safety_analysis)
1082
1083/* Guard variables and structure members by lock. */
1084#define __guarded_by(x) __lock_annotate(guarded_by(x))
1085#define __pt_guarded_by(x) __lock_annotate(pt_guarded_by(x))
1086
1087/* Specify that a file requires capabilities */
1088#if __has_feature(capabilities)
1089#define __REQUIRE_CAPABILITIES
1090#else
1091# 897 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
1092#define __REQUIRE_CAPABILITIES \
1093 _Pragma("GCC error \"This file requires a capability-aware compiler\"")
1094#endif
1095# 900 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
1096
1097#endif /* !_SYS_CDEFS_H_ */
1098# 902 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/cdefs.h" 3 4
1099# 33 "/home/alr48/cheri/sources/cheribsd/bin/cheritest/cheritest_registers.c" 2
1100
1101#if !__has_feature(capabilities)
1102#error "This code requires a CHERI-aware compiler"
1103#endif
1104# 37 "/home/alr48/cheri/sources/cheribsd/bin/cheritest/cheritest_registers.c"
1105
1106#if 0 /* expanded by -frewrite-includes */
1107#include <sys/types.h>
1108#endif /* expanded by -frewrite-includes */
1109# 38 "/home/alr48/cheri/sources/cheribsd/bin/cheritest/cheritest_registers.c"
1110# 1 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/types.h" 1 3 4
1111/*-
1112 * Copyright (c) 1982, 1986, 1991, 1993, 1994
1113 * The Regents of the University of California. All rights reserved.
1114 * (c) UNIX System Laboratories, Inc.
1115 * All or some portions of this file are derived from material licensed
1116 * to the University of California by American Telephone and Telegraph
1117 * Co. or Unix System Laboratories, Inc. and are reproduced herein with
1118 * the permission of UNIX System Laboratories, Inc.
1119 *
1120 * Redistribution and use in source and binary forms, with or without
1121 * modification, are permitted provided that the following conditions
1122 * are met:
1123 * 1. Redistributions of source code must retain the above copyright
1124 * notice, this list of conditions and the following disclaimer.
1125 * 2. Redistributions in binary form must reproduce the above copyright
1126 * notice, this list of conditions and the following disclaimer in the
1127 * documentation and/or other materials provided with the distribution.
1128 * 4. Neither the name of the University nor the names of its contributors
1129 * may be used to endorse or promote products derived from this software
1130 * without specific prior written permission.
1131 *
1132 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
1133 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1134 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1135 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
1136 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1137 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
1138 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
1139 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
1140 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
1141 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
1142 * SUCH DAMAGE.
1143 *
1144 * @(#)types.h 8.6 (Berkeley) 2/19/95
1145 * $FreeBSD$
1146 */
1147
1148#ifndef _SYS_TYPES_H_
1149#define _SYS_TYPES_H_
1150
1151#if 0 /* expanded by -frewrite-includes */
1152#include <sys/cdefs.h>
1153#endif /* expanded by -frewrite-includes */
1154# 41 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/types.h" 3 4
1155# 42 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/types.h" 3 4
1156
1157/* Machine type dependent parameters. */
1158#if 0 /* expanded by -frewrite-includes */
1159#include <machine/endian.h>
1160#endif /* expanded by -frewrite-includes */
1161# 44 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/types.h" 3 4
1162# 1 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/machine/endian.h" 1 3 4
1163/*-
1164 * Copyright (c) 1987, 1991 Regents of the University of California.
1165 * All rights reserved.
1166 *
1167 * Redistribution and use in source and binary forms, with or without
1168 * modification, are permitted provided that the following conditions
1169 * are met:
1170 * 1. Redistributions of source code must retain the above copyright
1171 * notice, this list of conditions and the following disclaimer.
1172 * 2. Redistributions in binary form must reproduce the above copyright
1173 * notice, this list of conditions and the following disclaimer in the
1174 * documentation and/or other materials provided with the distribution.
1175 * 4. Neither the name of the University nor the names of its contributors
1176 * may be used to endorse or promote products derived from this software
1177 * without specific prior written permission.
1178 *
1179 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
1180 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1181 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1182 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
1183 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1184 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
1185 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
1186 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
1187 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
1188 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
1189 * SUCH DAMAGE.
1190 *
1191 * @(#)endian.h 7.8 (Berkeley) 4/3/91
1192 * $FreeBSD$
1193 */
1194
1195#ifndef _MACHINE_ENDIAN_H_
1196#define _MACHINE_ENDIAN_H_
1197
1198#if 0 /* expanded by -frewrite-includes */
1199#include <sys/cdefs.h>
1200#endif /* expanded by -frewrite-includes */
1201# 36 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/machine/endian.h" 3 4
1202# 37 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/machine/endian.h" 3 4
1203#ifndef __ASSEMBLER__
1204#if 0 /* expanded by -frewrite-includes */
1205#include <sys/_types.h>
1206#endif /* expanded by -frewrite-includes */
1207# 38 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/machine/endian.h" 3 4
1208# 1 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/_types.h" 1 3 4
1209/*-
1210 * Copyright (c) 2002 Mike Barcroft <mike@FreeBSD.org>
1211 * All rights reserved.
1212 *
1213 * Redistribution and use in source and binary forms, with or without
1214 * modification, are permitted provided that the following conditions
1215 * are met:
1216 * 1. Redistributions of source code must retain the above copyright
1217 * notice, this list of conditions and the following disclaimer.
1218 * 2. Redistributions in binary form must reproduce the above copyright
1219 * notice, this list of conditions and the following disclaimer in the
1220 * documentation and/or other materials provided with the distribution.
1221 *
1222 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
1223 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1224 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1225 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
1226 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1227 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
1228 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
1229 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
1230 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
1231 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
1232 * SUCH DAMAGE.
1233 *
1234 * $FreeBSD$
1235 */
1236
1237#ifndef _SYS__TYPES_H_
1238#define _SYS__TYPES_H_
1239
1240#if 0 /* expanded by -frewrite-includes */
1241#include <sys/cdefs.h>
1242#endif /* expanded by -frewrite-includes */
1243# 32 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/_types.h" 3 4
1244# 33 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/_types.h" 3 4
1245#if 0 /* expanded by -frewrite-includes */
1246#include <machine/_types.h>
1247#endif /* expanded by -frewrite-includes */
1248# 33 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/_types.h" 3 4
1249# 1 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/machine/_types.h" 1 3 4
1250/*-
1251 * Copyright (c) 2002 Mike Barcroft <mike@FreeBSD.org>
1252 * Copyright (c) 1990, 1993
1253 * The Regents of the University of California. All rights reserved.
1254 *
1255 * Redistribution and use in source and binary forms, with or without
1256 * modification, are permitted provided that the following conditions
1257 * are met:
1258 * 1. Redistributions of source code must retain the above copyright
1259 * notice, this list of conditions and the following disclaimer.
1260 * 2. Redistributions in binary form must reproduce the above copyright
1261 * notice, this list of conditions and the following disclaimer in the
1262 * documentation and/or other materials provided with the distribution.
1263 * 3. All advertising materials mentioning features or use of this software
1264 * must display the following acknowledgement:
1265 * This product includes software developed by the University of
1266 * California, Berkeley and its contributors.
1267 * 4. Neither the name of the University nor the names of its contributors
1268 * may be used to endorse or promote products derived from this software
1269 * without specific prior written permission.
1270 *
1271 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
1272 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1273 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1274 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
1275 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1276 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
1277 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
1278 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
1279 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
1280 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
1281 * SUCH DAMAGE.
1282 *
1283 * From: @(#)ansi.h 8.2 (Berkeley) 1/4/94
1284 * From: @(#)types.h 8.3 (Berkeley) 1/5/94
1285 * from: src/sys/i386/include/_types.h,v 1.12 2005/07/02 23:13:31 thompsa
1286 * $FreeBSD$
1287 */
1288
1289#ifndef _MACHINE__TYPES_H_
1290#define _MACHINE__TYPES_H_
1291
1292#ifndef _SYS_CDEFS_H_
1293#error this file needs sys/cdefs.h as a prerequisite
1294#endif
1295# 46 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/machine/_types.h" 3 4
1296
1297/*
1298 * Basic types upon which most other types are built.
1299 */
1300typedef signed char __int8_t;
1301typedef unsigned char __uint8_t;
1302typedef short __int16_t;
1303typedef unsigned short __uint16_t;
1304typedef int __int32_t;
1305typedef unsigned int __uint32_t;
1306#ifdef __mips_n64
1307typedef long __int64_t;
1308typedef unsigned long __uint64_t;
1309#else
1310# 60 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/machine/_types.h" 3 4
1311#ifndef lint
1312__extension__
1313#endif
1314# 63 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/machine/_types.h" 3 4
1315/* LONGLONG */
1316typedef long long __int64_t;
1317#ifndef lint
1318__extension__
1319#endif
1320# 68 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/machine/_types.h" 3 4
1321/* LONGLONG */
1322typedef unsigned long long __uint64_t;
1323#endif
1324# 71 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/machine/_types.h" 3 4
1325
1326/*
1327 * Standard type definitions.
1328 */
1329typedef __int32_t __clock_t; /* clock()... */
1330typedef double __double_t;
1331typedef float __float_t;
1332#ifdef __mips_n64
1333#ifndef __CHERI_PURE_CAPABILITY__
1334typedef __int64_t __critical_t;
1335typedef __int64_t __intfptr_t;
1336typedef __int64_t __intptr_t;
1337#else
1338# 84 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/machine/_types.h" 3 4
1339typedef __intcap_t __critical_t;
1340typedef __intcap_t __intfptr_t;
1341typedef __intcap_t __intptr_t;
1342#endif
1343# 88 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/machine/_types.h" 3 4
1344#else
1345# 89 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/machine/_types.h" 3 4
1346typedef __int32_t __critical_t;
1347typedef __int32_t __intfptr_t;
1348typedef __int32_t __intptr_t;
1349#endif
1350# 93 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/machine/_types.h" 3 4
1351typedef __int64_t __intmax_t;
1352typedef __int32_t __int_fast8_t;
1353typedef __int32_t __int_fast16_t;
1354typedef __int32_t __int_fast32_t;
1355typedef __int64_t __int_fast64_t;
1356typedef __int8_t __int_least8_t;
1357typedef __int16_t __int_least16_t;
1358typedef __int32_t __int_least32_t;
1359typedef __int64_t __int_least64_t;
1360#if defined(__mips_n64) || defined(__mips_n32)
1361typedef __int64_t __register_t;
1362typedef __int64_t f_register_t;
1363#else
1364# 106 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/machine/_types.h" 3 4
1365typedef __int32_t __register_t;
1366typedef __int32_t f_register_t;
1367#endif
1368# 109 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/machine/_types.h" 3 4
1369#ifdef __mips_n64
1370typedef __int64_t __ptrdiff_t;
1371typedef __int64_t __segsz_t;
1372typedef __uint64_t __size_t;
1373typedef __int64_t __ssize_t;
1374#ifndef __CHERI_PURE_CAPABILITY__
1375typedef __uint64_t __uintfptr_t;
1376typedef __uint64_t __uintptr_t;
1377#else
1378# 118 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/machine/_types.h" 3 4
1379typedef __uintcap_t __uintfptr_t;
1380typedef __uintcap_t __uintptr_t;
1381#endif
1382# 121 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/machine/_types.h" 3 4
1383#else
1384# 122 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/machine/_types.h" 3 4
1385typedef __int32_t __ptrdiff_t; /* ptr1 - ptr2 */
1386typedef __int32_t __segsz_t; /* segment size (in pages) */
1387typedef __uint32_t __size_t; /* sizeof() */
1388typedef __int32_t __ssize_t; /* byte count or error */
1389typedef __uint32_t __uintfptr_t;
1390typedef __uint32_t __uintptr_t;
1391#endif
1392# 129 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/machine/_types.h" 3 4
1393typedef __int64_t __time_t; /* time()... */
1394typedef __uint64_t __uintmax_t;
1395typedef __uint32_t __uint_fast8_t;
1396typedef __uint32_t __uint_fast16_t;
1397typedef __uint32_t __uint_fast32_t;
1398typedef __uint64_t __uint_fast64_t;
1399typedef __uint8_t __uint_least8_t;
1400typedef __uint16_t __uint_least16_t;
1401typedef __uint32_t __uint_least32_t;
1402typedef __uint64_t __uint_least64_t;
1403#if defined(__mips_n64) || defined(__mips_n32)
1404typedef __uint64_t __u_register_t;
1405#else
1406# 142 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/machine/_types.h" 3 4
1407typedef __uint32_t __u_register_t;
1408#endif
1409# 144 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/machine/_types.h" 3 4
1410#ifdef __mips_n64
1411typedef __uint64_t __vm_offset_t;
1412typedef __uint64_t __vm_size_t;
1413#else
1414# 148 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/machine/_types.h" 3 4
1415typedef __uint32_t __vm_offset_t;
1416typedef __uint32_t __vm_size_t;
1417#endif
1418# 151 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/machine/_types.h" 3 4
1419#if defined(__mips_n64) || defined(__mips_n32) /* PHYSADDR_64_BIT */
1420typedef __uint64_t __vm_paddr_t;
1421#else
1422# 154 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/machine/_types.h" 3 4
1423typedef __uint32_t __vm_paddr_t;
1424#endif
1425# 156 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/machine/_types.h" 3 4
1426
1427typedef __int64_t __vm_ooffset_t;
1428typedef __uint64_t __vm_pindex_t;
1429typedef int ___wchar_t;
1430
1431#define __WCHAR_MIN __INT_MIN /* min value for a wchar_t */
1432#define __WCHAR_MAX __INT_MAX /* max value for a wchar_t */
1433
1434/*
1435 * Unusual type definitions.
1436 */
1437#ifdef __GNUCLIKE_BUILTIN_VARARGS
1438typedef __builtin_va_list __va_list; /* internally known to gcc */
1439#else
1440# 170 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/machine/_types.h" 3 4
1441typedef char * __va_list;
1442#endif /* __GNUCLIKE_BUILTIN_VARARGS */
1443# 172 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/machine/_types.h" 3 4
1444#if defined(__GNUC_VA_LIST_COMPATIBILITY) && !defined(__GNUC_VA_LIST) \
1445 && !defined(__NO_GNUC_VA_LIST)
1446#define __GNUC_VA_LIST
1447typedef __va_list __gnuc_va_list; /* compatibility w/GNU headers*/
1448#endif
1449# 177 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/machine/_types.h" 3 4
1450
1451#endif /* !_MACHINE__TYPES_H_ */
1452# 179 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/machine/_types.h" 3 4
1453# 34 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/_types.h" 2 3 4
1454
1455/*
1456 * Standard type definitions.
1457 */
1458typedef __int32_t __blksize_t; /* file block size */
1459typedef __int64_t __blkcnt_t; /* file block count */
1460typedef __int32_t __clockid_t; /* clock_gettime()... */
1461typedef __uint32_t __fflags_t; /* file flags */
1462typedef __uint64_t __fsblkcnt_t;
1463typedef __uint64_t __fsfilcnt_t;
1464typedef __uint32_t __gid_t;
1465typedef __int64_t __id_t; /* can hold a gid_t, pid_t, or uid_t */
1466typedef __uint32_t __ino_t; /* inode number */
1467typedef long __key_t; /* IPC key (for Sys V IPC) */
1468typedef __int32_t __lwpid_t; /* Thread ID (a.k.a. LWP) */
1469typedef __uint16_t __mode_t; /* permissions */
1470typedef int __accmode_t; /* access permissions */
1471typedef int __nl_item;
1472typedef __uint16_t __nlink_t; /* link count */
1473typedef __int64_t __off_t; /* file offset */
1474typedef __int64_t __off64_t; /* file offset (alias) */
1475typedef __int32_t __pid_t; /* process [group] */
1476typedef __int64_t __rlim_t; /* resource limit - intentionally */
1477 /* signed, because of legacy code */
1478 /* that uses -1 for RLIM_INFINITY */
1479typedef __uint8_t __sa_family_t;
1480typedef __uint32_t __socklen_t;
1481typedef long __suseconds_t; /* microseconds (signed) */
1482typedef struct __timer *__timer_t; /* timer_gettime()... */
1483typedef struct __mq *__mqd_t; /* mq_open()... */
1484typedef __uint32_t __uid_t;
1485typedef unsigned int __useconds_t; /* microseconds (unsigned) */
1486typedef int __cpuwhich_t; /* which parameter for cpuset. */
1487typedef int __cpulevel_t; /* level parameter for cpuset. */
1488typedef int __cpusetid_t; /* cpuset identifier. */
1489
1490/*
1491 * Unusual type definitions.
1492 */
1493/*
1494 * rune_t is declared to be an ``int'' instead of the more natural
1495 * ``unsigned long'' or ``long''. Two things are happening here. It is not
1496 * unsigned so that EOF (-1) can be naturally assigned to it and used. Also,
1497 * it looks like 10646 will be a 31 bit standard. This means that if your
1498 * ints cannot hold 32 bits, you will be in trouble. The reason an int was
1499 * chosen over a long is that the is*() and to*() routines take ints (says
1500 * ANSI C), but they use __ct_rune_t instead of int.
1501 *
1502 * NOTE: rune_t is not covered by ANSI nor other standards, and should not
1503 * be instantiated outside of lib/libc/locale. Use wchar_t. wint_t and
1504 * rune_t must be the same type. Also, wint_t should be able to hold all
1505 * members of the largest character set plus one extra value (WEOF), and
1506 * must be at least 16 bits.
1507 */
1508typedef int __ct_rune_t; /* arg type for ctype funcs */
1509typedef __ct_rune_t __rune_t; /* rune_t (see above) */
1510typedef __ct_rune_t __wint_t; /* wint_t (see above) */
1511
1512/* Clang already provides these types as built-ins, but only in C++ mode. */
1513#if !defined(__clang__) || !defined(__cplusplus)
1514typedef __uint_least16_t __char16_t;
1515typedef __uint_least32_t __char32_t;
1516#endif
1517# 97 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/_types.h" 3 4
1518/* In C++11, char16_t and char32_t are built-in types. */
1519#if defined(__cplusplus) && __cplusplus >= 201103L
1520#define _CHAR16_T_DECLARED
1521#define _CHAR32_T_DECLARED
1522#endif
1523# 102 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/_types.h" 3 4
1524
1525typedef struct {
1526 long long __max_align1 __aligned(_Alignof(long long));
1527 long double __max_align2 __aligned(_Alignof(long double));
1528} __max_align_t;
1529
1530typedef __uint32_t __dev_t; /* device number */
1531
1532typedef __uint32_t __fixpt_t; /* fixed point number */
1533
1534/*
1535 * mbstate_t is an opaque object to keep conversion state during multibyte
1536 * stream conversions.
1537 */
1538typedef union {
1539 char __mbstate8[128];
1540 __int64_t _mbstateL; /* for alignment */
1541} __mbstate_t;
1542
1543typedef __uintmax_t __rman_res_t;
1544
1545#endif /* !_SYS__TYPES_H_ */
1546# 124 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/_types.h" 3 4
1547# 39 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/machine/endian.h" 2 3 4
1548#endif
1549# 40 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/machine/endian.h" 3 4
1550
1551#ifdef __cplusplus
1552extern "C" {
1553#endif
1554# 44 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/machine/endian.h" 3 4
1555
1556/*
1557 * Definitions for byte order, according to byte significance from low
1558 * address to high.
1559 */
1560#define _LITTLE_ENDIAN 1234 /* LSB first: i386, vax */
1561#define _BIG_ENDIAN 4321 /* MSB first: 68000, ibm, net */
1562#define _PDP_ENDIAN 3412 /* LSB first in word, MSW first in long */
1563
1564#ifdef __MIPSEB__
1565#define _BYTE_ORDER _BIG_ENDIAN
1566#else
1567# 56 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/machine/endian.h" 3 4
1568#define _BYTE_ORDER _LITTLE_ENDIAN
1569#endif /* __MIBSEB__ */
1570# 58 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/machine/endian.h" 3 4
1571
1572/*
1573 * Deprecated variants that don't have enough underscores to be useful in more
1574 * strict namespaces.
1575 */
1576#if __BSD_VISIBLE
1577#define LITTLE_ENDIAN _LITTLE_ENDIAN
1578#define BIG_ENDIAN _BIG_ENDIAN
1579#define PDP_ENDIAN _PDP_ENDIAN
1580#define BYTE_ORDER _BYTE_ORDER
1581#endif
1582# 69 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/machine/endian.h" 3 4
1583
1584#ifndef __ASSEMBLER__
1585#if defined(__GNUCLIKE_BUILTIN_CONSTANT_P) && defined(__OPTIMIZE__)
1586#define __is_constant(x) __builtin_constant_p(x)
1587#else
1588# 74 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/machine/endian.h" 3 4
1589#define __is_constant(x) 0
1590#endif
1591# 76 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/machine/endian.h" 3 4
1592
1593#define __bswap16_const(x) (((x) >> 8) | (((x) << 8) & 0xff00))
1594#define __bswap32_const(x) (((x) >> 24) | (((x) >> 8) & 0xff00) | \
1595 (((x) << 8) & 0xff0000) | (((x) << 24) & 0xff000000))
1596#define __bswap64_const(x) (((x) >> 56) | (((x) >> 40) & 0xff00) | \
1597 (((x) >> 24) & 0xff0000) | (((x) >> 8) & 0xff000000) | \
1598 (((x) << 8) & ((__uint64_t)0xff << 32)) | \
1599 (((x) << 24) & ((__uint64_t)0xff << 40)) | \
1600 (((x) << 40) & ((__uint64_t)0xff << 48)) | (((x) << 56)))
1601
1602static __inline __uint16_t
1603__bswap16_var(__uint16_t _x)
1604{
1605
1606 return ((_x >> 8) | ((_x << 8) & 0xff00));
1607}
1608
1609static __inline __uint32_t
1610__bswap32_var(__uint32_t _x)
1611{
1612
1613 return ((_x >> 24) | ((_x >> 8) & 0xff00) | ((_x << 8) & 0xff0000) |
1614 ((_x << 24) & 0xff000000));
1615}
1616
1617static __inline __uint64_t
1618__bswap64_var(__uint64_t _x)
1619{
1620
1621 return ((_x >> 56) | ((_x >> 40) & 0xff00) | ((_x >> 24) & 0xff0000) |
1622 ((_x >> 8) & 0xff000000) | ((_x << 8) & ((__uint64_t)0xff << 32)) |
1623 ((_x << 24) & ((__uint64_t)0xff << 40)) |
1624 ((_x << 40) & ((__uint64_t)0xff << 48)) | ((_x << 56)));
1625}
1626
1627#define __bswap16(x) ((__uint16_t)(__is_constant((x)) ? \
1628 __bswap16_const((__uint16_t)(x)) : __bswap16_var((__uint16_t)(x))))
1629#define __bswap32(x) ((__uint32_t)(__is_constant((x)) ? \
1630 __bswap32_const((__uint32_t)(x)) : __bswap32_var((__uint32_t)(x))))
1631#define __bswap64(x) ((__uint64_t)(__is_constant((x)) ? \
1632 __bswap64_const((__uint64_t)(x)) : __bswap64_var((__uint64_t)(x))))
1633
1634#ifdef __MIPSEB__
1635#define __htonl(x) ((__uint32_t)(x))
1636#define __htons(x) ((__uint16_t)(x))
1637#define __ntohl(x) ((__uint32_t)(x))
1638#define __ntohs(x) ((__uint16_t)(x))
1639/*
1640 * Define the order of 32-bit words in 64-bit words.
1641 */
1642/*
1643 * XXXMIPS: Additional parentheses to make gcc more happy.
1644 */
1645#define _QUAD_HIGHWORD 0
1646#define _QUAD_LOWWORD 1
1647#else
1648# 132 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/machine/endian.h" 3 4
1649#define _QUAD_HIGHWORD 1
1650#define _QUAD_LOWWORD 0
1651#define __ntohl(x) (__bswap32((x)))
1652#define __ntohs(x) (__bswap16((x)))
1653#define __htonl(x) (__bswap32((x)))
1654#define __htons(x) (__bswap16((x)))
1655#endif /* _MIPSEB */
1656# 139 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/machine/endian.h" 3 4
1657
1658#endif /* _ASSEMBLER_ */
1659# 141 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/machine/endian.h" 3 4
1660
1661#ifdef __cplusplus
1662}
1663#endif
1664# 145 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/machine/endian.h" 3 4
1665
1666#endif /* !_MACHINE_ENDIAN_H_ */
1667# 147 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/machine/endian.h" 3 4
1668# 45 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/types.h" 2 3 4
1669#if 0 /* expanded by -frewrite-includes */
1670#include <sys/_types.h>
1671#endif /* expanded by -frewrite-includes */
1672# 45 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/types.h" 3 4
1673# 46 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/types.h" 3 4
1674
1675#if 0 /* expanded by -frewrite-includes */
1676#include <sys/_pthreadtypes.h>
1677#endif /* expanded by -frewrite-includes */
1678# 47 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/types.h" 3 4
1679# 1 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/_pthreadtypes.h" 1 3 4
1680/*
1681 * Copyright (c) 1993, 1994 by Chris Provenzano, proven@mit.edu
1682 * Copyright (c) 1995-1998 by John Birrell <jb@cimlogic.com.au>
1683 * All rights reserved.
1684 *
1685 * Redistribution and use in source and binary forms, with or without
1686 * modification, are permitted provided that the following conditions
1687 * are met:
1688 * 1. Redistributions of source code must retain the above copyright
1689 * notice, this list of conditions and the following disclaimer.
1690 * 2. Redistributions in binary form must reproduce the above copyright
1691 * notice, this list of conditions and the following disclaimer in the
1692 * documentation and/or other materials provided with the distribution.
1693 * 3. All advertising materials mentioning features or use of this software
1694 * must display the following acknowledgement:
1695 * This product includes software developed by Chris Provenzano.
1696 * 4. The name of Chris Provenzano may not be used to endorse or promote
1697 * products derived from this software without specific prior written
1698 * permission.
1699 *
1700 * THIS SOFTWARE IS PROVIDED BY CHRIS PROVENZANO ``AS IS'' AND
1701 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1702 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1703 * ARE DISCLAIMED. IN NO EVENT SHALL CHRIS PROVENZANO BE LIABLE FOR ANY
1704 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
1705 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
1706 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
1707 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
1708 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
1709 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
1710 * SUCH DAMAGE.
1711 *
1712 * $FreeBSD$
1713 */
1714
1715#ifndef _SYS__PTHREADTYPES_H_
1716#define _SYS__PTHREADTYPES_H_
1717
1718/*
1719 * Forward structure definitions.
1720 *
1721 * These are mostly opaque to the user.
1722 */
1723struct pthread;
1724struct pthread_attr;
1725struct pthread_cond;
1726struct pthread_cond_attr;
1727struct pthread_mutex;
1728struct pthread_mutex_attr;
1729struct pthread_once;
1730struct pthread_rwlock;
1731struct pthread_rwlockattr;
1732struct pthread_barrier;
1733struct pthread_barrier_attr;
1734struct pthread_spinlock;
1735
1736/*
1737 * Primitive system data type definitions required by P1003.1c.
1738 *
1739 * Note that P1003.1c specifies that there are no defined comparison
1740 * or assignment operators for the types pthread_attr_t, pthread_cond_t,
1741 * pthread_condattr_t, pthread_mutex_t, pthread_mutexattr_t.
1742 */
1743#ifndef _PTHREAD_T_DECLARED
1744typedef struct pthread *pthread_t;
1745#define _PTHREAD_T_DECLARED
1746#endif
1747# 68 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/_pthreadtypes.h" 3 4
1748typedef struct pthread_attr *pthread_attr_t;
1749typedef struct pthread_mutex *pthread_mutex_t;
1750typedef struct pthread_mutex_attr *pthread_mutexattr_t;
1751typedef struct pthread_cond *pthread_cond_t;
1752typedef struct pthread_cond_attr *pthread_condattr_t;
1753typedef int pthread_key_t;
1754typedef struct pthread_once pthread_once_t;
1755typedef struct pthread_rwlock *pthread_rwlock_t;
1756typedef struct pthread_rwlockattr *pthread_rwlockattr_t;
1757typedef struct pthread_barrier *pthread_barrier_t;
1758typedef struct pthread_barrierattr *pthread_barrierattr_t;
1759typedef struct pthread_spinlock *pthread_spinlock_t;
1760
1761/*
1762 * Additional type definitions:
1763 *
1764 * Note that P1003.1c reserves the prefixes pthread_ and PTHREAD_ for
1765 * use in header symbols.
1766 */
1767typedef void *pthread_addr_t;
1768typedef void *(*pthread_startroutine_t)(void *);
1769
1770/*
1771 * Once definitions.
1772 */
1773struct pthread_once {
1774 int state;
1775 pthread_mutex_t mutex;
1776};
1777
1778#endif /* ! _SYS__PTHREADTYPES_H_ */
1779# 99 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/_pthreadtypes.h" 3 4
1780# 48 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/types.h" 2 3 4
1781
1782#if __BSD_VISIBLE
1783typedef unsigned char u_char;
1784typedef unsigned short u_short;
1785typedef unsigned int u_int;
1786typedef unsigned long u_long;
1787#ifndef _KERNEL
1788typedef unsigned short ushort; /* Sys V compatibility */
1789typedef unsigned int uint; /* Sys V compatibility */
1790#endif
1791# 58 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/types.h" 3 4
1792#endif
1793# 59 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/types.h" 3 4
1794
1795/*
1796 * XXX POSIX sized integrals that should appear only in <sys/stdint.h>.
1797 */
1798#if 0 /* expanded by -frewrite-includes */
1799#include <sys/_stdint.h>
1800#endif /* expanded by -frewrite-includes */
1801# 63 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/types.h" 3 4
1802# 1 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/_stdint.h" 1 3 4
1803/*-
1804 * Copyright (c) 2011 David E. O'Brien <obrien@FreeBSD.org>
1805 * Copyright (c) 2001 Mike Barcroft <mike@FreeBSD.org>
1806 * All rights reserved.
1807 *
1808 * Redistribution and use in source and binary forms, with or without
1809 * modification, are permitted provided that the following conditions
1810 * are met:
1811 * 1. Redistributions of source code must retain the above copyright
1812 * notice, this list of conditions and the following disclaimer.
1813 * 2. Redistributions in binary form must reproduce the above copyright
1814 * notice, this list of conditions and the following disclaimer in the
1815 * documentation and/or other materials provided with the distribution.
1816 *
1817 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
1818 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1819 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1820 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
1821 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
1822 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
1823 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
1824 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
1825 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
1826 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
1827 * SUCH DAMAGE.
1828 *
1829 * $FreeBSD$
1830 */
1831
1832#ifndef _SYS__STDINT_H_
1833#define _SYS__STDINT_H_
1834
1835#ifndef _INT8_T_DECLARED
1836typedef __int8_t int8_t;
1837#define _INT8_T_DECLARED
1838#endif
1839# 37 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/_stdint.h" 3 4
1840
1841#ifndef _INT16_T_DECLARED
1842typedef __int16_t int16_t;
1843#define _INT16_T_DECLARED
1844#endif
1845# 42 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/_stdint.h" 3 4
1846
1847#ifndef _INT32_T_DECLARED
1848typedef __int32_t int32_t;
1849#define _INT32_T_DECLARED
1850#endif
1851# 47 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/_stdint.h" 3 4
1852
1853#ifndef _INT64_T_DECLARED
1854typedef __int64_t int64_t;
1855#define _INT64_T_DECLARED
1856#endif
1857# 52 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/_stdint.h" 3 4
1858
1859#ifndef _UINT8_T_DECLARED
1860typedef __uint8_t uint8_t;
1861#define _UINT8_T_DECLARED
1862#endif
1863# 57 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/_stdint.h" 3 4
1864
1865#ifndef _UINT16_T_DECLARED
1866typedef __uint16_t uint16_t;
1867#define _UINT16_T_DECLARED
1868#endif
1869# 62 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/_stdint.h" 3 4
1870
1871#ifndef _UINT32_T_DECLARED
1872typedef __uint32_t uint32_t;
1873#define _UINT32_T_DECLARED
1874#endif
1875# 67 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/_stdint.h" 3 4
1876
1877#ifndef _UINT64_T_DECLARED
1878typedef __uint64_t uint64_t;
1879#define _UINT64_T_DECLARED
1880#endif
1881# 72 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/_stdint.h" 3 4
1882
1883#ifndef _INTPTR_T_DECLARED
1884typedef __intptr_t intptr_t;
1885#define _INTPTR_T_DECLARED
1886#endif
1887# 77 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/_stdint.h" 3 4
1888#ifndef _UINTPTR_T_DECLARED
1889typedef __uintptr_t uintptr_t;
1890#define _UINTPTR_T_DECLARED
1891#endif
1892# 81 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/_stdint.h" 3 4
1893#ifndef _INTMAX_T_DECLARED
1894typedef __intmax_t intmax_t;
1895#define _INTMAX_T_DECLARED
1896#endif
1897# 85 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/_stdint.h" 3 4
1898#ifndef _UINTMAX_T_DECLARED
1899typedef __uintmax_t uintmax_t;
1900#define _UINTMAX_T_DECLARED
1901#endif
1902# 89 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/_stdint.h" 3 4
1903
1904#if __has_attribute(memory_address)
1905#define __memory_address __attribute__((memory_address))
1906#else
1907# 93 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/_stdint.h" 3 4
1908#define __memory_address
1909#endif
1910# 95 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/_stdint.h" 3 4
1911
1912#ifdef __CHERI_PURE_CAPABILITY__
1913typedef __memory_address __uintcap_t vaddr_t;
1914#else
1915# 99 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/_stdint.h" 3 4
1916typedef __memory_address __uintptr_t vaddr_t;
1917#endif
1918# 101 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/_stdint.h" 3 4
1919
1920#endif /* !_SYS__STDINT_H_ */
1921# 103 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/_stdint.h" 3 4
1922# 64 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/types.h" 2 3 4
1923
1924typedef __uint8_t u_int8_t; /* unsigned integrals (deprecated) */
1925typedef __uint16_t u_int16_t;
1926typedef __uint32_t u_int32_t;
1927typedef __uint64_t u_int64_t;
1928
1929typedef __uint64_t u_quad_t; /* quads (deprecated) */
1930typedef __int64_t quad_t;
1931typedef quad_t * qaddr_t;
1932
1933typedef char * caddr_t; /* core address */
1934typedef const char * c_caddr_t; /* core address, pointer to const */
1935
1936#ifndef _BLKSIZE_T_DECLARED
1937typedef __blksize_t blksize_t;
1938#define _BLKSIZE_T_DECLARED
1939#endif
1940# 81 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/types.h" 3 4
1941
1942typedef __cpuwhich_t cpuwhich_t;
1943typedef __cpulevel_t cpulevel_t;
1944typedef __cpusetid_t cpusetid_t;
1945
1946#ifndef _BLKCNT_T_DECLARED
1947typedef __blkcnt_t blkcnt_t;
1948#define _BLKCNT_T_DECLARED
1949#endif
1950# 90 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/types.h" 3 4
1951
1952#ifndef _CLOCK_T_DECLARED
1953typedef __clock_t clock_t;
1954#define _CLOCK_T_DECLARED
1955#endif
1956# 95 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/types.h" 3 4
1957
1958#ifndef _CLOCKID_T_DECLARED
1959typedef __clockid_t clockid_t;
1960#define _CLOCKID_T_DECLARED
1961#endif
1962# 100 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/types.h" 3 4
1963
1964typedef __critical_t critical_t; /* Critical section value */
1965typedef __int64_t daddr_t; /* disk address */
1966
1967#ifndef _DEV_T_DECLARED
1968typedef __dev_t dev_t; /* device number or struct cdev */
1969#define _DEV_T_DECLARED
1970#endif
1971# 108 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/types.h" 3 4
1972
1973#ifndef _FFLAGS_T_DECLARED
1974typedef __fflags_t fflags_t; /* file flags */
1975#define _FFLAGS_T_DECLARED
1976#endif
1977# 113 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/types.h" 3 4
1978
1979typedef __fixpt_t fixpt_t; /* fixed point number */
1980
1981#ifndef _FSBLKCNT_T_DECLARED /* for statvfs() */
1982typedef __fsblkcnt_t fsblkcnt_t;
1983typedef __fsfilcnt_t fsfilcnt_t;
1984#define _FSBLKCNT_T_DECLARED
1985#endif
1986# 121 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/types.h" 3 4
1987
1988#ifndef _GID_T_DECLARED
1989typedef __gid_t gid_t; /* group id */
1990#define _GID_T_DECLARED
1991#endif
1992# 126 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/types.h" 3 4
1993
1994#ifndef _IN_ADDR_T_DECLARED
1995typedef __uint32_t in_addr_t; /* base type for internet address */
1996#define _IN_ADDR_T_DECLARED
1997#endif
1998# 131 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/types.h" 3 4
1999
2000#ifndef _IN_PORT_T_DECLARED
2001typedef __uint16_t in_port_t;
2002#define _IN_PORT_T_DECLARED
2003#endif
2004# 136 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/types.h" 3 4
2005
2006#ifndef _ID_T_DECLARED
2007typedef __id_t id_t; /* can hold a uid_t or pid_t */
2008#define _ID_T_DECLARED
2009#endif
2010# 141 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/types.h" 3 4
2011
2012#ifndef _INO_T_DECLARED
2013typedef __ino_t ino_t; /* inode number */
2014#define _INO_T_DECLARED
2015#endif
2016# 146 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/types.h" 3 4
2017
2018#ifndef _KEY_T_DECLARED
2019typedef __key_t key_t; /* IPC key (for Sys V IPC) */
2020#define _KEY_T_DECLARED
2021#endif
2022# 151 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/types.h" 3 4
2023
2024#ifndef _LWPID_T_DECLARED
2025typedef __lwpid_t lwpid_t; /* Thread ID (a.k.a. LWP) */
2026#define _LWPID_T_DECLARED
2027#endif
2028# 156 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/types.h" 3 4
2029
2030#ifndef _MODE_T_DECLARED
2031typedef __mode_t mode_t; /* permissions */
2032#define _MODE_T_DECLARED
2033#endif
2034# 161 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/types.h" 3 4
2035
2036#ifndef _ACCMODE_T_DECLARED
2037typedef __accmode_t accmode_t; /* access permissions */
2038#define _ACCMODE_T_DECLARED
2039#endif
2040# 166 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/types.h" 3 4
2041
2042#ifndef _NLINK_T_DECLARED
2043typedef __nlink_t nlink_t; /* link count */
2044#define _NLINK_T_DECLARED
2045#endif
2046# 171 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/types.h" 3 4
2047
2048#ifndef _OFF_T_DECLARED
2049typedef __off_t off_t; /* file offset */
2050#define _OFF_T_DECLARED
2051#endif
2052# 176 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/types.h" 3 4
2053
2054#ifndef _OFF64_T_DECLARED
2055typedef __off64_t off64_t; /* file offset (alias) */
2056#define _OFF64_T_DECLARED
2057#endif
2058# 181 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/types.h" 3 4
2059
2060#ifndef _PID_T_DECLARED
2061typedef __pid_t pid_t; /* process id */
2062#define _PID_T_DECLARED
2063#endif
2064# 186 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/types.h" 3 4
2065
2066typedef __register_t register_t;
2067
2068#ifndef _RLIM_T_DECLARED
2069typedef __rlim_t rlim_t; /* resource limit */
2070#define _RLIM_T_DECLARED
2071#endif
2072# 193 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/types.h" 3 4
2073
2074typedef __int64_t sbintime_t;
2075
2076typedef __segsz_t segsz_t; /* segment size (in pages) */
2077
2078#ifndef _SIZE_T_DECLARED
2079typedef __size_t size_t;
2080#define _SIZE_T_DECLARED
2081#endif
2082# 202 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/types.h" 3 4
2083
2084#ifndef _SSIZE_T_DECLARED
2085typedef __ssize_t ssize_t;
2086#define _SSIZE_T_DECLARED
2087#endif
2088# 207 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/types.h" 3 4
2089
2090#ifndef _SUSECONDS_T_DECLARED
2091typedef __suseconds_t suseconds_t; /* microseconds (signed) */
2092#define _SUSECONDS_T_DECLARED
2093#endif
2094# 212 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/types.h" 3 4
2095
2096#ifndef _TIME_T_DECLARED
2097typedef __time_t time_t;
2098#define _TIME_T_DECLARED
2099#endif
2100# 217 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/types.h" 3 4
2101
2102#ifndef _TIMER_T_DECLARED
2103typedef __timer_t timer_t;
2104#define _TIMER_T_DECLARED
2105#endif
2106# 222 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/types.h" 3 4
2107
2108#ifndef _MQD_T_DECLARED
2109typedef __mqd_t mqd_t;
2110#define _MQD_T_DECLARED
2111#endif
2112# 227 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/types.h" 3 4
2113
2114typedef __u_register_t u_register_t;
2115
2116#ifndef _UID_T_DECLARED
2117typedef __uid_t uid_t; /* user id */
2118#define _UID_T_DECLARED
2119#endif
2120# 234 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/types.h" 3 4
2121
2122#ifndef _USECONDS_T_DECLARED
2123typedef __useconds_t useconds_t; /* microseconds (unsigned) */
2124#define _USECONDS_T_DECLARED
2125#endif
2126# 239 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/types.h" 3 4
2127
2128#ifndef _CAP_IOCTL_T_DECLARED
2129#define _CAP_IOCTL_T_DECLARED
2130typedef unsigned long cap_ioctl_t;
2131#endif
2132# 244 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/types.h" 3 4
2133
2134#ifndef _CAP_RIGHTS_T_DECLARED
2135#define _CAP_RIGHTS_T_DECLARED
2136struct cap_rights;
2137
2138typedef struct cap_rights cap_rights_t;
2139#endif
2140# 251 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/types.h" 3 4
2141
2142typedef __vm_offset_t vm_offset_t;
2143typedef __vm_ooffset_t vm_ooffset_t;
2144typedef __vm_paddr_t vm_paddr_t;
2145typedef __vm_pindex_t vm_pindex_t;
2146typedef __vm_size_t vm_size_t;
2147
2148typedef __rman_res_t rman_res_t;
2149
2150#ifdef _KERNEL
2151typedef int boolean_t;
2152typedef struct device *device_t;
2153typedef __intfptr_t intfptr_t;
2154
2155/*
2156 * XXX this is fixed width for historical reasons. It should have had type
2157 * __int_fast32_t. Fixed-width types should not be used unless binary
2158 * compatibility is essential. Least-width types should be used even less
2159 * since they provide smaller benefits.
2160 *
2161 * XXX should be MD.
2162 *
2163 * XXX this is bogus in -current, but still used for spl*().
2164 */
2165typedef __uint32_t intrmask_t; /* Interrupt mask (spl, xxx_imask...) */
2166
2167typedef __uintfptr_t uintfptr_t;
2168typedef __uint64_t uoff_t;
2169typedef char vm_memattr_t; /* memory attribute codes */
2170typedef struct vm_page *vm_page_t;
2171
2172#if !defined(__bool_true_false_are_defined) && !defined(__cplusplus)
2173#define __bool_true_false_are_defined 1
2174#define false 0
2175#define true 1
2176#if __STDC_VERSION__ < 199901L && __GNUC__ < 3 && !defined(__INTEL_COMPILER)
2177typedef int _Bool;
2178#endif
2179# 289 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/types.h" 3 4
2180typedef _Bool bool;
2181#endif /* !__bool_true_false_are_defined && !__cplusplus */
2182# 291 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/types.h" 3 4
2183
2184#define offsetof(type, field) __offsetof(type, field)
2185
2186#endif /* !_KERNEL */
2187# 295 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/types.h" 3 4
2188
2189/*
2190 * The following are all things that really shouldn't exist in this header,
2191 * since its purpose is to provide typedefs, not miscellaneous doodads.
2192 */
2193
2194#ifdef __POPCNT__
2195#define __bitcount64(x) __builtin_popcountll((__uint64_t)(x))
2196#define __bitcount32(x) __builtin_popcount((__uint32_t)(x))
2197#define __bitcount16(x) __builtin_popcount((__uint16_t)(x))
2198#define __bitcountl(x) __builtin_popcountl((unsigned long)(x))
2199#define __bitcount(x) __builtin_popcount((unsigned int)(x))
2200#else
2201# 308 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/types.h" 3 4
2202/*
2203 * Population count algorithm using SWAR approach
2204 * - "SIMD Within A Register".
2205 */
2206static __inline __uint16_t
2207__bitcount16(__uint16_t _x)
2208{
2209
2210 _x = (_x & 0x5555) + ((_x & 0xaaaa) >> 1);
2211 _x = (_x & 0x3333) + ((_x & 0xcccc) >> 2);
2212 _x = (_x + (_x >> 4)) & 0x0f0f;
2213 _x = (_x + (_x >> 8)) & 0x00ff;
2214 return (_x);
2215}
2216
2217static __inline __uint32_t
2218__bitcount32(__uint32_t _x)
2219{
2220
2221 _x = (_x & 0x55555555) + ((_x & 0xaaaaaaaa) >> 1);
2222 _x = (_x & 0x33333333) + ((_x & 0xcccccccc) >> 2);
2223 _x = (_x + (_x >> 4)) & 0x0f0f0f0f;
2224 _x = (_x + (_x >> 8));
2225 _x = (_x + (_x >> 16)) & 0x000000ff;
2226 return (_x);
2227}
2228
2229#ifdef __LP64__
2230static __inline __uint64_t
2231__bitcount64(__uint64_t _x)
2232{
2233
2234 _x = (_x & 0x5555555555555555) + ((_x & 0xaaaaaaaaaaaaaaaa) >> 1);
2235 _x = (_x & 0x3333333333333333) + ((_x & 0xcccccccccccccccc) >> 2);
2236 _x = (_x + (_x >> 4)) & 0x0f0f0f0f0f0f0f0f;
2237 _x = (_x + (_x >> 8));
2238 _x = (_x + (_x >> 16));
2239 _x = (_x + (_x >> 32)) & 0x000000ff;
2240 return (_x);
2241}
2242
2243#define __bitcountl(x) __bitcount64((unsigned long)(x))
2244#else
2245# 351 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/types.h" 3 4
2246static __inline __uint64_t
2247__bitcount64(__uint64_t _x)
2248{
2249
2250 return (__bitcount32(_x >> 32) + __bitcount32(_x));
2251}
2252
2253#define __bitcountl(x) __bitcount32((unsigned long)(x))
2254#endif
2255# 360 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/types.h" 3 4
2256#define __bitcount(x) __bitcount32((unsigned int)(x))
2257#endif
2258# 362 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/types.h" 3 4
2259
2260#if __BSD_VISIBLE
2261
2262#if 0 /* expanded by -frewrite-includes */
2263#include <sys/select.h>
2264#endif /* expanded by -frewrite-includes */
2265# 365 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/types.h" 3 4
2266# 1 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/select.h" 1 3 4
2267/*-
2268 * Copyright (c) 1992, 1993
2269 * The Regents of the University of California. All rights reserved.
2270 *
2271 * Redistribution and use in source and binary forms, with or without
2272 * modification, are permitted provided that the following conditions
2273 * are met:
2274 * 1. Redistributions of source code must retain the above copyright
2275 * notice, this list of conditions and the following disclaimer.
2276 * 2. Redistributions in binary form must reproduce the above copyright
2277 * notice, this list of conditions and the following disclaimer in the
2278 * documentation and/or other materials provided with the distribution.
2279 * 4. Neither the name of the University nor the names of its contributors
2280 * may be used to endorse or promote products derived from this software
2281 * without specific prior written permission.
2282 *
2283 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
2284 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2285 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2286 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
2287 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2288 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2289 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2290 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2291 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2292 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2293 * SUCH DAMAGE.
2294 *
2295 * $FreeBSD$
2296 */
2297
2298#ifndef _SYS_SELECT_H_
2299#define _SYS_SELECT_H_
2300
2301#if 0 /* expanded by -frewrite-includes */
2302#include <sys/cdefs.h>
2303#endif /* expanded by -frewrite-includes */
2304# 35 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/select.h" 3 4
2305# 36 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/select.h" 3 4
2306#if 0 /* expanded by -frewrite-includes */
2307#include <sys/_types.h>
2308#endif /* expanded by -frewrite-includes */
2309# 36 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/select.h" 3 4
2310# 37 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/select.h" 3 4
2311
2312#if 0 /* expanded by -frewrite-includes */
2313#include <sys/_sigset.h>
2314#endif /* expanded by -frewrite-includes */
2315# 38 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/select.h" 3 4
2316# 1 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/_sigset.h" 1 3 4
2317/*-
2318 * Copyright (c) 1982, 1986, 1989, 1991, 1993
2319 * The Regents of the University of California. All rights reserved.
2320 * (c) UNIX System Laboratories, Inc.
2321 * All or some portions of this file are derived from material licensed
2322 * to the University of California by American Telephone and Telegraph
2323 * Co. or Unix System Laboratories, Inc. and are reproduced herein with
2324 * the permission of UNIX System Laboratories, Inc.
2325 *
2326 * Redistribution and use in source and binary forms, with or without
2327 * modification, are permitted provided that the following conditions
2328 * are met:
2329 * 1. Redistributions of source code must retain the above copyright
2330 * notice, this list of conditions and the following disclaimer.
2331 * 2. Redistributions in binary form must reproduce the above copyright
2332 * notice, this list of conditions and the following disclaimer in the
2333 * documentation and/or other materials provided with the distribution.
2334 * 4. Neither the name of the University nor the names of its contributors
2335 * may be used to endorse or promote products derived from this software
2336 * without specific prior written permission.
2337 *
2338 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
2339 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2340 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2341 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
2342 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2343 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2344 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2345 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2346 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2347 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2348 * SUCH DAMAGE.
2349 *
2350 * @(#)signal.h 8.4 (Berkeley) 5/4/95
2351 * $FreeBSD$
2352 */
2353
2354#ifndef _SYS__SIGSET_H_
2355#define _SYS__SIGSET_H_
2356
2357/*
2358 * sigset_t macros.
2359 */
2360#define _SIG_WORDS 4
2361#define _SIG_MAXSIG 128
2362#define _SIG_IDX(sig) ((sig) - 1)
2363#define _SIG_WORD(sig) (_SIG_IDX(sig) >> 5)
2364#define _SIG_BIT(sig) (1 << (_SIG_IDX(sig) & 31))
2365#define _SIG_VALID(sig) ((sig) <= _SIG_MAXSIG && (sig) > 0)
2366
2367typedef struct __sigset {
2368 __uint32_t __bits[_SIG_WORDS];
2369} __sigset_t;
2370
2371#if defined(_KERNEL) && defined(COMPAT_43)
2372typedef unsigned int osigset_t;
2373#endif
2374# 58 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/_sigset.h" 3 4
2375
2376#endif /* !_SYS__SIGSET_H_ */
2377# 60 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/_sigset.h" 3 4
2378# 39 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/select.h" 2 3 4
2379#if 0 /* expanded by -frewrite-includes */
2380#include <sys/_timeval.h>
2381#endif /* expanded by -frewrite-includes */
2382# 39 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/select.h" 3 4
2383# 1 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/_timeval.h" 1 3 4
2384/*-
2385 * Copyright (c) 2002 Mike Barcroft <mike@FreeBSD.org>
2386 * All rights reserved.
2387 *
2388 * Redistribution and use in source and binary forms, with or without
2389 * modification, are permitted provided that the following conditions
2390 * are met:
2391 * 1. Redistributions of source code must retain the above copyright
2392 * notice, this list of conditions and the following disclaimer.
2393 * 2. Redistributions in binary form must reproduce the above copyright
2394 * notice, this list of conditions and the following disclaimer in the
2395 * documentation and/or other materials provided with the distribution.
2396 *
2397 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
2398 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2399 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2400 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
2401 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2402 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2403 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2404 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2405 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2406 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2407 * SUCH DAMAGE.
2408 *
2409 * $FreeBSD$
2410 */
2411
2412#ifndef _SYS__TIMEVAL_H_
2413#define _SYS__TIMEVAL_H_
2414
2415#if 0 /* expanded by -frewrite-includes */
2416#include <sys/_types.h>
2417#endif /* expanded by -frewrite-includes */
2418# 32 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/_timeval.h" 3 4
2419# 33 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/_timeval.h" 3 4
2420
2421#ifndef _SUSECONDS_T_DECLARED
2422typedef __suseconds_t suseconds_t;
2423#define _SUSECONDS_T_DECLARED
2424#endif
2425# 38 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/_timeval.h" 3 4
2426
2427#ifndef _TIME_T_DECLARED
2428typedef __time_t time_t;
2429#define _TIME_T_DECLARED
2430#endif
2431# 43 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/_timeval.h" 3 4
2432
2433/*
2434 * Structure returned by gettimeofday(2) system call, and used in other calls.
2435 */
2436struct timeval {
2437 time_t tv_sec; /* seconds */
2438 suseconds_t tv_usec; /* and microseconds */
2439};
2440
2441#endif /* !_SYS__TIMEVAL_H_ */
2442# 53 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/_timeval.h" 3 4
2443# 40 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/select.h" 2 3 4
2444#if 0 /* expanded by -frewrite-includes */
2445#include <sys/timespec.h>
2446#endif /* expanded by -frewrite-includes */
2447# 40 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/select.h" 3 4
2448# 1 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/timespec.h" 1 3 4
2449/*-
2450 * Copyright (c) 1982, 1986, 1993
2451 * The Regents of the University of California. All rights reserved.
2452 *
2453 * Redistribution and use in source and binary forms, with or without
2454 * modification, are permitted provided that the following conditions
2455 * are met:
2456 * 1. Redistributions of source code must retain the above copyright
2457 * notice, this list of conditions and the following disclaimer.
2458 * 2. Redistributions in binary form must reproduce the above copyright
2459 * notice, this list of conditions and the following disclaimer in the
2460 * documentation and/or other materials provided with the distribution.
2461 * 4. Neither the name of the University nor the names of its contributors
2462 * may be used to endorse or promote products derived from this software
2463 * without specific prior written permission.
2464 *
2465 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
2466 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2467 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2468 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
2469 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2470 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2471 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2472 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2473 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2474 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2475 * SUCH DAMAGE.
2476 *
2477 * @(#)time.h 8.5 (Berkeley) 5/4/95
2478 * from: FreeBSD: src/sys/sys/time.h,v 1.43 2000/03/20 14:09:05 phk Exp
2479 * $FreeBSD$
2480 */
2481
2482#ifndef _SYS_TIMESPEC_H_
2483#define _SYS_TIMESPEC_H_
2484
2485#if 0 /* expanded by -frewrite-includes */
2486#include <sys/cdefs.h>
2487#endif /* expanded by -frewrite-includes */
2488# 37 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/timespec.h" 3 4
2489# 38 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/timespec.h" 3 4
2490#if 0 /* expanded by -frewrite-includes */
2491#include <sys/_timespec.h>
2492#endif /* expanded by -frewrite-includes */
2493# 38 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/timespec.h" 3 4
2494# 1 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/_timespec.h" 1 3 4
2495/*-
2496 * Copyright (c) 1982, 1986, 1993
2497 * The Regents of the University of California. All rights reserved.
2498 *
2499 * Redistribution and use in source and binary forms, with or without
2500 * modification, are permitted provided that the following conditions
2501 * are met:
2502 * 1. Redistributions of source code must retain the above copyright
2503 * notice, this list of conditions and the following disclaimer.
2504 * 2. Redistributions in binary form must reproduce the above copyright
2505 * notice, this list of conditions and the following disclaimer in the
2506 * documentation and/or other materials provided with the distribution.
2507 * 4. Neither the name of the University nor the names of its contributors
2508 * may be used to endorse or promote products derived from this software
2509 * without specific prior written permission.
2510 *
2511 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
2512 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2513 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2514 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
2515 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2516 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2517 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2518 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2519 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2520 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2521 * SUCH DAMAGE.
2522 *
2523 * @(#)time.h 8.5 (Berkeley) 5/4/95
2524 * from: FreeBSD: src/sys/sys/time.h,v 1.43 2000/03/20 14:09:05 phk Exp
2525 * $FreeBSD$
2526 */
2527
2528#ifndef _SYS__TIMESPEC_H_
2529#define _SYS__TIMESPEC_H_
2530
2531#if 0 /* expanded by -frewrite-includes */
2532#include <sys/_types.h>
2533#endif /* expanded by -frewrite-includes */
2534# 37 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/_timespec.h" 3 4
2535# 38 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/_timespec.h" 3 4
2536
2537#ifndef _TIME_T_DECLARED
2538typedef __time_t time_t;
2539#define _TIME_T_DECLARED
2540#endif
2541# 43 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/_timespec.h" 3 4
2542
2543struct timespec {
2544 time_t tv_sec; /* seconds */
2545 long tv_nsec; /* and nanoseconds */
2546};
2547
2548#endif /* !_SYS__TIMESPEC_H_ */
2549# 50 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/_timespec.h" 3 4
2550# 39 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/timespec.h" 2 3 4
2551
2552#if __BSD_VISIBLE
2553#define TIMEVAL_TO_TIMESPEC(tv, ts) \
2554 do { \
2555 (ts)->tv_sec = (tv)->tv_sec; \
2556 (ts)->tv_nsec = (tv)->tv_usec * 1000; \
2557 } while (0)
2558#define TIMESPEC_TO_TIMEVAL(tv, ts) \
2559 do { \
2560 (tv)->tv_sec = (ts)->tv_sec; \
2561 (tv)->tv_usec = (ts)->tv_nsec / 1000; \
2562 } while (0)
2563
2564#endif /* __BSD_VISIBLE */
2565# 53 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/timespec.h" 3 4
2566
2567/*
2568 * Structure defined by POSIX.1b to be like a itimerval, but with
2569 * timespecs. Used in the timer_*() system calls.
2570 */
2571struct itimerspec {
2572 struct timespec it_interval;
2573 struct timespec it_value;
2574};
2575
2576#endif /* _SYS_TIMESPEC_H_ */
2577# 64 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/timespec.h" 3 4
2578# 41 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/select.h" 2 3 4
2579
2580typedef unsigned long __fd_mask;
2581#if __BSD_VISIBLE
2582typedef __fd_mask fd_mask;
2583#endif
2584# 46 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/select.h" 3 4
2585
2586#ifndef _SIGSET_T_DECLARED
2587#define _SIGSET_T_DECLARED
2588typedef __sigset_t sigset_t;
2589#endif
2590# 51 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/select.h" 3 4
2591
2592/*
2593 * Select uses bit masks of file descriptors in longs. These macros
2594 * manipulate such bit fields (the filesystem macros use chars).
2595 * FD_SETSIZE may be defined by the user, but the default here should
2596 * be enough for most uses.
2597 */
2598#ifndef FD_SETSIZE
2599#define FD_SETSIZE 1024
2600#endif
2601# 61 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/select.h" 3 4
2602
2603#define _NFDBITS (sizeof(__fd_mask) * 8) /* bits per mask */
2604#if __BSD_VISIBLE
2605#define NFDBITS _NFDBITS
2606#endif
2607# 66 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/select.h" 3 4
2608
2609#ifndef _howmany
2610#define _howmany(x, y) (((x) + ((y) - 1)) / (y))
2611#endif
2612# 70 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/select.h" 3 4
2613
2614typedef struct fd_set {
2615 __fd_mask __fds_bits[_howmany(FD_SETSIZE, _NFDBITS)];
2616} fd_set;
2617#if __BSD_VISIBLE
2618#define fds_bits __fds_bits
2619#endif
2620# 77 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/select.h" 3 4
2621
2622#define __fdset_mask(n) ((__fd_mask)1 << ((n) % _NFDBITS))
2623#define FD_CLR(n, p) ((p)->__fds_bits[(n)/_NFDBITS] &= ~__fdset_mask(n))
2624#if __BSD_VISIBLE
2625#define FD_COPY(f, t) (void)(*(t) = *(f))
2626#endif
2627# 83 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/select.h" 3 4
2628#define FD_ISSET(n, p) (((p)->__fds_bits[(n)/_NFDBITS] & __fdset_mask(n)) != 0)
2629#define FD_SET(n, p) ((p)->__fds_bits[(n)/_NFDBITS] |= __fdset_mask(n))
2630#define FD_ZERO(p) do { \
2631 fd_set *_p; \
2632 __size_t _n; \
2633 \
2634 _p = (p); \
2635 _n = _howmany(FD_SETSIZE, _NFDBITS); \
2636 while (_n > 0) \
2637 _p->__fds_bits[--_n] = 0; \
2638} while (0)
2639
2640#ifndef _KERNEL
2641
2642__BEGIN_DECLS
2643int pselect(int, fd_set *__restrict, fd_set *__restrict, fd_set *__restrict,
2644 const struct timespec *__restrict, const sigset_t *__restrict);
2645#ifndef _SELECT_DECLARED
2646#define _SELECT_DECLARED
2647/* XXX missing restrict type-qualifier */
2648int select(int, fd_set *, fd_set *, fd_set *, struct timeval *);
2649#endif
2650# 105 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/select.h" 3 4
2651__END_DECLS
2652#endif /* !_KERNEL */
2653# 107 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/select.h" 3 4
2654
2655#endif /* _SYS_SELECT_H_ */
2656# 109 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/select.h" 3 4
2657# 366 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/types.h" 2 3 4
2658
2659/*
2660 * minor() gives a cookie instead of an index since we don't want to
2661 * change the meanings of bits 0-15 or waste time and space shifting
2662 * bits 16-31 for devices that don't use them.
2663 */
2664#define major(x) ((int)(((u_int)(x) >> 8)&0xff)) /* major number */
2665#define minor(x) ((int)((x)&0xffff00ff)) /* minor number */
2666#define makedev(x,y) ((dev_t)(((x) << 8) | (y))) /* create dev_t */
2667
2668/*
2669 * These declarations belong elsewhere, but are repeated here and in
2670 * <stdio.h> to give broken programs a better chance of working with
2671 * 64-bit off_t's.
2672 */
2673#ifndef _KERNEL
2674__BEGIN_DECLS
2675#ifndef _FTRUNCATE_DECLARED
2676#define _FTRUNCATE_DECLARED
2677int ftruncate(int, off_t);
2678#endif
2679# 387 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/types.h" 3 4
2680#ifndef _LSEEK_DECLARED
2681#define _LSEEK_DECLARED
2682off_t lseek(int, off_t, int);
2683#endif
2684# 391 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/types.h" 3 4
2685#ifndef _MMAP_DECLARED
2686#define _MMAP_DECLARED
2687void * mmap(void *, size_t, int, int, int, off_t);
2688#endif
2689# 395 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/types.h" 3 4
2690#ifndef _TRUNCATE_DECLARED
2691#define _TRUNCATE_DECLARED
2692int truncate(const char *, off_t);
2693#endif
2694# 399 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/types.h" 3 4
2695__END_DECLS
2696#endif /* !_KERNEL */
2697# 401 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/types.h" 3 4
2698
2699#endif /* __BSD_VISIBLE */
2700# 403 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/types.h" 3 4
2701
2702#endif /* !_SYS_TYPES_H_ */
2703# 405 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/types.h" 3 4
2704# 39 "/home/alr48/cheri/sources/cheribsd/bin/cheritest/cheritest_registers.c" 2
2705#if 0 /* expanded by -frewrite-includes */
2706#include <sys/sysctl.h>
2707#endif /* expanded by -frewrite-includes */
2708# 39 "/home/alr48/cheri/sources/cheribsd/bin/cheritest/cheritest_registers.c"
2709# 1 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/sysctl.h" 1 3 4
2710/*-
2711 * Copyright (c) 1989, 1993
2712 * The Regents of the University of California. All rights reserved.
2713 *
2714 * This code is derived from software contributed to Berkeley by
2715 * Mike Karels at Berkeley Software Design, Inc.
2716 *
2717 * Redistribution and use in source and binary forms, with or without
2718 * modification, are permitted provided that the following conditions
2719 * are met:
2720 * 1. Redistributions of source code must retain the above copyright
2721 * notice, this list of conditions and the following disclaimer.
2722 * 2. Redistributions in binary form must reproduce the above copyright
2723 * notice, this list of conditions and the following disclaimer in the
2724 * documentation and/or other materials provided with the distribution.
2725 * 4. Neither the name of the University nor the names of its contributors
2726 * may be used to endorse or promote products derived from this software
2727 * without specific prior written permission.
2728 *
2729 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
2730 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2731 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2732 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
2733 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2734 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2735 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2736 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2737 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2738 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2739 * SUCH DAMAGE.
2740 *
2741 * @(#)sysctl.h 8.1 (Berkeley) 6/2/93
2742 * $FreeBSD$
2743 */
2744
2745#ifndef _SYS_SYSCTL_H_
2746#define _SYS_SYSCTL_H_
2747
2748#if 0 /* expanded by -frewrite-includes */
2749#include <sys/queue.h>
2750#endif /* expanded by -frewrite-includes */
2751# 39 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/sysctl.h" 3 4
2752# 1 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/queue.h" 1 3 4
2753/*-
2754 * Copyright (c) 1991, 1993
2755 * The Regents of the University of California. All rights reserved.
2756 *
2757 * Redistribution and use in source and binary forms, with or without
2758 * modification, are permitted provided that the following conditions
2759 * are met:
2760 * 1. Redistributions of source code must retain the above copyright
2761 * notice, this list of conditions and the following disclaimer.
2762 * 2. Redistributions in binary form must reproduce the above copyright
2763 * notice, this list of conditions and the following disclaimer in the
2764 * documentation and/or other materials provided with the distribution.
2765 * 4. Neither the name of the University nor the names of its contributors
2766 * may be used to endorse or promote products derived from this software
2767 * without specific prior written permission.
2768 *
2769 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
2770 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2771 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2772 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
2773 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2774 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2775 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2776 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2777 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2778 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2779 * SUCH DAMAGE.
2780 *
2781 * @(#)queue.h 8.5 (Berkeley) 8/20/94
2782 * $FreeBSD$
2783 */
2784
2785#ifndef _SYS_QUEUE_H_
2786#define _SYS_QUEUE_H_
2787
2788#if 0 /* expanded by -frewrite-includes */
2789#include <sys/cdefs.h>
2790#endif /* expanded by -frewrite-includes */
2791# 36 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/queue.h" 3 4
2792# 37 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/queue.h" 3 4
2793
2794/*
2795 * This file defines four types of data structures: singly-linked lists,
2796 * singly-linked tail queues, lists and tail queues.
2797 *
2798 * A singly-linked list is headed by a single forward pointer. The elements
2799 * are singly linked for minimum space and pointer manipulation overhead at
2800 * the expense of O(n) removal for arbitrary elements. New elements can be
2801 * added to the list after an existing element or at the head of the list.
2802 * Elements being removed from the head of the list should use the explicit
2803 * macro for this purpose for optimum efficiency. A singly-linked list may
2804 * only be traversed in the forward direction. Singly-linked lists are ideal
2805 * for applications with large datasets and few or no removals or for
2806 * implementing a LIFO queue.
2807 *
2808 * A singly-linked tail queue is headed by a pair of pointers, one to the
2809 * head of the list and the other to the tail of the list. The elements are
2810 * singly linked for minimum space and pointer manipulation overhead at the
2811 * expense of O(n) removal for arbitrary elements. New elements can be added
2812 * to the list after an existing element, at the head of the list, or at the
2813 * end of the list. Elements being removed from the head of the tail queue
2814 * should use the explicit macro for this purpose for optimum efficiency.
2815 * A singly-linked tail queue may only be traversed in the forward direction.
2816 * Singly-linked tail queues are ideal for applications with large datasets
2817 * and few or no removals or for implementing a FIFO queue.
2818 *
2819 * A list is headed by a single forward pointer (or an array of forward
2820 * pointers for a hash table header). The elements are doubly linked
2821 * so that an arbitrary element can be removed without a need to
2822 * traverse the list. New elements can be added to the list before
2823 * or after an existing element or at the head of the list. A list
2824 * may be traversed in either direction.
2825 *
2826 * A tail queue is headed by a pair of pointers, one to the head of the
2827 * list and the other to the tail of the list. The elements are doubly
2828 * linked so that an arbitrary element can be removed without a need to
2829 * traverse the list. New elements can be added to the list before or
2830 * after an existing element, at the head of the list, or at the end of
2831 * the list. A tail queue may be traversed in either direction.
2832 *
2833 * For details on the use of these macros, see the queue(3) manual page.
2834 *
2835 * Below is a summary of implemented functions where:
2836 * + means the macro is available
2837 * - means the macro is not available
2838 * s means the macro is available but is slow (runs in O(n) time)
2839 *
2840 * SLIST LIST STAILQ TAILQ
2841 * _HEAD + + + +
2842 * _CLASS_HEAD + + + +
2843 * _HEAD_INITIALIZER + + + +
2844 * _ENTRY + + + +
2845 * _CLASS_ENTRY + + + +
2846 * _INIT + + + +
2847 * _EMPTY + + + +
2848 * _FIRST + + + +
2849 * _NEXT + + + +
2850 * _PREV - + - +
2851 * _LAST - - + +
2852 * _FOREACH + + + +
2853 * _FOREACH_FROM + + + +
2854 * _FOREACH_SAFE + + + +
2855 * _FOREACH_FROM_SAFE + + + +
2856 * _FOREACH_REVERSE - - - +
2857 * _FOREACH_REVERSE_FROM - - - +
2858 * _FOREACH_REVERSE_SAFE - - - +
2859 * _FOREACH_REVERSE_FROM_SAFE - - - +
2860 * _INSERT_HEAD + + + +
2861 * _INSERT_BEFORE - + - +
2862 * _INSERT_AFTER + + + +
2863 * _INSERT_TAIL - - + +
2864 * _CONCAT s s + +
2865 * _REMOVE_AFTER + - + -
2866 * _REMOVE_HEAD + - + -
2867 * _REMOVE s + s +
2868 * _SWAP + + + +
2869 *
2870 */
2871#ifdef QUEUE_MACRO_DEBUG
2872#warn Use QUEUE_MACRO_DEBUG_TRACE and/or QUEUE_MACRO_DEBUG_TRASH
2873#define QUEUE_MACRO_DEBUG_TRACE
2874#define QUEUE_MACRO_DEBUG_TRASH
2875#endif
2876# 120 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/queue.h" 3 4
2877
2878#ifdef QUEUE_MACRO_DEBUG_TRACE
2879/* Store the last 2 places the queue element or head was altered */
2880struct qm_trace {
2881 unsigned long lastline;
2882 unsigned long prevline;
2883 const char *lastfile;
2884 const char *prevfile;
2885};
2886
2887#define TRACEBUF struct qm_trace trace;
2888#define TRACEBUF_INITIALIZER { __LINE__, 0, __FILE__, NULL } ,
2889
2890#define QMD_TRACE_HEAD(head) do { \
2891 (head)->trace.prevline = (head)->trace.lastline; \
2892 (head)->trace.prevfile = (head)->trace.lastfile; \
2893 (head)->trace.lastline = __LINE__; \
2894 (head)->trace.lastfile = __FILE__; \
2895} while (0)
2896
2897#define QMD_TRACE_ELEM(elem) do { \
2898 (elem)->trace.prevline = (elem)->trace.lastline; \
2899 (elem)->trace.prevfile = (elem)->trace.lastfile; \
2900 (elem)->trace.lastline = __LINE__; \
2901 (elem)->trace.lastfile = __FILE__; \
2902} while (0)
2903
2904#else /* !QUEUE_MACRO_DEBUG_TRACE */
2905# 148 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/queue.h" 3 4
2906#define QMD_TRACE_ELEM(elem)
2907#define QMD_TRACE_HEAD(head)
2908#define TRACEBUF
2909#define TRACEBUF_INITIALIZER
2910#endif /* QUEUE_MACRO_DEBUG_TRACE */
2911# 153 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/queue.h" 3 4
2912
2913#ifdef QUEUE_MACRO_DEBUG_TRASH
2914#define TRASHIT(x) do {(x) = (void *)-1;} while (0)
2915#define QMD_IS_TRASHED(x) ((x) == (void *)(intptr_t)-1)
2916#else /* !QUEUE_MACRO_DEBUG_TRASH */
2917# 158 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/queue.h" 3 4
2918#define TRASHIT(x)
2919#define QMD_IS_TRASHED(x) 0
2920#endif /* QUEUE_MACRO_DEBUG_TRASH */
2921# 161 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/queue.h" 3 4
2922
2923#if defined(QUEUE_MACRO_DEBUG_TRACE) || defined(QUEUE_MACRO_DEBUG_TRASH)
2924#define QMD_SAVELINK(name, link) void **name = (void *)&(link)
2925#else /* !QUEUE_MACRO_DEBUG_TRACE && !QUEUE_MACRO_DEBUG_TRASH */
2926# 165 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/queue.h" 3 4
2927#define QMD_SAVELINK(name, link)
2928#endif /* QUEUE_MACRO_DEBUG_TRACE || QUEUE_MACRO_DEBUG_TRASH */
2929# 167 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/queue.h" 3 4
2930
2931#ifdef __cplusplus
2932/*
2933 * In C++ there can be structure lists and class lists:
2934 */
2935#define QUEUE_TYPEOF(type) type
2936#else
2937# 174 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/queue.h" 3 4
2938#define QUEUE_TYPEOF(type) struct type
2939#endif
2940# 176 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/queue.h" 3 4
2941
2942/*
2943 * Singly-linked List declarations.
2944 */
2945#define SLIST_HEAD(name, type) \
2946struct name { \
2947 struct type *slh_first; /* first element */ \
2948}
2949
2950#define SLIST_CLASS_HEAD(name, type) \
2951struct name { \
2952 class type *slh_first; /* first element */ \
2953}
2954
2955#define SLIST_HEAD_INITIALIZER(head) \
2956 { NULL }
2957
2958#define SLIST_ENTRY(type) \
2959struct { \
2960 struct type *sle_next; /* next element */ \
2961}
2962
2963#define SLIST_CLASS_ENTRY(type) \
2964struct { \
2965 class type *sle_next; /* next element */ \
2966}
2967
2968/*
2969 * Singly-linked List functions.
2970 */
2971#if (defined(_KERNEL) && defined(INVARIANTS))
2972#define QMD_SLIST_CHECK_PREVPTR(prevp, elm) do { \
2973 if (*(prevp) != (elm)) \
2974 panic("Bad prevptr *(%p) == %p != %p", \
2975 (prevp), *(prevp), (elm)); \
2976} while (0)
2977#else
2978# 213 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/queue.h" 3 4
2979#define QMD_SLIST_CHECK_PREVPTR(prevp, elm)
2980#endif
2981# 215 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/queue.h" 3 4
2982
2983#define SLIST_CONCAT(head1, head2, type, field) do { \
2984 QUEUE_TYPEOF(type) *curelm = SLIST_FIRST(head1); \
2985 if (curelm == NULL) { \
2986 if ((SLIST_FIRST(head1) = SLIST_FIRST(head2)) != NULL) \
2987 SLIST_INIT(head2); \
2988 } else if (SLIST_FIRST(head2) != NULL) { \
2989 while (SLIST_NEXT(curelm, field) != NULL) \
2990 curelm = SLIST_NEXT(curelm, field); \
2991 SLIST_NEXT(curelm, field) = SLIST_FIRST(head2); \
2992 SLIST_INIT(head2); \
2993 } \
2994} while (0)
2995
2996#define SLIST_EMPTY(head) ((head)->slh_first == NULL)
2997
2998#define SLIST_FIRST(head) ((head)->slh_first)
2999
3000#define SLIST_FOREACH(var, head, field) \
3001 for ((var) = SLIST_FIRST((head)); \
3002 (var); \
3003 (var) = SLIST_NEXT((var), field))
3004
3005#define SLIST_FOREACH_FROM(var, head, field) \
3006 for ((var) = ((var) ? (var) : SLIST_FIRST((head))); \
3007 (var); \
3008 (var) = SLIST_NEXT((var), field))
3009
3010#define SLIST_FOREACH_SAFE(var, head, field, tvar) \
3011 for ((var) = SLIST_FIRST((head)); \
3012 (var) && ((tvar) = SLIST_NEXT((var), field), 1); \
3013 (var) = (tvar))
3014
3015#define SLIST_FOREACH_FROM_SAFE(var, head, field, tvar) \
3016 for ((var) = ((var) ? (var) : SLIST_FIRST((head))); \
3017 (var) && ((tvar) = SLIST_NEXT((var), field), 1); \
3018 (var) = (tvar))
3019
3020#define SLIST_FOREACH_PREVPTR(var, varp, head, field) \
3021 for ((varp) = &SLIST_FIRST((head)); \
3022 ((var) = *(varp)) != NULL; \
3023 (varp) = &SLIST_NEXT((var), field))
3024
3025#define SLIST_INIT(head) do { \
3026 SLIST_FIRST((head)) = NULL; \
3027} while (0)
3028
3029#define SLIST_INSERT_AFTER(slistelm, elm, field) do { \
3030 SLIST_NEXT((elm), field) = SLIST_NEXT((slistelm), field); \
3031 SLIST_NEXT((slistelm), field) = (elm); \
3032} while (0)
3033
3034#define SLIST_INSERT_HEAD(head, elm, field) do { \
3035 SLIST_NEXT((elm), field) = SLIST_FIRST((head)); \
3036 SLIST_FIRST((head)) = (elm); \
3037} while (0)
3038
3039#define SLIST_NEXT(elm, field) ((elm)->field.sle_next)
3040
3041#define SLIST_REMOVE(head, elm, type, field) do { \
3042 QMD_SAVELINK(oldnext, (elm)->field.sle_next); \
3043 if (SLIST_FIRST((head)) == (elm)) { \
3044 SLIST_REMOVE_HEAD((head), field); \
3045 } \
3046 else { \
3047 QUEUE_TYPEOF(type) *curelm = SLIST_FIRST(head); \
3048 while (SLIST_NEXT(curelm, field) != (elm)) \
3049 curelm = SLIST_NEXT(curelm, field); \
3050 SLIST_REMOVE_AFTER(curelm, field); \
3051 } \
3052 TRASHIT(*oldnext); \
3053} while (0)
3054
3055#define SLIST_REMOVE_AFTER(elm, field) do { \
3056 SLIST_NEXT(elm, field) = \
3057 SLIST_NEXT(SLIST_NEXT(elm, field), field); \
3058} while (0)
3059
3060#define SLIST_REMOVE_HEAD(head, field) do { \
3061 SLIST_FIRST((head)) = SLIST_NEXT(SLIST_FIRST((head)), field); \
3062} while (0)
3063
3064#define SLIST_REMOVE_PREVPTR(prevp, elm, field) do { \
3065 QMD_SLIST_CHECK_PREVPTR(prevp, elm); \
3066 *(prevp) = SLIST_NEXT(elm, field); \
3067 TRASHIT((elm)->field.sle_next); \
3068} while (0)
3069
3070#define SLIST_SWAP(head1, head2, type) do { \
3071 QUEUE_TYPEOF(type) *swap_first = SLIST_FIRST(head1); \
3072 SLIST_FIRST(head1) = SLIST_FIRST(head2); \
3073 SLIST_FIRST(head2) = swap_first; \
3074} while (0)
3075
3076/*
3077 * Singly-linked Tail queue declarations.
3078 */
3079#define STAILQ_HEAD(name, type) \
3080struct name { \
3081 struct type *stqh_first;/* first element */ \
3082 struct type **stqh_last;/* addr of last next element */ \
3083}
3084
3085#define STAILQ_CLASS_HEAD(name, type) \
3086struct name { \
3087 class type *stqh_first; /* first element */ \
3088 class type **stqh_last; /* addr of last next element */ \
3089}
3090
3091#define STAILQ_HEAD_INITIALIZER(head) \
3092 { NULL, &(head).stqh_first }
3093
3094#define STAILQ_ENTRY(type) \
3095struct { \
3096 struct type *stqe_next; /* next element */ \
3097}
3098
3099#define STAILQ_CLASS_ENTRY(type) \
3100struct { \
3101 class type *stqe_next; /* next element */ \
3102}
3103
3104/*
3105 * Singly-linked Tail queue functions.
3106 */
3107#define STAILQ_CONCAT(head1, head2) do { \
3108 if (!STAILQ_EMPTY((head2))) { \
3109 *(head1)->stqh_last = (head2)->stqh_first; \
3110 (head1)->stqh_last = (head2)->stqh_last; \
3111 STAILQ_INIT((head2)); \
3112 } \
3113} while (0)
3114
3115#define STAILQ_EMPTY(head) ((head)->stqh_first == NULL)
3116
3117#define STAILQ_FIRST(head) ((head)->stqh_first)
3118
3119#define STAILQ_FOREACH(var, head, field) \
3120 for((var) = STAILQ_FIRST((head)); \
3121 (var); \
3122 (var) = STAILQ_NEXT((var), field))
3123
3124#define STAILQ_FOREACH_FROM(var, head, field) \
3125 for ((var) = ((var) ? (var) : STAILQ_FIRST((head))); \
3126 (var); \
3127 (var) = STAILQ_NEXT((var), field))
3128
3129#define STAILQ_FOREACH_SAFE(var, head, field, tvar) \
3130 for ((var) = STAILQ_FIRST((head)); \
3131 (var) && ((tvar) = STAILQ_NEXT((var), field), 1); \
3132 (var) = (tvar))
3133
3134#define STAILQ_FOREACH_FROM_SAFE(var, head, field, tvar) \
3135 for ((var) = ((var) ? (var) : STAILQ_FIRST((head))); \
3136 (var) && ((tvar) = STAILQ_NEXT((var), field), 1); \
3137 (var) = (tvar))
3138
3139#define STAILQ_INIT(head) do { \
3140 STAILQ_FIRST((head)) = NULL; \
3141 (head)->stqh_last = &STAILQ_FIRST((head)); \
3142} while (0)
3143
3144#define STAILQ_INSERT_AFTER(head, tqelm, elm, field) do { \
3145 if ((STAILQ_NEXT((elm), field) = STAILQ_NEXT((tqelm), field)) == NULL)\
3146 (head)->stqh_last = &STAILQ_NEXT((elm), field); \
3147 STAILQ_NEXT((tqelm), field) = (elm); \
3148} while (0)
3149
3150#define STAILQ_INSERT_HEAD(head, elm, field) do { \
3151 if ((STAILQ_NEXT((elm), field) = STAILQ_FIRST((head))) == NULL) \
3152 (head)->stqh_last = &STAILQ_NEXT((elm), field); \
3153 STAILQ_FIRST((head)) = (elm); \
3154} while (0)
3155
3156#define STAILQ_INSERT_TAIL(head, elm, field) do { \
3157 STAILQ_NEXT((elm), field) = NULL; \
3158 *(head)->stqh_last = (elm); \
3159 (head)->stqh_last = &STAILQ_NEXT((elm), field); \
3160} while (0)
3161
3162#define STAILQ_LAST(head, type, field) \
3163 (STAILQ_EMPTY((head)) ? NULL : \
3164 __containerof((head)->stqh_last, \
3165 QUEUE_TYPEOF(type), field.stqe_next))
3166
3167#define STAILQ_NEXT(elm, field) ((elm)->field.stqe_next)
3168
3169#define STAILQ_REMOVE(head, elm, type, field) do { \
3170 QMD_SAVELINK(oldnext, (elm)->field.stqe_next); \
3171 if (STAILQ_FIRST((head)) == (elm)) { \
3172 STAILQ_REMOVE_HEAD((head), field); \
3173 } \
3174 else { \
3175 QUEUE_TYPEOF(type) *curelm = STAILQ_FIRST(head); \
3176 while (STAILQ_NEXT(curelm, field) != (elm)) \
3177 curelm = STAILQ_NEXT(curelm, field); \
3178 STAILQ_REMOVE_AFTER(head, curelm, field); \
3179 } \
3180 TRASHIT(*oldnext); \
3181} while (0)
3182
3183#define STAILQ_REMOVE_AFTER(head, elm, field) do { \
3184 if ((STAILQ_NEXT(elm, field) = \
3185 STAILQ_NEXT(STAILQ_NEXT(elm, field), field)) == NULL) \
3186 (head)->stqh_last = &STAILQ_NEXT((elm), field); \
3187} while (0)
3188
3189#define STAILQ_REMOVE_HEAD(head, field) do { \
3190 if ((STAILQ_FIRST((head)) = \
3191 STAILQ_NEXT(STAILQ_FIRST((head)), field)) == NULL) \
3192 (head)->stqh_last = &STAILQ_FIRST((head)); \
3193} while (0)
3194
3195#define STAILQ_SWAP(head1, head2, type) do { \
3196 QUEUE_TYPEOF(type) *swap_first = STAILQ_FIRST(head1); \
3197 QUEUE_TYPEOF(type) **swap_last = (head1)->stqh_last; \
3198 STAILQ_FIRST(head1) = STAILQ_FIRST(head2); \
3199 (head1)->stqh_last = (head2)->stqh_last; \
3200 STAILQ_FIRST(head2) = swap_first; \
3201 (head2)->stqh_last = swap_last; \
3202 if (STAILQ_EMPTY(head1)) \
3203 (head1)->stqh_last = &STAILQ_FIRST(head1); \
3204 if (STAILQ_EMPTY(head2)) \
3205 (head2)->stqh_last = &STAILQ_FIRST(head2); \
3206} while (0)
3207
3208
3209/*
3210 * List declarations.
3211 */
3212#define LIST_HEAD(name, type) \
3213struct name { \
3214 struct type *lh_first; /* first element */ \
3215}
3216
3217#define LIST_CLASS_HEAD(name, type) \
3218struct name { \
3219 class type *lh_first; /* first element */ \
3220}
3221
3222#define LIST_HEAD_INITIALIZER(head) \
3223 { NULL }
3224
3225#define LIST_ENTRY(type) \
3226struct { \
3227 struct type *le_next; /* next element */ \
3228 struct type **le_prev; /* address of previous next element */ \
3229}
3230
3231#define LIST_CLASS_ENTRY(type) \
3232struct { \
3233 class type *le_next; /* next element */ \
3234 class type **le_prev; /* address of previous next element */ \
3235}
3236
3237/*
3238 * List functions.
3239 */
3240
3241#if (defined(_KERNEL) && defined(INVARIANTS))
3242#define QMD_LIST_CHECK_HEAD(head, field) do { \
3243 if (LIST_FIRST((head)) != NULL && \
3244 LIST_FIRST((head))->field.le_prev != \
3245 &LIST_FIRST((head))) \
3246 panic("Bad list head %p first->prev != head", (head)); \
3247} while (0)
3248
3249#define QMD_LIST_CHECK_NEXT(elm, field) do { \
3250 if (LIST_NEXT((elm), field) != NULL && \
3251 LIST_NEXT((elm), field)->field.le_prev != \
3252 &((elm)->field.le_next)) \
3253 panic("Bad link elm %p next->prev != elm", (elm)); \
3254} while (0)
3255
3256#define QMD_LIST_CHECK_PREV(elm, field) do { \
3257 if (*(elm)->field.le_prev != (elm)) \
3258 panic("Bad link elm %p prev->next != elm", (elm)); \
3259} while (0)
3260#else
3261# 494 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/queue.h" 3 4
3262#define QMD_LIST_CHECK_HEAD(head, field)
3263#define QMD_LIST_CHECK_NEXT(elm, field)
3264#define QMD_LIST_CHECK_PREV(elm, field)
3265#endif /* (_KERNEL && INVARIANTS) */
3266# 498 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/queue.h" 3 4
3267
3268#define LIST_CONCAT(head1, head2, type, field) do { \
3269 QUEUE_TYPEOF(type) *curelm = LIST_FIRST(head1); \
3270 if (curelm == NULL) { \
3271 if ((LIST_FIRST(head1) = LIST_FIRST(head2)) != NULL) { \
3272 LIST_FIRST(head2)->field.le_prev = \
3273 &LIST_FIRST((head1)); \
3274 LIST_INIT(head2); \
3275 } \
3276 } else if (LIST_FIRST(head2) != NULL) { \
3277 while (LIST_NEXT(curelm, field) != NULL) \
3278 curelm = LIST_NEXT(curelm, field); \
3279 LIST_NEXT(curelm, field) = LIST_FIRST(head2); \
3280 LIST_FIRST(head2)->field.le_prev = &LIST_NEXT(curelm, field); \
3281 LIST_INIT(head2); \
3282 } \
3283} while (0)
3284
3285#define LIST_EMPTY(head) ((head)->lh_first == NULL)
3286
3287#define LIST_FIRST(head) ((head)->lh_first)
3288
3289#define LIST_FOREACH(var, head, field) \
3290 for ((var) = LIST_FIRST((head)); \
3291 (var); \
3292 (var) = LIST_NEXT((var), field))
3293
3294#define LIST_FOREACH_FROM(var, head, field) \
3295 for ((var) = ((var) ? (var) : LIST_FIRST((head))); \
3296 (var); \
3297 (var) = LIST_NEXT((var), field))
3298
3299#define LIST_FOREACH_SAFE(var, head, field, tvar) \
3300 for ((var) = LIST_FIRST((head)); \
3301 (var) && ((tvar) = LIST_NEXT((var), field), 1); \
3302 (var) = (tvar))
3303
3304#define LIST_FOREACH_FROM_SAFE(var, head, field, tvar) \
3305 for ((var) = ((var) ? (var) : LIST_FIRST((head))); \
3306 (var) && ((tvar) = LIST_NEXT((var), field), 1); \
3307 (var) = (tvar))
3308
3309#define LIST_INIT(head) do { \
3310 LIST_FIRST((head)) = NULL; \
3311} while (0)
3312
3313#define LIST_INSERT_AFTER(listelm, elm, field) do { \
3314 QMD_LIST_CHECK_NEXT(listelm, field); \
3315 if ((LIST_NEXT((elm), field) = LIST_NEXT((listelm), field)) != NULL)\
3316 LIST_NEXT((listelm), field)->field.le_prev = \
3317 &LIST_NEXT((elm), field); \
3318 LIST_NEXT((listelm), field) = (elm); \
3319 (elm)->field.le_prev = &LIST_NEXT((listelm), field); \
3320} while (0)
3321
3322#define LIST_INSERT_BEFORE(listelm, elm, field) do { \
3323 QMD_LIST_CHECK_PREV(listelm, field); \
3324 (elm)->field.le_prev = (listelm)->field.le_prev; \
3325 LIST_NEXT((elm), field) = (listelm); \
3326 *(listelm)->field.le_prev = (elm); \
3327 (listelm)->field.le_prev = &LIST_NEXT((elm), field); \
3328} while (0)
3329
3330#define LIST_INSERT_HEAD(head, elm, field) do { \
3331 QMD_LIST_CHECK_HEAD((head), field); \
3332 if ((LIST_NEXT((elm), field) = LIST_FIRST((head))) != NULL) \
3333 LIST_FIRST((head))->field.le_prev = &LIST_NEXT((elm), field);\
3334 LIST_FIRST((head)) = (elm); \
3335 (elm)->field.le_prev = &LIST_FIRST((head)); \
3336} while (0)
3337
3338#define LIST_NEXT(elm, field) ((elm)->field.le_next)
3339
3340#define LIST_PREV(elm, head, type, field) \
3341 ((elm)->field.le_prev == &LIST_FIRST((head)) ? NULL : \
3342 __containerof((elm)->field.le_prev, \
3343 QUEUE_TYPEOF(type), field.le_next))
3344
3345#define LIST_REMOVE(elm, field) do { \
3346 QMD_SAVELINK(oldnext, (elm)->field.le_next); \
3347 QMD_SAVELINK(oldprev, (elm)->field.le_prev); \
3348 QMD_LIST_CHECK_NEXT(elm, field); \
3349 QMD_LIST_CHECK_PREV(elm, field); \
3350 if (LIST_NEXT((elm), field) != NULL) \
3351 LIST_NEXT((elm), field)->field.le_prev = \
3352 (elm)->field.le_prev; \
3353 *(elm)->field.le_prev = LIST_NEXT((elm), field); \
3354 TRASHIT(*oldnext); \
3355 TRASHIT(*oldprev); \
3356} while (0)
3357
3358#define LIST_SWAP(head1, head2, type, field) do { \
3359 QUEUE_TYPEOF(type) *swap_tmp = LIST_FIRST(head1); \
3360 LIST_FIRST((head1)) = LIST_FIRST((head2)); \
3361 LIST_FIRST((head2)) = swap_tmp; \
3362 if ((swap_tmp = LIST_FIRST((head1))) != NULL) \
3363 swap_tmp->field.le_prev = &LIST_FIRST((head1)); \
3364 if ((swap_tmp = LIST_FIRST((head2))) != NULL) \
3365 swap_tmp->field.le_prev = &LIST_FIRST((head2)); \
3366} while (0)
3367
3368/*
3369 * Tail queue declarations.
3370 */
3371#define TAILQ_HEAD(name, type) \
3372struct name { \
3373 struct type *tqh_first; /* first element */ \
3374 struct type **tqh_last; /* addr of last next element */ \
3375 TRACEBUF \
3376}
3377
3378#define TAILQ_CLASS_HEAD(name, type) \
3379struct name { \
3380 class type *tqh_first; /* first element */ \
3381 class type **tqh_last; /* addr of last next element */ \
3382 TRACEBUF \
3383}
3384
3385#define TAILQ_HEAD_INITIALIZER(head) \
3386 { NULL, &(head).tqh_first, TRACEBUF_INITIALIZER }
3387
3388#define TAILQ_ENTRY(type) \
3389struct { \
3390 struct type *tqe_next; /* next element */ \
3391 struct type **tqe_prev; /* address of previous next element */ \
3392 TRACEBUF \
3393}
3394
3395#define TAILQ_CLASS_ENTRY(type) \
3396struct { \
3397 class type *tqe_next; /* next element */ \
3398 class type **tqe_prev; /* address of previous next element */ \
3399 TRACEBUF \
3400}
3401
3402/*
3403 * Tail queue functions.
3404 */
3405#if (defined(_KERNEL) && defined(INVARIANTS))
3406#define QMD_TAILQ_CHECK_HEAD(head, field) do { \
3407 if (!TAILQ_EMPTY(head) && \
3408 TAILQ_FIRST((head))->field.tqe_prev != \
3409 &TAILQ_FIRST((head))) \
3410 panic("Bad tailq head %p first->prev != head", (head)); \
3411} while (0)
3412
3413#define QMD_TAILQ_CHECK_TAIL(head, field) do { \
3414 if (*(head)->tqh_last != NULL) \
3415 panic("Bad tailq NEXT(%p->tqh_last) != NULL", (head)); \
3416} while (0)
3417
3418#define QMD_TAILQ_CHECK_NEXT(elm, field) do { \
3419 if (TAILQ_NEXT((elm), field) != NULL && \
3420 TAILQ_NEXT((elm), field)->field.tqe_prev != \
3421 &((elm)->field.tqe_next)) \
3422 panic("Bad link elm %p next->prev != elm", (elm)); \
3423} while (0)
3424
3425#define QMD_TAILQ_CHECK_PREV(elm, field) do { \
3426 if (*(elm)->field.tqe_prev != (elm)) \
3427 panic("Bad link elm %p prev->next != elm", (elm)); \
3428} while (0)
3429#else
3430# 661 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/queue.h" 3 4
3431#define QMD_TAILQ_CHECK_HEAD(head, field)
3432#define QMD_TAILQ_CHECK_TAIL(head, headname)
3433#define QMD_TAILQ_CHECK_NEXT(elm, field)
3434#define QMD_TAILQ_CHECK_PREV(elm, field)
3435#endif /* (_KERNEL && INVARIANTS) */
3436# 666 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/queue.h" 3 4
3437
3438#define TAILQ_CONCAT(head1, head2, field) do { \
3439 if (!TAILQ_EMPTY(head2)) { \
3440 *(head1)->tqh_last = (head2)->tqh_first; \
3441 (head2)->tqh_first->field.tqe_prev = (head1)->tqh_last; \
3442 (head1)->tqh_last = (head2)->tqh_last; \
3443 TAILQ_INIT((head2)); \
3444 QMD_TRACE_HEAD(head1); \
3445 QMD_TRACE_HEAD(head2); \
3446 } \
3447} while (0)
3448
3449#define TAILQ_EMPTY(head) ((head)->tqh_first == NULL)
3450
3451#define TAILQ_FIRST(head) ((head)->tqh_first)
3452
3453#define TAILQ_FOREACH(var, head, field) \
3454 for ((var) = TAILQ_FIRST((head)); \
3455 (var); \
3456 (var) = TAILQ_NEXT((var), field))
3457
3458#define TAILQ_FOREACH_FROM(var, head, field) \
3459 for ((var) = ((var) ? (var) : TAILQ_FIRST((head))); \
3460 (var); \
3461 (var) = TAILQ_NEXT((var), field))
3462
3463#define TAILQ_FOREACH_SAFE(var, head, field, tvar) \
3464 for ((var) = TAILQ_FIRST((head)); \
3465 (var) && ((tvar) = TAILQ_NEXT((var), field), 1); \
3466 (var) = (tvar))
3467
3468#define TAILQ_FOREACH_FROM_SAFE(var, head, field, tvar) \
3469 for ((var) = ((var) ? (var) : TAILQ_FIRST((head))); \
3470 (var) && ((tvar) = TAILQ_NEXT((var), field), 1); \
3471 (var) = (tvar))
3472
3473#define TAILQ_FOREACH_REVERSE(var, head, headname, field) \
3474 for ((var) = TAILQ_LAST((head), headname); \
3475 (var); \
3476 (var) = TAILQ_PREV((var), headname, field))
3477
3478#define TAILQ_FOREACH_REVERSE_FROM(var, head, headname, field) \
3479 for ((var) = ((var) ? (var) : TAILQ_LAST((head), headname)); \
3480 (var); \
3481 (var) = TAILQ_PREV((var), headname, field))
3482
3483#define TAILQ_FOREACH_REVERSE_SAFE(var, head, headname, field, tvar) \
3484 for ((var) = TAILQ_LAST((head), headname); \
3485 (var) && ((tvar) = TAILQ_PREV((var), headname, field), 1); \
3486 (var) = (tvar))
3487
3488#define TAILQ_FOREACH_REVERSE_FROM_SAFE(var, head, headname, field, tvar) \
3489 for ((var) = ((var) ? (var) : TAILQ_LAST((head), headname)); \
3490 (var) && ((tvar) = TAILQ_PREV((var), headname, field), 1); \
3491 (var) = (tvar))
3492
3493#define TAILQ_INIT(head) do { \
3494 TAILQ_FIRST((head)) = NULL; \
3495 (head)->tqh_last = &TAILQ_FIRST((head)); \
3496 QMD_TRACE_HEAD(head); \
3497} while (0)
3498
3499#define TAILQ_INSERT_AFTER(head, listelm, elm, field) do { \
3500 QMD_TAILQ_CHECK_NEXT(listelm, field); \
3501 if ((TAILQ_NEXT((elm), field) = TAILQ_NEXT((listelm), field)) != NULL)\
3502 TAILQ_NEXT((elm), field)->field.tqe_prev = \
3503 &TAILQ_NEXT((elm), field); \
3504 else { \
3505 (head)->tqh_last = &TAILQ_NEXT((elm), field); \
3506 QMD_TRACE_HEAD(head); \
3507 } \
3508 TAILQ_NEXT((listelm), field) = (elm); \
3509 (elm)->field.tqe_prev = &TAILQ_NEXT((listelm), field); \
3510 QMD_TRACE_ELEM(&(elm)->field); \
3511 QMD_TRACE_ELEM(&(listelm)->field); \
3512} while (0)
3513
3514#define TAILQ_INSERT_BEFORE(listelm, elm, field) do { \
3515 QMD_TAILQ_CHECK_PREV(listelm, field); \
3516 (elm)->field.tqe_prev = (listelm)->field.tqe_prev; \
3517 TAILQ_NEXT((elm), field) = (listelm); \
3518 *(listelm)->field.tqe_prev = (elm); \
3519 (listelm)->field.tqe_prev = &TAILQ_NEXT((elm), field); \
3520 QMD_TRACE_ELEM(&(elm)->field); \
3521 QMD_TRACE_ELEM(&(listelm)->field); \
3522} while (0)
3523
3524#define TAILQ_INSERT_HEAD(head, elm, field) do { \
3525 QMD_TAILQ_CHECK_HEAD(head, field); \
3526 if ((TAILQ_NEXT((elm), field) = TAILQ_FIRST((head))) != NULL) \
3527 TAILQ_FIRST((head))->field.tqe_prev = \
3528 &TAILQ_NEXT((elm), field); \
3529 else \
3530 (head)->tqh_last = &TAILQ_NEXT((elm), field); \
3531 TAILQ_FIRST((head)) = (elm); \
3532 (elm)->field.tqe_prev = &TAILQ_FIRST((head)); \
3533 QMD_TRACE_HEAD(head); \
3534 QMD_TRACE_ELEM(&(elm)->field); \
3535} while (0)
3536
3537#define TAILQ_INSERT_TAIL(head, elm, field) do { \
3538 QMD_TAILQ_CHECK_TAIL(head, field); \
3539 TAILQ_NEXT((elm), field) = NULL; \
3540 (elm)->field.tqe_prev = (head)->tqh_last; \
3541 *(head)->tqh_last = (elm); \
3542 (head)->tqh_last = &TAILQ_NEXT((elm), field); \
3543 QMD_TRACE_HEAD(head); \
3544 QMD_TRACE_ELEM(&(elm)->field); \
3545} while (0)
3546
3547#define TAILQ_LAST(head, headname) \
3548 (*(((struct headname *)((head)->tqh_last))->tqh_last))
3549
3550#define TAILQ_NEXT(elm, field) ((elm)->field.tqe_next)
3551
3552#define TAILQ_PREV(elm, headname, field) \
3553 (*(((struct headname *)((elm)->field.tqe_prev))->tqh_last))
3554
3555#define TAILQ_REMOVE(head, elm, field) do { \
3556 QMD_SAVELINK(oldnext, (elm)->field.tqe_next); \
3557 QMD_SAVELINK(oldprev, (elm)->field.tqe_prev); \
3558 QMD_TAILQ_CHECK_NEXT(elm, field); \
3559 QMD_TAILQ_CHECK_PREV(elm, field); \
3560 if ((TAILQ_NEXT((elm), field)) != NULL) \
3561 TAILQ_NEXT((elm), field)->field.tqe_prev = \
3562 (elm)->field.tqe_prev; \
3563 else { \
3564 (head)->tqh_last = (elm)->field.tqe_prev; \
3565 QMD_TRACE_HEAD(head); \
3566 } \
3567 *(elm)->field.tqe_prev = TAILQ_NEXT((elm), field); \
3568 TRASHIT(*oldnext); \
3569 TRASHIT(*oldprev); \
3570 QMD_TRACE_ELEM(&(elm)->field); \
3571} while (0)
3572
3573#define TAILQ_SWAP(head1, head2, type, field) do { \
3574 QUEUE_TYPEOF(type) *swap_first = (head1)->tqh_first; \
3575 QUEUE_TYPEOF(type) **swap_last = (head1)->tqh_last; \
3576 (head1)->tqh_first = (head2)->tqh_first; \
3577 (head1)->tqh_last = (head2)->tqh_last; \
3578 (head2)->tqh_first = swap_first; \
3579 (head2)->tqh_last = swap_last; \
3580 if ((swap_first = (head1)->tqh_first) != NULL) \
3581 swap_first->field.tqe_prev = &(head1)->tqh_first; \
3582 else \
3583 (head1)->tqh_last = &(head1)->tqh_first; \
3584 if ((swap_first = (head2)->tqh_first) != NULL) \
3585 swap_first->field.tqe_prev = &(head2)->tqh_first; \
3586 else \
3587 (head2)->tqh_last = &(head2)->tqh_first; \
3588} while (0)
3589
3590#endif /* !_SYS_QUEUE_H_ */
3591# 820 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/queue.h" 3 4
3592# 40 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/sysctl.h" 2 3 4
3593
3594struct thread;
3595/*
3596 * Definitions for sysctl call. The sysctl call uses a hierarchical name
3597 * for objects that can be examined or modified. The name is expressed as
3598 * a sequence of integers. Like a file path name, the meaning of each
3599 * component depends on its place in the hierarchy. The top-level and kern
3600 * identifiers are defined here, and other identifiers are defined in the
3601 * respective subsystem header files.
3602 */
3603
3604#define CTL_MAXNAME 24 /* largest number of components supported */
3605
3606/*
3607 * Each subsystem defined by sysctl defines a list of variables
3608 * for that subsystem. Each name is either a node with further
3609 * levels defined below it, or it is a leaf of some particular
3610 * type given below. Each sysctl level defines a set of name/type
3611 * pairs to be used by sysctl(8) in manipulating the subsystem.
3612 */
3613struct ctlname {
3614 char *ctl_name; /* subsystem name */
3615 int ctl_type; /* type of name */
3616};
3617
3618#define CTLTYPE 0xf /* mask for the type */
3619#define CTLTYPE_NODE 1 /* name is a node */
3620#define CTLTYPE_INT 2 /* name describes an integer */
3621#define CTLTYPE_STRING 3 /* name describes a string */
3622#define CTLTYPE_S64 4 /* name describes a signed 64-bit number */
3623#define CTLTYPE_OPAQUE 5 /* name describes a structure */
3624#define CTLTYPE_STRUCT CTLTYPE_OPAQUE /* name describes a structure */
3625#define CTLTYPE_UINT 6 /* name describes an unsigned integer */
3626#define CTLTYPE_LONG 7 /* name describes a long */
3627#define CTLTYPE_ULONG 8 /* name describes an unsigned long */
3628#define CTLTYPE_U64 9 /* name describes an unsigned 64-bit number */
3629#define CTLTYPE_U8 0xa /* name describes an unsigned 8-bit number */
3630#define CTLTYPE_U16 0xb /* name describes an unsigned 16-bit number */
3631#define CTLTYPE_S8 0xc /* name describes a signed 8-bit number */
3632#define CTLTYPE_S16 0xd /* name describes a signed 16-bit number */
3633#define CTLTYPE_S32 0xe /* name describes a signed 32-bit number */
3634#define CTLTYPE_U32 0xf /* name describes an unsigned 32-bit number */
3635
3636#define CTLFLAG_RD 0x80000000 /* Allow reads of variable */
3637#define CTLFLAG_WR 0x40000000 /* Allow writes to the variable */
3638#define CTLFLAG_RW (CTLFLAG_RD|CTLFLAG_WR)
3639#define CTLFLAG_ANYBODY 0x10000000 /* All users can set this var */
3640#define CTLFLAG_SECURE 0x08000000 /* Permit set only if securelevel<=0 */
3641#define CTLFLAG_PRISON 0x04000000 /* Prisoned roots can fiddle */
3642#define CTLFLAG_DYN 0x02000000 /* Dynamic oid - can be freed */
3643#define CTLFLAG_SKIP 0x01000000 /* Skip this sysctl when listing */
3644#define CTLMASK_SECURE 0x00F00000 /* Secure level */
3645#define CTLFLAG_TUN 0x00080000 /* Default value is loaded from getenv() */
3646#define CTLFLAG_RDTUN (CTLFLAG_RD|CTLFLAG_TUN)
3647#define CTLFLAG_RWTUN (CTLFLAG_RW|CTLFLAG_TUN)
3648#define CTLFLAG_MPSAFE 0x00040000 /* Handler is MP safe */
3649#define CTLFLAG_VNET 0x00020000 /* Prisons with vnet can fiddle */
3650#define CTLFLAG_DYING 0x00010000 /* Oid is being removed */
3651#define CTLFLAG_CAPRD 0x00008000 /* Can be read in capability mode */
3652#define CTLFLAG_CAPWR 0x00004000 /* Can be written in capability mode */
3653#define CTLFLAG_STATS 0x00002000 /* Statistics, not a tuneable */
3654#define CTLFLAG_NOFETCH 0x00001000 /* Don't fetch tunable from getenv() */
3655#define CTLFLAG_CAPRW (CTLFLAG_CAPRD|CTLFLAG_CAPWR)
3656
3657/*
3658 * Secure level. Note that CTLFLAG_SECURE == CTLFLAG_SECURE1.
3659 *
3660 * Secure when the securelevel is raised to at least N.
3661 */
3662#define CTLSHIFT_SECURE 20
3663#define CTLFLAG_SECURE1 (CTLFLAG_SECURE | (0 << CTLSHIFT_SECURE))
3664#define CTLFLAG_SECURE2 (CTLFLAG_SECURE | (1 << CTLSHIFT_SECURE))
3665#define CTLFLAG_SECURE3 (CTLFLAG_SECURE | (2 << CTLSHIFT_SECURE))
3666
3667/*
3668 * USE THIS instead of a hardwired number from the categories below
3669 * to get dynamically assigned sysctl entries using the linker-set
3670 * technology. This is the way nearly all new sysctl variables should
3671 * be implemented.
3672 * e.g. SYSCTL_INT(_parent, OID_AUTO, name, CTLFLAG_RW, &variable, 0, "");
3673 */
3674#define OID_AUTO (-1)
3675
3676/*
3677 * The starting number for dynamically-assigned entries. WARNING!
3678 * ALL static sysctl entries should have numbers LESS than this!
3679 */
3680#define CTL_AUTO_START 0x100
3681
3682#ifdef _KERNEL
3683#if 0 /* expanded by -frewrite-includes */
3684#include <sys/linker_set.h>
3685#endif /* expanded by -frewrite-includes */
3686# 130 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/sysctl.h" 3 4
3687# 131 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/sysctl.h" 3 4
3688
3689#ifdef KLD_MODULE
3690/* XXX allow overspecification of type in external kernel modules */
3691#define SYSCTL_CT_ASSERT_MASK CTLTYPE
3692#else
3693# 136 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/sysctl.h" 3 4
3694#define SYSCTL_CT_ASSERT_MASK 0
3695#endif
3696# 138 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/sysctl.h" 3 4
3697
3698#define SYSCTL_HANDLER_ARGS struct sysctl_oid *oidp, void *arg1, \
3699 intmax_t arg2, struct sysctl_req *req
3700
3701/* definitions for sysctl_req 'lock' member */
3702#define REQ_UNWIRED 1
3703#define REQ_WIRED 2
3704
3705/* definitions for sysctl_req 'flags' member */
3706#if defined(__amd64__) || defined(__powerpc64__) ||\
3707 (defined(__mips__) && defined(__mips_n64))
3708#define SCTL_MASK32 1 /* 32 bit emulation */
3709#endif
3710# 151 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/sysctl.h" 3 4
3711#ifdef COMPAT_CHERIABI
3712#define SCTL_CHERIABI 2 /* CheriABI support */
3713#endif
3714# 154 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/sysctl.h" 3 4
3715
3716/*
3717 * This describes the access space for a sysctl request. This is needed
3718 * so that we can use the interface from the kernel or from user-space.
3719 */
3720struct sysctl_req {
3721 struct thread *td; /* used for access checking */
3722 int lock; /* wiring state */
3723 void *oldptr;
3724 size_t oldlen;
3725 size_t oldidx;
3726 int (*oldfunc)(struct sysctl_req *, const void *, size_t);
3727 void *newptr;
3728 size_t newlen;
3729 size_t newidx;
3730 int (*newfunc)(struct sysctl_req *, void *, size_t);
3731 size_t validlen;
3732 int flags;
3733};
3734
3735SLIST_HEAD(sysctl_oid_list, sysctl_oid);
3736
3737/*
3738 * This describes one "oid" in the MIB tree. Potentially more nodes can
3739 * be hidden behind it, expanded by the handler.
3740 */
3741struct sysctl_oid {
3742 struct sysctl_oid_list oid_children;
3743 struct sysctl_oid_list *oid_parent;
3744 SLIST_ENTRY(sysctl_oid) oid_link;
3745 int oid_number;
3746 u_int oid_kind;
3747 void *oid_arg1;
3748 intmax_t oid_arg2;
3749 const char *oid_name;
3750 int (*oid_handler)(SYSCTL_HANDLER_ARGS);
3751 const char *oid_fmt;
3752 int oid_refcnt;
3753 u_int oid_running;
3754 const char *oid_descr;
3755};
3756
3757#define SYSCTL_IN(r, p, l) (r->newfunc)(r, p, l)
3758#define SYSCTL_OUT(r, p, l) (r->oldfunc)(r, p, l)
3759#define SYSCTL_OUT_STR(r, p) (r->oldfunc)(r, p, strlen(p) + 1)
3760
3761int sysctl_handle_bool(SYSCTL_HANDLER_ARGS);
3762int sysctl_handle_8(SYSCTL_HANDLER_ARGS);
3763int sysctl_handle_16(SYSCTL_HANDLER_ARGS);
3764int sysctl_handle_32(SYSCTL_HANDLER_ARGS);
3765int sysctl_handle_64(SYSCTL_HANDLER_ARGS);
3766int sysctl_handle_int(SYSCTL_HANDLER_ARGS);
3767int sysctl_msec_to_ticks(SYSCTL_HANDLER_ARGS);
3768int sysctl_handle_long(SYSCTL_HANDLER_ARGS);
3769int sysctl_handle_string(SYSCTL_HANDLER_ARGS);
3770int sysctl_handle_opaque(SYSCTL_HANDLER_ARGS);
3771int sysctl_handle_counter_u64(SYSCTL_HANDLER_ARGS);
3772int sysctl_handle_counter_u64_array(SYSCTL_HANDLER_ARGS);
3773
3774int sysctl_handle_uma_zone_max(SYSCTL_HANDLER_ARGS);
3775int sysctl_handle_uma_zone_cur(SYSCTL_HANDLER_ARGS);
3776
3777int sysctl_dpcpu_int(SYSCTL_HANDLER_ARGS);
3778int sysctl_dpcpu_long(SYSCTL_HANDLER_ARGS);
3779int sysctl_dpcpu_quad(SYSCTL_HANDLER_ARGS);
3780
3781/*
3782 * These functions are used to add/remove an oid from the mib.
3783 */
3784void sysctl_register_oid(struct sysctl_oid *oidp);
3785void sysctl_unregister_oid(struct sysctl_oid *oidp);
3786
3787/* Declare a static oid to allow child oids to be added to it. */
3788#define SYSCTL_DECL(name) \
3789 extern struct sysctl_oid sysctl__##name
3790
3791/* Hide these in macros. */
3792#define SYSCTL_CHILDREN(oid_ptr) (&(oid_ptr)->oid_children)
3793#define SYSCTL_PARENT(oid_ptr) \
3794 (((oid_ptr)->oid_parent != &sysctl__children) ? \
3795 __containerof((oid_ptr)->oid_parent, struct sysctl_oid, \
3796 oid_children) : (struct sysctl_oid *)NULL)
3797#define SYSCTL_STATIC_CHILDREN(oid_name) (&sysctl__##oid_name.oid_children)
3798
3799/* === Structs and macros related to context handling. === */
3800
3801/* All dynamically created sysctls can be tracked in a context list. */
3802struct sysctl_ctx_entry {
3803 struct sysctl_oid *entry;
3804 TAILQ_ENTRY(sysctl_ctx_entry) link;
3805};
3806
3807TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_entry);
3808
3809#define SYSCTL_NODE_CHILDREN(parent, name) \
3810 sysctl__##parent##_##name.oid_children
3811
3812#ifndef NO_SYSCTL_DESCR
3813#define __DESCR(d) d
3814#else
3815# 254 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/sysctl.h" 3 4
3816#define __DESCR(d) ""
3817#endif
3818# 256 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/sysctl.h" 3 4
3819
3820/* This macro is only for internal use */
3821#define SYSCTL_OID_RAW(id, parent_child_head, nbr, name, kind, a1, a2, handler, fmt, descr) \
3822 struct sysctl_oid id = { \
3823 .oid_parent = (parent_child_head), \
3824 .oid_children = SLIST_HEAD_INITIALIZER(&id.oid_children), \
3825 .oid_number = (nbr), \
3826 .oid_kind = (kind), \
3827 .oid_arg1 = (a1), \
3828 .oid_arg2 = (a2), \
3829 .oid_name = (name), \
3830 .oid_handler = (handler), \
3831 .oid_fmt = (fmt), \
3832 .oid_descr = __DESCR(descr) \
3833 }; \
3834 DATA_SET(sysctl_set, id)
3835
3836/* This constructs a static "raw" MIB oid. */
3837#define SYSCTL_OID(parent, nbr, name, kind, a1, a2, handler, fmt, descr) \
3838 static SYSCTL_OID_RAW(sysctl__##parent##_##name, \
3839 SYSCTL_CHILDREN(&sysctl__##parent), \
3840 nbr, #name, kind, a1, a2, handler, fmt, descr)
3841
3842/* This constructs a global "raw" MIB oid. */
3843#define SYSCTL_OID_GLOBAL(parent, nbr, name, kind, a1, a2, handler, fmt, descr) \
3844 SYSCTL_OID_RAW(sysctl__##parent##_##name, \
3845 SYSCTL_CHILDREN(&sysctl__##parent), \
3846 nbr, #name, kind, a1, a2, handler, fmt, descr)
3847
3848#define SYSCTL_ADD_OID(ctx, parent, nbr, name, kind, a1, a2, handler, fmt, descr) \
3849 sysctl_add_oid(ctx, parent, nbr, name, kind, a1, a2, handler, fmt, __DESCR(descr))
3850
3851/* This constructs a root node from which other nodes can hang. */
3852#define SYSCTL_ROOT_NODE(nbr, name, access, handler, descr) \
3853 SYSCTL_OID_RAW(sysctl___##name, &sysctl__children, \
3854 nbr, #name, CTLTYPE_NODE|(access), NULL, 0, \
3855 handler, "N", descr); \
3856 CTASSERT(((access) & CTLTYPE) == 0 || \
3857 ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_NODE)
3858
3859/* This constructs a node from which other oids can hang. */
3860#define SYSCTL_NODE(parent, nbr, name, access, handler, descr) \
3861 SYSCTL_OID_GLOBAL(parent, nbr, name, CTLTYPE_NODE|(access), \
3862 NULL, 0, handler, "N", descr); \
3863 CTASSERT(((access) & CTLTYPE) == 0 || \
3864 ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_NODE)
3865
3866#define SYSCTL_ADD_NODE(ctx, parent, nbr, name, access, handler, descr) \
3867({ \
3868 CTASSERT(((access) & CTLTYPE) == 0 || \
3869 ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_NODE); \
3870 sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_NODE|(access), \
3871 NULL, 0, handler, "N", __DESCR(descr)); \
3872})
3873
3874#define SYSCTL_ADD_ROOT_NODE(ctx, nbr, name, access, handler, descr) \
3875({ \
3876 CTASSERT(((access) & CTLTYPE) == 0 || \
3877 ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_NODE); \
3878 sysctl_add_oid(ctx, &sysctl__children, nbr, name, \
3879 CTLTYPE_NODE|(access), \
3880 NULL, 0, handler, "N", __DESCR(descr)); \
3881})
3882
3883/* Oid for a string. len can be 0 to indicate '\0' termination. */
3884#define SYSCTL_STRING(parent, nbr, name, access, arg, len, descr) \
3885 SYSCTL_OID(parent, nbr, name, CTLTYPE_STRING|(access), \
3886 arg, len, sysctl_handle_string, "A", descr); \
3887 CTASSERT(((access) & CTLTYPE) == 0 || \
3888 ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_STRING)
3889
3890#define SYSCTL_ADD_STRING(ctx, parent, nbr, name, access, arg, len, descr) \
3891({ \
3892 char *__arg = (arg); \
3893 CTASSERT(((access) & CTLTYPE) == 0 || \
3894 ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_STRING); \
3895 sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_STRING|(access), \
3896 __arg, len, sysctl_handle_string, "A", __DESCR(descr)); \
3897})
3898
3899/* Oid for a bool. If ptr is NULL, val is returned. */
3900#define SYSCTL_NULL_BOOL_PTR ((bool *)NULL)
3901#define SYSCTL_BOOL(parent, nbr, name, access, ptr, val, descr) \
3902 SYSCTL_OID(parent, nbr, name, \
3903 CTLTYPE_U8 | CTLFLAG_MPSAFE | (access), \
3904 ptr, val, sysctl_handle_bool, "CU", descr); \
3905 CTASSERT(((access) & CTLTYPE) == 0 && \
3906 sizeof(bool) == sizeof(*(ptr)))
3907
3908#define SYSCTL_ADD_BOOL(ctx, parent, nbr, name, access, ptr, val, descr) \
3909({ \
3910 bool *__ptr = (ptr); \
3911 CTASSERT(((access) & CTLTYPE) == 0); \
3912 sysctl_add_oid(ctx, parent, nbr, name, \
3913 CTLTYPE_U8 | CTLFLAG_MPSAFE | (access), \
3914 __ptr, val, sysctl_handle_bool, "CU", __DESCR(descr)); \
3915})
3916
3917/* Oid for a signed 8-bit int. If ptr is NULL, val is returned. */
3918#define SYSCTL_NULL_S8_PTR ((int8_t *)NULL)
3919#define SYSCTL_S8(parent, nbr, name, access, ptr, val, descr) \
3920 SYSCTL_OID(parent, nbr, name, \
3921 CTLTYPE_S8 | CTLFLAG_MPSAFE | (access), \
3922 ptr, val, sysctl_handle_8, "C", descr); \
3923 CTASSERT((((access) & CTLTYPE) == 0 || \
3924 ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_S8) && \
3925 sizeof(int8_t) == sizeof(*(ptr)))
3926
3927#define SYSCTL_ADD_S8(ctx, parent, nbr, name, access, ptr, val, descr) \
3928({ \
3929 int8_t *__ptr = (ptr); \
3930 CTASSERT(((access) & CTLTYPE) == 0 || \
3931 ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_S8); \
3932 sysctl_add_oid(ctx, parent, nbr, name, \
3933 CTLTYPE_S8 | CTLFLAG_MPSAFE | (access), \
3934 __ptr, val, sysctl_handle_8, "C", __DESCR(descr)); \
3935})
3936
3937/* Oid for an unsigned 8-bit int. If ptr is NULL, val is returned. */
3938#define SYSCTL_NULL_U8_PTR ((uint8_t *)NULL)
3939#define SYSCTL_U8(parent, nbr, name, access, ptr, val, descr) \
3940 SYSCTL_OID(parent, nbr, name, \
3941 CTLTYPE_U8 | CTLFLAG_MPSAFE | (access), \
3942 ptr, val, sysctl_handle_8, "CU", descr); \
3943 CTASSERT((((access) & CTLTYPE) == 0 || \
3944 ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_U8) && \
3945 sizeof(uint8_t) == sizeof(*(ptr)))
3946
3947#define SYSCTL_ADD_U8(ctx, parent, nbr, name, access, ptr, val, descr) \
3948({ \
3949 uint8_t *__ptr = (ptr); \
3950 CTASSERT(((access) & CTLTYPE) == 0 || \
3951 ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_U8); \
3952 sysctl_add_oid(ctx, parent, nbr, name, \
3953 CTLTYPE_U8 | CTLFLAG_MPSAFE | (access), \
3954 __ptr, val, sysctl_handle_8, "CU", __DESCR(descr)); \
3955})
3956
3957/* Oid for a signed 16-bit int. If ptr is NULL, val is returned. */
3958#define SYSCTL_NULL_S16_PTR ((int16_t *)NULL)
3959#define SYSCTL_S16(parent, nbr, name, access, ptr, val, descr) \
3960 SYSCTL_OID(parent, nbr, name, \
3961 CTLTYPE_S16 | CTLFLAG_MPSAFE | (access), \
3962 ptr, val, sysctl_handle_16, "S", descr); \
3963 CTASSERT((((access) & CTLTYPE) == 0 || \
3964 ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_S16) && \
3965 sizeof(int16_t) == sizeof(*(ptr)))
3966
3967#define SYSCTL_ADD_S16(ctx, parent, nbr, name, access, ptr, val, descr) \
3968({ \
3969 int16_t *__ptr = (ptr); \
3970 CTASSERT(((access) & CTLTYPE) == 0 || \
3971 ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_S16); \
3972 sysctl_add_oid(ctx, parent, nbr, name, \
3973 CTLTYPE_S16 | CTLFLAG_MPSAFE | (access), \
3974 __ptr, val, sysctl_handle_16, "S", __DESCR(descr)); \
3975})
3976
3977/* Oid for an unsigned 16-bit int. If ptr is NULL, val is returned. */
3978#define SYSCTL_NULL_U16_PTR ((uint16_t *)NULL)
3979#define SYSCTL_U16(parent, nbr, name, access, ptr, val, descr) \
3980 SYSCTL_OID(parent, nbr, name, \
3981 CTLTYPE_U16 | CTLFLAG_MPSAFE | (access), \
3982 ptr, val, sysctl_handle_16, "SU", descr); \
3983 CTASSERT((((access) & CTLTYPE) == 0 || \
3984 ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_U16) && \
3985 sizeof(uint16_t) == sizeof(*(ptr)))
3986
3987#define SYSCTL_ADD_U16(ctx, parent, nbr, name, access, ptr, val, descr) \
3988({ \
3989 uint16_t *__ptr = (ptr); \
3990 CTASSERT(((access) & CTLTYPE) == 0 || \
3991 ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_U16); \
3992 sysctl_add_oid(ctx, parent, nbr, name, \
3993 CTLTYPE_U16 | CTLFLAG_MPSAFE | (access), \
3994 __ptr, val, sysctl_handle_16, "SU", __DESCR(descr)); \
3995})
3996
3997/* Oid for a signed 32-bit int. If ptr is NULL, val is returned. */
3998#define SYSCTL_NULL_S32_PTR ((int32_t *)NULL)
3999#define SYSCTL_S32(parent, nbr, name, access, ptr, val, descr) \
4000 SYSCTL_OID(parent, nbr, name, \
4001 CTLTYPE_S32 | CTLFLAG_MPSAFE | (access), \
4002 ptr, val, sysctl_handle_32, "I", descr); \
4003 CTASSERT((((access) & CTLTYPE) == 0 || \
4004 ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_S32) && \
4005 sizeof(int32_t) == sizeof(*(ptr)))
4006
4007#define SYSCTL_ADD_S32(ctx, parent, nbr, name, access, ptr, val, descr) \
4008({ \
4009 int32_t *__ptr = (ptr); \
4010 CTASSERT(((access) & CTLTYPE) == 0 || \
4011 ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_S32); \
4012 sysctl_add_oid(ctx, parent, nbr, name, \
4013 CTLTYPE_S32 | CTLFLAG_MPSAFE | (access), \
4014 __ptr, val, sysctl_handle_32, "I", __DESCR(descr)); \
4015})
4016
4017/* Oid for an unsigned 32-bit int. If ptr is NULL, val is returned. */
4018#define SYSCTL_NULL_U32_PTR ((uint32_t *)NULL)
4019#define SYSCTL_U32(parent, nbr, name, access, ptr, val, descr) \
4020 SYSCTL_OID(parent, nbr, name, \
4021 CTLTYPE_U32 | CTLFLAG_MPSAFE | (access), \
4022 ptr, val, sysctl_handle_32, "IU", descr); \
4023 CTASSERT((((access) & CTLTYPE) == 0 || \
4024 ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_U32) && \
4025 sizeof(uint32_t) == sizeof(*(ptr)))
4026
4027#define SYSCTL_ADD_U32(ctx, parent, nbr, name, access, ptr, val, descr) \
4028({ \
4029 uint32_t *__ptr = (ptr); \
4030 CTASSERT(((access) & CTLTYPE) == 0 || \
4031 ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_U32); \
4032 sysctl_add_oid(ctx, parent, nbr, name, \
4033 CTLTYPE_U32 | CTLFLAG_MPSAFE | (access), \
4034 __ptr, val, sysctl_handle_32, "IU", __DESCR(descr)); \
4035})
4036
4037/* Oid for a signed 64-bit int. If ptr is NULL, val is returned. */
4038#define SYSCTL_NULL_S64_PTR ((int64_t *)NULL)
4039#define SYSCTL_S64(parent, nbr, name, access, ptr, val, descr) \
4040 SYSCTL_OID(parent, nbr, name, \
4041 CTLTYPE_S64 | CTLFLAG_MPSAFE | (access), \
4042 ptr, val, sysctl_handle_64, "Q", descr); \
4043 CTASSERT((((access) & CTLTYPE) == 0 || \
4044 ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_S64) && \
4045 sizeof(int64_t) == sizeof(*(ptr)))
4046
4047#define SYSCTL_ADD_S64(ctx, parent, nbr, name, access, ptr, val, descr) \
4048({ \
4049 int64_t *__ptr = (ptr); \
4050 CTASSERT(((access) & CTLTYPE) == 0 || \
4051 ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_S64); \
4052 sysctl_add_oid(ctx, parent, nbr, name, \
4053 CTLTYPE_S64 | CTLFLAG_MPSAFE | (access), \
4054 __ptr, val, sysctl_handle_64, "Q", __DESCR(descr)); \
4055})
4056
4057/* Oid for an unsigned 64-bit int. If ptr is NULL, val is returned. */
4058#define SYSCTL_NULL_U64_PTR ((uint64_t *)NULL)
4059#define SYSCTL_U64(parent, nbr, name, access, ptr, val, descr) \
4060 SYSCTL_OID(parent, nbr, name, \
4061 CTLTYPE_U64 | CTLFLAG_MPSAFE | (access), \
4062 ptr, val, sysctl_handle_64, "QU", descr); \
4063 CTASSERT((((access) & CTLTYPE) == 0 || \
4064 ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_U64) && \
4065 sizeof(uint64_t) == sizeof(*(ptr)))
4066
4067#define SYSCTL_ADD_U64(ctx, parent, nbr, name, access, ptr, val, descr) \
4068({ \
4069 uint64_t *__ptr = (ptr); \
4070 CTASSERT(((access) & CTLTYPE) == 0 || \
4071 ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_U64); \
4072 sysctl_add_oid(ctx, parent, nbr, name, \
4073 CTLTYPE_U64 | CTLFLAG_MPSAFE | (access), \
4074 __ptr, val, sysctl_handle_64, "QU", __DESCR(descr)); \
4075})
4076
4077/* Oid for an int. If ptr is SYSCTL_NULL_INT_PTR, val is returned. */
4078#define SYSCTL_NULL_INT_PTR ((int *)NULL)
4079#define SYSCTL_INT(parent, nbr, name, access, ptr, val, descr) \
4080 SYSCTL_OID(parent, nbr, name, \
4081 CTLTYPE_INT | CTLFLAG_MPSAFE | (access), \
4082 ptr, val, sysctl_handle_int, "I", descr); \
4083 CTASSERT((((access) & CTLTYPE) == 0 || \
4084 ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_INT) && \
4085 sizeof(int) == sizeof(*(ptr)))
4086
4087#define SYSCTL_ADD_INT(ctx, parent, nbr, name, access, ptr, val, descr) \
4088({ \
4089 int *__ptr = (ptr); \
4090 CTASSERT(((access) & CTLTYPE) == 0 || \
4091 ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_INT); \
4092 sysctl_add_oid(ctx, parent, nbr, name, \
4093 CTLTYPE_INT | CTLFLAG_MPSAFE | (access), \
4094 __ptr, val, sysctl_handle_int, "I", __DESCR(descr)); \
4095})
4096
4097/* Oid for an unsigned int. If ptr is NULL, val is returned. */
4098#define SYSCTL_NULL_UINT_PTR ((unsigned *)NULL)
4099#define SYSCTL_UINT(parent, nbr, name, access, ptr, val, descr) \
4100 SYSCTL_OID(parent, nbr, name, \
4101 CTLTYPE_UINT | CTLFLAG_MPSAFE | (access), \
4102 ptr, val, sysctl_handle_int, "IU", descr); \
4103 CTASSERT((((access) & CTLTYPE) == 0 || \
4104 ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_UINT) && \
4105 sizeof(unsigned) == sizeof(*(ptr)))
4106
4107#define SYSCTL_ADD_UINT(ctx, parent, nbr, name, access, ptr, val, descr) \
4108({ \
4109 unsigned *__ptr = (ptr); \
4110 CTASSERT(((access) & CTLTYPE) == 0 || \
4111 ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_UINT); \
4112 sysctl_add_oid(ctx, parent, nbr, name, \
4113 CTLTYPE_UINT | CTLFLAG_MPSAFE | (access), \
4114 __ptr, val, sysctl_handle_int, "IU", __DESCR(descr)); \
4115})
4116
4117/* Oid for a long. The pointer must be non NULL. */
4118#define SYSCTL_NULL_LONG_PTR ((long *)NULL)
4119#define SYSCTL_LONG(parent, nbr, name, access, ptr, val, descr) \
4120 SYSCTL_OID(parent, nbr, name, \
4121 CTLTYPE_LONG | CTLFLAG_MPSAFE | (access), \
4122 ptr, val, sysctl_handle_long, "L", descr); \
4123 CTASSERT((((access) & CTLTYPE) == 0 || \
4124 ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_LONG) && \
4125 sizeof(long) == sizeof(*(ptr)))
4126
4127#define SYSCTL_ADD_LONG(ctx, parent, nbr, name, access, ptr, descr) \
4128({ \
4129 long *__ptr = (ptr); \
4130 CTASSERT(((access) & CTLTYPE) == 0 || \
4131 ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_LONG); \
4132 sysctl_add_oid(ctx, parent, nbr, name, \
4133 CTLTYPE_LONG | CTLFLAG_MPSAFE | (access), \
4134 __ptr, 0, sysctl_handle_long, "L", __DESCR(descr)); \
4135})
4136
4137/* Oid for an unsigned long. The pointer must be non NULL. */
4138#define SYSCTL_NULL_ULONG_PTR ((unsigned long *)NULL)
4139#define SYSCTL_ULONG(parent, nbr, name, access, ptr, val, descr) \
4140 SYSCTL_OID(parent, nbr, name, \
4141 CTLTYPE_ULONG | CTLFLAG_MPSAFE | (access), \
4142 ptr, val, sysctl_handle_long, "LU", descr); \
4143 CTASSERT((((access) & CTLTYPE) == 0 || \
4144 ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_ULONG) && \
4145 sizeof(unsigned long) == sizeof(*(ptr)))
4146
4147#define SYSCTL_ADD_ULONG(ctx, parent, nbr, name, access, ptr, descr) \
4148({ \
4149 unsigned long *__ptr = (ptr); \
4150 CTASSERT(((access) & CTLTYPE) == 0 || \
4151 ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_ULONG); \
4152 sysctl_add_oid(ctx, parent, nbr, name, \
4153 CTLTYPE_ULONG | CTLFLAG_MPSAFE | (access), \
4154 __ptr, 0, sysctl_handle_long, "LU", __DESCR(descr)); \
4155})
4156
4157/* Oid for a quad. The pointer must be non NULL. */
4158#define SYSCTL_NULL_QUAD_PTR ((int64_t *)NULL)
4159#define SYSCTL_QUAD(parent, nbr, name, access, ptr, val, descr) \
4160 SYSCTL_OID(parent, nbr, name, \
4161 CTLTYPE_S64 | CTLFLAG_MPSAFE | (access), \
4162 ptr, val, sysctl_handle_64, "Q", descr); \
4163 CTASSERT((((access) & CTLTYPE) == 0 || \
4164 ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_S64) && \
4165 sizeof(int64_t) == sizeof(*(ptr)))
4166
4167#define SYSCTL_ADD_QUAD(ctx, parent, nbr, name, access, ptr, descr) \
4168({ \
4169 int64_t *__ptr = (ptr); \
4170 CTASSERT(((access) & CTLTYPE) == 0 || \
4171 ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_S64); \
4172 sysctl_add_oid(ctx, parent, nbr, name, \
4173 CTLTYPE_S64 | CTLFLAG_MPSAFE | (access), \
4174 __ptr, 0, sysctl_handle_64, "Q", __DESCR(descr)); \
4175})
4176
4177#define SYSCTL_NULL_UQUAD_PTR ((uint64_t *)NULL)
4178#define SYSCTL_UQUAD(parent, nbr, name, access, ptr, val, descr) \
4179 SYSCTL_OID(parent, nbr, name, \
4180 CTLTYPE_U64 | CTLFLAG_MPSAFE | (access), \
4181 ptr, val, sysctl_handle_64, "QU", descr); \
4182 CTASSERT((((access) & CTLTYPE) == 0 || \
4183 ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_U64) && \
4184 sizeof(uint64_t) == sizeof(*(ptr)))
4185
4186#define SYSCTL_ADD_UQUAD(ctx, parent, nbr, name, access, ptr, descr) \
4187({ \
4188 uint64_t *__ptr = (ptr); \
4189 CTASSERT(((access) & CTLTYPE) == 0 || \
4190 ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_U64); \
4191 sysctl_add_oid(ctx, parent, nbr, name, \
4192 CTLTYPE_U64 | CTLFLAG_MPSAFE | (access), \
4193 __ptr, 0, sysctl_handle_64, "QU", __DESCR(descr)); \
4194})
4195
4196/* Oid for a CPU dependent variable */
4197#define SYSCTL_ADD_UAUTO(ctx, parent, nbr, name, access, ptr, descr) \
4198({ \
4199 struct sysctl_oid *__ret; \
4200 CTASSERT((sizeof(uint64_t) == sizeof(*(ptr)) || \
4201 sizeof(unsigned) == sizeof(*(ptr))) && \
4202 ((access) & CTLTYPE) == 0); \
4203 if (sizeof(uint64_t) == sizeof(*(ptr))) { \
4204 __ret = sysctl_add_oid(ctx, parent, nbr, name, \
4205 CTLTYPE_U64 | CTLFLAG_MPSAFE | (access), \
4206 (ptr), 0, sysctl_handle_64, "QU", \
4207 __DESCR(descr)); \
4208 } else { \
4209 __ret = sysctl_add_oid(ctx, parent, nbr, name, \
4210 CTLTYPE_UINT | CTLFLAG_MPSAFE | (access), \
4211 (ptr), 0, sysctl_handle_int, "IU", \
4212 __DESCR(descr)); \
4213 } \
4214 __ret; \
4215})
4216
4217/* Oid for a 64-bit unsigned counter(9). The pointer must be non NULL. */
4218#define SYSCTL_COUNTER_U64(parent, nbr, name, access, ptr, descr) \
4219 SYSCTL_OID(parent, nbr, name, \
4220 CTLTYPE_U64 | CTLFLAG_MPSAFE | (access), \
4221 (ptr), 0, sysctl_handle_counter_u64, "QU", descr); \
4222 CTASSERT((((access) & CTLTYPE) == 0 || \
4223 ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_U64) && \
4224 sizeof(counter_u64_t) == sizeof(*(ptr)) && \
4225 sizeof(uint64_t) == sizeof(**(ptr)))
4226
4227#define SYSCTL_ADD_COUNTER_U64(ctx, parent, nbr, name, access, ptr, descr) \
4228({ \
4229 counter_u64_t *__ptr = (ptr); \
4230 CTASSERT(((access) & CTLTYPE) == 0 || \
4231 ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_U64); \
4232 sysctl_add_oid(ctx, parent, nbr, name, \
4233 CTLTYPE_U64 | CTLFLAG_MPSAFE | (access), \
4234 __ptr, 0, sysctl_handle_counter_u64, "QU", __DESCR(descr)); \
4235})
4236
4237/* Oid for an array of counter(9)s. The pointer and length must be non zero. */
4238#define SYSCTL_COUNTER_U64_ARRAY(parent, nbr, name, access, ptr, len, descr) \
4239 SYSCTL_OID(parent, nbr, name, \
4240 CTLTYPE_OPAQUE | CTLFLAG_MPSAFE | (access), \
4241 (ptr), (len), sysctl_handle_counter_u64_array, "S", descr); \
4242 CTASSERT((((access) & CTLTYPE) == 0 || \
4243 ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_OPAQUE) && \
4244 sizeof(counter_u64_t) == sizeof(*(ptr)) && \
4245 sizeof(uint64_t) == sizeof(**(ptr)))
4246
4247#define SYSCTL_ADD_COUNTER_U64_ARRAY(ctx, parent, nbr, name, access, \
4248 ptr, len, descr) \
4249({ \
4250 counter_u64_t *__ptr = (ptr); \
4251 CTASSERT(((access) & CTLTYPE) == 0 || \
4252 ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_OPAQUE); \
4253 sysctl_add_oid(ctx, parent, nbr, name, \
4254 CTLTYPE_OPAQUE | CTLFLAG_MPSAFE | (access), \
4255 __ptr, len, sysctl_handle_counter_u64_array, "S", \
4256 __DESCR(descr)); \
4257})
4258
4259/* Oid for an opaque object. Specified by a pointer and a length. */
4260#define SYSCTL_OPAQUE(parent, nbr, name, access, ptr, len, fmt, descr) \
4261 SYSCTL_OID(parent, nbr, name, CTLTYPE_OPAQUE|(access), \
4262 ptr, len, sysctl_handle_opaque, fmt, descr); \
4263 CTASSERT(((access) & CTLTYPE) == 0 || \
4264 ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_OPAQUE)
4265
4266#define SYSCTL_ADD_OPAQUE(ctx, parent, nbr, name, access, ptr, len, fmt, descr) \
4267({ \
4268 CTASSERT(((access) & CTLTYPE) == 0 || \
4269 ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_OPAQUE); \
4270 sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_OPAQUE|(access), \
4271 ptr, len, sysctl_handle_opaque, fmt, __DESCR(descr)); \
4272})
4273
4274/* Oid for a struct. Specified by a pointer and a type. */
4275#define SYSCTL_STRUCT(parent, nbr, name, access, ptr, type, descr) \
4276 SYSCTL_OID(parent, nbr, name, CTLTYPE_OPAQUE|(access), \
4277 ptr, sizeof(struct type), sysctl_handle_opaque, \
4278 "S," #type, descr); \
4279 CTASSERT(((access) & CTLTYPE) == 0 || \
4280 ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_OPAQUE)
4281
4282#define SYSCTL_ADD_STRUCT(ctx, parent, nbr, name, access, ptr, type, descr) \
4283({ \
4284 CTASSERT(((access) & CTLTYPE) == 0 || \
4285 ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_OPAQUE); \
4286 sysctl_add_oid(ctx, parent, nbr, name, CTLTYPE_OPAQUE|(access), \
4287 (ptr), sizeof(struct type), \
4288 sysctl_handle_opaque, "S," #type, __DESCR(descr)); \
4289})
4290
4291/* Oid for a procedure. Specified by a pointer and an arg. */
4292#define SYSCTL_PROC(parent, nbr, name, access, ptr, arg, handler, fmt, descr) \
4293 SYSCTL_OID(parent, nbr, name, (access), \
4294 ptr, arg, handler, fmt, descr); \
4295 CTASSERT(((access) & CTLTYPE) != 0)
4296
4297#define SYSCTL_ADD_PROC(ctx, parent, nbr, name, access, ptr, arg, handler, fmt, descr) \
4298({ \
4299 CTASSERT(((access) & CTLTYPE) != 0); \
4300 sysctl_add_oid(ctx, parent, nbr, name, (access), \
4301 (ptr), (arg), (handler), (fmt), __DESCR(descr)); \
4302})
4303
4304/* Oid to handle limits on uma(9) zone specified by pointer. */
4305#define SYSCTL_UMA_MAX(parent, nbr, name, access, ptr, descr) \
4306 SYSCTL_OID(parent, nbr, name, \
4307 CTLTYPE_INT | CTLFLAG_MPSAFE | (access), \
4308 (ptr), 0, sysctl_handle_uma_zone_max, "I", descr); \
4309 CTASSERT(((access) & CTLTYPE) == 0 || \
4310 ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_INT)
4311
4312#define SYSCTL_ADD_UMA_MAX(ctx, parent, nbr, name, access, ptr, descr) \
4313({ \
4314 uma_zone_t __ptr = (ptr); \
4315 CTASSERT(((access) & CTLTYPE) == 0 || \
4316 ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_INT); \
4317 sysctl_add_oid(ctx, parent, nbr, name, \
4318 CTLTYPE_INT | CTLFLAG_MPSAFE | (access), \
4319 __ptr, 0, sysctl_handle_uma_zone_max, "I", __DESCR(descr)); \
4320})
4321
4322/* Oid to obtain current use of uma(9) zone specified by pointer. */
4323#define SYSCTL_UMA_CUR(parent, nbr, name, access, ptr, descr) \
4324 SYSCTL_OID(parent, nbr, name, \
4325 CTLTYPE_INT | CTLFLAG_MPSAFE | CTLFLAG_RD | (access), \
4326 (ptr), 0, sysctl_handle_uma_zone_cur, "I", descr); \
4327 CTASSERT(((access) & CTLTYPE) == 0 || \
4328 ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_INT)
4329
4330#define SYSCTL_ADD_UMA_CUR(ctx, parent, nbr, name, access, ptr, descr) \
4331({ \
4332 uma_zone_t __ptr = (ptr); \
4333 CTASSERT(((access) & CTLTYPE) == 0 || \
4334 ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_INT); \
4335 sysctl_add_oid(ctx, parent, nbr, name, \
4336 CTLTYPE_INT | CTLFLAG_MPSAFE | CTLFLAG_RD | (access), \
4337 __ptr, 0, sysctl_handle_uma_zone_cur, "I", __DESCR(descr)); \
4338})
4339
4340/*
4341 * A macro to generate a read-only sysctl to indicate the presence of optional
4342 * kernel features.
4343 */
4344#define FEATURE(name, desc) \
4345 SYSCTL_INT(_kern_features, OID_AUTO, name, CTLFLAG_RD | CTLFLAG_CAPRD, \
4346 SYSCTL_NULL_INT_PTR, 1, desc)
4347
4348#endif /* _KERNEL */
4349# 786 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/sysctl.h" 3 4
4350
4351/*
4352 * Top-level identifiers
4353 */
4354#define CTL_UNSPEC 0 /* unused */
4355#define CTL_KERN 1 /* "high kernel": proc, limits */
4356#define CTL_VM 2 /* virtual memory */
4357#define CTL_VFS 3 /* filesystem, mount type is next */
4358#define CTL_NET 4 /* network, see socket.h */
4359#define CTL_DEBUG 5 /* debugging parameters */
4360#define CTL_HW 6 /* generic cpu/io */
4361#define CTL_MACHDEP 7 /* machine dependent */
4362#define CTL_USER 8 /* user-level */
4363#define CTL_P1003_1B 9 /* POSIX 1003.1B */
4364
4365/*
4366 * CTL_KERN identifiers
4367 */
4368#define KERN_OSTYPE 1 /* string: system version */
4369#define KERN_OSRELEASE 2 /* string: system release */
4370#define KERN_OSREV 3 /* int: system revision */
4371#define KERN_VERSION 4 /* string: compile time info */
4372#define KERN_MAXVNODES 5 /* int: max vnodes */
4373#define KERN_MAXPROC 6 /* int: max processes */
4374#define KERN_MAXFILES 7 /* int: max open files */
4375#define KERN_ARGMAX 8 /* int: max arguments to exec */
4376#define KERN_SECURELVL 9 /* int: system security level */
4377#define KERN_HOSTNAME 10 /* string: hostname */
4378#define KERN_HOSTID 11 /* int: host identifier */
4379#define KERN_CLOCKRATE 12 /* struct: struct clockrate */
4380#define KERN_VNODE 13 /* struct: vnode structures */
4381#define KERN_PROC 14 /* struct: process entries */
4382#define KERN_FILE 15 /* struct: file entries */
4383#define KERN_PROF 16 /* node: kernel profiling info */
4384#define KERN_POSIX1 17 /* int: POSIX.1 version */
4385#define KERN_NGROUPS 18 /* int: # of supplemental group ids */
4386#define KERN_JOB_CONTROL 19 /* int: is job control available */
4387#define KERN_SAVED_IDS 20 /* int: saved set-user/group-ID */
4388#define KERN_BOOTTIME 21 /* struct: time kernel was booted */
4389#define KERN_NISDOMAINNAME 22 /* string: YP domain name */
4390#define KERN_UPDATEINTERVAL 23 /* int: update process sleep time */
4391#define KERN_OSRELDATE 24 /* int: kernel release date */
4392#define KERN_NTP_PLL 25 /* node: NTP PLL control */
4393#define KERN_BOOTFILE 26 /* string: name of booted kernel */
4394#define KERN_MAXFILESPERPROC 27 /* int: max open files per proc */
4395#define KERN_MAXPROCPERUID 28 /* int: max processes per uid */
4396#define KERN_DUMPDEV 29 /* struct cdev *: device to dump on */
4397#define KERN_IPC 30 /* node: anything related to IPC */
4398#define KERN_DUMMY 31 /* unused */
4399#define KERN_PS_STRINGS 32 /* int: address of PS_STRINGS */
4400#define KERN_USRSTACK 33 /* int: address of USRSTACK */
4401#define KERN_LOGSIGEXIT 34 /* int: do we log sigexit procs? */
4402#define KERN_IOV_MAX 35 /* int: value of UIO_MAXIOV */
4403#define KERN_HOSTUUID 36 /* string: host UUID identifier */
4404#define KERN_ARND 37 /* int: from arc4rand() */
4405#define KERN_MAXPHYS 38 /* int: MAXPHYS value */
4406/*
4407 * KERN_PROC subtypes
4408 */
4409#define KERN_PROC_ALL 0 /* everything */
4410#define KERN_PROC_PID 1 /* by process id */
4411#define KERN_PROC_PGRP 2 /* by process group id */
4412#define KERN_PROC_SESSION 3 /* by session of pid */
4413#define KERN_PROC_TTY 4 /* by controlling tty */
4414#define KERN_PROC_UID 5 /* by effective uid */
4415#define KERN_PROC_RUID 6 /* by real uid */
4416#define KERN_PROC_ARGS 7 /* get/set arguments/proctitle */
4417#define KERN_PROC_PROC 8 /* only return procs */
4418#define KERN_PROC_SV_NAME 9 /* get syscall vector name */
4419#define KERN_PROC_RGID 10 /* by real group id */
4420#define KERN_PROC_GID 11 /* by effective group id */
4421#define KERN_PROC_PATHNAME 12 /* path to executable */
4422#define KERN_PROC_OVMMAP 13 /* Old VM map entries for process */
4423#define KERN_PROC_OFILEDESC 14 /* Old file descriptors for process */
4424#define KERN_PROC_KSTACK 15 /* Kernel stacks for process */
4425#define KERN_PROC_INC_THREAD 0x10 /*
4426 * modifier for pid, pgrp, tty,
4427 * uid, ruid, gid, rgid and proc
4428 * This effectively uses 16-31
4429 */
4430#define KERN_PROC_VMMAP 32 /* VM map entries for process */
4431#define KERN_PROC_FILEDESC 33 /* File descriptors for process */
4432#define KERN_PROC_GROUPS 34 /* process groups */
4433#define KERN_PROC_ENV 35 /* get environment */
4434#define KERN_PROC_AUXV 36 /* get ELF auxiliary vector */
4435#define KERN_PROC_RLIMIT 37 /* process resource limits */
4436#define KERN_PROC_PS_STRINGS 38 /* get ps_strings location */
4437#define KERN_PROC_UMASK 39 /* process umask */
4438#define KERN_PROC_OSREL 40 /* osreldate for process binary */
4439#define KERN_PROC_SIGTRAMP 41 /* signal trampoline location */
4440#define KERN_PROC_CWD 42 /* process current working directory */
4441#define KERN_PROC_NFDS 43 /* number of open file descriptors */
4442#define KERN_PROC_SBCLASSES 44 /* get sandbox classes */
4443#define KERN_PROC_SBMETHODS 45 /* get sandbox methods */
4444#define KERN_PROC_SBOBJECTS 46 /* get sandbox objects */
4445
4446/*
4447 * KERN_IPC identifiers
4448 */
4449#define KIPC_MAXSOCKBUF 1 /* int: max size of a socket buffer */
4450#define KIPC_SOCKBUF_WASTE 2 /* int: wastage factor in sockbuf */
4451#define KIPC_SOMAXCONN 3 /* int: max length of connection q */
4452#define KIPC_MAX_LINKHDR 4 /* int: max length of link header */
4453#define KIPC_MAX_PROTOHDR 5 /* int: max length of network header */
4454#define KIPC_MAX_HDR 6 /* int: max total length of headers */
4455#define KIPC_MAX_DATALEN 7 /* int: max length of data? */
4456
4457/*
4458 * CTL_HW identifiers
4459 */
4460#define HW_MACHINE 1 /* string: machine class */
4461#define HW_MODEL 2 /* string: specific machine model */
4462#define HW_NCPU 3 /* int: number of cpus */
4463#define HW_BYTEORDER 4 /* int: machine byte order */
4464#define HW_PHYSMEM 5 /* int: total memory */
4465#define HW_USERMEM 6 /* int: non-kernel memory */
4466#define HW_PAGESIZE 7 /* int: software page size */
4467#define HW_DISKNAMES 8 /* strings: disk drive names */
4468#define HW_DISKSTATS 9 /* struct: diskstats[] */
4469#define HW_FLOATINGPT 10 /* int: has HW floating point? */
4470#define HW_MACHINE_ARCH 11 /* string: machine architecture */
4471#define HW_REALMEM 12 /* int: 'real' memory */
4472
4473/*
4474 * CTL_USER definitions
4475 */
4476#define USER_CS_PATH 1 /* string: _CS_PATH */
4477#define USER_BC_BASE_MAX 2 /* int: BC_BASE_MAX */
4478#define USER_BC_DIM_MAX 3 /* int: BC_DIM_MAX */
4479#define USER_BC_SCALE_MAX 4 /* int: BC_SCALE_MAX */
4480#define USER_BC_STRING_MAX 5 /* int: BC_STRING_MAX */
4481#define USER_COLL_WEIGHTS_MAX 6 /* int: COLL_WEIGHTS_MAX */
4482#define USER_EXPR_NEST_MAX 7 /* int: EXPR_NEST_MAX */
4483#define USER_LINE_MAX 8 /* int: LINE_MAX */
4484#define USER_RE_DUP_MAX 9 /* int: RE_DUP_MAX */
4485#define USER_POSIX2_VERSION 10 /* int: POSIX2_VERSION */
4486#define USER_POSIX2_C_BIND 11 /* int: POSIX2_C_BIND */
4487#define USER_POSIX2_C_DEV 12 /* int: POSIX2_C_DEV */
4488#define USER_POSIX2_CHAR_TERM 13 /* int: POSIX2_CHAR_TERM */
4489#define USER_POSIX2_FORT_DEV 14 /* int: POSIX2_FORT_DEV */
4490#define USER_POSIX2_FORT_RUN 15 /* int: POSIX2_FORT_RUN */
4491#define USER_POSIX2_LOCALEDEF 16 /* int: POSIX2_LOCALEDEF */
4492#define USER_POSIX2_SW_DEV 17 /* int: POSIX2_SW_DEV */
4493#define USER_POSIX2_UPE 18 /* int: POSIX2_UPE */
4494#define USER_STREAM_MAX 19 /* int: POSIX2_STREAM_MAX */
4495#define USER_TZNAME_MAX 20 /* int: POSIX2_TZNAME_MAX */
4496
4497#define CTL_P1003_1B_ASYNCHRONOUS_IO 1 /* boolean */
4498#define CTL_P1003_1B_MAPPED_FILES 2 /* boolean */
4499#define CTL_P1003_1B_MEMLOCK 3 /* boolean */
4500#define CTL_P1003_1B_MEMLOCK_RANGE 4 /* boolean */
4501#define CTL_P1003_1B_MEMORY_PROTECTION 5 /* boolean */
4502#define CTL_P1003_1B_MESSAGE_PASSING 6 /* boolean */
4503#define CTL_P1003_1B_PRIORITIZED_IO 7 /* boolean */
4504#define CTL_P1003_1B_PRIORITY_SCHEDULING 8 /* boolean */
4505#define CTL_P1003_1B_REALTIME_SIGNALS 9 /* boolean */
4506#define CTL_P1003_1B_SEMAPHORES 10 /* boolean */
4507#define CTL_P1003_1B_FSYNC 11 /* boolean */
4508#define CTL_P1003_1B_SHARED_MEMORY_OBJECTS 12 /* boolean */
4509#define CTL_P1003_1B_SYNCHRONIZED_IO 13 /* boolean */
4510#define CTL_P1003_1B_TIMERS 14 /* boolean */
4511#define CTL_P1003_1B_AIO_LISTIO_MAX 15 /* int */
4512#define CTL_P1003_1B_AIO_MAX 16 /* int */
4513#define CTL_P1003_1B_AIO_PRIO_DELTA_MAX 17 /* int */
4514#define CTL_P1003_1B_DELAYTIMER_MAX 18 /* int */
4515#define CTL_P1003_1B_MQ_OPEN_MAX 19 /* int */
4516#define CTL_P1003_1B_PAGESIZE 20 /* int */
4517#define CTL_P1003_1B_RTSIG_MAX 21 /* int */
4518#define CTL_P1003_1B_SEM_NSEMS_MAX 22 /* int */
4519#define CTL_P1003_1B_SEM_VALUE_MAX 23 /* int */
4520#define CTL_P1003_1B_SIGQUEUE_MAX 24 /* int */
4521#define CTL_P1003_1B_TIMER_MAX 25 /* int */
4522
4523#define CTL_P1003_1B_MAXID 26
4524
4525#ifdef _KERNEL
4526
4527/*
4528 * Declare some common oids.
4529 */
4530extern struct sysctl_oid_list sysctl__children;
4531SYSCTL_DECL(_kern);
4532SYSCTL_DECL(_kern_features);
4533SYSCTL_DECL(_kern_ipc);
4534SYSCTL_DECL(_kern_proc);
4535SYSCTL_DECL(_kern_sched);
4536SYSCTL_DECL(_kern_sched_stats);
4537SYSCTL_DECL(_sysctl);
4538SYSCTL_DECL(_vm);
4539SYSCTL_DECL(_vm_stats);
4540SYSCTL_DECL(_vm_stats_misc);
4541SYSCTL_DECL(_vfs);
4542SYSCTL_DECL(_net);
4543SYSCTL_DECL(_debug);
4544SYSCTL_DECL(_debug_sizeof);
4545SYSCTL_DECL(_dev);
4546SYSCTL_DECL(_hw);
4547SYSCTL_DECL(_hw_bus);
4548SYSCTL_DECL(_hw_bus_devices);
4549SYSCTL_DECL(_hw_bus_info);
4550SYSCTL_DECL(_machdep);
4551SYSCTL_DECL(_user);
4552SYSCTL_DECL(_compat);
4553SYSCTL_DECL(_regression);
4554SYSCTL_DECL(_security);
4555SYSCTL_DECL(_security_bsd);
4556
4557extern char machine[];
4558extern char osrelease[];
4559extern char ostype[];
4560extern char kern_ident[];
4561
4562/* Dynamic oid handling */
4563struct sysctl_oid *sysctl_add_oid(struct sysctl_ctx_list *clist,
4564 struct sysctl_oid_list *parent, int nbr, const char *name, int kind,
4565 void *arg1, intmax_t arg2, int (*handler)(SYSCTL_HANDLER_ARGS),
4566 const char *fmt, const char *descr);
4567int sysctl_remove_name(struct sysctl_oid *parent, const char *name, int del,
4568 int recurse);
4569void sysctl_rename_oid(struct sysctl_oid *oidp, const char *name);
4570int sysctl_move_oid(struct sysctl_oid *oidp,
4571 struct sysctl_oid_list *parent);
4572int sysctl_remove_oid(struct sysctl_oid *oidp, int del, int recurse);
4573int sysctl_ctx_init(struct sysctl_ctx_list *clist);
4574int sysctl_ctx_free(struct sysctl_ctx_list *clist);
4575struct sysctl_ctx_entry *sysctl_ctx_entry_add(struct sysctl_ctx_list *clist,
4576 struct sysctl_oid *oidp);
4577struct sysctl_ctx_entry *sysctl_ctx_entry_find(struct sysctl_ctx_list *clist,
4578 struct sysctl_oid *oidp);
4579int sysctl_ctx_entry_del(struct sysctl_ctx_list *clist,
4580 struct sysctl_oid *oidp);
4581
4582int kernel_sysctl(struct thread *td, int *name, u_int namelen, void *old,
4583 size_t *oldlenp, void *new, size_t newlen, size_t *retval,
4584 int flags);
4585int kernel_sysctlbyname(struct thread *td, char *name, void *old,
4586 size_t *oldlenp, void *new, size_t newlen, size_t *retval,
4587 int flags);
4588int userland_sysctl(struct thread *td, int *name, u_int namelen, void *old,
4589 size_t *oldlenp, int inkernel, void *new, size_t newlen,
4590 size_t *retval, int flags);
4591int sysctl_find_oid(int *name, u_int namelen, struct sysctl_oid **noid,
4592 int *nindx, struct sysctl_req *req);
4593void sysctl_wlock(void);
4594void sysctl_wunlock(void);
4595int sysctl_wire_old_buffer(struct sysctl_req *req, size_t len);
4596
4597struct sbuf;
4598struct sbuf *sbuf_new_for_sysctl(struct sbuf *, char *, int,
4599 struct sysctl_req *);
4600#else /* !_KERNEL */
4601# 1037 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/sysctl.h" 3 4
4602#if 0 /* expanded by -frewrite-includes */
4603#include <sys/cdefs.h>
4604#endif /* expanded by -frewrite-includes */
4605# 1037 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/sysctl.h" 3 4
4606# 1038 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/sysctl.h" 3 4
4607
4608__BEGIN_DECLS
4609int sysctl(const int *, u_int, void *, size_t *, const void *, size_t);
4610int sysctlbyname(const char *, void *, size_t *, const void *, size_t);
4611int sysctlnametomib(const char *, int *, size_t *);
4612__END_DECLS
4613#endif /* _KERNEL */
4614# 1045 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/sysctl.h" 3 4
4615
4616#endif /* !_SYS_SYSCTL_H_ */
4617# 1047 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/sysctl.h" 3 4
4618# 40 "/home/alr48/cheri/sources/cheribsd/bin/cheritest/cheritest_registers.c" 2
4619#if 0 /* expanded by -frewrite-includes */
4620#include <sys/time.h>
4621#endif /* expanded by -frewrite-includes */
4622# 40 "/home/alr48/cheri/sources/cheribsd/bin/cheritest/cheritest_registers.c"
4623# 1 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/time.h" 1 3 4
4624/*-
4625 * Copyright (c) 1982, 1986, 1993
4626 * The Regents of the University of California. All rights reserved.
4627 *
4628 * Redistribution and use in source and binary forms, with or without
4629 * modification, are permitted provided that the following conditions
4630 * are met:
4631 * 1. Redistributions of source code must retain the above copyright
4632 * notice, this list of conditions and the following disclaimer.
4633 * 2. Redistributions in binary form must reproduce the above copyright
4634 * notice, this list of conditions and the following disclaimer in the
4635 * documentation and/or other materials provided with the distribution.
4636 * 4. Neither the name of the University nor the names of its contributors
4637 * may be used to endorse or promote products derived from this software
4638 * without specific prior written permission.
4639 *
4640 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
4641 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
4642 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
4643 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
4644 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
4645 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
4646 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
4647 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
4648 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
4649 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
4650 * SUCH DAMAGE.
4651 *
4652 * @(#)time.h 8.5 (Berkeley) 5/4/95
4653 * $FreeBSD$
4654 */
4655
4656#ifndef _SYS_TIME_H_
4657#define _SYS_TIME_H_
4658
4659#if 0 /* expanded by -frewrite-includes */
4660#include <sys/_timeval.h>
4661#endif /* expanded by -frewrite-includes */
4662# 36 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/time.h" 3 4
4663# 37 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/time.h" 3 4
4664#if 0 /* expanded by -frewrite-includes */
4665#include <sys/types.h>
4666#endif /* expanded by -frewrite-includes */
4667# 37 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/time.h" 3 4
4668# 38 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/time.h" 3 4
4669#if 0 /* expanded by -frewrite-includes */
4670#include <sys/timespec.h>
4671#endif /* expanded by -frewrite-includes */
4672# 38 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/time.h" 3 4
4673# 39 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/time.h" 3 4
4674
4675struct timezone {
4676 int tz_minuteswest; /* minutes west of Greenwich */
4677 int tz_dsttime; /* type of dst correction */
4678};
4679#define DST_NONE 0 /* not on dst */
4680#define DST_USA 1 /* USA style dst */
4681#define DST_AUST 2 /* Australian style dst */
4682#define DST_WET 3 /* Western European dst */
4683#define DST_MET 4 /* Middle European dst */
4684#define DST_EET 5 /* Eastern European dst */
4685#define DST_CAN 6 /* Canada */
4686
4687#if __BSD_VISIBLE
4688struct bintime {
4689 time_t sec;
4690 uint64_t frac;
4691};
4692
4693static __inline void
4694bintime_addx(struct bintime *_bt, uint64_t _x)
4695{
4696 uint64_t _u;
4697
4698 _u = _bt->frac;
4699 _bt->frac += _x;
4700 if (_u > _bt->frac)
4701 _bt->sec++;
4702}
4703
4704static __inline void
4705bintime_add(struct bintime *_bt, const struct bintime *_bt2)
4706{
4707 uint64_t _u;
4708
4709 _u = _bt->frac;
4710 _bt->frac += _bt2->frac;
4711 if (_u > _bt->frac)
4712 _bt->sec++;
4713 _bt->sec += _bt2->sec;
4714}
4715
4716static __inline void
4717bintime_sub(struct bintime *_bt, const struct bintime *_bt2)
4718{
4719 uint64_t _u;
4720
4721 _u = _bt->frac;
4722 _bt->frac -= _bt2->frac;
4723 if (_u < _bt->frac)
4724 _bt->sec--;
4725 _bt->sec -= _bt2->sec;
4726}
4727
4728static __inline void
4729bintime_mul(struct bintime *_bt, u_int _x)
4730{
4731 uint64_t _p1, _p2;
4732
4733 _p1 = (_bt->frac & 0xffffffffull) * _x;
4734 _p2 = (_bt->frac >> 32) * _x + (_p1 >> 32);
4735 _bt->sec *= _x;
4736 _bt->sec += (_p2 >> 32);
4737 _bt->frac = (_p2 << 32) | (_p1 & 0xffffffffull);
4738}
4739
4740static __inline void
4741bintime_shift(struct bintime *_bt, int _exp)
4742{
4743
4744 if (_exp > 0) {
4745 _bt->sec <<= _exp;
4746 _bt->sec |= _bt->frac >> (64 - _exp);
4747 _bt->frac <<= _exp;
4748 } else if (_exp < 0) {
4749 _bt->frac >>= -_exp;
4750 _bt->frac |= (uint64_t)_bt->sec << (64 + _exp);
4751 _bt->sec >>= -_exp;
4752 }
4753}
4754
4755#define bintime_clear(a) ((a)->sec = (a)->frac = 0)
4756#define bintime_isset(a) ((a)->sec || (a)->frac)
4757#define bintime_cmp(a, b, cmp) \
4758 (((a)->sec == (b)->sec) ? \
4759 ((a)->frac cmp (b)->frac) : \
4760 ((a)->sec cmp (b)->sec))
4761
4762#define SBT_1S ((sbintime_t)1 << 32)
4763#define SBT_1M (SBT_1S * 60)
4764#define SBT_1MS (SBT_1S / 1000)
4765#define SBT_1US (SBT_1S / 1000000)
4766#define SBT_1NS (SBT_1S / 1000000000)
4767#define SBT_MAX 0x7fffffffffffffffLL
4768
4769static __inline int
4770sbintime_getsec(sbintime_t _sbt)
4771{
4772
4773 return (_sbt >> 32);
4774}
4775
4776static __inline sbintime_t
4777bttosbt(const struct bintime _bt)
4778{
4779
4780 return (((sbintime_t)_bt.sec << 32) + (_bt.frac >> 32));
4781}
4782
4783static __inline struct bintime
4784sbttobt(sbintime_t _sbt)
4785{
4786 struct bintime _bt;
4787
4788 _bt.sec = _sbt >> 32;
4789 _bt.frac = _sbt << 32;
4790 return (_bt);
4791}
4792
4793/*-
4794 * Background information:
4795 *
4796 * When converting between timestamps on parallel timescales of differing
4797 * resolutions it is historical and scientific practice to round down rather
4798 * than doing 4/5 rounding.
4799 *
4800 * The date changes at midnight, not at noon.
4801 *
4802 * Even at 15:59:59.999999999 it's not four'o'clock.
4803 *
4804 * time_second ticks after N.999999999 not after N.4999999999
4805 */
4806
4807static __inline void
4808bintime2timespec(const struct bintime *_bt, struct timespec *_ts)
4809{
4810
4811 _ts->tv_sec = _bt->sec;
4812 _ts->tv_nsec = ((uint64_t)1000000000 *
4813 (uint32_t)(_bt->frac >> 32)) >> 32;
4814}
4815
4816static __inline void
4817timespec2bintime(const struct timespec *_ts, struct bintime *_bt)
4818{
4819
4820 _bt->sec = _ts->tv_sec;
4821 /* 18446744073 = int(2^64 / 1000000000) */
4822 _bt->frac = _ts->tv_nsec * (uint64_t)18446744073LL;
4823}
4824
4825static __inline void
4826bintime2timeval(const struct bintime *_bt, struct timeval *_tv)
4827{
4828
4829 _tv->tv_sec = _bt->sec;
4830 _tv->tv_usec = ((uint64_t)1000000 * (uint32_t)(_bt->frac >> 32)) >> 32;
4831}
4832
4833static __inline void
4834timeval2bintime(const struct timeval *_tv, struct bintime *_bt)
4835{
4836
4837 _bt->sec = _tv->tv_sec;
4838 /* 18446744073709 = int(2^64 / 1000000) */
4839 _bt->frac = _tv->tv_usec * (uint64_t)18446744073709LL;
4840}
4841
4842static __inline struct timespec
4843sbttots(sbintime_t _sbt)
4844{
4845 struct timespec _ts;
4846
4847 _ts.tv_sec = _sbt >> 32;
4848 _ts.tv_nsec = ((uint64_t)1000000000 * (uint32_t)_sbt) >> 32;
4849 return (_ts);
4850}
4851
4852static __inline sbintime_t
4853tstosbt(struct timespec _ts)
4854{
4855
4856 return (((sbintime_t)_ts.tv_sec << 32) +
4857 (_ts.tv_nsec * (((uint64_t)1 << 63) / 500000000) >> 32));
4858}
4859
4860static __inline struct timeval
4861sbttotv(sbintime_t _sbt)
4862{
4863 struct timeval _tv;
4864
4865 _tv.tv_sec = _sbt >> 32;
4866 _tv.tv_usec = ((uint64_t)1000000 * (uint32_t)_sbt) >> 32;
4867 return (_tv);
4868}
4869
4870static __inline sbintime_t
4871tvtosbt(struct timeval _tv)
4872{
4873
4874 return (((sbintime_t)_tv.tv_sec << 32) +
4875 (_tv.tv_usec * (((uint64_t)1 << 63) / 500000) >> 32));
4876}
4877#endif /* __BSD_VISIBLE */
4878# 243 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/time.h" 3 4
4879
4880#ifdef _KERNEL
4881
4882/* Operations on timespecs */
4883#define timespecclear(tvp) ((tvp)->tv_sec = (tvp)->tv_nsec = 0)
4884#define timespecisset(tvp) ((tvp)->tv_sec || (tvp)->tv_nsec)
4885#define timespeccmp(tvp, uvp, cmp) \
4886 (((tvp)->tv_sec == (uvp)->tv_sec) ? \
4887 ((tvp)->tv_nsec cmp (uvp)->tv_nsec) : \
4888 ((tvp)->tv_sec cmp (uvp)->tv_sec))
4889#define timespecadd(vvp, uvp) \
4890 do { \
4891 (vvp)->tv_sec += (uvp)->tv_sec; \
4892 (vvp)->tv_nsec += (uvp)->tv_nsec; \
4893 if ((vvp)->tv_nsec >= 1000000000) { \
4894 (vvp)->tv_sec++; \
4895 (vvp)->tv_nsec -= 1000000000; \
4896 } \
4897 } while (0)
4898#define timespecsub(vvp, uvp) \
4899 do { \
4900 (vvp)->tv_sec -= (uvp)->tv_sec; \
4901 (vvp)->tv_nsec -= (uvp)->tv_nsec; \
4902 if ((vvp)->tv_nsec < 0) { \
4903 (vvp)->tv_sec--; \
4904 (vvp)->tv_nsec += 1000000000; \
4905 } \
4906 } while (0)
4907
4908/* Operations on timevals. */
4909
4910#define timevalclear(tvp) ((tvp)->tv_sec = (tvp)->tv_usec = 0)
4911#define timevalisset(tvp) ((tvp)->tv_sec || (tvp)->tv_usec)
4912#define timevalcmp(tvp, uvp, cmp) \
4913 (((tvp)->tv_sec == (uvp)->tv_sec) ? \
4914 ((tvp)->tv_usec cmp (uvp)->tv_usec) : \
4915 ((tvp)->tv_sec cmp (uvp)->tv_sec))
4916
4917/* timevaladd and timevalsub are not inlined */
4918
4919#endif /* _KERNEL */
4920# 284 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/time.h" 3 4
4921
4922#ifndef _KERNEL /* NetBSD/OpenBSD compatible interfaces */
4923
4924#define timerclear(tvp) ((tvp)->tv_sec = (tvp)->tv_usec = 0)
4925#define timerisset(tvp) ((tvp)->tv_sec || (tvp)->tv_usec)
4926#define timercmp(tvp, uvp, cmp) \
4927 (((tvp)->tv_sec == (uvp)->tv_sec) ? \
4928 ((tvp)->tv_usec cmp (uvp)->tv_usec) : \
4929 ((tvp)->tv_sec cmp (uvp)->tv_sec))
4930#define timeradd(tvp, uvp, vvp) \
4931 do { \
4932 (vvp)->tv_sec = (tvp)->tv_sec + (uvp)->tv_sec; \
4933 (vvp)->tv_usec = (tvp)->tv_usec + (uvp)->tv_usec; \
4934 if ((vvp)->tv_usec >= 1000000) { \
4935 (vvp)->tv_sec++; \
4936 (vvp)->tv_usec -= 1000000; \
4937 } \
4938 } while (0)
4939#define timersub(tvp, uvp, vvp) \
4940 do { \
4941 (vvp)->tv_sec = (tvp)->tv_sec - (uvp)->tv_sec; \
4942 (vvp)->tv_usec = (tvp)->tv_usec - (uvp)->tv_usec; \
4943 if ((vvp)->tv_usec < 0) { \
4944 (vvp)->tv_sec--; \
4945 (vvp)->tv_usec += 1000000; \
4946 } \
4947 } while (0)
4948#endif
4949# 312 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/time.h" 3 4
4950
4951/*
4952 * Names of the interval timers, and structure
4953 * defining a timer setting.
4954 */
4955#define ITIMER_REAL 0
4956#define ITIMER_VIRTUAL 1
4957#define ITIMER_PROF 2
4958
4959struct itimerval {
4960 struct timeval it_interval; /* timer interval */
4961 struct timeval it_value; /* current value */
4962};
4963
4964/*
4965 * Getkerninfo clock information structure
4966 */
4967struct clockinfo {
4968 int hz; /* clock frequency */
4969 int tick; /* micro-seconds per hz tick */
4970 int spare;
4971 int stathz; /* statistics clock frequency */
4972 int profhz; /* profiling clock frequency */
4973};
4974
4975/* These macros are also in time.h. */
4976#ifndef CLOCK_REALTIME
4977#define CLOCK_REALTIME 0
4978#define CLOCK_VIRTUAL 1
4979#define CLOCK_PROF 2
4980#define CLOCK_MONOTONIC 4
4981#define CLOCK_UPTIME 5 /* FreeBSD-specific. */
4982#define CLOCK_UPTIME_PRECISE 7 /* FreeBSD-specific. */
4983#define CLOCK_UPTIME_FAST 8 /* FreeBSD-specific. */
4984#define CLOCK_REALTIME_PRECISE 9 /* FreeBSD-specific. */
4985#define CLOCK_REALTIME_FAST 10 /* FreeBSD-specific. */
4986#define CLOCK_MONOTONIC_PRECISE 11 /* FreeBSD-specific. */
4987#define CLOCK_MONOTONIC_FAST 12 /* FreeBSD-specific. */
4988#define CLOCK_SECOND 13 /* FreeBSD-specific. */
4989#define CLOCK_THREAD_CPUTIME_ID 14
4990#define CLOCK_PROCESS_CPUTIME_ID 15
4991#endif
4992# 354 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/time.h" 3 4
4993
4994#ifndef TIMER_ABSTIME
4995#define TIMER_RELTIME 0x0 /* relative timer */
4996#define TIMER_ABSTIME 0x1 /* absolute timer */
4997#endif
4998# 359 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/time.h" 3 4
4999
5000#if __BSD_VISIBLE
5001#define CPUCLOCK_WHICH_PID 0
5002#define CPUCLOCK_WHICH_TID 1
5003#endif
5004# 364 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/time.h" 3 4
5005
5006#ifdef _KERNEL
5007
5008/*
5009 * Kernel to clock driver interface.
5010 */
5011void inittodr(time_t base);
5012void resettodr(void);
5013
5014extern volatile time_t time_second;
5015extern volatile time_t time_uptime;
5016extern struct bintime tc_tick_bt;
5017extern sbintime_t tc_tick_sbt;
5018extern struct bintime tick_bt;
5019extern sbintime_t tick_sbt;
5020extern int tc_precexp;
5021extern int tc_timepercentage;
5022extern struct bintime bt_timethreshold;
5023extern struct bintime bt_tickthreshold;
5024extern sbintime_t sbt_timethreshold;
5025extern sbintime_t sbt_tickthreshold;
5026
5027/*
5028 * Functions for looking at our clock: [get]{bin,nano,micro}[up]time()
5029 *
5030 * Functions without the "get" prefix returns the best timestamp
5031 * we can produce in the given format.
5032 *
5033 * "bin" == struct bintime == seconds + 64 bit fraction of seconds.
5034 * "nano" == struct timespec == seconds + nanoseconds.
5035 * "micro" == struct timeval == seconds + microseconds.
5036 *
5037 * Functions containing "up" returns time relative to boot and
5038 * should be used for calculating time intervals.
5039 *
5040 * Functions without "up" returns UTC time.
5041 *
5042 * Functions with the "get" prefix returns a less precise result
5043 * much faster than the functions without "get" prefix and should
5044 * be used where a precision of 1/hz seconds is acceptable or where
5045 * performance is priority. (NB: "precision", _not_ "resolution" !)
5046 */
5047
5048void binuptime(struct bintime *bt);
5049void nanouptime(struct timespec *tsp);
5050void microuptime(struct timeval *tvp);
5051
5052static __inline sbintime_t
5053sbinuptime(void)
5054{
5055 struct bintime _bt;
5056
5057 binuptime(&_bt);
5058 return (bttosbt(_bt));
5059}
5060
5061void bintime(struct bintime *bt);
5062void nanotime(struct timespec *tsp);
5063void microtime(struct timeval *tvp);
5064
5065void getbinuptime(struct bintime *bt);
5066void getnanouptime(struct timespec *tsp);
5067void getmicrouptime(struct timeval *tvp);
5068
5069static __inline sbintime_t
5070getsbinuptime(void)
5071{
5072 struct bintime _bt;
5073
5074 getbinuptime(&_bt);
5075 return (bttosbt(_bt));
5076}
5077
5078void getbintime(struct bintime *bt);
5079void getnanotime(struct timespec *tsp);
5080void getmicrotime(struct timeval *tvp);
5081
5082void getboottime(struct timeval *boottime);
5083void getboottimebin(struct bintime *boottimebin);
5084
5085/* Other functions */
5086int itimerdecr(struct itimerval *itp, int usec);
5087int itimerfix(struct timeval *tv);
5088int ppsratecheck(struct timeval *, int *, int);
5089int ratecheck(struct timeval *, const struct timeval *);
5090void timevaladd(struct timeval *t1, const struct timeval *t2);
5091void timevalsub(struct timeval *t1, const struct timeval *t2);
5092int tvtohz(struct timeval *tv);
5093
5094#define TC_DEFAULTPERC 5
5095
5096#define BT2FREQ(bt) \
5097 (((uint64_t)0x8000000000000000 + ((bt)->frac >> 2)) / \
5098 ((bt)->frac >> 1))
5099
5100#define SBT2FREQ(sbt) ((SBT_1S + ((sbt) >> 1)) / (sbt))
5101
5102#define FREQ2BT(freq, bt) \
5103{ \
5104 (bt)->sec = 0; \
5105 (bt)->frac = ((uint64_t)0x8000000000000000 / (freq)) << 1; \
5106}
5107
5108#define TIMESEL(sbt, sbt2) \
5109 (((sbt2) >= sbt_timethreshold) ? \
5110 ((*(sbt) = getsbinuptime()), 1) : ((*(sbt) = sbinuptime()), 0))
5111
5112#else /* !_KERNEL */
5113# 472 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/time.h" 3 4
5114#if 0 /* expanded by -frewrite-includes */
5115#include <time.h>
5116#endif /* expanded by -frewrite-includes */
5117# 472 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/time.h" 3 4
5118# 1 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/time.h" 1 3 4
5119/*
5120 * Copyright (c) 1989, 1993
5121 * The Regents of the University of California. All rights reserved.
5122 * (c) UNIX System Laboratories, Inc.
5123 * All or some portions of this file are derived from material licensed
5124 * to the University of California by American Telephone and Telegraph
5125 * Co. or Unix System Laboratories, Inc. and are reproduced herein with
5126 * the permission of UNIX System Laboratories, Inc.
5127 *
5128 * Redistribution and use in source and binary forms, with or without
5129 * modification, are permitted provided that the following conditions
5130 * are met:
5131 * 1. Redistributions of source code must retain the above copyright
5132 * notice, this list of conditions and the following disclaimer.
5133 * 2. Redistributions in binary form must reproduce the above copyright
5134 * notice, this list of conditions and the following disclaimer in the
5135 * documentation and/or other materials provided with the distribution.
5136 * 3. Neither the name of the University nor the names of its contributors
5137 * may be used to endorse or promote products derived from this software
5138 * without specific prior written permission.
5139 *
5140 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
5141 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
5142 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
5143 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
5144 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
5145 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
5146 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
5147 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
5148 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
5149 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
5150 * SUCH DAMAGE.
5151 *
5152 * @(#)time.h 8.3 (Berkeley) 1/21/94
5153 */
5154
5155/*
5156 * $FreeBSD$
5157 */
5158
5159#ifndef _TIME_H_
5160#define _TIME_H_
5161
5162#if 0 /* expanded by -frewrite-includes */
5163#include <sys/cdefs.h>
5164#endif /* expanded by -frewrite-includes */
5165# 44 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/time.h" 3 4
5166# 45 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/time.h" 3 4
5167#if 0 /* expanded by -frewrite-includes */
5168#include <sys/_null.h>
5169#endif /* expanded by -frewrite-includes */
5170# 45 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/time.h" 3 4
5171# 1 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/_null.h" 1 3 4
5172/*-
5173 * Copyright (c) 2003 Marcel Moolenaar
5174 * All rights reserved.
5175 *
5176 * Redistribution and use in source and binary forms, with or without
5177 * modification, are permitted provided that the following conditions
5178 * are met:
5179 *
5180 * 1. Redistributions of source code must retain the above copyright
5181 * notice, this list of conditions and the following disclaimer.
5182 * 2. Redistributions in binary form must reproduce the above copyright
5183 * notice, this list of conditions and the following disclaimer in the
5184 * documentation and/or other materials provided with the distribution.
5185 *
5186 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
5187 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
5188 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
5189 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
5190 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
5191 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
5192 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
5193 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
5194 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
5195 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
5196 *
5197 * $FreeBSD$
5198 */
5199
5200#ifndef NULL
5201
5202#if !defined(__cplusplus)
5203#define NULL ((void *)0)
5204#else
5205# 34 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/_null.h" 3 4
5206#if __cplusplus >= 201103L
5207#define NULL nullptr
5208#elif defined(__GNUG__) && defined(__GNUC__) && __GNUC__ >= 4
5209# 37 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/_null.h" 3 4
5210#define NULL __null
5211#else
5212# 39 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/_null.h" 3 4
5213#if defined(__LP64__)
5214#define NULL (0L)
5215#else
5216# 42 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/_null.h" 3 4
5217#define NULL 0
5218#endif /* __LP64__ */
5219# 44 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/_null.h" 3 4
5220#endif /* __GNUG__ */
5221# 45 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/_null.h" 3 4
5222#endif /* !__cplusplus */
5223# 46 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/_null.h" 3 4
5224
5225#endif
5226# 48 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/_null.h" 3 4
5227# 46 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/time.h" 2 3 4
5228#if 0 /* expanded by -frewrite-includes */
5229#include <sys/_types.h>
5230#endif /* expanded by -frewrite-includes */
5231# 46 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/time.h" 3 4
5232# 47 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/time.h" 3 4
5233
5234#if __POSIX_VISIBLE > 0 && __POSIX_VISIBLE < 200112 || __BSD_VISIBLE
5235/*
5236 * Frequency of the clock ticks reported by times(). Deprecated - use
5237 * sysconf(_SC_CLK_TCK) instead. (Removed in 1003.1-2001.)
5238 */
5239#define CLK_TCK 128
5240#endif
5241# 55 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/time.h" 3 4
5242
5243/* Frequency of the clock ticks reported by clock(). */
5244#define CLOCKS_PER_SEC 128
5245
5246#ifndef _CLOCK_T_DECLARED
5247typedef __clock_t clock_t;
5248#define _CLOCK_T_DECLARED
5249#endif
5250# 63 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/time.h" 3 4
5251
5252#ifndef _TIME_T_DECLARED
5253typedef __time_t time_t;
5254#define _TIME_T_DECLARED
5255#endif
5256# 68 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/time.h" 3 4
5257
5258#ifndef _SIZE_T_DECLARED
5259typedef __size_t size_t;
5260#define _SIZE_T_DECLARED
5261#endif
5262# 73 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/time.h" 3 4
5263
5264#if __POSIX_VISIBLE >= 199309
5265/*
5266 * New in POSIX 1003.1b-1993.
5267 */
5268#ifndef _CLOCKID_T_DECLARED
5269typedef __clockid_t clockid_t;
5270#define _CLOCKID_T_DECLARED
5271#endif
5272# 82 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/time.h" 3 4
5273
5274#ifndef _TIMER_T_DECLARED
5275typedef __timer_t timer_t;
5276#define _TIMER_T_DECLARED
5277#endif
5278# 87 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/time.h" 3 4
5279
5280#if 0 /* expanded by -frewrite-includes */
5281#include <sys/timespec.h>
5282#endif /* expanded by -frewrite-includes */
5283# 88 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/time.h" 3 4
5284# 89 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/time.h" 3 4
5285#endif /* __POSIX_VISIBLE >= 199309 */
5286# 90 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/time.h" 3 4
5287
5288#if __POSIX_VISIBLE >= 200112
5289#ifndef _PID_T_DECLARED
5290typedef __pid_t pid_t;
5291#define _PID_T_DECLARED
5292#endif
5293# 96 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/time.h" 3 4
5294#endif
5295# 97 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/time.h" 3 4
5296
5297/* These macros are also in sys/time.h. */
5298#if !defined(CLOCK_REALTIME) && __POSIX_VISIBLE >= 200112
5299#define CLOCK_REALTIME 0
5300#ifdef __BSD_VISIBLE
5301#define CLOCK_VIRTUAL 1
5302#define CLOCK_PROF 2
5303#endif
5304# 105 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/time.h" 3 4
5305#define CLOCK_MONOTONIC 4
5306#define CLOCK_UPTIME 5 /* FreeBSD-specific. */
5307#define CLOCK_UPTIME_PRECISE 7 /* FreeBSD-specific. */
5308#define CLOCK_UPTIME_FAST 8 /* FreeBSD-specific. */
5309#define CLOCK_REALTIME_PRECISE 9 /* FreeBSD-specific. */
5310#define CLOCK_REALTIME_FAST 10 /* FreeBSD-specific. */
5311#define CLOCK_MONOTONIC_PRECISE 11 /* FreeBSD-specific. */
5312#define CLOCK_MONOTONIC_FAST 12 /* FreeBSD-specific. */
5313#define CLOCK_SECOND 13 /* FreeBSD-specific. */
5314#define CLOCK_THREAD_CPUTIME_ID 14
5315#define CLOCK_PROCESS_CPUTIME_ID 15
5316#endif /* !defined(CLOCK_REALTIME) && __POSIX_VISIBLE >= 200112 */
5317# 117 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/time.h" 3 4
5318
5319#if !defined(TIMER_ABSTIME) && __POSIX_VISIBLE >= 200112
5320#if __BSD_VISIBLE
5321#define TIMER_RELTIME 0x0 /* relative timer */
5322#endif
5323# 122 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/time.h" 3 4
5324#define TIMER_ABSTIME 0x1 /* absolute timer */
5325#endif /* !defined(TIMER_ABSTIME) && __POSIX_VISIBLE >= 200112 */
5326# 124 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/time.h" 3 4
5327
5328struct tm {
5329 int tm_sec; /* seconds after the minute [0-60] */
5330 int tm_min; /* minutes after the hour [0-59] */
5331 int tm_hour; /* hours since midnight [0-23] */
5332 int tm_mday; /* day of the month [1-31] */
5333 int tm_mon; /* months since January [0-11] */
5334 int tm_year; /* years since 1900 */
5335 int tm_wday; /* days since Sunday [0-6] */
5336 int tm_yday; /* days since January 1 [0-365] */
5337 int tm_isdst; /* Daylight Savings Time flag */
5338 long tm_gmtoff; /* offset from UTC in seconds */
5339 char *tm_zone; /* timezone abbreviation */
5340};
5341
5342#if __POSIX_VISIBLE
5343extern char *tzname[];
5344#endif
5345# 142 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/time.h" 3 4
5346
5347__BEGIN_DECLS
5348char *asctime(const struct tm *);
5349clock_t clock(void);
5350char *ctime(const time_t *);
5351double difftime(time_t, time_t);
5352/* XXX missing: getdate() */
5353struct tm *gmtime(const time_t *);
5354struct tm *localtime(const time_t *);
5355time_t mktime(struct tm *);
5356size_t strftime(char * __restrict, size_t, const char * __restrict,
5357 const struct tm * __restrict);
5358time_t time(time_t *);
5359#if __POSIX_VISIBLE >= 200112
5360struct sigevent;
5361int timer_create(clockid_t, struct sigevent *__restrict, timer_t *__restrict);
5362int timer_delete(timer_t);
5363int timer_gettime(timer_t, struct itimerspec *);
5364int timer_getoverrun(timer_t);
5365int timer_settime(timer_t, int, const struct itimerspec *__restrict,
5366 struct itimerspec *__restrict);
5367#endif
5368# 164 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/time.h" 3 4
5369#if __POSIX_VISIBLE
5370void tzset(void);
5371#endif
5372# 167 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/time.h" 3 4
5373
5374#if __POSIX_VISIBLE >= 199309
5375int clock_getres(clockid_t, struct timespec *);
5376int clock_gettime(clockid_t, struct timespec *);
5377int clock_settime(clockid_t, const struct timespec *);
5378/* XXX missing: clock_nanosleep() */
5379int nanosleep(const struct timespec *, struct timespec *);
5380#endif /* __POSIX_VISIBLE >= 199309 */
5381# 175 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/time.h" 3 4
5382
5383#if __POSIX_VISIBLE >= 200112
5384int clock_getcpuclockid(pid_t, clockid_t *);
5385#endif
5386# 179 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/time.h" 3 4
5387
5388#if __POSIX_VISIBLE >= 199506
5389char *asctime_r(const struct tm *, char *);
5390char *ctime_r(const time_t *, char *);
5391struct tm *gmtime_r(const time_t *, struct tm *);
5392struct tm *localtime_r(const time_t *, struct tm *);
5393#endif
5394# 186 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/time.h" 3 4
5395
5396#if __XSI_VISIBLE
5397char *strptime(const char * __restrict, const char * __restrict,
5398 struct tm * __restrict);
5399#endif
5400# 191 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/time.h" 3 4
5401
5402#if __BSD_VISIBLE
5403char *timezone(int, int); /* XXX XSI conflict */
5404void tzsetwall(void);
5405time_t timelocal(struct tm * const);
5406time_t timegm(struct tm * const);
5407int timer_oshandle_np(timer_t timerid);
5408#endif /* __BSD_VISIBLE */
5409# 199 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/time.h" 3 4
5410
5411#if __POSIX_VISIBLE >= 200809 || defined(_XLOCALE_H_)
5412#if 0 /* expanded by -frewrite-includes */
5413#include <xlocale/_time.h>
5414#endif /* expanded by -frewrite-includes */
5415# 201 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/time.h" 3 4
5416# 1 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/xlocale/_time.h" 1 3 4
5417/*-
5418 * Copyright (c) 2011, 2012 The FreeBSD Foundation
5419 * All rights reserved.
5420 *
5421 * This software was developed by David Chisnall under sponsorship from
5422 * the FreeBSD Foundation.
5423 *
5424 * Redistribution and use in source and binary forms, with or without
5425 * modification, are permitted provided that the following conditions
5426 * are met:
5427 * 1. Redistributions of source code must retain the above copyright
5428 * notice, this list of conditions and the following disclaimer.
5429 * 2. Redistributions in binary form must reproduce the above copyright
5430 * notice, this list of conditions and the following disclaimer in the
5431 * documentation and/or other materials provided with the distribution.
5432 *
5433 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
5434 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
5435 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
5436 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
5437 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
5438 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
5439 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
5440 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
5441 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
5442 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
5443 * SUCH DAMAGE.
5444 *
5445 * $FreeBSD$
5446 */
5447
5448#ifndef _LOCALE_T_DEFINED
5449#define _LOCALE_T_DEFINED
5450typedef struct _xlocale *locale_t;
5451#endif
5452# 36 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/xlocale/_time.h" 3 4
5453
5454/*
5455 * This file is included from both locale.h and xlocale.h. We need to expose
5456 * the declarations unconditionally if we are included from xlocale.h, but only
5457 * if we are in POSIX2008 mode if included from locale.h.
5458 */
5459#ifndef _XLOCALE_LOCALE1_H
5460#define _XLOCALE_LOCALE1_H
5461
5462size_t strftime_l(char * __restrict, size_t, const char * __restrict,
5463 const struct tm * __restrict, locale_t) __strftimelike(3, 0);
5464
5465#endif /* _XLOCALE_LOCALE1_H */
5466# 49 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/xlocale/_time.h" 3 4
5467
5468#ifdef _XLOCALE_H_
5469#ifndef _XLOCALE_LOCALE2_H
5470#define _XLOCALE_LOCALE2_H
5471
5472char *strptime_l(const char * __restrict, const char * __restrict,
5473 struct tm * __restrict, locale_t);
5474
5475#endif /* _XLOCALE_LOCALE2_H */
5476# 58 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/xlocale/_time.h" 3 4
5477#endif /* _XLOCALE_H_ */
5478# 59 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/xlocale/_time.h" 3 4
5479# 202 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/time.h" 2 3 4
5480#endif
5481# 203 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/time.h" 3 4
5482__END_DECLS
5483
5484#endif /* !_TIME_H_ */
5485# 206 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/time.h" 3 4
5486# 473 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/time.h" 2 3 4
5487
5488#if 0 /* expanded by -frewrite-includes */
5489#include <sys/cdefs.h>
5490#endif /* expanded by -frewrite-includes */
5491# 474 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/time.h" 3 4
5492# 475 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/time.h" 3 4
5493#if 0 /* expanded by -frewrite-includes */
5494#include <sys/select.h>
5495#endif /* expanded by -frewrite-includes */
5496# 475 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/time.h" 3 4
5497# 476 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/time.h" 3 4
5498
5499__BEGIN_DECLS
5500int setitimer(int, const struct itimerval *, struct itimerval *);
5501int utimes(const char *, const struct timeval *);
5502
5503#if __BSD_VISIBLE
5504int adjtime(const struct timeval *, struct timeval *);
5505int clock_getcpuclockid2(id_t, int, clockid_t *);
5506int futimes(int, const struct timeval *);
5507int futimesat(int, const char *, const struct timeval [2]);
5508int lutimes(const char *, const struct timeval *);
5509int settimeofday(const struct timeval *, const struct timezone *);
5510#endif
5511# 489 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/time.h" 3 4
5512
5513#if __XSI_VISIBLE
5514int getitimer(int, struct itimerval *);
5515int gettimeofday(struct timeval *, struct timezone *);
5516#endif
5517# 494 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/time.h" 3 4
5518
5519__END_DECLS
5520
5521#endif /* !_KERNEL */
5522# 498 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/time.h" 3 4
5523
5524#endif /* !_SYS_TIME_H_ */
5525# 500 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/time.h" 3 4
5526# 41 "/home/alr48/cheri/sources/cheribsd/bin/cheritest/cheritest_registers.c" 2
5527
5528#if 0 /* expanded by -frewrite-includes */
5529#include <machine/cherireg.h>
5530#endif /* expanded by -frewrite-includes */
5531# 42 "/home/alr48/cheri/sources/cheribsd/bin/cheritest/cheritest_registers.c"
5532# 1 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/machine/cherireg.h" 1 3 4
5533/*-
5534 * Copyright (c) 2011-2016 Robert N. M. Watson
5535 * All rights reserved.
5536 *
5537 * This software was developed by SRI International and the University of
5538 * Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237)
5539 * ("CTSRD"), as part of the DARPA CRASH research programme.
5540 *
5541 * Redistribution and use in source and binary forms, with or without
5542 * modification, are permitted provided that the following conditions
5543 * are met:
5544 * 1. Redistributions of source code must retain the above copyright
5545 * notice, this list of conditions and the following disclaimer.
5546 * 2. Redistributions in binary form must reproduce the above copyright
5547 * notice, this list of conditions and the following disclaimer in the
5548 * documentation and/or other materials provided with the distribution.
5549 *
5550 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
5551 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
5552 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
5553 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
5554 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
5555 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
5556 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
5557 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
5558 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
5559 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
5560 * SUCH DAMAGE.
5561 */
5562
5563#ifndef _MIPS_INCLUDE_CHERIREG_H_
5564#define _MIPS_INCLUDE_CHERIREG_H_
5565
5566/*
5567 * The size of in-memory capabilities in bytes; minimum alignment is also
5568 * assumed to be this size.
5569 */
5570#if defined(_MIPS_SZCAP) && (_MIPS_SZCAP != 128) && (_MIPS_SZCAP != 256)
5571#error "_MIPS_SZCAP defined but neither 128 nor 256"
5572#endif
5573# 41 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/machine/cherireg.h" 3 4
5574
5575#if defined(CPU_CHERI128) || (defined(_MIPS_SZCAP) && (_MIPS_SZCAP == 128))
5576#define CHERICAP_SIZE 16
5577#define CHERICAP_SHIFT 4
5578#else
5579# 46 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/machine/cherireg.h" 3 4
5580#define CHERICAP_SIZE 32
5581#define CHERICAP_SHIFT 5
5582#endif
5583# 49 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/machine/cherireg.h" 3 4
5584
5585/*
5586 * CHERI ISA-defined constants for capabilities -- suitable for inclusion from
5587 * assembly source code.
5588 *
5589 * XXXRW: CHERI_UNSEALED is not currently considered part of the perms word,
5590 * but perhaps it should be.
5591 */
5592#define CHERI_PERM_GLOBAL (1 << 0) /* 0x00000001 */
5593#define CHERI_PERM_EXECUTE (1 << 1) /* 0x00000002 */
5594#define CHERI_PERM_LOAD (1 << 2) /* 0x00000004 */
5595#define CHERI_PERM_STORE (1 << 3) /* 0x00000008 */
5596#define CHERI_PERM_LOAD_CAP (1 << 4) /* 0x00000010 */
5597#define CHERI_PERM_STORE_CAP (1 << 5) /* 0x00000020 */
5598#define CHERI_PERM_STORE_LOCAL_CAP (1 << 6) /* 0x00000040 */
5599#define CHERI_PERM_SEAL (1 << 7) /* 0x00000080 */
5600#define CHERI_PERM_RESERVED0 (1 << 8) /* 0x00000100 */
5601#define CHERI_PERM_RESERVED1 (1 << 9) /* 0x00000200 */
5602#define CHERI_PERM_SYSTEM_REGS (1 << 10) /* 0x00000400 */
5603
5604/*
5605 * User-defined permission bits.
5606 *
5607 * 256-bit CHERI has a substantially larger number of user-defined
5608 * permissions.
5609 */
5610#define CHERI256_PERM_USER0 (1 << 15) /* 0x00008000 */
5611#define CHERI256_PERM_USER1 (1 << 16) /* 0x00010000 */
5612#define CHERI256_PERM_USER2 (1 << 17) /* 0x00020000 */
5613#define CHERI256_PERM_USER3 (1 << 18) /* 0x00040000 */
5614#define CHERI256_PERM_USER4 (1 << 19) /* 0x00080000 */
5615#define CHERI256_PERM_USER5 (1 << 20) /* 0x00100000 */
5616#define CHERI256_PERM_USER6 (1 << 21) /* 0x00200000 */
5617#define CHERI256_PERM_USER7 (1 << 22) /* 0x00400000 */
5618#define CHERI256_PERM_USER8 (1 << 23) /* 0x00800000 */
5619#define CHERI256_PERM_USER9 (1 << 24) /* 0x01000000 */
5620#define CHERI256_PERM_USER10 (1 << 25) /* 0x02000000 */
5621#define CHERI256_PERM_USER11 (1 << 26) /* 0x04000000 */
5622#define CHERI256_PERM_USER12 (1 << 27) /* 0x08000000 */
5623#define CHERI256_PERM_USER13 (1 << 28) /* 0x10000000 */
5624#define CHERI256_PERM_USER14 (1 << 29) /* 0x20000000 */
5625#define CHERI256_PERM_USER15 (1 << 30) /* 0x40000000 */
5626
5627#define CHERI128_PERM_USER0 (1 << 15) /* 0x00008000 */
5628#define CHERI128_PERM_USER1 (1 << 16) /* 0x00010000 */
5629#define CHERI128_PERM_USER2 (1 << 17) /* 0x00020000 */
5630#define CHERI128_PERM_USER3 (1 << 18) /* 0x00040000 */
5631
5632#if (CHERICAP_SIZE == 32)
5633#define CHERI_PERM_USER0 CHERI256_PERM_USER0
5634#define CHERI_PERM_USER1 CHERI256_PERM_USER1
5635#define CHERI_PERM_USER2 CHERI256_PERM_USER2
5636#define CHERI_PERM_USER3 CHERI256_PERM_USER3
5637#define CHERI_PERM_USER4 CHERI256_PERM_USER4
5638#define CHERI_PERM_USER5 CHERI256_PERM_USER5
5639#define CHERI_PERM_USER6 CHERI256_PERM_USER6
5640#define CHERI_PERM_USER7 CHERI256_PERM_USER7
5641#define CHERI_PERM_USER8 CHERI256_PERM_USER8
5642#define CHERI_PERM_USER9 CHERI256_PERM_USER9
5643#define CHERI_PERM_USER10 CHERI256_PERM_USER10
5644#define CHERI_PERM_USER11 CHERI256_PERM_USER11
5645#define CHERI_PERM_USER12 CHERI256_PERM_USER12
5646#define CHERI_PERM_USER13 CHERI256_PERM_USER13
5647#define CHERI_PERM_USER14 CHERI256_PERM_USER14
5648#define CHERI_PERM_USER15 CHERI256_PERM_USER15
5649#else /* (!(CHERICAP_SIZE == 32)) */
5650# 115 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/machine/cherireg.h" 3 4
5651#define CHERI_PERM_USER0 CHERI128_PERM_USER0
5652#define CHERI_PERM_USER1 CHERI128_PERM_USER1
5653#define CHERI_PERM_USER2 CHERI128_PERM_USER2
5654#define CHERI_PERM_USER3 CHERI128_PERM_USER3
5655#endif /* (!(CHERICAP_SIZE == 32)) */
5656# 120 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/machine/cherireg.h" 3 4
5657
5658/*
5659 * The kernel snags one for the user-defined permissions for the purposes of
5660 * authorising system calls from $pcc. This is a bit of an oddity: normally,
5661 * we check permissions on data capabilities, not code capabilities, but
5662 * aligns with 'privilege' checks: e.g., $epcc access. We may wish to switch
5663 * to another model, such as having userspace register one or more class
5664 * capabilities as suitable for privilege.
5665 */
5666#define CHERI_PERM_SYSCALL CHERI_PERM_USER0
5667
5668/*
5669 * Use another user-defined permission to restrict the ability to change
5670 * the page mapping underlying a capability. This can't be the same
5671 * permission bit as CHERI_PERM_SYSCALL because $pcc should not confer the
5672 * right rewrite or remap executable memory.
5673 */
5674#define CHERI_PERM_CHERIABI_VMMAP CHERI_PERM_USER1
5675
5676/*
5677 * Macros defining initial permission sets for various scenarios; details
5678 * depend on the permissions available on 256-bit or 128-bit CHERI:
5679 *
5680 * CHERI_PERM_USER_PRIVS: Mask of all available user-defined permissions
5681 * CHERI_PERM_PRIV: Mask of all available hardware-defined permissions
5682 */
5683#if (CHERICAP_SIZE == 32)
5684#define CHERI_PERM_USER_PRIVS \
5685 (CHERI_PERM_USER0 | CHERI_PERM_USER1 | CHERI_PERM_USER2 | \
5686 CHERI_PERM_USER3 | CHERI_PERM_USER4 | CHERI_PERM_USER5 | \
5687 CHERI_PERM_USER6 | CHERI_PERM_USER7 | CHERI_PERM_USER8 | \
5688 CHERI_PERM_USER9 | CHERI_PERM_USER10 | CHERI_PERM_USER11 | \
5689 CHERI_PERM_USER12 | CHERI_PERM_USER13 | CHERI_PERM_USER14 | \
5690 CHERI_PERM_USER15)
5691#else /* (!(CHERICAP_SIZE == 32)) */
5692# 155 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/machine/cherireg.h" 3 4
5693#define CHERI_PERM_USER_PRIVS \
5694 (CHERI_PERM_USER0 | CHERI_PERM_USER1 | CHERI_PERM_USER2 | \
5695 CHERI_PERM_USER3)
5696#endif /* (!(CHERICAP_SIZE == 32)) */
5697# 159 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/machine/cherireg.h" 3 4
5698
5699/*
5700 * No variation between 256-bit and 128-bit CHERI for privileged capability
5701 * permissions -- at least, not anymore.
5702 */
5703#define CHERI_PERM_KERN \
5704 (CHERI_PERM_GLOBAL | CHERI_PERM_EXECUTE | \
5705 CHERI_PERM_LOAD | CHERI_PERM_STORE | CHERI_PERM_LOAD_CAP | \
5706 CHERI_PERM_STORE_CAP | CHERI_PERM_STORE_LOCAL_CAP | \
5707 CHERI_PERM_SEAL | CHERI_PERM_RESERVED0 | CHERI_PERM_RESERVED1 | \
5708 CHERI_PERM_SYSTEM_REGS | CHERI_PERM_USER_PRIVS)
5709
5710/*
5711 * Root "object-type" capability for the kernel. This can be used neither as
5712 * a data nor code capability.
5713 */
5714#define CHERI_PERM_KERN_TYPE (CHERI_PERM_GLOBAL | CHERI_PERM_SEAL)
5715
5716/*
5717 * Basic userspace permission mask; CHERI_PERM_EXECUTE will be added for
5718 * executable capabilities ($pcc); CHERI_PERM_STORE, CHERI_PERM_STORE_CAP,
5719 * and CHERI_PERM_STORE_LOCAL_CAP will be added for data permissions ($c0).
5720 *
5721 * No variation required between 256-bit and 128-bit CHERI.
5722 */
5723#define CHERI_PERM_USER \
5724 (CHERI_PERM_GLOBAL | CHERI_PERM_LOAD | CHERI_PERM_LOAD_CAP | \
5725 (CHERI_PERM_USER_PRIVS & ~CHERI_PERM_CHERIABI_VMMAP))
5726
5727#define CHERI_PERM_USER_CODE (CHERI_PERM_USER | CHERI_PERM_EXECUTE)
5728/*
5729 * XXX-BD: _DATA should not include _VMMAP, but malloc needs rework to
5730 * fix.
5731 */
5732#define CHERI_PERM_USER_DATA (CHERI_PERM_USER | CHERI_PERM_STORE | \
5733 CHERI_PERM_STORE_CAP | \
5734 CHERI_PERM_STORE_LOCAL_CAP | \
5735 CHERI_PERM_CHERIABI_VMMAP)
5736
5737/*
5738 * Root "object-type" capability -- queried via sysarch(2) when libcheri needs
5739 * to allocate types. This can be used neither as a data nor code capability.
5740 *
5741 * No variation required between 256-bit and 128-bit CHERI.
5742 */
5743#define CHERI_PERM_USER_TYPE (CHERI_PERM_GLOBAL | CHERI_PERM_SEAL)
5744
5745/*
5746 * The CHERI object-type space is split between userspace and kernel,
5747 * permitting kernel object references to be delegated to userspace (if
5748 * desired). Currently, we provide 23 bits of namespace to each, with the top
5749 * bit set for kernel object types, but it is easy to imagine other splits.
5750 * User and kernel software should be written so as to not place assumptions
5751 * about the specific values used here, as they may change.
5752 */
5753#define CHERI_OTYPE_USER_MIN (0)
5754#define CHERI_OTYPE_USER_MAX ((1 << 23) - 1)
5755#define CHERI_OTYPE_KERN_MIN (1 << 24)
5756#define CHERI_OTYPE_KERN_MAX ((1 << 24) - 1)
5757
5758#define CHERI_OTYPE_ISKERN(x) (((x) & (1 << 23)) != 0)
5759#define CHERI_OTYPE_ISUSER(x) (!(CHERI_OTYPE_ISKERN(x)))
5760
5761/*
5762 * Definition for kernel "privileged" capability able to name the entire
5763 * address space.
5764 *
5765 * No variation required between 256-bit and 128-bit CHERI.
5766 */
5767#define CHERI_CAP_KERN_PERMS CHERI_PERM_KERN
5768#define CHERI_CAP_KERN_BASE 0x0
5769#define CHERI_CAP_KERN_LENGTH 0xffffffffffffffff
5770#define CHERI_CAP_KERN_OFFSET 0x0
5771
5772#define CHERI_CAP_KERN_TYPE_PERMS CHERI_PERM_KERN_TYPE
5773#define CHERI_CAP_KERN_TYPE_BASE CHERI_OTYPE_KERN_MIN
5774#define CHERI_CAP_KERN_TYPE_LENGTH \
5775 (CHERI_OTYPE_KERN_MAX - CHERI_OTYPE_KERN_MIN)
5776#define CHERI_CAP_KERN_TYPE_OFFSET 0x0
5777
5778/*
5779 * Definition for userspace "unprivileged" capability able to name the user
5780 * portion of the address space.
5781 *
5782 * No variation required between 256-bit and 128-bit CHERI.
5783 */
5784#define CHERI_CAP_USER_CODE_PERMS CHERI_PERM_USER_CODE
5785#define CHERI_CAP_USER_CODE_BASE MIPS_XUSEG_START
5786#define CHERI_CAP_USER_CODE_LENGTH (MIPS_XUSEG_END - MIPS_XUSEG_START)
5787#define CHERI_CAP_USER_CODE_OFFSET 0x0
5788
5789#define CHERI_CAP_USER_DATA_PERMS CHERI_PERM_USER_DATA
5790#define CHERI_CAP_USER_DATA_BASE MIPS_XUSEG_START
5791#define CHERI_CAP_USER_DATA_LENGTH (MIPS_XUSEG_END - MIPS_XUSEG_START)
5792#define CHERI_CAP_USER_DATA_OFFSET 0x0
5793
5794#define CHERI_CAP_USER_TYPE_PERMS CHERI_PERM_USER_TYPE
5795#define CHERI_CAP_USER_TYPE_BASE CHERI_OTYPE_USER_MIN
5796#define CHERI_CAP_USER_TYPE_LENGTH \
5797 (CHERI_OTYPE_USER_MAX - CHERI_OTYPE_USER_MIN + 1)
5798#define CHERI_CAP_USER_TYPE_OFFSET 0x0
5799
5800#define CHERI_CAP_USER_MMAP_PERMS \
5801 (CHERI_PERM_USER_DATA | CHERI_PERM_USER_CODE | CHERI_PERM_CHERIABI_VMMAP)
5802#define CHERI_CAP_USER_MMAP_BASE MIPS_XUSEG_START
5803#define CHERI_CAP_USER_MMAP_LENGTH (MIPS_XUSEG_END - MIPS_XUSEG_START)
5804#define CHERI_CAP_USER_MMAP_OFFSET 0x0
5805
5806/*
5807 * A blend of hardware and software allocation of capability registers.
5808 * Ideally, this list wouldn't exist here, but be purely in the assembler.
5809 */
5810#define CHERI_CR_C0 0 /* MIPS fetch/load/store capability. */
5811#define CHERI_CR_DDC CHERI_CR_C0
5812#define CHERI_CR_C1 1
5813#define CHERI_CR_C2 2
5814#define CHERI_CR_C3 3
5815#define CHERI_CR_C4 4
5816#define CHERI_CR_C5 5
5817#define CHERI_CR_C6 6
5818#define CHERI_CR_C7 7
5819#define CHERI_CR_C8 8
5820#define CHERI_CR_C9 9
5821#define CHERI_CR_C10 10
5822#define CHERI_CR_C11 11
5823#define CHERI_CR_STC CHERI_CR_C11
5824#define CHERI_CR_C12 12
5825#define CHERI_CR_C13 13
5826#define CHERI_CR_C14 14
5827#define CHERI_CR_C15 15
5828#define CHERI_CR_C16 16
5829#define CHERI_CR_C17 17
5830#define CHERI_CR_C18 18
5831#define CHERI_CR_C19 19
5832#define CHERI_CR_C20 20
5833#define CHERI_CR_C21 21
5834#define CHERI_CR_C22 22
5835#define CHERI_CR_C23 23
5836#define CHERI_CR_C24 24
5837#define CHERI_CR_C25 25
5838#define CHERI_CR_C26 26
5839#define CHERI_CR_IDC CHERI_CR_C26
5840#define CHERI_CR_C27 27
5841#define CHERI_CR_KR1C CHERI_CR_C27
5842#define CHERI_CR_C28 28
5843#define CHERI_CR_KR2C CHERI_CR_C28
5844#define CHERI_CR_C29 29
5845#define CHERI_CR_KCC CHERI_CR_C29
5846#define CHERI_CR_C30 30
5847#define CHERI_CR_KDC CHERI_CR_C30
5848#define CHERI_CR_C31 31
5849#define CHERI_CR_EPCC CHERI_CR_C31
5850
5851#define CHERI_CR_CTEMP0 CHERI_CR_C13 /* C capability manipulation. */
5852#define CHERI_CR_CTEMP1 CHERI_CR_C14 /* C capability manipulation. */
5853#define CHERI_CR_SEC0 CHERI_CR_KR2C /* Saved $c0 in exception handler. */
5854
5855/*
5856 * Offsets of registers in struct cheri_kframe -- must match the definition in
5857 * cheri.h.
5858 */
5859#define CHERIKFRAME_OFF_C17 0
5860#define CHERIKFRAME_OFF_C18 1
5861#define CHERIKFRAME_OFF_C19 2
5862#define CHERIKFRAME_OFF_C20 3
5863#define CHERIKFRAME_OFF_C21 4
5864#define CHERIKFRAME_OFF_C22 5
5865#define CHERIKFRAME_OFF_C23 6
5866#define CHERIKFRAME_OFF_C24 7
5867
5868/*
5869 * List of CHERI capability cause code constants, which are used to
5870 * characterise various CP2 exceptions.
5871 */
5872#define CHERI_EXCCODE_NONE 0x00
5873#define CHERI_EXCCODE_LENGTH 0x01
5874#define CHERI_EXCCODE_TAG 0x02
5875#define CHERI_EXCCODE_SEAL 0x03
5876#define CHERI_EXCCODE_TYPE 0x04
5877#define CHERI_EXCCODE_CALL 0x05
5878#define CHERI_EXCCODE_RETURN 0x06
5879#define CHERI_EXCCODE_UNDERFLOW 0x07
5880#define CHERI_EXCCODE_USER_PERM 0x08
5881#define CHERI_EXCCODE_PERM_USER CHERI_EXCCODE_USER_PERM
5882#define CHERI_EXCCODE_TLBSTORE 0x09
5883#define CHERI_EXCCODE_IMPRECISE 0x0a
5884#define _CHERI_EXCCODE_RESERVED0b 0x0b
5885#define _CHERI_EXCCODE_RESERVED0c 0x0c
5886#define _CHERI_EXCCODE_RESERVED0d 0x0d
5887#define _CHERI_EXCCODE_RESERVED0e 0x0e
5888#define _CHERI_EXCCODE_RESERVED0f 0x0f
5889#define CHERI_EXCCODE_GLOBAL 0x10
5890#define CHERI_EXCCODE_PERM_EXECUTE 0x11
5891#define CHERI_EXCCODE_PERM_LOAD 0x12
5892#define CHERI_EXCCODE_PERM_STORE 0x13
5893#define CHERI_EXCCODE_PERM_LOADCAP 0x14
5894#define CHERI_EXCCODE_PERM_STORECAP 0x15
5895#define CHERI_EXCCODE_STORE_LOCALCAP 0x16
5896#define CHERI_EXCCODE_PERM_SEAL 0x17
5897#define CHERI_EXCCODE_SYSTEM_REGS 0x18
5898#define _CHERI_EXCCODE_RESERVED19 0x19
5899#define _CHERI_EXCCODE_RESERVED1a 0x1a
5900#define _CHERI_EXCCODE_RESERVED1b 0x1b
5901#define _CHERI_EXCCODE_RESERVED1c 0x1c
5902#define _CHERI_EXCCODE_RESERVED1d 0x1d
5903#define _CHERI_EXCCODE_RESERVED1e 0x1e
5904#define _CHERI_EXCCODE_RESERVED1f 0x1f
5905
5906/*
5907 * User-defined CHERI exception codes are numbered 128...255.
5908 */
5909#define CHERI_EXCCODE_SW_BASE 0x80
5910#define CHERI_EXCCODE_SW_LOCALARG 0x80 /* Non-global CCall argument. */
5911#define CHERI_EXCCODE_SW_LOCALRET 0x81 /* Non-global CReturn value. */
5912#define CHERI_EXCCODE_SW_CCALLREGS 0x82 /* Incorrect CCall registers. */
5913
5914/*
5915 * How to turn the cause register into an exception code and register number.
5916 */
5917#define CHERI_CAPCAUSE_EXCCODE_MASK 0xff00
5918#define CHERI_CAPCAUSE_EXCCODE_SHIFT 8
5919#define CHERI_CAPCAUSE_REGNUM_MASK 0xff
5920
5921/*
5922 * Location of the CHERI CCall/CReturn software-path exception vector.
5923 */
5924#define CHERI_CCALL_EXC_VEC ((intptr_t)(int32_t)0x80000280)
5925
5926#if CHERICAP_SIZE == 32
5927#define CHERI_ALIGN_SHIFT(l) 0ULL
5928#define CHERI_SEAL_ALIGN_SHIFT(l) 0ULL
5929#else /* (!(CHERICAP_SIZE == 32)) */
5930# 391 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/machine/cherireg.h" 3 4
5931
5932#define CHERI_BASELEN_BITS 20
5933#define CHERI_SEAL_BASELEN_BITS 5
5934#define CHERI_SLOP_BITS 2
5935#define CHERI_ADDR_BITS 64
5936#define CHERI_SEAL_MIN_ALIGN 12
5937
5938/*
5939 * Use __builtin_clzll() to implement flsll() on clang where emission of
5940 * DCLZ instructions is correctly conditionalized.
5941 */
5942#ifdef __clang__
5943#define _flsll(x) (64 - __builtin_clzll(x))
5944#else
5945# 405 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/machine/cherireg.h" 3 4
5946#define _flsll(x) flsll(x)
5947#endif
5948# 407 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/machine/cherireg.h" 3 4
5949#define CHERI_ALIGN_SHIFT(l) \
5950 ((_flsll(l) <= (CHERI_BASELEN_BITS - CHERI_SLOP_BITS)) ? 0ULL : \
5951 (_flsll(l) - (CHERI_BASELEN_BITS - CHERI_SLOP_BITS)))
5952#define _CHERI_SEAL_ALIGN_SHIFT(l) \
5953 ((_flsll(l) <= (CHERI_SEAL_BASELEN_BITS)) ? 0ULL : \
5954 (_flsll(l) - (CHERI_SEAL_BASELEN_BITS)))
5955#define CHERI_SEAL_ALIGN_SHIFT(l) \
5956 (_CHERI_SEAL_ALIGN_SHIFT(l) < CHERI_SEAL_MIN_ALIGN ? \
5957 CHERI_SEAL_MIN_ALIGN : _CHERI_SEAL_ALIGN_SHIFT(l))
5958#endif /* (!(CHERICAP_SIZE == 32)) */
5959# 417 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/machine/cherireg.h" 3 4
5960
5961#define CHERI_ALIGN_MASK(l) ~(~0ULL << CHERI_ALIGN_SHIFT(l))
5962#define CHERI_SEAL_ALIGN_MASK(l) ~(~0ULL << CHERI_SEAL_ALIGN_SHIFT(l))
5963
5964#endif /* _MIPS_INCLUDE_CHERIREG_H_ */
5965# 422 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/machine/cherireg.h" 3 4
5966# 43 "/home/alr48/cheri/sources/cheribsd/bin/cheritest/cheritest_registers.c" 2
5967#if 0 /* expanded by -frewrite-includes */
5968#include <machine/cpuregs.h>
5969#endif /* expanded by -frewrite-includes */
5970# 43 "/home/alr48/cheri/sources/cheribsd/bin/cheritest/cheritest_registers.c"
5971# 1 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/machine/cpuregs.h" 1 3 4
5972/* $NetBSD: cpuregs.h,v 1.70 2006/05/15 02:26:54 simonb Exp $ */
5973
5974/*
5975 * Copyright (c) 1992, 1993
5976 * The Regents of the University of California. All rights reserved.
5977 *
5978 * This code is derived from software contributed to Berkeley by
5979 * Ralph Campbell and Rick Macklem.
5980 *
5981 * Redistribution and use in source and binary forms, with or without
5982 * modification, are permitted provided that the following conditions
5983 * are met:
5984 * 1. Redistributions of source code must retain the above copyright
5985 * notice, this list of conditions and the following disclaimer.
5986 * 2. Redistributions in binary form must reproduce the above copyright
5987 * notice, this list of conditions and the following disclaimer in the
5988 * documentation and/or other materials provided with the distribution.
5989 * 3. Neither the name of the University nor the names of its contributors
5990 * may be used to endorse or promote products derived from this software
5991 * without specific prior written permission.
5992 *
5993 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
5994 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
5995 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
5996 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
5997 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
5998 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
5999 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
6000 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
6001 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
6002 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
6003 * SUCH DAMAGE.
6004 *
6005 * @(#)machConst.h 8.1 (Berkeley) 6/10/93
6006 *
6007 * machConst.h --
6008 *
6009 * Machine dependent constants.
6010 *
6011 * Copyright (C) 1989 Digital Equipment Corporation.
6012 * Permission to use, copy, modify, and distribute this software and
6013 * its documentation for any purpose and without fee is hereby granted,
6014 * provided that the above copyright notice appears in all copies.
6015 * Digital Equipment Corporation makes no representations about the
6016 * suitability of this software for any purpose. It is provided "as is"
6017 * without express or implied warranty.
6018 *
6019 * from: Header: /sprite/src/kernel/mach/ds3100.md/RCS/machConst.h,
6020 * v 9.2 89/10/21 15:55:22 jhh Exp SPRITE (DECWRL)
6021 * from: Header: /sprite/src/kernel/mach/ds3100.md/RCS/machAddrs.h,
6022 * v 1.2 89/08/15 18:28:21 rab Exp SPRITE (DECWRL)
6023 * from: Header: /sprite/src/kernel/vm/ds3100.md/RCS/vmPmaxConst.h,
6024 * v 9.1 89/09/18 17:33:00 shirriff Exp SPRITE (DECWRL)
6025 *
6026 * $FreeBSD$
6027 */
6028
6029#ifndef _MIPS_CPUREGS_H_
6030#define _MIPS_CPUREGS_H_
6031
6032/*
6033 * Address space.
6034 * 32-bit mips CPUS partition their 32-bit address space into four segments:
6035 *
6036 * kuseg 0x00000000 - 0x7fffffff User virtual mem, mapped
6037 * kseg0 0x80000000 - 0x9fffffff Physical memory, cached, unmapped
6038 * kseg1 0xa0000000 - 0xbfffffff Physical memory, uncached, unmapped
6039 * kseg2 0xc0000000 - 0xffffffff kernel-virtual, mapped
6040 *
6041 * Caching of mapped addresses is controlled by bits in the TLB entry.
6042 */
6043
6044#define MIPS_KSEG0_LARGEST_PHYS (0x20000000)
6045#define MIPS_KSEG0_PHYS_MASK (0x1fffffff)
6046#define MIPS_XKPHYS_LARGEST_PHYS (0x10000000000) /* 40 bit PA */
6047#define MIPS_XKPHYS_PHYS_MASK (0x0ffffffffff)
6048
6049#ifndef LOCORE
6050#define MIPS_KUSEG_START 0x00000000
6051#define MIPS_KSEG0_START ((intptr_t)(int32_t)0x80000000)
6052#define MIPS_KSEG0_END ((intptr_t)(int32_t)0x9fffffff)
6053#define MIPS_KSEG1_START ((intptr_t)(int32_t)0xa0000000)
6054#define MIPS_KSEG1_END ((intptr_t)(int32_t)0xbfffffff)
6055#define MIPS_KSSEG_START ((intptr_t)(int32_t)0xc0000000)
6056#define MIPS_KSSEG_END ((intptr_t)(int32_t)0xdfffffff)
6057#define MIPS_KSEG3_START ((intptr_t)(int32_t)0xe0000000)
6058#define MIPS_KSEG3_END ((intptr_t)(int32_t)0xffffffff)
6059#define MIPS_KSEG2_START MIPS_KSSEG_START
6060#define MIPS_KSEG2_END MIPS_KSSEG_END
6061#endif
6062# 91 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/machine/cpuregs.h" 3 4
6063
6064#define MIPS_PHYS_TO_KSEG0(x) ((uintptr_t)(x) | MIPS_KSEG0_START)
6065#define MIPS_PHYS_TO_KSEG1(x) ((uintptr_t)(x) | MIPS_KSEG1_START)
6066#define MIPS_KSEG0_TO_PHYS(x) ((uintptr_t)(x) & MIPS_KSEG0_PHYS_MASK)
6067#define MIPS_KSEG1_TO_PHYS(x) ((uintptr_t)(x) & MIPS_KSEG0_PHYS_MASK)
6068
6069#define MIPS_IS_KSEG0_ADDR(x) \
6070 (((vm_offset_t)(x) >= MIPS_KSEG0_START) && \
6071 ((vm_offset_t)(x) <= MIPS_KSEG0_END))
6072#define MIPS_IS_KSEG1_ADDR(x) \
6073 (((vm_offset_t)(x) >= MIPS_KSEG1_START) && \
6074 ((vm_offset_t)(x) <= MIPS_KSEG1_END))
6075#define MIPS_IS_VALID_PTR(x) (MIPS_IS_KSEG0_ADDR(x) || \
6076 MIPS_IS_KSEG1_ADDR(x))
6077
6078/*
6079 * Cache Coherency Attributes:
6080 * UC: Uncached.
6081 * UA: Uncached accelerated.
6082 * C: Cacheable, coherency unspecified.
6083 * CNC: Cacheable non-coherent.
6084 * CC: Cacheable coherent.
6085 * CCS: Cacheable coherent, shared read.
6086 * CCE: Cacheable coherent, exclusive read.
6087 * CCEW: Cacheable coherent, exclusive write.
6088 * CCUOW: Cacheable coherent, update on write.
6089 *
6090 * Note that some bits vary in meaning across implementations (and that the
6091 * listing here is no doubt incomplete) and that the optimal cached mode varies
6092 * between implementations. 0x02 is required to be UC and 0x03 is required to
6093 * be a least C.
6094 *
6095 * We define the following logical bits:
6096 * UNCACHED:
6097 * The optimal uncached mode for the target CPU type. This must
6098 * be suitable for use in accessing memory-mapped devices.
6099 * CACHED: The optional cached mode for the target CPU type.
6100 */
6101
6102#define MIPS_CCA_UC 0x02 /* Uncached. */
6103#define MIPS_CCA_C 0x03 /* Cacheable, coherency unspecified. */
6104
6105#if defined(CPU_R4000) || defined(CPU_R10000)
6106#define MIPS_CCA_CNC 0x03
6107#define MIPS_CCA_CCE 0x04
6108#define MIPS_CCA_CCEW 0x05
6109
6110#ifdef CPU_R4000
6111#define MIPS_CCA_CCUOW 0x06
6112#endif
6113# 141 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/machine/cpuregs.h" 3 4
6114
6115#ifdef CPU_R10000
6116#define MIPS_CCA_UA 0x07
6117#endif
6118# 145 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/machine/cpuregs.h" 3 4
6119
6120#define MIPS_CCA_CACHED MIPS_CCA_CCEW
6121#endif /* defined(CPU_R4000) || defined(CPU_R10000) */
6122# 148 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/machine/cpuregs.h" 3 4
6123
6124#if defined(CPU_SB1)
6125#define MIPS_CCA_CC 0x05 /* Cacheable Coherent. */
6126#endif
6127# 152 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/machine/cpuregs.h" 3 4
6128
6129#if defined(CPU_MIPS74K)
6130#define MIPS_CCA_UNCACHED 0x02
6131#define MIPS_CCA_CACHED 0x03
6132#endif
6133# 157 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/machine/cpuregs.h" 3 4
6134
6135/*
6136 * 1004K and 1074K cores, as well as interAptiv and proAptiv cores, support
6137 * Cacheable Coherent CCAs 0x04 and 0x05, as well as Cacheable non-Coherent
6138 * CCA 0x03 and Uncached Accelerated CCA 0x07
6139 */
6140#if defined(CPU_MIPS1004K) || defined(CPU_MIPS1074K) || \
6141 defined(CPU_INTERAPTIV) || defined(CPU_PROAPTIV)
6142#define MIPS_CCA_CNC 0x03
6143#define MIPS_CCA_CCE 0x04
6144#define MIPS_CCA_CCS 0x05
6145#define MIPS_CCA_UA 0x07
6146
6147/* We use shared read CCA for CACHED CCA */
6148#define MIPS_CCA_CACHED MIPS_CCA_CCS
6149#endif
6150# 173 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/machine/cpuregs.h" 3 4
6151
6152#ifndef MIPS_CCA_UNCACHED
6153#define MIPS_CCA_UNCACHED MIPS_CCA_UC
6154#endif
6155# 177 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/machine/cpuregs.h" 3 4
6156
6157/*
6158 * If we don't know which cached mode to use and there is a cache coherent
6159 * mode, use it. If there is not a cache coherent mode, use the required
6160 * cacheable mode.
6161 */
6162#ifndef MIPS_CCA_CACHED
6163#ifdef MIPS_CCA_CC
6164#define MIPS_CCA_CACHED MIPS_CCA_CC
6165#else
6166# 187 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/machine/cpuregs.h" 3 4
6167#define MIPS_CCA_CACHED MIPS_CCA_C
6168#endif
6169# 189 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/machine/cpuregs.h" 3 4
6170#endif
6171# 190 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/machine/cpuregs.h" 3 4
6172
6173#define MIPS_PHYS_TO_XKPHYS(cca,x) \
6174 ((0x2ULL << 62) | ((unsigned long long)(cca) << 59) | (x))
6175#define MIPS_PHYS_TO_XKPHYS_CACHED(x) \
6176 ((0x2ULL << 62) | ((unsigned long long)(MIPS_CCA_CACHED) << 59) | (x))
6177#define MIPS_PHYS_TO_XKPHYS_UNCACHED(x) \
6178 ((0x2ULL << 62) | ((unsigned long long)(MIPS_CCA_UNCACHED) << 59) | (x))
6179
6180#define MIPS_XKPHYS_TO_PHYS(x) ((uintptr_t)(x) & MIPS_XKPHYS_PHYS_MASK)
6181
6182#define MIPS_XKPHYS_START 0x8000000000000000
6183#define MIPS_XKPHYS_END 0xbfffffffffffffff
6184#define MIPS_XUSEG_START 0x0000000000000000
6185#define MIPS_XUSEG_END 0x0000010000000000
6186#define MIPS_XKSEG_START 0xc000000000000000
6187#define MIPS_XKSEG_END 0xc00000ff80000000
6188#define MIPS_XKSEG_COMPAT32_START 0xffffffff80000000
6189#define MIPS_XKSEG_COMPAT32_END 0xffffffffffffffff
6190#define MIPS_XKSEG_TO_COMPAT32(va) ((va) & 0xffffffff)
6191
6192#ifdef __mips_n64
6193#define MIPS_DIRECT_MAPPABLE(pa) 1
6194#define MIPS_PHYS_TO_DIRECT(pa) MIPS_PHYS_TO_XKPHYS_CACHED(pa)
6195#define MIPS_PHYS_TO_DIRECT_UNCACHED(pa) MIPS_PHYS_TO_XKPHYS_UNCACHED(pa)
6196#define MIPS_DIRECT_TO_PHYS(va) MIPS_XKPHYS_TO_PHYS(va)
6197#else
6198# 216 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/machine/cpuregs.h" 3 4
6199#define MIPS_DIRECT_MAPPABLE(pa) ((pa) < MIPS_KSEG0_LARGEST_PHYS)
6200#define MIPS_PHYS_TO_DIRECT(pa) MIPS_PHYS_TO_KSEG0(pa)
6201#define MIPS_PHYS_TO_DIRECT_UNCACHED(pa) MIPS_PHYS_TO_KSEG1(pa)
6202#define MIPS_DIRECT_TO_PHYS(va) MIPS_KSEG0_TO_PHYS(va)
6203#endif
6204# 221 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/machine/cpuregs.h" 3 4
6205
6206/* CPU dependent mtc0 hazard hook */
6207#if defined(CPU_CNMIPS) || defined(CPU_RMI) || defined(CPU_BERI)
6208#define COP0_SYNC
6209#elif defined(CPU_NLM)
6210# 226 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/machine/cpuregs.h" 3 4
6211#define COP0_SYNC .word 0xc0 /* ehb */
6212#elif defined(CPU_SB1)
6213# 228 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/machine/cpuregs.h" 3 4
6214#define COP0_SYNC ssnop; ssnop; ssnop; ssnop; ssnop; ssnop; ssnop; ssnop; ssnop
6215#elif defined(CPU_MIPS24K) || defined(CPU_MIPS34K) || \
6216 defined(CPU_MIPS74K) || defined(CPU_MIPS1004K) || \
6217 defined(CPU_MIPS1074K) || defined(CPU_INTERAPTIV) || \
6218 defined(CPU_PROAPTIV)
6219# 233 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/machine/cpuregs.h" 3 4
6220/*
6221 * According to MIPS32tm Architecture for Programmers, Vol.II, rev. 2.00:
6222 * "As EHB becomes standard in MIPS implementations, the previous SSNOPs can be
6223 * removed, leaving only the EHB".
6224 * Also, all MIPS32 Release 2 implementations have the EHB instruction, which
6225 * resolves all execution hazards. The same goes for MIPS32 Release 3.
6226 */
6227#define COP0_SYNC .word 0xc0 /* ehb */
6228#else
6229# 242 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/machine/cpuregs.h" 3 4
6230/*
6231 * Pick a reasonable default based on the "typical" spacing described in the
6232 * "CP0 Hazards" chapter of MIPS Architecture Book Vol III.
6233 */
6234#define COP0_SYNC ssnop; ssnop; ssnop; ssnop; .word 0xc0;
6235#endif
6236# 248 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/machine/cpuregs.h" 3 4
6237#define COP0_HAZARD_FPUENABLE nop; nop; nop; nop;
6238
6239/*
6240 * The bits in the cause register.
6241 *
6242 * Bits common to r3000 and r4000:
6243 *
6244 * MIPS_CR_BR_DELAY Exception happened in branch delay slot.
6245 * MIPS_CR_COP_ERR Coprocessor error.
6246 * MIPS_CR_IP Interrupt pending bits defined below.
6247 * (same meaning as in CAUSE register).
6248 * MIPS_CR_EXC_CODE The exception type (see exception codes below).
6249 *
6250 * Differences:
6251 * r3k has 4 bits of execption type, r4k has 5 bits.
6252 */
6253#define MIPS_CR_BR_DELAY 0x80000000
6254#define MIPS_CR_COP_ERR 0x30000000
6255#define MIPS_CR_EXC_CODE 0x0000007C /* five bits */
6256#define MIPS_CR_IP 0x0000FF00
6257#define MIPS_CR_EXC_CODE_SHIFT 2
6258#define MIPS_CR_COP_ERR_SHIFT 28
6259
6260/*
6261 * The bits in the status register. All bits are active when set to 1.
6262 *
6263 * R3000 status register fields:
6264 * MIPS_SR_COP_USABILITY Control the usability of the four coprocessors.
6265 * MIPS_SR_TS TLB shutdown.
6266 *
6267 * MIPS_SR_INT_IE Master (current) interrupt enable bit.
6268 *
6269 * Differences:
6270 * r3k has cache control is via frobbing SR register bits, whereas the
6271 * r4k cache control is via explicit instructions.
6272 * r3k has a 3-entry stack of kernel/user bits, whereas the
6273 * r4k has kernel/supervisor/user.
6274 */
6275#define MIPS_SR_COP_USABILITY 0xf0000000
6276#define MIPS_SR_COP_0_BIT 0x10000000
6277#define MIPS_SR_COP_1_BIT 0x20000000
6278#define MIPS_SR_COP_2_BIT 0x40000000
6279
6280 /* r4k and r3k differences, see below */
6281
6282#define MIPS_SR_MX 0x01000000 /* MIPS64 */
6283#define MIPS_SR_PX 0x00800000 /* MIPS64 */
6284#define MIPS_SR_BEV 0x00400000 /* Use boot exception vector */
6285#define MIPS_SR_TS 0x00200000
6286#define MIPS_SR_DE 0x00010000
6287
6288#define MIPS_SR_INT_IE 0x00000001
6289/*#define MIPS_SR_MBZ 0x0f8000c0*/ /* Never used, true for r3k */
6290#define MIPS_SR_INT_MASK 0x0000ff00
6291
6292/*
6293 * R4000 status register bit definitons,
6294 * where different from r2000/r3000.
6295 */
6296#define MIPS_SR_XX 0x80000000
6297#define MIPS_SR_RP 0x08000000
6298#define MIPS_SR_FR 0x04000000
6299#define MIPS_SR_RE 0x02000000
6300
6301#define MIPS_SR_DIAG_DL 0x01000000 /* QED 52xx */
6302#define MIPS_SR_DIAG_IL 0x00800000 /* QED 52xx */
6303#define MIPS_SR_SR 0x00100000
6304#define MIPS_SR_NMI 0x00080000 /* MIPS32/64 */
6305#define MIPS_SR_DIAG_CH 0x00040000
6306#define MIPS_SR_DIAG_CE 0x00020000
6307#define MIPS_SR_DIAG_PE 0x00010000
6308#define MIPS_SR_EIE 0x00010000 /* TX79/R5900 */
6309#define MIPS_SR_KX 0x00000080
6310#define MIPS_SR_SX 0x00000040
6311#define MIPS_SR_UX 0x00000020
6312#define MIPS_SR_KSU_MASK 0x00000018
6313#define MIPS_SR_KSU_USER 0x00000010
6314#define MIPS_SR_KSU_SUPER 0x00000008
6315#define MIPS_SR_KSU_KERNEL 0x00000000
6316#define MIPS_SR_ERL 0x00000004
6317#define MIPS_SR_EXL 0x00000002
6318
6319/*
6320 * The interrupt masks.
6321 * If a bit in the mask is 1 then the interrupt is enabled (or pending).
6322 */
6323#define MIPS_INT_MASK 0xff00
6324#define MIPS_INT_MASK_5 0x8000
6325#define MIPS_INT_MASK_4 0x4000
6326#define MIPS_INT_MASK_3 0x2000
6327#define MIPS_INT_MASK_2 0x1000
6328#define MIPS_INT_MASK_1 0x0800
6329#define MIPS_INT_MASK_0 0x0400
6330#define MIPS_HARD_INT_MASK 0xfc00
6331#define MIPS_SOFT_INT_MASK_1 0x0200
6332#define MIPS_SOFT_INT_MASK_0 0x0100
6333
6334/*
6335 * The bits in the MIPS3 config register.
6336 *
6337 * bit 0..5: R/W, Bit 6..31: R/O
6338 */
6339
6340/* kseg0 coherency algorithm - see MIPS3_TLB_ATTR values */
6341#define MIPS_CONFIG_K0_MASK 0x00000007
6342
6343/*
6344 * R/W Update on Store Conditional
6345 * 0: Store Conditional uses coherency algorithm specified by TLB
6346 * 1: Store Conditional uses cacheable coherent update on write
6347 */
6348#define MIPS_CONFIG_CU 0x00000008
6349
6350#define MIPS_CONFIG_DB 0x00000010 /* Primary D-cache line size */
6351#define MIPS_CONFIG_IB 0x00000020 /* Primary I-cache line size */
6352#define MIPS_CONFIG_CACHE_L1_LSIZE(config, bit) \
6353 (((config) & (bit)) ? 32 : 16)
6354
6355#define MIPS_CONFIG_DC_MASK 0x000001c0 /* Primary D-cache size */
6356#define MIPS_CONFIG_DC_SHIFT 6
6357#define MIPS_CONFIG_IC_MASK 0x00000e00 /* Primary I-cache size */
6358#define MIPS_CONFIG_IC_SHIFT 9
6359#define MIPS_CONFIG_C_DEFBASE 0x1000 /* default base 2^12 */
6360
6361/* Cache size mode indication: available only on Vr41xx CPUs */
6362#define MIPS_CONFIG_CS 0x00001000
6363#define MIPS_CONFIG_C_4100BASE 0x0400 /* base is 2^10 if CS=1 */
6364#define MIPS_CONFIG_CACHE_SIZE(config, mask, base, shift) \
6365 ((base) << (((config) & (mask)) >> (shift)))
6366
6367/* External cache enable: Controls L2 for R5000/Rm527x and L3 for Rm7000 */
6368#define MIPS_CONFIG_SE 0x00001000
6369
6370/* Block ordering: 0: sequential, 1: sub-block */
6371#define MIPS_CONFIG_EB 0x00002000
6372
6373/* ECC mode - 0: ECC mode, 1: parity mode */
6374#define MIPS_CONFIG_EM 0x00004000
6375
6376/* BigEndianMem - 0: kernel and memory are little endian, 1: big endian */
6377#define MIPS_CONFIG_BE 0x00008000
6378
6379/* Dirty Shared coherency state - 0: enabled, 1: disabled */
6380#define MIPS_CONFIG_SM 0x00010000
6381
6382/* Secondary Cache - 0: present, 1: not present */
6383#define MIPS_CONFIG_SC 0x00020000
6384
6385/* System Port width - 0: 64-bit, 1: 32-bit (QED RM523x), 2,3: reserved */
6386#define MIPS_CONFIG_EW_MASK 0x000c0000
6387#define MIPS_CONFIG_EW_SHIFT 18
6388
6389/* Secondary Cache port width - 0: 128-bit data path to S-cache, 1: reserved */
6390#define MIPS_CONFIG_SW 0x00100000
6391
6392/* Split Secondary Cache Mode - 0: I/D mixed, 1: I/D separated by SCAddr(17) */
6393#define MIPS_CONFIG_SS 0x00200000
6394
6395/* Secondary Cache line size */
6396#define MIPS_CONFIG_SB_MASK 0x00c00000
6397#define MIPS_CONFIG_SB_SHIFT 22
6398#define MIPS_CONFIG_CACHE_L2_LSIZE(config) \
6399 (0x10 << (((config) & MIPS_CONFIG_SB_MASK) >> MIPS_CONFIG_SB_SHIFT))
6400
6401/* Write back data rate */
6402#define MIPS_CONFIG_EP_MASK 0x0f000000
6403#define MIPS_CONFIG_EP_SHIFT 24
6404
6405/* System clock ratio - this value is CPU dependent */
6406#define MIPS_CONFIG_EC_MASK 0x70000000
6407#define MIPS_CONFIG_EC_SHIFT 28
6408
6409/* Master-Checker Mode - 1: enabled */
6410#define MIPS_CONFIG_CM 0x80000000
6411
6412/*
6413 * The bits in the MIPS4 config register.
6414 */
6415
6416/*
6417 * Location of exception vectors.
6418 *
6419 * Common vectors: reset and UTLB miss.
6420 */
6421#define MIPS_RESET_EXC_VEC ((intptr_t)(int32_t)0xBFC00000)
6422#define MIPS_UTLB_MISS_EXC_VEC ((intptr_t)(int32_t)0x80000000)
6423
6424/*
6425 * MIPS-III exception vectors
6426 */
6427#define MIPS_XTLB_MISS_EXC_VEC ((intptr_t)(int32_t)0x80000080)
6428#define MIPS_CACHE_ERR_EXC_VEC ((intptr_t)(int32_t)0x80000100)
6429#define MIPS_GEN_EXC_VEC ((intptr_t)(int32_t)0x80000180)
6430
6431/*
6432 * MIPS32/MIPS64 (and some MIPS3) dedicated interrupt vector.
6433 */
6434#define MIPS_INTR_EXC_VEC 0x80000200
6435
6436/*
6437 * Coprocessor 0 registers:
6438 *
6439 * v--- width for mips I,III,32,64
6440 * (3=32bit, 6=64bit, i=impl dep)
6441 * 0 MIPS_COP_0_TLB_INDEX 3333 TLB Index.
6442 * 1 MIPS_COP_0_TLB_RANDOM 3333 TLB Random.
6443 * 2 MIPS_COP_0_TLB_LO0 .636 r4k TLB entry low.
6444 * 3 MIPS_COP_0_TLB_LO1 .636 r4k TLB entry low, extended.
6445 * 4 MIPS_COP_0_TLB_CONTEXT 3636 TLB Context.
6446 * 4/2 MIPS_COP_0_USERLOCAL ..36 UserLocal.
6447 * 5 MIPS_COP_0_TLB_PG_MASK .333 TLB Page Mask register.
6448 * 6 MIPS_COP_0_TLB_WIRED .333 Wired TLB number.
6449 * 7 MIPS_COP_0_HWRENA ..33 rdHWR Enable.
6450 * 8 MIPS_COP_0_BAD_VADDR 3636 Bad virtual address.
6451 * 9 MIPS_COP_0_COUNT .333 Count register.
6452 * 10 MIPS_COP_0_TLB_HI 3636 TLB entry high.
6453 * 11 MIPS_COP_0_COMPARE .333 Compare (against Count).
6454 * 12 MIPS_COP_0_STATUS 3333 Status register.
6455 * 13 MIPS_COP_0_CAUSE 3333 Exception cause register.
6456 * 14 MIPS_COP_0_EXC_PC 3636 Exception PC.
6457 * 15 MIPS_COP_0_PRID 3333 Processor revision identifier.
6458 * 15/1 MIPS_COP_0_EBASE ..3? Exception Base.
6459 * 15/2 MIPS_COP_0_CDMM ..3? Common Device Memory Map.
6460 * 15/6 MIPS_COP_0_CINFO ...3 Core count/id (BERI).
6461 * 15/7 MIPS_COP_0_TINFO ...3 Thread count/id (BERI).
6462 * 16 MIPS_COP_0_CONFIG 3333 Configuration register.
6463 * 16/1 MIPS_COP_0_CONFIG1 ..33 Configuration register 1.
6464 * 16/2 MIPS_COP_0_CONFIG2 ..33 Configuration register 2.
6465 * 16/3 MIPS_COP_0_CONFIG3 ..33 Configuration register 3.
6466 * 16/4 MIPS_COP_0_CONFIG4 ..33 Configuration register 4.
6467 * 17 MIPS_COP_0_LLADDR .336 Load Linked Address.
6468 * 18 MIPS_COP_0_WATCH_LO .336 WatchLo register.
6469 * 19 MIPS_COP_0_WATCH_HI .333 WatchHi register.
6470 * 20 MIPS_COP_0_TLB_XCONTEXT .6.6 TLB XContext register.
6471 * 23 MIPS_COP_0_DEBUG .... Debug JTAG register.
6472 * 24 MIPS_COP_0_DEPC .... DEPC JTAG register.
6473 * 25 MIPS_COP_0_PERFCNT ..36 Performance Counter register.
6474 * 26 MIPS_COP_0_ECC .3ii ECC / Error Control register.
6475 * 27 MIPS_COP_0_CACHE_ERR .3ii Cache Error register.
6476 * 28/0 MIPS_COP_0_TAG_LO .3ii Cache TagLo register (instr).
6477 * 28/1 MIPS_COP_0_DATA_LO ..ii Cache DataLo register (instr).
6478 * 28/2 MIPS_COP_0_TAG_LO ..ii Cache TagLo register (data).
6479 * 28/3 MIPS_COP_0_DATA_LO ..ii Cache DataLo register (data).
6480 * 29/0 MIPS_COP_0_TAG_HI .3ii Cache TagHi register (instr).
6481 * 29/1 MIPS_COP_0_DATA_HI ..ii Cache DataHi register (instr).
6482 * 29/2 MIPS_COP_0_TAG_HI ..ii Cache TagHi register (data).
6483 * 29/3 MIPS_COP_0_DATA_HI ..ii Cache DataHi register (data).
6484 * 30 MIPS_COP_0_ERROR_PC .636 Error EPC register.
6485 * 31 MIPS_COP_0_DESAVE .... DESAVE JTAG register.
6486 */
6487
6488/* Deal with inclusion from an assembly file. */
6489#if defined(_LOCORE) || defined(LOCORE)
6490#define _(n) $n
6491#else
6492# 503 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/machine/cpuregs.h" 3 4
6493#define _(n) n
6494#endif
6495# 505 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/machine/cpuregs.h" 3 4
6496
6497
6498#define MIPS_COP_0_TLB_INDEX _(0)
6499#define MIPS_COP_0_TLB_RANDOM _(1)
6500 /* Name and meaning of TLB bits for $2 differ on r3k and r4k. */
6501
6502#define MIPS_COP_0_TLB_CONTEXT _(4)
6503 /* $5 and $6 new with MIPS-III */
6504#define MIPS_COP_0_BAD_VADDR _(8)
6505#define MIPS_COP_0_TLB_HI _(10)
6506#define MIPS_COP_0_STATUS _(12)
6507#define MIPS_COP_0_CAUSE _(13)
6508#define MIPS_COP_0_EXC_PC _(14)
6509#define MIPS_COP_0_PRID _(15)
6510
6511/* MIPS-III */
6512#define MIPS_COP_0_TLB_LO0 _(2)
6513#define MIPS_COP_0_TLB_LO1 _(3)
6514
6515#define MIPS_COP_0_TLB_PG_MASK _(5)
6516#define MIPS_COP_0_TLB_WIRED _(6)
6517
6518#define MIPS_COP_0_COUNT _(9)
6519#define MIPS_COP_0_COMPARE _(11)
6520
6521#define MIPS_COP_0_CONFIG _(16)
6522#define MIPS_COP_0_LLADDR _(17)
6523#define MIPS_COP_0_WATCH_LO _(18)
6524#define MIPS_COP_0_WATCH_HI _(19)
6525#define MIPS_COP_0_TLB_XCONTEXT _(20)
6526#define MIPS_COP_0_ECC _(26)
6527#define MIPS_COP_0_CACHE_ERR _(27)
6528#define MIPS_COP_0_TAG_LO _(28)
6529#define MIPS_COP_0_TAG_HI _(29)
6530#define MIPS_COP_0_ERROR_PC _(30)
6531
6532/* MIPS32/64 */
6533#define MIPS_COP_0_USERLOCAL _(4) /* sel 2 is userlevel register */
6534#define MIPS_COP_0_HWRENA _(7)
6535#define MIPS_COP_0_DEBUG _(23)
6536#define MIPS_COP_0_DEPC _(24)
6537#define MIPS_COP_0_PERFCNT _(25)
6538#define MIPS_COP_0_DATA_LO _(28)
6539#define MIPS_COP_0_DATA_HI _(29)
6540#define MIPS_COP_0_DESAVE _(31)
6541
6542/* BERI */
6543#if defined(CPU_BERI)
6544#define MIPS_COP_0_EXC_INS _(8) /* sel 1 encoding of instruction causing exception */
6545#endif
6546# 555 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/machine/cpuregs.h" 3 4
6547
6548/* MIPS32 Config register definitions */
6549#define MIPS_MMU_NONE 0x00 /* No MMU present */
6550#define MIPS_MMU_TLB 0x01 /* Standard TLB */
6551#define MIPS_MMU_BAT 0x02 /* Standard BAT */
6552#define MIPS_MMU_FIXED 0x03 /* Standard fixed mapping */
6553
6554/*
6555 * Config Register Fields
6556 * (See "MIPS Architecture for Programmers Volume III", MD00091, Table 9.39)
6557 */
6558#define MIPS_CONFIG0_M 0x80000000 /* Flag: Config1 is present. */
6559#define MIPS_CONFIG0_MT_MASK 0x00000380 /* bits 9..7 MMU Type */
6560#define MIPS_CONFIG0_MT_SHIFT 7
6561#define MIPS_CONFIG0_BE 0x00008000 /* data is big-endian */
6562#define MIPS_CONFIG0_VI 0x00000008 /* inst cache is virtual */
6563
6564/*
6565 * Config1 Register Fields
6566 * (See "MIPS Architecture for Programmers Volume III", MD00091, Table 9-1)
6567 */
6568#define MIPS_CONFIG1_M 0x80000000 /* Flag: Config2 is present. */
6569#define MIPS_CONFIG1_TLBSZ_MASK 0x7E000000 /* bits 30..25 # tlb entries minus one */
6570#define MIPS_CONFIG1_TLBSZ_SHIFT 25
6571
6572#define MIPS_CONFIG1_IS_MASK 0x01C00000 /* bits 24..22 icache sets per way */
6573#define MIPS_CONFIG1_IS_SHIFT 22
6574#define MIPS_CONFIG1_IL_MASK 0x00380000 /* bits 21..19 icache line size */
6575#define MIPS_CONFIG1_IL_SHIFT 19
6576#define MIPS_CONFIG1_IA_MASK 0x00070000 /* bits 18..16 icache associativity */
6577#define MIPS_CONFIG1_IA_SHIFT 16
6578#define MIPS_CONFIG1_DS_MASK 0x0000E000 /* bits 15..13 dcache sets per way */
6579#define MIPS_CONFIG1_DS_SHIFT 13
6580#define MIPS_CONFIG1_DL_MASK 0x00001C00 /* bits 12..10 dcache line size */
6581#define MIPS_CONFIG1_DL_SHIFT 10
6582#define MIPS_CONFIG1_DA_MASK 0x00000380 /* bits 9.. 7 dcache associativity */
6583#define MIPS_CONFIG1_DA_SHIFT 7
6584#define MIPS_CONFIG1_LOWBITS 0x0000007F
6585#define MIPS_CONFIG1_C2 0x00000040 /* Coprocessor 2 implemented */
6586#define MIPS_CONFIG1_MD 0x00000020 /* MDMX ASE implemented (MIPS64) */
6587#define MIPS_CONFIG1_PC 0x00000010 /* Performance counters implemented */
6588#define MIPS_CONFIG1_WR 0x00000008 /* Watch registers implemented */
6589#define MIPS_CONFIG1_CA 0x00000004 /* MIPS16e ISA implemented */
6590#define MIPS_CONFIG1_EP 0x00000002 /* EJTAG implemented */
6591#define MIPS_CONFIG1_FP 0x00000001 /* FPU implemented */
6592
6593/*
6594 * Config2 Register Fields
6595 * (See "MIPS Architecture for Programmers Volume III", MD00091, Table 9.40)
6596 */
6597#define MIPS_CONFIG2_M 0x80000000 /* Flag: Config3 is present. */
6598#define MIPS_CONFIG2_SA_SHIFT 0 /* Secondary cache associativity */
6599#define MIPS_CONFIG2_SA_MASK 0xf
6600#define MIPS_CONFIG2_SL_SHIFT 4 /* Secondary cache line size */
6601#define MIPS_CONFIG2_SL_MASK 0xf
6602#define MIPS_CONFIG2_SS_SHIFT 8 /* Secondary cache sets per way */
6603#define MIPS_CONFIG2_SS_MASK 0xf
6604
6605/*
6606 * Config3 Register Fields
6607 * (See "MIPS Architecture for Programmers Volume III", MD00091, Table 9.41)
6608 */
6609#define MIPS_CONFIG3_M 0x80000000 /* Flag: Config4 is present */
6610#define MIPS_CONFIG3_CMGCR_MASK 0x20000000 /* Coherence manager present */
6611#define MIPS_CONFIG3_ULR 0x00002000 /* UserLocal reg implemented */
6612
6613/*
6614 * Config2 Register Fields
6615 * (See "MIPS Architecture for Programmers Volume III", MD00091, Table 9.40)
6616 */
6617#define MIPS_CONFIG2_M 0x80000000 /* Flag: Config3 is present. */
6618
6619/*
6620 * Config3 Register Fields
6621 * (See "MIPS Architecture for Programmers Volume III", MD00091, Table 9.41)
6622 */
6623#define MIPS_CONFIG3_M 0x80000000 /* Flag: Config4 is present */
6624#define MIPS_CONFIG3_ULR 0x00002000 /* UserLocal reg implemented */
6625
6626#define MIPS_CONFIG4_MMUSIZEEXT 0x000000FF /* bits 7.. 0 MMU Size Extension */
6627#define MIPS_CONFIG4_MMUEXTDEF 0x0000C000 /* bits 15.14 MMU Extension Definition */
6628#define MIPS_CONFIG4_MMUEXTDEF_MMUSIZEEXT 0x00004000 /* This values denotes CONFIG4 bits */
6629
6630/*
6631 * Values for the code field in a break instruction.
6632 */
6633#define MIPS_BREAK_INSTR 0x0000000d
6634#define MIPS_BREAK_VAL_MASK 0x03ff0000
6635#define MIPS_BREAK_VAL_SHIFT 16
6636#define MIPS_BREAK_KDB_VAL 512
6637#define MIPS_BREAK_SSTEP_VAL 513
6638#define MIPS_BREAK_BRKPT_VAL 514
6639#define MIPS_BREAK_SOVER_VAL 515
6640#define MIPS_BREAK_DDB_VAL 516
6641#define MIPS_BREAK_KDB (MIPS_BREAK_INSTR | \
6642 (MIPS_BREAK_KDB_VAL << MIPS_BREAK_VAL_SHIFT))
6643#define MIPS_BREAK_SSTEP (MIPS_BREAK_INSTR | \
6644 (MIPS_BREAK_SSTEP_VAL << MIPS_BREAK_VAL_SHIFT))
6645#define MIPS_BREAK_BRKPT (MIPS_BREAK_INSTR | \
6646 (MIPS_BREAK_BRKPT_VAL << MIPS_BREAK_VAL_SHIFT))
6647#define MIPS_BREAK_SOVER (MIPS_BREAK_INSTR | \
6648 (MIPS_BREAK_SOVER_VAL << MIPS_BREAK_VAL_SHIFT))
6649#define MIPS_BREAK_DDB (MIPS_BREAK_INSTR | \
6650 (MIPS_BREAK_DDB_VAL << MIPS_BREAK_VAL_SHIFT))
6651
6652/*
6653 * Mininum and maximum cache sizes.
6654 */
6655#define MIPS_MIN_CACHE_SIZE (16 * 1024)
6656#define MIPS_MAX_CACHE_SIZE (256 * 1024)
6657#define MIPS_MAX_PCACHE_SIZE (32 * 1024) /* max. primary cache size */
6658
6659/*
6660 * The floating point version and status registers.
6661 */
6662#define MIPS_FPU_ID $0
6663#define MIPS_FPU_CSR $31
6664
6665/*
6666 * The floating point coprocessor status register bits.
6667 */
6668#define MIPS_FPU_ROUNDING_BITS 0x00000003
6669#define MIPS_FPU_ROUND_RN 0x00000000
6670#define MIPS_FPU_ROUND_RZ 0x00000001
6671#define MIPS_FPU_ROUND_RP 0x00000002
6672#define MIPS_FPU_ROUND_RM 0x00000003
6673#define MIPS_FPU_STICKY_BITS 0x0000007c
6674#define MIPS_FPU_STICKY_INEXACT 0x00000004
6675#define MIPS_FPU_STICKY_UNDERFLOW 0x00000008
6676#define MIPS_FPU_STICKY_OVERFLOW 0x00000010
6677#define MIPS_FPU_STICKY_DIV0 0x00000020
6678#define MIPS_FPU_STICKY_INVALID 0x00000040
6679#define MIPS_FPU_ENABLE_BITS 0x00000f80
6680#define MIPS_FPU_ENABLE_INEXACT 0x00000080
6681#define MIPS_FPU_ENABLE_UNDERFLOW 0x00000100
6682#define MIPS_FPU_ENABLE_OVERFLOW 0x00000200
6683#define MIPS_FPU_ENABLE_DIV0 0x00000400
6684#define MIPS_FPU_ENABLE_INVALID 0x00000800
6685#define MIPS_FPU_EXCEPTION_BITS 0x0003f000
6686#define MIPS_FPU_EXCEPTION_INEXACT 0x00001000
6687#define MIPS_FPU_EXCEPTION_UNDERFLOW 0x00002000
6688#define MIPS_FPU_EXCEPTION_OVERFLOW 0x00004000
6689#define MIPS_FPU_EXCEPTION_DIV0 0x00008000
6690#define MIPS_FPU_EXCEPTION_INVALID 0x00010000
6691#define MIPS_FPU_EXCEPTION_UNIMPL 0x00020000
6692#define MIPS_FPU_COND_BIT 0x00800000
6693#define MIPS_FPU_FLUSH_BIT 0x01000000 /* r4k, MBZ on r3k */
6694#define MIPS_FPC_MBZ_BITS 0xfe7c0000
6695
6696
6697/*
6698 * Constants to determine if have a floating point instruction.
6699 */
6700#define MIPS_OPCODE_SHIFT 26
6701#define MIPS_OPCODE_C1 0x11
6702
6703/*
6704 * Bits defined for for the HWREna (CP0 register 7, select 0).
6705 */
6706#define MIPS_HWRENA_CPUNUM (1<<0) /* CPU number program is running on */
6707#define MIPS_HWRENA_SYNCI_STEP (1<<1) /* Address step sized used with SYNCI */
6708#define MIPS_HWRENA_CC (1<<2) /* Hi Res cycle counter */
6709#define MIPS_HWRENA_CCRES (1<<3) /* Cycle counter resolution */
6710#define MIPS_HWRENA_UL (1<<29) /* UserLocal Register */
6711#define MIPS_HWRENA_IMPL30 (1<<30) /* Implementation-dependent 30 */
6712#define MIPS_HWRENA_IMPL31 (1<<31) /* Implementation-dependent 31 */
6713
6714/* Coherence manager constants */
6715#define MIPS_CMGCRB_BASE 11
6716#define MIPS_CMGCRF_BASE (~((1 << MIPS_CMGCRB_BASE) - 1))
6717
6718/*
6719 * Bits defined for for the HWREna (CP0 register 7, select 0).
6720 */
6721#define MIPS_HWRENA_CPUNUM (1<<0) /* CPU number program is running on */
6722#define MIPS_HWRENA_SYNCI_STEP (1<<1) /* Address step sized used with SYNCI */
6723#define MIPS_HWRENA_CC (1<<2) /* Hi Res cycle counter */
6724#define MIPS_HWRENA_CCRES (1<<3) /* Cycle counter resolution */
6725#define MIPS_HWRENA_UL (1<<29) /* UserLocal Register */
6726#define MIPS_HWRENA_IMPL30 (1<<30) /* Implementation-dependent 30 */
6727#define MIPS_HWRENA_IMPL31 (1<<31) /* Implementation-dependent 31 */
6728
6729#endif /* _MIPS_CPUREGS_H_ */
6730# 738 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/machine/cpuregs.h" 3 4
6731# 44 "/home/alr48/cheri/sources/cheribsd/bin/cheritest/cheritest_registers.c" 2
6732
6733#if 0 /* expanded by -frewrite-includes */
6734#include <cheri/cheri.h>
6735#endif /* expanded by -frewrite-includes */
6736# 45 "/home/alr48/cheri/sources/cheribsd/bin/cheritest/cheritest_registers.c"
6737# 1 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/cheri/cheri.h" 1 3 4
6738/*-
6739 * Copyright (c) 2011-2016 Robert N. M. Watson
6740 * Copyright (c) 2015 SRI International
6741 * All rights reserved.
6742 *
6743 * This software was developed by SRI International and the University of
6744 * Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237)
6745 * ("CTSRD"), as part of the DARPA CRASH research programme.
6746 *
6747 * Redistribution and use in source and binary forms, with or without
6748 * modification, are permitted provided that the following conditions
6749 * are met:
6750 * 1. Redistributions of source code must retain the above copyright
6751 * notice, this list of conditions and the following disclaimer.
6752 * 2. Redistributions in binary form must reproduce the above copyright
6753 * notice, this list of conditions and the following disclaimer in the
6754 * documentation and/or other materials provided with the distribution.
6755 *
6756 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
6757 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
6758 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
6759 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
6760 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
6761 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
6762 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
6763 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
6764 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
6765 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
6766 * SUCH DAMAGE.
6767 */
6768
6769#ifndef _SYS_CHERI_H_
6770#define _SYS_CHERI_H_
6771
6772#ifdef _KERNEL
6773#if 0 /* expanded by -frewrite-includes */
6774#include <sys/sysctl.h> /* SYSCTL_DECL() */
6775#endif /* expanded by -frewrite-includes */
6776# 36 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/cheri/cheri.h" 3 4
6777# 37 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/cheri/cheri.h" 3 4
6778#if 0 /* expanded by -frewrite-includes */
6779#include <sys/systm.h> /* CTASSERT() */
6780#endif /* expanded by -frewrite-includes */
6781# 37 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/cheri/cheri.h" 3 4
6782# 38 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/cheri/cheri.h" 3 4
6783#endif
6784# 39 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/cheri/cheri.h" 3 4
6785
6786#if 0 /* expanded by -frewrite-includes */
6787#include <sys/types.h>
6788#endif /* expanded by -frewrite-includes */
6789# 40 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/cheri/cheri.h" 3 4
6790# 41 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/cheri/cheri.h" 3 4
6791
6792#if 0 /* expanded by -frewrite-includes */
6793#include <machine/cherireg.h> /* CHERICAP_SIZE. */
6794#endif /* expanded by -frewrite-includes */
6795# 42 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/cheri/cheri.h" 3 4
6796# 43 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/cheri/cheri.h" 3 4
6797
6798/*
6799 * Canonical C-language representation of a capability for compilers that
6800 * don't support capabilities directly. The in-memory layout is sensitive to
6801 * the microarchitecture, and hence treated as opaque. Fields must be
6802 * accessed via the ISA.
6803 */
6804struct chericap {
6805 uint8_t c_data[CHERICAP_SIZE];
6806} __packed __aligned(CHERICAP_SIZE);
6807#ifdef _KERNEL
6808CTASSERT(sizeof(struct chericap) == CHERICAP_SIZE);
6809#endif
6810# 56 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/cheri/cheri.h" 3 4
6811
6812/*
6813 * Canonical C-language representation of a CHERI object capability -- code and
6814 * data capabilities in registers or memory.
6815 */
6816struct cheri_object {
6817#if !defined(_KERNEL) && __has_feature(capabilities)
6818 __capability void *co_codecap;
6819 __capability void *co_datacap;
6820#else
6821# 66 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/cheri/cheri.h" 3 4
6822 struct chericap co_codecap;
6823 struct chericap co_datacap;
6824#endif
6825# 69 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/cheri/cheri.h" 3 4
6826};
6827
6828#if !defined(_KERNEL) && __has_feature(capabilities)
6829#define CHERI_OBJECT_INIT_NULL {NULL, NULL}
6830#define CHERI_OBJECT_ISNULL(co) \
6831 ((co).co_codecap == NULL && (co).co_datacap == NULL)
6832#endif
6833# 76 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/cheri/cheri.h" 3 4
6834
6835/*
6836 * Data structure describing CHERI's sigaltstack-like extensions to signal
6837 * delivery. In the event that a thread takes a signal when $pcc doesn't hold
6838 * CHERI_PERM_SYSCALL, we will need to install new $pcc, $ddc, $stc, and $idc
6839 * state, and move execution to the per-thread alternative stack, whose
6840 * pointer should (presumably) be relative to the $ddc/$stc defined here.
6841 */
6842struct cheri_signal {
6843#if !defined(_KERNEL) && __has_feature(capabilities)
6844 __capability void *csig_pcc;
6845 __capability void *csig_ddc;
6846 __capability void *csig_stc;
6847 __capability void *csig_idc;
6848 __capability void *csig_default_stack;
6849 __capability void *csig_sigcode;
6850#else
6851# 93 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/cheri/cheri.h" 3 4
6852 struct chericap csig_pcc;
6853 struct chericap csig_ddc;
6854 struct chericap csig_stc;
6855 struct chericap csig_idc;
6856 struct chericap csig_default_stack;
6857 struct chericap csig_sigcode;
6858#endif
6859# 100 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/cheri/cheri.h" 3 4
6860};
6861
6862/*
6863 * Per-thread CHERI CCall/CReturn stack, which preserves the calling PC/PCC/
6864 * IDC across CCall so that CReturn can restore them.
6865 *
6866 * XXXRW: This is a very early experiment -- it's not clear if this idea will
6867 * persist in its current form, or at all. For more complex userspace
6868 * language, there's a reasonable expectation that it, rather than the kernel,
6869 * will want to manage the idea of a "trusted stack".
6870 *
6871 * XXXRW: This is currently part of the kernel-user ABI due to the
6872 * CHERI_GET_STACK and CHERI_SET_STACK sysarch() calls. In due course we need
6873 * to revise those APIs and differentiate the kernel-internal representation
6874 * from the public one.
6875 */
6876struct cheri_stack_frame {
6877 register_t _csf_pad0; /* Used to be MIPS program counter. */
6878 register_t _csf_pad1;
6879 register_t _csf_pad2;
6880 register_t _csf_pad3;
6881#if !defined(_KERNEL) && __has_feature(capabilities)
6882 __capability void *csf_pcc;
6883 __capability void *csf_idc;
6884#else
6885# 125 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/cheri/cheri.h" 3 4
6886 struct chericap csf_pcc;
6887 struct chericap csf_idc;
6888#endif
6889# 128 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/cheri/cheri.h" 3 4
6890};
6891
6892#define CHERI_STACK_DEPTH 8 /* XXXRW: 8 is a nice round number. */
6893struct cheri_stack {
6894 register_t cs_tsp; /* Byte offset, not frame index. */
6895 register_t cs_tsize; /* Stack size, in bytes. */
6896 register_t _cs_pad0;
6897 register_t _cs_pad1;
6898 struct cheri_stack_frame cs_frames[CHERI_STACK_DEPTH];
6899} __aligned(CHERICAP_SIZE);
6900
6901#define CHERI_FRAME_SIZE sizeof(struct cheri_stack_frame)
6902#define CHERI_STACK_SIZE (CHERI_STACK_DEPTH * CHERI_FRAME_SIZE)
6903
6904/*
6905 * APIs that act on C language representations of capabilities -- but not
6906 * capabilities themselves.
6907 */
6908#ifdef _KERNEL
6909void cheri_capability_copy(struct chericap *cp_to,
6910 struct chericap *cp_from);
6911void cheri_capability_set(struct chericap *cp, uint32_t uperms,
6912 void *basep, size_t length, off_t off);
6913void cheri_capability_set_null(struct chericap *cp);
6914void cheri_capability_setoffset(struct chericap *cp, register_t offset);
6915
6916/*
6917 * CHERI capability utility functions.
6918 */
6919void cheri_bcopy(void *src, void *dst, size_t len);
6920void *cheri_memcpy(void *dst, void *src, size_t len);
6921
6922/*
6923 * CHERI context management functions.
6924 */
6925struct cheri_frame;
6926struct thread;
6927struct trapframe;
6928const char *cheri_exccode_string(uint8_t exccode);
6929void cheri_exec_setregs(struct thread *td, u_long entry_addr);
6930void cheri_log_cheri_frame(struct trapframe *frame);
6931void cheri_log_exception(struct trapframe *frame, int trap_type);
6932void cheri_log_exception_registers(struct trapframe *frame);
6933void cheri_newthread_setregs(struct thread *td);
6934int cheri_syscall_authorize(struct thread *td, u_int code,
6935 int nargs, register_t *args);
6936int cheri_signal_sandboxed(struct thread *td);
6937void cheri_sendsig(struct thread *td);
6938void cheri_trapframe_from_cheriframe(struct trapframe *frame,
6939 struct cheri_frame *cfp);
6940void cheri_trapframe_to_cheriframe(struct trapframe *frame,
6941 struct cheri_frame *cfp);
6942
6943/*
6944 * Functions to set up and manipulate CHERI contexts and stacks.
6945 */
6946struct pcb;
6947struct sysarch_args;
6948void cheri_signal_copy(struct pcb *dst, struct pcb *src);
6949void cheri_stack_copy(struct pcb *dst, struct pcb *src);
6950void cheri_stack_init(struct pcb *pcb);
6951int cheri_stack_unwind(struct thread *td, struct trapframe *tf,
6952 int signum);
6953int cheri_sysarch_getstack(struct thread *td, struct sysarch_args *uap);
6954int cheri_sysarch_gettypecap(struct thread *td, struct sysarch_args *uap);
6955int cheri_sysarch_setstack(struct thread *td, struct sysarch_args *uap);
6956void cheri_typecap_copy(struct pcb *dst, struct pcb *src);
6957
6958/*
6959 * Global sysctl definitions.
6960 */
6961SYSCTL_DECL(_security_cheri);
6962SYSCTL_DECL(_security_cheri_stats);
6963extern u_int security_cheri_debugger_on_sandbox_signal;
6964extern u_int security_cheri_debugger_on_sandbox_syscall;
6965extern u_int security_cheri_debugger_on_sandbox_unwind;
6966extern u_int security_cheri_debugger_on_sigprot;
6967extern u_int security_cheri_sandboxed_signals;
6968extern u_int security_cheri_syscall_violations;
6969
6970/*
6971 * Functions exposed to machine-independent code that must interact with
6972 * CHERI-specific features; e.g., ktrace.
6973 */
6974struct ktr_ccall;
6975struct ktr_creturn;
6976struct ktr_cexception;
6977struct thr_param_c;
6978void cheriabi_thr_new_md(struct thread *parent_td,
6979 struct thr_param_c *param);
6980void ktrccall_mdfill(struct pcb *pcb, struct ktr_ccall *kc);
6981void ktrcreturn_mdfill(struct pcb *pcb, struct ktr_creturn *kr);
6982void ktrcexception_mdfill(struct trapframe *frame,
6983 struct ktr_cexception *ke);
6984#endif /* !_KERNEL */
6985# 223 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/cheri/cheri.h" 3 4
6986
6987/*
6988 * Nested include of machine-dependent definitions, which likely depend on
6989 * first having defined chericap.h.
6990 */
6991#if 0 /* expanded by -frewrite-includes */
6992#include <machine/cheri.h>
6993#endif /* expanded by -frewrite-includes */
6994# 228 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/cheri/cheri.h" 3 4
6995# 1 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/machine/cheri.h" 1 3 4
6996/*-
6997 * Copyright (c) 2011-2016 Robert N. M. Watson
6998 * Copyright (c) 2015 SRI International
6999 * All rights reserved.
7000 *
7001 * This software was developed by SRI International and the University of
7002 * Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237)
7003 * ("CTSRD"), as part of the DARPA CRASH research programme.
7004 *
7005 * Redistribution and use in source and binary forms, with or without
7006 * modification, are permitted provided that the following conditions
7007 * are met:
7008 * 1. Redistributions of source code must retain the above copyright
7009 * notice, this list of conditions and the following disclaimer.
7010 * 2. Redistributions in binary form must reproduce the above copyright
7011 * notice, this list of conditions and the following disclaimer in the
7012 * documentation and/or other materials provided with the distribution.
7013 *
7014 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
7015 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
7016 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
7017 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
7018 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
7019 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
7020 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
7021 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
7022 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
7023 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
7024 * SUCH DAMAGE.
7025 */
7026
7027#ifndef _MIPS_INCLUDE_CHERI_H_
7028#define _MIPS_INCLUDE_CHERI_H_
7029
7030#ifdef _KERNEL
7031#if 0 /* expanded by -frewrite-includes */
7032#include <sys/sysctl.h> /* SYSCTL_DECL() */
7033#endif /* expanded by -frewrite-includes */
7034# 36 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/machine/cheri.h" 3 4
7035# 37 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/machine/cheri.h" 3 4
7036#if 0 /* expanded by -frewrite-includes */
7037#include <sys/systm.h> /* CTASSERT() */
7038#endif /* expanded by -frewrite-includes */
7039# 37 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/machine/cheri.h" 3 4
7040# 38 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/machine/cheri.h" 3 4
7041#endif
7042# 39 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/machine/cheri.h" 3 4
7043
7044#if 0 /* expanded by -frewrite-includes */
7045#include <machine/cherireg.h>
7046#endif /* expanded by -frewrite-includes */
7047# 40 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/machine/cheri.h" 3 4
7048# 41 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/machine/cheri.h" 3 4
7049
7050#if 0 /* expanded by -frewrite-includes */
7051#include <sys/types.h>
7052#endif /* expanded by -frewrite-includes */
7053# 42 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/machine/cheri.h" 3 4
7054# 43 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/machine/cheri.h" 3 4
7055
7056/*
7057 * In the past, struct cheri_frame was the in-kernel and kernel<->user
7058 * structure holding CHERI register state for context switching. It is now a
7059 * public structure for kernel<->user interaction (e.g., signals), and struct
7060 * trapframe is used within the kernel. Regardless, correct preservation of
7061 * state in this structure is critical to both correctness and security.
7062 */
7063struct cheri_frame {
7064 /* DDC has special properties for MIPS load/store instructions. */
7065#if !defined(_KERNEL) && __has_feature(capabilities)
7066 __capability void *cf_ddc;
7067#else
7068# 56 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/machine/cheri.h" 3 4
7069 struct chericap cf_ddc;
7070#endif
7071# 58 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/machine/cheri.h" 3 4
7072
7073 /*
7074 * General-purpose capabilities -- note, numbering is from v1.17 of
7075 * the CHERI ISA spec (ISAv5 draft).
7076 */
7077#if !defined(_KERNEL) && __has_feature(capabilities)
7078 __capability void *cf_c1, *cf_c2, *cf_c3, *cf_c4;
7079 __capability void *cf_c5, *cf_c6, *cf_c7;
7080 __capability void *cf_c8, *cf_c9, *cf_c10, *cf_stc, *cf_c12;
7081 __capability void *cf_c13, *cf_c14, *cf_c15, *cf_c16, *cf_c17;
7082 __capability void *cf_c18, *cf_c19, *cf_c20, *cf_c21, *cf_c22;
7083 __capability void *cf_c23, *cf_c24, *cf_c25, *cf_idc;
7084#else
7085# 71 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/machine/cheri.h" 3 4
7086 struct chericap cf_c1, cf_c2, cf_c3, cf_c4;
7087 struct chericap cf_c5, cf_c6, cf_c7;
7088 struct chericap cf_c8, cf_c9, cf_c10, cf_stc, cf_c12;
7089 struct chericap cf_c13, cf_c14, cf_c15, cf_c16, cf_c17;
7090 struct chericap cf_c18, cf_c19, cf_c20, cf_c21, cf_c22;
7091 struct chericap cf_c23, cf_c24, cf_c25, cf_idc;
7092#endif
7093# 78 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/machine/cheri.h" 3 4
7094
7095 /*
7096 * Program counter capability -- extracted from exception frame EPCC.
7097 */
7098#if !defined(_KERNEL) && __has_feature(capabilities)
7099 __capability void *cf_pcc;
7100#else
7101# 85 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/machine/cheri.h" 3 4
7102 struct chericap cf_pcc;
7103#endif
7104# 87 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/machine/cheri.h" 3 4
7105
7106 /*
7107 * Padded out non-capability registers.
7108 *
7109 * XXXRW: The comment below on only updating for CP2 exceptions is
7110 * incorrect, but should be made correct.
7111 */
7112 register_t cf_capcause; /* Updated only on CP2 exceptions. */
7113 register_t _cf_pad0[1];
7114#if (defined(CPU_CHERI) && !defined(CPU_CHERI128)) || (defined(_MIPS_SZCAP) && (_MIPS_SZCAP == 256))
7115 register_t _cf_pad1[2];
7116#endif
7117# 99 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/machine/cheri.h" 3 4
7118};
7119
7120#ifdef _KERNEL
7121/* 28 capability registers + capcause + padding. */
7122CTASSERT(sizeof(struct cheri_frame) == (29 * CHERICAP_SIZE));
7123#endif
7124# 105 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/machine/cheri.h" 3 4
7125
7126#ifdef _KERNEL
7127/*
7128 * Data structure defining kernel per-thread caller-save state used in
7129 * voluntary context switches. This is morally equivalent to pcb_context[].
7130 */
7131struct cheri_kframe {
7132 struct chericap ckf_c17;
7133 struct chericap ckf_c18;
7134 struct chericap ckf_c19;
7135 struct chericap ckf_c20;
7136 struct chericap ckf_c21;
7137 struct chericap ckf_c22;
7138 struct chericap ckf_c23;
7139 struct chericap ckf_c24;
7140};
7141#endif
7142# 122 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/machine/cheri.h" 3 4
7143
7144/*
7145 * CHERI capability register manipulation macros.
7146 */
7147#define CHERI_CGETBASE(v, cb) do { \
7148 __asm__ __volatile__ ( \
7149 ".set push\n" \
7150 ".set noreorder\n" \
7151 "cgetbase %0, $c%1\n" \
7152 ".set pop\n" \
7153 : "=r" (v) : "i" (cb)); \
7154} while (0)
7155
7156#define CHERI_CGETLEN(v, cb) do { \
7157 __asm__ __volatile__ ( \
7158 ".set push\n" \
7159 ".set noreorder\n" \
7160 "cgetlen %0, $c%1\n" \
7161 ".set pop\n" \
7162 : "=r" (v) :"i" (cb)); \
7163} while (0)
7164
7165#define CHERI_CGETOFFSET(v, cb) do { \
7166 __asm__ __volatile__ ( \
7167 ".set push\n" \
7168 ".set noreorder\n" \
7169 "cgetoffset %0, $c%1\n" \
7170 ".set pop\n" \
7171 : "=r" (v) : "i" (cb)); \
7172} while (0)
7173
7174#define CHERI_CGETTAG(v, cb) do { \
7175 __asm__ __volatile__ ( \
7176 ".set push\n" \
7177 ".set noreorder\n" \
7178 "cgettag %0, $c%1\n" \
7179 ".set pop\n" \
7180 : "=r" (v) : "i" (cb)); \
7181} while (0)
7182
7183#define CHERI_CGETSEALED(v, cb) do { \
7184 __asm__ __volatile__ ( \
7185 ".set push\n" \
7186 ".set noreorder\n" \
7187 "cgetsealed %0, $c%1\n" \
7188 ".set pop\n" \
7189 : "=r" (v) : "i" (cb)); \
7190} while (0)
7191
7192#define CHERI_CGETPERM(v, cb) do { \
7193 __asm__ __volatile__ ( \
7194 ".set push\n" \
7195 ".set noreorder\n" \
7196 "cgetperm %0, $c%1\n" \
7197 ".set pop\n" \
7198 : "=r" (v) : "i" (cb)); \
7199} while (0)
7200
7201#define CHERI_CGETTYPE(v, cb) do { \
7202 __asm__ __volatile__ ( \
7203 ".set push\n" \
7204 ".set noreorder\n" \
7205 "cgettype %0, $c%1\n" \
7206 ".set pop\n" \
7207 : "=r" (v) : "i" (cb)); \
7208} while (0)
7209
7210#define CHERI_CGETCAUSE(v) do { \
7211 __asm__ __volatile__ ( \
7212 ".set push\n" \
7213 ".set noreorder\n" \
7214 "cgetcause %0\n" \
7215 ".set pop\n" \
7216 : "=r" (v)); \
7217} while (0)
7218
7219#define CHERI_CTOPTR(v, cb, ct) do { \
7220 __asm__ __volatile__ ( \
7221 ".set push\n" \
7222 ".set noreorder\n" \
7223 "ctoptr %0, $c%1, $c%2\n" \
7224 ".set pop\n" \
7225 : "=r" (v) : "i" (cb), "i" (ct)); \
7226} while (0)
7227
7228/*
7229 * Implement a CToInt similar to CToPtr but without the tag check, which will
7230 * be useful to extract integer interpretations of untagged capabilities. One
7231 * property of this conversion is that, since the capability might be
7232 * untagged, we can't assume that (base + offset) < (max capability address),
7233 * and so significant care should be taken -- ideally this variant would only
7234 * be used when we know that the capability is untagged and holds a value that
7235 * must be an integer (due to types or other compile-time information).
7236 *
7237 * This may someday be an instruction. If so, it could directly return the
7238 * cursor, rather than extract (base, offset).
7239 */
7240#define CHERI_CTOINT(v, cb) do { \
7241 register_t _base, _offset; \
7242 \
7243 CHERI_CGETBASE(_base, cb); \
7244 CHERI_CGETOFFSET(_offset, cb); \
7245 v = (__typeof__(v))(_base + _offset); \
7246} while (0)
7247
7248/*
7249 * Note that despite effectively being a CMove, CGetDefault doesn't require a
7250 * memory clobber: if it's writing to $ddc, it's a nop; otherwise, it's not
7251 * writing to $ddc so no clobber is needed.
7252 */
7253#define CHERI_CGETDEFAULT(cd) do { \
7254 __asm__ __volatile__ ( \
7255 ".set push\n" \
7256 ".set noreorder\n" \
7257 "cgetdefault $c%0\n" \
7258 ".set pop\n" \
7259 : : "i" (cd)); \
7260} while (0)
7261
7262/*
7263 * Instructions that check capability values and could throw exceptions; no
7264 * capability-register value changes, so no clobbers required.
7265 */
7266#define CHERI_CCHECKPERM(cs, v) do { \
7267 __asm__ __volatile__ ( \
7268 ".set push\n" \
7269 ".set noreorder\n" \
7270 "ccheckperm $c%0, %1\n" \
7271 ".set pop\n" \
7272 : : "i" (cd), "r" (v)); \
7273} while (0)
7274
7275#define CHERI_CCHECKTYPE(cs, cb) do { \
7276 __asm__ __volatile__ ( \
7277 ".set push\n" \
7278 ".set noreorder\n" \
7279 "cchecktype $c%0, $c%1\n" \
7280 ".set pop\n" \
7281 : : "i" (cs), "i" (cb)); \
7282} while (0)
7283
7284/*
7285 * Instructions relating to capability invocation, return, sealing, and
7286 * unsealing. Memory clobbers are required for register manipulation when
7287 * targeting $ddc. They are also required for both CCall and CReturn to
7288 * ensure that any memory write-back is done before invocation.
7289 *
7290 * XXXRW: Is the latter class of cases required?
7291 */
7292#define CHERI_CSEAL(cd, cs, ct) do { \
7293 if ((cd) == 0) \
7294 __asm__ __volatile__ ( \
7295 ".set push\n" \
7296 ".set noreorder\n" \
7297 "cseal $c%0, $c%1, $c%2\n" \
7298 ".set pop\n" \
7299 : : "i" (cd), "i" (cs), "i" (ct) : "memory"); \
7300 else \
7301 __asm__ __volatile__ ( \
7302 ".set push\n" \
7303 ".set noreorder\n" \
7304 "cseal $c%0, $c%1, $c%2\n" \
7305 ".set pop\n" \
7306 : : "i" (cd), "i" (cs), "i" (ct)); \
7307} while (0)
7308
7309#define CHERI_CUNSEAL(cd, cb, ct) do { \
7310 if ((cd) == 0) \
7311 __asm__ __volatile__ ( \
7312 ".set push\n" \
7313 ".set noreorder\n" \
7314 "cunseal $c%0, $c%1, $c%2\n" \
7315 ".set pop\n" \
7316 : : "i" (cd), "i" (cb), "i" (ct) : "memory"); \
7317 else \
7318 __asm__ __volatile__ ( \
7319 ".set push\n" \
7320 ".set noreorder\n" \
7321 "cunseal $c%0, $c%1, $c%2\n" \
7322 ".set pop\n" \
7323 : : "i" (cd), "i" (cb), "i" (ct)); \
7324} while (0)
7325
7326#define CHERI_CCALL(cs, cb) do { \
7327 __asm__ __volatile__ ( \
7328 ".set push\n" \
7329 ".set noreorder\n" \
7330 "ccall $c%0, $c%1\n" \
7331 ".set pop\n" \
7332 : : "i" (cs), "i" (cb) : "memory"); \
7333} while (0)
7334
7335#define CHERI_CRETURN() do { \
7336 __asm__ __volatile__ ( \
7337 ".set push\n" \
7338 ".set noreorder\n" \
7339 "creturn\n" \
7340 ".set pop\n" \
7341 : : : "memory"); \
7342} while (0)
7343
7344/*
7345 * Capability store; while this doesn't muck with $ddc, it does require a
7346 * memory clobber.
7347 */
7348#define CHERI_CSC(cs, cb, regbase, offset) do { \
7349 __asm__ __volatile__ ( \
7350 ".set push\n" \
7351 ".set noreorder\n" \
7352 "csc $c%0, %1, %2($c%3)\n" \
7353 ".set pop\n" \
7354 : : "i" (cs), "r" (regbase), "i" (offset), "i" (cb) : \
7355 "memory"); \
7356} while (0)
7357
7358/*
7359 * Data stores; while these don't muck with $ddc, they do require memory
7360 * clobbers.
7361 */
7362#define CHERI_CSB(rs, rt, offset, cb) do { \
7363 __asm__ __volatile__ ( \
7364 ".set push\n" \
7365 ".set noreorder\n" \
7366 "csb %0, %1, %2($c%3)\n" \
7367 ".set pop\n" \
7368 : : "r" (rs), "r" (rt), "i" (offset), "i" (cb) : "memory"); \
7369} while (0)
7370
7371#define CHERI_CSH(rs, rt, offset, cb) do { \
7372 __asm__ __volatile__ ( \
7373 ".set push\n" \
7374 ".set noreorder\n" \
7375 "csh %0, %1, %2($c%3)\n" \
7376 ".set pop\n" \
7377 : : "r" (rs), "r" (rt), "i" (offset), "i" (cb) : "memory"); \
7378} while (0)
7379
7380#define CHERI_CSW(rs, rt, offset, cb) do { \
7381 __asm__ __volatile__ ( \
7382 ".set push\n" \
7383 ".set noreorder\n" \
7384 "csw %0, %1, %2($c%3)\n" \
7385 ".set pop\n" \
7386 : : "r" (rs), "r" (rt), "i" (offset), "i" (cb) : "memory"); \
7387} while (0)
7388
7389#define CHERI_CSD(rs, rt, offset, cb) do { \
7390 __asm__ __volatile__ ( \
7391 ".set push\n" \
7392 ".set noreorder\n" \
7393 "csd %0, %1, %2($c%3)\n" \
7394 ".set pop\n" \
7395 : : "r" (rs), "r" (rt), "i" (offset), "i" (cb) : "memory"); \
7396} while (0)
7397
7398/*
7399 * Data loads: while these don't much with $ddc, they do require memory
7400 * clobbers.
7401 */
7402#define CHERI_CLB(rd, rt, offset, cb) do { \
7403 __asm__ __volatile__ ( \
7404 ".set push\n" \
7405 ".set noreorder\n" \
7406 "clb %0, %1, %2($c%3)\n" \
7407 ".set pop\n" \
7408 : "=r" (rd) : "r" (rt), "i" (offset),"i" (cb) : "memory"); \
7409} while (0)
7410
7411#define CHERI_CLH(rd, rt, offset, cb) do { \
7412 __asm__ __volatile__ ( \
7413 ".set push\n" \
7414 ".set noreorder\n" \
7415 "clh %0, %1, %2($c%3)\n" \
7416 ".set pop\n" \
7417 : "=r" (rd) : "r" (rt), "i" (offset), "i" (cb) : "memory"); \
7418} while (0)
7419
7420#define CHERI_CLW(rd, rt, offset, cb) do { \
7421 __asm__ __volatile__ ( \
7422 ".set push\n" \
7423 ".set noreorder\n" \
7424 "clw %0, %1, %2($c%3)\n" \
7425 ".set pop\n" \
7426 : "=r" (rd) : "r" (rt), "i" (offset), "i" (cb) : "memory"); \
7427} while (0)
7428
7429#define CHERI_CLD(rd, rt, offset, cb) do { \
7430 __asm__ __volatile__ ( \
7431 ".set push\n" \
7432 ".set noreorder\n" \
7433 "cld %0, %1, %2($c%3)\n" \
7434 ".set pop\n" \
7435 : "=r" (rd) : "r" (rt), "i" (offset), "i" (cb) : "memory"); \
7436} while (0)
7437
7438#define CHERI_CLBU(rd, rt, offset, cb) do { \
7439 __asm__ __volatile__ ( \
7440 ".set push\n" \
7441 ".set noreorder\n" \
7442 "clbu %0, %1, %2($c%3)\n" \
7443 ".set pop\n" \
7444 : "=r" (rd) : "r" (rt), "i" (offset), "i" (cb) : "memory"); \
7445} while (0)
7446
7447#define CHERI_CLHU(rd, rt, offset, cb) do { \
7448 __asm__ __volatile__ ( \
7449 ".set push\n" \
7450 ".set noreorder\n" \
7451 "clhu %0, %1, %2($c%3)\n" \
7452 ".set pop\n" \
7453 : "=r" (rd) : "r" (rt), "i" (offset), "i" (cb) : "memory"); \
7454} while (0)
7455
7456#define CHERI_CLWU(rd, rt, offset, cb) do { \
7457 __asm__ __volatile__ ( \
7458 ".set push\n" \
7459 ".set noreorder\n" \
7460 "clwu %0, %1, %2($c%3)\n" \
7461 ".set pop\n" \
7462 : "=r" (rd) : "r" (rt), "i" (offset), "i" (cb) : "memory"); \
7463} while (0)
7464
7465/*
7466 * Routines that modify or replace values in capability registers, and that if
7467 * if used on $ddc, require the compiler to write registers back to memory,
7468 * and reload afterwards, since we may effectively be changing the compiler-
7469 * visible address space. This is also necessary for permissions changes as
7470 * well, to ensure that write-back occurs before a possible loss of store
7471 * permission.
7472 */
7473#define CHERI_CGETPCC(v, cd) do { \
7474 if ((cd) == 0) \
7475 __asm__ __volatile__ ( \
7476 ".set push\n" \
7477 ".set noreorder\n" \
7478 "cgetpcc %0, $c%1\n" \
7479 ".set pop\n" \
7480 : "=r" (v) : "i" (cd) : "memory"); \
7481 else \
7482 __asm__ __volatile__ ( \
7483 ".set push\n" \
7484 ".set noreorder\n" \
7485 "cgetpcc %0, $c%1\n" \
7486 ".set pop\n" \
7487 : "=r" (v) : "i" (cd)); \
7488} while (0)
7489
7490#define CHERI_CINCBASE(cd, cb, v) do { \
7491 if ((cd) == 0) \
7492 __asm__ __volatile__ ( \
7493 ".set push\n" \
7494 ".set noreorder\n" \
7495 "cincbase $c%0, $c%1, %2\n" \
7496 ".set pop\n" \
7497 : : "i" (cd), "i" (cb), "r" (v) : "memory"); \
7498 else \
7499 __asm__ __volatile__ ( \
7500 ".set push\n" \
7501 ".set noreorder\n" \
7502 "cincbase $c%0, $c%1, %2\n" \
7503 ".set pop\n" \
7504 : : "i" (cd), "i" (cb), "r" (v)); \
7505} while (0)
7506
7507#define CHERI_CINCOFFSET(cd, cb, v) do { \
7508 if ((cd) == 0) \
7509 __asm__ __volatile__ ( \
7510 ".set push\n" \
7511 ".set noreorder\n" \
7512 "cincoffset $c%0, $c%1, %2\n" \
7513 ".set pop\n" \
7514 : : "i" (cd), "i" (cb), "r" (v) : "memory"); \
7515 else \
7516 __asm__ __volatile__ ( \
7517 ".set push\n" \
7518 ".set noreorder\n" \
7519 "cincoffset $c%0, $c%1, %2\n" \
7520 ".set pop\n" \
7521 : : "i" (cd), "i" (cb), "r" (v)); \
7522} while (0)
7523
7524#if (defined(CPU_CHERI) && !defined(CPU_CHERI128)) || (defined(_MIPS_SZCAP) && (_MIPS_SZCAP == 256))
7525#define CHERI_CMOVE(cd, cb) do { \
7526 if ((cd) == 0) \
7527 __asm__ __volatile__ ( \
7528 ".set push\n" \
7529 ".set noreorder\n" \
7530 "cmove $c%0, $c%1\n" \
7531 ".set pop\n" \
7532 : : "i" (cd), "i" (cb) : "memory"); \
7533 else \
7534 __asm__ __volatile__ ( \
7535 ".set push\n" \
7536 ".set noreorder\n" \
7537 "cmove $c%0, $c%1\n" \
7538 ".set pop\n" \
7539 : : "i" (cd), "i" (cb)); \
7540} while (0)
7541#else /* 128-bit CHERI */
7542# 521 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/machine/cheri.h" 3 4
7543#define CHERI_CMOVE(cd, cb) CHERI_CINCOFFSET(cd, cb, 0)
7544#endif /* 128-bit CHERI */
7545# 523 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/machine/cheri.h" 3 4
7546
7547#define CHERI_CSETDEFAULT(cb) do { \
7548 __asm__ __volatile__ ( \
7549 ".set push\n" \
7550 ".set noreorder\n" \
7551 "csetdefault %c%0\n" \
7552 ".set pop\n" \
7553 : : "i" (cb) : "memory"); \
7554} while (0)
7555
7556#define CHERI_CSETLEN(cd, cb, v) do { \
7557 if ((cd) == 0) \
7558 __asm__ __volatile__ ( \
7559 ".set push\n" \
7560 ".set noreorder\n" \
7561 "csetlen $c%0, $c%1, %2\n" \
7562 ".set pop\n" \
7563 : : "i" (cd), "i" (cb), "r" (v) : "memory"); \
7564 else \
7565 __asm__ __volatile__ ( \
7566 ".set push\n" \
7567 ".set noreorder\n" \
7568 "csetlen $c%0, $c%1, %2\n" \
7569 ".set pop\n" \
7570 : : "i" (cd), "i" (cb), "r" (v)); \
7571} while (0)
7572
7573#define CHERI_CSETOFFSET(cd, cb, v) do { \
7574 if ((cd) == 0) \
7575 __asm__ __volatile__ ( \
7576 ".set push\n" \
7577 ".set noreorder\n" \
7578 "csetoffset $c%0, $c%1, %2\n" \
7579 ".set pop\n" \
7580 : : "i" (cd), "i" (cb), "r" (v) : "memory"); \
7581 else \
7582 __asm__ __volatile__ ( \
7583 ".set push\n" \
7584 ".set noreorder\n" \
7585 "csetoffset $c%0, $c%1, %2\n" \
7586 ".set pop\n" \
7587 : : "i" (cd), "i" (cb), "r" (v)); \
7588} while (0)
7589
7590#define CHERI_CCLEARTAG(cd, cb) do { \
7591 if ((cd) == 0) \
7592 __asm__ __volatile__ ( \
7593 ".set push\n" \
7594 ".set noreorder\n" \
7595 "ccleartag $c%0, $c%1\n" \
7596 ".set pop\n" \
7597 : : "i" (cd), "i" (cb) : "memory"); \
7598 else \
7599 __asm__ __volatile__ ( \
7600 ".set push\n" \
7601 ".set noreorder\n" \
7602 "ccleartag $c%0, $c%1\n" \
7603 ".set pop\n" \
7604 : : "i" (cd), "i" (cb)); \
7605} while (0)
7606
7607#define CHERI_CANDPERM(cd, cb, v) do { \
7608 if ((cd) == 0) \
7609 __asm__ __volatile__ ( \
7610 ".set push\n" \
7611 ".set noreorder\n" \
7612 "candperm $c%0, $c%1, %2\n" \
7613 ".set pop\n" \
7614 : : "i" (cd), "i" (cb), "r" (v) : "memory"); \
7615 else \
7616 __asm__ __volatile__ ( \
7617 ".set push\n" \
7618 ".set noreorder\n" \
7619 "candperm $c%0, $c%1, %2\n" \
7620 ".set pop\n" \
7621 : : "i" (cd), "i" (cb), "r" (v)); \
7622} while (0)
7623
7624#define CHERI_CSETBOUNDS(cd, cb, v) do { \
7625 if ((cd) == 0) \
7626 __asm__ __volatile__ ( \
7627 ".set push\n" \
7628 ".set noreorder\n" \
7629 "csetbounds $c%0, $c%1, %2\n" \
7630 ".set pop\n" \
7631 : : "i" (cd), "i" (cb), "r" (v) : "memory"); \
7632 else \
7633 __asm__ __volatile__ ( \
7634 ".set push\n" \
7635 ".set noreorder\n" \
7636 "csetbounds $c%0, $c%1, %2\n" \
7637 ".set pop\n" \
7638 : : "i" (cd), "i" (cb), "r" (v)); \
7639} while (0)
7640
7641#define CHERI_CFROMPTR(cd, cb, v) do { \
7642 if ((cd) == 0) \
7643 __asm__ __volatile__ ( \
7644 ".set push\n" \
7645 ".set noreorder\n" \
7646 "cfromptr $c%0, $c%1, %2\n" \
7647 ".set pop\n" \
7648 : : "i" (cd), "i" (cb), "r" (v) : "memory"); \
7649 else \
7650 __asm__ __volatile__ ( \
7651 ".set push\n" \
7652 ".set noreorder\n" \
7653 "cfromptr $c%0, $c%1, %2\n" \
7654 ".set pop\n" \
7655 : : "i" (cd), "i" (cb), "r" (v)); \
7656} while (0)
7657
7658#define CHERI_CLC(cd, cb, regbase, offset) do { \
7659 if ((cd) == 0) \
7660 __asm__ __volatile__ ( \
7661 ".set push\n" \
7662 ".set noreorder\n" \
7663 "clc $c%0, %1, %2($c%3)\n" \
7664 ".set pop\n" \
7665 : : "i" (cd), "r" (regbase), "i" (offset), "i" (cb) \
7666 : "memory"); \
7667 else \
7668 __asm__ __volatile__ ( \
7669 ".set push\n" \
7670 ".set noreorder\n" \
7671 "clc $c%0, %1, %2($c%3)\n" \
7672 ".set pop\n" \
7673 : : "i" (cd), "r" (regbase), "i" (offset), \
7674 "i" (cb)); \
7675} while (0)
7676
7677/*
7678 * Utility functions for the kernel -- as they depend on $kdc.
7679 */
7680#ifdef _KERNEL
7681static inline void
7682cheri_capability_load(u_int crn_to, struct chericap *cp)
7683{
7684
7685 CHERI_CLC(crn_to, CHERI_CR_KDC, cp, 0);
7686}
7687
7688static inline void
7689cheri_capability_store(u_int crn_from, struct chericap *cp)
7690{
7691
7692 CHERI_CSC(crn_from, CHERI_CR_KDC, cp, 0);
7693}
7694#endif
7695# 672 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/machine/cheri.h" 3 4
7696
7697/*
7698 * Routines for measuring time -- depends on a later MIPS userspace cycle
7699 * counter.
7700 */
7701static __inline uint32_t
7702cheri_get_cyclecount(void)
7703{
7704 uint64_t _time;
7705
7706 __asm__ __volatile__ (
7707 ".set push\n"
7708 ".set noreorder\n"
7709 "rdhwr %0, $2\n"
7710 ".set pop\n"
7711 : "=r" (_time));
7712 return (_time & 0xffffffff);
7713}
7714
7715/*
7716 * Special marker NOPs recognised by analyse_trace.py to start / stop region
7717 * of interest in trace.
7718 */
7719#define CHERI_START_TRACE do { \
7720 __asm__ __volatile__("li $0, 0xbeef"); \
7721} while(0)
7722#define CHERI_STOP_TRACE do { \
7723 __asm__ __volatile__("li $0, 0xdead"); \
7724} while(0)
7725
7726#ifdef _KERNEL
7727#define CHERI_CAP_PRINT(crn) do { \
7728 uintmax_t c_perms, c_otype, c_base, c_length, c_offset; \
7729 u_int ctag, c_sealed; \
7730 \
7731 CHERI_CGETTAG(ctag, (crn)); \
7732 CHERI_CGETSEALED(c_sealed, (crn)); \
7733 CHERI_CGETPERM(c_perms, (crn)); \
7734 CHERI_CGETTYPE(c_otype, (crn)); \
7735 CHERI_CGETBASE(c_base, (crn)); \
7736 CHERI_CGETLEN(c_length, (crn)); \
7737 CHERI_CGETOFFSET(c_offset, (crn)); \
7738 printf("v:%u s:%u p:%08jx b:%016jx l:%016jx o:%jx t:%jx\n", \
7739 ctag, c_sealed, c_perms, c_base, c_length, c_offset, \
7740 c_otype); \
7741} while (0)
7742
7743#define CHERI_REG_PRINT(crn, num) do { \
7744 printf("$c%02u: ", num); \
7745 CHERI_CAP_PRINT(crn); \
7746} while (0)
7747
7748static inline void
7749cheri_capability_print(struct chericap *cp)
7750{
7751 CHERI_CLC(CHERI_CR_CTEMP0, CHERI_CR_KDC, cp, 0);
7752 CHERI_CAP_PRINT(CHERI_CR_CTEMP0);
7753}
7754
7755#ifdef DDB
7756#define DB_CHERI_CAP_PRINT(crn) do { \
7757 uintmax_t c_perms, c_otype, c_base, c_length, c_offset; \
7758 u_int ctag, c_sealed; \
7759 \
7760 CHERI_CGETTAG(ctag, (crn)); \
7761 CHERI_CGETSEALED(c_sealed, (crn)); \
7762 CHERI_CGETPERM(c_perms, (crn)); \
7763 CHERI_CGETTYPE(c_otype, (crn)); \
7764 CHERI_CGETBASE(c_base, (crn)); \
7765 CHERI_CGETLEN(c_length, (crn)); \
7766 CHERI_CGETOFFSET(c_offset, (crn)); \
7767 db_printf("v:%u s:%u p:%08jx b:%016jx l:%016jx o:%jx t:%jx\n", \
7768 ctag, c_sealed, c_perms, c_base, c_length, c_offset, \
7769 c_otype); \
7770} while (0)
7771
7772#define DB_CHERI_REG_PRINT(crn, num) do { \
7773 db_printf("$c%02u: ", num); \
7774 DB_CHERI_CAP_PRINT(crn); \
7775} while (0)
7776#endif /* !DDB */
7777# 753 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/machine/cheri.h" 3 4
7778#endif /* !_KERNEL */
7779# 754 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/machine/cheri.h" 3 4
7780
7781#endif /* _MIPS_INCLUDE_CHERI_H_ */
7782# 756 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/machine/cheri.h" 3 4
7783# 229 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/cheri/cheri.h" 2 3 4
7784
7785#endif /* _SYS_CHERI_H_ */
7786# 231 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/cheri/cheri.h" 3 4
7787# 46 "/home/alr48/cheri/sources/cheribsd/bin/cheritest/cheritest_registers.c" 2
7788#if 0 /* expanded by -frewrite-includes */
7789#include <cheri/cheric.h>
7790#endif /* expanded by -frewrite-includes */
7791# 46 "/home/alr48/cheri/sources/cheribsd/bin/cheritest/cheritest_registers.c"
7792# 1 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/cheri/cheric.h" 1 3 4
7793/*-
7794 * Copyright (c) 2013-2016 Robert N. M. Watson
7795 * All rights reserved.
7796 *
7797 * This software was developed by SRI International and the University of
7798 * Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237)
7799 * ("CTSRD"), as part of the DARPA CRASH research programme.
7800 *
7801 * Redistribution and use in source and binary forms, with or without
7802 * modification, are permitted provided that the following conditions
7803 * are met:
7804 * 1. Redistributions of source code must retain the above copyright
7805 * notice, this list of conditions and the following disclaimer.
7806 * 2. Redistributions in binary form must reproduce the above copyright
7807 * notice, this list of conditions and the following disclaimer in the
7808 * documentation and/or other materials provided with the distribution.
7809 *
7810 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
7811 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
7812 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
7813 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
7814 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
7815 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
7816 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
7817 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
7818 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
7819 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
7820 * SUCH DAMAGE.
7821 */
7822
7823#ifndef _SYS_CHERIC_H_
7824#define _SYS_CHERIC_H_
7825
7826#if 0 /* expanded by -frewrite-includes */
7827#include <sys/cdefs.h>
7828#endif /* expanded by -frewrite-includes */
7829# 34 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/cheri/cheric.h" 3 4
7830# 35 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/cheri/cheric.h" 3 4
7831#if 0 /* expanded by -frewrite-includes */
7832#include <sys/types.h>
7833#endif /* expanded by -frewrite-includes */
7834# 35 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/cheri/cheric.h" 3 4
7835# 36 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/cheri/cheric.h" 3 4
7836
7837#if 0 /* expanded by -frewrite-includes */
7838#include <machine/cherireg.h> /* Permission definitions. */
7839#endif /* expanded by -frewrite-includes */
7840# 37 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/cheri/cheric.h" 3 4
7841# 38 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/cheri/cheric.h" 3 4
7842
7843#if !defined(_KERNEL) && __has_feature(capabilities)
7844/*
7845 * Programmer-friendly macros for CHERI-aware C code -- requires use of
7846 * CHERI-aware Clang/LLVM, and full capability context switching, so not yet
7847 * usable in the kernel.
7848 */
7849#define cheri_getlen(x) __builtin_cheri_get_cap_length( \
7850 __DECONST(__capability void *, (x)))
7851#define cheri_getbase(x) __builtin_cheri_get_cap_base( \
7852 __DECONST(__capability void *, (x)))
7853#define cheri_getoffset(x) __builtin_cheri_cap_offset_get( \
7854 __DECONST(__capability void *, (x)))
7855#define cheri_getperm(x) __builtin_cheri_get_cap_perms( \
7856 __DECONST(__capability void *, (x)))
7857#define cheri_getsealed(x) __builtin_cheri_get_cap_sealed( \
7858 __DECONST(__capability void *, (x)))
7859#define cheri_gettag(x) __builtin_cheri_get_cap_tag( \
7860 __DECONST(__capability void *, (x)))
7861#define cheri_gettype(x) __builtin_cheri_get_cap_type( \
7862 __DECONST(__capability void *, (x)))
7863
7864#define cheri_andperm(x, y) __builtin_cheri_and_cap_perms( \
7865 __DECONST(__capability void *, (x)), (y))
7866#define cheri_cleartag(x) __builtin_cheri_clear_cap_tag( \
7867 __DECONST(__capability void *, (x)))
7868#define cheri_incoffset(x, y) __builtin_cheri_cap_offset_increment( \
7869 __DECONST(__capability void *, (x)), (y))
7870#define cheri_setoffset(x, y) __builtin_cheri_cap_offset_set( \
7871 __DECONST(__capability void *, (x)), (y))
7872
7873#define cheri_seal(x, y) __builtin_cheri_seal_cap( \
7874 __DECONST(__capability void *, (x)), \
7875 __DECONST(__capability void *, (y)))
7876#define cheri_unseal(x, y) __builtin_cheri_unseal_cap( \
7877 __DECONST(__capability void *, (x)), \
7878 __DECONST(__capability void *, (y)))
7879
7880#define cheri_getcause() __builtin_cheri_get_cause()
7881#define cheri_setcause(x) __builtin_cheri_set_cause(x)
7882
7883#define cheri_ccheckperm(c, p) __builtin_cheri_check_perms( \
7884 __DECONST(__capability void *, (c)), (p))
7885#define cheri_cchecktype(c, t) __builtin_cheri_check_type( \
7886 __DECONST(__capability void *, (c)), (t))
7887
7888#define cheri_getdefault() __builtin_cheri_get_global_data_cap()
7889#define cheri_getidc() __builtin_cheri_get_invoke_data_cap()
7890#define cheri_getkr0c() __builtin_cheri_get_kernel_cap1()
7891#define cheri_getkr1c() __builtin_cheri_get_kernel_cap2()
7892#define cheri_getkcc() __builtin_cheri_get_kernel_code_cap()
7893#define cheri_getkdc() __builtin_cheri_get_kernel_data_cap()
7894#define cheri_getepcc() __builtin_cheri_get_exception_program_counter_cap()
7895#define cheri_getpcc() __builtin_cheri_get_program_counter_cap()
7896#define cheri_getstack() __builtin_memcap_stack_get()
7897
7898#define cheri_local(c) cheri_andperm((c), ~CHERI_PERM_GLOBAL)
7899
7900#define cheri_csetbounds(x, y) __builtin_memcap_bounds_set( \
7901 __DECONST(__capability void *, (x)), (y))
7902
7903/*
7904 * Two variations on cheri_ptr() based on whether we are looking for a code or
7905 * data capability. The compiler's use of CFromPtr will be with respect to
7906 * $ddc or $pcc depending on the type of the pointer derived, so we need to
7907 * use types to differentiate the two versions at compile time. We don't
7908 * provide the full set of function variations for code pointers as they
7909 * haven't proven necessary as yet.
7910 *
7911 * XXXRW: Ideally, casting via a function pointer would cause the compiler to
7912 * derive the capability using CFromPtr on $pcc rather than on $ddc. This
7913 * appears not currently to be the case, so manually derive using
7914 * cheri_getpcc() for now.
7915 */
7916static __inline __capability void *
7917cheri_codeptr(const void *ptr, size_t len)
7918{
7919#ifdef NOTYET
7920 __capability void (*c)(void) = ptr;
7921#else
7922# 118 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/cheri/cheric.h" 3 4
7923 __capability void *c = cheri_setoffset(cheri_getpcc(),
7924 (vaddr_t)ptr);
7925#endif
7926# 121 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/cheri/cheric.h" 3 4
7927
7928 /* Assume CFromPtr without base set, availability of CSetBounds. */
7929 return (cheri_csetbounds(c, len));
7930}
7931
7932static __inline __capability void *
7933cheri_codeptrperm(const void *ptr, size_t len, register_t perm)
7934{
7935
7936 return (cheri_andperm(cheri_codeptr(ptr, len),
7937 perm | CHERI_PERM_GLOBAL));
7938}
7939
7940static __inline __capability void *
7941cheri_ptr(const void *ptr, size_t len)
7942{
7943
7944 /* Assume CFromPtr without base set, availability of CSetBounds. */
7945 return (cheri_csetbounds((const __capability void *)ptr, len));
7946}
7947
7948static __inline __capability void *
7949cheri_ptrperm(const void *ptr, size_t len, register_t perm)
7950{
7951
7952 return (cheri_andperm(cheri_ptr(ptr, len), perm | CHERI_PERM_GLOBAL));
7953}
7954
7955static __inline __capability void *
7956cheri_ptrpermoff(const void *ptr, size_t len, register_t perm, off_t off)
7957{
7958
7959 return (cheri_setoffset(cheri_ptrperm(ptr, len, perm), off));
7960}
7961
7962/*
7963 * Construct a capability suitable to describe a type identified by 'ptr';
7964 * set it to zero-length with the offset equal to the base. The caller must
7965 * provide a root capability (in the old world order, derived from $ddc, but
7966 * in the new world order, likely extracted from the kernel using sysarch(2)).
7967 *
7968 * The caller may wish to assert various properties about the returned
7969 * capability, including that CHERI_PERM_SEAL is set.
7970 */
7971static __inline __capability void *
7972cheri_maketype(__capability void *root_type, register_t type)
7973{
7974 __capability void *c;
7975
7976 c = root_type;
7977 c = cheri_setoffset(c, type); /* Set type as desired. */
7978 c = cheri_csetbounds(c, 1); /* ISA implies length of 1. */
7979 c = cheri_andperm(c, CHERI_PERM_GLOBAL | CHERI_PERM_SEAL); /* Perms. */
7980 return (c);
7981}
7982
7983static __inline __capability void *
7984cheri_zerocap(void)
7985{
7986 return (__capability void *)0;
7987}
7988
7989#define CHERI_PRINT_PTR(ptr) \
7990 printf("%s: " #ptr " b:%016jx l:%016zx o:%jx\n", __func__, \
7991 cheri_getbase((const __capability void *)(ptr)), \
7992 cheri_getlen((const __capability void *)(ptr)), \
7993 cheri_getoffset((const __capability void *)(ptr)))
7994#endif
7995# 189 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/cheri/cheric.h" 3 4
7996
7997#if 0 /* expanded by -frewrite-includes */
7998#include <machine/cheric.h>
7999#endif /* expanded by -frewrite-includes */
8000# 190 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/cheri/cheric.h" 3 4
8001# 1 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/machine/cheric.h" 1 3 4
8002/*-
8003 * Copyright (c) 2013-2016 Robert N. M. Watson
8004 * All rights reserved.
8005 *
8006 * This software was developed by SRI International and the University of
8007 * Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237)
8008 * ("CTSRD"), as part of the DARPA CRASH research programme.
8009 *
8010 * Redistribution and use in source and binary forms, with or without
8011 * modification, are permitted provided that the following conditions
8012 * are met:
8013 * 1. Redistributions of source code must retain the above copyright
8014 * notice, this list of conditions and the following disclaimer.
8015 * 2. Redistributions in binary form must reproduce the above copyright
8016 * notice, this list of conditions and the following disclaimer in the
8017 * documentation and/or other materials provided with the distribution.
8018 *
8019 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
8020 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
8021 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
8022 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
8023 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
8024 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
8025 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
8026 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
8027 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
8028 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
8029 * SUCH DAMAGE.
8030 */
8031
8032#ifndef _MIPS_INCLUDE_CHERIC_H_
8033#define _MIPS_INCLUDE_CHERIC_H_
8034
8035#if 0 /* expanded by -frewrite-includes */
8036#include <sys/cdefs.h>
8037#endif /* expanded by -frewrite-includes */
8038# 34 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/machine/cheric.h" 3 4
8039# 35 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/machine/cheric.h" 3 4
8040
8041#if 0 /* expanded by -frewrite-includes */
8042#include <cheri/cheri.h>
8043#endif /* expanded by -frewrite-includes */
8044# 36 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/machine/cheric.h" 3 4
8045# 37 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/machine/cheric.h" 3 4
8046
8047#if !defined(_KERNEL) && __has_feature(capabilities)
8048#define cheri_getreg(x) ({ \
8049 __capability void *_cap; \
8050 __asm __volatile ("cmove %0, $c" #x : "=C" (_cap)); \
8051 _cap; \
8052})
8053
8054#define cheri_setreg(x, cap) do { \
8055 if ((x) == 0) \
8056 __asm __volatile ("cmove $c" #x ", %0" : : "C" (cap) : \
8057 "memory"); \
8058 else \
8059 __asm __volatile ("cmove $c" #x ", %0" : : "C" (cap)); \
8060} while (0)
8061#endif
8062# 53 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/machine/cheric.h" 3 4
8063
8064#endif /* _MIPS_INCLUDE_CHERIC_H_ */
8065# 55 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/machine/cheric.h" 3 4
8066# 191 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/cheri/cheric.h" 2 3 4
8067
8068#endif /* _SYS_CHERIC_H_ */
8069# 193 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/cheri/cheric.h" 3 4
8070# 47 "/home/alr48/cheri/sources/cheribsd/bin/cheritest/cheritest_registers.c" 2
8071#if 0 /* expanded by -frewrite-includes */
8072#include <cheri/cheri_fd.h>
8073#endif /* expanded by -frewrite-includes */
8074# 47 "/home/alr48/cheri/sources/cheribsd/bin/cheritest/cheritest_registers.c"
8075# 1 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/cheri/cheri_fd.h" 1 3 4
8076/*-
8077 * Copyright (c) 2014-2015 Robert N. M. Watson
8078 * All rights reserved.
8079 *
8080 * This software was developed by SRI International and the University of
8081 * Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237)
8082 * ("CTSRD"), as part of the DARPA CRASH research programme.
8083 *
8084 * Redistribution and use in source and binary forms, with or without
8085 * modification, are permitted provided that the following conditions
8086 * are met:
8087 * 1. Redistributions of source code must retain the above copyright
8088 * notice, this list of conditions and the following disclaimer.
8089 * 2. Redistributions in binary form must reproduce the above copyright
8090 * notice, this list of conditions and the following disclaimer in the
8091 * documentation and/or other materials provided with the distribution.
8092 *
8093 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
8094 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
8095 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
8096 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
8097 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
8098 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
8099 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
8100 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
8101 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
8102 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
8103 * SUCH DAMAGE.
8104 */
8105
8106#ifndef _CHERI_FD_H_
8107#define _CHERI_FD_H_
8108
8109extern __capability vm_offset_t *cheri_fd_vtable;
8110
8111extern struct cheri_object cheri_fd;
8112#ifdef CHERI_FD_INTERNAL
8113#define CHERI_FD_CCALL \
8114 __attribute__((cheri_ccallee)) \
8115 __attribute__((cheri_method_suffix("_c"))) \
8116 __attribute__((cheri_method_class(cheri_fd)))
8117#else
8118# 43 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/cheri/cheri_fd.h" 3 4
8119#define CHERI_FD_CCALL \
8120 __attribute__((cheri_ccall)) \
8121 __attribute__((cheri_method_suffix("_c"))) \
8122 __attribute__((cheri_method_class(cheri_fd)))
8123#endif
8124# 48 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/cheri/cheri_fd.h" 3 4
8125
8126
8127/*
8128 * Interfaces to create/revoke/destroy cheri_fd objects with ambient
8129 * authority.
8130 */
8131int cheri_fd_new(int fd, struct cheri_object *cop);
8132void cheri_fd_revoke(struct cheri_object co);
8133void cheri_fd_destroy(struct cheri_object co);
8134
8135/*
8136 * All methods return the following structure, which fits in register return
8137 * values for the calling convention. In practice, retval0 is what we think
8138 * of as the normal return value for each method; retval1 holds an errno value
8139 * if retval0 == -1. This is near-identical to the semantics of the kernel's
8140 * td_retval[0,1].
8141 */
8142struct cheri_fd_ret {
8143 register_t cfr_retval0; /* Actual return value. */
8144 register_t cfr_retval1; /* errno if cfr_retval0 == -1. */
8145};
8146
8147/*
8148 * Methods that can be invoked on cheri_fd objects regardless of ambient
8149 * authority.
8150 */
8151struct stat;
8152CHERI_FD_CCALL
8153struct cheri_fd_ret cheri_fd_fstat(__capability struct stat *sb_c);
8154CHERI_FD_CCALL
8155struct cheri_fd_ret cheri_fd_lseek(off_t offset, int whence);
8156CHERI_FD_CCALL
8157struct cheri_fd_ret cheri_fd_read(__capability void *buf_c,
8158 size_t nbytes);
8159CHERI_FD_CCALL
8160struct cheri_fd_ret cheri_fd_write(__capability const void *buf_c,
8161 size_t nbytes);
8162
8163#endif /* !_CHERI_FD_H_ */
8164# 87 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/cheri/cheri_fd.h" 3 4
8165# 48 "/home/alr48/cheri/sources/cheribsd/bin/cheritest/cheritest_registers.c" 2
8166#if 0 /* expanded by -frewrite-includes */
8167#include <cheri/sandbox.h>
8168#endif /* expanded by -frewrite-includes */
8169# 48 "/home/alr48/cheri/sources/cheribsd/bin/cheritest/cheritest_registers.c"
8170# 1 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/cheri/sandbox.h" 1 3 4
8171/*-
8172 * Copyright (c) 2012-2015 Robert N. M. Watson
8173 * Copyright (c) 2015 SRI International
8174 * All rights reserved.
8175 *
8176 * This software was developed by SRI International and the University of
8177 * Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237)
8178 * ("CTSRD"), as part of the DARPA CRASH research programme.
8179 *
8180 * Redistribution and use in source and binary forms, with or without
8181 * modification, are permitted provided that the following conditions
8182 * are met:
8183 * 1. Redistributions of source code must retain the above copyright
8184 * notice, this list of conditions and the following disclaimer.
8185 * 2. Redistributions in binary form must reproduce the above copyright
8186 * notice, this list of conditions and the following disclaimer in the
8187 * documentation and/or other materials provided with the distribution.
8188 *
8189 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
8190 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
8191 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
8192 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
8193 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
8194 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
8195 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
8196 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
8197 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
8198 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
8199 * SUCH DAMAGE.
8200 */
8201
8202#ifndef _SANDBOX_H_
8203#define _SANDBOX_H_
8204
8205/*
8206 * This section defines the interface between 'inside' and 'outside' the
8207 * sandbox model.
8208 */
8209
8210/*
8211 * Per-sandbox meta-data structure mapped read-only within the sandbox at a
8212 * fixed address to allow sandboxed code to find its stack, heap, etc.
8213 *
8214 * NB: This data structure (and its base address) are part of the ABI between
8215 * libcheri and programs running in sandboxes. Only ever append to this,
8216 * don't modify the order, lengths, or interpretations of existing fields. If
8217 * this reaches a page in size, then allocation code in sandbox.c will need
8218 * updating. See also sandbox.c and sandboxasm.h.
8219 */
8220struct sandbox_metadata {
8221 register_t sbm_heapbase; /* Offset: 0 */
8222 register_t sbm_heaplen; /* Offset: 8 */
8223 uint64_t _sbm_reserved0; /* Offset: 16 */
8224 uint64_t _sbm_reserved1; /* Offset: 24 */
8225 struct cheri_object sbm_system_object; /* Offset: 32 */
8226#if __has_feature(capabilities)
8227 __capability vm_offset_t *sbm_vtable; /* Cap-offset: 2 */
8228 __capability void *sbm_stackcap; /* Cap-offset: 3 */
8229#else
8230# 60 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/cheri/sandbox.h" 3 4
8231 struct chericap sbm_vtable;
8232 struct chericap sbm_stackcap;
8233#endif
8234# 63 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/cheri/sandbox.h" 3 4
8235};
8236
8237/*
8238 * This section defines interfaces for setting up, invoking, resetting, and
8239 * destroying sandbox classes and objects.
8240 */
8241
8242extern int sb_verbose;
8243
8244/**
8245 * The CHERI error number variable. If the stack is forcibly unwound as the
8246 * result of signal delivery during a ccall invocation, this will be set to the
8247 * signal number of the signal inside the sandbox. If a ccall invocation
8248 * returns normally then this value is unmodified.
8249 */
8250extern _Thread_local int cherierrno;
8251
8252struct sandbox_class;
8253int sandbox_class_new(const char *path, size_t maxmapsize,
8254 struct sandbox_class **sbcpp);
8255int sandbox_class_method_declare(struct sandbox_class *sbcp,
8256 u_int methodnum, const char *methodname);
8257void sandbox_class_destroy(struct sandbox_class *sbcp);
8258int sandbox_class_method_get_number(struct sandbox_class *sbcp,
8259 const char *name);
8260
8261struct sandbox_object;
8262int sandbox_object_new(struct sandbox_class *sbcp, size_t heaplen,
8263 struct sandbox_object **sbopp);
8264int sandbox_object_new_flags(struct sandbox_class *sbcp, size_t heaplen,
8265 uint flags, struct sandbox_object **sbopp);
8266/**
8267 * Reset the stack of a sandbox. This is a temporary API until libcheri
8268 * becomes responsible for managing a pool of stacks.
8269 */
8270int sandbox_object_stack_reset(struct sandbox_object *sbop);
8271int sandbox_object_reset(struct sandbox_object *sbop);
8272#if __has_feature(capabilities)
8273register_t sandbox_object_cinvoke(struct sandbox_object *sbop,
8274 register_t methodnum, register_t a1,
8275 register_t a2, register_t a3, register_t a4,
8276 register_t a5, register_t a6, register_t a7,
8277 __capability void *c3, __capability void *c4,
8278 __capability void *c5, __capability void *c6,
8279 __capability void *c7, __capability void *c8,
8280 __capability void *c9, __capability void *c10);
8281#endif
8282# 110 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/cheri/sandbox.h" 3 4
8283register_t sandbox_object_invoke(struct sandbox_object *sbop,
8284 register_t methodnum, register_t a1,
8285 register_t a2, register_t a3, register_t a4,
8286 register_t a5, register_t a6, register_t a7,
8287 struct chericap *c3p, struct chericap *c4p,
8288 struct chericap *c5p, struct chericap *c6p,
8289 struct chericap *c7p, struct chericap *c8p,
8290 struct chericap *c9p, struct chericap *c10p);
8291void sandbox_object_destroy(struct sandbox_object *sbop);
8292
8293/*
8294 * Flags for sandbox_object_new_flags():
8295 */
8296#define SANDBOX_OBJECT_FLAG_CONSOLE 0x00000001 /* printf(), etc. */
8297#define SANDBOX_OBJECT_FLAG_ALLOCFREE 0x00000002 /* calloc(), free(). */
8298#define SANDBOX_OBJECT_FLAG_USERFN 0x00000004 /* User callbacks. */
8299
8300/*
8301 * API to query the object-capability pair for the sandbox itself
8302 */
8303struct cheri_object sandbox_object_getobject(struct sandbox_object *sbop);
8304
8305#if __has_feature(capabilities)
8306/**
8307 * Get the sandbox's global data capability.
8308 */
8309__capability void *
8310sandbox_object_getsandboxdata(struct sandbox_object *sbop);
8311
8312/**
8313 * Get the sandbox's stack. This is a temporary API and should go away once
8314 * libcheri is responsible for managing a pool of stacks and clearing them.
8315 */
8316__capability void *
8317sandbox_object_getsandboxstack(struct sandbox_object *sbop);
8318#endif
8319# 146 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/cheri/sandbox.h" 3 4
8320
8321/*
8322 * API to query system capabilities for use by sandboxes.
8323 */
8324struct cheri_object sandbox_object_getsystemobject(
8325 struct sandbox_object *sbop);
8326
8327#endif /* !_SANDBOX_H_ */
8328# 154 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/cheri/sandbox.h" 3 4
8329# 49 "/home/alr48/cheri/sources/cheribsd/bin/cheritest/cheritest_registers.c" 2
8330
8331#if 0 /* expanded by -frewrite-includes */
8332#include <cheritest-helper.h>
8333#endif /* expanded by -frewrite-includes */
8334# 50 "/home/alr48/cheri/sources/cheribsd/bin/cheritest/cheritest_registers.c"
8335# 1 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/cheritest-helper.h" 1 3 4
8336/*-
8337 * Copyright (c) 2013-2016 Robert N. M. Watson
8338 * Copyright (c) 2014-2015 SRI International
8339 * All rights reserved.
8340 *
8341 * This software was developed by SRI International and the University of
8342 * Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237)
8343 * ("CTSRD"), as part of the DARPA CRASH research programme.
8344 *
8345 * Redistribution and use in source and binary forms, with or without
8346 * modification, are permitted provided that the following conditions
8347 * are met:
8348 * 1. Redistributions of source code must retain the above copyright
8349 * notice, this list of conditions and the following disclaimer.
8350 * 2. Redistributions in binary form must reproduce the above copyright
8351 * notice, this list of conditions and the following disclaimer in the
8352 * documentation and/or other materials provided with the distribution.
8353 *
8354 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
8355 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
8356 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
8357 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
8358 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
8359 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
8360 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
8361 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
8362 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
8363 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
8364 * SUCH DAMAGE.
8365 */
8366
8367#ifndef _LIBEXEC_CHERITEST_CHERITEST_HELPER_H_
8368#define _LIBEXEC_CHERITEST_CHERITEST_HELPER_H_
8369
8370#define CHERITEST_HELPER_CAP_FAULT_CP2_BOUND 1
8371#define CHERITEST_HELPER_CAP_FAULT_CP2_PERM_LOAD 2
8372#define CHERITEST_HELPER_CAP_FAULT_CP2_PERM_STORE 3
8373#define CHERITEST_HELPER_CAP_FAULT_CP2_TAG 4
8374#define CHERITEST_HELPER_CAP_FAULT_CP2_SEAL 5
8375
8376#define CHERITEST_HELPER_VM_FAULT_RFAULT 1
8377#define CHERITEST_HELPER_VM_FAULT_WFAULT 2
8378#define CHERITEST_HELPER_VM_FAULT_XFAULT 3
8379
8380/*
8381 * We use system-class extensions to allow cheritest-helper code to call back
8382 * into cheritest to exercise various cases (e.g., stack-related tests).
8383 * These are the corresponding method numbers.
8384 */
8385#define CHERITEST_USERFN_RETURNARG (CHERI_SYSTEM_USER_BASE)
8386#define CHERITEST_USERFN_GETSTACK (CHERI_SYSTEM_USER_BASE + 1)
8387#define CHERITEST_USERFN_SETSTACK (CHERI_SYSTEM_USER_BASE + 2)
8388
8389/*
8390 * Constants used to test BSS, .data, and constructor-based variable
8391 * initialisation in sandboxes.
8392 */
8393#define CHERITEST_VALUE_BSS 0x00 /* Of course. */
8394#define CHERITEST_VALUE_DATA 0xaa
8395#define CHERITEST_VALUE_INVALID 0xbb
8396#define CHERITEST_VALUE_CONSTRUCTOR 0xcc
8397
8398
8399#ifdef LIST_ONLY
8400#define CHERITEST_CCALL
8401#define CHERITEST_CCALL2
8402#define BEGIN_CAPABILITIES
8403#define END_CAPABILITIES
8404#else
8405# 70 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/cheritest-helper.h" 3 4
8406#if __has_feature(pointer_interpretation)
8407#define BEGIN_CAPABILITIES \
8408 _Pragma("pointer_interpretation push") \
8409 _Pragma("pointer_interpretation capability")
8410#define END_CAPABILITIES \
8411 _Pragma("pointer_interpretation pop")
8412#else
8413# 77 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/cheritest-helper.h" 3 4
8414#error Compiler does not support capabilities.
8415#endif
8416# 79 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/cheritest-helper.h" 3 4
8417extern struct cheri_object cheritest;
8418#ifdef CHERITEST_INTERNAL
8419#define CHERITEST_CCALL \
8420 __attribute__((cheri_ccallee)) \
8421 __attribute__((cheri_method_class(cheritest)))
8422#else
8423# 85 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/cheritest-helper.h" 3 4
8424#define CHERITEST_CCALL \
8425 __attribute__((cheri_ccall)) \
8426 __attribute__((cheri_method_suffix("_cap"))) \
8427 __attribute__((cheri_method_class(cheritest)))
8428#endif
8429# 90 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/cheritest-helper.h" 3 4
8430extern struct cheri_object cheritest2;
8431#ifdef CHERITEST_INTERNAL
8432#define CHERITEST_CCALL2 \
8433 __attribute__((cheri_ccallee)) \
8434 __attribute__((cheri_method_class(cheritest2)))
8435#else
8436# 96 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/cheritest-helper.h" 3 4
8437#define CHERITEST_CCALL2 \
8438 __attribute__((cheri_ccall)) \
8439 __attribute__((cheri_method_suffix("_cap"))) \
8440 __attribute__((cheri_method_class(cheritest2)))
8441#endif
8442# 101 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/cheritest-helper.h" 3 4
8443#endif
8444# 102 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/cheritest-helper.h" 3 4
8445
8446struct cheri_object;
8447
8448BEGIN_CAPABILITIES
8449CHERITEST_CCALL int invoke_divzero(void);
8450CHERITEST_CCALL int invoke_cheri_system_helloworld(void);
8451CHERITEST_CCALL int invoke_cheri_system_puts(void);
8452CHERITEST_CCALL int invoke_cheri_system_putchar(void);
8453CHERITEST_CCALL int invoke_cheri_system_printf(void);
8454
8455CHERITEST_CCALL int invoke_abort(void);
8456CHERITEST_CCALL int invoke_md5(size_t len, char *data_input,
8457 char *data_output);
8458CHERITEST_CCALL int invoke_cap_fault(register_t op);
8459CHERITEST_CCALL int invoke_vm_fault(register_t op);
8460CHERITEST_CCALL int invoke_syscall(void);
8461CHERITEST_CCALL int invoke_fd_fstat_c(struct cheri_object fd_object);
8462CHERITEST_CCALL int invoke_fd_lseek_c(struct cheri_object fd_object);
8463CHERITEST_CCALL int invoke_fd_read_c(struct cheri_object fd_object,
8464 void *buf, size_t nbytes);
8465CHERITEST_CCALL int invoke_fd_write_c(struct cheri_object fd_object,
8466 char *arg, size_t nbytes);
8467CHERITEST_CCALL int invoke_malloc(void);
8468CHERITEST_CCALL int invoke_system_calloc(void);
8469CHERITEST_CCALL int invoke_clock_gettime(void);
8470CHERITEST_CCALL int invoke_libcheri_userfn(register_t arg, size_t len);
8471CHERITEST_CCALL int invoke_libcheri_userfn_setstack(register_t arg);
8472CHERITEST_CCALL int invoke_libcheri_save_capability_in_heap(
8473 void *data_input);
8474
8475CHERITEST_CCALL register_t invoke_store_capability_in_bss(void *);
8476CHERITEST_CCALL register_t invoke_store_local_capability_in_bss(void *);
8477CHERITEST_CCALL register_t invoke_store_capability_in_stack(void *);
8478CHERITEST_CCALL register_t invoke_store_local_capability_in_stack(void *);
8479CHERITEST_CCALL void *invoke_return_capability(void *);
8480CHERITEST_CCALL void *invoke_return_local_capability(void *);
8481
8482CHERITEST_CCALL register_t invoke_get_var_bss(void);
8483CHERITEST_CCALL register_t invoke_get_var_data(void);
8484CHERITEST_CCALL register_t invoke_set_var_data(register_t v);
8485CHERITEST_CCALL register_t invoke_get_var_constructor(void);
8486struct zstream_proxy;
8487CHERITEST_CCALL register_t invoke_inflate(struct zstream_proxy *zspp);
8488CHERITEST_CCALL register_t invoke_spin(void);
8489
8490/* Test calling with a different default object */
8491CHERITEST_CCALL2 int call_invoke_md5(size_t len, char *data_input,
8492 char *data_output);
8493
8494CHERITEST_CCALL int sandbox_test_ptrdiff(void);
8495CHERITEST_CCALL int sandbox_test_varargs(void);
8496CHERITEST_CCALL int sandbox_test_va_copy(void);
8497END_CAPABILITIES
8498
8499#endif /* !_LIBEXEC_CHERITEST_CHERITEST_HELPER_H_ */
8500# 157 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/cheritest-helper.h" 3 4
8501# 51 "/home/alr48/cheri/sources/cheribsd/bin/cheritest/cheritest_registers.c" 2
8502#if 0 /* expanded by -frewrite-includes */
8503#include <err.h>
8504#endif /* expanded by -frewrite-includes */
8505# 51 "/home/alr48/cheri/sources/cheribsd/bin/cheritest/cheritest_registers.c"
8506# 1 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/err.h" 1 3 4
8507/*-
8508 * Copyright (c) 1993
8509 * The Regents of the University of California. All rights reserved.
8510 *
8511 * Redistribution and use in source and binary forms, with or without
8512 * modification, are permitted provided that the following conditions
8513 * are met:
8514 * 1. Redistributions of source code must retain the above copyright
8515 * notice, this list of conditions and the following disclaimer.
8516 * 2. Redistributions in binary form must reproduce the above copyright
8517 * notice, this list of conditions and the following disclaimer in the
8518 * documentation and/or other materials provided with the distribution.
8519 * 3. Neither the name of the University nor the names of its contributors
8520 * may be used to endorse or promote products derived from this software
8521 * without specific prior written permission.
8522 *
8523 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
8524 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
8525 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
8526 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
8527 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
8528 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
8529 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
8530 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
8531 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
8532 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
8533 * SUCH DAMAGE.
8534 *
8535 * @(#)err.h 8.1 (Berkeley) 6/2/93
8536 * $FreeBSD$
8537 */
8538
8539#ifndef _ERR_H_
8540#define _ERR_H_
8541
8542/*
8543 * Don't use va_list in the err/warn prototypes. Va_list is typedef'd in two
8544 * places (<machine/varargs.h> and <machine/stdarg.h>), so if we include one
8545 * of them here we may collide with the utility's includes. It's unreasonable
8546 * for utilities to have to include one of them to include err.h, so we get
8547 * __va_list from <sys/_types.h> and use it.
8548 */
8549#if 0 /* expanded by -frewrite-includes */
8550#include <sys/cdefs.h>
8551#endif /* expanded by -frewrite-includes */
8552# 43 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/err.h" 3 4
8553# 44 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/err.h" 3 4
8554#if 0 /* expanded by -frewrite-includes */
8555#include <sys/_types.h>
8556#endif /* expanded by -frewrite-includes */
8557# 44 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/err.h" 3 4
8558# 45 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/err.h" 3 4
8559
8560__BEGIN_DECLS
8561void err(int, const char *, ...) __dead2 __printf0like(2, 3);
8562void verr(int, const char *, __va_list) __dead2 __printf0like(2, 0);
8563void errc(int, int, const char *, ...) __dead2 __printf0like(3, 4);
8564void verrc(int, int, const char *, __va_list) __dead2
8565 __printf0like(3, 0);
8566void errx(int, const char *, ...) __dead2 __printf0like(2, 3);
8567void verrx(int, const char *, __va_list) __dead2 __printf0like(2, 0);
8568void warn(const char *, ...) __printf0like(1, 2);
8569void vwarn(const char *, __va_list) __printf0like(1, 0);
8570void warnc(int, const char *, ...) __printf0like(2, 3);
8571void vwarnc(int, const char *, __va_list) __printf0like(2, 0);
8572void warnx(const char *, ...) __printflike(1, 2);
8573void vwarnx(const char *, __va_list) __printflike(1, 0);
8574void err_set_file(void *);
8575void err_set_exit(void (*)(int));
8576__END_DECLS
8577
8578#endif /* !_ERR_H_ */
8579# 65 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/err.h" 3 4
8580# 52 "/home/alr48/cheri/sources/cheribsd/bin/cheritest/cheritest_registers.c" 2
8581#if 0 /* expanded by -frewrite-includes */
8582#include <fcntl.h>
8583#endif /* expanded by -frewrite-includes */
8584# 52 "/home/alr48/cheri/sources/cheribsd/bin/cheritest/cheritest_registers.c"
8585# 1 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/fcntl.h" 1 3 4
8586/*-
8587 * Copyright (c) 1983, 1990, 1993
8588 * The Regents of the University of California. All rights reserved.
8589 * (c) UNIX System Laboratories, Inc.
8590 * All or some portions of this file are derived from material licensed
8591 * to the University of California by American Telephone and Telegraph
8592 * Co. or Unix System Laboratories, Inc. and are reproduced herein with
8593 * the permission of UNIX System Laboratories, Inc.
8594 *
8595 * Redistribution and use in source and binary forms, with or without
8596 * modification, are permitted provided that the following conditions
8597 * are met:
8598 * 1. Redistributions of source code must retain the above copyright
8599 * notice, this list of conditions and the following disclaimer.
8600 * 2. Redistributions in binary form must reproduce the above copyright
8601 * notice, this list of conditions and the following disclaimer in the
8602 * documentation and/or other materials provided with the distribution.
8603 * 4. Neither the name of the University nor the names of its contributors
8604 * may be used to endorse or promote products derived from this software
8605 * without specific prior written permission.
8606 *
8607 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
8608 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
8609 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
8610 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
8611 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
8612 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
8613 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
8614 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
8615 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
8616 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
8617 * SUCH DAMAGE.
8618 *
8619 * @(#)fcntl.h 8.3 (Berkeley) 1/21/94
8620 * $FreeBSD$
8621 */
8622
8623#ifndef _SYS_FCNTL_H_
8624#define _SYS_FCNTL_H_
8625
8626/*
8627 * This file includes the definitions for open and fcntl
8628 * described by POSIX for <fcntl.h>; it also includes
8629 * related kernel definitions.
8630 */
8631
8632#if 0 /* expanded by -frewrite-includes */
8633#include <sys/cdefs.h>
8634#endif /* expanded by -frewrite-includes */
8635# 47 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/fcntl.h" 3 4
8636# 48 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/fcntl.h" 3 4
8637#if 0 /* expanded by -frewrite-includes */
8638#include <sys/_types.h>
8639#endif /* expanded by -frewrite-includes */
8640# 48 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/fcntl.h" 3 4
8641# 49 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/fcntl.h" 3 4
8642
8643#ifndef _MODE_T_DECLARED
8644typedef __mode_t mode_t;
8645#define _MODE_T_DECLARED
8646#endif
8647# 54 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/fcntl.h" 3 4
8648
8649#ifndef _OFF_T_DECLARED
8650typedef __off_t off_t;
8651#define _OFF_T_DECLARED
8652#endif
8653# 59 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/fcntl.h" 3 4
8654
8655#ifndef _PID_T_DECLARED
8656typedef __pid_t pid_t;
8657#define _PID_T_DECLARED
8658#endif
8659# 64 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/fcntl.h" 3 4
8660
8661/*
8662 * File status flags: these are used by open(2), fcntl(2).
8663 * They are also used (indirectly) in the kernel file structure f_flags,
8664 * which is a superset of the open/fcntl flags. Open flags and f_flags
8665 * are inter-convertible using OFLAGS(fflags) and FFLAGS(oflags).
8666 * Open/fcntl flags begin with O_; kernel-internal flags begin with F.
8667 */
8668/* open-only flags */
8669#define O_RDONLY 0x0000 /* open for reading only */
8670#define O_WRONLY 0x0001 /* open for writing only */
8671#define O_RDWR 0x0002 /* open for reading and writing */
8672#define O_ACCMODE 0x0003 /* mask for above modes */
8673
8674/*
8675 * Kernel encoding of open mode; separate read and write bits that are
8676 * independently testable: 1 greater than the above.
8677 *
8678 * XXX
8679 * FREAD and FWRITE are excluded from the #ifdef _KERNEL so that TIOCFLUSH,
8680 * which was documented to use FREAD/FWRITE, continues to work.
8681 */
8682#if __BSD_VISIBLE
8683#define FREAD 0x0001
8684#define FWRITE 0x0002
8685#endif
8686# 90 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/fcntl.h" 3 4
8687#define O_NONBLOCK 0x0004 /* no delay */
8688#define O_APPEND 0x0008 /* set append mode */
8689#if __BSD_VISIBLE
8690#define O_SHLOCK 0x0010 /* open with shared file lock */
8691#define O_EXLOCK 0x0020 /* open with exclusive file lock */
8692#define O_ASYNC 0x0040 /* signal pgrp when data ready */
8693#define O_FSYNC 0x0080 /* synchronous writes */
8694#endif
8695# 98 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/fcntl.h" 3 4
8696#define O_SYNC 0x0080 /* POSIX synonym for O_FSYNC */
8697#if __POSIX_VISIBLE >= 200809
8698#define O_NOFOLLOW 0x0100 /* don't follow symlinks */
8699#endif
8700# 102 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/fcntl.h" 3 4
8701#define O_CREAT 0x0200 /* create if nonexistent */
8702#define O_TRUNC 0x0400 /* truncate to zero length */
8703#define O_EXCL 0x0800 /* error if already exists */
8704#ifdef _KERNEL
8705#define FHASLOCK 0x4000 /* descriptor holds advisory lock */
8706#endif
8707# 108 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/fcntl.h" 3 4
8708
8709/* Defined by POSIX 1003.1; BSD default, but must be distinct from O_RDONLY. */
8710#define O_NOCTTY 0x8000 /* don't assign controlling terminal */
8711
8712#if __BSD_VISIBLE
8713/* Attempt to bypass buffer cache */
8714#define O_DIRECT 0x00010000
8715#endif
8716# 116 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/fcntl.h" 3 4
8717
8718#if __POSIX_VISIBLE >= 200809
8719#define O_DIRECTORY 0x00020000 /* Fail if not directory */
8720#define O_EXEC 0x00040000 /* Open for execute only */
8721#endif
8722# 121 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/fcntl.h" 3 4
8723#ifdef _KERNEL
8724#define FEXEC O_EXEC
8725#endif
8726# 124 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/fcntl.h" 3 4
8727
8728#if __POSIX_VISIBLE >= 200809
8729/* Defined by POSIX 1003.1-2008; BSD default, but reserve for future use. */
8730#define O_TTY_INIT 0x00080000 /* Restore default termios attributes */
8731
8732#define O_CLOEXEC 0x00100000
8733#endif
8734# 131 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/fcntl.h" 3 4
8735
8736#if __BSD_VISIBLE
8737#define O_VERIFY 0x00200000 /* open only after verification */
8738#endif
8739# 135 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/fcntl.h" 3 4
8740
8741/*
8742 * XXX missing O_DSYNC, O_RSYNC.
8743 */
8744
8745#ifdef _KERNEL
8746
8747/* Only for devfs d_close() flags. */
8748#define FLASTCLOSE O_DIRECTORY
8749#define FREVOKE O_VERIFY
8750/* Only for fo_close() from half-succeeded open */
8751#define FOPENFAILED O_TTY_INIT
8752
8753/* convert from open() flags to/from fflags; convert O_RD/WR to FREAD/FWRITE */
8754#define FFLAGS(oflags) ((oflags) & O_EXEC ? (oflags) : (oflags) + 1)
8755#define OFLAGS(fflags) ((fflags) & O_EXEC ? (fflags) : (fflags) - 1)
8756
8757/* bits to save after open */
8758#define FMASK (FREAD|FWRITE|FAPPEND|FASYNC|FFSYNC|FNONBLOCK|O_DIRECT|FEXEC)
8759/* bits settable by fcntl(F_SETFL, ...) */
8760#define FCNTLFLAGS (FAPPEND|FASYNC|FFSYNC|FNONBLOCK|FRDAHEAD|O_DIRECT)
8761
8762#if defined(COMPAT_FREEBSD7) || defined(COMPAT_FREEBSD6) || \
8763 defined(COMPAT_FREEBSD5) || defined(COMPAT_FREEBSD4)
8764/*
8765 * Set by shm_open(3) in older libc's to get automatic MAP_ASYNC
8766 * behavior for POSIX shared memory objects (which are otherwise
8767 * implemented as plain files).
8768 */
8769#define FPOSIXSHM O_NOFOLLOW
8770#undef FCNTLFLAGS
8771#define FCNTLFLAGS (FAPPEND|FASYNC|FFSYNC|FNONBLOCK|FPOSIXSHM|FRDAHEAD| \
8772 O_DIRECT)
8773#endif
8774# 169 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/fcntl.h" 3 4
8775#endif
8776# 170 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/fcntl.h" 3 4
8777
8778/*
8779 * The O_* flags used to have only F* names, which were used in the kernel
8780 * and by fcntl. We retain the F* names for the kernel f_flag field
8781 * and for backward compatibility for fcntl. These flags are deprecated.
8782 */
8783#if __BSD_VISIBLE
8784#define FAPPEND O_APPEND /* kernel/compat */
8785#define FASYNC O_ASYNC /* kernel/compat */
8786#define FFSYNC O_FSYNC /* kernel */
8787#define FNONBLOCK O_NONBLOCK /* kernel */
8788#define FNDELAY O_NONBLOCK /* compat */
8789#define O_NDELAY O_NONBLOCK /* compat */
8790#endif
8791# 184 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/fcntl.h" 3 4
8792
8793/*
8794 * We are out of bits in f_flag (which is a short). However,
8795 * the flag bits not set in FMASK are only meaningful in the
8796 * initial open syscall. Those bits can thus be given a
8797 * different meaning for fcntl(2).
8798 */
8799#if __BSD_VISIBLE
8800/* Read ahead */
8801#define FRDAHEAD O_CREAT
8802#endif
8803# 195 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/fcntl.h" 3 4
8804
8805#if __POSIX_VISIBLE >= 200809
8806/*
8807 * Magic value that specify the use of the current working directory
8808 * to determine the target of relative file paths in the openat() and
8809 * similar syscalls.
8810 */
8811#define AT_FDCWD -100
8812
8813/*
8814 * Miscellaneous flags for the *at() syscalls.
8815 */
8816#define AT_EACCESS 0x100 /* Check access using effective user and group ID */
8817#define AT_SYMLINK_NOFOLLOW 0x200 /* Do not follow symbolic links */
8818#define AT_SYMLINK_FOLLOW 0x400 /* Follow symbolic link */
8819#define AT_REMOVEDIR 0x800 /* Remove directory instead of file */
8820#endif
8821# 212 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/fcntl.h" 3 4
8822
8823/*
8824 * Constants used for fcntl(2)
8825 */
8826
8827/* command values */
8828#define F_DUPFD 0 /* duplicate file descriptor */
8829#define F_GETFD 1 /* get file descriptor flags */
8830#define F_SETFD 2 /* set file descriptor flags */
8831#define F_GETFL 3 /* get file status flags */
8832#define F_SETFL 4 /* set file status flags */
8833#if __XSI_VISIBLE || __POSIX_VISIBLE >= 200112
8834#define F_GETOWN 5 /* get SIGIO/SIGURG proc/pgrp */
8835#define F_SETOWN 6 /* set SIGIO/SIGURG proc/pgrp */
8836#endif
8837# 227 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/fcntl.h" 3 4
8838#if __BSD_VISIBLE
8839#define F_OGETLK 7 /* get record locking information */
8840#define F_OSETLK 8 /* set record locking information */
8841#define F_OSETLKW 9 /* F_SETLK; wait if blocked */
8842#define F_DUP2FD 10 /* duplicate file descriptor to arg */
8843#endif
8844# 233 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/fcntl.h" 3 4
8845#define F_GETLK 11 /* get record locking information */
8846#define F_SETLK 12 /* set record locking information */
8847#define F_SETLKW 13 /* F_SETLK; wait if blocked */
8848#if __BSD_VISIBLE
8849#define F_SETLK_REMOTE 14 /* debugging support for remote locks */
8850#define F_READAHEAD 15 /* read ahead */
8851#define F_RDAHEAD 16 /* Darwin compatible read ahead */
8852#endif
8853# 241 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/fcntl.h" 3 4
8854#if __POSIX_VISIBLE >= 200809
8855#define F_DUPFD_CLOEXEC 17 /* Like F_DUPFD, but FD_CLOEXEC is set */
8856#endif
8857# 244 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/fcntl.h" 3 4
8858#if __BSD_VISIBLE
8859#define F_DUP2FD_CLOEXEC 18 /* Like F_DUP2FD, but FD_CLOEXEC is set */
8860#endif
8861# 247 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/fcntl.h" 3 4
8862
8863/* file descriptor flags (F_GETFD, F_SETFD) */
8864#define FD_CLOEXEC 1 /* close-on-exec flag */
8865
8866/* record locking flags (F_GETLK, F_SETLK, F_SETLKW) */
8867#define F_RDLCK 1 /* shared or read lock */
8868#define F_UNLCK 2 /* unlock */
8869#define F_WRLCK 3 /* exclusive or write lock */
8870#if __BSD_VISIBLE
8871#define F_UNLCKSYS 4 /* purge locks for a given system ID */
8872#define F_CANCEL 5 /* cancel an async lock request */
8873#endif
8874# 259 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/fcntl.h" 3 4
8875#ifdef _KERNEL
8876#define F_WAIT 0x010 /* Wait until lock is granted */
8877#define F_FLOCK 0x020 /* Use flock(2) semantics for lock */
8878#define F_POSIX 0x040 /* Use POSIX semantics for lock */
8879#define F_REMOTE 0x080 /* Lock owner is remote NFS client */
8880#define F_NOINTR 0x100 /* Ignore signals when waiting */
8881#endif
8882# 266 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/fcntl.h" 3 4
8883
8884/*
8885 * Advisory file segment locking data type -
8886 * information passed to system by user
8887 */
8888struct flock {
8889 off_t l_start; /* starting offset */
8890 off_t l_len; /* len = 0 means until end of file */
8891 pid_t l_pid; /* lock owner */
8892 short l_type; /* lock type: read/write, etc. */
8893 short l_whence; /* type of l_start */
8894 int l_sysid; /* remote system id or zero for local */
8895};
8896
8897#if __BSD_VISIBLE
8898/*
8899 * Old advisory file segment locking data type,
8900 * before adding l_sysid.
8901 */
8902struct __oflock {
8903 off_t l_start; /* starting offset */
8904 off_t l_len; /* len = 0 means until end of file */
8905 pid_t l_pid; /* lock owner */
8906 short l_type; /* lock type: read/write, etc. */
8907 short l_whence; /* type of l_start */
8908};
8909#endif
8910# 293 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/fcntl.h" 3 4
8911
8912#if __BSD_VISIBLE
8913/* lock operations for flock(2) */
8914#define LOCK_SH 0x01 /* shared file lock */
8915#define LOCK_EX 0x02 /* exclusive file lock */
8916#define LOCK_NB 0x04 /* don't block when locking */
8917#define LOCK_UN 0x08 /* unlock file */
8918#endif
8919# 301 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/fcntl.h" 3 4
8920
8921#if __POSIX_VISIBLE >= 200112
8922/*
8923 * Advice to posix_fadvise
8924 */
8925#define POSIX_FADV_NORMAL 0 /* no special treatment */
8926#define POSIX_FADV_RANDOM 1 /* expect random page references */
8927#define POSIX_FADV_SEQUENTIAL 2 /* expect sequential page references */
8928#define POSIX_FADV_WILLNEED 3 /* will need these pages */
8929#define POSIX_FADV_DONTNEED 4 /* dont need these pages */
8930#define POSIX_FADV_NOREUSE 5 /* access data only once */
8931#endif
8932# 313 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/fcntl.h" 3 4
8933
8934#ifndef _KERNEL
8935__BEGIN_DECLS
8936int open(const char *, int, ...);
8937int creat(const char *, mode_t);
8938int fcntl(int, int, ...);
8939#if __BSD_VISIBLE
8940int flock(int, int);
8941#endif
8942# 322 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/fcntl.h" 3 4
8943#if __POSIX_VISIBLE >= 200809
8944int openat(int, const char *, int, ...);
8945#endif
8946# 325 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/fcntl.h" 3 4
8947#if __POSIX_VISIBLE >= 200112
8948int posix_fadvise(int, off_t, off_t, int);
8949int posix_fallocate(int, off_t, off_t);
8950#endif
8951# 329 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/fcntl.h" 3 4
8952__END_DECLS
8953#endif
8954# 331 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/fcntl.h" 3 4
8955
8956#endif /* !_SYS_FCNTL_H_ */
8957# 333 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/fcntl.h" 3 4
8958# 53 "/home/alr48/cheri/sources/cheribsd/bin/cheritest/cheritest_registers.c" 2
8959#if 0 /* expanded by -frewrite-includes */
8960#include <inttypes.h>
8961#endif /* expanded by -frewrite-includes */
8962# 53 "/home/alr48/cheri/sources/cheribsd/bin/cheritest/cheritest_registers.c"
8963# 1 "/home/alr48/cheri/output-debug/sdk256/bin/../lib/clang/3.8.0/include/inttypes.h" 1 3 4
8964/*===---- inttypes.h - Standard header for integer printf macros ----------===*\
8965 *
8966 * Permission is hereby granted, free of charge, to any person obtaining a copy
8967 * of this software and associated documentation files (the "Software"), to deal
8968 * in the Software without restriction, including without limitation the rights
8969 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8970 * copies of the Software, and to permit persons to whom the Software is
8971 * furnished to do so, subject to the following conditions:
8972 *
8973 * The above copyright notice and this permission notice shall be included in
8974 * all copies or substantial portions of the Software.
8975 *
8976 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
8977 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
8978 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
8979 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
8980 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
8981 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
8982 * THE SOFTWARE.
8983 *
8984\*===----------------------------------------------------------------------===*/
8985
8986#ifndef __CLANG_INTTYPES_H
8987#define __CLANG_INTTYPES_H
8988
8989#if 0 /* expanded by -frewrite-includes */
8990#include_next <inttypes.h>
8991#endif /* expanded by -frewrite-includes */
8992# 26 "/home/alr48/cheri/output-debug/sdk256/bin/../lib/clang/3.8.0/include/inttypes.h" 3 4
8993# 1 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/inttypes.h" 1 3 4
8994/*-
8995 * Copyright (c) 2001 Mike Barcroft <mike@FreeBSD.org>
8996 * All rights reserved.
8997 *
8998 * Redistribution and use in source and binary forms, with or without
8999 * modification, are permitted provided that the following conditions
9000 * are met:
9001 * 1. Redistributions of source code must retain the above copyright
9002 * notice, this list of conditions and the following disclaimer.
9003 * 2. Redistributions in binary form must reproduce the above copyright
9004 * notice, this list of conditions and the following disclaimer in the
9005 * documentation and/or other materials provided with the distribution.
9006 *
9007 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
9008 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
9009 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
9010 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
9011 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
9012 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
9013 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
9014 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
9015 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
9016 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
9017 * SUCH DAMAGE.
9018 *
9019 * $FreeBSD$
9020 */
9021
9022#ifndef _INTTYPES_H_
9023#define _INTTYPES_H_
9024
9025#if 0 /* expanded by -frewrite-includes */
9026#include <machine/_inttypes.h>
9027#endif /* expanded by -frewrite-includes */
9028# 32 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/inttypes.h" 3 4
9029# 1 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/machine/_inttypes.h" 1 3 4
9030/*-
9031 * Copyright (c) 2001 The NetBSD Foundation, Inc.
9032 * All rights reserved.
9033 *
9034 * This code is derived from software contributed to The NetBSD Foundation
9035 * by Klaus Klein.
9036 *
9037 * Redistribution and use in source and binary forms, with or without
9038 * modification, are permitted provided that the following conditions
9039 * are met:
9040 * 1. Redistributions of source code must retain the above copyright
9041 * notice, this list of conditions and the following disclaimer.
9042 * 2. Redistributions in binary form must reproduce the above copyright
9043 * notice, this list of conditions and the following disclaimer in the
9044 * documentation and/or other materials provided with the distribution.
9045 *
9046 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
9047 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
9048 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
9049 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
9050 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
9051 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
9052 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
9053 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
9054 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
9055 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
9056 * POSSIBILITY OF SUCH DAMAGE.
9057 *
9058 * From: $NetBSD: int_fmtio.h,v 1.2 2001/04/26 16:25:21 kleink Exp $
9059 * from: src/sys/i386/include/_inttypes.h,v 1.2 2002/06/30 05:48:02 mike
9060 * $FreeBSD$
9061 */
9062
9063#ifndef _MACHINE_INTTYPES_H_
9064#define _MACHINE_INTTYPES_H_
9065
9066/*
9067 * Macros for format specifiers.
9068 */
9069
9070#ifdef __mips_n64
9071#define __PRI64 "l"
9072#ifndef __CHERI_PURE_CAPABILITY__
9073#define __PRIptr "l"
9074#else
9075# 46 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/machine/_inttypes.h" 3 4
9076#define __PRIptr "P"
9077#endif
9078# 48 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/machine/_inttypes.h" 3 4
9079#else
9080# 49 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/machine/_inttypes.h" 3 4
9081#define __PRI64 "ll"
9082#define __PRIptr
9083#endif
9084# 52 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/machine/_inttypes.h" 3 4
9085
9086/* fprintf(3) macros for signed integers. */
9087
9088#define PRId8 "d" /* int8_t */
9089#define PRId16 "d" /* int16_t */
9090#define PRId32 "d" /* int32_t */
9091#define PRId64 __PRI64"d" /* int64_t */
9092#define PRIdLEAST8 "d" /* int_least8_t */
9093#define PRIdLEAST16 "d" /* int_least16_t */
9094#define PRIdLEAST32 "d" /* int_least32_t */
9095#define PRIdLEAST64 __PRI64"d" /* int_least64_t */
9096#define PRIdFAST8 "d" /* int_fast8_t */
9097#define PRIdFAST16 "d" /* int_fast16_t */
9098#define PRIdFAST32 "d" /* int_fast32_t */
9099#define PRIdFAST64 __PRI64"d" /* int_fast64_t */
9100#define PRIdMAX "jd" /* intmax_t */
9101#define PRIdPTR __PRIptr"d" /* intptr_t */
9102
9103#define PRIi8 "i" /* int8_t */
9104#define PRIi16 "i" /* int16_t */
9105#define PRIi32 "i" /* int32_t */
9106#define PRIi64 __PRI64"i" /* int64_t */
9107#define PRIiLEAST8 "i" /* int_least8_t */
9108#define PRIiLEAST16 "i" /* int_least16_t */
9109#define PRIiLEAST32 "i" /* int_least32_t */
9110#define PRIiLEAST64 __PRI64"i" /* int_least64_t */
9111#define PRIiFAST8 "i" /* int_fast8_t */
9112#define PRIiFAST16 "i" /* int_fast16_t */
9113#define PRIiFAST32 "i" /* int_fast32_t */
9114#define PRIiFAST64 __PRI64"i" /* int_fast64_t */
9115#define PRIiMAX "ji" /* intmax_t */
9116#define PRIiPTR __PRIptr"i" /* intptr_t */
9117
9118/* fprintf(3) macros for unsigned integers. */
9119
9120#define PRIo8 "o" /* uint8_t */
9121#define PRIo16 "o" /* uint16_t */
9122#define PRIo32 "o" /* uint32_t */
9123#define PRIo64 __PRI64"o" /* uint64_t */
9124#define PRIoLEAST8 "o" /* uint_least8_t */
9125#define PRIoLEAST16 "o" /* uint_least16_t */
9126#define PRIoLEAST32 "o" /* uint_least32_t */
9127#define PRIoLEAST64 __PRI64"o" /* uint_least64_t */
9128#define PRIoFAST8 "o" /* uint_fast8_t */
9129#define PRIoFAST16 "o" /* uint_fast16_t */
9130#define PRIoFAST32 "o" /* uint_fast32_t */
9131#define PRIoFAST64 __PRI64"o" /* uint_fast64_t */
9132#define PRIoMAX "jo" /* uintmax_t */
9133#define PRIoPTR __PRIptr"o" /* uintptr_t */
9134
9135#define PRIu8 "u" /* uint8_t */
9136#define PRIu16 "u" /* uint16_t */
9137#define PRIu32 "u" /* uint32_t */
9138#define PRIu64 __PRI64"u" /* uint64_t */
9139#define PRIuLEAST8 "u" /* uint_least8_t */
9140#define PRIuLEAST16 "u" /* uint_least16_t */
9141#define PRIuLEAST32 "u" /* uint_least32_t */
9142#define PRIuLEAST64 __PRI64"u" /* uint_least64_t */
9143#define PRIuFAST8 "u" /* uint_fast8_t */
9144#define PRIuFAST16 "u" /* uint_fast16_t */
9145#define PRIuFAST32 "u" /* uint_fast32_t */
9146#define PRIuFAST64 __PRI64"u" /* uint_fast64_t */
9147#define PRIuMAX "ju" /* uintmax_t */
9148#define PRIuPTR __PRIptr"u" /* uintptr_t */
9149
9150#define PRIx8 "x" /* uint8_t */
9151#define PRIx16 "x" /* uint16_t */
9152#define PRIx32 "x" /* uint32_t */
9153#define PRIx64 __PRI64"x" /* uint64_t */
9154#define PRIxLEAST8 "x" /* uint_least8_t */
9155#define PRIxLEAST16 "x" /* uint_least16_t */
9156#define PRIxLEAST32 "x" /* uint_least32_t */
9157#define PRIxLEAST64 __PRI64"x" /* uint_least64_t */
9158#define PRIxFAST8 "x" /* uint_fast8_t */
9159#define PRIxFAST16 "x" /* uint_fast16_t */
9160#define PRIxFAST32 "x" /* uint_fast32_t */
9161#define PRIxFAST64 __PRI64"x" /* uint_fast64_t */
9162#define PRIxMAX "jx" /* uintmax_t */
9163#define PRIxPTR __PRIptr"x" /* uintptr_t */
9164
9165#define PRIX8 "X" /* uint8_t */
9166#define PRIX16 "X" /* uint16_t */
9167#define PRIX32 "X" /* uint32_t */
9168#define PRIX64 __PRI64"X" /* uint64_t */
9169#define PRIXLEAST8 "X" /* uint_least8_t */
9170#define PRIXLEAST16 "X" /* uint_least16_t */
9171#define PRIXLEAST32 "X" /* uint_least32_t */
9172#define PRIXLEAST64 __PRI64"X" /* uint_least64_t */
9173#define PRIXFAST8 "X" /* uint_fast8_t */
9174#define PRIXFAST16 "X" /* uint_fast16_t */
9175#define PRIXFAST32 "X" /* uint_fast32_t */
9176#define PRIXFAST64 __PRI64"X" /* uint_fast64_t */
9177#define PRIXMAX "jX" /* uintmax_t */
9178#define PRIXPTR __PRIptr"X" /* uintptr_t */
9179
9180/* fscanf(3) macros for signed integers. */
9181
9182#define SCNd8 "hhd" /* int8_t */
9183#define SCNd16 "hd" /* int16_t */
9184#define SCNd32 "d" /* int32_t */
9185#define SCNd64 __PRI64"d" /* int64_t */
9186#define SCNdLEAST8 "hhd" /* int_least8_t */
9187#define SCNdLEAST16 "hd" /* int_least16_t */
9188#define SCNdLEAST32 "d" /* int_least32_t */
9189#define SCNdLEAST64 __PRI64"d" /* int_least64_t */
9190#define SCNdFAST8 "d" /* int_fast8_t */
9191#define SCNdFAST16 "d" /* int_fast16_t */
9192#define SCNdFAST32 "d" /* int_fast32_t */
9193#define SCNdFAST64 __PRI64"d" /* int_fast64_t */
9194#define SCNdMAX "jd" /* intmax_t */
9195#define SCNdPTR __PRIptr"d" /* intptr_t */
9196
9197#define SCNi8 "hhi" /* int8_t */
9198#define SCNi16 "hi" /* int16_t */
9199#define SCNi32 "i" /* int32_t */
9200#define SCNi64 __PRI64"i" /* int64_t */
9201#define SCNiLEAST8 "hhi" /* int_least8_t */
9202#define SCNiLEAST16 "hi" /* int_least16_t */
9203#define SCNiLEAST32 "i" /* int_least32_t */
9204#define SCNiLEAST64 __PRI64"i" /* int_least64_t */
9205#define SCNiFAST8 "i" /* int_fast8_t */
9206#define SCNiFAST16 "i" /* int_fast16_t */
9207#define SCNiFAST32 "i" /* int_fast32_t */
9208#define SCNiFAST64 __PRI64"i" /* int_fast64_t */
9209#define SCNiMAX "ji" /* intmax_t */
9210#define SCNiPTR __PRIptr"i" /* intptr_t */
9211
9212/* fscanf(3) macros for unsigned integers. */
9213
9214#define SCNo8 "hho" /* uint8_t */
9215#define SCNo16 "ho" /* uint16_t */
9216#define SCNo32 "o" /* uint32_t */
9217#define SCNo64 __PRI64"o" /* uint64_t */
9218#define SCNoLEAST8 "hho" /* uint_least8_t */
9219#define SCNoLEAST16 "ho" /* uint_least16_t */
9220#define SCNoLEAST32 "o" /* uint_least32_t */
9221#define SCNoLEAST64 __PRI64"o" /* uint_least64_t */
9222#define SCNoFAST8 "o" /* uint_fast8_t */
9223#define SCNoFAST16 "o" /* uint_fast16_t */
9224#define SCNoFAST32 "o" /* uint_fast32_t */
9225#define SCNoFAST64 __PRI64"o" /* uint_fast64_t */
9226#define SCNoMAX "jo" /* uintmax_t */
9227#define SCNoPTR __PRIptr"o" /* uintptr_t */
9228
9229#define SCNu8 "hhu" /* uint8_t */
9230#define SCNu16 "hu" /* uint16_t */
9231#define SCNu32 "u" /* uint32_t */
9232#define SCNu64 __PRI64"u" /* uint64_t */
9233#define SCNuLEAST8 "hhu" /* uint_least8_t */
9234#define SCNuLEAST16 "hu" /* uint_least16_t */
9235#define SCNuLEAST32 "u" /* uint_least32_t */
9236#define SCNuLEAST64 __PRI64"u" /* uint_least64_t */
9237#define SCNuFAST8 "u" /* uint_fast8_t */
9238#define SCNuFAST16 "u" /* uint_fast16_t */
9239#define SCNuFAST32 "u" /* uint_fast32_t */
9240#define SCNuFAST64 __PRI64"u" /* uint_fast64_t */
9241#define SCNuMAX "ju" /* uintmax_t */
9242#define SCNuPTR __PRIptr"u" /* uintptr_t */
9243
9244#define SCNx8 "hhx" /* uint8_t */
9245#define SCNx16 "hx" /* uint16_t */
9246#define SCNx32 "x" /* uint32_t */
9247#define SCNx64 __PRI64"x" /* uint64_t */
9248#define SCNxLEAST8 "hhx" /* uint_least8_t */
9249#define SCNxLEAST16 "hx" /* uint_least16_t */
9250#define SCNxLEAST32 "x" /* uint_least32_t */
9251#define SCNxLEAST64 __PRI64"x" /* uint_least64_t */
9252#define SCNxFAST8 "x" /* uint_fast8_t */
9253#define SCNxFAST16 "x" /* uint_fast16_t */
9254#define SCNxFAST32 "x" /* uint_fast32_t */
9255#define SCNxFAST64 __PRI64"x" /* uint_fast64_t */
9256#define SCNxMAX "jx" /* uintmax_t */
9257#define SCNxPTR __PRIptr"x" /* uintptr_t */
9258
9259#endif /* !_MACHINE_INTTYPES_H_ */
9260# 227 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/machine/_inttypes.h" 3 4
9261# 33 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/inttypes.h" 2 3 4
9262#if 0 /* expanded by -frewrite-includes */
9263#include <sys/stdint.h>
9264#endif /* expanded by -frewrite-includes */
9265# 33 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/inttypes.h" 3 4
9266# 1 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/stdint.h" 1 3 4
9267/*-
9268 * Copyright (c) 2001 Mike Barcroft <mike@FreeBSD.org>
9269 * All rights reserved.
9270 *
9271 * Redistribution and use in source and binary forms, with or without
9272 * modification, are permitted provided that the following conditions
9273 * are met:
9274 * 1. Redistributions of source code must retain the above copyright
9275 * notice, this list of conditions and the following disclaimer.
9276 * 2. Redistributions in binary form must reproduce the above copyright
9277 * notice, this list of conditions and the following disclaimer in the
9278 * documentation and/or other materials provided with the distribution.
9279 *
9280 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
9281 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
9282 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
9283 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
9284 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
9285 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
9286 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
9287 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
9288 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
9289 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
9290 * SUCH DAMAGE.
9291 *
9292 * $FreeBSD$
9293 */
9294
9295#ifndef _SYS_STDINT_H_
9296#define _SYS_STDINT_H_
9297
9298#if 0 /* expanded by -frewrite-includes */
9299#include <sys/cdefs.h>
9300#endif /* expanded by -frewrite-includes */
9301# 32 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/stdint.h" 3 4
9302# 33 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/stdint.h" 3 4
9303#if 0 /* expanded by -frewrite-includes */
9304#include <sys/_types.h>
9305#endif /* expanded by -frewrite-includes */
9306# 33 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/stdint.h" 3 4
9307# 34 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/stdint.h" 3 4
9308
9309#if 0 /* expanded by -frewrite-includes */
9310#include <machine/_stdint.h>
9311#endif /* expanded by -frewrite-includes */
9312# 35 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/stdint.h" 3 4
9313# 1 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/machine/_stdint.h" 1 3 4
9314/*-
9315 * Copyright (c) 2001, 2002 Mike Barcroft <mike@FreeBSD.org>
9316 * Copyright (c) 2001 The NetBSD Foundation, Inc.
9317 * All rights reserved.
9318 *
9319 * This code is derived from software contributed to The NetBSD Foundation
9320 * by Klaus Klein.
9321 *
9322 * Redistribution and use in source and binary forms, with or without
9323 * modification, are permitted provided that the following conditions
9324 * are met:
9325 * 1. Redistributions of source code must retain the above copyright
9326 * notice, this list of conditions and the following disclaimer.
9327 * 2. Redistributions in binary form must reproduce the above copyright
9328 * notice, this list of conditions and the following disclaimer in the
9329 * documentation and/or other materials provided with the distribution.
9330 * 3. All advertising materials mentioning features or use of this software
9331 * must display the following acknowledgement:
9332 * This product includes software developed by the NetBSD
9333 * Foundation, Inc. and its contributors.
9334 * 4. Neither the name of The NetBSD Foundation nor the names of its
9335 * contributors may be used to endorse or promote products derived
9336 * from this software without specific prior written permission.
9337 *
9338 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
9339 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
9340 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
9341 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
9342 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
9343 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
9344 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
9345 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
9346 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
9347 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
9348 * POSSIBILITY OF SUCH DAMAGE.
9349 *
9350 * from: src/sys/i386/include/_stdint.h,v 1.2 2004/05/18 16:04:57 stefanf
9351 * $FreeBSD$
9352 */
9353
9354#ifndef _MACHINE__STDINT_H_
9355#define _MACHINE__STDINT_H_
9356
9357#if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS)
9358
9359#define INT8_C(c) (c)
9360#define INT16_C(c) (c)
9361#define INT32_C(c) (c)
9362
9363#define UINT8_C(c) (c)
9364#define UINT16_C(c) (c)
9365#define UINT32_C(c) (c ## U)
9366
9367#ifdef __mips_n64
9368#define INT64_C(c) (c ## L)
9369#define UINT64_C(c) (c ## UL)
9370#else
9371# 58 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/machine/_stdint.h" 3 4
9372#define INT64_C(c) (c ## LL)
9373#define UINT64_C(c) (c ## ULL)
9374#endif
9375# 61 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/machine/_stdint.h" 3 4
9376
9377#define INTMAX_C(c) INT64_C(c)
9378#define UINTMAX_C(c) UINT64_C(c)
9379
9380#endif /* !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) */
9381# 66 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/machine/_stdint.h" 3 4
9382
9383#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS)
9384
9385#ifndef __INT64_C
9386#ifdef __mips_n64
9387#define __INT64_C(c) (c ## L)
9388#define __UINT64_C(c) (c ## UL)
9389#else
9390# 74 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/machine/_stdint.h" 3 4
9391#define __INT64_C(c) (c ## LL)
9392#define __UINT64_C(c) (c ## ULL)
9393#endif
9394# 77 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/machine/_stdint.h" 3 4
9395#endif
9396# 78 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/machine/_stdint.h" 3 4
9397
9398/*
9399 * ISO/IEC 9899:1999
9400 * 7.18.2.1 Limits of exact-width integer types
9401 */
9402/* Minimum values of exact-width signed integer types. */
9403#define INT8_MIN (-0x7f-1)
9404#define INT16_MIN (-0x7fff-1)
9405#define INT32_MIN (-0x7fffffff-1)
9406#define INT64_MIN (-__INT64_C(0x7fffffffffffffff)-1)
9407
9408/* Maximum values of exact-width signed integer types. */
9409#define INT8_MAX 0x7f
9410#define INT16_MAX 0x7fff
9411#define INT32_MAX 0x7fffffff
9412#define INT64_MAX __INT64_C(0x7fffffffffffffff)
9413
9414/* Maximum values of exact-width unsigned integer types. */
9415#define UINT8_MAX 0xff
9416#define UINT16_MAX 0xffff
9417#define UINT32_MAX 0xffffffff
9418#define UINT64_MAX __UINT64_C(0xffffffffffffffff)
9419
9420/*
9421 * ISO/IEC 9899:1999
9422 * 7.18.2.2 Limits of minimum-width integer types
9423 */
9424/* Minimum values of minimum-width signed integer types. */
9425#define INT_LEAST8_MIN INT8_MIN
9426#define INT_LEAST16_MIN INT16_MIN
9427#define INT_LEAST32_MIN INT32_MIN
9428#define INT_LEAST64_MIN INT64_MIN
9429
9430/* Maximum values of minimum-width signed integer types. */
9431#define INT_LEAST8_MAX INT8_MAX
9432#define INT_LEAST16_MAX INT16_MAX
9433#define INT_LEAST32_MAX INT32_MAX
9434#define INT_LEAST64_MAX INT64_MAX
9435
9436/* Maximum values of minimum-width unsigned integer types. */
9437#define UINT_LEAST8_MAX UINT8_MAX
9438#define UINT_LEAST16_MAX UINT16_MAX
9439#define UINT_LEAST32_MAX UINT32_MAX
9440#define UINT_LEAST64_MAX UINT64_MAX
9441
9442/*
9443 * ISO/IEC 9899:1999
9444 * 7.18.2.3 Limits of fastest minimum-width integer types
9445 */
9446/* Minimum values of fastest minimum-width signed integer types. */
9447#define INT_FAST8_MIN INT32_MIN
9448#define INT_FAST16_MIN INT32_MIN
9449#define INT_FAST32_MIN INT32_MIN
9450#define INT_FAST64_MIN INT64_MIN
9451
9452/* Maximum values of fastest minimum-width signed integer types. */
9453#define INT_FAST8_MAX INT32_MAX
9454#define INT_FAST16_MAX INT32_MAX
9455#define INT_FAST32_MAX INT32_MAX
9456#define INT_FAST64_MAX INT64_MAX
9457
9458/* Maximum values of fastest minimum-width unsigned integer types. */
9459#define UINT_FAST8_MAX UINT32_MAX
9460#define UINT_FAST16_MAX UINT32_MAX
9461#define UINT_FAST32_MAX UINT32_MAX
9462#define UINT_FAST64_MAX UINT64_MAX
9463
9464/*
9465 * ISO/IEC 9899:1999
9466 * 7.18.2.4 Limits of integer types capable of holding object pointers
9467 */
9468#ifdef __mips_n64
9469#define INTPTR_MIN INT64_MIN
9470#define INTPTR_MAX INT64_MAX
9471#define UINTPTR_MAX UINT64_MAX
9472#else
9473# 154 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/machine/_stdint.h" 3 4
9474#define INTPTR_MIN INT32_MIN
9475#define INTPTR_MAX INT32_MAX
9476#define UINTPTR_MAX UINT32_MAX
9477#endif
9478# 158 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/machine/_stdint.h" 3 4
9479
9480/*
9481 * ISO/IEC 9899:1999
9482 * 7.18.2.5 Limits of greatest-width integer types
9483 */
9484#define INTMAX_MIN INT64_MIN
9485#define INTMAX_MAX INT64_MAX
9486#define UINTMAX_MAX UINT64_MAX
9487
9488/*
9489 * ISO/IEC 9899:1999
9490 * 7.18.3 Limits of other integer types
9491 */
9492#ifdef __mips_n64
9493/* Limits of ptrdiff_t. */
9494#define PTRDIFF_MIN INT64_MIN
9495#define PTRDIFF_MAX INT64_MAX
9496
9497/* Limit of size_t. */
9498#define SIZE_MAX UINT64_MAX
9499#else
9500# 179 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/machine/_stdint.h" 3 4
9501/* Limits of ptrdiff_t. */
9502#define PTRDIFF_MIN INT32_MIN
9503#define PTRDIFF_MAX INT32_MAX
9504
9505/* Limit of size_t. */
9506#define SIZE_MAX UINT32_MAX
9507#endif
9508# 186 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/machine/_stdint.h" 3 4
9509
9510/* Limits of sig_atomic_t. */
9511#define SIG_ATOMIC_MIN INT32_MIN
9512#define SIG_ATOMIC_MAX INT32_MAX
9513
9514/* Limits of wint_t. */
9515#define WINT_MIN INT32_MIN
9516#define WINT_MAX INT32_MAX
9517
9518#endif /* !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) */
9519# 196 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/machine/_stdint.h" 3 4
9520
9521#endif /* !_MACHINE__STDINT_H_ */
9522# 198 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/machine/_stdint.h" 3 4
9523# 36 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/stdint.h" 2 3 4
9524#if 0 /* expanded by -frewrite-includes */
9525#include <sys/_stdint.h>
9526#endif /* expanded by -frewrite-includes */
9527# 36 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/stdint.h" 3 4
9528# 37 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/stdint.h" 3 4
9529
9530typedef __int_least8_t int_least8_t;
9531typedef __int_least16_t int_least16_t;
9532typedef __int_least32_t int_least32_t;
9533typedef __int_least64_t int_least64_t;
9534
9535typedef __uint_least8_t uint_least8_t;
9536typedef __uint_least16_t uint_least16_t;
9537typedef __uint_least32_t uint_least32_t;
9538typedef __uint_least64_t uint_least64_t;
9539
9540typedef __int_fast8_t int_fast8_t;
9541typedef __int_fast16_t int_fast16_t;
9542typedef __int_fast32_t int_fast32_t;
9543typedef __int_fast64_t int_fast64_t;
9544
9545typedef __uint_fast8_t uint_fast8_t;
9546typedef __uint_fast16_t uint_fast16_t;
9547typedef __uint_fast32_t uint_fast32_t;
9548typedef __uint_fast64_t uint_fast64_t;
9549
9550/* GNU and Darwin define this and people seem to think it's portable */
9551#if defined(UINTPTR_MAX) && defined(UINT64_MAX) && (UINTPTR_MAX == UINT64_MAX)
9552#define __WORDSIZE 64
9553#else
9554# 62 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/stdint.h" 3 4
9555#define __WORDSIZE 32
9556#endif
9557# 64 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/stdint.h" 3 4
9558
9559/* Limits of wchar_t. */
9560#define WCHAR_MIN __WCHAR_MIN
9561#define WCHAR_MAX __WCHAR_MAX
9562
9563#endif /* !_SYS_STDINT_H_ */
9564# 70 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/stdint.h" 3 4
9565# 34 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/inttypes.h" 2 3 4
9566
9567#ifndef __cplusplus
9568#ifndef _WCHAR_T_DECLARED
9569typedef ___wchar_t wchar_t;
9570#define _WCHAR_T_DECLARED
9571#endif
9572# 40 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/inttypes.h" 3 4
9573#endif
9574# 41 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/inttypes.h" 3 4
9575
9576typedef struct {
9577 intmax_t quot; /* Quotient. */
9578 intmax_t rem; /* Remainder. */
9579} imaxdiv_t;
9580
9581__BEGIN_DECLS
9582#ifdef _XLOCALE_H_
9583#if 0 /* expanded by -frewrite-includes */
9584#include <xlocale/_inttypes.h>
9585#endif /* expanded by -frewrite-includes */
9586# 49 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/inttypes.h" 3 4
9587# 50 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/inttypes.h" 3 4
9588#endif
9589# 51 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/inttypes.h" 3 4
9590intmax_t imaxabs(intmax_t) __pure2;
9591imaxdiv_t imaxdiv(intmax_t, intmax_t) __pure2;
9592
9593intmax_t strtoimax(const char * __restrict, char ** __restrict, int);
9594uintmax_t strtoumax(const char * __restrict, char ** __restrict, int);
9595intmax_t wcstoimax(const wchar_t * __restrict,
9596 wchar_t ** __restrict, int);
9597uintmax_t wcstoumax(const wchar_t * __restrict,
9598 wchar_t ** __restrict, int);
9599__END_DECLS
9600
9601#endif /* !_INTTYPES_H_ */
9602# 63 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/inttypes.h" 3 4
9603# 27 "/home/alr48/cheri/output-debug/sdk256/bin/../lib/clang/3.8.0/include/inttypes.h" 2 3 4
9604
9605#if defined(_MSC_VER) && _MSC_VER < 1900
9606/* MSVC headers define int32_t as int, but PRIx32 as "lx" instead of "x".
9607 * This triggers format warnings, so fix it up here. */
9608#undef PRId32
9609#undef PRIdLEAST32
9610#undef PRIdFAST32
9611#undef PRIi32
9612#undef PRIiLEAST32
9613#undef PRIiFAST32
9614#undef PRIo32
9615#undef PRIoLEAST32
9616#undef PRIoFAST32
9617#undef PRIu32
9618#undef PRIuLEAST32
9619#undef PRIuFAST32
9620#undef PRIx32
9621#undef PRIxLEAST32
9622#undef PRIxFAST32
9623#undef PRIX32
9624#undef PRIXLEAST32
9625#undef PRIXFAST32
9626
9627#undef SCNd32
9628#undef SCNdLEAST32
9629#undef SCNdFAST32
9630#undef SCNi32
9631#undef SCNiLEAST32
9632#undef SCNiFAST32
9633#undef SCNo32
9634#undef SCNoLEAST32
9635#undef SCNoFAST32
9636#undef SCNu32
9637#undef SCNuLEAST32
9638#undef SCNuFAST32
9639#undef SCNx32
9640#undef SCNxLEAST32
9641#undef SCNxFAST32
9642
9643#define PRId32 "d"
9644#define PRIdLEAST32 "d"
9645#define PRIdFAST32 "d"
9646#define PRIi32 "i"
9647#define PRIiLEAST32 "i"
9648#define PRIiFAST32 "i"
9649#define PRIo32 "o"
9650#define PRIoLEAST32 "o"
9651#define PRIoFAST32 "o"
9652#define PRIu32 "u"
9653#define PRIuLEAST32 "u"
9654#define PRIuFAST32 "u"
9655#define PRIx32 "x"
9656#define PRIxLEAST32 "x"
9657#define PRIxFAST32 "x"
9658#define PRIX32 "X"
9659#define PRIXLEAST32 "X"
9660#define PRIXFAST32 "X"
9661
9662#define SCNd32 "d"
9663#define SCNdLEAST32 "d"
9664#define SCNdFAST32 "d"
9665#define SCNi32 "i"
9666#define SCNiLEAST32 "i"
9667#define SCNiFAST32 "i"
9668#define SCNo32 "o"
9669#define SCNoLEAST32 "o"
9670#define SCNoFAST32 "o"
9671#define SCNu32 "u"
9672#define SCNuLEAST32 "u"
9673#define SCNuFAST32 "u"
9674#define SCNx32 "x"
9675#define SCNxLEAST32 "x"
9676#define SCNxFAST32 "x"
9677#endif
9678# 101 "/home/alr48/cheri/output-debug/sdk256/bin/../lib/clang/3.8.0/include/inttypes.h" 3 4
9679
9680#endif /* __CLANG_INTTYPES_H */
9681# 103 "/home/alr48/cheri/output-debug/sdk256/bin/../lib/clang/3.8.0/include/inttypes.h" 3 4
9682# 54 "/home/alr48/cheri/sources/cheribsd/bin/cheritest/cheritest_registers.c" 2
9683#if 0 /* expanded by -frewrite-includes */
9684#include <stdio.h>
9685#endif /* expanded by -frewrite-includes */
9686# 54 "/home/alr48/cheri/sources/cheribsd/bin/cheritest/cheritest_registers.c"
9687# 1 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/stdio.h" 1 3 4
9688/*-
9689 * Copyright (c) 1990, 1993
9690 * The Regents of the University of California. All rights reserved.
9691 *
9692 * This code is derived from software contributed to Berkeley by
9693 * Chris Torek.
9694 *
9695 * Redistribution and use in source and binary forms, with or without
9696 * modification, are permitted provided that the following conditions
9697 * are met:
9698 * 1. Redistributions of source code must retain the above copyright
9699 * notice, this list of conditions and the following disclaimer.
9700 * 2. Redistributions in binary form must reproduce the above copyright
9701 * notice, this list of conditions and the following disclaimer in the
9702 * documentation and/or other materials provided with the distribution.
9703 * 3. Neither the name of the University nor the names of its contributors
9704 * may be used to endorse or promote products derived from this software
9705 * without specific prior written permission.
9706 *
9707 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
9708 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
9709 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
9710 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
9711 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
9712 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
9713 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
9714 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
9715 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
9716 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
9717 * SUCH DAMAGE.
9718 *
9719 * @(#)stdio.h 8.5 (Berkeley) 4/29/95
9720 * $FreeBSD$
9721 */
9722
9723#ifndef _STDIO_H_
9724#define _STDIO_H_
9725
9726#if 0 /* expanded by -frewrite-includes */
9727#include <sys/cdefs.h>
9728#endif /* expanded by -frewrite-includes */
9729# 39 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/stdio.h" 3 4
9730# 40 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/stdio.h" 3 4
9731#if 0 /* expanded by -frewrite-includes */
9732#include <sys/_null.h>
9733#endif /* expanded by -frewrite-includes */
9734# 40 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/stdio.h" 3 4
9735# 41 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/stdio.h" 3 4
9736#if 0 /* expanded by -frewrite-includes */
9737#include <sys/_types.h>
9738#endif /* expanded by -frewrite-includes */
9739# 41 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/stdio.h" 3 4
9740# 42 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/stdio.h" 3 4
9741
9742typedef __off_t fpos_t;
9743
9744#ifndef _SIZE_T_DECLARED
9745typedef __size_t size_t;
9746#define _SIZE_T_DECLARED
9747#endif
9748# 49 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/stdio.h" 3 4
9749
9750#if __POSIX_VISIBLE >= 200809
9751#ifndef _OFF_T_DECLARED
9752#define _OFF_T_DECLARED
9753typedef __off_t off_t;
9754#endif
9755# 55 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/stdio.h" 3 4
9756#ifndef _SSIZE_T_DECLARED
9757#define _SSIZE_T_DECLARED
9758typedef __ssize_t ssize_t;
9759#endif
9760# 59 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/stdio.h" 3 4
9761#endif
9762# 60 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/stdio.h" 3 4
9763
9764#ifndef _OFF64_T_DECLARED
9765#define _OFF64_T_DECLARED
9766typedef __off64_t off64_t;
9767#endif
9768# 65 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/stdio.h" 3 4
9769
9770#if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE
9771#ifndef _VA_LIST_DECLARED
9772typedef __va_list va_list;
9773#define _VA_LIST_DECLARED
9774#endif
9775# 71 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/stdio.h" 3 4
9776#endif
9777# 72 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/stdio.h" 3 4
9778
9779#define _FSTDIO /* Define for new stdio with functions. */
9780
9781/*
9782 * NB: to fit things in six character monocase externals, the stdio
9783 * code uses the prefix `__s' for stdio objects, typically followed
9784 * by a three-character attempt at a mnemonic.
9785 */
9786
9787/* stdio buffers */
9788struct __sbuf {
9789 unsigned char *_base;
9790 int _size;
9791};
9792
9793/*
9794 * stdio state variables.
9795 *
9796 * The following always hold:
9797 *
9798 * if (_flags&(__SLBF|__SWR)) == (__SLBF|__SWR),
9799 * _lbfsize is -_bf._size, else _lbfsize is 0
9800 * if _flags&__SRD, _w is 0
9801 * if _flags&__SWR, _r is 0
9802 *
9803 * This ensures that the getc and putc macros (or inline functions) never
9804 * try to write or read from a file that is in `read' or `write' mode.
9805 * (Moreover, they can, and do, automatically switch from read mode to
9806 * write mode, and back, on "r+" and "w+" files.)
9807 *
9808 * _lbfsize is used only to make the inline line-buffered output stream
9809 * code as compact as possible.
9810 *
9811 * _ub, _up, and _ur are used when ungetc() pushes back more characters
9812 * than fit in the current _bf, or when ungetc() pushes back a character
9813 * that does not match the previous one in _bf. When this happens,
9814 * _ub._base becomes non-nil (i.e., a stream has ungetc() data iff
9815 * _ub._base!=NULL) and _up and _ur save the current values of _p and _r.
9816 *
9817 * Certain members of __sFILE are accessed directly via macros or
9818 * inline functions. To preserve ABI compat, these members must not
9819 * be disturbed. These members are marked below with (*).
9820 */
9821struct __sFILE {
9822 unsigned char *_p; /* (*) current position in (some) buffer */
9823 int _r; /* (*) read space left for getc() */
9824 int _w; /* (*) write space left for putc() */
9825 short _flags; /* (*) flags, below; this FILE is free if 0 */
9826 short _file; /* (*) fileno, if Unix descriptor, else -1 */
9827 struct __sbuf _bf; /* (*) the buffer (at least 1 byte, if !NULL) */
9828 int _lbfsize; /* (*) 0 or -_bf._size, for inline putc */
9829
9830 /* operations */
9831 void *_cookie; /* (*) cookie passed to io functions */
9832 int (*_close)(void *);
9833 int (*_read)(void *, char *, int);
9834 fpos_t (*_seek)(void *, fpos_t, int);
9835 int (*_write)(void *, const char *, int);
9836
9837 /* separate buffer for long sequences of ungetc() */
9838 struct __sbuf _ub; /* ungetc buffer */
9839 unsigned char *_up; /* saved _p when _p is doing ungetc data */
9840 int _ur; /* saved _r when _r is counting ungetc data */
9841
9842 /* tricks to meet minimum requirements even when malloc() fails */
9843 unsigned char _ubuf[3]; /* guarantee an ungetc() buffer */
9844 unsigned char _nbuf[1]; /* guarantee a getc() buffer */
9845
9846 /* separate buffer for fgetln() when line crosses buffer boundary */
9847 struct __sbuf _lb; /* buffer for fgetln() */
9848
9849 /* Unix stdio files get aligned to block boundaries on fseek() */
9850 int _blksize; /* stat.st_blksize (may be != _bf._size) */
9851 fpos_t _offset; /* current lseek offset */
9852
9853 struct pthread_mutex *_fl_mutex; /* used for MT-safety */
9854 struct pthread *_fl_owner; /* current owner */
9855 int _fl_count; /* recursive lock count */
9856 int _orientation; /* orientation for fwide() */
9857 __mbstate_t _mbstate; /* multibyte conversion state */
9858 int _flags2; /* additional flags */
9859};
9860#ifndef _STDFILE_DECLARED
9861#define _STDFILE_DECLARED
9862typedef struct __sFILE FILE;
9863#endif
9864# 158 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/stdio.h" 3 4
9865#ifndef _STDSTREAM_DECLARED
9866__BEGIN_DECLS
9867extern FILE *__stdinp;
9868extern FILE *__stdoutp;
9869extern FILE *__stderrp;
9870__END_DECLS
9871#define _STDSTREAM_DECLARED
9872#endif
9873# 166 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/stdio.h" 3 4
9874
9875#define __SLBF 0x0001 /* line buffered */
9876#define __SNBF 0x0002 /* unbuffered */
9877#define __SRD 0x0004 /* OK to read */
9878#define __SWR 0x0008 /* OK to write */
9879 /* RD and WR are never simultaneously asserted */
9880#define __SRW 0x0010 /* open for reading & writing */
9881#define __SEOF 0x0020 /* found EOF */
9882#define __SERR 0x0040 /* found error */
9883#define __SMBF 0x0080 /* _bf._base is from malloc */
9884#define __SAPP 0x0100 /* fdopen()ed in append mode */
9885#define __SSTR 0x0200 /* this is an sprintf/snprintf string */
9886#define __SOPT 0x0400 /* do fseek() optimization */
9887#define __SNPT 0x0800 /* do not do fseek() optimization */
9888#define __SOFF 0x1000 /* set iff _offset is in fact correct */
9889#define __SMOD 0x2000 /* true => fgetln modified _p text */
9890#define __SALC 0x4000 /* allocate string space dynamically */
9891#define __SIGN 0x8000 /* ignore this file in _fwalk */
9892
9893#define __S2OAP 0x0001 /* O_APPEND mode is set */
9894
9895/*
9896 * The following three definitions are for ANSI C, which took them
9897 * from System V, which brilliantly took internal interface macros and
9898 * made them official arguments to setvbuf(), without renaming them.
9899 * Hence, these ugly _IOxxx names are *supposed* to appear in user code.
9900 *
9901 * Although numbered as their counterparts above, the implementation
9902 * does not rely on this.
9903 */
9904#define _IOFBF 0 /* setvbuf should set fully buffered */
9905#define _IOLBF 1 /* setvbuf should set line buffered */
9906#define _IONBF 2 /* setvbuf should set unbuffered */
9907
9908#define BUFSIZ 1024 /* size of buffer used by setbuf */
9909#define EOF (-1)
9910
9911/*
9912 * FOPEN_MAX is a minimum maximum, and is the number of streams that
9913 * stdio can provide without attempting to allocate further resources
9914 * (which could fail). Do not use this for anything.
9915 */
9916 /* must be == _POSIX_STREAM_MAX <limits.h> */
9917#ifndef FOPEN_MAX
9918#define FOPEN_MAX 20 /* must be <= OPEN_MAX <sys/syslimits.h> */
9919#endif
9920# 212 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/stdio.h" 3 4
9921#define FILENAME_MAX 1024 /* must be <= PATH_MAX <sys/syslimits.h> */
9922
9923/* System V/ANSI C; this is the wrong way to do this, do *not* use these. */
9924#if __XSI_VISIBLE
9925#define P_tmpdir "/tmp/"
9926#endif
9927# 218 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/stdio.h" 3 4
9928#define L_tmpnam 1024 /* XXX must be == PATH_MAX */
9929#define TMP_MAX 308915776
9930
9931#ifndef SEEK_SET
9932#define SEEK_SET 0 /* set file offset to offset */
9933#endif
9934# 224 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/stdio.h" 3 4
9935#ifndef SEEK_CUR
9936#define SEEK_CUR 1 /* set file offset to current plus offset */
9937#endif
9938# 227 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/stdio.h" 3 4
9939#ifndef SEEK_END
9940#define SEEK_END 2 /* set file offset to EOF plus offset */
9941#endif
9942# 230 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/stdio.h" 3 4
9943
9944#define stdin __stdinp
9945#define stdout __stdoutp
9946#define stderr __stderrp
9947
9948__BEGIN_DECLS
9949#ifdef _XLOCALE_H_
9950#if 0 /* expanded by -frewrite-includes */
9951#include <xlocale/_stdio.h>
9952#endif /* expanded by -frewrite-includes */
9953# 237 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/stdio.h" 3 4
9954# 238 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/stdio.h" 3 4
9955#endif
9956# 239 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/stdio.h" 3 4
9957/*
9958 * Functions defined in ANSI C standard.
9959 */
9960void clearerr(FILE *);
9961int fclose(FILE *);
9962int feof(FILE *);
9963int ferror(FILE *);
9964int fflush(FILE *);
9965int fgetc(FILE *);
9966int fgetpos(FILE * __restrict, fpos_t * __restrict);
9967char *fgets(char * __restrict, int, FILE * __restrict);
9968FILE *fopen(const char * __restrict, const char * __restrict);
9969int fprintf(FILE * __restrict, const char * __restrict, ...) __printflike(2, 3);
9970int fputc(int, FILE *);
9971int fputs(const char * __restrict, FILE * __restrict);
9972size_t fread(void * __restrict, size_t, size_t, FILE * __restrict);
9973FILE *freopen(const char * __restrict, const char * __restrict, FILE * __restrict);
9974int fscanf(FILE * __restrict, const char * __restrict, ...) __scanflike(2, 3);;
9975int fseek(FILE *, long, int);
9976int fsetpos(FILE *, const fpos_t *);
9977long ftell(FILE *);
9978size_t fwrite(const void * __restrict, size_t, size_t, FILE * __restrict);
9979int getc(FILE *);
9980int getchar(void);
9981char *gets(char *);
9982void perror(const char *);
9983int printf(const char * __restrict, ...) __printflike(1, 2);
9984int putc(int, FILE *);
9985int putchar(int);
9986int puts(const char *);
9987int remove(const char *);
9988int rename(const char *, const char *);
9989void rewind(FILE *);
9990int scanf(const char * __restrict, ...) __scanflike(1, 2);
9991void setbuf(FILE * __restrict, char * __restrict);
9992int setvbuf(FILE * __restrict, char * __restrict, int, size_t);
9993int sprintf(char * __restrict, const char * __restrict, ...) __printflike(2, 3);
9994int sscanf(const char * __restrict, const char * __restrict, ...) __scanflike(2, 3);
9995FILE *tmpfile(void);
9996char *tmpnam(char *);
9997int ungetc(int, FILE *);
9998int vfprintf(FILE * __restrict, const char * __restrict,
9999 __va_list);
10000int vprintf(const char * __restrict, __va_list);
10001int vsprintf(char * __restrict, const char * __restrict,
10002 __va_list);
10003
10004#if __ISO_C_VISIBLE >= 1999
10005int snprintf(char * __restrict, size_t, const char * __restrict,
10006 ...) __printflike(3, 4);
10007int vfscanf(FILE * __restrict, const char * __restrict, __va_list)
10008 __scanflike(2, 0);
10009int vscanf(const char * __restrict, __va_list) __scanflike(1, 0);
10010int vsnprintf(char * __restrict, size_t, const char * __restrict,
10011 __va_list) __printflike(3, 0);
10012int vsscanf(const char * __restrict, const char * __restrict, __va_list)
10013 __scanflike(2, 0);
10014#endif
10015# 297 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/stdio.h" 3 4
10016
10017/*
10018 * Functions defined in all versions of POSIX 1003.1.
10019 */
10020#if __BSD_VISIBLE || (__POSIX_VISIBLE && __POSIX_VISIBLE <= 199506)
10021#define L_cuserid 17 /* size for cuserid(3); MAXLOGNAME, legacy */
10022#endif
10023# 304 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/stdio.h" 3 4
10024
10025#if __POSIX_VISIBLE
10026#define L_ctermid 1024 /* size for ctermid(3); PATH_MAX */
10027
10028char *ctermid(char *);
10029FILE *fdopen(int, const char *);
10030int fileno(FILE *);
10031#endif /* __POSIX_VISIBLE */
10032# 312 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/stdio.h" 3 4
10033
10034#if __POSIX_VISIBLE >= 199209
10035int pclose(FILE *);
10036FILE *popen(const char *, const char *);
10037#endif
10038# 317 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/stdio.h" 3 4
10039
10040#if __POSIX_VISIBLE >= 199506
10041int ftrylockfile(FILE *);
10042void flockfile(FILE *);
10043void funlockfile(FILE *);
10044
10045/*
10046 * These are normally used through macros as defined below, but POSIX
10047 * requires functions as well.
10048 */
10049int getc_unlocked(FILE *);
10050int getchar_unlocked(void);
10051int putc_unlocked(int, FILE *);
10052int putchar_unlocked(int);
10053#endif
10054# 332 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/stdio.h" 3 4
10055#if __BSD_VISIBLE
10056void clearerr_unlocked(FILE *);
10057int feof_unlocked(FILE *);
10058int ferror_unlocked(FILE *);
10059int fileno_unlocked(FILE *);
10060#endif
10061# 338 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/stdio.h" 3 4
10062
10063#if __POSIX_VISIBLE >= 200112
10064int fseeko(FILE *, __off_t, int);
10065__off_t ftello(FILE *);
10066#endif
10067# 343 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/stdio.h" 3 4
10068
10069#if __BSD_VISIBLE || __XSI_VISIBLE > 0 && __XSI_VISIBLE < 600
10070int getw(FILE *);
10071int putw(int, FILE *);
10072#endif /* BSD or X/Open before issue 6 */
10073# 348 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/stdio.h" 3 4
10074
10075#if __XSI_VISIBLE
10076char *tempnam(const char *, const char *);
10077#endif
10078# 352 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/stdio.h" 3 4
10079
10080#if __POSIX_VISIBLE >= 200809
10081FILE *fmemopen(void * __restrict, size_t, const char * __restrict);
10082ssize_t getdelim(char ** __restrict, size_t * __restrict, int,
10083 FILE * __restrict);
10084FILE *open_memstream(char **, size_t *);
10085int renameat(int, const char *, int, const char *);
10086int vdprintf(int, const char * __restrict, __va_list) __printflike(2, 0);
10087/* _WITH_GETLINE to allow pre 11 sources to build on 11+ systems */
10088ssize_t getline(char ** __restrict, size_t * __restrict, FILE * __restrict);
10089int dprintf(int, const char * __restrict, ...) __printflike(2, 3);
10090#endif /* __POSIX_VISIBLE >= 200809 */
10091# 364 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/stdio.h" 3 4
10092
10093/*
10094 * Routines that are purely local.
10095 */
10096#if __BSD_VISIBLE
10097int asprintf(char **, const char *, ...) __printflike(2, 3);
10098char *ctermid_r(char *);
10099void fcloseall(void);
10100int fdclose(FILE *, int *);
10101char *fgetln(FILE *, size_t *);
10102const char *fmtcheck(const char *, const char *) __format_arg(2);
10103int fpurge(FILE *);
10104void setbuffer(FILE *, char *, int);
10105int setlinebuf(FILE *);
10106int vasprintf(char **, const char *, __va_list)
10107 __printflike(2, 0);
10108
10109/*
10110 * The system error table contains messages for the first sys_nerr
10111 * positive errno values. Use strerror() or strerror_r() from <string.h>
10112 * instead.
10113 */
10114extern const int sys_nerr;
10115extern const char * const sys_errlist[];
10116
10117/*
10118 * Stdio function-access interface.
10119 */
10120FILE *funopen(const void *,
10121 int (*)(void *, char *, int),
10122 int (*)(void *, const char *, int),
10123 fpos_t (*)(void *, fpos_t, int),
10124 int (*)(void *));
10125#define fropen(cookie, fn) funopen(cookie, fn, 0, 0, 0)
10126#define fwopen(cookie, fn) funopen(cookie, 0, fn, 0, 0)
10127
10128typedef __ssize_t cookie_read_function_t(void *, char *, size_t);
10129typedef __ssize_t cookie_write_function_t(void *, const char *, size_t);
10130typedef int cookie_seek_function_t(void *, off64_t *, int);
10131typedef int cookie_close_function_t(void *);
10132typedef struct {
10133 cookie_read_function_t *read;
10134 cookie_write_function_t *write;
10135 cookie_seek_function_t *seek;
10136 cookie_close_function_t *close;
10137} cookie_io_functions_t;
10138FILE *fopencookie(void *, const char *, cookie_io_functions_t);
10139
10140/*
10141 * Portability hacks. See <sys/types.h>.
10142 */
10143#ifndef _FTRUNCATE_DECLARED
10144#define _FTRUNCATE_DECLARED
10145int ftruncate(int, __off_t);
10146#endif
10147# 419 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/stdio.h" 3 4
10148#ifndef _LSEEK_DECLARED
10149#define _LSEEK_DECLARED
10150__off_t lseek(int, __off_t, int);
10151#endif
10152# 423 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/stdio.h" 3 4
10153#ifndef _MMAP_DECLARED
10154#define _MMAP_DECLARED
10155void *mmap(void *, size_t, int, int, int, __off_t);
10156#endif
10157# 427 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/stdio.h" 3 4
10158#ifndef _TRUNCATE_DECLARED
10159#define _TRUNCATE_DECLARED
10160int truncate(const char *, __off_t);
10161#endif
10162# 431 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/stdio.h" 3 4
10163#endif /* __BSD_VISIBLE */
10164# 432 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/stdio.h" 3 4
10165
10166/*
10167 * Functions internal to the implementation.
10168 */
10169int __srget(FILE *);
10170int __swbuf(int, FILE *);
10171
10172/*
10173 * The __sfoo macros are here so that we can
10174 * define function versions in the C library.
10175 */
10176#define __sgetc(p) (--(p)->_r < 0 ? __srget(p) : (int)(*(p)->_p++))
10177#if defined(__GNUC__) && defined(__STDC__)
10178static __inline int __sputc(int _c, FILE *_p) {
10179 if (--_p->_w >= 0 || (_p->_w >= _p->_lbfsize && (char)_c != '\n'))
10180 return (*_p->_p++ = _c);
10181 else
10182 return (__swbuf(_c, _p));
10183}
10184#else
10185# 452 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/stdio.h" 3 4
10186/*
10187 * This has been tuned to generate reasonable code on the vax using pcc.
10188 */
10189#define __sputc(c, p) \
10190 (--(p)->_w < 0 ? \
10191 (p)->_w >= (p)->_lbfsize ? \
10192 (*(p)->_p = (c)), *(p)->_p != '\n' ? \
10193 (int)*(p)->_p++ : \
10194 __swbuf('\n', p) : \
10195 __swbuf((int)(c), p) : \
10196 (*(p)->_p = (c), (int)*(p)->_p++))
10197#endif
10198# 464 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/stdio.h" 3 4
10199
10200extern int __isthreaded;
10201
10202#ifndef __cplusplus
10203
10204#define __sfeof(p) (((p)->_flags & __SEOF) != 0)
10205#define __sferror(p) (((p)->_flags & __SERR) != 0)
10206#define __sclearerr(p) ((void)((p)->_flags &= ~(__SERR|__SEOF)))
10207#define __sfileno(p) ((p)->_file)
10208
10209
10210#define feof(p) (!__isthreaded ? __sfeof(p) : (feof)(p))
10211#define ferror(p) (!__isthreaded ? __sferror(p) : (ferror)(p))
10212#define clearerr(p) (!__isthreaded ? __sclearerr(p) : (clearerr)(p))
10213
10214#if __POSIX_VISIBLE
10215#define fileno(p) (!__isthreaded ? __sfileno(p) : (fileno)(p))
10216#endif
10217# 482 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/stdio.h" 3 4
10218
10219#define getc(fp) (!__isthreaded ? __sgetc(fp) : (getc)(fp))
10220#define putc(x, fp) (!__isthreaded ? __sputc(x, fp) : (putc)(x, fp))
10221
10222#define getchar() getc(stdin)
10223#define putchar(x) putc(x, stdout)
10224
10225#if __BSD_VISIBLE
10226/*
10227 * See ISO/IEC 9945-1 ANSI/IEEE Std 1003.1 Second Edition 1996-07-12
10228 * B.8.2.7 for the rationale behind the *_unlocked() macros.
10229 */
10230#define feof_unlocked(p) __sfeof(p)
10231#define ferror_unlocked(p) __sferror(p)
10232#define clearerr_unlocked(p) __sclearerr(p)
10233#define fileno_unlocked(p) __sfileno(p)
10234#endif
10235# 499 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/stdio.h" 3 4
10236#if __POSIX_VISIBLE >= 199506
10237#define getc_unlocked(fp) __sgetc(fp)
10238#define putc_unlocked(x, fp) __sputc(x, fp)
10239
10240#define getchar_unlocked() getc_unlocked(stdin)
10241#define putchar_unlocked(x) putc_unlocked(x, stdout)
10242#endif
10243# 506 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/stdio.h" 3 4
10244#endif /* __cplusplus */
10245# 507 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/stdio.h" 3 4
10246
10247__END_DECLS
10248#endif /* !_STDIO_H_ */
10249# 510 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/stdio.h" 3 4
10250# 55 "/home/alr48/cheri/sources/cheribsd/bin/cheritest/cheritest_registers.c" 2
10251#if 0 /* expanded by -frewrite-includes */
10252#include <stdlib.h>
10253#endif /* expanded by -frewrite-includes */
10254# 55 "/home/alr48/cheri/sources/cheribsd/bin/cheritest/cheritest_registers.c"
10255# 1 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/stdlib.h" 1 3 4
10256/*-
10257 * Copyright (c) 1990, 1993
10258 * The Regents of the University of California. All rights reserved.
10259 *
10260 * Redistribution and use in source and binary forms, with or without
10261 * modification, are permitted provided that the following conditions
10262 * are met:
10263 * 1. Redistributions of source code must retain the above copyright
10264 * notice, this list of conditions and the following disclaimer.
10265 * 2. Redistributions in binary form must reproduce the above copyright
10266 * notice, this list of conditions and the following disclaimer in the
10267 * documentation and/or other materials provided with the distribution.
10268 * 3. Neither the name of the University nor the names of its contributors
10269 * may be used to endorse or promote products derived from this software
10270 * without specific prior written permission.
10271 *
10272 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
10273 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
10274 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
10275 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
10276 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
10277 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
10278 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
10279 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
10280 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
10281 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
10282 * SUCH DAMAGE.
10283 *
10284 * @(#)stdlib.h 8.5 (Berkeley) 5/19/95
10285 * $FreeBSD$
10286 */
10287
10288#ifndef _STDLIB_H_
10289#define _STDLIB_H_
10290
10291#if 0 /* expanded by -frewrite-includes */
10292#include <sys/cdefs.h>
10293#endif /* expanded by -frewrite-includes */
10294# 36 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/stdlib.h" 3 4
10295# 37 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/stdlib.h" 3 4
10296#if 0 /* expanded by -frewrite-includes */
10297#include <sys/_null.h>
10298#endif /* expanded by -frewrite-includes */
10299# 37 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/stdlib.h" 3 4
10300# 38 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/stdlib.h" 3 4
10301#if 0 /* expanded by -frewrite-includes */
10302#include <sys/_types.h>
10303#endif /* expanded by -frewrite-includes */
10304# 38 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/stdlib.h" 3 4
10305# 39 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/stdlib.h" 3 4
10306
10307#if __BSD_VISIBLE
10308#ifndef _RUNE_T_DECLARED
10309typedef __rune_t rune_t;
10310#define _RUNE_T_DECLARED
10311#endif
10312# 45 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/stdlib.h" 3 4
10313#endif
10314# 46 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/stdlib.h" 3 4
10315
10316#ifndef _SIZE_T_DECLARED
10317typedef __size_t size_t;
10318#define _SIZE_T_DECLARED
10319#endif
10320# 51 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/stdlib.h" 3 4
10321
10322#ifndef __cplusplus
10323#ifndef _WCHAR_T_DECLARED
10324typedef ___wchar_t wchar_t;
10325#define _WCHAR_T_DECLARED
10326#endif
10327# 57 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/stdlib.h" 3 4
10328#endif
10329# 58 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/stdlib.h" 3 4
10330
10331typedef struct {
10332 int quot; /* quotient */
10333 int rem; /* remainder */
10334} div_t;
10335
10336typedef struct {
10337 long quot;
10338 long rem;
10339} ldiv_t;
10340
10341#define EXIT_FAILURE 1
10342#define EXIT_SUCCESS 0
10343
10344#define RAND_MAX 0x7ffffffd
10345
10346__BEGIN_DECLS
10347#ifdef _XLOCALE_H_
10348#if 0 /* expanded by -frewrite-includes */
10349#include <xlocale/_stdlib.h>
10350#endif /* expanded by -frewrite-includes */
10351# 76 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/stdlib.h" 3 4
10352# 77 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/stdlib.h" 3 4
10353#endif
10354# 78 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/stdlib.h" 3 4
10355extern int __mb_cur_max;
10356extern int ___mb_cur_max(void);
10357#define MB_CUR_MAX ((size_t)___mb_cur_max())
10358
10359_Noreturn void abort(void);
10360int abs(int) __pure2;
10361int atexit(void (*)(void));
10362double atof(const char *);
10363int atoi(const char *);
10364long atol(const char *);
10365void *bsearch(const void *, const void *, size_t,
10366 size_t, int (*)(const void *, const void *));
10367void *calloc(size_t, size_t) __malloc_like __result_use_check
10368 __alloc_size(1) __alloc_size(2);
10369div_t div(int, int) __pure2;
10370_Noreturn void exit(int);
10371void free(void *);
10372char *getenv(const char *);
10373long labs(long) __pure2;
10374ldiv_t ldiv(long, long) __pure2;
10375void *malloc(size_t) __malloc_like __result_use_check __alloc_size(1);
10376int mblen(const char *, size_t);
10377size_t mbstowcs(wchar_t * __restrict , const char * __restrict, size_t);
10378int mbtowc(wchar_t * __restrict, const char * __restrict, size_t);
10379void qsort(void *, size_t, size_t,
10380 int (*)(const void *, const void *));
10381int rand(void);
10382void *realloc(void *, size_t) __result_use_check __alloc_size(2);
10383void srand(unsigned);
10384double strtod(const char * __restrict, char ** __restrict);
10385float strtof(const char * __restrict, char ** __restrict);
10386long strtol(const char * __restrict, char ** __restrict, int);
10387long double
10388 strtold(const char * __restrict, char ** __restrict);
10389unsigned long
10390 strtoul(const char * __restrict, char ** __restrict, int);
10391int system(const char *);
10392int wctomb(char *, wchar_t);
10393size_t wcstombs(char * __restrict, const wchar_t * __restrict, size_t);
10394
10395/*
10396 * Functions added in C99 which we make conditionally available in the
10397 * BSD^C89 namespace if the compiler supports `long long'.
10398 * The #if test is more complicated than it ought to be because
10399 * __BSD_VISIBLE implies __ISO_C_VISIBLE == 1999 *even if* `long long'
10400 * is not supported in the compilation environment (which therefore means
10401 * that it can't really be ISO C99).
10402 *
10403 * (The only other extension made by C99 in thie header is _Exit().)
10404 */
10405#if __ISO_C_VISIBLE >= 1999 || defined(__cplusplus)
10406#ifdef __LONG_LONG_SUPPORTED
10407/* LONGLONG */
10408typedef struct {
10409 long long quot;
10410 long long rem;
10411} lldiv_t;
10412
10413/* LONGLONG */
10414long long
10415 atoll(const char *);
10416/* LONGLONG */
10417long long
10418 llabs(long long) __pure2;
10419/* LONGLONG */
10420lldiv_t lldiv(long long, long long) __pure2;
10421/* LONGLONG */
10422long long
10423 strtoll(const char * __restrict, char ** __restrict, int);
10424/* LONGLONG */
10425unsigned long long
10426 strtoull(const char * __restrict, char ** __restrict, int);
10427#endif /* __LONG_LONG_SUPPORTED */
10428# 151 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/stdlib.h" 3 4
10429
10430_Noreturn void _Exit(int);
10431#endif /* __ISO_C_VISIBLE >= 1999 */
10432# 154 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/stdlib.h" 3 4
10433
10434/*
10435 * If we're in a mode greater than C99, expose C11 functions.
10436 */
10437#if __ISO_C_VISIBLE >= 2011 || __cplusplus >= 201103L
10438void * aligned_alloc(size_t, size_t) __malloc_like __alloc_align(1)
10439 __alloc_size(2);
10440int at_quick_exit(void (*)(void));
10441_Noreturn void
10442 quick_exit(int);
10443#endif /* __ISO_C_VISIBLE >= 2011 */
10444# 165 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/stdlib.h" 3 4
10445/*
10446 * Extensions made by POSIX relative to C.
10447 */
10448#if __POSIX_VISIBLE >= 199506 || __XSI_VISIBLE
10449char *realpath(const char * __restrict, char * __restrict);
10450#endif
10451# 171 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/stdlib.h" 3 4
10452#if __POSIX_VISIBLE >= 199506
10453int rand_r(unsigned *); /* (TSF) */
10454#endif
10455# 174 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/stdlib.h" 3 4
10456#if __POSIX_VISIBLE >= 200112
10457int posix_memalign(void **, size_t, size_t) __nonnull(1); /* (ADV) */
10458int setenv(const char *, const char *, int);
10459int unsetenv(const char *);
10460#endif
10461# 179 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/stdlib.h" 3 4
10462
10463#if __POSIX_VISIBLE >= 200809 || __XSI_VISIBLE
10464int getsubopt(char **, char *const *, char **);
10465#ifndef _MKDTEMP_DECLARED
10466char *mkdtemp(char *);
10467#define _MKDTEMP_DECLARED
10468#endif
10469# 186 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/stdlib.h" 3 4
10470#ifndef _MKSTEMP_DECLARED
10471int mkstemp(char *);
10472#define _MKSTEMP_DECLARED
10473#endif
10474# 190 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/stdlib.h" 3 4
10475#endif /* __POSIX_VISIBLE >= 200809 || __XSI_VISIBLE */
10476# 191 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/stdlib.h" 3 4
10477
10478/*
10479 * The only changes to the XSI namespace in revision 6 were the deletion
10480 * of the ttyslot() and valloc() functions, which FreeBSD never declared
10481 * in this header. For revision 7, ecvt(), fcvt(), and gcvt(), which
10482 * FreeBSD also does not have, and mktemp(), are to be deleted.
10483 */
10484#if __XSI_VISIBLE
10485/* XXX XSI requires pollution from <sys/wait.h> here. We'd rather not. */
10486long a64l(const char *);
10487double drand48(void);
10488/* char *ecvt(double, int, int * __restrict, int * __restrict); */
10489double erand48(unsigned short[3]);
10490/* char *fcvt(double, int, int * __restrict, int * __restrict); */
10491/* char *gcvt(double, int, int * __restrict, int * __restrict); */
10492int grantpt(int);
10493char *initstate(unsigned int, char *, size_t);
10494long jrand48(unsigned short[3]);
10495char *l64a(long);
10496void lcong48(unsigned short[7]);
10497long lrand48(void);
10498#if !defined(_MKTEMP_DECLARED) && (__BSD_VISIBLE || __XSI_VISIBLE <= 600)
10499char *mktemp(char *);
10500#define _MKTEMP_DECLARED
10501#endif
10502# 216 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/stdlib.h" 3 4
10503long mrand48(void);
10504long nrand48(unsigned short[3]);
10505int posix_openpt(int);
10506char *ptsname(int);
10507int putenv(char *);
10508long random(void);
10509unsigned short
10510 *seed48(unsigned short[3]);
10511char *setstate(/* const */ char *);
10512void srand48(long);
10513void srandom(unsigned int);
10514int unlockpt(int);
10515#endif /* __XSI_VISIBLE */
10516# 229 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/stdlib.h" 3 4
10517
10518#if __BSD_VISIBLE
10519extern const char *malloc_conf;
10520extern void (*malloc_message)(void *, const char *);
10521
10522/*
10523 * The alloca() function can't be implemented in C, and on some
10524 * platforms it can't be implemented at all as a callable function.
10525 * The GNU C compiler provides a built-in alloca() which we can use;
10526 * in all other cases, provide a prototype, mainly to pacify various
10527 * incarnations of lint. On platforms where alloca() is not in libc,
10528 * programs which use it will fail to link when compiled with non-GNU
10529 * compilers.
10530 */
10531#if __GNUC__ >= 2 || defined(__INTEL_COMPILER)
10532#undef alloca /* some GNU bits try to get cute and define this on their own */
10533#define alloca(sz) __builtin_alloca(sz)
10534#elif defined(lint)
10535# 247 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/stdlib.h" 3 4
10536void *alloca(size_t);
10537#endif
10538# 249 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/stdlib.h" 3 4
10539
10540void abort2(const char *, int, void **) __dead2;
10541__uint32_t
10542 arc4random(void);
10543void arc4random_addrandom(unsigned char *, int);
10544void arc4random_buf(void *, size_t);
10545void arc4random_stir(void);
10546__uint32_t
10547 arc4random_uniform(__uint32_t);
10548#ifdef __BLOCKS__
10549int atexit_b(void (^)(void));
10550void *bsearch_b(const void *, const void *, size_t,
10551 size_t, int (^)(const void *, const void *));
10552#endif
10553# 263 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/stdlib.h" 3 4
10554char *getbsize(int *, long *);
10555 /* getcap(3) functions */
10556char *cgetcap(char *, const char *, int);
10557int cgetclose(void);
10558int cgetent(char **, char **, const char *);
10559int cgetfirst(char **, char **);
10560int cgetmatch(const char *, const char *);
10561int cgetnext(char **, char **);
10562int cgetnum(char *, const char *, long *);
10563int cgetset(const char *);
10564int cgetstr(char *, const char *, char **);
10565int cgetustr(char *, const char *, char **);
10566
10567int daemon(int, int);
10568char *devname(__dev_t, __mode_t);
10569char *devname_r(__dev_t, __mode_t, char *, int);
10570char *fdevname(int);
10571char *fdevname_r(int, char *, int);
10572int getloadavg(double [], int);
10573const char *
10574 getprogname(void);
10575
10576int heapsort(void *, size_t, size_t, int (*)(const void *, const void *));
10577#ifdef __BLOCKS__
10578int heapsort_b(void *, size_t, size_t, int (^)(const void *, const void *));
10579void qsort_b(void *, size_t, size_t,
10580 int (^)(const void *, const void *));
10581#endif
10582# 291 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/stdlib.h" 3 4
10583int l64a_r(long, char *, int);
10584int mergesort(void *, size_t, size_t, int (*)(const void *, const void *));
10585#ifdef __BLOCKS__
10586int mergesort_b(void *, size_t, size_t, int (^)(const void *, const void *));
10587#endif
10588# 296 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/stdlib.h" 3 4
10589int mkostemp(char *, int);
10590int mkostemps(char *, int, int);
10591void qsort_r(void *, size_t, size_t, void *,
10592 int (*)(void *, const void *, const void *));
10593int radixsort(const unsigned char **, int, const unsigned char *,
10594 unsigned);
10595void *reallocarray(void *, size_t, size_t) __result_use_check __alloc_size(2)
10596 __alloc_size(3);
10597void *reallocf(void *, size_t) __alloc_size(2);
10598int rpmatch(const char *);
10599void setprogname(const char *);
10600int sradixsort(const unsigned char **, int, const unsigned char *,
10601 unsigned);
10602void sranddev(void);
10603void srandomdev(void);
10604long long
10605 strtonum(const char *, long long, long long, const char **);
10606
10607/* Deprecated interfaces, to be removed in FreeBSD 6.0. */
10608__int64_t
10609 strtoq(const char *, char **, int);
10610__uint64_t
10611 strtouq(const char *, char **, int);
10612
10613#if __has_feature(capabilities)
10614long strtol_c(__capability const char * __restrict,
10615 __capability char ** __restrict, int);
10616long double
10617 strtold_c(__capability const char * __restrict,
10618 __capability char ** __restrict);
10619#endif
10620# 327 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/stdlib.h" 3 4
10621
10622extern char *suboptarg; /* getsubopt(3) external variable */
10623#endif /* __BSD_VISIBLE */
10624# 330 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/stdlib.h" 3 4
10625__END_DECLS
10626
10627#endif /* !_STDLIB_H_ */
10628# 333 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/stdlib.h" 3 4
10629# 56 "/home/alr48/cheri/sources/cheribsd/bin/cheritest/cheritest_registers.c" 2
10630#if 0 /* expanded by -frewrite-includes */
10631#include <string.h>
10632#endif /* expanded by -frewrite-includes */
10633# 56 "/home/alr48/cheri/sources/cheribsd/bin/cheritest/cheritest_registers.c"
10634# 1 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/string.h" 1 3 4
10635/*-
10636 * Copyright (c) 1990, 1993
10637 * The Regents of the University of California. All rights reserved.
10638 *
10639 * Redistribution and use in source and binary forms, with or without
10640 * modification, are permitted provided that the following conditions
10641 * are met:
10642 * 1. Redistributions of source code must retain the above copyright
10643 * notice, this list of conditions and the following disclaimer.
10644 * 2. Redistributions in binary form must reproduce the above copyright
10645 * notice, this list of conditions and the following disclaimer in the
10646 * documentation and/or other materials provided with the distribution.
10647 * 3. Neither the name of the University nor the names of its contributors
10648 * may be used to endorse or promote products derived from this software
10649 * without specific prior written permission.
10650 *
10651 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
10652 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
10653 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
10654 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
10655 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
10656 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
10657 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
10658 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
10659 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
10660 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
10661 * SUCH DAMAGE.
10662 *
10663 * @(#)string.h 8.1 (Berkeley) 6/2/93
10664 * $FreeBSD$
10665 */
10666
10667#ifndef _STRING_H_
10668#define _STRING_H_
10669
10670#if 0 /* expanded by -frewrite-includes */
10671#include <sys/cdefs.h>
10672#endif /* expanded by -frewrite-includes */
10673# 36 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/string.h" 3 4
10674# 37 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/string.h" 3 4
10675#if 0 /* expanded by -frewrite-includes */
10676#include <sys/_null.h>
10677#endif /* expanded by -frewrite-includes */
10678# 37 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/string.h" 3 4
10679# 38 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/string.h" 3 4
10680#if 0 /* expanded by -frewrite-includes */
10681#include <sys/_types.h>
10682#endif /* expanded by -frewrite-includes */
10683# 38 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/string.h" 3 4
10684# 39 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/string.h" 3 4
10685
10686/*
10687 * Prototype functions which were historically defined in <string.h>, but
10688 * are required by POSIX to be prototyped in <strings.h>.
10689 */
10690#if __BSD_VISIBLE
10691#if 0 /* expanded by -frewrite-includes */
10692#include <strings.h>
10693#endif /* expanded by -frewrite-includes */
10694# 45 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/string.h" 3 4
10695# 1 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/strings.h" 1 3 4
10696/*-
10697 * Copyright (c) 2002 Mike Barcroft <mike@FreeBSD.org>
10698 * All rights reserved.
10699 *
10700 * Redistribution and use in source and binary forms, with or without
10701 * modification, are permitted provided that the following conditions
10702 * are met:
10703 * 1. Redistributions of source code must retain the above copyright
10704 * notice, this list of conditions and the following disclaimer.
10705 * 2. Redistributions in binary form must reproduce the above copyright
10706 * notice, this list of conditions and the following disclaimer in the
10707 * documentation and/or other materials provided with the distribution.
10708 *
10709 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
10710 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
10711 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
10712 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
10713 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
10714 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
10715 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
10716 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
10717 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
10718 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
10719 * SUCH DAMAGE.
10720 *
10721 * $FreeBSD$
10722 */
10723
10724#ifndef _STRINGS_H_
10725#define _STRINGS_H_
10726
10727#if 0 /* expanded by -frewrite-includes */
10728#include <sys/cdefs.h>
10729#endif /* expanded by -frewrite-includes */
10730# 32 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/strings.h" 3 4
10731# 33 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/strings.h" 3 4
10732#if 0 /* expanded by -frewrite-includes */
10733#include <sys/_types.h>
10734#endif /* expanded by -frewrite-includes */
10735# 33 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/strings.h" 3 4
10736# 34 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/strings.h" 3 4
10737
10738#ifndef _SIZE_T_DECLARED
10739typedef __size_t size_t;
10740#define _SIZE_T_DECLARED
10741#endif
10742# 39 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/strings.h" 3 4
10743
10744__BEGIN_DECLS
10745#if __BSD_VISIBLE || __POSIX_VISIBLE <= 200112
10746int bcmp(const void *, const void *, size_t) __pure; /* LEGACY */
10747void bcopy(const void *, void *, size_t); /* LEGACY */
10748void bzero(void *, size_t); /* LEGACY */
10749#endif
10750# 46 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/strings.h" 3 4
10751#if __BSD_VISIBLE
10752void explicit_bzero(void *, size_t);
10753#endif
10754# 49 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/strings.h" 3 4
10755#if __XSI_VISIBLE
10756int ffs(int) __pure2;
10757#endif
10758# 52 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/strings.h" 3 4
10759#if __BSD_VISIBLE
10760int ffsl(long) __pure2;
10761int ffsll(long long) __pure2;
10762int fls(int) __pure2;
10763int flsl(long) __pure2;
10764int flsll(long long) __pure2;
10765#endif
10766# 59 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/strings.h" 3 4
10767#if __BSD_VISIBLE || __POSIX_VISIBLE <= 200112
10768char *index(const char *, int) __pure; /* LEGACY */
10769char *rindex(const char *, int) __pure; /* LEGACY */
10770#endif
10771# 63 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/strings.h" 3 4
10772int strcasecmp(const char *, const char *) __pure;
10773int strncasecmp(const char *, const char *, size_t) __pure;
10774
10775#if __POSIX_VISIBLE >= 200809 || defined(_XLOCALE_H_)
10776#if 0 /* expanded by -frewrite-includes */
10777#include <xlocale/_strings.h>
10778#endif /* expanded by -frewrite-includes */
10779# 67 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/strings.h" 3 4
10780# 1 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/xlocale/_strings.h" 1 3 4
10781/*-
10782 * Copyright (c) 2011, 2012 The FreeBSD Foundation
10783 * All rights reserved.
10784 *
10785 * Redistribution and use in source and binary forms, with or without
10786 * modification, are permitted provided that the following conditions
10787 * are met:
10788 * 1. Redistributions of source code must retain the above copyright
10789 * notice, this list of conditions and the following disclaimer.
10790 * 2. Redistributions in binary form must reproduce the above copyright
10791 * notice, this list of conditions and the following disclaimer in the
10792 * documentation and/or other materials provided with the distribution.
10793 *
10794 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
10795 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
10796 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
10797 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
10798 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
10799 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
10800 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
10801 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
10802 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
10803 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
10804 * SUCH DAMAGE.
10805 *
10806 * $FreeBSD$
10807 */
10808
10809#ifndef _LOCALE_T_DEFINED
10810#define _LOCALE_T_DEFINED
10811typedef struct _xlocale *locale_t;
10812#endif
10813# 33 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/xlocale/_strings.h" 3 4
10814
10815/*
10816 * This file is included from both strings.h and xlocale.h. We need to expose
10817 * the declarations unconditionally if we are included from xlocale.h, but only
10818 * if we are in POSIX2008 mode if included from string.h.
10819 */
10820
10821#ifndef _XLOCALE_STRINGS1_H
10822#define _XLOCALE_STRINGS1_H
10823
10824/*
10825 * POSIX2008 functions
10826 */
10827int strcasecmp_l(const char *, const char *, locale_t);
10828int strncasecmp_l(const char *, const char *, size_t, locale_t);
10829#endif /* _XLOCALE_STRINGS1_H */
10830# 49 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/xlocale/_strings.h" 3 4
10831# 68 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/strings.h" 2 3 4
10832#endif
10833# 69 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/strings.h" 3 4
10834__END_DECLS
10835
10836#endif /* _STRINGS_H_ */
10837# 72 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/strings.h" 3 4
10838# 46 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/string.h" 2 3 4
10839#endif
10840# 47 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/string.h" 3 4
10841
10842#ifndef _SIZE_T_DECLARED
10843typedef __size_t size_t;
10844#define _SIZE_T_DECLARED
10845#endif
10846# 52 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/string.h" 3 4
10847
10848__BEGIN_DECLS
10849#if __XSI_VISIBLE >= 600
10850void *memccpy(void * __restrict, const void * __restrict, int, size_t);
10851#endif
10852# 57 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/string.h" 3 4
10853void *memchr(const void *, int, size_t) __pure;
10854#if __BSD_VISIBLE
10855void *memrchr(const void *, int, size_t) __pure;
10856#endif
10857# 61 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/string.h" 3 4
10858int memcmp(const void *, const void *, size_t) __pure;
10859void *memcpy(void * __restrict, const void * __restrict, size_t);
10860#if __BSD_VISIBLE
10861void *memmem(const void *, size_t, const void *, size_t) __pure;
10862#endif
10863# 66 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/string.h" 3 4
10864void *memmove(void *, const void *, size_t);
10865void *memset(void *, int, size_t);
10866#if __POSIX_VISIBLE >= 200809
10867char *stpcpy(char * __restrict, const char * __restrict);
10868char *stpncpy(char * __restrict, const char * __restrict, size_t);
10869#endif
10870# 72 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/string.h" 3 4
10871#if __BSD_VISIBLE
10872char *strcasestr(const char *, const char *) __pure;
10873#endif
10874# 75 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/string.h" 3 4
10875char *strcat(char * __restrict, const char * __restrict);
10876char *strchr(const char *, int) __pure;
10877#if __BSD_VISIBLE
10878char *strchrnul(const char*, int) __pure;
10879#endif
10880# 80 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/string.h" 3 4
10881int strcmp(const char *, const char *) __pure;
10882int strcoll(const char *, const char *);
10883char *strcpy(char * __restrict, const char * __restrict);
10884size_t strcspn(const char *, const char *) __pure;
10885#if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE
10886char *strdup(const char *) __malloc_like;
10887#endif
10888# 87 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/string.h" 3 4
10889char *strerror(int);
10890#if __POSIX_VISIBLE >= 200112
10891int strerror_r(int, char *, size_t);
10892#endif
10893# 91 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/string.h" 3 4
10894#if __BSD_VISIBLE
10895size_t strlcat(char * __restrict, const char * __restrict, size_t);
10896size_t strlcpy(char * __restrict, const char * __restrict, size_t);
10897#endif
10898# 95 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/string.h" 3 4
10899size_t strlen(const char *) __pure;
10900#if __BSD_VISIBLE
10901void strmode(int, char *);
10902#endif
10903# 99 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/string.h" 3 4
10904char *strncat(char * __restrict, const char * __restrict, size_t);
10905int strncmp(const char *, const char *, size_t) __pure;
10906char *strncpy(char * __restrict, const char * __restrict, size_t);
10907#if __POSIX_VISIBLE >= 200809
10908char *strndup(const char *, size_t) __malloc_like;
10909size_t strnlen(const char *, size_t) __pure;
10910#endif
10911# 106 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/string.h" 3 4
10912#if __BSD_VISIBLE
10913char *strnstr(const char *, const char *, size_t) __pure;
10914#endif
10915# 109 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/string.h" 3 4
10916char *strpbrk(const char *, const char *) __pure;
10917char *strrchr(const char *, int) __pure;
10918#if __BSD_VISIBLE
10919char *strsep(char **, const char *);
10920#endif
10921# 114 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/string.h" 3 4
10922#if __POSIX_VISIBLE >= 200809
10923char *strsignal(int);
10924#endif
10925# 117 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/string.h" 3 4
10926size_t strspn(const char *, const char *) __pure;
10927char *strstr(const char *, const char *) __pure;
10928char *strtok(char * __restrict, const char * __restrict);
10929#if __POSIX_VISIBLE >= 199506 || __XSI_VISIBLE >= 500
10930char *strtok_r(char *, const char *, char **);
10931#endif
10932# 123 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/string.h" 3 4
10933size_t strxfrm(char * __restrict, const char * __restrict, size_t);
10934#if __BSD_VISIBLE
10935
10936#ifndef _SWAB_DECLARED
10937#define _SWAB_DECLARED
10938
10939#ifndef _SSIZE_T_DECLARED
10940typedef __ssize_t ssize_t;
10941#define _SSIZE_T_DECLARED
10942#endif /* _SIZE_T_DECLARED */
10943# 133 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/string.h" 3 4
10944
10945void swab(const void * __restrict, void * __restrict, ssize_t);
10946#endif /* _SWAB_DECLARED */
10947# 136 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/string.h" 3 4
10948
10949#if __has_feature(capabilities)
10950__capability const void *
10951 memchr_c_const(__capability const void *, int, size_t) __pure;
10952__capability void
10953 *memchr_c(__capability const void *, int, size_t) __pure;
10954int memcmp_c(__capability const void *, __capability const void *, size_t)
10955 __pure;
10956__capability void
10957 *memcpy_c(__capability void * __restrict,
10958 __capability const void * __restrict, size_t);
10959void *memcpy_c_fromcap(void * __restrict,
10960 __capability const void * __restrict, size_t);
10961__capability void
10962 *memcpy_c_tocap(__capability void * __restrict,
10963 const void * __restrict, size_t);
10964__capability void
10965 *memmove_c(__capability void * __restrict,
10966 __capability const void * __restrict, size_t);
10967__capability void
10968 *memset_c(__capability void *, int, size_t);
10969
10970__capability char
10971 *strchr_c(__capability const char *, int) __pure;
10972int strcmp_c(__capability const char *,
10973 __capability const char *s2) __pure;
10974__capability char
10975 *strcpy_c(__capability char * __restrict,
10976 __capability const char * __restrict);
10977int strncmp_c(__capability const char *, __capability const char *,
10978 size_t) __pure;
10979__capability char
10980*strncpy_c(__capability char * __restrict, __capability const char * __restrict,
10981 size_t);
10982char *strncpy_c_fromcap(char * __restrict,
10983 __capability const char * __restrict, size_t);
10984__capability char
10985 *strncpy_c_tocap(__capability char * __restrict,
10986 const char * __restrict, size_t);
10987size_t strnlen_c(__capability const char *, size_t) __pure;
10988#endif
10989# 177 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/string.h" 3 4
10990
10991int timingsafe_bcmp(const void *, const void *, size_t);
10992int timingsafe_memcmp(const void *, const void *, size_t);
10993#endif /* __BSD_VISIBLE */
10994# 181 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/string.h" 3 4
10995
10996#if __POSIX_VISIBLE >= 200809 || defined(_XLOCALE_H_)
10997#if 0 /* expanded by -frewrite-includes */
10998#include <xlocale/_string.h>
10999#endif /* expanded by -frewrite-includes */
11000# 183 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/string.h" 3 4
11001# 1 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/xlocale/_string.h" 1 3 4
11002/*-
11003 * Copyright (c) 2011, 2012 The FreeBSD Foundation
11004 * All rights reserved.
11005 *
11006 * Redistribution and use in source and binary forms, with or without
11007 * modification, are permitted provided that the following conditions
11008 * are met:
11009 * 1. Redistributions of source code must retain the above copyright
11010 * notice, this list of conditions and the following disclaimer.
11011 * 2. Redistributions in binary form must reproduce the above copyright
11012 * notice, this list of conditions and the following disclaimer in the
11013 * documentation and/or other materials provided with the distribution.
11014 *
11015 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
11016 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
11017 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
11018 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
11019 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
11020 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
11021 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
11022 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
11023 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
11024 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
11025 * SUCH DAMAGE.
11026 *
11027 * $FreeBSD$
11028 */
11029
11030#ifndef _LOCALE_T_DEFINED
11031#define _LOCALE_T_DEFINED
11032typedef struct _xlocale *locale_t;
11033#endif
11034# 33 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/xlocale/_string.h" 3 4
11035
11036/*
11037 * This file is included from both string.h and xlocale.h. We need to expose
11038 * the declarations unconditionally if we are included from xlocale.h, but only
11039 * if we are in POSIX2008 mode if included from string.h.
11040 */
11041
11042#ifndef _XLOCALE_STRING1_H
11043#define _XLOCALE_STRING1_H
11044
11045/*
11046 * POSIX2008 functions
11047 */
11048int strcoll_l(const char *, const char *, locale_t);
11049size_t strxfrm_l(char *, const char *, size_t, locale_t);
11050#endif /* _XLOCALE_STRING1_H */
11051# 49 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/xlocale/_string.h" 3 4
11052
11053/*
11054 * xlocale extensions
11055 */
11056#ifdef _XLOCALE_H_
11057#ifndef _XLOCALE_STRING2_H
11058#define _XLOCALE_STRING2_H
11059char *strcasestr_l(const char *, const char *, locale_t);
11060
11061#endif /* _XLOCALE_STRING2_H */
11062# 59 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/xlocale/_string.h" 3 4
11063#endif /* _XLOCALE_H_ */
11064# 60 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/xlocale/_string.h" 3 4
11065# 184 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/string.h" 2 3 4
11066#endif
11067# 185 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/string.h" 3 4
11068__END_DECLS
11069
11070#endif /* _STRING_H_ */
11071# 188 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/string.h" 3 4
11072# 57 "/home/alr48/cheri/sources/cheribsd/bin/cheritest/cheritest_registers.c" 2
11073#if 0 /* expanded by -frewrite-includes */
11074#include <sysexits.h>
11075#endif /* expanded by -frewrite-includes */
11076# 57 "/home/alr48/cheri/sources/cheribsd/bin/cheritest/cheritest_registers.c"
11077# 1 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sysexits.h" 1 3 4
11078/*
11079 * Copyright (c) 1987, 1993
11080 * The Regents of the University of California. All rights reserved.
11081 *
11082 * Redistribution and use in source and binary forms, with or without
11083 * modification, are permitted provided that the following conditions
11084 * are met:
11085 * 1. Redistributions of source code must retain the above copyright
11086 * notice, this list of conditions and the following disclaimer.
11087 * 2. Redistributions in binary form must reproduce the above copyright
11088 * notice, this list of conditions and the following disclaimer in the
11089 * documentation and/or other materials provided with the distribution.
11090 * 3. Neither the name of the University nor the names of its contributors
11091 * may be used to endorse or promote products derived from this software
11092 * without specific prior written permission.
11093 *
11094 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
11095 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
11096 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
11097 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
11098 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
11099 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
11100 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
11101 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
11102 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
11103 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
11104 * SUCH DAMAGE.
11105 *
11106 * @(#)sysexits.h 8.1 (Berkeley) 6/2/93
11107 *
11108 * $FreeBSD$
11109 */
11110
11111#ifndef _SYSEXITS_H_
11112#define _SYSEXITS_H_
11113
11114/*
11115 * SYSEXITS.H -- Exit status codes for system programs.
11116 *
11117 * This include file attempts to categorize possible error
11118 * exit statuses for system programs, notably delivermail
11119 * and the Berkeley network.
11120 *
11121 * Error numbers begin at EX__BASE to reduce the possibility of
11122 * clashing with other exit statuses that random programs may
11123 * already return. The meaning of the codes is approximately
11124 * as follows:
11125 *
11126 * EX_USAGE -- The command was used incorrectly, e.g., with
11127 * the wrong number of arguments, a bad flag, a bad
11128 * syntax in a parameter, or whatever.
11129 * EX_DATAERR -- The input data was incorrect in some way.
11130 * This should only be used for user's data & not
11131 * system files.
11132 * EX_NOINPUT -- An input file (not a system file) did not
11133 * exist or was not readable. This could also include
11134 * errors like "No message" to a mailer (if it cared
11135 * to catch it).
11136 * EX_NOUSER -- The user specified did not exist. This might
11137 * be used for mail addresses or remote logins.
11138 * EX_NOHOST -- The host specified did not exist. This is used
11139 * in mail addresses or network requests.
11140 * EX_UNAVAILABLE -- A service is unavailable. This can occur
11141 * if a support program or file does not exist. This
11142 * can also be used as a catchall message when something
11143 * you wanted to do doesn't work, but you don't know
11144 * why.
11145 * EX_SOFTWARE -- An internal software error has been detected.
11146 * This should be limited to non-operating system related
11147 * errors as possible.
11148 * EX_OSERR -- An operating system error has been detected.
11149 * This is intended to be used for such things as "cannot
11150 * fork", "cannot create pipe", or the like. It includes
11151 * things like getuid returning a user that does not
11152 * exist in the passwd file.
11153 * EX_OSFILE -- Some system file (e.g., /etc/passwd, /etc/utmp,
11154 * etc.) does not exist, cannot be opened, or has some
11155 * sort of error (e.g., syntax error).
11156 * EX_CANTCREAT -- A (user specified) output file cannot be
11157 * created.
11158 * EX_IOERR -- An error occurred while doing I/O on some file.
11159 * EX_TEMPFAIL -- temporary failure, indicating something that
11160 * is not really an error. In sendmail, this means
11161 * that a mailer (e.g.) could not create a connection,
11162 * and the request should be reattempted later.
11163 * EX_PROTOCOL -- the remote system returned something that
11164 * was "not possible" during a protocol exchange.
11165 * EX_NOPERM -- You did not have sufficient permission to
11166 * perform the operation. This is not intended for
11167 * file system problems, which should use NOINPUT or
11168 * CANTCREAT, but rather for higher level permissions.
11169 */
11170
11171#define EX_OK 0 /* successful termination */
11172
11173#define EX__BASE 64 /* base value for error messages */
11174
11175#define EX_USAGE 64 /* command line usage error */
11176#define EX_DATAERR 65 /* data format error */
11177#define EX_NOINPUT 66 /* cannot open input */
11178#define EX_NOUSER 67 /* addressee unknown */
11179#define EX_NOHOST 68 /* host name unknown */
11180#define EX_UNAVAILABLE 69 /* service unavailable */
11181#define EX_SOFTWARE 70 /* internal software error */
11182#define EX_OSERR 71 /* system error (e.g., can't fork) */
11183#define EX_OSFILE 72 /* critical OS file missing */
11184#define EX_CANTCREAT 73 /* can't create (user) output file */
11185#define EX_IOERR 74 /* input/output error */
11186#define EX_TEMPFAIL 75 /* temp failure; user is invited to retry */
11187#define EX_PROTOCOL 76 /* remote error in protocol */
11188#define EX_NOPERM 77 /* permission denied */
11189#define EX_CONFIG 78 /* configuration error */
11190
11191#define EX__MAX 78 /* maximum listed value */
11192
11193#endif /* !_SYSEXITS_H_ */
11194# 117 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sysexits.h" 3 4
11195# 58 "/home/alr48/cheri/sources/cheribsd/bin/cheritest/cheritest_registers.c" 2
11196#if 0 /* expanded by -frewrite-includes */
11197#include <unistd.h>
11198#endif /* expanded by -frewrite-includes */
11199# 58 "/home/alr48/cheri/sources/cheribsd/bin/cheritest/cheritest_registers.c"
11200# 1 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/unistd.h" 1 3 4
11201/*-
11202 * Copyright (c) 1991, 1993, 1994
11203 * The Regents of the University of California. All rights reserved.
11204 *
11205 * Redistribution and use in source and binary forms, with or without
11206 * modification, are permitted provided that the following conditions
11207 * are met:
11208 * 1. Redistributions of source code must retain the above copyright
11209 * notice, this list of conditions and the following disclaimer.
11210 * 2. Redistributions in binary form must reproduce the above copyright
11211 * notice, this list of conditions and the following disclaimer in the
11212 * documentation and/or other materials provided with the distribution.
11213 * 3. Neither the name of the University nor the names of its contributors
11214 * may be used to endorse or promote products derived from this software
11215 * without specific prior written permission.
11216 *
11217 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
11218 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
11219 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
11220 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
11221 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
11222 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
11223 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
11224 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
11225 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
11226 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
11227 * SUCH DAMAGE.
11228 *
11229 * @(#)unistd.h 8.12 (Berkeley) 4/27/95
11230 * $FreeBSD$
11231 */
11232
11233#ifndef _UNISTD_H_
11234#define _UNISTD_H_
11235
11236#if 0 /* expanded by -frewrite-includes */
11237#include <sys/cdefs.h>
11238#endif /* expanded by -frewrite-includes */
11239# 36 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/unistd.h" 3 4
11240# 37 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/unistd.h" 3 4
11241#if 0 /* expanded by -frewrite-includes */
11242#include <sys/types.h> /* XXX adds too much pollution. */
11243#endif /* expanded by -frewrite-includes */
11244# 37 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/unistd.h" 3 4
11245# 38 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/unistd.h" 3 4
11246#if 0 /* expanded by -frewrite-includes */
11247#include <sys/unistd.h>
11248#endif /* expanded by -frewrite-includes */
11249# 38 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/unistd.h" 3 4
11250# 1 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/unistd.h" 1 3 4
11251/*-
11252 * Copyright (c) 1989, 1993
11253 * The Regents of the University of California. All rights reserved.
11254 *
11255 * Redistribution and use in source and binary forms, with or without
11256 * modification, are permitted provided that the following conditions
11257 * are met:
11258 * 1. Redistributions of source code must retain the above copyright
11259 * notice, this list of conditions and the following disclaimer.
11260 * 2. Redistributions in binary form must reproduce the above copyright
11261 * notice, this list of conditions and the following disclaimer in the
11262 * documentation and/or other materials provided with the distribution.
11263 * 4. Neither the name of the University nor the names of its contributors
11264 * may be used to endorse or promote products derived from this software
11265 * without specific prior written permission.
11266 *
11267 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
11268 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
11269 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
11270 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
11271 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
11272 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
11273 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
11274 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
11275 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
11276 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
11277 * SUCH DAMAGE.
11278 *
11279 * @(#)unistd.h 8.2 (Berkeley) 1/7/94
11280 * $FreeBSD$
11281 */
11282
11283#ifndef _SYS_UNISTD_H_
11284#define _SYS_UNISTD_H_
11285
11286#if 0 /* expanded by -frewrite-includes */
11287#include <sys/cdefs.h>
11288#endif /* expanded by -frewrite-includes */
11289# 36 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/unistd.h" 3 4
11290# 37 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/unistd.h" 3 4
11291
11292/*
11293 * POSIX options and option groups we unconditionally do or don't
11294 * implement. Those options which are implemented (or not) entirely
11295 * in user mode are defined in <unistd.h>. Please keep this list in
11296 * alphabetical order.
11297 *
11298 * Anything which is defined as zero below **must** have an
11299 * implementation for the corresponding sysconf() which is able to
11300 * determine conclusively whether or not the feature is supported.
11301 * Anything which is defined as other than -1 below **must** have
11302 * complete headers, types, and function declarations as specified by
11303 * the POSIX standard; however, if the relevant sysconf() function
11304 * returns -1, the functions may be stubbed out.
11305 */
11306#define _POSIX_ADVISORY_INFO 200112L
11307#define _POSIX_ASYNCHRONOUS_IO 200112L
11308#define _POSIX_CHOWN_RESTRICTED 1
11309#define _POSIX_CLOCK_SELECTION (-1)
11310#define _POSIX_CPUTIME 200112L
11311#define _POSIX_FSYNC 200112L
11312#define _POSIX_IPV6 0
11313#define _POSIX_JOB_CONTROL 1
11314#define _POSIX_MAPPED_FILES 200112L
11315#define _POSIX_MEMLOCK (-1)
11316#define _POSIX_MEMLOCK_RANGE 200112L
11317#define _POSIX_MEMORY_PROTECTION 200112L
11318#define _POSIX_MESSAGE_PASSING 200112L
11319#define _POSIX_MONOTONIC_CLOCK 200112L
11320#define _POSIX_NO_TRUNC 1
11321#define _POSIX_PRIORITIZED_IO (-1)
11322#define _POSIX_PRIORITY_SCHEDULING 200112L
11323#define _POSIX_RAW_SOCKETS 200112L
11324#define _POSIX_REALTIME_SIGNALS 200112L
11325#define _POSIX_SEMAPHORES 200112L
11326#define _POSIX_SHARED_MEMORY_OBJECTS 200112L
11327#define _POSIX_SPORADIC_SERVER (-1)
11328#define _POSIX_SYNCHRONIZED_IO (-1)
11329#define _POSIX_TIMEOUTS 200112L
11330#define _POSIX_TIMERS 200112L
11331#define _POSIX_TYPED_MEMORY_OBJECTS (-1)
11332#define _POSIX_VDISABLE 0xff
11333
11334#if __XSI_VISIBLE
11335#define _XOPEN_SHM 1
11336#define _XOPEN_STREAMS (-1)
11337#endif
11338# 84 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/unistd.h" 3 4
11339
11340/*
11341 * Although we have saved user/group IDs, we do not use them in setuid
11342 * as described in POSIX 1003.1, because the feature does not work for
11343 * root. We use the saved IDs in seteuid/setegid, which are not currently
11344 * part of the POSIX 1003.1 specification. XXX revisit for 1003.1-2001
11345 * as this is now mandatory.
11346 */
11347#ifdef _NOT_AVAILABLE
11348#define _POSIX_SAVED_IDS 1 /* saved set-user-ID and set-group-ID */
11349#endif
11350# 95 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/unistd.h" 3 4
11351
11352/* Define the POSIX.1 version we target for compliance. */
11353#define _POSIX_VERSION 200112L
11354
11355/* access function */
11356#define F_OK 0 /* test for existence of file */
11357#define X_OK 0x01 /* test for execute or search permission */
11358#define W_OK 0x02 /* test for write permission */
11359#define R_OK 0x04 /* test for read permission */
11360
11361/* whence values for lseek(2) */
11362#ifndef SEEK_SET
11363#define SEEK_SET 0 /* set file offset to offset */
11364#define SEEK_CUR 1 /* set file offset to current plus offset */
11365#define SEEK_END 2 /* set file offset to EOF plus offset */
11366#endif
11367# 111 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/unistd.h" 3 4
11368#if __BSD_VISIBLE
11369#define SEEK_DATA 3 /* set file offset to next data past offset */
11370#define SEEK_HOLE 4 /* set file offset to next hole past offset */
11371#endif
11372# 115 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/unistd.h" 3 4
11373
11374#ifndef _POSIX_SOURCE
11375/* whence values for lseek(2); renamed by POSIX 1003.1 */
11376#define L_SET SEEK_SET
11377#define L_INCR SEEK_CUR
11378#define L_XTND SEEK_END
11379#endif
11380# 122 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/unistd.h" 3 4
11381
11382/* configurable pathname variables */
11383#define _PC_LINK_MAX 1
11384#define _PC_MAX_CANON 2
11385#define _PC_MAX_INPUT 3
11386#define _PC_NAME_MAX 4
11387#define _PC_PATH_MAX 5
11388#define _PC_PIPE_BUF 6
11389#define _PC_CHOWN_RESTRICTED 7
11390#define _PC_NO_TRUNC 8
11391#define _PC_VDISABLE 9
11392
11393#if __POSIX_VISIBLE >= 199309
11394#define _PC_ASYNC_IO 53
11395#define _PC_PRIO_IO 54
11396#define _PC_SYNC_IO 55
11397#endif
11398# 139 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/unistd.h" 3 4
11399
11400#if __POSIX_VISIBLE >= 200112
11401#define _PC_ALLOC_SIZE_MIN 10
11402#define _PC_FILESIZEBITS 12
11403#define _PC_REC_INCR_XFER_SIZE 14
11404#define _PC_REC_MAX_XFER_SIZE 15
11405#define _PC_REC_MIN_XFER_SIZE 16
11406#define _PC_REC_XFER_ALIGN 17
11407#define _PC_SYMLINK_MAX 18
11408#endif
11409# 149 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/unistd.h" 3 4
11410
11411#if __BSD_VISIBLE
11412#define _PC_ACL_EXTENDED 59
11413#define _PC_ACL_PATH_MAX 60
11414#define _PC_CAP_PRESENT 61
11415#define _PC_INF_PRESENT 62
11416#define _PC_MAC_PRESENT 63
11417#define _PC_ACL_NFS4 64
11418#endif
11419# 158 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/unistd.h" 3 4
11420
11421/* From OpenSolaris, used by SEEK_DATA/SEEK_HOLE. */
11422#define _PC_MIN_HOLE_SIZE 21
11423
11424#if __BSD_VISIBLE
11425/*
11426 * rfork() options.
11427 *
11428 * XXX currently, some operations without RFPROC set are not supported.
11429 */
11430#define RFNAMEG (1<<0) /* UNIMPL new plan9 `name space' */
11431#define RFENVG (1<<1) /* UNIMPL copy plan9 `env space' */
11432#define RFFDG (1<<2) /* copy fd table */
11433#define RFNOTEG (1<<3) /* UNIMPL create new plan9 `note group' */
11434#define RFPROC (1<<4) /* change child (else changes curproc) */
11435#define RFMEM (1<<5) /* share `address space' */
11436#define RFNOWAIT (1<<6) /* give child to init */
11437#define RFCNAMEG (1<<10) /* UNIMPL zero plan9 `name space' */
11438#define RFCENVG (1<<11) /* UNIMPL zero plan9 `env space' */
11439#define RFCFDG (1<<12) /* close all fds, zero fd table */
11440#define RFTHREAD (1<<13) /* enable kernel thread support */
11441#define RFSIGSHARE (1<<14) /* share signal handlers */
11442#define RFLINUXTHPN (1<<16) /* do linux clone exit parent notification */
11443#define RFSTOPPED (1<<17) /* leave child in a stopped state */
11444#define RFHIGHPID (1<<18) /* use a pid higher than 10 (idleproc) */
11445#define RFTSIGZMB (1<<19) /* select signal for exit parent notification */
11446#define RFTSIGSHIFT 20 /* selected signal number is in bits 20-27 */
11447#define RFTSIGMASK 0xFF
11448#define RFTSIGNUM(flags) (((flags) >> RFTSIGSHIFT) & RFTSIGMASK)
11449#define RFTSIGFLAGS(signum) ((signum) << RFTSIGSHIFT)
11450#define RFPROCDESC (1<<28) /* return a process descriptor */
11451#define RFPPWAIT (1<<31) /* parent sleeps until child exits (vfork) */
11452#define RFFLAGS (RFFDG | RFPROC | RFMEM | RFNOWAIT | RFCFDG | \
11453 RFTHREAD | RFSIGSHARE | RFLINUXTHPN | RFSTOPPED | RFHIGHPID | RFTSIGZMB | \
11454 RFPROCDESC | RFPPWAIT)
11455#define RFKERNELONLY (RFSTOPPED | RFHIGHPID | RFPPWAIT | RFPROCDESC)
11456
11457#endif /* __BSD_VISIBLE */
11458# 196 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/unistd.h" 3 4
11459
11460#endif /* !_SYS_UNISTD_H_ */
11461# 198 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/sys/unistd.h" 3 4
11462# 39 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/unistd.h" 2 3 4
11463#if 0 /* expanded by -frewrite-includes */
11464#include <sys/_null.h>
11465#endif /* expanded by -frewrite-includes */
11466# 39 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/unistd.h" 3 4
11467# 40 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/unistd.h" 3 4
11468#if 0 /* expanded by -frewrite-includes */
11469#include <sys/_types.h>
11470#endif /* expanded by -frewrite-includes */
11471# 40 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/unistd.h" 3 4
11472# 41 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/unistd.h" 3 4
11473
11474#ifndef _GID_T_DECLARED
11475typedef __gid_t gid_t;
11476#define _GID_T_DECLARED
11477#endif
11478# 46 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/unistd.h" 3 4
11479
11480#ifndef _OFF_T_DECLARED
11481typedef __off_t off_t;
11482#define _OFF_T_DECLARED
11483#endif
11484# 51 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/unistd.h" 3 4
11485
11486#ifndef _PID_T_DECLARED
11487typedef __pid_t pid_t;
11488#define _PID_T_DECLARED
11489#endif
11490# 56 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/unistd.h" 3 4
11491
11492#ifndef _SIZE_T_DECLARED
11493typedef __size_t size_t;
11494#define _SIZE_T_DECLARED
11495#endif
11496# 61 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/unistd.h" 3 4
11497
11498#ifndef _SSIZE_T_DECLARED
11499typedef __ssize_t ssize_t;
11500#define _SSIZE_T_DECLARED
11501#endif
11502# 66 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/unistd.h" 3 4
11503
11504#ifndef _UID_T_DECLARED
11505typedef __uid_t uid_t;
11506#define _UID_T_DECLARED
11507#endif
11508# 71 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/unistd.h" 3 4
11509
11510#ifndef _USECONDS_T_DECLARED
11511typedef __useconds_t useconds_t;
11512#define _USECONDS_T_DECLARED
11513#endif
11514# 76 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/unistd.h" 3 4
11515
11516#define STDIN_FILENO 0 /* standard input file descriptor */
11517#define STDOUT_FILENO 1 /* standard output file descriptor */
11518#define STDERR_FILENO 2 /* standard error file descriptor */
11519
11520#if __XSI_VISIBLE || __POSIX_VISIBLE >= 200112
11521#define F_ULOCK 0 /* unlock locked section */
11522#define F_LOCK 1 /* lock a section for exclusive use */
11523#define F_TLOCK 2 /* test and lock a section for exclusive use */
11524#define F_TEST 3 /* test a section for locks by other procs */
11525#endif
11526# 87 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/unistd.h" 3 4
11527
11528/*
11529 * POSIX options and option groups we unconditionally do or don't
11530 * implement. This list includes those options which are exclusively
11531 * implemented (or not) in user mode. Please keep this list in
11532 * alphabetical order.
11533 *
11534 * Anything which is defined as zero below **must** have an
11535 * implementation for the corresponding sysconf() which is able to
11536 * determine conclusively whether or not the feature is supported.
11537 * Anything which is defined as other than -1 below **must** have
11538 * complete headers, types, and function declarations as specified by
11539 * the POSIX standard; however, if the relevant sysconf() function
11540 * returns -1, the functions may be stubbed out.
11541 */
11542#define _POSIX_BARRIERS 200112L
11543#define _POSIX_CPUTIME 200112L
11544#define _POSIX_READER_WRITER_LOCKS 200112L
11545#define _POSIX_REGEXP 1
11546#define _POSIX_SHELL 1
11547#define _POSIX_SPAWN 200112L
11548#define _POSIX_SPIN_LOCKS 200112L
11549#define _POSIX_THREAD_ATTR_STACKADDR 200112L
11550#define _POSIX_THREAD_ATTR_STACKSIZE 200112L
11551#define _POSIX_THREAD_CPUTIME 200112L
11552#define _POSIX_THREAD_PRIO_INHERIT 200112L
11553#define _POSIX_THREAD_PRIO_PROTECT 200112L
11554#define _POSIX_THREAD_PRIORITY_SCHEDULING 200112L
11555#define _POSIX_THREAD_PROCESS_SHARED 200112L
11556#define _POSIX_THREAD_SAFE_FUNCTIONS -1
11557#define _POSIX_THREAD_SPORADIC_SERVER -1
11558#define _POSIX_THREADS 200112L
11559#define _POSIX_TRACE -1
11560#define _POSIX_TRACE_EVENT_FILTER -1
11561#define _POSIX_TRACE_INHERIT -1
11562#define _POSIX_TRACE_LOG -1
11563#define _POSIX2_C_BIND 200112L /* mandatory */
11564#define _POSIX2_C_DEV -1 /* need c99 utility */
11565#define _POSIX2_CHAR_TERM 1
11566#define _POSIX2_FORT_DEV -1 /* need fort77 utility */
11567#define _POSIX2_FORT_RUN 200112L
11568#define _POSIX2_LOCALEDEF -1
11569#define _POSIX2_PBS -1
11570#define _POSIX2_PBS_ACCOUNTING -1
11571#define _POSIX2_PBS_CHECKPOINT -1
11572#define _POSIX2_PBS_LOCATE -1
11573#define _POSIX2_PBS_MESSAGE -1
11574#define _POSIX2_PBS_TRACK -1
11575#define _POSIX2_SW_DEV -1 /* XXX ??? */
11576#define _POSIX2_UPE 200112L
11577#define _V6_ILP32_OFF32 -1
11578#define _V6_ILP32_OFFBIG 0
11579#define _V6_LP64_OFF64 0
11580#define _V6_LPBIG_OFFBIG -1
11581
11582#if __XSI_VISIBLE
11583#define _XOPEN_CRYPT -1 /* XXX ??? */
11584#define _XOPEN_ENH_I18N -1 /* mandatory in XSI */
11585#define _XOPEN_LEGACY -1
11586#define _XOPEN_REALTIME -1
11587#define _XOPEN_REALTIME_THREADS -1
11588#define _XOPEN_UNIX -1
11589#endif
11590# 150 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/unistd.h" 3 4
11591
11592/* Define the POSIX.2 version we target for compliance. */
11593#define _POSIX2_VERSION 199212L
11594
11595/*
11596 * POSIX-style system configuration variable accessors (for the
11597 * sysconf function). The kernel does not directly implement the
11598 * sysconf() interface; rather, a C library stub translates references
11599 * to sysconf() into calls to sysctl() using a giant switch statement.
11600 * Those that are marked `user' are implemented entirely in the C
11601 * library and never query the kernel. pathconf() is implemented
11602 * directly by the kernel so those are not defined here.
11603 */
11604#define _SC_ARG_MAX 1
11605#define _SC_CHILD_MAX 2
11606#define _SC_CLK_TCK 3
11607#define _SC_NGROUPS_MAX 4
11608#define _SC_OPEN_MAX 5
11609#define _SC_JOB_CONTROL 6
11610#define _SC_SAVED_IDS 7
11611#define _SC_VERSION 8
11612#define _SC_BC_BASE_MAX 9 /* user */
11613#define _SC_BC_DIM_MAX 10 /* user */
11614#define _SC_BC_SCALE_MAX 11 /* user */
11615#define _SC_BC_STRING_MAX 12 /* user */
11616#define _SC_COLL_WEIGHTS_MAX 13 /* user */
11617#define _SC_EXPR_NEST_MAX 14 /* user */
11618#define _SC_LINE_MAX 15 /* user */
11619#define _SC_RE_DUP_MAX 16 /* user */
11620#define _SC_2_VERSION 17 /* user */
11621#define _SC_2_C_BIND 18 /* user */
11622#define _SC_2_C_DEV 19 /* user */
11623#define _SC_2_CHAR_TERM 20 /* user */
11624#define _SC_2_FORT_DEV 21 /* user */
11625#define _SC_2_FORT_RUN 22 /* user */
11626#define _SC_2_LOCALEDEF 23 /* user */
11627#define _SC_2_SW_DEV 24 /* user */
11628#define _SC_2_UPE 25 /* user */
11629#define _SC_STREAM_MAX 26 /* user */
11630#define _SC_TZNAME_MAX 27 /* user */
11631
11632#if __POSIX_VISIBLE >= 199309
11633#define _SC_ASYNCHRONOUS_IO 28
11634#define _SC_MAPPED_FILES 29
11635#define _SC_MEMLOCK 30
11636#define _SC_MEMLOCK_RANGE 31
11637#define _SC_MEMORY_PROTECTION 32
11638#define _SC_MESSAGE_PASSING 33
11639#define _SC_PRIORITIZED_IO 34
11640#define _SC_PRIORITY_SCHEDULING 35
11641#define _SC_REALTIME_SIGNALS 36
11642#define _SC_SEMAPHORES 37
11643#define _SC_FSYNC 38
11644#define _SC_SHARED_MEMORY_OBJECTS 39
11645#define _SC_SYNCHRONIZED_IO 40
11646#define _SC_TIMERS 41
11647#define _SC_AIO_LISTIO_MAX 42
11648#define _SC_AIO_MAX 43
11649#define _SC_AIO_PRIO_DELTA_MAX 44
11650#define _SC_DELAYTIMER_MAX 45
11651#define _SC_MQ_OPEN_MAX 46
11652#define _SC_PAGESIZE 47
11653#define _SC_RTSIG_MAX 48
11654#define _SC_SEM_NSEMS_MAX 49
11655#define _SC_SEM_VALUE_MAX 50
11656#define _SC_SIGQUEUE_MAX 51
11657#define _SC_TIMER_MAX 52
11658#endif
11659# 218 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/unistd.h" 3 4
11660
11661#if __POSIX_VISIBLE >= 200112
11662#define _SC_2_PBS 59 /* user */
11663#define _SC_2_PBS_ACCOUNTING 60 /* user */
11664#define _SC_2_PBS_CHECKPOINT 61 /* user */
11665#define _SC_2_PBS_LOCATE 62 /* user */
11666#define _SC_2_PBS_MESSAGE 63 /* user */
11667#define _SC_2_PBS_TRACK 64 /* user */
11668#define _SC_ADVISORY_INFO 65
11669#define _SC_BARRIERS 66 /* user */
11670#define _SC_CLOCK_SELECTION 67
11671#define _SC_CPUTIME 68
11672#define _SC_FILE_LOCKING 69
11673#define _SC_GETGR_R_SIZE_MAX 70 /* user */
11674#define _SC_GETPW_R_SIZE_MAX 71 /* user */
11675#define _SC_HOST_NAME_MAX 72
11676#define _SC_LOGIN_NAME_MAX 73
11677#define _SC_MONOTONIC_CLOCK 74
11678#define _SC_MQ_PRIO_MAX 75
11679#define _SC_READER_WRITER_LOCKS 76 /* user */
11680#define _SC_REGEXP 77 /* user */
11681#define _SC_SHELL 78 /* user */
11682#define _SC_SPAWN 79 /* user */
11683#define _SC_SPIN_LOCKS 80 /* user */
11684#define _SC_SPORADIC_SERVER 81
11685#define _SC_THREAD_ATTR_STACKADDR 82 /* user */
11686#define _SC_THREAD_ATTR_STACKSIZE 83 /* user */
11687#define _SC_THREAD_CPUTIME 84 /* user */
11688#define _SC_THREAD_DESTRUCTOR_ITERATIONS 85 /* user */
11689#define _SC_THREAD_KEYS_MAX 86 /* user */
11690#define _SC_THREAD_PRIO_INHERIT 87 /* user */
11691#define _SC_THREAD_PRIO_PROTECT 88 /* user */
11692#define _SC_THREAD_PRIORITY_SCHEDULING 89 /* user */
11693#define _SC_THREAD_PROCESS_SHARED 90 /* user */
11694#define _SC_THREAD_SAFE_FUNCTIONS 91 /* user */
11695#define _SC_THREAD_SPORADIC_SERVER 92 /* user */
11696#define _SC_THREAD_STACK_MIN 93 /* user */
11697#define _SC_THREAD_THREADS_MAX 94 /* user */
11698#define _SC_TIMEOUTS 95 /* user */
11699#define _SC_THREADS 96 /* user */
11700#define _SC_TRACE 97 /* user */
11701#define _SC_TRACE_EVENT_FILTER 98 /* user */
11702#define _SC_TRACE_INHERIT 99 /* user */
11703#define _SC_TRACE_LOG 100 /* user */
11704#define _SC_TTY_NAME_MAX 101 /* user */
11705#define _SC_TYPED_MEMORY_OBJECTS 102
11706#define _SC_V6_ILP32_OFF32 103 /* user */
11707#define _SC_V6_ILP32_OFFBIG 104 /* user */
11708#define _SC_V6_LP64_OFF64 105 /* user */
11709#define _SC_V6_LPBIG_OFFBIG 106 /* user */
11710#define _SC_IPV6 118
11711#define _SC_RAW_SOCKETS 119
11712#define _SC_SYMLOOP_MAX 120
11713#endif
11714# 272 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/unistd.h" 3 4
11715
11716#if __XSI_VISIBLE
11717#define _SC_ATEXIT_MAX 107 /* user */
11718#define _SC_IOV_MAX 56
11719#define _SC_PAGE_SIZE _SC_PAGESIZE
11720#define _SC_XOPEN_CRYPT 108 /* user */
11721#define _SC_XOPEN_ENH_I18N 109 /* user */
11722#define _SC_XOPEN_LEGACY 110 /* user */
11723#define _SC_XOPEN_REALTIME 111
11724#define _SC_XOPEN_REALTIME_THREADS 112
11725#define _SC_XOPEN_SHM 113
11726#define _SC_XOPEN_STREAMS 114
11727#define _SC_XOPEN_UNIX 115
11728#define _SC_XOPEN_VERSION 116
11729#define _SC_XOPEN_XCU_VERSION 117 /* user */
11730#endif
11731# 288 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/unistd.h" 3 4
11732
11733#if __BSD_VISIBLE
11734#define _SC_NPROCESSORS_CONF 57
11735#define _SC_NPROCESSORS_ONLN 58
11736#define _SC_CPUSET_SIZE 122
11737#endif
11738# 294 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/unistd.h" 3 4
11739
11740/* Extensions found in Solaris and Linux. */
11741#define _SC_PHYS_PAGES 121
11742
11743/* Keys for the confstr(3) function. */
11744#if __POSIX_VISIBLE >= 199209
11745#define _CS_PATH 1 /* default value of PATH */
11746#endif
11747# 302 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/unistd.h" 3 4
11748
11749#if __POSIX_VISIBLE >= 200112
11750#define _CS_POSIX_V6_ILP32_OFF32_CFLAGS 2
11751#define _CS_POSIX_V6_ILP32_OFF32_LDFLAGS 3
11752#define _CS_POSIX_V6_ILP32_OFF32_LIBS 4
11753#define _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS 5
11754#define _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS 6
11755#define _CS_POSIX_V6_ILP32_OFFBIG_LIBS 7
11756#define _CS_POSIX_V6_LP64_OFF64_CFLAGS 8
11757#define _CS_POSIX_V6_LP64_OFF64_LDFLAGS 9
11758#define _CS_POSIX_V6_LP64_OFF64_LIBS 10
11759#define _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS 11
11760#define _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS 12
11761#define _CS_POSIX_V6_LPBIG_OFFBIG_LIBS 13
11762#define _CS_POSIX_V6_WIDTH_RESTRICTED_ENVS 14
11763#endif
11764# 318 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/unistd.h" 3 4
11765
11766__BEGIN_DECLS
11767/* 1003.1-1990 */
11768void _exit(int) __dead2;
11769int access(const char *, int);
11770unsigned int alarm(unsigned int);
11771int chdir(const char *);
11772int chown(const char *, uid_t, gid_t);
11773int close(int);
11774void closefrom(int);
11775int dup(int);
11776int dup2(int, int);
11777int execl(const char *, const char *, ...) __null_sentinel;
11778int execle(const char *, const char *, ...);
11779int execlp(const char *, const char *, ...) __null_sentinel;
11780int execv(const char *, char * const *);
11781int execve(const char *, char * const *, char * const *);
11782int execvp(const char *, char * const *);
11783pid_t fork(void);
11784long fpathconf(int, int);
11785char *getcwd(char *, size_t);
11786gid_t getegid(void);
11787uid_t geteuid(void);
11788gid_t getgid(void);
11789int getgroups(int, gid_t []);
11790char *getlogin(void);
11791pid_t getpgrp(void);
11792pid_t getpid(void);
11793pid_t getppid(void);
11794uid_t getuid(void);
11795int isatty(int);
11796int link(const char *, const char *);
11797#ifndef _LSEEK_DECLARED
11798#define _LSEEK_DECLARED
11799off_t lseek(int, off_t, int);
11800#endif
11801# 354 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/unistd.h" 3 4
11802long pathconf(const char *, int);
11803int pause(void);
11804int pipe(int *);
11805ssize_t read(int, void *, size_t);
11806int rmdir(const char *);
11807int setgid(gid_t);
11808int setpgid(pid_t, pid_t);
11809pid_t setsid(void);
11810int setuid(uid_t);
11811unsigned int sleep(unsigned int);
11812long sysconf(int);
11813pid_t tcgetpgrp(int);
11814int tcsetpgrp(int, pid_t);
11815char *ttyname(int);
11816int ttyname_r(int, char *, size_t);
11817int unlink(const char *);
11818ssize_t write(int, const void *, size_t);
11819
11820/* 1003.2-1992 */
11821#if __POSIX_VISIBLE >= 199209 || __XSI_VISIBLE
11822size_t confstr(int, char *, size_t);
11823#ifndef _GETOPT_DECLARED
11824#define _GETOPT_DECLARED
11825int getopt(int, char * const [], const char *);
11826
11827extern char *optarg; /* getopt(3) external variables */
11828extern int optind, opterr, optopt;
11829#endif /* _GETOPT_DECLARED */
11830# 382 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/unistd.h" 3 4
11831#endif
11832# 383 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/unistd.h" 3 4
11833
11834/* ISO/IEC 9945-1: 1996 */
11835#if __POSIX_VISIBLE >= 199506 || __XSI_VISIBLE
11836int fsync(int);
11837int fdatasync(int);
11838
11839/*
11840 * ftruncate() was in the POSIX Realtime Extension (it's used for shared
11841 * memory), but truncate() was not.
11842 */
11843#ifndef _FTRUNCATE_DECLARED
11844#define _FTRUNCATE_DECLARED
11845int ftruncate(int, off_t);
11846#endif
11847# 397 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/unistd.h" 3 4
11848#endif
11849# 398 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/unistd.h" 3 4
11850
11851#if __POSIX_VISIBLE >= 199506
11852int getlogin_r(char *, int);
11853#endif
11854# 402 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/unistd.h" 3 4
11855
11856/* 1003.1-2001 */
11857#if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE
11858int fchown(int, uid_t, gid_t);
11859ssize_t readlink(const char * __restrict, char * __restrict, size_t);
11860#endif
11861# 408 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/unistd.h" 3 4
11862#if __POSIX_VISIBLE >= 200112
11863int gethostname(char *, size_t);
11864int setegid(gid_t);
11865int seteuid(uid_t);
11866#endif
11867# 413 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/unistd.h" 3 4
11868
11869/* 1003.1-2008 */
11870#if __POSIX_VISIBLE >= 200809 || __XSI_VISIBLE
11871int getsid(pid_t _pid);
11872int fchdir(int);
11873int getpgid(pid_t _pid);
11874int lchown(const char *, uid_t, gid_t);
11875ssize_t pread(int, void *, size_t, off_t);
11876ssize_t pwrite(int, const void *, size_t, off_t);
11877
11878/* See comment at ftruncate() above. */
11879#ifndef _TRUNCATE_DECLARED
11880#define _TRUNCATE_DECLARED
11881int truncate(const char *, off_t);
11882#endif
11883# 428 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/unistd.h" 3 4
11884#endif /* __POSIX_VISIBLE >= 200809 || __XSI_VISIBLE */
11885# 429 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/unistd.h" 3 4
11886
11887#if __POSIX_VISIBLE >= 200809
11888int faccessat(int, const char *, int, int);
11889int fchownat(int, const char *, uid_t, gid_t, int);
11890int fexecve(int, char *const [], char *const []);
11891int linkat(int, const char *, int, const char *, int);
11892ssize_t readlinkat(int, const char * __restrict, char * __restrict, size_t);
11893int symlinkat(const char *, int, const char *);
11894int unlinkat(int, const char *, int);
11895#endif /* __POSIX_VISIBLE >= 200809 */
11896# 439 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/unistd.h" 3 4
11897
11898/*
11899 * symlink() was originally in POSIX.1a, which was withdrawn after
11900 * being overtaken by events (1003.1-2001). It was in XPG4.2, and of
11901 * course has been in BSD since 4.2.
11902 */
11903#if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE >= 402
11904int symlink(const char * __restrict, const char * __restrict);
11905#endif
11906# 448 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/unistd.h" 3 4
11907
11908/* X/Open System Interfaces */
11909#if __XSI_VISIBLE
11910char *crypt(const char *, const char *);
11911long gethostid(void);
11912int lockf(int, int, off_t);
11913int nice(int);
11914int setregid(gid_t, gid_t);
11915int setreuid(uid_t, uid_t);
11916
11917#ifndef _SWAB_DECLARED
11918#define _SWAB_DECLARED
11919void swab(const void * __restrict, void * __restrict, ssize_t);
11920#endif /* _SWAB_DECLARED */
11921# 462 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/unistd.h" 3 4
11922
11923void sync(void);
11924
11925#endif /* __XSI_VISIBLE */
11926# 466 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/unistd.h" 3 4
11927
11928#if (__XSI_VISIBLE && __XSI_VISIBLE <= 500) || __BSD_VISIBLE
11929int brk(const void *);
11930int chroot(const char *);
11931int getdtablesize(void);
11932int getpagesize(void) __pure2;
11933char *getpass(const char *);
11934void *sbrk(intptr_t);
11935#endif
11936# 475 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/unistd.h" 3 4
11937
11938#if (__XSI_VISIBLE && __XSI_VISIBLE <= 600) || __BSD_VISIBLE
11939char *getwd(char *); /* obsoleted by getcwd() */
11940useconds_t
11941 ualarm(useconds_t, useconds_t);
11942int usleep(useconds_t);
11943pid_t vfork(void) __returns_twice;
11944#endif
11945# 483 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/unistd.h" 3 4
11946
11947#if __BSD_VISIBLE
11948struct timeval; /* select(2) */
11949
11950struct crypt_data {
11951 int initialized; /* For compatibility with glibc. */
11952 char __buf[256]; /* Buffer returned by crypt_r(). */
11953};
11954
11955int acct(const char *);
11956int async_daemon(void);
11957int check_utility_compat(const char *);
11958const char *
11959 crypt_get_format(void);
11960char *crypt_r(const char *, const char *, struct crypt_data *);
11961int crypt_set_format(const char *);
11962int dup3(int, int, int);
11963int eaccess(const char *, int);
11964void endusershell(void);
11965int exect(const char *, char * const *, char * const *);
11966int execvP(const char *, const char *, char * const *);
11967int feature_present(const char *);
11968char *fflagstostr(u_long);
11969int getdomainname(char *, int);
11970int getgrouplist(const char *, gid_t, gid_t *, int *);
11971int getloginclass(char *, size_t);
11972mode_t getmode(const void *, mode_t);
11973int getosreldate(void);
11974int getpeereid(int, uid_t *, gid_t *);
11975int getresgid(gid_t *, gid_t *, gid_t *);
11976int getresuid(uid_t *, uid_t *, uid_t *);
11977char *getusershell(void);
11978int initgroups(const char *, gid_t);
11979int iruserok(unsigned long, int, const char *, const char *);
11980int iruserok_sa(const void *, int, int, const char *, const char *);
11981int issetugid(void);
11982void __FreeBSD_libc_enter_restricted_mode(void);
11983long lpathconf(const char *, int);
11984#ifndef _MKDTEMP_DECLARED
11985char *mkdtemp(char *);
11986#define _MKDTEMP_DECLARED
11987#endif
11988# 525 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/unistd.h" 3 4
11989#ifndef _MKNOD_DECLARED
11990int mknod(const char *, mode_t, dev_t);
11991#define _MKNOD_DECLARED
11992#endif
11993# 529 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/unistd.h" 3 4
11994#ifndef _MKSTEMP_DECLARED
11995int mkstemp(char *);
11996#define _MKSTEMP_DECLARED
11997#endif
11998# 533 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/unistd.h" 3 4
11999int mkstemps(char *, int);
12000#ifndef _MKTEMP_DECLARED
12001char *mktemp(char *);
12002#define _MKTEMP_DECLARED
12003#endif
12004# 538 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/unistd.h" 3 4
12005int nfssvc(int, void *);
12006int nlm_syscall(int, int, int, char **);
12007int pipe2(int *, int);
12008int profil(char *, size_t, vm_offset_t, int);
12009int rcmd(char **, int, const char *, const char *, const char *, int *);
12010int rcmd_af(char **, int, const char *,
12011 const char *, const char *, int *, int);
12012int rcmdsh(char **, int, const char *,
12013 const char *, const char *, const char *);
12014char *re_comp(const char *);
12015int re_exec(const char *);
12016int reboot(int);
12017int revoke(const char *);
12018pid_t rfork(int);
12019pid_t rfork_thread(int, void *, int (*)(void *), void *);
12020int rresvport(int *);
12021int rresvport_af(int *, int);
12022int ruserok(const char *, int, const char *, const char *);
12023#if __BSD_VISIBLE
12024#ifndef _SELECT_DECLARED
12025#define _SELECT_DECLARED
12026int select(int, fd_set *, fd_set *, fd_set *, struct timeval *);
12027#endif
12028# 561 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/unistd.h" 3 4
12029#endif
12030# 562 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/unistd.h" 3 4
12031int setdomainname(const char *, int);
12032int setgroups(int, const gid_t *);
12033void sethostid(long);
12034int sethostname(const char *, int);
12035int setlogin(const char *);
12036int setloginclass(const char *);
12037void *setmode(const char *);
12038int setpgrp(pid_t, pid_t); /* obsoleted by setpgid() */
12039void setproctitle(const char *_fmt, ...) __printf0like(1, 2);
12040int setresgid(gid_t, gid_t, gid_t);
12041int setresuid(uid_t, uid_t, uid_t);
12042int setrgid(gid_t);
12043int setruid(uid_t);
12044void setusershell(void);
12045int strtofflags(char **, u_long *, u_long *);
12046int swapon(const char *);
12047int swapoff(const char *);
12048int syscall(int, ...);
12049off_t __syscall(quad_t, ...);
12050int undelete(const char *);
12051int unwhiteout(const char *);
12052void *valloc(size_t); /* obsoleted by malloc() */
12053
12054#ifndef _OPTRESET_DECLARED
12055#define _OPTRESET_DECLARED
12056extern int optreset; /* getopt(3) external variable */
12057#endif
12058# 589 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/unistd.h" 3 4
12059
12060#if __has_feature(capabilities)
12061ssize_t write_c(int, __capability const void *, size_t);
12062#endif
12063# 593 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/unistd.h" 3 4
12064#endif /* __BSD_VISIBLE */
12065# 594 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/unistd.h" 3 4
12066__END_DECLS
12067
12068#endif /* !_UNISTD_H_ */
12069# 597 "/home/alr48/cheri/build-debug/cheribsd-obj-256/mips.mips64/home/alr48/cheri/sources/cheribsd/tmp/usr/include/unistd.h" 3 4
12070# 59 "/home/alr48/cheri/sources/cheribsd/bin/cheritest/cheritest_registers.c" 2
12071
12072#if 0 /* expanded by -frewrite-includes */
12073#include "cheritest.h"
12074#endif /* expanded by -frewrite-includes */
12075# 60 "/home/alr48/cheri/sources/cheribsd/bin/cheritest/cheritest_registers.c"
12076# 1 "/home/alr48/cheri/sources/cheribsd/bin/cheritest/cheritest.h" 1
12077/*-
12078 * Copyright (c) 2012-2016 Robert N. M. Watson
12079 * Copyright (c) 2014 SRI International
12080 * All rights reserved.
12081 *
12082 * This software was developed by SRI International and the University of
12083 * Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237)
12084 * ("CTSRD"), as part of the DARPA CRASH research programme.
12085 *
12086 * Redistribution and use in source and binary forms, with or without
12087 * modification, are permitted provided that the following conditions
12088 * are met:
12089 * 1. Redistributions of source code must retain the above copyright
12090 * notice, this list of conditions and the following disclaimer.
12091 * 2. Redistributions in binary form must reproduce the above copyright
12092 * notice, this list of conditions and the following disclaimer in the
12093 * documentation and/or other materials provided with the distribution.
12094 *
12095 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
12096 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
12097 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
12098 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
12099 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
12100 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
12101 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
12102 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
12103 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
12104 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
12105 * SUCH DAMAGE.
12106 */
12107
12108#ifndef _CHERITEST_H_
12109#define _CHERITEST_H_
12110
12111#define CHERI_CAP_PRINT(cap) do { \
12112 printf("tag %ju s %ju perms %08jx type %016jx\n", \
12113 (uintmax_t)cheri_gettag(cap), \
12114 (uintmax_t)cheri_getsealed(cap), \
12115 (uintmax_t)cheri_getperm(cap), \
12116 (uintmax_t)cheri_gettype(cap)); \
12117 printf("\tbase %016jx length %016jx\n", \
12118 (uintmax_t)cheri_getbase(cap), \
12119 (uintmax_t)cheri_getlen(cap)); \
12120} while (0)
12121
12122#define CHERI_CAPREG_PRINT(crn) do { \
12123 __capability void *cap; \
12124 if (crn == 0) \
12125 cap = cheri_getdefault(); \
12126 else \
12127 cap = cheri_getreg(crn); \
12128 printf("C%u ", crn); \
12129 CHERI_CAP_PRINT(cap); \
12130} while (0)
12131
12132#define CHERI_PCC_PRINT() do { \
12133 __capability void *cap; \
12134 cap = cheri_getpcc(); \
12135 printf("PCC "); \
12136 CHERI_CAP_PRINT(cap); \
12137} while (0)
12138
12139/*
12140 * Shared memory interface between tests and the test controller process.
12141 */
12142#define TESTRESULT_STR_LEN 1024
12143struct cheritest_child_state {
12144 /* Fields filled in by the child signal handler. */
12145 int ccs_signum;
12146 register_t ccs_mips_cause;
12147 register_t ccs_cp2_cause;
12148 int ccs_unwound; /* If any trusted-stack frames unwound. */
12149
12150 /* Fields filled in by the test itself. */
12151 int ccs_testresult;
12152 char ccs_testresult_str[TESTRESULT_STR_LEN];
12153};
12154extern struct cheritest_child_state *ccsp;
12155
12156/*
12157 * If the test runs to completion, it must set ccs_testresult to SUCCESS or
12158 * FAILURE. If the latter, it should also fill ccs_testresult_str with a
12159 * suitable message to display to the user.
12160 */
12161#define TESTRESULT_UNKNOWN 0 /* Default initialisation. */
12162#define TESTRESULT_SUCCESS 1 /* Test declares success. */
12163#define TESTRESULT_FAILURE 2 /* Test declares failure. */
12164
12165/*
12166 * Description structure for each test -- passed to the test in case it needs
12167 * access to configuration state, such as strings passed to/from stdio.
12168 */
12169#define CT_FLAG_SIGNAL 0x00000001 /* Should fault; checks signum. */
12170#define CT_FLAG_MIPS_EXCCODE 0x00000002 /* Check MIPS exception code. */
12171#define CT_FLAG_CP2_EXCCODE 0x00000004 /* Check CP2 exception code. */
12172#define CT_FLAG_STDOUT_STRING 0x00000008 /* Check stdout for a string. */
12173#define CT_FLAG_STDIN_STRING 0x00000010 /* Provide string on stdin. */
12174#define CT_FLAG_STDOUT_IGNORE 0x00000020 /* Standard output produced,
12175 but not checkable */
12176#define CT_FLAG_SLOW 0x00000040 /* Test is expected to take a
12177 long time to run */
12178#define CT_FLAG_SIGNAL_UNWIND 0x00000080 /* Should fault and unwind
12179 trusted stack; checks signum
12180 and result. */
12181
12182#define CHERITEST_SANDBOX_UNWOUND 0x123456789ULL
12183
12184struct cheri_test {
12185 const char *ct_name;
12186 const char *ct_desc;
12187 int ct_arg; /* 0: ct_func; otherwise ct_func_arg. */
12188 void (*ct_func)(const struct cheri_test *);
12189 void (*ct_func_arg)(const struct cheri_test *, int);
12190 const char * (*ct_check_xfail)(const char *);
12191 u_int ct_flags;
12192 int ct_signum;
12193 register_t ct_mips_exccode;
12194 register_t ct_cp2_exccode;
12195 const char *ct_stdin_string;
12196 const char *ct_stdout_string;
12197 const char *ct_xfail_reason;
12198};
12199
12200/*
12201 * Useful APIs for tests. These terminate the process returning either
12202 * success or failure with a test-defined, human-readable string describing
12203 * the error.
12204 */
12205void cheritest_failure_err(const char *msg, ...) __dead2 __printflike(1, 2);
12206void cheritest_failure_errx(const char *msg, ...) __dead2 __printflike(1, 2);
12207void cheritest_success(void) __dead2;
12208void signal_handler_clear(int sig);
12209
12210/* cheritest_bounds_heap.c */
12211void test_bounds_calloc(const struct cheri_test *ctp);
12212
12213/* cheritest_bounds_stack.c */
12214void test_bounds_stack_static_uint8(const struct cheri_test *ctp);
12215void test_bounds_stack_static_uint16(const struct cheri_test *ctp);
12216void test_bounds_stack_static_uint32(const struct cheri_test *ctp);
12217void test_bounds_stack_static_uint64(const struct cheri_test *ctp);
12218void test_bounds_stack_static_cap(const struct cheri_test *ctp);
12219void test_bounds_stack_static_16(const struct cheri_test *ctp);
12220void test_bounds_stack_static_32(const struct cheri_test *ctp);
12221void test_bounds_stack_static_64(const struct cheri_test *ctp);
12222void test_bounds_stack_static_128(const struct cheri_test *ctp);
12223void test_bounds_stack_static_256(const struct cheri_test *ctp);
12224void test_bounds_stack_static_512(const struct cheri_test *ctp);
12225void test_bounds_stack_static_1024(const struct cheri_test *ctp);
12226void test_bounds_stack_static_2048(const struct cheri_test *ctp);
12227void test_bounds_stack_static_4096(const struct cheri_test *ctp);
12228void test_bounds_stack_static_8192(const struct cheri_test *ctp);
12229void test_bounds_stack_static_16384(const struct cheri_test *ctp);
12230void test_bounds_stack_static_32768(const struct cheri_test *ctp);
12231void test_bounds_stack_static_65536(const struct cheri_test *ctp);
12232void test_bounds_stack_static_131072(const struct cheri_test *ctp);
12233void test_bounds_stack_static_262144(const struct cheri_test *ctp);
12234void test_bounds_stack_static_524288(const struct cheri_test *ctp);
12235void test_bounds_stack_static_1048576(const struct cheri_test *ctp);
12236void test_bounds_stack_dynamic_uint8(const struct cheri_test *ctp);
12237void test_bounds_stack_dynamic_uint16(const struct cheri_test *ctp);
12238void test_bounds_stack_dynamic_uint32(const struct cheri_test *ctp);
12239void test_bounds_stack_dynamic_uint64(const struct cheri_test *ctp);
12240void test_bounds_stack_dynamic_cap(const struct cheri_test *ctp);
12241void test_bounds_stack_dynamic_16(const struct cheri_test *ctp);
12242void test_bounds_stack_dynamic_32(const struct cheri_test *ctp);
12243void test_bounds_stack_dynamic_64(const struct cheri_test *ctp);
12244void test_bounds_stack_dynamic_128(const struct cheri_test *ctp);
12245void test_bounds_stack_dynamic_256(const struct cheri_test *ctp);
12246void test_bounds_stack_dynamic_512(const struct cheri_test *ctp);
12247void test_bounds_stack_dynamic_1024(const struct cheri_test *ctp);
12248void test_bounds_stack_dynamic_2048(const struct cheri_test *ctp);
12249void test_bounds_stack_dynamic_4096(const struct cheri_test *ctp);
12250void test_bounds_stack_dynamic_8192(const struct cheri_test *ctp);
12251void test_bounds_stack_dynamic_16384(const struct cheri_test *ctp);
12252void test_bounds_stack_dynamic_32768(const struct cheri_test *ctp);
12253void test_bounds_stack_dynamic_65536(const struct cheri_test *ctp);
12254void test_bounds_stack_dynamic_131072(const struct cheri_test *ctp);
12255void test_bounds_stack_dynamic_262144(const struct cheri_test *ctp);
12256void test_bounds_stack_dynamic_524288(const struct cheri_test *ctp);
12257void test_bounds_stack_dynamic_1048576(const struct cheri_test *ctp);
12258
12259/* cheritest_ccall.c */
12260void cheritest_ccall_setup(void);
12261void test_nofault_ccall_creturn(const struct cheri_test *ctp);
12262void test_nofault_ccall_nop_creturn(const struct cheri_test *ctp);
12263void test_nofault_ccall_dli_creturn(const struct cheri_test *ctp);
12264void test_fault_creturn(const struct cheri_test *ctp);
12265void test_fault_ccall_code_untagged(const struct cheri_test *ctp);
12266void test_fault_ccall_data_untagged(const struct cheri_test *ctp);
12267void test_fault_ccall_code_unsealed(const struct cheri_test *ctp);
12268void test_fault_ccall_data_unsealed(const struct cheri_test *ctp);
12269void test_fault_ccall_typemismatch(const struct cheri_test *ctp);
12270void test_fault_ccall_code_noexecute(const struct cheri_test *ctp);
12271void test_fault_ccall_data_execute(const struct cheri_test *ctp);
12272
12273/* cheritest_cheriabi.c */
12274void test_cheriabi_mmap_nospace(const struct cheri_test *ctp);
12275void test_cheriabi_mmap_perms(const struct cheri_test *ctp);
12276
12277/* cheritest_fault.c */
12278void test_fault_bounds(const struct cheri_test *ctp);
12279void test_fault_cgetcause(const struct cheri_test *ctp);
12280void test_nofault_cfromptr(const struct cheri_test *ctp);
12281void test_fault_perm_load(const struct cheri_test *ctp);
12282void test_nofault_perm_load(const struct cheri_test *ctp);
12283void test_fault_perm_store(const struct cheri_test *ctp);
12284void test_nofault_perm_store(const struct cheri_test *ctp);
12285void test_fault_tag(const struct cheri_test *ctp);
12286void test_fault_ccheck_user_fail(const struct cheri_test *ctp);
12287void test_fault_read_kr1c(const struct cheri_test *ctp);
12288void test_fault_read_kr2c(const struct cheri_test *ctp);
12289void test_fault_read_kcc(const struct cheri_test *ctp);
12290void test_fault_read_kdc(const struct cheri_test *ctp);
12291void test_fault_read_epcc(const struct cheri_test *ctp);
12292void test_nofault_ccheck_user_pass(const struct cheri_test *ctp);
12293
12294void test_sandbox_cp2_bound_catch(const struct cheri_test *ctp);
12295void test_sandbox_cp2_bound_nocatch(const struct cheri_test *ctp);
12296void test_sandbox_cp2_perm_load_catch(const struct cheri_test *ctp);
12297void test_sandbox_cp2_perm_load_nocatch(const struct cheri_test *ctp);
12298void test_sandbox_cp2_perm_store_catch(const struct cheri_test *ctp);
12299void test_sandbox_cp2_perm_store_nocatch(const struct cheri_test *ctp);
12300void test_sandbox_cp2_tag_catch(const struct cheri_test *ctp);
12301void test_sandbox_cp2_tag_nocatch(const struct cheri_test *ctp);
12302void test_sandbox_cp2_seal_catch(const struct cheri_test *ctp);
12303void test_sandbox_cp2_seal_nocatch(const struct cheri_test *ctp);
12304void test_sandbox_divzero_catch(const struct cheri_test *ctp);
12305void test_sandbox_divzero_nocatch(const struct cheri_test *ctp);
12306void test_sandbox_vm_rfault_catch(const struct cheri_test *ctp);
12307void test_sandbox_vm_rfault_nocatch(const struct cheri_test *ctp);
12308void test_sandbox_vm_wfault_catch(const struct cheri_test *ctp);
12309void test_sandbox_vm_wfault_nocatch(const struct cheri_test *ctp);
12310void test_sandbox_vm_xfault_catch(const struct cheri_test *ctp);
12311void test_sandbox_vm_xfault_nocatch(const struct cheri_test *ctp);
12312
12313/* cheritest_fd.c */
12314#define CHERITEST_FD_READ_STR "read123"
12315#define CHERITEST_FD_WRITE_STR "write123"
12316
12317extern int zero_fd;
12318extern struct cheri_object stdin_fd_object;
12319extern struct cheri_object stdout_fd_object;
12320extern struct cheri_object zero_fd_object;
12321
12322void test_sandbox_fd_fstat(const struct cheri_test *ctp);
12323void test_sandbox_fd_lseek(const struct cheri_test *ctp);
12324void test_sandbox_fd_read(const struct cheri_test *ctp);
12325void test_sandbox_fd_read_revoke(const struct cheri_test *ctp);
12326void test_sandbox_fd_write(const struct cheri_test *ctp);
12327void test_sandbox_fd_write_revoke(const struct cheri_test *ctp);
12328
12329/* cheritest_libcheri.c */
12330extern struct sandbox_class *cheritest_classp;
12331extern struct sandbox_object *cheritest_objectp;
12332
12333void test_sandbox_abort(const struct cheri_test *ctp);
12334void test_sandbox_cs_calloc(const struct cheri_test *ctp);
12335void test_sandbox_cs_clock_gettime(const struct cheri_test *ctp);
12336void test_sandbox_cs_clock_gettime_default(const struct cheri_test *ctp);
12337void test_sandbox_cs_clock_gettime_deny(const struct cheri_test *ctp);
12338void test_sandbox_cs_helloworld(const struct cheri_test *ctp);
12339void test_sandbox_cs_putchar(const struct cheri_test *ctp);
12340void test_sandbox_cs_puts(const struct cheri_test *ctp);
12341void test_sandbox_malloc(const struct cheri_test *ctp);
12342void test_sandbox_md5_ccall(const struct cheri_test *ctp, int class2);
12343void test_sandbox_printf(const struct cheri_test *ctp);
12344void test_sandbox_ptrdiff(const struct cheri_test *ctp);
12345void test_sandbox_varargs(const struct cheri_test *ctp);
12346void test_sandbox_va_copy(const struct cheri_test *ctp);
12347void test_sandbox_spin(const struct cheri_test *ctp);
12348void test_sandbox_userfn(const struct cheri_test *ctp);
12349void test_2sandbox_newdestroy(const struct cheri_test *ctp);
12350int cheritest_libcheri_setup(void);
12351void cheritest_libcheri_destroy(void);
12352
12353/* cheritest_local.c */
12354void test_sandbox_store_global_capability_in_bss(
12355 const struct cheri_test *ctp);
12356void test_sandbox_store_local_capability_in_bss_catch(
12357 const struct cheri_test *ctp);
12358void test_sandbox_store_local_capability_in_bss_nocatch(
12359 const struct cheri_test *ctp);
12360void test_sandbox_store_global_capability_in_stack(
12361 const struct cheri_test *ctp);
12362void test_sandbox_store_local_capability_in_stack(
12363 const struct cheri_test *ctp);
12364void test_sandbox_return_global_capability(const struct cheri_test *ctp);
12365void test_sandbox_return_local_capability_catch(
12366 const struct cheri_test *ctp);
12367void test_sandbox_return_local_capability_nocatch(
12368 const struct cheri_test *ctp);
12369void test_sandbox_pass_local_capability_arg(const struct cheri_test *ctp);
12370
12371/* cheritest_stack.c */
12372register_t cheritest_libcheri_userfn_getstack(void);
12373register_t cheritest_libcheri_userfn_setstack(register_t arg);
12374void test_sandbox_getstack(const struct cheri_test *ctp);
12375void test_sandbox_setstack(const struct cheri_test *ctp);
12376void test_sandbox_setstack_nop(const struct cheri_test *ctp);
12377
12378/* cheritest_string.c */
12379void test_string_memcpy(const struct cheri_test *ctp);
12380void test_string_memcpy_c(const struct cheri_test *ctp);
12381void test_string_memmove(const struct cheri_test *ctp);
12382void test_string_memmove_c(const struct cheri_test *ctp);
12383
12384/* cheritest_syscall.c */
12385void test_sandbox_syscall(const struct cheri_test *ctp);
12386
12387/* cheritest_registers.c */
12388void test_initregs_default(const struct cheri_test *ctp);
12389void test_initregs_stack(const struct cheri_test *ctp);
12390void test_initregs_idc(const struct cheri_test *ctp);
12391void test_initregs_pcc(const struct cheri_test *ctp);
12392void test_copyregs(const struct cheri_test *ctp);
12393void test_listregs(const struct cheri_test *ctp);
12394
12395/* cheritest_var.c */
12396void test_sandbox_var_bss(const struct cheri_test *ctp);
12397void test_sandbox_var_data(const struct cheri_test *ctp);
12398void test_sandbox_var_data_getset(const struct cheri_test *ctp);
12399void test_2sandbox_var_data_getset(const struct cheri_test *ctp);
12400void test_sandbox_var_constructor(const struct cheri_test *ctp);
12401
12402/* cheritest_vm.c */
12403void cheritest_vm_tag_mmap_anon(const struct cheri_test *ctp __unused);
12404void cheritest_vm_tag_shm_open_anon_shared(const struct cheri_test *ctp
12405 __unused);
12406void cheritest_vm_tag_shm_open_anon_private(const struct cheri_test *ctp
12407 __unused);
12408void cheritest_vm_tag_dev_zero_shared(const struct cheri_test *ctp
12409 __unused);
12410void cheritest_vm_tag_dev_zero_private(const struct cheri_test *ctp
12411 __unused);
12412void cheritest_vm_notag_tmpfile_shared(const struct cheri_test *ctp __unused);
12413void cheritest_vm_tag_tmpfile_private(const struct cheri_test *ctp __unused);
12414void cheritest_vm_tag_tmpfile_private_prefault(const struct cheri_test *ctp
12415 __unused);
12416void cheritest_vm_cow_read(const struct cheri_test *ctp);
12417void cheritest_vm_cow_write(const struct cheri_test *ctp);
12418const char *xfail_need_writable_tmp(const char *name);
12419const char *xfail_need_writable_non_tmpfs_tmp(const char *name);
12420
12421/* cheritest_vm_swap.c */
12422void cheritest_vm_swap(const struct cheri_test *ctp __unused);
12423const char *xfail_swap_required(const char *name);
12424
12425/* cheritest_zlib.c */
12426void test_deflate_zeroes(const struct cheri_test *ctp);
12427void test_inflate_zeroes(const struct cheri_test *ctp);
12428void test_sandbox_inflate_zeroes(const struct cheri_test *ctp);
12429
12430#ifdef CHERI_C_TESTS
12431#define DECLARE_TEST(name, desc) \
12432 void cheri_c_test_ ## name(const struct cheri_test *ctp __unused);
12433#define DECLARE_TEST_FAULT(name, desc) /* Not supported */
12434#if 0 /* expanded by -frewrite-includes */
12435#include <cheri_c_testdecls.h>
12436#endif /* expanded by -frewrite-includes */
12437# 358 "/home/alr48/cheri/sources/cheribsd/bin/cheritest/cheritest.h"
12438# 359 "/home/alr48/cheri/sources/cheribsd/bin/cheritest/cheritest.h"
12439#undef DECLARE_TEST
12440#endif
12441# 361 "/home/alr48/cheri/sources/cheribsd/bin/cheritest/cheritest.h"
12442
12443#endif /* !_CHERITEST_H_ */
12444# 363 "/home/alr48/cheri/sources/cheribsd/bin/cheritest/cheritest.h"
12445# 61 "/home/alr48/cheri/sources/cheribsd/bin/cheritest/cheritest_registers.c" 2
12446
12447void
12448test_copyregs(const struct cheri_test *ctp __unused)
12449{
12450
12451 CHERI_CGETDEFAULT(2);
12452 CHERI_CGETDEFAULT(3);
12453 CHERI_CGETDEFAULT(4);
12454 CHERI_CGETDEFAULT(5);
12455 CHERI_CGETDEFAULT(6);
12456 CHERI_CGETDEFAULT(7);
12457 cheritest_success();
12458}
12459
12460void
12461test_listregs(const struct cheri_test *ctp __unused)
12462{
12463
12464 /*
12465 * Because of the assembly generated by CP2_CR_GET(), can't use a loop
12466 * -- register numbers must be available at compile-time.
12467 */
12468 printf("CP2 registers:\n");
12469 CHERI_CAPREG_PRINT(0);
12470 CHERI_CAPREG_PRINT(1);
12471 CHERI_CAPREG_PRINT(2);
12472 CHERI_CAPREG_PRINT(3);
12473 CHERI_CAPREG_PRINT(4);
12474 CHERI_CAPREG_PRINT(5);
12475 CHERI_CAPREG_PRINT(6);
12476 CHERI_CAPREG_PRINT(7);
12477 CHERI_CAPREG_PRINT(8);
12478 CHERI_CAPREG_PRINT(9);
12479 CHERI_CAPREG_PRINT(10);
12480 CHERI_CAPREG_PRINT(11);
12481 CHERI_CAPREG_PRINT(12);
12482 CHERI_CAPREG_PRINT(13);
12483 CHERI_CAPREG_PRINT(14);
12484 CHERI_CAPREG_PRINT(15);
12485 CHERI_CAPREG_PRINT(16);
12486 CHERI_CAPREG_PRINT(17);
12487 CHERI_CAPREG_PRINT(18);
12488 CHERI_CAPREG_PRINT(19);
12489 CHERI_CAPREG_PRINT(20);
12490 CHERI_CAPREG_PRINT(21);
12491 CHERI_CAPREG_PRINT(22);
12492 CHERI_CAPREG_PRINT(23);
12493 CHERI_CAPREG_PRINT(24);
12494 CHERI_CAPREG_PRINT(25);
12495 CHERI_CAPREG_PRINT(26);
12496 CHERI_PCC_PRINT();
12497 cheritest_success();
12498}
12499
12500/*
12501 * These tests assume that the compiler and run-time libraries won't muck with
12502 * the global registers in question -- which is true at the time of writing.
12503 *
12504 * However, in the future, it could be that they are modified -- e.g., to
12505 * differentiate memory capabilities from class-type capabilities. In that
12506 * case, these tests would need to check the original capability values saved
12507 * during process startup -- and also the new expected values.
12508 */
12509static void
12510check_initreg_code(__capability void *c)
12511{
12512 register_t v;
12513
12514 /* Base. */
12515 v = cheri_getbase(c);
12516 if (v != CHERI_CAP_USER_CODE_BASE)
12517 cheritest_failure_errx("base %jx (expected %jx)", v,
12518 (uintmax_t)CHERI_CAP_USER_CODE_BASE);
12519
12520 /* Length. */
12521 v = cheri_getlen(c);
12522 if (v != CHERI_CAP_USER_CODE_LENGTH)
12523 cheritest_failure_errx("length 0x%jx (expected 0x%jx)", v,
12524 CHERI_CAP_USER_CODE_LENGTH);
12525
12526 /* Offset. */
12527 v = cheri_getoffset(c);
12528 if (v != CHERI_CAP_USER_CODE_OFFSET)
12529 cheritest_failure_errx("offset %jx (expected %jx)", v,
12530 (uintmax_t)CHERI_CAP_USER_CODE_OFFSET);
12531
12532 /* Type -- should be zero for an unsealed capability. */
12533 v = cheri_gettype(c);
12534 if (v != 0)
12535 cheritest_failure_errx("otype %jx (expected %jx)", v, 0);
12536
12537 /* Permissions. */
12538 v = cheri_getperm(c);
12539 if (v != CHERI_CAP_USER_CODE_PERMS)
12540 cheritest_failure_errx("perms %jx (expected %jx)", v,
12541 (uintmax_t)CHERI_CAP_USER_CODE_PERMS);
12542
12543 /* Sealed bit. */
12544 v = cheri_getsealed(c);
12545 if (v != 0)
12546 cheritest_failure_errx("sealed %jx (expected 0)", v);
12547
12548 /* Tag bit. */
12549 v = cheri_gettag(c);
12550 if (v != 1)
12551 cheritest_failure_errx("tag %jx (expected 1)", v);
12552 cheritest_success();
12553}
12554
12555static void
12556check_initreg_data(__capability void *c)
12557{
12558 register_t v;
12559
12560 /* Base. */
12561 v = cheri_getbase(c);
12562 if (v != CHERI_CAP_USER_DATA_BASE)
12563 cheritest_failure_errx("base %jx (expected %jx)", v,
12564 (uintmax_t)CHERI_CAP_USER_DATA_BASE);
12565
12566 /* Length. */
12567 v = cheri_getlen(c);
12568 if (v != CHERI_CAP_USER_DATA_LENGTH)
12569 cheritest_failure_errx("length 0x%jx (expected 0x%jx)", v,
12570 CHERI_CAP_USER_DATA_LENGTH);
12571
12572 /* Offset. */
12573 v = cheri_getoffset(c);
12574 if (v != CHERI_CAP_USER_DATA_OFFSET)
12575 cheritest_failure_errx("offset %jx (expected %jx)", v,
12576 (uintmax_t)CHERI_CAP_USER_DATA_OFFSET);
12577
12578 /* Type -- should be zero for an unsealed capability. */
12579 v = cheri_gettype(c);
12580 if (v != 0)
12581 cheritest_failure_errx("otype %jx (expected %jx)", v, 0);
12582
12583 /* Permissions. */
12584 v = cheri_getperm(c);
12585 if (v != CHERI_CAP_USER_DATA_PERMS)
12586 cheritest_failure_errx("perms %jx (expected %jx)", v,
12587 (uintmax_t)CHERI_CAP_USER_DATA_PERMS);
12588
12589 /* Sealed bit. */
12590 v = cheri_getsealed(c);
12591 if (v != 0)
12592 cheritest_failure_errx("sealed %jx (expected 0)", v);
12593
12594 /* Tag bit. */
12595 v = cheri_gettag(c);
12596 if (v != 1)
12597 cheritest_failure_errx("tag %jx (expected 1)", v);
12598 cheritest_success();
12599}
12600
12601void
12602test_initregs_default(const struct cheri_test *ctp __unused)
12603{
12604
12605 check_initreg_data(cheri_getdefault());
12606}
12607
12608/*
12609 * Outside of CheriABI, we expect the stack capability to be the same as the
12610 * default data capability, since we need the stack pointer ($sp) to be usable
12611 * relative to either capability.
12612 *
12613 * Inside CheriABI, the stack capability should contain only the specific
12614 * address range used for the stack. We could try to capture the same logic
12615 * here as used in the kernel to select the stack -- but it seems more
12616 * sensible to simply assert that the capability is not the same as the
12617 * default capability for the MIPS ABI.
12618 */
12619void
12620test_initregs_stack(const struct cheri_test *ctp __unused)
12621#ifndef __CHERI_PURE_CAPABILITY__
12622{
12623
12624 check_initreg_data(cheri_getstack());
12625}
12626#else
12627# 242 "/home/alr48/cheri/sources/cheribsd/bin/cheritest/cheritest_registers.c"
12628{
12629 __capability void *c = cheri_getstack();
12630 register_t v;
12631
12632 /* Base. */
12633 v = cheri_getbase(c);
12634 if (v == CHERI_CAP_USER_DATA_BASE)
12635 cheritest_failure_errx("base %jx (did not expect %jx)", v,
12636 (uintmax_t)CHERI_CAP_USER_DATA_BASE);
12637
12638 /* Length. */
12639 v = cheri_getlen(c);
12640 if (v == CHERI_CAP_USER_DATA_LENGTH)
12641 cheritest_failure_errx("length 0x%jx (did not expect 0x%jx)",
12642 v, CHERI_CAP_USER_DATA_LENGTH);
12643
12644 /* Offset. */
12645 v = cheri_getoffset(c);
12646 if (v != CHERI_CAP_USER_DATA_OFFSET)
12647 cheritest_failure_errx("offset %jx (expected %jx)", v,
12648 (uintmax_t)CHERI_CAP_USER_DATA_OFFSET);
12649
12650 /* Type -- should be zero for an unsealed capability. */
12651 v = cheri_gettype(c);
12652 if (v != 0)
12653 cheritest_failure_errx("otype %jx (expected %jx)", v, 0);
12654
12655 /* Permissions. */
12656 v = cheri_getperm(c);
12657 if (v != CHERI_CAP_USER_DATA_PERMS)
12658 cheritest_failure_errx("perms %jx (expected %jx)", v,
12659 (uintmax_t)CHERI_CAP_USER_DATA_PERMS);
12660
12661 /* Sealed bit. */
12662 v = cheri_getsealed(c);
12663 if (v != 0)
12664 cheritest_failure_errx("sealed %jx (expected 0)", v);
12665
12666 /* Tag bit. */
12667 v = cheri_gettag(c);
12668 if (v != 1)
12669 cheritest_failure_errx("tag %jx (expected 1)", v);
12670 cheritest_success();
12671}
12672#endif
12673# 287 "/home/alr48/cheri/sources/cheribsd/bin/cheritest/cheritest_registers.c"
12674
12675void
12676test_initregs_idc(const struct cheri_test *ctp __unused)
12677{
12678
12679 check_initreg_data(cheri_getidc());
12680}
12681
12682void
12683test_initregs_pcc(const struct cheri_test *ctp __unused)
12684{
12685 __capability void *c;
12686
12687 /* $pcc includes $pc, so clear that for the purposes of the check. */
12688 c = cheri_getpcc();
12689 c = cheri_setoffset(c, 0);
12690 check_initreg_code(c);
12691}