| author | |
| committer | |
| log | 7f36c4c7d3c8f3bfabb49a922a6156e4f1c61f67 |
| tree | 783c358e06ea2fdcab5e4659aff2a70c8c4ea1b8 |
| parent | c2aeef04e564213d8ea57007a11451bf825ae883 |
| parent | 81c52fd62188a43591f0df52c0a121999b497a28 |
Reviewed-on: https://codeberg.org/ziglang/zig/pulls/301351116 files changed, 30069 insertions(+), 22531 deletions(-)
lib/libc/freebsd/COPYRIGHT+1-2| ... | ... | @@ -1,9 +1,8 @@ |
| 1 | #	@(#)COPYRIGHT	8.2 (Berkeley) 3/21/94 | |
| 2 | 1 | |
| 3 | 2 | The compilation of software known as FreeBSD is distributed under the |
| 4 | 3 | following terms: |
| 5 | 4 | |
| 6 | Copyright (c) 1992-2023 The FreeBSD Project. | |
| 5 | Copyright (c) 1992-2025 The FreeBSD Project. | |
| 7 | 6 | |
| 8 | 7 | Redistribution and use in source and binary forms, with or without |
| 9 | 8 | modification, are permitted provided that the following conditions |
lib/libc/freebsd/abilists| Binary files a/lib/libc/freebsd/abilists and b/lib/libc/freebsd/abilists differ |
lib/libc/freebsd/lib/csu/amd64/crt1_s.S+6-9| ... | ... | @@ -49,15 +49,12 @@ _start: |
| 49 | 49 | #ifdef GCRT |
| 50 | 50 | 	subq	$16, %rsp |
| 51 | 51 | #endif |
| 52 | 	movq	%rsi, %rcx | |
| 53 | 	movq	%rdi, %rsi		/* argv = ap */ | |
| 54 | 	addq	$8, %rsi		/* argv += 1 */ | |
| 55 | 	movq	%rdi, %rdx		/* env = ap */ | |
| 56 | 	addq	$16, %rdx		/* env += 2 */ | |
| 57 | 	movslq	(%rdi), %rax | |
| 58 | 	movl	%eax, %edi		/* argc = *(long *)(void *)ap */ | |
| 59 | 	shlq	$3, %rax | |
| 60 | 	addq	%rax, %rdx		/* env += argc */ | |
| 52 | 	movq	%rsi, %rcx		/* cleanup */ | |
| 53 | 	movslq	(%rdi), %rax		/* long *ap; tmpargc = *ap */ | |
| 54 | 	leaq	0x8(%rdi), %rsi		/* argv = ap + 1 */ | |
| 55 | 	leaq	0x10(%rdi, %rax, 8), %rdx /* env = ap + 2 + tmpargc */ | |
| 56 | 	movl	%eax, %edi		/* argc = tmpargc */ | |
| 57 | ||
| 61 | 58 | #ifdef PIC |
| 62 | 59 | 	/* |
| 63 | 60 | 	 * XXX. %rip relative addressing is not intended for use in the |
lib/libc/freebsd/lib/csu/arm/crt1_c.c-1| ... | ... | @@ -41,7 +41,6 @@ |
| 41 | 41 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 42 | 42 | */ |
| 43 | 43 | |
| 44 | #include <sys/cdefs.h> | |
| 45 | 44 | #include <sys/param.h> |
| 46 | 45 | #include <sys/elf_common.h> |
| 47 | 46 |
lib/libc/freebsd/lib/csu/common/crtbegin.c+2-43| ... | ... | @@ -21,7 +21,6 @@ |
| 21 | 21 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 22 | 22 | */ |
| 23 | 23 | |
| 24 | #include <sys/cdefs.h> | |
| 25 | 24 | #include <sys/param.h> |
| 26 | 25 | |
| 27 | 26 | #include "crt.h" |
| ... | ... | @@ -41,9 +40,8 @@ void __cxa_finalize(void *) __weak_symbol; |
| 41 | 40 | * When we have ctors/dtors call from the dtor handler before calling |
| 42 | 41 | * any dtors, otherwise use a destructor. |
| 43 | 42 | */ |
| 44 | #ifndef HAVE_CTORS | |
| 43 | /* zig patch: no HAVE_CTORS */ | |
| 45 | 44 | __attribute__((destructor)) |
| 46 | #endif | |
| 47 | 45 | static void |
| 48 | 46 | run_cxa_finalize(void) |
| 49 | 47 | { |
| ... | ... | @@ -53,43 +51,4 @@ run_cxa_finalize(void) |
| 53 | 51 | } |
| 54 | 52 | #endif |
| 55 | 53 | |
| 56 | /* | |
| 57 | * On some architectures and toolchains we may need to call the .dtors. | |
| 58 | * These are called in the order they are in the ELF file. | |
| 59 | */ | |
| 60 | #ifdef HAVE_CTORS | |
| 61 | static void __do_global_dtors_aux(void) __used; | |
| 62 | ||
| 63 | static crt_func __CTOR_LIST__[] __section(".ctors") __used = { | |
| 64 | 	(crt_func)-1 | |
| 65 | }; | |
| 66 | static crt_func __DTOR_LIST__[] __section(".dtors") __used = { | |
| 67 | 	(crt_func)-1 | |
| 68 | }; | |
| 69 | ||
| 70 | static void | |
| 71 | __do_global_dtors_aux(void) | |
| 72 | { | |
| 73 | 	crt_func fn; | |
| 74 | 	int n; | |
| 75 | ||
| 76 | #ifdef SHARED | |
| 77 | 	run_cxa_finalize(); | |
| 78 | #endif | |
| 79 | ||
| 80 | 	for (n = 1;; n++) { | |
| 81 | 		fn = __DTOR_LIST__[n]; | |
| 82 | 		if (fn == (crt_func)0 || fn == (crt_func)-1) | |
| 83 | 			break; | |
| 84 | 		fn(); | |
| 85 | 	} | |
| 86 | } | |
| 87 | ||
| 88 | asm ( | |
| 89 | ".pushsection .fini		\n" | |
| 90 | "\t" INIT_CALL_SEQ(__do_global_dtors_aux) "\n" | |
| 91 | ".popsection		\n" | |
| 92 | ); | |
| 93 | #endif | |
| 94 | ||
| 95 | /* zig patch: remove gcj nonsense */ | |
| 54 | /* zig patch: no HAVE_CTORS */ |
lib/libc/freebsd/lib/csu/common/crtbrand.S+1-1| ... | ... | @@ -36,7 +36,7 @@ |
| 36 | 36 | * for more information. |
| 37 | 37 | */ |
| 38 | 38 | |
| 39 | 	.section .note.tag,"aG",%note,.freebsd.noteG,comdat | |
| 39 | 	.section .note.tag,"aGR",%note,.freebsd.noteG,comdat | |
| 40 | 40 | 	.p2align	2 |
| 41 | 41 | 	.4byte		2f-1f |
| 42 | 42 | 	.4byte		4f-3f |
lib/libc/freebsd/lib/csu/common/crtend.c deleted-65| ... | ... | @@ -1,65 +0,0 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-1-Clause | |
| 3 | * | |
| 4 | * Copyright 2018 Andrew Turner | |
| 5 | * | |
| 6 | * Redistribution and use in source and binary forms, with or without | |
| 7 | * modification, are permitted provided that the following conditions | |
| 8 | * are met: | |
| 9 | * 1. Redistributions of source code must retain the above copyright | |
| 10 | * notice, this list of conditions and the following disclaimer. | |
| 11 | * | |
| 12 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | |
| 13 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |
| 14 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | |
| 15 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | |
| 16 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | |
| 17 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
| 18 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
| 19 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
| 20 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | |
| 21 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 22 | */ | |
| 23 | ||
| 24 | #include <sys/cdefs.h> | |
| 25 | #include "crt.h" | |
| 26 | ||
| 27 | typedef void (*crt_func)(void); | |
| 28 | ||
| 29 | /* zig patch: remove gcj nonsense */ | |
| 30 | ||
| 31 | #ifdef HAVE_CTORS | |
| 32 | ||
| 33 | /* | |
| 34 | * On some architectures and toolchains we may need to call the .ctors. | |
| 35 | * These are called in the reverse order they are in the ELF file. | |
| 36 | */ | |
| 37 | static void __do_global_ctors_aux(void) __used; | |
| 38 | ||
| 39 | static crt_func __CTOR_END__[] __section(".ctors") __used = { | |
| 40 | 	(crt_func)0 | |
| 41 | }; | |
| 42 | static crt_func __DTOR_END__[] __section(".dtors") __used = { | |
| 43 | 	(crt_func)0 | |
| 44 | }; | |
| 45 | ||
| 46 | static void | |
| 47 | __do_global_ctors_aux(void) | |
| 48 | { | |
| 49 | 	crt_func fn; | |
| 50 | 	int n; | |
| 51 | ||
| 52 | 	for (n = 1;; n++) { | |
| 53 | 		fn = __CTOR_END__[-n]; | |
| 54 | 		if (fn == (crt_func)0 || fn == (crt_func)-1) | |
| 55 | 			break; | |
| 56 | 		fn(); | |
| 57 | 	} | |
| 58 | } | |
| 59 | ||
| 60 | asm ( | |
| 61 | ".pushsection .init		\n" | |
| 62 | "\t" INIT_CALL_SEQ(__do_global_ctors_aux) "\n" | |
| 63 | ".popsection		\n" | |
| 64 | ); | |
| 65 | #endif |
lib/libc/freebsd/lib/csu/common/feature_note.S+1-1| ... | ... | @@ -29,7 +29,7 @@ |
| 29 | 29 | #include <sys/elf_common.h> |
| 30 | 30 | #include "notes.h" |
| 31 | 31 | |
| 32 | 	.section .note.tag,"a",%note | |
| 32 | 	.section .note.tag,"aR",%note | |
| 33 | 33 | 	.p2align	2 |
| 34 | 34 | 	.4byte		2f-1f |
| 35 | 35 | 	.4byte		4f-3f |
lib/libc/freebsd/lib/csu/common/ignore_init_note.S+1-1| ... | ... | @@ -30,7 +30,7 @@ |
| 30 | 30 | |
| 31 | 31 | #include "notes.h" |
| 32 | 32 | |
| 33 | 	.section .note.tag,"a",%note | |
| 33 | 	.section .note.tag,"aR",%note | |
| 34 | 34 | 	.p2align	2 |
| 35 | 35 | 	.4byte		2f-1f |
| 36 | 36 | 	.4byte		4f-3f |
lib/libc/freebsd/lib/csu/powerpc/crt.h+1-2| ... | ... | @@ -24,8 +24,7 @@ |
| 24 | 24 | #ifndef _CRT_H_ |
| 25 | 25 | #define	_CRT_H_ |
| 26 | 26 | |
| 27 | /* zig patch: no HAVE_CTORS */ | |
| 28 | #define	CTORS_CONSTRUCTORS | |
| 27 | /* zig patch: no HAVE_CTORS/CTORS_CONSTRUCTORS */ | |
| 29 | 28 | #define	INIT_CALL_SEQ(func)	"bl " __STRING(func) "; nop" |
| 30 | 29 | |
| 31 | 30 | #endif |
lib/libc/freebsd/lib/csu/powerpc64/crt.h+1-2| ... | ... | @@ -24,8 +24,7 @@ |
| 24 | 24 | #ifndef _CRT_H_ |
| 25 | 25 | #define	_CRT_H_ |
| 26 | 26 | |
| 27 | /* zig patch: no HAVE_CTORS */ | |
| 28 | #define	CTORS_CONSTRUCTORS | |
| 27 | /* zig patch: no HAVE_CTORS/CTORS_CONSTRUCTORS */ | |
| 29 | 28 | #define	INIT_CALL_SEQ(func)	"bl " __STRING(func) "; nop" |
| 30 | 29 | |
| 31 | 30 | #endif |
lib/libc/freebsd/lib/libc/include/libc_private.h+22-86| ... | ... | @@ -37,6 +37,8 @@ |
| 37 | 37 | #include <sys/_types.h> |
| 38 | 38 | #include <sys/_pthreadtypes.h> |
| 39 | 39 | |
| 40 | #include <libsys.h> | |
| 41 | ||
| 40 | 42 | extern char **environ; |
| 41 | 43 | |
| 42 | 44 | /* |
| ... | ... | @@ -185,10 +187,12 @@ typedef enum { |
| 185 | 187 | 	PJT_GETTHREADID_NP, |
| 186 | 188 | 	PJT_ATTR_GET_NP, |
| 187 | 189 | 	PJT_GETNAME_NP, |
| 190 | 	PJT_SUSPEND_ALL_NP, | |
| 191 | 	PJT_RESUME_ALL_NP, | |
| 188 | 192 | 	PJT_MAX |
| 189 | 193 | } pjt_index_t; |
| 190 | 194 | |
| 191 | typedef int (*pthread_func_t)(void); | |
| 195 | typedef void (*pthread_func_t)(void); | |
| 192 | 196 | typedef pthread_func_t pthread_func_entry_t[2]; |
| 193 | 197 | |
| 194 | 198 | extern pthread_func_entry_t __thr_jtable[]; |
| ... | ... | @@ -197,9 +201,10 @@ void	__set_error_selector(int *(*arg)(void)); |
| 197 | 201 | int	_pthread_mutex_init_calloc_cb_stub(pthread_mutex_t *mutex, |
| 198 | 202 | 	 void *(calloc_cb)(__size_t, __size_t)); |
| 199 | 203 | |
| 200 | typedef int (*interpos_func_t)(void); | |
| 204 | typedef void (*interpos_func_t)(void); | |
| 201 | 205 | interpos_func_t *__libc_interposing_slot(int interposno); |
| 202 | 206 | extern interpos_func_t __libc_interposing[] __hidden; |
| 207 | interpos_func_t *__libsys_interposing_slot(int interposno); | |
| 203 | 208 | |
| 204 | 209 | enum { |
| 205 | 210 | 	INTERPOS_accept, |
| ... | ... | @@ -244,11 +249,18 @@ enum { |
| 244 | 249 | 	INTERPOS_map_stacks_exec, |
| 245 | 250 | 	INTERPOS_fdatasync, |
| 246 | 251 | 	INTERPOS_clock_nanosleep, |
| 247 | 	INTERPOS_distribute_static_tls, | |
| 252 | 	INTERPOS__reserved0, /* was distribute_static_tls */ | |
| 248 | 253 | 	INTERPOS_pdfork, |
| 254 | 	INTERPOS_uexterr_gettext, | |
| 249 | 255 | 	INTERPOS_MAX |
| 250 | 256 | }; |
| 251 | 257 | |
| 258 | #define	_INTERPOS_SYS(type, idx, ...)				\ | |
| 259 | ((type *)*(__libc_interposing_slot(idx)))(__VA_ARGS__) | |
| 260 | #define	INTERPOS_SYS(syscall, ...)				\ | |
| 261 | _INTERPOS_SYS(__sys_## syscall ##_t, INTERPOS_## syscall	\ | |
| 262 | __VA_OPT__(,) __VA_ARGS__) | |
| 263 | ||
| 252 | 264 | /* |
| 253 | 265 | * yplib internal interfaces |
| 254 | 266 | */ |
| ... | ... | @@ -333,102 +345,22 @@ struct __siginfo; |
| 333 | 345 | struct __ucontext; |
| 334 | 346 | struct __wrusage; |
| 335 | 347 | enum idtype; |
| 336 | int		__sys_aio_suspend(const struct aiocb * const[], int, | |
| 337 | 		 const struct timespec *); | |
| 338 | int		__sys_accept(int, struct sockaddr *, __socklen_t *); | |
| 339 | int		__sys_accept4(int, struct sockaddr *, __socklen_t *, int); | |
| 340 | int		__sys_clock_gettime(__clockid_t, struct timespec *ts); | |
| 341 | int		__sys_clock_nanosleep(__clockid_t, int, | |
| 342 | 		 const struct timespec *, struct timespec *); | |
| 343 | int		__sys_close(int); | |
| 344 | int		__sys_close_range(unsigned, unsigned, int); | |
| 345 | int		__sys_connect(int, const struct sockaddr *, __socklen_t); | |
| 346 | int		__sys_fcntl(int, int, ...); | |
| 347 | int		__sys_fdatasync(int); | |
| 348 | int		__sys_fstat(int fd, struct stat *); | |
| 349 | int		__sys_fstatfs(int fd, struct statfs *); | |
| 350 | int		__sys_fstatat(int, const char *, struct stat *, int); | |
| 351 | int		__sys_fsync(int); | |
| 352 | __pid_t		__sys_fork(void); | |
| 353 | int		__sys_ftruncate(int, __off_t); | |
| 354 | __ssize_t	__sys_getdirentries(int, char *, __size_t, __off_t *); | |
| 355 | int		__sys_getfsstat(struct statfs *, long, int); | |
| 356 | int		__sys_gettimeofday(struct timeval *, struct timezone *); | |
| 357 | int		__sys_kevent(int, const struct kevent *, int, struct kevent *, | |
| 358 | 		 int, const struct timespec *); | |
| 359 | __off_t		__sys_lseek(int, __off_t, int); | |
| 360 | void	 *__sys_mmap(void *, __size_t, int, int, int, __off_t); | |
| 361 | int		__sys_msync(void *, __size_t, int); | |
| 362 | int		__sys_nanosleep(const struct timespec *, struct timespec *); | |
| 363 | int		__sys_open(const char *, int, ...); | |
| 364 | int		__sys_openat(int, const char *, int, ...); | |
| 365 | int		__sys_pdfork(int *, int); | |
| 366 | int		__sys_pselect(int, struct fd_set *, struct fd_set *, | |
| 367 | 		 struct fd_set *, const struct timespec *, | |
| 368 | 		 const __sigset_t *); | |
| 369 | int		__sys_ptrace(int, __pid_t, char *, int); | |
| 370 | int		__sys_poll(struct pollfd *, unsigned, int); | |
| 371 | int		__sys_ppoll(struct pollfd *, unsigned, const struct timespec *, | |
| 372 | 		 const __sigset_t *); | |
| 373 | __ssize_t	__sys_pread(int, void *, __size_t, __off_t); | |
| 374 | __ssize_t	__sys_pwrite(int, const void *, __size_t, __off_t); | |
| 375 | __ssize_t	__sys_read(int, void *, __size_t); | |
| 376 | __ssize_t	__sys_readv(int, const struct iovec *, int); | |
| 377 | __ssize_t	__sys_recv(int, void *, __size_t, int); | |
| 378 | __ssize_t	__sys_recvfrom(int, void *, __size_t, int, struct sockaddr *, | |
| 379 | 		 __socklen_t *); | |
| 380 | __ssize_t	__sys_recvmsg(int, struct msghdr *, int); | |
| 381 | int		__sys_sched_getcpu(void); | |
| 382 | int		__sys_select(int, struct fd_set *, struct fd_set *, | |
| 383 | 		 struct fd_set *, struct timeval *); | |
| 384 | __ssize_t	__sys_sendmsg(int, const struct msghdr *, int); | |
| 385 | __ssize_t	__sys_sendto(int, const void *, __size_t, int, | |
| 386 | 		 const struct sockaddr *, __socklen_t); | |
| 387 | int		__sys_setcontext(const struct __ucontext *); | |
| 388 | int		__sys_sigaction(int, const struct sigaction *, | |
| 389 | 		 struct sigaction *); | |
| 390 | int		__sys_sigprocmask(int, const __sigset_t *, __sigset_t *); | |
| 391 | int		__sys_sigsuspend(const __sigset_t *); | |
| 392 | int		__sys_sigtimedwait(const __sigset_t *, struct __siginfo *, | |
| 393 | 		 const struct timespec *); | |
| 394 | int		__sys_sigwait(const __sigset_t *, int *); | |
| 395 | int		__sys_sigwaitinfo(const __sigset_t *, struct __siginfo *); | |
| 396 | int		__sys___specialfd(int, const void *, __size_t); | |
| 397 | int		__sys_statfs(const char *, struct statfs *); | |
| 398 | int		__sys_swapcontext(struct __ucontext *, | |
| 399 | 		 const struct __ucontext *); | |
| 400 | int		__sys_thr_kill(long, int); | |
| 401 | int		__sys_thr_self(long *); | |
| 402 | int		__sys_truncate(const char *, __off_t); | |
| 403 | __pid_t		__sys_wait4(__pid_t, int *, int, struct rusage *); | |
| 404 | __pid_t		__sys_wait6(enum idtype, __id_t, int *, int, | |
| 405 | 		 struct __wrusage *, struct __siginfo *); | |
| 406 | __ssize_t	__sys_write(int, const void *, __size_t); | |
| 407 | __ssize_t	__sys_writev(int, const struct iovec *, int); | |
| 408 | int		__sys_shm_open2(const char *, int, __mode_t, int, const char *); | |
| 409 | 348 | |
| 349 | int		__libc_execvpe(const char *, char * const *, char * const *); | |
| 410 | 350 | int		__libc_sigaction(int, const struct sigaction *, |
| 411 | 351 | 		 struct sigaction *) __hidden; |
| 412 | 352 | int		__libc_sigprocmask(int, const __sigset_t *, __sigset_t *) |
| 413 | 353 | 		 __hidden; |
| 414 | 354 | int		__libc_sigsuspend(const __sigset_t *) __hidden; |
| 415 | int		__libc_sigwait(const __sigset_t * __restrict, | |
| 416 | 		 int * restrict sig); | |
| 355 | int		__libsys_sigwait(const __sigset_t *, int *) __hidden; | |
| 417 | 356 | int		__libc_system(const char *); |
| 418 | 357 | int		__libc_tcdrain(int); |
| 419 | int		__fcntl_compat(int fd, int cmd, ...); | |
| 420 | ||
| 421 | int		__sys_futimens(int fd, const struct timespec *times) __hidden; | |
| 422 | int		__sys_utimensat(int fd, const char *path, | |
| 423 | 		 const struct timespec *times, int flag) __hidden; | |
| 424 | 358 | |
| 425 | 359 | int _elf_aux_info(int aux, void *buf, int buflen); |
| 426 | 360 | struct dl_phdr_info; |
| 427 | 361 | int __elf_phdr_match_addr(struct dl_phdr_info *, void *); |
| 428 | 362 | void __init_elf_aux_vector(void); |
| 429 | 363 | void __libc_map_stacks_exec(void); |
| 430 | void __libc_distribute_static_tls(__size_t, void *, __size_t, __size_t); | |
| 431 | __uintptr_t __libc_static_tls_base(__size_t); | |
| 432 | 364 | |
| 433 | 365 | void	_pthread_cancel_enter(int); |
| 434 | 366 | void	_pthread_cancel_leave(int); |
| ... | ... | @@ -444,7 +376,11 @@ struct __nl_cat_d; |
| 444 | 376 | struct _xlocale; |
| 445 | 377 | struct __nl_cat_d *__catopen_l(const char *name, int type, |
| 446 | 378 | 	 struct _xlocale *locale); |
| 447 | int __strerror_rl(int errnum, char *strerrbuf, __size_t buflen, | |
| 379 | int __strerror_rl(int errnum, char *strerrbuf, size_t buflen, | |
| 448 | 380 | 	 struct _xlocale *locale); |
| 449 | 381 | |
| 382 | struct uexterror; | |
| 383 | int __uexterr_format(const struct uexterror *ue, char *buf, size_t bufsz); | |
| 384 | int __libc_uexterr_gettext(char *buf, size_t bufsz); | |
| 385 | ||
| 450 | 386 | #endif /* _LIBC_PRIVATE_H_ */ |
lib/libc/include/aarch64-freebsd-none/arm/_align.h-2| ... | ... | @@ -35,8 +35,6 @@ |
| 35 | 35 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 36 | 36 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 37 | 37 | * SUCH DAMAGE. |
| 38 | * | |
| 39 | *	from: @(#)param.h	5.8 (Berkeley) 6/28/91 | |
| 40 | 38 | */ |
| 41 | 39 | |
| 42 | 40 | #ifndef _ARM_INCLUDE__ALIGN_H_ |
lib/libc/include/aarch64-freebsd-none/arm/_limits.h-2| ... | ... | @@ -27,8 +27,6 @@ |
| 27 | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | * | |
| 31 | *	@(#)limits.h	8.3 (Berkeley) 1/4/94 | |
| 32 | 30 | */ |
| 33 | 31 | |
| 34 | 32 | #ifndef _MACHINE__LIMITS_H_ |
lib/libc/include/aarch64-freebsd-none/arm/_types.h-3| ... | ... | @@ -32,9 +32,6 @@ |
| 32 | 32 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 33 | 33 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 34 | 34 | * SUCH DAMAGE. |
| 35 | * | |
| 36 | *	From: @(#)ansi.h	8.2 (Berkeley) 1/4/94 | |
| 37 | *	From: @(#)types.h	8.3 (Berkeley) 1/5/94 | |
| 38 | 35 | */ |
| 39 | 36 | |
| 40 | 37 | #ifndef _MACHINE__TYPES_H_ |
lib/libc/include/aarch64-freebsd-none/arm/acle-compat.h+3-155| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* |
| 2 | * Copyright (c) 2014 ARM Ltd | |
| 2 | * Copyright (c) 2024 Arm Ltd | |
| 3 | 3 | * All rights reserved. |
| 4 | 4 | * |
| 5 | 5 | * Redistribution and use in source and binary forms, with or without |
| ... | ... | @@ -27,157 +27,5 @@ |
| 27 | 27 | */ |
| 28 | 28 | |
| 29 | 29 | #ifndef __ARM_ARCH |
| 30 | ||
| 31 | /* ACLE standardises a set of pre-defines that describe the ARM architecture. | |
| 32 | These were mostly implemented in GCC around GCC-4.8; older versions | |
| 33 | have no, or only partial support. To provide a level of backwards | |
| 34 | compatibility we try to work out what the definitions should be, given | |
| 35 | the older pre-defines that GCC did produce. This isn't complete, but | |
| 36 | it should be enough for use by routines that depend on this header. */ | |
| 37 | ||
| 38 | /* No need to handle ARMv8, GCC had ACLE support before that. */ | |
| 39 | ||
| 40 | #define __ARM_ACLE 101 | |
| 41 | ||
| 42 | # ifdef __ARM_ARCH_7__ | |
| 43 | /* The common subset of ARMv7 in all profiles. */ | |
| 44 | # define __ARM_ARCH 7 | |
| 45 | # define __ARM_ARCH_ISA_THUMB 2 | |
| 46 | # define __ARM_FEATURE_CLZ | |
| 47 | # define __ARM_FEATURE_LDREX 7 | |
| 48 | # define __ARM_FEATURE_UNALIGNED | |
| 49 | # endif | |
| 50 | ||
| 51 | # if defined (__ARM_ARCH_7A__) || defined (__ARM_ARCH_7R__) | |
| 52 | # define __ARM_ARCH 7 | |
| 53 | # define __ARM_ARCH_ISA_THUMB 2 | |
| 54 | # define __ARM_ARCH_ISA_ARM | |
| 55 | # define __ARM_FEATURE_CLZ | |
| 56 | # define __ARM_FEATURE_SIMD32 | |
| 57 | # define __ARM_FEATURE_DSP | |
| 58 | # define __ARM_FEATURE_QBIT | |
| 59 | # define __ARM_FEATURE_SAT | |
| 60 | # define __ARM_FEATURE_LDREX 15 | |
| 61 | # define __ARM_FEATURE_UNALIGNED | |
| 62 | # ifdef __ARM_ARCH_7A__ | |
| 63 | # define __ARM_ARCH_PROFILE 'A' | |
| 64 | # else | |
| 65 | # define __ARM_ARCH_PROFILE 'R' | |
| 66 | # endif | |
| 67 | # endif | |
| 68 | ||
| 69 | # ifdef __ARM_ARCH_7EM__ | |
| 70 | # define __ARM_ARCH 7 | |
| 71 | # define __ARM_ARCH_ISA_THUMB 2 | |
| 72 | # define __ARM_FEATURE_CLZ | |
| 73 | # define __ARM_FEATURE_SIMD32 | |
| 74 | # define __ARM_FEATURE_DSP | |
| 75 | # define __ARM_FEATURE_QBIT | |
| 76 | # define __ARM_FEATURE_SAT | |
| 77 | # define __ARM_FEATURE_LDREX 7 | |
| 78 | # define __ARM_FEATURE_UNALIGNED | |
| 79 | # define __ARM_ARCH_PROFILE 'M' | |
| 80 | # endif | |
| 81 | ||
| 82 | # ifdef __ARM_ARCH_7M__ | |
| 83 | # define __ARM_ARCH 7 | |
| 84 | # define __ARM_ARCH_ISA_THUMB 2 | |
| 85 | # define __ARM_FEATURE_CLZ | |
| 86 | # define __ARM_FEATURE_QBIT | |
| 87 | # define __ARM_FEATURE_SAT | |
| 88 | # define __ARM_FEATURE_LDREX 7 | |
| 89 | # define __ARM_FEATURE_UNALIGNED | |
| 90 | # define __ARM_ARCH_PROFILE 'M' | |
| 91 | # endif | |
| 92 | ||
| 93 | # ifdef __ARM_ARCH_6T2__ | |
| 94 | # define __ARM_ARCH 6 | |
| 95 | # define __ARM_ARCH_ISA_THUMB 2 | |
| 96 | # define __ARM_ARCH_ISA_ARM | |
| 97 | # define __ARM_FEATURE_CLZ | |
| 98 | # define __ARM_FEATURE_SIMD32 | |
| 99 | # define __ARM_FEATURE_DSP | |
| 100 | # define __ARM_FEATURE_QBIT | |
| 101 | # define __ARM_FEATURE_SAT | |
| 102 | # define __ARM_FEATURE_LDREX 4 | |
| 103 | # define __ARM_FEATURE_UNALIGNED | |
| 104 | # endif | |
| 105 | ||
| 106 | # ifdef __ARM_ARCH_6M__ | |
| 107 | # define __ARM_ARCH 6 | |
| 108 | # define __ARM_ARCH_ISA_THUMB 1 | |
| 109 | # define __ARM_ARCH_PROFILE 'M' | |
| 110 | # endif | |
| 111 | ||
| 112 | # if defined (__ARM_ARCH_6__) || defined (__ARM_ARCH_6J__) \ | |
| 113 | || defined (__ARM_ARCH_6K__) || defined (__ARM_ARCH_6Z__) \ | |
| 114 | || defined (__ARM_ARCH_6ZK__) | |
| 115 | # define __ARM_ARCH 6 | |
| 116 | # define __ARM_ARCH_ISA_THUMB 1 | |
| 117 | # define __ARM_ARCH_ISA_ARM | |
| 118 | # define __ARM_FEATURE_CLZ | |
| 119 | # define __ARM_FEATURE_SIMD32 | |
| 120 | # define __ARM_FEATURE_DSP | |
| 121 | # define __ARM_FEATURE_QBIT | |
| 122 | # define __ARM_FEATURE_SAT | |
| 123 | # define __ARM_FEATURE_UNALIGNED | |
| 124 | # ifndef __thumb__ | |
| 125 | # if defined (__ARM_ARCH_6K__) || defined (__ARM_ARCH_6ZK__) | |
| 126 | # define __ARM_FEATURE_LDREX 15 | |
| 127 | # else | |
| 128 | # define __ARM_FEATURE_LDREX 4 | |
| 129 | # endif | |
| 130 | # endif | |
| 131 | # endif | |
| 132 | ||
| 133 | # if defined (__ARM_ARCH_5TE__) || defined (__ARM_ARCH_5E__) | |
| 134 | # define __ARM_ARCH 5 | |
| 135 | # define __ARM_ARCH_ISA_ARM | |
| 136 | # ifdef __ARM_ARCH_5TE__ | |
| 137 | # define __ARM_ARCH_ISA_THUMB 1 | |
| 138 | # endif | |
| 139 | # define __ARM_FEATURE_CLZ | |
| 140 | # define __ARM_FEATURE_DSP | |
| 141 | # endif | |
| 142 | ||
| 143 | # if defined (__ARM_ARCH_5T__) || defined (__ARM_ARCH_5__) | |
| 144 | # define __ARM_ARCH 5 | |
| 145 | # define __ARM_ARCH_ISA_ARM | |
| 146 | # ifdef __ARM_ARCH_5TE__ | |
| 147 | # define __ARM_ARCH_ISA_THUMB 1 | |
| 148 | # endif | |
| 149 | # define __ARM_FEATURE_CLZ | |
| 150 | # endif | |
| 151 | ||
| 152 | # ifdef __ARM_ARCH_4T__ | |
| 153 | # define __ARM_ARCH 4 | |
| 154 | # define __ARM_ARCH_ISA_ARM | |
| 155 | # define __ARM_ARCH_ISA_THUMB 1 | |
| 156 | # endif | |
| 157 | ||
| 158 | # ifdef __ARM_ARCH_4__ | |
| 159 | # define __ARM_ARCH 4 | |
| 160 | # define __ARM_ARCH_ISA_ARM | |
| 161 | # endif | |
| 162 | ||
| 163 | # if defined (__ARM_ARCH_3__) || defined (__ARM_ARCH_3M__) | |
| 164 | # define __ARM_ARCH 3 | |
| 165 | # define __ARM_ARCH_ISA_ARM | |
| 166 | # endif | |
| 167 | ||
| 168 | # ifdef __ARM_ARCH_2__ | |
| 169 | # define __ARM_ARCH 2 | |
| 170 | # define __ARM_ARCH_ISA_ARM | |
| 171 | # endif | |
| 172 | ||
| 173 | # ifdef __ARMEB__ | |
| 174 | # define __ARM_BIG_ENDIAN | |
| 175 | # endif | |
| 176 | ||
| 177 | /* If we still don't know what the target architecture is, then we're | |
| 178 | probably not using GCC. */ | |
| 179 | # ifndef __ARM_ARCH | |
| 180 | # error Unable to determine architecture version. | |
| 181 | # endif | |
| 182 | ||
| 183 | #endif /* __ARM_ARCH */ | |
| \ No newline at end of file | ||
| 30 | #error Your compiler is too old | |
| 31 | #endif | |
| \ No newline at end of file |
lib/libc/include/aarch64-freebsd-none/arm/asm.h-10| ... | ... | @@ -32,8 +32,6 @@ |
| 32 | 32 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 33 | 33 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 34 | 34 | * SUCH DAMAGE. |
| 35 | * | |
| 36 | *	from: @(#)asm.h	5.5 (Berkeley) 5/7/91 | |
| 37 | 35 | */ |
| 38 | 36 | |
| 39 | 37 | #ifndef _MACHINE_ASM_H_ |
| ... | ... | @@ -176,7 +174,6 @@ |
| 176 | 174 | # define RETne	bxne	lr |
| 177 | 175 | # define RETc(c) bx##c	lr |
| 178 | 176 | |
| 179 | #if __ARM_ARCH >= 7 | |
| 180 | 177 | #define ISB	isb |
| 181 | 178 | #define DSB	dsb |
| 182 | 179 | #define DMB	dmb |
| ... | ... | @@ -190,12 +187,5 @@ |
| 190 | 187 | #define ERET .word 0xe160006e |
| 191 | 188 | #endif |
| 192 | 189 | |
| 193 | #elif __ARM_ARCH == 6 | |
| 194 | #include <machine/sysreg.h> | |
| 195 | #define ISB	mcr CP15_CP15ISB | |
| 196 | #define DSB	mcr CP15_CP15DSB | |
| 197 | #define DMB	mcr CP15_CP15DMB | |
| 198 | #define WFI	mcr CP15_CP15WFI | |
| 199 | #endif | |
| 200 | 190 | |
| 201 | 191 | #endif /* !_MACHINE_ASM_H_ */ |
| \ No newline at end of file |
lib/libc/include/aarch64-freebsd-none/arm/atomic.h+28-21| ... | ... | @@ -41,15 +41,9 @@ |
| 41 | 41 | |
| 42 | 42 | #include <sys/atomic_common.h> |
| 43 | 43 | |
| 44 | #if __ARM_ARCH >= 7 | |
| 45 | 44 | #define isb() __asm __volatile("isb" : : : "memory") |
| 46 | 45 | #define dsb() __asm __volatile("dsb" : : : "memory") |
| 47 | 46 | #define dmb() __asm __volatile("dmb" : : : "memory") |
| 48 | #else | |
| 49 | #define isb() __asm __volatile("mcr p15, 0, %0, c7, c5, 4" : : "r" (0) : "memory") | |
| 50 | #define dsb() __asm __volatile("mcr p15, 0, %0, c7, c10, 4" : : "r" (0) : "memory") | |
| 51 | #define dmb() __asm __volatile("mcr p15, 0, %0, c7, c10, 5" : : "r" (0) : "memory") | |
| 52 | #endif | |
| 53 | 47 | |
| 54 | 48 | #define mb() dmb() |
| 55 | 49 | #define wmb() dmb() |
| ... | ... | @@ -614,7 +608,7 @@ atomic_fetchadd_long(volatile u_long *p, u_long val) |
| 614 | 608 | } |
| 615 | 609 | |
| 616 | 610 | static __inline uint32_t |
| 617 | atomic_load_acq_32(volatile uint32_t *p) | |
| 611 | atomic_load_acq_32(const volatile uint32_t *p) | |
| 618 | 612 | { |
| 619 | 613 | 	uint32_t v; |
| 620 | 614 | |
| ... | ... | @@ -624,7 +618,7 @@ atomic_load_acq_32(volatile uint32_t *p) |
| 624 | 618 | } |
| 625 | 619 | |
| 626 | 620 | static __inline uint64_t |
| 627 | atomic_load_64(volatile uint64_t *p) | |
| 621 | atomic_load_64(const volatile uint64_t *p) | |
| 628 | 622 | { |
| 629 | 623 | 	uint64_t ret; |
| 630 | 624 | |
| ... | ... | @@ -643,7 +637,7 @@ atomic_load_64(volatile uint64_t *p) |
| 643 | 637 | } |
| 644 | 638 | |
| 645 | 639 | static __inline uint64_t |
| 646 | atomic_load_acq_64(volatile uint64_t *p) | |
| 640 | atomic_load_acq_64(const volatile uint64_t *p) | |
| 647 | 641 | { |
| 648 | 642 | 	uint64_t ret; |
| 649 | 643 | |
| ... | ... | @@ -653,7 +647,7 @@ atomic_load_acq_64(volatile uint64_t *p) |
| 653 | 647 | } |
| 654 | 648 | |
| 655 | 649 | static __inline u_long |
| 656 | atomic_load_acq_long(volatile u_long *p) | |
| 650 | atomic_load_acq_long(const volatile u_long *p) | |
| 657 | 651 | { |
| 658 | 652 | 	u_long v; |
| 659 | 653 | |
| ... | ... | @@ -898,8 +892,6 @@ atomic_testandclear_long(volatile u_long *p, u_int v) |
| 898 | 892 | |
| 899 | 893 | 	return (atomic_testandclear_32((volatile uint32_t *)p, v)); |
| 900 | 894 | } |
| 901 | #define	atomic_testandclear_long	atomic_testandclear_long | |
| 902 | ||
| 903 | 895 | |
| 904 | 896 | static __inline int |
| 905 | 897 | atomic_testandclear_64(volatile uint64_t *p, u_int v) |
| ... | ... | @@ -958,7 +950,16 @@ atomic_testandset_long(volatile u_long *p, u_int v) |
| 958 | 950 | |
| 959 | 951 | 	return (atomic_testandset_32((volatile uint32_t *)p, v)); |
| 960 | 952 | } |
| 961 | #define	atomic_testandset_long	atomic_testandset_long | |
| 953 | ||
| 954 | static __inline int | |
| 955 | atomic_testandset_acq_long(volatile u_long *p, u_int v) | |
| 956 | { | |
| 957 | 	int ret; | |
| 958 | ||
| 959 | 	ret = atomic_testandset_32((volatile uint32_t *)p, v); | |
| 960 | 	dmb(); | |
| 961 | 	return (ret); | |
| 962 | } | |
| 962 | 963 | |
| 963 | 964 | static __inline int |
| 964 | 965 | atomic_testandset_64(volatile uint64_t *p, u_int v) |
| ... | ... | @@ -1052,6 +1053,12 @@ atomic_thread_fence_seq_cst(void) |
| 1052 | 1053 | 	dmb(); |
| 1053 | 1054 | } |
| 1054 | 1055 | |
| 1056 | #define atomic_add_ptr			atomic_add_32 | |
| 1057 | #define atomic_add_acq_ptr		atomic_add_acq_32 | |
| 1058 | #define atomic_add_rel_ptr		atomic_add_rel_32 | |
| 1059 | #define atomic_subtract_ptr		atomic_subtract_32 | |
| 1060 | #define atomic_subtract_acq_ptr		atomic_subtract_acq_32 | |
| 1061 | #define atomic_subtract_rel_ptr		atomic_subtract_rel_32 | |
| 1055 | 1062 | #define atomic_clear_ptr		atomic_clear_32 |
| 1056 | 1063 | #define atomic_clear_acq_ptr		atomic_clear_acq_32 |
| 1057 | 1064 | #define atomic_clear_rel_ptr		atomic_clear_rel_32 |
| ... | ... | @@ -1059,15 +1066,18 @@ atomic_thread_fence_seq_cst(void) |
| 1059 | 1066 | #define atomic_set_acq_ptr		atomic_set_acq_32 |
| 1060 | 1067 | #define atomic_set_rel_ptr		atomic_set_rel_32 |
| 1061 | 1068 | #define atomic_fcmpset_ptr		atomic_fcmpset_32 |
| 1062 | #define atomic_fcmpset_rel_ptr		atomic_fcmpset_rel_32 | |
| 1063 | 1069 | #define atomic_fcmpset_acq_ptr		atomic_fcmpset_acq_32 |
| 1070 | #define atomic_fcmpset_rel_ptr		atomic_fcmpset_rel_32 | |
| 1064 | 1071 | #define atomic_cmpset_ptr		atomic_cmpset_32 |
| 1065 | 1072 | #define atomic_cmpset_acq_ptr		atomic_cmpset_acq_32 |
| 1066 | 1073 | #define atomic_cmpset_rel_ptr		atomic_cmpset_rel_32 |
| 1074 | #define atomic_fetchadd_ptr		atomic_fetchadd_32 | |
| 1075 | #define atomic_readandclear_ptr		atomic_readandclear_32 | |
| 1067 | 1076 | #define atomic_load_acq_ptr		atomic_load_acq_32 |
| 1068 | 1077 | #define atomic_store_rel_ptr		atomic_store_rel_32 |
| 1069 | 1078 | #define atomic_swap_ptr			atomic_swap_32 |
| 1070 | #define atomic_readandclear_ptr		atomic_readandclear_32 | |
| 1079 | #define	atomic_testandset_ptr		atomic_testandset_32 | |
| 1080 | #define	atomic_testandclear_ptr		atomic_testandclear_32 | |
| 1071 | 1081 | |
| 1072 | 1082 | #define atomic_add_int			atomic_add_32 |
| 1073 | 1083 | #define atomic_add_acq_int		atomic_add_acq_32 |
| ... | ... | @@ -1093,12 +1103,9 @@ atomic_thread_fence_seq_cst(void) |
| 1093 | 1103 | #define atomic_store_rel_int		atomic_store_rel_32 |
| 1094 | 1104 | #define atomic_swap_int			atomic_swap_32 |
| 1095 | 1105 | |
| 1096 | /* | |
| 1097 | * For: | |
| 1098 | * - atomic_load_acq_8 | |
| 1099 | * - atomic_load_acq_16 | |
| 1100 | * - atomic_testandset_acq_long | |
| 1101 | */ | |
| 1102 | 1106 | #include <sys/_atomic_subword.h> |
| 1103 | 1107 | |
| 1108 | #define	atomic_set_short		atomic_set_16 | |
| 1109 | #define	atomic_clear_short		atomic_clear_16 | |
| 1110 | ||
| 1104 | 1111 | #endif /* _MACHINE_ATOMIC_H_ */ |
| \ No newline at end of file |
lib/libc/include/aarch64-freebsd-none/arm/cpu.h+11-45| ... | ... | @@ -45,13 +45,7 @@ void	cpu_halt(void); |
| 45 | 45 | * unconditionally with -DSMP. Although it looks like a bug, |
| 46 | 46 | * handle this case here and in #elif condition in ARM_SMP_UP macro. |
| 47 | 47 | */ |
| 48 | #if __ARM_ARCH <= 6 && defined(SMP) && !defined(KLD_MODULE) | |
| 49 | #error SMP option is not supported on ARMv6 | |
| 50 | #endif | |
| 51 | 48 | |
| 52 | #if __ARM_ARCH <= 6 && defined(SMP_ON_UP) | |
| 53 | #error SMP_ON_UP option is only supported on ARMv7+ CPUs | |
| 54 | #endif | |
| 55 | 49 | |
| 56 | 50 | #if !defined(SMP) && defined(SMP_ON_UP) |
| 57 | 51 | #error SMP option must be defined for SMP_ON_UP option |
| ... | ... | @@ -68,7 +62,7 @@ do {								\ |
| 68 | 62 | 		up_code;					\ |
| 69 | 63 | 	}							\ |
| 70 | 64 | } while (0) |
| 71 | #elif defined(SMP) && __ARM_ARCH > 6 | |
| 65 | #elif defined(SMP) | |
| 72 | 66 | #define ARM_SMP_UP(smp_code, up_code)				\ |
| 73 | 67 | do {								\ |
| 74 | 68 | 	smp_code;						\ |
| ... | ... | @@ -146,15 +140,15 @@ fname(uint64_t reg)							\ |
| 146 | 140 | /* TLB */ |
| 147 | 141 | |
| 148 | 142 | _WF0(_CP15_TLBIALL, CP15_TLBIALL)		/* Invalidate entire unified TLB */ |
| 149 | #if __ARM_ARCH >= 7 && defined(SMP) | |
| 143 | #if defined(SMP) | |
| 150 | 144 | _WF0(_CP15_TLBIALLIS, CP15_TLBIALLIS)		/* Invalidate entire unified TLB IS */ |
| 151 | 145 | #endif |
| 152 | 146 | _WF1(_CP15_TLBIASID, CP15_TLBIASID(%0))		/* Invalidate unified TLB by ASID */ |
| 153 | #if __ARM_ARCH >= 7 && defined(SMP) | |
| 147 | #if defined(SMP) | |
| 154 | 148 | _WF1(_CP15_TLBIASIDIS, CP15_TLBIASIDIS(%0))	/* Invalidate unified TLB by ASID IS */ |
| 155 | 149 | #endif |
| 156 | 150 | _WF1(_CP15_TLBIMVAA, CP15_TLBIMVAA(%0))		/* Invalidate unified TLB by MVA, all ASID */ |
| 157 | #if __ARM_ARCH >= 7 && defined(SMP) | |
| 151 | #if defined(SMP) | |
| 158 | 152 | _WF1(_CP15_TLBIMVAAIS, CP15_TLBIMVAAIS(%0))	/* Invalidate unified TLB by MVA, all ASID IS */ |
| 159 | 153 | #endif |
| 160 | 154 | _WF1(_CP15_TLBIMVA, CP15_TLBIMVA(%0))		/* Invalidate unified TLB by MVA */ |
| ... | ... | @@ -164,21 +158,19 @@ _WF1(_CP15_TTB_SET, CP15_TTBR0(%0)) |
| 164 | 158 | /* Cache and Branch predictor */ |
| 165 | 159 | |
| 166 | 160 | _WF0(_CP15_BPIALL, CP15_BPIALL)			/* Branch predictor invalidate all */ |
| 167 | #if __ARM_ARCH >= 7 && defined(SMP) | |
| 161 | #if defined(SMP) | |
| 168 | 162 | _WF0(_CP15_BPIALLIS, CP15_BPIALLIS)		/* Branch predictor invalidate all IS */ |
| 169 | 163 | #endif |
| 170 | 164 | _WF1(_CP15_BPIMVA, CP15_BPIMVA(%0))		/* Branch predictor invalidate by MVA */ |
| 171 | 165 | _WF1(_CP15_DCCIMVAC, CP15_DCCIMVAC(%0))		/* Data cache clean and invalidate by MVA PoC */ |
| 172 | 166 | _WF1(_CP15_DCCISW, CP15_DCCISW(%0))		/* Data cache clean and invalidate by set/way */ |
| 173 | 167 | _WF1(_CP15_DCCMVAC, CP15_DCCMVAC(%0))		/* Data cache clean by MVA PoC */ |
| 174 | #if __ARM_ARCH >= 7 | |
| 175 | 168 | _WF1(_CP15_DCCMVAU, CP15_DCCMVAU(%0))		/* Data cache clean by MVA PoU */ |
| 176 | #endif | |
| 177 | 169 | _WF1(_CP15_DCCSW, CP15_DCCSW(%0))		/* Data cache clean by set/way */ |
| 178 | 170 | _WF1(_CP15_DCIMVAC, CP15_DCIMVAC(%0))		/* Data cache invalidate by MVA PoC */ |
| 179 | 171 | _WF1(_CP15_DCISW, CP15_DCISW(%0))		/* Data cache invalidate by set/way */ |
| 180 | 172 | _WF0(_CP15_ICIALLU, CP15_ICIALLU)		/* Instruction cache invalidate all PoU */ |
| 181 | #if __ARM_ARCH >= 7 && defined(SMP) | |
| 173 | #if defined(SMP) | |
| 182 | 174 | _WF0(_CP15_ICIALLUIS, CP15_ICIALLUIS)		/* Instruction cache invalidate all PoU IS */ |
| 183 | 175 | #endif |
| 184 | 176 | _WF1(_CP15_ICIMVAU, CP15_ICIMVAU(%0))		/* Instruction cache invalidate */ |
| ... | ... | @@ -209,10 +201,8 @@ _WF1(cp15_prrr_set, CP15_PRRR(%0)) |
| 209 | 201 | _WF1(cp15_nmrr_set, CP15_NMRR(%0)) |
| 210 | 202 | _RF0(cp15_ttbr_get, CP15_TTBR0(%0)) |
| 211 | 203 | _RF0(cp15_dfar_get, CP15_DFAR(%0)) |
| 212 | #if __ARM_ARCH >= 7 | |
| 213 | 204 | _RF0(cp15_ifar_get, CP15_IFAR(%0)) |
| 214 | 205 | _RF0(cp15_l2ctlr_get, CP15_L2CTLR(%0)) |
| 215 | #endif | |
| 216 | 206 | _RF0(cp15_actlr_get, CP15_ACTLR(%0)) |
| 217 | 207 | _WF1(cp15_actlr_set, CP15_ACTLR(%0)) |
| 218 | 208 | _WF1(cp15_ats1cpr_set, CP15_ATS1CPR(%0)) |
| ... | ... | @@ -251,14 +241,6 @@ _RF0(cp15_cbar_get, CP15_CBAR(%0)) |
| 251 | 241 | |
| 252 | 242 | /* Performance Monitor registers */ |
| 253 | 243 | |
| 254 | #if __ARM_ARCH == 6 && defined(CPU_ARM1176) | |
| 255 | _RF0(cp15_pmuserenr_get, CP15_PMUSERENR(%0)) | |
| 256 | _WF1(cp15_pmuserenr_set, CP15_PMUSERENR(%0)) | |
| 257 | _RF0(cp15_pmcr_get, CP15_PMCR(%0)) | |
| 258 | _WF1(cp15_pmcr_set, CP15_PMCR(%0)) | |
| 259 | _RF0(cp15_pmccntr_get, CP15_PMCCNTR(%0)) | |
| 260 | _WF1(cp15_pmccntr_set, CP15_PMCCNTR(%0)) | |
| 261 | #elif __ARM_ARCH > 6 | |
| 262 | 244 | _RF0(cp15_pmcr_get, CP15_PMCR(%0)) |
| 263 | 245 | _WF1(cp15_pmcr_set, CP15_PMCR(%0)) |
| 264 | 246 | _RF0(cp15_pmcnten_get, CP15_PMCNTENSET(%0)) |
| ... | ... | @@ -280,7 +262,6 @@ _WF1(cp15_pmuserenr_set, CP15_PMUSERENR(%0)) |
| 280 | 262 | _RF0(cp15_pminten_get, CP15_PMINTENSET(%0)) |
| 281 | 263 | _WF1(cp15_pminten_set, CP15_PMINTENSET(%0)) |
| 282 | 264 | _WF1(cp15_pminten_clr, CP15_PMINTENCLR(%0)) |
| 283 | #endif | |
| 284 | 265 | |
| 285 | 266 | _RF0(cp15_tpidrurw_get, CP15_TPIDRURW(%0)) |
| 286 | 267 | _WF1(cp15_tpidrurw_set, CP15_TPIDRURW(%0)) |
| ... | ... | @@ -380,7 +361,7 @@ tlb_flush_range_local(vm_offset_t va, vm_size_t size) |
| 380 | 361 | } |
| 381 | 362 | |
| 382 | 363 | /* Broadcasting operations. */ |
| 383 | #if __ARM_ARCH >= 7 && defined(SMP) | |
| 364 | #if defined(SMP) | |
| 384 | 365 | |
| 385 | 366 | static __inline void |
| 386 | 367 | tlb_flush_all(void) |
| ... | ... | @@ -442,14 +423,14 @@ tlb_flush_range(vm_offset_t va, vm_size_t size) |
| 442 | 423 | 	); |
| 443 | 424 | 	dsb(); |
| 444 | 425 | } |
| 445 | #else /* __ARM_ARCH < 7 */ | |
| 426 | #else /* !SMP */ | |
| 446 | 427 | |
| 447 | 428 | #define tlb_flush_all() 		tlb_flush_all_local() |
| 448 | 429 | #define tlb_flush_all_ng() 		tlb_flush_all_ng_local() |
| 449 | 430 | #define tlb_flush(va) 			tlb_flush_local(va) |
| 450 | 431 | #define tlb_flush_range(va, size) 	tlb_flush_range_local(va, size) |
| 451 | 432 | |
| 452 | #endif /* __ARM_ARCH < 7 */ | |
| 433 | #endif /* !SMP */ | |
| 453 | 434 | |
| 454 | 435 | /* |
| 455 | 436 | * Cache maintenance operations. |
| ... | ... | @@ -465,11 +446,7 @@ icache_sync(vm_offset_t va, vm_size_t size) |
| 465 | 446 | 	va &= ~cpuinfo.dcache_line_mask; |
| 466 | 447 | |
| 467 | 448 | 	for ( ; va < eva; va += cpuinfo.dcache_line_size) { |
| 468 | #if __ARM_ARCH >= 7 | |
| 469 | 449 | 		_CP15_DCCMVAU(va); |
| 470 | #else | |
| 471 | 		_CP15_DCCMVAC(va); | |
| 472 | #endif | |
| 473 | 450 | 	} |
| 474 | 451 | 	dsb(); |
| 475 | 452 | 	ARM_SMP_UP( |
| ... | ... | @@ -515,11 +492,7 @@ dcache_wb_pou(vm_offset_t va, vm_size_t size) |
| 515 | 492 | 	dsb(); |
| 516 | 493 | 	va &= ~cpuinfo.dcache_line_mask; |
| 517 | 494 | 	for ( ; va < eva; va += cpuinfo.dcache_line_size) { |
| 518 | #if __ARM_ARCH >= 7 | |
| 519 | 495 | 		_CP15_DCCMVAU(va); |
| 520 | #else | |
| 521 | 		_CP15_DCCMVAC(va); | |
| 522 | #endif | |
| 523 | 496 | 	} |
| 524 | 497 | 	dsb(); |
| 525 | 498 | } |
| ... | ... | @@ -686,8 +659,7 @@ cp15_ats1cuw_check(vm_offset_t addr) |
| 686 | 659 | static __inline uint64_t |
| 687 | 660 | get_cyclecount(void) |
| 688 | 661 | { |
| 689 | #if __ARM_ARCH > 6 || (__ARM_ARCH == 6 && defined(CPU_ARM1176)) | |
| 690 | #if (__ARM_ARCH > 6) && defined(DEV_PMU) | |
| 662 | #if defined(DEV_PMU) | |
| 691 | 663 | 	if (pmu_attched) { |
| 692 | 664 | 		u_int cpu; |
| 693 | 665 | 		uint64_t h, h2; |
| ... | ... | @@ -711,12 +683,6 @@ get_cyclecount(void) |
| 711 | 683 | 	} else |
| 712 | 684 | #endif |
| 713 | 685 | 		return cp15_pmccntr_get(); |
| 714 | #else /* No performance counters, so use nanotime(9). */ | |
| 715 | 	struct timespec tv; | |
| 716 | ||
| 717 | 	nanotime(&tv); | |
| 718 | 	return (tv.tv_sec * (uint64_t)1000000000ull + tv.tv_nsec); | |
| 719 | #endif | |
| 720 | 686 | } |
| 721 | 687 | #endif |
| 722 | 688 | |
| ... | ... | @@ -729,7 +695,7 @@ get_cyclecount(void) |
| 729 | 695 | #define cpu_spinwait()		/* nothing */ |
| 730 | 696 | #define	cpu_lock_delay()	DELAY(1) |
| 731 | 697 | |
| 732 | #define ARM_NVEC		8 | |
| 698 | #define ARM_NVEC		7 | |
| 733 | 699 | #define ARM_VEC_ALL		0xffffffff |
| 734 | 700 | |
| 735 | 701 | extern vm_offset_t vector_page; |
lib/libc/include/aarch64-freebsd-none/arm/cpufunc.h-3| ... | ... | @@ -97,9 +97,6 @@ void	armv7_cpu_sleep			(int); |
| 97 | 97 | void	pj4b_config			(void); |
| 98 | 98 | #endif |
| 99 | 99 | |
| 100 | #if defined(CPU_ARM1176) | |
| 101 | void arm11x6_sleep (int); /* no ref. for errata */ | |
| 102 | #endif | |
| 103 | 100 | |
| 104 | 101 | |
| 105 | 102 | /* |
lib/libc/include/aarch64-freebsd-none/arm/fenv.h+1| ... | ... | @@ -29,6 +29,7 @@ |
| 29 | 29 | #ifndef	_FENV_H_ |
| 30 | 30 | #define	_FENV_H_ |
| 31 | 31 | |
| 32 | #include <sys/cdefs.h> | |
| 32 | 33 | #include <sys/_types.h> |
| 33 | 34 | |
| 34 | 35 | #ifndef	__fenv_static |
lib/libc/include/aarch64-freebsd-none/arm/float.h-2| ... | ... | @@ -27,8 +27,6 @@ |
| 27 | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | * | |
| 31 | *	from: @(#)float.h	7.1 (Berkeley) 5/8/90 | |
| 32 | 30 | */ |
| 33 | 31 | |
| 34 | 32 | #ifndef _MACHINE_FLOAT_H_ |
lib/libc/include/aarch64-freebsd-none/arm/ieeefp.h+10| ... | ... | @@ -49,4 +49,14 @@ typedef enum { |
| 49 | 49 | |
| 50 | 50 | #define fp_except_t	int |
| 51 | 51 | |
| 52 | /* Augment the userland declarations. */ | |
| 53 | __BEGIN_DECLS | |
| 54 | extern fp_rnd_t fpgetround(void); | |
| 55 | extern fp_rnd_t fpsetround(fp_rnd_t); | |
| 56 | extern fp_except_t fpgetmask(void); | |
| 57 | extern fp_except_t fpsetmask(fp_except_t); | |
| 58 | extern fp_except_t fpgetsticky(void); | |
| 59 | extern fp_except_t fpsetsticky(fp_except_t); | |
| 60 | __END_DECLS | |
| 61 | ||
| 52 | 62 | #endif /* _MACHINE_IEEEFP_H_ */ |
| \ No newline at end of file |
lib/libc/include/aarch64-freebsd-none/arm/param.h+2-15| ... | ... | @@ -35,8 +35,6 @@ |
| 35 | 35 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 36 | 36 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 37 | 37 | * SUCH DAMAGE. |
| 38 | * | |
| 39 | *	from: @(#)param.h	5.8 (Berkeley) 6/28/91 | |
| 40 | 38 | */ |
| 41 | 39 | |
| 42 | 40 | #ifndef _ARM_INCLUDE_PARAM_H_ |
| ... | ... | @@ -51,17 +49,11 @@ |
| 51 | 49 | #define STACKALIGNBYTES	(8 - 1) |
| 52 | 50 | #define STACKALIGN(p)	((u_int)(p) & ~STACKALIGNBYTES) |
| 53 | 51 | |
| 54 | #define __PCI_REROUTE_INTERRUPT | |
| 55 | ||
| 56 | 52 | #ifndef MACHINE |
| 57 | 53 | #define	MACHINE		"arm" |
| 58 | 54 | #endif |
| 59 | 55 | #ifndef MACHINE_ARCH |
| 60 | #if __ARM_ARCH >= 7 | |
| 61 | 56 | #define	MACHINE_ARCH	"armv7" |
| 62 | #else | |
| 63 | #define	MACHINE_ARCH	"armv6" | |
| 64 | #endif | |
| 65 | 57 | #endif |
| 66 | 58 | |
| 67 | 59 | #ifdef SMP |
| ... | ... | @@ -76,6 +68,8 @@ |
| 76 | 68 | #define	MAXMEMDOM	1 |
| 77 | 69 | #endif |
| 78 | 70 | |
| 71 | #define	__HAVE_STATIC_DEVMAP | |
| 72 | ||
| 79 | 73 | #define	ALIGNBYTES	_ALIGNBYTES |
| 80 | 74 | #define	ALIGN(p)	_ALIGN(p) |
| 81 | 75 | /* |
| ... | ... | @@ -129,17 +123,10 @@ |
| 129 | 123 | /* |
| 130 | 124 | * Mach derived conversion macros |
| 131 | 125 | */ |
| 132 | #define	trunc_page(x)		((x) & ~PAGE_MASK) | |
| 133 | #define	round_page(x)		(((x) + PAGE_MASK) & ~PAGE_MASK) | |
| 134 | 126 | #define	trunc_1mpage(x)		((unsigned)(x) & ~PDRMASK) |
| 135 | 127 | #define	round_1mpage(x)		((((unsigned)(x)) + PDRMASK) & ~PDRMASK) |
| 136 | 128 | |
| 137 | #define	atop(x)			((unsigned)(x) >> PAGE_SHIFT) | |
| 138 | #define	ptoa(x)			((unsigned)(x) << PAGE_SHIFT) | |
| 139 | ||
| 140 | 129 | #define	arm32_btop(x)		((unsigned)(x) >> PAGE_SHIFT) |
| 141 | 130 | #define	arm32_ptob(x)		((unsigned)(x) << PAGE_SHIFT) |
| 142 | 131 | |
| 143 | #define	pgtok(x)		((x) * (PAGE_SIZE / 1024)) | |
| 144 | ||
| 145 | 132 | #endif /* !_ARM_INCLUDE_PARAM_H_ */ |
| \ No newline at end of file |
lib/libc/include/aarch64-freebsd-none/arm/pmap.h+3-12| ... | ... | @@ -39,9 +39,6 @@ |
| 39 | 39 | * map the page tables using the pagetables themselves. This is done to |
| 40 | 40 | * reduce the impact on kernel virtual memory for lots of sparse address |
| 41 | 41 | * space, and to reduce the cost of memory to each process. |
| 42 | * | |
| 43 | * from: hp300: @(#)pmap.h 7.2 (Berkeley) 12/16/90 | |
| 44 | * from: @(#)pmap.h 7.4 (Berkeley) 5/12/91 | |
| 45 | 42 | * 	from: FreeBSD: src/sys/i386/include/pmap.h,v 1.70 2000/11/30 |
| 46 | 43 | */ |
| 47 | 44 | |
| ... | ... | @@ -138,9 +135,9 @@ extern ttb_entry_t pmap_kern_ttb; 	/* TTB for kernel pmap */ |
| 138 | 135 | * vtopte2(). |
| 139 | 136 | */ |
| 140 | 137 | void pmap_bootstrap(vm_offset_t); |
| 141 | void pmap_kenter(vm_offset_t, vm_paddr_t); | |
| 138 | void pmap_kenter(vm_offset_t, vm_size_t, vm_paddr_t, int); | |
| 142 | 139 | void pmap_kremove(vm_offset_t); |
| 143 | boolean_t pmap_page_is_mapped(vm_page_t); | |
| 140 | bool pmap_page_is_mapped(vm_page_t); | |
| 144 | 141 | bool	pmap_ps_enabled(pmap_t pmap); |
| 145 | 142 | |
| 146 | 143 | void pmap_tlb_flush(pmap_t, vm_offset_t); |
| ... | ... | @@ -175,15 +172,9 @@ void pmap_page_set_memattr(vm_page_t, vm_memattr_t); |
| 175 | 172 | #define	pmap_map_delete(pmap, sva, eva)	pmap_remove(pmap, sva, eva) |
| 176 | 173 | |
| 177 | 174 | void *pmap_mapdev(vm_paddr_t, vm_size_t); |
| 175 | void *pmap_mapdev_attr(vm_paddr_t, vm_size_t, vm_memattr_t); | |
| 178 | 176 | void pmap_unmapdev(void *, vm_size_t); |
| 179 | 177 | |
| 180 | static inline void * | |
| 181 | pmap_mapdev_attr(vm_paddr_t addr __unused, vm_size_t size __unused, | |
| 182 | int attr __unused) | |
| 183 | { | |
| 184 | 	panic("%s is not implemented yet!\n", __func__); | |
| 185 | } | |
| 186 | ||
| 187 | 178 | struct pcb; |
| 188 | 179 | void pmap_set_pcb_pagedir(pmap_t, struct pcb *); |
| 189 | 180 |
lib/libc/include/aarch64-freebsd-none/arm/proc.h-2| ... | ... | @@ -31,8 +31,6 @@ |
| 31 | 31 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 32 | 32 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 33 | 33 | * SUCH DAMAGE. |
| 34 | * | |
| 35 | * from: @(#)proc.h 7.1 (Berkeley) 5/15/91 | |
| 36 | 34 | *	from: FreeBSD: src/sys/i386/include/proc.h,v 1.11 2001/06/29 |
| 37 | 35 | */ |
| 38 | 36 |
lib/libc/include/aarch64-freebsd-none/arm/profile.h-2| ... | ... | @@ -31,8 +31,6 @@ |
| 31 | 31 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 32 | 32 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 33 | 33 | * SUCH DAMAGE. |
| 34 | * | |
| 35 | *	@(#)profile.h	8.1 (Berkeley) 6/11/93 | |
| 36 | 34 | */ |
| 37 | 35 | |
| 38 | 36 | #ifndef _MACHINE_PROFILE_H_ |
lib/libc/include/aarch64-freebsd-none/arm/reloc.h-2| ... | ... | @@ -31,8 +31,6 @@ |
| 31 | 31 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 32 | 32 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 33 | 33 | * SUCH DAMAGE. |
| 34 | * | |
| 35 | *	@(#)reloc.h	8.1 (Berkeley) 6/10/93 | |
| 36 | 34 | */ |
| 37 | 35 | |
| 38 | 36 | #ifndef _MACHINE_RELOC_H_ |
lib/libc/include/aarch64-freebsd-none/arm/resource.h-2| ... | ... | @@ -40,8 +40,6 @@ |
| 40 | 40 | #define	SYS_RES_MEMORY	3	/* i/o memory */ |
| 41 | 41 | #define	SYS_RES_IOPORT	4	/* i/o ports */ |
| 42 | 42 | #define	SYS_RES_GPIO	5	/* general purpose i/o */ |
| 43 | #ifdef NEW_PCIB | |
| 44 | 43 | #define PCI_RES_BUS	6	/* PCI bus numbers */ |
| 45 | #endif | |
| 46 | 44 | |
| 47 | 45 | #endif /* !_MACHINE_RESOURCE_H_ */ |
| \ No newline at end of file |
lib/libc/include/aarch64-freebsd-none/arm/runq.h deleted-46| ... | ... | @@ -1,46 +0,0 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-2-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 2001 Jake Burkholder <jake@FreeBSD.org> | |
| 5 | * All rights reserved. | |
| 6 | * | |
| 7 | * Redistribution and use in source and binary forms, with or without | |
| 8 | * modification, are permitted provided that the following conditions | |
| 9 | * are met: | |
| 10 | * 1. Redistributions of source code must retain the above copyright | |
| 11 | * notice, this list of conditions and the following disclaimer. | |
| 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 13 | * notice, this list of conditions and the following disclaimer in the | |
| 14 | * documentation and/or other materials provided with the distribution. | |
| 15 | * | |
| 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |
| 17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
| 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | |
| 20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
| 21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
| 22 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
| 23 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
| 24 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
| 25 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
| 26 | * SUCH DAMAGE. | |
| 27 | */ | |
| 28 | ||
| 29 | #ifndef	_MACHINE_RUNQ_H_ | |
| 30 | #define	_MACHINE_RUNQ_H_ | |
| 31 | ||
| 32 | #define	RQB_LEN		(2)		/* Number of priority status words. */ | |
| 33 | #define	RQB_L2BPW	(5)		/* Log2(sizeof(rqb_word_t) * NBBY)). */ | |
| 34 | #define	RQB_BPW		(1<<RQB_L2BPW)	/* Bits in an rqb_word_t. */ | |
| 35 | ||
| 36 | #define	RQB_BIT(pri)	(1 << ((pri) & (RQB_BPW - 1))) | |
| 37 | #define	RQB_WORD(pri)	((pri) >> RQB_L2BPW) | |
| 38 | ||
| 39 | #define	RQB_FFS(word)	(ffs(word) - 1) | |
| 40 | ||
| 41 | /* | |
| 42 | * Type of run queue status word. | |
| 43 | */ | |
| 44 | typedef	u_int32_t	rqb_word_t; | |
| 45 | ||
| 46 | #endif | |
| \ No newline at end of file |
lib/libc/include/aarch64-freebsd-none/arm/signal.h-2| ... | ... | @@ -27,8 +27,6 @@ |
| 27 | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | * | |
| 31 | * @(#)signal.h 8.1 (Berkeley) 6/11/93 | |
| 32 | 30 | *	from: FreeBSD: src/sys/i386/include/signal.h,v 1.13 2000/11/09 |
| 33 | 31 | *	from: FreeBSD: src/sys/sparc64/include/signal.h,v 1.6 2001/09/30 18:52:17 |
| 34 | 32 | */ |
lib/libc/include/aarch64-freebsd-none/arm/sysarch.h+2| ... | ... | @@ -38,6 +38,8 @@ |
| 38 | 38 | #ifndef _ARM_SYSARCH_H_ |
| 39 | 39 | #define _ARM_SYSARCH_H_ |
| 40 | 40 | |
| 41 | #include <sys/cdefs.h> | |
| 42 | ||
| 41 | 43 | #include <machine/armreg.h> |
| 42 | 44 | |
| 43 | 45 | #ifndef LOCORE |
lib/libc/include/aarch64-freebsd-none/arm/sysreg.h+2-36| ... | ... | @@ -127,11 +127,9 @@ |
| 127 | 127 | |
| 128 | 128 | /* From ARMv6: */ |
| 129 | 129 | #define	CP15_IFSR(rr)		p15, 0, rr, c5, c0, 1 /* Instruction Fault Status Register */ |
| 130 | #if __ARM_ARCH >= 7 | |
| 131 | 130 | /* From ARMv7: */ |
| 132 | 131 | #define	CP15_ADFSR(rr)		p15, 0, rr, c5, c1, 0 /* Auxiliary Data Fault Status Register */ |
| 133 | 132 | #define	CP15_AIFSR(rr)		p15, 0, rr, c5, c1, 1 /* Auxiliary Instruction Fault Status Register */ |
| 134 | #endif | |
| 135 | 133 | |
| 136 | 134 | /* |
| 137 | 135 | * CP15 C6 registers |
| ... | ... | @@ -147,7 +145,7 @@ |
| 147 | 145 | /* |
| 148 | 146 | * CP15 C7 registers |
| 149 | 147 | */ |
| 150 | #if __ARM_ARCH >= 7 && defined(SMP) | |
| 148 | #if defined(SMP) | |
| 151 | 149 | /* From ARMv7: */ |
| 152 | 150 | #define	CP15_ICIALLUIS		p15, 0, r0, c7, c1, 0 /* Instruction cache invalidate all PoU, IS */ |
| 153 | 151 | #define	CP15_BPIALLIS		p15, 0, r0, c7, c1, 6 /* Branch predictor invalidate all IS */ |
| ... | ... | @@ -157,17 +155,9 @@ |
| 157 | 155 | |
| 158 | 156 | #define	CP15_ICIALLU		p15, 0, r0, c7, c5, 0 /* Instruction cache invalidate all PoU */ |
| 159 | 157 | #define	CP15_ICIMVAU(rr)	p15, 0, rr, c7, c5, 1 /* Instruction cache invalidate */ |
| 160 | #if __ARM_ARCH == 6 | |
| 161 | /* Deprecated in ARMv7 */ | |
| 162 | #define	CP15_CP15ISB		p15, 0, r0, c7, c5, 4 /* ISB */ | |
| 163 | #endif | |
| 164 | 158 | #define	CP15_BPIALL		p15, 0, r0, c7, c5, 6 /* Branch predictor invalidate all */ |
| 165 | 159 | #define	CP15_BPIMVA		p15, 0, rr, c7, c5, 7 /* Branch predictor invalidate by MVA */ |
| 166 | 160 | |
| 167 | #if __ARM_ARCH == 6 | |
| 168 | /* Only ARMv6: */ | |
| 169 | #define	CP15_DCIALL		p15, 0, r0, c7, c6, 0 /* Data cache invalidate all */ | |
| 170 | #endif | |
| 171 | 161 | #define	CP15_DCIMVAC(rr)	p15, 0, rr, c7, c6, 1 /* Data cache invalidate by MVA PoC */ |
| 172 | 162 | #define	CP15_DCISW(rr)		p15, 0, rr, c7, c6, 2 /* Data cache invalidate by set/way */ |
| 173 | 163 | |
| ... | ... | @@ -176,43 +166,25 @@ |
| 176 | 166 | #define	CP15_ATS1CUR(rr)	p15, 0, rr, c7, c8, 2 /* Stage 1 Current state unprivileged read */ |
| 177 | 167 | #define	CP15_ATS1CUW(rr)	p15, 0, rr, c7, c8, 3 /* Stage 1 Current state unprivileged write */ |
| 178 | 168 | |
| 179 | #if __ARM_ARCH >= 7 | |
| 180 | 169 | /* From ARMv7: */ |
| 181 | 170 | #define	CP15_ATS12NSOPR(rr)	p15, 0, rr, c7, c8, 4 /* Stages 1 and 2 Non-secure only PL1 read */ |
| 182 | 171 | #define	CP15_ATS12NSOPW(rr)	p15, 0, rr, c7, c8, 5 /* Stages 1 and 2 Non-secure only PL1 write */ |
| 183 | 172 | #define	CP15_ATS12NSOUR(rr)	p15, 0, rr, c7, c8, 6 /* Stages 1 and 2 Non-secure only unprivileged read */ |
| 184 | 173 | #define	CP15_ATS12NSOUW(rr)	p15, 0, rr, c7, c8, 7 /* Stages 1 and 2 Non-secure only unprivileged write */ |
| 185 | #endif | |
| 186 | 174 | |
| 187 | #if __ARM_ARCH == 6 | |
| 188 | /* Only ARMv6: */ | |
| 189 | #define	CP15_DCCALL		p15, 0, r0, c7, c10, 0 /* Data cache clean all */ | |
| 190 | #endif | |
| 191 | 175 | #define	CP15_DCCMVAC(rr)	p15, 0, rr, c7, c10, 1 /* Data cache clean by MVA PoC */ |
| 192 | 176 | #define	CP15_DCCSW(rr)		p15, 0, rr, c7, c10, 2 /* Data cache clean by set/way */ |
| 193 | #if __ARM_ARCH == 6 | |
| 194 | /* Only ARMv6: */ | |
| 195 | #define	CP15_CP15DSB		p15, 0, r0, c7, c10, 4 /* DSB */ | |
| 196 | #define	CP15_CP15DMB		p15, 0, r0, c7, c10, 5 /* DMB */ | |
| 197 | #define	CP15_CP15WFI		p15, 0, r0, c7, c0, 4 /* WFI */ | |
| 198 | #endif | |
| 199 | 177 | |
| 200 | #if __ARM_ARCH >= 7 | |
| 201 | 178 | /* From ARMv7: */ |
| 202 | 179 | #define	CP15_DCCMVAU(rr)	p15, 0, rr, c7, c11, 1 /* Data cache clean by MVA PoU */ |
| 203 | #endif | |
| 204 | 180 | |
| 205 | #if __ARM_ARCH == 6 | |
| 206 | /* Only ARMv6: */ | |
| 207 | #define	CP15_DCCIALL		p15, 0, r0, c7, c14, 0 /* Data cache clean and invalidate all */ | |
| 208 | #endif | |
| 209 | 181 | #define	CP15_DCCIMVAC(rr)	p15, 0, rr, c7, c14, 1 /* Data cache clean and invalidate by MVA PoC */ |
| 210 | 182 | #define	CP15_DCCISW(rr)		p15, 0, rr, c7, c14, 2 /* Data cache clean and invalidate by set/way */ |
| 211 | 183 | |
| 212 | 184 | /* |
| 213 | 185 | * CP15 C8 registers |
| 214 | 186 | */ |
| 215 | #if __ARM_ARCH >= 7 && defined(SMP) | |
| 187 | #if defined(SMP) | |
| 216 | 188 | /* From ARMv7: */ |
| 217 | 189 | #define	CP15_TLBIALLIS		p15, 0, r0, c8, c3, 0 /* Invalidate entire unified TLB IS */ |
| 218 | 190 | #define	CP15_TLBIMVAIS(rr)	p15, 0, rr, c8, c3, 1 /* Invalidate unified TLB by MVA IS */ |
| ... | ... | @@ -232,11 +204,6 @@ |
| 232 | 204 | /* |
| 233 | 205 | * CP15 C9 registers |
| 234 | 206 | */ |
| 235 | #if __ARM_ARCH == 6 && defined(CPU_ARM1176) | |
| 236 | #define	CP15_PMUSERENR(rr)	p15, 0, rr, c15, c9, 0 /* Access Validation Control Register */ | |
| 237 | #define	CP15_PMCR(rr)		p15, 0, rr, c15, c12, 0 /* Performance Monitor Control Register */ | |
| 238 | #define	CP15_PMCCNTR(rr)	p15, 0, rr, c15, c12, 1 /* PM Cycle Count Register */ | |
| 239 | #else | |
| 240 | 207 | #define	CP15_L2CTLR(rr)		p15, 1, rr, c9, c0, 2 /* L2 Control Register */ |
| 241 | 208 | #define	CP15_PMCR(rr)		p15, 0, rr, c9, c12, 0 /* Performance Monitor Control Register */ |
| 242 | 209 | #define	CP15_PMCNTENSET(rr)	p15, 0, rr, c9, c12, 1 /* PM Count Enable Set Register */ |
| ... | ... | @@ -250,7 +217,6 @@ |
| 250 | 217 | #define	CP15_PMUSERENR(rr)	p15, 0, rr, c9, c14, 0 /* PM User Enable Register */ |
| 251 | 218 | #define	CP15_PMINTENSET(rr)	p15, 0, rr, c9, c14, 1 /* PM Interrupt Enable Set Register */ |
| 252 | 219 | #define	CP15_PMINTENCLR(rr)	p15, 0, rr, c9, c14, 2 /* PM Interrupt Enable Clear Register */ |
| 253 | #endif | |
| 254 | 220 | |
| 255 | 221 | /* |
| 256 | 222 | * CP15 C10 registers |
lib/libc/include/aarch64-freebsd-none/arm/vmparam.h+1| ... | ... | @@ -200,5 +200,6 @@ extern vm_offset_t vm_max_kernel_address; |
| 200 | 200 | * Need a page dump array for minidump. |
| 201 | 201 | */ |
| 202 | 202 | #define MINIDUMP_PAGE_TRACKING	1 |
| 203 | #define MINIDUMP_STARTUP_PAGE_TRACKING 0 | |
| 203 | 204 | |
| 204 | 205 | #endif	/* _MACHINE_VMPARAM_H_ */ |
| \ No newline at end of file |
lib/libc/include/aarch64-freebsd-none/fenv.h+1| ... | ... | @@ -31,6 +31,7 @@ |
| 31 | 31 | #ifndef	_FENV_H_ |
| 32 | 32 | #define	_FENV_H_ |
| 33 | 33 | |
| 34 | #include <sys/cdefs.h> | |
| 34 | 35 | #include <sys/_types.h> |
| 35 | 36 | |
| 36 | 37 | #ifndef	__fenv_static |
lib/libc/include/aarch64-freebsd-none/float.h-2| ... | ... | @@ -25,8 +25,6 @@ |
| 25 | 25 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 26 | 26 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 27 | 27 | * SUCH DAMAGE. |
| 28 | * | |
| 29 | *	from: @(#)float.h	7.1 (Berkeley) 5/8/90 | |
| 30 | 28 | */ |
| 31 | 29 | |
| 32 | 30 | #ifdef __arm__ |
lib/libc/include/aarch64-freebsd-none/machine/_align.h-2| ... | ... | @@ -25,8 +25,6 @@ |
| 25 | 25 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 26 | 26 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 27 | 27 | * SUCH DAMAGE. |
| 28 | * | |
| 29 | *	from: @(#)param.h	5.8 (Berkeley) 6/28/91 | |
| 30 | 28 | */ |
| 31 | 29 | |
| 32 | 30 | #ifdef __arm__ |
lib/libc/include/aarch64-freebsd-none/machine/_bus.h deleted-43| ... | ... | @@ -1,43 +0,0 @@ |
| 1 | /*- | |
| 2 | * Copyright (c) 2005 M. Warner Losh <imp@FreeBSD.org> | |
| 3 | * | |
| 4 | * Redistribution and use in source and binary forms, with or without | |
| 5 | * modification, are permitted provided that the following conditions | |
| 6 | * are met: | |
| 7 | * 1. Redistributions of source code must retain the above copyright | |
| 8 | * notice, this list of conditions, and the following disclaimer, | |
| 9 | * without modification, immediately at the beginning of the file. | |
| 10 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 11 | * notice, this list of conditions and the following disclaimer in | |
| 12 | * the documentation and/or other materials provided with the | |
| 13 | * distribution. | |
| 14 | * | |
| 15 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |
| 16 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 17 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
| 18 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR | |
| 19 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
| 20 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
| 21 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
| 22 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
| 23 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
| 24 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
| 25 | * SUCH DAMAGE. | |
| 26 | */ | |
| 27 | ||
| 28 | #ifndef _MACHINE__BUS_H_ | |
| 29 | #define	_MACHINE__BUS_H_ | |
| 30 | ||
| 31 | /* | |
| 32 | * Addresses (in bus space). | |
| 33 | */ | |
| 34 | typedef u_long bus_addr_t; | |
| 35 | typedef u_long bus_size_t; | |
| 36 | ||
| 37 | /* | |
| 38 | * Access methods for bus space. | |
| 39 | */ | |
| 40 | typedef u_long bus_space_handle_t; | |
| 41 | typedef struct bus_space *bus_space_tag_t; | |
| 42 | ||
| 43 | #endif /* !_MACHINE__BUS_H_ */ | |
| \ No newline at end of file |
lib/libc/include/aarch64-freebsd-none/machine/_limits.h-2| ... | ... | @@ -22,8 +22,6 @@ |
| 22 | 22 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 23 | 23 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 24 | 24 | * SUCH DAMAGE. |
| 25 | * | |
| 26 | *	@(#)limits.h	8.3 (Berkeley) 1/4/94 | |
| 27 | 25 | */ |
| 28 | 26 | |
| 29 | 27 | #ifdef __arm__ |
lib/libc/include/aarch64-freebsd-none/machine/_types.h-3| ... | ... | @@ -26,9 +26,6 @@ |
| 26 | 26 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 27 | 27 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 28 | 28 | * SUCH DAMAGE. |
| 29 | * | |
| 30 | *	From: @(#)ansi.h	8.2 (Berkeley) 1/4/94 | |
| 31 | *	From: @(#)types.h	8.3 (Berkeley) 1/5/94 | |
| 32 | 29 | */ |
| 33 | 30 | |
| 34 | 31 | #ifdef __arm__ |
lib/libc/include/aarch64-freebsd-none/machine/armreg.h+477-166| ... | ... | @@ -36,29 +36,6 @@ |
| 36 | 36 | |
| 37 | 37 | #define	INSN_SIZE		4 |
| 38 | 38 | |
| 39 | #define	MRS_MASK			0xfff00000 | |
| 40 | #define	MRS_VALUE			0xd5300000 | |
| 41 | #define	MRS_SPECIAL(insn)		((insn) & 0x000fffe0) | |
| 42 | #define	MRS_REGISTER(insn)		((insn) & 0x0000001f) | |
| 43 | #define	 MRS_Op0_SHIFT			19 | |
| 44 | #define	 MRS_Op0_MASK			0x00080000 | |
| 45 | #define	 MRS_Op1_SHIFT			16 | |
| 46 | #define	 MRS_Op1_MASK			0x00070000 | |
| 47 | #define	 MRS_CRn_SHIFT			12 | |
| 48 | #define	 MRS_CRn_MASK			0x0000f000 | |
| 49 | #define	 MRS_CRm_SHIFT			8 | |
| 50 | #define	 MRS_CRm_MASK			0x00000f00 | |
| 51 | #define	 MRS_Op2_SHIFT			5 | |
| 52 | #define	 MRS_Op2_MASK			0x000000e0 | |
| 53 | #define	 MRS_Rt_SHIFT			0 | |
| 54 | #define	 MRS_Rt_MASK			0x0000001f | |
| 55 | #define	__MRS_REG(op0, op1, crn, crm, op2)				\ | |
| 56 | (((op0) << MRS_Op0_SHIFT) | ((op1) << MRS_Op1_SHIFT) |		\ | |
| 57 | ((crn) << MRS_CRn_SHIFT) | ((crm) << MRS_CRm_SHIFT) |		\ | |
| 58 | ((op2) << MRS_Op2_SHIFT)) | |
| 59 | #define	MRS_REG(reg)							\ | |
| 60 | __MRS_REG(reg##_op0, reg##_op1, reg##_CRn, reg##_CRm, reg##_op2) | |
| 61 | ||
| 62 | 39 | #define	__MRS_REG_ALT_NAME(op0, op1, crn, crm, op2)			\ |
| 63 | 40 | S##op0##_##op1##_C##crn##_C##crm##_##op2 |
| 64 | 41 | #define	_MRS_REG_ALT_NAME(op0, op1, crn, crm, op2)			\ |
| ... | ... | @@ -231,8 +208,21 @@ |
| 231 | 208 | #define	CLIDR_CTYPE_ID		0x3	/* Split instruction and data */ |
| 232 | 209 | #define	CLIDR_CTYPE_UNIFIED	0x4	/* Unified */ |
| 233 | 210 | |
| 211 | /* CNTKCTL_EL1 - Counter-timer Kernel Control Register */ | |
| 212 | #define	CNTKCTL_EL1_op0		3 | |
| 213 | #define	CNTKCTL_EL1_op1		0 | |
| 214 | #define	CNTKCTL_EL1_CRn		14 | |
| 215 | #define	CNTKCTL_EL1_CRm		1 | |
| 216 | #define	CNTKCTL_EL1_op2		0 | |
| 217 | ||
| 218 | /* CNTKCTL_EL12 - Counter-timer Kernel Control Register */ | |
| 219 | #define	CNTKCTL_EL12_op0	3 | |
| 220 | #define	CNTKCTL_EL12_op1	5 | |
| 221 | #define	CNTKCTL_EL12_CRn	14 | |
| 222 | #define	CNTKCTL_EL12_CRm	1 | |
| 223 | #define	CNTKCTL_EL12_op2	0 | |
| 224 | ||
| 234 | 225 | /* CNTP_CTL_EL0 - Counter-timer Physical Timer Control register */ |
| 235 | #define	CNTP_CTL_EL0		MRS_REG(CNTP_CTL_EL0) | |
| 236 | 226 | #define	CNTP_CTL_EL0_op0	3 |
| 237 | 227 | #define	CNTP_CTL_EL0_op1	3 |
| 238 | 228 | #define	CNTP_CTL_EL0_CRn	14 |
| ... | ... | @@ -243,7 +233,6 @@ |
| 243 | 233 | #define	CNTP_CTL_ISTATUS	(1 << 2) |
| 244 | 234 | |
| 245 | 235 | /* CNTP_CVAL_EL0 - Counter-timer Physical Timer CompareValue register */ |
| 246 | #define	CNTP_CVAL_EL0		MRS_REG(CNTP_CVAL_EL0) | |
| 247 | 236 | #define	CNTP_CVAL_EL0_op0	3 |
| 248 | 237 | #define	CNTP_CVAL_EL0_op1	3 |
| 249 | 238 | #define	CNTP_CVAL_EL0_CRn	14 |
| ... | ... | @@ -251,7 +240,6 @@ |
| 251 | 240 | #define	CNTP_CVAL_EL0_op2	2 |
| 252 | 241 | |
| 253 | 242 | /* CNTP_TVAL_EL0 - Counter-timer Physical Timer TimerValue register */ |
| 254 | #define	CNTP_TVAL_EL0		MRS_REG(CNTP_TVAL_EL0) | |
| 255 | 243 | #define	CNTP_TVAL_EL0_op0	3 |
| 256 | 244 | #define	CNTP_TVAL_EL0_op1	3 |
| 257 | 245 | #define	CNTP_TVAL_EL0_CRn	14 |
| ... | ... | @@ -259,15 +247,42 @@ |
| 259 | 247 | #define	CNTP_TVAL_EL0_op2	0 |
| 260 | 248 | |
| 261 | 249 | /* CNTPCT_EL0 - Counter-timer Physical Count register */ |
| 262 | #define	CNTPCT_EL0		MRS_REG(CNTPCT_EL0) | |
| 250 | #define	CNTPCT_EL0_ISS		ISS_MSR_REG(CNTPCT_EL0) | |
| 263 | 251 | #define	CNTPCT_EL0_op0		3 |
| 264 | 252 | #define	CNTPCT_EL0_op1		3 |
| 265 | 253 | #define	CNTPCT_EL0_CRn		14 |
| 266 | 254 | #define	CNTPCT_EL0_CRm		0 |
| 267 | 255 | #define	CNTPCT_EL0_op2		1 |
| 268 | 256 | |
| 257 | /* CNTV_CTL_EL0 - Counter-timer Virtual Timer Control register */ | |
| 258 | #define	CNTV_CTL_EL0_op0	3 | |
| 259 | #define	CNTV_CTL_EL0_op1	3 | |
| 260 | #define	CNTV_CTL_EL0_CRn	14 | |
| 261 | #define	CNTV_CTL_EL0_CRm	3 | |
| 262 | #define	CNTV_CTL_EL0_op2	1 | |
| 263 | ||
| 264 | /* CNTV_CTL_EL02 - Counter-timer Virtual Timer Control register */ | |
| 265 | #define	CNTV_CTL_EL02_op0	3 | |
| 266 | #define	CNTV_CTL_EL02_op1	5 | |
| 267 | #define	CNTV_CTL_EL02_CRn	14 | |
| 268 | #define	CNTV_CTL_EL02_CRm	3 | |
| 269 | #define	CNTV_CTL_EL02_op2	1 | |
| 270 | ||
| 271 | /* CNTV_CVAL_EL0 - Counter-timer Virtual Timer CompareValue register */ | |
| 272 | #define	CNTV_CVAL_EL0_op0	3 | |
| 273 | #define	CNTV_CVAL_EL0_op1	3 | |
| 274 | #define	CNTV_CVAL_EL0_CRn	14 | |
| 275 | #define	CNTV_CVAL_EL0_CRm	3 | |
| 276 | #define	CNTV_CVAL_EL0_op2	2 | |
| 277 | ||
| 278 | /* CNTV_CVAL_EL02 - Counter-timer Virtual Timer CompareValue register */ | |
| 279 | #define	CNTV_CVAL_EL02_op0	3 | |
| 280 | #define	CNTV_CVAL_EL02_op1	5 | |
| 281 | #define	CNTV_CVAL_EL02_CRn	14 | |
| 282 | #define	CNTV_CVAL_EL02_CRm	3 | |
| 283 | #define	CNTV_CVAL_EL02_op2	2 | |
| 284 | ||
| 269 | 285 | /* CONTEXTIDR_EL1 - Context ID register */ |
| 270 | #define	CONTEXTIDR_EL1		MRS_REG(CONTEXTIDR_EL1) | |
| 271 | 286 | #define	CONTEXTIDR_EL1_REG	MRS_REG_ALT_NAME(CONTEXTIDR_EL1) |
| 272 | 287 | #define	CONTEXTIDR_EL1_op0	3 |
| 273 | 288 | #define	CONTEXTIDR_EL1_op1	0 |
| ... | ... | @@ -315,36 +330,52 @@ |
| 315 | 330 | #define	CSSELR_InD		0x00000001 |
| 316 | 331 | |
| 317 | 332 | /* CTR_EL0 - Cache Type Register */ |
| 333 | #define	CTR_EL0_REG		MRS_REG_ALT_NAME(CTR_EL0) | |
| 334 | #define	CTR_EL0_ISS		ISS_MSR_REG(CTR_EL0) | |
| 335 | #define	CTR_EL0_op0		3 | |
| 336 | #define	CTR_EL0_op1		3 | |
| 337 | #define	CTR_EL0_CRn		0 | |
| 338 | #define	CTR_EL0_CRm		0 | |
| 339 | #define	CTR_EL0_op2		1 | |
| 318 | 340 | #define	CTR_RES1		(1 << 31) |
| 319 | 341 | #define	CTR_TminLine_SHIFT	32 |
| 320 | 342 | #define	CTR_TminLine_MASK	(UL(0x3f) << CTR_TminLine_SHIFT) |
| 321 | 343 | #define	CTR_TminLine_VAL(reg)	((reg) & CTR_TminLine_MASK) |
| 322 | 344 | #define	CTR_DIC_SHIFT		29 |
| 345 | #define	CTR_DIC_WIDTH		1 | |
| 323 | 346 | #define	CTR_DIC_MASK		(0x1 << CTR_DIC_SHIFT) |
| 324 | 347 | #define	CTR_DIC_VAL(reg)	((reg) & CTR_DIC_MASK) |
| 348 | #define	 CTR_DIC_NONE		(0x0 << CTR_DIC_SHIFT) | |
| 349 | #define	 CTR_DIC_IMPL		(0x1 << CTR_DIC_SHIFT) | |
| 325 | 350 | #define	CTR_IDC_SHIFT		28 |
| 351 | #define	CTR_IDC_WIDTH		1 | |
| 326 | 352 | #define	CTR_IDC_MASK		(0x1 << CTR_IDC_SHIFT) |
| 327 | 353 | #define	CTR_IDC_VAL(reg)	((reg) & CTR_IDC_MASK) |
| 354 | #define	 CTR_IDC_NONE		(0x0 << CTR_IDC_SHIFT) | |
| 355 | #define	 CTR_IDC_IMPL		(0x1 << CTR_IDC_SHIFT) | |
| 328 | 356 | #define	CTR_CWG_SHIFT		24 |
| 357 | #define	CTR_CWG_WIDTH		4 | |
| 329 | 358 | #define	CTR_CWG_MASK		(0xf << CTR_CWG_SHIFT) |
| 330 | 359 | #define	CTR_CWG_VAL(reg)	((reg) & CTR_CWG_MASK) |
| 331 | 360 | #define	CTR_CWG_SIZE(reg)	(4 << (CTR_CWG_VAL(reg) >> CTR_CWG_SHIFT)) |
| 332 | 361 | #define	CTR_ERG_SHIFT		20 |
| 362 | #define	CTR_ERG_WIDTH		4 | |
| 333 | 363 | #define	CTR_ERG_MASK		(0xf << CTR_ERG_SHIFT) |
| 334 | 364 | #define	CTR_ERG_VAL(reg)	((reg) & CTR_ERG_MASK) |
| 335 | 365 | #define	CTR_ERG_SIZE(reg)	(4 << (CTR_ERG_VAL(reg) >> CTR_ERG_SHIFT)) |
| 336 | 366 | #define	CTR_DLINE_SHIFT		16 |
| 367 | #define	CTR_DLINE_WIDTH		4 | |
| 337 | 368 | #define	CTR_DLINE_MASK		(0xf << CTR_DLINE_SHIFT) |
| 338 | 369 | #define	CTR_DLINE_VAL(reg)	((reg) & CTR_DLINE_MASK) |
| 339 | 370 | #define	CTR_DLINE_SIZE(reg)	(4 << (CTR_DLINE_VAL(reg) >> CTR_DLINE_SHIFT)) |
| 340 | 371 | #define	CTR_L1IP_SHIFT		14 |
| 372 | #define	CTR_L1IP_WIDTH		2 | |
| 341 | 373 | #define	CTR_L1IP_MASK		(0x3 << CTR_L1IP_SHIFT) |
| 342 | 374 | #define	CTR_L1IP_VAL(reg)	((reg) & CTR_L1IP_MASK) |
| 343 | #define	 CTR_L1IP_VPIPT		(0 << CTR_L1IP_SHIFT) | |
| 344 | #define	 CTR_L1IP_AIVIVT	(1 << CTR_L1IP_SHIFT) | |
| 345 | 375 | #define	 CTR_L1IP_VIPT		(2 << CTR_L1IP_SHIFT) |
| 346 | 376 | #define	 CTR_L1IP_PIPT		(3 << CTR_L1IP_SHIFT) |
| 347 | 377 | #define	CTR_ILINE_SHIFT		0 |
| 378 | #define	CTR_ILINE_WIDTH		4 | |
| 348 | 379 | #define	CTR_ILINE_MASK		(0xf << CTR_ILINE_SHIFT) |
| 349 | 380 | #define	CTR_ILINE_VAL(reg)	((reg) & CTR_ILINE_MASK) |
| 350 | 381 | #define	CTR_ILINE_SIZE(reg)	(4 << (CTR_ILINE_VAL(reg) >> CTR_ILINE_SHIFT)) |
| ... | ... | @@ -363,7 +394,7 @@ |
| 363 | 394 | #define	DAIF_I			(1 << 1) |
| 364 | 395 | #define	DAIF_F			(1 << 0) |
| 365 | 396 | #define	DAIF_ALL		(DAIF_D | DAIF_A | DAIF_I | DAIF_F) |
| 366 | #define	DAIF_INTR		(DAIF_I)	/* All exceptions that pass */ | |
| 397 | #define	DAIF_INTR		(DAIF_I | DAIF_F)	/* All exceptions that pass */ | |
| 367 | 398 | 						/* through the intr framework */ |
| 368 | 399 | |
| 369 | 400 | /* DBGBCR<n>_EL1 - Debug Breakpoint Control Registers */ |
| ... | ... | @@ -435,7 +466,6 @@ |
| 435 | 466 | #define	DCZID_BS_SIZE(reg)	(((reg) & DCZID_BS_MASK) >> DCZID_BS_SHIFT) |
| 436 | 467 | |
| 437 | 468 | /* DBGAUTHSTATUS_EL1 */ |
| 438 | #define	DBGAUTHSTATUS_EL1		MRS_REG(DBGAUTHSTATUS_EL1) | |
| 439 | 469 | #define	DBGAUTHSTATUS_EL1_op0		2 |
| 440 | 470 | #define	DBGAUTHSTATUS_EL1_op1		0 |
| 441 | 471 | #define	DBGAUTHSTATUS_EL1_CRn		7 |
| ... | ... | @@ -443,7 +473,6 @@ |
| 443 | 473 | #define	DBGAUTHSTATUS_EL1_op2		6 |
| 444 | 474 | |
| 445 | 475 | /* DBGCLAIMCLR_EL1 */ |
| 446 | #define	DBGCLAIMCLR_EL1			MRS_REG(DBGCLAIMCLR_EL1) | |
| 447 | 476 | #define	DBGCLAIMCLR_EL1_op0		2 |
| 448 | 477 | #define	DBGCLAIMCLR_EL1_op1		0 |
| 449 | 478 | #define	DBGCLAIMCLR_EL1_CRn		7 |
| ... | ... | @@ -451,7 +480,6 @@ |
| 451 | 480 | #define	DBGCLAIMCLR_EL1_op2		6 |
| 452 | 481 | |
| 453 | 482 | /* DBGCLAIMSET_EL1 */ |
| 454 | #define	DBGCLAIMSET_EL1			MRS_REG(DBGCLAIMSET_EL1) | |
| 455 | 483 | #define	DBGCLAIMSET_EL1_op0		2 |
| 456 | 484 | #define	DBGCLAIMSET_EL1_op1		0 |
| 457 | 485 | #define	DBGCLAIMSET_EL1_CRn		7 |
| ... | ... | @@ -459,7 +487,6 @@ |
| 459 | 487 | #define	DBGCLAIMSET_EL1_op2		6 |
| 460 | 488 | |
| 461 | 489 | /* DBGPRCR_EL1 */ |
| 462 | #define	DBGPRCR_EL1			MRS_REG(DBGPRCR_EL1) | |
| 463 | 490 | #define	DBGPRCR_EL1_op0			2 |
| 464 | 491 | #define	DBGPRCR_EL1_op1			0 |
| 465 | 492 | #define	DBGPRCR_EL1_CRn			1 |
| ... | ... | @@ -540,12 +567,14 @@ |
| 540 | 567 | #define	 ISS_MSR_REG_MASK	\ |
| 541 | 568 | (ISS_MSR_OP0_MASK | ISS_MSR_OP2_MASK | ISS_MSR_OP1_MASK | 	\ |
| 542 | 569 | ISS_MSR_CRn_MASK | ISS_MSR_CRm_MASK) |
| 570 | #define	 __ISS_MSR_REG(op0, op1, crn, crm, op2)		\ | |
| 571 | (((op0) << ISS_MSR_OP0_SHIFT) |			\ | |
| 572 | ((op1) << ISS_MSR_OP1_SHIFT) |			\ | |
| 573 | ((crn) << ISS_MSR_CRn_SHIFT) |			\ | |
| 574 | ((crm) << ISS_MSR_CRm_SHIFT) |			\ | |
| 575 | ((op2) << ISS_MSR_OP2_SHIFT)) | |
| 543 | 576 | #define	 ISS_MSR_REG(reg)				\ |
| 544 | (((reg ## _op0) << ISS_MSR_OP0_SHIFT) |		\ | |
| 545 | ((reg ## _op1) << ISS_MSR_OP1_SHIFT) |		\ | |
| 546 | ((reg ## _CRn) << ISS_MSR_CRn_SHIFT) |		\ | |
| 547 | ((reg ## _CRm) << ISS_MSR_CRm_SHIFT) |		\ | |
| 548 | ((reg ## _op2) << ISS_MSR_OP2_SHIFT)) | |
| 577 | __ISS_MSR_REG(reg##_op0, reg##_op1, reg##_CRn, reg##_CRm, reg##_op2) | |
| 549 | 578 | |
| 550 | 579 | #define	 ISS_DATA_ISV_SHIFT	24 |
| 551 | 580 | #define	 ISS_DATA_ISV		(0x01 << ISS_DATA_ISV_SHIFT) |
| ... | ... | @@ -667,7 +696,6 @@ |
| 667 | 696 | #define	ICC_PMR_EL1_PRIO_MASK	(0xFFUL) |
| 668 | 697 | |
| 669 | 698 | /* ICC_SGI1R_EL1 */ |
| 670 | #define	ICC_SGI1R_EL1			MRS_REG(ICC_SGI1R_EL1) | |
| 671 | 699 | #define	ICC_SGI1R_EL1_op0		3 |
| 672 | 700 | #define	ICC_SGI1R_EL1_op1		0 |
| 673 | 701 | #define	ICC_SGI1R_EL1_CRn		12 |
| ... | ... | @@ -697,8 +725,8 @@ |
| 697 | 725 | #define	ICC_SRE_EL1_SRE		(1U << 0) |
| 698 | 726 | |
| 699 | 727 | /* ID_AA64AFR0_EL1 */ |
| 700 | #define	ID_AA64AFR0_EL1			MRS_REG(ID_AA64AFR0_EL1) | |
| 701 | 728 | #define	ID_AA64AFR0_EL1_REG		MRS_REG_ALT_NAME(ID_AA64AFR0_EL1) |
| 729 | #define	ID_AA64AFR0_EL1_ISS		ISS_MSR_REG(ID_AA64AFR0_EL1) | |
| 702 | 730 | #define	ID_AA64AFR0_EL1_op0		3 |
| 703 | 731 | #define	ID_AA64AFR0_EL1_op1		0 |
| 704 | 732 | #define	ID_AA64AFR0_EL1_CRn		0 |
| ... | ... | @@ -706,8 +734,8 @@ |
| 706 | 734 | #define	ID_AA64AFR0_EL1_op2		4 |
| 707 | 735 | |
| 708 | 736 | /* ID_AA64AFR1_EL1 */ |
| 709 | #define	ID_AA64AFR1_EL1			MRS_REG(ID_AA64AFR1_EL1) | |
| 710 | 737 | #define	ID_AA64AFR1_EL1_REG		MRS_REG_ALT_NAME(ID_AA64AFR1_EL1) |
| 738 | #define	ID_AA64AFR1_EL1_ISS		ISS_MSR_REG(ID_AA64AFR1_EL1) | |
| 711 | 739 | #define	ID_AA64AFR1_EL1_op0		3 |
| 712 | 740 | #define	ID_AA64AFR1_EL1_op1		0 |
| 713 | 741 | #define	ID_AA64AFR1_EL1_CRn		0 |
| ... | ... | @@ -715,14 +743,15 @@ |
| 715 | 743 | #define	ID_AA64AFR1_EL1_op2		5 |
| 716 | 744 | |
| 717 | 745 | /* ID_AA64DFR0_EL1 */ |
| 718 | #define	ID_AA64DFR0_EL1			MRS_REG(ID_AA64DFR0_EL1) | |
| 719 | 746 | #define	ID_AA64DFR0_EL1_REG		MRS_REG_ALT_NAME(ID_AA64DFR0_EL1) |
| 747 | #define	ID_AA64DFR0_EL1_ISS		ISS_MSR_REG(ID_AA64DFR0_EL1) | |
| 720 | 748 | #define	ID_AA64DFR0_EL1_op0		3 |
| 721 | 749 | #define	ID_AA64DFR0_EL1_op1		0 |
| 722 | 750 | #define	ID_AA64DFR0_EL1_CRn		0 |
| 723 | 751 | #define	ID_AA64DFR0_EL1_CRm		5 |
| 724 | 752 | #define	ID_AA64DFR0_EL1_op2		0 |
| 725 | 753 | #define	ID_AA64DFR0_DebugVer_SHIFT	0 |
| 754 | #define	ID_AA64DFR0_DebugVer_WIDTH	4 | |
| 726 | 755 | #define	ID_AA64DFR0_DebugVer_MASK	(UL(0xf) << ID_AA64DFR0_DebugVer_SHIFT) |
| 727 | 756 | #define	ID_AA64DFR0_DebugVer_VAL(x)	((x) & ID_AA64DFR0_DebugVer_MASK) |
| 728 | 757 | #define	 ID_AA64DFR0_DebugVer_8		(UL(0x6) << ID_AA64DFR0_DebugVer_SHIFT) |
| ... | ... | @@ -730,12 +759,15 @@ |
| 730 | 759 | #define	 ID_AA64DFR0_DebugVer_8_2	(UL(0x8) << ID_AA64DFR0_DebugVer_SHIFT) |
| 731 | 760 | #define	 ID_AA64DFR0_DebugVer_8_4	(UL(0x9) << ID_AA64DFR0_DebugVer_SHIFT) |
| 732 | 761 | #define	 ID_AA64DFR0_DebugVer_8_8	(UL(0xa) << ID_AA64DFR0_DebugVer_SHIFT) |
| 762 | #define	 ID_AA64DFR0_DebugVer_8_9	(UL(0xb) << ID_AA64DFR0_DebugVer_SHIFT) | |
| 733 | 763 | #define	ID_AA64DFR0_TraceVer_SHIFT	4 |
| 764 | #define	ID_AA64DFR0_TraceVer_WIDTH	4 | |
| 734 | 765 | #define	ID_AA64DFR0_TraceVer_MASK	(UL(0xf) << ID_AA64DFR0_TraceVer_SHIFT) |
| 735 | 766 | #define	ID_AA64DFR0_TraceVer_VAL(x)	((x) & ID_AA64DFR0_TraceVer_MASK) |
| 736 | 767 | #define	 ID_AA64DFR0_TraceVer_NONE	(UL(0x0) << ID_AA64DFR0_TraceVer_SHIFT) |
| 737 | 768 | #define	 ID_AA64DFR0_TraceVer_IMPL	(UL(0x1) << ID_AA64DFR0_TraceVer_SHIFT) |
| 738 | 769 | #define	ID_AA64DFR0_PMUVer_SHIFT	8 |
| 770 | #define	ID_AA64DFR0_PMUVer_WIDTH	4 | |
| 739 | 771 | #define	ID_AA64DFR0_PMUVer_MASK		(UL(0xf) << ID_AA64DFR0_PMUVer_SHIFT) |
| 740 | 772 | #define	ID_AA64DFR0_PMUVer_VAL(x)	((x) & ID_AA64DFR0_PMUVer_MASK) |
| 741 | 773 | #define	 ID_AA64DFR0_PMUVer_NONE	(UL(0x0) << ID_AA64DFR0_PMUVer_SHIFT) |
| ... | ... | @@ -745,25 +777,31 @@ |
| 745 | 777 | #define	 ID_AA64DFR0_PMUVer_3_5		(UL(0x6) << ID_AA64DFR0_PMUVer_SHIFT) |
| 746 | 778 | #define	 ID_AA64DFR0_PMUVer_3_7		(UL(0x7) << ID_AA64DFR0_PMUVer_SHIFT) |
| 747 | 779 | #define	 ID_AA64DFR0_PMUVer_3_8		(UL(0x8) << ID_AA64DFR0_PMUVer_SHIFT) |
| 780 | #define	 ID_AA64DFR0_PMUVer_3_9		(UL(0x9) << ID_AA64DFR0_PMUVer_SHIFT) | |
| 748 | 781 | #define	 ID_AA64DFR0_PMUVer_IMPL	(UL(0xf) << ID_AA64DFR0_PMUVer_SHIFT) |
| 749 | 782 | #define	ID_AA64DFR0_BRPs_SHIFT		12 |
| 783 | #define	ID_AA64DFR0_BRPs_WIDTH		4 | |
| 750 | 784 | #define	ID_AA64DFR0_BRPs_MASK		(UL(0xf) << ID_AA64DFR0_BRPs_SHIFT) |
| 751 | 785 | #define	ID_AA64DFR0_BRPs_VAL(x)	\ |
| 752 | 786 | ((((x) >> ID_AA64DFR0_BRPs_SHIFT) & 0xf) + 1) |
| 753 | 787 | #define	ID_AA64DFR0_PMSS_SHIFT		16 |
| 788 | #define	ID_AA64DFR0_PMSS_WIDTH		4 | |
| 754 | 789 | #define	ID_AA64DFR0_PMSS_MASK		(UL(0xf) << ID_AA64DFR0_PMSS_SHIFT) |
| 755 | 790 | #define	ID_AA64DFR0_PMSS_VAL(x)		((x) & ID_AA64DFR0_PMSS_MASK) |
| 756 | 791 | #define	 ID_AA64DFR0_PMSS_NONE		(UL(0x0) << ID_AA64DFR0_PMSS_SHIFT) |
| 757 | 792 | #define	 ID_AA64DFR0_PMSS_IMPL		(UL(0x1) << ID_AA64DFR0_PMSS_SHIFT) |
| 758 | 793 | #define	ID_AA64DFR0_WRPs_SHIFT		20 |
| 794 | #define	ID_AA64DFR0_WRPs_WIDTH		4 | |
| 759 | 795 | #define	ID_AA64DFR0_WRPs_MASK		(UL(0xf) << ID_AA64DFR0_WRPs_SHIFT) |
| 760 | 796 | #define	ID_AA64DFR0_WRPs_VAL(x)	\ |
| 761 | 797 | ((((x) >> ID_AA64DFR0_WRPs_SHIFT) & 0xf) + 1) |
| 762 | 798 | #define	ID_AA64DFR0_CTX_CMPs_SHIFT	28 |
| 799 | #define	ID_AA64DFR0_CTX_CMPs_WIDTH	4 | |
| 763 | 800 | #define	ID_AA64DFR0_CTX_CMPs_MASK	(UL(0xf) << ID_AA64DFR0_CTX_CMPs_SHIFT) |
| 764 | 801 | #define	ID_AA64DFR0_CTX_CMPs_VAL(x)	\ |
| 765 | 802 | ((((x) >> ID_AA64DFR0_CTX_CMPs_SHIFT) & 0xf) + 1) |
| 766 | 803 | #define	ID_AA64DFR0_PMSVer_SHIFT	32 |
| 804 | #define	ID_AA64DFR0_PMSVer_WIDTH	4 | |
| 767 | 805 | #define	ID_AA64DFR0_PMSVer_MASK		(UL(0xf) << ID_AA64DFR0_PMSVer_SHIFT) |
| 768 | 806 | #define	ID_AA64DFR0_PMSVer_VAL(x)	((x) & ID_AA64DFR0_PMSVer_MASK) |
| 769 | 807 | #define	 ID_AA64DFR0_PMSVer_NONE	(UL(0x0) << ID_AA64DFR0_PMSVer_SHIFT) |
| ... | ... | @@ -771,150 +809,192 @@ |
| 771 | 809 | #define	 ID_AA64DFR0_PMSVer_SPE_1_1	(UL(0x2) << ID_AA64DFR0_PMSVer_SHIFT) |
| 772 | 810 | #define	 ID_AA64DFR0_PMSVer_SPE_1_2	(UL(0x3) << ID_AA64DFR0_PMSVer_SHIFT) |
| 773 | 811 | #define	 ID_AA64DFR0_PMSVer_SPE_1_3	(UL(0x4) << ID_AA64DFR0_PMSVer_SHIFT) |
| 812 | #define	 ID_AA64DFR0_PMSVer_SPE_1_4	(UL(0x5) << ID_AA64DFR0_PMSVer_SHIFT) | |
| 774 | 813 | #define	ID_AA64DFR0_DoubleLock_SHIFT	36 |
| 814 | #define	ID_AA64DFR0_DoubleLock_WIDTH	4 | |
| 775 | 815 | #define	ID_AA64DFR0_DoubleLock_MASK	(UL(0xf) << ID_AA64DFR0_DoubleLock_SHIFT) |
| 776 | 816 | #define	ID_AA64DFR0_DoubleLock_VAL(x)	((x) & ID_AA64DFR0_DoubleLock_MASK) |
| 777 | 817 | #define	 ID_AA64DFR0_DoubleLock_IMPL	(UL(0x0) << ID_AA64DFR0_DoubleLock_SHIFT) |
| 778 | 818 | #define	 ID_AA64DFR0_DoubleLock_NONE	(UL(0xf) << ID_AA64DFR0_DoubleLock_SHIFT) |
| 779 | 819 | #define	ID_AA64DFR0_TraceFilt_SHIFT	40 |
| 820 | #define	ID_AA64DFR0_TraceFilt_WIDTH	4 | |
| 780 | 821 | #define	ID_AA64DFR0_TraceFilt_MASK	(UL(0xf) << ID_AA64DFR0_TraceFilt_SHIFT) |
| 781 | 822 | #define	ID_AA64DFR0_TraceFilt_VAL(x)	((x) & ID_AA64DFR0_TraceFilt_MASK) |
| 782 | 823 | #define	 ID_AA64DFR0_TraceFilt_NONE	(UL(0x0) << ID_AA64DFR0_TraceFilt_SHIFT) |
| 783 | 824 | #define	 ID_AA64DFR0_TraceFilt_8_4	(UL(0x1) << ID_AA64DFR0_TraceFilt_SHIFT) |
| 784 | 825 | #define	ID_AA64DFR0_TraceBuffer_SHIFT	44 |
| 826 | #define	ID_AA64DFR0_TraceBuffer_WIDTH	4 | |
| 785 | 827 | #define	ID_AA64DFR0_TraceBuffer_MASK	(UL(0xf) << ID_AA64DFR0_TraceBuffer_SHIFT) |
| 786 | 828 | #define	ID_AA64DFR0_TraceBuffer_VAL(x)	((x) & ID_AA64DFR0_TraceBuffer_MASK) |
| 787 | 829 | #define	 ID_AA64DFR0_TraceBuffer_NONE	(UL(0x0) << ID_AA64DFR0_TraceBuffer_SHIFT) |
| 788 | 830 | #define	 ID_AA64DFR0_TraceBuffer_IMPL	(UL(0x1) << ID_AA64DFR0_TraceBuffer_SHIFT) |
| 789 | 831 | #define	ID_AA64DFR0_MTPMU_SHIFT		48 |
| 832 | #define	ID_AA64DFR0_MTPMU_WIDTH		4 | |
| 790 | 833 | #define	ID_AA64DFR0_MTPMU_MASK		(UL(0xf) << ID_AA64DFR0_MTPMU_SHIFT) |
| 791 | 834 | #define	ID_AA64DFR0_MTPMU_VAL(x)	((x) & ID_AA64DFR0_MTPMU_MASK) |
| 792 | 835 | #define	 ID_AA64DFR0_MTPMU_NONE		(UL(0x0) << ID_AA64DFR0_MTPMU_SHIFT) |
| 793 | 836 | #define	 ID_AA64DFR0_MTPMU_IMPL		(UL(0x1) << ID_AA64DFR0_MTPMU_SHIFT) |
| 794 | 837 | #define	 ID_AA64DFR0_MTPMU_NONE_MT_RES0	(UL(0xf) << ID_AA64DFR0_MTPMU_SHIFT) |
| 795 | 838 | #define	ID_AA64DFR0_BRBE_SHIFT		52 |
| 839 | #define	ID_AA64DFR0_BRBE_WIDTH		4 | |
| 796 | 840 | #define	ID_AA64DFR0_BRBE_MASK		(UL(0xf) << ID_AA64DFR0_BRBE_SHIFT) |
| 797 | 841 | #define	ID_AA64DFR0_BRBE_VAL(x)		((x) & ID_AA64DFR0_BRBE_MASK) |
| 798 | 842 | #define	 ID_AA64DFR0_BRBE_NONE		(UL(0x0) << ID_AA64DFR0_BRBE_SHIFT) |
| 799 | 843 | #define	 ID_AA64DFR0_BRBE_IMPL		(UL(0x1) << ID_AA64DFR0_BRBE_SHIFT) |
| 800 | 844 | #define	 ID_AA64DFR0_BRBE_EL3		(UL(0x2) << ID_AA64DFR0_BRBE_SHIFT) |
| 801 | 845 | #define	ID_AA64DFR0_HPMN0_SHIFT		60 |
| 846 | #define	ID_AA64DFR0_HPMN0_WIDTH		4 | |
| 802 | 847 | #define	ID_AA64DFR0_HPMN0_MASK		(UL(0xf) << ID_AA64DFR0_HPMN0_SHIFT) |
| 803 | 848 | #define	ID_AA64DFR0_HPMN0_VAL(x)	((x) & ID_AA64DFR0_HPMN0_MASK) |
| 804 | 849 | #define	 ID_AA64DFR0_HPMN0_CONSTR	(UL(0x0) << ID_AA64DFR0_HPMN0_SHIFT) |
| 805 | 850 | #define	 ID_AA64DFR0_HPMN0_DEFINED	(UL(0x1) << ID_AA64DFR0_HPMN0_SHIFT) |
| 806 | 851 | |
| 807 | 852 | /* ID_AA64DFR1_EL1 */ |
| 808 | #define	ID_AA64DFR1_EL1			MRS_REG(ID_AA64DFR1_EL1) | |
| 809 | 853 | #define	ID_AA64DFR1_EL1_REG		MRS_REG_ALT_NAME(ID_AA64DFR1_EL1) |
| 854 | #define	ID_AA64DFR1_EL1_ISS		ISS_MSR_REG(ID_AA64DFR1_EL1) | |
| 810 | 855 | #define	ID_AA64DFR1_EL1_op0		3 |
| 811 | 856 | #define	ID_AA64DFR1_EL1_op1		0 |
| 812 | 857 | #define	ID_AA64DFR1_EL1_CRn		0 |
| 813 | 858 | #define	ID_AA64DFR1_EL1_CRm		5 |
| 814 | 859 | #define	ID_AA64DFR1_EL1_op2		1 |
| 860 | #define	ID_AA64DFR1_SPMU_SHIFT		32 | |
| 861 | #define	ID_AA64DFR1_SPMU_WIDTH		4 | |
| 862 | #define	ID_AA64DFR1_SPMU_MASK		(UL(0xf) << ID_AA64DFR1_SPMU_SHIFT) | |
| 863 | #define	ID_AA64DFR1_SPMU_VAL(x)		((x) & ID_AA64DFR1_SPMU_MASK) | |
| 864 | #define	 ID_AA64DFR1_SPMU_NONE		(UL(0x0) << ID_AA64DFR1_SPMU_SHIFT) | |
| 865 | #define	 ID_AA64DFR1_SPMU_IMPL		(UL(0x1) << ID_AA64DFR1_SPMU_SHIFT) | |
| 866 | #define	ID_AA64DFR1_PMICNTR_SHIFT	36 | |
| 867 | #define	ID_AA64DFR1_PMICNTR_WIDTH	4 | |
| 868 | #define	ID_AA64DFR1_PMICNTR_MASK	(UL(0xf) << ID_AA64DFR1_PMICNTR_SHIFT) | |
| 869 | #define	ID_AA64DFR1_PMICNTR_VAL(x)	((x) & ID_AA64DFR1_PMICNTR_MASK) | |
| 870 | #define	 ID_AA64DFR1_PMICNTR_NONE	(UL(0x0) << ID_AA64DFR1_PMICNTR_SHIFT) | |
| 871 | #define	 ID_AA64DFR1_PMICNTR_IMPL	(UL(0x1) << ID_AA64DFR1_PMICNTR_SHIFT) | |
| 872 | #define	ID_AA64DFR1_DPFZS_SHIFT		52 | |
| 873 | #define	ID_AA64DFR1_DPFZS_WIDTH		4 | |
| 874 | #define	ID_AA64DFR1_DPFZS_MASK		(UL(0xf) << ID_AA64DFR1_DPFZS_SHIFT) | |
| 875 | #define	ID_AA64DFR1_DPFZS_VAL(x)	((x) & ID_AA64DFR1_DPFZS_MASK) | |
| 876 | #define	 ID_AA64DFR1_DPFZS_NONE		(UL(0x0) << ID_AA64DFR1_DPFZS_SHIFT) | |
| 877 | #define	 ID_AA64DFR1_DPFZS_IMPL		(UL(0x1) << ID_AA64DFR1_DPFZS_SHIFT) | |
| 815 | 878 | |
| 816 | 879 | /* ID_AA64ISAR0_EL1 */ |
| 817 | #define	ID_AA64ISAR0_EL1		MRS_REG(ID_AA64ISAR0_EL1) | |
| 818 | 880 | #define	ID_AA64ISAR0_EL1_REG		MRS_REG_ALT_NAME(ID_AA64ISAR0_EL1) |
| 881 | #define	ID_AA64ISAR0_EL1_ISS		ISS_MSR_REG(ID_AA64ISAR0_EL1) | |
| 819 | 882 | #define	ID_AA64ISAR0_EL1_op0		3 |
| 820 | 883 | #define	ID_AA64ISAR0_EL1_op1		0 |
| 821 | 884 | #define	ID_AA64ISAR0_EL1_CRn		0 |
| 822 | 885 | #define	ID_AA64ISAR0_EL1_CRm		6 |
| 823 | 886 | #define	ID_AA64ISAR0_EL1_op2		0 |
| 824 | 887 | #define	ID_AA64ISAR0_AES_SHIFT		4 |
| 888 | #define	ID_AA64ISAR0_AES_WIDTH		4 | |
| 825 | 889 | #define	ID_AA64ISAR0_AES_MASK		(UL(0xf) << ID_AA64ISAR0_AES_SHIFT) |
| 826 | 890 | #define	ID_AA64ISAR0_AES_VAL(x)		((x) & ID_AA64ISAR0_AES_MASK) |
| 827 | 891 | #define	 ID_AA64ISAR0_AES_NONE		(UL(0x0) << ID_AA64ISAR0_AES_SHIFT) |
| 828 | 892 | #define	 ID_AA64ISAR0_AES_BASE		(UL(0x1) << ID_AA64ISAR0_AES_SHIFT) |
| 829 | 893 | #define	 ID_AA64ISAR0_AES_PMULL		(UL(0x2) << ID_AA64ISAR0_AES_SHIFT) |
| 830 | 894 | #define	ID_AA64ISAR0_SHA1_SHIFT		8 |
| 895 | #define	ID_AA64ISAR0_SHA1_WIDTH		4 | |
| 831 | 896 | #define	ID_AA64ISAR0_SHA1_MASK		(UL(0xf) << ID_AA64ISAR0_SHA1_SHIFT) |
| 832 | 897 | #define	ID_AA64ISAR0_SHA1_VAL(x)	((x) & ID_AA64ISAR0_SHA1_MASK) |
| 833 | 898 | #define	 ID_AA64ISAR0_SHA1_NONE		(UL(0x0) << ID_AA64ISAR0_SHA1_SHIFT) |
| 834 | 899 | #define	 ID_AA64ISAR0_SHA1_BASE		(UL(0x1) << ID_AA64ISAR0_SHA1_SHIFT) |
| 835 | 900 | #define	ID_AA64ISAR0_SHA2_SHIFT		12 |
| 901 | #define	ID_AA64ISAR0_SHA2_WIDTH		4 | |
| 836 | 902 | #define	ID_AA64ISAR0_SHA2_MASK		(UL(0xf) << ID_AA64ISAR0_SHA2_SHIFT) |
| 837 | 903 | #define	ID_AA64ISAR0_SHA2_VAL(x)	((x) & ID_AA64ISAR0_SHA2_MASK) |
| 838 | 904 | #define	 ID_AA64ISAR0_SHA2_NONE		(UL(0x0) << ID_AA64ISAR0_SHA2_SHIFT) |
| 839 | 905 | #define	 ID_AA64ISAR0_SHA2_BASE		(UL(0x1) << ID_AA64ISAR0_SHA2_SHIFT) |
| 840 | 906 | #define	 ID_AA64ISAR0_SHA2_512		(UL(0x2) << ID_AA64ISAR0_SHA2_SHIFT) |
| 841 | 907 | #define	ID_AA64ISAR0_CRC32_SHIFT	16 |
| 908 | #define	ID_AA64ISAR0_CRC32_WIDTH	4 | |
| 842 | 909 | #define	ID_AA64ISAR0_CRC32_MASK		(UL(0xf) << ID_AA64ISAR0_CRC32_SHIFT) |
| 843 | 910 | #define	ID_AA64ISAR0_CRC32_VAL(x)	((x) & ID_AA64ISAR0_CRC32_MASK) |
| 844 | 911 | #define	 ID_AA64ISAR0_CRC32_NONE	(UL(0x0) << ID_AA64ISAR0_CRC32_SHIFT) |
| 845 | 912 | #define	 ID_AA64ISAR0_CRC32_BASE	(UL(0x1) << ID_AA64ISAR0_CRC32_SHIFT) |
| 846 | 913 | #define	ID_AA64ISAR0_Atomic_SHIFT	20 |
| 914 | #define	ID_AA64ISAR0_Atomic_WIDTH	4 | |
| 847 | 915 | #define	ID_AA64ISAR0_Atomic_MASK	(UL(0xf) << ID_AA64ISAR0_Atomic_SHIFT) |
| 848 | 916 | #define	ID_AA64ISAR0_Atomic_VAL(x)	((x) & ID_AA64ISAR0_Atomic_MASK) |
| 849 | 917 | #define	 ID_AA64ISAR0_Atomic_NONE	(UL(0x0) << ID_AA64ISAR0_Atomic_SHIFT) |
| 850 | 918 | #define	 ID_AA64ISAR0_Atomic_IMPL	(UL(0x2) << ID_AA64ISAR0_Atomic_SHIFT) |
| 851 | 919 | #define	ID_AA64ISAR0_TME_SHIFT		24 |
| 920 | #define	ID_AA64ISAR0_TME_WIDTH		4 | |
| 852 | 921 | #define	ID_AA64ISAR0_TME_MASK		(UL(0xf) << ID_AA64ISAR0_TME_SHIFT) |
| 853 | 922 | #define	 ID_AA64ISAR0_TME_NONE		(UL(0x0) << ID_AA64ISAR0_TME_SHIFT) |
| 854 | 923 | #define	 ID_AA64ISAR0_TME_IMPL		(UL(0x1) << ID_AA64ISAR0_TME_SHIFT) |
| 855 | 924 | #define	ID_AA64ISAR0_RDM_SHIFT		28 |
| 925 | #define	ID_AA64ISAR0_RDM_WIDTH		4 | |
| 856 | 926 | #define	ID_AA64ISAR0_RDM_MASK		(UL(0xf) << ID_AA64ISAR0_RDM_SHIFT) |
| 857 | 927 | #define	ID_AA64ISAR0_RDM_VAL(x)		((x) & ID_AA64ISAR0_RDM_MASK) |
| 858 | 928 | #define	 ID_AA64ISAR0_RDM_NONE		(UL(0x0) << ID_AA64ISAR0_RDM_SHIFT) |
| 859 | 929 | #define	 ID_AA64ISAR0_RDM_IMPL		(UL(0x1) << ID_AA64ISAR0_RDM_SHIFT) |
| 860 | 930 | #define	ID_AA64ISAR0_SHA3_SHIFT		32 |
| 931 | #define	ID_AA64ISAR0_SHA3_WIDTH		4 | |
| 861 | 932 | #define	ID_AA64ISAR0_SHA3_MASK		(UL(0xf) << ID_AA64ISAR0_SHA3_SHIFT) |
| 862 | 933 | #define	ID_AA64ISAR0_SHA3_VAL(x)	((x) & ID_AA64ISAR0_SHA3_MASK) |
| 863 | 934 | #define	 ID_AA64ISAR0_SHA3_NONE		(UL(0x0) << ID_AA64ISAR0_SHA3_SHIFT) |
| 864 | 935 | #define	 ID_AA64ISAR0_SHA3_IMPL		(UL(0x1) << ID_AA64ISAR0_SHA3_SHIFT) |
| 865 | 936 | #define	ID_AA64ISAR0_SM3_SHIFT		36 |
| 937 | #define	ID_AA64ISAR0_SM3_WIDTH		4 | |
| 866 | 938 | #define	ID_AA64ISAR0_SM3_MASK		(UL(0xf) << ID_AA64ISAR0_SM3_SHIFT) |
| 867 | 939 | #define	ID_AA64ISAR0_SM3_VAL(x)		((x) & ID_AA64ISAR0_SM3_MASK) |
| 868 | 940 | #define	 ID_AA64ISAR0_SM3_NONE		(UL(0x0) << ID_AA64ISAR0_SM3_SHIFT) |
| 869 | 941 | #define	 ID_AA64ISAR0_SM3_IMPL		(UL(0x1) << ID_AA64ISAR0_SM3_SHIFT) |
| 870 | 942 | #define	ID_AA64ISAR0_SM4_SHIFT		40 |
| 943 | #define	ID_AA64ISAR0_SM4_WIDTH		4 | |
| 871 | 944 | #define	ID_AA64ISAR0_SM4_MASK		(UL(0xf) << ID_AA64ISAR0_SM4_SHIFT) |
| 872 | 945 | #define	ID_AA64ISAR0_SM4_VAL(x)		((x) & ID_AA64ISAR0_SM4_MASK) |
| 873 | 946 | #define	 ID_AA64ISAR0_SM4_NONE		(UL(0x0) << ID_AA64ISAR0_SM4_SHIFT) |
| 874 | 947 | #define	 ID_AA64ISAR0_SM4_IMPL		(UL(0x1) << ID_AA64ISAR0_SM4_SHIFT) |
| 875 | 948 | #define	ID_AA64ISAR0_DP_SHIFT		44 |
| 949 | #define	ID_AA64ISAR0_DP_WIDTH		4 | |
| 876 | 950 | #define	ID_AA64ISAR0_DP_MASK		(UL(0xf) << ID_AA64ISAR0_DP_SHIFT) |
| 877 | 951 | #define	ID_AA64ISAR0_DP_VAL(x)		((x) & ID_AA64ISAR0_DP_MASK) |
| 878 | 952 | #define	 ID_AA64ISAR0_DP_NONE		(UL(0x0) << ID_AA64ISAR0_DP_SHIFT) |
| 879 | 953 | #define	 ID_AA64ISAR0_DP_IMPL		(UL(0x1) << ID_AA64ISAR0_DP_SHIFT) |
| 880 | 954 | #define	ID_AA64ISAR0_FHM_SHIFT		48 |
| 955 | #define	ID_AA64ISAR0_FHM_WIDTH		4 | |
| 881 | 956 | #define	ID_AA64ISAR0_FHM_MASK		(UL(0xf) << ID_AA64ISAR0_FHM_SHIFT) |
| 882 | 957 | #define	ID_AA64ISAR0_FHM_VAL(x)		((x) & ID_AA64ISAR0_FHM_MASK) |
| 883 | 958 | #define	 ID_AA64ISAR0_FHM_NONE		(UL(0x0) << ID_AA64ISAR0_FHM_SHIFT) |
| 884 | 959 | #define	 ID_AA64ISAR0_FHM_IMPL		(UL(0x1) << ID_AA64ISAR0_FHM_SHIFT) |
| 885 | 960 | #define	ID_AA64ISAR0_TS_SHIFT		52 |
| 961 | #define	ID_AA64ISAR0_TS_WIDTH		4 | |
| 886 | 962 | #define	ID_AA64ISAR0_TS_MASK		(UL(0xf) << ID_AA64ISAR0_TS_SHIFT) |
| 887 | 963 | #define	ID_AA64ISAR0_TS_VAL(x)		((x) & ID_AA64ISAR0_TS_MASK) |
| 888 | 964 | #define	 ID_AA64ISAR0_TS_NONE		(UL(0x0) << ID_AA64ISAR0_TS_SHIFT) |
| 889 | 965 | #define	 ID_AA64ISAR0_TS_CondM_8_4	(UL(0x1) << ID_AA64ISAR0_TS_SHIFT) |
| 890 | 966 | #define	 ID_AA64ISAR0_TS_CondM_8_5	(UL(0x2) << ID_AA64ISAR0_TS_SHIFT) |
| 891 | 967 | #define	ID_AA64ISAR0_TLB_SHIFT		56 |
| 968 | #define	ID_AA64ISAR0_TLB_WIDTH		4 | |
| 892 | 969 | #define	ID_AA64ISAR0_TLB_MASK		(UL(0xf) << ID_AA64ISAR0_TLB_SHIFT) |
| 893 | 970 | #define	ID_AA64ISAR0_TLB_VAL(x)		((x) & ID_AA64ISAR0_TLB_MASK) |
| 894 | 971 | #define	 ID_AA64ISAR0_TLB_NONE		(UL(0x0) << ID_AA64ISAR0_TLB_SHIFT) |
| 895 | 972 | #define	 ID_AA64ISAR0_TLB_TLBIOS	(UL(0x1) << ID_AA64ISAR0_TLB_SHIFT) |
| 896 | 973 | #define	 ID_AA64ISAR0_TLB_TLBIOSR	(UL(0x2) << ID_AA64ISAR0_TLB_SHIFT) |
| 897 | 974 | #define	ID_AA64ISAR0_RNDR_SHIFT		60 |
| 975 | #define	ID_AA64ISAR0_RNDR_WIDTH		4 | |
| 898 | 976 | #define	ID_AA64ISAR0_RNDR_MASK		(UL(0xf) << ID_AA64ISAR0_RNDR_SHIFT) |
| 899 | 977 | #define	ID_AA64ISAR0_RNDR_VAL(x)	((x) & ID_AA64ISAR0_RNDR_MASK) |
| 900 | 978 | #define	 ID_AA64ISAR0_RNDR_NONE		(UL(0x0) << ID_AA64ISAR0_RNDR_SHIFT) |
| 901 | 979 | #define	 ID_AA64ISAR0_RNDR_IMPL		(UL(0x1) << ID_AA64ISAR0_RNDR_SHIFT) |
| 902 | 980 | |
| 903 | 981 | /* ID_AA64ISAR1_EL1 */ |
| 904 | #define	ID_AA64ISAR1_EL1		MRS_REG(ID_AA64ISAR1_EL1) | |
| 905 | 982 | #define	ID_AA64ISAR1_EL1_REG		MRS_REG_ALT_NAME(ID_AA64ISAR1_EL1) |
| 983 | #define	ID_AA64ISAR1_EL1_ISS		ISS_MSR_REG(ID_AA64ISAR1_EL1) | |
| 906 | 984 | #define	ID_AA64ISAR1_EL1_op0		3 |
| 907 | 985 | #define	ID_AA64ISAR1_EL1_op1		0 |
| 908 | 986 | #define	ID_AA64ISAR1_EL1_CRn		0 |
| 909 | 987 | #define	ID_AA64ISAR1_EL1_CRm		6 |
| 910 | 988 | #define	ID_AA64ISAR1_EL1_op2		1 |
| 911 | 989 | #define	ID_AA64ISAR1_DPB_SHIFT		0 |
| 990 | #define	ID_AA64ISAR1_DPB_WIDTH		4 | |
| 912 | 991 | #define	ID_AA64ISAR1_DPB_MASK		(UL(0xf) << ID_AA64ISAR1_DPB_SHIFT) |
| 913 | 992 | #define	ID_AA64ISAR1_DPB_VAL(x)		((x) & ID_AA64ISAR1_DPB_MASK) |
| 914 | 993 | #define	 ID_AA64ISAR1_DPB_NONE		(UL(0x0) << ID_AA64ISAR1_DPB_SHIFT) |
| 915 | 994 | #define	 ID_AA64ISAR1_DPB_DCCVAP	(UL(0x1) << ID_AA64ISAR1_DPB_SHIFT) |
| 916 | 995 | #define	 ID_AA64ISAR1_DPB_DCCVADP	(UL(0x2) << ID_AA64ISAR1_DPB_SHIFT) |
| 917 | 996 | #define	ID_AA64ISAR1_APA_SHIFT		4 |
| 997 | #define	ID_AA64ISAR1_APA_WIDTH		4 | |
| 918 | 998 | #define	ID_AA64ISAR1_APA_MASK		(UL(0xf) << ID_AA64ISAR1_APA_SHIFT) |
| 919 | 999 | #define	ID_AA64ISAR1_APA_VAL(x)		((x) & ID_AA64ISAR1_APA_MASK) |
| 920 | 1000 | #define	 ID_AA64ISAR1_APA_NONE		(UL(0x0) << ID_AA64ISAR1_APA_SHIFT) |
| ... | ... | @@ -924,6 +1004,7 @@ |
| 924 | 1004 | #define	 ID_AA64ISAR1_APA_FPAC		(UL(0x4) << ID_AA64ISAR1_APA_SHIFT) |
| 925 | 1005 | #define	 ID_AA64ISAR1_APA_FPAC_COMBINED	(UL(0x5) << ID_AA64ISAR1_APA_SHIFT) |
| 926 | 1006 | #define	ID_AA64ISAR1_API_SHIFT		8 |
| 1007 | #define	ID_AA64ISAR1_API_WIDTH		4 | |
| 927 | 1008 | #define	ID_AA64ISAR1_API_MASK		(UL(0xf) << ID_AA64ISAR1_API_SHIFT) |
| 928 | 1009 | #define	ID_AA64ISAR1_API_VAL(x)		((x) & ID_AA64ISAR1_API_MASK) |
| 929 | 1010 | #define	 ID_AA64ISAR1_API_NONE		(UL(0x0) << ID_AA64ISAR1_API_SHIFT) |
| ... | ... | @@ -933,68 +1014,82 @@ |
| 933 | 1014 | #define	 ID_AA64ISAR1_API_FPAC		(UL(0x4) << ID_AA64ISAR1_API_SHIFT) |
| 934 | 1015 | #define	 ID_AA64ISAR1_API_FPAC_COMBINED	(UL(0x5) << ID_AA64ISAR1_API_SHIFT) |
| 935 | 1016 | #define	ID_AA64ISAR1_JSCVT_SHIFT	12 |
| 1017 | #define	ID_AA64ISAR1_JSCVT_WIDTH	4 | |
| 936 | 1018 | #define	ID_AA64ISAR1_JSCVT_MASK		(UL(0xf) << ID_AA64ISAR1_JSCVT_SHIFT) |
| 937 | 1019 | #define	ID_AA64ISAR1_JSCVT_VAL(x)	((x) & ID_AA64ISAR1_JSCVT_MASK) |
| 938 | 1020 | #define	 ID_AA64ISAR1_JSCVT_NONE	(UL(0x0) << ID_AA64ISAR1_JSCVT_SHIFT) |
| 939 | 1021 | #define	 ID_AA64ISAR1_JSCVT_IMPL	(UL(0x1) << ID_AA64ISAR1_JSCVT_SHIFT) |
| 940 | 1022 | #define	ID_AA64ISAR1_FCMA_SHIFT		16 |
| 1023 | #define	ID_AA64ISAR1_FCMA_WIDTH		4 | |
| 941 | 1024 | #define	ID_AA64ISAR1_FCMA_MASK		(UL(0xf) << ID_AA64ISAR1_FCMA_SHIFT) |
| 942 | 1025 | #define	ID_AA64ISAR1_FCMA_VAL(x)	((x) & ID_AA64ISAR1_FCMA_MASK) |
| 943 | 1026 | #define	 ID_AA64ISAR1_FCMA_NONE		(UL(0x0) << ID_AA64ISAR1_FCMA_SHIFT) |
| 944 | 1027 | #define	 ID_AA64ISAR1_FCMA_IMPL		(UL(0x1) << ID_AA64ISAR1_FCMA_SHIFT) |
| 945 | 1028 | #define	ID_AA64ISAR1_LRCPC_SHIFT	20 |
| 1029 | #define	ID_AA64ISAR1_LRCPC_WIDTH	4 | |
| 946 | 1030 | #define	ID_AA64ISAR1_LRCPC_MASK		(UL(0xf) << ID_AA64ISAR1_LRCPC_SHIFT) |
| 947 | 1031 | #define	ID_AA64ISAR1_LRCPC_VAL(x)	((x) & ID_AA64ISAR1_LRCPC_MASK) |
| 948 | 1032 | #define	 ID_AA64ISAR1_LRCPC_NONE	(UL(0x0) << ID_AA64ISAR1_LRCPC_SHIFT) |
| 949 | 1033 | #define	 ID_AA64ISAR1_LRCPC_RCPC_8_3	(UL(0x1) << ID_AA64ISAR1_LRCPC_SHIFT) |
| 950 | 1034 | #define	 ID_AA64ISAR1_LRCPC_RCPC_8_4	(UL(0x2) << ID_AA64ISAR1_LRCPC_SHIFT) |
| 951 | 1035 | #define	ID_AA64ISAR1_GPA_SHIFT		24 |
| 1036 | #define	ID_AA64ISAR1_GPA_WIDTH		4 | |
| 952 | 1037 | #define	ID_AA64ISAR1_GPA_MASK		(UL(0xf) << ID_AA64ISAR1_GPA_SHIFT) |
| 953 | 1038 | #define	ID_AA64ISAR1_GPA_VAL(x)		((x) & ID_AA64ISAR1_GPA_MASK) |
| 954 | 1039 | #define	 ID_AA64ISAR1_GPA_NONE		(UL(0x0) << ID_AA64ISAR1_GPA_SHIFT) |
| 955 | 1040 | #define	 ID_AA64ISAR1_GPA_IMPL		(UL(0x1) << ID_AA64ISAR1_GPA_SHIFT) |
| 956 | 1041 | #define	ID_AA64ISAR1_GPI_SHIFT		28 |
| 1042 | #define	ID_AA64ISAR1_GPI_WIDTH		4 | |
| 957 | 1043 | #define	ID_AA64ISAR1_GPI_MASK		(UL(0xf) << ID_AA64ISAR1_GPI_SHIFT) |
| 958 | 1044 | #define	ID_AA64ISAR1_GPI_VAL(x)		((x) & ID_AA64ISAR1_GPI_MASK) |
| 959 | 1045 | #define	 ID_AA64ISAR1_GPI_NONE		(UL(0x0) << ID_AA64ISAR1_GPI_SHIFT) |
| 960 | 1046 | #define	 ID_AA64ISAR1_GPI_IMPL		(UL(0x1) << ID_AA64ISAR1_GPI_SHIFT) |
| 961 | 1047 | #define	ID_AA64ISAR1_FRINTTS_SHIFT	32 |
| 1048 | #define	ID_AA64ISAR1_FRINTTS_WIDTH	4 | |
| 962 | 1049 | #define	ID_AA64ISAR1_FRINTTS_MASK	(UL(0xf) << ID_AA64ISAR1_FRINTTS_SHIFT) |
| 963 | 1050 | #define	ID_AA64ISAR1_FRINTTS_VAL(x)	((x) & ID_AA64ISAR1_FRINTTS_MASK) |
| 964 | 1051 | #define	 ID_AA64ISAR1_FRINTTS_NONE	(UL(0x0) << ID_AA64ISAR1_FRINTTS_SHIFT) |
| 965 | 1052 | #define	 ID_AA64ISAR1_FRINTTS_IMPL	(UL(0x1) << ID_AA64ISAR1_FRINTTS_SHIFT) |
| 966 | 1053 | #define	ID_AA64ISAR1_SB_SHIFT		36 |
| 1054 | #define	ID_AA64ISAR1_SB_WIDTH		4 | |
| 967 | 1055 | #define	ID_AA64ISAR1_SB_MASK		(UL(0xf) << ID_AA64ISAR1_SB_SHIFT) |
| 968 | 1056 | #define	ID_AA64ISAR1_SB_VAL(x)		((x) & ID_AA64ISAR1_SB_MASK) |
| 969 | 1057 | #define	 ID_AA64ISAR1_SB_NONE		(UL(0x0) << ID_AA64ISAR1_SB_SHIFT) |
| 970 | 1058 | #define	 ID_AA64ISAR1_SB_IMPL		(UL(0x1) << ID_AA64ISAR1_SB_SHIFT) |
| 971 | 1059 | #define	ID_AA64ISAR1_SPECRES_SHIFT	40 |
| 1060 | #define	ID_AA64ISAR1_SPECRES_WIDTH	4 | |
| 972 | 1061 | #define	ID_AA64ISAR1_SPECRES_MASK	(UL(0xf) << ID_AA64ISAR1_SPECRES_SHIFT) |
| 973 | 1062 | #define	ID_AA64ISAR1_SPECRES_VAL(x)	((x) & ID_AA64ISAR1_SPECRES_MASK) |
| 974 | 1063 | #define	 ID_AA64ISAR1_SPECRES_NONE	(UL(0x0) << ID_AA64ISAR1_SPECRES_SHIFT) |
| 975 | #define	 ID_AA64ISAR1_SPECRES_IMPL	(UL(0x1) << ID_AA64ISAR1_SPECRES_SHIFT) | |
| 1064 | #define	 ID_AA64ISAR1_SPECRES_8_5	(UL(0x1) << ID_AA64ISAR1_SPECRES_SHIFT) | |
| 1065 | #define	 ID_AA64ISAR1_SPECRES_8_9	(UL(0x2) << ID_AA64ISAR1_SPECRES_SHIFT) | |
| 976 | 1066 | #define	ID_AA64ISAR1_BF16_SHIFT		44 |
| 1067 | #define	ID_AA64ISAR1_BF16_WIDTH		4 | |
| 977 | 1068 | #define	ID_AA64ISAR1_BF16_MASK		(UL(0xf) << ID_AA64ISAR1_BF16_SHIFT) |
| 978 | 1069 | #define	ID_AA64ISAR1_BF16_VAL(x)	((x) & ID_AA64ISAR1_BF16_MASK) |
| 979 | 1070 | #define	 ID_AA64ISAR1_BF16_NONE		(UL(0x0) << ID_AA64ISAR1_BF16_SHIFT) |
| 980 | 1071 | #define	 ID_AA64ISAR1_BF16_IMPL		(UL(0x1) << ID_AA64ISAR1_BF16_SHIFT) |
| 981 | 1072 | #define	 ID_AA64ISAR1_BF16_EBF		(UL(0x2) << ID_AA64ISAR1_BF16_SHIFT) |
| 982 | 1073 | #define	ID_AA64ISAR1_DGH_SHIFT		48 |
| 1074 | #define	ID_AA64ISAR1_DGH_WIDTH		4 | |
| 983 | 1075 | #define	ID_AA64ISAR1_DGH_MASK		(UL(0xf) << ID_AA64ISAR1_DGH_SHIFT) |
| 984 | 1076 | #define	ID_AA64ISAR1_DGH_VAL(x)		((x) & ID_AA64ISAR1_DGH_MASK) |
| 985 | 1077 | #define	 ID_AA64ISAR1_DGH_NONE		(UL(0x0) << ID_AA64ISAR1_DGH_SHIFT) |
| 986 | 1078 | #define	 ID_AA64ISAR1_DGH_IMPL		(UL(0x1) << ID_AA64ISAR1_DGH_SHIFT) |
| 987 | 1079 | #define	ID_AA64ISAR1_I8MM_SHIFT		52 |
| 1080 | #define	ID_AA64ISAR1_I8MM_WIDTH		4 | |
| 988 | 1081 | #define	ID_AA64ISAR1_I8MM_MASK		(UL(0xf) << ID_AA64ISAR1_I8MM_SHIFT) |
| 989 | 1082 | #define	ID_AA64ISAR1_I8MM_VAL(x)	((x) & ID_AA64ISAR1_I8MM_MASK) |
| 990 | 1083 | #define	 ID_AA64ISAR1_I8MM_NONE		(UL(0x0) << ID_AA64ISAR1_I8MM_SHIFT) |
| 991 | 1084 | #define	 ID_AA64ISAR1_I8MM_IMPL		(UL(0x1) << ID_AA64ISAR1_I8MM_SHIFT) |
| 992 | 1085 | #define	ID_AA64ISAR1_XS_SHIFT		56 |
| 1086 | #define	ID_AA64ISAR1_XS_WIDTH		4 | |
| 993 | 1087 | #define	ID_AA64ISAR1_XS_MASK		(UL(0xf) << ID_AA64ISAR1_XS_SHIFT) |
| 994 | 1088 | #define	ID_AA64ISAR1_XS_VAL(x)		((x) & ID_AA64ISAR1_XS_MASK) |
| 995 | 1089 | #define	 ID_AA64ISAR1_XS_NONE		(UL(0x0) << ID_AA64ISAR1_XS_SHIFT) |
| 996 | 1090 | #define	 ID_AA64ISAR1_XS_IMPL		(UL(0x1) << ID_AA64ISAR1_XS_SHIFT) |
| 997 | 1091 | #define	ID_AA64ISAR1_LS64_SHIFT		60 |
| 1092 | #define	ID_AA64ISAR1_LS64_WIDTH		4 | |
| 998 | 1093 | #define	ID_AA64ISAR1_LS64_MASK		(UL(0xf) << ID_AA64ISAR1_LS64_SHIFT) |
| 999 | 1094 | #define	ID_AA64ISAR1_LS64_VAL(x)	((x) & ID_AA64ISAR1_LS64_MASK) |
| 1000 | 1095 | #define	 ID_AA64ISAR1_LS64_NONE		(UL(0x0) << ID_AA64ISAR1_LS64_SHIFT) |
| ... | ... | @@ -1003,29 +1098,33 @@ |
| 1003 | 1098 | #define	 ID_AA64ISAR1_LS64_ACCDATA	(UL(0x3) << ID_AA64ISAR1_LS64_SHIFT) |
| 1004 | 1099 | |
| 1005 | 1100 | /* ID_AA64ISAR2_EL1 */ |
| 1006 | #define	ID_AA64ISAR2_EL1		MRS_REG(ID_AA64ISAR2_EL1) | |
| 1007 | 1101 | #define	ID_AA64ISAR2_EL1_REG		MRS_REG_ALT_NAME(ID_AA64ISAR2_EL1) |
| 1102 | #define	ID_AA64ISAR2_EL1_ISS		ISS_MSR_REG(ID_AA64ISAR2_EL1) | |
| 1008 | 1103 | #define	ID_AA64ISAR2_EL1_op0		3 |
| 1009 | 1104 | #define	ID_AA64ISAR2_EL1_op1		0 |
| 1010 | 1105 | #define	ID_AA64ISAR2_EL1_CRn		0 |
| 1011 | 1106 | #define	ID_AA64ISAR2_EL1_CRm		6 |
| 1012 | 1107 | #define	ID_AA64ISAR2_EL1_op2		2 |
| 1013 | 1108 | #define	ID_AA64ISAR2_WFxT_SHIFT		0 |
| 1109 | #define	ID_AA64ISAR2_WFxT_WIDTH		4 | |
| 1014 | 1110 | #define	ID_AA64ISAR2_WFxT_MASK		(UL(0xf) << ID_AA64ISAR2_WFxT_SHIFT) |
| 1015 | 1111 | #define	ID_AA64ISAR2_WFxT_VAL(x)	((x) & ID_AA64ISAR2_WFxT_MASK) |
| 1016 | 1112 | #define	 ID_AA64ISAR2_WFxT_NONE		(UL(0x0) << ID_AA64ISAR2_WFxT_SHIFT) |
| 1017 | #define	 ID_AA64ISAR2_WFxT_IMPL		(UL(0x1) << ID_AA64ISAR2_WFxT_SHIFT) | |
| 1113 | #define	 ID_AA64ISAR2_WFxT_IMPL		(UL(0x2) << ID_AA64ISAR2_WFxT_SHIFT) | |
| 1018 | 1114 | #define	ID_AA64ISAR2_RPRES_SHIFT	4 |
| 1115 | #define	ID_AA64ISAR2_RPRES_WIDTH	4 | |
| 1019 | 1116 | #define	ID_AA64ISAR2_RPRES_MASK		(UL(0xf) << ID_AA64ISAR2_RPRES_SHIFT) |
| 1020 | 1117 | #define	ID_AA64ISAR2_RPRES_VAL(x)	((x) & ID_AA64ISAR2_RPRES_MASK) |
| 1021 | 1118 | #define	 ID_AA64ISAR2_RPRES_NONE	(UL(0x0) << ID_AA64ISAR2_RPRES_SHIFT) |
| 1022 | 1119 | #define	 ID_AA64ISAR2_RPRES_IMPL	(UL(0x1) << ID_AA64ISAR2_RPRES_SHIFT) |
| 1023 | 1120 | #define	ID_AA64ISAR2_GPA3_SHIFT		8 |
| 1121 | #define	ID_AA64ISAR2_GPA3_WIDTH		4 | |
| 1024 | 1122 | #define	ID_AA64ISAR2_GPA3_MASK		(UL(0xf) << ID_AA64ISAR2_GPA3_SHIFT) |
| 1025 | 1123 | #define	ID_AA64ISAR2_GPA3_VAL(x)	((x) & ID_AA64ISAR2_GPA3_MASK) |
| 1026 | 1124 | #define	 ID_AA64ISAR2_GPA3_NONE		(UL(0x0) << ID_AA64ISAR2_GPA3_SHIFT) |
| 1027 | 1125 | #define	 ID_AA64ISAR2_GPA3_IMPL		(UL(0x1) << ID_AA64ISAR2_GPA3_SHIFT) |
| 1028 | 1126 | #define	ID_AA64ISAR2_APA3_SHIFT		12 |
| 1127 | #define	ID_AA64ISAR2_APA3_WIDTH		4 | |
| 1029 | 1128 | #define	ID_AA64ISAR2_APA3_MASK		(UL(0xf) << ID_AA64ISAR2_APA3_SHIFT) |
| 1030 | 1129 | #define	ID_AA64ISAR2_APA3_VAL(x)	((x) & ID_AA64ISAR2_APA3_MASK) |
| 1031 | 1130 | #define	 ID_AA64ISAR2_APA3_NONE		(UL(0x0) << ID_AA64ISAR2_APA3_SHIFT) |
| ... | ... | @@ -1035,30 +1134,64 @@ |
| 1035 | 1134 | #define	 ID_AA64ISAR2_APA3_FPAC		(UL(0x4) << ID_AA64ISAR2_APA3_SHIFT) |
| 1036 | 1135 | #define	 ID_AA64ISAR2_APA3_FPAC_COMBINED (UL(0x5) << ID_AA64ISAR2_APA3_SHIFT) |
| 1037 | 1136 | #define	ID_AA64ISAR2_MOPS_SHIFT		16 |
| 1137 | #define	ID_AA64ISAR2_MOPS_WIDTH		4 | |
| 1038 | 1138 | #define	ID_AA64ISAR2_MOPS_MASK		(UL(0xf) << ID_AA64ISAR2_MOPS_SHIFT) |
| 1039 | 1139 | #define	ID_AA64ISAR2_MOPS_VAL(x)	((x) & ID_AA64ISAR2_MOPS_MASK) |
| 1040 | 1140 | #define	 ID_AA64ISAR2_MOPS_NONE		(UL(0x0) << ID_AA64ISAR2_MOPS_SHIFT) |
| 1041 | 1141 | #define	 ID_AA64ISAR2_MOPS_IMPL		(UL(0x1) << ID_AA64ISAR2_MOPS_SHIFT) |
| 1042 | 1142 | #define	ID_AA64ISAR2_BC_SHIFT		20 |
| 1143 | #define	ID_AA64ISAR2_BC_WIDTH		4 | |
| 1043 | 1144 | #define	ID_AA64ISAR2_BC_MASK		(UL(0xf) << ID_AA64ISAR2_BC_SHIFT) |
| 1044 | 1145 | #define	ID_AA64ISAR2_BC_VAL(x)		((x) & ID_AA64ISAR2_BC_MASK) |
| 1045 | 1146 | #define	 ID_AA64ISAR2_BC_NONE		(UL(0x0) << ID_AA64ISAR2_BC_SHIFT) |
| 1046 | 1147 | #define	 ID_AA64ISAR2_BC_IMPL		(UL(0x1) << ID_AA64ISAR2_BC_SHIFT) |
| 1047 | #define	ID_AA64ISAR2_PAC_frac_SHIFT	28 | |
| 1148 | #define	ID_AA64ISAR2_PAC_frac_SHIFT	24 | |
| 1149 | #define	ID_AA64ISAR2_PAC_frac_WIDTH	4 | |
| 1048 | 1150 | #define	ID_AA64ISAR2_PAC_frac_MASK	(UL(0xf) << ID_AA64ISAR2_PAC_frac_SHIFT) |
| 1049 | 1151 | #define	ID_AA64ISAR2_PAC_frac_VAL(x)	((x) & ID_AA64ISAR2_PAC_frac_MASK) |
| 1050 | 1152 | #define	 ID_AA64ISAR2_PAC_frac_NONE	(UL(0x0) << ID_AA64ISAR2_PAC_frac_SHIFT) |
| 1051 | 1153 | #define	 ID_AA64ISAR2_PAC_frac_IMPL	(UL(0x1) << ID_AA64ISAR2_PAC_frac_SHIFT) |
| 1154 | #define	ID_AA64ISAR2_CLRBHB_SHIFT	28 | |
| 1155 | #define	ID_AA64ISAR2_CLRBHB_WIDTH	4 | |
| 1156 | #define	ID_AA64ISAR2_CLRBHB_MASK	(UL(0xf) << ID_AA64ISAR2_CLRBHB_SHIFT) | |
| 1157 | #define	ID_AA64ISAR2_CLRBHB_VAL(x)	((x) & ID_AA64ISAR2_CLRBHB_MASK) | |
| 1158 | #define	 ID_AA64ISAR2_CLRBHB_NONE	(UL(0x0) << ID_AA64ISAR2_CLRBHB_SHIFT) | |
| 1159 | #define	 ID_AA64ISAR2_CLRBHB_IMPL	(UL(0x1) << ID_AA64ISAR2_CLRBHB_SHIFT) | |
| 1160 | #define	ID_AA64ISAR2_PRFMSLC_SHIFT	40 | |
| 1161 | #define	ID_AA64ISAR2_PRFMSLC_WIDTH	4 | |
| 1162 | #define	ID_AA64ISAR2_PRFMSLC_MASK	(UL(0xf) << ID_AA64ISAR2_PRFMSLC_SHIFT) | |
| 1163 | #define	ID_AA64ISAR2_PRFMSLC_VAL(x)	((x) & ID_AA64ISAR2_PRFMSLC_MASK) | |
| 1164 | #define	ID_AA64ISAR2_PRFMSLC_NONE	(UL(0x0) << ID_AA64ISAR2_PRFMSLC_SHIFT) | |
| 1165 | #define	ID_AA64ISAR2_PRFMSLC_IMPL	(UL(0x1) << ID_AA64ISAR2_PRFMSLC_SHIFT) | |
| 1166 | #define	ID_AA64ISAR2_RPRFM_SHIFT	48 | |
| 1167 | #define	ID_AA64ISAR2_RPRFM_WIDTH	4 | |
| 1168 | #define	ID_AA64ISAR2_RPRFM_MASK		(UL(0xf) << ID_AA64ISAR2_RPRFM_SHIFT) | |
| 1169 | #define	ID_AA64ISAR2_RPRFM_VAL(x)	((x) & ID_AA64ISAR2_RPRFM_MASK) | |
| 1170 | #define	ID_AA64ISAR2_RPRFM_NONE		(UL(0x0) << ID_AA64ISAR2_RPRFM_SHIFT) | |
| 1171 | #define	ID_AA64ISAR2_RPRFM_IMPL		(UL(0x1) << ID_AA64ISAR2_RPRFM_SHIFT) | |
| 1172 | #define	ID_AA64ISAR2_CSSC_SHIFT		52 | |
| 1173 | #define	ID_AA64ISAR2_CSSC_WIDTH		4 | |
| 1174 | #define	ID_AA64ISAR2_CSSC_MASK		(UL(0xf) << ID_AA64ISAR2_CSSC_SHIFT) | |
| 1175 | #define	ID_AA64ISAR2_CSSC_VAL(x)	((x) & ID_AA64ISAR2_CSSC_MASK) | |
| 1176 | #define	 ID_AA64ISAR2_CSSC_NONE		(UL(0x0) << ID_AA64ISAR2_CSSC_SHIFT) | |
| 1177 | #define	 ID_AA64ISAR2_CSSC_IMPL		(UL(0x1) << ID_AA64ISAR2_CSSC_SHIFT) | |
| 1178 | #define	ID_AA64ISAR2_ATS1A_SHIFT	60 | |
| 1179 | #define	ID_AA64ISAR2_ATS1A_WIDTH	4 | |
| 1180 | #define	ID_AA64ISAR2_ATS1A_MASK	(UL(0xf) << ID_AA64ISAR2_ATS1A_SHIFT) | |
| 1181 | #define	ID_AA64ISAR2_ATS1A_VAL(x)	((x) & ID_AA64ISAR2_ATS1A_MASK) | |
| 1182 | #define	 ID_AA64ISAR2_ATS1A_NONE	(UL(0x0) << ID_AA64ISAR2_ATS1A_SHIFT) | |
| 1183 | #define	 ID_AA64ISAR2_ATS1A_IMPL	(UL(0x1) << ID_AA64ISAR2_ATS1A_SHIFT) | |
| 1052 | 1184 | |
| 1053 | 1185 | /* ID_AA64MMFR0_EL1 */ |
| 1054 | #define	ID_AA64MMFR0_EL1		MRS_REG(ID_AA64MMFR0_EL1) | |
| 1055 | 1186 | #define	ID_AA64MMFR0_EL1_REG		MRS_REG_ALT_NAME(ID_AA64MMFR0_EL1) |
| 1187 | #define	ID_AA64MMFR0_EL1_ISS		ISS_MSR_REG(ID_AA64MMFR0_EL1) | |
| 1056 | 1188 | #define	ID_AA64MMFR0_EL1_op0		3 |
| 1057 | 1189 | #define	ID_AA64MMFR0_EL1_op1		0 |
| 1058 | 1190 | #define	ID_AA64MMFR0_EL1_CRn		0 |
| 1059 | 1191 | #define	ID_AA64MMFR0_EL1_CRm		7 |
| 1060 | 1192 | #define	ID_AA64MMFR0_EL1_op2		0 |
| 1061 | 1193 | #define	ID_AA64MMFR0_PARange_SHIFT	0 |
| 1194 | #define	ID_AA64MMFR0_PARange_WIDTH	4 | |
| 1062 | 1195 | #define	ID_AA64MMFR0_PARange_MASK	(UL(0xf) << ID_AA64MMFR0_PARange_SHIFT) |
| 1063 | 1196 | #define	ID_AA64MMFR0_PARange_VAL(x)	((x) & ID_AA64MMFR0_PARange_MASK) |
| 1064 | 1197 | #define	 ID_AA64MMFR0_PARange_4G	(UL(0x0) << ID_AA64MMFR0_PARange_SHIFT) |
| ... | ... | @@ -1069,43 +1202,51 @@ |
| 1069 | 1202 | #define	 ID_AA64MMFR0_PARange_256T	(UL(0x5) << ID_AA64MMFR0_PARange_SHIFT) |
| 1070 | 1203 | #define	 ID_AA64MMFR0_PARange_4P	(UL(0x6) << ID_AA64MMFR0_PARange_SHIFT) |
| 1071 | 1204 | #define	ID_AA64MMFR0_ASIDBits_SHIFT	4 |
| 1205 | #define	ID_AA64MMFR0_ASIDBits_WIDTH	4 | |
| 1072 | 1206 | #define	ID_AA64MMFR0_ASIDBits_MASK	(UL(0xf) << ID_AA64MMFR0_ASIDBits_SHIFT) |
| 1073 | 1207 | #define	ID_AA64MMFR0_ASIDBits_VAL(x)	((x) & ID_AA64MMFR0_ASIDBits_MASK) |
| 1074 | 1208 | #define	 ID_AA64MMFR0_ASIDBits_8	(UL(0x0) << ID_AA64MMFR0_ASIDBits_SHIFT) |
| 1075 | 1209 | #define	 ID_AA64MMFR0_ASIDBits_16	(UL(0x2) << ID_AA64MMFR0_ASIDBits_SHIFT) |
| 1076 | 1210 | #define	ID_AA64MMFR0_BigEnd_SHIFT	8 |
| 1211 | #define	ID_AA64MMFR0_BigEnd_WIDTH	4 | |
| 1077 | 1212 | #define	ID_AA64MMFR0_BigEnd_MASK	(UL(0xf) << ID_AA64MMFR0_BigEnd_SHIFT) |
| 1078 | 1213 | #define	ID_AA64MMFR0_BigEnd_VAL(x)	((x) & ID_AA64MMFR0_BigEnd_MASK) |
| 1079 | 1214 | #define	 ID_AA64MMFR0_BigEnd_FIXED	(UL(0x0) << ID_AA64MMFR0_BigEnd_SHIFT) |
| 1080 | 1215 | #define	 ID_AA64MMFR0_BigEnd_MIXED	(UL(0x1) << ID_AA64MMFR0_BigEnd_SHIFT) |
| 1081 | 1216 | #define	ID_AA64MMFR0_SNSMem_SHIFT	12 |
| 1217 | #define	ID_AA64MMFR0_SNSMem_WIDTH	4 | |
| 1082 | 1218 | #define	ID_AA64MMFR0_SNSMem_MASK	(UL(0xf) << ID_AA64MMFR0_SNSMem_SHIFT) |
| 1083 | 1219 | #define	ID_AA64MMFR0_SNSMem_VAL(x)	((x) & ID_AA64MMFR0_SNSMem_MASK) |
| 1084 | 1220 | #define	 ID_AA64MMFR0_SNSMem_NONE	(UL(0x0) << ID_AA64MMFR0_SNSMem_SHIFT) |
| 1085 | 1221 | #define	 ID_AA64MMFR0_SNSMem_DISTINCT	(UL(0x1) << ID_AA64MMFR0_SNSMem_SHIFT) |
| 1086 | 1222 | #define	ID_AA64MMFR0_BigEndEL0_SHIFT	16 |
| 1223 | #define	ID_AA64MMFR0_BigEndEL0_WIDTH	4 | |
| 1087 | 1224 | #define	ID_AA64MMFR0_BigEndEL0_MASK	(UL(0xf) << ID_AA64MMFR0_BigEndEL0_SHIFT) |
| 1088 | 1225 | #define	ID_AA64MMFR0_BigEndEL0_VAL(x)	((x) & ID_AA64MMFR0_BigEndEL0_MASK) |
| 1089 | 1226 | #define	 ID_AA64MMFR0_BigEndEL0_FIXED	(UL(0x0) << ID_AA64MMFR0_BigEndEL0_SHIFT) |
| 1090 | 1227 | #define	 ID_AA64MMFR0_BigEndEL0_MIXED	(UL(0x1) << ID_AA64MMFR0_BigEndEL0_SHIFT) |
| 1091 | 1228 | #define	ID_AA64MMFR0_TGran16_SHIFT	20 |
| 1229 | #define	ID_AA64MMFR0_TGran16_WIDTH	4 | |
| 1092 | 1230 | #define	ID_AA64MMFR0_TGran16_MASK	(UL(0xf) << ID_AA64MMFR0_TGran16_SHIFT) |
| 1093 | 1231 | #define	ID_AA64MMFR0_TGran16_VAL(x)	((x) & ID_AA64MMFR0_TGran16_MASK) |
| 1094 | 1232 | #define	 ID_AA64MMFR0_TGran16_NONE	(UL(0x0) << ID_AA64MMFR0_TGran16_SHIFT) |
| 1095 | 1233 | #define	 ID_AA64MMFR0_TGran16_IMPL	(UL(0x1) << ID_AA64MMFR0_TGran16_SHIFT) |
| 1096 | 1234 | #define	 ID_AA64MMFR0_TGran16_LPA2	(UL(0x2) << ID_AA64MMFR0_TGran16_SHIFT) |
| 1097 | 1235 | #define	ID_AA64MMFR0_TGran64_SHIFT	24 |
| 1236 | #define	ID_AA64MMFR0_TGran64_WIDTH	4 | |
| 1098 | 1237 | #define	ID_AA64MMFR0_TGran64_MASK	(UL(0xf) << ID_AA64MMFR0_TGran64_SHIFT) |
| 1099 | 1238 | #define	ID_AA64MMFR0_TGran64_VAL(x)	((x) & ID_AA64MMFR0_TGran64_MASK) |
| 1100 | 1239 | #define	 ID_AA64MMFR0_TGran64_IMPL	(UL(0x0) << ID_AA64MMFR0_TGran64_SHIFT) |
| 1101 | 1240 | #define	 ID_AA64MMFR0_TGran64_NONE	(UL(0xf) << ID_AA64MMFR0_TGran64_SHIFT) |
| 1102 | 1241 | #define	ID_AA64MMFR0_TGran4_SHIFT	28 |
| 1242 | #define	ID_AA64MMFR0_TGran4_WIDTH	4 | |
| 1103 | 1243 | #define	ID_AA64MMFR0_TGran4_MASK	(UL(0xf) << ID_AA64MMFR0_TGran4_SHIFT) |
| 1104 | 1244 | #define	ID_AA64MMFR0_TGran4_VAL(x)	((x) & ID_AA64MMFR0_TGran4_MASK) |
| 1105 | 1245 | #define	 ID_AA64MMFR0_TGran4_IMPL	(UL(0x0) << ID_AA64MMFR0_TGran4_SHIFT) |
| 1106 | 1246 | #define	 ID_AA64MMFR0_TGran4_LPA2	(UL(0x1) << ID_AA64MMFR0_TGran4_SHIFT) |
| 1107 | 1247 | #define	 ID_AA64MMFR0_TGran4_NONE	(UL(0xf) << ID_AA64MMFR0_TGran4_SHIFT) |
| 1108 | 1248 | #define	ID_AA64MMFR0_TGran16_2_SHIFT	32 |
| 1249 | #define	ID_AA64MMFR0_TGran16_2_WIDTH	4 | |
| 1109 | 1250 | #define	ID_AA64MMFR0_TGran16_2_MASK	(UL(0xf) << ID_AA64MMFR0_TGran16_2_SHIFT) |
| 1110 | 1251 | #define	ID_AA64MMFR0_TGran16_2_VAL(x)	((x) & ID_AA64MMFR0_TGran16_2_MASK) |
| 1111 | 1252 | #define	 ID_AA64MMFR0_TGran16_2_TGran16	(UL(0x0) << ID_AA64MMFR0_TGran16_2_SHIFT) |
| ... | ... | @@ -1113,12 +1254,14 @@ |
| 1113 | 1254 | #define	 ID_AA64MMFR0_TGran16_2_IMPL	(UL(0x2) << ID_AA64MMFR0_TGran16_2_SHIFT) |
| 1114 | 1255 | #define	 ID_AA64MMFR0_TGran16_2_LPA2	(UL(0x3) << ID_AA64MMFR0_TGran16_2_SHIFT) |
| 1115 | 1256 | #define	ID_AA64MMFR0_TGran64_2_SHIFT	36 |
| 1257 | #define	ID_AA64MMFR0_TGran64_2_WIDTH	4 | |
| 1116 | 1258 | #define	ID_AA64MMFR0_TGran64_2_MASK	(UL(0xf) << ID_AA64MMFR0_TGran64_2_SHIFT) |
| 1117 | 1259 | #define	ID_AA64MMFR0_TGran64_2_VAL(x)	((x) & ID_AA64MMFR0_TGran64_2_MASK) |
| 1118 | 1260 | #define	 ID_AA64MMFR0_TGran64_2_TGran64	(UL(0x0) << ID_AA64MMFR0_TGran64_2_SHIFT) |
| 1119 | 1261 | #define	 ID_AA64MMFR0_TGran64_2_NONE	(UL(0x1) << ID_AA64MMFR0_TGran64_2_SHIFT) |
| 1120 | 1262 | #define	 ID_AA64MMFR0_TGran64_2_IMPL	(UL(0x2) << ID_AA64MMFR0_TGran64_2_SHIFT) |
| 1121 | 1263 | #define	ID_AA64MMFR0_TGran4_2_SHIFT	40 |
| 1264 | #define	ID_AA64MMFR0_TGran4_2_WIDTH	4 | |
| 1122 | 1265 | #define	ID_AA64MMFR0_TGran4_2_MASK	(UL(0xf) << ID_AA64MMFR0_TGran4_2_SHIFT) |
| 1123 | 1266 | #define	ID_AA64MMFR0_TGran4_2_VAL(x)	((x) & ID_AA64MMFR0_TGran4_2_MASK) |
| 1124 | 1267 | #define	 ID_AA64MMFR0_TGran4_2_TGran4	(UL(0x0) << ID_AA64MMFR0_TGran4_2_SHIFT) |
| ... | ... | @@ -1126,229 +1269,328 @@ |
| 1126 | 1269 | #define	 ID_AA64MMFR0_TGran4_2_IMPL	(UL(0x2) << ID_AA64MMFR0_TGran4_2_SHIFT) |
| 1127 | 1270 | #define	 ID_AA64MMFR0_TGran4_2_LPA2	(UL(0x3) << ID_AA64MMFR0_TGran4_2_SHIFT) |
| 1128 | 1271 | #define	ID_AA64MMFR0_ExS_SHIFT		44 |
| 1272 | #define	ID_AA64MMFR0_ExS_WIDTH		4 | |
| 1129 | 1273 | #define	ID_AA64MMFR0_ExS_MASK		(UL(0xf) << ID_AA64MMFR0_ExS_SHIFT) |
| 1130 | 1274 | #define	ID_AA64MMFR0_ExS_VAL(x)		((x) & ID_AA64MMFR0_ExS_MASK) |
| 1131 | 1275 | #define	 ID_AA64MMFR0_ExS_ALL		(UL(0x0) << ID_AA64MMFR0_ExS_SHIFT) |
| 1132 | 1276 | #define	 ID_AA64MMFR0_ExS_IMPL		(UL(0x1) << ID_AA64MMFR0_ExS_SHIFT) |
| 1133 | 1277 | #define	ID_AA64MMFR0_FGT_SHIFT		56 |
| 1278 | #define	ID_AA64MMFR0_FGT_WIDTH		4 | |
| 1134 | 1279 | #define	ID_AA64MMFR0_FGT_MASK		(UL(0xf) << ID_AA64MMFR0_FGT_SHIFT) |
| 1135 | 1280 | #define	ID_AA64MMFR0_FGT_VAL(x)		((x) & ID_AA64MMFR0_FGT_MASK) |
| 1136 | 1281 | #define	 ID_AA64MMFR0_FGT_NONE		(UL(0x0) << ID_AA64MMFR0_FGT_SHIFT) |
| 1137 | #define	 ID_AA64MMFR0_FGT_IMPL		(UL(0x1) << ID_AA64MMFR0_FGT_SHIFT) | |
| 1282 | #define	 ID_AA64MMFR0_FGT_8_6		(UL(0x1) << ID_AA64MMFR0_FGT_SHIFT) | |
| 1283 | #define	 ID_AA64MMFR0_FGT_8_9		(UL(0x2) << ID_AA64MMFR0_FGT_SHIFT) | |
| 1138 | 1284 | #define	ID_AA64MMFR0_ECV_SHIFT		60 |
| 1285 | #define	ID_AA64MMFR0_ECV_WIDTH		4 | |
| 1139 | 1286 | #define	ID_AA64MMFR0_ECV_MASK		(UL(0xf) << ID_AA64MMFR0_ECV_SHIFT) |
| 1140 | 1287 | #define	ID_AA64MMFR0_ECV_VAL(x)		((x) & ID_AA64MMFR0_ECV_MASK) |
| 1141 | 1288 | #define	 ID_AA64MMFR0_ECV_NONE		(UL(0x0) << ID_AA64MMFR0_ECV_SHIFT) |
| 1142 | 1289 | #define	 ID_AA64MMFR0_ECV_IMPL		(UL(0x1) << ID_AA64MMFR0_ECV_SHIFT) |
| 1143 | #define	 ID_AA64MMFR0_ECV_CNTHCTL	(UL(0x2) << ID_AA64MMFR0_ECV_SHIFT) | |
| 1290 | #define	 ID_AA64MMFR0_ECV_POFF		(UL(0x2) << ID_AA64MMFR0_ECV_SHIFT) | |
| 1144 | 1291 | |
| 1145 | 1292 | /* ID_AA64MMFR1_EL1 */ |
| 1146 | #define	ID_AA64MMFR1_EL1		MRS_REG(ID_AA64MMFR1_EL1) | |
| 1147 | 1293 | #define	ID_AA64MMFR1_EL1_REG		MRS_REG_ALT_NAME(ID_AA64MMFR1_EL1) |
| 1294 | #define	ID_AA64MMFR1_EL1_ISS		ISS_MSR_REG(ID_AA64MMFR1_EL1) | |
| 1148 | 1295 | #define	ID_AA64MMFR1_EL1_op0		3 |
| 1149 | 1296 | #define	ID_AA64MMFR1_EL1_op1		0 |
| 1150 | 1297 | #define	ID_AA64MMFR1_EL1_CRn		0 |
| 1151 | 1298 | #define	ID_AA64MMFR1_EL1_CRm		7 |
| 1152 | 1299 | #define	ID_AA64MMFR1_EL1_op2		1 |
| 1153 | 1300 | #define	ID_AA64MMFR1_HAFDBS_SHIFT	0 |
| 1301 | #define	ID_AA64MMFR1_HAFDBS_WIDTH	4 | |
| 1154 | 1302 | #define	ID_AA64MMFR1_HAFDBS_MASK	(UL(0xf) << ID_AA64MMFR1_HAFDBS_SHIFT) |
| 1155 | 1303 | #define	ID_AA64MMFR1_HAFDBS_VAL(x)	((x) & ID_AA64MMFR1_HAFDBS_MASK) |
| 1156 | 1304 | #define	 ID_AA64MMFR1_HAFDBS_NONE	(UL(0x0) << ID_AA64MMFR1_HAFDBS_SHIFT) |
| 1157 | 1305 | #define	 ID_AA64MMFR1_HAFDBS_AF		(UL(0x1) << ID_AA64MMFR1_HAFDBS_SHIFT) |
| 1158 | 1306 | #define	 ID_AA64MMFR1_HAFDBS_AF_DBS	(UL(0x2) << ID_AA64MMFR1_HAFDBS_SHIFT) |
| 1159 | 1307 | #define	ID_AA64MMFR1_VMIDBits_SHIFT	4 |
| 1308 | #define	ID_AA64MMFR1_VMIDBits_WIDTH	4 | |
| 1160 | 1309 | #define	ID_AA64MMFR1_VMIDBits_MASK	(UL(0xf) << ID_AA64MMFR1_VMIDBits_SHIFT) |
| 1161 | 1310 | #define	ID_AA64MMFR1_VMIDBits_VAL(x)	((x) & ID_AA64MMFR1_VMIDBits_MASK) |
| 1162 | 1311 | #define	 ID_AA64MMFR1_VMIDBits_8	(UL(0x0) << ID_AA64MMFR1_VMIDBits_SHIFT) |
| 1163 | 1312 | #define	 ID_AA64MMFR1_VMIDBits_16	(UL(0x2) << ID_AA64MMFR1_VMIDBits_SHIFT) |
| 1164 | 1313 | #define	ID_AA64MMFR1_VH_SHIFT		8 |
| 1314 | #define	ID_AA64MMFR1_VH_WIDTH		4 | |
| 1165 | 1315 | #define	ID_AA64MMFR1_VH_MASK		(UL(0xf) << ID_AA64MMFR1_VH_SHIFT) |
| 1166 | 1316 | #define	ID_AA64MMFR1_VH_VAL(x)		((x) & ID_AA64MMFR1_VH_MASK) |
| 1167 | 1317 | #define	 ID_AA64MMFR1_VH_NONE		(UL(0x0) << ID_AA64MMFR1_VH_SHIFT) |
| 1168 | 1318 | #define	 ID_AA64MMFR1_VH_IMPL		(UL(0x1) << ID_AA64MMFR1_VH_SHIFT) |
| 1169 | 1319 | #define	ID_AA64MMFR1_HPDS_SHIFT		12 |
| 1320 | #define	ID_AA64MMFR1_HPDS_WIDTH		4 | |
| 1170 | 1321 | #define	ID_AA64MMFR1_HPDS_MASK		(UL(0xf) << ID_AA64MMFR1_HPDS_SHIFT) |
| 1171 | 1322 | #define	ID_AA64MMFR1_HPDS_VAL(x)	((x) & ID_AA64MMFR1_HPDS_MASK) |
| 1172 | 1323 | #define	 ID_AA64MMFR1_HPDS_NONE		(UL(0x0) << ID_AA64MMFR1_HPDS_SHIFT) |
| 1173 | 1324 | #define	 ID_AA64MMFR1_HPDS_HPD		(UL(0x1) << ID_AA64MMFR1_HPDS_SHIFT) |
| 1174 | 1325 | #define	 ID_AA64MMFR1_HPDS_TTPBHA	(UL(0x2) << ID_AA64MMFR1_HPDS_SHIFT) |
| 1175 | 1326 | #define	ID_AA64MMFR1_LO_SHIFT		16 |
| 1327 | #define	ID_AA64MMFR1_LO_WIDTH		4 | |
| 1176 | 1328 | #define	ID_AA64MMFR1_LO_MASK		(UL(0xf) << ID_AA64MMFR1_LO_SHIFT) |
| 1177 | 1329 | #define	ID_AA64MMFR1_LO_VAL(x)		((x) & ID_AA64MMFR1_LO_MASK) |
| 1178 | 1330 | #define	 ID_AA64MMFR1_LO_NONE		(UL(0x0) << ID_AA64MMFR1_LO_SHIFT) |
| 1179 | 1331 | #define	 ID_AA64MMFR1_LO_IMPL		(UL(0x1) << ID_AA64MMFR1_LO_SHIFT) |
| 1180 | 1332 | #define	ID_AA64MMFR1_PAN_SHIFT		20 |
| 1333 | #define	ID_AA64MMFR1_PAN_WIDTH		4 | |
| 1181 | 1334 | #define	ID_AA64MMFR1_PAN_MASK		(UL(0xf) << ID_AA64MMFR1_PAN_SHIFT) |
| 1182 | 1335 | #define	ID_AA64MMFR1_PAN_VAL(x)		((x) & ID_AA64MMFR1_PAN_MASK) |
| 1183 | 1336 | #define	 ID_AA64MMFR1_PAN_NONE		(UL(0x0) << ID_AA64MMFR1_PAN_SHIFT) |
| 1184 | 1337 | #define	 ID_AA64MMFR1_PAN_IMPL		(UL(0x1) << ID_AA64MMFR1_PAN_SHIFT) |
| 1185 | 1338 | #define	 ID_AA64MMFR1_PAN_ATS1E1	(UL(0x2) << ID_AA64MMFR1_PAN_SHIFT) |
| 1186 | #define	 ID_AA64MMFR1_PAN_EPAN		(UL(0x2) << ID_AA64MMFR1_PAN_SHIFT) | |
| 1339 | #define	 ID_AA64MMFR1_PAN_EPAN		(UL(0x3) << ID_AA64MMFR1_PAN_SHIFT) | |
| 1187 | 1340 | #define	ID_AA64MMFR1_SpecSEI_SHIFT	24 |
| 1341 | #define	ID_AA64MMFR1_SpecSEI_WIDTH	4 | |
| 1188 | 1342 | #define	ID_AA64MMFR1_SpecSEI_MASK	(UL(0xf) << ID_AA64MMFR1_SpecSEI_SHIFT) |
| 1189 | 1343 | #define	ID_AA64MMFR1_SpecSEI_VAL(x)	((x) & ID_AA64MMFR1_SpecSEI_MASK) |
| 1190 | 1344 | #define	 ID_AA64MMFR1_SpecSEI_NONE	(UL(0x0) << ID_AA64MMFR1_SpecSEI_SHIFT) |
| 1191 | 1345 | #define	 ID_AA64MMFR1_SpecSEI_IMPL	(UL(0x1) << ID_AA64MMFR1_SpecSEI_SHIFT) |
| 1192 | 1346 | #define	ID_AA64MMFR1_XNX_SHIFT		28 |
| 1347 | #define	ID_AA64MMFR1_XNX_WIDTH		4 | |
| 1193 | 1348 | #define	ID_AA64MMFR1_XNX_MASK		(UL(0xf) << ID_AA64MMFR1_XNX_SHIFT) |
| 1194 | 1349 | #define	ID_AA64MMFR1_XNX_VAL(x)		((x) & ID_AA64MMFR1_XNX_MASK) |
| 1195 | 1350 | #define	 ID_AA64MMFR1_XNX_NONE		(UL(0x0) << ID_AA64MMFR1_XNX_SHIFT) |
| 1196 | 1351 | #define	 ID_AA64MMFR1_XNX_IMPL		(UL(0x1) << ID_AA64MMFR1_XNX_SHIFT) |
| 1197 | 1352 | #define	ID_AA64MMFR1_TWED_SHIFT		32 |
| 1353 | #define	ID_AA64MMFR1_TWED_WIDTH		4 | |
| 1198 | 1354 | #define	ID_AA64MMFR1_TWED_MASK		(UL(0xf) << ID_AA64MMFR1_TWED_SHIFT) |
| 1199 | 1355 | #define	ID_AA64MMFR1_TWED_VAL(x)	((x) & ID_AA64MMFR1_TWED_MASK) |
| 1200 | 1356 | #define	 ID_AA64MMFR1_TWED_NONE		(UL(0x0) << ID_AA64MMFR1_TWED_SHIFT) |
| 1201 | 1357 | #define	 ID_AA64MMFR1_TWED_IMPL		(UL(0x1) << ID_AA64MMFR1_TWED_SHIFT) |
| 1202 | 1358 | #define	ID_AA64MMFR1_ETS_SHIFT		36 |
| 1359 | #define	ID_AA64MMFR1_ETS_WIDTH		4 | |
| 1203 | 1360 | #define	ID_AA64MMFR1_ETS_MASK		(UL(0xf) << ID_AA64MMFR1_ETS_SHIFT) |
| 1204 | 1361 | #define	ID_AA64MMFR1_ETS_VAL(x)		((x) & ID_AA64MMFR1_ETS_MASK) |
| 1205 | 1362 | #define	 ID_AA64MMFR1_ETS_NONE		(UL(0x0) << ID_AA64MMFR1_ETS_SHIFT) |
| 1206 | #define	 ID_AA64MMFR1_ETS_IMPL		(UL(0x1) << ID_AA64MMFR1_ETS_SHIFT) | |
| 1363 | #define	 ID_AA64MMFR1_ETS_NONE2		(UL(0x1) << ID_AA64MMFR1_ETS_SHIFT) | |
| 1364 | #define	 ID_AA64MMFR1_ETS_IMPL		(UL(0x2) << ID_AA64MMFR1_ETS_SHIFT) | |
| 1207 | 1365 | #define	ID_AA64MMFR1_HCX_SHIFT		40 |
| 1366 | #define	ID_AA64MMFR1_HCX_WIDTH		4 | |
| 1208 | 1367 | #define	ID_AA64MMFR1_HCX_MASK		(UL(0xf) << ID_AA64MMFR1_HCX_SHIFT) |
| 1209 | 1368 | #define	ID_AA64MMFR1_HCX_VAL(x)		((x) & ID_AA64MMFR1_HCX_MASK) |
| 1210 | 1369 | #define	 ID_AA64MMFR1_HCX_NONE		(UL(0x0) << ID_AA64MMFR1_HCX_SHIFT) |
| 1211 | 1370 | #define	 ID_AA64MMFR1_HCX_IMPL		(UL(0x1) << ID_AA64MMFR1_HCX_SHIFT) |
| 1212 | 1371 | #define	ID_AA64MMFR1_AFP_SHIFT		44 |
| 1372 | #define	ID_AA64MMFR1_AFP_WIDTH		4 | |
| 1213 | 1373 | #define	ID_AA64MMFR1_AFP_MASK		(UL(0xf) << ID_AA64MMFR1_AFP_SHIFT) |
| 1214 | 1374 | #define	ID_AA64MMFR1_AFP_VAL(x)		((x) & ID_AA64MMFR1_AFP_MASK) |
| 1215 | 1375 | #define	 ID_AA64MMFR1_AFP_NONE		(UL(0x0) << ID_AA64MMFR1_AFP_SHIFT) |
| 1216 | 1376 | #define	 ID_AA64MMFR1_AFP_IMPL		(UL(0x1) << ID_AA64MMFR1_AFP_SHIFT) |
| 1217 | 1377 | #define	ID_AA64MMFR1_nTLBPA_SHIFT	48 |
| 1378 | #define	ID_AA64MMFR1_nTLBPA_WIDTH	4 | |
| 1218 | 1379 | #define	ID_AA64MMFR1_nTLBPA_MASK	(UL(0xf) << ID_AA64MMFR1_nTLBPA_SHIFT) |
| 1219 | 1380 | #define	ID_AA64MMFR1_nTLBPA_VAL(x)	((x) & ID_AA64MMFR1_nTLBPA_MASK) |
| 1220 | 1381 | #define	 ID_AA64MMFR1_nTLBPA_NONE	(UL(0x0) << ID_AA64MMFR1_nTLBPA_SHIFT) |
| 1221 | 1382 | #define	 ID_AA64MMFR1_nTLBPA_IMPL	(UL(0x1) << ID_AA64MMFR1_nTLBPA_SHIFT) |
| 1222 | 1383 | #define	ID_AA64MMFR1_TIDCP1_SHIFT	52 |
| 1384 | #define	ID_AA64MMFR1_TIDCP1_WIDTH	4 | |
| 1223 | 1385 | #define	ID_AA64MMFR1_TIDCP1_MASK	(UL(0xf) << ID_AA64MMFR1_TIDCP1_SHIFT) |
| 1224 | 1386 | #define	ID_AA64MMFR1_TIDCP1_VAL(x)	((x) & ID_AA64MMFR1_TIDCP1_MASK) |
| 1225 | 1387 | #define	 ID_AA64MMFR1_TIDCP1_NONE	(UL(0x0) << ID_AA64MMFR1_TIDCP1_SHIFT) |
| 1226 | 1388 | #define	 ID_AA64MMFR1_TIDCP1_IMPL	(UL(0x1) << ID_AA64MMFR1_TIDCP1_SHIFT) |
| 1227 | 1389 | #define	ID_AA64MMFR1_CMOVW_SHIFT	56 |
| 1390 | #define	ID_AA64MMFR1_CMOVW_WIDTH	4 | |
| 1228 | 1391 | #define	ID_AA64MMFR1_CMOVW_MASK		(UL(0xf) << ID_AA64MMFR1_CMOVW_SHIFT) |
| 1229 | 1392 | #define	ID_AA64MMFR1_CMOVW_VAL(x)	((x) & ID_AA64MMFR1_CMOVW_MASK) |
| 1230 | 1393 | #define	 ID_AA64MMFR1_CMOVW_NONE	(UL(0x0) << ID_AA64MMFR1_CMOVW_SHIFT) |
| 1231 | 1394 | #define	 ID_AA64MMFR1_CMOVW_IMPL	(UL(0x1) << ID_AA64MMFR1_CMOVW_SHIFT) |
| 1395 | #define	ID_AA64MMFR1_ECBHB_SHIFT	60 | |
| 1396 | #define	ID_AA64MMFR1_ECBHB_WIDTH	4 | |
| 1397 | #define	ID_AA64MMFR1_ECBHB_MASK		(UL(0xf) << ID_AA64MMFR1_ECBHB_SHIFT) | |
| 1398 | #define	ID_AA64MMFR1_ECBHB_VAL(x)	((x) & ID_AA64MMFR1_ECBHB_MASK) | |
| 1399 | #define	 ID_AA64MMFR1_ECBHB_NONE	(UL(0x0) << ID_AA64MMFR1_ECBHB_SHIFT) | |
| 1400 | #define	 ID_AA64MMFR1_ECBHB_IMPL	(UL(0x1) << ID_AA64MMFR1_ECBHB_SHIFT) | |
| 1232 | 1401 | |
| 1233 | 1402 | /* ID_AA64MMFR2_EL1 */ |
| 1234 | #define	ID_AA64MMFR2_EL1		MRS_REG(ID_AA64MMFR2_EL1) | |
| 1235 | 1403 | #define	ID_AA64MMFR2_EL1_REG		MRS_REG_ALT_NAME(ID_AA64MMFR2_EL1) |
| 1404 | #define	ID_AA64MMFR2_EL1_ISS		ISS_MSR_REG(ID_AA64MMFR2_EL1) | |
| 1236 | 1405 | #define	ID_AA64MMFR2_EL1_op0		3 |
| 1237 | 1406 | #define	ID_AA64MMFR2_EL1_op1		0 |
| 1238 | 1407 | #define	ID_AA64MMFR2_EL1_CRn		0 |
| 1239 | 1408 | #define	ID_AA64MMFR2_EL1_CRm		7 |
| 1240 | 1409 | #define	ID_AA64MMFR2_EL1_op2		2 |
| 1241 | 1410 | #define	ID_AA64MMFR2_CnP_SHIFT		0 |
| 1411 | #define	ID_AA64MMFR2_CnP_WIDTH		4 | |
| 1242 | 1412 | #define	ID_AA64MMFR2_CnP_MASK		(UL(0xf) << ID_AA64MMFR2_CnP_SHIFT) |
| 1243 | 1413 | #define	ID_AA64MMFR2_CnP_VAL(x)		((x) & ID_AA64MMFR2_CnP_MASK) |
| 1244 | 1414 | #define	 ID_AA64MMFR2_CnP_NONE		(UL(0x0) << ID_AA64MMFR2_CnP_SHIFT) |
| 1245 | 1415 | #define	 ID_AA64MMFR2_CnP_IMPL		(UL(0x1) << ID_AA64MMFR2_CnP_SHIFT) |
| 1246 | 1416 | #define	ID_AA64MMFR2_UAO_SHIFT		4 |
| 1417 | #define	ID_AA64MMFR2_UAO_WIDTH		4 | |
| 1247 | 1418 | #define	ID_AA64MMFR2_UAO_MASK		(UL(0xf) << ID_AA64MMFR2_UAO_SHIFT) |
| 1248 | 1419 | #define	ID_AA64MMFR2_UAO_VAL(x)		((x) & ID_AA64MMFR2_UAO_MASK) |
| 1249 | 1420 | #define	 ID_AA64MMFR2_UAO_NONE		(UL(0x0) << ID_AA64MMFR2_UAO_SHIFT) |
| 1250 | 1421 | #define	 ID_AA64MMFR2_UAO_IMPL		(UL(0x1) << ID_AA64MMFR2_UAO_SHIFT) |
| 1251 | 1422 | #define	ID_AA64MMFR2_LSM_SHIFT		8 |
| 1423 | #define	ID_AA64MMFR2_LSM_WIDTH		4 | |
| 1252 | 1424 | #define	ID_AA64MMFR2_LSM_MASK		(UL(0xf) << ID_AA64MMFR2_LSM_SHIFT) |
| 1253 | 1425 | #define	ID_AA64MMFR2_LSM_VAL(x)		((x) & ID_AA64MMFR2_LSM_MASK) |
| 1254 | 1426 | #define	 ID_AA64MMFR2_LSM_NONE		(UL(0x0) << ID_AA64MMFR2_LSM_SHIFT) |
| 1255 | 1427 | #define	 ID_AA64MMFR2_LSM_IMPL		(UL(0x1) << ID_AA64MMFR2_LSM_SHIFT) |
| 1256 | 1428 | #define	ID_AA64MMFR2_IESB_SHIFT		12 |
| 1429 | #define	ID_AA64MMFR2_IESB_WIDTH		4 | |
| 1257 | 1430 | #define	ID_AA64MMFR2_IESB_MASK		(UL(0xf) << ID_AA64MMFR2_IESB_SHIFT) |
| 1258 | 1431 | #define	ID_AA64MMFR2_IESB_VAL(x)	((x) & ID_AA64MMFR2_IESB_MASK) |
| 1259 | 1432 | #define	 ID_AA64MMFR2_IESB_NONE		(UL(0x0) << ID_AA64MMFR2_IESB_SHIFT) |
| 1260 | 1433 | #define	 ID_AA64MMFR2_IESB_IMPL		(UL(0x1) << ID_AA64MMFR2_IESB_SHIFT) |
| 1261 | 1434 | #define	ID_AA64MMFR2_VARange_SHIFT	16 |
| 1435 | #define	ID_AA64MMFR2_VARange_WIDTH	4 | |
| 1262 | 1436 | #define	ID_AA64MMFR2_VARange_MASK	(UL(0xf) << ID_AA64MMFR2_VARange_SHIFT) |
| 1263 | 1437 | #define	ID_AA64MMFR2_VARange_VAL(x)	((x) & ID_AA64MMFR2_VARange_MASK) |
| 1264 | 1438 | #define	 ID_AA64MMFR2_VARange_48	(UL(0x0) << ID_AA64MMFR2_VARange_SHIFT) |
| 1265 | 1439 | #define	 ID_AA64MMFR2_VARange_52	(UL(0x1) << ID_AA64MMFR2_VARange_SHIFT) |
| 1266 | 1440 | #define	ID_AA64MMFR2_CCIDX_SHIFT	20 |
| 1441 | #define	ID_AA64MMFR2_CCIDX_WIDTH	4 | |
| 1267 | 1442 | #define	ID_AA64MMFR2_CCIDX_MASK		(UL(0xf) << ID_AA64MMFR2_CCIDX_SHIFT) |
| 1268 | 1443 | #define	ID_AA64MMFR2_CCIDX_VAL(x)	((x) & ID_AA64MMFR2_CCIDX_MASK) |
| 1269 | 1444 | #define	 ID_AA64MMFR2_CCIDX_32		(UL(0x0) << ID_AA64MMFR2_CCIDX_SHIFT) |
| 1270 | 1445 | #define	 ID_AA64MMFR2_CCIDX_64		(UL(0x1) << ID_AA64MMFR2_CCIDX_SHIFT) |
| 1271 | 1446 | #define	ID_AA64MMFR2_NV_SHIFT		24 |
| 1447 | #define	ID_AA64MMFR2_NV_WIDTH		4 | |
| 1272 | 1448 | #define	ID_AA64MMFR2_NV_MASK		(UL(0xf) << ID_AA64MMFR2_NV_SHIFT) |
| 1273 | 1449 | #define	ID_AA64MMFR2_NV_VAL(x)		((x) & ID_AA64MMFR2_NV_MASK) |
| 1274 | 1450 | #define	 ID_AA64MMFR2_NV_NONE		(UL(0x0) << ID_AA64MMFR2_NV_SHIFT) |
| 1275 | 1451 | #define	 ID_AA64MMFR2_NV_8_3		(UL(0x1) << ID_AA64MMFR2_NV_SHIFT) |
| 1276 | 1452 | #define	 ID_AA64MMFR2_NV_8_4		(UL(0x2) << ID_AA64MMFR2_NV_SHIFT) |
| 1277 | 1453 | #define	ID_AA64MMFR2_ST_SHIFT		28 |
| 1454 | #define	ID_AA64MMFR2_ST_WIDTH		4 | |
| 1278 | 1455 | #define	ID_AA64MMFR2_ST_MASK		(UL(0xf) << ID_AA64MMFR2_ST_SHIFT) |
| 1279 | 1456 | #define	ID_AA64MMFR2_ST_VAL(x)		((x) & ID_AA64MMFR2_ST_MASK) |
| 1280 | 1457 | #define	 ID_AA64MMFR2_ST_NONE		(UL(0x0) << ID_AA64MMFR2_ST_SHIFT) |
| 1281 | 1458 | #define	 ID_AA64MMFR2_ST_IMPL		(UL(0x1) << ID_AA64MMFR2_ST_SHIFT) |
| 1282 | 1459 | #define	ID_AA64MMFR2_AT_SHIFT		32 |
| 1460 | #define	ID_AA64MMFR2_AT_WIDTH		4 | |
| 1283 | 1461 | #define	ID_AA64MMFR2_AT_MASK		(UL(0xf) << ID_AA64MMFR2_AT_SHIFT) |
| 1284 | 1462 | #define	ID_AA64MMFR2_AT_VAL(x)		((x) & ID_AA64MMFR2_AT_MASK) |
| 1285 | 1463 | #define	 ID_AA64MMFR2_AT_NONE		(UL(0x0) << ID_AA64MMFR2_AT_SHIFT) |
| 1286 | 1464 | #define	 ID_AA64MMFR2_AT_IMPL		(UL(0x1) << ID_AA64MMFR2_AT_SHIFT) |
| 1287 | 1465 | #define	ID_AA64MMFR2_IDS_SHIFT		36 |
| 1466 | #define	ID_AA64MMFR2_IDS_WIDTH		4 | |
| 1288 | 1467 | #define	ID_AA64MMFR2_IDS_MASK		(UL(0xf) << ID_AA64MMFR2_IDS_SHIFT) |
| 1289 | 1468 | #define	ID_AA64MMFR2_IDS_VAL(x)		((x) & ID_AA64MMFR2_IDS_MASK) |
| 1290 | 1469 | #define	 ID_AA64MMFR2_IDS_NONE		(UL(0x0) << ID_AA64MMFR2_IDS_SHIFT) |
| 1291 | 1470 | #define	 ID_AA64MMFR2_IDS_IMPL		(UL(0x1) << ID_AA64MMFR2_IDS_SHIFT) |
| 1292 | 1471 | #define	ID_AA64MMFR2_FWB_SHIFT		40 |
| 1472 | #define	ID_AA64MMFR2_FWB_WIDTH		4 | |
| 1293 | 1473 | #define	ID_AA64MMFR2_FWB_MASK		(UL(0xf) << ID_AA64MMFR2_FWB_SHIFT) |
| 1294 | 1474 | #define	ID_AA64MMFR2_FWB_VAL(x)		((x) & ID_AA64MMFR2_FWB_MASK) |
| 1295 | 1475 | #define	 ID_AA64MMFR2_FWB_NONE		(UL(0x0) << ID_AA64MMFR2_FWB_SHIFT) |
| 1296 | 1476 | #define	 ID_AA64MMFR2_FWB_IMPL		(UL(0x1) << ID_AA64MMFR2_FWB_SHIFT) |
| 1297 | 1477 | #define	ID_AA64MMFR2_TTL_SHIFT		48 |
| 1478 | #define	ID_AA64MMFR2_TTL_WIDTH		4 | |
| 1298 | 1479 | #define	ID_AA64MMFR2_TTL_MASK		(UL(0xf) << ID_AA64MMFR2_TTL_SHIFT) |
| 1299 | 1480 | #define	ID_AA64MMFR2_TTL_VAL(x)		((x) & ID_AA64MMFR2_TTL_MASK) |
| 1300 | 1481 | #define	 ID_AA64MMFR2_TTL_NONE		(UL(0x0) << ID_AA64MMFR2_TTL_SHIFT) |
| 1301 | 1482 | #define	 ID_AA64MMFR2_TTL_IMPL		(UL(0x1) << ID_AA64MMFR2_TTL_SHIFT) |
| 1302 | 1483 | #define	ID_AA64MMFR2_BBM_SHIFT		52 |
| 1484 | #define	ID_AA64MMFR2_BBM_WIDTH		4 | |
| 1303 | 1485 | #define	ID_AA64MMFR2_BBM_MASK		(UL(0xf) << ID_AA64MMFR2_BBM_SHIFT) |
| 1304 | 1486 | #define	ID_AA64MMFR2_BBM_VAL(x)		((x) & ID_AA64MMFR2_BBM_MASK) |
| 1305 | 1487 | #define	 ID_AA64MMFR2_BBM_LEVEL0	(UL(0x0) << ID_AA64MMFR2_BBM_SHIFT) |
| 1306 | 1488 | #define	 ID_AA64MMFR2_BBM_LEVEL1	(UL(0x1) << ID_AA64MMFR2_BBM_SHIFT) |
| 1307 | 1489 | #define	 ID_AA64MMFR2_BBM_LEVEL2	(UL(0x2) << ID_AA64MMFR2_BBM_SHIFT) |
| 1308 | 1490 | #define	ID_AA64MMFR2_EVT_SHIFT		56 |
| 1491 | #define	ID_AA64MMFR2_EVT_WIDTH		4 | |
| 1309 | 1492 | #define	ID_AA64MMFR2_EVT_MASK		(UL(0xf) << ID_AA64MMFR2_EVT_SHIFT) |
| 1310 | 1493 | #define	ID_AA64MMFR2_EVT_VAL(x)		((x) & ID_AA64MMFR2_EVT_MASK) |
| 1311 | 1494 | #define	 ID_AA64MMFR2_EVT_NONE		(UL(0x0) << ID_AA64MMFR2_EVT_SHIFT) |
| 1312 | 1495 | #define	 ID_AA64MMFR2_EVT_8_2		(UL(0x1) << ID_AA64MMFR2_EVT_SHIFT) |
| 1313 | 1496 | #define	 ID_AA64MMFR2_EVT_8_5		(UL(0x2) << ID_AA64MMFR2_EVT_SHIFT) |
| 1314 | 1497 | #define	ID_AA64MMFR2_E0PD_SHIFT		60 |
| 1498 | #define	ID_AA64MMFR2_E0PD_WIDTH		4 | |
| 1315 | 1499 | #define	ID_AA64MMFR2_E0PD_MASK		(UL(0xf) << ID_AA64MMFR2_E0PD_SHIFT) |
| 1316 | 1500 | #define	ID_AA64MMFR2_E0PD_VAL(x)	((x) & ID_AA64MMFR2_E0PD_MASK) |
| 1317 | 1501 | #define	 ID_AA64MMFR2_E0PD_NONE		(UL(0x0) << ID_AA64MMFR2_E0PD_SHIFT) |
| 1318 | 1502 | #define	 ID_AA64MMFR2_E0PD_IMPL		(UL(0x1) << ID_AA64MMFR2_E0PD_SHIFT) |
| 1319 | 1503 | |
| 1320 | 1504 | /* ID_AA64MMFR3_EL1 */ |
| 1321 | #define	ID_AA64MMFR3_EL1		MRS_REG(ID_AA64MMFR3_EL1) | |
| 1322 | 1505 | #define	ID_AA64MMFR3_EL1_REG		MRS_REG_ALT_NAME(ID_AA64MMFR3_EL1) |
| 1506 | #define	ID_AA64MMFR3_EL1_ISS		ISS_MSR_REG(ID_AA64MMFR3_EL1) | |
| 1323 | 1507 | #define	ID_AA64MMFR3_EL1_op0		3 |
| 1324 | 1508 | #define	ID_AA64MMFR3_EL1_op1		0 |
| 1325 | 1509 | #define	ID_AA64MMFR3_EL1_CRn		0 |
| 1326 | 1510 | #define	ID_AA64MMFR3_EL1_CRm		7 |
| 1327 | 1511 | #define	ID_AA64MMFR3_EL1_op2		3 |
| 1328 | 1512 | #define	ID_AA64MMFR3_TCRX_SHIFT		0 |
| 1513 | #define	ID_AA64MMFR3_TCRX_WIDTH		4 | |
| 1329 | 1514 | #define	ID_AA64MMFR3_TCRX_MASK		(UL(0xf) << ID_AA64MMFR3_TCRX_SHIFT) |
| 1330 | 1515 | #define	ID_AA64MMFR3_TCRX_VAL(x)	((x) & ID_AA64MMFR3_TCRX_MASK) |
| 1331 | 1516 | #define	 ID_AA64MMFR3_TCRX_NONE		(UL(0x0) << ID_AA64MMFR3_TCRX_SHIFT) |
| 1332 | 1517 | #define	 ID_AA64MMFR3_TCRX_IMPL		(UL(0x1) << ID_AA64MMFR3_TCRX_SHIFT) |
| 1333 | 1518 | #define	ID_AA64MMFR3_SCTLRX_SHIFT	4 |
| 1519 | #define	ID_AA64MMFR3_SCTLRX_WIDTH	4 | |
| 1334 | 1520 | #define	ID_AA64MMFR3_SCTLRX_MASK	(UL(0xf) << ID_AA64MMFR3_SCTLRX_SHIFT) |
| 1335 | 1521 | #define	ID_AA64MMFR3_SCTLRX_VAL(x)	((x) & ID_AA64MMFR3_SCTLRX_MASK) |
| 1336 | 1522 | #define	 ID_AA64MMFR3_SCTLRX_NONE	(UL(0x0) << ID_AA64MMFR3_SCTLRX_SHIFT) |
| 1337 | 1523 | #define	 ID_AA64MMFR3_SCTLRX_IMPL	(UL(0x1) << ID_AA64MMFR3_SCTLRX_SHIFT) |
| 1524 | #define	ID_AA64MMFR3_S1PIE_SHIFT	8 | |
| 1525 | #define	ID_AA64MMFR3_S1PIE_WIDTH	4 | |
| 1526 | #define	ID_AA64MMFR3_S1PIE_MASK		(UL(0xf) << ID_AA64MMFR3_S1PIE_SHIFT) | |
| 1527 | #define	ID_AA64MMFR3_S1PIE_VAL(x)	((x) & ID_AA64MMFR3_S1PIE_MASK) | |
| 1528 | #define	 ID_AA64MMFR3_S1PIE_NONE	(UL(0x0) << ID_AA64MMFR3_S1PIE_SHIFT) | |
| 1529 | #define	 ID_AA64MMFR3_S1PIE_IMPL	(UL(0x1) << ID_AA64MMFR3_S1PIE_SHIFT) | |
| 1530 | #define	ID_AA64MMFR3_S2PIE_SHIFT	12 | |
| 1531 | #define	ID_AA64MMFR3_S2PIE_WIDTH	4 | |
| 1532 | #define	ID_AA64MMFR3_S2PIE_MASK		(UL(0xf) << ID_AA64MMFR3_S2PIE_SHIFT) | |
| 1533 | #define	ID_AA64MMFR3_S2PIE_VAL(x)	((x) & ID_AA64MMFR3_S2PIE_MASK) | |
| 1534 | #define	 ID_AA64MMFR3_S2PIE_NONE	(UL(0x0) << ID_AA64MMFR3_S2PIE_SHIFT) | |
| 1535 | #define	 ID_AA64MMFR3_S2PIE_IMPL	(UL(0x1) << ID_AA64MMFR3_S2PIE_SHIFT) | |
| 1536 | #define	ID_AA64MMFR3_S1POE_SHIFT	16 | |
| 1537 | #define	ID_AA64MMFR3_S1POE_WIDTH	4 | |
| 1538 | #define	ID_AA64MMFR3_S1POE_MASK		(UL(0xf) << ID_AA64MMFR3_S1POE_SHIFT) | |
| 1539 | #define	ID_AA64MMFR3_S1POE_VAL(x)	((x) & ID_AA64MMFR3_S1POE_MASK) | |
| 1540 | #define	 ID_AA64MMFR3_S1POE_NONE	(UL(0x0) << ID_AA64MMFR3_S1POE_SHIFT) | |
| 1541 | #define	 ID_AA64MMFR3_S1POE_IMPL	(UL(0x1) << ID_AA64MMFR3_S1POE_SHIFT) | |
| 1542 | #define	ID_AA64MMFR3_S2POE_SHIFT	20 | |
| 1543 | #define	ID_AA64MMFR3_S2POE_WIDTH	4 | |
| 1544 | #define	ID_AA64MMFR3_S2POE_MASK		(UL(0xf) << ID_AA64MMFR3_S2POE_SHIFT) | |
| 1545 | #define	ID_AA64MMFR3_S2POE_VAL(x)	((x) & ID_AA64MMFR3_S2POE_MASK) | |
| 1546 | #define	 ID_AA64MMFR3_S2POE_NONE	(UL(0x0) << ID_AA64MMFR3_S2POE_SHIFT) | |
| 1547 | #define	 ID_AA64MMFR3_S2POE_IMPL	(UL(0x1) << ID_AA64MMFR3_S2POE_SHIFT) | |
| 1548 | #define	ID_AA64MMFR3_AIE_SHIFT		24 | |
| 1549 | #define	ID_AA64MMFR3_AIE_WIDTH		4 | |
| 1550 | #define	ID_AA64MMFR3_AIE_MASK		(UL(0xf) << ID_AA64MMFR3_AIE_SHIFT) | |
| 1551 | #define	ID_AA64MMFR3_AIE_VAL(x)		((x) & ID_AA64MMFR3_AIE_MASK) | |
| 1552 | #define	 ID_AA64MMFR3_AIE_NONE		(UL(0x0) << ID_AA64MMFR3_AIE_SHIFT) | |
| 1553 | #define	 ID_AA64MMFR3_AIE_IMPL		(UL(0x1) << ID_AA64MMFR3_AIE_SHIFT) | |
| 1338 | 1554 | #define	ID_AA64MMFR3_MEC_SHIFT		28 |
| 1555 | #define	ID_AA64MMFR3_MEC_WIDTH		4 | |
| 1339 | 1556 | #define	ID_AA64MMFR3_MEC_MASK		(UL(0xf) << ID_AA64MMFR3_MEC_SHIFT) |
| 1340 | 1557 | #define	ID_AA64MMFR3_MEC_VAL(x)	((x) & ID_AA64MMFR3_MEC_MASK) |
| 1341 | 1558 | #define	 ID_AA64MMFR3_MEC_NONE		(UL(0x0) << ID_AA64MMFR3_MEC_SHIFT) |
| 1342 | 1559 | #define	 ID_AA64MMFR3_MEC_IMPL		(UL(0x1) << ID_AA64MMFR3_MEC_SHIFT) |
| 1560 | #define	ID_AA64MMFR3_SNERR_SHIFT	40 | |
| 1561 | #define	ID_AA64MMFR3_SNERR_WIDTH	4 | |
| 1562 | #define	ID_AA64MMFR3_SNERR_MASK		(UL(0xf) << ID_AA64MMFR3_SNERR_SHIFT) | |
| 1563 | #define	ID_AA64MMFR3_SNERR_VAL(x)	((x) & ID_AA64MMFR3_SNERR_MASK) | |
| 1564 | #define	 ID_AA64MMFR3_SNERR_NONE	(UL(0x0) << ID_AA64MMFR3_SNERR_SHIFT) | |
| 1565 | #define	 ID_AA64MMFR3_SNERR_ALL		(UL(0x1) << ID_AA64MMFR3_SNERR_SHIFT) | |
| 1566 | #define	ID_AA64MMFR3_ANERR_SHIFT	44 | |
| 1567 | #define	ID_AA64MMFR3_ANERR_WIDTH	4 | |
| 1568 | #define	ID_AA64MMFR3_ANERR_MASK		(UL(0xf) << ID_AA64MMFR3_ANERR_SHIFT) | |
| 1569 | #define	ID_AA64MMFR3_ANERR_VAL(x)	((x) & ID_AA64MMFR3_ANERR_MASK) | |
| 1570 | #define	 ID_AA64MMFR3_ANERR_NONE	(UL(0x0) << ID_AA64MMFR3_ANERR_SHIFT) | |
| 1571 | #define	 ID_AA64MMFR3_ANERR_SOME	(UL(0x1) << ID_AA64MMFR3_ANERR_SHIFT) | |
| 1572 | #define	ID_AA64MMFR3_SDERR_SHIFT	52 | |
| 1573 | #define	ID_AA64MMFR3_SDERR_WIDTH	4 | |
| 1574 | #define	ID_AA64MMFR3_SDERR_MASK		(UL(0xf) << ID_AA64MMFR3_SDERR_SHIFT) | |
| 1575 | #define	ID_AA64MMFR3_SDERR_VAL(x)	((x) & ID_AA64MMFR3_SDERR_MASK) | |
| 1576 | #define	 ID_AA64MMFR3_SDERR_NONE	(UL(0x0) << ID_AA64MMFR3_SDERR_SHIFT) | |
| 1577 | #define	 ID_AA64MMFR3_SDERR_ALL		(UL(0x1) << ID_AA64MMFR3_SDERR_SHIFT) | |
| 1578 | #define	ID_AA64MMFR3_ADERR_SHIFT	56 | |
| 1579 | #define	ID_AA64MMFR3_ADERR_WIDTH	4 | |
| 1580 | #define	ID_AA64MMFR3_ADERR_MASK		(UL(0xf) << ID_AA64MMFR3_ADERR_SHIFT) | |
| 1581 | #define	ID_AA64MMFR3_ADERR_VAL(x)	((x) & ID_AA64MMFR3_ADERR_MASK) | |
| 1582 | #define	 ID_AA64MMFR3_ADERR_NONE	(UL(0x0) << ID_AA64MMFR3_ADERR_SHIFT) | |
| 1583 | #define	 ID_AA64MMFR3_ADERR_SOME	(UL(0x1) << ID_AA64MMFR3_ADERR_SHIFT) | |
| 1343 | 1584 | #define	ID_AA64MMFR3_Spec_FPACC_SHIFT	60 |
| 1585 | #define	ID_AA64MMFR3_Spec_FPACC_WIDTH	4 | |
| 1344 | 1586 | #define	ID_AA64MMFR3_Spec_FPACC_MASK	(UL(0xf) << ID_AA64MMFR3_Spec_FPACC_SHIFT) |
| 1345 | 1587 | #define	ID_AA64MMFR3_Spec_FPACC_VAL(x)	((x) & ID_AA64MMFR3_Spec_FPACC_MASK) |
| 1346 | 1588 | #define	 ID_AA64MMFR3_Spec_FPACC_NONE	(UL(0x0) << ID_AA64MMFR3_Spec_FPACC_SHIFT) |
| 1347 | 1589 | #define	 ID_AA64MMFR3_Spec_FPACC_IMPL	(UL(0x1) << ID_AA64MMFR3_Spec_FPACC_SHIFT) |
| 1348 | 1590 | |
| 1349 | 1591 | /* ID_AA64MMFR4_EL1 */ |
| 1350 | #define	ID_AA64MMFR4_EL1		MRS_REG(ID_AA64MMFR4_EL1) | |
| 1351 | 1592 | #define	ID_AA64MMFR4_EL1_REG		MRS_REG_ALT_NAME(ID_AA64MMFR4_EL1) |
| 1593 | #define	ID_AA64MMFR4_EL1_ISS		ISS_MSR_REG(ID_AA64MMFR4_EL1) | |
| 1352 | 1594 | #define	ID_AA64MMFR4_EL1_op0		3 |
| 1353 | 1595 | #define	ID_AA64MMFR4_EL1_op1		0 |
| 1354 | 1596 | #define	ID_AA64MMFR4_EL1_CRn		0 |
| ... | ... | @@ -1356,42 +1598,48 @@ |
| 1356 | 1598 | #define	ID_AA64MMFR4_EL1_op2		4 |
| 1357 | 1599 | |
| 1358 | 1600 | /* ID_AA64PFR0_EL1 */ |
| 1359 | #define	ID_AA64PFR0_EL1			MRS_REG(ID_AA64PFR0_EL1) | |
| 1360 | 1601 | #define	ID_AA64PFR0_EL1_REG		MRS_REG_ALT_NAME(ID_AA64PFR0_EL1) |
| 1602 | #define	ID_AA64PFR0_EL1_ISS		ISS_MSR_REG(ID_AA64PFR0_EL1) | |
| 1361 | 1603 | #define	ID_AA64PFR0_EL1_op0		3 |
| 1362 | 1604 | #define	ID_AA64PFR0_EL1_op1		0 |
| 1363 | 1605 | #define	ID_AA64PFR0_EL1_CRn		0 |
| 1364 | 1606 | #define	ID_AA64PFR0_EL1_CRm		4 |
| 1365 | 1607 | #define	ID_AA64PFR0_EL1_op2		0 |
| 1366 | 1608 | #define	ID_AA64PFR0_EL0_SHIFT		0 |
| 1609 | #define	ID_AA64PFR0_EL0_WIDTH		4 | |
| 1367 | 1610 | #define	ID_AA64PFR0_EL0_MASK		(UL(0xf) << ID_AA64PFR0_EL0_SHIFT) |
| 1368 | 1611 | #define	ID_AA64PFR0_EL0_VAL(x)		((x) & ID_AA64PFR0_EL0_MASK) |
| 1369 | 1612 | #define	 ID_AA64PFR0_EL0_64		(UL(0x1) << ID_AA64PFR0_EL0_SHIFT) |
| 1370 | 1613 | #define	 ID_AA64PFR0_EL0_64_32		(UL(0x2) << ID_AA64PFR0_EL0_SHIFT) |
| 1371 | 1614 | #define	ID_AA64PFR0_EL1_SHIFT		4 |
| 1615 | #define	ID_AA64PFR0_EL1_WIDTH		4 | |
| 1372 | 1616 | #define	ID_AA64PFR0_EL1_MASK		(UL(0xf) << ID_AA64PFR0_EL1_SHIFT) |
| 1373 | 1617 | #define	ID_AA64PFR0_EL1_VAL(x)		((x) & ID_AA64PFR0_EL1_MASK) |
| 1374 | 1618 | #define	 ID_AA64PFR0_EL1_64		(UL(0x1) << ID_AA64PFR0_EL1_SHIFT) |
| 1375 | 1619 | #define	 ID_AA64PFR0_EL1_64_32		(UL(0x2) << ID_AA64PFR0_EL1_SHIFT) |
| 1376 | 1620 | #define	ID_AA64PFR0_EL2_SHIFT		8 |
| 1621 | #define	ID_AA64PFR0_EL2_WIDTH		4 | |
| 1377 | 1622 | #define	ID_AA64PFR0_EL2_MASK		(UL(0xf) << ID_AA64PFR0_EL2_SHIFT) |
| 1378 | 1623 | #define	ID_AA64PFR0_EL2_VAL(x)		((x) & ID_AA64PFR0_EL2_MASK) |
| 1379 | 1624 | #define	 ID_AA64PFR0_EL2_NONE		(UL(0x0) << ID_AA64PFR0_EL2_SHIFT) |
| 1380 | 1625 | #define	 ID_AA64PFR0_EL2_64		(UL(0x1) << ID_AA64PFR0_EL2_SHIFT) |
| 1381 | 1626 | #define	 ID_AA64PFR0_EL2_64_32		(UL(0x2) << ID_AA64PFR0_EL2_SHIFT) |
| 1382 | 1627 | #define	ID_AA64PFR0_EL3_SHIFT		12 |
| 1628 | #define	ID_AA64PFR0_EL3_WIDTH		4 | |
| 1383 | 1629 | #define	ID_AA64PFR0_EL3_MASK		(UL(0xf) << ID_AA64PFR0_EL3_SHIFT) |
| 1384 | 1630 | #define	ID_AA64PFR0_EL3_VAL(x)		((x) & ID_AA64PFR0_EL3_MASK) |
| 1385 | 1631 | #define	 ID_AA64PFR0_EL3_NONE		(UL(0x0) << ID_AA64PFR0_EL3_SHIFT) |
| 1386 | 1632 | #define	 ID_AA64PFR0_EL3_64		(UL(0x1) << ID_AA64PFR0_EL3_SHIFT) |
| 1387 | 1633 | #define	 ID_AA64PFR0_EL3_64_32		(UL(0x2) << ID_AA64PFR0_EL3_SHIFT) |
| 1388 | 1634 | #define	ID_AA64PFR0_FP_SHIFT		16 |
| 1635 | #define	ID_AA64PFR0_FP_WIDTH		4 | |
| 1389 | 1636 | #define	ID_AA64PFR0_FP_MASK		(UL(0xf) << ID_AA64PFR0_FP_SHIFT) |
| 1390 | 1637 | #define	ID_AA64PFR0_FP_VAL(x)		((x) & ID_AA64PFR0_FP_MASK) |
| 1391 | 1638 | #define	 ID_AA64PFR0_FP_IMPL		(UL(0x0) << ID_AA64PFR0_FP_SHIFT) |
| 1392 | 1639 | #define	 ID_AA64PFR0_FP_HP		(UL(0x1) << ID_AA64PFR0_FP_SHIFT) |
| 1393 | 1640 | #define	 ID_AA64PFR0_FP_NONE		(UL(0xf) << ID_AA64PFR0_FP_SHIFT) |
| 1394 | 1641 | #define	ID_AA64PFR0_AdvSIMD_SHIFT	20 |
| 1642 | #define	ID_AA64PFR0_AdvSIMD_WIDTH	4 | |
| 1395 | 1643 | #define	ID_AA64PFR0_AdvSIMD_MASK	(UL(0xf) << ID_AA64PFR0_AdvSIMD_SHIFT) |
| 1396 | 1644 | #define	ID_AA64PFR0_AdvSIMD_VAL(x)	((x) & ID_AA64PFR0_AdvSIMD_MASK) |
| 1397 | 1645 | #define	 ID_AA64PFR0_AdvSIMD_IMPL	(UL(0x0) << ID_AA64PFR0_AdvSIMD_SHIFT) |
| ... | ... | @@ -1399,49 +1647,59 @@ |
| 1399 | 1647 | #define	 ID_AA64PFR0_AdvSIMD_NONE	(UL(0xf) << ID_AA64PFR0_AdvSIMD_SHIFT) |
| 1400 | 1648 | #define	ID_AA64PFR0_GIC_BITS		0x4 /* Number of bits in GIC field */ |
| 1401 | 1649 | #define	ID_AA64PFR0_GIC_SHIFT		24 |
| 1650 | #define	ID_AA64PFR0_GIC_WIDTH		4 | |
| 1402 | 1651 | #define	ID_AA64PFR0_GIC_MASK		(UL(0xf) << ID_AA64PFR0_GIC_SHIFT) |
| 1403 | 1652 | #define	ID_AA64PFR0_GIC_VAL(x)		((x) & ID_AA64PFR0_GIC_MASK) |
| 1404 | 1653 | #define	 ID_AA64PFR0_GIC_CPUIF_NONE	(UL(0x0) << ID_AA64PFR0_GIC_SHIFT) |
| 1405 | 1654 | #define	 ID_AA64PFR0_GIC_CPUIF_EN	(UL(0x1) << ID_AA64PFR0_GIC_SHIFT) |
| 1406 | 1655 | #define	 ID_AA64PFR0_GIC_CPUIF_4_1	(UL(0x3) << ID_AA64PFR0_GIC_SHIFT) |
| 1407 | 1656 | #define	ID_AA64PFR0_RAS_SHIFT		28 |
| 1657 | #define	ID_AA64PFR0_RAS_WIDTH		4 | |
| 1408 | 1658 | #define	ID_AA64PFR0_RAS_MASK		(UL(0xf) << ID_AA64PFR0_RAS_SHIFT) |
| 1409 | 1659 | #define	ID_AA64PFR0_RAS_VAL(x)		((x) & ID_AA64PFR0_RAS_MASK) |
| 1410 | 1660 | #define	 ID_AA64PFR0_RAS_NONE		(UL(0x0) << ID_AA64PFR0_RAS_SHIFT) |
| 1411 | 1661 | #define	 ID_AA64PFR0_RAS_IMPL		(UL(0x1) << ID_AA64PFR0_RAS_SHIFT) |
| 1412 | 1662 | #define	 ID_AA64PFR0_RAS_8_4		(UL(0x2) << ID_AA64PFR0_RAS_SHIFT) |
| 1663 | #define	 ID_AA64PFR0_RAS_8_9		(UL(0x3) << ID_AA64PFR0_RAS_SHIFT) | |
| 1413 | 1664 | #define	ID_AA64PFR0_SVE_SHIFT		32 |
| 1665 | #define	ID_AA64PFR0_SVE_WIDTH		4 | |
| 1414 | 1666 | #define	ID_AA64PFR0_SVE_MASK		(UL(0xf) << ID_AA64PFR0_SVE_SHIFT) |
| 1415 | 1667 | #define	ID_AA64PFR0_SVE_VAL(x)		((x) & ID_AA64PFR0_SVE_MASK) |
| 1416 | 1668 | #define	 ID_AA64PFR0_SVE_NONE		(UL(0x0) << ID_AA64PFR0_SVE_SHIFT) |
| 1417 | 1669 | #define	 ID_AA64PFR0_SVE_IMPL		(UL(0x1) << ID_AA64PFR0_SVE_SHIFT) |
| 1418 | 1670 | #define	ID_AA64PFR0_SEL2_SHIFT		36 |
| 1671 | #define	ID_AA64PFR0_SEL2_WIDTH		4 | |
| 1419 | 1672 | #define	ID_AA64PFR0_SEL2_MASK		(UL(0xf) << ID_AA64PFR0_SEL2_SHIFT) |
| 1420 | 1673 | #define	ID_AA64PFR0_SEL2_VAL(x)		((x) & ID_AA64PFR0_SEL2_MASK) |
| 1421 | 1674 | #define	 ID_AA64PFR0_SEL2_NONE		(UL(0x0) << ID_AA64PFR0_SEL2_SHIFT) |
| 1422 | 1675 | #define	 ID_AA64PFR0_SEL2_IMPL		(UL(0x1) << ID_AA64PFR0_SEL2_SHIFT) |
| 1423 | 1676 | #define	ID_AA64PFR0_MPAM_SHIFT		40 |
| 1677 | #define	ID_AA64PFR0_MPAM_WIDTH		4 | |
| 1424 | 1678 | #define	ID_AA64PFR0_MPAM_MASK		(UL(0xf) << ID_AA64PFR0_MPAM_SHIFT) |
| 1425 | 1679 | #define	ID_AA64PFR0_MPAM_VAL(x)		((x) & ID_AA64PFR0_MPAM_MASK) |
| 1426 | 1680 | #define	 ID_AA64PFR0_MPAM_NONE		(UL(0x0) << ID_AA64PFR0_MPAM_SHIFT) |
| 1427 | 1681 | #define	 ID_AA64PFR0_MPAM_IMPL		(UL(0x1) << ID_AA64PFR0_MPAM_SHIFT) |
| 1428 | 1682 | #define	ID_AA64PFR0_AMU_SHIFT		44 |
| 1683 | #define	ID_AA64PFR0_AMU_WIDTH		4 | |
| 1429 | 1684 | #define	ID_AA64PFR0_AMU_MASK		(UL(0xf) << ID_AA64PFR0_AMU_SHIFT) |
| 1430 | 1685 | #define	ID_AA64PFR0_AMU_VAL(x)		((x) & ID_AA64PFR0_AMU_MASK) |
| 1431 | 1686 | #define	 ID_AA64PFR0_AMU_NONE		(UL(0x0) << ID_AA64PFR0_AMU_SHIFT) |
| 1432 | 1687 | #define	 ID_AA64PFR0_AMU_V1		(UL(0x1) << ID_AA64PFR0_AMU_SHIFT) |
| 1433 | 1688 | #define	 ID_AA64PFR0_AMU_V1_1		(UL(0x2) << ID_AA64PFR0_AMU_SHIFT) |
| 1434 | 1689 | #define	ID_AA64PFR0_DIT_SHIFT		48 |
| 1690 | #define	ID_AA64PFR0_DIT_WIDTH		4 | |
| 1435 | 1691 | #define	ID_AA64PFR0_DIT_MASK		(UL(0xf) << ID_AA64PFR0_DIT_SHIFT) |
| 1436 | 1692 | #define	ID_AA64PFR0_DIT_VAL(x)		((x) & ID_AA64PFR0_DIT_MASK) |
| 1437 | 1693 | #define	 ID_AA64PFR0_DIT_NONE		(UL(0x0) << ID_AA64PFR0_DIT_SHIFT) |
| 1438 | 1694 | #define	 ID_AA64PFR0_DIT_PSTATE		(UL(0x1) << ID_AA64PFR0_DIT_SHIFT) |
| 1439 | 1695 | #define	ID_AA64PFR0_RME_SHIFT		52 |
| 1696 | #define	ID_AA64PFR0_RME_WIDTH		4 | |
| 1440 | 1697 | #define	ID_AA64PFR0_RME_MASK		(UL(0xf) << ID_AA64PFR0_RME_SHIFT) |
| 1441 | 1698 | #define	ID_AA64PFR0_RME_VAL(x)		((x) & ID_AA64PFR0_RME_MASK) |
| 1442 | 1699 | #define	 ID_AA64PFR0_RME_NONE		(UL(0x0) << ID_AA64PFR0_RME_SHIFT) |
| 1443 | 1700 | #define	 ID_AA64PFR0_RME_IMPL		(UL(0x1) << ID_AA64PFR0_RME_SHIFT) |
| 1444 | 1701 | #define	ID_AA64PFR0_CSV2_SHIFT		56 |
| 1702 | #define	ID_AA64PFR0_CSV2_WIDTH		4 | |
| 1445 | 1703 | #define	ID_AA64PFR0_CSV2_MASK		(UL(0xf) << ID_AA64PFR0_CSV2_SHIFT) |
| 1446 | 1704 | #define	ID_AA64PFR0_CSV2_VAL(x)		((x) & ID_AA64PFR0_CSV2_MASK) |
| 1447 | 1705 | #define	 ID_AA64PFR0_CSV2_NONE		(UL(0x0) << ID_AA64PFR0_CSV2_SHIFT) |
| ... | ... | @@ -1449,31 +1707,35 @@ |
| 1449 | 1707 | #define	 ID_AA64PFR0_CSV2_SCXTNUM	(UL(0x2) << ID_AA64PFR0_CSV2_SHIFT) |
| 1450 | 1708 | #define	 ID_AA64PFR0_CSV2_3		(UL(0x3) << ID_AA64PFR0_CSV2_SHIFT) |
| 1451 | 1709 | #define	ID_AA64PFR0_CSV3_SHIFT		60 |
| 1710 | #define	ID_AA64PFR0_CSV3_WIDTH		4 | |
| 1452 | 1711 | #define	ID_AA64PFR0_CSV3_MASK		(UL(0xf) << ID_AA64PFR0_CSV3_SHIFT) |
| 1453 | 1712 | #define	ID_AA64PFR0_CSV3_VAL(x)		((x) & ID_AA64PFR0_CSV3_MASK) |
| 1454 | 1713 | #define	 ID_AA64PFR0_CSV3_NONE		(UL(0x0) << ID_AA64PFR0_CSV3_SHIFT) |
| 1455 | 1714 | #define	 ID_AA64PFR0_CSV3_ISOLATED	(UL(0x1) << ID_AA64PFR0_CSV3_SHIFT) |
| 1456 | 1715 | |
| 1457 | 1716 | /* ID_AA64PFR1_EL1 */ |
| 1458 | #define	ID_AA64PFR1_EL1			MRS_REG(ID_AA64PFR1_EL1) | |
| 1459 | 1717 | #define	ID_AA64PFR1_EL1_REG		MRS_REG_ALT_NAME(ID_AA64PFR1_EL1) |
| 1718 | #define	ID_AA64PFR1_EL1_ISS		ISS_MSR_REG(ID_AA64PFR1_EL1) | |
| 1460 | 1719 | #define	ID_AA64PFR1_EL1_op0		3 |
| 1461 | 1720 | #define	ID_AA64PFR1_EL1_op1		0 |
| 1462 | 1721 | #define	ID_AA64PFR1_EL1_CRn		0 |
| 1463 | 1722 | #define	ID_AA64PFR1_EL1_CRm		4 |
| 1464 | 1723 | #define	ID_AA64PFR1_EL1_op2		1 |
| 1465 | 1724 | #define	ID_AA64PFR1_BT_SHIFT		0 |
| 1725 | #define	ID_AA64PFR1_BT_WIDTH		4 | |
| 1466 | 1726 | #define	ID_AA64PFR1_BT_MASK		(UL(0xf) << ID_AA64PFR1_BT_SHIFT) |
| 1467 | 1727 | #define	ID_AA64PFR1_BT_VAL(x)		((x) & ID_AA64PFR1_BT_MASK) |
| 1468 | 1728 | #define	 ID_AA64PFR1_BT_NONE		(UL(0x0) << ID_AA64PFR1_BT_SHIFT) |
| 1469 | 1729 | #define	 ID_AA64PFR1_BT_IMPL		(UL(0x1) << ID_AA64PFR1_BT_SHIFT) |
| 1470 | 1730 | #define	ID_AA64PFR1_SSBS_SHIFT		4 |
| 1731 | #define	ID_AA64PFR1_SSBS_WIDTH		4 | |
| 1471 | 1732 | #define	ID_AA64PFR1_SSBS_MASK		(UL(0xf) << ID_AA64PFR1_SSBS_SHIFT) |
| 1472 | 1733 | #define	ID_AA64PFR1_SSBS_VAL(x)		((x) & ID_AA64PFR1_SSBS_MASK) |
| 1473 | 1734 | #define	 ID_AA64PFR1_SSBS_NONE		(UL(0x0) << ID_AA64PFR1_SSBS_SHIFT) |
| 1474 | 1735 | #define	 ID_AA64PFR1_SSBS_PSTATE	(UL(0x1) << ID_AA64PFR1_SSBS_SHIFT) |
| 1475 | 1736 | #define	 ID_AA64PFR1_SSBS_PSTATE_MSR	(UL(0x2) << ID_AA64PFR1_SSBS_SHIFT) |
| 1476 | 1737 | #define	ID_AA64PFR1_MTE_SHIFT		8 |
| 1738 | #define	ID_AA64PFR1_MTE_WIDTH		4 | |
| 1477 | 1739 | #define	ID_AA64PFR1_MTE_MASK		(UL(0xf) << ID_AA64PFR1_MTE_SHIFT) |
| 1478 | 1740 | #define	ID_AA64PFR1_MTE_VAL(x)		((x) & ID_AA64PFR1_MTE_MASK) |
| 1479 | 1741 | #define	 ID_AA64PFR1_MTE_NONE		(UL(0x0) << ID_AA64PFR1_MTE_SHIFT) |
| ... | ... | @@ -1481,41 +1743,77 @@ |
| 1481 | 1743 | #define	 ID_AA64PFR1_MTE_MTE2		(UL(0x2) << ID_AA64PFR1_MTE_SHIFT) |
| 1482 | 1744 | #define	 ID_AA64PFR1_MTE_MTE3		(UL(0x3) << ID_AA64PFR1_MTE_SHIFT) |
| 1483 | 1745 | #define	ID_AA64PFR1_RAS_frac_SHIFT	12 |
| 1746 | #define	ID_AA64PFR1_RAS_frac_WIDTH	4 | |
| 1484 | 1747 | #define	ID_AA64PFR1_RAS_frac_MASK	(UL(0xf) << ID_AA64PFR1_RAS_frac_SHIFT) |
| 1485 | 1748 | #define	ID_AA64PFR1_RAS_frac_VAL(x)	((x) & ID_AA64PFR1_RAS_frac_MASK) |
| 1486 | 1749 | #define	 ID_AA64PFR1_RAS_frac_p0	(UL(0x0) << ID_AA64PFR1_RAS_frac_SHIFT) |
| 1487 | 1750 | #define	 ID_AA64PFR1_RAS_frac_p1	(UL(0x1) << ID_AA64PFR1_RAS_frac_SHIFT) |
| 1488 | 1751 | #define	ID_AA64PFR1_MPAM_frac_SHIFT	16 |
| 1752 | #define	ID_AA64PFR1_MPAM_frac_WIDTH	4 | |
| 1489 | 1753 | #define	ID_AA64PFR1_MPAM_frac_MASK	(UL(0xf) << ID_AA64PFR1_MPAM_frac_SHIFT) |
| 1490 | 1754 | #define	ID_AA64PFR1_MPAM_frac_VAL(x)	((x) & ID_AA64PFR1_MPAM_frac_MASK) |
| 1491 | 1755 | #define	 ID_AA64PFR1_MPAM_frac_p0	(UL(0x0) << ID_AA64PFR1_MPAM_frac_SHIFT) |
| 1492 | 1756 | #define	 ID_AA64PFR1_MPAM_frac_p1	(UL(0x1) << ID_AA64PFR1_MPAM_frac_SHIFT) |
| 1493 | 1757 | #define	ID_AA64PFR1_SME_SHIFT		24 |
| 1758 | #define	ID_AA64PFR1_SME_WIDTH		4 | |
| 1494 | 1759 | #define	ID_AA64PFR1_SME_MASK		(UL(0xf) << ID_AA64PFR1_SME_SHIFT) |
| 1495 | 1760 | #define	ID_AA64PFR1_SME_VAL(x)		((x) & ID_AA64PFR1_SME_MASK) |
| 1496 | 1761 | #define	 ID_AA64PFR1_SME_NONE		(UL(0x0) << ID_AA64PFR1_SME_SHIFT) |
| 1497 | 1762 | #define	 ID_AA64PFR1_SME_SME		(UL(0x1) << ID_AA64PFR1_SME_SHIFT) |
| 1498 | 1763 | #define	 ID_AA64PFR1_SME_SME2		(UL(0x2) << ID_AA64PFR1_SME_SHIFT) |
| 1499 | 1764 | #define	ID_AA64PFR1_RNDR_trap_SHIFT	28 |
| 1765 | #define	ID_AA64PFR1_RNDR_trap_WIDTH	4 | |
| 1500 | 1766 | #define	ID_AA64PFR1_RNDR_trap_MASK	(UL(0xf) << ID_AA64PFR1_RNDR_trap_SHIFT) |
| 1501 | 1767 | #define	ID_AA64PFR1_RNDR_trap_VAL(x)	((x) & ID_AA64PFR1_RNDR_trap_MASK) |
| 1502 | 1768 | #define	 ID_AA64PFR1_RNDR_trap_NONE	(UL(0x0) << ID_AA64PFR1_RNDR_trap_SHIFT) |
| 1503 | 1769 | #define	 ID_AA64PFR1_RNDR_trap_IMPL	(UL(0x1) << ID_AA64PFR1_RNDR_trap_SHIFT) |
| 1504 | 1770 | #define	ID_AA64PFR1_CSV2_frac_SHIFT	32 |
| 1771 | #define	ID_AA64PFR1_CSV2_frac_WIDTH	4 | |
| 1505 | 1772 | #define	ID_AA64PFR1_CSV2_frac_MASK	(UL(0xf) << ID_AA64PFR1_CSV2_frac_SHIFT) |
| 1506 | 1773 | #define	ID_AA64PFR1_CSV2_frac_VAL(x)	((x) & ID_AA64PFR1_CSV2_frac_MASK) |
| 1507 | 1774 | #define	 ID_AA64PFR1_CSV2_frac_p0	(UL(0x0) << ID_AA64PFR1_CSV2_frac_SHIFT) |
| 1508 | 1775 | #define	 ID_AA64PFR1_CSV2_frac_p1	(UL(0x1) << ID_AA64PFR1_CSV2_frac_SHIFT) |
| 1509 | 1776 | #define	 ID_AA64PFR1_CSV2_frac_p2	(UL(0x2) << ID_AA64PFR1_CSV2_frac_SHIFT) |
| 1510 | 1777 | #define	ID_AA64PFR1_NMI_SHIFT		36 |
| 1778 | #define	ID_AA64PFR1_NMI_WIDTH		4 | |
| 1511 | 1779 | #define	ID_AA64PFR1_NMI_MASK		(UL(0xf) << ID_AA64PFR1_NMI_SHIFT) |
| 1512 | 1780 | #define	ID_AA64PFR1_NMI_VAL(x)		((x) & ID_AA64PFR1_NMI_MASK) |
| 1513 | 1781 | #define	 ID_AA64PFR1_NMI_NONE		(UL(0x0) << ID_AA64PFR1_NMI_SHIFT) |
| 1514 | 1782 | #define	 ID_AA64PFR1_NMI_IMPL		(UL(0x1) << ID_AA64PFR1_NMI_SHIFT) |
| 1783 | #define	ID_AA64PFR1_MTE_frac_SHIFT	40 | |
| 1784 | #define	ID_AA64PFR1_MTE_frac_WIDTH	4 | |
| 1785 | #define	ID_AA64PFR1_MTE_frac_MASK	(UL(0xf) << ID_AA64PFR1_MTE_frac_SHIFT) | |
| 1786 | #define	ID_AA64PFR1_MTE_frac_VAL(x)	((x) & ID_AA64PFR1_MTE_frac_MASK) | |
| 1787 | #define	 ID_AA64PFR1_MTE_frac_IMPL	(UL(0x0) << ID_AA64PFR1_MTE_frac_SHIFT) | |
| 1788 | #define	 ID_AA64PFR1_MTE_frac_NONE	(UL(0xf) << ID_AA64PFR1_MTE_frac_SHIFT) | |
| 1789 | #define	ID_AA64PFR1_THE_SHIFT		48 | |
| 1790 | #define	ID_AA64PFR1_THE_WIDTH		4 | |
| 1791 | #define	ID_AA64PFR1_THE_MASK		(UL(0xf) << ID_AA64PFR1_THE_SHIFT) | |
| 1792 | #define	ID_AA64PFR1_THE_VAL(x)		((x) & ID_AA64PFR1_THE_MASK) | |
| 1793 | #define	 ID_AA64PFR1_THE_NONE		(UL(0x0) << ID_AA64PFR1_THE_SHIFT) | |
| 1794 | #define	 ID_AA64PFR1_THE_IMPL		(UL(0x1) << ID_AA64PFR1_THE_SHIFT) | |
| 1795 | #define	ID_AA64PFR1_MTEX_SHIFT		52 | |
| 1796 | #define	ID_AA64PFR1_MTEX_WIDTH		4 | |
| 1797 | #define	ID_AA64PFR1_MTEX_MASK		(UL(0xf) << ID_AA64PFR1_MTEX_SHIFT) | |
| 1798 | #define	ID_AA64PFR1_MTEX_VAL(x)		((x) & ID_AA64PFR1_MTEX_MASK) | |
| 1799 | #define	 ID_AA64PFR1_MTEX_NONE		(UL(0x0) << ID_AA64PFR1_MTEX_SHIFT) | |
| 1800 | #define	 ID_AA64PFR1_MTEX_IMPL		(UL(0x1) << ID_AA64PFR1_MTEX_SHIFT) | |
| 1801 | #define	ID_AA64PFR1_DF2_SHIFT		56 | |
| 1802 | #define	ID_AA64PFR1_DF2_WIDTH		4 | |
| 1803 | #define	ID_AA64PFR1_DF2_MASK		(UL(0xf) << ID_AA64PFR1_DF2_SHIFT) | |
| 1804 | #define	ID_AA64PFR1_DF2_VAL(x)		((x) & ID_AA64PFR1_DF2_MASK) | |
| 1805 | #define	 ID_AA64PFR1_DF2_NONE		(UL(0x0) << ID_AA64PFR1_DF2_SHIFT) | |
| 1806 | #define	 ID_AA64PFR1_DF2_IMPL		(UL(0x1) << ID_AA64PFR1_DF2_SHIFT) | |
| 1807 | #define	ID_AA64PFR1_PFAR_SHIFT		60 | |
| 1808 | #define	ID_AA64PFR1_PFAR_WIDTH		4 | |
| 1809 | #define	ID_AA64PFR1_PFAR_MASK		(UL(0xf) << ID_AA64PFR1_PFAR_SHIFT) | |
| 1810 | #define	ID_AA64PFR1_PFAR_VAL(x)		((x) & ID_AA64PFR1_PFAR_MASK) | |
| 1811 | #define	 ID_AA64PFR1_PFAR_NONE		(UL(0x0) << ID_AA64PFR1_PFAR_SHIFT) | |
| 1812 | #define	 ID_AA64PFR1_PFAR_IMPL		(UL(0x1) << ID_AA64PFR1_PFAR_SHIFT) | |
| 1515 | 1813 | |
| 1516 | 1814 | /* ID_AA64PFR2_EL1 */ |
| 1517 | #define	ID_AA64PFR2_EL1			MRS_REG(ID_AA64PFR2_EL1) | |
| 1518 | 1815 | #define	ID_AA64PFR2_EL1_REG		MRS_REG_ALT_NAME(ID_AA64PFR2_EL1) |
| 1816 | #define	ID_AA64PFR2_EL1_ISS		ISS_MSR_REG(ID_AA64PFR2_EL1) | |
| 1519 | 1817 | #define	ID_AA64PFR2_EL1_op0		3 |
| 1520 | 1818 | #define	ID_AA64PFR2_EL1_op1		0 |
| 1521 | 1819 | #define	ID_AA64PFR2_EL1_CRn		0 |
| ... | ... | @@ -1523,101 +1821,117 @@ |
| 1523 | 1821 | #define	ID_AA64PFR2_EL1_op2		2 |
| 1524 | 1822 | |
| 1525 | 1823 | /* ID_AA64ZFR0_EL1 */ |
| 1526 | #define	ID_AA64ZFR0_EL1			MRS_REG(ID_AA64ZFR0_EL1) | |
| 1527 | 1824 | #define	ID_AA64ZFR0_EL1_REG		MRS_REG_ALT_NAME(ID_AA64ZFR0_EL1) |
| 1825 | #define	ID_AA64ZFR0_EL1_ISS		ISS_MSR_REG(ID_AA64ZFR0_EL1) | |
| 1528 | 1826 | #define	ID_AA64ZFR0_EL1_op0		3 |
| 1529 | 1827 | #define	ID_AA64ZFR0_EL1_op1		0 |
| 1530 | 1828 | #define	ID_AA64ZFR0_EL1_CRn		0 |
| 1531 | 1829 | #define	ID_AA64ZFR0_EL1_CRm		4 |
| 1532 | 1830 | #define	ID_AA64ZFR0_EL1_op2		4 |
| 1533 | 1831 | #define	ID_AA64ZFR0_SVEver_SHIFT	0 |
| 1832 | #define	ID_AA64ZFR0_SVEver_WIDTH	4 | |
| 1534 | 1833 | #define	ID_AA64ZFR0_SVEver_MASK		(UL(0xf) << ID_AA64ZFR0_SVEver_SHIFT) |
| 1535 | #define	ID_AA64ZFR0_SVEver_VAL(x)	((x) & ID_AA64ZFR0_SVEver_MASK | |
| 1536 | #define	ID_AA64ZFR0_SVEver_SVE1		(UL(0x0) << ID_AA64ZFR0_SVEver_SHIFT) | |
| 1537 | #define	ID_AA64ZFR0_SVEver_SVE2		(UL(0x1) << ID_AA64ZFR0_SVEver_SHIFT) | |
| 1538 | #define	ID_AA64ZFR0_SVEver_SVE2P1	(UL(0x2) << ID_AA64ZFR0_SVEver_SHIFT) | |
| 1834 | #define	ID_AA64ZFR0_SVEver_VAL(x)	((x) & ID_AA64ZFR0_SVEver_MASK) | |
| 1835 | #define	 ID_AA64ZFR0_SVEver_SVE1	(UL(0x0) << ID_AA64ZFR0_SVEver_SHIFT) | |
| 1836 | #define	 ID_AA64ZFR0_SVEver_SVE2	(UL(0x1) << ID_AA64ZFR0_SVEver_SHIFT) | |
| 1837 | #define	 ID_AA64ZFR0_SVEver_SVE2P1	(UL(0x2) << ID_AA64ZFR0_SVEver_SHIFT) | |
| 1539 | 1838 | #define	ID_AA64ZFR0_AES_SHIFT		4 |
| 1839 | #define	ID_AA64ZFR0_AES_WIDTH		4 | |
| 1540 | 1840 | #define	ID_AA64ZFR0_AES_MASK		(UL(0xf) << ID_AA64ZFR0_AES_SHIFT) |
| 1541 | #define	ID_AA64ZFR0_AES_VAL(x)		((x) & ID_AA64ZFR0_AES_MASK | |
| 1542 | #define	ID_AA64ZFR0_AES_NONE		(UL(0x0) << ID_AA64ZFR0_AES_SHIFT) | |
| 1543 | #define	ID_AA64ZFR0_AES_BASE		(UL(0x1) << ID_AA64ZFR0_AES_SHIFT) | |
| 1544 | #define	ID_AA64ZFR0_AES_PMULL		(UL(0x2) << ID_AA64ZFR0_AES_SHIFT) | |
| 1841 | #define	ID_AA64ZFR0_AES_VAL(x)		((x) & ID_AA64ZFR0_AES_MASK) | |
| 1842 | #define	 ID_AA64ZFR0_AES_NONE		(UL(0x0) << ID_AA64ZFR0_AES_SHIFT) | |
| 1843 | #define	 ID_AA64ZFR0_AES_BASE		(UL(0x1) << ID_AA64ZFR0_AES_SHIFT) | |
| 1844 | #define	 ID_AA64ZFR0_AES_PMULL		(UL(0x2) << ID_AA64ZFR0_AES_SHIFT) | |
| 1545 | 1845 | #define	ID_AA64ZFR0_BitPerm_SHIFT	16 |
| 1846 | #define	ID_AA64ZFR0_BitPerm_WIDTH	4 | |
| 1546 | 1847 | #define	ID_AA64ZFR0_BitPerm_MASK	(UL(0xf) << ID_AA64ZFR0_BitPerm_SHIFT) |
| 1547 | #define	ID_AA64ZFR0_BitPerm_VAL(x)	((x) & ID_AA64ZFR0_BitPerm_MASK | |
| 1548 | #define	ID_AA64ZFR0_BitPerm_NONE	(UL(0x0) << ID_AA64ZFR0_BitPerm_SHIFT) | |
| 1549 | #define	ID_AA64ZFR0_BitPerm_IMPL	(UL(0x1) << ID_AA64ZFR0_BitPerm_SHIFT) | |
| 1848 | #define	ID_AA64ZFR0_BitPerm_VAL(x)	((x) & ID_AA64ZFR0_BitPerm_MASK) | |
| 1849 | #define	 ID_AA64ZFR0_BitPerm_NONE	(UL(0x0) << ID_AA64ZFR0_BitPerm_SHIFT) | |
| 1850 | #define	 ID_AA64ZFR0_BitPerm_IMPL	(UL(0x1) << ID_AA64ZFR0_BitPerm_SHIFT) | |
| 1550 | 1851 | #define	ID_AA64ZFR0_BF16_SHIFT		20 |
| 1852 | #define	ID_AA64ZFR0_BF16_WIDTH		4 | |
| 1551 | 1853 | #define	ID_AA64ZFR0_BF16_MASK		(UL(0xf) << ID_AA64ZFR0_BF16_SHIFT) |
| 1552 | #define	ID_AA64ZFR0_BF16_VAL(x)		((x) & ID_AA64ZFR0_BF16_MASK | |
| 1553 | #define	ID_AA64ZFR0_BF16_NONE		(UL(0x0) << ID_AA64ZFR0_BF16_SHIFT) | |
| 1554 | #define	ID_AA64ZFR0_BF16_BASE		(UL(0x1) << ID_AA64ZFR0_BF16_SHIFT) | |
| 1555 | #define	ID_AA64ZFR0_BF16_EBF		(UL(0x1) << ID_AA64ZFR0_BF16_SHIFT) | |
| 1854 | #define	ID_AA64ZFR0_BF16_VAL(x)		((x) & ID_AA64ZFR0_BF16_MASK) | |
| 1855 | #define	 ID_AA64ZFR0_BF16_NONE		(UL(0x0) << ID_AA64ZFR0_BF16_SHIFT) | |
| 1856 | #define	 ID_AA64ZFR0_BF16_BASE		(UL(0x1) << ID_AA64ZFR0_BF16_SHIFT) | |
| 1857 | #define	 ID_AA64ZFR0_BF16_EBF		(UL(0x1) << ID_AA64ZFR0_BF16_SHIFT) | |
| 1556 | 1858 | #define	ID_AA64ZFR0_SHA3_SHIFT		32 |
| 1859 | #define	ID_AA64ZFR0_SHA3_WIDTH		4 | |
| 1557 | 1860 | #define	ID_AA64ZFR0_SHA3_MASK		(UL(0xf) << ID_AA64ZFR0_SHA3_SHIFT) |
| 1558 | #define	ID_AA64ZFR0_SHA3_VAL(x)		((x) & ID_AA64ZFR0_SHA3_MASK | |
| 1559 | #define	ID_AA64ZFR0_SHA3_NONE		(UL(0x0) << ID_AA64ZFR0_SHA3_SHIFT) | |
| 1560 | #define	ID_AA64ZFR0_SHA3_IMPL		(UL(0x1) << ID_AA64ZFR0_SHA3_SHIFT) | |
| 1861 | #define	ID_AA64ZFR0_SHA3_VAL(x)		((x) & ID_AA64ZFR0_SHA3_MASK) | |
| 1862 | #define	 ID_AA64ZFR0_SHA3_NONE		(UL(0x0) << ID_AA64ZFR0_SHA3_SHIFT) | |
| 1863 | #define	 ID_AA64ZFR0_SHA3_IMPL		(UL(0x1) << ID_AA64ZFR0_SHA3_SHIFT) | |
| 1561 | 1864 | #define	ID_AA64ZFR0_SM4_SHIFT		40 |
| 1865 | #define	ID_AA64ZFR0_SM4_WIDTH		4 | |
| 1562 | 1866 | #define	ID_AA64ZFR0_SM4_MASK		(UL(0xf) << ID_AA64ZFR0_SM4_SHIFT) |
| 1563 | #define	ID_AA64ZFR0_SM4_VAL(x)		((x) & ID_AA64ZFR0_SM4_MASK | |
| 1564 | #define	ID_AA64ZFR0_SM4_NONE		(UL(0x0) << ID_AA64ZFR0_SM4_SHIFT) | |
| 1565 | #define	ID_AA64ZFR0_SM4_IMPL		(UL(0x1) << ID_AA64ZFR0_SM4_SHIFT) | |
| 1867 | #define	ID_AA64ZFR0_SM4_VAL(x)		((x) & ID_AA64ZFR0_SM4_MASK) | |
| 1868 | #define	 ID_AA64ZFR0_SM4_NONE		(UL(0x0) << ID_AA64ZFR0_SM4_SHIFT) | |
| 1869 | #define	 ID_AA64ZFR0_SM4_IMPL		(UL(0x1) << ID_AA64ZFR0_SM4_SHIFT) | |
| 1566 | 1870 | #define	ID_AA64ZFR0_I8MM_SHIFT		44 |
| 1871 | #define	ID_AA64ZFR0_I8MM_WIDTH		4 | |
| 1567 | 1872 | #define	ID_AA64ZFR0_I8MM_MASK		(UL(0xf) << ID_AA64ZFR0_I8MM_SHIFT) |
| 1568 | #define	ID_AA64ZFR0_I8MM_VAL(x)		((x) & ID_AA64ZFR0_I8MM_MASK | |
| 1569 | #define	ID_AA64ZFR0_I8MM_NONE		(UL(0x0) << ID_AA64ZFR0_I8MM_SHIFT) | |
| 1570 | #define	ID_AA64ZFR0_I8MM_IMPL		(UL(0x1) << ID_AA64ZFR0_I8MM_SHIFT) | |
| 1873 | #define	ID_AA64ZFR0_I8MM_VAL(x)		((x) & ID_AA64ZFR0_I8MM_MASK) | |
| 1874 | #define	 ID_AA64ZFR0_I8MM_NONE		(UL(0x0) << ID_AA64ZFR0_I8MM_SHIFT) | |
| 1875 | #define	 ID_AA64ZFR0_I8MM_IMPL		(UL(0x1) << ID_AA64ZFR0_I8MM_SHIFT) | |
| 1571 | 1876 | #define	ID_AA64ZFR0_F32MM_SHIFT		52 |
| 1877 | #define	ID_AA64ZFR0_F32MM_WIDTH		4 | |
| 1572 | 1878 | #define	ID_AA64ZFR0_F32MM_MASK		(UL(0xf) << ID_AA64ZFR0_F32MM_SHIFT) |
| 1573 | #define	ID_AA64ZFR0_F32MM_VAL(x)	((x) & ID_AA64ZFR0_F32MM_MASK | |
| 1574 | #define	ID_AA64ZFR0_F32MM_NONE		(UL(0x0) << ID_AA64ZFR0_F32MM_SHIFT) | |
| 1575 | #define	ID_AA64ZFR0_F32MM_IMPL		(UL(0x1) << ID_AA64ZFR0_F32MM_SHIFT) | |
| 1879 | #define	ID_AA64ZFR0_F32MM_VAL(x)	((x) & ID_AA64ZFR0_F32MM_MASK) | |
| 1880 | #define	 ID_AA64ZFR0_F32MM_NONE		(UL(0x0) << ID_AA64ZFR0_F32MM_SHIFT) | |
| 1881 | #define	 ID_AA64ZFR0_F32MM_IMPL		(UL(0x1) << ID_AA64ZFR0_F32MM_SHIFT) | |
| 1576 | 1882 | #define	ID_AA64ZFR0_F64MM_SHIFT		56 |
| 1883 | #define	ID_AA64ZFR0_F64MM_WIDTH		4 | |
| 1577 | 1884 | #define	ID_AA64ZFR0_F64MM_MASK		(UL(0xf) << ID_AA64ZFR0_F64MM_SHIFT) |
| 1578 | #define	ID_AA64ZFR0_F64MM_VAL(x)	((x) & ID_AA64ZFR0_F64MM_MASK | |
| 1579 | #define	ID_AA64ZFR0_F64MM_NONE		(UL(0x0) << ID_AA64ZFR0_F64MM_SHIFT) | |
| 1580 | #define	ID_AA64ZFR0_F64MM_IMPL		(UL(0x1) << ID_AA64ZFR0_F64MM_SHIFT) | |
| 1885 | #define	ID_AA64ZFR0_F64MM_VAL(x)	((x) & ID_AA64ZFR0_F64MM_MASK) | |
| 1886 | #define	 ID_AA64ZFR0_F64MM_NONE		(UL(0x0) << ID_AA64ZFR0_F64MM_SHIFT) | |
| 1887 | #define	 ID_AA64ZFR0_F64MM_IMPL		(UL(0x1) << ID_AA64ZFR0_F64MM_SHIFT) | |
| 1581 | 1888 | |
| 1582 | 1889 | /* ID_ISAR5_EL1 */ |
| 1583 | #define	ID_ISAR5_EL1			MRS_REG(ID_ISAR5_EL1) | |
| 1890 | #define	ID_ISAR5_EL1_ISS		ISS_MSR_REG(ID_ISAR5_EL1) | |
| 1584 | 1891 | #define	ID_ISAR5_EL1_op0		0x3 |
| 1585 | 1892 | #define	ID_ISAR5_EL1_op1		0x0 |
| 1586 | 1893 | #define	ID_ISAR5_EL1_CRn		0x0 |
| 1587 | 1894 | #define	ID_ISAR5_EL1_CRm		0x2 |
| 1588 | 1895 | #define	ID_ISAR5_EL1_op2		0x5 |
| 1589 | 1896 | #define	ID_ISAR5_SEVL_SHIFT		0 |
| 1897 | #define	ID_ISAR5_SEVL_WIDTH		4 | |
| 1590 | 1898 | #define	ID_ISAR5_SEVL_MASK		(UL(0xf) << ID_ISAR5_SEVL_SHIFT) |
| 1591 | 1899 | #define	ID_ISAR5_SEVL_VAL(x)		((x) & ID_ISAR5_SEVL_MASK) |
| 1592 | 1900 | #define	 ID_ISAR5_SEVL_NOP		(UL(0x0) << ID_ISAR5_SEVL_SHIFT) |
| 1593 | 1901 | #define	 ID_ISAR5_SEVL_IMPL		(UL(0x1) << ID_ISAR5_SEVL_SHIFT) |
| 1594 | 1902 | #define	ID_ISAR5_AES_SHIFT		4 |
| 1903 | #define	ID_ISAR5_AES_WIDTH		4 | |
| 1595 | 1904 | #define	ID_ISAR5_AES_MASK		(UL(0xf) << ID_ISAR5_AES_SHIFT) |
| 1596 | 1905 | #define	ID_ISAR5_AES_VAL(x)		((x) & ID_ISAR5_AES_MASK) |
| 1597 | 1906 | #define	 ID_ISAR5_AES_NONE		(UL(0x0) << ID_ISAR5_AES_SHIFT) |
| 1598 | 1907 | #define	 ID_ISAR5_AES_BASE		(UL(0x1) << ID_ISAR5_AES_SHIFT) |
| 1599 | 1908 | #define	 ID_ISAR5_AES_VMULL		(UL(0x2) << ID_ISAR5_AES_SHIFT) |
| 1600 | 1909 | #define	ID_ISAR5_SHA1_SHIFT		8 |
| 1910 | #define	ID_ISAR5_SHA1_WIDTH		4 | |
| 1601 | 1911 | #define	ID_ISAR5_SHA1_MASK		(UL(0xf) << ID_ISAR5_SHA1_SHIFT) |
| 1602 | 1912 | #define	ID_ISAR5_SHA1_VAL(x)		((x) & ID_ISAR5_SHA1_MASK) |
| 1603 | 1913 | #define	 ID_ISAR5_SHA1_NONE		(UL(0x0) << ID_ISAR5_SHA1_SHIFT) |
| 1604 | 1914 | #define	 ID_ISAR5_SHA1_IMPL		(UL(0x1) << ID_ISAR5_SHA1_SHIFT) |
| 1605 | 1915 | #define	ID_ISAR5_SHA2_SHIFT		12 |
| 1916 | #define	ID_ISAR5_SHA2_WIDTH		4 | |
| 1606 | 1917 | #define	ID_ISAR5_SHA2_MASK		(UL(0xf) << ID_ISAR5_SHA2_SHIFT) |
| 1607 | 1918 | #define	ID_ISAR5_SHA2_VAL(x)		((x) & ID_ISAR5_SHA2_MASK) |
| 1608 | 1919 | #define	 ID_ISAR5_SHA2_NONE		(UL(0x0) << ID_ISAR5_SHA2_SHIFT) |
| 1609 | 1920 | #define	 ID_ISAR5_SHA2_IMPL		(UL(0x1) << ID_ISAR5_SHA2_SHIFT) |
| 1610 | 1921 | #define	ID_ISAR5_CRC32_SHIFT		16 |
| 1922 | #define	ID_ISAR5_CRC32_WIDTH		4 | |
| 1611 | 1923 | #define	ID_ISAR5_CRC32_MASK		(UL(0xf) << ID_ISAR5_CRC32_SHIFT) |
| 1612 | 1924 | #define	ID_ISAR5_CRC32_VAL(x)		((x) & ID_ISAR5_CRC32_MASK) |
| 1613 | 1925 | #define	 ID_ISAR5_CRC32_NONE		(UL(0x0) << ID_ISAR5_CRC32_SHIFT) |
| 1614 | 1926 | #define	 ID_ISAR5_CRC32_IMPL		(UL(0x1) << ID_ISAR5_CRC32_SHIFT) |
| 1615 | 1927 | #define	ID_ISAR5_RDM_SHIFT		24 |
| 1928 | #define	ID_ISAR5_RDM_WIDTH		4 | |
| 1616 | 1929 | #define	ID_ISAR5_RDM_MASK		(UL(0xf) << ID_ISAR5_RDM_SHIFT) |
| 1617 | 1930 | #define	ID_ISAR5_RDM_VAL(x)		((x) & ID_ISAR5_RDM_MASK) |
| 1618 | 1931 | #define	 ID_ISAR5_RDM_NONE		(UL(0x0) << ID_ISAR5_RDM_SHIFT) |
| 1619 | 1932 | #define	 ID_ISAR5_RDM_IMPL		(UL(0x1) << ID_ISAR5_RDM_SHIFT) |
| 1620 | 1933 | #define	ID_ISAR5_VCMA_SHIFT		28 |
| 1934 | #define	ID_ISAR5_VCMA_WIDTH		4 | |
| 1621 | 1935 | #define	ID_ISAR5_VCMA_MASK		(UL(0xf) << ID_ISAR5_VCMA_SHIFT) |
| 1622 | 1936 | #define	ID_ISAR5_VCMA_VAL(x)		((x) & ID_ISAR5_VCMA_MASK) |
| 1623 | 1937 | #define	 ID_ISAR5_VCMA_NONE		(UL(0x0) << ID_ISAR5_VCMA_SHIFT) |
| ... | ... | @@ -1647,7 +1961,6 @@ |
| 1647 | 1961 | #define	MAIR_EL12_op2			0 |
| 1648 | 1962 | |
| 1649 | 1963 | /* MDCCINT_EL1 */ |
| 1650 | #define	MDCCINT_EL1			MRS_REG(MDCCINT_EL1) | |
| 1651 | 1964 | #define	MDCCINT_EL1_op0			2 |
| 1652 | 1965 | #define	MDCCINT_EL1_op1			0 |
| 1653 | 1966 | #define	MDCCINT_EL1_CRn			0 |
| ... | ... | @@ -1655,7 +1968,6 @@ |
| 1655 | 1968 | #define	MDCCINT_EL1_op2			0 |
| 1656 | 1969 | |
| 1657 | 1970 | /* MDCCSR_EL0 */ |
| 1658 | #define	MDCCSR_EL0			MRS_REG(MDCCSR_EL0) | |
| 1659 | 1971 | #define	MDCCSR_EL0_op0			2 |
| 1660 | 1972 | #define	MDCCSR_EL0_op1			3 |
| 1661 | 1973 | #define	MDCCSR_EL0_CRn			0 |
| ... | ... | @@ -1663,7 +1975,6 @@ |
| 1663 | 1975 | #define	MDCCSR_EL0_op2			0 |
| 1664 | 1976 | |
| 1665 | 1977 | /* MDSCR_EL1 - Monitor Debug System Control Register */ |
| 1666 | #define	MDSCR_EL1			MRS_REG(MDSCR_EL1) | |
| 1667 | 1978 | #define	MDSCR_EL1_op0			2 |
| 1668 | 1979 | #define	MDSCR_EL1_op1			0 |
| 1669 | 1980 | #define	MDSCR_EL1_CRn			0 |
| ... | ... | @@ -1677,7 +1988,6 @@ |
| 1677 | 1988 | #define	MDSCR_MDE			(UL(0x1) << MDSCR_MDE_SHIFT) |
| 1678 | 1989 | |
| 1679 | 1990 | /* MIDR_EL1 - Main ID Register */ |
| 1680 | #define	MIDR_EL1			MRS_REG(MIDR_EL1) | |
| 1681 | 1991 | #define	MIDR_EL1_op0			3 |
| 1682 | 1992 | #define	MIDR_EL1_op1			0 |
| 1683 | 1993 | #define	MIDR_EL1_CRn			0 |
| ... | ... | @@ -1685,7 +1995,6 @@ |
| 1685 | 1995 | #define	MIDR_EL1_op2			0 |
| 1686 | 1996 | |
| 1687 | 1997 | /* MPIDR_EL1 - Multiprocessor Affinity Register */ |
| 1688 | #define	MPIDR_EL1			MRS_REG(MPIDR_EL1) | |
| 1689 | 1998 | #define	MPIDR_EL1_op0			3 |
| 1690 | 1999 | #define	MPIDR_EL1_op1			0 |
| 1691 | 2000 | #define	MPIDR_EL1_CRn			0 |
| ... | ... | @@ -1709,95 +2018,110 @@ |
| 1709 | 2018 | #define	MPIDR_AFF3_VAL(x)		((x) & MPIDR_AFF3_MASK) |
| 1710 | 2019 | |
| 1711 | 2020 | /* MVFR0_EL1 */ |
| 1712 | #define	MVFR0_EL1			MRS_REG(MVFR0_EL1) | |
| 2021 | #define	MVFR0_EL1_ISS			ISS_MSR_REG(MVFR0_EL1) | |
| 1713 | 2022 | #define	MVFR0_EL1_op0			0x3 |
| 1714 | 2023 | #define	MVFR0_EL1_op1			0x0 |
| 1715 | 2024 | #define	MVFR0_EL1_CRn			0x0 |
| 1716 | 2025 | #define	MVFR0_EL1_CRm			0x3 |
| 1717 | 2026 | #define	MVFR0_EL1_op2			0x0 |
| 1718 | 2027 | #define	MVFR0_SIMDReg_SHIFT		0 |
| 2028 | #define	MVFR0_SIMDReg_WIDTH		4 | |
| 1719 | 2029 | #define	MVFR0_SIMDReg_MASK		(UL(0xf) << MVFR0_SIMDReg_SHIFT) |
| 1720 | 2030 | #define	MVFR0_SIMDReg_VAL(x)		((x) & MVFR0_SIMDReg_MASK) |
| 1721 | 2031 | #define	 MVFR0_SIMDReg_NONE		(UL(0x0) << MVFR0_SIMDReg_SHIFT) |
| 1722 | 2032 | #define	 MVFR0_SIMDReg_FP		(UL(0x1) << MVFR0_SIMDReg_SHIFT) |
| 1723 | 2033 | #define	 MVFR0_SIMDReg_AdvSIMD		(UL(0x2) << MVFR0_SIMDReg_SHIFT) |
| 1724 | 2034 | #define	MVFR0_FPSP_SHIFT		4 |
| 2035 | #define	MVFR0_FPSP_WIDTH		4 | |
| 1725 | 2036 | #define	MVFR0_FPSP_MASK			(UL(0xf) << MVFR0_FPSP_SHIFT) |
| 1726 | 2037 | #define	MVFR0_FPSP_VAL(x)		((x) & MVFR0_FPSP_MASK) |
| 1727 | 2038 | #define	 MVFR0_FPSP_NONE		(UL(0x0) << MVFR0_FPSP_SHIFT) |
| 1728 | 2039 | #define	 MVFR0_FPSP_VFP_v2		(UL(0x1) << MVFR0_FPSP_SHIFT) |
| 1729 | 2040 | #define	 MVFR0_FPSP_VFP_v3_v4		(UL(0x2) << MVFR0_FPSP_SHIFT) |
| 1730 | 2041 | #define	MVFR0_FPDP_SHIFT		8 |
| 2042 | #define	MVFR0_FPDP_WIDTH		4 | |
| 1731 | 2043 | #define	MVFR0_FPDP_MASK			(UL(0xf) << MVFR0_FPDP_SHIFT) |
| 1732 | 2044 | #define	MVFR0_FPDP_VAL(x)		((x) & MVFR0_FPDP_MASK) |
| 1733 | 2045 | #define	 MVFR0_FPDP_NONE		(UL(0x0) << MVFR0_FPDP_SHIFT) |
| 1734 | 2046 | #define	 MVFR0_FPDP_VFP_v2		(UL(0x1) << MVFR0_FPDP_SHIFT) |
| 1735 | 2047 | #define	 MVFR0_FPDP_VFP_v3_v4		(UL(0x2) << MVFR0_FPDP_SHIFT) |
| 1736 | 2048 | #define	MVFR0_FPTrap_SHIFT		12 |
| 2049 | #define	MVFR0_FPTrap_WIDTH		4 | |
| 1737 | 2050 | #define	MVFR0_FPTrap_MASK		(UL(0xf) << MVFR0_FPTrap_SHIFT) |
| 1738 | 2051 | #define	MVFR0_FPTrap_VAL(x)		((x) & MVFR0_FPTrap_MASK) |
| 1739 | 2052 | #define	 MVFR0_FPTrap_NONE		(UL(0x0) << MVFR0_FPTrap_SHIFT) |
| 1740 | 2053 | #define	 MVFR0_FPTrap_IMPL		(UL(0x1) << MVFR0_FPTrap_SHIFT) |
| 1741 | 2054 | #define	MVFR0_FPDivide_SHIFT		16 |
| 2055 | #define	MVFR0_FPDivide_WIDTH		4 | |
| 1742 | 2056 | #define	MVFR0_FPDivide_MASK		(UL(0xf) << MVFR0_FPDivide_SHIFT) |
| 1743 | 2057 | #define	MVFR0_FPDivide_VAL(x)		((x) & MVFR0_FPDivide_MASK) |
| 1744 | 2058 | #define	 MVFR0_FPDivide_NONE		(UL(0x0) << MVFR0_FPDivide_SHIFT) |
| 1745 | 2059 | #define	 MVFR0_FPDivide_IMPL		(UL(0x1) << MVFR0_FPDivide_SHIFT) |
| 1746 | 2060 | #define	MVFR0_FPSqrt_SHIFT		20 |
| 2061 | #define	MVFR0_FPSqrt_WIDTH		4 | |
| 1747 | 2062 | #define	MVFR0_FPSqrt_MASK		(UL(0xf) << MVFR0_FPSqrt_SHIFT) |
| 1748 | 2063 | #define	MVFR0_FPSqrt_VAL(x)		((x) & MVFR0_FPSqrt_MASK) |
| 1749 | 2064 | #define	 MVFR0_FPSqrt_NONE		(UL(0x0) << MVFR0_FPSqrt_SHIFT) |
| 1750 | 2065 | #define	 MVFR0_FPSqrt_IMPL		(UL(0x1) << MVFR0_FPSqrt_SHIFT) |
| 1751 | 2066 | #define	MVFR0_FPShVec_SHIFT		24 |
| 2067 | #define	MVFR0_FPShVec_WIDTH		4 | |
| 1752 | 2068 | #define	MVFR0_FPShVec_MASK		(UL(0xf) << MVFR0_FPShVec_SHIFT) |
| 1753 | 2069 | #define	MVFR0_FPShVec_VAL(x)		((x) & MVFR0_FPShVec_MASK) |
| 1754 | 2070 | #define	 MVFR0_FPShVec_NONE		(UL(0x0) << MVFR0_FPShVec_SHIFT) |
| 1755 | 2071 | #define	 MVFR0_FPShVec_IMPL		(UL(0x1) << MVFR0_FPShVec_SHIFT) |
| 1756 | 2072 | #define	MVFR0_FPRound_SHIFT		28 |
| 2073 | #define	MVFR0_FPRound_WIDTH		4 | |
| 1757 | 2074 | #define	MVFR0_FPRound_MASK		(UL(0xf) << MVFR0_FPRound_SHIFT) |
| 1758 | 2075 | #define	MVFR0_FPRound_VAL(x)		((x) & MVFR0_FPRound_MASK) |
| 1759 | 2076 | #define	 MVFR0_FPRound_NONE		(UL(0x0) << MVFR0_FPRound_SHIFT) |
| 1760 | 2077 | #define	 MVFR0_FPRound_IMPL		(UL(0x1) << MVFR0_FPRound_SHIFT) |
| 1761 | 2078 | |
| 1762 | 2079 | /* MVFR1_EL1 */ |
| 1763 | #define	MVFR1_EL1			MRS_REG(MVFR1_EL1) | |
| 2080 | #define	MVFR1_EL1_ISS			ISS_MSR_REG(MVFR1_EL1) | |
| 1764 | 2081 | #define	MVFR1_EL1_op0			0x3 |
| 1765 | 2082 | #define	MVFR1_EL1_op1			0x0 |
| 1766 | 2083 | #define	MVFR1_EL1_CRn			0x0 |
| 1767 | 2084 | #define	MVFR1_EL1_CRm			0x3 |
| 1768 | 2085 | #define	MVFR1_EL1_op2			0x1 |
| 1769 | 2086 | #define	MVFR1_FPFtZ_SHIFT		0 |
| 2087 | #define	MVFR1_FPFtZ_WIDTH		4 | |
| 1770 | 2088 | #define	MVFR1_FPFtZ_MASK		(UL(0xf) << MVFR1_FPFtZ_SHIFT) |
| 1771 | 2089 | #define	MVFR1_FPFtZ_VAL(x)		((x) & MVFR1_FPFtZ_MASK) |
| 1772 | 2090 | #define	 MVFR1_FPFtZ_NONE		(UL(0x0) << MVFR1_FPFtZ_SHIFT) |
| 1773 | 2091 | #define	 MVFR1_FPFtZ_IMPL		(UL(0x1) << MVFR1_FPFtZ_SHIFT) |
| 1774 | 2092 | #define	MVFR1_FPDNaN_SHIFT		4 |
| 2093 | #define	MVFR1_FPDNaN_WIDTH		4 | |
| 1775 | 2094 | #define	MVFR1_FPDNaN_MASK		(UL(0xf) << MVFR1_FPDNaN_SHIFT) |
| 1776 | 2095 | #define	MVFR1_FPDNaN_VAL(x)		((x) & MVFR1_FPDNaN_MASK) |
| 1777 | 2096 | #define	 MVFR1_FPDNaN_NONE		(UL(0x0) << MVFR1_FPDNaN_SHIFT) |
| 1778 | 2097 | #define	 MVFR1_FPDNaN_IMPL		(UL(0x1) << MVFR1_FPDNaN_SHIFT) |
| 1779 | 2098 | #define	MVFR1_SIMDLS_SHIFT		8 |
| 2099 | #define	MVFR1_SIMDLS_WIDTH		4 | |
| 1780 | 2100 | #define	MVFR1_SIMDLS_MASK		(UL(0xf) << MVFR1_SIMDLS_SHIFT) |
| 1781 | 2101 | #define	MVFR1_SIMDLS_VAL(x)		((x) & MVFR1_SIMDLS_MASK) |
| 1782 | 2102 | #define	 MVFR1_SIMDLS_NONE		(UL(0x0) << MVFR1_SIMDLS_SHIFT) |
| 1783 | 2103 | #define	 MVFR1_SIMDLS_IMPL		(UL(0x1) << MVFR1_SIMDLS_SHIFT) |
| 1784 | 2104 | #define	MVFR1_SIMDInt_SHIFT		12 |
| 2105 | #define	MVFR1_SIMDInt_WIDTH		4 | |
| 1785 | 2106 | #define	MVFR1_SIMDInt_MASK		(UL(0xf) << MVFR1_SIMDInt_SHIFT) |
| 1786 | 2107 | #define	MVFR1_SIMDInt_VAL(x)		((x) & MVFR1_SIMDInt_MASK) |
| 1787 | 2108 | #define	 MVFR1_SIMDInt_NONE		(UL(0x0) << MVFR1_SIMDInt_SHIFT) |
| 1788 | 2109 | #define	 MVFR1_SIMDInt_IMPL		(UL(0x1) << MVFR1_SIMDInt_SHIFT) |
| 1789 | 2110 | #define	MVFR1_SIMDSP_SHIFT		16 |
| 2111 | #define	MVFR1_SIMDSP_WIDTH		4 | |
| 1790 | 2112 | #define	MVFR1_SIMDSP_MASK		(UL(0xf) << MVFR1_SIMDSP_SHIFT) |
| 1791 | 2113 | #define	MVFR1_SIMDSP_VAL(x)		((x) & MVFR1_SIMDSP_MASK) |
| 1792 | 2114 | #define	 MVFR1_SIMDSP_NONE		(UL(0x0) << MVFR1_SIMDSP_SHIFT) |
| 1793 | 2115 | #define	 MVFR1_SIMDSP_IMPL		(UL(0x1) << MVFR1_SIMDSP_SHIFT) |
| 1794 | 2116 | #define	MVFR1_SIMDHP_SHIFT		20 |
| 2117 | #define	MVFR1_SIMDHP_WIDTH		4 | |
| 1795 | 2118 | #define	MVFR1_SIMDHP_MASK		(UL(0xf) << MVFR1_SIMDHP_SHIFT) |
| 1796 | 2119 | #define	MVFR1_SIMDHP_VAL(x)		((x) & MVFR1_SIMDHP_MASK) |
| 1797 | 2120 | #define	 MVFR1_SIMDHP_NONE		(UL(0x0) << MVFR1_SIMDHP_SHIFT) |
| 1798 | 2121 | #define	 MVFR1_SIMDHP_CONV_SP		(UL(0x1) << MVFR1_SIMDHP_SHIFT) |
| 1799 | 2122 | #define	 MVFR1_SIMDHP_ARITH		(UL(0x2) << MVFR1_SIMDHP_SHIFT) |
| 1800 | 2123 | #define	MVFR1_FPHP_SHIFT		24 |
| 2124 | #define	MVFR1_FPHP_WIDTH		4 | |
| 1801 | 2125 | #define	MVFR1_FPHP_MASK			(UL(0xf) << MVFR1_FPHP_SHIFT) |
| 1802 | 2126 | #define	MVFR1_FPHP_VAL(x)		((x) & MVFR1_FPHP_MASK) |
| 1803 | 2127 | #define	 MVFR1_FPHP_NONE		(UL(0x0) << MVFR1_FPHP_SHIFT) |
| ... | ... | @@ -1805,13 +2129,13 @@ |
| 1805 | 2129 | #define	 MVFR1_FPHP_CONV_DP		(UL(0x2) << MVFR1_FPHP_SHIFT) |
| 1806 | 2130 | #define	 MVFR1_FPHP_ARITH		(UL(0x3) << MVFR1_FPHP_SHIFT) |
| 1807 | 2131 | #define	MVFR1_SIMDFMAC_SHIFT		28 |
| 2132 | #define	MVFR1_SIMDFMAC_WIDTH		4 | |
| 1808 | 2133 | #define	MVFR1_SIMDFMAC_MASK		(UL(0xf) << MVFR1_SIMDFMAC_SHIFT) |
| 1809 | 2134 | #define	MVFR1_SIMDFMAC_VAL(x)		((x) & MVFR1_SIMDFMAC_MASK) |
| 1810 | 2135 | #define	 MVFR1_SIMDFMAC_NONE		(UL(0x0) << MVFR1_SIMDFMAC_SHIFT) |
| 1811 | 2136 | #define	 MVFR1_SIMDFMAC_IMPL		(UL(0x1) << MVFR1_SIMDFMAC_SHIFT) |
| 1812 | 2137 | |
| 1813 | 2138 | /* OSDLR_EL1 */ |
| 1814 | #define	OSDLR_EL1			MRS_REG(OSDLR_EL1) | |
| 1815 | 2139 | #define	OSDLR_EL1_op0			2 |
| 1816 | 2140 | #define	OSDLR_EL1_op1			0 |
| 1817 | 2141 | #define	OSDLR_EL1_CRn			1 |
| ... | ... | @@ -1819,20 +2143,23 @@ |
| 1819 | 2143 | #define	OSDLR_EL1_op2			4 |
| 1820 | 2144 | |
| 1821 | 2145 | /* OSLAR_EL1 */ |
| 1822 | #define	OSLAR_EL1			MRS_REG(OSLAR_EL1) | |
| 1823 | 2146 | #define	OSLAR_EL1_op0			2 |
| 1824 | 2147 | #define	OSLAR_EL1_op1			0 |
| 1825 | 2148 | #define	OSLAR_EL1_CRn			1 |
| 1826 | 2149 | #define	OSLAR_EL1_CRm			0 |
| 1827 | 2150 | #define	OSLAR_EL1_op2			4 |
| 2151 | #define	OSLAR_OSLK			(0x1ul << 0) | |
| 1828 | 2152 | |
| 1829 | 2153 | /* OSLSR_EL1 */ |
| 1830 | #define	OSLSR_EL1			MRS_REG(OSLSR_EL1) | |
| 1831 | 2154 | #define	OSLSR_EL1_op0			2 |
| 1832 | 2155 | #define	OSLSR_EL1_op1			0 |
| 1833 | 2156 | #define	OSLSR_EL1_CRn			1 |
| 1834 | 2157 | #define	OSLSR_EL1_CRm			1 |
| 1835 | 2158 | #define	OSLSR_EL1_op2			4 |
| 2159 | #define	OSLSR_OSLM_1			(0x1ul << 3) | |
| 2160 | #define	OSLSR_nTT			(0x1ul << 2) | |
| 2161 | #define	OSLSR_OSLK			(0x1ul << 1) | |
| 2162 | #define	OSLSR_OSLM_0			(0x1ul << 0) | |
| 1836 | 2163 | |
| 1837 | 2164 | /* PAR_EL1 - Physical Address Register */ |
| 1838 | 2165 | #define	PAR_F_SHIFT		0 |
| ... | ... | @@ -1845,7 +2172,7 @@ |
| 1845 | 2172 | #define	PAR_NS_SHIFT		9 |
| 1846 | 2173 | #define	PAR_NS_MASK		(0x3 << PAR_NS_SHIFT) |
| 1847 | 2174 | #define	PAR_PA_SHIFT		12 |
| 1848 | #define	PAR_PA_MASK		0x0000fffffffff000 | |
| 2175 | #define	PAR_PA_MASK		0x000ffffffffff000 | |
| 1849 | 2176 | #define	PAR_ATTR_SHIFT		56 |
| 1850 | 2177 | #define	PAR_ATTR_MASK		(0xff << PAR_ATTR_SHIFT) |
| 1851 | 2178 | /* When PAR_F == 1 (aborted) */ |
| ... | ... | @@ -1857,7 +2184,6 @@ |
| 1857 | 2184 | #define	PAR_S_MASK		(0x1 << PAR_S_SHIFT) |
| 1858 | 2185 | |
| 1859 | 2186 | /* PMBIDR_EL1 */ |
| 1860 | #define	PMBIDR_EL1			MRS_REG(PMBIDR_EL1) | |
| 1861 | 2187 | #define	PMBIDR_EL1_REG			MRS_REG_ALT_NAME(PMBIDR_EL1) |
| 1862 | 2188 | #define	PMBIDR_EL1_op0			3 |
| 1863 | 2189 | #define	PMBIDR_EL1_op1			0 |
| ... | ... | @@ -1872,7 +2198,6 @@ |
| 1872 | 2198 | #define	PMBIDR_F			(UL(0x1) << PMBIDR_F_SHIFT) |
| 1873 | 2199 | |
| 1874 | 2200 | /* PMBLIMITR_EL1 */ |
| 1875 | #define	PMBLIMITR_EL1			MRS_REG(PMBLIMITR_EL1) | |
| 1876 | 2201 | #define	PMBLIMITR_EL1_REG		MRS_REG_ALT_NAME(PMBLIMITR_EL1) |
| 1877 | 2202 | #define	PMBLIMITR_EL1_op0		3 |
| 1878 | 2203 | #define	PMBLIMITR_EL1_op1		0 |
| ... | ... | @@ -1890,7 +2215,6 @@ |
| 1890 | 2215 | (UL(0xfffffffffffff) << PMBLIMITR_LIMIT_SHIFT) |
| 1891 | 2216 | |
| 1892 | 2217 | /* PMBPTR_EL1 */ |
| 1893 | #define	PMBPTR_EL1			MRS_REG(PMBPTR_EL1) | |
| 1894 | 2218 | #define	PMBPTR_EL1_REG			MRS_REG_ALT_NAME(PMBPTR_EL1) |
| 1895 | 2219 | #define	PMBPTR_EL1_op0			3 |
| 1896 | 2220 | #define	PMBPTR_EL1_op1			0 |
| ... | ... | @@ -1902,7 +2226,6 @@ |
| 1902 | 2226 | (UL(0xffffffffffffffff) << PMBPTR_PTR_SHIFT) |
| 1903 | 2227 | |
| 1904 | 2228 | /* PMBSR_EL1 */ |
| 1905 | #define	PMBSR_EL1			MRS_REG(PMBSR_EL1) | |
| 1906 | 2229 | #define	PMBSR_EL1_REG			MRS_REG_ALT_NAME(PMBSR_EL1) |
| 1907 | 2230 | #define	PMBSR_EL1_op0			3 |
| 1908 | 2231 | #define	PMBSR_EL1_op1			0 |
| ... | ... | @@ -1925,7 +2248,6 @@ |
| 1925 | 2248 | #define	PMBSR_EC_MASK			(UL(0x3f) << PMBSR_EC_SHIFT) |
| 1926 | 2249 | |
| 1927 | 2250 | /* PMCCFILTR_EL0 */ |
| 1928 | #define	PMCCFILTR_EL0			MRS_REG(PMCCFILTR_EL0) | |
| 1929 | 2251 | #define	PMCCFILTR_EL0_op0		3 |
| 1930 | 2252 | #define	PMCCFILTR_EL0_op1		3 |
| 1931 | 2253 | #define	PMCCFILTR_EL0_CRn		14 |
| ... | ... | @@ -1933,7 +2255,6 @@ |
| 1933 | 2255 | #define	PMCCFILTR_EL0_op2		7 |
| 1934 | 2256 | |
| 1935 | 2257 | /* PMCCNTR_EL0 */ |
| 1936 | #define	PMCCNTR_EL0			MRS_REG(PMCCNTR_EL0) | |
| 1937 | 2258 | #define	PMCCNTR_EL0_op0			3 |
| 1938 | 2259 | #define	PMCCNTR_EL0_op1			3 |
| 1939 | 2260 | #define	PMCCNTR_EL0_CRn			9 |
| ... | ... | @@ -1941,7 +2262,6 @@ |
| 1941 | 2262 | #define	PMCCNTR_EL0_op2			0 |
| 1942 | 2263 | |
| 1943 | 2264 | /* PMCEID0_EL0 */ |
| 1944 | #define	PMCEID0_EL0			MRS_REG(PMCEID0_EL0) | |
| 1945 | 2265 | #define	PMCEID0_EL0_op0			3 |
| 1946 | 2266 | #define	PMCEID0_EL0_op1			3 |
| 1947 | 2267 | #define	PMCEID0_EL0_CRn			9 |
| ... | ... | @@ -1949,7 +2269,6 @@ |
| 1949 | 2269 | #define	PMCEID0_EL0_op2			6 |
| 1950 | 2270 | |
| 1951 | 2271 | /* PMCEID1_EL0 */ |
| 1952 | #define	PMCEID1_EL0			MRS_REG(PMCEID1_EL0) | |
| 1953 | 2272 | #define	PMCEID1_EL0_op0			3 |
| 1954 | 2273 | #define	PMCEID1_EL0_op1			3 |
| 1955 | 2274 | #define	PMCEID1_EL0_CRn			9 |
| ... | ... | @@ -1957,7 +2276,6 @@ |
| 1957 | 2276 | #define	PMCEID1_EL0_op2			7 |
| 1958 | 2277 | |
| 1959 | 2278 | /* PMCNTENCLR_EL0 */ |
| 1960 | #define	PMCNTENCLR_EL0			MRS_REG(PMCNTENCLR_EL0) | |
| 1961 | 2279 | #define	PMCNTENCLR_EL0_op0		3 |
| 1962 | 2280 | #define	PMCNTENCLR_EL0_op1		3 |
| 1963 | 2281 | #define	PMCNTENCLR_EL0_CRn		9 |
| ... | ... | @@ -1965,7 +2283,6 @@ |
| 1965 | 2283 | #define	PMCNTENCLR_EL0_op2		2 |
| 1966 | 2284 | |
| 1967 | 2285 | /* PMCNTENSET_EL0 */ |
| 1968 | #define	PMCNTENSET_EL0			MRS_REG(PMCNTENSET_EL0) | |
| 1969 | 2286 | #define	PMCNTENSET_EL0_op0		3 |
| 1970 | 2287 | #define	PMCNTENSET_EL0_op1		3 |
| 1971 | 2288 | #define	PMCNTENSET_EL0_CRn		9 |
| ... | ... | @@ -1973,24 +2290,24 @@ |
| 1973 | 2290 | #define	PMCNTENSET_EL0_op2		1 |
| 1974 | 2291 | |
| 1975 | 2292 | /* PMCR_EL0 - Perfomance Monitoring Counters */ |
| 1976 | #define	PMCR_EL0			MRS_REG(PMCR_EL0) | |
| 1977 | 2293 | #define	PMCR_EL0_op0			3 |
| 1978 | 2294 | #define	PMCR_EL0_op1			3 |
| 1979 | 2295 | #define	PMCR_EL0_CRn			9 |
| 1980 | 2296 | #define	PMCR_EL0_CRm			12 |
| 1981 | 2297 | #define	PMCR_EL0_op2			0 |
| 1982 | #define	PMCR_E				(1 << 0) /* Enable all counters */ | |
| 1983 | #define	PMCR_P				(1 << 1) /* Reset all counters */ | |
| 1984 | #define	PMCR_C				(1 << 2) /* Clock counter reset */ | |
| 1985 | #define	PMCR_D				(1 << 3) /* CNTR counts every 64 clk cycles */ | |
| 1986 | #define	PMCR_X				(1 << 4) /* Export to ext. monitoring (ETM) */ | |
| 1987 | #define	PMCR_DP				(1 << 5) /* Disable CCNT if non-invasive debug*/ | |
| 1988 | #define	PMCR_LC				(1 << 6) /* Long cycle count enable */ | |
| 1989 | #define	PMCR_IMP_SHIFT			24	/* Implementer code */ | |
| 1990 | #define	PMCR_IMP_MASK			(0xff << PMCR_IMP_SHIFT) | |
| 1991 | #define	 PMCR_IMP_ARM			0x41 | |
| 2298 | #define	PMCR_E				(1ul << 0) /* Enable all counters */ | |
| 2299 | #define	PMCR_P				(1ul << 1) /* Reset all counters */ | |
| 2300 | #define	PMCR_C				(1ul << 2) /* Clock counter reset */ | |
| 2301 | #define	PMCR_D				(1ul << 3) /* CNTR counts every 64 clk cycles */ | |
| 2302 | #define	PMCR_X				(1ul << 4) /* Export to ext. monitoring (ETM) */ | |
| 2303 | #define	PMCR_DP				(1ul << 5) /* Disable CCNT if non-invasive debug*/ | |
| 2304 | #define	PMCR_LC				(1ul << 6) /* Long cycle count enable */ | |
| 2305 | #define	PMCR_LP				(1ul << 7) /* Long event count enable */ | |
| 2306 | #define	PMCR_FZO			(1ul << 9) /* Freeze-on-overflow */ | |
| 2307 | #define	PMCR_N_SHIFT			11 /* Number of counters implemented */ | |
| 2308 | #define	PMCR_N_MASK			(0x1ful << PMCR_N_SHIFT) | |
| 1992 | 2309 | #define	PMCR_IDCODE_SHIFT		16	/* Identification code */ |
| 1993 | #define	PMCR_IDCODE_MASK		(0xff << PMCR_IDCODE_SHIFT) | |
| 2310 | #define	PMCR_IDCODE_MASK		(0xfful << PMCR_IDCODE_SHIFT) | |
| 1994 | 2311 | #define	 PMCR_IDCODE_CORTEX_A57		0x01 |
| 1995 | 2312 | #define	 PMCR_IDCODE_CORTEX_A72		0x02 |
| 1996 | 2313 | #define	 PMCR_IDCODE_CORTEX_A53		0x03 |
| ... | ... | @@ -2002,8 +2319,10 @@ |
| 2002 | 2319 | #define	 PMCR_IDCODE_CORTEX_A55		0x45 |
| 2003 | 2320 | #define	 PMCR_IDCODE_NEOVERSE_E1	0x46 |
| 2004 | 2321 | #define	 PMCR_IDCODE_CORTEX_A75		0x4a |
| 2005 | #define	PMCR_N_SHIFT			11 /* Number of counters implemented */ | |
| 2006 | #define	PMCR_N_MASK			(0x1f << PMCR_N_SHIFT) | |
| 2322 | #define	PMCR_IMP_SHIFT			24	/* Implementer code */ | |
| 2323 | #define	PMCR_IMP_MASK			(0xfful << PMCR_IMP_SHIFT) | |
| 2324 | #define	 PMCR_IMP_ARM			0x41 | |
| 2325 | #define	PMCR_FZS			(1ul << 32) /* Freeze-on-SPE event */ | |
| 2007 | 2326 | |
| 2008 | 2327 | /* PMEVCNTR<n>_EL0 */ |
| 2009 | 2328 | #define	PMEVCNTR_EL0_op0		3 |
| ... | ... | @@ -2035,7 +2354,6 @@ |
| 2035 | 2354 | #define	PMEVTYPER_P			(1 << 31) /* Privileged filtering */ |
| 2036 | 2355 | |
| 2037 | 2356 | /* PMINTENCLR_EL1 */ |
| 2038 | #define	PMINTENCLR_EL1			MRS_REG(PMINTENCLR_EL1) | |
| 2039 | 2357 | #define	PMINTENCLR_EL1_op0		3 |
| 2040 | 2358 | #define	PMINTENCLR_EL1_op1		0 |
| 2041 | 2359 | #define	PMINTENCLR_EL1_CRn		9 |
| ... | ... | @@ -2043,7 +2361,6 @@ |
| 2043 | 2361 | #define	PMINTENCLR_EL1_op2		2 |
| 2044 | 2362 | |
| 2045 | 2363 | /* PMINTENSET_EL1 */ |
| 2046 | #define	PMINTENSET_EL1			MRS_REG(PMINTENSET_EL1) | |
| 2047 | 2364 | #define	PMINTENSET_EL1_op0		3 |
| 2048 | 2365 | #define	PMINTENSET_EL1_op1		0 |
| 2049 | 2366 | #define	PMINTENSET_EL1_CRn		9 |
| ... | ... | @@ -2051,7 +2368,6 @@ |
| 2051 | 2368 | #define	PMINTENSET_EL1_op2		1 |
| 2052 | 2369 | |
| 2053 | 2370 | /* PMMIR_EL1 */ |
| 2054 | #define	PMMIR_EL1			MRS_REG(PMMIR_EL1) | |
| 2055 | 2371 | #define	PMMIR_EL1_op0			3 |
| 2056 | 2372 | #define	PMMIR_EL1_op1			0 |
| 2057 | 2373 | #define	PMMIR_EL1_CRn			9 |
| ... | ... | @@ -2059,7 +2375,6 @@ |
| 2059 | 2375 | #define	PMMIR_EL1_op2			6 |
| 2060 | 2376 | |
| 2061 | 2377 | /* PMOVSCLR_EL0 */ |
| 2062 | #define	PMOVSCLR_EL0			MRS_REG(PMOVSCLR_EL0) | |
| 2063 | 2378 | #define	PMOVSCLR_EL0_op0		3 |
| 2064 | 2379 | #define	PMOVSCLR_EL0_op1		3 |
| 2065 | 2380 | #define	PMOVSCLR_EL0_CRn		9 |
| ... | ... | @@ -2067,7 +2382,6 @@ |
| 2067 | 2382 | #define	PMOVSCLR_EL0_op2		3 |
| 2068 | 2383 | |
| 2069 | 2384 | /* PMOVSSET_EL0 */ |
| 2070 | #define	PMOVSSET_EL0			MRS_REG(PMOVSSET_EL0) | |
| 2071 | 2385 | #define	PMOVSSET_EL0_op0		3 |
| 2072 | 2386 | #define	PMOVSSET_EL0_op1		3 |
| 2073 | 2387 | #define	PMOVSSET_EL0_CRn		9 |
| ... | ... | @@ -2075,7 +2389,6 @@ |
| 2075 | 2389 | #define	PMOVSSET_EL0_op2		3 |
| 2076 | 2390 | |
| 2077 | 2391 | /* PMSCR_EL1 */ |
| 2078 | #define	PMSCR_EL1			MRS_REG(PMSCR_EL1) | |
| 2079 | 2392 | #define	PMSCR_EL1_REG			MRS_REG_ALT_NAME(PMSCR_EL1) |
| 2080 | 2393 | #define	PMSCR_EL1_op0			3 |
| 2081 | 2394 | #define	PMSCR_EL1_op1			0 |
| ... | ... | @@ -2096,7 +2409,6 @@ |
| 2096 | 2409 | #define	PMSCR_PCT_MASK			(UL(0x3) << PMSCR_PCT_SHIFT) |
| 2097 | 2410 | |
| 2098 | 2411 | /* PMSELR_EL0 */ |
| 2099 | #define	PMSELR_EL0			MRS_REG(PMSELR_EL0) | |
| 2100 | 2412 | #define	PMSELR_EL0_op0			3 |
| 2101 | 2413 | #define	PMSELR_EL0_op1			3 |
| 2102 | 2414 | #define	PMSELR_EL0_CRn			9 |
| ... | ... | @@ -2105,7 +2417,6 @@ |
| 2105 | 2417 | #define	PMSELR_SEL_MASK			0x1f |
| 2106 | 2418 | |
| 2107 | 2419 | /* PMSEVFR_EL1 */ |
| 2108 | #define	PMSEVFR_EL1			MRS_REG(PMSEVFR_EL1) | |
| 2109 | 2420 | #define	PMSEVFR_EL1_REG			MRS_REG_ALT_NAME(PMSEVFR_EL1) |
| 2110 | 2421 | #define	PMSEVFR_EL1_op0			3 |
| 2111 | 2422 | #define	PMSEVFR_EL1_op1			0 |
| ... | ... | @@ -2114,7 +2425,6 @@ |
| 2114 | 2425 | #define	PMSEVFR_EL1_op2			5 |
| 2115 | 2426 | |
| 2116 | 2427 | /* PMSFCR_EL1 */ |
| 2117 | #define	PMSFCR_EL1			MRS_REG(PMSFCR_EL1) | |
| 2118 | 2428 | #define	PMSFCR_EL1_REG			MRS_REG_ALT_NAME(PMSFCR_EL1) |
| 2119 | 2429 | #define	PMSFCR_EL1_op0			3 |
| 2120 | 2430 | #define	PMSFCR_EL1_op1			0 |
| ... | ... | @@ -2137,7 +2447,6 @@ |
| 2137 | 2447 | #define	PMSFCR_ST			(UL(0x1) << PMSFCR_ST_SHIFT) |
| 2138 | 2448 | |
| 2139 | 2449 | /* PMSICR_EL1 */ |
| 2140 | #define	PMSICR_EL1			MRS_REG(PMSICR_EL1) | |
| 2141 | 2450 | #define	PMSICR_EL1_REG			MRS_REG_ALT_NAME(PMSICR_EL1) |
| 2142 | 2451 | #define	PMSICR_EL1_op0			3 |
| 2143 | 2452 | #define	PMSICR_EL1_op1			0 |
| ... | ... | @@ -2150,7 +2459,6 @@ |
| 2150 | 2459 | #define	PMSICR_ECOUNT_MASK		(UL(0xff) << PMSICR_ECOUNT_SHIFT) |
| 2151 | 2460 | |
| 2152 | 2461 | /* PMSIDR_EL1 */ |
| 2153 | #define	PMSIDR_EL1			MRS_REG(PMSIDR_EL1) | |
| 2154 | 2462 | #define	PMSIDR_EL1_REG			MRS_REG_ALT_NAME(PMSIDR_EL1) |
| 2155 | 2463 | #define	PMSIDR_EL1_op0			3 |
| 2156 | 2464 | #define	PMSIDR_EL1_op1			0 |
| ... | ... | @@ -2183,7 +2491,6 @@ |
| 2183 | 2491 | #define	PMSIDR_PBT			(UL(0x1) << PMSIDR_PBT_SHIFT) |
| 2184 | 2492 | |
| 2185 | 2493 | /* PMSIRR_EL1 */ |
| 2186 | #define	PMSIRR_EL1			MRS_REG(PMSIRR_EL1) | |
| 2187 | 2494 | #define	PMSIRR_EL1_REG			MRS_REG_ALT_NAME(PMSIRR_EL1) |
| 2188 | 2495 | #define	PMSIRR_EL1_op0			3 |
| 2189 | 2496 | #define	PMSIRR_EL1_op1			0 |
| ... | ... | @@ -2196,7 +2503,6 @@ |
| 2196 | 2503 | #define	PMSIRR_INTERVAL_MASK		(UL(0xffffff) << PMSIRR_INTERVAL_SHIFT) |
| 2197 | 2504 | |
| 2198 | 2505 | /* PMSLATFR_EL1 */ |
| 2199 | #define	PMSLATFR_EL1			MRS_REG(PMSLATFR_EL1) | |
| 2200 | 2506 | #define	PMSLATFR_EL1_REG		MRS_REG_ALT_NAME(PMSLATFR_EL1) |
| 2201 | 2507 | #define	PMSLATFR_EL1_op0		3 |
| 2202 | 2508 | #define	PMSLATFR_EL1_op1		0 |
| ... | ... | @@ -2207,7 +2513,6 @@ |
| 2207 | 2513 | #define	PMSLATFR_MINLAT_MASK		(UL(0xfff) << PMSLATFR_MINLAT_SHIFT) |
| 2208 | 2514 | |
| 2209 | 2515 | /* PMSNEVFR_EL1 */ |
| 2210 | #define	PMSNEVFR_EL1			MRS_REG(PMSNEVFR_EL1) | |
| 2211 | 2516 | #define	PMSNEVFR_EL1_REG		MRS_REG_ALT_NAME(PMSNEVFR_EL1) |
| 2212 | 2517 | #define	PMSNEVFR_EL1_op0		3 |
| 2213 | 2518 | #define	PMSNEVFR_EL1_op1		0 |
| ... | ... | @@ -2216,7 +2521,6 @@ |
| 2216 | 2521 | #define	PMSNEVFR_EL1_op2		1 |
| 2217 | 2522 | |
| 2218 | 2523 | /* PMSWINC_EL0 */ |
| 2219 | #define	PMSWINC_EL0			MRS_REG(PMSWINC_EL0) | |
| 2220 | 2524 | #define	PMSWINC_EL0_op0			3 |
| 2221 | 2525 | #define	PMSWINC_EL0_op1			3 |
| 2222 | 2526 | #define	PMSWINC_EL0_CRn			9 |
| ... | ... | @@ -2224,7 +2528,6 @@ |
| 2224 | 2528 | #define	PMSWINC_EL0_op2			4 |
| 2225 | 2529 | |
| 2226 | 2530 | /* PMUSERENR_EL0 */ |
| 2227 | #define	PMUSERENR_EL0			MRS_REG(PMUSERENR_EL0) | |
| 2228 | 2531 | #define	PMUSERENR_EL0_op0		3 |
| 2229 | 2532 | #define	PMUSERENR_EL0_op1		3 |
| 2230 | 2533 | #define	PMUSERENR_EL0_CRn		9 |
| ... | ... | @@ -2232,7 +2535,6 @@ |
| 2232 | 2535 | #define	PMUSERENR_EL0_op2		0 |
| 2233 | 2536 | |
| 2234 | 2537 | /* PMXEVCNTR_EL0 */ |
| 2235 | #define	PMXEVCNTR_EL0			MRS_REG(PMXEVCNTR_EL0) | |
| 2236 | 2538 | #define	PMXEVCNTR_EL0_op0		3 |
| 2237 | 2539 | #define	PMXEVCNTR_EL0_op1		3 |
| 2238 | 2540 | #define	PMXEVCNTR_EL0_CRn		9 |
| ... | ... | @@ -2240,7 +2542,6 @@ |
| 2240 | 2542 | #define	PMXEVCNTR_EL0_op2		2 |
| 2241 | 2543 | |
| 2242 | 2544 | /* PMXEVTYPER_EL0 */ |
| 2243 | #define	PMXEVTYPER_EL0			MRS_REG(PMXEVTYPER_EL0) | |
| 2244 | 2545 | #define	PMXEVTYPER_EL0_op0		3 |
| 2245 | 2546 | #define	PMXEVTYPER_EL0_op1		3 |
| 2246 | 2547 | #define	PMXEVTYPER_EL0_CRn		9 |
| ... | ... | @@ -2248,7 +2549,6 @@ |
| 2248 | 2549 | #define	PMXEVTYPER_EL0_op2		1 |
| 2249 | 2550 | |
| 2250 | 2551 | /* RNDRRS */ |
| 2251 | #define	RNDRRS				MRS_REG(RNDRRS) | |
| 2252 | 2552 | #define	RNDRRS_REG			MRS_REG_ALT_NAME(RNDRRS) |
| 2253 | 2553 | #define	RNDRRS_op0			3 |
| 2254 | 2554 | #define	RNDRRS_op1			3 |
| ... | ... | @@ -2313,6 +2613,26 @@ |
| 2313 | 2613 | #define	SCTLR_EnALS			(UL(0x1) << 56) |
| 2314 | 2614 | #define	SCTLR_EPAN			(UL(0x1) << 57) |
| 2315 | 2615 | |
| 2616 | #define	SCTLR_MMU_OFF			\ | |
| 2617 | (SCTLR_LSMAOE | SCTLR_nTLSMD | SCTLR_EIS | SCTLR_TSCXT | SCTLR_EOS) | |
| 2618 | #define	SCTLR_MMU_ON			\ | |
| 2619 | (SCTLR_MMU_OFF |			\ | |
| 2620 | SCTLR_BT1 |			\ | |
| 2621 | SCTLR_BT0 |			\ | |
| 2622 | SCTLR_UCI |			\ | |
| 2623 | SCTLR_SPAN |			\ | |
| 2624 | SCTLR_nTWE |			\ | |
| 2625 | SCTLR_nTWI |			\ | |
| 2626 | SCTLR_UCT |			\ | |
| 2627 | SCTLR_DZE |			\ | |
| 2628 | SCTLR_I |				\ | |
| 2629 | SCTLR_SED |			\ | |
| 2630 | SCTLR_CP15BEN |			\ | |
| 2631 | SCTLR_SA0 |			\ | |
| 2632 | SCTLR_SA |				\ | |
| 2633 | SCTLR_C |				\ | |
| 2634 | SCTLR_M) | |
| 2635 | ||
| 2316 | 2636 | /* SCTLR_EL12 */ |
| 2317 | 2637 | #define	SCTLR_EL12_REG			MRS_REG_ALT_NAME(SCTLR_EL12) |
| 2318 | 2638 | #define	SCTLR_EL12_op0			3 |
| ... | ... | @@ -2354,7 +2674,8 @@ |
| 2354 | 2674 | #define	PSR_D		0x00000200UL |
| 2355 | 2675 | #define	PSR_DAIF	(PSR_D | PSR_A | PSR_I | PSR_F) |
| 2356 | 2676 | /* The default DAIF mask. These bits are valid in spsr_el1 and daif */ |
| 2357 | #define	PSR_DAIF_DEFAULT (PSR_F) | |
| 2677 | #define	PSR_DAIF_DEFAULT (0) | |
| 2678 | #define	PSR_DAIF_INTR	(PSR_I | PSR_F) | |
| 2358 | 2679 | #define	PSR_BTYPE	0x00000c00UL |
| 2359 | 2680 | #define	PSR_SSBS	0x00001000UL |
| 2360 | 2681 | #define	PSR_ALLINT	0x00002000UL |
| ... | ... | @@ -2382,7 +2703,6 @@ |
| 2382 | 2703 | #define	SPSR_EL12_op2			0 |
| 2383 | 2704 | |
| 2384 | 2705 | /* REVIDR_EL1 - Revision ID Register */ |
| 2385 | #define	REVIDR_EL1			MRS_REG(REVIDR_EL1) | |
| 2386 | 2706 | #define	REVIDR_EL1_op0			3 |
| 2387 | 2707 | #define	REVIDR_EL1_op1			0 |
| 2388 | 2708 | #define	REVIDR_EL1_CRn			0 |
| ... | ... | @@ -2496,14 +2816,6 @@ |
| 2496 | 2816 | #define	TCR_T0SZ(x)		((x) << TCR_T0SZ_SHIFT) |
| 2497 | 2817 | #define	TCR_TxSZ(x)		(TCR_T1SZ(x) | TCR_T0SZ(x)) |
| 2498 | 2818 | |
| 2499 | #define	TCR_CACHE_ATTRS	((TCR_IRGN0_WBWA | TCR_IRGN1_WBWA) |\ | |
| 2500 | 				(TCR_ORGN0_WBWA | TCR_ORGN1_WBWA)) | |
| 2501 | #ifdef SMP | |
| 2502 | #define	TCR_SMP_ATTRS	(TCR_SH0_IS | TCR_SH1_IS) | |
| 2503 | #else | |
| 2504 | #define	TCR_SMP_ATTRS	0 | |
| 2505 | #endif | |
| 2506 | ||
| 2507 | 2819 | /* TCR_EL12 */ |
| 2508 | 2820 | #define	TCR_EL12_REG			MRS_REG_ALT_NAME(TCR_EL12) |
| 2509 | 2821 | #define	TCR_EL12_op0			3 |
| ... | ... | @@ -2568,13 +2880,12 @@ |
| 2568 | 2880 | #define	VBAR_EL12_op2			0 |
| 2569 | 2881 | |
| 2570 | 2882 | /* ZCR_EL1 - SVE Control Register */ |
| 2571 | #define	ZCR_EL1			MRS_REG(ZCR_EL1) | |
| 2572 | #define	ZCR_EL1_REG		MRS_REG_ALT_NAME(ZCR_EL1_REG) | |
| 2573 | #define	ZCR_EL1_REG_op0		3 | |
| 2574 | #define	ZCR_EL1_REG_op1		0 | |
| 2575 | #define	ZCR_EL1_REG_CRn		1 | |
| 2576 | #define	ZCR_EL1_REG_CRm		2 | |
| 2577 | #define	ZCR_EL1_REG_op2		0 | |
| 2883 | #define	ZCR_EL1_REG		MRS_REG_ALT_NAME(ZCR_EL1) | |
| 2884 | #define	ZCR_EL1_op0		3 | |
| 2885 | #define	ZCR_EL1_op1		0 | |
| 2886 | #define	ZCR_EL1_CRn		1 | |
| 2887 | #define	ZCR_EL1_CRm		2 | |
| 2888 | #define	ZCR_EL1_op2		0 | |
| 2578 | 2889 | #define	ZCR_LEN_SHIFT		0 |
| 2579 | 2890 | #define	ZCR_LEN_MASK		(0xf << ZCR_LEN_SHIFT) |
| 2580 | 2891 | #define	ZCR_LEN_BYTES(x)	((((x) & ZCR_LEN_MASK) + 1) * 16) |
lib/libc/include/aarch64-freebsd-none/machine/asm.h+20-3| ... | ... | @@ -72,6 +72,17 @@ |
| 72 | 72 | /* Alias for link register x30 */ |
| 73 | 73 | #define	lr		x30 |
| 74 | 74 | |
| 75 | /* | |
| 76 | * Check whether a given cpu feature is present, in the case it is not we jump | |
| 77 | * to the given label. The tmp register should be a register able to hold the | |
| 78 | * temporary data. | |
| 79 | */ | |
| 80 | #define CHECK_CPU_FEAT(tmp, feat_reg, feat, min_val, label)	\ | |
| 81 | 	mrs tmp, ##feat_reg##_el1;				\ | |
| 82 | 	ubfx tmp, tmp, ##feat_reg##_##feat##_SHIFT, ##feat_reg##_##feat##_WIDTH; \ | |
| 83 | 	cmp tmp, #(##feat_reg##_##feat##_##min_val## >> ##feat_reg##_##feat##_SHIFT); \ | |
| 84 | 	b.lt label | |
| 85 | ||
| 75 | 86 | /* |
| 76 | 87 | * Sets the trap fault handler. The exception handler will return to the |
| 77 | 88 | * address in the handler register on a data abort or the xzr register to |
| ... | ... | @@ -87,19 +98,25 @@ |
| 87 | 98 | 	ldr	tmp, =has_pan;			/* Get the addr of has_pan */ \ |
| 88 | 99 | 	ldr	reg, [tmp];			/* Read it */		\ |
| 89 | 100 | 	cbz	reg, 997f;			/* If no PAN skip */	\ |
| 90 | 	.inst	0xd500409f | (0 << 8);		/* Clear PAN */		\ | |
| 101 | 	.arch_extension pan;						\ | |
| 102 | 	msr pan, #0;				/* Disable PAN checks */ \ | |
| 103 | 	.arch_extension nopan;						\ | |
| 91 | 104 | 	997: |
| 92 | 105 | |
| 93 | 106 | #define	EXIT_USER_ACCESS(reg)						\ |
| 94 | 107 | 	cbz	reg, 998f;			/* If no PAN skip */	\ |
| 95 | 	.inst	0xd500409f | (1 << 8);		/* Set PAN */		\ | |
| 108 | 	.arch_extension pan;						\ | |
| 109 | 	msr pan, #1;				/* Enable PAN checks */ \ | |
| 110 | 	.arch_extension nopan;						\ | |
| 96 | 111 | 	998: |
| 97 | 112 | |
| 98 | 113 | #define	EXIT_USER_ACCESS_CHECK(reg, tmp)				\ |
| 99 | 114 | 	ldr	tmp, =has_pan;			/* Get the addr of has_pan */ \ |
| 100 | 115 | 	ldr	reg, [tmp];			/* Read it */		\ |
| 101 | 116 | 	cbz	reg, 999f;			/* If no PAN skip */	\ |
| 102 | 	.inst	0xd500409f | (1 << 8);		/* Set PAN */		\ | |
| 117 | 	.arch_extension pan;						\ | |
| 118 | 	msr pan, #1;				/* Enable PAN checks */ \ | |
| 119 | 	.arch_extension nopan;						\ | |
| 103 | 120 | 	999: |
| 104 | 121 | |
| 105 | 122 | /* |
lib/libc/include/aarch64-freebsd-none/machine/atomic.h+3-1| ... | ... | @@ -465,7 +465,7 @@ _ATOMIC_TEST_OP(set, orr, set) |
| 465 | 465 | |
| 466 | 466 | #define	_ATOMIC_LOAD_ACQ_IMPL(t, w, s)					\ |
| 467 | 467 | static __inline uint##t##_t						\ |
| 468 | atomic_load_acq_##t(volatile uint##t##_t *p)				\ | |
| 468 | atomic_load_acq_##t(const volatile uint##t##_t *p)			\ | |
| 469 | 469 | {									\ |
| 470 | 470 | 	uint##t##_t ret;						\ |
| 471 | 471 | 									\ |
| ... | ... | @@ -609,6 +609,8 @@ _ATOMIC_STORE_REL_IMPL(64, , ) |
| 609 | 609 | #define	atomic_set_ptr			atomic_set_64 |
| 610 | 610 | #define	atomic_swap_ptr			atomic_swap_64 |
| 611 | 611 | #define	atomic_subtract_ptr		atomic_subtract_64 |
| 612 | #define	atomic_testandclear_ptr		atomic_testandclear_64 | |
| 613 | #define	atomic_testandset_ptr		atomic_testandset_64 | |
| 612 | 614 | |
| 613 | 615 | #define	atomic_add_acq_long		atomic_add_acq_64 |
| 614 | 616 | #define	atomic_fcmpset_acq_long		atomic_fcmpset_acq_64 |
lib/libc/include/aarch64-freebsd-none/machine/bus.h+1| ... | ... | @@ -76,6 +76,7 @@ |
| 76 | 76 | |
| 77 | 77 | #define	BUS_SPACE_MAXADDR_24BIT	0xFFFFFFUL |
| 78 | 78 | #define	BUS_SPACE_MAXADDR_32BIT 0xFFFFFFFFUL |
| 79 | #define	BUS_SPACE_MAXADDR_36BIT 0xFFFFFFFFFUL | |
| 79 | 80 | #define	BUS_SPACE_MAXADDR_40BIT	0xFFFFFFFFFFUL |
| 80 | 81 | #define	BUS_SPACE_MAXSIZE_24BIT	0xFFFFFFUL |
| 81 | 82 | #define	BUS_SPACE_MAXSIZE_32BIT	0xFFFFFFFFUL |
lib/libc/include/aarch64-freebsd-none/machine/bus_dma.h+13-1| ... | ... | @@ -61,7 +61,7 @@ bus_dmamem_alloc(bus_dma_tag_t dmat, void** vaddr, int flags, |
| 61 | 61 | |
| 62 | 62 | /* |
| 63 | 63 | * Free a piece of memory and it's allociated dmamap, that was allocated |
| 64 | * via bus_dmamem_alloc. Make the same choice for free/contigfree. | |
| 64 | * via bus_dmamem_alloc. | |
| 65 | 65 | */ |
| 66 | 66 | static inline void |
| 67 | 67 | bus_dmamem_free(bus_dma_tag_t dmat, void *vaddr, bus_dmamap_t map) |
| ... | ... | @@ -148,4 +148,16 @@ _bus_dmamap_complete(bus_dma_tag_t dmat, bus_dmamap_t map, |
| 148 | 148 | 	return (tc->impl->map_complete(dmat, map, segs, nsegs, error)); |
| 149 | 149 | } |
| 150 | 150 | |
| 151 | #ifdef KMSAN | |
| 152 | static inline void | |
| 153 | _bus_dmamap_load_kmsan(bus_dma_tag_t dmat, bus_dmamap_t map, | |
| 154 | struct memdesc *mem) | |
| 155 | { | |
| 156 | 	struct bus_dma_tag_common *tc; | |
| 157 | ||
| 158 | 	tc = (struct bus_dma_tag_common *)dmat; | |
| 159 | 	return (tc->impl->load_kmsan(map, mem)); | |
| 160 | } | |
| 161 | #endif | |
| 162 | ||
| 151 | 163 | #endif /* !_MACHINE_BUS_DMA_H_ */ |
| \ No newline at end of file |
lib/libc/include/aarch64-freebsd-none/machine/bus_dma_impl.h+7-11| ... | ... | @@ -31,28 +31,23 @@ |
| 31 | 31 | |
| 32 | 32 | struct bus_dma_tag_common { |
| 33 | 33 | 	struct bus_dma_impl *impl; |
| 34 | 	struct bus_dma_tag_common *parent; | |
| 35 | 34 | 	bus_size_t	 alignment; |
| 36 | 35 | 	bus_addr_t	 boundary; |
| 37 | 36 | 	bus_addr_t	 lowaddr; |
| 38 | 37 | 	bus_addr_t	 highaddr; |
| 39 | 	bus_dma_filter_t *filter; | |
| 40 | 	void		 *filterarg; | |
| 41 | 38 | 	bus_size_t	 maxsize; |
| 42 | 39 | 	u_int		 nsegments; |
| 43 | 40 | 	bus_size_t	 maxsegsz; |
| 44 | 41 | 	int		 flags; |
| 45 | 42 | 	bus_dma_lock_t	 *lockfunc; |
| 46 | 43 | 	void		 *lockfuncarg; |
| 47 | 	int		 ref_count; | |
| 48 | 44 | 	int		 domain; |
| 49 | 45 | }; |
| 50 | 46 | |
| 51 | 47 | struct bus_dma_impl { |
| 52 | 48 | 	int (*tag_create)(bus_dma_tag_t parent, |
| 53 | 49 | 	 bus_size_t alignment, bus_addr_t boundary, bus_addr_t lowaddr, |
| 54 | 	 bus_addr_t highaddr, bus_dma_filter_t *filter, | |
| 55 | 	 void *filterarg, bus_size_t maxsize, int nsegments, | |
| 50 | 	 bus_addr_t highaddr, bus_size_t maxsize, int nsegments, | |
| 56 | 51 | 	 bus_size_t maxsegsz, int flags, bus_dma_lock_t *lockfunc, |
| 57 | 52 | 	 void *lockfuncarg, bus_dma_tag_t *dmat); |
| 58 | 53 | 	int (*tag_destroy)(bus_dma_tag_t dmat); |
| ... | ... | @@ -80,14 +75,15 @@ struct bus_dma_impl { |
| 80 | 75 | 	void (*map_unload)(bus_dma_tag_t dmat, bus_dmamap_t map); |
| 81 | 76 | 	void (*map_sync)(bus_dma_tag_t dmat, bus_dmamap_t map, |
| 82 | 77 | 	 bus_dmasync_op_t op); |
| 78 | #ifdef KMSAN | |
| 79 | 	void (*load_kmsan)(bus_dmamap_t map, struct memdesc *mem); | |
| 80 | #endif | |
| 83 | 81 | }; |
| 84 | 82 | |
| 85 | int bus_dma_run_filter(struct bus_dma_tag_common *dmat, bus_addr_t paddr); | |
| 86 | 83 | int common_bus_dma_tag_create(struct bus_dma_tag_common *parent, |
| 87 | bus_size_t alignment, | |
| 88 | bus_addr_t boundary, bus_addr_t lowaddr, bus_addr_t highaddr, | |
| 89 | bus_dma_filter_t *filter, void *filterarg, bus_size_t maxsize, | |
| 90 | int nsegments, bus_size_t maxsegsz, int flags, bus_dma_lock_t *lockfunc, | |
| 84 | bus_size_t alignment, bus_addr_t boundary, bus_addr_t lowaddr, | |
| 85 | bus_addr_t highaddr, bus_size_t maxsize, int nsegments, | |
| 86 | bus_size_t maxsegsz, int flags, bus_dma_lock_t *lockfunc, | |
| 91 | 87 | void *lockfuncarg, size_t sz, void **dmat); |
| 92 | 88 | |
| 93 | 89 | extern struct bus_dma_impl bus_dma_bounce_impl; |
lib/libc/include/aarch64-freebsd-none/machine/cpu.h+65-8| ... | ... | @@ -32,8 +32,6 @@ |
| 32 | 32 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 33 | 33 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 34 | 34 | * SUCH DAMAGE. |
| 35 | * | |
| 36 | *	from: @(#)cpu.h 5.4 (Berkeley) 5/9/91 | |
| 37 | 35 | *	from: FreeBSD: src/sys/i386/include/cpu.h,v 1.62 2001/06/29 |
| 38 | 36 | */ |
| 39 | 37 | |
| ... | ... | @@ -77,6 +75,7 @@ |
| 77 | 75 | #define	CPU_IMPL_CAVIUM		0x43 |
| 78 | 76 | #define	CPU_IMPL_DEC		0x44 |
| 79 | 77 | #define	CPU_IMPL_FUJITSU	0x46 |
| 78 | #define	CPU_IMPL_HISILICON	0x48 | |
| 80 | 79 | #define	CPU_IMPL_INFINEON	0x49 |
| 81 | 80 | #define	CPU_IMPL_FREESCALE	0x4D |
| 82 | 81 | #define	CPU_IMPL_NVIDIA		0x4E |
| ... | ... | @@ -86,6 +85,7 @@ |
| 86 | 85 | #define	CPU_IMPL_APPLE		0x61 |
| 87 | 86 | #define	CPU_IMPL_INTEL		0x69 |
| 88 | 87 | #define	CPU_IMPL_AMPERE		0xC0 |
| 88 | #define	CPU_IMPL_MICROSOFT	0x6D | |
| 89 | 89 | |
| 90 | 90 | /* ARM Part numbers */ |
| 91 | 91 | #define	CPU_PART_FOUNDATION	0xD00 |
| ... | ... | @@ -105,6 +105,7 @@ |
| 105 | 105 | #define	CPU_PART_AEM_V8		0xD0F |
| 106 | 106 | #define	CPU_PART_NEOVERSE_V1	0xD40 |
| 107 | 107 | #define	CPU_PART_CORTEX_A78	0xD41 |
| 108 | #define	CPU_PART_CORTEX_A78AE	0xD42 | |
| 108 | 109 | #define	CPU_PART_CORTEX_A65AE	0xD43 |
| 109 | 110 | #define	CPU_PART_CORTEX_X1	0xD44 |
| 110 | 111 | #define	CPU_PART_CORTEX_A510	0xD46 |
| ... | ... | @@ -117,6 +118,18 @@ |
| 117 | 118 | #define	CPU_PART_CORTEX_A715	0xD4D |
| 118 | 119 | #define	CPU_PART_CORTEX_X3	0xD4E |
| 119 | 120 | #define	CPU_PART_NEOVERSE_V2	0xD4F |
| 121 | #define	CPU_PART_CORTEX_A520	0xD80 | |
| 122 | #define	CPU_PART_CORTEX_A720	0xD81 | |
| 123 | #define	CPU_PART_CORTEX_X4	0xD82 | |
| 124 | #define	CPU_PART_NEOVERSE_V3AE	0xD83 | |
| 125 | #define	CPU_PART_NEOVERSE_V3	0xD84 | |
| 126 | #define	CPU_PART_CORTEX_X925	0xD85 | |
| 127 | #define	CPU_PART_CORTEX_A725	0xD87 | |
| 128 | #define	CPU_PART_C1_NANO	0xD8A | |
| 129 | #define	CPU_PART_C1_PRO		0xD8B | |
| 130 | #define	CPU_PART_C1_ULTRA	0xD8C | |
| 131 | #define	CPU_PART_NEOVERSE_N3	0xD8E | |
| 132 | #define	CPU_PART_C1_PREMIUM	0xD90 | |
| 120 | 133 | |
| 121 | 134 | /* Cavium Part numbers */ |
| 122 | 135 | #define	CPU_PART_THUNDERX	0x0A1 |
| ... | ... | @@ -129,9 +142,16 @@ |
| 129 | 142 | |
| 130 | 143 | #define	CPU_REV_THUNDERX2_0	0x00 |
| 131 | 144 | |
| 132 | /* APM / Ampere Part Number */ | |
| 145 | /* APM (now Ampere) Part number */ | |
| 133 | 146 | #define CPU_PART_EMAG8180	0x000 |
| 134 | 147 | |
| 148 | /* Ampere Part numbers */ | |
| 149 | #define	CPU_PART_AMPERE1	0xAC3 | |
| 150 | #define	CPU_PART_AMPERE1A	0xAC4 | |
| 151 | ||
| 152 | /* Microsoft Part numbers */ | |
| 153 | #define	CPU_PART_AZURE_COBALT_100	0xD49 | |
| 154 | ||
| 135 | 155 | /* Qualcomm */ |
| 136 | 156 | #define	CPU_PART_KRYO400_GOLD	0x804 |
| 137 | 157 | #define	CPU_PART_KRYO400_SILVER	0x805 |
| ... | ... | @@ -177,8 +197,30 @@ |
| 177 | 197 | (((mask) & PCPU_GET(midr)) ==			\ |
| 178 | 198 | ((mask) & CPU_ID_RAW((impl), (part), (var), (rev)))) |
| 179 | 199 | |
| 180 | #define	CPU_MATCH_RAW(mask, devid)			\ | |
| 181 | (((mask) & PCPU_GET(midr)) == ((mask) & (devid))) | |
| 200 | #if !defined(__ASSEMBLER__) | |
| 201 | static inline bool | |
| 202 | midr_check_var_part_range(u_int midr, u_int impl, u_int part, u_int var_low, | |
| 203 | u_int part_low, u_int var_high, u_int part_high) | |
| 204 | { | |
| 205 | 	/* Check for the correct part */ | |
| 206 | 	if (CPU_IMPL(midr) != impl || CPU_PART(midr) != part) | |
| 207 | 		return (false); | |
| 208 | ||
| 209 | 	/* Check if the variant is between var_low and var_high inclusive */ | |
| 210 | 	if (CPU_VAR(midr) < var_low || CPU_VAR(midr) > var_high) | |
| 211 | 		return (false); | |
| 212 | ||
| 213 | 	/* If the variant is the low value, check if the part is high enough */ | |
| 214 | 	if (CPU_VAR(midr) == var_low && CPU_PART(midr) < part_low) | |
| 215 | 		return (false); | |
| 216 | ||
| 217 | 	/* If the variant is the high value, check if the part is low enough */ | |
| 218 | 	if (CPU_VAR(midr) == var_high && CPU_PART(midr) > part_high) | |
| 219 | 		return (false); | |
| 220 | ||
| 221 | 	return (true); | |
| 222 | } | |
| 223 | #endif | |
| 182 | 224 | |
| 183 | 225 | /* |
| 184 | 226 | * Chip-specific errata. This defines are intended to be |
| ... | ... | @@ -210,6 +252,12 @@ extern uint64_t __cpu_affinity[]; |
| 210 | 252 | |
| 211 | 253 | struct arm64_addr_mask; |
| 212 | 254 | extern struct arm64_addr_mask elf64_addr_mask; |
| 255 | #ifdef COMPAT_FREEBSD14 | |
| 256 | extern struct arm64_addr_mask elf64_addr_mask_14; | |
| 257 | #endif | |
| 258 | ||
| 259 | typedef void (*cpu_reset_hook_t)(void); | |
| 260 | extern cpu_reset_hook_t cpu_reset_hook; | |
| 213 | 261 | |
| 214 | 262 | void	cpu_halt(void) __dead2; |
| 215 | 263 | void	cpu_reset(void) __dead2; |
| ... | ... | @@ -231,9 +279,18 @@ void	ptrauth_mp_start(uint64_t); |
| 231 | 279 | |
| 232 | 280 | /* Functions to read the sanitised view of the special registers */ |
| 233 | 281 | void	update_special_regs(u_int); |
| 234 | bool	extract_user_id_field(u_int, u_int, uint8_t *); | |
| 235 | bool	get_kernel_reg(u_int, uint64_t *); | |
| 236 | bool	get_kernel_reg_masked(u_int, uint64_t *, uint64_t); | |
| 282 | void	update_special_reg_iss(u_int, uint64_t, uint64_t); | |
| 283 | #define	update_special_reg(reg, clear, set)			\ | |
| 284 | update_special_reg_iss(reg ## _ISS, clear, set) | |
| 285 | bool	get_kernel_reg_iss(u_int, uint64_t *); | |
| 286 | #define	get_kernel_reg(reg, valp)				\ | |
| 287 | get_kernel_reg_iss(reg ## _ISS, valp) | |
| 288 | bool	get_kernel_reg_iss_masked(u_int, uint64_t *, uint64_t); | |
| 289 | #define	get_kernel_reg_masked(reg, valp, mask)			\ | |
| 290 | get_kernel_reg_iss_masked(reg ## _ISS, valp, mask) | |
| 291 | bool	get_user_reg_iss(u_int, uint64_t *, bool); | |
| 292 | #define	get_user_reg(reg, valp, fbsd)					\ | |
| 293 | get_user_reg_iss(reg ## _ISS, valp, fbsd) | |
| 237 | 294 | |
| 238 | 295 | void	cpu_desc_init(void); |
| 239 | 296 |
lib/libc/include/aarch64-freebsd-none/machine/cpu_feat.h created+136| ... | ... | @@ -0,0 +1,136 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-2-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 2024 Arm Ltd | |
| 5 | * | |
| 6 | * Redistribution and use in source and binary forms, with or without | |
| 7 | * modification, are permitted provided that the following conditions | |
| 8 | * are met: | |
| 9 | * 1. Redistributions of source code must retain the above copyright | |
| 10 | * notice, this list of conditions and the following disclaimer. | |
| 11 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 12 | * notice, this list of conditions and the following disclaimer in the | |
| 13 | * documentation and/or other materials provided with the distribution. | |
| 14 | * | |
| 15 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |
| 16 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 17 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
| 18 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | |
| 19 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
| 20 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
| 21 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
| 22 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
| 23 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
| 24 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
| 25 | * SUCH DAMAGE. | |
| 26 | */ | |
| 27 | ||
| 28 | #ifndef _MACHINE_CPU_FEAT_H_ | |
| 29 | #define	_MACHINE_CPU_FEAT_H_ | |
| 30 | ||
| 31 | #include <sys/linker_set.h> | |
| 32 | #include <sys/sysctl.h> | |
| 33 | ||
| 34 | typedef enum { | |
| 35 | 	ERRATA_UNKNOWN,		/* Unknown erratum */ | |
| 36 | 	ERRATA_NONE,		/* No errata for this feature on this system. */ | |
| 37 | 	ERRATA_AFFECTED,	/* There is errata on this system. */ | |
| 38 | 	ERRATA_FW_MITIGAION,	/* There is errata, and a firmware */ | |
| 39 | 				/* mitigation. The mitigation may need a */ | |
| 40 | 				/* kernel component. */ | |
| 41 | } cpu_feat_errata; | |
| 42 | ||
| 43 | typedef enum { | |
| 44 | 	/* | |
| 45 | 	 * Don't implement the feature or erratum wrokarount, | |
| 46 | 	 * e.g. the feature is not implemented or erratum is | |
| 47 | 	 * for another CPU. | |
| 48 | 	 */ | |
| 49 | 	FEAT_ALWAYS_DISABLE, | |
| 50 | ||
| 51 | 	/* | |
| 52 | 	 * Disable by default, but allow the user to enable, | |
| 53 | 	 * e.g. For a rare erratum with a workaround, Arm | |
| 54 | 	 * Category B (rare) or similar. | |
| 55 | 	 */ | |
| 56 | 	FEAT_DEFAULT_DISABLE, | |
| 57 | ||
| 58 | 	/* | |
| 59 | 	 * Enabled by default, bit allow the user to disable, | |
| 60 | 	 * e.g. For a common erratum with a workaround, Arm | |
| 61 | 	 * Category A or B or similar. | |
| 62 | 	 */ | |
| 63 | 	FEAT_DEFAULT_ENABLE, | |
| 64 | ||
| 65 | 	/* We could add FEAT_ALWAYS_ENABLE if a need was found. */ | |
| 66 | } cpu_feat_en; | |
| 67 | ||
| 68 | #define	CPU_FEAT_STAGE_MASK	0x00000001 | |
| 69 | #define	CPU_FEAT_EARLY_BOOT	0x00000000 | |
| 70 | #define	CPU_FEAT_AFTER_DEV	0x00000001 | |
| 71 | ||
| 72 | #define	CPU_FEAT_SCOPE_MASK	0x00000010 | |
| 73 | #define	CPU_FEAT_PER_CPU	0x00000000 | |
| 74 | #define	CPU_FEAT_SYSTEM		0x00000010 | |
| 75 | ||
| 76 | #define	CPU_FEAT_USER_ENABLED	0x40000000 | |
| 77 | #define	CPU_FEAT_USER_DISABLED	0x80000000 | |
| 78 | ||
| 79 | struct cpu_feat; | |
| 80 | ||
| 81 | typedef cpu_feat_en (cpu_feat_check)(const struct cpu_feat *, u_int); | |
| 82 | typedef bool (cpu_feat_has_errata)(const struct cpu_feat *, u_int, | |
| 83 | u_int **, u_int *); | |
| 84 | typedef bool (cpu_feat_enable)(const struct cpu_feat *, cpu_feat_errata, | |
| 85 | u_int *, u_int); | |
| 86 | typedef void (cpu_feat_disabled)(const struct cpu_feat *); | |
| 87 | ||
| 88 | struct cpu_feat { | |
| 89 | 	const char		*feat_name; | |
| 90 | 	cpu_feat_check		*feat_check; | |
| 91 | 	cpu_feat_has_errata	*feat_has_errata; | |
| 92 | 	cpu_feat_enable		*feat_enable; | |
| 93 | 	cpu_feat_disabled	*feat_disabled; | |
| 94 | 	uint32_t		 feat_flags; | |
| 95 | 	bool			 feat_enabled; | |
| 96 | }; | |
| 97 | SET_DECLARE(cpu_feat_set, struct cpu_feat); | |
| 98 | ||
| 99 | SYSCTL_DECL(_hw_feat); | |
| 100 | ||
| 101 | #define	CPU_FEAT(name, descr, check, has_errata, enable, disabled, flags) \ | |
| 102 | static struct cpu_feat name = {						\ | |
| 103 | 	.feat_name		= #name,				\ | |
| 104 | 	.feat_check		= check,				\ | |
| 105 | 	.feat_has_errata	= has_errata,				\ | |
| 106 | 	.feat_enable		= enable,				\ | |
| 107 | 	.feat_disabled		= disabled,				\ | |
| 108 | 	.feat_flags		= flags,				\ | |
| 109 | 	.feat_enabled		= false,				\ | |
| 110 | };									\ | |
| 111 | DATA_SET(cpu_feat_set, name);						\ | |
| 112 | SYSCTL_BOOL(_hw_feat, OID_AUTO, name, CTLFLAG_RD, &name.feat_enabled,	\ | |
| 113 | 0, descr) | |
| 114 | ||
| 115 | /* | |
| 116 | * Allow drivers to mark an erratum as worked around, e.g. the Errata | |
| 117 | * Management ABI may know the workaround isn't needed on a given system. | |
| 118 | */ | |
| 119 | typedef cpu_feat_errata (*cpu_feat_errata_check_fn)(const struct cpu_feat *, | |
| 120 | u_int); | |
| 121 | void cpu_feat_register_errata_check(cpu_feat_errata_check_fn); | |
| 122 | ||
| 123 | void	enable_cpu_feat(uint32_t); | |
| 124 | ||
| 125 | /* Check if an erratum is in the list of errata */ | |
| 126 | static inline bool | |
| 127 | cpu_feat_has_erratum(u_int *errata_list, u_int errata_count, u_int erratum) | |
| 128 | { | |
| 129 | 	for (u_int i = 0; i < errata_count; i++) | |
| 130 | 		if (errata_list[0] == erratum) | |
| 131 | 			return (true); | |
| 132 | ||
| 133 | 	return (false); | |
| 134 | } | |
| 135 | ||
| 136 | #endif /* _MACHINE_CPU_FEAT_H_ */ | |
| \ No newline at end of file |
lib/libc/include/aarch64-freebsd-none/machine/cpufunc.h+29-11| ... | ... | @@ -41,8 +41,6 @@ breakpoint(void) |
| 41 | 41 | #ifdef _KERNEL |
| 42 | 42 | #include <machine/armreg.h> |
| 43 | 43 | |
| 44 | void pan_enable(void); | |
| 45 | ||
| 46 | 44 | static __inline register_t |
| 47 | 45 | dbg_disable(void) |
| 48 | 46 | { |
| ... | ... | @@ -160,6 +158,26 @@ invalidate_local_icache(void) |
| 160 | 158 | 	 "isb \n"); |
| 161 | 159 | } |
| 162 | 160 | |
| 161 | static __inline void | |
| 162 | wfet(uint64_t val) | |
| 163 | { | |
| 164 | 	__asm __volatile( | |
| 165 | 		"msr s0_3_c1_c0_0, %0\n" | |
| 166 | 		: | |
| 167 | 		: "r" ((val)) | |
| 168 | 		: "memory"); | |
| 169 | } | |
| 170 | ||
| 171 | static __inline void | |
| 172 | wfit(uint64_t val) | |
| 173 | { | |
| 174 | 	__asm __volatile( | |
| 175 | 		"msr s0_3_c1_c0_1, %0\n" | |
| 176 | 		: | |
| 177 | 		: "r" ((val)) | |
| 178 | 		: "memory"); | |
| 179 | } | |
| 180 | ||
| 163 | 181 | extern bool icache_aliasing; |
| 164 | 182 | extern bool icache_vmid; |
| 165 | 183 | |
| ... | ... | @@ -177,21 +195,21 @@ extern int64_t dczva_line_size; |
| 177 | 195 | #define	cpu_dcache_inv_range(a, s)	arm64_dcache_inv_range((a), (s)) |
| 178 | 196 | #define	cpu_dcache_wb_range(a, s)	arm64_dcache_wb_range((a), (s)) |
| 179 | 197 | |
| 180 | extern void (*arm64_icache_sync_range)(vm_offset_t, vm_size_t); | |
| 198 | extern void (*arm64_icache_sync_range)(void *, vm_size_t); | |
| 181 | 199 | |
| 182 | 200 | #define	cpu_icache_sync_range(a, s)	arm64_icache_sync_range((a), (s)) |
| 183 | 201 | #define cpu_icache_sync_range_checked(a, s) arm64_icache_sync_range_checked((a), (s)) |
| 184 | 202 | |
| 185 | 203 | void arm64_nullop(void); |
| 186 | 204 | void arm64_tlb_flushID(void); |
| 187 | void arm64_dic_idc_icache_sync_range(vm_offset_t, vm_size_t); | |
| 188 | void arm64_idc_aliasing_icache_sync_range(vm_offset_t, vm_size_t); | |
| 189 | void arm64_aliasing_icache_sync_range(vm_offset_t, vm_size_t); | |
| 190 | int arm64_icache_sync_range_checked(vm_offset_t, vm_size_t); | |
| 191 | void arm64_dcache_wbinv_range(vm_offset_t, vm_size_t); | |
| 192 | void arm64_dcache_inv_range(vm_offset_t, vm_size_t); | |
| 193 | void arm64_dcache_wb_range(vm_offset_t, vm_size_t); | |
| 194 | bool arm64_get_writable_addr(vm_offset_t, vm_offset_t *); | |
| 205 | void arm64_dic_idc_icache_sync_range(void *, vm_size_t); | |
| 206 | void arm64_idc_aliasing_icache_sync_range(void *, vm_size_t); | |
| 207 | void arm64_aliasing_icache_sync_range(void *, vm_size_t); | |
| 208 | int arm64_icache_sync_range_checked(void *, vm_size_t); | |
| 209 | void arm64_dcache_wbinv_range(void *, vm_size_t); | |
| 210 | void arm64_dcache_inv_range(void *, vm_size_t); | |
| 211 | void arm64_dcache_wb_range(void *, vm_size_t); | |
| 212 | bool arm64_get_writable_addr(void *, void **); | |
| 195 | 213 | |
| 196 | 214 | #endif	/* _KERNEL */ |
| 197 | 215 | #endif	/* _MACHINE_CPUFUNC_H_ */ |
lib/libc/include/aarch64-freebsd-none/machine/db_machdep.h+3| ... | ... | @@ -40,6 +40,9 @@ |
| 40 | 40 | #define	T_SINGLESTEP	(EXCP_SOFTSTP_EL1) |
| 41 | 41 | #define	T_WATCHPOINT	(EXCP_WATCHPT_EL1) |
| 42 | 42 | |
| 43 | #define	HAS_HW_BREAKPOINT | |
| 44 | #define	NHBREAKPOINTS		16 | |
| 45 | ||
| 43 | 46 | typedef vm_offset_t	db_addr_t; |
| 44 | 47 | typedef long		db_expr_t; |
| 45 | 48 |
lib/libc/include/aarch64-freebsd-none/machine/debug_monitor.h+1| ... | ... | @@ -56,6 +56,7 @@ void dbg_monitor_init(void); |
| 56 | 56 | void dbg_register_sync(struct debug_monitor_state *); |
| 57 | 57 | |
| 58 | 58 | #ifdef DDB |
| 59 | void dbg_show_breakpoint(void); | |
| 59 | 60 | void dbg_show_watchpoint(void); |
| 60 | 61 | #endif |
| 61 | 62 |
lib/libc/include/aarch64-freebsd-none/machine/efi.h+3-1| ... | ... | @@ -35,6 +35,8 @@ |
| 35 | 35 | #ifndef __ARM64_INCLUDE_EFI_H_ |
| 36 | 36 | #define __ARM64_INCLUDE_EFI_H_ |
| 37 | 37 | |
| 38 | #include <sys/types.h> | |
| 39 | ||
| 38 | 40 | #define	EFIABI_ATTR |
| 39 | 41 | |
| 40 | 42 | #ifdef _KERNEL |
| ... | ... | @@ -44,7 +46,7 @@ |
| 44 | 46 | #define	EFI_TIME_UNLOCK() |
| 45 | 47 | #define	EFI_TIME_OWNED() |
| 46 | 48 | |
| 47 | #define	EFI_RT_HANDLE_FAULTS_DEFAULT	0 | |
| 49 | #define	EFI_RT_HANDLE_FAULTS_DEFAULT	1 | |
| 48 | 50 | #endif |
| 49 | 51 | |
| 50 | 52 | struct efirt_callinfo { |
lib/libc/include/aarch64-freebsd-none/machine/elf.h+100-77| ... | ... | @@ -93,91 +93,114 @@ __ElfType(Auxinfo); |
| 93 | 93 | #define	ET_DYN_LOAD_ADDR 0x100000 |
| 94 | 94 | #endif |
| 95 | 95 | |
| 96 | /* First __FreeBSD_version that supports Top Byte Ignore (TBI) */ | |
| 97 | #define	TBI_VERSION	1500058 | |
| 98 | ||
| 96 | 99 | /* HWCAP */ |
| 97 | #define	HWCAP_FP		0x00000001 | |
| 98 | #define	HWCAP_ASIMD		0x00000002 | |
| 99 | #define	HWCAP_EVTSTRM		0x00000004 | |
| 100 | #define	HWCAP_AES		0x00000008 | |
| 101 | #define	HWCAP_PMULL		0x00000010 | |
| 102 | #define	HWCAP_SHA1		0x00000020 | |
| 103 | #define	HWCAP_SHA2		0x00000040 | |
| 104 | #define	HWCAP_CRC32		0x00000080 | |
| 105 | #define	HWCAP_ATOMICS		0x00000100 | |
| 106 | #define	HWCAP_FPHP		0x00000200 | |
| 107 | #define	HWCAP_ASIMDHP		0x00000400 | |
| 100 | #define	HWCAP_FP		(1 << 0) | |
| 101 | #define	HWCAP_ASIMD		(1 << 1) | |
| 102 | #define	HWCAP_EVTSTRM		(1 << 2) | |
| 103 | #define	HWCAP_AES		(1 << 3) | |
| 104 | #define	HWCAP_PMULL		(1 << 4) | |
| 105 | #define	HWCAP_SHA1		(1 << 5) | |
| 106 | #define	HWCAP_SHA2		(1 << 6) | |
| 107 | #define	HWCAP_CRC32		(1 << 7) | |
| 108 | #define	HWCAP_ATOMICS		(1 << 8) | |
| 109 | #define	HWCAP_FPHP		(1 << 9) | |
| 110 | #define	HWCAP_ASIMDHP		(1 << 10) | |
| 108 | 111 | /* |
| 109 | 112 | * XXX: The following bits (from CPUID to FLAGM) were originally incorrect, |
| 110 | 113 | * but later changed to match the Linux definitions. No compatibility code is |
| 111 | 114 | * provided, as the fix was expected to result in near-zero fallout. |
| 112 | 115 | */ |
| 113 | #define	HWCAP_CPUID		0x00000800 | |
| 114 | #define	HWCAP_ASIMDRDM		0x00001000 | |
| 115 | #define	HWCAP_JSCVT		0x00002000 | |
| 116 | #define	HWCAP_FCMA		0x00004000 | |
| 117 | #define	HWCAP_LRCPC		0x00008000 | |
| 118 | #define	HWCAP_DCPOP		0x00010000 | |
| 119 | #define	HWCAP_SHA3		0x00020000 | |
| 120 | #define	HWCAP_SM3		0x00040000 | |
| 121 | #define	HWCAP_SM4		0x00080000 | |
| 122 | #define	HWCAP_ASIMDDP		0x00100000 | |
| 123 | #define	HWCAP_SHA512		0x00200000 | |
| 124 | #define	HWCAP_SVE		0x00400000 | |
| 125 | #define	HWCAP_ASIMDFHM		0x00800000 | |
| 126 | #define	HWCAP_DIT		0x01000000 | |
| 127 | #define	HWCAP_USCAT		0x02000000 | |
| 128 | #define	HWCAP_ILRCPC		0x04000000 | |
| 129 | #define	HWCAP_FLAGM		0x08000000 | |
| 130 | #define	HWCAP_SSBS		0x10000000 | |
| 131 | #define	HWCAP_SB		0x20000000 | |
| 132 | #define	HWCAP_PACA		0x40000000 | |
| 133 | #define	HWCAP_PACG		0x80000000 | |
| 116 | #define	HWCAP_CPUID		(1 << 11) | |
| 117 | #define	HWCAP_ASIMDRDM		(1 << 12) | |
| 118 | #define	HWCAP_JSCVT		(1 << 13) | |
| 119 | #define	HWCAP_FCMA		(1 << 14) | |
| 120 | #define	HWCAP_LRCPC		(1 << 15) | |
| 121 | #define	HWCAP_DCPOP		(1 << 16) | |
| 122 | #define	HWCAP_SHA3		(1 << 17) | |
| 123 | #define	HWCAP_SM3		(1 << 18) | |
| 124 | #define	HWCAP_SM4		(1 << 19) | |
| 125 | #define	HWCAP_ASIMDDP		(1 << 20) | |
| 126 | #define	HWCAP_SHA512		(1 << 21) | |
| 127 | #define	HWCAP_SVE		(1 << 22) | |
| 128 | #define	HWCAP_ASIMDFHM		(1 << 23) | |
| 129 | #define	HWCAP_DIT		(1 << 24) | |
| 130 | #define	HWCAP_USCAT		(1 << 25) | |
| 131 | #define	HWCAP_ILRCPC		(1 << 26) | |
| 132 | #define	HWCAP_FLAGM		(1 << 27) | |
| 133 | #define	HWCAP_SSBS		(1 << 28) | |
| 134 | #define	HWCAP_SB		(1 << 29) | |
| 135 | #define	HWCAP_PACA		(1 << 30) | |
| 136 | #define	HWCAP_PACG		(1UL << 31) | |
| 137 | #define	HWCAP_GCS		(1UL << 32) | |
| 134 | 138 | |
| 135 | 139 | /* HWCAP2 */ |
| 136 | #define	HWCAP2_DCPODP		0x0000000000000001ul | |
| 137 | #define	HWCAP2_SVE2		0x0000000000000002ul | |
| 138 | #define	HWCAP2_SVEAES		0x0000000000000004ul | |
| 139 | #define	HWCAP2_SVEPMULL		0x0000000000000008ul | |
| 140 | #define	HWCAP2_SVEBITPERM	0x0000000000000010ul | |
| 141 | #define	HWCAP2_SVESHA3		0x0000000000000020ul | |
| 142 | #define	HWCAP2_SVESM4		0x0000000000000040ul | |
| 143 | #define	HWCAP2_FLAGM2		0x0000000000000080ul | |
| 144 | #define	HWCAP2_FRINT		0x0000000000000100ul | |
| 145 | #define	HWCAP2_SVEI8MM		0x0000000000000200ul | |
| 146 | #define	HWCAP2_SVEF32MM		0x0000000000000400ul | |
| 147 | #define	HWCAP2_SVEF64MM		0x0000000000000800ul | |
| 148 | #define	HWCAP2_SVEBF16		0x0000000000001000ul | |
| 149 | #define	HWCAP2_I8MM		0x0000000000002000ul | |
| 150 | #define	HWCAP2_BF16		0x0000000000004000ul | |
| 151 | #define	HWCAP2_DGH		0x0000000000008000ul | |
| 152 | #define	HWCAP2_RNG		0x0000000000010000ul | |
| 153 | #define	HWCAP2_BTI		0x0000000000020000ul | |
| 154 | #define	HWCAP2_MTE		0x0000000000040000ul | |
| 155 | #define	HWCAP2_ECV		0x0000000000080000ul | |
| 156 | #define	HWCAP2_AFP		0x0000000000100000ul | |
| 157 | #define	HWCAP2_RPRES		0x0000000000200000ul | |
| 158 | #define	HWCAP2_MTE3		0x0000000000400000ul | |
| 159 | #define	HWCAP2_SME		0x0000000000800000ul | |
| 160 | #define	HWCAP2_SME_I16I64	0x0000000001000000ul | |
| 161 | #define	HWCAP2_SME_F64F64	0x0000000002000000ul | |
| 162 | #define	HWCAP2_SME_I8I32	0x0000000004000000ul | |
| 163 | #define	HWCAP2_SME_F16F32	0x0000000008000000ul | |
| 164 | #define	HWCAP2_SME_B16F32	0x0000000010000000ul | |
| 165 | #define	HWCAP2_SME_F32F32	0x0000000020000000ul | |
| 166 | #define	HWCAP2_SME_FA64		0x0000000040000000ul | |
| 167 | #define	HWCAP2_WFXT		0x0000000080000000ul | |
| 168 | #define	HWCAP2_EBF16		0x0000000100000000ul | |
| 169 | #define	HWCAP2_SVE_EBF16	0x0000000200000000ul | |
| 170 | #define	HWCAP2_CSSC		0x0000000400000000ul | |
| 171 | #define	HWCAP2_RPRFM		0x0000000800000000ul | |
| 172 | #define	HWCAP2_SVE2P1		0x0000001000000000ul | |
| 173 | #define	HWCAP2_SME2		0x0000002000000000ul | |
| 174 | #define	HWCAP2_SME2P1		0x0000004000000000ul | |
| 175 | #define	HWCAP2_SME_I16I32	0x0000008000000000ul | |
| 176 | #define	HWCAP2_SME_BI32I32	0x0000010000000000ul | |
| 177 | #define	HWCAP2_SME_B16B16	0x0000020000000000ul | |
| 178 | #define	HWCAP2_SME_F16F16	0x0000040000000000ul | |
| 179 | #define	HWCAP2_MOPS		0x0000080000000000ul | |
| 180 | #define	HWCAP2_HBC		0x0000100000000000ul | |
| 140 | #define	HWCAP2_DCPODP		(1 << 0) | |
| 141 | #define	HWCAP2_SVE2		(1 << 1) | |
| 142 | #define	HWCAP2_SVEAES		(1 << 2) | |
| 143 | #define	HWCAP2_SVEPMULL		(1 << 3) | |
| 144 | #define	HWCAP2_SVEBITPERM	(1 << 4) | |
| 145 | #define	HWCAP2_SVESHA3		(1 << 5) | |
| 146 | #define	HWCAP2_SVESM4		(1 << 6) | |
| 147 | #define	HWCAP2_FLAGM2		(1 << 7) | |
| 148 | #define	HWCAP2_FRINT		(1 << 8) | |
| 149 | #define	HWCAP2_SVEI8MM		(1 << 9) | |
| 150 | #define	HWCAP2_SVEF32MM		(1 << 10) | |
| 151 | #define	HWCAP2_SVEF64MM		(1 << 11) | |
| 152 | #define	HWCAP2_SVEBF16		(1 << 12) | |
| 153 | #define	HWCAP2_I8MM		(1 << 13) | |
| 154 | #define	HWCAP2_BF16		(1 << 14) | |
| 155 | #define	HWCAP2_DGH		(1 << 15) | |
| 156 | #define	HWCAP2_RNG		(1 << 16) | |
| 157 | #define	HWCAP2_BTI		(1 << 17) | |
| 158 | #define	HWCAP2_MTE		(1 << 18) | |
| 159 | #define	HWCAP2_ECV		(1 << 19) | |
| 160 | #define	HWCAP2_AFP		(1 << 20) | |
| 161 | #define	HWCAP2_RPRES		(1 << 21) | |
| 162 | #define	HWCAP2_MTE3		(1 << 22) | |
| 163 | #define	HWCAP2_SME		(1 << 23) | |
| 164 | #define	HWCAP2_SME_I16I64	(1 << 24) | |
| 165 | #define	HWCAP2_SME_F64F64	(1 << 25) | |
| 166 | #define	HWCAP2_SME_I8I32	(1 << 26) | |
| 167 | #define	HWCAP2_SME_F16F32	(1 << 27) | |
| 168 | #define	HWCAP2_SME_B16F32	(1 << 28) | |
| 169 | #define	HWCAP2_SME_F32F32	(1 << 29) | |
| 170 | #define	HWCAP2_SME_FA64		(1 << 30) | |
| 171 | #define	HWCAP2_WFXT		(1UL << 31) | |
| 172 | #define	HWCAP2_EBF16		(1UL << 32) | |
| 173 | #define	HWCAP2_SVE_EBF16	(1UL << 33) | |
| 174 | #define	HWCAP2_CSSC		(1UL << 34) | |
| 175 | #define	HWCAP2_RPRFM		(1UL << 35) | |
| 176 | #define	HWCAP2_SVE2P1		(1UL << 36) | |
| 177 | #define	HWCAP2_SME2		(1UL << 37) | |
| 178 | #define	HWCAP2_SME2P1		(1UL << 38) | |
| 179 | #define	HWCAP2_SME_I16I32	(1UL << 39) | |
| 180 | #define	HWCAP2_SME_BI32I32	(1UL << 40) | |
| 181 | #define	HWCAP2_SME_B16B16	(1UL << 41) | |
| 182 | #define	HWCAP2_SME_F16F16	(1UL << 42) | |
| 183 | #define	HWCAP2_MOPS		(1UL << 43) | |
| 184 | #define	HWCAP2_HBC		(1UL << 44) | |
| 185 | #define	HWCAP2_SVE_B16B16	(1UL << 45) | |
| 186 | #define	HWCAP2_LRCPC3		(1UL << 46) | |
| 187 | #define	HWCAP2_LSE128		(1UL << 47) | |
| 188 | #define	HWCAP2_FPMR		(1UL << 48) | |
| 189 | #define	HWCAP2_LUT		(1UL << 49) | |
| 190 | #define	HWCAP2_FAMINMAX		(1UL << 50) | |
| 191 | #define	HWCAP2_F8CVT		(1UL << 51) | |
| 192 | #define	HWCAP2_F8FMA		(1UL << 52) | |
| 193 | #define	HWCAP2_F8DP4		(1UL << 53) | |
| 194 | #define	HWCAP2_F8DP2		(1UL << 54) | |
| 195 | #define	HWCAP2_F8E4M3		(1UL << 55) | |
| 196 | #define	HWCAP2_F8E5M2		(1UL << 56) | |
| 197 | #define	HWCAP2_SME_LUTV2	(1UL << 57) | |
| 198 | #define	HWCAP2_SME_F8F16	(1UL << 58) | |
| 199 | #define	HWCAP2_SME_F8F32	(1UL << 59) | |
| 200 | #define	HWCAP2_SME_SF8FMA	(1UL << 60) | |
| 201 | #define	HWCAP2_SME_SF8DP4	(1UL << 61) | |
| 202 | #define	HWCAP2_SME_SF8DP2	(1UL << 62) | |
| 203 | #define	HWCAP2_POE		(1UL << 63) | |
| 181 | 204 | |
| 182 | 205 | #ifdef COMPAT_FREEBSD32 |
| 183 | 206 | /* ARM HWCAP */ |
lib/libc/include/aarch64-freebsd-none/machine/endian.h-2| ... | ... | @@ -24,8 +24,6 @@ |
| 24 | 24 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 25 | 25 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 26 | 26 | * SUCH DAMAGE. |
| 27 | * | |
| 28 | *	@(#)endian.h	8.1 (Berkeley) 6/10/93 | |
| 29 | 27 | * $NetBSD: endian.h,v 1.7 1999/08/21 05:53:51 simonb Exp $ |
| 30 | 28 | */ |
| 31 | 29 |
lib/libc/include/aarch64-freebsd-none/machine/float.h-2| ... | ... | @@ -25,8 +25,6 @@ |
| 25 | 25 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 26 | 26 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 27 | 27 | * SUCH DAMAGE. |
| 28 | * | |
| 29 | *	from: @(#)float.h	7.1 (Berkeley) 5/8/90 | |
| 30 | 28 | */ |
| 31 | 29 | |
| 32 | 30 | #ifdef __arm__ |
lib/libc/include/aarch64-freebsd-none/machine/frame.h+1-1| ... | ... | @@ -70,7 +70,7 @@ struct frame { |
| 70 | 70 | |
| 71 | 71 | #ifdef COMPAT_FREEBSD32 |
| 72 | 72 | struct sigframe32 { |
| 73 | 	struct siginfo32		sf_si; | |
| 73 | 	struct __siginfo32		sf_si; | |
| 74 | 74 | 	ucontext32_t			sf_uc; |
| 75 | 75 | 	mcontext32_vfp_t		sf_vfp; |
| 76 | 76 | }; |
lib/libc/include/aarch64-freebsd-none/machine/hypervisor.h+105-50| ... | ... | @@ -41,21 +41,38 @@ |
| 41 | 41 | #define	CNTHCTL_EL1PCTEN	(1 << 0) /* Allow physical counter access */ |
| 42 | 42 | #define	CNTHCTL_EL1PCEN		(1 << 1) /* Allow physical timer access */ |
| 43 | 43 | /* Valid if HCR_EL2.E2H == 1 */ |
| 44 | #define	CNTHCTL_E2H_EL0PCTEN	(1 << 0) /* Allow EL0 physical counter access */ | |
| 45 | #define	CNTHCTL_E2H_EL0VCTEN	(1 << 1) /* Allow EL0 virtual counter access */ | |
| 46 | #define	CNTHCTL_E2H_EL0VTEN	(1 << 8) | |
| 47 | #define	CNTHCTL_E2H_EL0PTEN	(1 << 9) | |
| 44 | 48 | #define	CNTHCTL_E2H_EL1PCTEN	(1 << 10) /* Allow physical counter access */ |
| 45 | 49 | #define	CNTHCTL_E2H_EL1PTEN	(1 << 11) /* Allow physical timer access */ |
| 46 | 50 | /* Unconditionally valid */ |
| 47 | 51 | #define	CNTHCTL_EVNTDIR		(1 << 3) /* Control transition trigger bit */ |
| 48 | 52 | #define	CNTHCTL_EVNTEN		(1 << 2) /* Enable event stream */ |
| 49 | 53 | |
| 54 | /* CNTPOFF_EL2 - Counter-timer Physical Offset Register */ | |
| 55 | #define	CNTPOFF_EL2_REG			MRS_REG_ALT_NAME(CNTPOFF_EL2) | |
| 56 | #define	CNTPOFF_EL2_op0			3 | |
| 57 | #define	CNTPOFF_EL2_op1			4 | |
| 58 | #define	CNTPOFF_EL2_CRn			14 | |
| 59 | #define	CNTPOFF_EL2_CRm			0 | |
| 60 | #define	CNTPOFF_EL2_op2			6 | |
| 61 | ||
| 50 | 62 | /* CPTR_EL2 - Architecture feature trap register */ |
| 51 | 63 | /* Valid if HCR_EL2.E2H == 0 */ |
| 64 | #define	CPTR_TRAP_ALL		0xc01037ff /* Enable all traps */ | |
| 52 | 65 | #define	CPTR_RES0		0x7fefc800 |
| 53 | 66 | #define	CPTR_RES1		0x000032ff |
| 67 | #define	CPTR_TZ			0x00000100 | |
| 54 | 68 | #define	CPTR_TFP		0x00000400 |
| 69 | #define	CPTR_TTA		0x00100000 | |
| 55 | 70 | /* Valid if HCR_EL2.E2H == 1 */ |
| 56 | #define	CPTR_FPEN		0x00300000 | |
| 71 | #define	CPTR_E2H_TRAP_ALL	0xd0000000 | |
| 72 | #define	CPTR_E2H_ZPEN		0x00030000 | |
| 73 | #define	CPTR_E2H_FPEN		0x00300000 | |
| 74 | #define	CPTR_E2H_TTA		0x10000000 | |
| 57 | 75 | /* Unconditionally valid */ |
| 58 | #define	CPTR_TTA		0x00100000 | |
| 59 | 76 | #define	CPTR_TCPAC		0x80000000 |
| 60 | 77 | |
| 61 | 78 | /* HCR_EL2 - Hypervisor Config Register */ |
| ... | ... | @@ -123,6 +140,41 @@ |
| 123 | 140 | #define	HCR_TWEDEn			(UL(0x1) << 59) |
| 124 | 141 | #define	HCR_TWEDEL_MASK			(UL(0xf) << 60) |
| 125 | 142 | |
| 143 | /* HCRX_EL2 - Extended Hypervisor Configuration Register */ | |
| 144 | #define HCRX_EL2_REG		MRS_REG_ALT_NAME(HCRX_EL2) | |
| 145 | #define HCRX_EL2_op0		3 | |
| 146 | #define HCRX_EL2_op1		4 | |
| 147 | #define HCRX_EL2_CRn		1 | |
| 148 | #define HCRX_EL2_CRm		2 | |
| 149 | #define HCRX_EL2_op2		2 | |
| 150 | ||
| 151 | #define HCRX_EnAS0			(UL(0x1) << 0) | |
| 152 | #define HCRX_EnALS			(UL(0x1) << 1) | |
| 153 | #define HCRX_EnASR			(UL(0x1) << 2) | |
| 154 | #define HCRX_FnXS			(UL(0x1) << 3) | |
| 155 | #define HCRX_FGTnXS			(UL(0x1) << 4) | |
| 156 | #define HCRX_SMPME			(UL(0x1) << 5) | |
| 157 | #define HCRX_TALLINT			(UL(0x1) << 6) | |
| 158 | #define HCRX_VINMI			(UL(0x1) << 7) | |
| 159 | #define HCRX_VFNMI			(UL(0x1) << 8) | |
| 160 | #define HCRX_CMOW			(UL(0x1) << 9) | |
| 161 | #define HCRX_MCE2			(UL(0x1) << 10) | |
| 162 | #define HCRX_MSCEn			(UL(0x1) << 11) | |
| 163 | /* Bits 12 & 13 are reserved */ | |
| 164 | #define HCRX_TCR2En			(UL(0x1) << 14) | |
| 165 | #define HCRX_SCTLR2En			(UL(0x1) << 15) | |
| 166 | #define HCRX_PTTWI			(UL(0x1) << 16) | |
| 167 | #define HCRX_D128En			(UL(0x1) << 17) | |
| 168 | #define HCRX_EnSNERR			(UL(0x1) << 18) | |
| 169 | #define HCRX_TMEA			(UL(0x1) << 19) | |
| 170 | #define HCRX_EnSDERR			(UL(0x1) << 20) | |
| 171 | #define HCRX_EnIDCP128			(UL(0x1) << 21) | |
| 172 | #define HCRX_GCSEn			(UL(0x1) << 22) | |
| 173 | #define HCRX_EnFPM			(UL(0x1) << 23) | |
| 174 | #define HCRX_PACMEn			(UL(0x1) << 24) | |
| 175 | /* Bit 25 is reserved */ | |
| 176 | #define HCRX_SRMASKEn			(UL(0x1) << 26) | |
| 177 | ||
| 126 | 178 | /* HPFAR_EL2 - Hypervisor IPA Fault Address Register */ |
| 127 | 179 | #define	HPFAR_EL2_FIPA_SHIFT	4 |
| 128 | 180 | #define	HPFAR_EL2_FIPA_MASK	0xfffffffff0 |
| ... | ... | @@ -138,6 +190,54 @@ |
| 138 | 190 | #define	ICC_SRE_EL2_SRE		(1UL << 0) |
| 139 | 191 | #define	ICC_SRE_EL2_EN		(1UL << 3) |
| 140 | 192 | |
| 193 | /* MDCR_EL2 - Hyp Debug Control Register */ | |
| 194 | #define	MDCR_EL2_HPMN_MASK	0x1f | |
| 195 | #define	MDCR_EL2_HPMN_SHIFT	0 | |
| 196 | #define	MDCR_EL2_TPMCR_SHIFT	5 | |
| 197 | #define	MDCR_EL2_TPMCR		(0x1UL << MDCR_EL2_TPMCR_SHIFT) | |
| 198 | #define	MDCR_EL2_TPM_SHIFT	6 | |
| 199 | #define	MDCR_EL2_TPM		(0x1UL << MDCR_EL2_TPM_SHIFT) | |
| 200 | #define	MDCR_EL2_HPME_SHIFT	7 | |
| 201 | #define	MDCR_EL2_HPME		(0x1UL << MDCR_EL2_HPME_SHIFT) | |
| 202 | #define	MDCR_EL2_TDE_SHIFT	8 | |
| 203 | #define	MDCR_EL2_TDE		(0x1UL << MDCR_EL2_TDE_SHIFT) | |
| 204 | #define	MDCR_EL2_TDA_SHIFT	9 | |
| 205 | #define	MDCR_EL2_TDA		(0x1UL << MDCR_EL2_TDA_SHIFT) | |
| 206 | #define	MDCR_EL2_TDOSA_SHIFT	10 | |
| 207 | #define	MDCR_EL2_TDOSA		(0x1UL << MDCR_EL2_TDOSA_SHIFT) | |
| 208 | #define	MDCR_EL2_TDRA_SHIFT	11 | |
| 209 | #define	MDCR_EL2_TDRA		(0x1UL << MDCR_EL2_TDRA_SHIFT) | |
| 210 | #define	MDCR_EL2_E2PB_SHIFT	12 | |
| 211 | #define	MDCR_EL2_E2PB_MASK	(0x3UL << MDCR_EL2_E2PB_SHIFT) | |
| 212 | #define	MDCR_EL2_TPMS_SHIFT	14 | |
| 213 | #define	MDCR_EL2_TPMS		(0x1UL << MDCR_EL2_TPMS_SHIFT) | |
| 214 | #define	MDCR_EL2_EnSPM_SHIFT	15 | |
| 215 | #define	MDCR_EL2_EnSPM		(0x1UL << MDCR_EL2_EnSPM_SHIFT) | |
| 216 | #define	MDCR_EL2_HPMD_SHIFT	17 | |
| 217 | #define	MDCR_EL2_HPMD		(0x1UL << MDCR_EL2_HPMD_SHIFT) | |
| 218 | #define	MDCR_EL2_TTRF_SHIFT	19 | |
| 219 | #define	MDCR_EL2_TTRF		(0x1UL << MDCR_EL2_TTRF_SHIFT) | |
| 220 | #define	MDCR_EL2_HCCD_SHIFT	23 | |
| 221 | #define	MDCR_EL2_HCCD		(0x1UL << MDCR_EL2_HCCD_SHIFT) | |
| 222 | #define	MDCR_EL2_E2TB_SHIFT	24 | |
| 223 | #define	MDCR_EL2_E2TB_MASK	(0x3UL << MDCR_EL2_E2TB_SHIFT) | |
| 224 | #define	MDCR_EL2_HLP_SHIFT	26 | |
| 225 | #define	MDCR_EL2_HLP		(0x1UL << MDCR_EL2_HLP_SHIFT) | |
| 226 | #define	MDCR_EL2_TDCC_SHIFT	27 | |
| 227 | #define	MDCR_EL2_TDCC		(0x1UL << MDCR_EL2_TDCC_SHIFT) | |
| 228 | #define	MDCR_EL2_MTPME_SHIFT	28 | |
| 229 | #define	MDCR_EL2_MTPME		(0x1UL << MDCR_EL2_MTPME_SHIFT) | |
| 230 | #define	MDCR_EL2_HPMFZO_SHIFT	29 | |
| 231 | #define	MDCR_EL2_HPMFZO		(0x1UL << MDCR_EL2_HPMFZO_SHIFT) | |
| 232 | #define	MDCR_EL2_PMSSE_SHIFT	30 | |
| 233 | #define	MDCR_EL2_PMSSE_MASK	(0x3UL << MDCR_EL2_PMSSE_SHIFT) | |
| 234 | #define	MDCR_EL2_HPMFZS_SHIFT	36 | |
| 235 | #define	MDCR_EL2_HPMFZS		(0x1UL << MDCR_EL2_HPMFZS_SHIFT) | |
| 236 | #define	MDCR_EL2_PMEE_SHIFT	40 | |
| 237 | #define	MDCR_EL2_PMEE_MASK	(0x3UL << MDCR_EL2_PMEE_SHIFT) | |
| 238 | #define	MDCR_EL2_EBWE_SHIFT	43 | |
| 239 | #define	MDCR_EL2_EBWE		(0x1UL << MDCR_EL2_EBWE_SHIFT) | |
| 240 | ||
| 141 | 241 | /* SCTLR_EL2 - System Control Register */ |
| 142 | 242 | #define	SCTLR_EL2_RES1		0x30c50830 |
| 143 | 243 | #define	SCTLR_EL2_M_SHIFT	0 |
| ... | ... | @@ -237,6 +337,9 @@ |
| 237 | 337 | #define	 VTCR_EL2_PS_42BIT	(0x3UL << VTCR_EL2_PS_SHIFT) |
| 238 | 338 | #define	 VTCR_EL2_PS_44BIT	(0x4UL << VTCR_EL2_PS_SHIFT) |
| 239 | 339 | #define	 VTCR_EL2_PS_48BIT	(0x5UL << VTCR_EL2_PS_SHIFT) |
| 340 | #define	 VTCR_EL2_PS_52BIT	(0x6UL << VTCR_EL2_PS_SHIFT) | |
| 341 | #define	VTCR_EL2_DS_SHIFT	32 | |
| 342 | #define	VTCR_EL2_DS		(0x1UL << VTCR_EL2_DS_SHIFT) | |
| 240 | 343 | |
| 241 | 344 | /* VTTBR_EL2 - Virtualization Translation Table Base Register */ |
| 242 | 345 | #define	VTTBR_VMID_MASK		0xffff000000000000 |
| ... | ... | @@ -244,52 +347,4 @@ |
| 244 | 347 | /* Assumed to be 0 by locore.S */ |
| 245 | 348 | #define	VTTBR_HOST		0x0000000000000000 |
| 246 | 349 | |
| 247 | /* MDCR_EL2 - Hyp Debug Control Register */ | |
| 248 | #define	MDCR_EL2_HPMN_MASK	0x1f | |
| 249 | #define	MDCR_EL2_HPMN_SHIFT	0 | |
| 250 | #define	MDCR_EL2_TPMCR_SHIFT	5 | |
| 251 | #define	MDCR_EL2_TPMCR		(0x1UL << MDCR_EL2_TPMCR_SHIFT) | |
| 252 | #define	MDCR_EL2_TPM_SHIFT	6 | |
| 253 | #define	MDCR_EL2_TPM		(0x1UL << MDCR_EL2_TPM_SHIFT) | |
| 254 | #define	MDCR_EL2_HPME_SHIFT	7 | |
| 255 | #define	MDCR_EL2_HPME		(0x1UL << MDCR_EL2_HPME_SHIFT) | |
| 256 | #define	MDCR_EL2_TDE_SHIFT	8 | |
| 257 | #define	MDCR_EL2_TDE		(0x1UL << MDCR_EL2_TDE_SHIFT) | |
| 258 | #define	MDCR_EL2_TDA_SHIFT	9 | |
| 259 | #define	MDCR_EL2_TDA		(0x1UL << MDCR_EL2_TDA_SHIFT) | |
| 260 | #define	MDCR_EL2_TDOSA_SHIFT	10 | |
| 261 | #define	MDCR_EL2_TDOSA		(0x1UL << MDCR_EL2_TDOSA_SHIFT) | |
| 262 | #define	MDCR_EL2_TDRA_SHIFT	11 | |
| 263 | #define	MDCR_EL2_TDRA		(0x1UL << MDCR_EL2_TDRA_SHIFT) | |
| 264 | #define	MDCR_E2PB_SHIFT		12 | |
| 265 | #define	MDCR_E2PB_MASK		(0x3UL << MDCR_E2PB_SHIFT) | |
| 266 | #define	MDCR_TPMS_SHIFT		14 | |
| 267 | #define	MDCR_TPMS		(0x1UL << MDCR_TPMS_SHIFT) | |
| 268 | #define	MDCR_EnSPM_SHIFT	15 | |
| 269 | #define	MDCR_EnSPM		(0x1UL << MDCR_EnSPM_SHIFT) | |
| 270 | #define	MDCR_HPMD_SHIFT		17 | |
| 271 | #define	MDCR_HPMD		(0x1UL << MDCR_HPMD_SHIFT) | |
| 272 | #define	MDCR_TTRF_SHIFT		19 | |
| 273 | #define	MDCR_TTRF		(0x1UL << MDCR_TTRF_SHIFT) | |
| 274 | #define	MDCR_HCCD_SHIFT		23 | |
| 275 | #define	MDCR_HCCD		(0x1UL << MDCR_HCCD_SHIFT) | |
| 276 | #define	MDCR_E2TB_SHIFT		24 | |
| 277 | #define	MDCR_E2TB_MASK		(0x3UL << MDCR_E2TB_SHIFT) | |
| 278 | #define	MDCR_HLP_SHIFT		26 | |
| 279 | #define	MDCR_HLP		(0x1UL << MDCR_HLP_SHIFT) | |
| 280 | #define	MDCR_TDCC_SHIFT		27 | |
| 281 | #define	MDCR_TDCC		(0x1UL << MDCR_TDCC_SHIFT) | |
| 282 | #define	MDCR_MTPME_SHIFT	28 | |
| 283 | #define	MDCR_MTPME		(0x1UL << MDCR_MTPME_SHIFT) | |
| 284 | #define	MDCR_HPMFZO_SHIFT	29 | |
| 285 | #define	MDCR_HPMFZO		(0x1UL << MDCR_HPMFZO_SHIFT) | |
| 286 | #define	MDCR_PMSSE_SHIFT	30 | |
| 287 | #define	MDCR_PMSSE_MASK		(0x3UL << MDCR_PMSSE_SHIFT) | |
| 288 | #define	MDCR_HPMFZS_SHIFT	36 | |
| 289 | #define	MDCR_HPMFZS		(0x1UL << MDCR_HPMFZS_SHIFT) | |
| 290 | #define	MDCR_PMEE_SHIFT		40 | |
| 291 | #define	MDCR_PMEE_MASK		(0x3UL << MDCR_PMEE_SHIFT) | |
| 292 | #define	MDCR_EBWE_SHIFT		43 | |
| 293 | #define	MDCR_EBWE		(0x1UL << MDCR_EBWE_SHIFT) | |
| 294 | ||
| 295 | 350 | #endif /* !_MACHINE_HYPERVISOR_H_ */ |
| \ No newline at end of file |
lib/libc/include/aarch64-freebsd-none/machine/in_cksum.h-1| ... | ... | @@ -27,7 +27,6 @@ |
| 27 | 27 | * SUCH DAMAGE. |
| 28 | 28 | * |
| 29 | 29 | *	from tahoe:	in_cksum.c	1.2	86/01/05 |
| 30 | *	from:		@(#)in_cksum.c	1.3 (Berkeley) 1/19/91 | |
| 31 | 30 | *	from: Id: in_cksum.c,v 1.8 1995/12/03 18:35:19 bde Exp |
| 32 | 31 | */ |
| 33 | 32 |
lib/libc/include/aarch64-freebsd-none/machine/intr.h+10-6| ... | ... | @@ -27,20 +27,20 @@ |
| 27 | 27 | #ifndef _MACHINE_INTR_H_ |
| 28 | 28 | #define	_MACHINE_INTR_H_ |
| 29 | 29 | |
| 30 | #ifndef LOCORE | |
| 30 | 31 | #ifdef FDT |
| 31 | 32 | #include <dev/ofw/openfirm.h> |
| 32 | 33 | #endif |
| 33 | 34 | |
| 34 | #include <sys/intr.h> | |
| 35 | ||
| 36 | #ifndef NIRQ | |
| 37 | #define	NIRQ		16384	/* XXX - It should be an option. */ | |
| 38 | #endif | |
| 39 | ||
| 40 | 35 | static inline void |
| 41 | 36 | arm_irq_memory_barrier(uintptr_t irq) |
| 42 | 37 | { |
| 43 | 38 | } |
| 39 | #endif /* !LOCORE */ | |
| 40 | ||
| 41 | #ifndef NIRQ | |
| 42 | #define	NIRQ		16384	/* XXX - It should be an option. */ | |
| 43 | #endif | |
| 44 | 44 | |
| 45 | 45 | #ifdef DEV_ACPI |
| 46 | 46 | #define	ACPI_INTR_XREF	1 |
| ... | ... | @@ -48,4 +48,8 @@ arm_irq_memory_barrier(uintptr_t irq) |
| 48 | 48 | #define	ACPI_GPIO_XREF	3 |
| 49 | 49 | #endif |
| 50 | 50 | |
| 51 | #define	INTR_ROOT_IRQ	0 | |
| 52 | #define	INTR_ROOT_FIQ	1 | |
| 53 | #define	INTR_ROOT_COUNT	2 | |
| 54 | ||
| 51 | 55 | #endif	/* _MACHINE_INTR_H */ |
| \ No newline at end of file |
lib/libc/include/aarch64-freebsd-none/machine/kdb.h+3-1| ... | ... | @@ -37,6 +37,8 @@ |
| 37 | 37 | |
| 38 | 38 | void kdb_cpu_clear_singlestep(void); |
| 39 | 39 | void kdb_cpu_set_singlestep(void); |
| 40 | int kdb_cpu_set_breakpoint(vm_offset_t addr); | |
| 41 | int kdb_cpu_clr_breakpoint(vm_offset_t addr); | |
| 40 | 42 | int kdb_cpu_set_watchpoint(vm_offset_t addr, size_t size, int access); |
| 41 | 43 | int kdb_cpu_clr_watchpoint(vm_offset_t addr, size_t size); |
| 42 | 44 | |
| ... | ... | @@ -44,7 +46,7 @@ static __inline void |
| 44 | 46 | kdb_cpu_sync_icache(unsigned char *addr, size_t size) |
| 45 | 47 | { |
| 46 | 48 | |
| 47 | 	cpu_icache_sync_range((vm_offset_t)addr, size); | |
| 49 | 	cpu_icache_sync_range(addr, size); | |
| 48 | 50 | } |
| 49 | 51 | |
| 50 | 52 | static __inline void |
lib/libc/include/aarch64-freebsd-none/machine/machdep.h+1-1| ... | ... | @@ -33,7 +33,6 @@ struct arm64_bootparams { |
| 33 | 33 | 	vm_offset_t	modulep; |
| 34 | 34 | 	vm_offset_t	kern_stack; |
| 35 | 35 | 	vm_paddr_t	kern_ttbr0; |
| 36 | 	uint64_t	hcr_el2; | |
| 37 | 36 | 	int		boot_el;	/* EL the kernel booted from */ |
| 38 | 37 | 	int		pad; |
| 39 | 38 | }; |
| ... | ... | @@ -48,6 +47,7 @@ extern enum arm64_bus arm64_bus_method; |
| 48 | 47 | |
| 49 | 48 | void dbg_init(void); |
| 50 | 49 | bool has_hyp(void); |
| 50 | bool in_vhe(void); | |
| 51 | 51 | void initarm(struct arm64_bootparams *); |
| 52 | 52 | vm_offset_t parse_boot_param(struct arm64_bootparams *abp); |
| 53 | 53 | #ifdef FDT |
lib/libc/include/aarch64-freebsd-none/machine/md_var.h+4| ... | ... | @@ -37,8 +37,12 @@ extern char sigcode[]; |
| 37 | 37 | extern int szsigcode; |
| 38 | 38 | extern u_long elf_hwcap; |
| 39 | 39 | extern u_long elf_hwcap2; |
| 40 | extern u_long elf_hwcap3; | |
| 41 | extern u_long elf_hwcap4; | |
| 40 | 42 | extern u_long linux_elf_hwcap; |
| 41 | 43 | extern u_long linux_elf_hwcap2; |
| 44 | extern u_long linux_elf_hwcap3; | |
| 45 | extern u_long linux_elf_hwcap4; | |
| 42 | 46 | #ifdef COMPAT_FREEBSD32 |
| 43 | 47 | extern u_long elf32_hwcap; |
| 44 | 48 | extern u_long elf32_hwcap2; |
lib/libc/include/aarch64-freebsd-none/machine/metadata.h+8-3| ... | ... | @@ -31,10 +31,15 @@ |
| 31 | 31 | #define	MODINFOMD_DTBP		0x1002 |
| 32 | 32 | #define	MODINFOMD_EFI_FB	0x1003 |
| 33 | 33 | |
| 34 | /* | |
| 35 | * This is not the same as the UEFI standard EFI_MEMORY_ATTRIBUTES_TABLE, though | |
| 36 | * memory_size / descritpr_size entries of EFI_MEMORY_DESCRIPTORS follow this table | |
| 37 | * starting at a 16-byte alignment. | |
| 38 | */ | |
| 34 | 39 | struct efi_map_header { |
| 35 | 	size_t		memory_size; | |
| 36 | 	size_t		descriptor_size; | |
| 37 | 	uint32_t	descriptor_version; | |
| 40 | 	size_t		memory_size;		/* Numnber of bytes that follow */ | |
| 41 | 	size_t		descriptor_size;	/* Size of each EFI_MEMORY_DESCRIPTOR */ | |
| 42 | 	uint32_t	descriptor_version;	/* Currently '1' */ | |
| 38 | 43 | }; |
| 39 | 44 | |
| 40 | 45 | struct efi_fb { |
lib/libc/include/aarch64-freebsd-none/machine/msan.h created+91| ... | ... | @@ -0,0 +1,91 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-2-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 2021 The FreeBSD Foundation | |
| 5 | * Copyright (c) 2023 Juniper Networks, Inc. | |
| 6 | * | |
| 7 | * This software was developed by Mark Johnston under sponsorship from the | |
| 8 | * FreeBSD Foundation. | |
| 9 | * | |
| 10 | * Redistribution and use in source and binary forms, with or without | |
| 11 | * modification, are permitted provided that the following conditions are | |
| 12 | * met: | |
| 13 | * 1. Redistributions of source code must retain the above copyright | |
| 14 | * notice, this list of conditions and the following disclaimer. | |
| 15 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 16 | * notice, this list of conditions and the following disclaimer in | |
| 17 | * the documentation and/or other materials provided with the distribution. | |
| 18 | * | |
| 19 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |
| 20 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 21 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
| 22 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | |
| 23 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
| 24 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
| 25 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
| 26 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
| 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
| 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
| 29 | * SUCH DAMAGE. | |
| 30 | */ | |
| 31 | ||
| 32 | #ifndef _MACHINE_MSAN_H_ | |
| 33 | #define	_MACHINE_MSAN_H_ | |
| 34 | ||
| 35 | #ifdef KMSAN | |
| 36 | ||
| 37 | #include <vm/vm.h> | |
| 38 | #include <vm/pmap.h> | |
| 39 | #include <vm/vm_page.h> | |
| 40 | #include <machine/vmparam.h> | |
| 41 | ||
| 42 | typedef uint32_t msan_orig_t; | |
| 43 | ||
| 44 | /* | |
| 45 | * Our 32-bit origin cells encode a 2-bit type and 30-bit pointer to a kernel | |
| 46 | * instruction. The pointer is compressed by making it a positive offset | |
| 47 | * relative to KERNBASE. | |
| 48 | */ | |
| 49 | #define	KMSAN_ORIG_TYPE_SHIFT	30u | |
| 50 | #define	KMSAN_ORIG_PTR_MASK	((1ul << KMSAN_ORIG_TYPE_SHIFT) - 1) | |
| 51 | ||
| 52 | static inline msan_orig_t | |
| 53 | kmsan_md_orig_encode(int type, uintptr_t ptr) | |
| 54 | { | |
| 55 | 	return ((type << KMSAN_ORIG_TYPE_SHIFT) | | |
| 56 | 	 ((ptr & KMSAN_ORIG_PTR_MASK))); | |
| 57 | } | |
| 58 | ||
| 59 | static inline void | |
| 60 | kmsan_md_orig_decode(msan_orig_t orig, int *type, uintptr_t *ptr) | |
| 61 | { | |
| 62 | 	*type = orig >> KMSAN_ORIG_TYPE_SHIFT; | |
| 63 | 	*ptr = (orig & KMSAN_ORIG_PTR_MASK) | KERNBASE; | |
| 64 | } | |
| 65 | ||
| 66 | static inline vm_offset_t | |
| 67 | kmsan_md_addr_to_shad(vm_offset_t addr) | |
| 68 | { | |
| 69 | 	return (addr - VM_MIN_KERNEL_ADDRESS + KMSAN_SHAD_MIN_ADDRESS); | |
| 70 | } | |
| 71 | ||
| 72 | static inline vm_offset_t | |
| 73 | kmsan_md_addr_to_orig(vm_offset_t addr) | |
| 74 | { | |
| 75 | 	return (addr - VM_MIN_KERNEL_ADDRESS + KMSAN_ORIG_MIN_ADDRESS); | |
| 76 | } | |
| 77 | ||
| 78 | static inline bool | |
| 79 | kmsan_md_unsupported(vm_offset_t addr) | |
| 80 | { | |
| 81 | 	/* | |
| 82 | 	 * It would be cheaper to use VM_MAX_KERNEL_ADDRESS as the upper bound, | |
| 83 | 	 * but we need to exclude device mappings above kernel_vm_end but within | |
| 84 | 	 * the kernel map. | |
| 85 | 	 */ | |
| 86 | 	return (addr < VM_MIN_KERNEL_ADDRESS || addr >= kernel_vm_end); | |
| 87 | } | |
| 88 | ||
| 89 | #endif /* KMSAN */ | |
| 90 | ||
| 91 | #endif /* !_MACHINE_MSAN_H_ */ | |
| \ No newline at end of file |
lib/libc/include/aarch64-freebsd-none/machine/param.h+1-13| ... | ... | @@ -25,8 +25,6 @@ |
| 25 | 25 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 26 | 26 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 27 | 27 | * SUCH DAMAGE. |
| 28 | * | |
| 29 | *	from: @(#)param.h	5.8 (Berkeley) 6/28/91 | |
| 30 | 28 | */ |
| 31 | 29 | |
| 32 | 30 | #ifdef __arm__ |
| ... | ... | @@ -45,8 +43,6 @@ |
| 45 | 43 | #define	STACKALIGNBYTES	(16 - 1) |
| 46 | 44 | #define	STACKALIGN(p)	((uint64_t)(p) & ~STACKALIGNBYTES) |
| 47 | 45 | |
| 48 | #define	__PCI_REROUTE_INTERRUPT | |
| 49 | ||
| 50 | 46 | #ifndef MACHINE |
| 51 | 47 | #define	MACHINE		"arm64" |
| 52 | 48 | #endif |
| ... | ... | @@ -99,7 +95,7 @@ |
| 99 | 95 | #define	PAGE_SIZE	(1 << PAGE_SHIFT) |
| 100 | 96 | #define	PAGE_MASK	(PAGE_SIZE - 1) |
| 101 | 97 | |
| 102 | #define	MAXPAGESIZES	3		/* maximum number of supported page sizes */ | |
| 98 | #define	MAXPAGESIZES	4		/* maximum number of supported page sizes */ | |
| 103 | 99 | |
| 104 | 100 | #ifndef KSTACK_PAGES |
| 105 | 101 | #if defined(KASAN) || defined(KMSAN) |
| ... | ... | @@ -121,17 +117,9 @@ |
| 121 | 117 | /* |
| 122 | 118 | * Mach derived conversion macros |
| 123 | 119 | */ |
| 124 | #define	round_page(x)		(((unsigned long)(x) + PAGE_MASK) & ~PAGE_MASK) | |
| 125 | #define	trunc_page(x)		((unsigned long)(x) & ~PAGE_MASK) | |
| 126 | ||
| 127 | #define	atop(x)			((unsigned long)(x) >> PAGE_SHIFT) | |
| 128 | #define	ptoa(x)			((unsigned long)(x) << PAGE_SHIFT) | |
| 129 | ||
| 130 | 120 | #define	arm64_btop(x)		((unsigned long)(x) >> PAGE_SHIFT) |
| 131 | 121 | #define	arm64_ptob(x)		((unsigned long)(x) << PAGE_SHIFT) |
| 132 | 122 | |
| 133 | #define	pgtok(x)		((unsigned long)(x) * (PAGE_SIZE / 1024)) | |
| 134 | ||
| 135 | 123 | #endif /* !_MACHINE_PARAM_H_ */ |
| 136 | 124 | |
| 137 | 125 | #endif /* !__arm__ */ |
| \ No newline at end of file |
lib/libc/include/aarch64-freebsd-none/machine/pci_cfgreg.h+2-5| ... | ... | @@ -27,10 +27,7 @@ |
| 27 | 27 | #define	_MACHINE_PCI_CFGREG_H |
| 28 | 28 | |
| 29 | 29 | int pci_cfgregopen(void); |
| 30 | uint32_t pci_cfgregread_domain(int, int, int, int, int, int); | |
| 31 | void pci_cfgregwrite_domain(int, int, int, int, int, uint32_t, int); | |
| 32 | ||
| 33 | #define	pci_cfgregread		pci_cfgregread_domain | |
| 34 | #define	pci_cfgregwrite		pci_cfgregwrite_domain | |
| 30 | uint32_t pci_cfgregread(int, int, int, int, int, int); | |
| 31 | void pci_cfgregwrite(int, int, int, int, int, uint32_t, int); | |
| 35 | 32 | |
| 36 | 33 | #endif /* !_MACHINE_PCI_CFGREG_H */ |
| \ No newline at end of file |
lib/libc/include/aarch64-freebsd-none/machine/pcpu.h-1| ... | ... | @@ -48,7 +48,6 @@ struct debug_monitor_state; |
| 48 | 48 | 	pcpu_ssbd pc_ssbd;						\ |
| 49 | 49 | 	struct pmap *pc_curpmap;					\ |
| 50 | 50 | 	struct pmap *pc_curvmpmap;					\ |
| 51 | 	/* Store as two u_int values to preserve KBI */			\ | |
| 52 | 51 | 	uint64_t pc_mpidr;						\ |
| 53 | 52 | 	u_int	pc_bcast_tlbi_workaround;				\ |
| 54 | 53 | 	char __pad[197] |
lib/libc/include/aarch64-freebsd-none/machine/pmap.h+16-8| ... | ... | @@ -63,10 +63,13 @@ void pmap_page_set_memattr(vm_page_t m, vm_memattr_t ma); |
| 63 | 63 | * Pmap stuff |
| 64 | 64 | */ |
| 65 | 65 | |
| 66 | struct rangeset; | |
| 67 | ||
| 66 | 68 | struct md_page { |
| 67 | 69 | 	TAILQ_HEAD(,pv_entry)	pv_list; |
| 68 | 70 | 	int			pv_gen; |
| 69 | 71 | 	vm_memattr_t		pv_memattr; |
| 72 | 	uint8_t			pv_reserve[3]; | |
| 70 | 73 | }; |
| 71 | 74 | |
| 72 | 75 | enum pmap_stage { |
| ... | ... | @@ -87,7 +90,8 @@ struct pmap { |
| 87 | 90 | 	struct asid_set		*pm_asid_set;	/* The ASID/VMID set to use */ |
| 88 | 91 | 	enum pmap_stage		pm_stage; |
| 89 | 92 | 	int			pm_levels; |
| 90 | 	uint64_t		pm_reserved[4]; | |
| 93 | 	struct rangeset		*pm_bti; | |
| 94 | 	uint64_t		pm_reserved[3]; | |
| 91 | 95 | }; |
| 92 | 96 | typedef struct pmap *pmap_t; |
| 93 | 97 | |
| ... | ... | @@ -98,6 +102,8 @@ extern struct pmap	kernel_pmap_store; |
| 98 | 102 | #define	kernel_pmap	(&kernel_pmap_store) |
| 99 | 103 | #define	pmap_kernel()	kernel_pmap |
| 100 | 104 | |
| 105 | extern bool		pmap_lpa_enabled; | |
| 106 | ||
| 101 | 107 | #define	PMAP_ASSERT_LOCKED(pmap) \ |
| 102 | 108 | 				mtx_assert(&(pmap)->pm_mtx, MA_OWNED) |
| 103 | 109 | #define	PMAP_LOCK(pmap)		mtx_lock(&(pmap)->pm_mtx) |
| ... | ... | @@ -124,6 +130,8 @@ extern struct pmap	kernel_pmap_store; |
| 124 | 130 | extern vm_offset_t virtual_avail; |
| 125 | 131 | extern vm_offset_t virtual_end; |
| 126 | 132 | |
| 133 | extern pt_entry_t pmap_sh_attr; | |
| 134 | ||
| 127 | 135 | /* |
| 128 | 136 | * Macros to test if a mapping is mappable with an L1 Section mapping |
| 129 | 137 | * or an L2 Large Page mapping. |
| ... | ... | @@ -134,7 +142,8 @@ extern vm_offset_t virtual_end; |
| 134 | 142 | #define	pmap_vm_page_alloc_check(m) |
| 135 | 143 | |
| 136 | 144 | void	pmap_activate_vm(pmap_t); |
| 137 | void	pmap_bootstrap(vm_size_t); | |
| 145 | void	pmap_bootstrap_dmap(vm_size_t); | |
| 146 | void	pmap_bootstrap(void); | |
| 138 | 147 | int	pmap_change_attr(vm_offset_t va, vm_size_t size, int mode); |
| 139 | 148 | int	pmap_change_prot(vm_offset_t va, vm_size_t size, vm_prot_t prot); |
| 140 | 149 | void	pmap_kenter(vm_offset_t sva, vm_size_t size, vm_paddr_t pa, int mode); |
| ... | ... | @@ -166,18 +175,17 @@ int	pmap_fault(pmap_t, uint64_t, uint64_t); |
| 166 | 175 | |
| 167 | 176 | struct pcb *pmap_switch(struct thread *); |
| 168 | 177 | |
| 178 | void	pmap_s1_invalidate_all_kernel(void); | |
| 179 | ||
| 169 | 180 | extern void (*pmap_clean_stage2_tlbi)(void); |
| 170 | extern void (*pmap_invalidate_vpipt_icache)(void); | |
| 171 | 181 | extern void (*pmap_stage2_invalidate_range)(uint64_t, vm_offset_t, vm_offset_t, |
| 172 | 182 | bool); |
| 173 | 183 | extern void (*pmap_stage2_invalidate_all)(uint64_t); |
| 174 | 184 | |
| 175 | static inline int | |
| 176 | pmap_vmspace_copy(pmap_t dst_pmap __unused, pmap_t src_pmap __unused) | |
| 177 | { | |
| 185 | int pmap_vmspace_copy(pmap_t, pmap_t); | |
| 178 | 186 | |
| 179 | 	return (0); | |
| 180 | } | |
| 187 | int pmap_bti_set(pmap_t, vm_offset_t, vm_offset_t); | |
| 188 | int pmap_bti_clear(pmap_t, vm_offset_t, vm_offset_t); | |
| 181 | 189 | |
| 182 | 190 | #if defined(KASAN) || defined(KMSAN) |
| 183 | 191 | struct arm64_bootparams; |
lib/libc/include/aarch64-freebsd-none/machine/proc.h+12-4| ... | ... | @@ -25,8 +25,6 @@ |
| 25 | 25 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 26 | 26 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 27 | 27 | * SUCH DAMAGE. |
| 28 | * | |
| 29 | * from: @(#)proc.h 7.1 (Berkeley) 5/15/91 | |
| 30 | 28 | *	from: FreeBSD: src/sys/i386/include/proc.h,v 1.11 2001/06/29 |
| 31 | 29 | */ |
| 32 | 30 | |
| ... | ... | @@ -37,6 +35,7 @@ |
| 37 | 35 | #ifndef	_MACHINE_PROC_H_ |
| 38 | 36 | #define	_MACHINE_PROC_H_ |
| 39 | 37 | |
| 38 | #ifndef LOCORE | |
| 40 | 39 | struct ptrauth_key { |
| 41 | 40 | 	uint64_t pa_key_lo; |
| 42 | 41 | 	uint64_t pa_key_hi; |
| ... | ... | @@ -67,12 +66,21 @@ struct mdthread { |
| 67 | 66 | 		struct ptrauth_key apia; |
| 68 | 67 | 	} md_ptrauth_kern; |
| 69 | 68 | |
| 70 | 	uint64_t md_reserved[4]; | |
| 69 | 	uint64_t md_efirt_tmp; | |
| 70 | 	int md_efirt_dis_pf; | |
| 71 | ||
| 72 | 	int md_reserved0; | |
| 73 | 	uint64_t md_reserved[2]; | |
| 71 | 74 | }; |
| 72 | 75 | |
| 73 | 76 | struct mdproc { |
| 74 | 	long	md_dummy; | |
| 77 | 	uint64_t md_tcr;		/* TCR_EL1 fields to update */ | |
| 78 | 	uint64_t md_reserved[2]; | |
| 75 | 79 | }; |
| 80 | #endif /* !LOCORE */ | |
| 81 | ||
| 82 | /* Fields that can be set in md_tcr */ | |
| 83 | #define	MD_TCR_FIELDS			TCR_TBI0 | |
| 76 | 84 | |
| 77 | 85 | #define	KINFO_PROC_SIZE	1088 |
| 78 | 86 | #define	KINFO_PROC32_SIZE 816 |
lib/libc/include/aarch64-freebsd-none/machine/pte.h+73-9| ... | ... | @@ -54,13 +54,6 @@ typedef	uint64_t	pt_entry_t;		/* page table entry */ |
| 54 | 54 | #define	ATTR_MASK_L		UINT64_C(0x0000000000000fff) |
| 55 | 55 | #define	ATTR_MASK		(ATTR_MASK_H | ATTR_MASK_L) |
| 56 | 56 | |
| 57 | #define BASE_MASK		~ATTR_MASK | |
| 58 | #define BASE_ADDR(x)		((x) & BASE_MASK) | |
| 59 | ||
| 60 | #define PTE_TO_PHYS(pte)	BASE_ADDR(pte) | |
| 61 | /* Convert a phys addr to the output address field of a PTE */ | |
| 62 | #define PHYS_TO_PTE(pa)		(pa) | |
| 63 | ||
| 64 | 57 | /* Bits 58:55 are reserved for software */ |
| 65 | 58 | #define	ATTR_SW_UNUSED1		(1UL << 58) |
| 66 | 59 | #define	ATTR_SW_NO_PROMOTE	(1UL << 57) |
| ... | ... | @@ -80,13 +73,37 @@ typedef	uint64_t	pt_entry_t;		/* page table entry */ |
| 80 | 73 | |
| 81 | 74 | #define	ATTR_CONTIGUOUS		(1UL << 52) |
| 82 | 75 | #define	ATTR_DBM		(1UL << 51) |
| 76 | #define	ATTR_S1_GP_SHIFT	50 | |
| 77 | #define	ATTR_S1_GP		(1UL << ATTR_S1_GP_SHIFT) | |
| 78 | ||
| 79 | /* | |
| 80 | * Largest possible output address field for a level 3 page. Block | |
| 81 | * entries will use fewer low address bits, but these are res0 so | |
| 82 | * should be safe to include. | |
| 83 | * | |
| 84 | * This is also safe to use for the next-level table address for | |
| 85 | * table entries as they encode a physical address in the same way. | |
| 86 | */ | |
| 87 | #if PAGE_SIZE == PAGE_SIZE_4K | |
| 88 | #define	ATTR_ADDR		UINT64_C(0x0003fffffffff000) | |
| 89 | #elif PAGE_SIZE == PAGE_SIZE_16K | |
| 90 | #define	ATTR_ADDR		UINT64_C(0x0003ffffffffc000) | |
| 91 | #else | |
| 92 | #error Unsupported page size | |
| 93 | #endif | |
| 94 | ||
| 83 | 95 | #define	ATTR_S1_nG		(1 << 11) |
| 84 | 96 | #define	ATTR_AF			(1 << 10) |
| 97 | /* When TCR_EL1.DS == 0 */ | |
| 85 | 98 | #define	ATTR_SH(x)		((x) << 8) |
| 86 | 99 | #define	 ATTR_SH_MASK		ATTR_SH(3) |
| 87 | 100 | #define	 ATTR_SH_NS		0		/* Non-shareable */ |
| 88 | 101 | #define	 ATTR_SH_OS		2		/* Outer-shareable */ |
| 89 | 102 | #define	 ATTR_SH_IS		3		/* Inner-shareable */ |
| 103 | /* When TCR_EL1.DS == 1 */ | |
| 104 | #define	ATTR_OA_51_50_SHIFT	8 | |
| 105 | #define	ATTR_OA_51_50_MASK	(3 << ATTR_OA_51_50_SHIFT) | |
| 106 | #define	ATTR_OA_51_50_DELTA	(50 - 8)	/* Delta from address to pte */ | |
| 90 | 107 | |
| 91 | 108 | #define	ATTR_S1_AP_RW_BIT	(1 << 7) |
| 92 | 109 | #define	ATTR_S1_AP(x)		((x) << 6) |
| ... | ... | @@ -110,8 +127,6 @@ typedef	uint64_t	pt_entry_t;		/* page table entry */ |
| 110 | 127 | #define	 ATTR_S2_MEMATTR_WT		0xa |
| 111 | 128 | #define	 ATTR_S2_MEMATTR_WB		0xf |
| 112 | 129 | |
| 113 | #define	ATTR_DEFAULT	(ATTR_AF | ATTR_SH(ATTR_SH_IS)) | |
| 114 | ||
| 115 | 130 | #define	ATTR_DESCR_MASK		3 |
| 116 | 131 | #define	ATTR_DESCR_VALID	1 |
| 117 | 132 | #define	ATTR_DESCR_TYPE_MASK	2 |
| ... | ... | @@ -119,6 +134,35 @@ typedef	uint64_t	pt_entry_t;		/* page table entry */ |
| 119 | 134 | #define	ATTR_DESCR_TYPE_PAGE	2 |
| 120 | 135 | #define	ATTR_DESCR_TYPE_BLOCK	0 |
| 121 | 136 | |
| 137 | /* | |
| 138 | * Superpage promotion requires that the bits specified by the following | |
| 139 | * mask all be identical in the constituent PTEs. | |
| 140 | */ | |
| 141 | #define	ATTR_PROMOTE	(ATTR_MASK & ~(ATTR_CONTIGUOUS | ATTR_AF)) | |
| 142 | ||
| 143 | /* Read the output address or next-level table address from a PTE */ | |
| 144 | #define PTE_TO_PHYS(x)		({					\ | |
| 145 | 	pt_entry_t _pte = (x);						\ | |
| 146 | 	vm_paddr_t _pa;							\ | |
| 147 | 	_pa = _pte & ATTR_ADDR;						\ | |
| 148 | 	if (pmap_lpa_enabled)						\ | |
| 149 | 		_pa |= (_pte & ATTR_OA_51_50_MASK) << ATTR_OA_51_50_DELTA; \ | |
| 150 | 	_pa;								\ | |
| 151 | }) | |
| 152 | ||
| 153 | /* | |
| 154 | * Convert a physical address to an output address or next-level | |
| 155 | * table address in a PTE | |
| 156 | */ | |
| 157 | #define PHYS_TO_PTE(x)		({					\ | |
| 158 | 	vm_paddr_t _pa = (x);						\ | |
| 159 | 	pt_entry_t _pte;						\ | |
| 160 | 	_pte = _pa & ATTR_ADDR;						\ | |
| 161 | 	if (pmap_lpa_enabled)						\ | |
| 162 | 		_pte |= (_pa >> ATTR_OA_51_50_DELTA) & ATTR_OA_51_50_MASK; \ | |
| 163 | 	_pte;								\ | |
| 164 | }) | |
| 165 | ||
| 122 | 166 | #if PAGE_SIZE == PAGE_SIZE_4K |
| 123 | 167 | #define	L0_SHIFT	39 |
| 124 | 168 | #define	L1_SHIFT	30 |
| ... | ... | @@ -186,6 +230,26 @@ typedef	uint64_t	pt_entry_t;		/* page table entry */ |
| 186 | 230 | #define	Ln_ADDR_MASK	(Ln_ENTRIES - 1) |
| 187 | 231 | #define	Ln_TABLE_MASK	((1 << 12) - 1) |
| 188 | 232 | |
| 233 | /* | |
| 234 | * The number of contiguous Level 3 entries (with ATTR_CONTIGUOUS set) that | |
| 235 | * can be coalesced into a single TLB entry | |
| 236 | */ | |
| 237 | #if PAGE_SIZE == PAGE_SIZE_4K | |
| 238 | #define	L2C_ENTRIES	16 | |
| 239 | #define	L3C_ENTRIES	16 | |
| 240 | #elif PAGE_SIZE == PAGE_SIZE_16K | |
| 241 | #define	L2C_ENTRIES	32 | |
| 242 | #define	L3C_ENTRIES	128 | |
| 243 | #else | |
| 244 | #error Unsupported page size | |
| 245 | #endif | |
| 246 | ||
| 247 | #define	L2C_SIZE	(L2C_ENTRIES * L2_SIZE) | |
| 248 | #define	L2C_OFFSET	(L2C_SIZE - 1) | |
| 249 | ||
| 250 | #define	L3C_SIZE	(L3C_ENTRIES * L3_SIZE) | |
| 251 | #define	L3C_OFFSET	(L3C_SIZE - 1) | |
| 252 | ||
| 189 | 253 | #define	pmap_l0_index(va)	(((va) >> L0_SHIFT) & L0_ADDR_MASK) |
| 190 | 254 | #define	pmap_l1_index(va)	(((va) >> L1_SHIFT) & Ln_ADDR_MASK) |
| 191 | 255 | #define	pmap_l2_index(va)	(((va) >> L2_SHIFT) & Ln_ADDR_MASK) |
lib/libc/include/aarch64-freebsd-none/machine/resource.h-2| ... | ... | @@ -44,9 +44,7 @@ |
| 44 | 44 | #define	SYS_RES_MEMORY	3	/* i/o memory */ |
| 45 | 45 | #define	SYS_RES_IOPORT	4	/* i/o ports */ |
| 46 | 46 | #define	SYS_RES_GPIO	5	/* general purpose i/o */ |
| 47 | #ifdef NEW_PCIB | |
| 48 | 47 | #define	PCI_RES_BUS	6	/* PCI bus numbers */ |
| 49 | #endif | |
| 50 | 48 | |
| 51 | 49 | #endif /* !_MACHINE_RESOURCE_H_ */ |
| 52 | 50 |
lib/libc/include/aarch64-freebsd-none/machine/runq.h deleted-50| ... | ... | @@ -1,50 +0,0 @@ |
| 1 | /*- | |
| 2 | * Copyright (c) 2001 Jake Burkholder <jake@FreeBSD.org> | |
| 3 | * All rights reserved. | |
| 4 | * | |
| 5 | * Redistribution and use in source and binary forms, with or without | |
| 6 | * modification, are permitted provided that the following conditions | |
| 7 | * are met: | |
| 8 | * 1. Redistributions of source code must retain the above copyright | |
| 9 | * notice, this list of conditions and the following disclaimer. | |
| 10 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 11 | * notice, this list of conditions and the following disclaimer in the | |
| 12 | * documentation and/or other materials provided with the distribution. | |
| 13 | * | |
| 14 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |
| 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 16 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
| 17 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | |
| 18 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
| 19 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
| 20 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
| 21 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
| 22 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
| 23 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
| 24 | * SUCH DAMAGE. | |
| 25 | */ | |
| 26 | ||
| 27 | #ifdef __arm__ | |
| 28 | #include <arm/runq.h> | |
| 29 | #else /* !__arm__ */ | |
| 30 | ||
| 31 | #ifndef	_MACHINE_RUNQ_H_ | |
| 32 | #define	_MACHINE_RUNQ_H_ | |
| 33 | ||
| 34 | #define	RQB_LEN		(1)		/* Number of priority status words. */ | |
| 35 | #define	RQB_L2BPW	(6)		/* Log2(sizeof(rqb_word_t) * NBBY)). */ | |
| 36 | #define	RQB_BPW		(1<<RQB_L2BPW)	/* Bits in an rqb_word_t. */ | |
| 37 | ||
| 38 | #define	RQB_BIT(pri)	(1ul << ((pri) & (RQB_BPW - 1))) | |
| 39 | #define	RQB_WORD(pri)	((pri) >> RQB_L2BPW) | |
| 40 | ||
| 41 | #define	RQB_FFS(word)	(ffsl(word) - 1) | |
| 42 | ||
| 43 | /* | |
| 44 | * Type of run queue status word. | |
| 45 | */ | |
| 46 | typedef	unsigned long	rqb_word_t; | |
| 47 | ||
| 48 | #endif | |
| 49 | ||
| 50 | #endif /* !__arm__ */ | |
| \ No newline at end of file |
lib/libc/include/aarch64-freebsd-none/machine/signal.h-2| ... | ... | @@ -25,8 +25,6 @@ |
| 25 | 25 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 26 | 26 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 27 | 27 | * SUCH DAMAGE. |
| 28 | * | |
| 29 | * @(#)signal.h 8.1 (Berkeley) 6/11/93 | |
| 30 | 28 | *	from: FreeBSD: src/sys/i386/include/signal.h,v 1.13 2000/11/09 |
| 31 | 29 | *	from: FreeBSD: src/sys/sparc64/include/signal.h,v 1.6 2001/09/30 18:52:17 |
| 32 | 30 | */ |
lib/libc/include/aarch64-freebsd-none/machine/sysarch.h+9| ... | ... | @@ -39,6 +39,15 @@ |
| 39 | 39 | #ifndef _MACHINE_SYSARCH_H_ |
| 40 | 40 | #define	_MACHINE_SYSARCH_H_ |
| 41 | 41 | |
| 42 | #include <sys/cdefs.h> | |
| 43 | ||
| 44 | #define	ARM64_GUARD_PAGE	0x100 | |
| 45 | ||
| 46 | struct arm64_guard_page_args { | |
| 47 | 	__uintptr_t	addr; | |
| 48 | 	__size_t	len; | |
| 49 | }; | |
| 50 | ||
| 42 | 51 | #define	ARM64_GET_SVE_VL	0x200 |
| 43 | 52 | /* Reserved ARM64_SET_SVE_VL	0x201 */ |
| 44 | 53 |
lib/libc/include/aarch64-freebsd-none/machine/undefined.h+8-22| ... | ... | @@ -35,31 +35,17 @@ |
| 35 | 35 | |
| 36 | 36 | typedef int (*undef_handler_t)(vm_offset_t, uint32_t, struct trapframe *, |
| 37 | 37 | uint32_t); |
| 38 | ||
| 39 | static inline int | |
| 40 | mrs_Op0(uint32_t insn) | |
| 41 | { | |
| 42 | ||
| 43 | 	/* op0 is encoded without the top bit in a mrs instruction */ | |
| 44 | 	return (2 | ((insn & MRS_Op0_MASK) >> MRS_Op0_SHIFT)); | |
| 45 | } | |
| 46 | ||
| 47 | #define	MRS_GET(op)						\ | |
| 48 | static inline int						\ | |
| 49 | mrs_##op(uint32_t insn)						\ | |
| 50 | {								\ | |
| 51 | 								\ | |
| 52 | 	return ((insn & MRS_##op##_MASK) >> MRS_##op##_SHIFT);	\ | |
| 53 | } | |
| 54 | MRS_GET(Op1) | |
| 55 | MRS_GET(CRn) | |
| 56 | MRS_GET(CRm) | |
| 57 | MRS_GET(Op2) | |
| 38 | typedef bool (*undef_sys_handler_t)(uint64_t, struct trapframe *); | |
| 58 | 39 | |
| 59 | 40 | void undef_init(void); |
| 60 | void *install_undef_handler(bool, undef_handler_t); | |
| 41 | void install_sys_handler(undef_sys_handler_t); | |
| 42 | void *install_undef_handler(undef_handler_t); | |
| 43 | #ifdef COMPAT_FREEBSD32 | |
| 44 | void *install_undef32_handler(undef_handler_t); | |
| 45 | #endif | |
| 61 | 46 | void remove_undef_handler(void *); |
| 62 | int undef_insn(u_int, struct trapframe *); | |
| 47 | bool undef_sys(uint64_t, struct trapframe *); | |
| 48 | int undef_insn(struct trapframe *); | |
| 63 | 49 | |
| 64 | 50 | #endif /* _KERNEL */ |
| 65 | 51 |
lib/libc/include/aarch64-freebsd-none/machine/vmm.h created+348| ... | ... | @@ -0,0 +1,348 @@ |
| 1 | /* | |
| 2 | * Copyright (C) 2015 Mihai Carabas <mihai.carabas@gmail.com> | |
| 3 | * All rights reserved. | |
| 4 | * | |
| 5 | * Redistribution and use in source and binary forms, with or without | |
| 6 | * modification, are permitted provided that the following conditions | |
| 7 | * are met: | |
| 8 | * 1. Redistributions of source code must retain the above copyright | |
| 9 | * notice, this list of conditions and the following disclaimer. | |
| 10 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 11 | * notice, this list of conditions and the following disclaimer in the | |
| 12 | * documentation and/or other materials provided with the distribution. | |
| 13 | * | |
| 14 | * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |
| 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 16 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
| 17 | * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE | |
| 18 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
| 19 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
| 20 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
| 21 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
| 22 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
| 23 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
| 24 | * SUCH DAMAGE. | |
| 25 | */ | |
| 26 | ||
| 27 | #ifndef _VMM_H_ | |
| 28 | #define	_VMM_H_ | |
| 29 | ||
| 30 | #include <sys/param.h> | |
| 31 | #include <sys/cpuset.h> | |
| 32 | #include <vm/vm.h> | |
| 33 | #include <vm/pmap.h> | |
| 34 | ||
| 35 | #include "pte.h" | |
| 36 | #include "pmap.h" | |
| 37 | ||
| 38 | struct vcpu; | |
| 39 | ||
| 40 | enum vm_suspend_how { | |
| 41 | 	VM_SUSPEND_NONE, | |
| 42 | 	VM_SUSPEND_RESET, | |
| 43 | 	VM_SUSPEND_POWEROFF, | |
| 44 | 	VM_SUSPEND_HALT, | |
| 45 | 	VM_SUSPEND_DESTROY, | |
| 46 | 	VM_SUSPEND_LAST | |
| 47 | }; | |
| 48 | ||
| 49 | /* | |
| 50 | * Identifiers for architecturally defined registers. | |
| 51 | */ | |
| 52 | enum vm_reg_name { | |
| 53 | 	VM_REG_GUEST_X0 = 0, | |
| 54 | 	VM_REG_GUEST_X1, | |
| 55 | 	VM_REG_GUEST_X2, | |
| 56 | 	VM_REG_GUEST_X3, | |
| 57 | 	VM_REG_GUEST_X4, | |
| 58 | 	VM_REG_GUEST_X5, | |
| 59 | 	VM_REG_GUEST_X6, | |
| 60 | 	VM_REG_GUEST_X7, | |
| 61 | 	VM_REG_GUEST_X8, | |
| 62 | 	VM_REG_GUEST_X9, | |
| 63 | 	VM_REG_GUEST_X10, | |
| 64 | 	VM_REG_GUEST_X11, | |
| 65 | 	VM_REG_GUEST_X12, | |
| 66 | 	VM_REG_GUEST_X13, | |
| 67 | 	VM_REG_GUEST_X14, | |
| 68 | 	VM_REG_GUEST_X15, | |
| 69 | 	VM_REG_GUEST_X16, | |
| 70 | 	VM_REG_GUEST_X17, | |
| 71 | 	VM_REG_GUEST_X18, | |
| 72 | 	VM_REG_GUEST_X19, | |
| 73 | 	VM_REG_GUEST_X20, | |
| 74 | 	VM_REG_GUEST_X21, | |
| 75 | 	VM_REG_GUEST_X22, | |
| 76 | 	VM_REG_GUEST_X23, | |
| 77 | 	VM_REG_GUEST_X24, | |
| 78 | 	VM_REG_GUEST_X25, | |
| 79 | 	VM_REG_GUEST_X26, | |
| 80 | 	VM_REG_GUEST_X27, | |
| 81 | 	VM_REG_GUEST_X28, | |
| 82 | 	VM_REG_GUEST_X29, | |
| 83 | 	VM_REG_GUEST_LR, | |
| 84 | 	VM_REG_GUEST_SP, | |
| 85 | 	VM_REG_GUEST_PC, | |
| 86 | 	VM_REG_GUEST_CPSR, | |
| 87 | ||
| 88 | 	VM_REG_GUEST_SCTLR_EL1, | |
| 89 | 	VM_REG_GUEST_TTBR0_EL1, | |
| 90 | 	VM_REG_GUEST_TTBR1_EL1, | |
| 91 | 	VM_REG_GUEST_TCR_EL1, | |
| 92 | 	VM_REG_GUEST_TCR2_EL1, | |
| 93 | 	VM_REG_GUEST_MPIDR_EL1, | |
| 94 | 	VM_REG_LAST | |
| 95 | }; | |
| 96 | ||
| 97 | #define	VM_INTINFO_VECTOR(info)	((info) & 0xff) | |
| 98 | #define	VM_INTINFO_DEL_ERRCODE	0x800 | |
| 99 | #define	VM_INTINFO_RSVD		0x7ffff000 | |
| 100 | #define	VM_INTINFO_VALID	0x80000000 | |
| 101 | #define	VM_INTINFO_TYPE		0x700 | |
| 102 | #define	VM_INTINFO_HWINTR	(0 << 8) | |
| 103 | #define	VM_INTINFO_NMI		(2 << 8) | |
| 104 | #define	VM_INTINFO_HWEXCEPTION	(3 << 8) | |
| 105 | #define	VM_INTINFO_SWINTR	(4 << 8) | |
| 106 | ||
| 107 | #define VM_GUEST_BASE_IPA	0x80000000UL	/* Guest kernel start ipa */ | |
| 108 | ||
| 109 | /* | |
| 110 | * The VM name has to fit into the pathname length constraints of devfs, | |
| 111 | * governed primarily by SPECNAMELEN. The length is the total number of | |
| 112 | * characters in the full path, relative to the mount point and not | |
| 113 | * including any leading '/' characters. | |
| 114 | * A prefix and a suffix are added to the name specified by the user. | |
| 115 | * The prefix is usually "vmm/" or "vmm.io/", but can be a few characters | |
| 116 | * longer for future use. | |
| 117 | * The suffix is a string that identifies a bootrom image or some similar | |
| 118 | * image that is attached to the VM. A separator character gets added to | |
| 119 | * the suffix automatically when generating the full path, so it must be | |
| 120 | * accounted for, reducing the effective length by 1. | |
| 121 | * The effective length of a VM name is 229 bytes for FreeBSD 13 and 37 | |
| 122 | * bytes for FreeBSD 12. A minimum length is set for safety and supports | |
| 123 | * a SPECNAMELEN as small as 32 on old systems. | |
| 124 | */ | |
| 125 | #define VM_MAX_PREFIXLEN 10 | |
| 126 | #define VM_MAX_SUFFIXLEN 15 | |
| 127 | #define VM_MAX_NAMELEN \ | |
| 128 | (SPECNAMELEN - VM_MAX_PREFIXLEN - VM_MAX_SUFFIXLEN - 1) | |
| 129 | ||
| 130 | #ifdef _KERNEL | |
| 131 | struct vm; | |
| 132 | struct vm_exception; | |
| 133 | struct vm_exit; | |
| 134 | struct vm_run; | |
| 135 | struct vm_object; | |
| 136 | struct vm_guest_paging; | |
| 137 | struct vm_vgic_descr; | |
| 138 | struct pmap; | |
| 139 | ||
| 140 | struct vm_eventinfo { | |
| 141 | 	void	*rptr;		/* rendezvous cookie */ | |
| 142 | 	int	*sptr;		/* suspend cookie */ | |
| 143 | 	int	*iptr;		/* reqidle cookie */ | |
| 144 | }; | |
| 145 | ||
| 146 | int vm_create(const char *name, struct vm **retvm); | |
| 147 | struct vcpu *vm_alloc_vcpu(struct vm *vm, int vcpuid); | |
| 148 | void vm_disable_vcpu_creation(struct vm *vm); | |
| 149 | void vm_slock_vcpus(struct vm *vm); | |
| 150 | void vm_unlock_vcpus(struct vm *vm); | |
| 151 | void vm_destroy(struct vm *vm); | |
| 152 | int vm_reinit(struct vm *vm); | |
| 153 | const char *vm_name(struct vm *vm); | |
| 154 | ||
| 155 | uint16_t vm_get_maxcpus(struct vm *vm); | |
| 156 | void vm_get_topology(struct vm *vm, uint16_t *sockets, uint16_t *cores, | |
| 157 | uint16_t *threads, uint16_t *maxcpus); | |
| 158 | int vm_set_topology(struct vm *vm, uint16_t sockets, uint16_t cores, | |
| 159 | uint16_t threads, uint16_t maxcpus); | |
| 160 | int vm_get_register(struct vcpu *vcpu, int reg, uint64_t *retval); | |
| 161 | int vm_set_register(struct vcpu *vcpu, int reg, uint64_t val); | |
| 162 | int vm_run(struct vcpu *vcpu); | |
| 163 | int vm_suspend(struct vm *vm, enum vm_suspend_how how); | |
| 164 | void* vm_get_cookie(struct vm *vm); | |
| 165 | int vcpu_vcpuid(struct vcpu *vcpu); | |
| 166 | void *vcpu_get_cookie(struct vcpu *vcpu); | |
| 167 | struct vm *vcpu_vm(struct vcpu *vcpu); | |
| 168 | struct vcpu *vm_vcpu(struct vm *vm, int cpu); | |
| 169 | int vm_get_capability(struct vcpu *vcpu, int type, int *val); | |
| 170 | int vm_set_capability(struct vcpu *vcpu, int type, int val); | |
| 171 | int vm_activate_cpu(struct vcpu *vcpu); | |
| 172 | int vm_suspend_cpu(struct vm *vm, struct vcpu *vcpu); | |
| 173 | int vm_resume_cpu(struct vm *vm, struct vcpu *vcpu); | |
| 174 | int vm_inject_exception(struct vcpu *vcpu, uint64_t esr, uint64_t far); | |
| 175 | int vm_attach_vgic(struct vm *vm, struct vm_vgic_descr *descr); | |
| 176 | int vm_assert_irq(struct vm *vm, uint32_t irq); | |
| 177 | int vm_deassert_irq(struct vm *vm, uint32_t irq); | |
| 178 | int vm_raise_msi(struct vm *vm, uint64_t msg, uint64_t addr, int bus, int slot, | |
| 179 | int func); | |
| 180 | struct vm_exit *vm_exitinfo(struct vcpu *vcpu); | |
| 181 | void vm_exit_suspended(struct vcpu *vcpu, uint64_t pc); | |
| 182 | void vm_exit_debug(struct vcpu *vcpu, uint64_t pc); | |
| 183 | void vm_exit_rendezvous(struct vcpu *vcpu, uint64_t pc); | |
| 184 | void vm_exit_astpending(struct vcpu *vcpu, uint64_t pc); | |
| 185 | ||
| 186 | cpuset_t vm_active_cpus(struct vm *vm); | |
| 187 | cpuset_t vm_debug_cpus(struct vm *vm); | |
| 188 | cpuset_t vm_suspended_cpus(struct vm *vm); | |
| 189 | ||
| 190 | static __inline int | |
| 191 | vcpu_rendezvous_pending(struct vm_eventinfo *info) | |
| 192 | { | |
| 193 | ||
| 194 | 	return (*((uintptr_t *)(info->rptr)) != 0); | |
| 195 | } | |
| 196 | ||
| 197 | static __inline int | |
| 198 | vcpu_suspended(struct vm_eventinfo *info) | |
| 199 | { | |
| 200 | ||
| 201 | 	return (*info->sptr); | |
| 202 | } | |
| 203 | ||
| 204 | int vcpu_debugged(struct vcpu *vcpu); | |
| 205 | ||
| 206 | enum vcpu_state { | |
| 207 | 	VCPU_IDLE, | |
| 208 | 	VCPU_FROZEN, | |
| 209 | 	VCPU_RUNNING, | |
| 210 | 	VCPU_SLEEPING, | |
| 211 | }; | |
| 212 | ||
| 213 | int vcpu_set_state(struct vcpu *vcpu, enum vcpu_state state, bool from_idle); | |
| 214 | enum vcpu_state vcpu_get_state(struct vcpu *vcpu, int *hostcpu); | |
| 215 | ||
| 216 | static int __inline | |
| 217 | vcpu_is_running(struct vcpu *vcpu, int *hostcpu) | |
| 218 | { | |
| 219 | 	return (vcpu_get_state(vcpu, hostcpu) == VCPU_RUNNING); | |
| 220 | } | |
| 221 | ||
| 222 | #ifdef _SYS_PROC_H_ | |
| 223 | static int __inline | |
| 224 | vcpu_should_yield(struct vcpu *vcpu) | |
| 225 | { | |
| 226 | 	struct thread *td; | |
| 227 | ||
| 228 | 	td = curthread; | |
| 229 | 	return (td->td_ast != 0 || td->td_owepreempt != 0); | |
| 230 | } | |
| 231 | #endif | |
| 232 | ||
| 233 | void *vcpu_stats(struct vcpu *vcpu); | |
| 234 | void vcpu_notify_event(struct vcpu *vcpu); | |
| 235 | struct vmspace *vm_vmspace(struct vm *vm); | |
| 236 | struct vm_mem *vm_mem(struct vm *vm); | |
| 237 | ||
| 238 | enum vm_reg_name vm_segment_name(int seg_encoding); | |
| 239 | ||
| 240 | struct vm_copyinfo { | |
| 241 | 	uint64_t	gpa; | |
| 242 | 	size_t		len; | |
| 243 | 	void		*hva; | |
| 244 | 	void		*cookie; | |
| 245 | }; | |
| 246 | ||
| 247 | #endif	/* _KERNEL */ | |
| 248 | ||
| 249 | #define	VM_DIR_READ	0 | |
| 250 | #define	VM_DIR_WRITE	1 | |
| 251 | ||
| 252 | #define	VM_GP_M_MASK		0x1f | |
| 253 | #define	VM_GP_MMU_ENABLED	(1 << 5) | |
| 254 | ||
| 255 | struct vm_guest_paging { | |
| 256 | 	uint64_t	ttbr0_addr; | |
| 257 | 	uint64_t	ttbr1_addr; | |
| 258 | 	uint64_t	tcr_el1; | |
| 259 | 	uint64_t	tcr2_el1; | |
| 260 | 	int		flags; | |
| 261 | 	int		padding; | |
| 262 | }; | |
| 263 | ||
| 264 | struct vie { | |
| 265 | 	uint8_t access_size:4, sign_extend:1, dir:1, unused:2; | |
| 266 | 	enum vm_reg_name reg; | |
| 267 | }; | |
| 268 | ||
| 269 | struct vre { | |
| 270 | 	uint32_t inst_syndrome; | |
| 271 | 	uint8_t dir:1, unused:7; | |
| 272 | 	enum vm_reg_name reg; | |
| 273 | }; | |
| 274 | ||
| 275 | /* | |
| 276 | * Identifiers for optional vmm capabilities | |
| 277 | */ | |
| 278 | enum vm_cap_type { | |
| 279 | 	VM_CAP_HALT_EXIT, | |
| 280 | 	VM_CAP_PAUSE_EXIT, | |
| 281 | 	VM_CAP_UNRESTRICTED_GUEST, | |
| 282 | 	VM_CAP_BRK_EXIT, | |
| 283 | 	VM_CAP_SS_EXIT, | |
| 284 | 	VM_CAP_MASK_HWINTR, | |
| 285 | 	VM_CAP_MAX | |
| 286 | }; | |
| 287 | ||
| 288 | enum vm_exitcode { | |
| 289 | 	VM_EXITCODE_BOGUS, | |
| 290 | 	VM_EXITCODE_INST_EMUL, | |
| 291 | 	VM_EXITCODE_REG_EMUL, | |
| 292 | 	VM_EXITCODE_HVC, | |
| 293 | 	VM_EXITCODE_SUSPENDED, | |
| 294 | 	VM_EXITCODE_HYP, | |
| 295 | 	VM_EXITCODE_WFI, | |
| 296 | 	VM_EXITCODE_PAGING, | |
| 297 | 	VM_EXITCODE_SMCCC, | |
| 298 | 	VM_EXITCODE_DEBUG, | |
| 299 | 	VM_EXITCODE_BRK, | |
| 300 | 	VM_EXITCODE_SS, | |
| 301 | 	VM_EXITCODE_MAX | |
| 302 | }; | |
| 303 | ||
| 304 | struct vm_exit { | |
| 305 | 	enum vm_exitcode	exitcode; | |
| 306 | 	int			inst_length; | |
| 307 | 	uint64_t		pc; | |
| 308 | 	union { | |
| 309 | 		/* | |
| 310 | 		 * ARM specific payload. | |
| 311 | 		 */ | |
| 312 | 		struct { | |
| 313 | 			uint32_t	exception_nr; | |
| 314 | 			uint32_t	pad; | |
| 315 | 			uint64_t	esr_el2;	/* Exception Syndrome Register */ | |
| 316 | 			uint64_t	far_el2;	/* Fault Address Register */ | |
| 317 | 			uint64_t	hpfar_el2;	/* Hypervisor IPA Fault Address Register */ | |
| 318 | 		} hyp; | |
| 319 | 		struct { | |
| 320 | 			struct vre 	vre; | |
| 321 | 		} reg_emul; | |
| 322 | 		struct { | |
| 323 | 			uint64_t	gpa; | |
| 324 | 			uint64_t	esr; | |
| 325 | 		} paging; | |
| 326 | 		struct { | |
| 327 | 			uint64_t	gpa; | |
| 328 | 			struct vm_guest_paging paging; | |
| 329 | 			struct vie	vie; | |
| 330 | 		} inst_emul; | |
| 331 | ||
| 332 | 		/* | |
| 333 | 		 * A SMCCC call, e.g. starting a core via PSCI. | |
| 334 | 		 * Further arguments can be read by asking the kernel for | |
| 335 | 		 * all register values. | |
| 336 | 		 */ | |
| 337 | 		struct { | |
| 338 | 			uint64_t	func_id; | |
| 339 | 			uint64_t	args[7]; | |
| 340 | 		} smccc_call; | |
| 341 | ||
| 342 | 		struct { | |
| 343 | 			enum vm_suspend_how how; | |
| 344 | 		} suspended; | |
| 345 | 	} u; | |
| 346 | }; | |
| 347 | ||
| 348 | #endif	/* _VMM_H_ */ | |
| \ No newline at end of file |
lib/libc/include/aarch64-freebsd-none/machine/vmm_dev.h created+274| ... | ... | @@ -0,0 +1,274 @@ |
| 1 | /* | |
| 2 | * Copyright (C) 2015 Mihai Carabas <mihai.carabas@gmail.com> | |
| 3 | * All rights reserved. | |
| 4 | * | |
| 5 | * Redistribution and use in source and binary forms, with or without | |
| 6 | * modification, are permitted provided that the following conditions | |
| 7 | * are met: | |
| 8 | * 1. Redistributions of source code must retain the above copyright | |
| 9 | * notice, this list of conditions and the following disclaimer. | |
| 10 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 11 | * notice, this list of conditions and the following disclaimer in the | |
| 12 | * documentation and/or other materials provided with the distribution. | |
| 13 | * | |
| 14 | * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |
| 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 16 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
| 17 | * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE | |
| 18 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
| 19 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
| 20 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
| 21 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
| 22 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
| 23 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
| 24 | * SUCH DAMAGE. | |
| 25 | */ | |
| 26 | ||
| 27 | #ifndef	_VMM_DEV_H_ | |
| 28 | #define	_VMM_DEV_H_ | |
| 29 | ||
| 30 | #include <sys/domainset.h> | |
| 31 | ||
| 32 | #include <machine/vmm.h> | |
| 33 | ||
| 34 | struct vm_memmap { | |
| 35 | 	vm_paddr_t	gpa; | |
| 36 | 	int		segid;		/* memory segment */ | |
| 37 | 	vm_ooffset_t	segoff;		/* offset into memory segment */ | |
| 38 | 	size_t		len;		/* mmap length */ | |
| 39 | 	int		prot;		/* RWX */ | |
| 40 | 	int		flags; | |
| 41 | }; | |
| 42 | #define	VM_MEMMAP_F_WIRED	0x01 | |
| 43 | ||
| 44 | struct vm_munmap { | |
| 45 | 	vm_paddr_t	gpa; | |
| 46 | 	size_t		len; | |
| 47 | }; | |
| 48 | ||
| 49 | #define	VM_MEMSEG_NAME(m)	((m)->name[0] != '\0' ? (m)->name : NULL) | |
| 50 | struct vm_memseg { | |
| 51 | 	int		segid; | |
| 52 | 	size_t		len; | |
| 53 | 	char		name[VM_MAX_SUFFIXLEN + 1]; | |
| 54 | 	domainset_t	*ds_mask; | |
| 55 | 	size_t		ds_mask_size; | |
| 56 | 	int		ds_policy; | |
| 57 | }; | |
| 58 | ||
| 59 | struct vm_register { | |
| 60 | 	int		cpuid; | |
| 61 | 	int		regnum;		/* enum vm_reg_name */ | |
| 62 | 	uint64_t	regval; | |
| 63 | }; | |
| 64 | ||
| 65 | struct vm_register_set { | |
| 66 | 	int		cpuid; | |
| 67 | 	unsigned int	count; | |
| 68 | 	const int	*regnums;	/* enum vm_reg_name */ | |
| 69 | 	uint64_t	*regvals; | |
| 70 | }; | |
| 71 | ||
| 72 | struct vm_run { | |
| 73 | 	int		cpuid; | |
| 74 | 	cpuset_t	*cpuset;	/* CPU set storage */ | |
| 75 | 	size_t		cpusetsize; | |
| 76 | 	struct vm_exit	*vm_exit; | |
| 77 | }; | |
| 78 | ||
| 79 | struct vm_exception { | |
| 80 | 	int		cpuid; | |
| 81 | 	uint64_t	esr; | |
| 82 | 	uint64_t	far; | |
| 83 | }; | |
| 84 | ||
| 85 | struct vm_msi { | |
| 86 | 	uint64_t	msg; | |
| 87 | 	uint64_t	addr; | |
| 88 | 	int		bus; | |
| 89 | 	int		slot; | |
| 90 | 	int		func; | |
| 91 | }; | |
| 92 | ||
| 93 | struct vm_capability { | |
| 94 | 	int		cpuid; | |
| 95 | 	enum vm_cap_type captype; | |
| 96 | 	int		capval; | |
| 97 | 	int		allcpus; | |
| 98 | }; | |
| 99 | ||
| 100 | #define	MAX_VM_STATS	64 | |
| 101 | struct vm_stats { | |
| 102 | 	int		cpuid;				/* in */ | |
| 103 | 	int		index;				/* in */ | |
| 104 | 	int		num_entries;			/* out */ | |
| 105 | 	struct timeval	tv; | |
| 106 | 	uint64_t	statbuf[MAX_VM_STATS]; | |
| 107 | }; | |
| 108 | struct vm_stat_desc { | |
| 109 | 	int		index;				/* in */ | |
| 110 | 	char		desc[128];			/* out */ | |
| 111 | }; | |
| 112 | ||
| 113 | struct vm_suspend { | |
| 114 | 	enum vm_suspend_how how; | |
| 115 | }; | |
| 116 | ||
| 117 | struct vm_gla2gpa { | |
| 118 | 	int		vcpuid;		/* inputs */ | |
| 119 | 	int 		prot;		/* PROT_READ or PROT_WRITE */ | |
| 120 | 	uint64_t	gla; | |
| 121 | 	struct vm_guest_paging paging; | |
| 122 | 	int		fault;		/* outputs */ | |
| 123 | 	uint64_t	gpa; | |
| 124 | }; | |
| 125 | ||
| 126 | struct vm_activate_cpu { | |
| 127 | 	int		vcpuid; | |
| 128 | }; | |
| 129 | ||
| 130 | struct vm_cpuset { | |
| 131 | 	int		which; | |
| 132 | 	int		cpusetsize; | |
| 133 | 	cpuset_t	*cpus; | |
| 134 | }; | |
| 135 | #define	VM_ACTIVE_CPUS		0 | |
| 136 | #define	VM_SUSPENDED_CPUS	1 | |
| 137 | #define	VM_DEBUG_CPUS		2 | |
| 138 | ||
| 139 | struct vm_vgic_version { | |
| 140 | 	u_int version; | |
| 141 | 	u_int flags; | |
| 142 | }; | |
| 143 | ||
| 144 | struct vm_vgic_descr { | |
| 145 | 	struct vm_vgic_version ver; | |
| 146 | 	union { | |
| 147 | 		struct { | |
| 148 | 			uint64_t dist_start; | |
| 149 | 			uint64_t dist_size; | |
| 150 | 			uint64_t redist_start; | |
| 151 | 			uint64_t redist_size; | |
| 152 | 		} v3_regs; | |
| 153 | 	}; | |
| 154 | }; | |
| 155 | ||
| 156 | struct vm_irq { | |
| 157 | 	uint32_t irq; | |
| 158 | }; | |
| 159 | ||
| 160 | struct vm_cpu_topology { | |
| 161 | 	uint16_t	sockets; | |
| 162 | 	uint16_t	cores; | |
| 163 | 	uint16_t	threads; | |
| 164 | 	uint16_t	maxcpus; | |
| 165 | }; | |
| 166 | ||
| 167 | enum { | |
| 168 | 	/* general routines */ | |
| 169 | 	IOCNUM_ABIVERS = 0, | |
| 170 | 	IOCNUM_RUN = 1, | |
| 171 | 	IOCNUM_SET_CAPABILITY = 2, | |
| 172 | 	IOCNUM_GET_CAPABILITY = 3, | |
| 173 | 	IOCNUM_SUSPEND = 4, | |
| 174 | 	IOCNUM_REINIT = 5, | |
| 175 | ||
| 176 | 	/* memory apis */ | |
| 177 | 	IOCNUM_GET_GPA_PMAP = 12, | |
| 178 | 	IOCNUM_GLA2GPA_NOFAULT = 13, | |
| 179 | 	IOCNUM_ALLOC_MEMSEG = 14, | |
| 180 | 	IOCNUM_GET_MEMSEG = 15, | |
| 181 | 	IOCNUM_MMAP_MEMSEG = 16, | |
| 182 | 	IOCNUM_MMAP_GETNEXT = 17, | |
| 183 | 	IOCNUM_MUNMAP_MEMSEG = 18, | |
| 184 | ||
| 185 | 	/* register/state accessors */ | |
| 186 | 	IOCNUM_SET_REGISTER = 20, | |
| 187 | 	IOCNUM_GET_REGISTER = 21, | |
| 188 | 	IOCNUM_SET_REGISTER_SET = 24, | |
| 189 | 	IOCNUM_GET_REGISTER_SET = 25, | |
| 190 | ||
| 191 | 	/* statistics */ | |
| 192 | 	IOCNUM_VM_STATS = 50, | |
| 193 | 	IOCNUM_VM_STAT_DESC = 51, | |
| 194 | ||
| 195 | 	/* CPU Topology */ | |
| 196 | 	IOCNUM_SET_TOPOLOGY = 63, | |
| 197 | 	IOCNUM_GET_TOPOLOGY = 64, | |
| 198 | ||
| 199 | 	/* interrupt injection */ | |
| 200 | 	IOCNUM_ASSERT_IRQ = 80, | |
| 201 | 	IOCNUM_DEASSERT_IRQ = 81, | |
| 202 | 	IOCNUM_RAISE_MSI = 82, | |
| 203 | 	IOCNUM_INJECT_EXCEPTION = 83, | |
| 204 | ||
| 205 | 	/* vm_cpuset */ | |
| 206 | 	IOCNUM_ACTIVATE_CPU = 90, | |
| 207 | 	IOCNUM_GET_CPUSET = 91, | |
| 208 | 	IOCNUM_SUSPEND_CPU = 92, | |
| 209 | 	IOCNUM_RESUME_CPU = 93, | |
| 210 | ||
| 211 | 	/* vm_attach_vgic */ | |
| 212 | 	IOCNUM_GET_VGIC_VERSION = 110, | |
| 213 | 	IOCNUM_ATTACH_VGIC = 111, | |
| 214 | }; | |
| 215 | ||
| 216 | #define	VM_RUN		\ | |
| 217 | 	_IOWR('v', IOCNUM_RUN, struct vm_run) | |
| 218 | #define	VM_SUSPEND	\ | |
| 219 | 	_IOW('v', IOCNUM_SUSPEND, struct vm_suspend) | |
| 220 | #define	VM_REINIT	\ | |
| 221 | 	_IO('v', IOCNUM_REINIT) | |
| 222 | #define	VM_ALLOC_MEMSEG	\ | |
| 223 | 	_IOW('v', IOCNUM_ALLOC_MEMSEG, struct vm_memseg) | |
| 224 | #define	VM_GET_MEMSEG	\ | |
| 225 | 	_IOWR('v', IOCNUM_GET_MEMSEG, struct vm_memseg) | |
| 226 | #define	VM_MMAP_MEMSEG	\ | |
| 227 | 	_IOW('v', IOCNUM_MMAP_MEMSEG, struct vm_memmap) | |
| 228 | #define	VM_MMAP_GETNEXT	\ | |
| 229 | 	_IOWR('v', IOCNUM_MMAP_GETNEXT, struct vm_memmap) | |
| 230 | #define	VM_MUNMAP_MEMSEG	\ | |
| 231 | 	_IOW('v', IOCNUM_MUNMAP_MEMSEG, struct vm_munmap) | |
| 232 | #define	VM_SET_REGISTER \ | |
| 233 | 	_IOW('v', IOCNUM_SET_REGISTER, struct vm_register) | |
| 234 | #define	VM_GET_REGISTER \ | |
| 235 | 	_IOWR('v', IOCNUM_GET_REGISTER, struct vm_register) | |
| 236 | #define	VM_SET_REGISTER_SET \ | |
| 237 | 	_IOW('v', IOCNUM_SET_REGISTER_SET, struct vm_register_set) | |
| 238 | #define	VM_GET_REGISTER_SET \ | |
| 239 | 	_IOWR('v', IOCNUM_GET_REGISTER_SET, struct vm_register_set) | |
| 240 | #define	VM_SET_CAPABILITY \ | |
| 241 | 	_IOW('v', IOCNUM_SET_CAPABILITY, struct vm_capability) | |
| 242 | #define	VM_GET_CAPABILITY \ | |
| 243 | 	_IOWR('v', IOCNUM_GET_CAPABILITY, struct vm_capability) | |
| 244 | #define	VM_STATS \ | |
| 245 | 	_IOWR('v', IOCNUM_VM_STATS, struct vm_stats) | |
| 246 | #define	VM_STAT_DESC \ | |
| 247 | 	_IOWR('v', IOCNUM_VM_STAT_DESC, struct vm_stat_desc) | |
| 248 | #define VM_ASSERT_IRQ \ | |
| 249 | 	_IOW('v', IOCNUM_ASSERT_IRQ, struct vm_irq) | |
| 250 | #define VM_DEASSERT_IRQ \ | |
| 251 | 	_IOW('v', IOCNUM_DEASSERT_IRQ, struct vm_irq) | |
| 252 | #define VM_RAISE_MSI \ | |
| 253 | 	_IOW('v', IOCNUM_RAISE_MSI, struct vm_msi) | |
| 254 | #define	VM_INJECT_EXCEPTION	\ | |
| 255 | 	_IOW('v', IOCNUM_INJECT_EXCEPTION, struct vm_exception) | |
| 256 | #define VM_SET_TOPOLOGY \ | |
| 257 | 	_IOW('v', IOCNUM_SET_TOPOLOGY, struct vm_cpu_topology) | |
| 258 | #define VM_GET_TOPOLOGY \ | |
| 259 | 	_IOR('v', IOCNUM_GET_TOPOLOGY, struct vm_cpu_topology) | |
| 260 | #define	VM_GLA2GPA_NOFAULT \ | |
| 261 | 	_IOWR('v', IOCNUM_GLA2GPA_NOFAULT, struct vm_gla2gpa) | |
| 262 | #define	VM_ACTIVATE_CPU	\ | |
| 263 | 	_IOW('v', IOCNUM_ACTIVATE_CPU, struct vm_activate_cpu) | |
| 264 | #define	VM_GET_CPUS	\ | |
| 265 | 	_IOW('v', IOCNUM_GET_CPUSET, struct vm_cpuset) | |
| 266 | #define	VM_SUSPEND_CPU \ | |
| 267 | 	_IOW('v', IOCNUM_SUSPEND_CPU, struct vm_activate_cpu) | |
| 268 | #define	VM_RESUME_CPU \ | |
| 269 | 	_IOW('v', IOCNUM_RESUME_CPU, struct vm_activate_cpu) | |
| 270 | #define	VM_GET_VGIC_VERSION	\ | |
| 271 | 	_IOR('v', IOCNUM_GET_VGIC_VERSION, struct vm_vgic_version) | |
| 272 | #define	VM_ATTACH_VGIC	\ | |
| 273 | 	_IOW('v', IOCNUM_ATTACH_VGIC, struct vm_vgic_descr) | |
| 274 | #endif | |
| \ No newline at end of file |
lib/libc/include/aarch64-freebsd-none/machine/vmm_instruction_emul.h created+83| ... | ... | @@ -0,0 +1,83 @@ |
| 1 | /* | |
| 2 | * Copyright (C) 2015 Mihai Carabas <mihai.carabas@gmail.com> | |
| 3 | * All rights reserved. | |
| 4 | * | |
| 5 | * Redistribution and use in source and binary forms, with or without | |
| 6 | * modification, are permitted provided that the following conditions | |
| 7 | * are met: | |
| 8 | * 1. Redistributions of source code must retain the above copyright | |
| 9 | * notice, this list of conditions and the following disclaimer. | |
| 10 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 11 | * notice, this list of conditions and the following disclaimer in the | |
| 12 | * documentation and/or other materials provided with the distribution. | |
| 13 | * | |
| 14 | * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |
| 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 16 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
| 17 | * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE | |
| 18 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
| 19 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
| 20 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
| 21 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
| 22 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
| 23 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
| 24 | * SUCH DAMAGE. | |
| 25 | */ | |
| 26 | ||
| 27 | #ifndef	_VMM_INSTRUCTION_EMUL_H_ | |
| 28 | #define	_VMM_INSTRUCTION_EMUL_H_ | |
| 29 | ||
| 30 | /* | |
| 31 | * Callback functions to read and write memory regions. | |
| 32 | */ | |
| 33 | typedef int (*mem_region_read_t)(struct vcpu *vcpu, uint64_t gpa, | |
| 34 | 				 uint64_t *rval, int rsize, void *arg); | |
| 35 | typedef int (*mem_region_write_t)(struct vcpu *vcpu, uint64_t gpa, | |
| 36 | 				 uint64_t wval, int wsize, void *arg); | |
| 37 | ||
| 38 | /* | |
| 39 | * Callback functions to read and write registers. | |
| 40 | */ | |
| 41 | typedef int (*reg_read_t)(struct vcpu *vcpu, uint64_t *rval, void *arg); | |
| 42 | typedef int (*reg_write_t)(struct vcpu *vcpu, uint64_t wval, void *arg); | |
| 43 | ||
| 44 | /* | |
| 45 | * Emulate the decoded 'vie' instruction when it contains a memory operation. | |
| 46 | * | |
| 47 | * The callbacks 'mrr' and 'mrw' emulate reads and writes to the memory region | |
| 48 | * containing 'gpa'. 'mrarg' is an opaque argument that is passed into the | |
| 49 | * callback functions. | |
| 50 | * | |
| 51 | * 'void *vm' should be 'struct vm *' when called from kernel context and | |
| 52 | * 'struct vmctx *' when called from user context. | |
| 53 | * | |
| 54 | */ | |
| 55 | int vmm_emulate_instruction(struct vcpu *vcpu, uint64_t gpa, struct vie *vie, | |
| 56 | struct vm_guest_paging *paging, mem_region_read_t mrr, | |
| 57 | mem_region_write_t mrw, void *mrarg); | |
| 58 | ||
| 59 | /* | |
| 60 | * Emulate the decoded 'vre' instruction when it contains a register access. | |
| 61 | * | |
| 62 | * The callbacks 'regread' and 'regwrite' emulate reads and writes to the | |
| 63 | * register from 'vie'. 'regarg' is an opaque argument that is passed into the | |
| 64 | * callback functions. | |
| 65 | * | |
| 66 | * 'void *vm' should be 'struct vm *' when called from kernel context and | |
| 67 | * 'struct vmctx *' when called from user context. | |
| 68 | * | |
| 69 | */ | |
| 70 | int vmm_emulate_register(struct vcpu *vcpu, struct vre *vre, reg_read_t regread, | |
| 71 | reg_write_t regwrite, void *regarg); | |
| 72 | ||
| 73 | #ifdef _KERNEL | |
| 74 | void vm_register_reg_handler(struct vm *vm, uint64_t iss, uint64_t mask, | |
| 75 | reg_read_t reg_read, reg_write_t reg_write, void *arg); | |
| 76 | void vm_deregister_reg_handler(struct vm *vm, uint64_t iss, uint64_t mask); | |
| 77 | ||
| 78 | void vm_register_inst_handler(struct vm *vm, uint64_t start, uint64_t size, | |
| 79 | mem_region_read_t mmio_read, mem_region_write_t mmio_write); | |
| 80 | void vm_deregister_inst_handler(struct vm *vm, uint64_t start, uint64_t size); | |
| 81 | #endif | |
| 82 | ||
| 83 | #endif	/* _VMM_INSTRUCTION_EMUL_H_ */ | |
| \ No newline at end of file |
lib/libc/include/aarch64-freebsd-none/machine/vmparam.h+61-15| ... | ... | @@ -30,8 +30,6 @@ |
| 30 | 30 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 31 | 31 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 32 | 32 | * SUCH DAMAGE. |
| 33 | * | |
| 34 | *	from: @(#)vmparam.h 5.9 (Berkeley) 5/12/91 | |
| 35 | 33 | *	from: FreeBSD: src/sys/i386/include/vmparam.h,v 1.33 2000/03/30 |
| 36 | 34 | */ |
| 37 | 35 | |
| ... | ... | @@ -75,14 +73,16 @@ |
| 75 | 73 | #define	VM_PHYSSEG_MAX		64 |
| 76 | 74 | |
| 77 | 75 | /* |
| 78 | * Create two free page pools: VM_FREEPOOL_DEFAULT is the default pool | |
| 79 | * from which physical pages are allocated and VM_FREEPOOL_DIRECT is | |
| 80 | * the pool from which physical pages for small UMA objects are | |
| 81 | * allocated. | |
| 76 | * Create three free page pools: VM_FREEPOOL_DEFAULT is the default pool from | |
| 77 | * which physical pages are allocated and VM_FREEPOOL_DIRECT is the pool from | |
| 78 | * which physical pages for page tables and small UMA objects are allocated. | |
| 79 | * VM_FREEPOOL_LAZYINIT is a special-purpose pool that is populated only during | |
| 80 | * boot and is used to implement deferred initialization of page structures. | |
| 82 | 81 | */ |
| 83 | #define	VM_NFREEPOOL		2 | |
| 84 | #define	VM_FREEPOOL_DEFAULT	0 | |
| 85 | #define	VM_FREEPOOL_DIRECT	1 | |
| 82 | #define	VM_NFREEPOOL		3 | |
| 83 | #define	VM_FREEPOOL_LAZYINIT	0 | |
| 84 | #define	VM_FREEPOOL_DEFAULT	1 | |
| 85 | #define	VM_FREEPOOL_DIRECT	2 | |
| 86 | 86 | |
| 87 | 87 | /* |
| 88 | 88 | * Create two free page lists: VM_FREELIST_DMA32 is for physical pages that have |
| ... | ... | @@ -101,21 +101,46 @@ |
| 101 | 101 | * are used by UMA, the physical memory allocator reduces the likelihood of |
| 102 | 102 | * both 2MB page TLB misses and cache misses during the page table walk when |
| 103 | 103 | * a 2MB page TLB miss does occur. |
| 104 | * | |
| 105 | * When PAGE_SIZE is 16KB, an allocation size of 32MB is supported. This | |
| 106 | * size is used by level 0 reservations and L2 BLOCK mappings. | |
| 104 | 107 | */ |
| 108 | #if PAGE_SIZE == PAGE_SIZE_4K | |
| 105 | 109 | #define	VM_NFREEORDER		13 |
| 110 | #elif PAGE_SIZE == PAGE_SIZE_16K | |
| 111 | #define	VM_NFREEORDER		12 | |
| 112 | #else | |
| 113 | #error Unsupported page size | |
| 114 | #endif | |
| 106 | 115 | |
| 107 | 116 | /* |
| 108 | * Enable superpage reservations: 1 level. | |
| 117 | * Enable superpage reservations: 2 levels. | |
| 109 | 118 | */ |
| 110 | 119 | #ifndef	VM_NRESERVLEVEL |
| 111 | #define	VM_NRESERVLEVEL		1 | |
| 120 | #define	VM_NRESERVLEVEL		2 | |
| 112 | 121 | #endif |
| 113 | 122 | |
| 114 | 123 | /* |
| 115 | * Level 0 reservations consist of 512 pages. | |
| 124 | * Level 0 reservations consist of 16 pages when PAGE_SIZE is 4KB, and 128 | |
| 125 | * pages when PAGE_SIZE is 16KB. Level 1 reservations consist of 32 64KB | |
| 126 | * pages when PAGE_SIZE is 4KB, and 16 2M pages when PAGE_SIZE is 16KB. | |
| 116 | 127 | */ |
| 128 | #if PAGE_SIZE == PAGE_SIZE_4K | |
| 117 | 129 | #ifndef	VM_LEVEL_0_ORDER |
| 118 | #define	VM_LEVEL_0_ORDER	9 | |
| 130 | #define	VM_LEVEL_0_ORDER	4 | |
| 131 | #endif | |
| 132 | #ifndef	VM_LEVEL_1_ORDER | |
| 133 | #define	VM_LEVEL_1_ORDER	5 | |
| 134 | #endif | |
| 135 | #elif PAGE_SIZE == PAGE_SIZE_16K | |
| 136 | #ifndef	VM_LEVEL_0_ORDER | |
| 137 | #define	VM_LEVEL_0_ORDER	7 | |
| 138 | #endif | |
| 139 | #ifndef	VM_LEVEL_1_ORDER | |
| 140 | #define	VM_LEVEL_1_ORDER	4 | |
| 141 | #endif | |
| 142 | #else | |
| 143 | #error Unsupported page size | |
| 119 | 144 | #endif |
| 120 | 145 | |
| 121 | 146 | /** |
| ... | ... | @@ -133,6 +158,12 @@ |
| 133 | 158 | * 0xfffffeffffffffff End of DMAP |
| 134 | 159 | * 0xffffa00000000000 Start of DMAP |
| 135 | 160 | * |
| 161 | * 0xffff027fffffffff End of KMSAN origin map | |
| 162 | * 0xffff020000000000 Start of KMSAN origin map | |
| 163 | * | |
| 164 | * 0xffff017fffffffff End of KMSAN shadow map | |
| 165 | * 0xffff010000000000 Start of KMSAN shadow map | |
| 166 | * | |
| 136 | 167 | * 0xffff009fffffffff End of KASAN shadow map |
| 137 | 168 | * 0xffff008000000000 Start of KASAN shadow map |
| 138 | 169 | * |
| ... | ... | @@ -169,11 +200,25 @@ |
| 169 | 200 | #define	KASAN_MIN_ADDRESS	(0xffff008000000000UL) |
| 170 | 201 | #define	KASAN_MAX_ADDRESS	(0xffff00a000000000UL) |
| 171 | 202 | |
| 203 | /* 512GiB KMSAN shadow map */ | |
| 204 | #define	KMSAN_SHAD_MIN_ADDRESS	(0xffff010000000000UL) | |
| 205 | #define	KMSAN_SHAD_MAX_ADDRESS	(0xffff018000000000UL) | |
| 206 | ||
| 207 | /* 512GiB KMSAN origin map */ | |
| 208 | #define	KMSAN_ORIG_MIN_ADDRESS	(0xffff020000000000UL) | |
| 209 | #define	KMSAN_ORIG_MAX_ADDRESS	(0xffff028000000000UL) | |
| 210 | ||
| 172 | 211 | /* The address bits that hold a pointer authentication code */ |
| 173 | #define	PAC_ADDR_MASK		(0xff7f000000000000UL) | |
| 212 | #define	PAC_ADDR_MASK		(0x007f000000000000UL) | |
| 213 | #define	PAC_ADDR_MASK_14	(0xff7f000000000000UL) | |
| 214 | ||
| 215 | /* The top-byte ignore address bits */ | |
| 216 | #define	TBI_ADDR_MASK		0xff00000000000000UL | |
| 174 | 217 | |
| 175 | 218 | /* If true addr is in the kernel address space */ |
| 176 | 219 | #define	ADDR_IS_KERNEL(addr)	(((addr) & (1ul << 55)) == (1ul << 55)) |
| 220 | /* If true addr is in the user address space */ | |
| 221 | #define	ADDR_IS_USER(addr)	(((addr) & (1ul << 55)) == 0) | |
| 177 | 222 | /* If true addr is in its canonical form (i.e. no TBI, PAC, etc.) */ |
| 178 | 223 | #define	ADDR_IS_CANONICAL(addr)	\ |
| 179 | 224 | (((addr) & 0xffff000000000000UL) == 0 || \ |
| ... | ... | @@ -265,7 +310,7 @@ |
| 265 | 310 | #endif |
| 266 | 311 | |
| 267 | 312 | #if !defined(KASAN) && !defined(KMSAN) |
| 268 | #define	UMA_MD_SMALL_ALLOC | |
| 313 | #define UMA_USE_DMAP | |
| 269 | 314 | #endif |
| 270 | 315 | |
| 271 | 316 | #ifndef LOCORE |
| ... | ... | @@ -289,6 +334,7 @@ extern vm_offset_t dmap_max_addr; |
| 289 | 334 | * Need a page dump array for minidump. |
| 290 | 335 | */ |
| 291 | 336 | #define MINIDUMP_PAGE_TRACKING	1 |
| 337 | #define MINIDUMP_STARTUP_PAGE_TRACKING 1 | |
| 292 | 338 | |
| 293 | 339 | #endif /* !_MACHINE_VMPARAM_H_ */ |
| 294 | 340 |
lib/libc/include/arm-freebsd-eabihf/fenv.h+1| ... | ... | @@ -29,6 +29,7 @@ |
| 29 | 29 | #ifndef	_FENV_H_ |
| 30 | 30 | #define	_FENV_H_ |
| 31 | 31 | |
| 32 | #include <sys/cdefs.h> | |
| 32 | 33 | #include <sys/_types.h> |
| 33 | 34 | |
| 34 | 35 | #ifndef	__fenv_static |
lib/libc/include/arm-freebsd-eabihf/float.h-2| ... | ... | @@ -27,8 +27,6 @@ |
| 27 | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | * | |
| 31 | *	from: @(#)float.h	7.1 (Berkeley) 5/8/90 | |
| 32 | 30 | */ |
| 33 | 31 | |
| 34 | 32 | #ifndef _MACHINE_FLOAT_H_ |
lib/libc/include/arm-freebsd-eabihf/floatingpoint.h-2| ... | ... | @@ -31,8 +31,6 @@ |
| 31 | 31 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 32 | 32 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 33 | 33 | * SUCH DAMAGE. |
| 34 | * | |
| 35 | *	from: @(#) floatingpoint.h	1.0 (Berkeley) 9/23/93 | |
| 36 | 34 | */ |
| 37 | 35 | |
| 38 | 36 | #ifndef _FLOATINGPOINT_H_ |
lib/libc/include/arm-freebsd-eabihf/machine/_align.h-2| ... | ... | @@ -35,8 +35,6 @@ |
| 35 | 35 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 36 | 36 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 37 | 37 | * SUCH DAMAGE. |
| 38 | * | |
| 39 | *	from: @(#)param.h	5.8 (Berkeley) 6/28/91 | |
| 40 | 38 | */ |
| 41 | 39 | |
| 42 | 40 | #ifndef _ARM_INCLUDE__ALIGN_H_ |
lib/libc/include/arm-freebsd-eabihf/machine/_bus.h+7-24| ... | ... | @@ -1,30 +1,13 @@ |
| 1 | 1 | /*- |
| 2 | * SPDX-License-Identifier: BSD-2-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 2005 M. Warner Losh <imp@FreeBSD.org> | |
| 2 | * Copyright (c) 2005 The FreeBSD Foundation. | |
| 5 | 3 | * |
| 6 | * Redistribution and use in source and binary forms, with or without | |
| 7 | * modification, are permitted provided that the following conditions | |
| 8 | * are met: | |
| 9 | * 1. Redistributions of source code must retain the above copyright | |
| 10 | * notice, this list of conditions, and the following disclaimer, | |
| 11 | * without modification, immediately at the beginning of the file. | |
| 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 13 | * notice, this list of conditions and the following disclaimer in | |
| 14 | * the documentation and/or other materials provided with the | |
| 15 | * distribution. | |
| 4 | * SPDX-License-Identifier: BSD-2-Clause | |
| 16 | 5 | * |
| 17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |
| 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 19 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
| 20 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR | |
| 21 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
| 22 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
| 23 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
| 24 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
| 25 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
| 26 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
| 27 | * SUCH DAMAGE. | |
| 6 | * Derived in part from NetBSD's bus.h files by (alphabetically): | |
| 7 | *	Christopher G. Demetriou | |
| 8 | *	Charles M. Hannum | |
| 9 | *	Jason Thorpe | |
| 10 | *	The NetBSD Foundation. | |
| 28 | 11 | */ |
| 29 | 12 | |
| 30 | 13 | #ifndef ARM_INCLUDE__BUS_H |
lib/libc/include/arm-freebsd-eabihf/machine/_limits.h-2| ... | ... | @@ -27,8 +27,6 @@ |
| 27 | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | * | |
| 31 | *	@(#)limits.h	8.3 (Berkeley) 1/4/94 | |
| 32 | 30 | */ |
| 33 | 31 | |
| 34 | 32 | #ifndef _MACHINE__LIMITS_H_ |
lib/libc/include/arm-freebsd-eabihf/machine/_types.h-3| ... | ... | @@ -32,9 +32,6 @@ |
| 32 | 32 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 33 | 33 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 34 | 34 | * SUCH DAMAGE. |
| 35 | * | |
| 36 | *	From: @(#)ansi.h	8.2 (Berkeley) 1/4/94 | |
| 37 | *	From: @(#)types.h	8.3 (Berkeley) 1/5/94 | |
| 38 | 35 | */ |
| 39 | 36 | |
| 40 | 37 | #ifndef _MACHINE__TYPES_H_ |
lib/libc/include/arm-freebsd-eabihf/machine/acle-compat.h+3-155| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /* |
| 2 | * Copyright (c) 2014 ARM Ltd | |
| 2 | * Copyright (c) 2024 Arm Ltd | |
| 3 | 3 | * All rights reserved. |
| 4 | 4 | * |
| 5 | 5 | * Redistribution and use in source and binary forms, with or without |
| ... | ... | @@ -27,157 +27,5 @@ |
| 27 | 27 | */ |
| 28 | 28 | |
| 29 | 29 | #ifndef __ARM_ARCH |
| 30 | ||
| 31 | /* ACLE standardises a set of pre-defines that describe the ARM architecture. | |
| 32 | These were mostly implemented in GCC around GCC-4.8; older versions | |
| 33 | have no, or only partial support. To provide a level of backwards | |
| 34 | compatibility we try to work out what the definitions should be, given | |
| 35 | the older pre-defines that GCC did produce. This isn't complete, but | |
| 36 | it should be enough for use by routines that depend on this header. */ | |
| 37 | ||
| 38 | /* No need to handle ARMv8, GCC had ACLE support before that. */ | |
| 39 | ||
| 40 | #define __ARM_ACLE 101 | |
| 41 | ||
| 42 | # ifdef __ARM_ARCH_7__ | |
| 43 | /* The common subset of ARMv7 in all profiles. */ | |
| 44 | # define __ARM_ARCH 7 | |
| 45 | # define __ARM_ARCH_ISA_THUMB 2 | |
| 46 | # define __ARM_FEATURE_CLZ | |
| 47 | # define __ARM_FEATURE_LDREX 7 | |
| 48 | # define __ARM_FEATURE_UNALIGNED | |
| 49 | # endif | |
| 50 | ||
| 51 | # if defined (__ARM_ARCH_7A__) || defined (__ARM_ARCH_7R__) | |
| 52 | # define __ARM_ARCH 7 | |
| 53 | # define __ARM_ARCH_ISA_THUMB 2 | |
| 54 | # define __ARM_ARCH_ISA_ARM | |
| 55 | # define __ARM_FEATURE_CLZ | |
| 56 | # define __ARM_FEATURE_SIMD32 | |
| 57 | # define __ARM_FEATURE_DSP | |
| 58 | # define __ARM_FEATURE_QBIT | |
| 59 | # define __ARM_FEATURE_SAT | |
| 60 | # define __ARM_FEATURE_LDREX 15 | |
| 61 | # define __ARM_FEATURE_UNALIGNED | |
| 62 | # ifdef __ARM_ARCH_7A__ | |
| 63 | # define __ARM_ARCH_PROFILE 'A' | |
| 64 | # else | |
| 65 | # define __ARM_ARCH_PROFILE 'R' | |
| 66 | # endif | |
| 67 | # endif | |
| 68 | ||
| 69 | # ifdef __ARM_ARCH_7EM__ | |
| 70 | # define __ARM_ARCH 7 | |
| 71 | # define __ARM_ARCH_ISA_THUMB 2 | |
| 72 | # define __ARM_FEATURE_CLZ | |
| 73 | # define __ARM_FEATURE_SIMD32 | |
| 74 | # define __ARM_FEATURE_DSP | |
| 75 | # define __ARM_FEATURE_QBIT | |
| 76 | # define __ARM_FEATURE_SAT | |
| 77 | # define __ARM_FEATURE_LDREX 7 | |
| 78 | # define __ARM_FEATURE_UNALIGNED | |
| 79 | # define __ARM_ARCH_PROFILE 'M' | |
| 80 | # endif | |
| 81 | ||
| 82 | # ifdef __ARM_ARCH_7M__ | |
| 83 | # define __ARM_ARCH 7 | |
| 84 | # define __ARM_ARCH_ISA_THUMB 2 | |
| 85 | # define __ARM_FEATURE_CLZ | |
| 86 | # define __ARM_FEATURE_QBIT | |
| 87 | # define __ARM_FEATURE_SAT | |
| 88 | # define __ARM_FEATURE_LDREX 7 | |
| 89 | # define __ARM_FEATURE_UNALIGNED | |
| 90 | # define __ARM_ARCH_PROFILE 'M' | |
| 91 | # endif | |
| 92 | ||
| 93 | # ifdef __ARM_ARCH_6T2__ | |
| 94 | # define __ARM_ARCH 6 | |
| 95 | # define __ARM_ARCH_ISA_THUMB 2 | |
| 96 | # define __ARM_ARCH_ISA_ARM | |
| 97 | # define __ARM_FEATURE_CLZ | |
| 98 | # define __ARM_FEATURE_SIMD32 | |
| 99 | # define __ARM_FEATURE_DSP | |
| 100 | # define __ARM_FEATURE_QBIT | |
| 101 | # define __ARM_FEATURE_SAT | |
| 102 | # define __ARM_FEATURE_LDREX 4 | |
| 103 | # define __ARM_FEATURE_UNALIGNED | |
| 104 | # endif | |
| 105 | ||
| 106 | # ifdef __ARM_ARCH_6M__ | |
| 107 | # define __ARM_ARCH 6 | |
| 108 | # define __ARM_ARCH_ISA_THUMB 1 | |
| 109 | # define __ARM_ARCH_PROFILE 'M' | |
| 110 | # endif | |
| 111 | ||
| 112 | # if defined (__ARM_ARCH_6__) || defined (__ARM_ARCH_6J__) \ | |
| 113 | || defined (__ARM_ARCH_6K__) || defined (__ARM_ARCH_6Z__) \ | |
| 114 | || defined (__ARM_ARCH_6ZK__) | |
| 115 | # define __ARM_ARCH 6 | |
| 116 | # define __ARM_ARCH_ISA_THUMB 1 | |
| 117 | # define __ARM_ARCH_ISA_ARM | |
| 118 | # define __ARM_FEATURE_CLZ | |
| 119 | # define __ARM_FEATURE_SIMD32 | |
| 120 | # define __ARM_FEATURE_DSP | |
| 121 | # define __ARM_FEATURE_QBIT | |
| 122 | # define __ARM_FEATURE_SAT | |
| 123 | # define __ARM_FEATURE_UNALIGNED | |
| 124 | # ifndef __thumb__ | |
| 125 | # if defined (__ARM_ARCH_6K__) || defined (__ARM_ARCH_6ZK__) | |
| 126 | # define __ARM_FEATURE_LDREX 15 | |
| 127 | # else | |
| 128 | # define __ARM_FEATURE_LDREX 4 | |
| 129 | # endif | |
| 130 | # endif | |
| 131 | # endif | |
| 132 | ||
| 133 | # if defined (__ARM_ARCH_5TE__) || defined (__ARM_ARCH_5E__) | |
| 134 | # define __ARM_ARCH 5 | |
| 135 | # define __ARM_ARCH_ISA_ARM | |
| 136 | # ifdef __ARM_ARCH_5TE__ | |
| 137 | # define __ARM_ARCH_ISA_THUMB 1 | |
| 138 | # endif | |
| 139 | # define __ARM_FEATURE_CLZ | |
| 140 | # define __ARM_FEATURE_DSP | |
| 141 | # endif | |
| 142 | ||
| 143 | # if defined (__ARM_ARCH_5T__) || defined (__ARM_ARCH_5__) | |
| 144 | # define __ARM_ARCH 5 | |
| 145 | # define __ARM_ARCH_ISA_ARM | |
| 146 | # ifdef __ARM_ARCH_5TE__ | |
| 147 | # define __ARM_ARCH_ISA_THUMB 1 | |
| 148 | # endif | |
| 149 | # define __ARM_FEATURE_CLZ | |
| 150 | # endif | |
| 151 | ||
| 152 | # ifdef __ARM_ARCH_4T__ | |
| 153 | # define __ARM_ARCH 4 | |
| 154 | # define __ARM_ARCH_ISA_ARM | |
| 155 | # define __ARM_ARCH_ISA_THUMB 1 | |
| 156 | # endif | |
| 157 | ||
| 158 | # ifdef __ARM_ARCH_4__ | |
| 159 | # define __ARM_ARCH 4 | |
| 160 | # define __ARM_ARCH_ISA_ARM | |
| 161 | # endif | |
| 162 | ||
| 163 | # if defined (__ARM_ARCH_3__) || defined (__ARM_ARCH_3M__) | |
| 164 | # define __ARM_ARCH 3 | |
| 165 | # define __ARM_ARCH_ISA_ARM | |
| 166 | # endif | |
| 167 | ||
| 168 | # ifdef __ARM_ARCH_2__ | |
| 169 | # define __ARM_ARCH 2 | |
| 170 | # define __ARM_ARCH_ISA_ARM | |
| 171 | # endif | |
| 172 | ||
| 173 | # ifdef __ARMEB__ | |
| 174 | # define __ARM_BIG_ENDIAN | |
| 175 | # endif | |
| 176 | ||
| 177 | /* If we still don't know what the target architecture is, then we're | |
| 178 | probably not using GCC. */ | |
| 179 | # ifndef __ARM_ARCH | |
| 180 | # error Unable to determine architecture version. | |
| 181 | # endif | |
| 182 | ||
| 183 | #endif /* __ARM_ARCH */ | |
| \ No newline at end of file | ||
| 30 | #error Your compiler is too old | |
| 31 | #endif | |
| \ No newline at end of file |
lib/libc/include/arm-freebsd-eabihf/machine/asm.h-10| ... | ... | @@ -32,8 +32,6 @@ |
| 32 | 32 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 33 | 33 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 34 | 34 | * SUCH DAMAGE. |
| 35 | * | |
| 36 | *	from: @(#)asm.h	5.5 (Berkeley) 5/7/91 | |
| 37 | 35 | */ |
| 38 | 36 | |
| 39 | 37 | #ifndef _MACHINE_ASM_H_ |
| ... | ... | @@ -176,7 +174,6 @@ |
| 176 | 174 | # define RETne	bxne	lr |
| 177 | 175 | # define RETc(c) bx##c	lr |
| 178 | 176 | |
| 179 | #if __ARM_ARCH >= 7 | |
| 180 | 177 | #define ISB	isb |
| 181 | 178 | #define DSB	dsb |
| 182 | 179 | #define DMB	dmb |
| ... | ... | @@ -190,12 +187,5 @@ |
| 190 | 187 | #define ERET .word 0xe160006e |
| 191 | 188 | #endif |
| 192 | 189 | |
| 193 | #elif __ARM_ARCH == 6 | |
| 194 | #include <machine/sysreg.h> | |
| 195 | #define ISB	mcr CP15_CP15ISB | |
| 196 | #define DSB	mcr CP15_CP15DSB | |
| 197 | #define DMB	mcr CP15_CP15DMB | |
| 198 | #define WFI	mcr CP15_CP15WFI | |
| 199 | #endif | |
| 200 | 190 | |
| 201 | 191 | #endif /* !_MACHINE_ASM_H_ */ |
| \ No newline at end of file |
lib/libc/include/arm-freebsd-eabihf/machine/atomic.h+28-21| ... | ... | @@ -41,15 +41,9 @@ |
| 41 | 41 | |
| 42 | 42 | #include <sys/atomic_common.h> |
| 43 | 43 | |
| 44 | #if __ARM_ARCH >= 7 | |
| 45 | 44 | #define isb() __asm __volatile("isb" : : : "memory") |
| 46 | 45 | #define dsb() __asm __volatile("dsb" : : : "memory") |
| 47 | 46 | #define dmb() __asm __volatile("dmb" : : : "memory") |
| 48 | #else | |
| 49 | #define isb() __asm __volatile("mcr p15, 0, %0, c7, c5, 4" : : "r" (0) : "memory") | |
| 50 | #define dsb() __asm __volatile("mcr p15, 0, %0, c7, c10, 4" : : "r" (0) : "memory") | |
| 51 | #define dmb() __asm __volatile("mcr p15, 0, %0, c7, c10, 5" : : "r" (0) : "memory") | |
| 52 | #endif | |
| 53 | 47 | |
| 54 | 48 | #define mb() dmb() |
| 55 | 49 | #define wmb() dmb() |
| ... | ... | @@ -614,7 +608,7 @@ atomic_fetchadd_long(volatile u_long *p, u_long val) |
| 614 | 608 | } |
| 615 | 609 | |
| 616 | 610 | static __inline uint32_t |
| 617 | atomic_load_acq_32(volatile uint32_t *p) | |
| 611 | atomic_load_acq_32(const volatile uint32_t *p) | |
| 618 | 612 | { |
| 619 | 613 | 	uint32_t v; |
| 620 | 614 | |
| ... | ... | @@ -624,7 +618,7 @@ atomic_load_acq_32(volatile uint32_t *p) |
| 624 | 618 | } |
| 625 | 619 | |
| 626 | 620 | static __inline uint64_t |
| 627 | atomic_load_64(volatile uint64_t *p) | |
| 621 | atomic_load_64(const volatile uint64_t *p) | |
| 628 | 622 | { |
| 629 | 623 | 	uint64_t ret; |
| 630 | 624 | |
| ... | ... | @@ -643,7 +637,7 @@ atomic_load_64(volatile uint64_t *p) |
| 643 | 637 | } |
| 644 | 638 | |
| 645 | 639 | static __inline uint64_t |
| 646 | atomic_load_acq_64(volatile uint64_t *p) | |
| 640 | atomic_load_acq_64(const volatile uint64_t *p) | |
| 647 | 641 | { |
| 648 | 642 | 	uint64_t ret; |
| 649 | 643 | |
| ... | ... | @@ -653,7 +647,7 @@ atomic_load_acq_64(volatile uint64_t *p) |
| 653 | 647 | } |
| 654 | 648 | |
| 655 | 649 | static __inline u_long |
| 656 | atomic_load_acq_long(volatile u_long *p) | |
| 650 | atomic_load_acq_long(const volatile u_long *p) | |
| 657 | 651 | { |
| 658 | 652 | 	u_long v; |
| 659 | 653 | |
| ... | ... | @@ -898,8 +892,6 @@ atomic_testandclear_long(volatile u_long *p, u_int v) |
| 898 | 892 | |
| 899 | 893 | 	return (atomic_testandclear_32((volatile uint32_t *)p, v)); |
| 900 | 894 | } |
| 901 | #define	atomic_testandclear_long	atomic_testandclear_long | |
| 902 | ||
| 903 | 895 | |
| 904 | 896 | static __inline int |
| 905 | 897 | atomic_testandclear_64(volatile uint64_t *p, u_int v) |
| ... | ... | @@ -958,7 +950,16 @@ atomic_testandset_long(volatile u_long *p, u_int v) |
| 958 | 950 | |
| 959 | 951 | 	return (atomic_testandset_32((volatile uint32_t *)p, v)); |
| 960 | 952 | } |
| 961 | #define	atomic_testandset_long	atomic_testandset_long | |
| 953 | ||
| 954 | static __inline int | |
| 955 | atomic_testandset_acq_long(volatile u_long *p, u_int v) | |
| 956 | { | |
| 957 | 	int ret; | |
| 958 | ||
| 959 | 	ret = atomic_testandset_32((volatile uint32_t *)p, v); | |
| 960 | 	dmb(); | |
| 961 | 	return (ret); | |
| 962 | } | |
| 962 | 963 | |
| 963 | 964 | static __inline int |
| 964 | 965 | atomic_testandset_64(volatile uint64_t *p, u_int v) |
| ... | ... | @@ -1052,6 +1053,12 @@ atomic_thread_fence_seq_cst(void) |
| 1052 | 1053 | 	dmb(); |
| 1053 | 1054 | } |
| 1054 | 1055 | |
| 1056 | #define atomic_add_ptr			atomic_add_32 | |
| 1057 | #define atomic_add_acq_ptr		atomic_add_acq_32 | |
| 1058 | #define atomic_add_rel_ptr		atomic_add_rel_32 | |
| 1059 | #define atomic_subtract_ptr		atomic_subtract_32 | |
| 1060 | #define atomic_subtract_acq_ptr		atomic_subtract_acq_32 | |
| 1061 | #define atomic_subtract_rel_ptr		atomic_subtract_rel_32 | |
| 1055 | 1062 | #define atomic_clear_ptr		atomic_clear_32 |
| 1056 | 1063 | #define atomic_clear_acq_ptr		atomic_clear_acq_32 |
| 1057 | 1064 | #define atomic_clear_rel_ptr		atomic_clear_rel_32 |
| ... | ... | @@ -1059,15 +1066,18 @@ atomic_thread_fence_seq_cst(void) |
| 1059 | 1066 | #define atomic_set_acq_ptr		atomic_set_acq_32 |
| 1060 | 1067 | #define atomic_set_rel_ptr		atomic_set_rel_32 |
| 1061 | 1068 | #define atomic_fcmpset_ptr		atomic_fcmpset_32 |
| 1062 | #define atomic_fcmpset_rel_ptr		atomic_fcmpset_rel_32 | |
| 1063 | 1069 | #define atomic_fcmpset_acq_ptr		atomic_fcmpset_acq_32 |
| 1070 | #define atomic_fcmpset_rel_ptr		atomic_fcmpset_rel_32 | |
| 1064 | 1071 | #define atomic_cmpset_ptr		atomic_cmpset_32 |
| 1065 | 1072 | #define atomic_cmpset_acq_ptr		atomic_cmpset_acq_32 |
| 1066 | 1073 | #define atomic_cmpset_rel_ptr		atomic_cmpset_rel_32 |
| 1074 | #define atomic_fetchadd_ptr		atomic_fetchadd_32 | |
| 1075 | #define atomic_readandclear_ptr		atomic_readandclear_32 | |
| 1067 | 1076 | #define atomic_load_acq_ptr		atomic_load_acq_32 |
| 1068 | 1077 | #define atomic_store_rel_ptr		atomic_store_rel_32 |
| 1069 | 1078 | #define atomic_swap_ptr			atomic_swap_32 |
| 1070 | #define atomic_readandclear_ptr		atomic_readandclear_32 | |
| 1079 | #define	atomic_testandset_ptr		atomic_testandset_32 | |
| 1080 | #define	atomic_testandclear_ptr		atomic_testandclear_32 | |
| 1071 | 1081 | |
| 1072 | 1082 | #define atomic_add_int			atomic_add_32 |
| 1073 | 1083 | #define atomic_add_acq_int		atomic_add_acq_32 |
| ... | ... | @@ -1093,12 +1103,9 @@ atomic_thread_fence_seq_cst(void) |
| 1093 | 1103 | #define atomic_store_rel_int		atomic_store_rel_32 |
| 1094 | 1104 | #define atomic_swap_int			atomic_swap_32 |
| 1095 | 1105 | |
| 1096 | /* | |
| 1097 | * For: | |
| 1098 | * - atomic_load_acq_8 | |
| 1099 | * - atomic_load_acq_16 | |
| 1100 | * - atomic_testandset_acq_long | |
| 1101 | */ | |
| 1102 | 1106 | #include <sys/_atomic_subword.h> |
| 1103 | 1107 | |
| 1108 | #define	atomic_set_short		atomic_set_16 | |
| 1109 | #define	atomic_clear_short		atomic_clear_16 | |
| 1110 | ||
| 1104 | 1111 | #endif /* _MACHINE_ATOMIC_H_ */ |
| \ No newline at end of file |
lib/libc/include/arm-freebsd-eabihf/machine/cpu.h+11-45| ... | ... | @@ -45,13 +45,7 @@ void	cpu_halt(void); |
| 45 | 45 | * unconditionally with -DSMP. Although it looks like a bug, |
| 46 | 46 | * handle this case here and in #elif condition in ARM_SMP_UP macro. |
| 47 | 47 | */ |
| 48 | #if __ARM_ARCH <= 6 && defined(SMP) && !defined(KLD_MODULE) | |
| 49 | #error SMP option is not supported on ARMv6 | |
| 50 | #endif | |
| 51 | 48 | |
| 52 | #if __ARM_ARCH <= 6 && defined(SMP_ON_UP) | |
| 53 | #error SMP_ON_UP option is only supported on ARMv7+ CPUs | |
| 54 | #endif | |
| 55 | 49 | |
| 56 | 50 | #if !defined(SMP) && defined(SMP_ON_UP) |
| 57 | 51 | #error SMP option must be defined for SMP_ON_UP option |
| ... | ... | @@ -68,7 +62,7 @@ do {								\ |
| 68 | 62 | 		up_code;					\ |
| 69 | 63 | 	}							\ |
| 70 | 64 | } while (0) |
| 71 | #elif defined(SMP) && __ARM_ARCH > 6 | |
| 65 | #elif defined(SMP) | |
| 72 | 66 | #define ARM_SMP_UP(smp_code, up_code)				\ |
| 73 | 67 | do {								\ |
| 74 | 68 | 	smp_code;						\ |
| ... | ... | @@ -146,15 +140,15 @@ fname(uint64_t reg)							\ |
| 146 | 140 | /* TLB */ |
| 147 | 141 | |
| 148 | 142 | _WF0(_CP15_TLBIALL, CP15_TLBIALL)		/* Invalidate entire unified TLB */ |
| 149 | #if __ARM_ARCH >= 7 && defined(SMP) | |
| 143 | #if defined(SMP) | |
| 150 | 144 | _WF0(_CP15_TLBIALLIS, CP15_TLBIALLIS)		/* Invalidate entire unified TLB IS */ |
| 151 | 145 | #endif |
| 152 | 146 | _WF1(_CP15_TLBIASID, CP15_TLBIASID(%0))		/* Invalidate unified TLB by ASID */ |
| 153 | #if __ARM_ARCH >= 7 && defined(SMP) | |
| 147 | #if defined(SMP) | |
| 154 | 148 | _WF1(_CP15_TLBIASIDIS, CP15_TLBIASIDIS(%0))	/* Invalidate unified TLB by ASID IS */ |
| 155 | 149 | #endif |
| 156 | 150 | _WF1(_CP15_TLBIMVAA, CP15_TLBIMVAA(%0))		/* Invalidate unified TLB by MVA, all ASID */ |
| 157 | #if __ARM_ARCH >= 7 && defined(SMP) | |
| 151 | #if defined(SMP) | |
| 158 | 152 | _WF1(_CP15_TLBIMVAAIS, CP15_TLBIMVAAIS(%0))	/* Invalidate unified TLB by MVA, all ASID IS */ |
| 159 | 153 | #endif |
| 160 | 154 | _WF1(_CP15_TLBIMVA, CP15_TLBIMVA(%0))		/* Invalidate unified TLB by MVA */ |
| ... | ... | @@ -164,21 +158,19 @@ _WF1(_CP15_TTB_SET, CP15_TTBR0(%0)) |
| 164 | 158 | /* Cache and Branch predictor */ |
| 165 | 159 | |
| 166 | 160 | _WF0(_CP15_BPIALL, CP15_BPIALL)			/* Branch predictor invalidate all */ |
| 167 | #if __ARM_ARCH >= 7 && defined(SMP) | |
| 161 | #if defined(SMP) | |
| 168 | 162 | _WF0(_CP15_BPIALLIS, CP15_BPIALLIS)		/* Branch predictor invalidate all IS */ |
| 169 | 163 | #endif |
| 170 | 164 | _WF1(_CP15_BPIMVA, CP15_BPIMVA(%0))		/* Branch predictor invalidate by MVA */ |
| 171 | 165 | _WF1(_CP15_DCCIMVAC, CP15_DCCIMVAC(%0))		/* Data cache clean and invalidate by MVA PoC */ |
| 172 | 166 | _WF1(_CP15_DCCISW, CP15_DCCISW(%0))		/* Data cache clean and invalidate by set/way */ |
| 173 | 167 | _WF1(_CP15_DCCMVAC, CP15_DCCMVAC(%0))		/* Data cache clean by MVA PoC */ |
| 174 | #if __ARM_ARCH >= 7 | |
| 175 | 168 | _WF1(_CP15_DCCMVAU, CP15_DCCMVAU(%0))		/* Data cache clean by MVA PoU */ |
| 176 | #endif | |
| 177 | 169 | _WF1(_CP15_DCCSW, CP15_DCCSW(%0))		/* Data cache clean by set/way */ |
| 178 | 170 | _WF1(_CP15_DCIMVAC, CP15_DCIMVAC(%0))		/* Data cache invalidate by MVA PoC */ |
| 179 | 171 | _WF1(_CP15_DCISW, CP15_DCISW(%0))		/* Data cache invalidate by set/way */ |
| 180 | 172 | _WF0(_CP15_ICIALLU, CP15_ICIALLU)		/* Instruction cache invalidate all PoU */ |
| 181 | #if __ARM_ARCH >= 7 && defined(SMP) | |
| 173 | #if defined(SMP) | |
| 182 | 174 | _WF0(_CP15_ICIALLUIS, CP15_ICIALLUIS)		/* Instruction cache invalidate all PoU IS */ |
| 183 | 175 | #endif |
| 184 | 176 | _WF1(_CP15_ICIMVAU, CP15_ICIMVAU(%0))		/* Instruction cache invalidate */ |
| ... | ... | @@ -209,10 +201,8 @@ _WF1(cp15_prrr_set, CP15_PRRR(%0)) |
| 209 | 201 | _WF1(cp15_nmrr_set, CP15_NMRR(%0)) |
| 210 | 202 | _RF0(cp15_ttbr_get, CP15_TTBR0(%0)) |
| 211 | 203 | _RF0(cp15_dfar_get, CP15_DFAR(%0)) |
| 212 | #if __ARM_ARCH >= 7 | |
| 213 | 204 | _RF0(cp15_ifar_get, CP15_IFAR(%0)) |
| 214 | 205 | _RF0(cp15_l2ctlr_get, CP15_L2CTLR(%0)) |
| 215 | #endif | |
| 216 | 206 | _RF0(cp15_actlr_get, CP15_ACTLR(%0)) |
| 217 | 207 | _WF1(cp15_actlr_set, CP15_ACTLR(%0)) |
| 218 | 208 | _WF1(cp15_ats1cpr_set, CP15_ATS1CPR(%0)) |
| ... | ... | @@ -251,14 +241,6 @@ _RF0(cp15_cbar_get, CP15_CBAR(%0)) |
| 251 | 241 | |
| 252 | 242 | /* Performance Monitor registers */ |
| 253 | 243 | |
| 254 | #if __ARM_ARCH == 6 && defined(CPU_ARM1176) | |
| 255 | _RF0(cp15_pmuserenr_get, CP15_PMUSERENR(%0)) | |
| 256 | _WF1(cp15_pmuserenr_set, CP15_PMUSERENR(%0)) | |
| 257 | _RF0(cp15_pmcr_get, CP15_PMCR(%0)) | |
| 258 | _WF1(cp15_pmcr_set, CP15_PMCR(%0)) | |
| 259 | _RF0(cp15_pmccntr_get, CP15_PMCCNTR(%0)) | |
| 260 | _WF1(cp15_pmccntr_set, CP15_PMCCNTR(%0)) | |
| 261 | #elif __ARM_ARCH > 6 | |
| 262 | 244 | _RF0(cp15_pmcr_get, CP15_PMCR(%0)) |
| 263 | 245 | _WF1(cp15_pmcr_set, CP15_PMCR(%0)) |
| 264 | 246 | _RF0(cp15_pmcnten_get, CP15_PMCNTENSET(%0)) |
| ... | ... | @@ -280,7 +262,6 @@ _WF1(cp15_pmuserenr_set, CP15_PMUSERENR(%0)) |
| 280 | 262 | _RF0(cp15_pminten_get, CP15_PMINTENSET(%0)) |
| 281 | 263 | _WF1(cp15_pminten_set, CP15_PMINTENSET(%0)) |
| 282 | 264 | _WF1(cp15_pminten_clr, CP15_PMINTENCLR(%0)) |
| 283 | #endif | |
| 284 | 265 | |
| 285 | 266 | _RF0(cp15_tpidrurw_get, CP15_TPIDRURW(%0)) |
| 286 | 267 | _WF1(cp15_tpidrurw_set, CP15_TPIDRURW(%0)) |
| ... | ... | @@ -380,7 +361,7 @@ tlb_flush_range_local(vm_offset_t va, vm_size_t size) |
| 380 | 361 | } |
| 381 | 362 | |
| 382 | 363 | /* Broadcasting operations. */ |
| 383 | #if __ARM_ARCH >= 7 && defined(SMP) | |
| 364 | #if defined(SMP) | |
| 384 | 365 | |
| 385 | 366 | static __inline void |
| 386 | 367 | tlb_flush_all(void) |
| ... | ... | @@ -442,14 +423,14 @@ tlb_flush_range(vm_offset_t va, vm_size_t size) |
| 442 | 423 | 	); |
| 443 | 424 | 	dsb(); |
| 444 | 425 | } |
| 445 | #else /* __ARM_ARCH < 7 */ | |
| 426 | #else /* !SMP */ | |
| 446 | 427 | |
| 447 | 428 | #define tlb_flush_all() 		tlb_flush_all_local() |
| 448 | 429 | #define tlb_flush_all_ng() 		tlb_flush_all_ng_local() |
| 449 | 430 | #define tlb_flush(va) 			tlb_flush_local(va) |
| 450 | 431 | #define tlb_flush_range(va, size) 	tlb_flush_range_local(va, size) |
| 451 | 432 | |
| 452 | #endif /* __ARM_ARCH < 7 */ | |
| 433 | #endif /* !SMP */ | |
| 453 | 434 | |
| 454 | 435 | /* |
| 455 | 436 | * Cache maintenance operations. |
| ... | ... | @@ -465,11 +446,7 @@ icache_sync(vm_offset_t va, vm_size_t size) |
| 465 | 446 | 	va &= ~cpuinfo.dcache_line_mask; |
| 466 | 447 | |
| 467 | 448 | 	for ( ; va < eva; va += cpuinfo.dcache_line_size) { |
| 468 | #if __ARM_ARCH >= 7 | |
| 469 | 449 | 		_CP15_DCCMVAU(va); |
| 470 | #else | |
| 471 | 		_CP15_DCCMVAC(va); | |
| 472 | #endif | |
| 473 | 450 | 	} |
| 474 | 451 | 	dsb(); |
| 475 | 452 | 	ARM_SMP_UP( |
| ... | ... | @@ -515,11 +492,7 @@ dcache_wb_pou(vm_offset_t va, vm_size_t size) |
| 515 | 492 | 	dsb(); |
| 516 | 493 | 	va &= ~cpuinfo.dcache_line_mask; |
| 517 | 494 | 	for ( ; va < eva; va += cpuinfo.dcache_line_size) { |
| 518 | #if __ARM_ARCH >= 7 | |
| 519 | 495 | 		_CP15_DCCMVAU(va); |
| 520 | #else | |
| 521 | 		_CP15_DCCMVAC(va); | |
| 522 | #endif | |
| 523 | 496 | 	} |
| 524 | 497 | 	dsb(); |
| 525 | 498 | } |
| ... | ... | @@ -686,8 +659,7 @@ cp15_ats1cuw_check(vm_offset_t addr) |
| 686 | 659 | static __inline uint64_t |
| 687 | 660 | get_cyclecount(void) |
| 688 | 661 | { |
| 689 | #if __ARM_ARCH > 6 || (__ARM_ARCH == 6 && defined(CPU_ARM1176)) | |
| 690 | #if (__ARM_ARCH > 6) && defined(DEV_PMU) | |
| 662 | #if defined(DEV_PMU) | |
| 691 | 663 | 	if (pmu_attched) { |
| 692 | 664 | 		u_int cpu; |
| 693 | 665 | 		uint64_t h, h2; |
| ... | ... | @@ -711,12 +683,6 @@ get_cyclecount(void) |
| 711 | 683 | 	} else |
| 712 | 684 | #endif |
| 713 | 685 | 		return cp15_pmccntr_get(); |
| 714 | #else /* No performance counters, so use nanotime(9). */ | |
| 715 | 	struct timespec tv; | |
| 716 | ||
| 717 | 	nanotime(&tv); | |
| 718 | 	return (tv.tv_sec * (uint64_t)1000000000ull + tv.tv_nsec); | |
| 719 | #endif | |
| 720 | 686 | } |
| 721 | 687 | #endif |
| 722 | 688 | |
| ... | ... | @@ -729,7 +695,7 @@ get_cyclecount(void) |
| 729 | 695 | #define cpu_spinwait()		/* nothing */ |
| 730 | 696 | #define	cpu_lock_delay()	DELAY(1) |
| 731 | 697 | |
| 732 | #define ARM_NVEC		8 | |
| 698 | #define ARM_NVEC		7 | |
| 733 | 699 | #define ARM_VEC_ALL		0xffffffff |
| 734 | 700 | |
| 735 | 701 | extern vm_offset_t vector_page; |
lib/libc/include/arm-freebsd-eabihf/machine/cpufunc.h-3| ... | ... | @@ -97,9 +97,6 @@ void	armv7_cpu_sleep			(int); |
| 97 | 97 | void	pj4b_config			(void); |
| 98 | 98 | #endif |
| 99 | 99 | |
| 100 | #if defined(CPU_ARM1176) | |
| 101 | void arm11x6_sleep (int); /* no ref. for errata */ | |
| 102 | #endif | |
| 103 | 100 | |
| 104 | 101 | |
| 105 | 102 | /* |
lib/libc/include/arm-freebsd-eabihf/machine/endian.h-2| ... | ... | @@ -26,8 +26,6 @@ |
| 26 | 26 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 27 | 27 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 28 | 28 | * SUCH DAMAGE. |
| 29 | * | |
| 30 | *	@(#)endian.h	8.1 (Berkeley) 6/10/93 | |
| 31 | 29 | * $NetBSD: endian.h,v 1.7 1999/08/21 05:53:51 simonb Exp $ |
| 32 | 30 | */ |
| 33 | 31 |
lib/libc/include/arm-freebsd-eabihf/machine/exec.h created+37| ... | ... | @@ -0,0 +1,37 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-3-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 2001 David E. O'Brien | |
| 5 | * All rights reserved. | |
| 6 | * | |
| 7 | * Redistribution and use in source and binary forms, with or without | |
| 8 | * modification, are permitted provided that the following conditions | |
| 9 | * are met: | |
| 10 | * 1. Redistributions of source code must retain the above copyright | |
| 11 | * notice, this list of conditions and the following disclaimer. | |
| 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 13 | * notice, this list of conditions and the following disclaimer in the | |
| 14 | * documentation and/or other materials provided with the distribution. | |
| 15 | * 3. Neither the name of the author nor the names of any co-contributors | |
| 16 | * may be used to endorse or promote products derived from this software | |
| 17 | * without specific prior written permission. | |
| 18 | * | |
| 19 | * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND | |
| 20 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 21 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
| 22 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
| 23 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
| 24 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
| 25 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
| 26 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
| 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
| 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
| 29 | * SUCH DAMAGE. | |
| 30 | */ | |
| 31 | ||
| 32 | #ifndef	_MACHINE_EXEC_H_ | |
| 33 | #define	_MACHINE_EXEC_H_ | |
| 34 | ||
| 35 | #define	__LDPGSZ	4096 | |
| 36 | ||
| 37 | #endif /* !_MACHINE_EXEC_H_ */ | |
| \ No newline at end of file |
lib/libc/include/arm-freebsd-eabihf/machine/fiq.h deleted-71| ... | ... | @@ -1,71 +0,0 @@ |
| 1 | /*	$NetBSD: fiq.h,v 1.1 2001/12/20 01:20:23 thorpej Exp $	*/ | |
| 2 | ||
| 3 | /*- | |
| 4 | * SPDX-License-Identifier: BSD-4-Clause | |
| 5 | * | |
| 6 | * Copyright (c) 2001 Wasabi Systems, Inc. | |
| 7 | * All rights reserved. | |
| 8 | * | |
| 9 | * Written by Jason R. Thorpe for Wasabi Systems, Inc. | |
| 10 | * | |
| 11 | * Redistribution and use in source and binary forms, with or without | |
| 12 | * modification, are permitted provided that the following conditions | |
| 13 | * are met: | |
| 14 | * 1. Redistributions of source code must retain the above copyright | |
| 15 | * notice, this list of conditions and the following disclaimer. | |
| 16 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 17 | * notice, this list of conditions and the following disclaimer in the | |
| 18 | * documentation and/or other materials provided with the distribution. | |
| 19 | * 3. All advertising materials mentioning features or use of this software | |
| 20 | * must display the following acknowledgement: | |
| 21 | *	This product includes software developed for the NetBSD Project by | |
| 22 | *	Wasabi Systems, Inc. | |
| 23 | * 4. The name of Wasabi Systems, Inc. may not be used to endorse | |
| 24 | * or promote products derived from this software without specific prior | |
| 25 | * written permission. | |
| 26 | * | |
| 27 | * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND | |
| 28 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | |
| 29 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
| 30 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC | |
| 31 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
| 32 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
| 33 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
| 34 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
| 35 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
| 36 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
| 37 | * POSSIBILITY OF SUCH DAMAGE. | |
| 38 | * | |
| 39 | */ | |
| 40 | ||
| 41 | #ifndef _MACHINE_FIQ_H_ | |
| 42 | #define	_MACHINE_FIQ_H_ | |
| 43 | ||
| 44 | #include <sys/queue.h> | |
| 45 | ||
| 46 | struct fiqregs { | |
| 47 | 	u_int	fr_r8;			/* FIQ mode r8 */ | |
| 48 | 	u_int	fr_r9;			/* FIQ mode r9 */ | |
| 49 | 	u_int	fr_r10;			/* FIQ mode r10 */ | |
| 50 | 	u_int	fr_r11;			/* FIQ mode r11 */ | |
| 51 | 	u_int	fr_r12;			/* FIQ mode r12 */ | |
| 52 | 	u_int	fr_r13;			/* FIQ mode r13 */ | |
| 53 | }; | |
| 54 | ||
| 55 | struct fiqhandler { | |
| 56 | 	TAILQ_ENTRY(fiqhandler) fh_list;/* link in the FIQ handler stack */ | |
| 57 | 	void	*fh_func;		/* FIQ handler routine */ | |
| 58 | 	size_t	fh_size;		/* size of FIQ handler */ | |
| 59 | 	int	fh_flags;		/* flags; see below */ | |
| 60 | 	struct fiqregs *fh_regs;	/* pointer to regs structure */ | |
| 61 | }; | |
| 62 | ||
| 63 | #define	FH_CANPUSH	0x01	/* can push this handler out of the way */ | |
| 64 | ||
| 65 | int	fiq_claim(struct fiqhandler *); | |
| 66 | void	fiq_release(struct fiqhandler *); | |
| 67 | ||
| 68 | void	fiq_getregs(struct fiqregs *); | |
| 69 | void	fiq_setregs(struct fiqregs *); | |
| 70 | ||
| 71 | #endif /* _MACHINE_FIQ_H_ */ | |
| \ No newline at end of file |
lib/libc/include/arm-freebsd-eabihf/machine/float.h-2| ... | ... | @@ -27,8 +27,6 @@ |
| 27 | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | * | |
| 31 | *	from: @(#)float.h	7.1 (Berkeley) 5/8/90 | |
| 32 | 30 | */ |
| 33 | 31 | |
| 34 | 32 | #ifndef _MACHINE_FLOAT_H_ |
lib/libc/include/arm-freebsd-eabihf/machine/floatingpoint.h-2| ... | ... | @@ -31,8 +31,6 @@ |
| 31 | 31 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 32 | 32 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 33 | 33 | * SUCH DAMAGE. |
| 34 | * | |
| 35 | *	from: @(#) floatingpoint.h	1.0 (Berkeley) 9/23/93 | |
| 36 | 34 | */ |
| 37 | 35 | |
| 38 | 36 | #ifndef _FLOATINGPOINT_H_ |
lib/libc/include/arm-freebsd-eabihf/machine/ieee.h-2| ... | ... | @@ -39,8 +39,6 @@ |
| 39 | 39 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 40 | 40 | * SUCH DAMAGE. |
| 41 | 41 | * |
| 42 | *	@(#)ieee.h	8.1 (Berkeley) 6/11/93 | |
| 43 | * | |
| 44 | 42 | */ |
| 45 | 43 | |
| 46 | 44 | /* |
lib/libc/include/arm-freebsd-eabihf/machine/ieeefp.h+10| ... | ... | @@ -49,4 +49,14 @@ typedef enum { |
| 49 | 49 | |
| 50 | 50 | #define fp_except_t	int |
| 51 | 51 | |
| 52 | /* Augment the userland declarations. */ | |
| 53 | __BEGIN_DECLS | |
| 54 | extern fp_rnd_t fpgetround(void); | |
| 55 | extern fp_rnd_t fpsetround(fp_rnd_t); | |
| 56 | extern fp_except_t fpgetmask(void); | |
| 57 | extern fp_except_t fpsetmask(fp_except_t); | |
| 58 | extern fp_except_t fpgetsticky(void); | |
| 59 | extern fp_except_t fpsetsticky(fp_except_t); | |
| 60 | __END_DECLS | |
| 61 | ||
| 52 | 62 | #endif /* _MACHINE_IEEEFP_H_ */ |
| \ No newline at end of file |
lib/libc/include/arm-freebsd-eabihf/machine/in_cksum.h-1| ... | ... | @@ -29,7 +29,6 @@ |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | 30 | * |
| 31 | 31 | *	from tahoe:	in_cksum.c	1.2	86/01/05 |
| 32 | *	from:		@(#)in_cksum.c	1.3 (Berkeley) 1/19/91 | |
| 33 | 32 | *	from: Id: in_cksum.c,v 1.8 1995/12/03 18:35:19 bde Exp |
| 34 | 33 | */ |
| 35 | 34 |
lib/libc/include/arm-freebsd-eabihf/machine/intr.h+6-3| ... | ... | @@ -39,16 +39,19 @@ |
| 39 | 39 | #ifndef _MACHINE_INTR_H_ |
| 40 | 40 | #define _MACHINE_INTR_H_ |
| 41 | 41 | |
| 42 | #ifndef LOCORE | |
| 42 | 43 | #ifdef FDT |
| 43 | 44 | #include <dev/ofw/openfirm.h> |
| 44 | 45 | #endif |
| 45 | 46 | |
| 47 | void arm_irq_memory_barrier(uintptr_t); | |
| 48 | #endif /* !LOCORE */ | |
| 49 | ||
| 46 | 50 | #ifndef NIRQ |
| 47 | 51 | #define	NIRQ		1024	/* XXX - It should be an option. */ |
| 48 | 52 | #endif |
| 49 | 53 | |
| 50 | #include <sys/intr.h> | |
| 51 | ||
| 52 | void arm_irq_memory_barrier(uintptr_t); | |
| 54 | #define	INTR_ROOT_IRQ	0 | |
| 55 | #define	INTR_ROOT_COUNT	1 | |
| 53 | 56 | |
| 54 | 57 | #endif	/* _MACHINE_INTR_H */ |
| \ No newline at end of file |
lib/libc/include/arm-freebsd-eabihf/machine/machdep.h+7| ... | ... | @@ -51,6 +51,13 @@ void arm_add_efi_map_entries(struct efi_map_header *efihdr, |
| 51 | 51 | struct mem_region *mr, int *mrcnt); |
| 52 | 52 | #endif |
| 53 | 53 | |
| 54 | #ifdef SOCDEV_PA | |
| 55 | /* | |
| 56 | * The virtual address SOCDEV_PA is mapped at. | |
| 57 | */ | |
| 58 | extern uintptr_t socdev_va; | |
| 59 | #endif | |
| 60 | ||
| 54 | 61 | /* |
| 55 | 62 | * Symbols created by ldscript.arm which are accessible in the kernel as global |
| 56 | 63 | * symbols. They have uint8 type because they mark the byte location where the |
lib/libc/include/arm-freebsd-eabihf/machine/metadata.h+8-3| ... | ... | @@ -33,10 +33,15 @@ |
| 33 | 33 | #define	MODINFOMD_DTBP		0x1002 |
| 34 | 34 | #define	MODINFOMD_EFI_MAP	0x1003 |
| 35 | 35 | |
| 36 | /* | |
| 37 | * This is not the same as the UEFI standard EFI_MEMORY_ATTRIBUTES_TABLE, though | |
| 38 | * memory_size / descritpr_size entries of EFI_MEMORY_DESCRIPTORS follow this table | |
| 39 | * starting at a 16-byte alignment. | |
| 40 | */ | |
| 36 | 41 | struct efi_map_header { |
| 37 | 	uint64_t	memory_size; | |
| 38 | 	uint64_t	descriptor_size; | |
| 39 | 	uint32_t	descriptor_version; | |
| 42 | 	uint64_t	memory_size;		/* Numnber of bytes that follow */ | |
| 43 | 	uint64_t	descriptor_size;	/* Size of each EFI_MEMORY_DESCRIPTOR */ | |
| 44 | 	uint32_t	descriptor_version;	/* Currently '1' */ | |
| 40 | 45 | }; |
| 41 | 46 | |
| 42 | 47 | /* |
lib/libc/include/arm-freebsd-eabihf/machine/param.h+2-15| ... | ... | @@ -35,8 +35,6 @@ |
| 35 | 35 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 36 | 36 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 37 | 37 | * SUCH DAMAGE. |
| 38 | * | |
| 39 | *	from: @(#)param.h	5.8 (Berkeley) 6/28/91 | |
| 40 | 38 | */ |
| 41 | 39 | |
| 42 | 40 | #ifndef _ARM_INCLUDE_PARAM_H_ |
| ... | ... | @@ -51,17 +49,11 @@ |
| 51 | 49 | #define STACKALIGNBYTES	(8 - 1) |
| 52 | 50 | #define STACKALIGN(p)	((u_int)(p) & ~STACKALIGNBYTES) |
| 53 | 51 | |
| 54 | #define __PCI_REROUTE_INTERRUPT | |
| 55 | ||
| 56 | 52 | #ifndef MACHINE |
| 57 | 53 | #define	MACHINE		"arm" |
| 58 | 54 | #endif |
| 59 | 55 | #ifndef MACHINE_ARCH |
| 60 | #if __ARM_ARCH >= 7 | |
| 61 | 56 | #define	MACHINE_ARCH	"armv7" |
| 62 | #else | |
| 63 | #define	MACHINE_ARCH	"armv6" | |
| 64 | #endif | |
| 65 | 57 | #endif |
| 66 | 58 | |
| 67 | 59 | #ifdef SMP |
| ... | ... | @@ -76,6 +68,8 @@ |
| 76 | 68 | #define	MAXMEMDOM	1 |
| 77 | 69 | #endif |
| 78 | 70 | |
| 71 | #define	__HAVE_STATIC_DEVMAP | |
| 72 | ||
| 79 | 73 | #define	ALIGNBYTES	_ALIGNBYTES |
| 80 | 74 | #define	ALIGN(p)	_ALIGN(p) |
| 81 | 75 | /* |
| ... | ... | @@ -129,17 +123,10 @@ |
| 129 | 123 | /* |
| 130 | 124 | * Mach derived conversion macros |
| 131 | 125 | */ |
| 132 | #define	trunc_page(x)		((x) & ~PAGE_MASK) | |
| 133 | #define	round_page(x)		(((x) + PAGE_MASK) & ~PAGE_MASK) | |
| 134 | 126 | #define	trunc_1mpage(x)		((unsigned)(x) & ~PDRMASK) |
| 135 | 127 | #define	round_1mpage(x)		((((unsigned)(x)) + PDRMASK) & ~PDRMASK) |
| 136 | 128 | |
| 137 | #define	atop(x)			((unsigned)(x) >> PAGE_SHIFT) | |
| 138 | #define	ptoa(x)			((unsigned)(x) << PAGE_SHIFT) | |
| 139 | ||
| 140 | 129 | #define	arm32_btop(x)		((unsigned)(x) >> PAGE_SHIFT) |
| 141 | 130 | #define	arm32_ptob(x)		((unsigned)(x) << PAGE_SHIFT) |
| 142 | 131 | |
| 143 | #define	pgtok(x)		((x) * (PAGE_SIZE / 1024)) | |
| 144 | ||
| 145 | 132 | #endif /* !_ARM_INCLUDE_PARAM_H_ */ |
| \ No newline at end of file |
lib/libc/include/arm-freebsd-eabihf/machine/pmap.h+3-12| ... | ... | @@ -39,9 +39,6 @@ |
| 39 | 39 | * map the page tables using the pagetables themselves. This is done to |
| 40 | 40 | * reduce the impact on kernel virtual memory for lots of sparse address |
| 41 | 41 | * space, and to reduce the cost of memory to each process. |
| 42 | * | |
| 43 | * from: hp300: @(#)pmap.h 7.2 (Berkeley) 12/16/90 | |
| 44 | * from: @(#)pmap.h 7.4 (Berkeley) 5/12/91 | |
| 45 | 42 | * 	from: FreeBSD: src/sys/i386/include/pmap.h,v 1.70 2000/11/30 |
| 46 | 43 | */ |
| 47 | 44 | |
| ... | ... | @@ -138,9 +135,9 @@ extern ttb_entry_t pmap_kern_ttb; 	/* TTB for kernel pmap */ |
| 138 | 135 | * vtopte2(). |
| 139 | 136 | */ |
| 140 | 137 | void pmap_bootstrap(vm_offset_t); |
| 141 | void pmap_kenter(vm_offset_t, vm_paddr_t); | |
| 138 | void pmap_kenter(vm_offset_t, vm_size_t, vm_paddr_t, int); | |
| 142 | 139 | void pmap_kremove(vm_offset_t); |
| 143 | boolean_t pmap_page_is_mapped(vm_page_t); | |
| 140 | bool pmap_page_is_mapped(vm_page_t); | |
| 144 | 141 | bool	pmap_ps_enabled(pmap_t pmap); |
| 145 | 142 | |
| 146 | 143 | void pmap_tlb_flush(pmap_t, vm_offset_t); |
| ... | ... | @@ -175,15 +172,9 @@ void pmap_page_set_memattr(vm_page_t, vm_memattr_t); |
| 175 | 172 | #define	pmap_map_delete(pmap, sva, eva)	pmap_remove(pmap, sva, eva) |
| 176 | 173 | |
| 177 | 174 | void *pmap_mapdev(vm_paddr_t, vm_size_t); |
| 175 | void *pmap_mapdev_attr(vm_paddr_t, vm_size_t, vm_memattr_t); | |
| 178 | 176 | void pmap_unmapdev(void *, vm_size_t); |
| 179 | 177 | |
| 180 | static inline void * | |
| 181 | pmap_mapdev_attr(vm_paddr_t addr __unused, vm_size_t size __unused, | |
| 182 | int attr __unused) | |
| 183 | { | |
| 184 | 	panic("%s is not implemented yet!\n", __func__); | |
| 185 | } | |
| 186 | ||
| 187 | 178 | struct pcb; |
| 188 | 179 | void pmap_set_pcb_pagedir(pmap_t, struct pcb *); |
| 189 | 180 |
lib/libc/include/arm-freebsd-eabihf/machine/pmap_var.h+10-10| ... | ... | @@ -161,7 +161,7 @@ pte1_clear_bit(pt1_entry_t *pte1p, uint32_t bit) |
| 161 | 161 | 	pte1_sync(pte1p); |
| 162 | 162 | } |
| 163 | 163 | |
| 164 | static __inline boolean_t | |
| 164 | static __inline bool | |
| 165 | 165 | pte1_is_link(pt1_entry_t pte1) |
| 166 | 166 | { |
| 167 | 167 | |
| ... | ... | @@ -175,21 +175,21 @@ pte1_is_section(pt1_entry_t pte1) |
| 175 | 175 | 	return ((pte1 & L1_TYPE_MASK) == L1_TYPE_S); |
| 176 | 176 | } |
| 177 | 177 | |
| 178 | static __inline boolean_t | |
| 178 | static __inline bool | |
| 179 | 179 | pte1_is_dirty(pt1_entry_t pte1) |
| 180 | 180 | { |
| 181 | 181 | |
| 182 | 182 | 	return ((pte1 & (PTE1_NM | PTE1_RO)) == 0); |
| 183 | 183 | } |
| 184 | 184 | |
| 185 | static __inline boolean_t | |
| 185 | static __inline bool | |
| 186 | 186 | pte1_is_global(pt1_entry_t pte1) |
| 187 | 187 | { |
| 188 | 188 | |
| 189 | 189 | 	return ((pte1 & PTE1_NG) == 0); |
| 190 | 190 | } |
| 191 | 191 | |
| 192 | static __inline boolean_t | |
| 192 | static __inline bool | |
| 193 | 193 | pte1_is_valid(pt1_entry_t pte1) |
| 194 | 194 | { |
| 195 | 195 | 	int l1_type; |
| ... | ... | @@ -198,7 +198,7 @@ pte1_is_valid(pt1_entry_t pte1) |
| 198 | 198 | 	return ((l1_type == L1_TYPE_C) || (l1_type == L1_TYPE_S)); |
| 199 | 199 | } |
| 200 | 200 | |
| 201 | static __inline boolean_t | |
| 201 | static __inline bool | |
| 202 | 202 | pte1_is_wired(pt1_entry_t pte1) |
| 203 | 203 | { |
| 204 | 204 | |
| ... | ... | @@ -301,28 +301,28 @@ pte2_clear_bit(pt2_entry_t *pte2p, uint32_t bit) |
| 301 | 301 | 	pte2_sync(pte2p); |
| 302 | 302 | } |
| 303 | 303 | |
| 304 | static __inline boolean_t | |
| 304 | static __inline bool | |
| 305 | 305 | pte2_is_dirty(pt2_entry_t pte2) |
| 306 | 306 | { |
| 307 | 307 | |
| 308 | 308 | 	return ((pte2 & (PTE2_NM | PTE2_RO)) == 0); |
| 309 | 309 | } |
| 310 | 310 | |
| 311 | static __inline boolean_t | |
| 311 | static __inline bool | |
| 312 | 312 | pte2_is_global(pt2_entry_t pte2) |
| 313 | 313 | { |
| 314 | 314 | |
| 315 | 315 | 	return ((pte2 & PTE2_NG) == 0); |
| 316 | 316 | } |
| 317 | 317 | |
| 318 | static __inline boolean_t | |
| 318 | static __inline bool | |
| 319 | 319 | pte2_is_valid(pt2_entry_t pte2) |
| 320 | 320 | { |
| 321 | 321 | |
| 322 | 322 | 	return (pte2 & PTE2_V); |
| 323 | 323 | } |
| 324 | 324 | |
| 325 | static __inline boolean_t | |
| 325 | static __inline bool | |
| 326 | 326 | pte2_is_wired(pt2_entry_t pte2) |
| 327 | 327 | { |
| 328 | 328 | |
| ... | ... | @@ -358,7 +358,7 @@ pte2_set_bit(pt2_entry_t *pte2p, uint32_t bit) |
| 358 | 358 | } |
| 359 | 359 | |
| 360 | 360 | static __inline void |
| 361 | pte2_set_wired(pt2_entry_t *pte2p, boolean_t wired) | |
| 361 | pte2_set_wired(pt2_entry_t *pte2p, bool wired) | |
| 362 | 362 | { |
| 363 | 363 | |
| 364 | 364 | 	/* |
lib/libc/include/arm-freebsd-eabihf/machine/proc.h-2| ... | ... | @@ -31,8 +31,6 @@ |
| 31 | 31 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 32 | 32 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 33 | 33 | * SUCH DAMAGE. |
| 34 | * | |
| 35 | * from: @(#)proc.h 7.1 (Berkeley) 5/15/91 | |
| 36 | 34 | *	from: FreeBSD: src/sys/i386/include/proc.h,v 1.11 2001/06/29 |
| 37 | 35 | */ |
| 38 | 36 |
lib/libc/include/arm-freebsd-eabihf/machine/profile.h-2| ... | ... | @@ -31,8 +31,6 @@ |
| 31 | 31 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 32 | 32 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 33 | 33 | * SUCH DAMAGE. |
| 34 | * | |
| 35 | *	@(#)profile.h	8.1 (Berkeley) 6/11/93 | |
| 36 | 34 | */ |
| 37 | 35 | |
| 38 | 36 | #ifndef _MACHINE_PROFILE_H_ |
lib/libc/include/arm-freebsd-eabihf/machine/reloc.h-2| ... | ... | @@ -31,8 +31,6 @@ |
| 31 | 31 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 32 | 32 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 33 | 33 | * SUCH DAMAGE. |
| 34 | * | |
| 35 | *	@(#)reloc.h	8.1 (Berkeley) 6/10/93 | |
| 36 | 34 | */ |
| 37 | 35 | |
| 38 | 36 | #ifndef _MACHINE_RELOC_H_ |
lib/libc/include/arm-freebsd-eabihf/machine/resource.h-2| ... | ... | @@ -40,8 +40,6 @@ |
| 40 | 40 | #define	SYS_RES_MEMORY	3	/* i/o memory */ |
| 41 | 41 | #define	SYS_RES_IOPORT	4	/* i/o ports */ |
| 42 | 42 | #define	SYS_RES_GPIO	5	/* general purpose i/o */ |
| 43 | #ifdef NEW_PCIB | |
| 44 | 43 | #define PCI_RES_BUS	6	/* PCI bus numbers */ |
| 45 | #endif | |
| 46 | 44 | |
| 47 | 45 | #endif /* !_MACHINE_RESOURCE_H_ */ |
| \ No newline at end of file |
lib/libc/include/arm-freebsd-eabihf/machine/runq.h deleted-46| ... | ... | @@ -1,46 +0,0 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-2-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 2001 Jake Burkholder <jake@FreeBSD.org> | |
| 5 | * All rights reserved. | |
| 6 | * | |
| 7 | * Redistribution and use in source and binary forms, with or without | |
| 8 | * modification, are permitted provided that the following conditions | |
| 9 | * are met: | |
| 10 | * 1. Redistributions of source code must retain the above copyright | |
| 11 | * notice, this list of conditions and the following disclaimer. | |
| 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 13 | * notice, this list of conditions and the following disclaimer in the | |
| 14 | * documentation and/or other materials provided with the distribution. | |
| 15 | * | |
| 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |
| 17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
| 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | |
| 20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
| 21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
| 22 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
| 23 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
| 24 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
| 25 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
| 26 | * SUCH DAMAGE. | |
| 27 | */ | |
| 28 | ||
| 29 | #ifndef	_MACHINE_RUNQ_H_ | |
| 30 | #define	_MACHINE_RUNQ_H_ | |
| 31 | ||
| 32 | #define	RQB_LEN		(2)		/* Number of priority status words. */ | |
| 33 | #define	RQB_L2BPW	(5)		/* Log2(sizeof(rqb_word_t) * NBBY)). */ | |
| 34 | #define	RQB_BPW		(1<<RQB_L2BPW)	/* Bits in an rqb_word_t. */ | |
| 35 | ||
| 36 | #define	RQB_BIT(pri)	(1 << ((pri) & (RQB_BPW - 1))) | |
| 37 | #define	RQB_WORD(pri)	((pri) >> RQB_L2BPW) | |
| 38 | ||
| 39 | #define	RQB_FFS(word)	(ffs(word) - 1) | |
| 40 | ||
| 41 | /* | |
| 42 | * Type of run queue status word. | |
| 43 | */ | |
| 44 | typedef	u_int32_t	rqb_word_t; | |
| 45 | ||
| 46 | #endif | |
| \ No newline at end of file |
lib/libc/include/arm-freebsd-eabihf/machine/signal.h-2| ... | ... | @@ -27,8 +27,6 @@ |
| 27 | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | * | |
| 31 | * @(#)signal.h 8.1 (Berkeley) 6/11/93 | |
| 32 | 30 | *	from: FreeBSD: src/sys/i386/include/signal.h,v 1.13 2000/11/09 |
| 33 | 31 | *	from: FreeBSD: src/sys/sparc64/include/signal.h,v 1.6 2001/09/30 18:52:17 |
| 34 | 32 | */ |
lib/libc/include/arm-freebsd-eabihf/machine/sysarch.h+2| ... | ... | @@ -38,6 +38,8 @@ |
| 38 | 38 | #ifndef _ARM_SYSARCH_H_ |
| 39 | 39 | #define _ARM_SYSARCH_H_ |
| 40 | 40 | |
| 41 | #include <sys/cdefs.h> | |
| 42 | ||
| 41 | 43 | #include <machine/armreg.h> |
| 42 | 44 | |
| 43 | 45 | #ifndef LOCORE |
lib/libc/include/arm-freebsd-eabihf/machine/sysreg.h+2-36| ... | ... | @@ -127,11 +127,9 @@ |
| 127 | 127 | |
| 128 | 128 | /* From ARMv6: */ |
| 129 | 129 | #define	CP15_IFSR(rr)		p15, 0, rr, c5, c0, 1 /* Instruction Fault Status Register */ |
| 130 | #if __ARM_ARCH >= 7 | |
| 131 | 130 | /* From ARMv7: */ |
| 132 | 131 | #define	CP15_ADFSR(rr)		p15, 0, rr, c5, c1, 0 /* Auxiliary Data Fault Status Register */ |
| 133 | 132 | #define	CP15_AIFSR(rr)		p15, 0, rr, c5, c1, 1 /* Auxiliary Instruction Fault Status Register */ |
| 134 | #endif | |
| 135 | 133 | |
| 136 | 134 | /* |
| 137 | 135 | * CP15 C6 registers |
| ... | ... | @@ -147,7 +145,7 @@ |
| 147 | 145 | /* |
| 148 | 146 | * CP15 C7 registers |
| 149 | 147 | */ |
| 150 | #if __ARM_ARCH >= 7 && defined(SMP) | |
| 148 | #if defined(SMP) | |
| 151 | 149 | /* From ARMv7: */ |
| 152 | 150 | #define	CP15_ICIALLUIS		p15, 0, r0, c7, c1, 0 /* Instruction cache invalidate all PoU, IS */ |
| 153 | 151 | #define	CP15_BPIALLIS		p15, 0, r0, c7, c1, 6 /* Branch predictor invalidate all IS */ |
| ... | ... | @@ -157,17 +155,9 @@ |
| 157 | 155 | |
| 158 | 156 | #define	CP15_ICIALLU		p15, 0, r0, c7, c5, 0 /* Instruction cache invalidate all PoU */ |
| 159 | 157 | #define	CP15_ICIMVAU(rr)	p15, 0, rr, c7, c5, 1 /* Instruction cache invalidate */ |
| 160 | #if __ARM_ARCH == 6 | |
| 161 | /* Deprecated in ARMv7 */ | |
| 162 | #define	CP15_CP15ISB		p15, 0, r0, c7, c5, 4 /* ISB */ | |
| 163 | #endif | |
| 164 | 158 | #define	CP15_BPIALL		p15, 0, r0, c7, c5, 6 /* Branch predictor invalidate all */ |
| 165 | 159 | #define	CP15_BPIMVA		p15, 0, rr, c7, c5, 7 /* Branch predictor invalidate by MVA */ |
| 166 | 160 | |
| 167 | #if __ARM_ARCH == 6 | |
| 168 | /* Only ARMv6: */ | |
| 169 | #define	CP15_DCIALL		p15, 0, r0, c7, c6, 0 /* Data cache invalidate all */ | |
| 170 | #endif | |
| 171 | 161 | #define	CP15_DCIMVAC(rr)	p15, 0, rr, c7, c6, 1 /* Data cache invalidate by MVA PoC */ |
| 172 | 162 | #define	CP15_DCISW(rr)		p15, 0, rr, c7, c6, 2 /* Data cache invalidate by set/way */ |
| 173 | 163 | |
| ... | ... | @@ -176,43 +166,25 @@ |
| 176 | 166 | #define	CP15_ATS1CUR(rr)	p15, 0, rr, c7, c8, 2 /* Stage 1 Current state unprivileged read */ |
| 177 | 167 | #define	CP15_ATS1CUW(rr)	p15, 0, rr, c7, c8, 3 /* Stage 1 Current state unprivileged write */ |
| 178 | 168 | |
| 179 | #if __ARM_ARCH >= 7 | |
| 180 | 169 | /* From ARMv7: */ |
| 181 | 170 | #define	CP15_ATS12NSOPR(rr)	p15, 0, rr, c7, c8, 4 /* Stages 1 and 2 Non-secure only PL1 read */ |
| 182 | 171 | #define	CP15_ATS12NSOPW(rr)	p15, 0, rr, c7, c8, 5 /* Stages 1 and 2 Non-secure only PL1 write */ |
| 183 | 172 | #define	CP15_ATS12NSOUR(rr)	p15, 0, rr, c7, c8, 6 /* Stages 1 and 2 Non-secure only unprivileged read */ |
| 184 | 173 | #define	CP15_ATS12NSOUW(rr)	p15, 0, rr, c7, c8, 7 /* Stages 1 and 2 Non-secure only unprivileged write */ |
| 185 | #endif | |
| 186 | 174 | |
| 187 | #if __ARM_ARCH == 6 | |
| 188 | /* Only ARMv6: */ | |
| 189 | #define	CP15_DCCALL		p15, 0, r0, c7, c10, 0 /* Data cache clean all */ | |
| 190 | #endif | |
| 191 | 175 | #define	CP15_DCCMVAC(rr)	p15, 0, rr, c7, c10, 1 /* Data cache clean by MVA PoC */ |
| 192 | 176 | #define	CP15_DCCSW(rr)		p15, 0, rr, c7, c10, 2 /* Data cache clean by set/way */ |
| 193 | #if __ARM_ARCH == 6 | |
| 194 | /* Only ARMv6: */ | |
| 195 | #define	CP15_CP15DSB		p15, 0, r0, c7, c10, 4 /* DSB */ | |
| 196 | #define	CP15_CP15DMB		p15, 0, r0, c7, c10, 5 /* DMB */ | |
| 197 | #define	CP15_CP15WFI		p15, 0, r0, c7, c0, 4 /* WFI */ | |
| 198 | #endif | |
| 199 | 177 | |
| 200 | #if __ARM_ARCH >= 7 | |
| 201 | 178 | /* From ARMv7: */ |
| 202 | 179 | #define	CP15_DCCMVAU(rr)	p15, 0, rr, c7, c11, 1 /* Data cache clean by MVA PoU */ |
| 203 | #endif | |
| 204 | 180 | |
| 205 | #if __ARM_ARCH == 6 | |
| 206 | /* Only ARMv6: */ | |
| 207 | #define	CP15_DCCIALL		p15, 0, r0, c7, c14, 0 /* Data cache clean and invalidate all */ | |
| 208 | #endif | |
| 209 | 181 | #define	CP15_DCCIMVAC(rr)	p15, 0, rr, c7, c14, 1 /* Data cache clean and invalidate by MVA PoC */ |
| 210 | 182 | #define	CP15_DCCISW(rr)		p15, 0, rr, c7, c14, 2 /* Data cache clean and invalidate by set/way */ |
| 211 | 183 | |
| 212 | 184 | /* |
| 213 | 185 | * CP15 C8 registers |
| 214 | 186 | */ |
| 215 | #if __ARM_ARCH >= 7 && defined(SMP) | |
| 187 | #if defined(SMP) | |
| 216 | 188 | /* From ARMv7: */ |
| 217 | 189 | #define	CP15_TLBIALLIS		p15, 0, r0, c8, c3, 0 /* Invalidate entire unified TLB IS */ |
| 218 | 190 | #define	CP15_TLBIMVAIS(rr)	p15, 0, rr, c8, c3, 1 /* Invalidate unified TLB by MVA IS */ |
| ... | ... | @@ -232,11 +204,6 @@ |
| 232 | 204 | /* |
| 233 | 205 | * CP15 C9 registers |
| 234 | 206 | */ |
| 235 | #if __ARM_ARCH == 6 && defined(CPU_ARM1176) | |
| 236 | #define	CP15_PMUSERENR(rr)	p15, 0, rr, c15, c9, 0 /* Access Validation Control Register */ | |
| 237 | #define	CP15_PMCR(rr)		p15, 0, rr, c15, c12, 0 /* Performance Monitor Control Register */ | |
| 238 | #define	CP15_PMCCNTR(rr)	p15, 0, rr, c15, c12, 1 /* PM Cycle Count Register */ | |
| 239 | #else | |
| 240 | 207 | #define	CP15_L2CTLR(rr)		p15, 1, rr, c9, c0, 2 /* L2 Control Register */ |
| 241 | 208 | #define	CP15_PMCR(rr)		p15, 0, rr, c9, c12, 0 /* Performance Monitor Control Register */ |
| 242 | 209 | #define	CP15_PMCNTENSET(rr)	p15, 0, rr, c9, c12, 1 /* PM Count Enable Set Register */ |
| ... | ... | @@ -250,7 +217,6 @@ |
| 250 | 217 | #define	CP15_PMUSERENR(rr)	p15, 0, rr, c9, c14, 0 /* PM User Enable Register */ |
| 251 | 218 | #define	CP15_PMINTENSET(rr)	p15, 0, rr, c9, c14, 1 /* PM Interrupt Enable Set Register */ |
| 252 | 219 | #define	CP15_PMINTENCLR(rr)	p15, 0, rr, c9, c14, 2 /* PM Interrupt Enable Clear Register */ |
| 253 | #endif | |
| 254 | 220 | |
| 255 | 221 | /* |
| 256 | 222 | * CP15 C10 registers |
lib/libc/include/arm-freebsd-eabihf/machine/vm.h+1-1| ... | ... | @@ -36,7 +36,7 @@ |
| 36 | 36 | #define VM_MEMATTR_WRITE_THROUGH	((vm_memattr_t)4) |
| 37 | 37 | |
| 38 | 38 | #define VM_MEMATTR_DEFAULT		VM_MEMATTR_WB_WA |
| 39 | #define VM_MEMATTR_UNCACHEABLE		VM_MEMATTR_SO 	/* misused by DMA */ | |
| 39 | #define VM_MEMATTR_UNCACHEABLE		VM_MEMATTR_NOCACHE	/* used by BUSDMA */ | |
| 40 | 40 | #ifdef _KERNEL |
| 41 | 41 | /* Don't export aliased VM_MEMATTR to userland */ |
| 42 | 42 | #define VM_MEMATTR_WRITE_COMBINING 	VM_MEMATTR_WRITE_THROUGH /* for DRM */ |
lib/libc/include/arm-freebsd-eabihf/machine/vmparam.h+1| ... | ... | @@ -200,5 +200,6 @@ extern vm_offset_t vm_max_kernel_address; |
| 200 | 200 | * Need a page dump array for minidump. |
| 201 | 201 | */ |
| 202 | 202 | #define MINIDUMP_PAGE_TRACKING	1 |
| 203 | #define MINIDUMP_STARTUP_PAGE_TRACKING 0 | |
| 203 | 204 | |
| 204 | 205 | #endif	/* _MACHINE_VMPARAM_H_ */ |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/_ctype.h-2| ... | ... | @@ -35,8 +35,6 @@ |
| 35 | 35 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 36 | 36 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 37 | 37 | * SUCH DAMAGE. |
| 38 | * | |
| 39 | * From @(#)ctype.h	8.4 (Berkeley) 1/21/94 | |
| 40 | 38 | * From FreeBSD: src/include/ctype.h,v 1.27 2004/06/23 07:11:39 tjr Exp |
| 41 | 39 | */ |
| 42 | 40 |
lib/libc/include/generic-freebsd/_libsys.h created+881| ... | ... | @@ -0,0 +1,881 @@ |
| 1 | /* | |
| 2 | * Public system call stubs provided by libsys. | |
| 3 | * | |
| 4 | * Do not use directly, include <libsys.h> instead. | |
| 5 | * | |
| 6 | * DO NOT EDIT-- this file is automatically @generated. | |
| 7 | */ | |
| 8 | ||
| 9 | #ifndef __LIBSYS_H_ | |
| 10 | #define __LIBSYS_H_ | |
| 11 | ||
| 12 | #include <sys/_cpuset.h> | |
| 13 | #include <sys/_domainset.h> | |
| 14 | #include <sys/_ffcounter.h> | |
| 15 | #include <sys/_semaphore.h> | |
| 16 | #include <sys/_sigaltstack.h> | |
| 17 | #include <machine/ucontext.h> /* for mcontext_t */ | |
| 18 | #include <sys/_ucontext.h> | |
| 19 | #include <sys/wait.h> | |
| 20 | ||
| 21 | struct __siginfo; | |
| 22 | struct __ucontext; | |
| 23 | struct __wrusage; | |
| 24 | struct acl; | |
| 25 | struct aiocb; | |
| 26 | struct auditinfo; | |
| 27 | struct auditinfo_addr; | |
| 28 | struct ffclock_estimate; | |
| 29 | struct fhandle; | |
| 30 | struct iovec; | |
| 31 | struct itimerspec; | |
| 32 | struct itimerval; | |
| 33 | struct jail; | |
| 34 | struct kevent; | |
| 35 | struct kld_file_stat; | |
| 36 | struct mac; | |
| 37 | struct module_stat; | |
| 38 | struct mq_attr; | |
| 39 | struct msghdr; | |
| 40 | struct msqid_ds; | |
| 41 | struct ntptimeval; | |
| 42 | struct pollfd; | |
| 43 | struct rlimit; | |
| 44 | struct rtprio; | |
| 45 | struct rusage; | |
| 46 | struct sched_param; | |
| 47 | struct sctp_sndrcvinfo; | |
| 48 | struct sembuf; | |
| 49 | struct setcred; | |
| 50 | struct sf_hdtr; | |
| 51 | struct shmid_ds; | |
| 52 | struct sigaction; | |
| 53 | struct sigaltstack; | |
| 54 | struct sigevent; | |
| 55 | struct sockaddr; | |
| 56 | struct spacectl_range; | |
| 57 | struct stat; | |
| 58 | struct statfs; | |
| 59 | struct thr_param; | |
| 60 | struct timespec; | |
| 61 | struct timeval; | |
| 62 | struct timex; | |
| 63 | struct timezone; | |
| 64 | struct uuid; | |
| 65 | union semun; | |
| 66 | ||
| 67 | __BEGIN_DECLS | |
| 68 | typedef void (__sys__exit_t)(int); | |
| 69 | typedef int (__sys_fork_t)(void); | |
| 70 | typedef ssize_t (__sys_read_t)(int, void *, size_t); | |
| 71 | typedef ssize_t (__sys_write_t)(int, const void *, size_t); | |
| 72 | typedef int (__sys_open_t)(const char *, int, mode_t); | |
| 73 | typedef int (__sys_close_t)(int); | |
| 74 | typedef int (__sys_wait4_t)(int, int *, int, struct rusage *); | |
| 75 | typedef int (__sys_link_t)(const char *, const char *); | |
| 76 | typedef int (__sys_unlink_t)(const char *); | |
| 77 | typedef int (__sys_chdir_t)(const char *); | |
| 78 | typedef int (__sys_fchdir_t)(int); | |
| 79 | typedef int (__sys_chmod_t)(const char *, mode_t); | |
| 80 | typedef int (__sys_chown_t)(const char *, int, int); | |
| 81 | typedef void * (__sys_break_t)(char *); | |
| 82 | typedef pid_t (__sys_getpid_t)(void); | |
| 83 | typedef int (__sys_mount_t)(const char *, const char *, int, void *); | |
| 84 | typedef int (__sys_unmount_t)(const char *, int); | |
| 85 | typedef int (__sys_setuid_t)(uid_t); | |
| 86 | typedef uid_t (__sys_getuid_t)(void); | |
| 87 | typedef uid_t (__sys_geteuid_t)(void); | |
| 88 | typedef int (__sys_ptrace_t)(int, pid_t, caddr_t, int); | |
| 89 | typedef ssize_t (__sys_recvmsg_t)(int, struct msghdr *, int); | |
| 90 | typedef ssize_t (__sys_sendmsg_t)(int, const struct msghdr *, int); | |
| 91 | typedef ssize_t (__sys_recvfrom_t)(int, void *, size_t, int, struct sockaddr *, __socklen_t *); | |
| 92 | typedef int (__sys_accept_t)(int, struct sockaddr *, __socklen_t *); | |
| 93 | typedef int (__sys_getpeername_t)(int, struct sockaddr *, __socklen_t *); | |
| 94 | typedef int (__sys_getsockname_t)(int, struct sockaddr *, __socklen_t *); | |
| 95 | typedef int (__sys_access_t)(const char *, int); | |
| 96 | typedef int (__sys_chflags_t)(const char *, u_long); | |
| 97 | typedef int (__sys_fchflags_t)(int, u_long); | |
| 98 | typedef int (__sys_sync_t)(void); | |
| 99 | typedef int (__sys_kill_t)(int, int); | |
| 100 | typedef pid_t (__sys_getppid_t)(void); | |
| 101 | typedef int (__sys_dup_t)(u_int); | |
| 102 | typedef gid_t (__sys_getegid_t)(void); | |
| 103 | typedef int (__sys_profil_t)(char *, size_t, size_t, u_int); | |
| 104 | typedef int (__sys_ktrace_t)(const char *, int, int, int); | |
| 105 | typedef gid_t (__sys_getgid_t)(void); | |
| 106 | typedef int (__sys_getlogin_t)(char *, u_int); | |
| 107 | typedef int (__sys_setlogin_t)(const char *); | |
| 108 | typedef int (__sys_acct_t)(const char *); | |
| 109 | typedef int (__sys_sigaltstack_t)(const struct sigaltstack *, struct sigaltstack *); | |
| 110 | typedef int (__sys_ioctl_t)(int, u_long, char *); | |
| 111 | typedef int (__sys_reboot_t)(int); | |
| 112 | typedef int (__sys_revoke_t)(const char *); | |
| 113 | typedef int (__sys_symlink_t)(const char *, const char *); | |
| 114 | typedef ssize_t (__sys_readlink_t)(const char *, char *, size_t); | |
| 115 | typedef int (__sys_execve_t)(const char *, char **, char **); | |
| 116 | typedef mode_t (__sys_umask_t)(mode_t); | |
| 117 | typedef int (__sys_chroot_t)(const char *); | |
| 118 | typedef int (__sys_msync_t)(void *, size_t, int); | |
| 119 | typedef int (__sys_vfork_t)(void); | |
| 120 | typedef int (__sys_munmap_t)(void *, size_t); | |
| 121 | typedef int (__sys_mprotect_t)(void *, size_t, int); | |
| 122 | typedef int (__sys_madvise_t)(void *, size_t, int); | |
| 123 | typedef int (__sys_mincore_t)(const void *, size_t, char *); | |
| 124 | typedef int (__sys_getpgrp_t)(void); | |
| 125 | typedef int (__sys_setpgid_t)(int, int); | |
| 126 | typedef int (__sys_setitimer_t)(int, const struct itimerval *, struct itimerval *); | |
| 127 | typedef int (__sys_swapon_t)(const char *); | |
| 128 | typedef int (__sys_getitimer_t)(int, struct itimerval *); | |
| 129 | typedef int (__sys_getdtablesize_t)(void); | |
| 130 | typedef int (__sys_dup2_t)(u_int, u_int); | |
| 131 | typedef int (__sys_fcntl_t)(int, int, intptr_t); | |
| 132 | typedef int (__sys_select_t)(int, fd_set *, fd_set *, fd_set *, struct timeval *); | |
| 133 | typedef int (__sys_fsync_t)(int); | |
| 134 | typedef int (__sys_setpriority_t)(int, int, int); | |
| 135 | typedef int (__sys_socket_t)(int, int, int); | |
| 136 | typedef int (__sys_connect_t)(int, const struct sockaddr *, __socklen_t); | |
| 137 | typedef int (__sys_getpriority_t)(int, int); | |
| 138 | typedef int (__sys_bind_t)(int, const struct sockaddr *, __socklen_t); | |
| 139 | typedef int (__sys_setsockopt_t)(int, int, int, const void *, __socklen_t); | |
| 140 | typedef int (__sys_listen_t)(int, int); | |
| 141 | typedef int (__sys_gettimeofday_t)(struct timeval *, struct timezone *); | |
| 142 | typedef int (__sys_getrusage_t)(int, struct rusage *); | |
| 143 | typedef int (__sys_getsockopt_t)(int, int, int, void *, __socklen_t *); | |
| 144 | typedef ssize_t (__sys_readv_t)(int, const struct iovec *, u_int); | |
| 145 | typedef ssize_t (__sys_writev_t)(int, const struct iovec *, u_int); | |
| 146 | typedef int (__sys_settimeofday_t)(const struct timeval *, const struct timezone *); | |
| 147 | typedef int (__sys_fchown_t)(int, int, int); | |
| 148 | typedef int (__sys_fchmod_t)(int, mode_t); | |
| 149 | typedef int (__sys_setreuid_t)(int, int); | |
| 150 | typedef int (__sys_setregid_t)(int, int); | |
| 151 | typedef int (__sys_rename_t)(const char *, const char *); | |
| 152 | typedef int (__sys_flock_t)(int, int); | |
| 153 | typedef int (__sys_mkfifo_t)(const char *, mode_t); | |
| 154 | typedef ssize_t (__sys_sendto_t)(int, const void *, size_t, int, const struct sockaddr *, __socklen_t); | |
| 155 | typedef int (__sys_shutdown_t)(int, int); | |
| 156 | typedef int (__sys_socketpair_t)(int, int, int, int *); | |
| 157 | typedef int (__sys_mkdir_t)(const char *, mode_t); | |
| 158 | typedef int (__sys_rmdir_t)(const char *); | |
| 159 | typedef int (__sys_utimes_t)(const char *, const struct timeval *); | |
| 160 | typedef int (__sys_adjtime_t)(const struct timeval *, struct timeval *); | |
| 161 | typedef int (__sys_setsid_t)(void); | |
| 162 | typedef int (__sys_quotactl_t)(const char *, int, int, void *); | |
| 163 | typedef int (__sys_nlm_syscall_t)(int, int, int, char **); | |
| 164 | typedef int (__sys_nfssvc_t)(int, void *); | |
| 165 | typedef int (__sys_lgetfh_t)(const char *, struct fhandle *); | |
| 166 | typedef int (__sys_getfh_t)(const char *, struct fhandle *); | |
| 167 | typedef int (__sys_sysarch_t)(int, char *); | |
| 168 | typedef int (__sys_rtprio_t)(int, pid_t, struct rtprio *); | |
| 169 | typedef int (__sys_semsys_t)(int, int, int, int, int); | |
| 170 | typedef int (__sys_msgsys_t)(int, int, int, int, int, int); | |
| 171 | typedef int (__sys_shmsys_t)(int, int, int, int); | |
| 172 | typedef int (__sys_setfib_t)(int); | |
| 173 | typedef int (__sys_ntp_adjtime_t)(struct timex *); | |
| 174 | typedef int (__sys_setgid_t)(gid_t); | |
| 175 | typedef int (__sys_setegid_t)(gid_t); | |
| 176 | typedef int (__sys_seteuid_t)(uid_t); | |
| 177 | typedef int (__sys_pathconf_t)(const char *, int); | |
| 178 | typedef int (__sys_fpathconf_t)(int, int); | |
| 179 | typedef int (__sys_getrlimit_t)(u_int, struct rlimit *); | |
| 180 | typedef int (__sys_setrlimit_t)(u_int, struct rlimit *); | |
| 181 | typedef int (__sys___sysctl_t)(const int *, u_int, void *, size_t *, const void *, size_t); | |
| 182 | typedef int (__sys_mlock_t)(const void *, size_t); | |
| 183 | typedef int (__sys_munlock_t)(const void *, size_t); | |
| 184 | typedef int (__sys_undelete_t)(const char *); | |
| 185 | typedef int (__sys_futimes_t)(int, const struct timeval *); | |
| 186 | typedef int (__sys_getpgid_t)(pid_t); | |
| 187 | typedef int (__sys_poll_t)(struct pollfd *, u_int, int); | |
| 188 | typedef int (__sys_semget_t)(key_t, int, int); | |
| 189 | typedef int (__sys_semop_t)(int, struct sembuf *, size_t); | |
| 190 | typedef int (__sys_msgget_t)(key_t, int); | |
| 191 | typedef int (__sys_msgsnd_t)(int, const void *, size_t, int); | |
| 192 | typedef ssize_t (__sys_msgrcv_t)(int, void *, size_t, long, int); | |
| 193 | typedef void * (__sys_shmat_t)(int, const void *, int); | |
| 194 | typedef int (__sys_shmdt_t)(const void *); | |
| 195 | typedef int (__sys_shmget_t)(key_t, size_t, int); | |
| 196 | typedef int (__sys_clock_gettime_t)(clockid_t, struct timespec *); | |
| 197 | typedef int (__sys_clock_settime_t)(clockid_t, const struct timespec *); | |
| 198 | typedef int (__sys_clock_getres_t)(clockid_t, struct timespec *); | |
| 199 | typedef int (__sys_ktimer_create_t)(clockid_t, struct sigevent *, int *); | |
| 200 | typedef int (__sys_ktimer_delete_t)(int); | |
| 201 | typedef int (__sys_ktimer_settime_t)(int, int, const struct itimerspec *, struct itimerspec *); | |
| 202 | typedef int (__sys_ktimer_gettime_t)(int, struct itimerspec *); | |
| 203 | typedef int (__sys_ktimer_getoverrun_t)(int); | |
| 204 | typedef int (__sys_nanosleep_t)(const struct timespec *, struct timespec *); | |
| 205 | typedef int (__sys_ffclock_getcounter_t)(ffcounter *); | |
| 206 | typedef int (__sys_ffclock_setestimate_t)(struct ffclock_estimate *); | |
| 207 | typedef int (__sys_ffclock_getestimate_t)(struct ffclock_estimate *); | |
| 208 | typedef int (__sys_clock_nanosleep_t)(clockid_t, int, const struct timespec *, struct timespec *); | |
| 209 | typedef int (__sys_clock_getcpuclockid2_t)(id_t, int, clockid_t *); | |
| 210 | typedef int (__sys_ntp_gettime_t)(struct ntptimeval *); | |
| 211 | typedef int (__sys_minherit_t)(void *, size_t, int); | |
| 212 | typedef int (__sys_rfork_t)(int); | |
| 213 | typedef int (__sys_issetugid_t)(void); | |
| 214 | typedef int (__sys_lchown_t)(const char *, int, int); | |
| 215 | typedef int (__sys_aio_read_t)(struct aiocb *); | |
| 216 | typedef int (__sys_aio_write_t)(struct aiocb *); | |
| 217 | typedef int (__sys_lio_listio_t)(int, struct aiocb * const *, int, struct sigevent *); | |
| 218 | typedef int (__sys_lchmod_t)(const char *, mode_t); | |
| 219 | typedef int (__sys_lutimes_t)(const char *, const struct timeval *); | |
| 220 | typedef ssize_t (__sys_preadv_t)(int, struct iovec *, u_int, off_t); | |
| 221 | typedef ssize_t (__sys_pwritev_t)(int, struct iovec *, u_int, off_t); | |
| 222 | typedef int (__sys_fhopen_t)(const struct fhandle *, int); | |
| 223 | typedef int (__sys_modnext_t)(int); | |
| 224 | typedef int (__sys_modstat_t)(int, struct module_stat *); | |
| 225 | typedef int (__sys_modfnext_t)(int); | |
| 226 | typedef int (__sys_modfind_t)(const char *); | |
| 227 | typedef int (__sys_kldload_t)(const char *); | |
| 228 | typedef int (__sys_kldunload_t)(int); | |
| 229 | typedef int (__sys_kldfind_t)(const char *); | |
| 230 | typedef int (__sys_kldnext_t)(int); | |
| 231 | typedef int (__sys_kldstat_t)(int, struct kld_file_stat *); | |
| 232 | typedef int (__sys_kldfirstmod_t)(int); | |
| 233 | typedef int (__sys_getsid_t)(pid_t); | |
| 234 | typedef int (__sys_setresuid_t)(uid_t, uid_t, uid_t); | |
| 235 | typedef int (__sys_setresgid_t)(gid_t, gid_t, gid_t); | |
| 236 | typedef ssize_t (__sys_aio_return_t)(struct aiocb *); | |
| 237 | typedef int (__sys_aio_suspend_t)(const struct aiocb * const *, int, const struct timespec *); | |
| 238 | typedef int (__sys_aio_cancel_t)(int, struct aiocb *); | |
| 239 | typedef int (__sys_aio_error_t)(struct aiocb *); | |
| 240 | typedef int (__sys_mlockall_t)(int); | |
| 241 | typedef int (__sys_munlockall_t)(void); | |
| 242 | typedef int (__sys___getcwd_t)(char *, size_t); | |
| 243 | typedef int (__sys_sched_setparam_t)(pid_t, const struct sched_param *); | |
| 244 | typedef int (__sys_sched_getparam_t)(pid_t, struct sched_param *); | |
| 245 | typedef int (__sys_sched_setscheduler_t)(pid_t, int, const struct sched_param *); | |
| 246 | typedef int (__sys_sched_getscheduler_t)(pid_t); | |
| 247 | typedef int (__sys_sched_yield_t)(void); | |
| 248 | typedef int (__sys_sched_get_priority_max_t)(int); | |
| 249 | typedef int (__sys_sched_get_priority_min_t)(int); | |
| 250 | typedef int (__sys_sched_rr_get_interval_t)(pid_t, struct timespec *); | |
| 251 | typedef int (__sys_utrace_t)(const void *, size_t); | |
| 252 | typedef int (__sys_kldsym_t)(int, int, void *); | |
| 253 | typedef int (__sys_jail_t)(struct jail *); | |
| 254 | typedef int (__sys_nnpfs_syscall_t)(int, char *, int, void *, int); | |
| 255 | typedef int (__sys_sigprocmask_t)(int, const sigset_t *, sigset_t *); | |
| 256 | typedef int (__sys_sigsuspend_t)(const sigset_t *); | |
| 257 | typedef int (__sys_sigpending_t)(sigset_t *); | |
| 258 | typedef int (__sys_sigtimedwait_t)(const sigset_t *, struct __siginfo *, const struct timespec *); | |
| 259 | typedef int (__sys_sigwaitinfo_t)(const sigset_t *, struct __siginfo *); | |
| 260 | typedef int (__sys___acl_get_file_t)(const char *, __acl_type_t, struct acl *); | |
| 261 | typedef int (__sys___acl_set_file_t)(const char *, __acl_type_t, struct acl *); | |
| 262 | typedef int (__sys___acl_get_fd_t)(int, __acl_type_t, struct acl *); | |
| 263 | typedef int (__sys___acl_set_fd_t)(int, __acl_type_t, struct acl *); | |
| 264 | typedef int (__sys___acl_delete_file_t)(const char *, __acl_type_t); | |
| 265 | typedef int (__sys___acl_delete_fd_t)(int, __acl_type_t); | |
| 266 | typedef int (__sys___acl_aclcheck_file_t)(const char *, __acl_type_t, struct acl *); | |
| 267 | typedef int (__sys___acl_aclcheck_fd_t)(int, __acl_type_t, struct acl *); | |
| 268 | typedef int (__sys_extattrctl_t)(const char *, int, const char *, int, const char *); | |
| 269 | typedef ssize_t (__sys_extattr_set_file_t)(const char *, int, const char *, void *, size_t); | |
| 270 | typedef ssize_t (__sys_extattr_get_file_t)(const char *, int, const char *, void *, size_t); | |
| 271 | typedef int (__sys_extattr_delete_file_t)(const char *, int, const char *); | |
| 272 | typedef ssize_t (__sys_aio_waitcomplete_t)(struct aiocb **, struct timespec *); | |
| 273 | typedef int (__sys_getresuid_t)(uid_t *, uid_t *, uid_t *); | |
| 274 | typedef int (__sys_getresgid_t)(gid_t *, gid_t *, gid_t *); | |
| 275 | typedef int (__sys_kqueue_t)(void); | |
| 276 | typedef ssize_t (__sys_extattr_set_fd_t)(int, int, const char *, void *, size_t); | |
| 277 | typedef ssize_t (__sys_extattr_get_fd_t)(int, int, const char *, void *, size_t); | |
| 278 | typedef int (__sys_extattr_delete_fd_t)(int, int, const char *); | |
| 279 | typedef int (__sys___setugid_t)(int); | |
| 280 | typedef int (__sys_eaccess_t)(const char *, int); | |
| 281 | typedef int (__sys_afs3_syscall_t)(long, long, long, long, long, long, long); | |
| 282 | typedef int (__sys_nmount_t)(struct iovec *, unsigned int, int); | |
| 283 | typedef int (__sys___mac_get_proc_t)(struct mac *); | |
| 284 | typedef int (__sys___mac_set_proc_t)(struct mac *); | |
| 285 | typedef int (__sys___mac_get_fd_t)(int, struct mac *); | |
| 286 | typedef int (__sys___mac_get_file_t)(const char *, struct mac *); | |
| 287 | typedef int (__sys___mac_set_fd_t)(int, struct mac *); | |
| 288 | typedef int (__sys___mac_set_file_t)(const char *, struct mac *); | |
| 289 | typedef int (__sys_kenv_t)(int, const char *, char *, int); | |
| 290 | typedef int (__sys_lchflags_t)(const char *, u_long); | |
| 291 | typedef int (__sys_uuidgen_t)(struct uuid *, int); | |
| 292 | typedef int (__sys_sendfile_t)(int, int, off_t, size_t, struct sf_hdtr *, off_t *, int); | |
| 293 | typedef int (__sys_mac_syscall_t)(const char *, int, void *); | |
| 294 | typedef int (__sys_ksem_close_t)(semid_t); | |
| 295 | typedef int (__sys_ksem_post_t)(semid_t); | |
| 296 | typedef int (__sys_ksem_wait_t)(semid_t); | |
| 297 | typedef int (__sys_ksem_trywait_t)(semid_t); | |
| 298 | typedef int (__sys_ksem_init_t)(semid_t *, unsigned int); | |
| 299 | typedef int (__sys_ksem_open_t)(semid_t *, const char *, int, mode_t, unsigned int); | |
| 300 | typedef int (__sys_ksem_unlink_t)(const char *); | |
| 301 | typedef int (__sys_ksem_getvalue_t)(semid_t, int *); | |
| 302 | typedef int (__sys_ksem_destroy_t)(semid_t); | |
| 303 | typedef int (__sys___mac_get_pid_t)(pid_t, struct mac *); | |
| 304 | typedef int (__sys___mac_get_link_t)(const char *, struct mac *); | |
| 305 | typedef int (__sys___mac_set_link_t)(const char *, struct mac *); | |
| 306 | typedef ssize_t (__sys_extattr_set_link_t)(const char *, int, const char *, void *, size_t); | |
| 307 | typedef ssize_t (__sys_extattr_get_link_t)(const char *, int, const char *, void *, size_t); | |
| 308 | typedef int (__sys_extattr_delete_link_t)(const char *, int, const char *); | |
| 309 | typedef int (__sys___mac_execve_t)(const char *, char **, char **, struct mac *); | |
| 310 | typedef int (__sys_sigaction_t)(int, const struct sigaction *, struct sigaction *); | |
| 311 | typedef int (__sys_sigreturn_t)(const struct __ucontext *); | |
| 312 | typedef int (__sys_getcontext_t)(struct __ucontext *); | |
| 313 | typedef int (__sys_setcontext_t)(const struct __ucontext *); | |
| 314 | typedef int (__sys_swapcontext_t)(struct __ucontext *, const struct __ucontext *); | |
| 315 | typedef int (__sys___acl_get_link_t)(const char *, __acl_type_t, struct acl *); | |
| 316 | typedef int (__sys___acl_set_link_t)(const char *, __acl_type_t, struct acl *); | |
| 317 | typedef int (__sys___acl_delete_link_t)(const char *, __acl_type_t); | |
| 318 | typedef int (__sys___acl_aclcheck_link_t)(const char *, __acl_type_t, struct acl *); | |
| 319 | typedef int (__sys_sigwait_t)(const sigset_t *, int *); | |
| 320 | typedef int (__sys_thr_create_t)(ucontext_t *, long *, int); | |
| 321 | typedef void (__sys_thr_exit_t)(long *); | |
| 322 | typedef int (__sys_thr_self_t)(long *); | |
| 323 | typedef int (__sys_thr_kill_t)(long, int); | |
| 324 | typedef int (__sys_jail_attach_t)(int); | |
| 325 | typedef ssize_t (__sys_extattr_list_fd_t)(int, int, void *, size_t); | |
| 326 | typedef ssize_t (__sys_extattr_list_file_t)(const char *, int, void *, size_t); | |
| 327 | typedef ssize_t (__sys_extattr_list_link_t)(const char *, int, void *, size_t); | |
| 328 | typedef int (__sys_ksem_timedwait_t)(semid_t, const struct timespec *); | |
| 329 | typedef int (__sys_thr_suspend_t)(const struct timespec *); | |
| 330 | typedef int (__sys_thr_wake_t)(long); | |
| 331 | typedef int (__sys_kldunloadf_t)(int, int); | |
| 332 | typedef int (__sys_audit_t)(const void *, u_int); | |
| 333 | typedef int (__sys_auditon_t)(int, void *, u_int); | |
| 334 | typedef int (__sys_getauid_t)(uid_t *); | |
| 335 | typedef int (__sys_setauid_t)(uid_t *); | |
| 336 | typedef int (__sys_getaudit_t)(struct auditinfo *); | |
| 337 | typedef int (__sys_setaudit_t)(struct auditinfo *); | |
| 338 | typedef int (__sys_getaudit_addr_t)(struct auditinfo_addr *, u_int); | |
| 339 | typedef int (__sys_setaudit_addr_t)(struct auditinfo_addr *, u_int); | |
| 340 | typedef int (__sys_auditctl_t)(const char *); | |
| 341 | typedef int (__sys__umtx_op_t)(void *, int, u_long, void *, void *); | |
| 342 | typedef int (__sys_thr_new_t)(struct thr_param *, int); | |
| 343 | typedef int (__sys_sigqueue_t)(pid_t, int, void *); | |
| 344 | typedef int (__sys_kmq_open_t)(const char *, int, mode_t, const struct mq_attr *); | |
| 345 | typedef int (__sys_kmq_setattr_t)(int, const struct mq_attr *, struct mq_attr *); | |
| 346 | typedef int (__sys_kmq_timedreceive_t)(int, char *, size_t, unsigned *, const struct timespec *); | |
| 347 | typedef int (__sys_kmq_timedsend_t)(int, const char *, size_t, unsigned, const struct timespec *); | |
| 348 | typedef int (__sys_kmq_notify_t)(int, const struct sigevent *); | |
| 349 | typedef int (__sys_kmq_unlink_t)(const char *); | |
| 350 | typedef void (__sys_abort2_t)(const char *, int, void **); | |
| 351 | typedef int (__sys_thr_set_name_t)(long, const char *); | |
| 352 | typedef int (__sys_aio_fsync_t)(int, struct aiocb *); | |
| 353 | typedef int (__sys_rtprio_thread_t)(int, lwpid_t, struct rtprio *); | |
| 354 | typedef int (__sys_sctp_peeloff_t)(int, uint32_t); | |
| 355 | typedef int (__sys_sctp_generic_sendmsg_t)(int, void *, int, const struct sockaddr *, __socklen_t, struct sctp_sndrcvinfo *, int); | |
| 356 | typedef int (__sys_sctp_generic_sendmsg_iov_t)(int, struct iovec *, int, const struct sockaddr *, __socklen_t, struct sctp_sndrcvinfo *, int); | |
| 357 | typedef int (__sys_sctp_generic_recvmsg_t)(int, struct iovec *, int, struct sockaddr *, __socklen_t *, struct sctp_sndrcvinfo *, int *); | |
| 358 | typedef ssize_t (__sys_pread_t)(int, void *, size_t, off_t); | |
| 359 | typedef ssize_t (__sys_pwrite_t)(int, const void *, size_t, off_t); | |
| 360 | typedef void * (__sys_mmap_t)(void *, size_t, int, int, int, off_t); | |
| 361 | typedef off_t (__sys_lseek_t)(int, off_t, int); | |
| 362 | typedef int (__sys_truncate_t)(const char *, off_t); | |
| 363 | typedef int (__sys_ftruncate_t)(int, off_t); | |
| 364 | typedef int (__sys_thr_kill2_t)(pid_t, long, int); | |
| 365 | typedef int (__sys_shm_unlink_t)(const char *); | |
| 366 | typedef int (__sys_cpuset_t)(cpusetid_t *); | |
| 367 | typedef int (__sys_cpuset_setid_t)(cpuwhich_t, id_t, cpusetid_t); | |
| 368 | typedef int (__sys_cpuset_getid_t)(cpulevel_t, cpuwhich_t, id_t, cpusetid_t *); | |
| 369 | typedef int (__sys_cpuset_getaffinity_t)(cpulevel_t, cpuwhich_t, id_t, size_t, cpuset_t *); | |
| 370 | typedef int (__sys_cpuset_setaffinity_t)(cpulevel_t, cpuwhich_t, id_t, size_t, const cpuset_t *); | |
| 371 | typedef int (__sys_faccessat_t)(int, const char *, int, int); | |
| 372 | typedef int (__sys_fchmodat_t)(int, const char *, mode_t, int); | |
| 373 | typedef int (__sys_fchownat_t)(int, const char *, uid_t, gid_t, int); | |
| 374 | typedef int (__sys_fexecve_t)(int, char **, char **); | |
| 375 | typedef int (__sys_futimesat_t)(int, const char *, const struct timeval *); | |
| 376 | typedef int (__sys_linkat_t)(int, const char *, int, const char *, int); | |
| 377 | typedef int (__sys_mkdirat_t)(int, const char *, mode_t); | |
| 378 | typedef int (__sys_mkfifoat_t)(int, const char *, mode_t); | |
| 379 | typedef int (__sys_openat_t)(int, const char *, int, mode_t); | |
| 380 | typedef ssize_t (__sys_readlinkat_t)(int, const char *, char *, size_t); | |
| 381 | typedef int (__sys_renameat_t)(int, const char *, int, const char *); | |
| 382 | typedef int (__sys_symlinkat_t)(const char *, int, const char *); | |
| 383 | typedef int (__sys_unlinkat_t)(int, const char *, int); | |
| 384 | typedef int (__sys_posix_openpt_t)(int); | |
| 385 | typedef int (__sys_jail_get_t)(struct iovec *, unsigned int, int); | |
| 386 | typedef int (__sys_jail_set_t)(struct iovec *, unsigned int, int); | |
| 387 | typedef int (__sys_jail_remove_t)(int); | |
| 388 | typedef int (__sys___semctl_t)(int, int, int, union semun *); | |
| 389 | typedef int (__sys_msgctl_t)(int, int, struct msqid_ds *); | |
| 390 | typedef int (__sys_shmctl_t)(int, int, struct shmid_ds *); | |
| 391 | typedef int (__sys_lpathconf_t)(const char *, int); | |
| 392 | typedef int (__sys___cap_rights_get_t)(int, int, cap_rights_t *); | |
| 393 | typedef int (__sys_cap_enter_t)(void); | |
| 394 | typedef int (__sys_cap_getmode_t)(u_int *); | |
| 395 | typedef int (__sys_pdfork_t)(int *, int); | |
| 396 | typedef int (__sys_pdkill_t)(int, int); | |
| 397 | typedef int (__sys_pdgetpid_t)(int, pid_t *); | |
| 398 | typedef int (__sys_pselect_t)(int, fd_set *, fd_set *, fd_set *, const struct timespec *, const sigset_t *); | |
| 399 | typedef int (__sys_getloginclass_t)(char *, size_t); | |
| 400 | typedef int (__sys_setloginclass_t)(const char *); | |
| 401 | typedef int (__sys_rctl_get_racct_t)(const void *, size_t, void *, size_t); | |
| 402 | typedef int (__sys_rctl_get_rules_t)(const void *, size_t, void *, size_t); | |
| 403 | typedef int (__sys_rctl_get_limits_t)(const void *, size_t, void *, size_t); | |
| 404 | typedef int (__sys_rctl_add_rule_t)(const void *, size_t, void *, size_t); | |
| 405 | typedef int (__sys_rctl_remove_rule_t)(const void *, size_t, void *, size_t); | |
| 406 | typedef int (__sys_posix_fallocate_t)(int, off_t, off_t); | |
| 407 | typedef int (__sys_posix_fadvise_t)(int, off_t, off_t, int); | |
| 408 | typedef int (__sys_wait6_t)(idtype_t, id_t, int *, int, struct __wrusage *, struct __siginfo *); | |
| 409 | typedef int (__sys_cap_rights_limit_t)(int, cap_rights_t *); | |
| 410 | typedef int (__sys_cap_ioctls_limit_t)(int, const u_long *, size_t); | |
| 411 | typedef ssize_t (__sys_cap_ioctls_get_t)(int, u_long *, size_t); | |
| 412 | typedef int (__sys_cap_fcntls_limit_t)(int, uint32_t); | |
| 413 | typedef int (__sys_cap_fcntls_get_t)(int, uint32_t *); | |
| 414 | typedef int (__sys_bindat_t)(int, int, const struct sockaddr *, __socklen_t); | |
| 415 | typedef int (__sys_connectat_t)(int, int, const struct sockaddr *, __socklen_t); | |
| 416 | typedef int (__sys_chflagsat_t)(int, const char *, u_long, int); | |
| 417 | typedef int (__sys_accept4_t)(int, struct sockaddr *, __socklen_t *, int); | |
| 418 | typedef int (__sys_pipe2_t)(int *, int); | |
| 419 | typedef int (__sys_aio_mlock_t)(struct aiocb *); | |
| 420 | typedef int (__sys_procctl_t)(idtype_t, id_t, int, void *); | |
| 421 | typedef int (__sys_ppoll_t)(struct pollfd *, u_int, const struct timespec *, const sigset_t *); | |
| 422 | typedef int (__sys_futimens_t)(int, const struct timespec *); | |
| 423 | typedef int (__sys_utimensat_t)(int, const char *, const struct timespec *, int); | |
| 424 | typedef int (__sys_fdatasync_t)(int); | |
| 425 | typedef int (__sys_fstat_t)(int, struct stat *); | |
| 426 | typedef int (__sys_fstatat_t)(int, const char *, struct stat *, int); | |
| 427 | typedef int (__sys_fhstat_t)(const struct fhandle *, struct stat *); | |
| 428 | typedef ssize_t (__sys_getdirentries_t)(int, char *, size_t, off_t *); | |
| 429 | typedef int (__sys_statfs_t)(const char *, struct statfs *); | |
| 430 | typedef int (__sys_fstatfs_t)(int, struct statfs *); | |
| 431 | typedef int (__sys_getfsstat_t)(struct statfs *, long, int); | |
| 432 | typedef int (__sys_fhstatfs_t)(const struct fhandle *, struct statfs *); | |
| 433 | typedef int (__sys_mknodat_t)(int, const char *, mode_t, dev_t); | |
| 434 | typedef int (__sys_kevent_t)(int, const struct kevent *, int, struct kevent *, int, const struct timespec *); | |
| 435 | typedef int (__sys_cpuset_getdomain_t)(cpulevel_t, cpuwhich_t, id_t, size_t, domainset_t *, int *); | |
| 436 | typedef int (__sys_cpuset_setdomain_t)(cpulevel_t, cpuwhich_t, id_t, size_t, domainset_t *, int); | |
| 437 | typedef int (__sys_getrandom_t)(void *, size_t, unsigned int); | |
| 438 | typedef int (__sys_getfhat_t)(int, char *, struct fhandle *, int); | |
| 439 | typedef int (__sys_fhlink_t)(struct fhandle *, const char *); | |
| 440 | typedef int (__sys_fhlinkat_t)(struct fhandle *, int, const char *); | |
| 441 | typedef int (__sys_fhreadlink_t)(struct fhandle *, char *, size_t); | |
| 442 | typedef int (__sys_funlinkat_t)(int, const char *, int, int); | |
| 443 | typedef ssize_t (__sys_copy_file_range_t)(int, off_t *, int, off_t *, size_t, unsigned int); | |
| 444 | typedef int (__sys___sysctlbyname_t)(const char *, size_t, void *, size_t *, void *, size_t); | |
| 445 | typedef int (__sys_shm_open2_t)(const char *, int, mode_t, int, const char *); | |
| 446 | typedef int (__sys_shm_rename_t)(const char *, const char *, int); | |
| 447 | typedef int (__sys_sigfastblock_t)(int, void *); | |
| 448 | typedef int (__sys___realpathat_t)(int, const char *, char *, size_t, int); | |
| 449 | typedef int (__sys_close_range_t)(u_int, u_int, int); | |
| 450 | typedef int (__sys_rpctls_syscall_t)(uint64_t); | |
| 451 | typedef int (__sys___specialfd_t)(int, const void *, size_t); | |
| 452 | typedef int (__sys_aio_writev_t)(struct aiocb *); | |
| 453 | typedef int (__sys_aio_readv_t)(struct aiocb *); | |
| 454 | typedef int (__sys_fspacectl_t)(int, int, const struct spacectl_range *, int, struct spacectl_range *); | |
| 455 | typedef int (__sys_sched_getcpu_t)(void); | |
| 456 | typedef int (__sys_swapoff_t)(const char *, u_int); | |
| 457 | typedef int (__sys_kqueuex_t)(u_int); | |
| 458 | typedef int (__sys_membarrier_t)(int, unsigned, int); | |
| 459 | typedef int (__sys_timerfd_create_t)(int, int); | |
| 460 | typedef int (__sys_timerfd_gettime_t)(int, struct itimerspec *); | |
| 461 | typedef int (__sys_timerfd_settime_t)(int, int, const struct itimerspec *, struct itimerspec *); | |
| 462 | typedef int (__sys_kcmp_t)(pid_t, pid_t, int, uintptr_t, uintptr_t); | |
| 463 | typedef int (__sys_getrlimitusage_t)(u_int, int, rlim_t *); | |
| 464 | typedef int (__sys_fchroot_t)(int); | |
| 465 | typedef int (__sys_setcred_t)(u_int, const struct setcred *, size_t); | |
| 466 | typedef int (__sys_exterrctl_t)(u_int, u_int, void *); | |
| 467 | typedef int (__sys_inotify_add_watch_at_t)(int, int, const char *, uint32_t); | |
| 468 | typedef int (__sys_inotify_rm_watch_t)(int, int); | |
| 469 | typedef int (__sys_getgroups_t)(int, gid_t *); | |
| 470 | typedef int (__sys_setgroups_t)(int, const gid_t *); | |
| 471 | typedef int (__sys_jail_attach_jd_t)(int); | |
| 472 | typedef int (__sys_jail_remove_jd_t)(int); | |
| 473 | ||
| 474 | _Noreturn void __sys__exit(int rval); | |
| 475 | int __sys_fork(void); | |
| 476 | ssize_t __sys_read(int fd, void * buf, size_t nbyte); | |
| 477 | ssize_t __sys_write(int fd, const void * buf, size_t nbyte); | |
| 478 | int __sys_open(const char * path, int flags, mode_t mode); | |
| 479 | int __sys_close(int fd); | |
| 480 | int __sys_wait4(int pid, int * status, int options, struct rusage * rusage); | |
| 481 | int __sys_link(const char * path, const char * link); | |
| 482 | int __sys_unlink(const char * path); | |
| 483 | int __sys_chdir(const char * path); | |
| 484 | int __sys_fchdir(int fd); | |
| 485 | int __sys_chmod(const char * path, mode_t mode); | |
| 486 | int __sys_chown(const char * path, int uid, int gid); | |
| 487 | void * __sys_break(char * nsize); | |
| 488 | pid_t __sys_getpid(void); | |
| 489 | int __sys_mount(const char * type, const char * path, int flags, void * data); | |
| 490 | int __sys_unmount(const char * path, int flags); | |
| 491 | int __sys_setuid(uid_t uid); | |
| 492 | uid_t __sys_getuid(void); | |
| 493 | uid_t __sys_geteuid(void); | |
| 494 | int __sys_ptrace(int req, pid_t pid, caddr_t addr, int data); | |
| 495 | ssize_t __sys_recvmsg(int s, struct msghdr * msg, int flags); | |
| 496 | ssize_t __sys_sendmsg(int s, const struct msghdr * msg, int flags); | |
| 497 | ssize_t __sys_recvfrom(int s, void * buf, size_t len, int flags, struct sockaddr * from, __socklen_t * fromlenaddr); | |
| 498 | int __sys_accept(int s, struct sockaddr * name, __socklen_t * anamelen); | |
| 499 | int __sys_getpeername(int fdes, struct sockaddr * asa, __socklen_t * alen); | |
| 500 | int __sys_getsockname(int fdes, struct sockaddr * asa, __socklen_t * alen); | |
| 501 | int __sys_access(const char * path, int amode); | |
| 502 | int __sys_chflags(const char * path, u_long flags); | |
| 503 | int __sys_fchflags(int fd, u_long flags); | |
| 504 | int __sys_sync(void); | |
| 505 | int __sys_kill(int pid, int signum); | |
| 506 | pid_t __sys_getppid(void); | |
| 507 | int __sys_dup(u_int fd); | |
| 508 | gid_t __sys_getegid(void); | |
| 509 | int __sys_profil(char * samples, size_t size, size_t offset, u_int scale); | |
| 510 | int __sys_ktrace(const char * fname, int ops, int facs, int pid); | |
| 511 | gid_t __sys_getgid(void); | |
| 512 | int __sys_getlogin(char * namebuf, u_int namelen); | |
| 513 | int __sys_setlogin(const char * namebuf); | |
| 514 | int __sys_acct(const char * path); | |
| 515 | int __sys_sigaltstack(const struct sigaltstack * ss, struct sigaltstack * oss); | |
| 516 | int __sys_ioctl(int fd, u_long com, char * data); | |
| 517 | int __sys_reboot(int opt); | |
| 518 | int __sys_revoke(const char * path); | |
| 519 | int __sys_symlink(const char * path, const char * link); | |
| 520 | ssize_t __sys_readlink(const char * path, char * buf, size_t count); | |
| 521 | int __sys_execve(const char * fname, char ** argv, char ** envv); | |
| 522 | mode_t __sys_umask(mode_t newmask); | |
| 523 | int __sys_chroot(const char * path); | |
| 524 | int __sys_msync(void * addr, size_t len, int flags); | |
| 525 | int __sys_vfork(void); | |
| 526 | int __sys_munmap(void * addr, size_t len); | |
| 527 | int __sys_mprotect(void * addr, size_t len, int prot); | |
| 528 | int __sys_madvise(void * addr, size_t len, int behav); | |
| 529 | int __sys_mincore(const void * addr, size_t len, char * vec); | |
| 530 | int __sys_getpgrp(void); | |
| 531 | int __sys_setpgid(int pid, int pgid); | |
| 532 | int __sys_setitimer(int which, const struct itimerval * itv, struct itimerval * oitv); | |
| 533 | int __sys_swapon(const char * name); | |
| 534 | int __sys_getitimer(int which, struct itimerval * itv); | |
| 535 | int __sys_getdtablesize(void); | |
| 536 | int __sys_dup2(u_int from, u_int to); | |
| 537 | int __sys_fcntl(int fd, int cmd, intptr_t arg); | |
| 538 | int __sys_select(int nd, fd_set * in, fd_set * ou, fd_set * ex, struct timeval * tv); | |
| 539 | int __sys_fsync(int fd); | |
| 540 | int __sys_setpriority(int which, int who, int prio); | |
| 541 | int __sys_socket(int domain, int type, int protocol); | |
| 542 | int __sys_connect(int s, const struct sockaddr * name, __socklen_t namelen); | |
| 543 | int __sys_getpriority(int which, int who); | |
| 544 | int __sys_bind(int s, const struct sockaddr * name, __socklen_t namelen); | |
| 545 | int __sys_setsockopt(int s, int level, int name, const void * val, __socklen_t valsize); | |
| 546 | int __sys_listen(int s, int backlog); | |
| 547 | int __sys_gettimeofday(struct timeval * tp, struct timezone * tzp); | |
| 548 | int __sys_getrusage(int who, struct rusage * rusage); | |
| 549 | int __sys_getsockopt(int s, int level, int name, void * val, __socklen_t * avalsize); | |
| 550 | ssize_t __sys_readv(int fd, const struct iovec * iovp, u_int iovcnt); | |
| 551 | ssize_t __sys_writev(int fd, const struct iovec * iovp, u_int iovcnt); | |
| 552 | int __sys_settimeofday(const struct timeval * tv, const struct timezone * tzp); | |
| 553 | int __sys_fchown(int fd, int uid, int gid); | |
| 554 | int __sys_fchmod(int fd, mode_t mode); | |
| 555 | int __sys_setreuid(int ruid, int euid); | |
| 556 | int __sys_setregid(int rgid, int egid); | |
| 557 | int __sys_rename(const char * from, const char * to); | |
| 558 | int __sys_flock(int fd, int how); | |
| 559 | int __sys_mkfifo(const char * path, mode_t mode); | |
| 560 | ssize_t __sys_sendto(int s, const void * buf, size_t len, int flags, const struct sockaddr * to, __socklen_t tolen); | |
| 561 | int __sys_shutdown(int s, int how); | |
| 562 | int __sys_socketpair(int domain, int type, int protocol, int * rsv); | |
| 563 | int __sys_mkdir(const char * path, mode_t mode); | |
| 564 | int __sys_rmdir(const char * path); | |
| 565 | int __sys_utimes(const char * path, const struct timeval * tptr); | |
| 566 | int __sys_adjtime(const struct timeval * delta, struct timeval * olddelta); | |
| 567 | int __sys_setsid(void); | |
| 568 | int __sys_quotactl(const char * path, int cmd, int uid, void * arg); | |
| 569 | int __sys_nlm_syscall(int debug_level, int grace_period, int addr_count, char ** addrs); | |
| 570 | int __sys_nfssvc(int flag, void * argp); | |
| 571 | int __sys_lgetfh(const char * fname, struct fhandle * fhp); | |
| 572 | int __sys_getfh(const char * fname, struct fhandle * fhp); | |
| 573 | int __sys_sysarch(int op, char * parms); | |
| 574 | int __sys_rtprio(int function, pid_t pid, struct rtprio * rtp); | |
| 575 | int __sys_semsys(int which, int a2, int a3, int a4, int a5); | |
| 576 | int __sys_msgsys(int which, int a2, int a3, int a4, int a5, int a6); | |
| 577 | int __sys_shmsys(int which, int a2, int a3, int a4); | |
| 578 | int __sys_setfib(int fibnum); | |
| 579 | int __sys_ntp_adjtime(struct timex * tp); | |
| 580 | int __sys_setgid(gid_t gid); | |
| 581 | int __sys_setegid(gid_t egid); | |
| 582 | int __sys_seteuid(uid_t euid); | |
| 583 | int __sys_pathconf(const char * path, int name); | |
| 584 | int __sys_fpathconf(int fd, int name); | |
| 585 | int __sys_getrlimit(u_int which, struct rlimit * rlp); | |
| 586 | int __sys_setrlimit(u_int which, struct rlimit * rlp); | |
| 587 | int __sys___sysctl(const int * name, u_int namelen, void * old, size_t * oldlenp, const void * new, size_t newlen); | |
| 588 | int __sys_mlock(const void * addr, size_t len); | |
| 589 | int __sys_munlock(const void * addr, size_t len); | |
| 590 | int __sys_undelete(const char * path); | |
| 591 | int __sys_futimes(int fd, const struct timeval * tptr); | |
| 592 | int __sys_getpgid(pid_t pid); | |
| 593 | int __sys_poll(struct pollfd * fds, u_int nfds, int timeout); | |
| 594 | int __sys_semget(key_t key, int nsems, int semflg); | |
| 595 | int __sys_semop(int semid, struct sembuf * sops, size_t nsops); | |
| 596 | int __sys_msgget(key_t key, int msgflg); | |
| 597 | int __sys_msgsnd(int msqid, const void * msgp, size_t msgsz, int msgflg); | |
| 598 | ssize_t __sys_msgrcv(int msqid, void * msgp, size_t msgsz, long msgtyp, int msgflg); | |
| 599 | void * __sys_shmat(int shmid, const void * shmaddr, int shmflg); | |
| 600 | int __sys_shmdt(const void * shmaddr); | |
| 601 | int __sys_shmget(key_t key, size_t size, int shmflg); | |
| 602 | int __sys_clock_gettime(clockid_t clock_id, struct timespec * tp); | |
| 603 | int __sys_clock_settime(clockid_t clock_id, const struct timespec * tp); | |
| 604 | int __sys_clock_getres(clockid_t clock_id, struct timespec * tp); | |
| 605 | int __sys_ktimer_create(clockid_t clock_id, struct sigevent * evp, int * timerid); | |
| 606 | int __sys_ktimer_delete(int timerid); | |
| 607 | int __sys_ktimer_settime(int timerid, int flags, const struct itimerspec * value, struct itimerspec * ovalue); | |
| 608 | int __sys_ktimer_gettime(int timerid, struct itimerspec * value); | |
| 609 | int __sys_ktimer_getoverrun(int timerid); | |
| 610 | int __sys_nanosleep(const struct timespec * rqtp, struct timespec * rmtp); | |
| 611 | int __sys_ffclock_getcounter(ffcounter * ffcount); | |
| 612 | int __sys_ffclock_setestimate(struct ffclock_estimate * cest); | |
| 613 | int __sys_ffclock_getestimate(struct ffclock_estimate * cest); | |
| 614 | int __sys_clock_nanosleep(clockid_t clock_id, int flags, const struct timespec * rqtp, struct timespec * rmtp); | |
| 615 | int __sys_clock_getcpuclockid2(id_t id, int which, clockid_t * clock_id); | |
| 616 | int __sys_ntp_gettime(struct ntptimeval * ntvp); | |
| 617 | int __sys_minherit(void * addr, size_t len, int inherit); | |
| 618 | int __sys_rfork(int flags); | |
| 619 | int __sys_issetugid(void); | |
| 620 | int __sys_lchown(const char * path, int uid, int gid); | |
| 621 | int __sys_aio_read(struct aiocb * aiocbp); | |
| 622 | int __sys_aio_write(struct aiocb * aiocbp); | |
| 623 | int __sys_lio_listio(int mode, struct aiocb * const * acb_list, int nent, struct sigevent * sig); | |
| 624 | int __sys_lchmod(const char * path, mode_t mode); | |
| 625 | int __sys_lutimes(const char * path, const struct timeval * tptr); | |
| 626 | ssize_t __sys_preadv(int fd, struct iovec * iovp, u_int iovcnt, off_t offset); | |
| 627 | ssize_t __sys_pwritev(int fd, struct iovec * iovp, u_int iovcnt, off_t offset); | |
| 628 | int __sys_fhopen(const struct fhandle * u_fhp, int flags); | |
| 629 | int __sys_modnext(int modid); | |
| 630 | int __sys_modstat(int modid, struct module_stat * stat); | |
| 631 | int __sys_modfnext(int modid); | |
| 632 | int __sys_modfind(const char * name); | |
| 633 | int __sys_kldload(const char * file); | |
| 634 | int __sys_kldunload(int fileid); | |
| 635 | int __sys_kldfind(const char * file); | |
| 636 | int __sys_kldnext(int fileid); | |
| 637 | int __sys_kldstat(int fileid, struct kld_file_stat * stat); | |
| 638 | int __sys_kldfirstmod(int fileid); | |
| 639 | int __sys_getsid(pid_t pid); | |
| 640 | int __sys_setresuid(uid_t ruid, uid_t euid, uid_t suid); | |
| 641 | int __sys_setresgid(gid_t rgid, gid_t egid, gid_t sgid); | |
| 642 | ssize_t __sys_aio_return(struct aiocb * aiocbp); | |
| 643 | int __sys_aio_suspend(const struct aiocb * const * aiocbp, int nent, const struct timespec * timeout); | |
| 644 | int __sys_aio_cancel(int fd, struct aiocb * aiocbp); | |
| 645 | int __sys_aio_error(struct aiocb * aiocbp); | |
| 646 | int __sys_mlockall(int how); | |
| 647 | int __sys_munlockall(void); | |
| 648 | int __sys___getcwd(char * buf, size_t buflen); | |
| 649 | int __sys_sched_setparam(pid_t pid, const struct sched_param * param); | |
| 650 | int __sys_sched_getparam(pid_t pid, struct sched_param * param); | |
| 651 | int __sys_sched_setscheduler(pid_t pid, int policy, const struct sched_param * param); | |
| 652 | int __sys_sched_getscheduler(pid_t pid); | |
| 653 | int __sys_sched_yield(void); | |
| 654 | int __sys_sched_get_priority_max(int policy); | |
| 655 | int __sys_sched_get_priority_min(int policy); | |
| 656 | int __sys_sched_rr_get_interval(pid_t pid, struct timespec * interval); | |
| 657 | int __sys_utrace(const void * addr, size_t len); | |
| 658 | int __sys_kldsym(int fileid, int cmd, void * data); | |
| 659 | int __sys_jail(struct jail * jail); | |
| 660 | int __sys_nnpfs_syscall(int operation, char * a_pathP, int a_opcode, void * a_paramsP, int a_followSymlinks); | |
| 661 | int __sys_sigprocmask(int how, const sigset_t * set, sigset_t * oset); | |
| 662 | int __sys_sigsuspend(const sigset_t * sigmask); | |
| 663 | int __sys_sigpending(sigset_t * set); | |
| 664 | int __sys_sigtimedwait(const sigset_t * set, struct __siginfo * info, const struct timespec * timeout); | |
| 665 | int __sys_sigwaitinfo(const sigset_t * set, struct __siginfo * info); | |
| 666 | int __sys___acl_get_file(const char * path, __acl_type_t type, struct acl * aclp); | |
| 667 | int __sys___acl_set_file(const char * path, __acl_type_t type, struct acl * aclp); | |
| 668 | int __sys___acl_get_fd(int filedes, __acl_type_t type, struct acl * aclp); | |
| 669 | int __sys___acl_set_fd(int filedes, __acl_type_t type, struct acl * aclp); | |
| 670 | int __sys___acl_delete_file(const char * path, __acl_type_t type); | |
| 671 | int __sys___acl_delete_fd(int filedes, __acl_type_t type); | |
| 672 | int __sys___acl_aclcheck_file(const char * path, __acl_type_t type, struct acl * aclp); | |
| 673 | int __sys___acl_aclcheck_fd(int filedes, __acl_type_t type, struct acl * aclp); | |
| 674 | int __sys_extattrctl(const char * path, int cmd, const char * filename, int attrnamespace, const char * attrname); | |
| 675 | ssize_t __sys_extattr_set_file(const char * path, int attrnamespace, const char * attrname, void * data, size_t nbytes); | |
| 676 | ssize_t __sys_extattr_get_file(const char * path, int attrnamespace, const char * attrname, void * data, size_t nbytes); | |
| 677 | int __sys_extattr_delete_file(const char * path, int attrnamespace, const char * attrname); | |
| 678 | ssize_t __sys_aio_waitcomplete(struct aiocb ** aiocbp, struct timespec * timeout); | |
| 679 | int __sys_getresuid(uid_t * ruid, uid_t * euid, uid_t * suid); | |
| 680 | int __sys_getresgid(gid_t * rgid, gid_t * egid, gid_t * sgid); | |
| 681 | int __sys_kqueue(void); | |
| 682 | ssize_t __sys_extattr_set_fd(int fd, int attrnamespace, const char * attrname, void * data, size_t nbytes); | |
| 683 | ssize_t __sys_extattr_get_fd(int fd, int attrnamespace, const char * attrname, void * data, size_t nbytes); | |
| 684 | int __sys_extattr_delete_fd(int fd, int attrnamespace, const char * attrname); | |
| 685 | int __sys___setugid(int flag); | |
| 686 | int __sys_eaccess(const char * path, int amode); | |
| 687 | int __sys_afs3_syscall(long syscall, long parm1, long parm2, long parm3, long parm4, long parm5, long parm6); | |
| 688 | int __sys_nmount(struct iovec * iovp, unsigned int iovcnt, int flags); | |
| 689 | int __sys___mac_get_proc(struct mac * mac_p); | |
| 690 | int __sys___mac_set_proc(struct mac * mac_p); | |
| 691 | int __sys___mac_get_fd(int fd, struct mac * mac_p); | |
| 692 | int __sys___mac_get_file(const char * path_p, struct mac * mac_p); | |
| 693 | int __sys___mac_set_fd(int fd, struct mac * mac_p); | |
| 694 | int __sys___mac_set_file(const char * path_p, struct mac * mac_p); | |
| 695 | int __sys_kenv(int what, const char * name, char * value, int len); | |
| 696 | int __sys_lchflags(const char * path, u_long flags); | |
| 697 | int __sys_uuidgen(struct uuid * store, int count); | |
| 698 | int __sys_sendfile(int fd, int s, off_t offset, size_t nbytes, struct sf_hdtr * hdtr, off_t * sbytes, int flags); | |
| 699 | int __sys_mac_syscall(const char * policy, int call, void * arg); | |
| 700 | int __sys_ksem_close(semid_t id); | |
| 701 | int __sys_ksem_post(semid_t id); | |
| 702 | int __sys_ksem_wait(semid_t id); | |
| 703 | int __sys_ksem_trywait(semid_t id); | |
| 704 | int __sys_ksem_init(semid_t * idp, unsigned int value); | |
| 705 | int __sys_ksem_open(semid_t * idp, const char * name, int oflag, mode_t mode, unsigned int value); | |
| 706 | int __sys_ksem_unlink(const char * name); | |
| 707 | int __sys_ksem_getvalue(semid_t id, int * val); | |
| 708 | int __sys_ksem_destroy(semid_t id); | |
| 709 | int __sys___mac_get_pid(pid_t pid, struct mac * mac_p); | |
| 710 | int __sys___mac_get_link(const char * path_p, struct mac * mac_p); | |
| 711 | int __sys___mac_set_link(const char * path_p, struct mac * mac_p); | |
| 712 | ssize_t __sys_extattr_set_link(const char * path, int attrnamespace, const char * attrname, void * data, size_t nbytes); | |
| 713 | ssize_t __sys_extattr_get_link(const char * path, int attrnamespace, const char * attrname, void * data, size_t nbytes); | |
| 714 | int __sys_extattr_delete_link(const char * path, int attrnamespace, const char * attrname); | |
| 715 | int __sys___mac_execve(const char * fname, char ** argv, char ** envv, struct mac * mac_p); | |
| 716 | int __sys_sigaction(int sig, const struct sigaction * act, struct sigaction * oact); | |
| 717 | int __sys_sigreturn(const struct __ucontext * sigcntxp); | |
| 718 | int __sys_getcontext(struct __ucontext * ucp); | |
| 719 | int __sys_setcontext(const struct __ucontext * ucp); | |
| 720 | int __sys_swapcontext(struct __ucontext * oucp, const struct __ucontext * ucp); | |
| 721 | int __sys___acl_get_link(const char * path, __acl_type_t type, struct acl * aclp); | |
| 722 | int __sys___acl_set_link(const char * path, __acl_type_t type, struct acl * aclp); | |
| 723 | int __sys___acl_delete_link(const char * path, __acl_type_t type); | |
| 724 | int __sys___acl_aclcheck_link(const char * path, __acl_type_t type, struct acl * aclp); | |
| 725 | int __sys_sigwait(const sigset_t * set, int * sig); | |
| 726 | int __sys_thr_create(ucontext_t * ctx, long * id, int flags); | |
| 727 | void __sys_thr_exit(long * state); | |
| 728 | int __sys_thr_self(long * id); | |
| 729 | int __sys_thr_kill(long id, int sig); | |
| 730 | int __sys_jail_attach(int jid); | |
| 731 | ssize_t __sys_extattr_list_fd(int fd, int attrnamespace, void * data, size_t nbytes); | |
| 732 | ssize_t __sys_extattr_list_file(const char * path, int attrnamespace, void * data, size_t nbytes); | |
| 733 | ssize_t __sys_extattr_list_link(const char * path, int attrnamespace, void * data, size_t nbytes); | |
| 734 | int __sys_ksem_timedwait(semid_t id, const struct timespec * abstime); | |
| 735 | int __sys_thr_suspend(const struct timespec * timeout); | |
| 736 | int __sys_thr_wake(long id); | |
| 737 | int __sys_kldunloadf(int fileid, int flags); | |
| 738 | int __sys_audit(const void * record, u_int length); | |
| 739 | int __sys_auditon(int cmd, void * data, u_int length); | |
| 740 | int __sys_getauid(uid_t * auid); | |
| 741 | int __sys_setauid(uid_t * auid); | |
| 742 | int __sys_getaudit(struct auditinfo * auditinfo); | |
| 743 | int __sys_setaudit(struct auditinfo * auditinfo); | |
| 744 | int __sys_getaudit_addr(struct auditinfo_addr * auditinfo_addr, u_int length); | |
| 745 | int __sys_setaudit_addr(struct auditinfo_addr * auditinfo_addr, u_int length); | |
| 746 | int __sys_auditctl(const char * path); | |
| 747 | int __sys__umtx_op(void * obj, int op, u_long val, void * uaddr1, void * uaddr2); | |
| 748 | int __sys_thr_new(struct thr_param * param, int param_size); | |
| 749 | int __sys_sigqueue(pid_t pid, int signum, void * value); | |
| 750 | int __sys_kmq_open(const char * path, int flags, mode_t mode, const struct mq_attr * attr); | |
| 751 | int __sys_kmq_setattr(int mqd, const struct mq_attr * attr, struct mq_attr * oattr); | |
| 752 | int __sys_kmq_timedreceive(int mqd, char * msg_ptr, size_t msg_len, unsigned * msg_prio, const struct timespec * abs_timeout); | |
| 753 | int __sys_kmq_timedsend(int mqd, const char * msg_ptr, size_t msg_len, unsigned msg_prio, const struct timespec * abs_timeout); | |
| 754 | int __sys_kmq_notify(int mqd, const struct sigevent * sigev); | |
| 755 | int __sys_kmq_unlink(const char * path); | |
| 756 | void __sys_abort2(const char * why, int nargs, void ** args); | |
| 757 | int __sys_thr_set_name(long id, const char * name); | |
| 758 | int __sys_aio_fsync(int op, struct aiocb * aiocbp); | |
| 759 | int __sys_rtprio_thread(int function, lwpid_t lwpid, struct rtprio * rtp); | |
| 760 | int __sys_sctp_peeloff(int sd, uint32_t name); | |
| 761 | int __sys_sctp_generic_sendmsg(int sd, void * msg, int mlen, const struct sockaddr * to, __socklen_t tolen, struct sctp_sndrcvinfo * sinfo, int flags); | |
| 762 | int __sys_sctp_generic_sendmsg_iov(int sd, struct iovec * iov, int iovlen, const struct sockaddr * to, __socklen_t tolen, struct sctp_sndrcvinfo * sinfo, int flags); | |
| 763 | int __sys_sctp_generic_recvmsg(int sd, struct iovec * iov, int iovlen, struct sockaddr * from, __socklen_t * fromlenaddr, struct sctp_sndrcvinfo * sinfo, int * msg_flags); | |
| 764 | ssize_t __sys_pread(int fd, void * buf, size_t nbyte, off_t offset); | |
| 765 | ssize_t __sys_pwrite(int fd, const void * buf, size_t nbyte, off_t offset); | |
| 766 | void * __sys_mmap(void * addr, size_t len, int prot, int flags, int fd, off_t pos); | |
| 767 | off_t __sys_lseek(int fd, off_t offset, int whence); | |
| 768 | int __sys_truncate(const char * path, off_t length); | |
| 769 | int __sys_ftruncate(int fd, off_t length); | |
| 770 | int __sys_thr_kill2(pid_t pid, long id, int sig); | |
| 771 | int __sys_shm_unlink(const char * path); | |
| 772 | int __sys_cpuset(cpusetid_t * setid); | |
| 773 | int __sys_cpuset_setid(cpuwhich_t which, id_t id, cpusetid_t setid); | |
| 774 | int __sys_cpuset_getid(cpulevel_t level, cpuwhich_t which, id_t id, cpusetid_t * setid); | |
| 775 | int __sys_cpuset_getaffinity(cpulevel_t level, cpuwhich_t which, id_t id, size_t cpusetsize, cpuset_t * mask); | |
| 776 | int __sys_cpuset_setaffinity(cpulevel_t level, cpuwhich_t which, id_t id, size_t cpusetsize, const cpuset_t * mask); | |
| 777 | int __sys_faccessat(int fd, const char * path, int amode, int flag); | |
| 778 | int __sys_fchmodat(int fd, const char * path, mode_t mode, int flag); | |
| 779 | int __sys_fchownat(int fd, const char * path, uid_t uid, gid_t gid, int flag); | |
| 780 | int __sys_fexecve(int fd, char ** argv, char ** envv); | |
| 781 | int __sys_futimesat(int fd, const char * path, const struct timeval * times); | |
| 782 | int __sys_linkat(int fd1, const char * path1, int fd2, const char * path2, int flag); | |
| 783 | int __sys_mkdirat(int fd, const char * path, mode_t mode); | |
| 784 | int __sys_mkfifoat(int fd, const char * path, mode_t mode); | |
| 785 | int __sys_openat(int fd, const char * path, int flag, mode_t mode); | |
| 786 | ssize_t __sys_readlinkat(int fd, const char * path, char * buf, size_t bufsize); | |
| 787 | int __sys_renameat(int oldfd, const char * old, int newfd, const char * new); | |
| 788 | int __sys_symlinkat(const char * path1, int fd, const char * path2); | |
| 789 | int __sys_unlinkat(int fd, const char * path, int flag); | |
| 790 | int __sys_posix_openpt(int flags); | |
| 791 | int __sys_jail_get(struct iovec * iovp, unsigned int iovcnt, int flags); | |
| 792 | int __sys_jail_set(struct iovec * iovp, unsigned int iovcnt, int flags); | |
| 793 | int __sys_jail_remove(int jid); | |
| 794 | int __sys___semctl(int semid, int semnum, int cmd, union semun * arg); | |
| 795 | int __sys_msgctl(int msqid, int cmd, struct msqid_ds * buf); | |
| 796 | int __sys_shmctl(int shmid, int cmd, struct shmid_ds * buf); | |
| 797 | int __sys_lpathconf(const char * path, int name); | |
| 798 | int __sys___cap_rights_get(int version, int fd, cap_rights_t * rightsp); | |
| 799 | int __sys_cap_enter(void); | |
| 800 | int __sys_cap_getmode(u_int * modep); | |
| 801 | int __sys_pdfork(int * fdp, int flags); | |
| 802 | int __sys_pdkill(int fd, int signum); | |
| 803 | int __sys_pdgetpid(int fd, pid_t * pidp); | |
| 804 | int __sys_pselect(int nd, fd_set * in, fd_set * ou, fd_set * ex, const struct timespec * ts, const sigset_t * sm); | |
| 805 | int __sys_getloginclass(char * namebuf, size_t namelen); | |
| 806 | int __sys_setloginclass(const char * namebuf); | |
| 807 | int __sys_rctl_get_racct(const void * inbufp, size_t inbuflen, void * outbufp, size_t outbuflen); | |
| 808 | int __sys_rctl_get_rules(const void * inbufp, size_t inbuflen, void * outbufp, size_t outbuflen); | |
| 809 | int __sys_rctl_get_limits(const void * inbufp, size_t inbuflen, void * outbufp, size_t outbuflen); | |
| 810 | int __sys_rctl_add_rule(const void * inbufp, size_t inbuflen, void * outbufp, size_t outbuflen); | |
| 811 | int __sys_rctl_remove_rule(const void * inbufp, size_t inbuflen, void * outbufp, size_t outbuflen); | |
| 812 | int __sys_posix_fallocate(int fd, off_t offset, off_t len); | |
| 813 | int __sys_posix_fadvise(int fd, off_t offset, off_t len, int advice); | |
| 814 | int __sys_wait6(idtype_t idtype, id_t id, int * status, int options, struct __wrusage * wrusage, struct __siginfo * info); | |
| 815 | int __sys_cap_rights_limit(int fd, cap_rights_t * rightsp); | |
| 816 | int __sys_cap_ioctls_limit(int fd, const u_long * cmds, size_t ncmds); | |
| 817 | ssize_t __sys_cap_ioctls_get(int fd, u_long * cmds, size_t maxcmds); | |
| 818 | int __sys_cap_fcntls_limit(int fd, uint32_t fcntlrights); | |
| 819 | int __sys_cap_fcntls_get(int fd, uint32_t * fcntlrightsp); | |
| 820 | int __sys_bindat(int fd, int s, const struct sockaddr * name, __socklen_t namelen); | |
| 821 | int __sys_connectat(int fd, int s, const struct sockaddr * name, __socklen_t namelen); | |
| 822 | int __sys_chflagsat(int fd, const char * path, u_long flags, int atflag); | |
| 823 | int __sys_accept4(int s, struct sockaddr * name, __socklen_t * anamelen, int flags); | |
| 824 | int __sys_pipe2(int * fildes, int flags); | |
| 825 | int __sys_aio_mlock(struct aiocb * aiocbp); | |
| 826 | int __sys_procctl(idtype_t idtype, id_t id, int com, void * data); | |
| 827 | int __sys_ppoll(struct pollfd * fds, u_int nfds, const struct timespec * ts, const sigset_t * set); | |
| 828 | int __sys_futimens(int fd, const struct timespec * times); | |
| 829 | int __sys_utimensat(int fd, const char * path, const struct timespec * times, int flag); | |
| 830 | int __sys_fdatasync(int fd); | |
| 831 | int __sys_fstat(int fd, struct stat * sb); | |
| 832 | int __sys_fstatat(int fd, const char * path, struct stat * buf, int flag); | |
| 833 | int __sys_fhstat(const struct fhandle * u_fhp, struct stat * sb); | |
| 834 | ssize_t __sys_getdirentries(int fd, char * buf, size_t count, off_t * basep); | |
| 835 | int __sys_statfs(const char * path, struct statfs * buf); | |
| 836 | int __sys_fstatfs(int fd, struct statfs * buf); | |
| 837 | int __sys_getfsstat(struct statfs * buf, long bufsize, int mode); | |
| 838 | int __sys_fhstatfs(const struct fhandle * u_fhp, struct statfs * buf); | |
| 839 | int __sys_mknodat(int fd, const char * path, mode_t mode, dev_t dev); | |
| 840 | int __sys_kevent(int fd, const struct kevent * changelist, int nchanges, struct kevent * eventlist, int nevents, const struct timespec * timeout); | |
| 841 | int __sys_cpuset_getdomain(cpulevel_t level, cpuwhich_t which, id_t id, size_t domainsetsize, domainset_t * mask, int * policy); | |
| 842 | int __sys_cpuset_setdomain(cpulevel_t level, cpuwhich_t which, id_t id, size_t domainsetsize, domainset_t * mask, int policy); | |
| 843 | int __sys_getrandom(void * buf, size_t buflen, unsigned int flags); | |
| 844 | int __sys_getfhat(int fd, char * path, struct fhandle * fhp, int flags); | |
| 845 | int __sys_fhlink(struct fhandle * fhp, const char * to); | |
| 846 | int __sys_fhlinkat(struct fhandle * fhp, int tofd, const char * to); | |
| 847 | int __sys_fhreadlink(struct fhandle * fhp, char * buf, size_t bufsize); | |
| 848 | int __sys_funlinkat(int dfd, const char * path, int fd, int flag); | |
| 849 | ssize_t __sys_copy_file_range(int infd, off_t * inoffp, int outfd, off_t * outoffp, size_t len, unsigned int flags); | |
| 850 | int __sys___sysctlbyname(const char * name, size_t namelen, void * old, size_t * oldlenp, void * new, size_t newlen); | |
| 851 | int __sys_shm_open2(const char * path, int flags, mode_t mode, int shmflags, const char * name); | |
| 852 | int __sys_shm_rename(const char * path_from, const char * path_to, int flags); | |
| 853 | int __sys_sigfastblock(int cmd, void * ptr); | |
| 854 | int __sys___realpathat(int fd, const char * path, char * buf, size_t size, int flags); | |
| 855 | int __sys_close_range(u_int lowfd, u_int highfd, int flags); | |
| 856 | int __sys_rpctls_syscall(uint64_t socookie); | |
| 857 | int __sys___specialfd(int type, const void * req, size_t len); | |
| 858 | int __sys_aio_writev(struct aiocb * aiocbp); | |
| 859 | int __sys_aio_readv(struct aiocb * aiocbp); | |
| 860 | int __sys_fspacectl(int fd, int cmd, const struct spacectl_range * rqsr, int flags, struct spacectl_range * rmsr); | |
| 861 | int __sys_sched_getcpu(void); | |
| 862 | int __sys_swapoff(const char * name, u_int flags); | |
| 863 | int __sys_kqueuex(u_int flags); | |
| 864 | int __sys_membarrier(int cmd, unsigned flags, int cpu_id); | |
| 865 | int __sys_timerfd_create(int clockid, int flags); | |
| 866 | int __sys_timerfd_gettime(int fd, struct itimerspec * curr_value); | |
| 867 | int __sys_timerfd_settime(int fd, int flags, const struct itimerspec * new_value, struct itimerspec * old_value); | |
| 868 | int __sys_kcmp(pid_t pid1, pid_t pid2, int type, uintptr_t idx1, uintptr_t idx2); | |
| 869 | int __sys_getrlimitusage(u_int which, int flags, rlim_t * res); | |
| 870 | int __sys_fchroot(int fd); | |
| 871 | int __sys_setcred(u_int flags, const struct setcred * wcred, size_t size); | |
| 872 | int __sys_exterrctl(u_int op, u_int flags, void * ptr); | |
| 873 | int __sys_inotify_add_watch_at(int fd, int dfd, const char * path, uint32_t mask); | |
| 874 | int __sys_inotify_rm_watch(int fd, int wd); | |
| 875 | int __sys_getgroups(int gidsetsize, gid_t * gidset); | |
| 876 | int __sys_setgroups(int gidsetsize, const gid_t * gidset); | |
| 877 | int __sys_jail_attach_jd(int fd); | |
| 878 | int __sys_jail_remove_jd(int fd); | |
| 879 | __END_DECLS | |
| 880 | ||
| 881 | #endif /* __LIBSYS_H_ */ | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/a.out.h-2| ... | ... | @@ -27,8 +27,6 @@ |
| 27 | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | * | |
| 31 | *	@(#)a.out.h	8.1 (Berkeley) 6/2/93 | |
| 32 | 30 | */ |
| 33 | 31 | |
| 34 | 32 | #ifndef	_AOUT_H_ |
lib/libc/include/generic-freebsd/aio.h+1-1| ... | ... | @@ -97,7 +97,7 @@ |
| 97 | 97 | struct __aiocb_private { |
| 98 | 98 | 	long	status; |
| 99 | 99 | 	long	error; |
| 100 | 	void	*kernelinfo; | |
| 100 | 	void	*spare; | |
| 101 | 101 | }; |
| 102 | 102 | |
| 103 | 103 | /* |
lib/libc/include/generic-freebsd/ar.h-2| ... | ... | @@ -35,8 +35,6 @@ |
| 35 | 35 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 36 | 36 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 37 | 37 | * SUCH DAMAGE. |
| 38 | * | |
| 39 | *	@(#)ar.h	8.2 (Berkeley) 1/21/94 | |
| 40 | 38 | */ |
| 41 | 39 | |
| 42 | 40 | #ifndef _AR_H_ |
lib/libc/include/generic-freebsd/arpa/ftp.h-2| ... | ... | @@ -27,8 +27,6 @@ |
| 27 | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | * | |
| 31 | *	@(#)ftp.h	8.1 (Berkeley) 6/2/93 | |
| 32 | 30 | */ |
| 33 | 31 | |
| 34 | 32 | #ifndef _ARPA_FTP_H_ |
lib/libc/include/generic-freebsd/arpa/inet.h-1| ... | ... | @@ -52,7 +52,6 @@ |
| 52 | 52 | */ |
| 53 | 53 | |
| 54 | 54 | /*% |
| 55 | *	@(#)inet.h	8.1 (Berkeley) 6/2/93 | |
| 56 | 55 | *	$Id: inet.h,v 1.3 2005/04/27 04:56:16 sra Exp $ |
| 57 | 56 | */ |
| 58 | 57 |
lib/libc/include/generic-freebsd/arpa/telnet.h-2| ... | ... | @@ -27,8 +27,6 @@ |
| 27 | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | * | |
| 31 | *	@(#)telnet.h	8.2 (Berkeley) 12/15/93 | |
| 32 | 30 | */ |
| 33 | 31 | |
| 34 | 32 | #ifndef _ARPA_TELNET_H_ |
lib/libc/include/generic-freebsd/arpa/tftp.h-2| ... | ... | @@ -27,8 +27,6 @@ |
| 27 | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | * | |
| 31 | *	@(#)tftp.h	8.1 (Berkeley) 6/2/93 | |
| 32 | 30 | */ |
| 33 | 31 | |
| 34 | 32 | #ifndef _ARPA_TFTP_H_ |
lib/libc/include/generic-freebsd/assert.h+7-2| ... | ... | @@ -32,8 +32,6 @@ |
| 32 | 32 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 33 | 33 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 34 | 34 | * SUCH DAMAGE. |
| 35 | * | |
| 36 | *	@(#)assert.h	8.2 (Berkeley) 1/21/94 | |
| 37 | 35 | */ |
| 38 | 36 | |
| 39 | 37 | #include <sys/cdefs.h> |
| ... | ... | @@ -45,15 +43,22 @@ |
| 45 | 43 | |
| 46 | 44 | #undef assert |
| 47 | 45 | #undef _assert |
| 46 | #undef __assert_unreachable | |
| 48 | 47 | |
| 49 | 48 | #ifdef NDEBUG |
| 50 | 49 | #define	assert(e)	((void)0) |
| 51 | 50 | #define	_assert(e)	((void)0) |
| 51 | #if __BSD_VISIBLE | |
| 52 | #define	__assert_unreachable()	__unreachable() | |
| 53 | #endif	/* __BSD_VISIBLE */ | |
| 52 | 54 | #else |
| 53 | 55 | #define	_assert(e)	assert(e) |
| 54 | 56 | |
| 55 | 57 | #define	assert(e)	((e) ? (void)0 : __assert(__func__, __FILE__, \ |
| 56 | 58 | 			 __LINE__, #e)) |
| 59 | #if __BSD_VISIBLE | |
| 60 | #define	__assert_unreachable()	assert(0 && "unreachable segment reached") | |
| 61 | #endif	/* __BSD_VISIBLE */ | |
| 57 | 62 | #endif /* NDEBUG */ |
| 58 | 63 | |
| 59 | 64 | #ifndef _ASSERT_H_ |
lib/libc/include/generic-freebsd/bsm/audit.h deleted-345| ... | ... | @@ -1,345 +0,0 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-3-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 2005-2009 Apple Inc. | |
| 5 | * Copyright (c) 2016 Robert N. M. Watson | |
| 6 | * All rights reserved. | |
| 7 | * | |
| 8 | * Portions of this software were developed by BAE Systems, the University of | |
| 9 | * Cambridge Computer Laboratory, and Memorial University under DARPA/AFRL | |
| 10 | * contract FA8650-15-C-7558 ("CADETS"), as part of the DARPA Transparent | |
| 11 | * Computing (TC) research program. | |
| 12 | * | |
| 13 | * Redistribution and use in source and binary forms, with or without | |
| 14 | * modification, are permitted provided that the following conditions | |
| 15 | * are met: | |
| 16 | * | |
| 17 | * 1. Redistributions of source code must retain the above copyright | |
| 18 | * notice, this list of conditions and the following disclaimer. | |
| 19 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 20 | * notice, this list of conditions and the following disclaimer in the | |
| 21 | * documentation and/or other materials provided with the distribution. | |
| 22 | * 3. Neither the name of Apple Inc. ("Apple") nor the names of | |
| 23 | * its contributors may be used to endorse or promote products derived | |
| 24 | * from this software without specific prior written permission. | |
| 25 | * | |
| 26 | * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY | |
| 27 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | |
| 28 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |
| 29 | * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY | |
| 30 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | |
| 31 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | |
| 32 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | |
| 33 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
| 34 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | |
| 35 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 36 | */ | |
| 37 | ||
| 38 | #ifndef	_BSM_AUDIT_H | |
| 39 | #define	_BSM_AUDIT_H | |
| 40 | ||
| 41 | #include <sys/param.h> | |
| 42 | #include <sys/types.h> | |
| 43 | ||
| 44 | #define	AUDIT_RECORD_MAGIC	0x828a0f1b | |
| 45 | #define	MAX_AUDIT_RECORDS	20 | |
| 46 | #define	MAXAUDITDATA		(0x8000 - 1) | |
| 47 | #define	MAX_AUDIT_RECORD_SIZE	MAXAUDITDATA | |
| 48 | #define	MIN_AUDIT_FILE_SIZE	(512 * 1024) | |
| 49 | ||
| 50 | /* | |
| 51 | * Minimum noumber of free blocks on the filesystem containing the audit | |
| 52 | * log necessary to avoid a hard log rotation. DO NOT SET THIS VALUE TO 0 | |
| 53 | * as the kernel does an unsigned compare, plus we want to leave a few blocks | |
| 54 | * free so userspace can terminate the log, etc. | |
| 55 | */ | |
| 56 | #define	AUDIT_HARD_LIMIT_FREE_BLOCKS	4 | |
| 57 | ||
| 58 | /* | |
| 59 | * Triggers for the audit daemon. | |
| 60 | */ | |
| 61 | #define	AUDIT_TRIGGER_MIN		1 | |
| 62 | #define	AUDIT_TRIGGER_LOW_SPACE		1	/* Below low watermark. */ | |
| 63 | #define	AUDIT_TRIGGER_ROTATE_KERNEL	2	/* Kernel requests rotate. */ | |
| 64 | #define	AUDIT_TRIGGER_READ_FILE		3	/* Re-read config file. */ | |
| 65 | #define	AUDIT_TRIGGER_CLOSE_AND_DIE	4	/* Terminate audit. */ | |
| 66 | #define	AUDIT_TRIGGER_NO_SPACE		5	/* Below min free space. */ | |
| 67 | #define	AUDIT_TRIGGER_ROTATE_USER	6	/* User requests rotate. */ | |
| 68 | #define	AUDIT_TRIGGER_INITIALIZE	7	/* User initialize of auditd. */ | |
| 69 | #define	AUDIT_TRIGGER_EXPIRE_TRAILS	8	/* User expiration of trails. */ | |
| 70 | #define	AUDIT_TRIGGER_MAX		8 | |
| 71 | ||
| 72 | /* | |
| 73 | * The special device filename (FreeBSD). | |
| 74 | */ | |
| 75 | #define	AUDITDEV_FILENAME	"audit" | |
| 76 | #define	AUDIT_TRIGGER_FILE	("/dev/" AUDITDEV_FILENAME) | |
| 77 | ||
| 78 | /* | |
| 79 | * Pre-defined audit IDs | |
| 80 | */ | |
| 81 | #define	AU_DEFAUDITID	(uid_t)(-1) | |
| 82 | #define	AU_DEFAUDITSID	 0 | |
| 83 | #define	AU_ASSIGN_ASID	-1 | |
| 84 | ||
| 85 | /* | |
| 86 | * IPC types. | |
| 87 | */ | |
| 88 | #define	AT_IPC_MSG	((u_char)1)	/* Message IPC id. */ | |
| 89 | #define	AT_IPC_SEM	((u_char)2)	/* Semaphore IPC id. */ | |
| 90 | #define	AT_IPC_SHM	((u_char)3)	/* Shared mem IPC id. */ | |
| 91 | ||
| 92 | /* | |
| 93 | * Audit conditions. | |
| 94 | */ | |
| 95 | #define	AUC_UNSET		0 | |
| 96 | #define	AUC_AUDITING		1 | |
| 97 | #define	AUC_NOAUDIT		2 | |
| 98 | #define	AUC_DISABLED		-1 | |
| 99 | ||
| 100 | /* | |
| 101 | * auditon(2) commands. | |
| 102 | */ | |
| 103 | #define	A_OLDGETPOLICY	2 | |
| 104 | #define	A_OLDSETPOLICY	3 | |
| 105 | #define	A_GETKMASK	4 | |
| 106 | #define	A_SETKMASK	5 | |
| 107 | #define	A_OLDGETQCTRL	6 | |
| 108 | #define	A_OLDSETQCTRL	7 | |
| 109 | #define	A_GETCWD	8 | |
| 110 | #define	A_GETCAR	9 | |
| 111 | #define	A_GETSTAT	12 | |
| 112 | #define	A_SETSTAT	13 | |
| 113 | #define	A_SETUMASK	14 | |
| 114 | #define	A_SETSMASK	15 | |
| 115 | #define	A_OLDGETCOND	20 | |
| 116 | #define	A_OLDSETCOND	21 | |
| 117 | #define	A_GETCLASS	22 | |
| 118 | #define	A_SETCLASS	23 | |
| 119 | #define	A_GETPINFO	24 | |
| 120 | #define	A_SETPMASK	25 | |
| 121 | #define	A_SETFSIZE	26 | |
| 122 | #define	A_GETFSIZE	27 | |
| 123 | #define	A_GETPINFO_ADDR	28 | |
| 124 | #define	A_GETKAUDIT	29 | |
| 125 | #define	A_SETKAUDIT	30 | |
| 126 | #define	A_SENDTRIGGER	31 | |
| 127 | #define	A_GETSINFO_ADDR	32 | |
| 128 | #define	A_GETPOLICY	33 | |
| 129 | #define	A_SETPOLICY	34 | |
| 130 | #define	A_GETQCTRL	35 | |
| 131 | #define	A_SETQCTRL	36 | |
| 132 | #define	A_GETCOND	37 | |
| 133 | #define	A_SETCOND	38 | |
| 134 | #define	A_GETEVENT	39	/* Get audit event-to-name mapping. */ | |
| 135 | #define	A_SETEVENT	40	/* Set audit event-to-name mapping. */ | |
| 136 | ||
| 137 | /* | |
| 138 | * Audit policy controls. | |
| 139 | */ | |
| 140 | #define	AUDIT_CNT	0x0001 | |
| 141 | #define	AUDIT_AHLT	0x0002 | |
| 142 | #define	AUDIT_ARGV	0x0004 | |
| 143 | #define	AUDIT_ARGE	0x0008 | |
| 144 | #define	AUDIT_SEQ	0x0010 | |
| 145 | #define	AUDIT_WINDATA	0x0020 | |
| 146 | #define	AUDIT_USER	0x0040 | |
| 147 | #define	AUDIT_GROUP	0x0080 | |
| 148 | #define	AUDIT_TRAIL	0x0100 | |
| 149 | #define	AUDIT_PATH	0x0200 | |
| 150 | #define	AUDIT_SCNT	0x0400 | |
| 151 | #define	AUDIT_PUBLIC	0x0800 | |
| 152 | #define	AUDIT_ZONENAME	0x1000 | |
| 153 | #define	AUDIT_PERZONE	0x2000 | |
| 154 | ||
| 155 | /* | |
| 156 | * Default audit queue control parameters. | |
| 157 | */ | |
| 158 | #define	AQ_HIWATER	100 | |
| 159 | #define	AQ_MAXHIGH	10000 | |
| 160 | #define	AQ_LOWATER	10 | |
| 161 | #define	AQ_BUFSZ	MAXAUDITDATA | |
| 162 | #define	AQ_MAXBUFSZ	1048576 | |
| 163 | ||
| 164 | /* | |
| 165 | * Default minimum percentage free space on file system. | |
| 166 | */ | |
| 167 | #define	AU_FS_MINFREE	20 | |
| 168 | ||
| 169 | /* | |
| 170 | * Type definitions used indicating the length of variable length addresses | |
| 171 | * in tokens containing addresses, such as header fields. | |
| 172 | */ | |
| 173 | #define	AU_IPv4		4 | |
| 174 | #define	AU_IPv6		16 | |
| 175 | ||
| 176 | __BEGIN_DECLS | |
| 177 | ||
| 178 | typedef	uid_t		au_id_t; | |
| 179 | typedef	pid_t		au_asid_t; | |
| 180 | typedef	u_int16_t	au_event_t; | |
| 181 | typedef	u_int16_t	au_emod_t; | |
| 182 | typedef	u_int32_t	au_class_t; | |
| 183 | typedef	u_int64_t	au_asflgs_t __attribute__ ((aligned (8))); | |
| 184 | ||
| 185 | struct au_tid { | |
| 186 | 	u_int32_t	port;		/* XXX dev_t compatibility */ | |
| 187 | 	u_int32_t	machine; | |
| 188 | }; | |
| 189 | typedef	struct au_tid	au_tid_t; | |
| 190 | ||
| 191 | struct au_tid_addr { | |
| 192 | 	u_int32_t	at_port;	/* XXX dev_t compatibility */ | |
| 193 | 	u_int32_t	at_type; | |
| 194 | 	u_int32_t	at_addr[4]; | |
| 195 | }; | |
| 196 | typedef	struct au_tid_addr	au_tid_addr_t; | |
| 197 | ||
| 198 | struct au_mask { | |
| 199 | 	unsigned int am_success; /* Success bits. */ | |
| 200 | 	unsigned int am_failure; /* Failure bits. */ | |
| 201 | }; | |
| 202 | typedef	struct au_mask	au_mask_t; | |
| 203 | ||
| 204 | struct auditinfo { | |
| 205 | 	au_id_t		ai_auid;	/* Audit user ID. */ | |
| 206 | 	au_mask_t	ai_mask;	/* Audit masks. */ | |
| 207 | 	au_tid_t	ai_termid;	/* Terminal ID. */ | |
| 208 | 	au_asid_t	ai_asid;	/* Audit session ID. */ | |
| 209 | }; | |
| 210 | typedef	struct auditinfo	auditinfo_t; | |
| 211 | ||
| 212 | struct auditinfo_addr { | |
| 213 | 	au_id_t		ai_auid;	/* Audit user ID. */ | |
| 214 | 	au_mask_t	ai_mask;	/* Audit masks. */ | |
| 215 | 	au_tid_addr_t	ai_termid;	/* Terminal ID. */ | |
| 216 | 	au_asid_t	ai_asid;	/* Audit session ID. */ | |
| 217 | 	au_asflgs_t	ai_flags;	/* Audit session flags. */ | |
| 218 | }; | |
| 219 | typedef	struct auditinfo_addr	auditinfo_addr_t; | |
| 220 | ||
| 221 | struct auditpinfo { | |
| 222 | 	pid_t		ap_pid;		/* ID of target process. */ | |
| 223 | 	au_id_t		ap_auid;	/* Audit user ID. */ | |
| 224 | 	au_mask_t	ap_mask;	/* Audit masks. */ | |
| 225 | 	au_tid_t	ap_termid;	/* Terminal ID. */ | |
| 226 | 	au_asid_t	ap_asid;	/* Audit session ID. */ | |
| 227 | }; | |
| 228 | typedef	struct auditpinfo	auditpinfo_t; | |
| 229 | ||
| 230 | struct auditpinfo_addr { | |
| 231 | 	pid_t		ap_pid;		/* ID of target process. */ | |
| 232 | 	au_id_t		ap_auid;	/* Audit user ID. */ | |
| 233 | 	au_mask_t	ap_mask;	/* Audit masks. */ | |
| 234 | 	au_tid_addr_t	ap_termid;	/* Terminal ID. */ | |
| 235 | 	au_asid_t	ap_asid;	/* Audit session ID. */ | |
| 236 | 	au_asflgs_t	ap_flags;	/* Audit session flags. */ | |
| 237 | }; | |
| 238 | typedef	struct auditpinfo_addr	auditpinfo_addr_t; | |
| 239 | ||
| 240 | struct au_session { | |
| 241 | 	auditinfo_addr_t	*as_aia_p;	/* Ptr to full audit info. */ | |
| 242 | 	au_mask_t		 as_mask;	/* Process Audit Masks. */ | |
| 243 | }; | |
| 244 | typedef struct au_session au_session_t; | |
| 245 | ||
| 246 | /* | |
| 247 | * Contents of token_t are opaque outside of libbsm. | |
| 248 | */ | |
| 249 | typedef	struct au_token	token_t; | |
| 250 | ||
| 251 | /* | |
| 252 | * Kernel audit queue control parameters: | |
| 253 | * 			Default:		Maximum: | |
| 254 | * 	aq_hiwater:	AQ_HIWATER (100)	AQ_MAXHIGH (10000) | |
| 255 | * 	aq_lowater:	AQ_LOWATER (10)		<aq_hiwater | |
| 256 | * 	aq_bufsz:	AQ_BUFSZ (32767)	AQ_MAXBUFSZ (1048576) | |
| 257 | * 	aq_delay:	20			20000 (not used) | |
| 258 | */ | |
| 259 | struct au_qctrl { | |
| 260 | 	int	aq_hiwater;	/* Max # of audit recs in queue when */ | |
| 261 | 				/* threads with new ARs get blocked. */ | |
| 262 | ||
| 263 | 	int	aq_lowater;	/* # of audit recs in queue when */ | |
| 264 | 				/* blocked threads get unblocked. */ | |
| 265 | ||
| 266 | 	int	aq_bufsz;	/* Max size of audit record for audit(2). */ | |
| 267 | 	int	aq_delay;	/* Queue delay (not used). */ | |
| 268 | 	int	aq_minfree;	/* Minimum filesystem percent free space. */ | |
| 269 | }; | |
| 270 | typedef	struct au_qctrl	au_qctrl_t; | |
| 271 | ||
| 272 | /* | |
| 273 | * Structure for the audit statistics. | |
| 274 | */ | |
| 275 | struct audit_stat { | |
| 276 | 	unsigned int	as_version; | |
| 277 | 	unsigned int	as_numevent; | |
| 278 | 	int		as_generated; | |
| 279 | 	int		as_nonattrib; | |
| 280 | 	int		as_kernel; | |
| 281 | 	int		as_audit; | |
| 282 | 	int		as_auditctl; | |
| 283 | 	int		as_enqueue; | |
| 284 | 	int		as_written; | |
| 285 | 	int		as_wblocked; | |
| 286 | 	int		as_rblocked; | |
| 287 | 	int		as_dropped; | |
| 288 | 	int		as_totalsize; | |
| 289 | 	unsigned int	as_memused; | |
| 290 | }; | |
| 291 | typedef	struct audit_stat	au_stat_t; | |
| 292 | ||
| 293 | /* | |
| 294 | * Structure for the audit file statistics. | |
| 295 | */ | |
| 296 | struct audit_fstat { | |
| 297 | 	u_int64_t	af_filesz; | |
| 298 | 	u_int64_t	af_currsz; | |
| 299 | }; | |
| 300 | typedef	struct audit_fstat	au_fstat_t; | |
| 301 | ||
| 302 | /* | |
| 303 | * Audit to event class mapping. | |
| 304 | */ | |
| 305 | struct au_evclass_map { | |
| 306 | 	au_event_t	ec_number; | |
| 307 | 	au_class_t	ec_class; | |
| 308 | }; | |
| 309 | typedef	struct au_evclass_map	au_evclass_map_t; | |
| 310 | ||
| 311 | /* | |
| 312 | * Event-to-name mapping. | |
| 313 | */ | |
| 314 | #define	EVNAMEMAP_NAME_SIZE	64 | |
| 315 | struct au_evname_map { | |
| 316 | 	au_event_t	en_number; | |
| 317 | 	char		en_name[EVNAMEMAP_NAME_SIZE]; | |
| 318 | }; | |
| 319 | typedef struct au_evname_map	au_evname_map_t; | |
| 320 | ||
| 321 | /* | |
| 322 | * Audit system calls. | |
| 323 | */ | |
| 324 | #if !defined(_KERNEL) && !defined(KERNEL) | |
| 325 | int	audit(const void *, int); | |
| 326 | int	auditon(int, void *, int); | |
| 327 | int	auditctl(const char *); | |
| 328 | int	getauid(au_id_t *); | |
| 329 | int	setauid(const au_id_t *); | |
| 330 | int	getaudit(struct auditinfo *); | |
| 331 | int	setaudit(const struct auditinfo *); | |
| 332 | int	getaudit_addr(struct auditinfo_addr *, int); | |
| 333 | int	setaudit_addr(const struct auditinfo_addr *, int); | |
| 334 | ||
| 335 | #ifdef __APPLE_API_PRIVATE | |
| 336 | #include <mach/port.h> | |
| 337 | mach_port_name_t audit_session_self(void); | |
| 338 | au_asid_t	 audit_session_join(mach_port_name_t port); | |
| 339 | #endif /* __APPLE_API_PRIVATE */ | |
| 340 | ||
| 341 | #endif /* defined(_KERNEL) || defined(KERNEL) */ | |
| 342 | ||
| 343 | __END_DECLS | |
| 344 | ||
| 345 | #endif /* !_BSM_AUDIT_H */ | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/bsm/audit_domain.h deleted-114| ... | ... | @@ -1,114 +0,0 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-3-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 2008 Apple Inc. | |
| 5 | * All rights reserved. | |
| 6 | * | |
| 7 | * Redistribution and use in source and binary forms, with or without | |
| 8 | * modification, are permitted provided that the following conditions | |
| 9 | * are met: | |
| 10 | * 1. Redistributions of source code must retain the above copyright | |
| 11 | * notice, this list of conditions and the following disclaimer. | |
| 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 13 | * notice, this list of conditions and the following disclaimer in the | |
| 14 | * documentation and/or other materials provided with the distribution. | |
| 15 | * 3. Neither the name of Apple Inc. ("Apple") nor the names of | |
| 16 | * its contributors may be used to endorse or promote products derived | |
| 17 | * from this software without specific prior written permission. | |
| 18 | * | |
| 19 | * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND | |
| 20 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 21 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
| 22 | * ARE DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR | |
| 23 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
| 24 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
| 25 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
| 26 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | |
| 27 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | |
| 28 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
| 29 | * POSSIBILITY OF SUCH DAMAGE. | |
| 30 | */ | |
| 31 | ||
| 32 | #ifndef _BSM_AUDIT_DOMAIN_H_ | |
| 33 | #define	_BSM_AUDIT_DOMAIN_H_ | |
| 34 | ||
| 35 | /* | |
| 36 | * BSM protocol domain constants - protocol domains defined in Solaris. | |
| 37 | */ | |
| 38 | #define	BSM_PF_UNSPEC		0 | |
| 39 | #define	BSM_PF_LOCAL		1 | |
| 40 | #define	BSM_PF_INET		2 | |
| 41 | #define	BSM_PF_IMPLINK		3 | |
| 42 | #define	BSM_PF_PUP		4 | |
| 43 | #define	BSM_PF_CHAOS		5 | |
| 44 | #define	BSM_PF_NS		6 | |
| 45 | #define	BSM_PF_NBS		7	/* Solaris-specific. */ | |
| 46 | #define	BSM_PF_ECMA		8 | |
| 47 | #define	BSM_PF_DATAKIT		9 | |
| 48 | #define	BSM_PF_CCITT		10 | |
| 49 | #define	BSM_PF_SNA		11 | |
| 50 | #define	BSM_PF_DECnet		12 | |
| 51 | #define	BSM_PF_DLI		13 | |
| 52 | #define	BSM_PF_LAT		14 | |
| 53 | #define	BSM_PF_HYLINK		15 | |
| 54 | #define	BSM_PF_APPLETALK	16 | |
| 55 | #define	BSM_PF_NIT		17	/* Solaris-specific. */ | |
| 56 | #define	BSM_PF_802		18	/* Solaris-specific. */ | |
| 57 | #define	BSM_PF_OSI		19 | |
| 58 | #define	BSM_PF_X25		20	/* Solaris/Linux-specific. */ | |
| 59 | #define	BSM_PF_OSINET		21	/* Solaris-specific. */ | |
| 60 | #define	BSM_PF_GOSIP		22	/* Solaris-specific. */ | |
| 61 | #define	BSM_PF_IPX		23 | |
| 62 | #define	BSM_PF_ROUTE		24 | |
| 63 | #define	BSM_PF_LINK		25 | |
| 64 | #define	BSM_PF_INET6		26 | |
| 65 | #define	BSM_PF_KEY		27 | |
| 66 | #define	BSM_PF_NCA		28	/* Solaris-specific. */ | |
| 67 | #define	BSM_PF_POLICY		29	/* Solaris-specific. */ | |
| 68 | #define	BSM_PF_INET_OFFLOAD	30	/* Solaris-specific. */ | |
| 69 | ||
| 70 | /* | |
| 71 | * BSM protocol domain constants - protocol domains not defined in Solaris. | |
| 72 | */ | |
| 73 | #define	BSM_PF_NETBIOS		500	/* FreeBSD/Darwin-specific. */ | |
| 74 | #define	BSM_PF_ISO		501	/* FreeBSD/Darwin-specific. */ | |
| 75 | #define	BSM_PF_XTP		502	/* FreeBSD/Darwin-specific. */ | |
| 76 | #define	BSM_PF_COIP		503	/* FreeBSD/Darwin-specific. */ | |
| 77 | #define	BSM_PF_CNT		504	/* FreeBSD/Darwin-specific. */ | |
| 78 | #define	BSM_PF_RTIP		505	/* FreeBSD/Darwin-specific. */ | |
| 79 | #define	BSM_PF_SIP		506	/* FreeBSD/Darwin-specific. */ | |
| 80 | #define	BSM_PF_PIP		507	/* FreeBSD/Darwin-specific. */ | |
| 81 | #define	BSM_PF_ISDN		508	/* FreeBSD/Darwin-specific. */ | |
| 82 | #define	BSM_PF_E164		509	/* FreeBSD/Darwin-specific. */ | |
| 83 | #define	BSM_PF_NATM		510	/* FreeBSD/Darwin-specific. */ | |
| 84 | #define	BSM_PF_ATM		511	/* FreeBSD/Darwin-specific. */ | |
| 85 | #define	BSM_PF_NETGRAPH		512	/* FreeBSD/Darwin-specific. */ | |
| 86 | #define	BSM_PF_SLOW		513	/* FreeBSD-specific. */ | |
| 87 | #define	BSM_PF_SCLUSTER		514	/* FreeBSD-specific. */ | |
| 88 | #define	BSM_PF_ARP		515	/* FreeBSD-specific. */ | |
| 89 | #define	BSM_PF_BLUETOOTH	516	/* FreeBSD-specific. */ | |
| 90 | 					/* 517: unallocated. */ | |
| 91 | #define	BSM_PF_AX25		518	/* Linux-specific. */ | |
| 92 | #define	BSM_PF_ROSE		519	/* Linux-specific. */ | |
| 93 | #define	BSM_PF_NETBEUI		520	/* Linux-specific. */ | |
| 94 | #define	BSM_PF_SECURITY		521	/* Linux-specific. */ | |
| 95 | #define	BSM_PF_PACKET		522	/* Linux-specific. */ | |
| 96 | #define	BSM_PF_ASH		523	/* Linux-specific. */ | |
| 97 | #define	BSM_PF_ECONET		524	/* Linux-specific. */ | |
| 98 | #define	BSM_PF_ATMSVC		525	/* Linux-specific. */ | |
| 99 | #define	BSM_PF_IRDA		526	/* Linux-specific. */ | |
| 100 | #define	BSM_PF_PPPOX		527	/* Linux-specific. */ | |
| 101 | #define	BSM_PF_WANPIPE		528	/* Linux-specific. */ | |
| 102 | #define	BSM_PF_LLC		529	/* Linux-specific. */ | |
| 103 | #define	BSM_PF_CAN		530	/* Linux-specific. */ | |
| 104 | #define	BSM_PF_TIPC		531	/* Linux-specific. */ | |
| 105 | #define	BSM_PF_IUCV		532	/* Linux-specific. */ | |
| 106 | #define	BSM_PF_RXRPC		533	/* Linux-specific. */ | |
| 107 | #define	BSM_PF_PHONET		534	/* Linux-specific. */ | |
| 108 | ||
| 109 | /* | |
| 110 | * Used when there is no mapping from a local to BSM protocol domain. | |
| 111 | */ | |
| 112 | #define	BSM_PF_UNKNOWN		700	/* OpenBSM-specific. */ | |
| 113 | ||
| 114 | #endif /* !_BSM_AUDIT_DOMAIN_H_ */ | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/bsm/audit_errno.h deleted-217| ... | ... | @@ -1,217 +0,0 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-3-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 2008 Apple Inc. | |
| 5 | * All rights reserved. | |
| 6 | * | |
| 7 | * Redistribution and use in source and binary forms, with or without | |
| 8 | * modification, are permitted provided that the following conditions | |
| 9 | * are met: | |
| 10 | * 1. Redistributions of source code must retain the above copyright | |
| 11 | * notice, this list of conditions and the following disclaimer. | |
| 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 13 | * notice, this list of conditions and the following disclaimer in the | |
| 14 | * documentation and/or other materials provided with the distribution. | |
| 15 | * 3. Neither the name of Apple Inc. ("Apple") nor the names of | |
| 16 | * its contributors may be used to endorse or promote products derived | |
| 17 | * from this software without specific prior written permission. | |
| 18 | * | |
| 19 | * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND | |
| 20 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 21 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
| 22 | * ARE DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR | |
| 23 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
| 24 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
| 25 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
| 26 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | |
| 27 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | |
| 28 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
| 29 | * POSSIBILITY OF SUCH DAMAGE. | |
| 30 | */ | |
| 31 | ||
| 32 | #ifndef _BSM_AUDIT_ERRNO_H_ | |
| 33 | #define	_BSM_AUDIT_ERRNO_H_ | |
| 34 | ||
| 35 | /* | |
| 36 | * For the purposes of portable encoding, we convert between local error | |
| 37 | * numbers and Solaris error numbers (as well as some extensions for error | |
| 38 | * numbers that don't exist in Solaris). Although the first 35 or so | |
| 39 | * constants are the same across all OS's, we don't handle that in any | |
| 40 | * special way. | |
| 41 | * | |
| 42 | * When adding constants here, also add them to bsm_errno.c. | |
| 43 | */ | |
| 44 | #define	BSM_ERRNO_ESUCCESS		0 | |
| 45 | #define	BSM_ERRNO_EPERM			1 | |
| 46 | #define	BSM_ERRNO_ENOENT		2 | |
| 47 | #define	BSM_ERRNO_ESRCH			3 | |
| 48 | #define	BSM_ERRNO_EINTR			4 | |
| 49 | #define	BSM_ERRNO_EIO			5 | |
| 50 | #define	BSM_ERRNO_ENXIO			6 | |
| 51 | #define	BSM_ERRNO_E2BIG			7 | |
| 52 | #define	BSM_ERRNO_ENOEXEC		8 | |
| 53 | #define	BSM_ERRNO_EBADF			9 | |
| 54 | #define	BSM_ERRNO_ECHILD		10 | |
| 55 | #define	BSM_ERRNO_EAGAIN		11 | |
| 56 | #define	BSM_ERRNO_ENOMEM		12 | |
| 57 | #define	BSM_ERRNO_EACCES		13 | |
| 58 | #define	BSM_ERRNO_EFAULT		14 | |
| 59 | #define	BSM_ERRNO_ENOTBLK		15 | |
| 60 | #define	BSM_ERRNO_EBUSY			16 | |
| 61 | #define	BSM_ERRNO_EEXIST		17 | |
| 62 | #define	BSM_ERRNO_EXDEV			18 | |
| 63 | #define	BSM_ERRNO_ENODEV		19 | |
| 64 | #define	BSM_ERRNO_ENOTDIR		20 | |
| 65 | #define	BSM_ERRNO_EISDIR		21 | |
| 66 | #define	BSM_ERRNO_EINVAL		22 | |
| 67 | #define	BSM_ERRNO_ENFILE		23 | |
| 68 | #define	BSM_ERRNO_EMFILE		24 | |
| 69 | #define	BSM_ERRNO_ENOTTY		25 | |
| 70 | #define	BSM_ERRNO_ETXTBSY		26 | |
| 71 | #define	BSM_ERRNO_EFBIG			27 | |
| 72 | #define	BSM_ERRNO_ENOSPC		28 | |
| 73 | #define	BSM_ERRNO_ESPIPE		29 | |
| 74 | #define	BSM_ERRNO_EROFS			30 | |
| 75 | #define	BSM_ERRNO_EMLINK		31 | |
| 76 | #define	BSM_ERRNO_EPIPE			32 | |
| 77 | #define	BSM_ERRNO_EDOM			33 | |
| 78 | #define	BSM_ERRNO_ERANGE		34 | |
| 79 | #define	BSM_ERRNO_ENOMSG		35 | |
| 80 | #define	BSM_ERRNO_EIDRM			36 | |
| 81 | #define	BSM_ERRNO_ECHRNG		37	/* Solaris/Linux-specific. */ | |
| 82 | #define	BSM_ERRNO_EL2NSYNC		38	/* Solaris/Linux-specific. */ | |
| 83 | #define	BSM_ERRNO_EL3HLT		39	/* Solaris/Linux-specific. */ | |
| 84 | #define	BSM_ERRNO_EL3RST		40	/* Solaris/Linux-specific. */ | |
| 85 | #define	BSM_ERRNO_ELNRNG		41	/* Solaris/Linux-specific. */ | |
| 86 | #define	BSM_ERRNO_EUNATCH		42	/* Solaris/Linux-specific. */ | |
| 87 | #define	BSM_ERRNO_ENOCSI		43	/* Solaris/Linux-specific. */ | |
| 88 | #define	BSM_ERRNO_EL2HLT		44	/* Solaris/Linux-specific. */ | |
| 89 | #define	BSM_ERRNO_EDEADLK		45 | |
| 90 | #define	BSM_ERRNO_ENOLCK		46 | |
| 91 | #define	BSM_ERRNO_ECANCELED		47 | |
| 92 | #define	BSM_ERRNO_ENOTSUP		48 | |
| 93 | #define	BSM_ERRNO_EDQUOT		49 | |
| 94 | #define	BSM_ERRNO_EBADE			50	/* Solaris/Linux-specific. */ | |
| 95 | #define	BSM_ERRNO_EBADR			51	/* Solaris/Linux-specific. */ | |
| 96 | #define	BSM_ERRNO_EXFULL		52	/* Solaris/Linux-specific. */ | |
| 97 | #define	BSM_ERRNO_ENOANO		53	/* Solaris/Linux-specific. */ | |
| 98 | #define	BSM_ERRNO_EBADRQC		54	/* Solaris/Linux-specific. */ | |
| 99 | #define	BSM_ERRNO_EBADSLT		55	/* Solaris/Linux-specific. */ | |
| 100 | #define	BSM_ERRNO_EDEADLOCK		56	/* Solaris-specific. */ | |
| 101 | #define	BSM_ERRNO_EBFONT		57	/* Solaris/Linux-specific. */ | |
| 102 | #define	BSM_ERRNO_EOWNERDEAD		58	/* Solaris/Linux-specific. */ | |
| 103 | #define	BSM_ERRNO_ENOTRECOVERABLE	59	/* Solaris/Linux-specific. */ | |
| 104 | #define	BSM_ERRNO_ENOSTR		60	/* Solaris/Darwin/Linux-specific. */ | |
| 105 | #define	BSM_ERRNO_ENODATA		61	/* Solaris/Darwin/Linux-specific. */ | |
| 106 | #define	BSM_ERRNO_ETIME			62	/* Solaris/Darwin/Linux-specific. */ | |
| 107 | #define	BSM_ERRNO_ENOSR			63	/* Solaris/Darwin/Linux-specific. */ | |
| 108 | #define	BSM_ERRNO_ENONET		64	/* Solaris/Linux-specific. */ | |
| 109 | #define	BSM_ERRNO_ENOPKG		65	/* Solaris/Linux-specific. */ | |
| 110 | #define	BSM_ERRNO_EREMOTE		66 | |
| 111 | #define	BSM_ERRNO_ENOLINK		67 | |
| 112 | #define	BSM_ERRNO_EADV			68	/* Solaris/Linux-specific. */ | |
| 113 | #define	BSM_ERRNO_ESRMNT		69	/* Solaris/Linux-specific. */ | |
| 114 | #define	BSM_ERRNO_ECOMM			70	/* Solaris/Linux-specific. */ | |
| 115 | #define	BSM_ERRNO_EPROTO		71 | |
| 116 | #define	BSM_ERRNO_ELOCKUNMAPPED		72	/* Solaris-specific. */ | |
| 117 | #define	BSM_ERRNO_ENOTACTIVE		73	/* Solaris-specific. */ | |
| 118 | #define	BSM_ERRNO_EMULTIHOP		74 | |
| 119 | #define	BSM_ERRNO_EBADMSG		77 | |
| 120 | #define	BSM_ERRNO_ENAMETOOLONG		78 | |
| 121 | #define	BSM_ERRNO_EOVERFLOW		79 | |
| 122 | #define	BSM_ERRNO_ENOTUNIQ		80	/* Solaris/Linux-specific. */ | |
| 123 | #define	BSM_ERRNO_EBADFD		81	/* Solaris/Linux-specific. */ | |
| 124 | #define	BSM_ERRNO_EREMCHG		82	/* Solaris/Linux-specific. */ | |
| 125 | #define	BSM_ERRNO_ELIBACC		83	/* Solaris/Linux-specific. */ | |
| 126 | #define	BSM_ERRNO_ELIBBAD		84	/* Solaris/Linux-specific. */ | |
| 127 | #define	BSM_ERRNO_ELIBSCN		85	/* Solaris/Linux-specific. */ | |
| 128 | #define	BSM_ERRNO_ELIBMAX		86	/* Solaris/Linux-specific. */ | |
| 129 | #define	BSM_ERRNO_ELIBEXEC		87	/* Solaris/Linux-specific. */ | |
| 130 | #define	BSM_ERRNO_EILSEQ		88 | |
| 131 | #define	BSM_ERRNO_ENOSYS		89 | |
| 132 | #define	BSM_ERRNO_ELOOP			90 | |
| 133 | #define	BSM_ERRNO_ERESTART		91 | |
| 134 | #define	BSM_ERRNO_ESTRPIPE		92	/* Solaris/Linux-specific. */ | |
| 135 | #define	BSM_ERRNO_ENOTEMPTY		93 | |
| 136 | #define	BSM_ERRNO_EUSERS		94 | |
| 137 | #define	BSM_ERRNO_ENOTSOCK		95 | |
| 138 | #define	BSM_ERRNO_EDESTADDRREQ		96 | |
| 139 | #define	BSM_ERRNO_EMSGSIZE		97 | |
| 140 | #define	BSM_ERRNO_EPROTOTYPE		98 | |
| 141 | #define	BSM_ERRNO_ENOPROTOOPT		99 | |
| 142 | #define	BSM_ERRNO_EPROTONOSUPPORT	120 | |
| 143 | #define	BSM_ERRNO_ESOCKTNOSUPPORT	121 | |
| 144 | #define	BSM_ERRNO_EOPNOTSUPP		122 | |
| 145 | #define	BSM_ERRNO_EPFNOSUPPORT		123 | |
| 146 | #define	BSM_ERRNO_EAFNOSUPPORT		124 | |
| 147 | #define	BSM_ERRNO_EADDRINUSE		125 | |
| 148 | #define	BSM_ERRNO_EADDRNOTAVAIL		126 | |
| 149 | #define	BSM_ERRNO_ENETDOWN		127 | |
| 150 | #define	BSM_ERRNO_ENETUNREACH		128 | |
| 151 | #define	BSM_ERRNO_ENETRESET		129 | |
| 152 | #define	BSM_ERRNO_ECONNABORTED		130 | |
| 153 | #define	BSM_ERRNO_ECONNRESET		131 | |
| 154 | #define	BSM_ERRNO_ENOBUFS		132 | |
| 155 | #define	BSM_ERRNO_EISCONN		133 | |
| 156 | #define	BSM_ERRNO_ENOTCONN		134 | |
| 157 | #define	BSM_ERRNO_ESHUTDOWN		143 | |
| 158 | #define	BSM_ERRNO_ETOOMANYREFS		144 | |
| 159 | #define	BSM_ERRNO_ETIMEDOUT		145 | |
| 160 | #define	BSM_ERRNO_ECONNREFUSED		146 | |
| 161 | #define	BSM_ERRNO_EHOSTDOWN		147 | |
| 162 | #define	BSM_ERRNO_EHOSTUNREACH		148 | |
| 163 | #define	BSM_ERRNO_EALREADY		149 | |
| 164 | #define	BSM_ERRNO_EINPROGRESS		150 | |
| 165 | #define	BSM_ERRNO_ESTALE		151 | |
| 166 | ||
| 167 | /* | |
| 168 | * OpenBSM constants for error numbers not defined in Solaris. In the event | |
| 169 | * that these errors are added to Solaris, we will deprecate the OpenBSM | |
| 170 | * numbers in the same way we do for audit event constants. | |
| 171 | * | |
| 172 | * ELAST doesn't get a constant in the BSM space. | |
| 173 | */ | |
| 174 | #define	BSM_ERRNO_EPROCLIM		190	/* FreeBSD/Darwin-specific. */ | |
| 175 | #define	BSM_ERRNO_EBADRPC		191	/* FreeBSD/Darwin-specific. */ | |
| 176 | #define	BSM_ERRNO_ERPCMISMATCH		192	/* FreeBSD/Darwin-specific. */ | |
| 177 | #define	BSM_ERRNO_EPROGUNAVAIL		193	/* FreeBSD/Darwin-specific. */ | |
| 178 | #define	BSM_ERRNO_EPROGMISMATCH		194	/* FreeBSD/Darwin-specific. */ | |
| 179 | #define	BSM_ERRNO_EPROCUNAVAIL		195	/* FreeBSD/Darwin-specific. */ | |
| 180 | #define	BSM_ERRNO_EFTYPE		196	/* FreeBSD/Darwin-specific. */ | |
| 181 | #define	BSM_ERRNO_EAUTH			197	/* FreeBSD/Darwin-specific. */ | |
| 182 | #define	BSM_ERRNO_ENEEDAUTH		198	/* FreeBSD/Darwin-specific. */ | |
| 183 | #define	BSM_ERRNO_ENOATTR		199	/* FreeBSD/Darwin-specific. */ | |
| 184 | #define	BSM_ERRNO_EDOOFUS		200	/* FreeBSD-specific. */ | |
| 185 | #define	BSM_ERRNO_EJUSTRETURN		201	/* FreeBSD-specific. */ | |
| 186 | #define	BSM_ERRNO_ENOIOCTL		202	/* FreeBSD-specific. */ | |
| 187 | #define	BSM_ERRNO_EDIRIOCTL		203	/* FreeBSD-specific. */ | |
| 188 | #define	BSM_ERRNO_EPWROFF		204	/* Darwin-specific. */ | |
| 189 | #define	BSM_ERRNO_EDEVERR		205	/* Darwin-specific. */ | |
| 190 | #define	BSM_ERRNO_EBADEXEC		206	/* Darwin-specific. */ | |
| 191 | #define	BSM_ERRNO_EBADARCH		207	/* Darwin-specific. */ | |
| 192 | #define	BSM_ERRNO_ESHLIBVERS		208	/* Darwin-specific. */ | |
| 193 | #define	BSM_ERRNO_EBADMACHO		209	/* Darwin-specific. */ | |
| 194 | #define	BSM_ERRNO_EPOLICY		210	/* Darwin-specific. */ | |
| 195 | #define	BSM_ERRNO_EDOTDOT		211	/* Linux-specific. */ | |
| 196 | #define	BSM_ERRNO_EUCLEAN		212	/* Linux-specific. */ | |
| 197 | #define	BSM_ERRNO_ENOTNAM		213	/* Linux(Xenix?)-specific. */ | |
| 198 | #define	BSM_ERRNO_ENAVAIL		214	/* Linux(Xenix?)-specific. */ | |
| 199 | #define	BSM_ERRNO_EISNAM		215	/* Linux(Xenix?)-specific. */ | |
| 200 | #define	BSM_ERRNO_EREMOTEIO		216	/* Linux-specific. */ | |
| 201 | #define	BSM_ERRNO_ENOMEDIUM		217	/* Linux-specific. */ | |
| 202 | #define	BSM_ERRNO_EMEDIUMTYPE		218	/* Linux-specific. */ | |
| 203 | #define	BSM_ERRNO_ENOKEY		219	/* Linux-specific. */ | |
| 204 | #define	BSM_ERRNO_EKEYEXPIRED		220	/* Linux-specific. */ | |
| 205 | #define	BSM_ERRNO_EKEYREVOKED		221	/* Linux-specific. */ | |
| 206 | #define	BSM_ERRNO_EKEYREJECTED		222	/* Linux-specific. */ | |
| 207 | #define	BSM_ERRNO_ENOTCAPABLE		223	/* FreeBSD-specific. */ | |
| 208 | #define	BSM_ERRNO_ECAPMODE		224	/* FreeBSD-specific. */ | |
| 209 | #define	BSM_ERRNO_EINTEGRITY		225	/* FreeBSD-specific. */ | |
| 210 | ||
| 211 | /* | |
| 212 | * In the event that OpenBSM doesn't have a file representation of a local | |
| 213 | * error number, use this. | |
| 214 | */ | |
| 215 | #define	BSM_ERRNO_UNKNOWN		250	/* OpenBSM-specific. */ | |
| 216 | ||
| 217 | #endif /* !_BSM_AUDIT_ERRNO_H_ */ | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/bsm/audit_fcntl.h deleted-140| ... | ... | @@ -1,140 +0,0 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-3-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 2009 Apple Inc. | |
| 5 | * All rights reserved. | |
| 6 | * | |
| 7 | * Redistribution and use in source and binary forms, with or without | |
| 8 | * modification, are permitted provided that the following conditions | |
| 9 | * are met: | |
| 10 | * 1. Redistributions of source code must retain the above copyright | |
| 11 | * notice, this list of conditions and the following disclaimer. | |
| 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 13 | * notice, this list of conditions and the following disclaimer in the | |
| 14 | * documentation and/or other materials provided with the distribution. | |
| 15 | * 3. Neither the name of Apple Inc. ("Apple") nor the names of | |
| 16 | * its contributors may be used to endorse or promote products derived | |
| 17 | * from this software without specific prior written permission. | |
| 18 | * | |
| 19 | * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND | |
| 20 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 21 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
| 22 | * ARE DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR | |
| 23 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
| 24 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
| 25 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
| 26 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | |
| 27 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | |
| 28 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
| 29 | * POSSIBILITY OF SUCH DAMAGE. | |
| 30 | */ | |
| 31 | ||
| 32 | #ifndef	_BSM_AUDIT_FCNTL_H_ | |
| 33 | #define	_BSM_AUDIT_FCNTL_H_ | |
| 34 | ||
| 35 | /* | |
| 36 | * Shared and Solaris-specific: (0-99). | |
| 37 | */ | |
| 38 | #define	BSM_F_DUPFD		0 | |
| 39 | #define	BSM_F_GETFD		1 | |
| 40 | #define	BSM_F_SETFD		2 | |
| 41 | #define	BSM_F_GETFL		3 | |
| 42 | #define	BSM_F_SETFL		4 | |
| 43 | #define	BSM_F_O_GETLK		5	/* Solaris-specific. */ | |
| 44 | #define	BSM_F_SETLK		6 | |
| 45 | #define	BSM_F_SETLKW		7 | |
| 46 | #define	BSM_F_CHKFL		8	/* Solaris-specific. */ | |
| 47 | #define	BSM_F_DUP2FD		9	/* FreeBSD/Solaris-specific. */ | |
| 48 | #define	BSM_F_ALLOCSP		10	/* Solaris-specific. */ | |
| 49 | #define	BSM_F_FREESP		11	/* Solaris-specific. */ | |
| 50 | ||
| 51 | #define	BSM_F_ISSTREAM		13	/* Solaris-specific. */ | |
| 52 | #define	BSM_F_GETLK		14	 | |
| 53 | #define	BSM_F_PRIV		15	/* Solaris-specific. */ | |
| 54 | #define	BSM_F_NPRIV		16	/* Solaris-specific. */ | |
| 55 | #define	BSM_F_QUOTACTL		17	/* Solaris-specific. */ | |
| 56 | #define	BSM_F_BLOCKS		18	/* Solaris-specific. */ | |
| 57 | #define	BSM_F_BLKSIZE		19	/* Solaris-specific. */ | |
| 58 | ||
| 59 | #define	BSM_F_GETOWN		23 | |
| 60 | #define	BSM_F_SETOWN		24 | |
| 61 | #define	BSM_F_REVOKE		25	/* Solaris-specific. */ | |
| 62 | #define	BSM_F_HASREMOTELOCKS	26	/* Solaris-specific. */ | |
| 63 | #define	BSM_F_FREESP64		27	/* Solaris-specific. */ | |
| 64 | #define	BSM_F_ALLOCSP64		28	/* Solaris-specific. */ | |
| 65 | ||
| 66 | #define	BSM_F_GETLK64		33	/* Solaris-specific. */ | |
| 67 | #define	BSM_F_SETLK64		34	/* Solaris-specific. */ | |
| 68 | #define	BSM_F_SETLKW64		35	/* Solaris-specific. */ | |
| 69 | ||
| 70 | #define	BSM_F_SHARE		40	/* Solaris-specific. */ | |
| 71 | #define	BSM_F_UNSHARE		41 	/* Solaris-specific. */ | |
| 72 | #define	BSM_F_SETLK_NBMAND	42	/* Solaris-specific. */ | |
| 73 | #define	BSM_F_SHARE_NBMAND	43	/* Solaris-specific. */ | |
| 74 | #define	BSM_F_SETLK64_NBMAND	44 	/* Solaris-specific. */ | |
| 75 | #define	BSM_F_GETXFL		45	/* Solaris-specific. */ | |
| 76 | #define	BSM_F_BADFD		46	/* Solaris-specific. */ | |
| 77 | ||
| 78 | /* | |
| 79 | * FreeBSD-specific (100-199). | |
| 80 | */ | |
| 81 | #define	BSM_F_OGETLK		107	/* FreeBSD-specific. */ | |
| 82 | #define	BSM_F_OSETLK		108	/* FreeBSD-specific. */ | |
| 83 | #define	BSM_F_OSETLKW		109	/* FreeBSD-specific. */ | |
| 84 | ||
| 85 | #define	BSM_F_SETLK_REMOTE	114	/* FreeBSD-specific. */ | |
| 86 | ||
| 87 | /* | |
| 88 | * Linux-specific (200-299). | |
| 89 | */ | |
| 90 | #define	BSM_F_SETSIG		210	/* Linux-specific. */ | |
| 91 | #define	BSM_F_GETSIG		211	/* Linux-specific. */ | |
| 92 | ||
| 93 | /* | |
| 94 | * Darwin-specific (300-399). | |
| 95 | */ | |
| 96 | #define	BSM_F_CHKCLEAN 		341	/* Darwin-specific. */ | |
| 97 | #define	BSM_F_PREALLOCATE	342	/* Darwin-specific. */ | |
| 98 | #define	BSM_F_SETSIZE		343	/* Darwin-specific. */ | |
| 99 | #define	BSM_F_RDADVISE		344	/* Darwin-specific. */ | |
| 100 | #define	BSM_F_RDAHEAD		345	/* Darwin-specific. */ | |
| 101 | #define	BSM_F_READBOOTSTRAP	346	/* Darwin-specific. */ | |
| 102 | #define	BSM_F_WRITEBOOTSTRAP	347	/* Darwin-specific. */ | |
| 103 | #define	BSM_F_NOCACHE		348	/* Darwin-specific. */ | |
| 104 | #define	BSM_F_LOG2PHYS		349	/* Darwin-specific. */ | |
| 105 | #define	BSM_F_GETPATH		350	/* Darwin-specific. */ | |
| 106 | #define	BSM_F_FULLFSYNC		351	/* Darwin-specific. */ | |
| 107 | #define	BSM_F_PATHPKG_CHECK	352	/* Darwin-specific. */ | |
| 108 | #define	BSM_F_FREEZE_FS		353	/* Darwin-specific. */ | |
| 109 | #define	BSM_F_THAW_FS		354	/* Darwin-specific. */ | |
| 110 | #define	BSM_F_GLOBAL_NOCACHE	355	/* Darwin-specific. */ | |
| 111 | #define	BSM_F_OPENFROM		356	/* Darwin-specific. */ | |
| 112 | #define	BSM_F_UNLINKFROM	357	/* Darwin-specific. */ | |
| 113 | #define	BSM_F_CHECK_OPENEVT	358	/* Darwin-specific. */ | |
| 114 | #define	BSM_F_ADDSIGS		359	/* Darwin-specific. */ | |
| 115 | #define	BSM_F_MARKDEPENDENCY	360	/* Darwin-specific. */ | |
| 116 | ||
| 117 | /* | |
| 118 | * Darwin file system specific (400-499). | |
| 119 | */ | |
| 120 | #define	BSM_F_FS_SPECIFIC_0	400	/* Darwin-fs-specific. */ | |
| 121 | #define	BSM_F_FS_SPECIFIC_1	401	/* Darwin-fs-specific. */ | |
| 122 | #define	BSM_F_FS_SPECIFIC_2	402	/* Darwin-fs-specific. */ | |
| 123 | #define	BSM_F_FS_SPECIFIC_3	403	/* Darwin-fs-specific. */ | |
| 124 | #define	BSM_F_FS_SPECIFIC_4	404	/* Darwin-fs-specific. */ | |
| 125 | #define	BSM_F_FS_SPECIFIC_5	405	/* Darwin-fs-specific. */ | |
| 126 | #define	BSM_F_FS_SPECIFIC_6	406	/* Darwin-fs-specific. */ | |
| 127 | #define	BSM_F_FS_SPECIFIC_7	407	/* Darwin-fs-specific. */ | |
| 128 | #define	BSM_F_FS_SPECIFIC_8	408	/* Darwin-fs-specific. */ | |
| 129 | #define	BSM_F_FS_SPECIFIC_9	409	/* Darwin-fs-specific. */ | |
| 130 | #define	BSM_F_FS_SPECIFIC_10	410	/* Darwin-fs-specific. */ | |
| 131 | #define	BSM_F_FS_SPECIFIC_11	411	/* Darwin-fs-specific. */ | |
| 132 | #define	BSM_F_FS_SPECIFIC_12	412	/* Darwin-fs-specific. */ | |
| 133 | #define	BSM_F_FS_SPECIFIC_13	413	/* Darwin-fs-specific. */ | |
| 134 | #define	BSM_F_FS_SPECIFIC_14	414	/* Darwin-fs-specific. */ | |
| 135 | #define	BSM_F_FS_SPECIFIC_15	415	/* Darwin-fs-specific. */ | |
| 136 | ||
| 137 | ||
| 138 | #define	BSM_F_UNKNOWN		0xFFFF	 | |
| 139 | ||
| 140 | #endif /* !_BSM_AUDIT_FCNTL_H_ */ | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/bsm/audit_internal.h deleted-117| ... | ... | @@ -1,117 +0,0 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-3-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 2005-2008 Apple Inc. | |
| 5 | * Copyright (c) 2005 SPARTA, Inc. | |
| 6 | * All rights reserved. | |
| 7 | * | |
| 8 | * This code was developed in part by Robert N. M. Watson, Senior Principal | |
| 9 | * Scientist, SPARTA, Inc. | |
| 10 | * | |
| 11 | * Redistribution and use in source and binary forms, with or without | |
| 12 | * modification, are permitted provided that the following conditions | |
| 13 | * are met: | |
| 14 | * | |
| 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 | * 3. Neither the name of Apple Inc. ("Apple") nor the names of | |
| 21 | * its contributors may be used to endorse or promote products derived | |
| 22 | * from this software without specific prior written permission. | |
| 23 | * | |
| 24 | * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY | |
| 25 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | |
| 26 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |
| 27 | * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY | |
| 28 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | |
| 29 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | |
| 30 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | |
| 31 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
| 32 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | |
| 33 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 34 | */ | |
| 35 | ||
| 36 | #ifndef _AUDIT_INTERNAL_H | |
| 37 | #define	_AUDIT_INTERNAL_H | |
| 38 | ||
| 39 | #if defined(__linux__) && !defined(__unused) | |
| 40 | #define	__unused | |
| 41 | #endif | |
| 42 | ||
| 43 | /* | |
| 44 | * audit_internal.h contains private interfaces that are shared by user space | |
| 45 | * and the kernel for the purposes of assembling audit records. Applications | |
| 46 | * should not include this file or use the APIs found within, or it may be | |
| 47 | * broken with future releases of OpenBSM, which may delete, modify, or | |
| 48 | * otherwise break these interfaces or the assumptions they rely on. | |
| 49 | */ | |
| 50 | struct au_token { | |
| 51 | 	u_char			*t_data; | |
| 52 | 	size_t			 len; | |
| 53 | 	TAILQ_ENTRY(au_token)	 tokens; | |
| 54 | }; | |
| 55 | ||
| 56 | struct au_record { | |
| 57 | 	char			 used;		/* Record currently in use? */ | |
| 58 | 	int			 desc;		/* Descriptor for record. */ | |
| 59 | 	TAILQ_HEAD(, au_token)	 token_q;	/* Queue of BSM tokens. */ | |
| 60 | 	u_char			*data; | |
| 61 | 	size_t			 len; | |
| 62 | 	LIST_ENTRY(au_record)	 au_rec_q; | |
| 63 | }; | |
| 64 | typedef	struct au_record	au_record_t; | |
| 65 | ||
| 66 | ||
| 67 | /* | |
| 68 | * We could determined the header and trailer sizes by defining appropriate | |
| 69 | * structures. We hold off that approach until we have a consistent way of | |
| 70 | * using structures for all tokens. This is not straightforward since these | |
| 71 | * token structures may contain pointers of whose contents we do not know the | |
| 72 | * size (e.g text tokens). | |
| 73 | */ | |
| 74 | #define	AUDIT_HEADER_EX_SIZE(a)	((a)->ai_termid.at_type+18+sizeof(u_int32_t)) | |
| 75 | #define	AUDIT_HEADER_SIZE	18 | |
| 76 | #define	MAX_AUDIT_HEADER_SIZE	(5*sizeof(u_int32_t)+18) | |
| 77 | #define	AUDIT_TRAILER_SIZE	7 | |
| 78 | ||
| 79 | /* | |
| 80 | * BSM token streams store fields in big endian byte order, so as to be | |
| 81 | * portable; when encoding and decoding, we must convert byte orders for | |
| 82 | * typed values. | |
| 83 | */ | |
| 84 | #define	ADD_U_CHAR(loc, val)						\ | |
| 85 | 	do {								\ | |
| 86 | 		*(loc) = (val);						\ | |
| 87 | 		(loc) += sizeof(u_char);				\ | |
| 88 | 	} while(0) | |
| 89 | ||
| 90 | ||
| 91 | #define	ADD_U_INT16(loc, val)						\ | |
| 92 | 	do {								\ | |
| 93 | 		be16enc((loc), (val));					\ | |
| 94 | 		(loc) += sizeof(u_int16_t);				\ | |
| 95 | 	} while(0) | |
| 96 | ||
| 97 | #define	ADD_U_INT32(loc, val)						\ | |
| 98 | 	do {								\ | |
| 99 | 		be32enc((loc), (val));					\ | |
| 100 | 		(loc) += sizeof(u_int32_t);				\ | |
| 101 | 	} while(0) | |
| 102 | ||
| 103 | #define	ADD_U_INT64(loc, val)						\ | |
| 104 | 	do {								\ | |
| 105 | 		be64enc((loc), (val));					\ | |
| 106 | 		(loc) += sizeof(u_int64_t); 				\ | |
| 107 | 	} while(0) | |
| 108 | ||
| 109 | #define	ADD_MEM(loc, data, size)					\ | |
| 110 | 	do {								\ | |
| 111 | 		memcpy((loc), (data), (size));				\ | |
| 112 | 		(loc) += size;						\ | |
| 113 | 	} while(0) | |
| 114 | ||
| 115 | #define	ADD_STRING(loc, data, size)	ADD_MEM(loc, data, size) | |
| 116 | ||
| 117 | #endif /* !_AUDIT_INTERNAL_H_ */ | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/bsm/audit_kevents.h deleted-851| ... | ... | @@ -1,851 +0,0 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-3-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 2005-2009 Apple Inc. | |
| 5 | * All rights reserved. | |
| 6 | * | |
| 7 | * Redistribution and use in source and binary forms, with or without | |
| 8 | * modification, are permitted provided that the following conditions | |
| 9 | * are met: | |
| 10 | * | |
| 11 | * 1. Redistributions of source code must retain the above copyright | |
| 12 | * notice, this list of conditions and the following disclaimer. | |
| 13 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 14 | * notice, this list of conditions and the following disclaimer in the | |
| 15 | * documentation and/or other materials provided with the distribution. | |
| 16 | * 3. Neither the name of Apple Inc. ("Apple") nor the names of | |
| 17 | * its contributors may be used to endorse or promote products derived | |
| 18 | * from this software without specific prior written permission. | |
| 19 | * | |
| 20 | * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY | |
| 21 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | |
| 22 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |
| 23 | * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY | |
| 24 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | |
| 25 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | |
| 26 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | |
| 27 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
| 28 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | |
| 29 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 30 | */ | |
| 31 | ||
| 32 | #ifndef _BSM_AUDIT_KEVENTS_H_ | |
| 33 | #define	_BSM_AUDIT_KEVENTS_H_ | |
| 34 | ||
| 35 | /* | |
| 36 | * The reserved event numbers for kernel events are 1...2047 and 43001..44999. | |
| 37 | */ | |
| 38 | #define	AUE_IS_A_KEVENT(e)	(((e) > 0 && (e) < 2048) ||	\ | |
| 39 | 				 ((e) > 43000 && (e) < 45000)) | |
| 40 | ||
| 41 | /* | |
| 42 | * Values marked as AUE_NULL are not required to be audited as per CAPP. | |
| 43 | * | |
| 44 | * Some conflicts exist in the assignment of name to event number mappings | |
| 45 | * between BSM implementations. In general, we prefer the OpenSolaris | |
| 46 | * definition as we consider Solaris BSM to be authoritative. _DARWIN_ has | |
| 47 | * been inserted for the Darwin variants. If necessary, other tags will be | |
| 48 | * added in the future. | |
| 49 | */ | |
| 50 | #define	AUE_NULL		0 | |
| 51 | #define	AUE_EXIT		1 | |
| 52 | #define	AUE_FORK		2 | |
| 53 | #define	AUE_FORKALL		AUE_FORK	/* Solaris-specific. */ | |
| 54 | #define	AUE_OPEN		3 | |
| 55 | #define	AUE_CREAT		4 | |
| 56 | #define	AUE_LINK		5 | |
| 57 | #define	AUE_UNLINK		6 | |
| 58 | #define	AUE_DELETE		AUE_UNLINK	/* Darwin-specific. */ | |
| 59 | #define	AUE_EXEC		7 | |
| 60 | #define	AUE_CHDIR		8 | |
| 61 | #define	AUE_MKNOD		9 | |
| 62 | #define	AUE_CHMOD		10 | |
| 63 | #define	AUE_CHOWN		11 | |
| 64 | #define	AUE_UMOUNT		12 | |
| 65 | #define	AUE_JUNK		13	/* Solaris-specific. */ | |
| 66 | #define	AUE_ACCESS		14 | |
| 67 | #define	AUE_KILL		15 | |
| 68 | #define	AUE_STAT		16 | |
| 69 | #define	AUE_LSTAT		17 | |
| 70 | #define	AUE_ACCT		18 | |
| 71 | #define	AUE_MCTL		19	/* Solaris-specific. */ | |
| 72 | #define	AUE_REBOOT		20	/* XXX: Darwin conflict. */ | |
| 73 | #define	AUE_SYMLINK		21 | |
| 74 | #define	AUE_READLINK		22 | |
| 75 | #define	AUE_EXECVE		23 | |
| 76 | #define	AUE_CHROOT		24 | |
| 77 | #define	AUE_VFORK		25 | |
| 78 | #define	AUE_SETGROUPS		26 | |
| 79 | #define	AUE_SETPGRP		27 | |
| 80 | #define	AUE_SWAPON		28 | |
| 81 | #define	AUE_SETHOSTNAME		29	/* XXX: Darwin conflict. */ | |
| 82 | #define	AUE_FCNTL		30 | |
| 83 | #define	AUE_SETPRIORITY		31	/* XXX: Darwin conflict. */ | |
| 84 | #define	AUE_CONNECT		32 | |
| 85 | #define	AUE_ACCEPT		33 | |
| 86 | #define	AUE_BIND		34 | |
| 87 | #define	AUE_SETSOCKOPT		35 | |
| 88 | #define	AUE_VTRACE		36	/* Solaris-specific. */ | |
| 89 | #define	AUE_SETTIMEOFDAY	37	/* XXX: Darwin conflict. */ | |
| 90 | #define	AUE_FCHOWN		38 | |
| 91 | #define	AUE_FCHMOD		39 | |
| 92 | #define	AUE_SETREUID		40 | |
| 93 | #define	AUE_SETREGID		41 | |
| 94 | #define	AUE_RENAME		42 | |
| 95 | #define	AUE_TRUNCATE		43	/* XXX: Darwin conflict. */ | |
| 96 | #define	AUE_FTRUNCATE		44	/* XXX: Darwin conflict. */ | |
| 97 | #define	AUE_FLOCK		45	/* XXX: Darwin conflict. */ | |
| 98 | #define	AUE_SHUTDOWN		46 | |
| 99 | #define	AUE_MKDIR		47 | |
| 100 | #define	AUE_RMDIR		48 | |
| 101 | #define	AUE_UTIMES		49 | |
| 102 | #define	AUE_ADJTIME		50 | |
| 103 | #define	AUE_SETRLIMIT		51 | |
| 104 | #define	AUE_KILLPG		52 | |
| 105 | #define	AUE_NFS_SVC		53	/* XXX: Darwin conflict. */ | |
| 106 | #define	AUE_STATFS		54 | |
| 107 | #define	AUE_FSTATFS		55 | |
| 108 | #define	AUE_UNMOUNT		56	/* XXX: Darwin conflict. */ | |
| 109 | #define	AUE_ASYNC_DAEMON	57 | |
| 110 | #define	AUE_NFS_GETFH		58	/* XXX: Darwin conflict. */ | |
| 111 | #define	AUE_SETDOMAINNAME	59 | |
| 112 | #define	AUE_QUOTACTL		60	/* XXX: Darwin conflict. */ | |
| 113 | #define	AUE_EXPORTFS		61 | |
| 114 | #define	AUE_MOUNT		62 | |
| 115 | #define	AUE_SEMSYS		63 | |
| 116 | #define	AUE_MSGSYS		64 | |
| 117 | #define	AUE_SHMSYS		65 | |
| 118 | #define	AUE_BSMSYS		66	/* Solaris-specific. */ | |
| 119 | #define	AUE_RFSSYS		67	/* Solaris-specific. */ | |
| 120 | #define	AUE_FCHDIR		68 | |
| 121 | #define	AUE_FCHROOT		69 | |
| 122 | #define	AUE_VPIXSYS		70	/* Solaris-specific. */ | |
| 123 | #define	AUE_PATHCONF		71 | |
| 124 | #define	AUE_OPEN_R		72 | |
| 125 | #define	AUE_OPEN_RC		73 | |
| 126 | #define	AUE_OPEN_RT		74 | |
| 127 | #define	AUE_OPEN_RTC		75 | |
| 128 | #define	AUE_OPEN_W		76 | |
| 129 | #define	AUE_OPEN_WC		77 | |
| 130 | #define	AUE_OPEN_WT		78 | |
| 131 | #define	AUE_OPEN_WTC		79 | |
| 132 | #define	AUE_OPEN_RW		80 | |
| 133 | #define	AUE_OPEN_RWC		81 | |
| 134 | #define	AUE_OPEN_RWT		82 | |
| 135 | #define	AUE_OPEN_RWTC		83 | |
| 136 | #define	AUE_MSGCTL		84 | |
| 137 | #define	AUE_MSGCTL_RMID		85 | |
| 138 | #define	AUE_MSGCTL_SET		86 | |
| 139 | #define	AUE_MSGCTL_STAT		87 | |
| 140 | #define	AUE_MSGGET		88 | |
| 141 | #define	AUE_MSGRCV		89 | |
| 142 | #define	AUE_MSGSND		90 | |
| 143 | #define	AUE_SHMCTL		91 | |
| 144 | #define	AUE_SHMCTL_RMID		92 | |
| 145 | #define	AUE_SHMCTL_SET		93 | |
| 146 | #define	AUE_SHMCTL_STAT		94 | |
| 147 | #define	AUE_SHMGET		95 | |
| 148 | #define	AUE_SHMAT		96 | |
| 149 | #define	AUE_SHMDT		97 | |
| 150 | #define	AUE_SEMCTL		98 | |
| 151 | #define	AUE_SEMCTL_RMID		99 | |
| 152 | #define	AUE_SEMCTL_SET		100 | |
| 153 | #define	AUE_SEMCTL_STAT		101 | |
| 154 | #define	AUE_SEMCTL_GETNCNT	102 | |
| 155 | #define	AUE_SEMCTL_GETPID	103 | |
| 156 | #define	AUE_SEMCTL_GETVAL	104 | |
| 157 | #define	AUE_SEMCTL_GETALL	105 | |
| 158 | #define	AUE_SEMCTL_GETZCNT	106 | |
| 159 | #define	AUE_SEMCTL_SETVAL	107 | |
| 160 | #define	AUE_SEMCTL_SETALL	108 | |
| 161 | #define	AUE_SEMGET		109 | |
| 162 | #define	AUE_SEMOP		110 | |
| 163 | #define	AUE_CORE		111	/* Solaris-specific, currently. */ | |
| 164 | #define	AUE_CLOSE		112 | |
| 165 | #define	AUE_SYSTEMBOOT		113	/* Solaris-specific. */ | |
| 166 | #define	AUE_ASYNC_DAEMON_EXIT	114	/* Solaris-specific. */ | |
| 167 | #define	AUE_NFSSVC_EXIT		115	/* Solaris-specific. */ | |
| 168 | #define	AUE_WRITEL		128	/* Solaris-specific. */ | |
| 169 | #define	AUE_WRITEVL		129	/* Solaris-specific. */ | |
| 170 | #define	AUE_GETAUID		130 | |
| 171 | #define	AUE_SETAUID		131 | |
| 172 | #define	AUE_GETAUDIT		132 | |
| 173 | #define	AUE_SETAUDIT		133 | |
| 174 | #define	AUE_GETUSERAUDIT	134	/* Solaris-specific. */ | |
| 175 | #define	AUE_SETUSERAUDIT	135	/* Solaris-specific. */ | |
| 176 | #define	AUE_AUDITSVC		136	/* Solaris-specific. */ | |
| 177 | #define	AUE_AUDITUSER		137	/* Solaris-specific. */ | |
| 178 | #define	AUE_AUDITON		138 | |
| 179 | #define	AUE_AUDITON_GTERMID	139	/* Solaris-specific. */ | |
| 180 | #define	AUE_AUDITON_STERMID	140	/* Solaris-specific. */ | |
| 181 | #define	AUE_AUDITON_GPOLICY	141 | |
| 182 | #define	AUE_AUDITON_SPOLICY	142 | |
| 183 | #define	AUE_AUDITON_GQCTRL	145 | |
| 184 | #define	AUE_AUDITON_SQCTRL	146 | |
| 185 | #define	AUE_GETKERNSTATE	147	/* Solaris-specific. */ | |
| 186 | #define	AUE_SETKERNSTATE	148	/* Solaris-specific. */ | |
| 187 | #define	AUE_GETPORTAUDIT	149	/* Solaris-specific. */ | |
| 188 | #define	AUE_AUDITSTAT		150	/* Solaris-specific. */ | |
| 189 | #define	AUE_REVOKE		151 | |
| 190 | #define	AUE_MAC			152	/* Solaris-specific. */ | |
| 191 | #define	AUE_ENTERPROM		153	/* Solaris-specific. */ | |
| 192 | #define	AUE_EXITPROM		154	/* Solaris-specific. */ | |
| 193 | #define	AUE_IFLOAT		155	/* Solaris-specific. */ | |
| 194 | #define	AUE_PFLOAT		156	/* Solaris-specific. */ | |
| 195 | #define	AUE_UPRIV		157	/* Solaris-specific. */ | |
| 196 | #define	AUE_IOCTL		158 | |
| 197 | #define	AUE_SOCKET		183 | |
| 198 | #define	AUE_SENDTO		184 | |
| 199 | #define	AUE_PIPE		185 | |
| 200 | #define	AUE_SOCKETPAIR		186	/* XXX: Darwin conflict. */ | |
| 201 | #define	AUE_SEND		187 | |
| 202 | #define	AUE_SENDMSG		188 | |
| 203 | #define	AUE_RECV		189 | |
| 204 | #define	AUE_RECVMSG		190 | |
| 205 | #define	AUE_RECVFROM		191 | |
| 206 | #define	AUE_READ		192 | |
| 207 | #define	AUE_GETDENTS		193 | |
| 208 | #define	AUE_LSEEK		194 | |
| 209 | #define	AUE_WRITE		195 | |
| 210 | #define	AUE_WRITEV		196 | |
| 211 | #define	AUE_NFS			197	/* Solaris-specific. */ | |
| 212 | #define	AUE_READV		198 | |
| 213 | #define	AUE_OSTAT		199	/* Solaris-specific. */ | |
| 214 | #define	AUE_SETUID		200	/* XXXRW: Solaris old setuid? */ | |
| 215 | #define	AUE_STIME		201	/* XXXRW: Solaris old stime? */ | |
| 216 | #define	AUE_UTIME		202	/* XXXRW: Solaris old utime? */ | |
| 217 | #define	AUE_NICE		203	/* XXXRW: Solaris old nice? */ | |
| 218 | #define	AUE_OSETPGRP		204	/* Solaris-specific. */ | |
| 219 | #define	AUE_SETGID		205 | |
| 220 | #define	AUE_READL		206	/* Solaris-specific. */ | |
| 221 | #define	AUE_READVL		207	/* Solaris-specific. */ | |
| 222 | #define	AUE_FSTAT		208 | |
| 223 | #define	AUE_DUP2		209 | |
| 224 | #define	AUE_MMAP		210 | |
| 225 | #define	AUE_AUDIT		211 | |
| 226 | #define	AUE_PRIOCNTLSYS		212	/* Solaris-specific. */ | |
| 227 | #define	AUE_MUNMAP		213 | |
| 228 | #define	AUE_SETEGID		214 | |
| 229 | #define	AUE_SETEUID		215 | |
| 230 | #define	AUE_PUTMSG		216	/* Solaris-specific. */ | |
| 231 | #define	AUE_GETMSG		217	/* Solaris-specific. */ | |
| 232 | #define	AUE_PUTPMSG		218	/* Solaris-specific. */ | |
| 233 | #define	AUE_GETPMSG		219	/* Solaris-specific. */ | |
| 234 | #define	AUE_AUDITSYS		220	/* Solaris-specific. */ | |
| 235 | #define	AUE_AUDITON_GETKMASK	221 | |
| 236 | #define	AUE_AUDITON_SETKMASK	222 | |
| 237 | #define	AUE_AUDITON_GETCWD	223 | |
| 238 | #define	AUE_AUDITON_GETCAR	224 | |
| 239 | #define	AUE_AUDITON_GETSTAT	225 | |
| 240 | #define	AUE_AUDITON_SETSTAT	226 | |
| 241 | #define	AUE_AUDITON_SETUMASK	227 | |
| 242 | #define	AUE_AUDITON_SETSMASK	228 | |
| 243 | #define	AUE_AUDITON_GETCOND	229 | |
| 244 | #define	AUE_AUDITON_SETCOND	230 | |
| 245 | #define	AUE_AUDITON_GETCLASS	231 | |
| 246 | #define	AUE_AUDITON_SETCLASS	232 | |
| 247 | #define	AUE_FUSERS		233	/* Solaris-specific; also UTSSYS? */ | |
| 248 | #define	AUE_STATVFS		234 | |
| 249 | #define	AUE_XSTAT		235	/* Solaris-specific. */ | |
| 250 | #define	AUE_LXSTAT		236	/* Solaris-specific. */ | |
| 251 | #define	AUE_LCHOWN		237 | |
| 252 | #define	AUE_MEMCNTL		238	/* Solaris-specific. */ | |
| 253 | #define	AUE_SYSINFO		239	/* Solaris-specific. */ | |
| 254 | #define	AUE_XMKNOD		240	/* Solaris-specific. */ | |
| 255 | #define	AUE_FORK1		241 | |
| 256 | #define	AUE_MODCTL		242	/* Solaris-specific. */ | |
| 257 | #define	AUE_MODLOAD		243 | |
| 258 | #define	AUE_MODUNLOAD		244 | |
| 259 | #define	AUE_MODCONFIG		245	/* Solaris-specific. */ | |
| 260 | #define	AUE_MODADDMAJ		246	/* Solaris-specific. */ | |
| 261 | #define	AUE_SOCKACCEPT		247	/* Solaris-specific. */ | |
| 262 | #define	AUE_SOCKCONNECT		248	/* Solaris-specific. */ | |
| 263 | #define	AUE_SOCKSEND		249	/* Solaris-specific. */ | |
| 264 | #define	AUE_SOCKRECEIVE		250	/* Solaris-specific. */ | |
| 265 | #define	AUE_ACLSET		251 | |
| 266 | #define	AUE_FACLSET		252 | |
| 267 | #define	AUE_DOORFS		253	/* Solaris-specific. */ | |
| 268 | #define	AUE_DOORFS_DOOR_CALL	254	/* Solaris-specific. */ | |
| 269 | #define	AUE_DOORFS_DOOR_RETURN	255	/* Solaris-specific. */ | |
| 270 | #define	AUE_DOORFS_DOOR_CREATE	256	/* Solaris-specific. */ | |
| 271 | #define	AUE_DOORFS_DOOR_REVOKE	257	/* Solaris-specific. */ | |
| 272 | #define	AUE_DOORFS_DOOR_INFO	258	/* Solaris-specific. */ | |
| 273 | #define	AUE_DOORFS_DOOR_CRED	259	/* Solaris-specific. */ | |
| 274 | #define	AUE_DOORFS_DOOR_BIND	260	/* Solaris-specific. */ | |
| 275 | #define	AUE_DOORFS_DOOR_UNBIND	261	/* Solaris-specific. */ | |
| 276 | #define	AUE_P_ONLINE		262	/* Solaris-specific. */ | |
| 277 | #define	AUE_PROCESSOR_BIND	263	/* Solaris-specific. */ | |
| 278 | #define	AUE_INST_SYNC		264	/* Solaris-specific. */ | |
| 279 | #define	AUE_SOCKCONFIG		265	/* Solaris-specific. */ | |
| 280 | #define	AUE_SETAUDIT_ADDR	266 | |
| 281 | #define	AUE_GETAUDIT_ADDR	267 | |
| 282 | #define	AUE_UMOUNT2		268	/* Solaris-specific. */ | |
| 283 | #define	AUE_FSAT		269	/* Solaris-specific. */ | |
| 284 | #define	AUE_OPENAT_R		270 | |
| 285 | #define	AUE_OPENAT_RC		271 | |
| 286 | #define	AUE_OPENAT_RT		272 | |
| 287 | #define	AUE_OPENAT_RTC		273 | |
| 288 | #define	AUE_OPENAT_W		274 | |
| 289 | #define	AUE_OPENAT_WC		275 | |
| 290 | #define	AUE_OPENAT_WT		276 | |
| 291 | #define	AUE_OPENAT_WTC		277 | |
| 292 | #define	AUE_OPENAT_RW		278 | |
| 293 | #define	AUE_OPENAT_RWC		279 | |
| 294 | #define	AUE_OPENAT_RWT		280 | |
| 295 | #define	AUE_OPENAT_RWTC		281 | |
| 296 | #define	AUE_RENAMEAT		282 | |
| 297 | #define	AUE_FSTATAT		283 | |
| 298 | #define	AUE_FCHOWNAT		284 | |
| 299 | #define	AUE_FUTIMESAT		285 | |
| 300 | #define	AUE_UNLINKAT		286 | |
| 301 | #define	AUE_CLOCK_SETTIME	287 | |
| 302 | #define	AUE_NTP_ADJTIME		288 | |
| 303 | #define	AUE_SETPPRIV		289	/* Solaris-specific. */ | |
| 304 | #define	AUE_MODDEVPLCY		290	/* Solaris-specific. */ | |
| 305 | #define	AUE_MODADDPRIV		291	/* Solaris-specific. */ | |
| 306 | #define	AUE_CRYPTOADM		292	/* Solaris-specific. */ | |
| 307 | #define	AUE_CONFIGKSSL		293	/* Solaris-specific. */ | |
| 308 | #define	AUE_BRANDSYS		294	/* Solaris-specific. */ | |
| 309 | #define	AUE_PF_POLICY_ADDRULE	295	/* Solaris-specific. */ | |
| 310 | #define	AUE_PF_POLICY_DELRULE	296	/* Solaris-specific. */ | |
| 311 | #define	AUE_PF_POLICY_CLONE	297	/* Solaris-specific. */ | |
| 312 | #define	AUE_PF_POLICY_FLIP	298	/* Solaris-specific. */ | |
| 313 | #define	AUE_PF_POLICY_FLUSH	299	/* Solaris-specific. */ | |
| 314 | #define	AUE_PF_POLICY_ALGS	300	/* Solaris-specific. */ | |
| 315 | #define	AUE_PORTFS		301	/* Solaris-specific. */ | |
| 316 | ||
| 317 | /* | |
| 318 | * Events added for Apple Darwin that potentially collide with future Solaris | |
| 319 | * BSM events. These are assigned AUE_DARWIN prefixes, and are deprecated in | |
| 320 | * new trails. Systems generating these events should switch to the new | |
| 321 | * identifiers that avoid colliding with the Solaris identifier space. | |
| 322 | */ | |
| 323 | #define	AUE_DARWIN_GETFSSTAT	301 | |
| 324 | #define	AUE_DARWIN_PTRACE	302 | |
| 325 | #define	AUE_DARWIN_CHFLAGS	303 | |
| 326 | #define	AUE_DARWIN_FCHFLAGS	304 | |
| 327 | #define	AUE_DARWIN_PROFILE	305 | |
| 328 | #define	AUE_DARWIN_KTRACE	306 | |
| 329 | #define	AUE_DARWIN_SETLOGIN	307 | |
| 330 | #define	AUE_DARWIN_REBOOT	308 | |
| 331 | #define	AUE_DARWIN_REVOKE	309 | |
| 332 | #define	AUE_DARWIN_UMASK	310 | |
| 333 | #define	AUE_DARWIN_MPROTECT	311 | |
| 334 | #define	AUE_DARWIN_SETPRIORITY	312 | |
| 335 | #define	AUE_DARWIN_SETTIMEOFDAY	313 | |
| 336 | #define	AUE_DARWIN_FLOCK	314 | |
| 337 | #define	AUE_DARWIN_MKFIFO	315 | |
| 338 | #define	AUE_DARWIN_POLL		316 | |
| 339 | #define	AUE_DARWIN_SOCKETPAIR	317 | |
| 340 | #define	AUE_DARWIN_FUTIMES	318 | |
| 341 | #define	AUE_DARWIN_SETSID	319 | |
| 342 | #define	AUE_DARWIN_SETPRIVEXEC	320	/* Darwin-specific. */ | |
| 343 | #define	AUE_DARWIN_NFSSVC	321 | |
| 344 | #define	AUE_DARWIN_GETFH	322 | |
| 345 | #define	AUE_DARWIN_QUOTACTL	323 | |
| 346 | #define	AUE_DARWIN_ADDPROFILE	324	/* Darwin-specific. */ | |
| 347 | #define	AUE_DARWIN_KDEBUGTRACE	325	/* Darwin-specific. */ | |
| 348 | #define	AUE_DARWIN_KDBUGTRACE	AUE_KDEBUGTRACE | |
| 349 | #define	AUE_DARWIN_FSTAT	326 | |
| 350 | #define	AUE_DARWIN_FPATHCONF	327 | |
| 351 | #define	AUE_DARWIN_GETDIRENTRIES	328 | |
| 352 | #define	AUE_DARWIN_TRUNCATE	329 | |
| 353 | #define	AUE_DARWIN_FTRUNCATE	330 | |
| 354 | #define	AUE_DARWIN_SYSCTL	331 | |
| 355 | #define	AUE_DARWIN_MLOCK	332 | |
| 356 | #define	AUE_DARWIN_MUNLOCK	333 | |
| 357 | #define	AUE_DARWIN_UNDELETE	334 | |
| 358 | #define	AUE_DARWIN_GETATTRLIST	335	/* Darwin-specific. */ | |
| 359 | #define	AUE_DARWIN_SETATTRLIST	336	/* Darwin-specific. */ | |
| 360 | #define	AUE_DARWIN_GETDIRENTRIESATTR	337	/* Darwin-specific. */ | |
| 361 | #define	AUE_DARWIN_EXCHANGEDATA	338	/* Darwin-specific. */ | |
| 362 | #define	AUE_DARWIN_SEARCHFS	339	/* Darwin-specific. */ | |
| 363 | #define	AUE_DARWIN_MINHERIT	340 | |
| 364 | #define	AUE_DARWIN_SEMCONFIG	341 | |
| 365 | #define	AUE_DARWIN_SEMOPEN	342 | |
| 366 | #define	AUE_DARWIN_SEMCLOSE	343 | |
| 367 | #define	AUE_DARWIN_SEMUNLINK	344 | |
| 368 | #define	AUE_DARWIN_SHMOPEN	345 | |
| 369 | #define	AUE_DARWIN_SHMUNLINK	346 | |
| 370 | #define	AUE_DARWIN_LOADSHFILE	347	/* Darwin-specific. */ | |
| 371 | #define	AUE_DARWIN_RESETSHFILE	348	/* Darwin-specific. */ | |
| 372 | #define	AUE_DARWIN_NEWSYSTEMSHREG	349	/* Darwin-specific. */ | |
| 373 | #define	AUE_DARWIN_PTHREADKILL	350	/* Darwin-specific. */ | |
| 374 | #define	AUE_DARWIN_PTHREADSIGMASK	351	/* Darwin-specific. */ | |
| 375 | #define	AUE_DARWIN_AUDITCTL	352 | |
| 376 | #define	AUE_DARWIN_RFORK	353 | |
| 377 | #define	AUE_DARWIN_LCHMOD	354 | |
| 378 | #define	AUE_DARWIN_SWAPOFF	355 | |
| 379 | #define	AUE_DARWIN_INITPROCESS	356	/* Darwin-specific. */ | |
| 380 | #define	AUE_DARWIN_MAPFD	357	/* Darwin-specific. */ | |
| 381 | #define	AUE_DARWIN_TASKFORPID	358	/* Darwin-specific. */ | |
| 382 | #define	AUE_DARWIN_PIDFORTASK	359	/* Darwin-specific. */ | |
| 383 | #define	AUE_DARWIN_SYSCTL_NONADMIN	360 | |
| 384 | #define	AUE_DARWIN_COPYFILE	361	/* Darwin-specific. */ | |
| 385 | ||
| 386 | /* | |
| 387 | * Audit event identifiers added as part of OpenBSM, generally corresponding | |
| 388 | * to events in FreeBSD, Darwin, and Linux that were not present in Solaris. | |
| 389 | * These often duplicate events added to the Solaris set by Darwin, but use | |
| 390 | * event identifiers in a higher range in order to avoid colliding with | |
| 391 | * future Solaris additions. | |
| 392 | * | |
| 393 | * If an event in this section is later added to Solaris, we prefer the | |
| 394 | * Solaris event identifier, and add _OPENBSM_ to the OpenBSM-specific | |
| 395 | * identifier so that old trails can still be processed, but new trails use | |
| 396 | * the Solaris identifier. | |
| 397 | */ | |
| 398 | #define	AUE_GETFSSTAT		43001 | |
| 399 | #define	AUE_PTRACE		43002 | |
| 400 | #define	AUE_CHFLAGS		43003 | |
| 401 | #define	AUE_FCHFLAGS		43004 | |
| 402 | #define	AUE_PROFILE		43005 | |
| 403 | #define	AUE_KTRACE		43006 | |
| 404 | #define	AUE_SETLOGIN		43007 | |
| 405 | #define	AUE_OPENBSM_REVOKE	43008	/* Solaris event now preferred. */ | |
| 406 | #define	AUE_UMASK		43009 | |
| 407 | #define	AUE_MPROTECT		43010 | |
| 408 | #define	AUE_MKFIFO		43011 | |
| 409 | #define	AUE_POLL		43012 | |
| 410 | #define	AUE_FUTIMES		43013 | |
| 411 | #define	AUE_SETSID		43014 | |
| 412 | #define	AUE_SETPRIVEXEC		43015	/* Darwin-specific. */ | |
| 413 | #define	AUE_ADDPROFILE		43016	/* Darwin-specific. */ | |
| 414 | #define	AUE_KDEBUGTRACE		43017	/* Darwin-specific. */ | |
| 415 | #define	AUE_KDBUGTRACE		AUE_KDEBUGTRACE | |
| 416 | #define	AUE_OPENBSM_FSTAT	43018	/* Solaris event now preferred. */ | |
| 417 | #define	AUE_FPATHCONF		43019 | |
| 418 | #define	AUE_GETDIRENTRIES	43020 | |
| 419 | #define	AUE_SYSCTL		43021 | |
| 420 | #define	AUE_MLOCK		43022 | |
| 421 | #define	AUE_MUNLOCK		43023 | |
| 422 | #define	AUE_UNDELETE		43024 | |
| 423 | #define	AUE_GETATTRLIST		43025	/* Darwin-specific. */ | |
| 424 | #define	AUE_SETATTRLIST		43026	/* Darwin-specific. */ | |
| 425 | #define	AUE_GETDIRENTRIESATTR	43027	/* Darwin-specific. */ | |
| 426 | #define	AUE_EXCHANGEDATA	43028	/* Darwin-specific. */ | |
| 427 | #define	AUE_SEARCHFS		43029	/* Darwin-specific. */ | |
| 428 | #define	AUE_MINHERIT		43030 | |
| 429 | #define	AUE_SEMCONFIG		43031 | |
| 430 | #define	AUE_SEMOPEN		43032 | |
| 431 | #define	AUE_SEMCLOSE		43033 | |
| 432 | #define	AUE_SEMUNLINK		43034 | |
| 433 | #define	AUE_SHMOPEN		43035 | |
| 434 | #define	AUE_SHMUNLINK		43036 | |
| 435 | #define	AUE_LOADSHFILE		43037	/* Darwin-specific. */ | |
| 436 | #define	AUE_RESETSHFILE		43038	/* Darwin-specific. */ | |
| 437 | #define	AUE_NEWSYSTEMSHREG	43039	/* Darwin-specific. */ | |
| 438 | #define	AUE_PTHREADKILL		43040	/* Darwin-specific. */ | |
| 439 | #define	AUE_PTHREADSIGMASK	43041	/* Darwin-specific. */ | |
| 440 | #define	AUE_AUDITCTL		43042 | |
| 441 | #define	AUE_RFORK		43043 | |
| 442 | #define	AUE_LCHMOD		43044 | |
| 443 | #define	AUE_SWAPOFF		43045 | |
| 444 | #define	AUE_INITPROCESS		43046	/* Darwin-specific. */ | |
| 445 | #define	AUE_MAPFD		43047	/* Darwin-specific. */ | |
| 446 | #define	AUE_TASKFORPID		43048	/* Darwin-specific. */ | |
| 447 | #define	AUE_PIDFORTASK		43049	/* Darwin-specific. */ | |
| 448 | #define	AUE_SYSCTL_NONADMIN	43050 | |
| 449 | #define	AUE_COPYFILE		43051	/* Darwin-specific. */ | |
| 450 | ||
| 451 | /* | |
| 452 | * Events added to OpenBSM for FreeBSD and Linux; may also be used by Darwin | |
| 453 | * in the future. | |
| 454 | */ | |
| 455 | #define	AUE_LUTIMES		43052 | |
| 456 | #define	AUE_LCHFLAGS		43053	/* FreeBSD-specific. */ | |
| 457 | #define	AUE_SENDFILE		43054	/* BSD/Linux-specific. */ | |
| 458 | #define	AUE_USELIB		43055	/* Linux-specific. */ | |
| 459 | #define	AUE_GETRESUID		43056 | |
| 460 | #define	AUE_SETRESUID		43057 | |
| 461 | #define	AUE_GETRESGID		43058 | |
| 462 | #define	AUE_SETRESGID		43059 | |
| 463 | #define	AUE_WAIT4		43060	/* FreeBSD-specific. */ | |
| 464 | #define	AUE_LGETFH		43061	/* FreeBSD-specific. */ | |
| 465 | #define	AUE_FHSTATFS		43062	/* FreeBSD-specific. */ | |
| 466 | #define	AUE_FHOPEN		43063	/* FreeBSD-specific. */ | |
| 467 | #define	AUE_FHSTAT		43064	/* FreeBSD-specific. */ | |
| 468 | #define	AUE_JAIL		43065	/* FreeBSD-specific. */ | |
| 469 | #define	AUE_EACCESS		43066	/* FreeBSD-specific. */ | |
| 470 | #define	AUE_KQUEUE		43067	/* FreeBSD-specific. */ | |
| 471 | #define	AUE_KEVENT		43068	/* FreeBSD-specific. */ | |
| 472 | #define	AUE_FSYNC		43069 | |
| 473 | #define	AUE_NMOUNT		43070	/* FreeBSD-specific. */ | |
| 474 | #define	AUE_BDFLUSH		43071	/* Linux-specific. */ | |
| 475 | #define	AUE_SETFSUID		43072	/* Linux-specific. */ | |
| 476 | #define	AUE_SETFSGID		43073	/* Linux-specific. */ | |
| 477 | #define	AUE_PERSONALITY		43074	/* Linux-specific. */ | |
| 478 | #define	AUE_SCHED_GETSCHEDULER	43075	/* POSIX.1b. */ | |
| 479 | #define	AUE_SCHED_SETSCHEDULER	43076	/* POSIX.1b. */ | |
| 480 | #define	AUE_PRCTL		43077	/* Linux-specific. */ | |
| 481 | #define	AUE_GETCWD		43078	/* FreeBSD/Linux-specific. */ | |
| 482 | #define	AUE_CAPGET		43079	/* Linux-specific. */ | |
| 483 | #define	AUE_CAPSET		43080	/* Linux-specific. */ | |
| 484 | #define	AUE_PIVOT_ROOT		43081	/* Linux-specific. */ | |
| 485 | #define	AUE_RTPRIO		43082	/* FreeBSD-specific. */ | |
| 486 | #define	AUE_SCHED_GETPARAM	43083	/* POSIX.1b. */ | |
| 487 | #define	AUE_SCHED_SETPARAM	43084	/* POSIX.1b. */ | |
| 488 | #define	AUE_SCHED_GET_PRIORITY_MAX	43085	/* POSIX.1b. */ | |
| 489 | #define	AUE_SCHED_GET_PRIORITY_MIN	43086	/* POSIX.1b. */ | |
| 490 | #define	AUE_SCHED_RR_GET_INTERVAL	43087	/* POSIX.1b. */ | |
| 491 | #define	AUE_ACL_GET_FILE	43088	/* FreeBSD. */ | |
| 492 | #define	AUE_ACL_SET_FILE	43089	/* FreeBSD. */ | |
| 493 | #define	AUE_ACL_GET_FD		43090	/* FreeBSD. */ | |
| 494 | #define	AUE_ACL_SET_FD		43091	/* FreeBSD. */ | |
| 495 | #define	AUE_ACL_DELETE_FILE	43092	/* FreeBSD. */ | |
| 496 | #define	AUE_ACL_DELETE_FD	43093	/* FreeBSD. */ | |
| 497 | #define	AUE_ACL_CHECK_FILE	43094	/* FreeBSD. */ | |
| 498 | #define	AUE_ACL_CHECK_FD	43095	/* FreeBSD. */ | |
| 499 | #define	AUE_ACL_GET_LINK	43096	/* FreeBSD. */ | |
| 500 | #define	AUE_ACL_SET_LINK	43097	/* FreeBSD. */ | |
| 501 | #define	AUE_ACL_DELETE_LINK	43098	/* FreeBSD. */ | |
| 502 | #define	AUE_ACL_CHECK_LINK	43099	/* FreeBSD. */ | |
| 503 | #define	AUE_SYSARCH		43100	/* FreeBSD. */ | |
| 504 | #define	AUE_EXTATTRCTL		43101	/* FreeBSD. */ | |
| 505 | #define	AUE_EXTATTR_GET_FILE	43102	/* FreeBSD. */ | |
| 506 | #define	AUE_EXTATTR_SET_FILE	43103	/* FreeBSD. */ | |
| 507 | #define	AUE_EXTATTR_LIST_FILE	43104	/* FreeBSD. */ | |
| 508 | #define	AUE_EXTATTR_DELETE_FILE	43105	/* FreeBSD. */ | |
| 509 | #define	AUE_EXTATTR_GET_FD	43106	/* FreeBSD. */ | |
| 510 | #define	AUE_EXTATTR_SET_FD	43107	/* FreeBSD. */ | |
| 511 | #define	AUE_EXTATTR_LIST_FD	43108	/* FreeBSD. */ | |
| 512 | #define	AUE_EXTATTR_DELETE_FD	43109	/* FreeBSD. */ | |
| 513 | #define	AUE_EXTATTR_GET_LINK	43110	/* FreeBSD. */ | |
| 514 | #define	AUE_EXTATTR_SET_LINK	43111	/* FreeBSD. */ | |
| 515 | #define	AUE_EXTATTR_LIST_LINK	43112	/* FreeBSD. */ | |
| 516 | #define	AUE_EXTATTR_DELETE_LINK	43113	/* FreeBSD. */ | |
| 517 | #define	AUE_KENV		43114	/* FreeBSD. */ | |
| 518 | #define	AUE_JAIL_ATTACH		43115	/* FreeBSD. */ | |
| 519 | #define	AUE_SYSCTL_WRITE	43116	/* FreeBSD. */ | |
| 520 | #define	AUE_IOPERM		43117	/* Linux. */ | |
| 521 | #define	AUE_READDIR		43118	/* Linux. */ | |
| 522 | #define	AUE_IOPL		43119	/* Linux. */ | |
| 523 | #define	AUE_VM86		43120	/* Linux. */ | |
| 524 | #define	AUE_MAC_GET_PROC	43121	/* FreeBSD/Darwin. */ | |
| 525 | #define	AUE_MAC_SET_PROC	43122	/* FreeBSD/Darwin. */ | |
| 526 | #define	AUE_MAC_GET_FD		43123	/* FreeBSD/Darwin. */ | |
| 527 | #define	AUE_MAC_GET_FILE	43124	/* FreeBSD/Darwin. */ | |
| 528 | #define	AUE_MAC_SET_FD		43125	/* FreeBSD/Darwin. */ | |
| 529 | #define	AUE_MAC_SET_FILE	43126	/* FreeBSD/Darwin. */ | |
| 530 | #define	AUE_MAC_SYSCALL		43127	/* FreeBSD. */ | |
| 531 | #define	AUE_MAC_GET_PID		43128	/* FreeBSD/Darwin. */ | |
| 532 | #define	AUE_MAC_GET_LINK	43129	/* FreeBSD/Darwin. */ | |
| 533 | #define	AUE_MAC_SET_LINK	43130	/* FreeBSD/Darwin. */ | |
| 534 | #define	AUE_MAC_EXECVE		43131	/* FreeBSD/Darwin. */ | |
| 535 | #define	AUE_GETPATH_FROMFD	43132	/* FreeBSD. */ | |
| 536 | #define	AUE_GETPATH_FROMADDR	43133	/* FreeBSD. */ | |
| 537 | #define	AUE_MQ_OPEN		43134	/* FreeBSD. */ | |
| 538 | #define	AUE_MQ_SETATTR		43135	/* FreeBSD. */ | |
| 539 | #define	AUE_MQ_TIMEDRECEIVE	43136	/* FreeBSD. */ | |
| 540 | #define	AUE_MQ_TIMEDSEND	43137	/* FreeBSD. */ | |
| 541 | #define	AUE_MQ_NOTIFY		43138	/* FreeBSD. */ | |
| 542 | #define	AUE_MQ_UNLINK		43139	/* FreeBSD. */ | |
| 543 | #define	AUE_LISTEN		43140	/* FreeBSD/Darwin/Linux. */ | |
| 544 | #define	AUE_MLOCKALL		43141	/* FreeBSD. */ | |
| 545 | #define	AUE_MUNLOCKALL		43142	/* FreeBSD. */ | |
| 546 | #define	AUE_CLOSEFROM		43143	/* FreeBSD. */ | |
| 547 | #define	AUE_FEXECVE		43144	/* FreeBSD. */ | |
| 548 | #define	AUE_FACCESSAT		43145	/* FreeBSD. */ | |
| 549 | #define	AUE_FCHMODAT		43146	/* FreeBSD. */ | |
| 550 | #define	AUE_LINKAT		43147	/* FreeBSD. */ | |
| 551 | #define	AUE_MKDIRAT		43148	/* FreeBSD. */ | |
| 552 | #define	AUE_MKFIFOAT		43149	/* FreeBSD. */ | |
| 553 | #define	AUE_MKNODAT		43150	/* FreeBSD. */ | |
| 554 | #define	AUE_READLINKAT		43151	/* FreeBSD. */ | |
| 555 | #define	AUE_SYMLINKAT		43152	/* FreeBSD. */ | |
| 556 | #define	AUE_MAC_GETFSSTAT	43153	/* Darwin. */ | |
| 557 | #define	AUE_MAC_GET_MOUNT	43154	/* Darwin. */ | |
| 558 | #define	AUE_MAC_GET_LCID	43155	/* Darwin. */ | |
| 559 | #define	AUE_MAC_GET_LCTX	43156	/* Darwin. */ | |
| 560 | #define	AUE_MAC_SET_LCTX	43157	/* Darwin. */ | |
| 561 | #define	AUE_MAC_MOUNT		43158	/* Darwin. */ | |
| 562 | #define	AUE_GETLCID		43159	/* Darwin. */ | |
| 563 | #define	AUE_SETLCID		43160	/* Darwin. */ | |
| 564 | #define	AUE_TASKNAMEFORPID	43161	/* Darwin. */ | |
| 565 | #define	AUE_ACCESS_EXTENDED	43162	/* Darwin. */ | |
| 566 | #define	AUE_CHMOD_EXTENDED	43163	/* Darwin. */ | |
| 567 | #define	AUE_FCHMOD_EXTENDED	43164	/* Darwin. */ | |
| 568 | #define	AUE_FSTAT_EXTENDED	43165	/* Darwin. */ | |
| 569 | #define	AUE_LSTAT_EXTENDED	43166	/* Darwin. */ | |
| 570 | #define	AUE_MKDIR_EXTENDED	43167	/* Darwin. */ | |
| 571 | #define	AUE_MKFIFO_EXTENDED	43168	/* Darwin. */ | |
| 572 | #define	AUE_OPEN_EXTENDED	43169	/* Darwin. */ | |
| 573 | #define	AUE_OPEN_EXTENDED_R	43170	/* Darwin. */ | |
| 574 | #define	AUE_OPEN_EXTENDED_RC	43171	/* Darwin. */ | |
| 575 | #define	AUE_OPEN_EXTENDED_RT	43172	/* Darwin. */ | |
| 576 | #define	AUE_OPEN_EXTENDED_RTC	43173	/* Darwin. */ | |
| 577 | #define	AUE_OPEN_EXTENDED_W	43174	/* Darwin. */ | |
| 578 | #define	AUE_OPEN_EXTENDED_WC	43175	/* Darwin. */ | |
| 579 | #define	AUE_OPEN_EXTENDED_WT	43176	/* Darwin. */ | |
| 580 | #define	AUE_OPEN_EXTENDED_WTC	43177	/* Darwin. */ | |
| 581 | #define	AUE_OPEN_EXTENDED_RW	43178	/* Darwin. */ | |
| 582 | #define	AUE_OPEN_EXTENDED_RWC	43179	/* Darwin. */ | |
| 583 | #define	AUE_OPEN_EXTENDED_RWT	43180	/* Darwin. */ | |
| 584 | #define	AUE_OPEN_EXTENDED_RWTC	43181	/* Darwin. */ | |
| 585 | #define	AUE_STAT_EXTENDED	43182	/* Darwin. */ | |
| 586 | #define	AUE_UMASK_EXTENDED	43183	/* Darwin. */ | |
| 587 | #define	AUE_OPENAT		43184	/* FreeBSD. */ | |
| 588 | #define	AUE_POSIX_OPENPT	43185	/* FreeBSD. */ | |
| 589 | #define	AUE_CAP_NEW		43186	/* TrustedBSD. */ | |
| 590 | #define	AUE_CAP_RIGHTS_GET	43187	/* TrustedBSD. */ | |
| 591 | #define	AUE_CAP_GETRIGHTS	AUE_CAP_RIGHTS_GET | |
| 592 | #define	AUE_CAP_ENTER		43188	/* TrustedBSD. */ | |
| 593 | #define	AUE_CAP_GETMODE		43189	/* TrustedBSD. */ | |
| 594 | #define	AUE_POSIX_SPAWN		43190	/* Darwin. */ | |
| 595 | #define	AUE_FSGETPATH		43191	/* Darwin. */ | |
| 596 | #define	AUE_PREAD		43192	/* Darwin/FreeBSD. */ | |
| 597 | #define	AUE_PWRITE		43193	/* Darwin/FreeBSD. */ | |
| 598 | #define	AUE_FSCTL		43194	/* Darwin. */ | |
| 599 | #define	AUE_FFSCTL		43195	/* Darwin. */ | |
| 600 | #define	AUE_LPATHCONF		43196	/* FreeBSD. */ | |
| 601 | #define	AUE_PDFORK		43197	/* FreeBSD. */ | |
| 602 | #define	AUE_PDKILL		43198	/* FreeBSD. */ | |
| 603 | #define	AUE_PDGETPID		43199	/* FreeBSD. */ | |
| 604 | #define	AUE_PDWAIT		43200	/* FreeBSD. */ | |
| 605 | #define	AUE_WAIT6		43201	/* FreeBSD. */ | |
| 606 | #define	AUE_CAP_RIGHTS_LIMIT	43202	/* TrustedBSD. */ | |
| 607 | #define	AUE_CAP_IOCTLS_LIMIT	43203	/* TrustedBSD. */ | |
| 608 | #define	AUE_CAP_IOCTLS_GET	43204	/* TrustedBSD. */ | |
| 609 | #define	AUE_CAP_FCNTLS_LIMIT	43205	/* TrustedBSD. */ | |
| 610 | #define	AUE_CAP_FCNTLS_GET	43206	/* TrustedBSD. */ | |
| 611 | #define	AUE_BINDAT		43207	/* TrustedBSD. */ | |
| 612 | #define	AUE_CONNECTAT		43208	/* TrustedBSD. */ | |
| 613 | #define	AUE_CHFLAGSAT		43209	/* FreeBSD-specific. */ | |
| 614 | #define	AUE_PREADV		43210	/* FreeBSD-specific. */ | |
| 615 | #define	AUE_PWRITEV		43211	/* FreeBSD-specific. */ | |
| 616 | #define	AUE_POSIX_FALLOCATE	43212	/* FreeBSD-specific. */ | |
| 617 | #define	AUE_AIO_MLOCK		43213	/* FreeBSD-specific. */ | |
| 618 | #define	AUE_PROCCTL		43214	/* FreeBSD-specific. */ | |
| 619 | #define	AUE_AIO_READ		43215	/* FreeBSD-specific. */ | |
| 620 | #define	AUE_AIO_WRITE		43216	/* FreeBSD-specific. */ | |
| 621 | #define	AUE_AIO_RETURN		43217	/* FreeBSD-specific. */ | |
| 622 | #define	AUE_AIO_SUSPEND		43218	/* FreeBSD-specific. */ | |
| 623 | #define	AUE_AIO_CANCEL		43219	/* FreeBSD-specific. */ | |
| 624 | #define	AUE_AIO_ERROR		43220	/* FreeBSD-specific. */ | |
| 625 | #define	AUE_AIO_WAITCOMPLETE	43221	/* FreeBSD-specific. */ | |
| 626 | #define	AUE_AIO_FSYNC		43222	/* FreeBSD-specific. */ | |
| 627 | #define	AUE_THR_CREATE		43223	/* FreeBSD-specific. */ | |
| 628 | #define	AUE_THR_NEW		43224	/* FreeBSD-specific. */ | |
| 629 | #define	AUE_THR_EXIT		43225	/* FreeBSD-specific. */ | |
| 630 | #define	AUE_THR_KILL		43226	/* FreeBSD-specific. */ | |
| 631 | #define	AUE_THR_KILL2		43227	/* FreeBSD-specific. */ | |
| 632 | #define	AUE_SETFIB		43228	/* FreeBSD-specific. */ | |
| 633 | #define	AUE_LIO_LISTIO		43229	/* FreeBSD-specific. */ | |
| 634 | #define	AUE_SETUGID		43230	/* FreeBSD-specific. */ | |
| 635 | #define	AUE_SCTP_PEELOFF	43231	/* FreeBSD-specific. */ | |
| 636 | #define	AUE_SCTP_GENERIC_SENDMSG	43232	/* FreeBSD-specific. */ | |
| 637 | #define	AUE_SCTP_GENERIC_RECVMSG	43233	/* FreeBSD-specific. */ | |
| 638 | #define	AUE_JAIL_GET		43234	/* FreeBSD-specific. */ | |
| 639 | #define	AUE_JAIL_SET		43235	/* FreeBSD-specific. */ | |
| 640 | #define	AUE_JAIL_REMOVE		43236	/* FreeBSD-specific. */ | |
| 641 | #define	AUE_GETLOGINCLASS	43237	/* FreeBSD-specific. */ | |
| 642 | #define	AUE_SETLOGINCLASS	43238	/* FreeBSD-specific. */ | |
| 643 | #define	AUE_POSIX_FADVISE	43239	/* FreeBSD-specific. */ | |
| 644 | #define	AUE_SCTP_GENERIC_SENDMSG_IOV	43240	/* FreeBSD-specific. */ | |
| 645 | #define	AUE_ABORT2		43241	/* FreeBSD-specific. */ | |
| 646 | #define	AUE_SEMTIMEDWAIT	43242	/* FreeBSD-specific. */ | |
| 647 | #define	AUE_SEMDESTROY		43243	/* FreeBSD-specific. */ | |
| 648 | #define	AUE_SEMGETVALUE		43244	/* FreeBSD-specific. */ | |
| 649 | #define	AUE_SEMINIT		43245	/* FreeBSD-specific. */ | |
| 650 | #define	AUE_SEMPOST		43246	/* FreeBSD-specific. */ | |
| 651 | #define	AUE_SEMTRYWAIT		43247	/* FreeBSD-specific. */ | |
| 652 | #define	AUE_SEMWAIT		43258	/* FreeBSD-specific. */ | |
| 653 | #define	AUE_FGETUUID		43259	/* CADETS. */ | |
| 654 | #define	AUE_GETUUID		43260	/* CADETS. */ | |
| 655 | #define	AUE_LGETUUID		43261	/* CADETS. */ | |
| 656 | #define	AUE_EXECVEAT		43262	/* FreeBSD/Linux. */ | |
| 657 | #define	AUE_SHMRENAME		43263	/* FreeBSD-specific. */ | |
| 658 | #define	AUE_REALPATHAT		43264	/* FreeBSD-specific. */ | |
| 659 | #define	AUE_CLOSERANGE		43265	/* FreeBSD-specific. */ | |
| 660 | #define	AUE_SPECIALFD		43266	/* FreeBSD-specific. */ | |
| 661 | #define	AUE_AIO_WRITEV		43267	/* FreeBSD-specific. */ | |
| 662 | #define	AUE_AIO_READV		43268	/* FreeBSD-specific. */ | |
| 663 | #define	AUE_FSPACECTL		43269	/* FreeBSD-specific. */ | |
| 664 | #define	AUE_TIMERFD		43270	/* FreeBSD/Linux. */ | |
| 665 | ||
| 666 | /* | |
| 667 | * Darwin BSM uses a number of AUE_O_* definitions, which are aliased to the | |
| 668 | * normal Solaris BSM identifiers. _O_ refers to it being an old, or compat | |
| 669 | * interface. In most cases, Darwin has never implemented these system calls | |
| 670 | * but picked up the fields in their system call table from their FreeBSD | |
| 671 | * import. Happily, these have different names than the AUE_O* definitions | |
| 672 | * in Solaris BSM. | |
| 673 | */ | |
| 674 | #define	AUE_O_CREAT		AUE_OPEN_RWTC	/* Darwin */ | |
| 675 | #define	AUE_O_EXECVE		AUE_NULL	/* Darwin */ | |
| 676 | #define	AUE_O_SBREAK		AUE_NULL	/* Darwin */ | |
| 677 | #define	AUE_O_LSEEK		AUE_NULL	/* Darwin */ | |
| 678 | #define	AUE_O_MOUNT		AUE_NULL	/* Darwin */ | |
| 679 | #define	AUE_O_UMOUNT		AUE_NULL	/* Darwin */ | |
| 680 | #define	AUE_O_STAT		AUE_STAT	/* Darwin */ | |
| 681 | #define	AUE_O_LSTAT		AUE_LSTAT	/* Darwin */ | |
| 682 | #define	AUE_O_FSTAT		AUE_FSTAT	/* Darwin */ | |
| 683 | #define	AUE_O_GETPAGESIZE	AUE_NULL	/* Darwin */ | |
| 684 | #define	AUE_O_VREAD		AUE_NULL	/* Darwin */ | |
| 685 | #define	AUE_O_VWRITE		AUE_NULL	/* Darwin */ | |
| 686 | #define	AUE_O_MMAP		AUE_MMAP	/* Darwin */ | |
| 687 | #define	AUE_O_VADVISE		AUE_NULL	/* Darwin */ | |
| 688 | #define	AUE_O_VHANGUP		AUE_NULL	/* Darwin */ | |
| 689 | #define	AUE_O_VLIMIT		AUE_NULL	/* Darwin */ | |
| 690 | #define	AUE_O_WAIT		AUE_NULL	/* Darwin */ | |
| 691 | #define	AUE_O_GETHOSTNAME	AUE_NULL	/* Darwin */ | |
| 692 | #define	AUE_O_SETHOSTNAME	AUE_SYSCTL	/* Darwin */ | |
| 693 | #define	AUE_O_GETDOPT		AUE_NULL	/* Darwin */ | |
| 694 | #define	AUE_O_SETDOPT		AUE_NULL	/* Darwin */ | |
| 695 | #define	AUE_O_ACCEPT		AUE_NULL	/* Darwin */ | |
| 696 | #define	AUE_O_SEND		AUE_SENDMSG	/* Darwin */ | |
| 697 | #define	AUE_O_RECV		AUE_RECVMSG	/* Darwin */ | |
| 698 | #define	AUE_O_VTIMES		AUE_NULL	/* Darwin */ | |
| 699 | #define	AUE_O_SIGVEC		AUE_NULL	/* Darwin */ | |
| 700 | #define	AUE_O_SIGBLOCK		AUE_NULL	/* Darwin */ | |
| 701 | #define	AUE_O_SIGSETMASK	AUE_NULL	/* Darwin */ | |
| 702 | #define	AUE_O_SIGSTACK		AUE_NULL	/* Darwin */ | |
| 703 | #define	AUE_O_RECVMSG		AUE_RECVMSG	/* Darwin */ | |
| 704 | #define	AUE_O_SENDMSG		AUE_SENDMSG	/* Darwin */ | |
| 705 | #define	AUE_O_VTRACE		AUE_NULL	/* Darwin */ | |
| 706 | #define	AUE_O_RESUBA		AUE_NULL	/* Darwin */ | |
| 707 | #define	AUE_O_RECVFROM		AUE_RECVFROM	/* Darwin */ | |
| 708 | #define	AUE_O_SETREUID		AUE_SETREUID	/* Darwin */ | |
| 709 | #define	AUE_O_SETREGID		AUE_SETREGID	/* Darwin */ | |
| 710 | #define	AUE_O_GETDIRENTRIES	AUE_GETDIRENTRIES	/* Darwin */ | |
| 711 | #define	AUE_O_TRUNCATE		AUE_TRUNCATE	/* Darwin */ | |
| 712 | #define	AUE_O_FTRUNCATE		AUE_FTRUNCATE	/* Darwin */ | |
| 713 | #define	AUE_O_GETPEERNAME	AUE_NULL	/* Darwin */ | |
| 714 | #define	AUE_O_GETHOSTID		AUE_NULL	/* Darwin */ | |
| 715 | #define	AUE_O_SETHOSTID		AUE_NULL	/* Darwin */ | |
| 716 | #define	AUE_O_GETRLIMIT		AUE_NULL	/* Darwin */ | |
| 717 | #define	AUE_O_SETRLIMIT		AUE_SETRLIMIT	/* Darwin */ | |
| 718 | #define	AUE_O_KILLPG		AUE_KILL	/* Darwin */ | |
| 719 | #define	AUE_O_SETQUOTA		AUE_NULL	/* Darwin */ | |
| 720 | #define	AUE_O_QUOTA		AUE_NULL	/* Darwin */ | |
| 721 | #define	AUE_O_GETSOCKNAME	AUE_NULL	/* Darwin */ | |
| 722 | #define	AUE_O_GETDIREENTRIES	AUE_GETDIREENTRIES	/* Darwin */ | |
| 723 | #define	AUE_O_ASYNCDAEMON	AUE_NULL	/* Darwin */ | |
| 724 | #define	AUE_O_GETDOMAINNAME	AUE_NULL	/* Darwin */ | |
| 725 | #define	AUE_O_SETDOMAINNAME	AUE_SYSCTL	/* Darwin */ | |
| 726 | #define	AUE_O_PCFS_MOUNT	AUE_NULL	/* Darwin */ | |
| 727 | #define	AUE_O_EXPORTFS		AUE_NULL	/* Darwin */ | |
| 728 | #define	AUE_O_USTATE		AUE_NULL	/* Darwin */ | |
| 729 | #define	AUE_O_WAIT3		AUE_NULL	/* Darwin */ | |
| 730 | #define	AUE_O_RPAUSE		AUE_NULL	/* Darwin */ | |
| 731 | #define	AUE_O_GETDENTS		AUE_NULL	/* Darwin */ | |
| 732 | ||
| 733 | /* | |
| 734 | * Possible desired future values based on review of BSD/Darwin system calls. | |
| 735 | */ | |
| 736 | #define	AUE_ATGETMSG		AUE_NULL | |
| 737 | #define	AUE_ATPUTMSG		AUE_NULL | |
| 738 | #define	AUE_ATSOCKET		AUE_NULL | |
| 739 | #define	AUE_ATPGETREQ		AUE_NULL | |
| 740 | #define	AUE_ATPGETRSP		AUE_NULL | |
| 741 | #define	AUE_ATPSNDREQ		AUE_NULL | |
| 742 | #define	AUE_ATPSNDRSP		AUE_NULL | |
| 743 | #define	AUE_BSDTHREADCREATE	AUE_NULL | |
| 744 | #define	AUE_BSDTHREADTERMINATE	AUE_NULL | |
| 745 | #define	AUE_BSDTHREADREGISTER	AUE_NULL | |
| 746 | #define	AUE_CHUD		AUE_NULL | |
| 747 | #define	AUE_CSOPS		AUE_NULL | |
| 748 | #define	AUE_DUP			AUE_NULL | |
| 749 | #define	AUE_FDATASYNC		AUE_NULL | |
| 750 | #define	AUE_FGETATTRLIST	AUE_NULL | |
| 751 | #define	AUE_FGETXATTR		AUE_NULL | |
| 752 | #define	AUE_FLISTXATTR		AUE_NULL | |
| 753 | #define	AUE_FREMOVEXATTR	AUE_NULL | |
| 754 | #define	AUE_FSETATTRLIST	AUE_NULL | |
| 755 | #define	AUE_FSETXATTR		AUE_NULL | |
| 756 | #define	AUE_FSTATFS64		AUE_NULL | |
| 757 | #define	AUE_FSTATV		AUE_NULL | |
| 758 | #define	AUE_FSTAT64		AUE_NULL | |
| 759 | #define	AUE_FSTAT64_EXTENDED	AUE_NULL | |
| 760 | #define	AUE_GCCONTROL		AUE_NULL | |
| 761 | #define	AUE_GETDIRENTRIES64	AUE_NULL | |
| 762 | #define	AUE_GETDTABLESIZE	AUE_NULL | |
| 763 | #define	AUE_GETEGID		AUE_NULL | |
| 764 | #define	AUE_GETEUID		AUE_NULL | |
| 765 | #define	AUE_GETFSSTAT64		AUE_NULL | |
| 766 | #define	AUE_GETGID		AUE_NULL | |
| 767 | #define	AUE_GETGROUPS		AUE_NULL | |
| 768 | #define	AUE_GETITIMER		AUE_NULL | |
| 769 | #define	AUE_GETLOGIN		AUE_NULL | |
| 770 | #define	AUE_GETPEERNAME		AUE_NULL | |
| 771 | #define	AUE_GETPGID		AUE_NULL | |
| 772 | #define	AUE_GETPGRP		AUE_NULL | |
| 773 | #define	AUE_GETPID		AUE_NULL | |
| 774 | #define	AUE_GETPPID		AUE_NULL | |
| 775 | #define	AUE_GETPRIORITY		AUE_NULL | |
| 776 | #define	AUE_GETRLIMIT		AUE_NULL | |
| 777 | #define	AUE_GETRUSAGE		AUE_NULL | |
| 778 | #define	AUE_GETSGROUPS		AUE_NULL | |
| 779 | #define	AUE_GETSID		AUE_NULL | |
| 780 | #define	AUE_GETSOCKNAME		AUE_NULL | |
| 781 | #define	AUE_GETTIMEOFDAY	AUE_NULL | |
| 782 | #define	AUE_GETTID		AUE_NULL | |
| 783 | #define	AUE_GETUID		AUE_NULL | |
| 784 | #define	AUE_GETSOCKOPT		AUE_NULL | |
| 785 | #define	AUE_GETWGROUPS		AUE_NULL | |
| 786 | #define	AUE_GETXATTR		AUE_NULL | |
| 787 | #define	AUE_IDENTITYSVC		AUE_NULL | |
| 788 | #define	AUE_INITGROUPS		AUE_NULL | |
| 789 | #define	AUE_IOPOLICYSYS		AUE_NULL | |
| 790 | #define	AUE_ISSETUGID		AUE_NULL | |
| 791 | #define	AUE_LIOLISTIO		AUE_NULL | |
| 792 | #define	AUE_LISTXATTR		AUE_NULL | |
| 793 | #define	AUE_LSTATV		AUE_NULL | |
| 794 | #define	AUE_LSTAT64		AUE_NULL | |
| 795 | #define	AUE_LSTAT64_EXTENDED	AUE_NULL | |
| 796 | #define	AUE_MADVISE		AUE_NULL | |
| 797 | #define	AUE_MINCORE		AUE_NULL | |
| 798 | #define	AUE_MKCOMPLEX		AUE_NULL | |
| 799 | #define	AUE_MODWATCH		AUE_NULL | |
| 800 | #define	AUE_MSGCL		AUE_NULL | |
| 801 | #define	AUE_MSYNC		AUE_NULL | |
| 802 | #define	AUE_PROCINFO		AUE_NULL | |
| 803 | #define	AUE_PTHREADCANCELED	AUE_NULL | |
| 804 | #define	AUE_PTHREADCHDIR	AUE_NULL | |
| 805 | #define	AUE_PTHREADCONDBROADCAST	AUE_NULL | |
| 806 | #define	AUE_PTHREADCONDDESTORY	AUE_NULL | |
| 807 | #define	AUE_PTHREADCONDINIT	AUE_NULL | |
| 808 | #define	AUE_PTHREADCONDSIGNAL	AUE_NULL | |
| 809 | #define	AUE_PTHREADCONDWAIT	AUE_NULL | |
| 810 | #define	AUE_PTHREADFCHDIR	AUE_NULL | |
| 811 | #define	AUE_PTHREADMARK		AUE_NULL | |
| 812 | #define	AUE_PTHREADMUTEXDESTROY	AUE_NULL | |
| 813 | #define	AUE_PTHREADMUTEXINIT	AUE_NULL | |
| 814 | #define	AUE_PTHREADMUTEXTRYLOCK	AUE_NULL | |
| 815 | #define	AUE_PTHREADMUTEXUNLOCK	AUE_NULL | |
| 816 | #define	AUE_REMOVEXATTR		AUE_NULL | |
| 817 | #define	AUE_SBRK		AUE_NULL | |
| 818 | #define	AUE_SELECT		AUE_NULL | |
| 819 | #define	AUE_SEMWAITSIGNAL	AUE_NULL | |
| 820 | #define	AUE_SETITIMER		AUE_NULL | |
| 821 | #define	AUE_SETSGROUPS		AUE_NULL | |
| 822 | #define	AUE_SETTID		AUE_NULL | |
| 823 | #define	AUE_SETTIDWITHPID	AUE_NULL | |
| 824 | #define	AUE_SETWGROUPS		AUE_NULL | |
| 825 | #define	AUE_SETXATTR		AUE_NULL | |
| 826 | #define	AUE_SHAREDREGIONCHECK	AUE_NULL | |
| 827 | #define	AUE_SHAREDREGIONMAP	AUE_NULL | |
| 828 | #define	AUE_SIGACTION		AUE_NULL | |
| 829 | #define	AUE_SIGALTSTACK		AUE_NULL | |
| 830 | #define	AUE_SIGPENDING		AUE_NULL | |
| 831 | #define	AUE_SIGPROCMASK		AUE_NULL | |
| 832 | #define	AUE_SIGRETURN		AUE_NULL | |
| 833 | #define	AUE_SIGSUSPEND		AUE_NULL | |
| 834 | #define	AUE_SIGWAIT		AUE_NULL | |
| 835 | #define	AUE_SSTK		AUE_NULL | |
| 836 | #define	AUE_STACKSNAPSHOT	AUE_NULL | |
| 837 | #define	AUE_STATFS64		AUE_NULL | |
| 838 | #define	AUE_STATV		AUE_NULL | |
| 839 | #define	AUE_STAT64		AUE_NULL | |
| 840 | #define	AUE_STAT64_EXTENDED	AUE_NULL | |
| 841 | #define	AUE_SYNC		AUE_NULL | |
| 842 | #define	AUE_SYSCALL		AUE_NULL | |
| 843 | #define	AUE_TABLE		AUE_NULL | |
| 844 | #define	AUE_VMPRESSUREMONITOR	AUE_NULL | |
| 845 | #define	AUE_WAITEVENT		AUE_NULL | |
| 846 | #define	AUE_WAITID		AUE_NULL | |
| 847 | #define	AUE_WATCHEVENT		AUE_NULL | |
| 848 | #define	AUE_WORKQOPEN		AUE_NULL | |
| 849 | #define	AUE_WORKQOPS		AUE_NULL | |
| 850 | ||
| 851 | #endif /* !_BSM_AUDIT_KEVENTS_H_ */ | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/bsm/audit_record.h deleted-311| ... | ... | @@ -1,311 +0,0 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-3-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 2005-2009 Apple Inc. | |
| 5 | * All rights reserved. | |
| 6 | * | |
| 7 | * Redistribution and use in source and binary forms, with or without | |
| 8 | * modification, are permitted provided that the following conditions | |
| 9 | * are met: | |
| 10 | * | |
| 11 | * 1. Redistributions of source code must retain the above copyright | |
| 12 | * notice, this list of conditions and the following disclaimer. | |
| 13 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 14 | * notice, this list of conditions and the following disclaimer in the | |
| 15 | * documentation and/or other materials provided with the distribution. | |
| 16 | * 3. Neither the name of Apple Inc. ("Apple") nor the names of | |
| 17 | * its contributors may be used to endorse or promote products derived | |
| 18 | * from this software without specific prior written permission. | |
| 19 | * | |
| 20 | * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY | |
| 21 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | |
| 22 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |
| 23 | * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY | |
| 24 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | |
| 25 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | |
| 26 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | |
| 27 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
| 28 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | |
| 29 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 30 | */ | |
| 31 | ||
| 32 | #ifndef _BSM_AUDIT_RECORD_H_ | |
| 33 | #define _BSM_AUDIT_RECORD_H_ | |
| 34 | ||
| 35 | #include <sys/types.h> | |
| 36 | #include <sys/time.h>			/* struct timeval */ | |
| 37 | ||
| 38 | /* | |
| 39 | * Token type identifiers. | |
| 40 | */ | |
| 41 | #define	AUT_INVALID		0x00 | |
| 42 | #define	AUT_OTHER_FILE32	0x11 | |
| 43 | #define	AUT_OHEADER		0x12 | |
| 44 | #define	AUT_TRAILER		0x13 | |
| 45 | #define	AUT_HEADER32		0x14 | |
| 46 | #define	AUT_HEADER32_EX		0x15 | |
| 47 | #define	AUT_DATA		0x21 | |
| 48 | #define	AUT_IPC			0x22 | |
| 49 | #define	AUT_PATH		0x23 | |
| 50 | #define	AUT_SUBJECT32		0x24 | |
| 51 | #define	AUT_XATPATH		0x25 | |
| 52 | #define	AUT_PROCESS32		0x26 | |
| 53 | #define	AUT_RETURN32		0x27 | |
| 54 | #define	AUT_TEXT		0x28 | |
| 55 | #define	AUT_OPAQUE		0x29 | |
| 56 | #define	AUT_IN_ADDR		0x2a | |
| 57 | #define	AUT_IP			0x2b | |
| 58 | #define	AUT_IPORT		0x2c | |
| 59 | #define	AUT_ARG32		0x2d | |
| 60 | #define	AUT_SOCKET		0x2e | |
| 61 | #define	AUT_SEQ			0x2f | |
| 62 | #define	AUT_ACL			0x30 | |
| 63 | #define	AUT_ATTR		0x31 | |
| 64 | #define	AUT_IPC_PERM		0x32 | |
| 65 | #define	AUT_LABEL		0x33 | |
| 66 | #define	AUT_GROUPS		0x34 | |
| 67 | #define	AUT_ACE			0x35 | |
| 68 | #define	AUT_PRIV		0x38 | |
| 69 | #define	AUT_UPRIV		0x39 | |
| 70 | #define	AUT_LIAISON		0x3a | |
| 71 | #define	AUT_NEWGROUPS		0x3b | |
| 72 | #define	AUT_EXEC_ARGS		0x3c | |
| 73 | #define	AUT_EXEC_ENV		0x3d | |
| 74 | #define	AUT_ATTR32		0x3e | |
| 75 | #define	AUT_UNAUTH		0x3f | |
| 76 | #define	AUT_XATOM		0x40 | |
| 77 | #define	AUT_XOBJ		0x41 | |
| 78 | #define	AUT_XPROTO		0x42 | |
| 79 | #define	AUT_XSELECT		0x43 | |
| 80 | #define	AUT_XCOLORMAP		0x44 | |
| 81 | #define	AUT_XCURSOR		0x45 | |
| 82 | #define	AUT_XFONT		0x46 | |
| 83 | #define	AUT_XGC			0x47 | |
| 84 | #define	AUT_XPIXMAP		0x48 | |
| 85 | #define	AUT_XPROPERTY		0x49 | |
| 86 | #define	AUT_XWINDOW		0x4a | |
| 87 | #define	AUT_XCLIENT		0x4b | |
| 88 | #define	AUT_CMD			0x51 | |
| 89 | #define	AUT_EXIT		0x52 | |
| 90 | #define	AUT_ZONENAME		0x60 | |
| 91 | #define	AUT_HOST		0x70 | |
| 92 | #define	AUT_ARG64		0x71 | |
| 93 | #define	AUT_RETURN64		0x72 | |
| 94 | #define	AUT_ATTR64		0x73 | |
| 95 | #define	AUT_HEADER64		0x74 | |
| 96 | #define	AUT_SUBJECT64		0x75 | |
| 97 | #define	AUT_PROCESS64		0x77 | |
| 98 | #define	AUT_OTHER_FILE64	0x78 | |
| 99 | #define	AUT_HEADER64_EX		0x79 | |
| 100 | #define	AUT_SUBJECT32_EX	0x7a | |
| 101 | #define	AUT_PROCESS32_EX	0x7b | |
| 102 | #define	AUT_SUBJECT64_EX	0x7c | |
| 103 | #define	AUT_PROCESS64_EX	0x7d | |
| 104 | #define	AUT_IN_ADDR_EX		0x7e | |
| 105 | #define	AUT_SOCKET_EX		0x7f | |
| 106 | ||
| 107 | /* | |
| 108 | * Pre-64-bit BSM, 32-bit tokens weren't explicitly named as '32'. We have | |
| 109 | * compatibility defines. | |
| 110 | */ | |
| 111 | #define	AUT_HEADER		AUT_HEADER32 | |
| 112 | #define	AUT_ARG			AUT_ARG32 | |
| 113 | #define	AUT_RETURN		AUT_RETURN32 | |
| 114 | #define	AUT_SUBJECT		AUT_SUBJECT32 | |
| 115 | #define	AUT_PROCESS		AUT_PROCESS32 | |
| 116 | #define	AUT_OTHER_FILE		AUT_OTHER_FILE32 | |
| 117 | ||
| 118 | /* | |
| 119 | * The values for the following token ids are not defined by BSM. | |
| 120 | * | |
| 121 | * XXXRW: Not sure how to handle these in OpenBSM yet, but I'll give them | |
| 122 | * names more consistent with Sun's BSM. These originally came from Apple's | |
| 123 | * BSM. | |
| 124 | */ | |
| 125 | #define	AUT_SOCKINET32		0x80		/* XXX */ | |
| 126 | #define	AUT_SOCKINET128		0x81		/* XXX */ | |
| 127 | #define	AUT_SOCKUNIX		0x82		/* XXX */ | |
| 128 | ||
| 129 | #define	AUT_RIGHTS		0x83 | |
| 130 | ||
| 131 | /* print values for the arbitrary token */ | |
| 132 | #define AUP_BINARY 0 | |
| 133 | #define AUP_OCTAL 1 | |
| 134 | #define AUP_DECIMAL 2 | |
| 135 | #define AUP_HEX 3 | |
| 136 | #define AUP_STRING 4 | |
| 137 | ||
| 138 | /* data-types for the arbitrary token */ | |
| 139 | #define AUR_BYTE 0 | |
| 140 | #define AUR_CHAR AUR_BYTE | |
| 141 | #define AUR_SHORT 1 | |
| 142 | #define AUR_INT32 2 | |
| 143 | #define AUR_INT AUR_INT32 | |
| 144 | #define AUR_INT64 3 | |
| 145 | ||
| 146 | /* ... and their sizes */ | |
| 147 | #define AUR_BYTE_SIZE sizeof(u_char) | |
| 148 | #define AUR_CHAR_SIZE AUR_BYTE_SIZE | |
| 149 | #define AUR_SHORT_SIZE sizeof(uint16_t) | |
| 150 | #define AUR_INT32_SIZE sizeof(uint32_t) | |
| 151 | #define AUR_INT_SIZE AUR_INT32_SIZE | |
| 152 | #define AUR_INT64_SIZE sizeof(uint64_t) | |
| 153 | ||
| 154 | /* Modifiers for the header token */ | |
| 155 | #define PAD_NOTATTR 0x4000 /* nonattributable event */ | |
| 156 | #define PAD_FAILURE 0x8000 /* fail audit event */ | |
| 157 | ||
| 158 | #define AUDIT_MAX_GROUPS 16 | |
| 159 | ||
| 160 | /* | |
| 161 | * A number of BSM versions are floating around and defined. Here are | |
| 162 | * constants for them. OpenBSM uses the same token types, etc, used in the | |
| 163 | * Solaris BSM version, but has a separate version number in order to | |
| 164 | * identify a potentially different event identifier name space. | |
| 165 | */ | |
| 166 | #define	AUDIT_HEADER_VERSION_OLDDARWIN	1	/* In retrospect, a mistake. */ | |
| 167 | #define	AUDIT_HEADER_VERSION_SOLARIS	2 | |
| 168 | #define	AUDIT_HEADER_VERSION_TSOL25	3 | |
| 169 | #define	AUDIT_HEADER_VERSION_TSOL	4 | |
| 170 | #define	AUDIT_HEADER_VERSION_OPENBSM10	10 | |
| 171 | #define	AUDIT_HEADER_VERSION_OPENBSM11	11 | |
| 172 | #define	AUDIT_HEADER_VERSION_OPENBSM	AUDIT_HEADER_VERSION_OPENBSM11 | |
| 173 | ||
| 174 | #define	AUT_TRAILER_MAGIC	0xb105 | |
| 175 | ||
| 176 | /* BSM library calls */ | |
| 177 | ||
| 178 | __BEGIN_DECLS | |
| 179 | ||
| 180 | struct in_addr; | |
| 181 | struct in6_addr; | |
| 182 | struct ip; | |
| 183 | struct ipc_perm; | |
| 184 | struct kevent; | |
| 185 | struct sockaddr; | |
| 186 | struct sockaddr_in; | |
| 187 | struct sockaddr_in6; | |
| 188 | struct sockaddr_un; | |
| 189 | #if defined(_KERNEL) || defined(KERNEL) | |
| 190 | struct vnode_au_info; | |
| 191 | #endif | |
| 192 | ||
| 193 | #ifndef	_CAP_RIGHTS_T_DECLARED | |
| 194 | #define	_CAP_RIGHTS_T_DECLARED | |
| 195 | struct cap_rights; | |
| 196 | ||
| 197 | typedef	struct cap_rights	cap_rights_t; | |
| 198 | #endif | |
| 199 | ||
| 200 | int	 au_open(void); | |
| 201 | int	 au_write(int d, token_t *m); | |
| 202 | int	 au_close(int d, int keep, short event); | |
| 203 | int	 au_close_buffer(int d, short event, u_char *buffer, size_t *buflen); | |
| 204 | int	 au_close_token(token_t *tok, u_char *buffer, size_t *buflen); | |
| 205 | ||
| 206 | token_t	*au_to_file(const char *file, struct timeval tm); | |
| 207 | ||
| 208 | token_t	*au_to_header32_tm(int rec_size, au_event_t e_type, au_emod_t e_mod, | |
| 209 | 	 struct timeval tm); | |
| 210 | token_t	*au_to_header32_ex_tm(int rec_size, au_event_t e_type, au_emod_t e_mod, | |
| 211 | 	 struct timeval tm, struct auditinfo_addr *aia); | |
| 212 | token_t	*au_to_header64_tm(int rec_size, au_event_t e_type, au_emod_t e_mod, | |
| 213 | 	 struct timeval tm); | |
| 214 | #if !defined(KERNEL) && !defined(_KERNEL) | |
| 215 | token_t	*au_to_header(int rec_size, au_event_t e_type, au_emod_t e_mod); | |
| 216 | token_t	*au_to_header_ex(int rec_size, au_event_t e_type, au_emod_t e_mod); | |
| 217 | token_t	*au_to_header32(int rec_size, au_event_t e_type, au_emod_t e_mod); | |
| 218 | token_t	*au_to_header64(int rec_size, au_event_t e_type, au_emod_t e_mod); | |
| 219 | token_t	*au_to_header32_ex(int rec_size, au_event_t e_type, au_emod_t e_mod); | |
| 220 | #endif | |
| 221 | ||
| 222 | token_t	*au_to_me(void); | |
| 223 | token_t	*au_to_arg(char n, const char *text, uint32_t v); | |
| 224 | token_t	*au_to_arg32(char n, const char *text, uint32_t v); | |
| 225 | token_t	*au_to_arg64(char n, const char *text, uint64_t v); | |
| 226 | ||
| 227 | #if defined(_KERNEL) || defined(KERNEL) | |
| 228 | token_t	*au_to_attr(struct vnode_au_info *vni); | |
| 229 | token_t	*au_to_attr32(struct vnode_au_info *vni); | |
| 230 | token_t	*au_to_attr64(struct vnode_au_info *vni); | |
| 231 | #endif | |
| 232 | ||
| 233 | token_t	*au_to_data(char unit_print, char unit_type, char unit_count, | |
| 234 | 	 const char *p); | |
| 235 | token_t	*au_to_exit(int retval, int err); | |
| 236 | token_t	*au_to_groups(int *groups); | |
| 237 | token_t	*au_to_newgroups(uint16_t n, gid_t *groups); | |
| 238 | token_t	*au_to_in_addr(struct in_addr *internet_addr); | |
| 239 | token_t	*au_to_in_addr_ex(struct in6_addr *internet_addr); | |
| 240 | token_t	*au_to_ip(struct ip *ip); | |
| 241 | token_t	*au_to_ipc(char type, int id); | |
| 242 | token_t	*au_to_ipc_perm(struct ipc_perm *perm); | |
| 243 | token_t	*au_to_iport(uint16_t iport); | |
| 244 | token_t	*au_to_opaque(const char *data, uint16_t bytes); | |
| 245 | token_t	*au_to_path(const char *path); | |
| 246 | token_t	*au_to_privset(char *privtypestr, char *privstr); | |
| 247 | token_t	*au_to_process(au_id_t auid, uid_t euid, gid_t egid, uid_t ruid, | |
| 248 | 	 gid_t rgid, pid_t pid, au_asid_t sid, au_tid_t *tid); | |
| 249 | token_t	*au_to_process32(au_id_t auid, uid_t euid, gid_t egid, uid_t ruid, | |
| 250 | 	 gid_t rgid, pid_t pid, au_asid_t sid, au_tid_t *tid); | |
| 251 | token_t	*au_to_process64(au_id_t auid, uid_t euid, gid_t egid, uid_t ruid, | |
| 252 | 	 gid_t rgid, pid_t pid, au_asid_t sid, au_tid_t *tid); | |
| 253 | token_t	*au_to_process_ex(au_id_t auid, uid_t euid, gid_t egid, uid_t ruid, | |
| 254 | 	 gid_t rgid, pid_t pid, au_asid_t sid, au_tid_addr_t *tid); | |
| 255 | token_t	*au_to_process32_ex(au_id_t auid, uid_t euid, gid_t egid, | |
| 256 | 	 uid_t ruid, gid_t rgid, pid_t pid, au_asid_t sid, | |
| 257 | 	 au_tid_addr_t *tid); | |
| 258 | token_t	*au_to_process64_ex(au_id_t auid, uid_t euid, gid_t egid, uid_t ruid, | |
| 259 | 	 gid_t rgid, pid_t pid, au_asid_t sid, au_tid_addr_t *tid); | |
| 260 | token_t	*au_to_rights(cap_rights_t *rightsp); | |
| 261 | token_t	*au_to_return(char status, uint32_t ret); | |
| 262 | token_t	*au_to_return32(char status, uint32_t ret); | |
| 263 | token_t	*au_to_return64(char status, uint64_t ret); | |
| 264 | token_t	*au_to_seq(long audit_count); | |
| 265 | token_t	*au_to_socket_ex(u_short so_domain, u_short so_type, | |
| 266 | 	 struct sockaddr *sa_local, struct sockaddr *sa_remote); | |
| 267 | token_t	*au_to_sock_inet(struct sockaddr_in *so); | |
| 268 | token_t	*au_to_sock_inet32(struct sockaddr_in *so); | |
| 269 | token_t	*au_to_sock_inet128(struct sockaddr_in6 *so); | |
| 270 | token_t	*au_to_sock_unix(struct sockaddr_un *so); | |
| 271 | token_t	*au_to_subject(au_id_t auid, uid_t euid, gid_t egid, uid_t ruid, | |
| 272 | 	 gid_t rgid, pid_t pid, au_asid_t sid, au_tid_t *tid); | |
| 273 | token_t	*au_to_subject32(au_id_t auid, uid_t euid, gid_t egid, uid_t ruid, | |
| 274 | 	 gid_t rgid, pid_t pid, au_asid_t sid, au_tid_t *tid); | |
| 275 | token_t	*au_to_subject64(au_id_t auid, uid_t euid, gid_t egid, uid_t ruid, | |
| 276 | 	 gid_t rgid, pid_t pid, au_asid_t sid, au_tid_t *tid); | |
| 277 | token_t	*au_to_subject_ex(au_id_t auid, uid_t euid, gid_t egid, uid_t ruid, | |
| 278 | 	 gid_t rgid, pid_t pid, au_asid_t sid, au_tid_addr_t *tid); | |
| 279 | token_t	*au_to_subject32_ex(au_id_t auid, uid_t euid, gid_t egid, uid_t ruid, | |
| 280 | 	 gid_t rgid, pid_t pid, au_asid_t sid, au_tid_addr_t *tid); | |
| 281 | token_t	*au_to_subject64_ex(au_id_t auid, uid_t euid, gid_t egid, uid_t ruid, | |
| 282 | 	 gid_t rgid, pid_t pid, au_asid_t sid, au_tid_addr_t *tid); | |
| 283 | #if defined(_KERNEL) || defined(KERNEL) | |
| 284 | token_t	*au_to_exec_args(char *args, int argc); | |
| 285 | token_t	*au_to_exec_env(char *envs, int envc); | |
| 286 | #else | |
| 287 | token_t	*au_to_exec_args(char **argv); | |
| 288 | token_t	*au_to_exec_env(char **envp); | |
| 289 | #endif | |
| 290 | token_t	*au_to_text(const char *text); | |
| 291 | token_t	*au_to_kevent(struct kevent *kev); | |
| 292 | token_t	*au_to_trailer(int rec_size); | |
| 293 | token_t	*au_to_upriv(char sorf, char *priv); | |
| 294 | token_t	*au_to_zonename(const char *zonename); | |
| 295 | ||
| 296 | /* | |
| 297 | * BSM library routines for converting between local and BSM constant spaces. | |
| 298 | */ | |
| 299 | int	 au_bsm_to_domain(u_short bsm_domain, int *local_domainp); | |
| 300 | int	 au_bsm_to_errno(u_char bsm_error, int *errorp); | |
| 301 | int	 au_bsm_to_fcntl_cmd(u_short bsm_fcntl_cmd, int *local_fcntl_cmdp); | |
| 302 | int	 au_bsm_to_socket_type(u_short bsm_socket_type, | |
| 303 | 	 int *local_socket_typep); | |
| 304 | u_short	 au_domain_to_bsm(int local_domain); | |
| 305 | u_char	 au_errno_to_bsm(int local_errno); | |
| 306 | u_short	 au_fcntl_cmd_to_bsm(int local_fcntl_command); | |
| 307 | u_short	 au_socket_type_to_bsm(int local_socket_type); | |
| 308 | ||
| 309 | __END_DECLS | |
| 310 | ||
| 311 | #endif /* ! _BSM_AUDIT_RECORD_H_ */ | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/bsm/audit_socket_type.h deleted-46| ... | ... | @@ -1,46 +0,0 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-3-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 2008 Apple Inc. | |
| 5 | * All rights reserved. | |
| 6 | * | |
| 7 | * Redistribution and use in source and binary forms, with or without | |
| 8 | * modification, are permitted provided that the following conditions | |
| 9 | * are met: | |
| 10 | * 1. Redistributions of source code must retain the above copyright | |
| 11 | * notice, this list of conditions and the following disclaimer. | |
| 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 13 | * notice, this list of conditions and the following disclaimer in the | |
| 14 | * documentation and/or other materials provided with the distribution. | |
| 15 | * 3. Neither the name of Apple Inc. ("Apple") nor the names of | |
| 16 | * its contributors may be used to endorse or promote products derived | |
| 17 | * from this software without specific prior written permission. | |
| 18 | * | |
| 19 | * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND | |
| 20 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 21 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
| 22 | * ARE DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR | |
| 23 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
| 24 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
| 25 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
| 26 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | |
| 27 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | |
| 28 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
| 29 | * POSSIBILITY OF SUCH DAMAGE. | |
| 30 | */ | |
| 31 | ||
| 32 | #ifndef _BSM_AUDIT_SOCKET_TYPE_H_ | |
| 33 | #define	_BSM_AUDIT_SOCKET_TYPE_H_ | |
| 34 | ||
| 35 | /* | |
| 36 | * BSM socket type constants. | |
| 37 | */ | |
| 38 | #define	BSM_SOCK_DGRAM		1 | |
| 39 | #define	BSM_SOCK_STREAM		2 | |
| 40 | #define	BSM_SOCK_RAW		4 | |
| 41 | #define	BSM_SOCK_RDM		5 | |
| 42 | #define	BSM_SOCK_SEQPACKET	6 | |
| 43 | ||
| 44 | #define	BSM_SOCK_UNKNOWN	500 | |
| 45 | ||
| 46 | #endif /* !_BSM_AUDIT_SOCKET_TYPE_H_ */ | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/cam/cam.h+6-1| ... | ... | @@ -35,9 +35,9 @@ |
| 35 | 35 | #include "opt_cam.h" |
| 36 | 36 | #endif |
| 37 | 37 | |
| 38 | #include <sys/cdefs.h> | |
| 39 | 38 | #ifndef _KERNEL |
| 40 | 39 | #include <stdbool.h> |
| 40 | #include <stdio.h> | |
| 41 | 41 | #endif |
| 42 | 42 | |
| 43 | 43 | typedef u_int path_id_t; |
| ... | ... | @@ -350,6 +350,11 @@ typedef enum { |
| 350 | 350 | 	CAM_EAF_PRINT_RESULT	= 0x20 |
| 351 | 351 | } cam_error_ata_flags; |
| 352 | 352 | |
| 353 | typedef enum { | |
| 354 | 	CAM_ENF_PRINT_NONE	= 0x00, | |
| 355 | 	CAM_ENF_PRINT_STATUS	= 0x10, | |
| 356 | } cam_error_nvme_flags; | |
| 357 | ||
| 353 | 358 | typedef enum { |
| 354 | 359 | 	CAM_STRVIS_FLAG_NONE		= 0x00, |
| 355 | 360 | 	CAM_STRVIS_FLAG_NONASCII_MASK	= 0x03, |
lib/libc/include/generic-freebsd/cam/cam_ccb.h+39-2| ... | ... | @@ -32,7 +32,6 @@ |
| 32 | 32 | #define _CAM_CAM_CCB_H 1 |
| 33 | 33 | |
| 34 | 34 | #include <sys/queue.h> |
| 35 | #include <sys/cdefs.h> | |
| 36 | 35 | #include <sys/time.h> |
| 37 | 36 | #include <sys/limits.h> |
| 38 | 37 | #ifndef _KERNEL |
| ... | ... | @@ -298,15 +297,18 @@ typedef enum { |
| 298 | 297 | 	XPORT_SRP,	/* SCSI RDMA Protocol */ |
| 299 | 298 | 	XPORT_NVME,	/* NVMe over PCIe */ |
| 300 | 299 | 	XPORT_MMCSD,	/* MMC, SD, SDIO card */ |
| 300 | 	XPORT_NVMF,	/* NVMe over Fabrics */ | |
| 301 | 	XPORT_UFSHCI,	/* Universal Flash Storage Host Interface */ | |
| 301 | 302 | } cam_xport; |
| 302 | 303 | |
| 303 | #define XPORT_IS_NVME(t)	((t) == XPORT_NVME) | |
| 304 | #define XPORT_IS_NVME(t)	((t) == XPORT_NVME || (t) == XPORT_NVMF) | |
| 304 | 305 | #define XPORT_IS_ATA(t)		((t) == XPORT_ATA || (t) == XPORT_SATA) |
| 305 | 306 | #define XPORT_IS_SCSI(t)	((t) != XPORT_UNKNOWN && \ |
| 306 | 307 | 				 (t) != XPORT_UNSPECIFIED && \ |
| 307 | 308 | 				 !XPORT_IS_ATA(t) && !XPORT_IS_NVME(t)) |
| 308 | 309 | #define XPORT_DEVSTAT_TYPE(t)	(XPORT_IS_ATA(t) ? DEVSTAT_TYPE_IF_IDE : \ |
| 309 | 310 | 				 XPORT_IS_SCSI(t) ? DEVSTAT_TYPE_IF_SCSI : \ |
| 311 | 				 XPORT_IS_NVME(t) ? DEVSTAT_TYPE_IF_NVME : \ | |
| 310 | 312 | 				 DEVSTAT_TYPE_IF_OTHER) |
| 311 | 313 | |
| 312 | 314 | #define PROTO_VERSION_UNKNOWN (UINT_MAX - 1) |
| ... | ... | @@ -653,6 +655,12 @@ struct ccb_pathinq_settings_nvme { |
| 653 | 655 | _Static_assert(sizeof(struct ccb_pathinq_settings_nvme) == 64, |
| 654 | 656 | "ccb_pathinq_settings_nvme too big"); |
| 655 | 657 | |
| 658 | struct ccb_pathinq_settings_nvmf { | |
| 659 | 	uint32_t nsid;		/* Namespace ID for this path */ | |
| 660 | 	uint8_t trtype; | |
| 661 | 	char	 dev_name[NVME_DEV_NAME_LEN]; /* nvme controller dev name for this device */ | |
| 662 | }; | |
| 663 | ||
| 656 | 664 | #define	PATHINQ_SETTINGS_SIZE	128 |
| 657 | 665 | |
| 658 | 666 | struct ccb_pathinq { |
| ... | ... | @@ -684,6 +692,7 @@ struct ccb_pathinq { |
| 684 | 692 | 		struct ccb_pathinq_settings_fc fc; |
| 685 | 693 | 		struct ccb_pathinq_settings_sas sas; |
| 686 | 694 | 		struct ccb_pathinq_settings_nvme nvme; |
| 695 | 		struct ccb_pathinq_settings_nvmf nvmf; | |
| 687 | 696 | 		char ccb_pathinq_settings_opaque[PATHINQ_SETTINGS_SIZE]; |
| 688 | 697 | 	} xport_specific; |
| 689 | 698 | 	u_int		maxio;		/* Max supported I/O size, in bytes. */ |
| ... | ... | @@ -1050,6 +1059,31 @@ struct ccb_trans_settings_nvme |
| 1050 | 1059 | 	uint8_t		max_speed;	/* PCIe generation for each lane */ |
| 1051 | 1060 | }; |
| 1052 | 1061 | |
| 1062 | struct ccb_trans_settings_nvmf | |
| 1063 | { | |
| 1064 | 	u_int 	valid;		/* Which fields to honor */ | |
| 1065 | #define CTS_NVMF_VALID_TRTYPE	0x01 | |
| 1066 | 	uint8_t		trtype; | |
| 1067 | }; | |
| 1068 | ||
| 1069 | struct ccb_trans_settings_ufshci | |
| 1070 | { | |
| 1071 | 	u_int 	valid;		/* Which fields to honor */ | |
| 1072 | 	/* | |
| 1073 | 	 * Ensure the validity of the information for the Unipro link | |
| 1074 | 	 * (GEAR, SPEED, LANE) | |
| 1075 | 	 */ | |
| 1076 | #define CTS_UFSHCI_VALID_LINK	0x01 | |
| 1077 | 	uint32_t 	speed; | |
| 1078 | 	uint8_t 	hs_gear; 	/* High Speed Gear (G1, G2, G3...) */ | |
| 1079 | 	uint8_t 	tx_lanes; | |
| 1080 | 	uint8_t 	rx_lanes; | |
| 1081 | 	uint8_t		max_hs_gear;	/* Maximum HS Gear */ | |
| 1082 | 	uint8_t		max_tx_lanes; | |
| 1083 | 	uint8_t		max_rx_lanes; | |
| 1084 | }; | |
| 1085 | ||
| 1086 | ||
| 1053 | 1087 | #include <cam/mmc/mmc_bus.h> |
| 1054 | 1088 | struct ccb_trans_settings_mmc { |
| 1055 | 1089 | 	struct mmc_ios ios; |
| ... | ... | @@ -1122,6 +1156,8 @@ struct ccb_trans_settings { |
| 1122 | 1156 | 		struct ccb_trans_settings_pata ata; |
| 1123 | 1157 | 		struct ccb_trans_settings_sata sata; |
| 1124 | 1158 | 		struct ccb_trans_settings_nvme nvme; |
| 1159 | 		struct ccb_trans_settings_nvmf nvmf; | |
| 1160 | 		struct ccb_trans_settings_ufshci ufshci; | |
| 1125 | 1161 | 	} xport_specific; |
| 1126 | 1162 | }; |
| 1127 | 1163 | |
| ... | ... | @@ -1488,6 +1524,7 @@ cam_fill_mmcio(struct ccb_mmcio *mmcio, uint32_t retries, |
| 1488 | 1524 | 	mmcio->cmd.opcode = mmc_opcode; |
| 1489 | 1525 | 	mmcio->cmd.arg = mmc_arg; |
| 1490 | 1526 | 	mmcio->cmd.flags = mmc_flags; |
| 1527 | 	mmcio->cmd.error = 0; | |
| 1491 | 1528 | 	mmcio->stop.opcode = 0; |
| 1492 | 1529 | 	mmcio->stop.arg = 0; |
| 1493 | 1530 | 	mmcio->stop.flags = 0; |
lib/libc/include/generic-freebsd/cam/cam_debug.h+28-39| ... | ... | @@ -81,57 +81,46 @@ extern uint32_t cam_dflags; |
| 81 | 81 | /* Printf delay value (to prevent scrolling) */ |
| 82 | 82 | extern uint32_t cam_debug_delay; |
| 83 | 83 | |
| 84 | /* Debugging macros. */ | |
| 85 | #define	CAM_DEBUGGED(path, flag)			\ | |
| 86 | 	(((flag) & (CAM_DEBUG_COMPILE) & cam_dflags)	\ | |
| 87 | 	 && (cam_dpath != NULL)				\ | |
| 88 | 	 && (xpt_path_comp(cam_dpath, path) >= 0)	\ | |
| 89 | 	 && (xpt_path_comp(cam_dpath, path) < 2)) | |
| 90 | ||
| 91 | #define	CAM_DEBUG(path, flag, printfargs)		\ | |
| 92 | 	if (((flag) & (CAM_DEBUG_COMPILE) & cam_dflags)	\ | |
| 93 | 	 && (cam_dpath != NULL)				\ | |
| 94 | 	 && (xpt_path_comp(cam_dpath, path) >= 0)	\ | |
| 95 | 	 && (xpt_path_comp(cam_dpath, path) < 2)) {	\ | |
| 96 | 		xpt_print_path(path);			\ | |
| 97 | 		printf printfargs;			\ | |
| 98 | 		if (cam_debug_delay != 0)		\ | |
| 99 | 			DELAY(cam_debug_delay);		\ | |
| 100 | 	} | |
| 84 | /* Helper routines -- helps conserve stack */ | |
| 85 | struct cam_ed; | |
| 86 | void xpt_cam_path_debug(struct cam_path *path, const char *fmt, ...); | |
| 87 | void xpt_cam_dev_debug(struct cam_ed *dev, const char *fmt, ...); | |
| 88 | void xpt_cam_debug(const char *fmt, ...); | |
| 101 | 89 | |
| 102 | #define	CAM_DEBUG_DEV(dev, flag, printfargs)		\ | |
| 103 | 	if (((flag) & (CAM_DEBUG_COMPILE) & cam_dflags)	\ | |
| 104 | 	 && (cam_dpath != NULL)				\ | |
| 105 | 	 && (xpt_path_comp_dev(cam_dpath, dev) >= 0)	\ | |
| 106 | 	 && (xpt_path_comp_dev(cam_dpath, dev) < 2)) {	\ | |
| 107 | 		xpt_print_device(dev);			\ | |
| 108 | 		printf printfargs;			\ | |
| 109 | 		if (cam_debug_delay != 0)		\ | |
| 110 | 			DELAY(cam_debug_delay);		\ | |
| 90 | /* Stupid macro to remove a layer of parens */ | |
| 91 | #define _CAM_X(...) __VA_ARGS__ | |
| 92 | ||
| 93 | /* Debugging macros. */ | |
| 94 | #define	CAM_DEBUGGED(path, flag)					\ | |
| 95 | 	(((flag) & (CAM_DEBUG_COMPILE) & cam_dflags)			\ | |
| 96 | 	 && (cam_dpath != NULL)						\ | |
| 97 | 	 && (xpt_path_comp(cam_dpath, (path)) >= 0)			\ | |
| 98 | 	 && (xpt_path_comp(cam_dpath, (path)) < 2)) | |
| 99 | ||
| 100 | #define	CAM_DEBUG(path, flag, printfargs)				\ | |
| 101 | 	if (CAM_DEBUGGED(path, flag)) {					\ | |
| 102 | 		xpt_cam_path_debug(path, _CAM_X printfargs);		\ | |
| 111 | 103 | 	} |
| 112 | 104 | |
| 113 | #define	CAM_DEBUG_PRINT(flag, printfargs)		\ | |
| 114 | 	if (((flag) & (CAM_DEBUG_COMPILE) & cam_dflags)) {	\ | |
| 115 | 		printf("cam_debug: ");			\ | |
| 116 | 		printf printfargs;			\ | |
| 117 | 		if (cam_debug_delay != 0)		\ | |
| 118 | 			DELAY(cam_debug_delay);		\ | |
| 105 | #define	CAM_DEBUG_DEV(dev, flag, printfargs)				\ | |
| 106 | 	if (((flag) & (CAM_DEBUG_COMPILE) & cam_dflags)			\ | |
| 107 | 	&& (cam_dpath != NULL)						\ | |
| 108 | 	&& (xpt_path_comp_dev(cam_dpath, (dev)) >= 0)			\ | |
| 109 | 	&& (xpt_path_comp_dev(cam_dpath, (dev)) < 2)) {			\ | |
| 110 | 		xpt_cam_dev_debug(dev, _CAM_X printfargs);		\ | |
| 119 | 111 | 	} |
| 120 | 112 | |
| 121 | #define	CAM_DEBUG_PATH_PRINT(flag, path, printfargs)	\ | |
| 122 | 	if (((flag) & (CAM_DEBUG_COMPILE) & cam_dflags)) {	\ | |
| 123 | 		xpt_print(path, "cam_debug: ");		\ | |
| 124 | 		printf printfargs;			\ | |
| 125 | 		if (cam_debug_delay != 0)		\ | |
| 126 | 			DELAY(cam_debug_delay);		\ | |
| 113 | #define	CAM_DEBUG_PRINT(flag, printfargs)				\ | |
| 114 | 	if (((flag) & (CAM_DEBUG_COMPILE) & cam_dflags)) {		\ | |
| 115 | 		xpt_cam_debug(_CAM_X printfargs);			\ | |
| 127 | 116 | 	} |
| 128 | 117 | |
| 129 | 118 | #else /* !_KERNEL */ |
| 130 | 119 | |
| 131 | 120 | #define	CAM_DEBUGGED(A, B)	0 |
| 132 | 121 | #define	CAM_DEBUG(A, B, C) |
| 122 | #define	CAM_DEBUG_DEV(A, B, C) | |
| 133 | 123 | #define	CAM_DEBUG_PRINT(A, B) |
| 134 | #define	CAM_DEBUG_PATH_PRINT(A, B, C) | |
| 135 | 124 | |
| 136 | 125 | #endif /* _KERNEL */ |
| 137 | 126 |
lib/libc/include/generic-freebsd/cam/cam_iosched.h+3-1| ... | ... | @@ -79,8 +79,10 @@ cam_iosched_sbintime_t(uintptr_t delta) |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | typedef void (*cam_iosched_latfcn_t)(void *, sbintime_t, struct bio *); |
| 82 | typedef void (*cam_iosched_schedule_t)(struct cam_periph *periph); | |
| 82 | 83 | |
| 83 | int cam_iosched_init(struct cam_iosched_softc **, struct cam_periph *periph); | |
| 84 | int cam_iosched_init(struct cam_iosched_softc **, struct cam_periph *periph, | |
| 85 | const struct disk *dp, cam_iosched_schedule_t schedfnp); | |
| 84 | 86 | void cam_iosched_fini(struct cam_iosched_softc *); |
| 85 | 87 | void cam_iosched_sysctl_init(struct cam_iosched_softc *, struct sysctl_ctx_list *, struct sysctl_oid *); |
| 86 | 88 | struct bio *cam_iosched_next_trim(struct cam_iosched_softc *isc); |
lib/libc/include/generic-freebsd/cam/cam_sim.h-9| ... | ... | @@ -60,15 +60,6 @@ struct cam_sim * cam_sim_alloc(sim_action_func sim_action, |
| 60 | 60 | 				int max_dev_transactions, |
| 61 | 61 | 				int max_tagged_dev_transactions, |
| 62 | 62 | 				struct cam_devq *queue); |
| 63 | struct cam_sim * cam_sim_alloc_dev(sim_action_func sim_action, | |
| 64 | 				sim_poll_func sim_poll, | |
| 65 | 				const char *sim_name, | |
| 66 | 				void *softc, | |
| 67 | 				device_t dev, | |
| 68 | 				struct mtx *mtx, | |
| 69 | 				int max_dev_transactions, | |
| 70 | 				int max_tagged_dev_transactions, | |
| 71 | 				struct cam_devq *queue); | |
| 72 | 63 | void		 cam_sim_free(struct cam_sim *sim, int free_devq); |
| 73 | 64 | void		 cam_sim_hold(struct cam_sim *sim); |
| 74 | 65 | void		 cam_sim_release(struct cam_sim *sim); |
lib/libc/include/generic-freebsd/cam/cam_xpt.h+17-7| ... | ... | @@ -33,16 +33,15 @@ |
| 33 | 33 | #define _CAM_CAM_XPT_H 1 |
| 34 | 34 | |
| 35 | 35 | #ifdef _KERNEL |
| 36 | #include <sys/cdefs.h> | |
| 37 | 36 | #include <cam/cam_ccb.h> |
| 38 | 37 | #endif |
| 38 | #include <sys/sbuf.h> | |
| 39 | 39 | |
| 40 | 40 | /* Forward Declarations */ |
| 41 | 41 | union ccb; |
| 42 | 42 | struct cam_periph; |
| 43 | 43 | struct cam_ed; |
| 44 | 44 | struct cam_sim; |
| 45 | struct sbuf; | |
| 46 | 45 | |
| 47 | 46 | /* |
| 48 | 47 | * Definition of a CAM path. Paths are created from bus, target, and lun ids |
| ... | ... | @@ -113,7 +112,6 @@ struct cam_sim		*xpt_path_sim(struct cam_path *path); |
| 113 | 112 | struct cam_periph	*xpt_path_periph(struct cam_path *path); |
| 114 | 113 | device_t		xpt_path_sim_device(const struct cam_path *path); |
| 115 | 114 | void			xpt_print_path(struct cam_path *path); |
| 116 | void			xpt_print_device(struct cam_ed *device); | |
| 117 | 115 | void			xpt_print(struct cam_path *path, const char *fmt, ...); |
| 118 | 116 | void			xpt_async(uint32_t async_code, struct cam_path *path, |
| 119 | 117 | 				 void *async_arg); |
| ... | ... | @@ -147,19 +145,31 @@ uint32_t		xpt_poll_setup(union ccb *start_ccb); |
| 147 | 145 | void			xpt_sim_poll(struct cam_sim *sim); |
| 148 | 146 | |
| 149 | 147 | /* |
| 150 | * Perform a path inquiry at the request priority. The bzero may be | |
| 151 | * unnecessary. | |
| 148 | * Perform a path inquiry. bzero may be redundant for allocated CCBs, but for | |
| 149 | * the on-stack CCBs it's required. | |
| 152 | 150 | */ |
| 153 | 151 | static inline void |
| 154 | 152 | xpt_path_inq(struct ccb_pathinq *cpi, struct cam_path *path) |
| 155 | 153 | { |
| 156 | ||
| 157 | 154 | 	bzero(cpi, sizeof(*cpi)); |
| 158 | 	xpt_setup_ccb(&cpi->ccb_h, path, CAM_PRIORITY_NORMAL); | |
| 155 | 	xpt_setup_ccb(&cpi->ccb_h, path, CAM_PRIORITY_NONE); | |
| 159 | 156 | 	cpi->ccb_h.func_code = XPT_PATH_INQ; |
| 160 | 157 | 	xpt_action((union ccb *)cpi); |
| 161 | 158 | } |
| 162 | 159 | |
| 160 | /* | |
| 161 | * Perform get device type. bzero may be redundant for allocated CCBs, but for | |
| 162 | * the on-stack CCBs it's required. | |
| 163 | */ | |
| 164 | static inline void | |
| 165 | xpt_gdev_type(struct ccb_getdev *cgd, struct cam_path *path) | |
| 166 | { | |
| 167 | 	bzero(cgd, sizeof(*cgd)); | |
| 168 | 	xpt_setup_ccb(&cgd->ccb_h, path, CAM_PRIORITY_NONE); | |
| 169 | 	cgd->ccb_h.func_code = XPT_GDEV_TYPE; | |
| 170 | 	xpt_action((union ccb *)cgd); | |
| 171 | } | |
| 172 | ||
| 163 | 173 | #endif /* _KERNEL */ |
| 164 | 174 | |
| 165 | 175 | #endif /* _CAM_CAM_XPT_H */ |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/cam/nvme/nvme_all.h+2-2| ... | ... | @@ -42,10 +42,10 @@ struct sbuf; |
| 42 | 42 | void	nvme_print_ident(const struct nvme_controller_data *, const struct nvme_namespace_data *, struct sbuf *); |
| 43 | 43 | void	nvme_print_ident_short(const struct nvme_controller_data *, |
| 44 | 44 | const struct nvme_namespace_data *, struct sbuf *); |
| 45 | const char *nvme_op_string(const struct nvme_command *, int admin); | |
| 46 | const char *nvme_cmd_string(const struct nvme_command *, char *, size_t); | |
| 47 | 45 | void nvme_cmd_sbuf(const struct nvme_command *, struct sbuf *sb); |
| 48 | 46 | int nvme_command_sbuf(struct ccb_nvmeio *nvmeio, struct sbuf *sb); |
| 47 | const char *nvme_command_string(struct ccb_nvmeio *nvmeio, char *, size_t); | |
| 48 | int nvme_status_sbuf(struct ccb_nvmeio *nvmeio, struct sbuf *sb); | |
| 49 | 49 | const void *nvme_get_identify_cntrl(struct cam_periph *); |
| 50 | 50 | const void *nvme_get_identify_ns(struct cam_periph *); |
| 51 | 51 |
lib/libc/include/generic-freebsd/cam/scsi/scsi_all.h+8-15| ... | ... | @@ -1,18 +1,12 @@ |
| 1 | /*- | |
| 2 | * Largely written by Julian Elischer (julian@tfs.com) | |
| 3 | * for TRW Financial Systems. | |
| 4 | * | |
| 5 | * TRW Financial Systems, in accordance with their agreement with Carnegie | |
| 6 | * Mellon University, makes this software available to CMU to distribute | |
| 7 | * or use in any manner that they see fit as long as this message is kept with | |
| 8 | * the software. For this reason TFS also grants any other persons or | |
| 9 | * organisations permission to use or modify this software. | |
| 1 | /* | |
| 2 | * Copyright (c) 1997-2017 Kenneth D. Merry <ken@FreeBSD.org> | |
| 3 | * Copyright (c) 2012-2020 Alexander Motin <mav@FreeBSD.org> | |
| 4 | * Copyright (c) 1997-2011 Justin T. Gibbs <gibbs@FreeBSD.org> | |
| 10 | 5 | * |
| 11 | * TFS supplies this software to be publicly redistributed | |
| 12 | * on the understanding that TFS is not responsible for the correct | |
| 13 | * functioning of this software in any circumstances. | |
| 6 | * SPDX-License-Identifier: BSD-2-Clause | |
| 14 | 7 | * |
| 15 | * Ported to run under 386BSD by Julian Elischer (julian@tfs.com) Sept 1992 | |
| 8 | * Original scsi_all.h from 386BSD was by Julian Elischer at TRW Financial | |
| 9 | * Services has been transformed into a new work by subsequent contributors. | |
| 16 | 10 | */ |
| 17 | 11 | |
| 18 | 12 | /* |
| ... | ... | @@ -22,10 +16,9 @@ |
| 22 | 16 | #ifndef	_SCSI_SCSI_ALL_H |
| 23 | 17 | #define	_SCSI_SCSI_ALL_H 1 |
| 24 | 18 | |
| 25 | #include <sys/cdefs.h> | |
| 26 | 19 | #ifdef _KERNEL |
| 27 | 20 | #include <sys/malloc.h> |
| 28 | #include <machine/stdarg.h> | |
| 21 | #include <sys/stdarg.h> | |
| 29 | 22 | #else |
| 30 | 23 | #include <stdarg.h> |
| 31 | 24 | #endif |
lib/libc/include/generic-freebsd/cam/scsi/scsi_ch.h-1| ... | ... | @@ -64,7 +64,6 @@ |
| 64 | 64 | #ifndef _SCSI_SCSI_CH_H |
| 65 | 65 | #define _SCSI_SCSI_CH_H 1 |
| 66 | 66 | |
| 67 | #include <sys/cdefs.h> | |
| 68 | 67 | |
| 69 | 68 | /* |
| 70 | 69 | * SCSI command format |
lib/libc/include/generic-freebsd/cam/scsi/scsi_da.h-1| ... | ... | @@ -50,7 +50,6 @@ |
| 50 | 50 | #ifndef	_SCSI_SCSI_DA_H |
| 51 | 51 | #define _SCSI_SCSI_DA_H 1 |
| 52 | 52 | |
| 53 | #include <sys/cdefs.h> | |
| 54 | 53 | |
| 55 | 54 | struct scsi_rezero_unit |
| 56 | 55 | { |
lib/libc/include/generic-freebsd/cam/scsi/scsi_sa.h-1| ... | ... | @@ -33,7 +33,6 @@ |
| 33 | 33 | #ifndef	_SCSI_SCSI_SA_H |
| 34 | 34 | #define _SCSI_SCSI_SA_H 1 |
| 35 | 35 | |
| 36 | #include <sys/cdefs.h> | |
| 37 | 36 | |
| 38 | 37 | struct scsi_read_block_limits |
| 39 | 38 | { |
lib/libc/include/generic-freebsd/crypto/cryptodev.h+1-1| ... | ... | @@ -433,7 +433,7 @@ struct cryptop { |
| 433 | 433 | 	int		crp_flags; |
| 434 | 434 | |
| 435 | 435 | #define	CRYPTO_F_CBIMM		0x0010	/* Do callback immediately */ |
| 436 | #define	CRYPTO_F_DONE		0x0020	/* Operation completed */ | |
| 436 | #define	CRYPTO_F_DONE		0x0020	/* Deprecated, do not use */ | |
| 437 | 437 | #define	CRYPTO_F_CBIFSYNC	0x0040	/* Do CBIMM if op is synchronous */ |
| 438 | 438 | #define	CRYPTO_F_ASYNC_ORDERED	0x0100	/* Completions must happen in order */ |
| 439 | 439 | #define	CRYPTO_F_IV_SEPARATE	0x0200	/* Use crp_iv[] as IV. */ |
lib/libc/include/generic-freebsd/ctype.h-2| ... | ... | @@ -35,8 +35,6 @@ |
| 35 | 35 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 36 | 36 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 37 | 37 | * SUCH DAMAGE. |
| 38 | * | |
| 39 | *	@(#)ctype.h	8.4 (Berkeley) 1/21/94 | |
| 40 | 38 | */ |
| 41 | 39 | |
| 42 | 40 | #ifndef _CTYPE_H_ |
lib/libc/include/generic-freebsd/db.h-2| ... | ... | @@ -27,8 +27,6 @@ |
| 27 | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | * | |
| 31 | *	@(#)db.h	8.7 (Berkeley) 6/16/94 | |
| 32 | 30 | */ |
| 33 | 31 | |
| 34 | 32 | #ifndef _DB_H_ |
lib/libc/include/generic-freebsd/dev/ciss/cissreg.h+1-1| ... | ... | @@ -684,7 +684,7 @@ struct ciss_bmic_id_table { |
| 684 | 684 | u_int8_t	percent_write_cache; /* Percent of memory allocated to write cache */ |
| 685 | 685 | u_int16_t	daughterboard_size_mb; /* Total size (MB) of cache board */ |
| 686 | 686 | u_int8_t	cache_batter_count; /* Number of cache batteries */ |
| 687 | u_int16_t	total_controller_mem_mb; /* Total size (MB) of atttached memory */ | |
| 687 | u_int16_t	total_controller_mem_mb; /* Total size (MB) of attached memory */ | |
| 688 | 688 | u_int8_t	more_controller_flags; /* Additional controller flags byte */ |
| 689 | 689 | u_int8_t	x_board_host_i2c_rev; /* 2nd byte of 3 byte autorev field */ |
| 690 | 690 | u_int8_t	battery_pic_rev; /* BBWC PIC revision */ |
lib/libc/include/generic-freebsd/dev/ciss/cissvar.h+2-1| ... | ... | @@ -184,7 +184,7 @@ struct ciss_softc |
| 184 | 184 | { |
| 185 | 185 | /* bus connections */ |
| 186 | 186 | device_t			ciss_dev;		/* bus attachment */ |
| 187 | struct cdev *ciss_dev_t;		/* control device */ | |
| 187 | struct cdev			*ciss_dev_t;		/* control device */ | |
| 188 | 188 | |
| 189 | 189 | struct resource		*ciss_regs_resource;	/* register interface window */ |
| 190 | 190 | int				ciss_regs_rid;		/* resource ID */ |
| ... | ... | @@ -236,6 +236,7 @@ struct ciss_softc |
| 236 | 236 | int				ciss_max_bus_number;	/* maximum bus number */ |
| 237 | 237 | int				ciss_max_logical_bus; |
| 238 | 238 | int				ciss_max_physical_bus; |
| 239 | int				ciss_max_physical_target;	/* highest physical target number */ | |
| 239 | 240 | |
| 240 | 241 | struct cam_devq		*ciss_cam_devq; |
| 241 | 242 | struct cam_sim		**ciss_cam_sim; |
lib/libc/include/generic-freebsd/dev/firewire/firewirereg.h+1-1| ... | ... | @@ -293,7 +293,7 @@ extern int firewire_debug; |
| 293 | 293 | extern devclass_t firewire_devclass; |
| 294 | 294 | extern int firewire_phydma_enable; |
| 295 | 295 | |
| 296 | #define	FWPRI		((PZERO + 8) | PCATCH) | |
| 296 | #define	FWPRI		(PWAIT | PCATCH) | |
| 297 | 297 | |
| 298 | 298 | #define CALLOUT_INIT(x) callout_init(x, 1 /* mpsafe */) |
| 299 | 299 |
lib/libc/include/generic-freebsd/dev/hid/hid.h+20-16| ... | ... | @@ -57,6 +57,7 @@ |
| 57 | 57 | #define	HUP_SCALE		0x008c |
| 58 | 58 | #define	HUP_CAMERA_CONTROL	0x0090 |
| 59 | 59 | #define	HUP_ARCADE		0x0091 |
| 60 | #define	HUP_FIDO		0xf1d0 | |
| 60 | 61 | #define	HUP_MICROSOFT		0xff00 |
| 61 | 62 | |
| 62 | 63 | /* Usages, generic desktop */ |
| ... | ... | @@ -161,6 +162,9 @@ |
| 161 | 162 | #define	HUC_HEADPHONE		0x0005 |
| 162 | 163 | #define	HUC_AC_PAN		0x0238 |
| 163 | 164 | |
| 165 | /* Usages, FIDO */ | |
| 166 | #define	HUF_U2FHID		0x0001 | |
| 167 | ||
| 164 | 168 | #define	HID_USAGE2(p,u)		(((p) << 16) | (u)) |
| 165 | 169 | #define	HID_GET_USAGE(u)	((u) & 0xffff) |
| 166 | 170 | #define	HID_GET_USAGE_PAGE(u)	(((u) >> 16) & 0xffff) |
| ... | ... | @@ -233,31 +237,31 @@ struct hid_location { |
| 233 | 237 | |
| 234 | 238 | struct hid_item { |
| 235 | 239 | 	/* Global */ |
| 236 | 	int32_t	_usage_page; | |
| 240 | 	uint32_t _usage_page; | |
| 237 | 241 | 	int32_t	logical_minimum; |
| 238 | 242 | 	int32_t	logical_maximum; |
| 239 | 243 | 	int32_t	physical_minimum; |
| 240 | 244 | 	int32_t	physical_maximum; |
| 241 | 	int32_t	unit_exponent; | |
| 242 | 	int32_t	unit; | |
| 243 | 	int32_t	report_ID; | |
| 245 | 	uint32_t unit_exponent; | |
| 246 | 	uint32_t unit; | |
| 247 | 	uint32_t report_ID; | |
| 244 | 248 | 	/* Local */ |
| 245 | 249 | 	int	nusages; |
| 246 | 250 | 	union { |
| 247 | 		int32_t	usage; | |
| 248 | 		int32_t usages[HID_ITEM_MAXUSAGE]; | |
| 251 | 		uint32_t usage; | |
| 252 | 		uint32_t usages[HID_ITEM_MAXUSAGE]; | |
| 249 | 253 | 	}; |
| 250 | 	int32_t	usage_minimum; | |
| 251 | 	int32_t	usage_maximum; | |
| 252 | 	int32_t	designator_index; | |
| 253 | 	int32_t	designator_minimum; | |
| 254 | 	int32_t	designator_maximum; | |
| 255 | 	int32_t	string_index; | |
| 256 | 	int32_t	string_minimum; | |
| 257 | 	int32_t	string_maximum; | |
| 258 | 	int32_t	set_delimiter; | |
| 254 | 	uint32_t usage_minimum; | |
| 255 | 	uint32_t usage_maximum; | |
| 256 | 	uint32_t designator_index; | |
| 257 | 	uint32_t designator_minimum; | |
| 258 | 	uint32_t designator_maximum; | |
| 259 | 	uint32_t string_index; | |
| 260 | 	uint32_t string_minimum; | |
| 261 | 	uint32_t string_maximum; | |
| 262 | 	uint32_t set_delimiter; | |
| 259 | 263 | 	/* Misc */ |
| 260 | 	int32_t	collection; | |
| 264 | 	uint32_t collection; | |
| 261 | 265 | 	int	collevel; |
| 262 | 266 | 	enum hid_kind kind; |
| 263 | 267 | 	uint32_t flags; |
lib/libc/include/generic-freebsd/dev/hid/hidraw.h+4| ... | ... | @@ -92,5 +92,9 @@ struct hidraw_devinfo { |
| 92 | 92 | #define	HIDIOCSFEATURE(len)	_IOC(IOC_IN, 'U', 35, len) |
| 93 | 93 | #define	HIDIOCGFEATURE(len)	_IOC(IOC_INOUT, 'U', 36, len) |
| 94 | 94 | #define	HIDIOCGRAWUNIQ(len)	_IOC(IOC_OUT, 'U', 37, len) |
| 95 | #define	HIDIOCSINPUT(len)	_IOC(IOC_IN, 'U', 38, len) | |
| 96 | #define	HIDIOCGINPUT(len)	_IOC(IOC_INOUT, 'U', 39, len) | |
| 97 | #define	HIDIOCSOUTPUT(len)	_IOC(IOC_IN, 'U', 40, len) | |
| 98 | #define	HIDIOCGOUTPUT(len)	_IOC(IOC_INOUT, 'U', 41, len) | |
| 95 | 99 | |
| 96 | 100 | #endif	/* _HID_HIDRAW_H */ |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/dev/hwpmc/hwpmc_amd.h+1-1| ... | ... | @@ -31,7 +31,7 @@ |
| 31 | 31 | #ifndef _DEV_HWPMC_AMD_H_ |
| 32 | 32 | #define	_DEV_HWPMC_AMD_H_ 1 |
| 33 | 33 | |
| 34 | /* AMD K7 and K8 PMCs */ | |
| 34 | /* AMD K8 PMCs */ | |
| 35 | 35 | |
| 36 | 36 | #define	AMD_PMC_EVSEL_0		0xC0010000 |
| 37 | 37 | #define	AMD_PMC_EVSEL_1		0xC0010001 |
lib/libc/include/generic-freebsd/dev/hwpmc/hwpmc_arm64.h+1-1| ... | ... | @@ -42,7 +42,7 @@ |
| 42 | 42 | #ifdef _KERNEL |
| 43 | 43 | /* MD extension for 'struct pmc' */ |
| 44 | 44 | struct pmc_md_arm64_pmc { |
| 45 | 	uint32_t	pm_arm64_evsel; | |
| 45 | 	uint64_t	pm_arm64_evsel; | |
| 46 | 46 | }; |
| 47 | 47 | #endif /* _KERNEL */ |
| 48 | 48 | #endif /* _DEV_HWPMC_ARMV8_H_ */ |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/dev/hwpmc/hwpmc_core.h-2| ... | ... | @@ -198,11 +198,9 @@ int	pmc_core_initialize(struct pmc_mdep *_md, int _maxcpu, |
| 198 | 198 | void	pmc_core_finalize(struct pmc_mdep *_md); |
| 199 | 199 | |
| 200 | 200 | int	pmc_iaf_initialize(struct pmc_mdep *_md, int _maxcpu, int _npmc, int _width); |
| 201 | void	pmc_iaf_finalize(struct pmc_mdep *_md); | |
| 202 | 201 | |
| 203 | 202 | int	pmc_iap_initialize(struct pmc_mdep *_md, int _maxcpu, int _npmc, int _width, |
| 204 | 203 | 	 int _flags); |
| 205 | void	pmc_iap_finalize(struct pmc_mdep *_md); | |
| 206 | 204 | |
| 207 | 205 | #endif	/* _KERNEL */ |
| 208 | 206 | #endif	/* _DEV_HWPMC_CORE_H */ |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/dev/hwpmc/pmc_events.h+1-36| ... | ... | @@ -62,39 +62,6 @@ __PMC_EV_ALIAS("cycles",	TSC_TSC) |
| 62 | 62 | #define PMC_EV_SOFT_FIRST 0x20000 |
| 63 | 63 | #define PMC_EV_SOFT_LAST (PMC_EV_SOFT_FIRST + PMC_EV_DYN_COUNT - 1) |
| 64 | 64 | |
| 65 | /* | |
| 66 | * AMD K7 Events, from "The AMD Athlon(tm) Processor x86 Code | |
| 67 | * Optimization Guide" [Doc#22007K, Feb 2002] | |
| 68 | */ | |
| 69 | ||
| 70 | #define	__PMC_EV_K7()					\ | |
| 71 | __PMC_EV(K7, DC_ACCESSES)				\ | |
| 72 | __PMC_EV(K7, DC_MISSES)					\ | |
| 73 | __PMC_EV(K7, DC_REFILLS_FROM_L2)			\ | |
| 74 | __PMC_EV(K7, DC_REFILLS_FROM_SYSTEM)			\ | |
| 75 | __PMC_EV(K7, DC_WRITEBACKS)				\ | |
| 76 | __PMC_EV(K7, L1_DTLB_MISS_AND_L2_DTLB_HITS)		\ | |
| 77 | __PMC_EV(K7, L1_AND_L2_DTLB_MISSES)			\ | |
| 78 | __PMC_EV(K7, MISALIGNED_REFERENCES)			\ | |
| 79 | __PMC_EV(K7, IC_FETCHES)				\ | |
| 80 | __PMC_EV(K7, IC_MISSES)					\ | |
| 81 | __PMC_EV(K7, L1_ITLB_MISSES)				\ | |
| 82 | __PMC_EV(K7, L1_L2_ITLB_MISSES)				\ | |
| 83 | __PMC_EV(K7, RETIRED_INSTRUCTIONS)			\ | |
| 84 | __PMC_EV(K7, RETIRED_OPS)				\ | |
| 85 | __PMC_EV(K7, RETIRED_BRANCHES)				\ | |
| 86 | __PMC_EV(K7, RETIRED_BRANCHES_MISPREDICTED)		\ | |
| 87 | __PMC_EV(K7, RETIRED_TAKEN_BRANCHES)			\ | |
| 88 | __PMC_EV(K7, RETIRED_TAKEN_BRANCHES_MISPREDICTED)	\ | |
| 89 | __PMC_EV(K7, RETIRED_FAR_CONTROL_TRANSFERS)		\ | |
| 90 | __PMC_EV(K7, RETIRED_RESYNC_BRANCHES)			\ | |
| 91 | __PMC_EV(K7, INTERRUPTS_MASKED_CYCLES)			\ | |
| 92 | __PMC_EV(K7, INTERRUPTS_MASKED_WHILE_PENDING_CYCLES)	\ | |
| 93 | __PMC_EV(K7, HARDWARE_INTERRUPTS) | |
| 94 | ||
| 95 | #define	PMC_EV_K7_FIRST	PMC_EV_K7_DC_ACCESSES | |
| 96 | #define	PMC_EV_K7_LAST	PMC_EV_K7_HARDWARE_INTERRUPTS | |
| 97 | ||
| 98 | 65 | /* AMD K8 PMCs */ |
| 99 | 66 | |
| 100 | 67 | #define	__PMC_EV_K8()							\ |
| ... | ... | @@ -2431,7 +2398,7 @@ __PMC_EV_ALIAS("unhalted-reference-cycles", IAF_CPU_CLK_UNHALTED_REF) |
| 2431 | 2398 | * START	#EVENTS		DESCRIPTION |
| 2432 | 2399 | * 0		0x1000		Reserved |
| 2433 | 2400 | * 0x1000	0x0001		TSC |
| 2434 | * 0x2000	0x0080		AMD K7 events | |
| 2401 | * 0x2000	0x0080		free (was AMD K7 events) | |
| 2435 | 2402 | * 0x2080	0x0100		AMD K8 events |
| 2436 | 2403 | * 0x10000	0x0080		INTEL architectural fixed-function events |
| 2437 | 2404 | * 0x10080	0x0F80		free (was INTEL architectural programmable events) |
| ... | ... | @@ -2457,8 +2424,6 @@ __PMC_EV_ALIAS("unhalted-reference-cycles", IAF_CPU_CLK_UNHALTED_REF) |
| 2457 | 2424 | #define	__PMC_EVENTS()					\ |
| 2458 | 2425 | 	__PMC_EV_BLOCK(TSC,		0x01000)	\ |
| 2459 | 2426 | 	__PMC_EV_TSC()					\ |
| 2460 | 	__PMC_EV_BLOCK(K7,		0x02000)	\ | |
| 2461 | 	__PMC_EV_K7()					\ | |
| 2462 | 2427 | 	__PMC_EV_BLOCK(K8,		0x02080)	\ |
| 2463 | 2428 | 	__PMC_EV_K8()					\ |
| 2464 | 2429 | 	__PMC_EV_BLOCK(IAF,		0x10000)	\ |
lib/libc/include/generic-freebsd/dev/ic/nec765.h-2| ... | ... | @@ -27,8 +27,6 @@ |
| 27 | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | * | |
| 31 | *	from: @(#)nec765.h	7.1 (Berkeley) 5/9/91 | |
| 32 | 30 | */ |
| 33 | 31 | |
| 34 | 32 | /* |
lib/libc/include/generic-freebsd/dev/ic/ns16550.h-5| ... | ... | @@ -27,8 +27,6 @@ |
| 27 | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | * | |
| 31 | *	from: @(#)ns16550.h	7.1 (Berkeley) 5/9/91 | |
| 32 | 30 | */ |
| 33 | 31 | |
| 34 | 32 | /* |
| ... | ... | @@ -162,9 +160,6 @@ |
| 162 | 160 | #define	FIFO_XMT_RST	FCR_XMT_RST |
| 163 | 161 | #define	FCR_DMA		0x08 |
| 164 | 162 | #define	FIFO_DMA_MODE	FCR_DMA |
| 165 | #ifdef CPU_XBURST | |
| 166 | #define	FCR_UART_ON	0x10 | |
| 167 | #endif | |
| 168 | 163 | #define	FCR_RX_LOW	0x00 |
| 169 | 164 | #define	FIFO_RX_LOW	FCR_RX_LOW |
| 170 | 165 | #define	FCR_RX_MEDL	0x40 |
lib/libc/include/generic-freebsd/dev/iicbus/iiconf.h+1-1| ... | ... | @@ -32,7 +32,7 @@ |
| 32 | 32 | #include <dev/iicbus/iic.h> |
| 33 | 33 | |
| 34 | 34 | |
| 35 | #define IICPRI (PZERO+8)		/* XXX sleep/wakeup queue priority */ | |
| 35 | #define IICPRI (PWAIT)		/* XXX sleep/wakeup queue priority */ | |
| 36 | 36 | |
| 37 | 37 | #define LSB 0x1 |
| 38 | 38 |
lib/libc/include/generic-freebsd/dev/mfi/mfireg.h+1-1| ... | ... | @@ -1028,7 +1028,7 @@ struct mfi_evt_detail { |
| 1028 | 1028 | 		} pd_prog; |
| 1029 | 1029 | |
| 1030 | 1030 | 		struct { |
| 1031 | 			struct mfi_evt_pd	ld; | |
| 1031 | 			struct mfi_evt_pd	pd; | |
| 1032 | 1032 | 			uint32_t		prev_state; |
| 1033 | 1033 | 			uint32_t		new_state; |
| 1034 | 1034 | 		} pd_state; |
lib/libc/include/generic-freebsd/dev/mmc/bridge.h+5| ... | ... | @@ -103,6 +103,10 @@ enum mmc_chip_select { |
| 103 | 103 | 	cs_dontcare = 0, cs_high, cs_low |
| 104 | 104 | }; |
| 105 | 105 | |
| 106 | enum mmc_bus_type { | |
| 107 | 	bus_type_default = 0, bus_type_spi | |
| 108 | }; | |
| 109 | ||
| 106 | 110 | enum mmc_bus_width { |
| 107 | 111 | 	bus_width_1 = 0, bus_width_4 = 2, bus_width_8 = 3 |
| 108 | 112 | }; |
| ... | ... | @@ -123,6 +127,7 @@ struct mmc_ios { |
| 123 | 127 | 	uint32_t	clock;	/* Speed of the clock in Hz to move data */ |
| 124 | 128 | 	enum mmc_vdd	vdd;	/* Voltage to apply to the power pins */ |
| 125 | 129 | 	enum mmc_vccq	vccq;	/* Voltage to use for signaling */ |
| 130 | 	enum mmc_bus_type bus_type; | |
| 126 | 131 | 	enum mmc_bus_mode bus_mode; |
| 127 | 132 | 	enum mmc_chip_select chip_select; |
| 128 | 133 | 	enum mmc_bus_width bus_width; |
lib/libc/include/generic-freebsd/dev/mmc/mmc_fdt_helpers.h+1-1| ... | ... | @@ -31,7 +31,7 @@ |
| 31 | 31 | #include <dev/gpio/gpiobusvar.h> |
| 32 | 32 | #include <dev/ofw/ofw_bus.h> |
| 33 | 33 | |
| 34 | #include <dev/extres/regulator/regulator.h> | |
| 34 | #include <dev/regulator/regulator.h> | |
| 35 | 35 | |
| 36 | 36 | #include <dev/mmc/mmc_helpers.h> |
| 37 | 37 |
lib/libc/include/generic-freebsd/dev/mmc/mmc_helpers.h+1-1| ... | ... | @@ -30,7 +30,7 @@ |
| 30 | 30 | |
| 31 | 31 | #include <dev/gpio/gpiobusvar.h> |
| 32 | 32 | |
| 33 | #include <dev/extres/regulator/regulator.h> | |
| 33 | #include <dev/regulator/regulator.h> | |
| 34 | 34 | |
| 35 | 35 | struct mmc_helper { |
| 36 | 36 | 	device_t		dev; |
lib/libc/include/generic-freebsd/dev/mmc/mmcbrvar.h+12| ... | ... | @@ -60,6 +60,7 @@ |
| 60 | 60 | #include "mmcbr_if.h" |
| 61 | 61 | |
| 62 | 62 | enum mmcbr_device_ivars { |
| 63 | MMCBR_IVAR_BUS_TYPE, | |
| 63 | 64 | MMCBR_IVAR_BUS_MODE, |
| 64 | 65 | MMCBR_IVAR_BUS_WIDTH, |
| 65 | 66 | MMCBR_IVAR_CHIP_SELECT, |
| ... | ... | @@ -113,6 +114,17 @@ mmcbr_get_retune_req(device_t dev) |
| 113 | 114 | 	return ((int)v); |
| 114 | 115 | } |
| 115 | 116 | |
| 117 | static int __inline | |
| 118 | mmcbr_get_bus_type(device_t dev) | |
| 119 | { | |
| 120 | 	uintptr_t v; | |
| 121 | ||
| 122 | 	if (__predict_false(BUS_READ_IVAR(device_get_parent(dev), dev, | |
| 123 | 	 MMCBR_IVAR_BUS_TYPE, &v) != 0)) | |
| 124 | 		return (bus_type_default); | |
| 125 | 	return ((int)v); | |
| 126 | } | |
| 127 | ||
| 116 | 128 | /* |
| 117 | 129 | * Convenience wrappers for the mmcbr interface |
| 118 | 130 | */ |
lib/libc/include/generic-freebsd/dev/mmc/mmcreg.h+1| ... | ... | @@ -80,6 +80,7 @@ struct mmc_command { |
| 80 | 80 | #define	MMC_CMD_BC	(2ul << 5)	/* Broadcast command, no response */ |
| 81 | 81 | #define	MMC_CMD_BCR	(3ul << 5)	/* Broadcast command with response */ |
| 82 | 82 | #define	MMC_CMD_MASK	(3ul << 5) |
| 83 | #define	MMC_CMD_IS_APP (1ul << 7)	/* Next cmd after MMC_APP_CMD */ | |
| 83 | 84 | |
| 84 | 85 | /* Possible response types defined in the standard: */ |
| 85 | 86 | #define	MMC_RSP_NONE	(0) |
lib/libc/include/generic-freebsd/dev/nvme/nvme.h+80-7| ... | ... | @@ -35,15 +35,23 @@ |
| 35 | 35 | |
| 36 | 36 | #include <sys/param.h> |
| 37 | 37 | #include <sys/endian.h> |
| 38 | #ifndef _KERNEL | |
| 39 | #include <stdbool.h> | |
| 40 | #endif | |
| 41 | ||
| 42 | struct sbuf; | |
| 38 | 43 | |
| 39 | 44 | #define	NVME_PASSTHROUGH_CMD		_IOWR('n', 0, struct nvme_pt_command) |
| 40 | 45 | #define	NVME_RESET_CONTROLLER		_IO('n', 1) |
| 41 | 46 | #define	NVME_GET_NSID			_IOR('n', 2, struct nvme_get_nsid) |
| 42 | 47 | #define	NVME_GET_MAX_XFER_SIZE		_IOR('n', 3, uint64_t) |
| 48 | #define	NVME_GET_CONTROLLER_DATA	_IOR('n', 4, struct nvme_controller_data) | |
| 43 | 49 | |
| 44 | 50 | #define	NVME_IO_TEST			_IOWR('n', 100, struct nvme_io_test) |
| 45 | 51 | #define	NVME_BIO_TEST			_IOWR('n', 101, struct nvme_io_test) |
| 46 | 52 | |
| 53 | /* NB: Fabrics-specific ioctls defined in nvmf.h start at 200. */ | |
| 54 | ||
| 47 | 55 | /* |
| 48 | 56 | * Macros to deal with NVME revisions, as defined VS register |
| 49 | 57 | */ |
| ... | ... | @@ -211,6 +219,11 @@ |
| 211 | 219 | |
| 212 | 220 | /* Command field definitions */ |
| 213 | 221 | |
| 222 | enum nvme_fuse { | |
| 223 | 	NVME_FUSE_NORMAL				= 0x0, | |
| 224 | 	NVME_FUSE_FIRST					= 0x1, | |
| 225 | 	NVME_FUSE_SECOND				= 0x2 | |
| 226 | }; | |
| 214 | 227 | #define NVME_CMD_FUSE_SHIFT				(0) |
| 215 | 228 | #define NVME_CMD_FUSE_MASK				(0x3) |
| 216 | 229 | |
| ... | ... | @@ -390,9 +403,24 @@ enum nvme_psdt { |
| 390 | 403 | /* per namespace smart/health log page */ |
| 391 | 404 | #define NVME_CTRLR_DATA_LPA_NS_SMART_SHIFT		(0) |
| 392 | 405 | #define NVME_CTRLR_DATA_LPA_NS_SMART_MASK		(0x1) |
| 406 | /* Commands Supported and Effects log page */ | |
| 407 | #define NVME_CTRLR_DATA_LPA_CMD_EFFECTS_SHIFT		(1) | |
| 408 | #define NVME_CTRLR_DATA_LPA_CMD_EFFECTS_MASK		(0x1) | |
| 393 | 409 | /* extended data for Get Log Page command */ |
| 394 | 410 | #define NVME_CTRLR_DATA_LPA_EXT_DATA_SHIFT		(2) |
| 395 | 411 | #define NVME_CTRLR_DATA_LPA_EXT_DATA_MASK		(0x1) |
| 412 | /* telemetry */ | |
| 413 | #define NVME_CTRLR_DATA_LPA_TELEMETRY_SHIFT		(3) | |
| 414 | #define NVME_CTRLR_DATA_LPA_TELEMETRY_MASK		(0x1) | |
| 415 | /* persistent event */ | |
| 416 | #define NVME_CTRLR_DATA_LPA_PERSISTENT_EVENT_SHIFT	(4) | |
| 417 | #define NVME_CTRLR_DATA_LPA_PERSISTENT_EVENT_MASK	(0x1) | |
| 418 | /* Supported log pages, etc */ | |
| 419 | #define NVME_CTRLR_DATA_LPA_LOG_PAGES_PAGE_SHIFT	(5) | |
| 420 | #define NVME_CTRLR_DATA_LPA_LOG_PAGES_PAGE_MASK		(0x1) | |
| 421 | /* Data Area 4 for Telemetry */ | |
| 422 | #define NVME_CTRLR_DATA_LPA_DA4_TELEMETRY_SHIFT		(6) | |
| 423 | #define NVME_CTRLR_DATA_LPA_DA4_TELEMETRY_MASK		(0x1) | |
| 396 | 424 | |
| 397 | 425 | /** AVSCC - admin vendor specific command configuration */ |
| 398 | 426 | /* admin vendor specific commands use spec format */ |
| ... | ... | @@ -623,10 +651,19 @@ enum nvme_critical_warning_state { |
| 623 | 651 | 	NVME_CRIT_WARN_ST_DEVICE_RELIABILITY		= 0x4, |
| 624 | 652 | 	NVME_CRIT_WARN_ST_READ_ONLY			= 0x8, |
| 625 | 653 | 	NVME_CRIT_WARN_ST_VOLATILE_MEMORY_BACKUP	= 0x10, |
| 654 | 	NVME_CRIT_WARN_ST_PERSISTENT_MEMORY_REGION	= 0x20, | |
| 626 | 655 | }; |
| 627 | #define NVME_CRIT_WARN_ST_RESERVED_MASK			(0xE0) | |
| 628 | #define	NVME_ASYNC_EVENT_NS_ATTRIBUTE			(0x100) | |
| 629 | #define	NVME_ASYNC_EVENT_FW_ACTIVATE			(0x200) | |
| 656 | #define NVME_CRIT_WARN_ST_RESERVED_MASK			(0xC0) | |
| 657 | #define	NVME_ASYNC_EVENT_NS_ATTRIBUTE			(1U << 8) | |
| 658 | #define	NVME_ASYNC_EVENT_FW_ACTIVATE			(1U << 9) | |
| 659 | #define	NVME_ASYNC_EVENT_TELEMETRY_LOG			(1U << 10) | |
| 660 | #define	NVME_ASYNC_EVENT_ASYM_NS_ACC			(1U << 11) | |
| 661 | #define	NVME_ASYNC_EVENT_PRED_LAT_DELTA			(1U << 12) | |
| 662 | #define	NVME_ASYNC_EVENT_LBA_STATUS			(1U << 13) | |
| 663 | #define	NVME_ASYNC_EVENT_ENDURANCE_DELTA		(1U << 14) | |
| 664 | #define	NVME_ASYNC_EVENT_NVM_SHUTDOWN			(1U << 15) | |
| 665 | #define	NVME_ASYNC_EVENT_ZONE_DELTA			(1U << 27) | |
| 666 | #define	NVME_ASYNC_EVENT_DISCOVERY_DELTA		(1U << 31) | |
| 630 | 667 | |
| 631 | 668 | /* slot for current FW */ |
| 632 | 669 | #define NVME_FIRMWARE_PAGE_AFI_SLOT_SHIFT		(0) |
| ... | ... | @@ -809,7 +846,7 @@ struct nvme_command { |
| 809 | 846 | 	uint32_t cdw13;		/* command-specific */ |
| 810 | 847 | 	uint32_t cdw14;		/* command-specific */ |
| 811 | 848 | 	uint32_t cdw15;		/* command-specific */ |
| 812 | }; | |
| 849 | } __aligned(8); | |
| 813 | 850 | |
| 814 | 851 | _Static_assert(sizeof(struct nvme_command) == 16 * 4, "bad size for nvme_command"); |
| 815 | 852 | |
| ... | ... | @@ -1578,7 +1615,7 @@ struct nvme_health_information_page { |
| 1578 | 1615 | 	uint32_t		ttftmt2; |
| 1579 | 1616 | |
| 1580 | 1617 | 	uint8_t			reserved2[280]; |
| 1581 | } __packed __aligned(4); | |
| 1618 | } __packed __aligned(8); | |
| 1582 | 1619 | |
| 1583 | 1620 | _Static_assert(sizeof(struct nvme_health_information_page) == 512, "bad size for nvme_health_information_page"); |
| 1584 | 1621 | |
| ... | ... | @@ -1629,6 +1666,30 @@ struct nvme_device_self_test_page { |
| 1629 | 1666 | _Static_assert(sizeof(struct nvme_device_self_test_page) == 564, |
| 1630 | 1667 | "bad size for nvme_device_self_test_page"); |
| 1631 | 1668 | |
| 1669 | /* | |
| 1670 | * Header structure for both host initiated telemetry (page 7) and controller | |
| 1671 | * initiated telemetry (page 8). | |
| 1672 | */ | |
| 1673 | struct nvme_telemetry_log_page { | |
| 1674 | 	uint8_t			identifier; | |
| 1675 | 	uint8_t			rsvd[4]; | |
| 1676 | 	uint8_t			oui[3]; | |
| 1677 | 	uint16_t		da1_last; | |
| 1678 | 	uint16_t		da2_last; | |
| 1679 | 	uint16_t		da3_last; | |
| 1680 | 	uint8_t			rsvd2[2]; | |
| 1681 | 	uint32_t		da4_last; | |
| 1682 | 	uint8_t			rsvd3[361]; | |
| 1683 | 	uint8_t			hi_gen; | |
| 1684 | 	uint8_t			ci_avail; | |
| 1685 | 	uint8_t			ci_gen; | |
| 1686 | 	uint8_t			reason[128]; | |
| 1687 | 	/* Blocks of telemetry data follow */ | |
| 1688 | } __packed __aligned(4); | |
| 1689 | ||
| 1690 | _Static_assert(sizeof(struct nvme_telemetry_log_page) == 512, | |
| 1691 | "bad size for nvme_telemetry_log"); | |
| 1692 | ||
| 1632 | 1693 | struct nvme_discovery_log_entry { |
| 1633 | 1694 | 	uint8_t			trtype; |
| 1634 | 1695 | 	uint8_t			adrfam; |
| ... | ... | @@ -1845,6 +1906,9 @@ struct nvme_hmb_desc { |
| 1845 | 1906 | #define nvme_completion_is_error(cpl)					\ |
| 1846 | 1907 | 	(NVME_STATUS_GET_SC((cpl)->status) != 0 || NVME_STATUS_GET_SCT((cpl)->status) != 0) |
| 1847 | 1908 | |
| 1909 | void	nvme_cpl_sbuf(const struct nvme_completion *cpl, struct sbuf *sbuf); | |
| 1910 | void	nvme_opcode_sbuf(bool admin, uint8_t opc, struct sbuf *sb); | |
| 1911 | void	nvme_sc_sbuf(const struct nvme_completion *cpl, struct sbuf *sbuf); | |
| 1848 | 1912 | void	nvme_strvis(uint8_t *dst, const uint8_t *src, int dstlen, int srclen); |
| 1849 | 1913 | |
| 1850 | 1914 | #ifdef _KERNEL |
| ... | ... | @@ -1855,6 +1919,7 @@ struct thread; |
| 1855 | 1919 | struct nvme_namespace; |
| 1856 | 1920 | struct nvme_controller; |
| 1857 | 1921 | struct nvme_consumer; |
| 1922 | struct nvme_passthru_cmd; | |
| 1858 | 1923 | |
| 1859 | 1924 | typedef void (*nvme_cb_fn_t)(void *, const struct nvme_completion *); |
| 1860 | 1925 | |
| ... | ... | @@ -1865,8 +1930,11 @@ typedef void (*nvme_cons_async_fn_t)(void *, const struct nvme_completion *, |
| 1865 | 1930 | typedef void (*nvme_cons_fail_fn_t)(void *); |
| 1866 | 1931 | |
| 1867 | 1932 | enum nvme_namespace_flags { |
| 1868 | 	NVME_NS_DEALLOCATE_SUPPORTED	= 0x1, | |
| 1869 | 	NVME_NS_FLUSH_SUPPORTED		= 0x2, | |
| 1933 | 	NVME_NS_DEALLOCATE_SUPPORTED	= 0x01, | |
| 1934 | 	NVME_NS_FLUSH_SUPPORTED		= 0x02, | |
| 1935 | 	NVME_NS_ADDED			= 0x04, | |
| 1936 | 	NVME_NS_CHANGED			= 0x08, | |
| 1937 | 	NVME_NS_GONE			= 0x10, | |
| 1870 | 1938 | }; |
| 1871 | 1939 | |
| 1872 | 1940 | int	nvme_ctrlr_passthrough_cmd(struct nvme_controller *ctrlr, |
| ... | ... | @@ -1874,6 +1942,11 @@ int	nvme_ctrlr_passthrough_cmd(struct nvme_controller *ctrlr, |
| 1874 | 1942 | 				 uint32_t nsid, int is_user_buffer, |
| 1875 | 1943 | 				 int is_admin_cmd); |
| 1876 | 1944 | |
| 1945 | int	nvme_ctrlr_linux_passthru_cmd(struct nvme_controller *ctrlr, | |
| 1946 | 				 struct nvme_passthru_cmd *npc, | |
| 1947 | 				 uint32_t nsid, bool is_user, | |
| 1948 | 				 bool is_admin); | |
| 1949 | ||
| 1877 | 1950 | /* Admin functions */ |
| 1878 | 1951 | void	nvme_ctrlr_cmd_set_feature(struct nvme_controller *ctrlr, |
| 1879 | 1952 | 				 uint8_t feature, uint32_t cdw11, |
lib/libc/include/generic-freebsd/dev/nvmf/nvmf.h created+132| ... | ... | @@ -0,0 +1,132 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-2-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 2022-2024 Chelsio Communications, Inc. | |
| 5 | * Written by: John Baldwin <jhb@FreeBSD.org> | |
| 6 | */ | |
| 7 | ||
| 8 | #ifndef __NVMF_H__ | |
| 9 | #define	__NVMF_H__ | |
| 10 | ||
| 11 | #include <sys/ioccom.h> | |
| 12 | #ifndef _KERNEL | |
| 13 | #include <stdbool.h> | |
| 14 | #endif | |
| 15 | ||
| 16 | /* | |
| 17 | * Default settings in Fabrics controllers. These match values used by the | |
| 18 | * Linux target. | |
| 19 | */ | |
| 20 | #define	NVMF_MAX_IO_ENTRIES	(1024) | |
| 21 | #define	NVMF_CC_EN_TIMEOUT	(15)	/* In 500ms units */ | |
| 22 | ||
| 23 | /* Allows for a 16k data buffer + SQE */ | |
| 24 | #define	NVMF_IOCCSZ		(sizeof(struct nvme_command) + 16 * 1024) | |
| 25 | #define	NVMF_IORCSZ		(sizeof(struct nvme_completion)) | |
| 26 | ||
| 27 | #define	NVMF_NN			(1024) | |
| 28 | ||
| 29 | /* | |
| 30 | * Default timeouts for Fabrics hosts. These match values used by | |
| 31 | * Linux. | |
| 32 | */ | |
| 33 | #define	NVMF_DEFAULT_RECONNECT_DELAY	10 | |
| 34 | #define	NVMF_DEFAULT_CONTROLLER_LOSS	600 | |
| 35 | ||
| 36 | /* | |
| 37 | * (data, size) is the userspace buffer for a packed nvlist. | |
| 38 | * | |
| 39 | * For requests that copyout an nvlist, len is the amount of data | |
| 40 | * copied out to *data. If size is zero, no data is copied and len is | |
| 41 | * set to the required buffer size. | |
| 42 | */ | |
| 43 | struct nvmf_ioc_nv { | |
| 44 | 	void	*data; | |
| 45 | 	size_t	len; | |
| 46 | 	size_t	size; | |
| 47 | }; | |
| 48 | ||
| 49 | /* | |
| 50 | * The fields in a qpair handoff nvlist are: | |
| 51 | * | |
| 52 | * Transport independent: | |
| 53 | * | |
| 54 | * bool		admin | |
| 55 | * bool		sq_flow_control | |
| 56 | * number	qsize | |
| 57 | * number	sqhd | |
| 58 | * number	sqtail			host only | |
| 59 | * | |
| 60 | * TCP transport: | |
| 61 | * | |
| 62 | * number	fd | |
| 63 | * number	rxpda | |
| 64 | * number	txpda | |
| 65 | * bool		header_digests | |
| 66 | * bool		data_digests | |
| 67 | * number	maxr2t | |
| 68 | * number	maxh2cdata | |
| 69 | * number	max_icd | |
| 70 | */ | |
| 71 | ||
| 72 | /* | |
| 73 | * The fields in the nvlist for NVMF_HANDOFF_HOST and | |
| 74 | * NVMF_RECONNECT_HOST are: | |
| 75 | * | |
| 76 | * number			trtype | |
| 77 | * number			kato	(optional) | |
| 78 | * number reconnect_delay (optional) | |
| 79 | * number controller_loss_timeout (optional) | |
| 80 | * qpair handoff nvlist		admin | |
| 81 | * qpair handoff nvlist array	io | |
| 82 | * binary			cdata	struct nvme_controller_data | |
| 83 | * NVMF_RECONNECT_PARAMS nvlist	rparams | |
| 84 | */ | |
| 85 | ||
| 86 | /* | |
| 87 | * The fields in the nvlist for NVMF_RECONNECT_PARAMS are: | |
| 88 | * | |
| 89 | * binary			dle	struct nvme_discovery_log_entry | |
| 90 | * string			hostnqn | |
| 91 | * number			num_io_queues | |
| 92 | * number			kato	(optional) | |
| 93 | * number reconnect_delay (optional) | |
| 94 | * number controller_loss_timeout (optional) | |
| 95 | * number			io_qsize | |
| 96 | * bool				sq_flow_control | |
| 97 | * | |
| 98 | * TCP transport: | |
| 99 | * | |
| 100 | * bool				header_digests | |
| 101 | * bool				data_digests | |
| 102 | */ | |
| 103 | ||
| 104 | /* | |
| 105 | * The fields in the nvlist for NVMF_CONNECTION_STATUS are: | |
| 106 | * | |
| 107 | * bool				connected | |
| 108 | * timespec nvlist		last_disconnect | |
| 109 | * number			tv_sec | |
| 110 | * number			tv_nsec | |
| 111 | */ | |
| 112 | ||
| 113 | /* | |
| 114 | * The fields in the nvlist for handing off a controller qpair are: | |
| 115 | * | |
| 116 | * number			trtype | |
| 117 | * qpair handoff nvlist		params | |
| 118 | * binary			cmd	struct nvmf_fabric_connect_cmd | |
| 119 | * binary			data	struct nvmf_fabric_connect_data | |
| 120 | */ | |
| 121 | ||
| 122 | /* Operations on /dev/nvmf */ | |
| 123 | #define	NVMF_HANDOFF_HOST	_IOW('n', 200, struct nvmf_ioc_nv) | |
| 124 | #define	NVMF_DISCONNECT_HOST	_IOW('n', 201, const char *) | |
| 125 | #define	NVMF_DISCONNECT_ALL	_IO('n', 202) | |
| 126 | ||
| 127 | /* Operations on /dev/nvmeX */ | |
| 128 | #define	NVMF_RECONNECT_PARAMS	_IOWR('n', 203, struct nvmf_ioc_nv) | |
| 129 | #define	NVMF_RECONNECT_HOST	_IOW('n', 204, struct nvmf_ioc_nv) | |
| 130 | #define	NVMF_CONNECTION_STATUS	_IOWR('n', 205, struct nvmf_ioc_nv) | |
| 131 | ||
| 132 | #endif /* !__NVMF_H__ */ | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/dev/nvmf/nvmf_proto.h created+765| ... | ... | @@ -0,0 +1,765 @@ |
| 1 | /* SPDX-License-Identifier: BSD-3-Clause | |
| 2 | * Copyright (C) 2016 Intel Corporation. | |
| 3 | * All rights reserved. | |
| 4 | */ | |
| 5 | ||
| 6 | /* Derived from include/spdk/nvmf_spec.h from Intel's SPDK. */ | |
| 7 | ||
| 8 | #ifndef __NVMF_PROTO_H__ | |
| 9 | #define	__NVMF_PROTO_H__ | |
| 10 | ||
| 11 | #include <sys/types.h> | |
| 12 | #include <sys/cdefs.h> | |
| 13 | #ifdef _KERNEL | |
| 14 | #include <sys/stddef.h> | |
| 15 | #else | |
| 16 | #include <stddef.h> | |
| 17 | #endif | |
| 18 | #include <dev/nvme/nvme.h> | |
| 19 | ||
| 20 | /** | |
| 21 | * \file | |
| 22 | * NVMe over Fabrics specification definitions | |
| 23 | */ | |
| 24 | ||
| 25 | #define	NVME_NQN_FIELD_SIZE		256 | |
| 26 | ||
| 27 | struct nvmf_capsule_cmd { | |
| 28 | 	uint8_t		opcode; | |
| 29 | 	uint8_t		reserved1; | |
| 30 | 	uint16_t	cid; | |
| 31 | 	uint8_t		fctype; | |
| 32 | 	uint8_t		reserved2[35]; | |
| 33 | 	uint8_t		fabric_specific[24]; | |
| 34 | }; | |
| 35 | _Static_assert(sizeof(struct nvmf_capsule_cmd) == 64, "Incorrect size"); | |
| 36 | ||
| 37 | /* Fabric Command Set */ | |
| 38 | enum nvmf_fabric_cmd_types { | |
| 39 | 	NVMF_FABRIC_COMMAND_PROPERTY_SET			= 0x00, | |
| 40 | 	NVMF_FABRIC_COMMAND_CONNECT				= 0x01, | |
| 41 | 	NVMF_FABRIC_COMMAND_PROPERTY_GET			= 0x04, | |
| 42 | 	NVMF_FABRIC_COMMAND_AUTHENTICATION_SEND			= 0x05, | |
| 43 | 	NVMF_FABRIC_COMMAND_AUTHENTICATION_RECV			= 0x06, | |
| 44 | 	NVMF_FABRIC_COMMAND_DISCONNECT				= 0x08, | |
| 45 | 	NVMF_FABRIC_COMMAND_START_VENDOR_SPECIFIC		= 0xC0, | |
| 46 | }; | |
| 47 | ||
| 48 | enum nvmf_fabric_cmd_status_code { | |
| 49 | 	NVMF_FABRIC_SC_INCOMPATIBLE_FORMAT		= 0x80, | |
| 50 | 	NVMF_FABRIC_SC_CONTROLLER_BUSY			= 0x81, | |
| 51 | 	NVMF_FABRIC_SC_INVALID_PARAM			= 0x82, | |
| 52 | 	NVMF_FABRIC_SC_RESTART_DISCOVERY		= 0x83, | |
| 53 | 	NVMF_FABRIC_SC_INVALID_HOST			= 0x84, | |
| 54 | 	NVMF_FABRIC_SC_INVALID_QUEUE_TYPE		= 0x85, | |
| 55 | 	NVMF_FABRIC_SC_LOG_RESTART_DISCOVERY		= 0x90, | |
| 56 | 	NVMF_FABRIC_SC_AUTH_REQUIRED			= 0x91, | |
| 57 | }; | |
| 58 | ||
| 59 | /** | |
| 60 | * RDMA Queue Pair service types | |
| 61 | */ | |
| 62 | enum nvmf_rdma_qptype { | |
| 63 | 	/** Reliable connected */ | |
| 64 | 	NVMF_RDMA_QPTYPE_RELIABLE_CONNECTED		= 0x1, | |
| 65 | ||
| 66 | 	/** Reliable datagram */ | |
| 67 | 	NVMF_RDMA_QPTYPE_RELIABLE_DATAGRAM		= 0x2, | |
| 68 | }; | |
| 69 | ||
| 70 | /** | |
| 71 | * RDMA provider types | |
| 72 | */ | |
| 73 | enum nvmf_rdma_prtype { | |
| 74 | 	/** No provider specified */ | |
| 75 | 	NVMF_RDMA_PRTYPE_NONE		= 0x1, | |
| 76 | ||
| 77 | 	/** InfiniBand */ | |
| 78 | 	NVMF_RDMA_PRTYPE_IB		= 0x2, | |
| 79 | ||
| 80 | 	/** RoCE v1 */ | |
| 81 | 	NVMF_RDMA_PRTYPE_ROCE		= 0x3, | |
| 82 | ||
| 83 | 	/** RoCE v2 */ | |
| 84 | 	NVMF_RDMA_PRTYPE_ROCE2		= 0x4, | |
| 85 | ||
| 86 | 	/** iWARP */ | |
| 87 | 	NVMF_RDMA_PRTYPE_IWARP		= 0x5, | |
| 88 | }; | |
| 89 | ||
| 90 | /** | |
| 91 | * RDMA connection management service types | |
| 92 | */ | |
| 93 | enum nvmf_rdma_cms { | |
| 94 | 	/** Sockets based endpoint addressing */ | |
| 95 | 	NVMF_RDMA_CMS_RDMA_CM		= 0x1, | |
| 96 | }; | |
| 97 | ||
| 98 | /** | |
| 99 | * NVMe over Fabrics transport types | |
| 100 | */ | |
| 101 | enum nvmf_trtype { | |
| 102 | 	/** RDMA */ | |
| 103 | 	NVMF_TRTYPE_RDMA		= 0x1, | |
| 104 | ||
| 105 | 	/** Fibre Channel */ | |
| 106 | 	NVMF_TRTYPE_FC			= 0x2, | |
| 107 | ||
| 108 | 	/** TCP */ | |
| 109 | 	NVMF_TRTYPE_TCP			= 0x3, | |
| 110 | ||
| 111 | 	/** Intra-host transport (loopback) */ | |
| 112 | 	NVMF_TRTYPE_INTRA_HOST		= 0xfe, | |
| 113 | }; | |
| 114 | ||
| 115 | /** | |
| 116 | * Address family types | |
| 117 | */ | |
| 118 | enum nvmf_adrfam { | |
| 119 | 	/** IPv4 (AF_INET) */ | |
| 120 | 	NVMF_ADRFAM_IPV4		= 0x1, | |
| 121 | ||
| 122 | 	/** IPv6 (AF_INET6) */ | |
| 123 | 	NVMF_ADRFAM_IPV6		= 0x2, | |
| 124 | ||
| 125 | 	/** InfiniBand (AF_IB) */ | |
| 126 | 	NVMF_ADRFAM_IB			= 0x3, | |
| 127 | ||
| 128 | 	/** Fibre Channel address family */ | |
| 129 | 	NVMF_ADRFAM_FC			= 0x4, | |
| 130 | ||
| 131 | 	/** Intra-host transport (loopback) */ | |
| 132 | 	NVMF_ADRFAM_INTRA_HOST		= 0xfe, | |
| 133 | }; | |
| 134 | ||
| 135 | /** | |
| 136 | * NVM subsystem types | |
| 137 | */ | |
| 138 | enum nvmf_subtype { | |
| 139 | 	/** Referral to a discovery service */ | |
| 140 | 	NVMF_SUBTYPE_DISCOVERY		= 0x1, | |
| 141 | ||
| 142 | 	/** NVM Subsystem */ | |
| 143 | 	NVMF_SUBTYPE_NVME		= 0x2, | |
| 144 | ||
| 145 | 	/** Current Discovery Subsystem */ | |
| 146 | 	NVMF_SUBTYPE_DISCOVERY_CURRENT	= 0x3 | |
| 147 | }; | |
| 148 | ||
| 149 | /* Discovery Log Entry Flags - Duplicate Returned Information */ | |
| 150 | #define NVMF_DISCOVERY_LOG_EFLAGS_DUPRETINFO (1u << 0u) | |
| 151 | ||
| 152 | /* Discovery Log Entry Flags - Explicit Persistent Connection Support for Discovery */ | |
| 153 | #define NVMF_DISCOVERY_LOG_EFLAGS_EPCSD (1u << 1u) | |
| 154 | ||
| 155 | /** | |
| 156 | * Connections shall be made over a fabric secure channel | |
| 157 | */ | |
| 158 | enum nvmf_treq_secure_channel { | |
| 159 | 	/** Not specified */ | |
| 160 | 	NVMF_TREQ_SECURE_CHANNEL_NOT_SPECIFIED		= 0x0, | |
| 161 | ||
| 162 | 	/** Required */ | |
| 163 | 	NVMF_TREQ_SECURE_CHANNEL_REQUIRED		= 0x1, | |
| 164 | ||
| 165 | 	/** Not required */ | |
| 166 | 	NVMF_TREQ_SECURE_CHANNEL_NOT_REQUIRED		= 0x2, | |
| 167 | }; | |
| 168 | ||
| 169 | struct nvmf_fabric_cmd { | |
| 170 | 	uint8_t		opcode; | |
| 171 | 	uint8_t		reserved1; | |
| 172 | 	uint16_t	cid; | |
| 173 | 	uint8_t		fctype; | |
| 174 | 	uint8_t		reserved2[59]; | |
| 175 | } __aligned(8); | |
| 176 | ||
| 177 | struct nvmf_fabric_auth_recv_cmd { | |
| 178 | 	uint8_t		opcode; | |
| 179 | 	uint8_t		reserved1; | |
| 180 | 	uint16_t	cid; | |
| 181 | 	uint8_t		fctype; /* NVMF_FABRIC_COMMAND_AUTHENTICATION_RECV (0x06) */ | |
| 182 | 	uint8_t		reserved2[19]; | |
| 183 | 	struct nvme_sgl_descriptor sgl1; | |
| 184 | 	uint8_t		reserved3; | |
| 185 | 	uint8_t		spsp0; | |
| 186 | 	uint8_t		spsp1; | |
| 187 | 	uint8_t		secp; | |
| 188 | 	uint32_t	al; | |
| 189 | 	uint8_t		reserved4[16]; | |
| 190 | }; | |
| 191 | _Static_assert(sizeof(struct nvmf_fabric_auth_recv_cmd) == 64, "Incorrect size"); | |
| 192 | ||
| 193 | struct nvmf_fabric_auth_send_cmd { | |
| 194 | 	uint8_t		opcode; | |
| 195 | 	uint8_t		reserved1; | |
| 196 | 	uint16_t	cid; | |
| 197 | 	uint8_t		fctype; /* NVMF_FABRIC_COMMAND_AUTHENTICATION_SEND (0x05) */ | |
| 198 | 	uint8_t		reserved2[19]; | |
| 199 | 	struct nvme_sgl_descriptor sgl1; | |
| 200 | 	uint8_t		reserved3; | |
| 201 | 	uint8_t		spsp0; | |
| 202 | 	uint8_t		spsp1; | |
| 203 | 	uint8_t		secp; | |
| 204 | 	uint32_t	tl; | |
| 205 | 	uint8_t		reserved4[16]; | |
| 206 | }; | |
| 207 | _Static_assert(sizeof(struct nvmf_fabric_auth_send_cmd) == 64, "Incorrect size"); | |
| 208 | ||
| 209 | struct nvmf_fabric_connect_data { | |
| 210 | 	uint8_t		hostid[16]; | |
| 211 | 	uint16_t	cntlid; | |
| 212 | 	uint8_t		reserved5[238]; | |
| 213 | 	uint8_t		subnqn[NVME_NQN_FIELD_SIZE]; | |
| 214 | 	uint8_t		hostnqn[NVME_NQN_FIELD_SIZE]; | |
| 215 | 	uint8_t		reserved6[256]; | |
| 216 | }; | |
| 217 | _Static_assert(sizeof(struct nvmf_fabric_connect_data) == 1024, "Incorrect size"); | |
| 218 | ||
| 219 | struct nvmf_fabric_connect_cmd { | |
| 220 | 	uint8_t		opcode; | |
| 221 | 	uint8_t		reserved1; | |
| 222 | 	uint16_t	cid; | |
| 223 | 	uint8_t		fctype; | |
| 224 | 	uint8_t		reserved2[19]; | |
| 225 | 	struct nvme_sgl_descriptor sgl1; | |
| 226 | 	uint16_t	recfmt; /* Connect Record Format */ | |
| 227 | 	uint16_t	qid; /* Queue Identifier */ | |
| 228 | 	uint16_t	sqsize; /* Submission Queue Size */ | |
| 229 | 	uint8_t		cattr; /* queue attributes */ | |
| 230 | 	uint8_t		reserved3; | |
| 231 | 	uint32_t	kato; /* keep alive timeout */ | |
| 232 | 	uint8_t		reserved4[12]; | |
| 233 | }; | |
| 234 | _Static_assert(sizeof(struct nvmf_fabric_connect_cmd) == 64, "Incorrect size"); | |
| 235 | ||
| 236 | #define	NVMF_CNTLID_DYNAMIC	0xFFFF | |
| 237 | #define	NVMF_CNTLID_STATIC_ANY	0xFFFE | |
| 238 | ||
| 239 | /* | |
| 240 | * XXX: 5.3 in NVMe-over-Fabrics 1.1 gives this as an upper bound in | |
| 241 | * the Discovery Log Entry. | |
| 242 | */ | |
| 243 | #define	NVMF_CNTLID_STATIC_MAX	0xFFEF | |
| 244 | ||
| 245 | /* 5.21.1.15 in NVMe 1.4b */ | |
| 246 | #define	NVMF_KATO_DEFAULT			(120000) | |
| 247 | ||
| 248 | #define NVMF_CONNECT_ATTR_PRIORITY_CLASS	(0x3) | |
| 249 | #define NVMF_CONNECT_ATTR_DISABLE_SQ_FC		(1u << 2) | |
| 250 | #define NVMF_CONNECT_ATTR_IO_QUEUE_DELETION	(1u << 3) | |
| 251 | ||
| 252 | struct nvmf_fabric_connect_rsp { | |
| 253 | 	union { | |
| 254 | 		struct { | |
| 255 | 			uint16_t cntlid; | |
| 256 | 			uint16_t authreq; | |
| 257 | 		} success; | |
| 258 | ||
| 259 | 		struct { | |
| 260 | 			uint16_t	ipo; | |
| 261 | 			uint8_t		iattr; | |
| 262 | 			uint8_t		reserved; | |
| 263 | 		} invalid; | |
| 264 | ||
| 265 | 		uint32_t raw; | |
| 266 | 	} status_code_specific; | |
| 267 | ||
| 268 | 	uint32_t	reserved0; | |
| 269 | 	uint16_t	sqhd; | |
| 270 | 	uint16_t	reserved1; | |
| 271 | 	uint16_t	cid; | |
| 272 | 	uint16_t	status; | |
| 273 | }; | |
| 274 | _Static_assert(sizeof(struct nvmf_fabric_connect_rsp) == 16, "Incorrect size"); | |
| 275 | ||
| 276 | struct nvmf_fabric_disconnect_cmd { | |
| 277 | 	uint8_t		opcode; | |
| 278 | 	uint8_t		reserved1; | |
| 279 | 	uint16_t	cid; | |
| 280 | 	uint8_t		fctype; | |
| 281 | 	uint8_t		reserved2[19]; | |
| 282 | 	struct nvme_sgl_descriptor sgl1; | |
| 283 | 	uint16_t	recfmt; /* Disconnect Record Format */ | |
| 284 | 	uint8_t		reserved3[22]; | |
| 285 | }; | |
| 286 | _Static_assert(sizeof(struct nvmf_fabric_disconnect_cmd) == 64, "Incorrect size"); | |
| 287 | ||
| 288 | #define NVMF_PROP_SIZE_4	0 | |
| 289 | #define NVMF_PROP_SIZE_8	1 | |
| 290 | ||
| 291 | #define	NVMF_PROP_CAP		0x00	/* Controller Capabilities */ | |
| 292 | #define	NVMF_PROP_VS		0x08	/* Version */ | |
| 293 | #define	NVMF_PROP_CC		0x14	/* Controller Configuration */ | |
| 294 | #define	NVMF_PROP_CSTS		0x1C	/* Controller Status */ | |
| 295 | #define	NVMF_PROP_NSSR		0x20	/* NVM Subsystem Reset */ | |
| 296 | ||
| 297 | struct nvmf_fabric_prop_get_cmd { | |
| 298 | 	uint8_t		opcode; | |
| 299 | 	uint8_t		reserved1; | |
| 300 | 	uint16_t	cid; | |
| 301 | 	uint8_t		fctype; | |
| 302 | 	uint8_t		reserved2[35]; | |
| 303 | 	struct { | |
| 304 | 		uint8_t size		: 3; | |
| 305 | 		uint8_t reserved	: 5; | |
| 306 | 	} attrib; | |
| 307 | 	uint8_t		reserved3[3]; | |
| 308 | 	uint32_t	ofst; | |
| 309 | 	uint8_t		reserved4[16]; | |
| 310 | }; | |
| 311 | _Static_assert(sizeof(struct nvmf_fabric_prop_get_cmd) == 64, "Incorrect size"); | |
| 312 | ||
| 313 | struct nvmf_fabric_prop_get_rsp { | |
| 314 | 	union { | |
| 315 | 		uint64_t u64; | |
| 316 | 		struct { | |
| 317 | 			uint32_t low; | |
| 318 | 			uint32_t high; | |
| 319 | 		} u32; | |
| 320 | 	} value; | |
| 321 | ||
| 322 | 	uint16_t	sqhd; | |
| 323 | 	uint16_t	reserved0; | |
| 324 | 	uint16_t	cid; | |
| 325 | 	uint16_t	status; | |
| 326 | }; | |
| 327 | _Static_assert(sizeof(struct nvmf_fabric_prop_get_rsp) == 16, "Incorrect size"); | |
| 328 | ||
| 329 | struct nvmf_fabric_prop_set_cmd { | |
| 330 | 	uint8_t		opcode; | |
| 331 | 	uint8_t		reserved0; | |
| 332 | 	uint16_t	cid; | |
| 333 | 	uint8_t		fctype; | |
| 334 | 	uint8_t		reserved1[35]; | |
| 335 | 	struct { | |
| 336 | 		uint8_t size		: 3; | |
| 337 | 		uint8_t reserved	: 5; | |
| 338 | 	} attrib; | |
| 339 | 	uint8_t		reserved2[3]; | |
| 340 | 	uint32_t	ofst; | |
| 341 | ||
| 342 | 	union { | |
| 343 | 		uint64_t u64; | |
| 344 | 		struct { | |
| 345 | 			uint32_t low; | |
| 346 | 			uint32_t high; | |
| 347 | 		} u32; | |
| 348 | 	} value; | |
| 349 | ||
| 350 | 	uint8_t		reserved4[8]; | |
| 351 | }; | |
| 352 | _Static_assert(sizeof(struct nvmf_fabric_prop_set_cmd) == 64, "Incorrect size"); | |
| 353 | ||
| 354 | #define NVMF_NQN_MIN_LEN 11 /* The prefix in the spec is 11 characters */ | |
| 355 | #define NVMF_NQN_MAX_LEN 223 | |
| 356 | #define NVMF_NQN_UUID_PRE_LEN 32 | |
| 357 | #define NVMF_UUID_STRING_LEN 36 | |
| 358 | #define NVMF_NQN_UUID_PRE "nqn.2014-08.org.nvmexpress:uuid:" | |
| 359 | #define NVMF_DISCOVERY_NQN "nqn.2014-08.org.nvmexpress.discovery" | |
| 360 | ||
| 361 | #define NVMF_TRSTRING_MAX_LEN 32 | |
| 362 | #define NVMF_TRADDR_MAX_LEN 256 | |
| 363 | #define NVMF_TRSVCID_MAX_LEN 32 | |
| 364 | ||
| 365 | /** RDMA transport-specific address subtype */ | |
| 366 | struct nvmf_rdma_transport_specific_address_subtype { | |
| 367 | 	/** RDMA QP service type (\ref nvmf_rdma_qptype) */ | |
| 368 | 	uint8_t		rdma_qptype; | |
| 369 | ||
| 370 | 	/** RDMA provider type (\ref nvmf_rdma_prtype) */ | |
| 371 | 	uint8_t		rdma_prtype; | |
| 372 | ||
| 373 | 	/** RDMA connection management service (\ref nvmf_rdma_cms) */ | |
| 374 | 	uint8_t		rdma_cms; | |
| 375 | ||
| 376 | 	uint8_t		reserved0[5]; | |
| 377 | ||
| 378 | 	/** RDMA partition key for AF_IB */ | |
| 379 | 	uint16_t	rdma_pkey; | |
| 380 | ||
| 381 | 	uint8_t		reserved2[246]; | |
| 382 | }; | |
| 383 | _Static_assert(sizeof(struct nvmf_rdma_transport_specific_address_subtype) == 256, | |
| 384 | 		 "Incorrect size"); | |
| 385 | ||
| 386 | /** TCP Secure Socket Type */ | |
| 387 | enum nvme_tcp_secure_socket_type { | |
| 388 | 	/** No security */ | |
| 389 | 	NVME_TCP_SECURITY_NONE				= 0, | |
| 390 | ||
| 391 | 	/** TLS (Secure Sockets) version 1.2 */ | |
| 392 | 	NVME_TCP_SECURITY_TLS_1_2			= 1, | |
| 393 | ||
| 394 | 	/** TLS (Secure Sockets) version 1.3 */ | |
| 395 | 	NVME_TCP_SECURITY_TLS_1_3			= 2, | |
| 396 | }; | |
| 397 | ||
| 398 | /** TCP transport-specific address subtype */ | |
| 399 | struct nvme_tcp_transport_specific_address_subtype { | |
| 400 | 	/** Security type (\ref nvme_tcp_secure_socket_type) */ | |
| 401 | 	uint8_t		sectype; | |
| 402 | ||
| 403 | 	uint8_t		reserved0[255]; | |
| 404 | }; | |
| 405 | _Static_assert(sizeof(struct nvme_tcp_transport_specific_address_subtype) == 256, | |
| 406 | 		 "Incorrect size"); | |
| 407 | ||
| 408 | /** Transport-specific address subtype */ | |
| 409 | union nvmf_transport_specific_address_subtype { | |
| 410 | 	uint8_t raw[256]; | |
| 411 | ||
| 412 | 	/** RDMA */ | |
| 413 | 	struct nvmf_rdma_transport_specific_address_subtype rdma; | |
| 414 | ||
| 415 | 	/** TCP */ | |
| 416 | 	struct nvme_tcp_transport_specific_address_subtype tcp; | |
| 417 | }; | |
| 418 | _Static_assert(sizeof(union nvmf_transport_specific_address_subtype) == 256, | |
| 419 | 		 "Incorrect size"); | |
| 420 | ||
| 421 | #define NVMF_MIN_ADMIN_MAX_SQ_SIZE 32 | |
| 422 | ||
| 423 | /** | |
| 424 | * Discovery Log Page entry | |
| 425 | */ | |
| 426 | struct nvmf_discovery_log_page_entry { | |
| 427 | 	/** Transport type (\ref nvmf_trtype) */ | |
| 428 | 	uint8_t		trtype; | |
| 429 | ||
| 430 | 	/** Address family (\ref nvmf_adrfam) */ | |
| 431 | 	uint8_t		adrfam; | |
| 432 | ||
| 433 | 	/** Subsystem type (\ref nvmf_subtype) */ | |
| 434 | 	uint8_t		subtype; | |
| 435 | ||
| 436 | 	/** Transport requirements */ | |
| 437 | 	struct { | |
| 438 | 		/** Secure channel requirements (\ref nvmf_treq_secure_channel) */ | |
| 439 | 		uint8_t secure_channel : 2; | |
| 440 | ||
| 441 | 		uint8_t reserved : 6; | |
| 442 | 	} treq; | |
| 443 | ||
| 444 | 	/** NVM subsystem port ID */ | |
| 445 | 	uint16_t	portid; | |
| 446 | ||
| 447 | 	/** Controller ID */ | |
| 448 | 	uint16_t	cntlid; | |
| 449 | ||
| 450 | 	/** Admin max SQ size */ | |
| 451 | 	uint16_t	asqsz; | |
| 452 | ||
| 453 | 	/** Entry Flags */ | |
| 454 | 	uint16_t	eflags; | |
| 455 | ||
| 456 | 	uint8_t		reserved0[20]; | |
| 457 | ||
| 458 | 	/** Transport service identifier */ | |
| 459 | 	uint8_t		trsvcid[NVMF_TRSVCID_MAX_LEN]; | |
| 460 | ||
| 461 | 	uint8_t		reserved1[192]; | |
| 462 | ||
| 463 | 	/** NVM subsystem qualified name */ | |
| 464 | 	uint8_t		subnqn[256]; | |
| 465 | ||
| 466 | 	/** Transport address */ | |
| 467 | 	uint8_t		traddr[NVMF_TRADDR_MAX_LEN]; | |
| 468 | ||
| 469 | 	/** Transport-specific address subtype */ | |
| 470 | 	union nvmf_transport_specific_address_subtype tsas; | |
| 471 | }; | |
| 472 | _Static_assert(sizeof(struct nvmf_discovery_log_page_entry) == 1024, "Incorrect size"); | |
| 473 | ||
| 474 | struct nvmf_discovery_log_page { | |
| 475 | 	uint64_t	genctr; | |
| 476 | 	uint64_t	numrec; | |
| 477 | 	uint16_t	recfmt; | |
| 478 | 	uint8_t		reserved0[1006]; | |
| 479 | 	struct nvmf_discovery_log_page_entry entries[0]; | |
| 480 | }; | |
| 481 | _Static_assert(sizeof(struct nvmf_discovery_log_page) == 1024, "Incorrect size"); | |
| 482 | ||
| 483 | /* RDMA Fabric specific definitions below */ | |
| 484 | ||
| 485 | #define NVME_SGL_SUBTYPE_INVALIDATE_KEY	0xF | |
| 486 | ||
| 487 | struct nvmf_rdma_request_private_data { | |
| 488 | 	uint16_t	recfmt; /* record format */ | |
| 489 | 	uint16_t	qid;	/* queue id */ | |
| 490 | 	uint16_t	hrqsize;	/* host receive queue size */ | |
| 491 | 	uint16_t	hsqsize;	/* host send queue size */ | |
| 492 | 	uint16_t	cntlid;		/* controller id */ | |
| 493 | 	uint8_t		reserved[22]; | |
| 494 | }; | |
| 495 | _Static_assert(sizeof(struct nvmf_rdma_request_private_data) == 32, "Incorrect size"); | |
| 496 | ||
| 497 | struct nvmf_rdma_accept_private_data { | |
| 498 | 	uint16_t	recfmt; /* record format */ | |
| 499 | 	uint16_t	crqsize;	/* controller receive queue size */ | |
| 500 | 	uint8_t		reserved[28]; | |
| 501 | }; | |
| 502 | _Static_assert(sizeof(struct nvmf_rdma_accept_private_data) == 32, "Incorrect size"); | |
| 503 | ||
| 504 | struct nvmf_rdma_reject_private_data { | |
| 505 | 	uint16_t	recfmt; /* record format */ | |
| 506 | 	uint16_t	sts; /* status */ | |
| 507 | }; | |
| 508 | _Static_assert(sizeof(struct nvmf_rdma_reject_private_data) == 4, "Incorrect size"); | |
| 509 | ||
| 510 | union nvmf_rdma_private_data { | |
| 511 | 	struct nvmf_rdma_request_private_data	pd_request; | |
| 512 | 	struct nvmf_rdma_accept_private_data	pd_accept; | |
| 513 | 	struct nvmf_rdma_reject_private_data	pd_reject; | |
| 514 | }; | |
| 515 | _Static_assert(sizeof(union nvmf_rdma_private_data) == 32, "Incorrect size"); | |
| 516 | ||
| 517 | enum nvmf_rdma_transport_error { | |
| 518 | 	NVMF_RDMA_ERROR_INVALID_PRIVATE_DATA_LENGTH	= 0x1, | |
| 519 | 	NVMF_RDMA_ERROR_INVALID_RECFMT			= 0x2, | |
| 520 | 	NVMF_RDMA_ERROR_INVALID_QID			= 0x3, | |
| 521 | 	NVMF_RDMA_ERROR_INVALID_HSQSIZE			= 0x4, | |
| 522 | 	NVMF_RDMA_ERROR_INVALID_HRQSIZE			= 0x5, | |
| 523 | 	NVMF_RDMA_ERROR_NO_RESOURCES			= 0x6, | |
| 524 | 	NVMF_RDMA_ERROR_INVALID_IRD			= 0x7, | |
| 525 | 	NVMF_RDMA_ERROR_INVALID_ORD			= 0x8, | |
| 526 | }; | |
| 527 | ||
| 528 | /* TCP transport specific definitions below */ | |
| 529 | ||
| 530 | /** NVMe/TCP PDU type */ | |
| 531 | enum nvme_tcp_pdu_type { | |
| 532 | 	/** Initialize Connection Request (ICReq) */ | |
| 533 | 	NVME_TCP_PDU_TYPE_IC_REQ			= 0x00, | |
| 534 | ||
| 535 | 	/** Initialize Connection Response (ICResp) */ | |
| 536 | 	NVME_TCP_PDU_TYPE_IC_RESP			= 0x01, | |
| 537 | ||
| 538 | 	/** Terminate Connection Request (TermReq) */ | |
| 539 | 	NVME_TCP_PDU_TYPE_H2C_TERM_REQ			= 0x02, | |
| 540 | ||
| 541 | 	/** Terminate Connection Response (TermResp) */ | |
| 542 | 	NVME_TCP_PDU_TYPE_C2H_TERM_REQ			= 0x03, | |
| 543 | ||
| 544 | 	/** Command Capsule (CapsuleCmd) */ | |
| 545 | 	NVME_TCP_PDU_TYPE_CAPSULE_CMD			= 0x04, | |
| 546 | ||
| 547 | 	/** Response Capsule (CapsuleRsp) */ | |
| 548 | 	NVME_TCP_PDU_TYPE_CAPSULE_RESP			= 0x05, | |
| 549 | ||
| 550 | 	/** Host To Controller Data (H2CData) */ | |
| 551 | 	NVME_TCP_PDU_TYPE_H2C_DATA			= 0x06, | |
| 552 | ||
| 553 | 	/** Controller To Host Data (C2HData) */ | |
| 554 | 	NVME_TCP_PDU_TYPE_C2H_DATA			= 0x07, | |
| 555 | ||
| 556 | 	/** Ready to Transfer (R2T) */ | |
| 557 | 	NVME_TCP_PDU_TYPE_R2T				= 0x09, | |
| 558 | }; | |
| 559 | ||
| 560 | /** Common NVMe/TCP PDU header */ | |
| 561 | struct nvme_tcp_common_pdu_hdr { | |
| 562 | 	/** PDU type (\ref nvme_tcp_pdu_type) */ | |
| 563 | 	uint8_t				pdu_type; | |
| 564 | ||
| 565 | 	/** pdu_type-specific flags */ | |
| 566 | 	uint8_t				flags; | |
| 567 | ||
| 568 | 	/** Length of PDU header (not including the Header Digest) */ | |
| 569 | 	uint8_t				hlen; | |
| 570 | ||
| 571 | 	/** PDU Data Offset from the start of the PDU */ | |
| 572 | 	uint8_t				pdo; | |
| 573 | ||
| 574 | 	/** Total number of bytes in PDU, including pdu_hdr */ | |
| 575 | 	uint32_t			plen; | |
| 576 | }; | |
| 577 | _Static_assert(sizeof(struct nvme_tcp_common_pdu_hdr) == 8, "Incorrect size"); | |
| 578 | _Static_assert(offsetof(struct nvme_tcp_common_pdu_hdr, pdu_type) == 0, | |
| 579 | 		 "Incorrect offset"); | |
| 580 | _Static_assert(offsetof(struct nvme_tcp_common_pdu_hdr, flags) == 1, "Incorrect offset"); | |
| 581 | _Static_assert(offsetof(struct nvme_tcp_common_pdu_hdr, hlen) == 2, "Incorrect offset"); | |
| 582 | _Static_assert(offsetof(struct nvme_tcp_common_pdu_hdr, pdo) == 3, "Incorrect offset"); | |
| 583 | _Static_assert(offsetof(struct nvme_tcp_common_pdu_hdr, plen) == 4, "Incorrect offset"); | |
| 584 | ||
| 585 | #define NVME_TCP_CH_FLAGS_HDGSTF		(1u << 0) | |
| 586 | #define NVME_TCP_CH_FLAGS_DDGSTF		(1u << 1) | |
| 587 | ||
| 588 | /** | |
| 589 | * ICReq | |
| 590 | * | |
| 591 | * common.pdu_type == NVME_TCP_PDU_TYPE_IC_REQ | |
| 592 | */ | |
| 593 | struct nvme_tcp_ic_req { | |
| 594 | 	struct nvme_tcp_common_pdu_hdr	common; | |
| 595 | 	uint16_t				pfv; | |
| 596 | 	/** Specifies the data alignment for all PDUs transferred from the controller to the host that contain data */ | |
| 597 | 	uint8_t					hpda; | |
| 598 | 	union { | |
| 599 | 		uint8_t				raw; | |
| 600 | 		struct { | |
| 601 | 			uint8_t			hdgst_enable : 1; | |
| 602 | 			uint8_t			ddgst_enable : 1; | |
| 603 | 			uint8_t			reserved : 6; | |
| 604 | 		} bits; | |
| 605 | 	} dgst; | |
| 606 | 	uint32_t				maxr2t; | |
| 607 | 	uint8_t					reserved16[112]; | |
| 608 | }; | |
| 609 | _Static_assert(sizeof(struct nvme_tcp_ic_req) == 128, "Incorrect size"); | |
| 610 | _Static_assert(offsetof(struct nvme_tcp_ic_req, pfv) == 8, "Incorrect offset"); | |
| 611 | _Static_assert(offsetof(struct nvme_tcp_ic_req, hpda) == 10, "Incorrect offset"); | |
| 612 | _Static_assert(offsetof(struct nvme_tcp_ic_req, maxr2t) == 12, "Incorrect offset"); | |
| 613 | ||
| 614 | #define NVME_TCP_HPDA_MAX 31 | |
| 615 | #define NVME_TCP_CPDA_MAX 31 | |
| 616 | #define NVME_TCP_PDU_PDO_MAX_OFFSET ((NVME_TCP_CPDA_MAX + 1) << 2) | |
| 617 | ||
| 618 | /** | |
| 619 | * ICResp | |
| 620 | * | |
| 621 | * common.pdu_type == NVME_TCP_PDU_TYPE_IC_RESP | |
| 622 | */ | |
| 623 | struct nvme_tcp_ic_resp { | |
| 624 | 	struct nvme_tcp_common_pdu_hdr	common; | |
| 625 | 	uint16_t				pfv; | |
| 626 | 	/** Specifies the data alignment for all PDUs transferred from the host to the controller that contain data */ | |
| 627 | 	uint8_t					cpda; | |
| 628 | 	union { | |
| 629 | 		uint8_t				raw; | |
| 630 | 		struct { | |
| 631 | 			uint8_t			hdgst_enable : 1; | |
| 632 | 			uint8_t			ddgst_enable : 1; | |
| 633 | 			uint8_t			reserved : 6; | |
| 634 | 		} bits; | |
| 635 | 	} dgst; | |
| 636 | 	/** Specifies the maximum number of PDU-Data bytes per H2C Data Transfer PDU */ | |
| 637 | 	uint32_t				maxh2cdata; | |
| 638 | 	uint8_t					reserved16[112]; | |
| 639 | }; | |
| 640 | _Static_assert(sizeof(struct nvme_tcp_ic_resp) == 128, "Incorrect size"); | |
| 641 | _Static_assert(offsetof(struct nvme_tcp_ic_resp, pfv) == 8, "Incorrect offset"); | |
| 642 | _Static_assert(offsetof(struct nvme_tcp_ic_resp, cpda) == 10, "Incorrect offset"); | |
| 643 | _Static_assert(offsetof(struct nvme_tcp_ic_resp, maxh2cdata) == 12, "Incorrect offset"); | |
| 644 | ||
| 645 | /** | |
| 646 | * TermReq | |
| 647 | * | |
| 648 | * common.pdu_type == NVME_TCP_PDU_TYPE_TERM_REQ | |
| 649 | */ | |
| 650 | struct nvme_tcp_term_req_hdr { | |
| 651 | 	struct nvme_tcp_common_pdu_hdr	common; | |
| 652 | 	uint16_t				fes; | |
| 653 | 	uint8_t					fei[4]; | |
| 654 | 	uint8_t					reserved14[10]; | |
| 655 | }; | |
| 656 | ||
| 657 | _Static_assert(sizeof(struct nvme_tcp_term_req_hdr) == 24, "Incorrect size"); | |
| 658 | _Static_assert(offsetof(struct nvme_tcp_term_req_hdr, fes) == 8, "Incorrect offset"); | |
| 659 | _Static_assert(offsetof(struct nvme_tcp_term_req_hdr, fei) == 10, "Incorrect offset"); | |
| 660 | ||
| 661 | enum nvme_tcp_term_req_fes { | |
| 662 | 	NVME_TCP_TERM_REQ_FES_INVALID_HEADER_FIELD			= 0x01, | |
| 663 | 	NVME_TCP_TERM_REQ_FES_PDU_SEQUENCE_ERROR			= 0x02, | |
| 664 | 	NVME_TCP_TERM_REQ_FES_HDGST_ERROR				= 0x03, | |
| 665 | 	NVME_TCP_TERM_REQ_FES_DATA_TRANSFER_OUT_OF_RANGE		= 0x04, | |
| 666 | 	NVME_TCP_TERM_REQ_FES_DATA_TRANSFER_LIMIT_EXCEEDED		= 0x05, | |
| 667 | 	NVME_TCP_TERM_REQ_FES_R2T_LIMIT_EXCEEDED			= 0x05, | |
| 668 | 	NVME_TCP_TERM_REQ_FES_INVALID_DATA_UNSUPPORTED_PARAMETER	= 0x06, | |
| 669 | }; | |
| 670 | ||
| 671 | /* Total length of term req PDU (including PDU header and DATA) in bytes shall not exceed a limit of 152 bytes. */ | |
| 672 | #define NVME_TCP_TERM_REQ_ERROR_DATA_MAX_SIZE	128 | |
| 673 | #define NVME_TCP_TERM_REQ_PDU_MAX_SIZE		(NVME_TCP_TERM_REQ_ERROR_DATA_MAX_SIZE + sizeof(struct nvme_tcp_term_req_hdr)) | |
| 674 | ||
| 675 | /** | |
| 676 | * CapsuleCmd | |
| 677 | * | |
| 678 | * common.pdu_type == NVME_TCP_PDU_TYPE_CAPSULE_CMD | |
| 679 | */ | |
| 680 | struct nvme_tcp_cmd { | |
| 681 | 	struct nvme_tcp_common_pdu_hdr	common; | |
| 682 | 	struct nvme_command		ccsqe; | |
| 683 | 	/**< icdoff hdgst padding + in-capsule data + ddgst (if enabled) */ | |
| 684 | }; | |
| 685 | _Static_assert(sizeof(struct nvme_tcp_cmd) == 72, "Incorrect size"); | |
| 686 | _Static_assert(offsetof(struct nvme_tcp_cmd, ccsqe) == 8, "Incorrect offset"); | |
| 687 | ||
| 688 | /** | |
| 689 | * CapsuleResp | |
| 690 | * | |
| 691 | * common.pdu_type == NVME_TCP_PDU_TYPE_CAPSULE_RESP | |
| 692 | */ | |
| 693 | struct nvme_tcp_rsp { | |
| 694 | 	struct nvme_tcp_common_pdu_hdr	common; | |
| 695 | 	struct nvme_completion		rccqe; | |
| 696 | }; | |
| 697 | _Static_assert(sizeof(struct nvme_tcp_rsp) == 24, "incorrect size"); | |
| 698 | _Static_assert(offsetof(struct nvme_tcp_rsp, rccqe) == 8, "Incorrect offset"); | |
| 699 | ||
| 700 | ||
| 701 | /** | |
| 702 | * H2CData | |
| 703 | * | |
| 704 | * hdr.pdu_type == NVME_TCP_PDU_TYPE_H2C_DATA | |
| 705 | */ | |
| 706 | struct nvme_tcp_h2c_data_hdr { | |
| 707 | 	struct nvme_tcp_common_pdu_hdr	common; | |
| 708 | 	uint16_t				cccid; | |
| 709 | 	uint16_t				ttag; | |
| 710 | 	uint32_t				datao; | |
| 711 | 	uint32_t				datal; | |
| 712 | 	uint8_t					reserved20[4]; | |
| 713 | }; | |
| 714 | _Static_assert(sizeof(struct nvme_tcp_h2c_data_hdr) == 24, "Incorrect size"); | |
| 715 | _Static_assert(offsetof(struct nvme_tcp_h2c_data_hdr, cccid) == 8, "Incorrect offset"); | |
| 716 | _Static_assert(offsetof(struct nvme_tcp_h2c_data_hdr, ttag) == 10, "Incorrect offset"); | |
| 717 | _Static_assert(offsetof(struct nvme_tcp_h2c_data_hdr, datao) == 12, "Incorrect offset"); | |
| 718 | _Static_assert(offsetof(struct nvme_tcp_h2c_data_hdr, datal) == 16, "Incorrect offset"); | |
| 719 | ||
| 720 | #define NVME_TCP_H2C_DATA_FLAGS_LAST_PDU	(1u << 2) | |
| 721 | #define NVME_TCP_H2C_DATA_FLAGS_SUCCESS		(1u << 3) | |
| 722 | #define NVME_TCP_H2C_DATA_PDO_MULT		8u | |
| 723 | ||
| 724 | /** | |
| 725 | * C2HData | |
| 726 | * | |
| 727 | * hdr.pdu_type == NVME_TCP_PDU_TYPE_C2H_DATA | |
| 728 | */ | |
| 729 | struct nvme_tcp_c2h_data_hdr { | |
| 730 | 	struct nvme_tcp_common_pdu_hdr	common; | |
| 731 | 	uint16_t				cccid; | |
| 732 | 	uint8_t					reserved10[2]; | |
| 733 | 	uint32_t				datao; | |
| 734 | 	uint32_t				datal; | |
| 735 | 	uint8_t					reserved20[4]; | |
| 736 | }; | |
| 737 | _Static_assert(sizeof(struct nvme_tcp_c2h_data_hdr) == 24, "Incorrect size"); | |
| 738 | _Static_assert(offsetof(struct nvme_tcp_c2h_data_hdr, cccid) == 8, "Incorrect offset"); | |
| 739 | _Static_assert(offsetof(struct nvme_tcp_c2h_data_hdr, datao) == 12, "Incorrect offset"); | |
| 740 | _Static_assert(offsetof(struct nvme_tcp_c2h_data_hdr, datal) == 16, "Incorrect offset"); | |
| 741 | ||
| 742 | #define NVME_TCP_C2H_DATA_FLAGS_SUCCESS		(1u << 3) | |
| 743 | #define NVME_TCP_C2H_DATA_FLAGS_LAST_PDU	(1u << 2) | |
| 744 | #define NVME_TCP_C2H_DATA_PDO_MULT		8u | |
| 745 | ||
| 746 | /** | |
| 747 | * R2T | |
| 748 | * | |
| 749 | * common.pdu_type == NVME_TCP_PDU_TYPE_R2T | |
| 750 | */ | |
| 751 | struct nvme_tcp_r2t_hdr { | |
| 752 | 	struct nvme_tcp_common_pdu_hdr	common; | |
| 753 | 	uint16_t				cccid; | |
| 754 | 	uint16_t				ttag; | |
| 755 | 	uint32_t				r2to; | |
| 756 | 	uint32_t				r2tl; | |
| 757 | 	uint8_t					reserved20[4]; | |
| 758 | }; | |
| 759 | _Static_assert(sizeof(struct nvme_tcp_r2t_hdr) == 24, "Incorrect size"); | |
| 760 | _Static_assert(offsetof(struct nvme_tcp_r2t_hdr, cccid) == 8, "Incorrect offset"); | |
| 761 | _Static_assert(offsetof(struct nvme_tcp_r2t_hdr, ttag) == 10, "Incorrect offset"); | |
| 762 | _Static_assert(offsetof(struct nvme_tcp_r2t_hdr, r2to) == 12, "Incorrect offset"); | |
| 763 | _Static_assert(offsetof(struct nvme_tcp_r2t_hdr, r2tl) == 16, "Incorrect offset"); | |
| 764 | ||
| 765 | #endif /* __NVMF_PROTO_H__ */ | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/dev/ofw/ofw_cpu.h+1-1| ... | ... | @@ -30,6 +30,6 @@ |
| 30 | 30 | #define _DEV_OFW_OFW_CPU_H_ |
| 31 | 31 | |
| 32 | 32 | typedef bool (*ofw_cpu_foreach_cb)(u_int, phandle_t, u_int, pcell_t *); |
| 33 | int ofw_cpu_early_foreach(ofw_cpu_foreach_cb, boolean_t); | |
| 33 | int ofw_cpu_early_foreach(ofw_cpu_foreach_cb, bool); | |
| 34 | 34 | |
| 35 | 35 | #endif /* _DEV_OFW_OFW_CPU_H_ */ |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/dev/ofw/openfirm.h+3-2| ... | ... | @@ -83,8 +83,8 @@ MALLOC_DECLARE(M_OFWPROP); |
| 83 | 83 | * interface as the Open Firmware access mechanism, OF_init initializes it. |
| 84 | 84 | */ |
| 85 | 85 | |
| 86 | boolean_t	OF_install(char *name, int prio); | |
| 87 | int		OF_init(void *cookie); | |
| 86 | bool	OF_install(char *name, int prio); | |
| 87 | int	OF_init(void *cookie); | |
| 88 | 88 | |
| 89 | 89 | /* |
| 90 | 90 | * Known Open Firmware interface names |
| ... | ... | @@ -149,6 +149,7 @@ phandle_t	OF_xref_from_node(phandle_t node); |
| 149 | 149 | device_t	OF_device_from_xref(phandle_t xref); |
| 150 | 150 | phandle_t	OF_xref_from_device(device_t dev); |
| 151 | 151 | int		OF_device_register_xref(phandle_t xref, device_t dev); |
| 152 | void		OF_device_unregister_xref(phandle_t xref, device_t dev); | |
| 152 | 153 | |
| 153 | 154 | /* Device I/O functions */ |
| 154 | 155 | ihandle_t	OF_open(const char *path); |
lib/libc/include/generic-freebsd/dev/ofw/openfirmio.h-2| ... | ... | @@ -33,8 +33,6 @@ |
| 33 | 33 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 34 | 34 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 35 | 35 | * SUCH DAMAGE. |
| 36 | * | |
| 37 | *	@(#)openpromio.h	8.1 (Berkeley) 6/11/93 | |
| 38 | 36 | */ |
| 39 | 37 | |
| 40 | 38 | #ifndef _DEV_OFW_OPENFIRMIO_H_ |
lib/libc/include/generic-freebsd/dev/pci/pcireg.h+3| ... | ... | @@ -616,6 +616,8 @@ |
| 616 | 616 | #define	PCIM_MSICTRL_MMC_16		0x0008 |
| 617 | 617 | #define	PCIM_MSICTRL_MMC_32		0x000A |
| 618 | 618 | #define	PCIM_MSICTRL_MSI_ENABLE		0x0001 |
| 619 | #define	PCI_MSI_MSGNUM(ctrl)						\ | |
| 620 | 	(1 << (((ctrl) & PCIM_MSICTRL_MMC_MASK) >> 1)) | |
| 619 | 621 | #define	PCIR_MSI_ADDR		0x4 |
| 620 | 622 | #define	PCIR_MSI_ADDR_HIGH	0x8 |
| 621 | 623 | #define	PCIR_MSI_DATA		0x8 |
| ... | ... | @@ -965,6 +967,7 @@ |
| 965 | 967 | #define	PCIM_MSIXCTRL_MSIX_ENABLE	0x8000 |
| 966 | 968 | #define	PCIM_MSIXCTRL_FUNCTION_MASK	0x4000 |
| 967 | 969 | #define	PCIM_MSIXCTRL_TABLE_SIZE	0x07FF |
| 970 | #define	PCI_MSIX_MSGNUM(ctrl)	(((ctrl) & PCIM_MSIXCTRL_TABLE_SIZE) + 1) | |
| 968 | 971 | #define	PCIR_MSIX_TABLE		0x4 |
| 969 | 972 | #define	PCIR_MSIX_PBA		0x8 |
| 970 | 973 | #define	PCIM_MSIX_BIR_MASK		0x7 |
lib/libc/include/generic-freebsd/dev/powermac_nvram/powermac_nvramvar.h deleted-82| ... | ... | @@ -1,82 +0,0 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-2-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 2006 Maxim Sobolev <sobomax@FreeBSD.org> | |
| 5 | * All rights reserved. | |
| 6 | * | |
| 7 | * Redistribution and use in source and binary forms, with or without | |
| 8 | * modification, are permitted provided that the following conditions | |
| 9 | * are met: | |
| 10 | * 1. Redistributions of source code must retain the above copyright | |
| 11 | * notice, this list of conditions and the following disclaimer. | |
| 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 13 | * notice, this list of conditions and the following disclaimer in the | |
| 14 | * documentation and/or other materials provided with the distribution. | |
| 15 | * | |
| 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | |
| 17 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | |
| 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |
| 19 | * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, | |
| 20 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | |
| 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | |
| 22 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
| 23 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | |
| 24 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN | |
| 25 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
| 26 | * POSSIBILITY OF SUCH DAMAGE. | |
| 27 | */ | |
| 28 | ||
| 29 | #ifndef	_POWERPC_POWERMAC_POWERMAC_NVRAMVAR_H_ | |
| 30 | #define	_POWERPC_POWERMAC_POWERMAC_NVRAMVAR_H_ | |
| 31 | ||
| 32 | #define	NVRAM_SIZE		0x2000 | |
| 33 | ||
| 34 | #define	CORE99_SIGNATURE	0x5a | |
| 35 | ||
| 36 | #define SM_FLASH_CMD_ERASE_CONFIRM	0xd0 | |
| 37 | #define SM_FLASH_CMD_ERASE_SETUP	0x20 | |
| 38 | #define SM_FLASH_CMD_RESET		0xff | |
| 39 | #define SM_FLASH_CMD_WRITE_SETUP	0x40 | |
| 40 | #define SM_FLASH_CMD_CLEAR_STATUS	0x50 | |
| 41 | #define SM_FLASH_CMD_READ_STATUS	0x70 | |
| 42 | ||
| 43 | #define SM_FLASH_STATUS_DONE	0x80 | |
| 44 | #define SM_FLASH_STATUS_ERR	0x38 | |
| 45 | ||
| 46 | #ifdef _KERNEL | |
| 47 | ||
| 48 | struct powermac_nvram_softc { | |
| 49 | 	device_t		sc_dev; | |
| 50 | 	struct sx		sc_lock; | |
| 51 | 	phandle_t		sc_node; | |
| 52 | 	void *			sc_bank; | |
| 53 | 	void *			sc_bank0; | |
| 54 | 	void *			sc_bank1; | |
| 55 | 	uint8_t			sc_data[NVRAM_SIZE]; | |
| 56 | ||
| 57 | 	struct cdev *		sc_cdev; | |
| 58 | 	int			sc_type; | |
| 59 | #define FLASH_TYPE_SM	0 | |
| 60 | #define FLASH_TYPE_AMD	1 | |
| 61 | 	int			sc_isopen; | |
| 62 | 	int			sc_rpos; | |
| 63 | 	int			sc_wpos; | |
| 64 | }; | |
| 65 | ||
| 66 | #endif /* _KERNEL */ | |
| 67 | ||
| 68 | struct chrp_header { | |
| 69 | 	uint8_t			signature; | |
| 70 | 	uint8_t			chrp_checksum; | |
| 71 | 	uint16_t		length; | |
| 72 | 	char			name[12]; | |
| 73 | }; | |
| 74 | ||
| 75 | struct core99_header { | |
| 76 | 	struct chrp_header	chrp_header; | |
| 77 | 	uint32_t		adler_checksum; | |
| 78 | 	uint32_t		generation; | |
| 79 | 	uint32_t		reserved[2]; | |
| 80 | }; | |
| 81 | ||
| 82 | #endif /* _POWERPC_POWERMAC_POWERMAC_NVRAMVAR_H_ */ | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/dev/ppbus/lpt.h-1| ... | ... | @@ -32,7 +32,6 @@ |
| 32 | 32 | * SUCH DAMAGE. |
| 33 | 33 | * |
| 34 | 34 | * Distantly from : |
| 35 | *	@(#)lptreg.h 1.1 (Berkeley) 12/19/90 | |
| 36 | 35 | *	Id: lptreg.h,v 1.6 1997/02/22 09:36:52 peter Exp |
| 37 | 36 | *	From Id: nlpt.h,v 1.3 1999/01/10 12:04:54 nsouch Exp |
| 38 | 37 | */ |
lib/libc/include/generic-freebsd/dev/ppbus/ppbconf.h+1-1| ... | ... | @@ -63,7 +63,7 @@ |
| 63 | 63 | /* |
| 64 | 64 | * Parallel Port Bus sleep/wakeup queue. |
| 65 | 65 | */ |
| 66 | #define PPBPRI	(PZERO+8) | |
| 66 | #define PPBPRI	(PWAIT) | |
| 67 | 67 | |
| 68 | 68 | /* |
| 69 | 69 | * Parallel Port Chipset mode masks. |
lib/libc/include/generic-freebsd/dev/smbus/smbconf.h+1-1| ... | ... | @@ -30,7 +30,7 @@ |
| 30 | 30 | |
| 31 | 31 | #include <sys/queue.h> |
| 32 | 32 | |
| 33 | #define SMBPRI (PZERO+8)		/* XXX sleep/wakeup queue priority */ | |
| 33 | #define SMBPRI (PWAIT)		/* XXX sleep/wakeup queue priority */ | |
| 34 | 34 | |
| 35 | 35 | #define n(flags) (~(flags) & (flags)) |
| 36 | 36 |
lib/libc/include/generic-freebsd/dev/usb/usb.h+1-1| ... | ... | @@ -114,7 +114,7 @@ MALLOC_DECLARE(M_USBDEV); |
| 114 | 114 | /* Allow for marginal and non-conforming devices. */ |
| 115 | 115 | #define	USB_PORT_RESET_DELAY		50	/* ms */ |
| 116 | 116 | #define	USB_PORT_ROOT_RESET_DELAY	200	/* ms */ |
| 117 | #define	USB_PORT_RESET_RECOVERY		10	/* ms */ | |
| 117 | #define	USB_PORT_RESET_RECOVERY		20	/* ms */ | |
| 118 | 118 | #define	USB_PORT_POWERUP_DELAY		300	/* ms */ |
| 119 | 119 | #define	USB_PORT_RESUME_DELAY		(20*2)	/* ms */ |
| 120 | 120 | #define	USB_SET_ADDRESS_SETTLE		10	/* ms */ |
lib/libc/include/generic-freebsd/dev/usb/usb_bus.h+1-1| ... | ... | @@ -86,7 +86,7 @@ struct usb_bus { |
| 86 | 86 | 	struct usb_bus_msg shutdown_msg[2]; |
| 87 | 87 | #if USB_HAVE_UGEN |
| 88 | 88 | 	struct usb_bus_msg cleanup_msg[2]; |
| 89 | 	LIST_HEAD(,usb_fs_privdata) pd_cleanup_list; | |
| 89 | 	SLIST_HEAD(,usb_fs_privdata) pd_cleanup_list; | |
| 90 | 90 | #endif |
| 91 | 91 | 	/* |
| 92 | 92 | 	 * This mutex protects the USB hardware: |
lib/libc/include/generic-freebsd/dev/usb/usb_dev.h+1-1| ... | ... | @@ -96,7 +96,7 @@ struct usb_fs_privdata { |
| 96 | 96 | 	int fifo_index; |
| 97 | 97 | 	struct cdev *cdev; |
| 98 | 98 | |
| 99 | 	LIST_ENTRY(usb_fs_privdata) pd_next; | |
| 99 | 	SLIST_ENTRY(usb_fs_privdata) pd_next; | |
| 100 | 100 | }; |
| 101 | 101 | |
| 102 | 102 | /* |
lib/libc/include/generic-freebsd/dev/usb/usb_device.h+1-1| ... | ... | @@ -225,7 +225,7 @@ struct usb_device { |
| 225 | 225 | 	struct usb_fifo *fifo[USB_FIFO_MAX]; |
| 226 | 226 | 	struct usb_symlink *ugen_symlink;	/* our generic symlink */ |
| 227 | 227 | 	struct usb_fs_privdata *ctrl_dev;	/* Control Endpoint 0 device node */ |
| 228 | 	LIST_HEAD(,usb_fs_privdata) pd_list; | |
| 228 | 	SLIST_HEAD(,usb_fs_privdata) pd_list; | |
| 229 | 229 | 	char	ugen_name[20];		/* name of ugenX.X device */ |
| 230 | 230 | #endif |
| 231 | 231 | 	usb_ticks_t plugtime;		/* copy of "ticks" */ |
lib/libc/include/generic-freebsd/dev/usb/usb_freebsd.h+1| ... | ... | @@ -42,6 +42,7 @@ |
| 42 | 42 | #define	USB_HAVE_TT_SUPPORT 1 |
| 43 | 43 | #define	USB_HAVE_POWERD 1 |
| 44 | 44 | #define	USB_HAVE_MSCTEST 1 |
| 45 | #define	USB_HAVE_MSCTEST_AUTOQUIRK 0 | |
| 45 | 46 | #define	USB_HAVE_MSCTEST_DETACH 1 |
| 46 | 47 | #define	USB_HAVE_PF 1 |
| 47 | 48 | #define	USB_HAVE_ROOT_MOUNT_HOLD 1 |
lib/libc/include/generic-freebsd/dev/usb/usb_freebsd_loader.h+1| ... | ... | @@ -42,6 +42,7 @@ |
| 42 | 42 | #define	USB_HAVE_TT_SUPPORT 1 |
| 43 | 43 | #define	USB_HAVE_POWERD 1 |
| 44 | 44 | #define	USB_HAVE_MSCTEST 1 |
| 45 | #define	USB_HAVE_MSCTEST_AUTOQUIRK 0 | |
| 45 | 46 | #define	USB_HAVE_MSCTEST_DETACH 0 |
| 46 | 47 | #define	USB_HAVE_PF 0 |
| 47 | 48 | #define	USB_HAVE_ROOT_MOUNT_HOLD 0 |
lib/libc/include/generic-freebsd/dev/usb/usb_ioctl.h+1-1| ... | ... | @@ -239,7 +239,7 @@ struct usb_gen_quirk { |
| 239 | 239 | #define	USB_DEVICESTATS		_IOR ('U', 5, struct usb_device_stats) |
| 240 | 240 | #define	USB_DEVICEENUMERATE	_IOW ('U', 6, int) |
| 241 | 241 | |
| 242 | /* Generic HID device. Numbers 26 and 30-39 are occupied by hidraw. */ | |
| 242 | /* Generic HID device. Numbers 26 and 30-49 are occupied by hidraw. */ | |
| 243 | 243 | #define	USB_GET_REPORT_DESC	_IOWR('U', 21, struct usb_gen_descriptor) |
| 244 | 244 | #define	USB_SET_IMMED		_IOW ('U', 22, int) |
| 245 | 245 | #define	USB_GET_REPORT		_IOWR('U', 23, struct usb_gen_descriptor) |
lib/libc/include/generic-freebsd/dev/usb/usb_process.h+1-1| ... | ... | @@ -31,7 +31,6 @@ |
| 31 | 31 | #ifndef USB_GLOBAL_INCLUDE_FILE |
| 32 | 32 | #include <sys/interrupt.h> |
| 33 | 33 | #include <sys/priority.h> |
| 34 | #include <sys/runq.h> | |
| 35 | 34 | #endif |
| 36 | 35 | |
| 37 | 36 | /* defines */ |
| ... | ... | @@ -76,6 +75,7 @@ int	usb_proc_create(struct usb_process *up, struct mtx *p_mtx, |
| 76 | 75 | 	 const char *pmesg, uint8_t prio); |
| 77 | 76 | void	usb_proc_drain(struct usb_process *up); |
| 78 | 77 | void	usb_proc_mwait(struct usb_process *up, void *pm0, void *pm1); |
| 78 | int	usb_proc_mwait_sig(struct usb_process *up, void *pm0, void *pm1); | |
| 79 | 79 | void	usb_proc_free(struct usb_process *up); |
| 80 | 80 | void *usb_proc_msignal(struct usb_process *up, void *pm0, void *pm1); |
| 81 | 81 | void	usb_proc_rewakeup(struct usb_process *up); |
lib/libc/include/generic-freebsd/dev/usb/usbdi.h+5| ... | ... | @@ -38,6 +38,7 @@ struct usb_process; |
| 38 | 38 | struct usb_proc_msg; |
| 39 | 39 | struct usb_mbuf; |
| 40 | 40 | struct usb_fs_privdata; |
| 41 | struct usb_device_info; | |
| 41 | 42 | struct mbuf; |
| 42 | 43 | |
| 43 | 44 | typedef enum {	/* keep in sync with usb_errstr_table */ |
| ... | ... | @@ -525,6 +526,8 @@ struct usb_proc_msg { |
| 525 | 526 | 	usb_size_t pm_num; |
| 526 | 527 | }; |
| 527 | 528 | |
| 529 | #define	USB_PROC_MSG_ENQUEUED(msg)	((msg)->pm_qentry.tqe_prev != NULL) | |
| 530 | ||
| 528 | 531 | #define	USB_FIFO_TX 0 |
| 529 | 532 | #define	USB_FIFO_RX 1 |
| 530 | 533 | |
| ... | ... | @@ -585,6 +588,8 @@ usb_error_t	usbd_set_endpoint_mode(struct usb_device *udev, |
| 585 | 588 | 			struct usb_endpoint *ep, uint8_t ep_mode); |
| 586 | 589 | uint8_t		usbd_get_endpoint_mode(struct usb_device *udev, |
| 587 | 590 | 			struct usb_endpoint *ep); |
| 591 | int		usbd_fill_deviceinfo(struct usb_device *udev, | |
| 592 | 			struct usb_device_info *di); | |
| 588 | 593 | |
| 589 | 594 | const struct usb_device_id *usbd_lookup_id_by_info( |
| 590 | 595 | 	 const struct usb_device_id *id, usb_size_t sizeof_id, |
lib/libc/include/generic-freebsd/dev/veriexec/veriexec_ioctl.h+1-1| ... | ... | @@ -63,7 +63,7 @@ struct verified_exec_label_params { |
| 63 | 63 | #define VERIEXEC_DEBUG_OFF 	_IO('S', 0x6)	/* reset debug */ |
| 64 | 64 | #define VERIEXEC_GETSTATE 	_IOR('S', 0x7, int) /* get state */ |
| 65 | 65 | #define	VERIEXEC_SIGNED_LOAD32	_IOW('S', 0x8, struct verified_exec_params32) |
| 66 | #define	VERIEXEC_VERIFIED_FILD	_IOW('S', 0x9, int) /* fd */ | |
| 66 | #define	VERIEXEC_VERIFIED_FILE	_IOW('S', 0x9, int) /* fd */ | |
| 67 | 67 | #define VERIEXEC_GETVERSION	_IOR('S', 0xa, int) /* get version */ |
| 68 | 68 | #define VERIEXEC_LABEL_LOAD	_IOW('S', 0xb, struct verified_exec_label_params) |
| 69 | 69 | #define	VERIEXEC_SIGNED_LOAD	_IOW('S', 0xc, struct verified_exec_params) |
lib/libc/include/generic-freebsd/dev/wg/if_wg.h+6| ... | ... | @@ -32,4 +32,10 @@ struct wg_data_io { |
| 32 | 32 | #define SIOCSWG _IOWR('i', 210, struct wg_data_io) |
| 33 | 33 | #define SIOCGWG _IOWR('i', 211, struct wg_data_io) |
| 34 | 34 | |
| 35 | ||
| 36 | /* Keep these in sync with wireguard-tools:containers.h */ | |
| 37 | #define WGALLOWEDIP_REMOVE_ME		0x0001 | |
| 38 | ||
| 39 | #define WGALLOWEDIP_VALID_FLAGS		WGALLOWEDIP_REMOVE_ME | |
| 40 | ||
| 35 | 41 | #endif /* __IF_WG_H__ */ |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/dirent.h+15-3| ... | ... | @@ -27,8 +27,6 @@ |
| 27 | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | * | |
| 31 | *	@(#)dirent.h	8.2 (Berkeley) 7/28/94 | |
| 32 | 30 | */ |
| 33 | 31 | |
| 34 | 32 | #ifndef _DIRENT_H_ |
| ... | ... | @@ -118,7 +116,8 @@ DIR	*fdopendir(int); |
| 118 | 116 | struct dirent * |
| 119 | 117 | 	 readdir(DIR *); |
| 120 | 118 | #if __POSIX_VISIBLE >= 199506 || __XSI_VISIBLE >= 500 |
| 121 | int	 readdir_r(DIR *, struct dirent *, struct dirent **); | |
| 119 | int	 readdir_r(DIR *, struct dirent *, struct dirent **) | |
| 120 | 	__deprecated1("Does not take variable {NAME_MAX} into account"); | |
| 122 | 121 | #endif |
| 123 | 122 | void	 rewinddir(DIR *); |
| 124 | 123 | #if __POSIX_VISIBLE >= 200809 || __XSI_VISIBLE >= 700 |
| ... | ... | @@ -132,9 +131,22 @@ int	 scandir_b(const char *, struct dirent ***, |
| 132 | 131 | #endif |
| 133 | 132 | #endif |
| 134 | 133 | #if __BSD_VISIBLE |
| 134 | int	 fdscandir(int, struct dirent ***, | |
| 135 | 	 int (*)(const struct dirent *), int (*)(const struct dirent **, | |
| 136 | 	 const struct dirent **)); | |
| 137 | #ifdef __BLOCKS__ | |
| 138 | int	 fdscandir_b(int, struct dirent ***, | |
| 139 | 	 int (^)(const struct dirent *), | |
| 140 | 	 int (^)(const struct dirent **, const struct dirent **)); | |
| 141 | #endif | |
| 135 | 142 | int	 scandirat(int, const char *, struct dirent ***, |
| 136 | 143 | 	 int (*)(const struct dirent *), int (*)(const struct dirent **, |
| 137 | 144 | 	 const struct dirent **)); |
| 145 | #ifdef __BLOCKS__ | |
| 146 | int	 scandirat_b(int, const char *, struct dirent ***, | |
| 147 | 	 int (^)(const struct dirent *), | |
| 148 | 	 int (^)(const struct dirent **, const struct dirent **)); | |
| 149 | #endif | |
| 138 | 150 | #endif |
| 139 | 151 | #if __XSI_VISIBLE |
| 140 | 152 | void	 seekdir(DIR *, long); |
lib/libc/include/generic-freebsd/dlfcn.h+1| ... | ... | @@ -32,6 +32,7 @@ |
| 32 | 32 | #ifndef _DLFCN_H_ |
| 33 | 33 | #define	_DLFCN_H_ |
| 34 | 34 | |
| 35 | #include <sys/cdefs.h> | |
| 35 | 36 | #include <sys/_types.h> |
| 36 | 37 | |
| 37 | 38 | /* |
lib/libc/include/generic-freebsd/endian.h+26-1| ... | ... | @@ -11,9 +11,34 @@ |
| 11 | 11 | #ifndef _ENDIAN_H_ |
| 12 | 12 | #define _ENDIAN_H_ |
| 13 | 13 | |
| 14 | /* | |
| 15 | * POSIX.1-2024 requires that endian.h define uint{16,32,64}_t. Although POSIX | |
| 16 | * allows stdint.h symbols here, be conservative and only define there required | |
| 17 | * ones. FreeBSD's sys/_endian.h doesn't need to expose those types since it | |
| 18 | * implements all the [bl]eXtoh hto[bl]eX interfaces as macros calling builtin | |
| 19 | * functions. POSIX.1-2024 allows functions, macros or both. We opt for macros | |
| 20 | * only. | |
| 21 | */ | |
| 22 | #include <sys/_types.h> | |
| 23 | ||
| 24 | #ifndef _UINT16_T_DECLARED | |
| 25 | typedef	__uint16_t		uint16_t; | |
| 26 | #define	_UINT16_T_DECLARED | |
| 27 | #endif | |
| 28 | ||
| 29 | #ifndef _UINT32_T_DECLARED | |
| 30 | typedef	__uint32_t		uint32_t; | |
| 31 | #define	_UINT32_T_DECLARED | |
| 32 | #endif | |
| 33 | ||
| 34 | #ifndef _UINT64_T_DECLARED | |
| 35 | typedef	__uint64_t		uint64_t; | |
| 36 | #define	_UINT64_T_DECLARED | |
| 37 | #endif | |
| 38 | ||
| 14 | 39 | /* |
| 15 | 40 | * FreeBSD's sys/_endian.h is very close to the interface provided on Linux by |
| 16 | * glibc's endian.h. | |
| 41 | * glibc's endian.h as well as POSIX.1-2024's endian.h. | |
| 17 | 42 | */ |
| 18 | 43 | #include <sys/_endian.h> |
| 19 | 44 |
lib/libc/include/generic-freebsd/err.h-2| ... | ... | @@ -27,8 +27,6 @@ |
| 27 | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | * | |
| 31 | *	@(#)err.h	8.1 (Berkeley) 6/2/93 | |
| 32 | 30 | */ |
| 33 | 31 | |
| 34 | 32 | #ifndef _ERR_H_ |
lib/libc/include/generic-freebsd/errno.h-2| ... | ... | @@ -32,8 +32,6 @@ |
| 32 | 32 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 33 | 33 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 34 | 34 | * SUCH DAMAGE. |
| 35 | * | |
| 36 | *	@(#)errno.h	8.5 (Berkeley) 1/21/94 | |
| 37 | 35 | */ |
| 38 | 36 | |
| 39 | 37 | #ifndef _SYS_ERRNO_H_ |
lib/libc/include/generic-freebsd/execinfo.h+2| ... | ... | @@ -32,6 +32,8 @@ |
| 32 | 32 | #ifndef _EXECINFO_H_ |
| 33 | 33 | #define _EXECINFO_H_ |
| 34 | 34 | |
| 35 | #include <sys/cdefs.h> | |
| 36 | ||
| 35 | 37 | #include <stddef.h> |
| 36 | 38 | |
| 37 | 39 | __BEGIN_DECLS |
lib/libc/include/generic-freebsd/exterr.h created+21| ... | ... | @@ -0,0 +1,21 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-2-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 2025 The FreeBSD Foundation | |
| 5 | * All rights reserved. | |
| 6 | * | |
| 7 | * This software were developed by Konstantin Belousov <kib@FreeBSD.org> | |
| 8 | * under sponsorship from the FreeBSD Foundation. | |
| 9 | */ | |
| 10 | ||
| 11 | #ifndef _EXTERR_H_ | |
| 12 | #define	_EXTERR_H_ | |
| 13 | ||
| 14 | #include <sys/cdefs.h> | |
| 15 | #include <sys/exterr_cat.h> | |
| 16 | ||
| 17 | __BEGIN_DECLS | |
| 18 | int uexterr_gettext(char *buf, size_t bufsz); | |
| 19 | __END_DECLS | |
| 20 | ||
| 21 | #endif | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/fcntl.h+31-2| ... | ... | @@ -32,8 +32,6 @@ |
| 32 | 32 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 33 | 33 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 34 | 34 | * SUCH DAMAGE. |
| 35 | * | |
| 36 | *	@(#)fcntl.h	8.3 (Berkeley) 1/21/94 | |
| 37 | 35 | */ |
| 38 | 36 | |
| 39 | 37 | #ifndef _SYS_FCNTL_H_ |
| ... | ... | @@ -142,8 +140,24 @@ typedef	__pid_t		pid_t; |
| 142 | 140 | #define	O_DSYNC		0x01000000	/* POSIX data sync */ |
| 143 | 141 | #if __BSD_VISIBLE |
| 144 | 142 | #define	O_EMPTY_PATH	0x02000000 |
| 143 | #define	O_NAMEDATTR	0x04000000	/* NFSv4 named attributes */ | |
| 144 | #define	O_XATTR		O_NAMEDATTR	/* Solaris compatibility */ | |
| 145 | #endif | |
| 146 | ||
| 147 | #if __POSIX_VISIBLE >= 202405 | |
| 148 | #define	O_CLOFORK	0x08000000 | |
| 145 | 149 | #endif |
| 146 | 150 | |
| 151 | /* | |
| 152 | * !!! DANGER !!! | |
| 153 | * | |
| 154 | * There are very few bits left for O_* flags. Every bit we consume for | |
| 155 | * local features is one bit we can't use for future source compatibility | |
| 156 | * with other operating systems. | |
| 157 | * | |
| 158 | * All additions should be coordinated with srcmgr@. | |
| 159 | */ | |
| 160 | ||
| 147 | 161 | /* |
| 148 | 162 | * XXX missing O_RSYNC. |
| 149 | 163 | */ |
| ... | ... | @@ -270,6 +284,16 @@ typedef	__pid_t		pid_t; |
| 270 | 284 | #define	F_GET_SEALS	20 |
| 271 | 285 | #define	F_ISUNIONSTACK	21		/* Kludge for libc, don't use it. */ |
| 272 | 286 | #define	F_KINFO		22		/* Return kinfo_file for this fd */ |
| 287 | #endif	/* __BSD_VISIBLE */ | |
| 288 | ||
| 289 | #if __POSIX_VISIBLE >= 202405 | |
| 290 | #define	F_DUPFD_CLOFORK	23		/* Like F_DUPFD, but FD_CLOFORK is set */ | |
| 291 | #endif | |
| 292 | ||
| 293 | #if __BSD_VISIBLE | |
| 294 | #define F_DUP3FD	24		/* Used with dup3() */ | |
| 295 | ||
| 296 | #define F_DUP3FD_SHIFT	16		/* Shift used for F_DUP3FD */ | |
| 273 | 297 | |
| 274 | 298 | /* Seals (F_ADD_SEALS, F_GET_SEALS). */ |
| 275 | 299 | #define	F_SEAL_SEAL	0x0001		/* Prevent adding sealings */ |
| ... | ... | @@ -280,6 +304,11 @@ typedef	__pid_t		pid_t; |
| 280 | 304 | |
| 281 | 305 | /* file descriptor flags (F_GETFD, F_SETFD) */ |
| 282 | 306 | #define	FD_CLOEXEC	1		/* close-on-exec flag */ |
| 307 | #define	FD_RESOLVE_BENEATH 2		/* all lookups relative to fd have | |
| 308 | 					 O_RESOLVE_BENEATH semantics */ | |
| 309 | #if __POSIX_VISIBLE >= 202405 | |
| 310 | #define	FD_CLOFORK	4		/* close-on-fork flag */ | |
| 311 | #endif | |
| 283 | 312 | |
| 284 | 313 | /* record locking flags (F_GETLK, F_SETLK, F_SETLKW) */ |
| 285 | 314 | #define	F_RDLCK		1		/* shared or read lock */ |
lib/libc/include/generic-freebsd/fenv.h+229-186| ... | ... | @@ -29,276 +29,319 @@ |
| 29 | 29 | #ifndef	_FENV_H_ |
| 30 | 30 | #define	_FENV_H_ |
| 31 | 31 | |
| 32 | #include <sys/cdefs.h> | |
| 32 | 33 | #include <sys/_types.h> |
| 33 | #include <machine/endian.h> | |
| 34 | #include <ieeefp.h> | |
| 34 | 35 | |
| 35 | 36 | #ifndef	__fenv_static |
| 36 | 37 | #define	__fenv_static	static |
| 37 | 38 | #endif |
| 38 | 39 | |
| 39 | typedef	__uint32_t	fenv_t; | |
| 40 | typedef	__uint32_t	fexcept_t; | |
| 40 | typedef	__uint16_t	fexcept_t; | |
| 41 | 41 | |
| 42 | 42 | /* Exception flags */ |
| 43 | #ifdef __SPE__ | |
| 44 | #define FE_OVERFLOW	0x00000100 | |
| 45 | #define FE_UNDERFLOW	0x00000200 | |
| 46 | #define FE_DIVBYZERO	0x00000400 | |
| 47 | #define FE_INVALID	0x00000800 | |
| 48 | #define FE_INEXACT	0x00001000 | |
| 49 | ||
| 50 | #define	FE_ALL_INVALID	FE_INVALID | |
| 51 | ||
| 52 | #define	_FPUSW_SHIFT	6 | |
| 53 | #else | |
| 54 | #define	FE_INEXACT	0x02000000 | |
| 55 | #define	FE_DIVBYZERO	0x04000000 | |
| 56 | #define	FE_UNDERFLOW	0x08000000 | |
| 57 | #define	FE_OVERFLOW	0x10000000 | |
| 58 | #define	FE_INVALID	0x20000000	/* all types of invalid FP ops */ | |
| 59 | ||
| 60 | /* | |
| 61 | * The PowerPC architecture has extra invalid flags that indicate the | |
| 62 | * specific type of invalid operation occurred. These flags may be | |
| 63 | * tested, set, and cleared---but not masked---separately. All of | |
| 64 | * these bits are cleared when FE_INVALID is cleared, but only | |
| 65 | * FE_VXSOFT is set when FE_INVALID is explicitly set in software. | |
| 66 | */ | |
| 67 | #define	FE_VXCVI	0x00000100	/* invalid integer convert */ | |
| 68 | #define	FE_VXSQRT	0x00000200	/* square root of a negative */ | |
| 69 | #define	FE_VXSOFT	0x00000400	/* software-requested exception */ | |
| 70 | #define	FE_VXVC		0x00080000	/* ordered comparison involving NaN */ | |
| 71 | #define	FE_VXIMZ	0x00100000	/* inf * 0 */ | |
| 72 | #define	FE_VXZDZ	0x00200000	/* 0 / 0 */ | |
| 73 | #define	FE_VXIDI	0x00400000	/* inf / inf */ | |
| 74 | #define	FE_VXISI	0x00800000	/* inf - inf */ | |
| 75 | #define	FE_VXSNAN	0x01000000	/* operation on a signalling NaN */ | |
| 76 | #define	FE_ALL_INVALID	(FE_VXCVI | FE_VXSQRT | FE_VXSOFT | FE_VXVC | \ | |
| 77 | 			 FE_VXIMZ | FE_VXZDZ | FE_VXIDI | FE_VXISI | \ | |
| 78 | 			 FE_VXSNAN | FE_INVALID) | |
| 79 | ||
| 80 | #define	_FPUSW_SHIFT	22 | |
| 81 | #endif | |
| 82 | #define	FE_ALL_EXCEPT	(FE_DIVBYZERO | FE_INEXACT | \ | |
| 83 | 			 FE_ALL_INVALID | FE_OVERFLOW | FE_UNDERFLOW) | |
| 43 | #define	FE_INVALID	0x01 | |
| 44 | #define	FE_DENORMAL	0x02 | |
| 45 | #define	FE_DIVBYZERO	0x04 | |
| 46 | #define	FE_OVERFLOW	0x08 | |
| 47 | #define	FE_UNDERFLOW	0x10 | |
| 48 | #define	FE_INEXACT	0x20 | |
| 49 | #define	FE_ALL_EXCEPT	(FE_DIVBYZERO | FE_DENORMAL | FE_INEXACT | \ | |
| 50 | 			 FE_INVALID | FE_OVERFLOW | FE_UNDERFLOW) | |
| 84 | 51 | |
| 85 | 52 | /* Rounding modes */ |
| 86 | 53 | #define	FE_TONEAREST	0x0000 |
| 87 | #define	FE_TOWARDZERO	0x0001 | |
| 88 | #define	FE_UPWARD	0x0002 | |
| 89 | #define	FE_DOWNWARD	0x0003 | |
| 54 | #define	FE_DOWNWARD	0x0400 | |
| 55 | #define	FE_UPWARD	0x0800 | |
| 56 | #define	FE_TOWARDZERO	0x0c00 | |
| 90 | 57 | #define	_ROUND_MASK	(FE_TONEAREST | FE_DOWNWARD | \ |
| 91 | 58 | 			 FE_UPWARD | FE_TOWARDZERO) |
| 92 | 59 | |
| 60 | /* | |
| 61 | * As compared to the x87 control word, the SSE unit's control word | |
| 62 | * has the rounding control bits offset by 3 and the exception mask | |
| 63 | * bits offset by 7. | |
| 64 | */ | |
| 65 | #define	_SSE_ROUND_SHIFT	3 | |
| 66 | #define	_SSE_EMASK_SHIFT	7 | |
| 67 | ||
| 68 | #ifdef __i386__ | |
| 69 | /* | |
| 70 | * To preserve binary compatibility with FreeBSD 5.3, we pack the | |
| 71 | * mxcsr into some reserved fields, rather than changing sizeof(fenv_t). | |
| 72 | */ | |
| 73 | typedef struct { | |
| 74 | 	__uint16_t	__control; | |
| 75 | 	__uint16_t __mxcsr_hi; | |
| 76 | 	__uint16_t	__status; | |
| 77 | 	__uint16_t __mxcsr_lo; | |
| 78 | 	__uint32_t	__tag; | |
| 79 | 	char		__other[16]; | |
| 80 | } fenv_t; | |
| 81 | #else /* __amd64__ */ | |
| 82 | typedef struct { | |
| 83 | 	struct { | |
| 84 | 		__uint32_t	__control; | |
| 85 | 		__uint32_t	__status; | |
| 86 | 		__uint32_t	__tag; | |
| 87 | 		char		__other[16]; | |
| 88 | 	} __x87; | |
| 89 | 	__uint32_t		__mxcsr; | |
| 90 | } fenv_t; | |
| 91 | #endif /* __i386__ */ | |
| 92 | ||
| 93 | 93 | __BEGIN_DECLS |
| 94 | 94 | |
| 95 | 95 | /* Default floating-point environment */ |
| 96 | 96 | extern const fenv_t	__fe_dfl_env; |
| 97 | 97 | #define	FE_DFL_ENV	(&__fe_dfl_env) |
| 98 | 98 | |
| 99 | /* We need to be able to map status flag positions to mask flag positions */ | |
| 100 | #define	_ENABLE_MASK	((FE_DIVBYZERO | FE_INEXACT | FE_INVALID | \ | |
| 101 | 			 FE_OVERFLOW | FE_UNDERFLOW) >> _FPUSW_SHIFT) | |
| 102 | ||
| 103 | #ifndef _SOFT_FLOAT | |
| 104 | #ifdef __SPE__ | |
| 105 | #define	__mffs(__env) \ | |
| 106 | 	__asm __volatile("mfspr %0, 512" : "=r" ((__env)->__bits.__reg)) | |
| 107 | #define	__mtfsf(__env) \ | |
| 108 | 	__asm __volatile("mtspr 512,%0;isync" :: "r" ((__env).__bits.__reg)) | |
| 109 | #else | |
| 110 | #define	__mffs(__env) \ | |
| 111 | 	__asm __volatile("mffs %0" : "=f" ((__env)->__d)) | |
| 112 | #define	__mtfsf(__env) \ | |
| 113 | 	__asm __volatile("mtfsf 255,%0" :: "f" ((__env).__d)) | |
| 114 | #endif | |
| 115 | #else | |
| 116 | #define	__mffs(__env) | |
| 117 | #define	__mtfsf(__env) | |
| 118 | #endif | |
| 99 | #define	__fldenvx(__env)	__asm __volatile("fldenv %0" : : "m" (__env) \ | |
| 100 | 				: "st", "st(1)", "st(2)", "st(3)", "st(4)", \ | |
| 101 | 				"st(5)", "st(6)", "st(7)") | |
| 102 | #define	__fwait()		__asm __volatile("fwait") | |
| 119 | 103 | |
| 120 | union __fpscr { | |
| 121 | 	double __d; | |
| 122 | 	struct { | |
| 123 | #if _BYTE_ORDER == _LITTLE_ENDIAN | |
| 124 | 		fenv_t __reg; | |
| 125 | 		__uint32_t __junk; | |
| 126 | #else | |
| 127 | 		__uint32_t __junk; | |
| 128 | 		fenv_t __reg; | |
| 129 | #endif | |
| 130 | 	} __bits; | |
| 131 | }; | |
| 104 | int fegetenv(fenv_t *__envp); | |
| 105 | int feholdexcept(fenv_t *__envp); | |
| 106 | int fesetexceptflag(const fexcept_t *__flagp, int __excepts); | |
| 107 | int feraiseexcept(int __excepts); | |
| 108 | int feupdateenv(const fenv_t *__envp); | |
| 132 | 109 | |
| 133 | 110 | __fenv_static inline int |
| 134 | feclearexcept(int __excepts) | |
| 111 | fegetround(void) | |
| 135 | 112 | { |
| 136 | 	union __fpscr __r; | |
| 137 | ||
| 138 | 	if (__excepts & FE_INVALID) | |
| 139 | 		__excepts |= FE_ALL_INVALID; | |
| 140 | 	__mffs(&__r); | |
| 141 | 	__r.__bits.__reg &= ~__excepts; | |
| 142 | 	__mtfsf(__r); | |
| 143 | 	return (0); | |
| 113 | 	__uint16_t __control; | |
| 114 | ||
| 115 | 	/* | |
| 116 | 	 * We assume that the x87 and the SSE unit agree on the | |
| 117 | 	 * rounding mode. Reading the control word on the x87 turns | |
| 118 | 	 * out to be about 5 times faster than reading it on the SSE | |
| 119 | 	 * unit on an Opteron 244. | |
| 120 | 	 */ | |
| 121 | 	__fnstcw(&__control); | |
| 122 | 	return (__control & _ROUND_MASK); | |
| 144 | 123 | } |
| 145 | 124 | |
| 146 | __fenv_static inline int | |
| 147 | fegetexceptflag(fexcept_t *__flagp, int __excepts) | |
| 148 | { | |
| 149 | 	union __fpscr __r; | |
| 125 | #if __BSD_VISIBLE | |
| 150 | 126 | |
| 151 | 	__mffs(&__r); | |
| 152 | 	*__flagp = __r.__bits.__reg & __excepts; | |
| 153 | 	return (0); | |
| 154 | } | |
| 127 | int feenableexcept(int __mask); | |
| 128 | int fedisableexcept(int __mask); | |
| 155 | 129 | |
| 156 | __fenv_static inline int | |
| 157 | fesetexceptflag(const fexcept_t *__flagp, int __excepts) | |
| 130 | /* We currently provide no external definition of fegetexcept(). */ | |
| 131 | static inline int | |
| 132 | fegetexcept(void) | |
| 158 | 133 | { |
| 159 | 	union __fpscr __r; | |
| 160 | ||
| 161 | 	if (__excepts & FE_INVALID) | |
| 162 | 		__excepts |= FE_ALL_INVALID; | |
| 163 | 	__mffs(&__r); | |
| 164 | 	__r.__bits.__reg &= ~__excepts; | |
| 165 | 	__r.__bits.__reg |= *__flagp & __excepts; | |
| 166 | 	__mtfsf(__r); | |
| 167 | 	return (0); | |
| 134 | 	__uint16_t __control; | |
| 135 | ||
| 136 | 	/* | |
| 137 | 	 * We assume that the masks for the x87 and the SSE unit are | |
| 138 | 	 * the same. | |
| 139 | 	 */ | |
| 140 | 	__fnstcw(&__control); | |
| 141 | 	return (~__control & FE_ALL_EXCEPT); | |
| 168 | 142 | } |
| 169 | 143 | |
| 170 | #ifdef __SPE__ | |
| 171 | extern int	feraiseexcept(int __excepts); | |
| 144 | #endif /* __BSD_VISIBLE */ | |
| 145 | ||
| 146 | #ifdef __i386__ | |
| 147 | ||
| 148 | /* After testing for SSE support once, we cache the result in __has_sse. */ | |
| 149 | enum __sse_support { __SSE_YES, __SSE_NO, __SSE_UNK }; | |
| 150 | extern enum __sse_support __has_sse; | |
| 151 | int __test_sse(void); | |
| 152 | #ifdef __SSE__ | |
| 153 | #define	__HAS_SSE()	1 | |
| 172 | 154 | #else |
| 155 | #define	__HAS_SSE()	(__has_sse == __SSE_YES ||			\ | |
| 156 | 			 (__has_sse == __SSE_UNK && __test_sse())) | |
| 157 | #endif | |
| 158 | ||
| 159 | #define	__get_mxcsr(env)	(((env).__mxcsr_hi << 16) |	\ | |
| 160 | 				 ((env).__mxcsr_lo)) | |
| 161 | #define	__set_mxcsr(env, x)	do {				\ | |
| 162 | 	(env).__mxcsr_hi = (__uint32_t)(x) >> 16;		\ | |
| 163 | 	(env).__mxcsr_lo = (__uint16_t)(x);			\ | |
| 164 | } while (0) | |
| 165 | ||
| 173 | 166 | __fenv_static inline int |
| 174 | feraiseexcept(int __excepts) | |
| 167 | feclearexcept(int __excepts) | |
| 175 | 168 | { |
| 176 | 	union __fpscr __r; | |
| 177 | ||
| 178 | 	if (__excepts & FE_INVALID) | |
| 179 | 		__excepts |= FE_VXSOFT; | |
| 180 | 	__mffs(&__r); | |
| 181 | 	__r.__bits.__reg |= __excepts; | |
| 182 | 	__mtfsf(__r); | |
| 169 | 	fenv_t __env; | |
| 170 | 	__uint32_t __mxcsr; | |
| 171 | ||
| 172 | 	if (__excepts == FE_ALL_EXCEPT) { | |
| 173 | 		__fnclex(); | |
| 174 | 	} else { | |
| 175 | 		__fnstenv(&__env); | |
| 176 | 		__env.__status &= ~__excepts; | |
| 177 | 		__fldenv(&__env); | |
| 178 | 	} | |
| 179 | 	if (__HAS_SSE()) { | |
| 180 | 		__stmxcsr(&__mxcsr); | |
| 181 | 		__mxcsr &= ~__excepts; | |
| 182 | 		__ldmxcsr(&__mxcsr); | |
| 183 | 	} | |
| 183 | 184 | 	return (0); |
| 184 | 185 | } |
| 185 | #endif | |
| 186 | 186 | |
| 187 | 187 | __fenv_static inline int |
| 188 | fetestexcept(int __excepts) | |
| 188 | fegetexceptflag(fexcept_t *__flagp, int __excepts) | |
| 189 | 189 | { |
| 190 | 	union __fpscr __r; | |
| 191 | ||
| 192 | 	__mffs(&__r); | |
| 193 | 	return (__r.__bits.__reg & __excepts); | |
| 190 | 	__uint32_t __mxcsr; | |
| 191 | 	__uint16_t __status; | |
| 192 | ||
| 193 | 	__fnstsw(&__status); | |
| 194 | 	if (__HAS_SSE()) | |
| 195 | 		__stmxcsr(&__mxcsr); | |
| 196 | 	else | |
| 197 | 		__mxcsr = 0; | |
| 198 | 	*__flagp = (__mxcsr | __status) & __excepts; | |
| 199 | 	return (0); | |
| 194 | 200 | } |
| 195 | 201 | |
| 196 | 202 | __fenv_static inline int |
| 197 | fegetround(void) | |
| 203 | fetestexcept(int __excepts) | |
| 198 | 204 | { |
| 199 | 	union __fpscr __r; | |
| 200 | ||
| 201 | 	__mffs(&__r); | |
| 202 | 	return (__r.__bits.__reg & _ROUND_MASK); | |
| 205 | 	__uint32_t __mxcsr; | |
| 206 | 	__uint16_t __status; | |
| 207 | ||
| 208 | 	__fnstsw(&__status); | |
| 209 | 	if (__HAS_SSE()) | |
| 210 | 		__stmxcsr(&__mxcsr); | |
| 211 | 	else | |
| 212 | 		__mxcsr = 0; | |
| 213 | 	return ((__status | __mxcsr) & __excepts); | |
| 203 | 214 | } |
| 204 | 215 | |
| 205 | 216 | __fenv_static inline int |
| 206 | 217 | fesetround(int __round) |
| 207 | 218 | { |
| 208 | 	union __fpscr __r; | |
| 219 | 	__uint32_t __mxcsr; | |
| 220 | 	__uint16_t __control; | |
| 209 | 221 | |
| 210 | 222 | 	if (__round & ~_ROUND_MASK) |
| 211 | 223 | 		return (-1); |
| 212 | 	__mffs(&__r); | |
| 213 | 	__r.__bits.__reg &= ~_ROUND_MASK; | |
| 214 | 	__r.__bits.__reg |= __round; | |
| 215 | 	__mtfsf(__r); | |
| 216 | 	return (0); | |
| 217 | } | |
| 218 | 224 | |
| 219 | __fenv_static inline int | |
| 220 | fegetenv(fenv_t *__envp) | |
| 221 | { | |
| 222 | 	union __fpscr __r; | |
| 225 | 	__fnstcw(&__control); | |
| 226 | 	__control &= ~_ROUND_MASK; | |
| 227 | 	__control |= __round; | |
| 228 | 	__fldcw(&__control); | |
| 229 | ||
| 230 | 	if (__HAS_SSE()) { | |
| 231 | 		__stmxcsr(&__mxcsr); | |
| 232 | 		__mxcsr &= ~(_ROUND_MASK << _SSE_ROUND_SHIFT); | |
| 233 | 		__mxcsr |= __round << _SSE_ROUND_SHIFT; | |
| 234 | 		__ldmxcsr(&__mxcsr); | |
| 235 | 	} | |
| 223 | 236 | |
| 224 | 	__mffs(&__r); | |
| 225 | 	*__envp = __r.__bits.__reg; | |
| 226 | 237 | 	return (0); |
| 227 | 238 | } |
| 228 | 239 | |
| 229 | 240 | __fenv_static inline int |
| 230 | feholdexcept(fenv_t *__envp) | |
| 241 | fesetenv(const fenv_t *__envp) | |
| 231 | 242 | { |
| 232 | 	union __fpscr __r; | |
| 233 | ||
| 234 | 	__mffs(&__r); | |
| 235 | 	*__envp = __r.__bits.__reg; | |
| 236 | 	__r.__bits.__reg &= ~(FE_ALL_EXCEPT | _ENABLE_MASK); | |
| 237 | 	__mtfsf(__r); | |
| 243 | 	fenv_t __env = *__envp; | |
| 244 | 	__uint32_t __mxcsr; | |
| 245 | ||
| 246 | 	__mxcsr = __get_mxcsr(__env); | |
| 247 | 	__set_mxcsr(__env, 0xffffffff); | |
| 248 | 	/* | |
| 249 | 	 * XXX Using fldenvx() instead of fldenv() tells the compiler that this | |
| 250 | 	 * instruction clobbers the i387 register stack. This happens because | |
| 251 | 	 * we restore the tag word from the saved environment. Normally, this | |
| 252 | 	 * would happen anyway and we wouldn't care, because the ABI allows | |
| 253 | 	 * function calls to clobber the i387 regs. However, fesetenv() is | |
| 254 | 	 * inlined, so we need to be more careful. | |
| 255 | 	 */ | |
| 256 | 	__fldenvx(__env); | |
| 257 | 	if (__HAS_SSE()) | |
| 258 | 		__ldmxcsr(&__mxcsr); | |
| 238 | 259 | 	return (0); |
| 239 | 260 | } |
| 240 | 261 | |
| 262 | #else /* __amd64__ */ | |
| 263 | ||
| 241 | 264 | __fenv_static inline int |
| 242 | fesetenv(const fenv_t *__envp) | |
| 265 | feclearexcept(int __excepts) | |
| 243 | 266 | { |
| 244 | 	union __fpscr __r; | |
| 245 | ||
| 246 | 	__r.__bits.__reg = *__envp; | |
| 247 | 	__mtfsf(__r); | |
| 267 | 	fenv_t __env; | |
| 268 | ||
| 269 | 	if (__excepts == FE_ALL_EXCEPT) { | |
| 270 | 		__fnclex(); | |
| 271 | 	} else { | |
| 272 | 		__fnstenv(&__env.__x87); | |
| 273 | 		__env.__x87.__status &= ~__excepts; | |
| 274 | 		__fldenv(&__env.__x87); | |
| 275 | 	} | |
| 276 | 	__stmxcsr(&__env.__mxcsr); | |
| 277 | 	__env.__mxcsr &= ~__excepts; | |
| 278 | 	__ldmxcsr(&__env.__mxcsr); | |
| 248 | 279 | 	return (0); |
| 249 | 280 | } |
| 250 | 281 | |
| 251 | 282 | __fenv_static inline int |
| 252 | feupdateenv(const fenv_t *__envp) | |
| 283 | fegetexceptflag(fexcept_t *__flagp, int __excepts) | |
| 253 | 284 | { |
| 254 | 	union __fpscr __r; | |
| 285 | 	__uint32_t __mxcsr; | |
| 286 | 	__uint16_t __status; | |
| 255 | 287 | |
| 256 | 	__mffs(&__r); | |
| 257 | 	__r.__bits.__reg &= FE_ALL_EXCEPT; | |
| 258 | 	__r.__bits.__reg |= *__envp; | |
| 259 | 	__mtfsf(__r); | |
| 288 | 	__stmxcsr(&__mxcsr); | |
| 289 | 	__fnstsw(&__status); | |
| 290 | 	*__flagp = (__mxcsr | __status) & __excepts; | |
| 260 | 291 | 	return (0); |
| 261 | 292 | } |
| 262 | 293 | |
| 263 | #if __BSD_VISIBLE | |
| 264 | ||
| 265 | 294 | __fenv_static inline int |
| 266 | feenableexcept(int __mask) | |
| 295 | fetestexcept(int __excepts) | |
| 267 | 296 | { |
| 268 | 	union __fpscr __r; | |
| 269 | 	fenv_t __oldmask; | |
| 270 | ||
| 271 | 	__mffs(&__r); | |
| 272 | 	__oldmask = __r.__bits.__reg; | |
| 273 | 	__r.__bits.__reg |= (__mask & FE_ALL_EXCEPT) >> _FPUSW_SHIFT; | |
| 274 | 	__mtfsf(__r); | |
| 275 | 	return ((__oldmask & _ENABLE_MASK) << _FPUSW_SHIFT); | |
| 297 | 	__uint32_t __mxcsr; | |
| 298 | 	__uint16_t __status; | |
| 299 | ||
| 300 | 	__stmxcsr(&__mxcsr); | |
| 301 | 	__fnstsw(&__status); | |
| 302 | 	return ((__status | __mxcsr) & __excepts); | |
| 276 | 303 | } |
| 277 | 304 | |
| 278 | 305 | __fenv_static inline int |
| 279 | fedisableexcept(int __mask) | |
| 306 | fesetround(int __round) | |
| 280 | 307 | { |
| 281 | 	union __fpscr __r; | |
| 282 | 	fenv_t __oldmask; | |
| 283 | ||
| 284 | 	__mffs(&__r); | |
| 285 | 	__oldmask = __r.__bits.__reg; | |
| 286 | 	__r.__bits.__reg &= ~((__mask & FE_ALL_EXCEPT) >> _FPUSW_SHIFT); | |
| 287 | 	__mtfsf(__r); | |
| 288 | 	return ((__oldmask & _ENABLE_MASK) << _FPUSW_SHIFT); | |
| 308 | 	__uint32_t __mxcsr; | |
| 309 | 	__uint16_t __control; | |
| 310 | ||
| 311 | 	if (__round & ~_ROUND_MASK) | |
| 312 | 		return (-1); | |
| 313 | ||
| 314 | 	__fnstcw(&__control); | |
| 315 | 	__control &= ~_ROUND_MASK; | |
| 316 | 	__control |= __round; | |
| 317 | 	__fldcw(&__control); | |
| 318 | ||
| 319 | 	__stmxcsr(&__mxcsr); | |
| 320 | 	__mxcsr &= ~(_ROUND_MASK << _SSE_ROUND_SHIFT); | |
| 321 | 	__mxcsr |= __round << _SSE_ROUND_SHIFT; | |
| 322 | 	__ldmxcsr(&__mxcsr); | |
| 323 | ||
| 324 | 	return (0); | |
| 289 | 325 | } |
| 290 | 326 | |
| 291 | /* We currently provide no external definition of fegetexcept(). */ | |
| 292 | static inline int | |
| 293 | fegetexcept(void) | |
| 327 | __fenv_static inline int | |
| 328 | fesetenv(const fenv_t *__envp) | |
| 294 | 329 | { |
| 295 | 	union __fpscr __r; | |
| 296 | 330 | |
| 297 | 	__mffs(&__r); | |
| 298 | 	return ((__r.__bits.__reg & _ENABLE_MASK) << _FPUSW_SHIFT); | |
| 331 | 	/* | |
| 332 | 	 * XXX Using fldenvx() instead of fldenv() tells the compiler that this | |
| 333 | 	 * instruction clobbers the i387 register stack. This happens because | |
| 334 | 	 * we restore the tag word from the saved environment. Normally, this | |
| 335 | 	 * would happen anyway and we wouldn't care, because the ABI allows | |
| 336 | 	 * function calls to clobber the i387 regs. However, fesetenv() is | |
| 337 | 	 * inlined, so we need to be more careful. | |
| 338 | 	 */ | |
| 339 | 	__fldenvx(__envp->__x87); | |
| 340 | 	__ldmxcsr(&__envp->__mxcsr); | |
| 341 | 	return (0); | |
| 299 | 342 | } |
| 300 | 343 | |
| 301 | #endif /* __BSD_VISIBLE */ | |
| 344 | #endif /* __i386__ */ | |
| 302 | 345 | |
| 303 | 346 | __END_DECLS |
| 304 | 347 |
lib/libc/include/generic-freebsd/float.h+2-97| ... | ... | @@ -1,100 +1,5 @@ |
| 1 | 1 | /*- |
| 2 | * SPDX-License-Identifier: BSD-3-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 1989 Regents of the University of California. | |
| 5 | * All rights reserved. | |
| 6 | * | |
| 7 | * Redistribution and use in source and binary forms, with or without | |
| 8 | * modification, are permitted provided that the following conditions | |
| 9 | * are met: | |
| 10 | * 1. Redistributions of source code must retain the above copyright | |
| 11 | * notice, this list of conditions and the following disclaimer. | |
| 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 13 | * notice, this list of conditions and the following disclaimer in the | |
| 14 | * documentation and/or other materials provided with the distribution. | |
| 15 | * 3. Neither the name of the University nor the names of its contributors | |
| 16 | * may be used to endorse or promote products derived from this software | |
| 17 | * without specific prior written permission. | |
| 18 | * | |
| 19 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | |
| 20 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 21 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
| 22 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
| 23 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
| 24 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
| 25 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
| 26 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
| 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
| 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
| 29 | * SUCH DAMAGE. | |
| 30 | * | |
| 31 | *	from: @(#)float.h	7.1 (Berkeley) 5/8/90 | |
| 32 | *	from: FreeBSD: src/sys/i386/include/float.h,v 1.8 1999/08/28 00:44:11 | |
| 2 | * This file is in the public domain. | |
| 33 | 3 | */ |
| 34 | 4 | |
| 35 | #ifndef _MACHINE_FLOAT_H_ | |
| 36 | #define _MACHINE_FLOAT_H_ 1 | |
| 37 | ||
| 38 | #include <sys/cdefs.h> | |
| 39 | ||
| 40 | #ifndef _SOFT_FLOAT | |
| 41 | __BEGIN_DECLS | |
| 42 | extern int __flt_rounds(void); | |
| 43 | __END_DECLS | |
| 44 | #define FLT_ROUNDS	__flt_rounds() | |
| 45 | #else | |
| 46 | #define FLT_ROUNDS	(-1) | |
| 47 | #endif | |
| 48 | ||
| 49 | #define FLT_RADIX	2		/* b */ | |
| 50 | #if __ISO_C_VISIBLE >= 1999 | |
| 51 | #define	FLT_EVAL_METHOD	0 | |
| 52 | #define	DECIMAL_DIG	17		/* max precision in decimal digits */ | |
| 53 | #endif | |
| 54 | ||
| 55 | #define FLT_MANT_DIG	24		/* p */ | |
| 56 | #define FLT_EPSILON	1.19209290E-07F	/* b**(1-p) */ | |
| 57 | #define FLT_DIG		6		/* floor((p-1)*log10(b))+(b == 10) */ | |
| 58 | #define FLT_MIN_EXP	(-125)		/* emin */ | |
| 59 | #define FLT_MIN		1.17549435E-38F	/* b**(emin-1) */ | |
| 60 | #define FLT_MIN_10_EXP	(-37)		/* ceil(log10(b**(emin-1))) */ | |
| 61 | #define FLT_MAX_EXP	128		/* emax */ | |
| 62 | #define FLT_MAX		3.40282347E+38F	/* (1-b**(-p))*b**emax */ | |
| 63 | #define FLT_MAX_10_EXP	38		/* floor(log10((1-b**(-p))*b**emax)) */ | |
| 64 | #if __ISO_C_VISIBLE >= 2011 | |
| 65 | #define	FLT_TRUE_MIN	1.40129846E-45F	/* b**(emin-p) */ | |
| 66 | #define	FLT_DECIMAL_DIG	9		/* ceil(1+p*log10(b)) */ | |
| 67 | #define	FLT_HAS_SUBNORM	1 | |
| 68 | #endif /* __ISO_C_VISIBLE >= 2011 */ | |
| 69 | ||
| 70 | #define DBL_MANT_DIG	53 | |
| 71 | #define DBL_EPSILON	2.2204460492503131E-16 | |
| 72 | #define DBL_DIG		15 | |
| 73 | #define DBL_MIN_EXP	(-1021) | |
| 74 | #define DBL_MIN		2.2250738585072014E-308 | |
| 75 | #define DBL_MIN_10_EXP	(-307) | |
| 76 | #define DBL_MAX_EXP	1024 | |
| 77 | #define DBL_MAX		1.7976931348623157E+308 | |
| 78 | #define DBL_MAX_10_EXP	308 | |
| 79 | #if __ISO_C_VISIBLE >= 2011 | |
| 80 | #define	DBL_TRUE_MIN	4.9406564584124654E-324 | |
| 81 | #define	DBL_DECIMAL_DIG	17 | |
| 82 | #define	DBL_HAS_SUBNORM	1 | |
| 83 | #endif /* __ISO_C_VISIBLE >= 2011 */ | |
| 84 | ||
| 85 | #define LDBL_MANT_DIG	DBL_MANT_DIG | |
| 86 | #define LDBL_EPSILON	((long double)DBL_EPSILON) | |
| 87 | #define LDBL_DIG	DBL_DIG | |
| 88 | #define LDBL_MIN_EXP	DBL_MIN_EXP | |
| 89 | #define LDBL_MIN	((long double)DBL_MIN) | |
| 90 | #define LDBL_MIN_10_EXP	DBL_MIN_10_EXP | |
| 91 | #define LDBL_MAX_EXP	DBL_MAX_EXP | |
| 92 | #define LDBL_MAX	((long double)DBL_MAX) | |
| 93 | #define LDBL_MAX_10_EXP	DBL_MAX_10_EXP | |
| 94 | #if __ISO_C_VISIBLE >= 2011 | |
| 95 | #define	LDBL_TRUE_MIN	((long double)DBL_TRUE_MIN) | |
| 96 | #define	LDBL_DECIMAL_DIG DBL_DECIMAL_DIG | |
| 97 | #define	LDBL_HAS_SUBNORM DBL_HAS_SUBNORM | |
| 98 | #endif /* __ISO_C_VISIBLE >= 2011 */ | |
| 99 | ||
| 100 | #endif /* _MACHINE_FLOAT_H_ */ | |
| \ No newline at end of file | ||
| 5 | #include <x86/float.h> | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/floatingpoint.h+9-4| ... | ... | @@ -1,7 +1,7 @@ |
| 1 | 1 | /*- |
| 2 | * SPDX-License-Identifier: BSD-3-Clause | |
| 2 | * SPDX-License-Identifier: BSD-4-Clause | |
| 3 | 3 | * |
| 4 | * Copyright (c) 2004 Suleiman Souhlal <refugee@segfaulted.com> | |
| 4 | * Copyright (c) 1993 Andrew Moore, Talke Studio | |
| 5 | 5 | * All rights reserved. |
| 6 | 6 | * |
| 7 | 7 | * Redistribution and use in source and binary forms, with or without |
| ... | ... | @@ -12,11 +12,15 @@ |
| 12 | 12 | * 2. Redistributions in binary form must reproduce the above copyright |
| 13 | 13 | * notice, this list of conditions and the following disclaimer in the |
| 14 | 14 | * documentation and/or other materials provided with the distribution. |
| 15 | * 3. Neither the name of the author nor the names of any co-contributors | |
| 15 | * 3. All advertising materials mentioning features or use of this software | |
| 16 | * must display the following acknowledgement: | |
| 17 | *	This product includes software developed by the University of | |
| 18 | *	California, Berkeley and its contributors. | |
| 19 | * 4. Neither the name of the University nor the names of its contributors | |
| 16 | 20 | * may be used to endorse or promote products derived from this software |
| 17 | 21 | * without specific prior written permission. |
| 18 | 22 | * |
| 19 | * THIS SOFTWARE IS PROVIDED BY DAVID O'BRIEN AND CONTRIBUTORS ``AS IS'' AND | |
| 23 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | |
| 20 | 24 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 21 | 25 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| 22 | 26 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE |
| ... | ... | @@ -32,6 +36,7 @@ |
| 32 | 36 | #ifndef _FLOATINGPOINT_H_ |
| 33 | 37 | #define _FLOATINGPOINT_H_ |
| 34 | 38 | |
| 39 | #include <sys/cdefs.h> | |
| 35 | 40 | #include <machine/ieeefp.h> |
| 36 | 41 | |
| 37 | 42 | #endif /* !_FLOATINGPOINT_H_ */ |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/fnmatch.h-1| ... | ... | @@ -27,7 +27,6 @@ |
| 27 | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | *	@(#)fnmatch.h	8.1 (Berkeley) 6/2/93 | |
| 31 | 30 | */ |
| 32 | 31 | |
| 33 | 32 | #ifndef	_FNMATCH_H_ |
lib/libc/include/generic-freebsd/fs/devfs/devfs.h-2| ... | ... | @@ -31,8 +31,6 @@ |
| 31 | 31 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 32 | 32 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 33 | 33 | * SUCH DAMAGE. |
| 34 | * | |
| 35 | *	@(#)kernfs.h	8.6 (Berkeley) 3/29/95 | |
| 36 | 34 | * From: FreeBSD: src/sys/miscfs/kernfs/kernfs.h 1.14 |
| 37 | 35 | */ |
| 38 | 36 |
lib/libc/include/generic-freebsd/fs/fdescfs/fdesc.h-2| ... | ... | @@ -30,8 +30,6 @@ |
| 30 | 30 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 31 | 31 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 32 | 32 | * SUCH DAMAGE. |
| 33 | * | |
| 34 | *	@(#)fdesc.h	8.5 (Berkeley) 1/21/94 | |
| 35 | 33 | */ |
| 36 | 34 | |
| 37 | 35 | #ifndef _FS_FDESC_H_ |
lib/libc/include/generic-freebsd/fs/msdosfs/bootsect.h+1-1| ... | ... | @@ -20,7 +20,7 @@ |
| 20 | 20 | |
| 21 | 21 | /* |
| 22 | 22 | * Format of a boot sector. This is the first sector on a DOS floppy disk |
| 23 | * or the fist sector of a partition on a hard disk. But, it is not the | |
| 23 | * or the first sector of a partition on a hard disk. But, it is not the | |
| 24 | 24 | * first sector of a partitioned hard disk. |
| 25 | 25 | */ |
| 26 | 26 | struct bootsector33 { |
lib/libc/include/generic-freebsd/fs/msdosfs/denode.h+2-2| ... | ... | @@ -212,7 +212,7 @@ struct denode { |
| 212 | 212 | 	 ((dep)->de_Attributes & ATTR_DIRECTORY) ? 0 : (dep)->de_FileSize), \ |
| 213 | 213 | 	 putushort((dp)->deHighClust, (dep)->de_StartCluster >> 16)) |
| 214 | 214 | |
| 215 | #if defined(_KERNEL) || defined(MAKEFS) | |
| 215 | #if defined(_KERNEL) || defined(_WANT_MSDOSFS_INTERNALS) | |
| 216 | 216 | |
| 217 | 217 | #define	VTODE(vp)	((struct denode *)(vp)->v_data) |
| 218 | 218 | #define	DETOV(de)	((de)->de_vnode) |
| ... | ... | @@ -294,5 +294,5 @@ int removede(struct denode *pdep, struct denode *dep); |
| 294 | 294 | int detrunc(struct denode *dep, u_long length, int flags, struct ucred *cred); |
| 295 | 295 | int doscheckpath( struct denode *source, struct denode *target, |
| 296 | 296 | daddr_t *wait_scn); |
| 297 | #endif	/* _KERNEL || MAKEFS */ | |
| 297 | #endif	/* _KERNEL || _WANT_MSDOSFS_INTERNALS */ | |
| 298 | 298 | #endif	/* !_FS_MSDOSFS_DENODE_H_ */ |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/fs/msdosfs/fat.h+2-2| ... | ... | @@ -81,7 +81,7 @@ |
| 81 | 81 | |
| 82 | 82 | #define	MSDOSFSEOF(pmp, cn)	((((cn) | ~(pmp)->pm_fatmask) & CLUST_EOFS) == CLUST_EOFS) |
| 83 | 83 | |
| 84 | #if defined (_KERNEL) || defined(MAKEFS) | |
| 84 | #if defined (_KERNEL) || defined(_WANT_MSDOSFS_INTERNALS) | |
| 85 | 85 | /* |
| 86 | 86 | * These are the values for the function argument to the function |
| 87 | 87 | * fatentry(). |
| ... | ... | @@ -110,5 +110,5 @@ markvoldirty(struct msdosfsmount *pmp, bool dirty) |
| 110 | 110 | 	return (markvoldirty_upgrade(pmp, dirty, false)); |
| 111 | 111 | } |
| 112 | 112 | |
| 113 | #endif	/* _KERNEL || MAKEFS */ | |
| 113 | #endif	/* _KERNEL || _WANT_MSDOSFS_INTERNALS */ | |
| 114 | 114 | #endif	/* !_FS_MSDOSFS_FAT_H_ */ |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/fs/msdosfs/msdosfsmount.h+9-9| ... | ... | @@ -52,14 +52,17 @@ |
| 52 | 52 | #ifndef _MSDOSFS_MSDOSFSMOUNT_H_ |
| 53 | 53 | #define	_MSDOSFS_MSDOSFSMOUNT_H_ |
| 54 | 54 | |
| 55 | #if defined (_KERNEL) || defined(MAKEFS) | |
| 55 | #if defined(_KERNEL) || defined(_WANT_MSDOSFS_INTERNALS) | |
| 56 | 56 | |
| 57 | 57 | #include <sys/types.h> |
| 58 | #ifndef MAKEFS | |
| 58 | #ifdef _KERNEL | |
| 59 | 59 | #include <sys/lock.h> |
| 60 | 60 | #include <sys/lockmgr.h> |
| 61 | #include <sys/_task.h> | |
| 61 | #else | |
| 62 | #include <sys/_lock.h> | |
| 63 | #include <sys/_lockmgr.h> | |
| 62 | 64 | #endif |
| 65 | #include <sys/_task.h> | |
| 63 | 66 | #include <sys/tree.h> |
| 64 | 67 | |
| 65 | 68 | #ifdef MALLOC_DECLARE |
| ... | ... | @@ -114,11 +117,8 @@ struct msdosfsmount { |
| 114 | 117 | 	void *pm_w2u;	/* Unicode->Local iconv handle */ |
| 115 | 118 | 	void *pm_u2d;	/* Unicode->DOS iconv handle */ |
| 116 | 119 | 	void *pm_d2u;	/* DOS->Local iconv handle */ |
| 117 | #ifndef MAKEFS | |
| 118 | 120 | 	struct lock pm_fatlock;	/* lockmgr protecting allocations */ |
| 119 | 	struct lock pm_checkpath_lock; /* protects doscheckpath result */ | |
| 120 | 121 | 	struct task pm_rw2ro_task; /* context for emergency remount ro */ |
| 121 | #endif | |
| 122 | 122 | }; |
| 123 | 123 | |
| 124 | 124 | /* |
| ... | ... | @@ -245,9 +245,9 @@ struct msdosfs_fileno { |
| 245 | 245 | #define	MSDOSFS_ASSERT_MP_LOCKED(pmp) \ |
| 246 | 246 | 	lockmgr_assert(&(pmp)->pm_fatlock, KA_XLOCKED) |
| 247 | 247 | |
| 248 | #endif /* _KERNEL || MAKEFS */ | |
| 248 | #endif /* _KERNEL || _WANT_MSDOSFS_INTERNALS */ | |
| 249 | 249 | |
| 250 | #ifndef MAKEFS | |
| 250 | #ifdef _KERNEL | |
| 251 | 251 | /* |
| 252 | 252 | * Arguments to mount MSDOS filesystems. |
| 253 | 253 | */ |
| ... | ... | @@ -265,7 +265,7 @@ struct msdosfs_args { |
| 265 | 265 | 	char	*cs_local;	/* Local Charset */ |
| 266 | 266 | 	mode_t	dirmask;	/* dir mask to be applied for msdosfs perms */ |
| 267 | 267 | }; |
| 268 | #endif /* MAKEFS */ | |
| 268 | #endif /* _KERNEL */ | |
| 269 | 269 | |
| 270 | 270 | /* |
| 271 | 271 | * Msdosfs mount options: |
lib/libc/include/generic-freebsd/fs/nfs/nfs.h+2| ... | ... | @@ -865,6 +865,8 @@ struct nfsslot { |
| 865 | 865 | /* Enumerated type for nfsuserd state. */ |
| 866 | 866 | typedef enum { NOTRUNNING=0, STARTSTOP=1, RUNNING=2 } nfsuserd_state; |
| 867 | 867 | |
| 868 | typedef enum { UNKNOWN=0, DELETED=1, NLINK_ZERO=2, VALID=3 } nfsremove_status; | |
| 869 | ||
| 868 | 870 | #endif	/* _KERNEL */ |
| 869 | 871 | |
| 870 | 872 | #endif	/* _NFS_NFS_H */ |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/fs/nfs/nfs_var.h+36-19| ... | ... | @@ -169,6 +169,7 @@ int nfsrv_mdscopymr(char *, char *, char *, char *, int *, char *, NFSPROC_T *, |
| 169 | 169 | struct vnode **, struct vnode **, struct pnfsdsfile **, struct nfsdevice **, |
| 170 | 170 | struct nfsdevice **); |
| 171 | 171 | void nfsrv_marknospc(char *, bool); |
| 172 | void nfsrv_removedeleg(fhandle_t *, struct nfsrv_descript *, NFSPROC_T *); | |
| 172 | 173 | |
| 173 | 174 | /* nfs_nfsdserv.c */ |
| 174 | 175 | int nfsrvd_access(struct nfsrv_descript *, int, |
| ... | ... | @@ -285,6 +286,8 @@ int nfsrvd_deallocate(struct nfsrv_descript *, int, |
| 285 | 286 | vnode_t, struct nfsexstuff *); |
| 286 | 287 | int nfsrvd_copy_file_range(struct nfsrv_descript *, int, |
| 287 | 288 | vnode_t, vnode_t, struct nfsexstuff *, struct nfsexstuff *); |
| 289 | int nfsrvd_clone(struct nfsrv_descript *, int, | |
| 290 | vnode_t, vnode_t, struct nfsexstuff *, struct nfsexstuff *); | |
| 288 | 291 | int nfsrvd_seek(struct nfsrv_descript *, int, |
| 289 | 292 | vnode_t, struct nfsexstuff *); |
| 290 | 293 | int nfsrvd_getxattr(struct nfsrv_descript *, int, |
| ... | ... | @@ -340,7 +343,8 @@ int nfsv4_loadattr(struct nfsrv_descript *, vnode_t, |
| 340 | 343 | struct nfsvattr *, struct nfsfh **, fhandle_t *, int, |
| 341 | 344 | struct nfsv3_pathconf *, struct statfs *, struct nfsstatfs *, |
| 342 | 345 | struct nfsfsinfo *, NFSACL_T *, |
| 343 | int, int *, u_int32_t *, u_int32_t *, NFSPROC_T *, struct ucred *); | |
| 346 | int, int *, u_int32_t *, u_int32_t *, bool *, uint32_t *, NFSPROC_T *, | |
| 347 | struct ucred *); | |
| 344 | 348 | int nfsv4_lock(struct nfsv4lock *, int, int *, struct mtx *, struct mount *); |
| 345 | 349 | void nfsv4_unlock(struct nfsv4lock *, int); |
| 346 | 350 | void nfsv4_relref(struct nfsv4lock *); |
| ... | ... | @@ -394,8 +398,9 @@ int nfsrv_putopbit(struct nfsrv_descript *, nfsopbit_t *); |
| 394 | 398 | void nfsrv_wcc(struct nfsrv_descript *, int, struct nfsvattr *, int, |
| 395 | 399 | struct nfsvattr *); |
| 396 | 400 | int nfsv4_fillattr(struct nfsrv_descript *, struct mount *, vnode_t, NFSACL_T *, |
| 397 | struct vattr *, fhandle_t *, int, nfsattrbit_t *, | |
| 398 | struct ucred *, NFSPROC_T *, int, int, int, int, uint64_t, struct statfs *); | |
| 401 | struct vattr *, fhandle_t *, int, nfsattrbit_t *, struct ucred *, | |
| 402 | NFSPROC_T *, int, int, int, int, uint64_t, struct statfs *, bool, bool, | |
| 403 | bool, uint32_t); | |
| 399 | 404 | void nfsrv_fillattr(struct nfsrv_descript *, struct nfsvattr *); |
| 400 | 405 | struct mbuf *nfsrv_adj(struct mbuf *, int, int); |
| 401 | 406 | void nfsrv_postopattr(struct nfsrv_descript *, int, struct nfsvattr *); |
| ... | ... | @@ -438,6 +443,7 @@ int nfs_supportsnfsv4acls(vnode_t); |
| 438 | 443 | /* nfs_commonacl.c */ |
| 439 | 444 | int nfsrv_dissectace(struct nfsrv_descript *, struct acl_entry *, |
| 440 | 445 | bool, int *, int *, NFSPROC_T *); |
| 446 | uint32_t nfs_aceperm(acl_perm_t); | |
| 441 | 447 | int nfsrv_buildacl(struct nfsrv_descript *, NFSACL_T *, __enum_uint8(vtype), |
| 442 | 448 | NFSPROC_T *); |
| 443 | 449 | int nfsrv_compareacl(NFSACL_T *, NFSACL_T *); |
| ... | ... | @@ -481,11 +487,13 @@ int nfsrpc_mknod(vnode_t, char *, int, struct vattr *, u_int32_t, |
| 481 | 487 | int nfsrpc_create(vnode_t, char *, int, struct vattr *, nfsquad_t, |
| 482 | 488 | int, struct ucred *, NFSPROC_T *, struct nfsvattr *, struct nfsvattr *, |
| 483 | 489 | struct nfsfh **, int *, int *); |
| 484 | int nfsrpc_remove(vnode_t, char *, int, vnode_t, struct ucred *, NFSPROC_T *, | |
| 485 | struct nfsvattr *, int *); | |
| 486 | int nfsrpc_rename(vnode_t, vnode_t, char *, int, vnode_t, vnode_t, char *, int, | |
| 487 | struct ucred *, NFSPROC_T *, struct nfsvattr *, struct nfsvattr *, | |
| 488 | int *, int *); | |
| 490 | int nfsrpc_remove(struct vnode *, char *, int, struct vnode *, | |
| 491 | struct nfsvattr *, int *, nfsremove_status *, struct nfsvattr *, int *, | |
| 492 | struct ucred *, NFSPROC_T *); | |
| 493 | int nfsrpc_rename(struct vnode *, struct vnode *, char *, int, struct vnode *, | |
| 494 | struct vnode *, char *, int, nfsremove_status *, struct nfsvattr *, | |
| 495 | struct nfsvattr *, int *, int *, struct nfsvattr *, int *, struct ucred *, | |
| 496 | NFSPROC_T *); | |
| 489 | 497 | int nfsrpc_link(vnode_t, vnode_t, char *, int, |
| 490 | 498 | struct ucred *, NFSPROC_T *, struct nfsvattr *, struct nfsvattr *, |
| 491 | 499 | int *, int *); |
| ... | ... | @@ -512,10 +520,10 @@ int nfsrpc_lock(struct nfsrv_descript *, struct nfsmount *, vnode_t, |
| 512 | 520 | u_int8_t *, int, struct nfscllockowner *, int, int, u_int64_t, |
| 513 | 521 | u_int64_t, short, struct ucred *, NFSPROC_T *, int); |
| 514 | 522 | int nfsrpc_statfs(vnode_t, struct nfsstatfs *, struct nfsfsinfo *, uint32_t *, |
| 515 | struct ucred *, NFSPROC_T *, struct nfsvattr *, int *); | |
| 523 | uint32_t *, struct ucred *, NFSPROC_T *, struct nfsvattr *, int *); | |
| 516 | 524 | int nfsrpc_fsinfo(vnode_t, struct nfsfsinfo *, struct ucred *, |
| 517 | 525 | NFSPROC_T *, struct nfsvattr *, int *); |
| 518 | int nfsrpc_pathconf(vnode_t, struct nfsv3_pathconf *, | |
| 526 | int nfsrpc_pathconf(vnode_t, struct nfsv3_pathconf *, bool *, uint32_t *, | |
| 519 | 527 | struct ucred *, NFSPROC_T *, struct nfsvattr *, int *); |
| 520 | 528 | int nfsrpc_renew(struct nfsclclient *, struct nfsclds *, struct ucred *, |
| 521 | 529 | NFSPROC_T *); |
| ... | ... | @@ -557,6 +565,8 @@ int nfsrpc_deallocate(vnode_t, off_t, off_t, struct nfsvattr *, int *, |
| 557 | 565 | int nfsrpc_copy_file_range(vnode_t, off_t *, vnode_t, off_t *, size_t *, |
| 558 | 566 | unsigned int, int *, struct nfsvattr *, int *, struct nfsvattr *, |
| 559 | 567 | struct ucred *, bool, bool *); |
| 568 | int nfsrpc_clone(vnode_t, off_t *, vnode_t, off_t *, size_t *, bool, | |
| 569 | int *, struct nfsvattr *, int *, struct nfsvattr *, struct ucred *); | |
| 560 | 570 | int nfsrpc_seek(vnode_t, off_t *, bool *, int, struct ucred *, |
| 561 | 571 | struct nfsvattr *, int *); |
| 562 | 572 | int nfsrpc_getextattr(vnode_t, const char *, struct uio *, ssize_t *, |
| ... | ... | @@ -568,6 +578,9 @@ int nfsrpc_listextattr(vnode_t, uint64_t *, struct uio *, size_t *, bool *, |
| 568 | 578 | int nfsrpc_rmextattr(vnode_t, const char *, struct nfsvattr *, int *, |
| 569 | 579 | struct ucred *, NFSPROC_T *); |
| 570 | 580 | void nfsrpc_bindconnsess(CLIENT *, void *, struct ucred *); |
| 581 | int nfsrpc_openattr(struct nfsmount *, struct vnode *, uint8_t *, int, | |
| 582 | bool, struct ucred *, NFSPROC_T *, struct nfsvattr *, struct nfsfh **, | |
| 583 | int *); | |
| 571 | 584 | |
| 572 | 585 | /* nfs_clstate.c */ |
| 573 | 586 | int nfscl_open(vnode_t, u_int8_t *, int, u_int32_t, int, |
| ... | ... | @@ -606,12 +619,12 @@ int nfscl_doclose(vnode_t, struct nfsclclient **, NFSPROC_T *); |
| 606 | 619 | int nfsrpc_doclose(struct nfsmount *, struct nfsclopen *, NFSPROC_T *, bool, |
| 607 | 620 | bool); |
| 608 | 621 | int nfscl_deleg(mount_t, struct nfsclclient *, u_int8_t *, int, |
| 609 | struct ucred *, NFSPROC_T *, struct nfscldeleg **); | |
| 622 | struct ucred *, NFSPROC_T *, struct nfscldeleg *); | |
| 610 | 623 | void nfscl_lockinit(struct nfsv4lock *); |
| 611 | 624 | void nfscl_lockexcl(struct nfsv4lock *, void *); |
| 612 | 625 | void nfscl_lockunlock(struct nfsv4lock *); |
| 613 | 626 | void nfscl_lockderef(struct nfsv4lock *); |
| 614 | void nfscl_delegreturnvp(vnode_t, NFSPROC_T *); | |
| 627 | void nfscl_delegreturnvp(struct vnode *, bool, NFSPROC_T *); | |
| 615 | 628 | void nfscl_docb(struct nfsrv_descript *, NFSPROC_T *); |
| 616 | 629 | void nfscl_releasealllocks(struct nfsclclient *, vnode_t, NFSPROC_T *, void *, |
| 617 | 630 | int); |
| ... | ... | @@ -626,7 +639,7 @@ int nfscl_renamedeleg(vnode_t, nfsv4stateid_t *, int *, vnode_t, |
| 626 | 639 | nfsv4stateid_t *, int *, NFSPROC_T *); |
| 627 | 640 | void nfscl_reclaimnode(vnode_t); |
| 628 | 641 | void nfscl_newnode(vnode_t); |
| 629 | void nfscl_delegmodtime(vnode_t); | |
| 642 | void nfscl_delegmodtime(struct vnode *, struct timespec *); | |
| 630 | 643 | void nfscl_deleggetmodtime(vnode_t, struct timespec *); |
| 631 | 644 | int nfscl_trydelegreturn(struct nfscldeleg *, struct ucred *, |
| 632 | 645 | struct nfsmount *, NFSPROC_T *); |
| ... | ... | @@ -651,6 +664,8 @@ void nfscl_freelayout(struct nfscllayout *); |
| 651 | 664 | void nfscl_freeflayout(struct nfsclflayout *); |
| 652 | 665 | void nfscl_freedevinfo(struct nfscldevinfo *); |
| 653 | 666 | int nfscl_layoutcommit(vnode_t, NFSPROC_T *); |
| 667 | int nfscl_delegacecheck(struct vnode *, accmode_t, struct ucred *); | |
| 668 | void nfscl_startdelegrecall(struct nfsclclient *, struct nfsfh *); | |
| 654 | 669 | |
| 655 | 670 | /* nfs_clport.c */ |
| 656 | 671 | int nfscl_nget(mount_t, vnode_t, struct nfsfh *, |
| ... | ... | @@ -658,7 +673,7 @@ int nfscl_nget(mount_t, vnode_t, struct nfsfh *, |
| 658 | 673 | NFSPROC_T *nfscl_getparent(NFSPROC_T *); |
| 659 | 674 | void nfscl_start_renewthread(struct nfsclclient *); |
| 660 | 675 | void nfscl_loadsbinfo(struct nfsmount *, struct nfsstatfs *, void *); |
| 661 | void nfscl_loadfsinfo (struct nfsmount *, struct nfsfsinfo *); | |
| 676 | void nfscl_loadfsinfo(struct nfsmount *, struct nfsfsinfo *, uint32_t); | |
| 662 | 677 | void nfscl_delegreturn(struct nfscldeleg *, int, struct nfsmount *, |
| 663 | 678 | struct ucred *, NFSPROC_T *); |
| 664 | 679 | void nfsrvd_cbinit(int); |
| ... | ... | @@ -707,12 +722,12 @@ int nfsvno_symlink(struct nameidata *, struct nfsvattr *, char *, int, int, |
| 707 | 722 | uid_t, struct ucred *, NFSPROC_T *, struct nfsexstuff *); |
| 708 | 723 | int nfsvno_getsymlink(struct nfsrv_descript *, struct nfsvattr *, |
| 709 | 724 | NFSPROC_T *, char **, int *); |
| 710 | int nfsvno_removesub(struct nameidata *, int, struct ucred *, NFSPROC_T *, | |
| 711 | struct nfsexstuff *); | |
| 725 | int nfsvno_removesub(struct nameidata *, bool, struct nfsrv_descript *, | |
| 726 | NFSPROC_T *, struct nfsexstuff *); | |
| 712 | 727 | int nfsvno_rmdirsub(struct nameidata *, int, struct ucred *, NFSPROC_T *, |
| 713 | 728 | struct nfsexstuff *); |
| 714 | int nfsvno_rename(struct nameidata *, struct nameidata *, u_int32_t, | |
| 715 | u_int32_t, struct ucred *, NFSPROC_T *); | |
| 729 | int nfsvno_rename(struct nameidata *, struct nameidata *, | |
| 730 | struct nfsrv_descript *, NFSPROC_T *); | |
| 716 | 731 | int nfsvno_link(struct nameidata *, vnode_t, nfsquad_t, struct ucred *, |
| 717 | 732 | NFSPROC_T *, struct nfsexstuff *); |
| 718 | 733 | int nfsvno_fsync(vnode_t, u_int64_t, int, struct ucred *, NFSPROC_T *); |
| ... | ... | @@ -726,7 +741,8 @@ int nfsvno_updfilerev(vnode_t, struct nfsvattr *, struct nfsrv_descript *, |
| 726 | 741 | NFSPROC_T *); |
| 727 | 742 | int nfsvno_fillattr(struct nfsrv_descript *, struct mount *, vnode_t, |
| 728 | 743 | struct nfsvattr *, fhandle_t *, int, nfsattrbit_t *, |
| 729 | struct ucred *, NFSPROC_T *, int, int, int, int, uint64_t); | |
| 744 | struct ucred *, NFSPROC_T *, int, int, int, int, uint64_t, bool, bool, | |
| 745 | bool, uint32_t); | |
| 730 | 746 | int nfsrv_sattr(struct nfsrv_descript *, vnode_t, struct nfsvattr *, nfsattrbit_t *, |
| 731 | 747 | NFSACL_T *, NFSPROC_T *); |
| 732 | 748 | int nfsv4_sattr(struct nfsrv_descript *, vnode_t, struct nfsvattr *, nfsattrbit_t *, |
| ... | ... | @@ -780,6 +796,7 @@ int newnfs_request(struct nfsrv_descript *, struct nfsmount *, |
| 780 | 796 | struct nfsclient *, struct nfssockreq *, vnode_t, NFSPROC_T *, |
| 781 | 797 | struct ucred *, u_int32_t, u_int32_t, u_char *, int, u_int64_t *, |
| 782 | 798 | struct nfsclsession *); |
| 799 | void nfs_resetslots(struct nfsclsession *); | |
| 783 | 800 | int newnfs_connect(struct nfsmount *, struct nfssockreq *, |
| 784 | 801 | struct ucred *, NFSPROC_T *, int, bool, struct __rpc_client **); |
| 785 | 802 | void newnfs_disconnect(struct nfsmount *, struct nfssockreq *); |
lib/libc/include/generic-freebsd/fs/nfs/nfscl.h+5-4| ... | ... | @@ -68,10 +68,11 @@ struct nfsv4node { |
| 68 | 68 | * These flag bits are used for the argument to nfscl_fillsattr() to |
| 69 | 69 | * indicate special handling of the attributes. |
| 70 | 70 | */ |
| 71 | #define	NFSSATTR_FULL		0x1 | |
| 72 | #define	NFSSATTR_SIZE0		0x2 | |
| 73 | #define	NFSSATTR_SIZENEG1	0x4 | |
| 74 | #define	NFSSATTR_SIZERDEV	0x8 | |
| 71 | #define	NFSSATTR_FULL		0x01 | |
| 72 | #define	NFSSATTR_SIZE0		0x02 | |
| 73 | #define	NFSSATTR_SIZENEG1	0x04 | |
| 74 | #define	NFSSATTR_SIZERDEV	0x08 | |
| 75 | #define	NFSSATTR_NEWFILE	0x10 | |
| 75 | 76 | |
| 76 | 77 | /* Use this macro for debug printfs. */ |
| 77 | 78 | #define	NFSCL_DEBUG(level, ...)	do {					\ |
lib/libc/include/generic-freebsd/fs/nfs/nfsclstate.h+4| ... | ... | @@ -116,6 +116,10 @@ struct nfsclclient { |
| 116 | 116 | 	struct proc		*nfsc_renewthread; |
| 117 | 117 | 	struct nfsmount		*nfsc_nmp; |
| 118 | 118 | 	time_t			nfsc_expire; |
| 119 | 	int			nfsc_delegcnt; | |
| 120 | 	int			nfsc_deleghighwater; | |
| 121 | 	int			nfsc_layoutcnt; | |
| 122 | 	int			nfsc_layouthighwater; | |
| 119 | 123 | 	u_int32_t		nfsc_clientidrev; |
| 120 | 124 | 	u_int32_t		nfsc_rev; |
| 121 | 125 | 	u_int32_t		nfsc_renew; |
lib/libc/include/generic-freebsd/fs/nfs/nfsport.h+14-17| ... | ... | @@ -439,10 +439,16 @@ |
| 439 | 439 | /* Do an NFSv4 Verify+Write. */ |
| 440 | 440 | #define	NFSPROC_APPENDWRITE	69 |
| 441 | 441 | |
| 442 | /* Do a NFSv4 Openattr. */ | |
| 443 | #define	NFSPROC_OPENATTR	70 | |
| 444 | ||
| 445 | /* Do a NFSv4.2 Clone. */ | |
| 446 | #define	NFSPROC_CLONE		71 | |
| 447 | ||
| 442 | 448 | /* |
| 443 | 449 | * Must be defined as one higher than the last NFSv4.2 Proc# above. |
| 444 | 450 | */ |
| 445 | #define	NFSV42_NPROCS		70 | |
| 451 | #define	NFSV42_NPROCS		72 | |
| 446 | 452 | |
| 447 | 453 | /* Value of NFSV42_NPROCS for old nfsstats structure. (Always 69) */ |
| 448 | 454 | #define	NFSV42_OLDNPROCS	69 |
| ... | ... | @@ -474,7 +480,7 @@ struct nfsstatsv1 { |
| 474 | 480 | 	uint64_t	readlink_bios; |
| 475 | 481 | 	uint64_t	biocache_readdirs; |
| 476 | 482 | 	uint64_t	readdir_bios; |
| 477 | 	uint64_t	rpccnt[NFSV42_NPROCS + 10]; | |
| 483 | 	uint64_t	rpccnt[NFSV42_NPROCS + 8]; | |
| 478 | 484 | 	uint64_t	rpcretries; |
| 479 | 485 | 	uint64_t	srvrpccnt[NFSV42_NOPS + NFSV4OP_FAKENOPS + 15]; |
| 480 | 486 | 	uint64_t	srvlayouts; |
| ... | ... | @@ -690,6 +696,7 @@ struct nfsvattr { |
| 690 | 696 | #define	na_bytes	na_vattr.va_bytes |
| 691 | 697 | #define	na_filerev	na_vattr.va_filerev |
| 692 | 698 | #define	na_vaflags	na_vattr.va_vaflags |
| 699 | #define	na_bsdflags	na_vattr.va_bsdflags | |
| 693 | 700 | |
| 694 | 701 | #include <fs/nfsclient/nfsnode.h> |
| 695 | 702 | |
| ... | ... | @@ -901,15 +908,6 @@ int nfsmsleep(void *, void *, int, const char *, struct timespec *); |
| 901 | 908 | #define	NFSBCMP(s, d, l)	bcmp((s), (d), (l)) |
| 902 | 909 | #define	NFSBZERO(s, l)		bzero((s), (l)) |
| 903 | 910 | |
| 904 | /* | |
| 905 | * Some queue.h files don't have these dfined in them. | |
| 906 | */ | |
| 907 | #ifndef LIST_END | |
| 908 | #define	LIST_END(head)		NULL | |
| 909 | #define	SLIST_END(head)		NULL | |
| 910 | #define	TAILQ_END(head)		NULL | |
| 911 | #endif | |
| 912 | ||
| 913 | 911 | /* |
| 914 | 912 | * This must be defined to be a global variable that increments once |
| 915 | 913 | * per second, but never stops or goes backwards, even when a "date" |
| ... | ... | @@ -1019,7 +1017,7 @@ MALLOC_DECLARE(M_NEWNFSDSESSION); |
| 1019 | 1017 | int nfscl_loadattrcache(struct vnode **, struct nfsvattr *, void *, int, int); |
| 1020 | 1018 | int newnfs_realign(struct mbuf **, int); |
| 1021 | 1019 | bool ncl_pager_setsize(struct vnode *vp, u_quad_t *nsizep); |
| 1022 | void ncl_copy_vattr(struct vattr *dst, struct vattr *src); | |
| 1020 | void ncl_copy_vattr(struct vnode *vp, struct vattr *dst, struct vattr *src); | |
| 1023 | 1021 | |
| 1024 | 1022 | /* |
| 1025 | 1023 | * If the port runs on an SMP box that can enforce Atomic ops with low |
| ... | ... | @@ -1030,9 +1028,6 @@ void ncl_copy_vattr(struct vattr *dst, struct vattr *src); |
| 1030 | 1028 | #define	NFSINCRGLOBAL(a)	((a)++) |
| 1031 | 1029 | #define	NFSDECRGLOBAL(a)	((a)--) |
| 1032 | 1030 | |
| 1033 | /* | |
| 1034 | * Assorted funky stuff to make things work under Darwin8. | |
| 1035 | */ | |
| 1036 | 1031 | /* |
| 1037 | 1032 | * These macros checks for a field in vattr being set. |
| 1038 | 1033 | */ |
| ... | ... | @@ -1180,9 +1175,11 @@ struct nfsreq { |
| 1180 | 1175 | */ |
| 1181 | 1176 | #ifdef VV_DISABLEDELEG |
| 1182 | 1177 | #define	NFSVNO_DELEGOK(v)						\ |
| 1183 | 	((v) == NULL || ((v)->v_vflag & VV_DISABLEDELEG) == 0) | |
| 1178 | 	((v) == NULL || ((v)->v_vflag & VV_DISABLEDELEG) == 0 ||	\ | |
| 1179 | 	 (vn_irflag_read(v) & VIRF_NAMEDATTR) == 0) | |
| 1184 | 1180 | #else |
| 1185 | #define	NFSVNO_DELEGOK(v)	(1) | |
| 1181 | #define	NFSVNO_DELEGOK(v)						\ | |
| 1182 | 	((v) == NULL || (vn_irflag_read(v) & VIRF_NAMEDATTR) == 0) | |
| 1186 | 1183 | #endif |
| 1187 | 1184 | |
| 1188 | 1185 | /* |
lib/libc/include/generic-freebsd/fs/nfs/nfsproto.h+50-7| ... | ... | @@ -275,6 +275,8 @@ |
| 275 | 275 | #define	NFSX_V4SESSIONID	16 |
| 276 | 276 | #define	NFSX_V4DEVICEID		16 |
| 277 | 277 | #define	NFSX_V4PNFSFH		(sizeof(fhandle_t) + 1) |
| 278 | #define	NFSX_V4NAMEDDIRFH	2 | |
| 279 | #define	NFSX_V4NAMEDATTRFH	3 | |
| 278 | 280 | #define	NFSX_V4FILELAYOUT	(4 * NFSX_UNSIGNED + NFSX_V4DEVICEID +	\ |
| 279 | 281 | 				 NFSX_HYPER + NFSM_RNDUP(NFSX_V4PNFSFH)) |
| 280 | 282 | #define	NFSX_V4FLEXLAYOUT(m)	(NFSX_HYPER + 3 * NFSX_UNSIGNED +		\ |
| ... | ... | @@ -406,10 +408,16 @@ |
| 406 | 408 | /* Do an NFSv4 Verify+Write. */ |
| 407 | 409 | #define	NFSPROC_APPENDWRITE	69 |
| 408 | 410 | |
| 411 | /* Do a NFSv4 Openattr. */ | |
| 412 | #define	NFSPROC_OPENATTR	70 | |
| 413 | ||
| 414 | /* Do a NFSv4.2 Clone. */ | |
| 415 | #define	NFSPROC_CLONE		71 | |
| 416 | ||
| 409 | 417 | /* |
| 410 | 418 | * Must be defined as one higher than the last NFSv4.2 Proc# above. |
| 411 | 419 | */ |
| 412 | #define	NFSV42_NPROCS		70 | |
| 420 | #define	NFSV42_NPROCS		72 | |
| 413 | 421 | |
| 414 | 422 | /* Value of NFSV42_NPROCS for old nfsstats structure. (Always 69) */ |
| 415 | 423 | #define	NFSV42_OLDNPROCS	69 |
| ... | ... | @@ -744,6 +752,17 @@ |
| 744 | 752 | #define	NFSSECINFONONAME_CURFH	0 |
| 745 | 753 | #define	NFSSECINFONONAME_PARENT	1 |
| 746 | 754 | |
| 755 | /* Bits for CB_RECALL_ANY. */ | |
| 756 | #define	NFSRCA4_RDATA_DLG	0x00000001 | |
| 757 | #define	NFSRCA4_WDATA_DLG	0x00000002 | |
| 758 | #define	NFSRCA4_DIR_DLG		0x00000004 | |
| 759 | #define	NFSRCA4_FILE_LAYOUT	0x00000008 | |
| 760 | #define	NFSRCA4_BLK_LAYOUT	0x00000010 | |
| 761 | #define	NFSRCA4_OBJ_LAYOUT_MIN	0x00000100 | |
| 762 | #define	NFSRCA4_OBJ_LAYOUT_MAX	0x00000200 | |
| 763 | #define	NFSRCA4_FF_LAYOUT_READ	0x00010000 | |
| 764 | #define	NFSRCA4_FF_LAYOUT_RW	0x00020000 | |
| 765 | ||
| 747 | 766 | #if defined(_KERNEL) || defined(KERNEL) |
| 748 | 767 | /* Conversion macros */ |
| 749 | 768 | #define	vtonfsv2_mode(t,m) 						\ |
| ... | ... | @@ -1126,6 +1145,7 @@ struct nfsv3_sattr { |
| 1126 | 1145 | 	NFSATTRBM_FILESFREE |						\ |
| 1127 | 1146 | 	NFSATTRBM_FILESTOTAL |						\ |
| 1128 | 1147 | 	NFSATTRBM_FSLOCATIONS |						\ |
| 1148 | 	NFSATTRBM_HIDDEN |						\ | |
| 1129 | 1149 | 	NFSATTRBM_HOMOGENEOUS |						\ |
| 1130 | 1150 | 	NFSATTRBM_MAXFILESIZE |						\ |
| 1131 | 1151 | 	NFSATTRBM_MAXLINK |						\ |
| ... | ... | @@ -1147,6 +1167,7 @@ struct nfsv3_sattr { |
| 1147 | 1167 | 	NFSATTRBM_SPACEFREE |						\ |
| 1148 | 1168 | 	NFSATTRBM_SPACETOTAL |						\ |
| 1149 | 1169 | 	NFSATTRBM_SPACEUSED |						\ |
| 1170 | 	NFSATTRBM_SYSTEM |						\ | |
| 1150 | 1171 | 	NFSATTRBM_TIMEACCESS |						\ |
| 1151 | 1172 | 	NFSATTRBM_TIMECREATE |						\ |
| 1152 | 1173 | 	NFSATTRBM_TIMEDELTA |						\ |
| ... | ... | @@ -1176,6 +1197,8 @@ struct nfsv3_sattr { |
| 1176 | 1197 | 	NFSATTRBM_LAYOUTBLKSIZE |					\ |
| 1177 | 1198 | 	NFSATTRBM_LAYOUTALIGNMENT |					\ |
| 1178 | 1199 | 	NFSATTRBM_SUPPATTREXCLCREAT |					\ |
| 1200 | 	NFSATTRBM_CLONEBLKSIZE |					\ | |
| 1201 | 	NFSATTRBM_CHANGEATTRTYPE |					\ | |
| 1179 | 1202 | 	NFSATTRBM_XATTRSUPPORT) |
| 1180 | 1203 | |
| 1181 | 1204 | /* |
| ... | ... | @@ -1183,7 +1206,8 @@ struct nfsv3_sattr { |
| 1183 | 1206 | */ |
| 1184 | 1207 | #define	NFSATTRBIT_SUPPSETONLY1	 (NFSATTRBM_TIMEACCESSSET |		\ |
| 1185 | 1208 | 				 NFSATTRBM_TIMEMODIFYSET) |
| 1186 | #define	NFSATTRBIT_SUPPSETONLY2	(NFSATTRBM_MODESETMASKED) | |
| 1209 | #define	NFSATTRBIT_SUPPSETONLY2	(NFSATTRBM_MODESETMASKED |		\ | |
| 1210 | 				 NFSATTRBM_MODEUMASK) | |
| 1187 | 1211 | |
| 1188 | 1212 | /* |
| 1189 | 1213 | * NFSATTRBIT_SETABLE - SETABLE0 - bits 0<->31 |
| ... | ... | @@ -1192,16 +1216,19 @@ struct nfsv3_sattr { |
| 1192 | 1216 | */ |
| 1193 | 1217 | #define	NFSATTRBIT_SETABLE0						\ |
| 1194 | 1218 | 	(NFSATTRBM_SIZE |						\ |
| 1219 | 	NFSATTRBM_HIDDEN |						\ | |
| 1195 | 1220 | 	NFSATTRBM_ACL) |
| 1196 | 1221 | #define	NFSATTRBIT_SETABLE1						\ |
| 1197 | 1222 | 	(NFSATTRBM_MODE |						\ |
| 1198 | 1223 | 	NFSATTRBM_OWNER |						\ |
| 1199 | 1224 | 	NFSATTRBM_OWNERGROUP |						\ |
| 1200 | 	NFSATTRBM_TIMECREATE |					\ | |
| 1225 | 	NFSATTRBM_SYSTEM |						\ | |
| 1226 | 	NFSATTRBM_TIMECREATE |						\ | |
| 1201 | 1227 | 	NFSATTRBM_TIMEACCESSSET |					\ |
| 1202 | 1228 | 	NFSATTRBM_TIMEMODIFYSET) |
| 1203 | 1229 | #define	NFSATTRBIT_SETABLE2						\ |
| 1204 | 	(NFSATTRBM_MODESETMASKED) | |
| 1230 | 	(NFSATTRBM_MODESETMASKED |					\ | |
| 1231 | 	NFSATTRBM_MODEUMASK) | |
| 1205 | 1232 | |
| 1206 | 1233 | /* |
| 1207 | 1234 | * NFSATTRBIT_NFSV41 - Attributes only supported by NFSv4.1. |
| ... | ... | @@ -1218,7 +1245,11 @@ struct nfsv3_sattr { |
| 1218 | 1245 | /* |
| 1219 | 1246 | * NFSATTRBIT_NFSV42 - Attributes only supported by NFSv4.2. |
| 1220 | 1247 | */ |
| 1221 | #define	NFSATTRBIT_NFSV42_2	NFSATTRBM_XATTRSUPPORT | |
| 1248 | #define	NFSATTRBIT_NFSV42_2						\ | |
| 1249 | 	(NFSATTRBM_CLONEBLKSIZE |					\ | |
| 1250 | 	NFSATTRBM_CHANGEATTRTYPE |					\ | |
| 1251 | 	NFSATTRBM_XATTRSUPPORT |					\ | |
| 1252 | 	NFSATTRBM_MODEUMASK) | |
| 1222 | 1253 | |
| 1223 | 1254 | /* |
| 1224 | 1255 | * Set of attributes that the getattr vnode op needs. |
| ... | ... | @@ -1232,6 +1263,7 @@ struct nfsv3_sattr { |
| 1232 | 1263 | 	NFSATTRBM_SIZE |						\ |
| 1233 | 1264 | 	NFSATTRBM_FSID |						\ |
| 1234 | 1265 | 	NFSATTRBM_FILEID |						\ |
| 1266 | 	NFSATTRBM_HIDDEN |						\ | |
| 1235 | 1267 | 	NFSATTRBM_MAXREAD) |
| 1236 | 1268 | |
| 1237 | 1269 | /* |
| ... | ... | @@ -1244,6 +1276,7 @@ struct nfsv3_sattr { |
| 1244 | 1276 | 	NFSATTRBM_OWNERGROUP |						\ |
| 1245 | 1277 | 	NFSATTRBM_RAWDEV |						\ |
| 1246 | 1278 | 	NFSATTRBM_SPACEUSED |						\ |
| 1279 | 	NFSATTRBM_SYSTEM |						\ | |
| 1247 | 1280 | 	NFSATTRBM_TIMEACCESS |						\ |
| 1248 | 1281 | 	NFSATTRBM_TIMECREATE |						\ |
| 1249 | 1282 | 	NFSATTRBM_TIMEMETADATA |					\ |
| ... | ... | @@ -1266,6 +1299,7 @@ struct nfsv3_sattr { |
| 1266 | 1299 | 	NFSATTRBM_SIZE |						\ |
| 1267 | 1300 | 	NFSATTRBM_FSID |						\ |
| 1268 | 1301 | 	NFSATTRBM_FILEID |						\ |
| 1302 | 	NFSATTRBM_HIDDEN |						\ | |
| 1269 | 1303 | 	NFSATTRBM_MAXREAD) |
| 1270 | 1304 | |
| 1271 | 1305 | /* |
| ... | ... | @@ -1276,6 +1310,7 @@ struct nfsv3_sattr { |
| 1276 | 1310 | 	NFSATTRBM_NUMLINKS |						\ |
| 1277 | 1311 | 	NFSATTRBM_RAWDEV |						\ |
| 1278 | 1312 | 	NFSATTRBM_SPACEUSED |						\ |
| 1313 | 	NFSATTRBM_SYSTEM |						\ | |
| 1279 | 1314 | 	NFSATTRBM_TIMEACCESS |						\ |
| 1280 | 1315 | 	NFSATTRBM_TIMECREATE |						\ |
| 1281 | 1316 | 	NFSATTRBM_TIMEMETADATA |					\ |
| ... | ... | @@ -1385,13 +1420,14 @@ struct nfsv3_sattr { |
| 1385 | 1420 | /* |
| 1386 | 1421 | * NFSGETATTRBIT_STATFS2 - bits 64<->95 |
| 1387 | 1422 | */ |
| 1388 | #define	NFSGETATTRBIT_STATFS2		0 | |
| 1423 | #define	NFSGETATTRBIT_STATFS2	(NFSATTRBM_CLONEBLKSIZE) | |
| 1389 | 1424 | |
| 1390 | 1425 | /* |
| 1391 | 1426 | * Set of attributes for the equivalent of an nfsv3 pathconf rpc. |
| 1392 | 1427 | * NFSGETATTRBIT_PATHCONF0 - bits 0<->31 |
| 1393 | 1428 | */ |
| 1394 | 1429 | #define	NFSGETATTRBIT_PATHCONF0	(NFSATTRBIT_GETATTR0 |			\ |
| 1430 | 				NFSATTRBM_NAMEDATTR |			\ | |
| 1395 | 1431 | 			 	NFSATTRBM_CASEINSENSITIVE |		\ |
| 1396 | 1432 | 			 	NFSATTRBM_CASEPRESERVING |		\ |
| 1397 | 1433 | 			 	NFSATTRBM_CHOWNRESTRICTED |		\ |
| ... | ... | @@ -1407,7 +1443,7 @@ struct nfsv3_sattr { |
| 1407 | 1443 | /* |
| 1408 | 1444 | * NFSGETATTRBIT_PATHCONF2 - bits 64<->95 |
| 1409 | 1445 | */ |
| 1410 | #define	NFSGETATTRBIT_PATHCONF2		0 | |
| 1446 | #define	NFSGETATTRBIT_PATHCONF2	(NFSATTRBM_CLONEBLKSIZE) | |
| 1411 | 1447 | |
| 1412 | 1448 | /* |
| 1413 | 1449 | * Sets of attributes required by readdir and readdirplus. |
| ... | ... | @@ -1653,4 +1689,11 @@ typedef struct nfsv4stateid nfsv4stateid_t; |
| 1653 | 1689 | #define	NFSV4SXATTR_CREATE	1 |
| 1654 | 1690 | #define	NFSV4SXATTR_REPLACE	2 |
| 1655 | 1691 | |
| 1692 | /* Values for ChangeAttrType (RFC-7862). */ | |
| 1693 | #define	NFSV4CHANGETYPE_MONOTONIC_INCR		0 | |
| 1694 | #define	NFSV4CHANGETYPE_VERS_COUNTER		1 | |
| 1695 | #define	NFSV4CHANGETYPE_VERS_COUNTER_NOPNFS	2 | |
| 1696 | #define	NFSV4CHANGETYPE_TIME_METADATA		3 | |
| 1697 | #define	NFSV4CHANGETYPE_UNDEFINED		4 | |
| 1698 | ||
| 1656 | 1699 | #endif	/* _NFS_NFSPROTO_H_ */ |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/fs/nullfs/null.h-2| ... | ... | @@ -30,8 +30,6 @@ |
| 30 | 30 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 31 | 31 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 32 | 32 | * SUCH DAMAGE. |
| 33 | * | |
| 34 | *	@(#)null.h	8.3 (Berkeley) 8/20/94 | |
| 35 | 33 | */ |
| 36 | 34 | |
| 37 | 35 | #ifndef	FS_NULL_H |
lib/libc/include/generic-freebsd/fs/procfs/procfs.h-2| ... | ... | @@ -32,8 +32,6 @@ |
| 32 | 32 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 33 | 33 | * SUCH DAMAGE. |
| 34 | 34 | * |
| 35 | *	@(#)procfs.h	8.9 (Berkeley) 5/14/95 | |
| 36 | * | |
| 37 | 35 | * From: |
| 38 | 36 | */ |
| 39 | 37 |
lib/libc/include/generic-freebsd/fs/smbfs/smbfs_node.h+1-1| ... | ... | @@ -93,7 +93,7 @@ u_int32_t smbfs_hash(const u_char *name, int nmlen); |
| 93 | 93 | |
| 94 | 94 | int smbfs_getpages(struct vop_getpages_args *); |
| 95 | 95 | int smbfs_putpages(struct vop_putpages_args *); |
| 96 | int smbfs_readvnode(struct vnode *vp, struct uio *uiop, struct ucred *cred); | |
| 96 | int smbfs_readvnode(struct vnode *vp, struct uio *uiop, struct ucred *cred, int *eofp); | |
| 97 | 97 | int smbfs_writevnode(struct vnode *vp, struct uio *uiop, struct ucred *cred, int ioflag); |
| 98 | 98 | void smbfs_attr_cacheenter(struct vnode *vp, struct smbfattr *fap); |
| 99 | 99 | int smbfs_attr_cachelookup(struct vnode *vp ,struct vattr *va); |
lib/libc/include/generic-freebsd/fs/udf/ecma167-udf.h+2-2| ... | ... | @@ -243,7 +243,7 @@ struct part_map_spare { |
| 243 | 243 | 	uint8_t			n_st;	/* Number of Sparing Tables */ |
| 244 | 244 | 	uint8_t			reserved1; |
| 245 | 245 | 	uint32_t		st_size; |
| 246 | 	uint32_t		st_loc[1]; | |
| 246 | 	uint32_t		st_loc[]; | |
| 247 | 247 | } __packed; |
| 248 | 248 | |
| 249 | 249 | union udf_pmap { |
| ... | ... | @@ -266,7 +266,7 @@ struct udf_sparing_table { |
| 266 | 266 | 	uint16_t		rt_l;	/* Relocation Table len */ |
| 267 | 267 | 	uint8_t			reserved[2]; |
| 268 | 268 | 	uint32_t		seq_num; |
| 269 | 	struct spare_map_entry	entries[1]; | |
| 269 | 	struct spare_map_entry	entries[]; | |
| 270 | 270 | } __packed; |
| 271 | 271 | |
| 272 | 272 | /* Partition Descriptor [3/10.5] */ |
lib/libc/include/generic-freebsd/fs/unionfs/union.h+17-19| ... | ... | @@ -33,8 +33,6 @@ |
| 33 | 33 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 34 | 34 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 35 | 35 | * SUCH DAMAGE. |
| 36 | * | |
| 37 | *	@(#)union.h	8.9 (Berkeley) 12/10/94 | |
| 38 | 36 | */ |
| 39 | 37 | |
| 40 | 38 | #ifdef _KERNEL |
| ... | ... | @@ -99,15 +97,17 @@ struct unionfs_node { |
| 99 | 97 | |
| 100 | 98 | 	char *un_path;		/* path */ |
| 101 | 99 | 	int		un_pathlen;		/* strlen of path */ |
| 102 | 	int		un_flag;		/* unionfs node flag */ | |
| 103 | }; | |
| 104 | 100 | |
| 105 | /* | |
| 106 | * unionfs node flags | |
| 107 | * It needs the vnode with exclusive lock, when changing the un_flag variable. | |
| 108 | */ | |
| 109 | #define UNIONFS_OPENEXTL	0x01	/* openextattr (lower) */ | |
| 110 | #define UNIONFS_OPENEXTU	0x02	/* openextattr (upper) */ | |
| 101 | 	/* | |
| 102 | 	 * unionfs node flags | |
| 103 | 	 * Changing these flags requires the vnode to be locked exclusive. | |
| 104 | 	 */ | |
| 105 | 	#define UNIONFS_OPENEXTL		0x01	/* openextattr (lower) */ | |
| 106 | 	#define UNIONFS_OPENEXTU		0x02	/* openextattr (upper) */ | |
| 107 | 	#define UNIONFS_COPY_IN_PROGRESS	0x04	/* copy/dir shadow in progres */ | |
| 108 | 	#define UNIONFS_LOOKUP_IN_PROGRESS	0x08 | |
| 109 | 	unsigned int	un_flag;		/* unionfs node flag */ | |
| 110 | }; | |
| 111 | 111 | |
| 112 | 112 | extern struct vop_vector unionfs_vnodeops; |
| 113 | 113 | |
| ... | ... | @@ -133,34 +133,32 @@ int	unionfs_uninit(struct vfsconf *); |
| 133 | 133 | int	unionfs_nodeget(struct mount *, struct vnode *, struct vnode *, |
| 134 | 134 | 	 struct vnode *, struct vnode **, struct componentname *); |
| 135 | 135 | void	unionfs_noderem(struct vnode *); |
| 136 | struct unionfs_node_status *	unionfs_find_node_status(struct unionfs_node *, | |
| 137 | 	 struct thread *td); | |
| 136 | 138 | void	unionfs_get_node_status(struct unionfs_node *, struct thread *, |
| 137 | 139 | 	 struct unionfs_node_status **); |
| 138 | 140 | void	unionfs_tryrem_node_status(struct unionfs_node *, |
| 139 | 141 | 	 struct unionfs_node_status *); |
| 140 | 142 | int	unionfs_check_rmdir(struct vnode *, struct ucred *, struct thread *td); |
| 141 | int	unionfs_copyfile(struct unionfs_node *, int, struct ucred *, | |
| 143 | int	unionfs_copyfile(struct vnode *, int, struct ucred *, | |
| 142 | 144 | 	 struct thread *); |
| 143 | 145 | void	unionfs_create_uppervattr_core(struct unionfs_mount *, struct vattr *, |
| 144 | 146 | 	 struct vattr *, struct thread *); |
| 145 | 147 | int	unionfs_create_uppervattr(struct unionfs_mount *, struct vnode *, |
| 146 | 148 | 	 struct vattr *, struct ucred *, struct thread *); |
| 147 | int	unionfs_mkshadowdir(struct unionfs_mount *, struct vnode *, | |
| 148 | 	 struct unionfs_node *, struct componentname *, struct thread *); | |
| 149 | int	unionfs_mkshadowdir(struct vnode *, struct vnode *, | |
| 150 | 	 struct componentname *, struct thread *); | |
| 149 | 151 | int	unionfs_mkwhiteout(struct vnode *, struct vnode *, |
| 150 | 152 | 	 struct componentname *, struct thread *, char *, int); |
| 151 | 153 | int	unionfs_relookup(struct vnode *, struct vnode **, |
| 152 | 154 | 	 struct componentname *, struct componentname *, struct thread *, |
| 153 | 155 | 	 char *, int, u_long); |
| 154 | int	unionfs_relookup_for_create(struct vnode *, struct componentname *, | |
| 155 | 	 struct thread *); | |
| 156 | int	unionfs_relookup_for_delete(struct vnode *, struct componentname *, | |
| 157 | 	 struct thread *); | |
| 158 | int	unionfs_relookup_for_rename(struct vnode *, struct componentname *, | |
| 159 | 	 struct thread *); | |
| 160 | 156 | void	unionfs_forward_vop_start_pair(struct vnode *, int *, |
| 161 | 157 | 	 struct vnode *, int *); |
| 162 | 158 | bool	unionfs_forward_vop_finish_pair(struct vnode *, struct vnode *, int, |
| 163 | 159 | 	 struct vnode *, struct vnode *, int); |
| 160 | int	unionfs_set_in_progress_flag(struct vnode *, unsigned int); | |
| 161 | void	unionfs_clear_in_progress_flag(struct vnode *, unsigned int); | |
| 164 | 162 | |
| 165 | 163 | static inline void |
| 166 | 164 | unionfs_forward_vop_start(struct vnode *basevp, int *lkflags) |
lib/libc/include/generic-freebsd/fstab.h-2| ... | ... | @@ -27,8 +27,6 @@ |
| 27 | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | * | |
| 31 | *	@(#)fstab.h	8.1 (Berkeley) 6/2/93 | |
| 32 | 30 | */ |
| 33 | 31 | |
| 34 | 32 | #ifndef _FSTAB_H_ |
lib/libc/include/generic-freebsd/fts.h+43-22| ... | ... | @@ -27,8 +27,6 @@ |
| 27 | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | * | |
| 31 | *	@(#)fts.h	8.3 (Berkeley) 8/14/94 | |
| 32 | 30 | */ |
| 33 | 31 | |
| 34 | 32 | #ifndef	_FTS_H_ |
| ... | ... | @@ -36,35 +34,54 @@ |
| 36 | 34 | |
| 37 | 35 | #include <sys/_types.h> |
| 38 | 36 | |
| 37 | typedef struct _ftsent FTSENT; | |
| 38 | ||
| 39 | 39 | typedef struct { |
| 40 | 	struct _ftsent *fts_cur;	/* current node */ | |
| 41 | 	struct _ftsent *fts_child;	/* linked list of children */ | |
| 42 | 	struct _ftsent **fts_array;	/* sort array */ | |
| 40 | 	FTSENT *fts_cur;		/* current node */ | |
| 41 | 	FTSENT *fts_child;		/* linked list of children */ | |
| 42 | 	FTSENT **fts_array;		/* sort array */ | |
| 43 | 43 | 	__dev_t fts_dev;		/* starting device # */ |
| 44 | 44 | 	char *fts_path;			/* path for this descent */ |
| 45 | 45 | 	int fts_rfd;			/* fd for root */ |
| 46 | 46 | 	__size_t fts_pathlen;		/* sizeof(path) */ |
| 47 | 47 | 	__size_t fts_nitems;		/* elements in the sort array */ |
| 48 | 	int (*fts_compar)		/* compare function */ | |
| 49 | 	 (const struct _ftsent * const *, const struct _ftsent * const *); | |
| 50 | ||
| 51 | #define	FTS_COMFOLLOW	0x001		/* follow command line symlinks */ | |
| 52 | #define	FTS_LOGICAL	0x002		/* logical walk */ | |
| 53 | #define	FTS_NOCHDIR	0x004		/* don't change directories */ | |
| 54 | #define	FTS_NOSTAT	0x008		/* don't get stat info */ | |
| 55 | #define	FTS_PHYSICAL	0x010		/* physical walk */ | |
| 56 | #define	FTS_SEEDOT	0x020		/* return dot and dot-dot */ | |
| 57 | #define	FTS_XDEV	0x040		/* don't cross devices */ | |
| 58 | #define	FTS_WHITEOUT	0x080		/* return whiteout information */ | |
| 59 | #define	FTS_OPTIONMASK	0x0ff		/* valid user option mask */ | |
| 60 | ||
| 61 | #define	FTS_NAMEONLY	0x100		/* (private) child names only */ | |
| 62 | #define	FTS_STOP	0x200		/* (private) unrecoverable error */ | |
| 48 | 	union { | |
| 49 | 		int (*fts_compar)	/* compare function */ | |
| 50 | 		 (const FTSENT * const *, const FTSENT * const *); | |
| 51 | #ifdef __BLOCKS__ | |
| 52 | 		int (^fts_compar_b) | |
| 53 | 		 (const FTSENT * const *, const FTSENT * const *); | |
| 54 | #else | |
| 55 | 		void *fts_compar_b; | |
| 56 | #endif /* __BLOCKS__ */ | |
| 57 | 	}; | |
| 58 | ||
| 59 | /* valid for fts_open() */ | |
| 60 | #define	FTS_COMFOLLOW	0x000001	/* follow command line symlinks */ | |
| 61 | #define	FTS_LOGICAL	0x000002	/* logical walk */ | |
| 62 | #define	FTS_NOCHDIR	0x000004	/* don't change directories */ | |
| 63 | #define	FTS_NOSTAT	0x000008	/* don't get stat info */ | |
| 64 | #define	FTS_PHYSICAL	0x000010	/* physical walk */ | |
| 65 | #define	FTS_SEEDOT	0x000020	/* return dot and dot-dot */ | |
| 66 | #define	FTS_XDEV	0x000040	/* don't cross devices */ | |
| 67 | #define	FTS_WHITEOUT	0x000080	/* return whiteout information */ | |
| 68 | 					/* 0x0100 is FTS_NAMEONLY below */ | |
| 69 | 					/* 0x0200 was previously FTS_STOP */ | |
| 70 | #define FTS_COMFOLLOWDIR 0x00400	/* like COMFOLLOW but directories only */ | |
| 71 | #define FTS_NOSTAT_TYPE	0x000800	/* like NOSTAT but use d_type */ | |
| 72 | #define	FTS_OPTIONMASK	0x000cff	/* valid user option mask */ | |
| 73 | ||
| 74 | /* valid only for fts_children() */ | |
| 75 | #define	FTS_NAMEONLY	0x000100	/* child names only */ | |
| 76 | ||
| 77 | /* internal use only */ | |
| 78 | #define	FTS_STOP	0x010000	/* unrecoverable error */ | |
| 79 | #define	FTS_COMPAR_B	0x020000	/* compare function is a block */ | |
| 63 | 80 | 	int fts_options;		/* fts_open options, global flags */ |
| 64 | 81 | 	void *fts_clientptr;		/* thunk for sort function */ |
| 65 | 82 | } FTS; |
| 66 | 83 | |
| 67 | typedef struct _ftsent { | |
| 84 | struct _ftsent { | |
| 68 | 85 | 	struct _ftsent *fts_cycle;	/* cycle node */ |
| 69 | 86 | 	struct _ftsent *fts_parent;	/* parent directory */ |
| 70 | 87 | 	struct _ftsent *fts_link;	/* next file in directory */ |
| ... | ... | @@ -116,7 +133,7 @@ typedef struct _ftsent { |
| 116 | 133 | 	struct stat *fts_statp;		/* stat(2) information */ |
| 117 | 134 | 	char *fts_name;			/* file name */ |
| 118 | 135 | 	FTS *fts_fts;			/* back pointer to main FTS */ |
| 119 | } FTSENT; | |
| 136 | }; | |
| 120 | 137 | |
| 121 | 138 | #include <sys/cdefs.h> |
| 122 | 139 | |
| ... | ... | @@ -129,6 +146,10 @@ FTS	*fts_get_stream(FTSENT *); |
| 129 | 146 | #define	 fts_get_stream(ftsent)	((ftsent)->fts_fts) |
| 130 | 147 | FTS	*fts_open(char * const *, int, |
| 131 | 148 | 	 int (*)(const FTSENT * const *, const FTSENT * const *)); |
| 149 | #ifdef __BLOCKS__ | |
| 150 | FTS	*fts_open_b(char * const *, int, | |
| 151 | 	 int (^)(const FTSENT * const *, const FTSENT * const *)); | |
| 152 | #endif /* __BLOCKS__ */ | |
| 132 | 153 | FTSENT	*fts_read(FTS *); |
| 133 | 154 | int	 fts_set(FTS *, FTSENT *, int); |
| 134 | 155 | void	 fts_set_clientptr(FTS *, void *); |
lib/libc/include/generic-freebsd/geom/geom.h+2-2| ... | ... | @@ -282,7 +282,7 @@ void g_detach(struct g_consumer *cp); |
| 282 | 282 | void g_error_provider(struct g_provider *pp, int error); |
| 283 | 283 | struct g_provider *g_provider_by_name(char const *arg); |
| 284 | 284 | int g_getattr__(const char *attr, struct g_consumer *cp, void *var, int len); |
| 285 | #define g_getattr(a, c, v) g_getattr__((a), (c), (v), sizeof *(v)) | |
| 285 | #define g_getattr(a, c, v) g_getattr__((a), (c), (v), sizeof(*(v))) | |
| 286 | 286 | int g_handleattr(struct bio *bp, const char *attribute, const void *val, |
| 287 | 287 | int len); |
| 288 | 288 | int g_handleattr_int(struct bio *bp, const char *attribute, int val); |
| ... | ... | @@ -417,7 +417,7 @@ g_free(void *ptr) |
| 417 | 417 | 	static moduledata_t name##_mod = {			\ |
| 418 | 418 | 		#name, g_modevent, &class			\ |
| 419 | 419 | 	};							\ |
| 420 | 	DECLARE_MODULE(name, name##_mod, SI_SUB_DRIVERS, SI_ORDER_SECOND); | |
| 420 | 	DECLARE_MODULE(name, name##_mod, SI_SUB_DRIVERS, SI_ORDER_THIRD); | |
| 421 | 421 | |
| 422 | 422 | int g_is_geom_thread(struct thread *td); |
| 423 | 423 |
lib/libc/include/generic-freebsd/geom/label/g_label.h+1-1| ... | ... | @@ -73,12 +73,12 @@ extern struct g_label_desc g_label_ufs_volume; |
| 73 | 73 | extern struct g_label_desc g_label_iso9660; |
| 74 | 74 | extern struct g_label_desc g_label_msdosfs; |
| 75 | 75 | extern struct g_label_desc g_label_ext2fs; |
| 76 | extern struct g_label_desc g_label_reiserfs; | |
| 77 | 76 | extern struct g_label_desc g_label_ntfs; |
| 78 | 77 | extern struct g_label_desc g_label_gpt; |
| 79 | 78 | extern struct g_label_desc g_label_gpt_uuid; |
| 80 | 79 | extern struct g_label_desc g_label_disk_ident; |
| 81 | 80 | extern struct g_label_desc g_label_flashmap; |
| 81 | extern struct g_label_desc g_label_swaplinux; | |
| 82 | 82 | |
| 83 | 83 | extern void g_label_rtrim(char *label, size_t size); |
| 84 | 84 | #endif	/* _KERNEL */ |
lib/libc/include/generic-freebsd/glob.h+14-4| ... | ... | @@ -30,8 +30,6 @@ |
| 30 | 30 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 31 | 31 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 32 | 32 | * SUCH DAMAGE. |
| 33 | * | |
| 34 | *	@(#)glob.h	8.1 (Berkeley) 6/2/93 | |
| 35 | 33 | */ |
| 36 | 34 | |
| 37 | 35 | #ifndef _GLOB_H_ |
| ... | ... | @@ -52,8 +50,15 @@ typedef struct { |
| 52 | 50 | 	size_t gl_offs;		/* Reserved at beginning of gl_pathv. */ |
| 53 | 51 | 	int gl_flags;		/* Copy of flags parameter to glob. */ |
| 54 | 52 | 	char **gl_pathv;	/* List of paths matching pattern. */ |
| 55 | 				/* Copy of errfunc parameter to glob. */ | |
| 56 | 	int (*gl_errfunc)(const char *, int); | |
| 53 | 				/* Copy of error callback parameter to glob. */ | |
| 54 | 	union { | |
| 55 | 		int (*gl_errfunc)(const char *, int); | |
| 56 | #ifdef __BLOCKS__ | |
| 57 | 		int (^gl_errblk)(const char *, int); | |
| 58 | #else | |
| 59 | 		void *gl_errblk; | |
| 60 | #endif | |
| 61 | 	}; | |
| 57 | 62 | |
| 58 | 63 | 	/* |
| 59 | 64 | 	 * Alternate filesystem access methods for glob; replacement |
| ... | ... | @@ -92,6 +97,7 @@ typedef struct { |
| 92 | 97 | #define	GLOB_QUOTE	0x0400	/* Quote special chars with \. */ |
| 93 | 98 | #define	GLOB_TILDE	0x0800	/* Expand tilde names from the passwd file. */ |
| 94 | 99 | #define	GLOB_LIMIT	0x1000	/* limit number of returned paths */ |
| 100 | #define	_GLOB_ERR_BLOCK 0x08000000 /* (internal) error callback is a block */ | |
| 95 | 101 | |
| 96 | 102 | /* source compatibility, these are the old names */ |
| 97 | 103 | #define GLOB_MAXPATH	GLOB_LIMIT |
| ... | ... | @@ -101,6 +107,10 @@ typedef struct { |
| 101 | 107 | __BEGIN_DECLS |
| 102 | 108 | int	glob(const char * __restrict, int, |
| 103 | 109 | 	int (*)(const char *, int), glob_t * __restrict); |
| 110 | #if defined(__BLOCKS__) && __BSD_VISIBLE | |
| 111 | int 	glob_b(const char * __restrict, int, | |
| 112 | 	int (^)(const char *, int), glob_t * __restrict); | |
| 113 | #endif | |
| 104 | 114 | void	globfree(glob_t *); |
| 105 | 115 | __END_DECLS |
| 106 | 116 |
lib/libc/include/generic-freebsd/grp.h-2| ... | ... | @@ -32,8 +32,6 @@ |
| 32 | 32 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 33 | 33 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 34 | 34 | * SUCH DAMAGE. |
| 35 | * | |
| 36 | *	@(#)grp.h	8.2 (Berkeley) 1/21/94 | |
| 37 | 35 | */ |
| 38 | 36 | |
| 39 | 37 | #ifndef _GRP_H_ |
lib/libc/include/generic-freebsd/iconv.h-2| ... | ... | @@ -33,12 +33,10 @@ |
| 33 | 33 | #ifndef _ICONV_H_ |
| 34 | 34 | #define _ICONV_H_ |
| 35 | 35 | |
| 36 | #include <sys/cdefs.h> | |
| 37 | 36 | #include <sys/types.h> |
| 38 | 37 | |
| 39 | 38 | #include <wchar.h> |
| 40 | 39 | |
| 41 | #include <sys/cdefs.h> | |
| 42 | 40 | #include <sys/types.h> |
| 43 | 41 | |
| 44 | 42 | #ifdef __cplusplus |
lib/libc/include/generic-freebsd/isofs/cd9660/cd9660_mount.h-2| ... | ... | @@ -32,8 +32,6 @@ |
| 32 | 32 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 33 | 33 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 34 | 34 | * SUCH DAMAGE. |
| 35 | * | |
| 36 | *	@(#)cd9660_mount.h	8.1 (Berkeley) 5/24/95 | |
| 37 | 35 | */ |
| 38 | 36 | |
| 39 | 37 | /* |
lib/libc/include/generic-freebsd/isofs/cd9660/cd9660_node.h+1-3| ... | ... | @@ -32,8 +32,6 @@ |
| 32 | 32 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 33 | 33 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 34 | 34 | * SUCH DAMAGE. |
| 35 | * | |
| 36 | *	@(#)cd9660_node.h	8.6 (Berkeley) 5/14/95 | |
| 37 | 35 | */ |
| 38 | 36 | |
| 39 | 37 | /* |
| ... | ... | @@ -58,7 +56,7 @@ typedef	struct	{ |
| 58 | 56 | |
| 59 | 57 | struct iso_node { |
| 60 | 58 | 	struct	vnode *i_vnode;	/* vnode associated with this inode */ |
| 61 | 	cd_ino_t	i_number;	/* the identity of the inode */ | |
| 59 | 	ino_t	i_number;	/* the identity of the inode */ | |
| 62 | 60 | 				/* we use the actual starting block of the file */ |
| 63 | 61 | 	struct	iso_mnt *i_mnt;	/* filesystem associated with this inode */ |
| 64 | 62 | 	struct	lockf *i_lockf;	/* head of byte-level lock list */ |
lib/libc/include/generic-freebsd/isofs/cd9660/cd9660_rrip.h-2| ... | ... | @@ -32,8 +32,6 @@ |
| 32 | 32 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 33 | 33 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 34 | 34 | * SUCH DAMAGE. |
| 35 | * | |
| 36 | *	@(#)cd9660_rrip.h	8.2 (Berkeley) 12/5/94 | |
| 37 | 35 | */ |
| 38 | 36 | |
| 39 | 37 | #ifndef _ISOFS_CD9660_CD9660_RRIP_H_ |
lib/libc/include/generic-freebsd/isofs/cd9660/iso.h+9-16| ... | ... | @@ -32,8 +32,6 @@ |
| 32 | 32 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 33 | 33 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 34 | 34 | * SUCH DAMAGE. |
| 35 | * | |
| 36 | *	@(#)iso.h	8.6 (Berkeley) 5/10/95 | |
| 37 | 35 | */ |
| 38 | 36 | |
| 39 | 37 | #ifndef _ISOFS_CD9660_ISO_H_ |
| ... | ... | @@ -214,21 +212,12 @@ struct iso_extended_attributes { |
| 214 | 212 | 	u_char len_au			[ISODCL (247, 250)]; /* 723 */ |
| 215 | 213 | }; |
| 216 | 214 | |
| 217 | #ifdef _KERNEL | |
| 215 | #if defined(_KERNEL) || defined(_WANT_ISO_MNT) | |
| 218 | 216 | |
| 219 | 217 | /* CD-ROM Format type */ |
| 220 | 218 | enum ISO_FTYPE	{ ISO_FTYPE_DEFAULT, ISO_FTYPE_9660, ISO_FTYPE_RRIP, |
| 221 | 219 | 		 ISO_FTYPE_JOLIET, ISO_FTYPE_ECMA, ISO_FTYPE_HIGH_SIERRA }; |
| 222 | 220 | |
| 223 | #ifndef	ISOFSMNT_ROOT | |
| 224 | #define	ISOFSMNT_ROOT	0 | |
| 225 | #endif | |
| 226 | ||
| 227 | /* | |
| 228 | * When ino_t becomes 64-bit, we can remove this definition in favor of ino_t. | |
| 229 | */ | |
| 230 | typedef __uint64_t cd_ino_t; | |
| 231 | ||
| 232 | 221 | struct iso_mnt { |
| 233 | 222 | 	uint64_t im_flags; |
| 234 | 223 | |
| ... | ... | @@ -264,12 +253,16 @@ struct iso_mnt { |
| 264 | 253 | 	void *im_l2d; |
| 265 | 254 | }; |
| 266 | 255 | |
| 256 | #endif /* defined(_KERNEL) || defined(_WANT_ISO_MNT) */ | |
| 257 | ||
| 258 | #ifdef _KERNEL | |
| 259 | ||
| 267 | 260 | struct ifid { |
| 268 | 261 | 	u_short		ifid_len; |
| 269 | 262 | 	u_short		ifid_pad; |
| 270 | 	cd_ino_t	ifid_ino; | |
| 263 | 	ino_t		ifid_ino; | |
| 271 | 264 | 	long		ifid_start; |
| 272 | }; | |
| 265 | } __packed; | |
| 273 | 266 | |
| 274 | 267 | #define VFSTOISOFS(mp)	((struct iso_mnt *)((mp)->mnt_data)) |
| 275 | 268 | |
| ... | ... | @@ -278,7 +271,7 @@ struct ifid { |
| 278 | 271 | #define lblkno(imp, loc)	((loc) >> (imp)->im_bshift) |
| 279 | 272 | #define blksize(imp, ip, lbn)	((imp)->logical_block_size) |
| 280 | 273 | |
| 281 | int cd9660_vget_internal(struct mount *, cd_ino_t, int, struct vnode **, int, | |
| 274 | int cd9660_vget_internal(struct mount *, ino_t	, int, struct vnode **, int, | |
| 282 | 275 | 			 struct iso_directory_record *); |
| 283 | 276 | #define cd9660_sysctl ((int (*)(int *, u_int, void *, size_t *, void *, \ |
| 284 | 277 | 				size_t, struct proc *))eopnotsupp) |
| ... | ... | @@ -289,7 +282,7 @@ extern struct vop_vector cd9660_fifoops; |
| 289 | 282 | int isochar(u_char *, u_char *, int, u_short *, int *, int, void *); |
| 290 | 283 | int isofncmp(u_char *, int, u_char *, int, int, int, void *, void *); |
| 291 | 284 | void isofntrans(u_char *, int, u_char *, u_short *, int, int, int, int, void *); |
| 292 | cd_ino_t isodirino(struct iso_directory_record *, struct iso_mnt *); | |
| 285 | ino_t isodirino(struct iso_directory_record *, struct iso_mnt *); | |
| 293 | 286 | u_short sgetrune(const char *, size_t, char const **, int, void *); |
| 294 | 287 | |
| 295 | 288 | #endif /* _KERNEL */ |
lib/libc/include/generic-freebsd/isofs/cd9660/iso_rrip.h+2-4| ... | ... | @@ -32,8 +32,6 @@ |
| 32 | 32 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 33 | 33 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 34 | 34 | * SUCH DAMAGE. |
| 35 | * | |
| 36 | *	@(#)iso_rrip.h	8.2 (Berkeley) 1/23/94 | |
| 37 | 35 | */ |
| 38 | 36 | |
| 39 | 37 | #ifndef _ISOFS_CD9660_ISO_RRIP_H_ |
| ... | ... | @@ -65,7 +63,7 @@ typedef struct { |
| 65 | 63 | 	off_t		iso_ce_off;	/* offset of continuation area */ |
| 66 | 64 | 	int		iso_ce_len;	/* length of continuation area */ |
| 67 | 65 | 	struct iso_mnt	*imp;		/* mount structure */ |
| 68 | 	cd_ino_t	*inump;		/* inode number pointer */ | |
| 66 | 	ino_t		*inump;		/* inode number pointer */ | |
| 69 | 67 | 	char		*outbuf;	/* name/symbolic link output area */ |
| 70 | 68 | 	u_short		*outlen;	/* length of above */ |
| 71 | 69 | 	u_short		maxlen;		/* maximum length of above */ |
| ... | ... | @@ -78,7 +76,7 @@ int cd9660_rrip_analyze(struct iso_directory_record *isodir, |
| 78 | 76 | 			 struct iso_node *inop, struct iso_mnt *imp); |
| 79 | 77 | int cd9660_rrip_getname(struct iso_directory_record *isodir, |
| 80 | 78 | 			 char *outbuf, u_short *outlen, |
| 81 | 			 cd_ino_t *inump, struct iso_mnt *imp); | |
| 79 | 			 ino_t *inump, struct iso_mnt *imp); | |
| 82 | 80 | int cd9660_rrip_getsymname(struct iso_directory_record *isodir, |
| 83 | 81 | 			 char *outbuf, u_short *outlen, |
| 84 | 82 | 			 struct iso_mnt *imp); |
lib/libc/include/generic-freebsd/libsys.h created+25| ... | ... | @@ -0,0 +1,25 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-2-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 2024 SRI International | |
| 5 | * | |
| 6 | * This software was developed by SRI International, the University of | |
| 7 | * Cambridge Computer Laboratory (Department of Computer Science and | |
| 8 | * Technology), and Capabilities Limited under Defense Advanced Research | |
| 9 | * Projects Agency (DARPA) Contract No. FA8750-24-C-B047 ("DEC"). | |
| 10 | */ | |
| 11 | ||
| 12 | #ifndef _LIBSYS_H_ | |
| 13 | #define _LIBSYS_H_ | |
| 14 | ||
| 15 | #include <sys/types.h> | |
| 16 | ||
| 17 | #include <_libsys.h> | |
| 18 | ||
| 19 | typedef int (__sys_syscall_t)(int number, ...); | |
| 20 | typedef int (__sys___syscall_t)(int64_t number, ...); | |
| 21 | ||
| 22 | int	__sys_syscall(int number, ...); | |
| 23 | off_t	__sys___syscall(int64_t number, ...); | |
| 24 | ||
| 25 | #endif	/* _LIBSYS_H_ */ | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/libutil.h+16-3| ... | ... | @@ -86,10 +86,17 @@ struct termios; |
| 86 | 86 | struct winsize; |
| 87 | 87 | |
| 88 | 88 | __BEGIN_DECLS |
| 89 | char	*auth_getval(const char *_name); | |
| 90 | 89 | void	clean_environment(const char * const *_white, |
| 91 | 90 | 	 const char * const *_more_white); |
| 92 | int	expand_number(const char *_buf, uint64_t *_num); | |
| 91 | int	expand_number(const char *_buf, int64_t *_num); | |
| 92 | int	expand_unsigned(const char *_buf, uint64_t *_num); | |
| 93 | #if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) ||	\ | |
| 94 | 	__has_extension(c_generic_selections) | |
| 95 | #define expand_number(_buf, _num)					\ | |
| 96 | 	_Generic((_num),						\ | |
| 97 | 		 uint64_t *: expand_unsigned,				\ | |
| 98 | 		 default: expand_number)((_buf), (_num)) | |
| 99 | #endif | |
| 93 | 100 | int	extattr_namespace_to_string(int _attrnamespace, char **_string); |
| 94 | 101 | int	extattr_string_to_namespace(const char *_string, int *_attrnamespace); |
| 95 | 102 | int	flopen(const char *_path, int _flags, ...); |
| ... | ... | @@ -213,7 +220,13 @@ int	cpuset_parselist(const char *list, cpuset_t *mask); |
| 213 | 220 | #define CPUSET_PARSE_OK			0 |
| 214 | 221 | #define CPUSET_PARSE_GETAFFINITY	-1 |
| 215 | 222 | #define CPUSET_PARSE_ERROR		-2 |
| 216 | #define CPUSET_PARSE_INVALID_CPU	-3 | |
| 223 | #define CPUSET_PARSE_OUT_OF_RANGE	-3 | |
| 224 | #define CPUSET_PARSE_GETDOMAIN		-4 | |
| 225 | #define CPUSET_PARSE_INVALID_CPU	CPUSET_PARSE_OUT_OF_RANGE /* backwards compat */ | |
| 226 | #endif | |
| 227 | ||
| 228 | #ifdef _SYS_DOMAINSET_H_ | |
| 229 | int	domainset_parselist(const char *list, domainset_t *mask, int *policyp); | |
| 217 | 230 | #endif |
| 218 | 231 | |
| 219 | 232 | __END_DECLS |
lib/libc/include/generic-freebsd/limits.h+5-2| ... | ... | @@ -27,8 +27,6 @@ |
| 27 | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | * | |
| 31 | *	@(#)limits.h	8.2 (Berkeley) 1/4/94 | |
| 32 | 30 | */ |
| 33 | 31 | |
| 34 | 32 | #ifndef _LIMITS_H_ |
| ... | ... | @@ -139,6 +137,11 @@ |
| 139 | 137 | |
| 140 | 138 | #define	MB_LEN_MAX		6	/* 31-bit UTF-8 */ |
| 141 | 139 | |
| 140 | #if __POSIX_VISIBLE >= 202405 | |
| 141 | #define GETENTROPY_MAX		256 | |
| 142 | #define NSIG_MAX		128	/* _SIG_MAXSIG from <signal.h> */ | |
| 143 | #endif | |
| 144 | ||
| 142 | 145 | #include <sys/limits.h> |
| 143 | 146 | |
| 144 | 147 | #if __POSIX_VISIBLE |
lib/libc/include/generic-freebsd/locale.h-2| ... | ... | @@ -27,8 +27,6 @@ |
| 27 | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | * | |
| 31 | *	@(#)locale.h	8.1 (Berkeley) 6/2/93 | |
| 32 | 30 | */ |
| 33 | 31 | |
| 34 | 32 | #ifndef _LOCALE_H_ |
lib/libc/include/generic-freebsd/machine/_align.h+2-50| ... | ... | @@ -1,53 +1,5 @@ |
| 1 | 1 | /*- |
| 2 | * SPDX-License-Identifier: BSD-4-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 2001 David E. O'Brien | |
| 5 | * Copyright (c) 1990 The Regents of the University of California. | |
| 6 | * All rights reserved. | |
| 7 | * | |
| 8 | * This code is derived from software contributed to Berkeley by | |
| 9 | * William Jolitz. | |
| 10 | * | |
| 11 | * Redistribution and use in source and binary forms, with or without | |
| 12 | * modification, are permitted provided that the following conditions | |
| 13 | * are met: | |
| 14 | * 1. Redistributions of source code must retain the above copyright | |
| 15 | * notice, this list of conditions and the following disclaimer. | |
| 16 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 17 | * notice, this list of conditions and the following disclaimer in the | |
| 18 | * documentation and/or other materials provided with the distribution. | |
| 19 | * 3. All advertising materials mentioning features or use of this software | |
| 20 | * must display the following acknowledgement: | |
| 21 | *	This product includes software developed by the University of | |
| 22 | *	California, Berkeley and its contributors. | |
| 23 | * 4. Neither the name of the University nor the names of its contributors | |
| 24 | * may be used to endorse or promote products derived from this software | |
| 25 | * without specific prior written permission. | |
| 26 | * | |
| 27 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | |
| 28 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 29 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
| 30 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
| 31 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
| 32 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
| 33 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
| 34 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
| 35 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
| 36 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
| 37 | * SUCH DAMAGE. | |
| 38 | * | |
| 39 | *	from: @(#)param.h	5.8 (Berkeley) 6/28/91 | |
| 2 | * This file is in the public domain. | |
| 40 | 3 | */ |
| 41 | 4 | |
| 42 | #ifndef _POWERPC_INCLUDE__ALIGN_H_ | |
| 43 | #define	_POWERPC_INCLUDE__ALIGN_H_ | |
| 44 | ||
| 45 | /* | |
| 46 | * Round p (pointer or byte index) up to a correctly-aligned value | |
| 47 | * for all data types (int, long, ...). The result is unsigned int | |
| 48 | * and must be cast to any desired pointer type. | |
| 49 | */ | |
| 50 | #define	_ALIGNBYTES	(sizeof(register_t) - 1) | |
| 51 | #define	_ALIGN(p)	(((uintptr_t)(p) + _ALIGNBYTES) & ~_ALIGNBYTES) | |
| 52 | ||
| 53 | #endif /* !_POWERPC_INCLUDE__ALIGN_H_ */ | |
| \ No newline at end of file | ||
| 5 | #include <x86/_align.h> | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/machine/_bus.h+15-34| ... | ... | @@ -1,47 +1,28 @@ |
| 1 | 1 | /*- |
| 2 | * SPDX-License-Identifier: BSD-2-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 2005 M. Warner Losh <imp@FreeBSD.org> | |
| 2 | * Copyright (c) 2005 The FreeBSD Foundation. | |
| 5 | 3 | * |
| 6 | * Redistribution and use in source and binary forms, with or without | |
| 7 | * modification, are permitted provided that the following conditions | |
| 8 | * are met: | |
| 9 | * 1. Redistributions of source code must retain the above copyright | |
| 10 | * notice, this list of conditions, and the following disclaimer, | |
| 11 | * without modification, immediately at the beginning of the file. | |
| 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 13 | * notice, this list of conditions and the following disclaimer in | |
| 14 | * the documentation and/or other materials provided with the | |
| 15 | * distribution. | |
| 4 | * SPDX-License-Identifier: BSD-2-Clause | |
| 16 | 5 | * |
| 17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |
| 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 19 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
| 20 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR | |
| 21 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
| 22 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
| 23 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
| 24 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
| 25 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
| 26 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
| 27 | * SUCH DAMAGE. | |
| 6 | * Derived in part from NetBSD's bus.h files by (alphabetically): | |
| 7 | *	Christopher G. Demetriou | |
| 8 | *	Charles M. Hannum | |
| 9 | *	Jason Thorpe | |
| 10 | *	The NetBSD Foundation. | |
| 28 | 11 | */ |
| 29 | 12 | |
| 30 | #ifndef POWERPC_INCLUDE__BUS_H | |
| 31 | #define POWERPC_INCLUDE__BUS_H | |
| 32 | ||
| 33 | #include <vm/vm_param.h> | |
| 13 | #ifndef _MACHINE__BUS_H_ | |
| 14 | #define	_MACHINE__BUS_H_ | |
| 34 | 15 | |
| 35 | 16 | /* |
| 36 | * Bus address and size types | |
| 17 | * Addresses (in bus space). | |
| 37 | 18 | */ |
| 38 | typedef vm_paddr_t bus_addr_t; | |
| 39 | typedef vm_size_t bus_size_t; | |
| 19 | typedef u_long bus_addr_t; | |
| 20 | typedef u_long bus_size_t; | |
| 40 | 21 | |
| 41 | 22 | /* |
| 42 | * Access methods for bus resources and address space. | |
| 23 | * Access methods for bus space. | |
| 43 | 24 | */ |
| 25 | typedef u_long bus_space_handle_t; | |
| 44 | 26 | typedef struct bus_space *bus_space_tag_t; |
| 45 | typedef vm_offset_t bus_space_handle_t; | |
| 46 | 27 | |
| 47 | #endif /* POWERPC_INCLUDE__BUS_H */ | |
| \ No newline at end of file | ||
| 28 | #endif /* !_MACHINE__BUS_H_ */ | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/machine/_inttypes.h+2-219| ... | ... | @@ -1,222 +1,5 @@ |
| 1 | 1 | /*- |
| 2 | * SPDX-License-Identifier: BSD-2-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 2001 The NetBSD Foundation, Inc. | |
| 5 | * All rights reserved. | |
| 6 | * | |
| 7 | * This code is derived from software contributed to The NetBSD Foundation | |
| 8 | * by Klaus Klein. | |
| 9 | * | |
| 10 | * Redistribution and use in source and binary forms, with or without | |
| 11 | * modification, are permitted provided that the following conditions | |
| 12 | * are met: | |
| 13 | * 1. Redistributions of source code must retain the above copyright | |
| 14 | * notice, this list of conditions and the following disclaimer. | |
| 15 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 16 | * notice, this list of conditions and the following disclaimer in the | |
| 17 | * documentation and/or other materials provided with the distribution. | |
| 18 | * | |
| 19 | * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS | |
| 20 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | |
| 21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
| 22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | |
| 23 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
| 24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
| 25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
| 26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
| 27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
| 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
| 29 | * POSSIBILITY OF SUCH DAMAGE. | |
| 30 | * | |
| 31 | *	From: $NetBSD: int_fmtio.h,v 1.2 2001/04/26 16:25:21 kleink Exp $ | |
| 2 | * This file is in the public domain. | |
| 32 | 3 | */ |
| 33 | 4 | |
| 34 | #ifndef _MACHINE_INTTYPES_H_ | |
| 35 | #define	_MACHINE_INTTYPES_H_ | |
| 36 | ||
| 37 | /* | |
| 38 | * Macros for format specifiers. | |
| 39 | */ | |
| 40 | ||
| 41 | #ifdef __LP64__ | |
| 42 | #define	__PRI64		"l" | |
| 43 | #define	__PRIptr	"l" | |
| 44 | #else | |
| 45 | #define	__PRI64		"ll" | |
| 46 | #define	__PRIptr | |
| 47 | #endif | |
| 48 | ||
| 49 | /* fprintf(3) macros for signed integers. */ | |
| 50 | ||
| 51 | #define	PRId8		"d"		/* int8_t */ | |
| 52 | #define	PRId16		"d"		/* int16_t */ | |
| 53 | #define	PRId32		"d"		/* int32_t */ | |
| 54 | #define	PRId64		__PRI64"d"	/* int64_t */ | |
| 55 | #define	PRIdLEAST8	"d"		/* int_least8_t */ | |
| 56 | #define	PRIdLEAST16	"d"		/* int_least16_t */ | |
| 57 | #define	PRIdLEAST32	"d"		/* int_least32_t */ | |
| 58 | #define	PRIdLEAST64	__PRI64"d"	/* int_least64_t */ | |
| 59 | #define	PRIdFAST8	"d"		/* int_fast8_t */ | |
| 60 | #define	PRIdFAST16	"d"		/* int_fast16_t */ | |
| 61 | #define	PRIdFAST32	"d"		/* int_fast32_t */ | |
| 62 | #define	PRIdFAST64	__PRI64"d"	/* int_fast64_t */ | |
| 63 | #define	PRIdMAX		"jd"		/* intmax_t */ | |
| 64 | #define	PRIdPTR		__PRIptr"d"	/* intptr_t */ | |
| 65 | ||
| 66 | #define	PRIi8		"i"		/* int8_t */ | |
| 67 | #define	PRIi16		"i"		/* int16_t */ | |
| 68 | #define	PRIi32		"i"		/* int32_t */ | |
| 69 | #define	PRIi64		__PRI64"i"	/* int64_t */ | |
| 70 | #define	PRIiLEAST8	"i"		/* int_least8_t */ | |
| 71 | #define	PRIiLEAST16	"i"		/* int_least16_t */ | |
| 72 | #define	PRIiLEAST32	"i"		/* int_least32_t */ | |
| 73 | #define	PRIiLEAST64	__PRI64"i"	/* int_least64_t */ | |
| 74 | #define	PRIiFAST8	"i"		/* int_fast8_t */ | |
| 75 | #define	PRIiFAST16	"i"		/* int_fast16_t */ | |
| 76 | #define	PRIiFAST32	"i"		/* int_fast32_t */ | |
| 77 | #define	PRIiFAST64	__PRI64"i"	/* int_fast64_t */ | |
| 78 | #define	PRIiMAX		"ji"		/* intmax_t */ | |
| 79 | #define	PRIiPTR		__PRIptr"i"	/* intptr_t */ | |
| 80 | ||
| 81 | /* fprintf(3) macros for unsigned integers. */ | |
| 82 | ||
| 83 | #define	PRIo8		"o"		/* uint8_t */ | |
| 84 | #define	PRIo16		"o"		/* uint16_t */ | |
| 85 | #define	PRIo32		"o"		/* uint32_t */ | |
| 86 | #define	PRIo64		__PRI64"o"	/* uint64_t */ | |
| 87 | #define	PRIoLEAST8	"o"		/* uint_least8_t */ | |
| 88 | #define	PRIoLEAST16	"o"		/* uint_least16_t */ | |
| 89 | #define	PRIoLEAST32	"o"		/* uint_least32_t */ | |
| 90 | #define	PRIoLEAST64	__PRI64"o"	/* uint_least64_t */ | |
| 91 | #define	PRIoFAST8	"o"		/* uint_fast8_t */ | |
| 92 | #define	PRIoFAST16	"o"		/* uint_fast16_t */ | |
| 93 | #define	PRIoFAST32	"o"		/* uint_fast32_t */ | |
| 94 | #define	PRIoFAST64	__PRI64"o"	/* uint_fast64_t */ | |
| 95 | #define	PRIoMAX		"jo"		/* uintmax_t */ | |
| 96 | #define	PRIoPTR		__PRIptr"o"	/* uintptr_t */ | |
| 97 | ||
| 98 | #define	PRIu8		"u"		/* uint8_t */ | |
| 99 | #define	PRIu16		"u"		/* uint16_t */ | |
| 100 | #define	PRIu32		"u"		/* uint32_t */ | |
| 101 | #define	PRIu64		__PRI64"u"	/* uint64_t */ | |
| 102 | #define	PRIuLEAST8	"u"		/* uint_least8_t */ | |
| 103 | #define	PRIuLEAST16	"u"		/* uint_least16_t */ | |
| 104 | #define	PRIuLEAST32	"u"		/* uint_least32_t */ | |
| 105 | #define	PRIuLEAST64	__PRI64"u"	/* uint_least64_t */ | |
| 106 | #define	PRIuFAST8	"u"		/* uint_fast8_t */ | |
| 107 | #define	PRIuFAST16	"u"		/* uint_fast16_t */ | |
| 108 | #define	PRIuFAST32	"u"		/* uint_fast32_t */ | |
| 109 | #define	PRIuFAST64	__PRI64"u"	/* uint_fast64_t */ | |
| 110 | #define	PRIuMAX		"ju"		/* uintmax_t */ | |
| 111 | #define	PRIuPTR		__PRIptr"u"	/* uintptr_t */ | |
| 112 | ||
| 113 | #define	PRIx8		"x"		/* uint8_t */ | |
| 114 | #define	PRIx16		"x"		/* uint16_t */ | |
| 115 | #define	PRIx32		"x"		/* uint32_t */ | |
| 116 | #define	PRIx64		__PRI64"x"	/* uint64_t */ | |
| 117 | #define	PRIxLEAST8	"x"		/* uint_least8_t */ | |
| 118 | #define	PRIxLEAST16	"x"		/* uint_least16_t */ | |
| 119 | #define	PRIxLEAST32	"x"		/* uint_least32_t */ | |
| 120 | #define	PRIxLEAST64	__PRI64"x"	/* uint_least64_t */ | |
| 121 | #define	PRIxFAST8	"x"		/* uint_fast8_t */ | |
| 122 | #define	PRIxFAST16	"x"		/* uint_fast16_t */ | |
| 123 | #define	PRIxFAST32	"x"		/* uint_fast32_t */ | |
| 124 | #define	PRIxFAST64	__PRI64"x"	/* uint_fast64_t */ | |
| 125 | #define	PRIxMAX		"jx"		/* uintmax_t */ | |
| 126 | #define	PRIxPTR		__PRIptr"x"	/* uintptr_t */ | |
| 127 | ||
| 128 | #define	PRIX8		"X"		/* uint8_t */ | |
| 129 | #define	PRIX16		"X"		/* uint16_t */ | |
| 130 | #define	PRIX32		"X"		/* uint32_t */ | |
| 131 | #define	PRIX64		__PRI64"X"	/* uint64_t */ | |
| 132 | #define	PRIXLEAST8	"X"		/* uint_least8_t */ | |
| 133 | #define	PRIXLEAST16	"X"		/* uint_least16_t */ | |
| 134 | #define	PRIXLEAST32	"X"		/* uint_least32_t */ | |
| 135 | #define	PRIXLEAST64	__PRI64"X"	/* uint_least64_t */ | |
| 136 | #define	PRIXFAST8	"X"		/* uint_fast8_t */ | |
| 137 | #define	PRIXFAST16	"X"		/* uint_fast16_t */ | |
| 138 | #define	PRIXFAST32	"X"		/* uint_fast32_t */ | |
| 139 | #define	PRIXFAST64	__PRI64"X"	/* uint_fast64_t */ | |
| 140 | #define	PRIXMAX		"jX"		/* uintmax_t */ | |
| 141 | #define	PRIXPTR		__PRIptr"X"	/* uintptr_t */ | |
| 142 | ||
| 143 | /* fscanf(3) macros for signed integers. */ | |
| 144 | ||
| 145 | #define	SCNd8		"hhd"		/* int8_t */ | |
| 146 | #define	SCNd16		"hd"		/* int16_t */ | |
| 147 | #define	SCNd32		"d"		/* int32_t */ | |
| 148 | #define	SCNd64		__PRI64"d"	/* int64_t */ | |
| 149 | #define	SCNdLEAST8	"hhd"		/* int_least8_t */ | |
| 150 | #define	SCNdLEAST16	"hd"		/* int_least16_t */ | |
| 151 | #define	SCNdLEAST32	"d"		/* int_least32_t */ | |
| 152 | #define	SCNdLEAST64	__PRI64"d"	/* int_least64_t */ | |
| 153 | #define	SCNdFAST8	"d"		/* int_fast8_t */ | |
| 154 | #define	SCNdFAST16	"d"		/* int_fast16_t */ | |
| 155 | #define	SCNdFAST32	"d"		/* int_fast32_t */ | |
| 156 | #define	SCNdFAST64	__PRI64"d"	/* int_fast64_t */ | |
| 157 | #define	SCNdMAX		"jd"		/* intmax_t */ | |
| 158 | #define	SCNdPTR		__PRIptr"d"	/* intptr_t */ | |
| 159 | ||
| 160 | #define	SCNi8		"hhi"		/* int8_t */ | |
| 161 | #define	SCNi16		"hi"		/* int16_t */ | |
| 162 | #define	SCNi32		"i"		/* int32_t */ | |
| 163 | #define	SCNi64		__PRI64"i"	/* int64_t */ | |
| 164 | #define	SCNiLEAST8	"hhi"		/* int_least8_t */ | |
| 165 | #define	SCNiLEAST16	"hi"		/* int_least16_t */ | |
| 166 | #define	SCNiLEAST32	"i"		/* int_least32_t */ | |
| 167 | #define	SCNiLEAST64	__PRI64"i"	/* int_least64_t */ | |
| 168 | #define	SCNiFAST8	"i"		/* int_fast8_t */ | |
| 169 | #define	SCNiFAST16	"i"		/* int_fast16_t */ | |
| 170 | #define	SCNiFAST32	"i"		/* int_fast32_t */ | |
| 171 | #define	SCNiFAST64	__PRI64"i"	/* int_fast64_t */ | |
| 172 | #define	SCNiMAX		"ji"		/* intmax_t */ | |
| 173 | #define	SCNiPTR		__PRIptr"i"	/* intptr_t */ | |
| 174 | ||
| 175 | /* fscanf(3) macros for unsigned integers. */ | |
| 176 | ||
| 177 | #define	SCNo8		"hho"		/* uint8_t */ | |
| 178 | #define	SCNo16		"ho"		/* uint16_t */ | |
| 179 | #define	SCNo32		"o"		/* uint32_t */ | |
| 180 | #define	SCNo64		__PRI64"o"	/* uint64_t */ | |
| 181 | #define	SCNoLEAST8	"hho"		/* uint_least8_t */ | |
| 182 | #define	SCNoLEAST16	"ho"		/* uint_least16_t */ | |
| 183 | #define	SCNoLEAST32	"o"		/* uint_least32_t */ | |
| 184 | #define	SCNoLEAST64	__PRI64"o"	/* uint_least64_t */ | |
| 185 | #define	SCNoFAST8	"o"		/* uint_fast8_t */ | |
| 186 | #define	SCNoFAST16	"o"		/* uint_fast16_t */ | |
| 187 | #define	SCNoFAST32	"o"		/* uint_fast32_t */ | |
| 188 | #define	SCNoFAST64	__PRI64"o"	/* uint_fast64_t */ | |
| 189 | #define	SCNoMAX		"jo"		/* uintmax_t */ | |
| 190 | #define	SCNoPTR		__PRIptr"o"	/* uintptr_t */ | |
| 191 | ||
| 192 | #define	SCNu8		"hhu"		/* uint8_t */ | |
| 193 | #define	SCNu16		"hu"		/* uint16_t */ | |
| 194 | #define	SCNu32		"u"		/* uint32_t */ | |
| 195 | #define	SCNu64		__PRI64"u"	/* uint64_t */ | |
| 196 | #define	SCNuLEAST8	"hhu"		/* uint_least8_t */ | |
| 197 | #define	SCNuLEAST16	"hu"		/* uint_least16_t */ | |
| 198 | #define	SCNuLEAST32	"u"		/* uint_least32_t */ | |
| 199 | #define	SCNuLEAST64	__PRI64"u"	/* uint_least64_t */ | |
| 200 | #define	SCNuFAST8	"u"		/* uint_fast8_t */ | |
| 201 | #define	SCNuFAST16	"u"		/* uint_fast16_t */ | |
| 202 | #define	SCNuFAST32	"u"		/* uint_fast32_t */ | |
| 203 | #define	SCNuFAST64	__PRI64"u"	/* uint_fast64_t */ | |
| 204 | #define	SCNuMAX		"ju"		/* uintmax_t */ | |
| 205 | #define	SCNuPTR		__PRIptr"u"	/* uintptr_t */ | |
| 206 | ||
| 207 | #define	SCNx8		"hhx"		/* uint8_t */ | |
| 208 | #define	SCNx16		"hx"		/* uint16_t */ | |
| 209 | #define	SCNx32		"x"		/* uint32_t */ | |
| 210 | #define	SCNx64		__PRI64"x"	/* uint64_t */ | |
| 211 | #define	SCNxLEAST8	"hhx"		/* uint_least8_t */ | |
| 212 | #define	SCNxLEAST16	"hx"		/* uint_least16_t */ | |
| 213 | #define	SCNxLEAST32	"x"		/* uint_least32_t */ | |
| 214 | #define	SCNxLEAST64	__PRI64"x"	/* uint_least64_t */ | |
| 215 | #define	SCNxFAST8	"x"		/* uint_fast8_t */ | |
| 216 | #define	SCNxFAST16	"x"		/* uint_fast16_t */ | |
| 217 | #define	SCNxFAST32	"x"		/* uint_fast32_t */ | |
| 218 | #define	SCNxFAST64	__PRI64"x"	/* uint_fast64_t */ | |
| 219 | #define	SCNxMAX		"jx"		/* uintmax_t */ | |
| 220 | #define	SCNxPTR		__PRIptr"x"	/* uintptr_t */ | |
| 221 | ||
| 222 | #endif /* !_MACHINE_INTTYPES_H_ */ | |
| \ No newline at end of file | ||
| 5 | #include <x86/_inttypes.h> | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/machine/_limits.h+2-95| ... | ... | @@ -1,98 +1,5 @@ |
| 1 | 1 | /*- |
| 2 | * SPDX-License-Identifier: BSD-3-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 1988, 1993 | |
| 5 | *	The Regents of the University of California. All rights reserved. | |
| 6 | * | |
| 7 | * Redistribution and use in source and binary forms, with or without | |
| 8 | * modification, are permitted provided that the following conditions | |
| 9 | * are met: | |
| 10 | * 1. Redistributions of source code must retain the above copyright | |
| 11 | * notice, this list of conditions and the following disclaimer. | |
| 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 13 | * notice, this list of conditions and the following disclaimer in the | |
| 14 | * documentation and/or other materials provided with the distribution. | |
| 15 | * 3. Neither the name of the University nor the names of its contributors | |
| 16 | * may be used to endorse or promote products derived from this software | |
| 17 | * without specific prior written permission. | |
| 18 | * | |
| 19 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | |
| 20 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 21 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
| 22 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
| 23 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
| 24 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
| 25 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
| 26 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
| 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
| 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
| 29 | * SUCH DAMAGE. | |
| 30 | * | |
| 31 | *	@(#)limits.h	8.3 (Berkeley) 1/4/94 | |
| 2 | * This file is in the public domain. | |
| 32 | 3 | */ |
| 33 | 4 | |
| 34 | #ifndef _MACHINE__LIMITS_H_ | |
| 35 | #define	_MACHINE__LIMITS_H_ | |
| 36 | ||
| 37 | /* | |
| 38 | * According to ANSI (section 2.2.4.2), the values below must be usable by | |
| 39 | * #if preprocessing directives. Additionally, the expression must have the | |
| 40 | * same type as would an expression that is an object of the corresponding | |
| 41 | * type converted according to the integral promotions. The subtraction for | |
| 42 | * INT_MIN, etc., is so the value is not unsigned; e.g., 0x80000000 is an | |
| 43 | * unsigned int for 32-bit two's complement ANSI compilers (section 3.1.3.2). | |
| 44 | */ | |
| 45 | ||
| 46 | #define	__CHAR_BIT	8		/* number of bits in a char */ | |
| 47 | ||
| 48 | #define	__SCHAR_MAX	0x7f		/* max value for a signed char */ | |
| 49 | #define	__SCHAR_MIN	(-0x7f - 1)	/* min value for a signed char */ | |
| 50 | ||
| 51 | #define	__UCHAR_MAX	0xff		/* max value for an unsigned char */ | |
| 52 | ||
| 53 | #define	__USHRT_MAX	0xffff		/* max value for an unsigned short */ | |
| 54 | #define	__SHRT_MAX	0x7fff		/* max value for a short */ | |
| 55 | #define	__SHRT_MIN	(-0x7fff - 1)	/* min value for a short */ | |
| 56 | ||
| 57 | #define	__UINT_MAX	0xffffffff	/* max value for an unsigned int */ | |
| 58 | #define	__INT_MAX	0x7fffffff	/* max value for an int */ | |
| 59 | #define	__INT_MIN	(-0x7fffffff - 1)	/* min value for an int */ | |
| 60 | ||
| 61 | #ifdef __LP64__ | |
| 62 | #define	__ULONG_MAX	0xffffffffffffffff | |
| 63 | #define	__LONG_MAX	0x7fffffffffffffff | |
| 64 | #define	__LONG_MIN	(-0x7fffffffffffffff - 1) | |
| 65 | #define	__LONG_BIT	64 | |
| 66 | #else | |
| 67 | #define	__ULONG_MAX	0xffffffffUL	/* max value for an unsigned long */ | |
| 68 | #define	__LONG_MAX	0x7fffffffL	/* max value for a long */ | |
| 69 | #define	__LONG_MIN	(-0x7fffffffL - 1)	/* min value for a long */ | |
| 70 | #define	__LONG_BIT	32 | |
| 71 | #endif | |
| 72 | ||
| 73 | #define	__ULLONG_MAX	0xffffffffffffffffULL | |
| 74 | #define	__LLONG_MAX	0x7fffffffffffffffLL	/* max value for a long long */ | |
| 75 | #define	__LLONG_MIN	(-0x7fffffffffffffffLL - 1) /* min for a long long */ | |
| 76 | ||
| 77 | #ifdef __LP64__ | |
| 78 | #define	__SSIZE_MAX	__LONG_MAX	/* max value for a ssize_t */ | |
| 79 | #define	__SIZE_T_MAX	__ULONG_MAX	/* max value for a size_t */ | |
| 80 | #else | |
| 81 | #define	__SSIZE_MAX	__INT_MAX	/* max value for a ssize_t */ | |
| 82 | #define	__SIZE_T_MAX	__UINT_MAX	/* max value for a size_t */ | |
| 83 | #endif | |
| 84 | ||
| 85 | #define	__OFF_MAX	__LLONG_MAX	/* max value for an off_t */ | |
| 86 | #define	__OFF_MIN	__LLONG_MIN	/* min value for an off_t */ | |
| 87 | ||
| 88 | /* Quads and long longs are the same size. Ensure they stay in sync. */ | |
| 89 | #define	__UQUAD_MAX	__ULLONG_MAX	/* max value for a uquad_t */ | |
| 90 | #define	__QUAD_MAX	__LLONG_MAX	/* max value for a quad_t */ | |
| 91 | #define	__QUAD_MIN	__LLONG_MIN	/* min value for a quad_t */ | |
| 92 | ||
| 93 | #define	__WORD_BIT	32 | |
| 94 | ||
| 95 | /* Minimum signal stack size. */ | |
| 96 | #define	__MINSIGSTKSZ	(512 * 4) | |
| 97 | ||
| 98 | #endif /* !_MACHINE__LIMITS_H_ */ | |
| \ No newline at end of file | ||
| 5 | #include <x86/_limits.h> | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/machine/_stdint.h+2-197| ... | ... | @@ -1,200 +1,5 @@ |
| 1 | 1 | /*- |
| 2 | * SPDX-License-Identifier: BSD-4-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 2001, 2002 Mike Barcroft <mike@FreeBSD.org> | |
| 5 | * Copyright (c) 2001 The NetBSD Foundation, Inc. | |
| 6 | * All rights reserved. | |
| 7 | * | |
| 8 | * This code is derived from software contributed to The NetBSD Foundation | |
| 9 | * by Klaus Klein. | |
| 10 | * | |
| 11 | * Redistribution and use in source and binary forms, with or without | |
| 12 | * modification, are permitted provided that the following conditions | |
| 13 | * are met: | |
| 14 | * 1. Redistributions of source code must retain the above copyright | |
| 15 | * notice, this list of conditions and the following disclaimer. | |
| 16 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 17 | * notice, this list of conditions and the following disclaimer in the | |
| 18 | * documentation and/or other materials provided with the distribution. | |
| 19 | * 3. All advertising materials mentioning features or use of this software | |
| 20 | * must display the following acknowledgement: | |
| 21 | * This product includes software developed by the NetBSD | |
| 22 | * Foundation, Inc. and its contributors. | |
| 23 | * 4. Neither the name of The NetBSD Foundation nor the names of its | |
| 24 | * contributors may be used to endorse or promote products derived | |
| 25 | * from this software without specific prior written permission. | |
| 26 | * | |
| 27 | * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS | |
| 28 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | |
| 29 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
| 30 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | |
| 31 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
| 32 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
| 33 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
| 34 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
| 35 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
| 36 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
| 37 | * POSSIBILITY OF SUCH DAMAGE. | |
| 2 | * This file is in the public domain. | |
| 38 | 3 | */ |
| 39 | 4 | |
| 40 | #ifndef _MACHINE__STDINT_H_ | |
| 41 | #define	_MACHINE__STDINT_H_ | |
| 42 | ||
| 43 | #if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) | |
| 44 | ||
| 45 | #define	INT8_C(c)		(c) | |
| 46 | #define	INT16_C(c)		(c) | |
| 47 | #define	INT32_C(c)		(c) | |
| 48 | ||
| 49 | #define	UINT8_C(c)		(c) | |
| 50 | #define	UINT16_C(c)		(c) | |
| 51 | #define	UINT32_C(c)		(c ## U) | |
| 52 | ||
| 53 | #ifdef __LP64__ | |
| 54 | #define	INT64_C(c)		(c ## L) | |
| 55 | #define	UINT64_C(c)		(c ## UL) | |
| 56 | #else | |
| 57 | #define	INT64_C(c)		(c ## LL) | |
| 58 | #define	UINT64_C(c)		(c ## ULL) | |
| 59 | #endif | |
| 60 | ||
| 61 | #define	INTMAX_C(c)		INT64_C(c) | |
| 62 | #define	UINTMAX_C(c)		UINT64_C(c) | |
| 63 | ||
| 64 | #endif /* !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) */ | |
| 65 | ||
| 66 | #if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) | |
| 67 | ||
| 68 | #ifndef __INT64_C | |
| 69 | #ifdef __LP64__ | |
| 70 | #define	__INT64_C(c)		(c ## L) | |
| 71 | #define	__UINT64_C(c)		(c ## UL) | |
| 72 | #else | |
| 73 | #define	__INT64_C(c)		(c ## LL) | |
| 74 | #define	__UINT64_C(c)		(c ## ULL) | |
| 75 | #endif | |
| 76 | #endif | |
| 77 | ||
| 78 | /* | |
| 79 | * ISO/IEC 9899:1999 | |
| 80 | * 7.18.2.1 Limits of exact-width integer types | |
| 81 | */ | |
| 82 | /* Minimum values of exact-width signed integer types. */ | |
| 83 | #define	INT8_MIN	(-0x7f-1) | |
| 84 | #define	INT16_MIN	(-0x7fff-1) | |
| 85 | #define	INT32_MIN	(-0x7fffffff-1) | |
| 86 | #define	INT64_MIN	(-__INT64_C(0x7fffffffffffffff)-1) | |
| 87 | ||
| 88 | /* Maximum values of exact-width signed integer types. */ | |
| 89 | #define	INT8_MAX	0x7f | |
| 90 | #define	INT16_MAX	0x7fff | |
| 91 | #define	INT32_MAX	0x7fffffff | |
| 92 | #define	INT64_MAX	__INT64_C(0x7fffffffffffffff) | |
| 93 | ||
| 94 | /* Maximum values of exact-width unsigned integer types. */ | |
| 95 | #define	UINT8_MAX	0xff | |
| 96 | #define	UINT16_MAX	0xffff | |
| 97 | #define	UINT32_MAX	0xffffffff | |
| 98 | #define	UINT64_MAX	__UINT64_C(0xffffffffffffffff) | |
| 99 | ||
| 100 | /* | |
| 101 | * ISO/IEC 9899:1999 | |
| 102 | * 7.18.2.2 Limits of minimum-width integer types | |
| 103 | */ | |
| 104 | /* Minimum values of minimum-width signed integer types. */ | |
| 105 | #define	INT_LEAST8_MIN	INT8_MIN | |
| 106 | #define	INT_LEAST16_MIN	INT16_MIN | |
| 107 | #define	INT_LEAST32_MIN	INT32_MIN | |
| 108 | #define	INT_LEAST64_MIN	INT64_MIN | |
| 109 | ||
| 110 | /* Maximum values of minimum-width signed integer types. */ | |
| 111 | #define	INT_LEAST8_MAX	INT8_MAX | |
| 112 | #define	INT_LEAST16_MAX	INT16_MAX | |
| 113 | #define	INT_LEAST32_MAX	INT32_MAX | |
| 114 | #define	INT_LEAST64_MAX	INT64_MAX | |
| 115 | ||
| 116 | /* Maximum values of minimum-width unsigned integer types. */ | |
| 117 | #define	UINT_LEAST8_MAX	 UINT8_MAX | |
| 118 | #define	UINT_LEAST16_MAX UINT16_MAX | |
| 119 | #define	UINT_LEAST32_MAX UINT32_MAX | |
| 120 | #define	UINT_LEAST64_MAX UINT64_MAX | |
| 121 | ||
| 122 | /* | |
| 123 | * ISO/IEC 9899:1999 | |
| 124 | * 7.18.2.3 Limits of fastest minimum-width integer types | |
| 125 | */ | |
| 126 | /* Minimum values of fastest minimum-width signed integer types. */ | |
| 127 | #define	INT_FAST8_MIN	INT32_MIN | |
| 128 | #define	INT_FAST16_MIN	INT32_MIN | |
| 129 | #define	INT_FAST32_MIN	INT32_MIN | |
| 130 | #define	INT_FAST64_MIN	INT64_MIN | |
| 131 | ||
| 132 | /* Maximum values of fastest minimum-width signed integer types. */ | |
| 133 | #define	INT_FAST8_MAX	INT32_MAX | |
| 134 | #define	INT_FAST16_MAX	INT32_MAX | |
| 135 | #define	INT_FAST32_MAX	INT32_MAX | |
| 136 | #define	INT_FAST64_MAX	INT64_MAX | |
| 137 | ||
| 138 | /* Maximum values of fastest minimum-width unsigned integer types. */ | |
| 139 | #define	UINT_FAST8_MAX	UINT32_MAX | |
| 140 | #define	UINT_FAST16_MAX	UINT32_MAX | |
| 141 | #define	UINT_FAST32_MAX	UINT32_MAX | |
| 142 | #define	UINT_FAST64_MAX	UINT64_MAX | |
| 143 | ||
| 144 | /* | |
| 145 | * ISO/IEC 9899:1999 | |
| 146 | * 7.18.2.4 Limits of integer types capable of holding object pointers | |
| 147 | */ | |
| 148 | #ifdef __LP64__ | |
| 149 | #define	INTPTR_MIN	INT64_MIN | |
| 150 | #define	INTPTR_MAX	INT64_MAX | |
| 151 | #define	UINTPTR_MAX	UINT64_MAX | |
| 152 | #else | |
| 153 | #define	INTPTR_MIN	INT32_MIN | |
| 154 | #define	INTPTR_MAX	INT32_MAX | |
| 155 | #define	UINTPTR_MAX	UINT32_MAX | |
| 156 | #endif | |
| 157 | ||
| 158 | /* | |
| 159 | * ISO/IEC 9899:1999 | |
| 160 | * 7.18.2.5 Limits of greatest-width integer types | |
| 161 | */ | |
| 162 | #define	INTMAX_MIN	INT64_MIN | |
| 163 | #define	INTMAX_MAX	INT64_MAX | |
| 164 | #define	UINTMAX_MAX	UINT64_MAX | |
| 165 | ||
| 166 | /* | |
| 167 | * ISO/IEC 9899:1999 | |
| 168 | * 7.18.3 Limits of other integer types | |
| 169 | */ | |
| 170 | #ifdef __LP64__ | |
| 171 | /* Limits of ptrdiff_t. */ | |
| 172 | #define	PTRDIFF_MIN	INT64_MIN	 | |
| 173 | #define	PTRDIFF_MAX	INT64_MAX | |
| 174 | ||
| 175 | /* Limits of sig_atomic_t. */ | |
| 176 | #define	SIG_ATOMIC_MIN	INT64_MIN | |
| 177 | #define	SIG_ATOMIC_MAX	INT64_MAX | |
| 178 | ||
| 179 | /* Limit of size_t. */ | |
| 180 | #define	SIZE_MAX	UINT64_MAX | |
| 181 | #else | |
| 182 | /* Limits of ptrdiff_t. */ | |
| 183 | #define	PTRDIFF_MIN	INT32_MIN	 | |
| 184 | #define	PTRDIFF_MAX	INT32_MAX | |
| 185 | ||
| 186 | /* Limits of sig_atomic_t. */ | |
| 187 | #define	SIG_ATOMIC_MIN	INT32_MIN | |
| 188 | #define	SIG_ATOMIC_MAX	INT32_MAX | |
| 189 | ||
| 190 | /* Limit of size_t. */ | |
| 191 | #define	SIZE_MAX	UINT32_MAX | |
| 192 | #endif | |
| 193 | ||
| 194 | /* Limits of wint_t. */ | |
| 195 | #define	WINT_MIN	INT32_MIN | |
| 196 | #define	WINT_MAX	INT32_MAX | |
| 197 | ||
| 198 | #endif /* !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) */ | |
| 199 | ||
| 200 | #endif /* !_MACHINE__STDINT_H_ */ | |
| \ No newline at end of file | ||
| 5 | #include <x86/_stdint.h> | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/machine/_types.h+2-89| ... | ... | @@ -1,92 +1,5 @@ |
| 1 | 1 | /*- |
| 2 | * SPDX-License-Identifier: BSD-4-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 2002 Mike Barcroft <mike@FreeBSD.org> | |
| 5 | * Copyright (c) 1990, 1993 | |
| 6 | *	The Regents of the University of California. All rights reserved. | |
| 7 | * | |
| 8 | * Redistribution and use in source and binary forms, with or without | |
| 9 | * modification, are permitted provided that the following conditions | |
| 10 | * are met: | |
| 11 | * 1. Redistributions of source code must retain the above copyright | |
| 12 | * notice, this list of conditions and the following disclaimer. | |
| 13 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 14 | * notice, this list of conditions and the following disclaimer in the | |
| 15 | * documentation and/or other materials provided with the distribution. | |
| 16 | * 3. All advertising materials mentioning features or use of this software | |
| 17 | * must display the following acknowledgement: | |
| 18 | *	This product includes software developed by the University of | |
| 19 | *	California, Berkeley and its contributors. | |
| 20 | * 4. Neither the name of the University nor the names of its contributors | |
| 21 | * may be used to endorse or promote products derived from this software | |
| 22 | * without specific prior written permission. | |
| 23 | * | |
| 24 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | |
| 25 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
| 27 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
| 28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
| 29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
| 30 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
| 31 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
| 32 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
| 33 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
| 34 | * SUCH DAMAGE. | |
| 35 | * | |
| 36 | *	From: @(#)ansi.h	8.2 (Berkeley) 1/4/94 | |
| 37 | *	From: @(#)types.h	8.3 (Berkeley) 1/5/94 | |
| 2 | * This file is in the public domain. | |
| 38 | 3 | */ |
| 39 | 4 | |
| 40 | #ifndef _MACHINE__TYPES_H_ | |
| 41 | #define	_MACHINE__TYPES_H_ | |
| 42 | ||
| 43 | #ifndef _SYS__TYPES_H_ | |
| 44 | #error do not include this header, use sys/_types.h | |
| 45 | #endif | |
| 46 | ||
| 47 | /* | |
| 48 | * Standard type definitions. | |
| 49 | */ | |
| 50 | typedef	__uint32_t	__clock_t;		/* clock()... */ | |
| 51 | #ifndef _STANDALONE | |
| 52 | typedef	double		__double_t; | |
| 53 | typedef	float		__float_t; | |
| 54 | #endif | |
| 55 | #ifdef __LP64__ | |
| 56 | typedef	__int64_t	__critical_t; | |
| 57 | #else | |
| 58 | typedef	__int32_t	__critical_t; | |
| 59 | #endif | |
| 60 | typedef	__int32_t	__int_fast8_t; | |
| 61 | typedef	__int32_t	__int_fast16_t; | |
| 62 | typedef	__int32_t	__int_fast32_t; | |
| 63 | typedef	__int64_t	__int_fast64_t; | |
| 64 | #ifdef __LP64__ | |
| 65 | typedef	__int64_t	__register_t; | |
| 66 | typedef	__int64_t	__segsz_t;		/* segment size (in pages) */ | |
| 67 | #else | |
| 68 | typedef	__int32_t	__register_t; | |
| 69 | typedef	__int32_t	__segsz_t;		/* segment size (in pages) */ | |
| 70 | #endif | |
| 71 | typedef	__int64_t	__time_t;		/* time()... */ | |
| 72 | typedef	__uint32_t	__uint_fast8_t; | |
| 73 | typedef	__uint32_t	__uint_fast16_t; | |
| 74 | typedef	__uint32_t	__uint_fast32_t; | |
| 75 | typedef	__uint64_t	__uint_fast64_t; | |
| 76 | #ifdef __LP64__ | |
| 77 | typedef	__uint64_t	__u_register_t; | |
| 78 | typedef	__uint64_t	__vm_paddr_t; | |
| 79 | #else | |
| 80 | typedef	__uint32_t	__u_register_t; | |
| 81 | #ifdef BOOKE | |
| 82 | typedef	__uint64_t	__vm_paddr_t; | |
| 83 | #else | |
| 84 | typedef	__uint32_t	__vm_paddr_t; | |
| 85 | #endif | |
| 86 | #endif | |
| 87 | typedef	int		___wchar_t; | |
| 88 | ||
| 89 | #define	__WCHAR_MIN	__INT_MIN	/* min value for a wchar_t */ | |
| 90 | #define	__WCHAR_MAX	__INT_MAX	/* max value for a wchar_t */ | |
| 91 | ||
| 92 | #endif /* !_MACHINE__TYPES_H_ */ | |
| \ No newline at end of file | ||
| 5 | #include <x86/_types.h> | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/machine/altivec.h deleted-41| ... | ... | @@ -1,41 +0,0 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-2-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 2008 Nathan Whitehorn | |
| 5 | * All rights reserved | |
| 6 | * | |
| 7 | * Redistribution and use in source and binary forms, with or without | |
| 8 | * modification, are permitted provided that the following conditions | |
| 9 | * are met: | |
| 10 | * 1. Redistributions of source code must retain the above copyright | |
| 11 | * notice, this list of conditions and the following disclaimer. | |
| 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 13 | * notice, this list of conditions and the following disclaimer in the | |
| 14 | * documentation and/or other materials provided with the distribution. | |
| 15 | * | |
| 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |
| 17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
| 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | |
| 20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
| 21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
| 22 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
| 23 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
| 24 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
| 25 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
| 26 | * SUCH DAMAGE. | |
| 27 | */ | |
| 28 | ||
| 29 | #ifndef	_MACHINE_ALTIVEC_H_ | |
| 30 | #define	_MACHINE_ALTIVEC_H_ | |
| 31 | ||
| 32 | #define ALTIVEC_VSCR_NJ		0x00010000	/* Enable non-Java mode */ | |
| 33 | #define ALTIVEC_VSCR_SAT	0x00000001	/* Saturation status bit */ | |
| 34 | ||
| 35 | void enable_vec(struct thread *); | |
| 36 | void save_vec(struct thread *); | |
| 37 | void save_vec_nodrop(struct thread *); | |
| 38 | void enable_vec_kern(void); | |
| 39 | void disable_vec(struct thread *td); | |
| 40 | ||
| 41 | #endif	/* _MACHINE_ALTIVEC_H_ */ | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/machine/asm.h deleted-267| ... | ... | @@ -1,267 +0,0 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-4-Clause | |
| 3 | * | |
| 4 | * Copyright (C) 1995, 1996 Wolfgang Solfrank. | |
| 5 | * Copyright (C) 1995, 1996 TooLs GmbH. | |
| 6 | * All rights reserved. | |
| 7 | * | |
| 8 | * Redistribution and use in source and binary forms, with or without | |
| 9 | * modification, are permitted provided that the following conditions | |
| 10 | * are met: | |
| 11 | * 1. Redistributions of source code must retain the above copyright | |
| 12 | * notice, this list of conditions and the following disclaimer. | |
| 13 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 14 | * notice, this list of conditions and the following disclaimer in the | |
| 15 | * documentation and/or other materials provided with the distribution. | |
| 16 | * 3. All advertising materials mentioning features or use of this software | |
| 17 | * must display the following acknowledgement: | |
| 18 | *	This product includes software developed by TooLs GmbH. | |
| 19 | * 4. The name of TooLs GmbH may not be used to endorse or promote products | |
| 20 | * derived from this software without specific prior written permission. | |
| 21 | * | |
| 22 | * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR | |
| 23 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |
| 24 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | |
| 25 | * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
| 26 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | |
| 27 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; | |
| 28 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | |
| 29 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | |
| 30 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | |
| 31 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 32 | * | |
| 33 | *	$NetBSD: asm.h,v 1.6.18.1 2000/07/25 08:37:14 kleink Exp $ | |
| 34 | */ | |
| 35 | ||
| 36 | #ifndef _MACHINE_ASM_H_ | |
| 37 | #define	_MACHINE_ASM_H_ | |
| 38 | ||
| 39 | #include <sys/cdefs.h> | |
| 40 | ||
| 41 | #if defined(PIC) && !defined(__powerpc64__) | |
| 42 | #define	PIC_PROLOGUE	XXX | |
| 43 | #define	PIC_EPILOGUE	XXX | |
| 44 | #define	PIC_PLT(x)	x@plt | |
| 45 | #ifdef	__STDC__ | |
| 46 | #define	PIC_GOT(x)	XXX | |
| 47 | #else	/* not __STDC__ */ | |
| 48 | #define	PIC_GOT(x)	XXX | |
| 49 | #endif	/* __STDC__ */ | |
| 50 | #else | |
| 51 | #define	PIC_PROLOGUE | |
| 52 | #define	PIC_EPILOGUE | |
| 53 | #define	PIC_PLT(x)	x | |
| 54 | #define PIC_GOT(x)	x | |
| 55 | #endif | |
| 56 | ||
| 57 | #define	CNAME(csym)		csym | |
| 58 | #define	ASMNAME(asmsym)		asmsym | |
| 59 | #ifdef __powerpc64__ | |
| 60 | #define	HIDENAME(asmsym)	__CONCAT(_,asmsym) | |
| 61 | #else | |
| 62 | #define	HIDENAME(asmsym)	__CONCAT(.,asmsym) | |
| 63 | #endif | |
| 64 | ||
| 65 | #if !defined(_CALL_ELF) || _CALL_ELF == 1 | |
| 66 | #ifdef _KERNEL | |
| 67 | /* ELFv1 kernel uses global dot symbols */ | |
| 68 | #define	DOT_LABEL(name)		__CONCAT(.,name) | |
| 69 | #define	TYPE_ENTRY(name)	.size	name,24; \ | |
| 70 | 				.type	DOT_LABEL(name),@function; \ | |
| 71 | 				.globl	DOT_LABEL(name); | |
| 72 | #define	END_SIZE(name)		.size	DOT_LABEL(name),.-DOT_LABEL(name); | |
| 73 | #else /* !_KERNEL */ | |
| 74 | /* ELFv1 user code uses local function entry points */ | |
| 75 | #define	DOT_LABEL(name)		__CONCAT(.L.,name) | |
| 76 | #define	TYPE_ENTRY(name)	.type	name,@function; | |
| 77 | #define	END_SIZE(name)		.size	name,.-DOT_LABEL(name); | |
| 78 | #endif /* _KERNEL */ | |
| 79 | #else | |
| 80 | /* ELFv2 doesn't have any of this complication */ | |
| 81 | #define	DOT_LABEL(name)		name | |
| 82 | #define	TYPE_ENTRY(name)	.type	name,@function; | |
| 83 | #define	END_SIZE(name)		.size	name,.-DOT_LABEL(name); | |
| 84 | #endif | |
| 85 | ||
| 86 | #define	_GLOBAL(name) \ | |
| 87 | 	.data; \ | |
| 88 | 	.p2align 2; \ | |
| 89 | 	.globl	name; \ | |
| 90 | 	name: | |
| 91 | ||
| 92 | #ifdef __powerpc64__ | |
| 93 | #define TOC_NAME_FOR_REF(name)	__CONCAT(.L,name) | |
| 94 | #define	TOC_REF(name)	TOC_NAME_FOR_REF(name)@toc | |
| 95 | #define TOC_ENTRY(name) \ | |
| 96 | 	.section ".toc","aw"; \ | |
| 97 | 	TOC_NAME_FOR_REF(name): \ | |
| 98 | .tc name[TC],name | |
| 99 | #endif | |
| 100 | ||
| 101 | #ifdef __powerpc64__ | |
| 102 | ||
| 103 | #if !defined(_CALL_ELF) || _CALL_ELF == 1 | |
| 104 | #define	_ENTRY(name) \ | |
| 105 | 	.section ".text"; \ | |
| 106 | 	.p2align 2; \ | |
| 107 | 	.globl	name; \ | |
| 108 | 	.section ".opd","aw"; \ | |
| 109 | 	.p2align 3; \ | |
| 110 | name: \ | |
| 111 | 	.quad	DOT_LABEL(name),.TOC.@tocbase,0; \ | |
| 112 | 	.previous; \ | |
| 113 | 	.p2align 4; \ | |
| 114 | 	TYPE_ENTRY(name) \ | |
| 115 | DOT_LABEL(name): \ | |
| 116 | 	.cfi_startproc | |
| 117 | #define	_NAKED_ENTRY(name)	_ENTRY(name) | |
| 118 | #else | |
| 119 | #define	_ENTRY(name) \ | |
| 120 | 	.text; \ | |
| 121 | 	.p2align 4; \ | |
| 122 | 	.globl	name; \ | |
| 123 | 	.type	name,@function; \ | |
| 124 | name: \ | |
| 125 | 	.cfi_startproc; \ | |
| 126 | 	addis	%r2, %r12, (.TOC.-name)@ha; \ | |
| 127 | 	addi	%r2, %r2, (.TOC.-name)@l; \ | |
| 128 | 	.localentry name, .-name; | |
| 129 | ||
| 130 | /* "Naked" function entry. No TOC prologue for ELFv2. */ | |
| 131 | #define	_NAKED_ENTRY(name) \ | |
| 132 | 	.text; \ | |
| 133 | 	.p2align 4; \ | |
| 134 | 	.globl	name; \ | |
| 135 | 	.type	name,@function; \ | |
| 136 | name: \ | |
| 137 | 	.cfi_startproc; \ | |
| 138 | 	.localentry name, .-name; | |
| 139 | #endif | |
| 140 | ||
| 141 | #define	_END(name) \ | |
| 142 | 	.cfi_endproc; \ | |
| 143 | 	.long	0; \ | |
| 144 | 	.byte	0,0,0,0,0,0,0,0; \ | |
| 145 | 	END_SIZE(name) | |
| 146 | ||
| 147 | #define	LOAD_ADDR(reg, var) \ | |
| 148 | 	lis	reg, var@highest; \ | |
| 149 | 	ori	reg, reg, var@higher; \ | |
| 150 | 	rldicr	reg, reg, 32, 31; \ | |
| 151 | 	oris	reg, reg, var@h; \ | |
| 152 | 	ori	reg, reg, var@l; | |
| 153 | #else /* !__powerpc64__ */ | |
| 154 | #define	_ENTRY(name) \ | |
| 155 | 	.text; \ | |
| 156 | 	.p2align 4; \ | |
| 157 | 	.globl	name; \ | |
| 158 | 	.type	name,@function; \ | |
| 159 | name: \ | |
| 160 | 	.cfi_startproc | |
| 161 | #define	_END(name) \ | |
| 162 | 	.cfi_endproc; \ | |
| 163 | 	.size	name, . - name | |
| 164 | ||
| 165 | #define _NAKED_ENTRY(name)	_ENTRY(name) | |
| 166 | ||
| 167 | #define	LOAD_ADDR(reg, var) \ | |
| 168 | 	lis	reg, var@ha; \ | |
| 169 | 	ori	reg, reg, var@l; | |
| 170 | #endif /* __powerpc64__ */ | |
| 171 | ||
| 172 | #if defined(PROF) || (defined(_KERNEL) && defined(GPROF)) | |
| 173 | # ifdef __powerpc64__ | |
| 174 | # define	_PROF_PROLOGUE	mflr 0;					\ | |
| 175 | 				std 3,48(1);				\ | |
| 176 | 				std 4,56(1);				\ | |
| 177 | 				std 5,64(1);				\ | |
| 178 | 				std 0,16(1);				\ | |
| 179 | 				stdu 1,-112(1);				\ | |
| 180 | 				bl _mcount;				\ | |
| 181 | 				nop;					\ | |
| 182 | 				ld 0,112+16(1);				\ | |
| 183 | 				ld 3,112+48(1);				\ | |
| 184 | 				ld 4,112+56(1);				\ | |
| 185 | 				ld 5,112+64(1);				\ | |
| 186 | 				mtlr 0;					\ | |
| 187 | 				addi 1,1,112 | |
| 188 | # else | |
| 189 | # define	_PROF_PROLOGUE	mflr 0; stw 0,4(1); bl _mcount | |
| 190 | # endif | |
| 191 | #else | |
| 192 | # define	_PROF_PROLOGUE | |
| 193 | #endif | |
| 194 | ||
| 195 | #define	ASEND(y)	_END(ASMNAME(y)) | |
| 196 | #define	ASENTRY(y)	_ENTRY(ASMNAME(y)); _PROF_PROLOGUE | |
| 197 | #define	END(y)		_END(CNAME(y)) | |
| 198 | #define	ENTRY(y)	_ENTRY(CNAME(y)); _PROF_PROLOGUE | |
| 199 | #define	GLOBAL(y)	_GLOBAL(CNAME(y)) | |
| 200 | ||
| 201 | #define	ASENTRY_NOPROF(y)	_ENTRY(ASMNAME(y)) | |
| 202 | #define	ENTRY_NOPROF(y)		_ENTRY(CNAME(y)) | |
| 203 | ||
| 204 | /* Load NIA without affecting branch prediction */ | |
| 205 | #define	LOAD_LR_NIA	bcl	20, 31, .+4 | |
| 206 | ||
| 207 | /* | |
| 208 | * Magic sequence to return to native endian. | |
| 209 | * Overwrites r0 and r11. | |
| 210 | * | |
| 211 | * The encoding of the instruction "tdi 0, %r0, 0x48" in opposite endian | |
| 212 | * happens to be "b . + 8". This is useful because we can write a sequence | |
| 213 | * of instructions that can execute in either endian. | |
| 214 | * | |
| 215 | * Use a sequence of handcoded instructions that switches contexts to the | |
| 216 | * instruction following the sequence, but with the correct PSL_LE bit. | |
| 217 | * | |
| 218 | * The same sequence works for both BE and LE because the xori will flip | |
| 219 | * the bit to the other state, and the code only runs when running in the | |
| 220 | * wrong endian. | |
| 221 | * | |
| 222 | * This sequence is NMI-reentrant. | |
| 223 | * | |
| 224 | * Do not change the length of this sequence without looking at the users, | |
| 225 | * this is used in size-constrained places like the reset vector! | |
| 226 | */ | |
| 227 | #define	RETURN_TO_NATIVE_ENDIAN						 \ | |
| 228 | 	tdi	0, %r0, 0x48;	/* Endian swapped: b . + 8		*/\ | |
| 229 | 	b	1f;		/* Will fall through to here if correct */\ | |
| 230 | 	.long	0xa600607d;	/* mfmsr %r11				*/\ | |
| 231 | 	.long	0x00000038;	/* li %r0, 0				*/\ | |
| 232 | 	.long	0x6401617d;	/* mtmsrd %r0, 1 (L=1 EE,RI bits only)	*/\ | |
| 233 | 	.long	0x01006b69;	/* xori %r11, %r11, 0x1 (PSL_LE)	*/\ | |
| 234 | 	.long	0xa602087c;	/* mflr %r0				*/\ | |
| 235 | 	.long	0x05009f42;	/* LOAD_LR_NIA				*/\ | |
| 236 | 	.long	0xa6037b7d;	/* 0: mtsrr1 %r11			*/\ | |
| 237 | 	.long	0xa602687d;	/* mflr	%r11				*/\ | |
| 238 | 	.long	0x18006b39;	/* addi	%r11, %r11, (1f - 0b)		*/\ | |
| 239 | 	.long	0xa6037a7d;	/* mtsrr0 %r11				*/\ | |
| 240 | 	.long	0xa603087c;	/* mtlr %r0				*/\ | |
| 241 | 	.long	0x2400004c;	/* rfid					*/\ | |
| 242 | 1:	/* RETURN_TO_NATIVE_ENDIAN */ | |
| 243 | ||
| 244 | #define	ASMSTR		.asciz | |
| 245 | ||
| 246 | #define	RCSID(x)	.text; .asciz x | |
| 247 | ||
| 248 | #undef __FBSDID | |
| 249 | #if !defined(lint) && !defined(STRIP_FBSDID) | |
| 250 | #define __FBSDID(s)	.ident s | |
| 251 | #else | |
| 252 | #define __FBSDID(s)	/* nothing */ | |
| 253 | #endif /* not lint and not STRIP_FBSDID */ | |
| 254 | ||
| 255 | #define	WEAK_REFERENCE(sym, alias)				\ | |
| 256 | 	.weak alias;						\ | |
| 257 | 	.equ alias,sym | |
| 258 | ||
| 259 | #ifdef __STDC__ | |
| 260 | #define	WARN_REFERENCES(_sym,_msg)				\ | |
| 261 | 	.section .gnu.warning. ## _sym ; .ascii _msg ; .text | |
| 262 | #else | |
| 263 | #define	WARN_REFERENCES(_sym,_msg)				\ | |
| 264 | 	.section .gnu.warning./**/_sym ; .ascii _msg ; .text | |
| 265 | #endif /* __STDC__ */ | |
| 266 | ||
| 267 | #endif /* !_MACHINE_ASM_H_ */ | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/machine/atomic.h deleted-1148| ... | ... | @@ -1,1148 +0,0 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-2-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 2008 Marcel Moolenaar | |
| 5 | * Copyright (c) 2001 Benno Rice | |
| 6 | * Copyright (c) 2001 David E. O'Brien | |
| 7 | * Copyright (c) 1998 Doug Rabson | |
| 8 | * All rights reserved. | |
| 9 | * | |
| 10 | * Redistribution and use in source and binary forms, with or without | |
| 11 | * modification, are permitted provided that the following conditions | |
| 12 | * are met: | |
| 13 | * 1. Redistributions of source code must retain the above copyright | |
| 14 | * notice, this list of conditions and the following disclaimer. | |
| 15 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 16 | * notice, this list of conditions and the following disclaimer in the | |
| 17 | * documentation and/or other materials provided with the distribution. | |
| 18 | * | |
| 19 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |
| 20 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 21 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
| 22 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | |
| 23 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
| 24 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
| 25 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
| 26 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
| 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
| 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
| 29 | * SUCH DAMAGE. | |
| 30 | */ | |
| 31 | ||
| 32 | #ifndef _MACHINE_ATOMIC_H_ | |
| 33 | #define	_MACHINE_ATOMIC_H_ | |
| 34 | ||
| 35 | #include <sys/atomic_common.h> | |
| 36 | ||
| 37 | #ifndef __powerpc64__ | |
| 38 | #include <sys/_atomic64e.h> | |
| 39 | #endif | |
| 40 | ||
| 41 | /* | |
| 42 | * The __ATOMIC_REL/ACQ() macros provide memory barriers only in conjunction | |
| 43 | * with the atomic lXarx/stXcx. sequences below. They are not exposed outside | |
| 44 | * of this file. See also Appendix B.2 of Book II of the architecture manual. | |
| 45 | * | |
| 46 | * Note that not all Book-E processors accept the light-weight sync variant. | |
| 47 | * In particular, early models of E500 cores are known to wedge. Bank on all | |
| 48 | * 64-bit capable CPUs to accept lwsync properly and pressimize 32-bit CPUs | |
| 49 | * to use the heavier-weight sync. | |
| 50 | */ | |
| 51 | ||
| 52 | #ifdef __powerpc64__ | |
| 53 | #define mb()		__asm __volatile("sync" : : : "memory") | |
| 54 | #define rmb()		__asm __volatile("lwsync" : : : "memory") | |
| 55 | #define wmb()		__asm __volatile("lwsync" : : : "memory") | |
| 56 | #define __ATOMIC_REL()	__asm __volatile("lwsync" : : : "memory") | |
| 57 | #define __ATOMIC_ACQ()	__asm __volatile("isync" : : : "memory") | |
| 58 | #else | |
| 59 | #define mb()		__asm __volatile("sync" : : : "memory") | |
| 60 | #define rmb()		__asm __volatile("sync" : : : "memory") | |
| 61 | #define wmb()		__asm __volatile("sync" : : : "memory") | |
| 62 | #define __ATOMIC_REL()	__asm __volatile("sync" : : : "memory") | |
| 63 | #define __ATOMIC_ACQ()	__asm __volatile("isync" : : : "memory") | |
| 64 | #endif | |
| 65 | ||
| 66 | static __inline void | |
| 67 | powerpc_lwsync(void) | |
| 68 | { | |
| 69 | ||
| 70 | #ifdef __powerpc64__ | |
| 71 | 	__asm __volatile("lwsync" : : : "memory"); | |
| 72 | #else | |
| 73 | 	__asm __volatile("sync" : : : "memory"); | |
| 74 | #endif | |
| 75 | } | |
| 76 | ||
| 77 | /* | |
| 78 | * atomic_add(p, v) | |
| 79 | * { *p += v; } | |
| 80 | */ | |
| 81 | ||
| 82 | #define __atomic_add_int(p, v, t)				\ | |
| 83 | __asm __volatile(						\ | |
| 84 | 	"1:	lwarx	%0, 0, %2\n"				\ | |
| 85 | 	"	add	%0, %3, %0\n"				\ | |
| 86 | 	"	stwcx.	%0, 0, %2\n"				\ | |
| 87 | 	"	bne-	1b\n"					\ | |
| 88 | 	: "=&r" (t), "=m" (*p)					\ | |
| 89 | 	: "r" (p), "r" (v), "m" (*p)				\ | |
| 90 | 	: "cr0", "memory")					\ | |
| 91 | /* __atomic_add_int */ | |
| 92 | ||
| 93 | #ifdef __powerpc64__ | |
| 94 | #define __atomic_add_long(p, v, t)				\ | |
| 95 | __asm __volatile(						\ | |
| 96 | 	"1:	ldarx	%0, 0, %2\n"				\ | |
| 97 | 	"	add	%0, %3, %0\n"				\ | |
| 98 | 	"	stdcx.	%0, 0, %2\n"				\ | |
| 99 | 	"	bne-	1b\n"					\ | |
| 100 | 	: "=&r" (t), "=m" (*p)					\ | |
| 101 | 	: "r" (p), "r" (v), "m" (*p)				\ | |
| 102 | 	: "cr0", "memory")					\ | |
| 103 | /* __atomic_add_long */ | |
| 104 | #else | |
| 105 | #define	__atomic_add_long(p, v, t)				\ | |
| 106 | __asm __volatile(						\ | |
| 107 | 	"1:	lwarx	%0, 0, %2\n"				\ | |
| 108 | 	"	add	%0, %3, %0\n"				\ | |
| 109 | 	"	stwcx.	%0, 0, %2\n"				\ | |
| 110 | 	"	bne-	1b\n"					\ | |
| 111 | 	: "=&r" (t), "=m" (*p)					\ | |
| 112 | 	: "r" (p), "r" (v), "m" (*p)				\ | |
| 113 | 	: "cr0", "memory")					\ | |
| 114 | /* __atomic_add_long */ | |
| 115 | #endif | |
| 116 | ||
| 117 | #define	_ATOMIC_ADD(type)					\ | |
| 118 | static __inline void					\ | |
| 119 | atomic_add_##type(volatile u_##type *p, u_##type v) {	\ | |
| 120 | 	u_##type t;						\ | |
| 121 | 	__atomic_add_##type(p, v, t);				\ | |
| 122 | }								\ | |
| 123 | 								\ | |
| 124 | static __inline void					\ | |
| 125 | atomic_add_acq_##type(volatile u_##type *p, u_##type v) {	\ | |
| 126 | 	u_##type t;						\ | |
| 127 | 	__atomic_add_##type(p, v, t);				\ | |
| 128 | 	__ATOMIC_ACQ();						\ | |
| 129 | }								\ | |
| 130 | 								\ | |
| 131 | static __inline void					\ | |
| 132 | atomic_add_rel_##type(volatile u_##type *p, u_##type v) {	\ | |
| 133 | 	u_##type t;						\ | |
| 134 | 	__ATOMIC_REL();						\ | |
| 135 | 	__atomic_add_##type(p, v, t);				\ | |
| 136 | }								\ | |
| 137 | /* _ATOMIC_ADD */ | |
| 138 | ||
| 139 | _ATOMIC_ADD(int) | |
| 140 | _ATOMIC_ADD(long) | |
| 141 | ||
| 142 | #define	atomic_add_32		atomic_add_int | |
| 143 | #define	atomic_add_acq_32	atomic_add_acq_int | |
| 144 | #define	atomic_add_rel_32	atomic_add_rel_int | |
| 145 | ||
| 146 | #ifdef __powerpc64__ | |
| 147 | #define	atomic_add_64		atomic_add_long | |
| 148 | #define	atomic_add_acq_64	atomic_add_acq_long | |
| 149 | #define	atomic_add_rel_64	atomic_add_rel_long | |
| 150 | ||
| 151 | #define	atomic_add_ptr		atomic_add_long | |
| 152 | #define	atomic_add_acq_ptr	atomic_add_acq_long | |
| 153 | #define	atomic_add_rel_ptr	atomic_add_rel_long | |
| 154 | #else | |
| 155 | #define	atomic_add_ptr		atomic_add_int | |
| 156 | #define	atomic_add_acq_ptr	atomic_add_acq_int | |
| 157 | #define	atomic_add_rel_ptr	atomic_add_rel_int | |
| 158 | #endif | |
| 159 | #undef _ATOMIC_ADD | |
| 160 | #undef __atomic_add_long | |
| 161 | #undef __atomic_add_int | |
| 162 | ||
| 163 | /* | |
| 164 | * atomic_clear(p, v) | |
| 165 | * { *p &= ~v; } | |
| 166 | */ | |
| 167 | ||
| 168 | #define __atomic_clear_int(p, v, t)				\ | |
| 169 | __asm __volatile(						\ | |
| 170 | 	"1:	lwarx	%0, 0, %2\n"				\ | |
| 171 | 	"	andc	%0, %0, %3\n"				\ | |
| 172 | 	"	stwcx.	%0, 0, %2\n"				\ | |
| 173 | 	"	bne-	1b\n"					\ | |
| 174 | 	: "=&r" (t), "=m" (*p)					\ | |
| 175 | 	: "r" (p), "r" (v), "m" (*p)				\ | |
| 176 | 	: "cr0", "memory")					\ | |
| 177 | /* __atomic_clear_int */ | |
| 178 | ||
| 179 | #ifdef __powerpc64__ | |
| 180 | #define __atomic_clear_long(p, v, t)				\ | |
| 181 | __asm __volatile(						\ | |
| 182 | 	"1:	ldarx	%0, 0, %2\n"				\ | |
| 183 | 	"	andc	%0, %0, %3\n"				\ | |
| 184 | 	"	stdcx.	%0, 0, %2\n"				\ | |
| 185 | 	"	bne-	1b\n"					\ | |
| 186 | 	: "=&r" (t), "=m" (*p)					\ | |
| 187 | 	: "r" (p), "r" (v), "m" (*p)				\ | |
| 188 | 	: "cr0", "memory")					\ | |
| 189 | /* __atomic_clear_long */ | |
| 190 | #else | |
| 191 | #define	__atomic_clear_long(p, v, t)				\ | |
| 192 | __asm __volatile(						\ | |
| 193 | 	"1:	lwarx	%0, 0, %2\n"				\ | |
| 194 | 	"	andc	%0, %0, %3\n"				\ | |
| 195 | 	"	stwcx.	%0, 0, %2\n"				\ | |
| 196 | 	"	bne-	1b\n"					\ | |
| 197 | 	: "=&r" (t), "=m" (*p)					\ | |
| 198 | 	: "r" (p), "r" (v), "m" (*p)				\ | |
| 199 | 	: "cr0", "memory")					\ | |
| 200 | /* __atomic_clear_long */ | |
| 201 | #endif | |
| 202 | ||
| 203 | #define	_ATOMIC_CLEAR(type)					\ | |
| 204 | static __inline void					\ | |
| 205 | atomic_clear_##type(volatile u_##type *p, u_##type v) {	\ | |
| 206 | 	u_##type t;						\ | |
| 207 | 	__atomic_clear_##type(p, v, t);				\ | |
| 208 | }								\ | |
| 209 | 								\ | |
| 210 | static __inline void					\ | |
| 211 | atomic_clear_acq_##type(volatile u_##type *p, u_##type v) {	\ | |
| 212 | 	u_##type t;						\ | |
| 213 | 	__atomic_clear_##type(p, v, t);				\ | |
| 214 | 	__ATOMIC_ACQ();						\ | |
| 215 | }								\ | |
| 216 | 								\ | |
| 217 | static __inline void					\ | |
| 218 | atomic_clear_rel_##type(volatile u_##type *p, u_##type v) {	\ | |
| 219 | 	u_##type t;						\ | |
| 220 | 	__ATOMIC_REL();						\ | |
| 221 | 	__atomic_clear_##type(p, v, t);				\ | |
| 222 | }								\ | |
| 223 | /* _ATOMIC_CLEAR */ | |
| 224 | ||
| 225 | _ATOMIC_CLEAR(int) | |
| 226 | _ATOMIC_CLEAR(long) | |
| 227 | ||
| 228 | #define	atomic_clear_32		atomic_clear_int | |
| 229 | #define	atomic_clear_acq_32	atomic_clear_acq_int | |
| 230 | #define	atomic_clear_rel_32	atomic_clear_rel_int | |
| 231 | ||
| 232 | #ifdef __powerpc64__ | |
| 233 | #define	atomic_clear_64		atomic_clear_long | |
| 234 | #define	atomic_clear_acq_64	atomic_clear_acq_long | |
| 235 | #define	atomic_clear_rel_64	atomic_clear_rel_long | |
| 236 | ||
| 237 | #define	atomic_clear_ptr	atomic_clear_long | |
| 238 | #define	atomic_clear_acq_ptr	atomic_clear_acq_long | |
| 239 | #define	atomic_clear_rel_ptr	atomic_clear_rel_long | |
| 240 | #else | |
| 241 | #define	atomic_clear_ptr	atomic_clear_int | |
| 242 | #define	atomic_clear_acq_ptr	atomic_clear_acq_int | |
| 243 | #define	atomic_clear_rel_ptr	atomic_clear_rel_int | |
| 244 | #endif | |
| 245 | #undef _ATOMIC_CLEAR | |
| 246 | #undef __atomic_clear_long | |
| 247 | #undef __atomic_clear_int | |
| 248 | ||
| 249 | /* | |
| 250 | * atomic_cmpset(p, o, n) | |
| 251 | */ | |
| 252 | /* TODO -- see below */ | |
| 253 | ||
| 254 | /* | |
| 255 | * atomic_load_acq(p) | |
| 256 | */ | |
| 257 | /* TODO -- see below */ | |
| 258 | ||
| 259 | /* | |
| 260 | * atomic_readandclear(p) | |
| 261 | */ | |
| 262 | /* TODO -- see below */ | |
| 263 | ||
| 264 | /* | |
| 265 | * atomic_set(p, v) | |
| 266 | * { *p |= v; } | |
| 267 | */ | |
| 268 | ||
| 269 | #define __atomic_set_int(p, v, t)				\ | |
| 270 | __asm __volatile(						\ | |
| 271 | 	"1:	lwarx	%0, 0, %2\n"				\ | |
| 272 | 	"	or	%0, %3, %0\n"				\ | |
| 273 | 	"	stwcx.	%0, 0, %2\n"				\ | |
| 274 | 	"	bne-	1b\n"					\ | |
| 275 | 	: "=&r" (t), "=m" (*p)					\ | |
| 276 | 	: "r" (p), "r" (v), "m" (*p)				\ | |
| 277 | 	: "cr0", "memory")					\ | |
| 278 | /* __atomic_set_int */ | |
| 279 | ||
| 280 | #ifdef __powerpc64__ | |
| 281 | #define __atomic_set_long(p, v, t)				\ | |
| 282 | __asm __volatile(						\ | |
| 283 | 	"1:	ldarx	%0, 0, %2\n"				\ | |
| 284 | 	"	or	%0, %3, %0\n"				\ | |
| 285 | 	"	stdcx.	%0, 0, %2\n"				\ | |
| 286 | 	"	bne-	1b\n"					\ | |
| 287 | 	: "=&r" (t), "=m" (*p)					\ | |
| 288 | 	: "r" (p), "r" (v), "m" (*p)				\ | |
| 289 | 	: "cr0", "memory")					\ | |
| 290 | /* __atomic_set_long */ | |
| 291 | #else | |
| 292 | #define	__atomic_set_long(p, v, t)				\ | |
| 293 | __asm __volatile(						\ | |
| 294 | 	"1:	lwarx	%0, 0, %2\n"				\ | |
| 295 | 	"	or	%0, %3, %0\n"				\ | |
| 296 | 	"	stwcx.	%0, 0, %2\n"				\ | |
| 297 | 	"	bne-	1b\n"					\ | |
| 298 | 	: "=&r" (t), "=m" (*p)					\ | |
| 299 | 	: "r" (p), "r" (v), "m" (*p)				\ | |
| 300 | 	: "cr0", "memory")					\ | |
| 301 | /* __atomic_set_long */ | |
| 302 | #endif | |
| 303 | ||
| 304 | #define	_ATOMIC_SET(type)					\ | |
| 305 | static __inline void					\ | |
| 306 | atomic_set_##type(volatile u_##type *p, u_##type v) {	\ | |
| 307 | 	u_##type t;						\ | |
| 308 | 	__atomic_set_##type(p, v, t);				\ | |
| 309 | }								\ | |
| 310 | 								\ | |
| 311 | static __inline void					\ | |
| 312 | atomic_set_acq_##type(volatile u_##type *p, u_##type v) {	\ | |
| 313 | 	u_##type t;						\ | |
| 314 | 	__atomic_set_##type(p, v, t);				\ | |
| 315 | 	__ATOMIC_ACQ();						\ | |
| 316 | }								\ | |
| 317 | 								\ | |
| 318 | static __inline void					\ | |
| 319 | atomic_set_rel_##type(volatile u_##type *p, u_##type v) {	\ | |
| 320 | 	u_##type t;						\ | |
| 321 | 	__ATOMIC_REL();						\ | |
| 322 | 	__atomic_set_##type(p, v, t);				\ | |
| 323 | }								\ | |
| 324 | /* _ATOMIC_SET */ | |
| 325 | ||
| 326 | _ATOMIC_SET(int) | |
| 327 | _ATOMIC_SET(long) | |
| 328 | ||
| 329 | #define	atomic_set_32		atomic_set_int | |
| 330 | #define	atomic_set_acq_32	atomic_set_acq_int | |
| 331 | #define	atomic_set_rel_32	atomic_set_rel_int | |
| 332 | ||
| 333 | #ifdef __powerpc64__ | |
| 334 | #define	atomic_set_64		atomic_set_long | |
| 335 | #define	atomic_set_acq_64	atomic_set_acq_long | |
| 336 | #define	atomic_set_rel_64	atomic_set_rel_long | |
| 337 | ||
| 338 | #define	atomic_set_ptr		atomic_set_long | |
| 339 | #define	atomic_set_acq_ptr	atomic_set_acq_long | |
| 340 | #define	atomic_set_rel_ptr	atomic_set_rel_long | |
| 341 | #else | |
| 342 | #define	atomic_set_ptr		atomic_set_int | |
| 343 | #define	atomic_set_acq_ptr	atomic_set_acq_int | |
| 344 | #define	atomic_set_rel_ptr	atomic_set_rel_int | |
| 345 | #endif | |
| 346 | #undef _ATOMIC_SET | |
| 347 | #undef __atomic_set_long | |
| 348 | #undef __atomic_set_int | |
| 349 | ||
| 350 | /* | |
| 351 | * atomic_subtract(p, v) | |
| 352 | * { *p -= v; } | |
| 353 | */ | |
| 354 | ||
| 355 | #define __atomic_subtract_int(p, v, t)				\ | |
| 356 | __asm __volatile(						\ | |
| 357 | 	"1:	lwarx	%0, 0, %2\n"				\ | |
| 358 | 	"	subf	%0, %3, %0\n"				\ | |
| 359 | 	"	stwcx.	%0, 0, %2\n"				\ | |
| 360 | 	"	bne-	1b\n"					\ | |
| 361 | 	: "=&r" (t), "=m" (*p)					\ | |
| 362 | 	: "r" (p), "r" (v), "m" (*p)				\ | |
| 363 | 	: "cr0", "memory")					\ | |
| 364 | /* __atomic_subtract_int */ | |
| 365 | ||
| 366 | #ifdef __powerpc64__ | |
| 367 | #define __atomic_subtract_long(p, v, t)				\ | |
| 368 | __asm __volatile(						\ | |
| 369 | 	"1:	ldarx	%0, 0, %2\n"				\ | |
| 370 | 	"	subf	%0, %3, %0\n"				\ | |
| 371 | 	"	stdcx.	%0, 0, %2\n"				\ | |
| 372 | 	"	bne-	1b\n"					\ | |
| 373 | 	: "=&r" (t), "=m" (*p)					\ | |
| 374 | 	: "r" (p), "r" (v), "m" (*p)				\ | |
| 375 | 	: "cr0", "memory")					\ | |
| 376 | /* __atomic_subtract_long */ | |
| 377 | #else | |
| 378 | #define	__atomic_subtract_long(p, v, t)				\ | |
| 379 | __asm __volatile(						\ | |
| 380 | 	"1:	lwarx	%0, 0, %2\n"				\ | |
| 381 | 	"	subf	%0, %3, %0\n"				\ | |
| 382 | 	"	stwcx.	%0, 0, %2\n"				\ | |
| 383 | 	"	bne-	1b\n"					\ | |
| 384 | 	: "=&r" (t), "=m" (*p)					\ | |
| 385 | 	: "r" (p), "r" (v), "m" (*p)				\ | |
| 386 | 	: "cr0", "memory")					\ | |
| 387 | /* __atomic_subtract_long */ | |
| 388 | #endif | |
| 389 | ||
| 390 | #define	_ATOMIC_SUBTRACT(type)						\ | |
| 391 | static __inline void						\ | |
| 392 | atomic_subtract_##type(volatile u_##type *p, u_##type v) {		\ | |
| 393 | 	u_##type t;							\ | |
| 394 | 	__atomic_subtract_##type(p, v, t);				\ | |
| 395 | }									\ | |
| 396 | 									\ | |
| 397 | static __inline void						\ | |
| 398 | atomic_subtract_acq_##type(volatile u_##type *p, u_##type v) {	\ | |
| 399 | 	u_##type t;							\ | |
| 400 | 	__atomic_subtract_##type(p, v, t);				\ | |
| 401 | 	__ATOMIC_ACQ();							\ | |
| 402 | }									\ | |
| 403 | 									\ | |
| 404 | static __inline void						\ | |
| 405 | atomic_subtract_rel_##type(volatile u_##type *p, u_##type v) {	\ | |
| 406 | 	u_##type t;							\ | |
| 407 | 	__ATOMIC_REL();							\ | |
| 408 | 	__atomic_subtract_##type(p, v, t);				\ | |
| 409 | }									\ | |
| 410 | /* _ATOMIC_SUBTRACT */ | |
| 411 | ||
| 412 | _ATOMIC_SUBTRACT(int) | |
| 413 | _ATOMIC_SUBTRACT(long) | |
| 414 | ||
| 415 | #define	atomic_subtract_32	atomic_subtract_int | |
| 416 | #define	atomic_subtract_acq_32	atomic_subtract_acq_int | |
| 417 | #define	atomic_subtract_rel_32	atomic_subtract_rel_int | |
| 418 | ||
| 419 | #ifdef __powerpc64__ | |
| 420 | #define	atomic_subtract_64	atomic_subtract_long | |
| 421 | #define	atomic_subtract_acq_64	atomic_subract_acq_long | |
| 422 | #define	atomic_subtract_rel_64	atomic_subtract_rel_long | |
| 423 | ||
| 424 | #define	atomic_subtract_ptr	atomic_subtract_long | |
| 425 | #define	atomic_subtract_acq_ptr	atomic_subtract_acq_long | |
| 426 | #define	atomic_subtract_rel_ptr	atomic_subtract_rel_long | |
| 427 | #else | |
| 428 | #define	atomic_subtract_ptr	atomic_subtract_int | |
| 429 | #define	atomic_subtract_acq_ptr	atomic_subtract_acq_int | |
| 430 | #define	atomic_subtract_rel_ptr	atomic_subtract_rel_int | |
| 431 | #endif | |
| 432 | #undef _ATOMIC_SUBTRACT | |
| 433 | #undef __atomic_subtract_long | |
| 434 | #undef __atomic_subtract_int | |
| 435 | ||
| 436 | /* | |
| 437 | * atomic_store_rel(p, v) | |
| 438 | */ | |
| 439 | /* TODO -- see below */ | |
| 440 | ||
| 441 | /* | |
| 442 | * Old/original implementations that still need revisiting. | |
| 443 | */ | |
| 444 | ||
| 445 | static __inline u_int | |
| 446 | atomic_readandclear_int(volatile u_int *addr) | |
| 447 | { | |
| 448 | 	u_int result,temp; | |
| 449 | ||
| 450 | 	__asm __volatile ( | |
| 451 | 		"\tsync\n"			/* drain writes */ | |
| 452 | 		"1:\tlwarx %0, 0, %3\n\t"	/* load old value */ | |
| 453 | 		"li %1, 0\n\t"			/* load new value */ | |
| 454 | 		"stwcx. %1, 0, %3\n\t" 	/* attempt to store */ | |
| 455 | 		"bne- 1b\n\t"			/* spin if failed */ | |
| 456 | 		: "=&r"(result), "=&r"(temp), "=m" (*addr) | |
| 457 | 		: "r" (addr), "m" (*addr) | |
| 458 | 		: "cr0", "memory"); | |
| 459 | ||
| 460 | 	return (result); | |
| 461 | } | |
| 462 | ||
| 463 | #ifdef __powerpc64__ | |
| 464 | static __inline u_long | |
| 465 | atomic_readandclear_long(volatile u_long *addr) | |
| 466 | { | |
| 467 | 	u_long result,temp; | |
| 468 | ||
| 469 | 	__asm __volatile ( | |
| 470 | 		"\tsync\n"			/* drain writes */ | |
| 471 | 		"1:\tldarx %0, 0, %3\n\t"	/* load old value */ | |
| 472 | 		"li %1, 0\n\t"			/* load new value */ | |
| 473 | 		"stdcx. %1, 0, %3\n\t" 	/* attempt to store */ | |
| 474 | 		"bne- 1b\n\t"			/* spin if failed */ | |
| 475 | 		: "=&r"(result), "=&r"(temp), "=m" (*addr) | |
| 476 | 		: "r" (addr), "m" (*addr) | |
| 477 | 		: "cr0", "memory"); | |
| 478 | ||
| 479 | 	return (result); | |
| 480 | } | |
| 481 | #endif | |
| 482 | ||
| 483 | #define	atomic_readandclear_32		atomic_readandclear_int | |
| 484 | ||
| 485 | #ifdef __powerpc64__ | |
| 486 | #define	atomic_readandclear_64		atomic_readandclear_long | |
| 487 | ||
| 488 | #define	atomic_readandclear_ptr		atomic_readandclear_long | |
| 489 | #else | |
| 490 | static __inline u_long | |
| 491 | atomic_readandclear_long(volatile u_long *addr) | |
| 492 | { | |
| 493 | ||
| 494 | 	return ((u_long)atomic_readandclear_int((volatile u_int *)addr)); | |
| 495 | } | |
| 496 | ||
| 497 | #define	atomic_readandclear_ptr		atomic_readandclear_int | |
| 498 | #endif | |
| 499 | ||
| 500 | /* | |
| 501 | * We assume that a = b will do atomic loads and stores. | |
| 502 | */ | |
| 503 | #define	ATOMIC_STORE_LOAD(TYPE)					\ | |
| 504 | static __inline u_##TYPE					\ | |
| 505 | atomic_load_acq_##TYPE(volatile u_##TYPE *p)			\ | |
| 506 | {								\ | |
| 507 | 	u_##TYPE v;						\ | |
| 508 | 								\ | |
| 509 | 	v = *p;							\ | |
| 510 | 	powerpc_lwsync();					\ | |
| 511 | 	return (v);						\ | |
| 512 | }								\ | |
| 513 | 								\ | |
| 514 | static __inline void						\ | |
| 515 | atomic_store_rel_##TYPE(volatile u_##TYPE *p, u_##TYPE v)	\ | |
| 516 | {								\ | |
| 517 | 								\ | |
| 518 | 	powerpc_lwsync();					\ | |
| 519 | 	*p = v;							\ | |
| 520 | } | |
| 521 | ||
| 522 | ATOMIC_STORE_LOAD(int) | |
| 523 | ||
| 524 | #define	atomic_load_acq_32	atomic_load_acq_int | |
| 525 | #define	atomic_store_rel_32	atomic_store_rel_int | |
| 526 | ||
| 527 | #ifdef __powerpc64__ | |
| 528 | ATOMIC_STORE_LOAD(long) | |
| 529 | ||
| 530 | #define	atomic_load_acq_64	atomic_load_acq_long | |
| 531 | #define	atomic_store_rel_64	atomic_store_rel_long | |
| 532 | ||
| 533 | #define	atomic_load_acq_ptr	atomic_load_acq_long | |
| 534 | #define	atomic_store_rel_ptr	atomic_store_rel_long | |
| 535 | #else | |
| 536 | static __inline u_long | |
| 537 | atomic_load_acq_long(volatile u_long *addr) | |
| 538 | { | |
| 539 | ||
| 540 | 	return ((u_long)atomic_load_acq_int((volatile u_int *)addr)); | |
| 541 | } | |
| 542 | ||
| 543 | static __inline void | |
| 544 | atomic_store_rel_long(volatile u_long *addr, u_long val) | |
| 545 | { | |
| 546 | ||
| 547 | 	atomic_store_rel_int((volatile u_int *)addr, (u_int)val); | |
| 548 | } | |
| 549 | ||
| 550 | #define	atomic_load_acq_ptr	atomic_load_acq_int | |
| 551 | #define	atomic_store_rel_ptr	atomic_store_rel_int | |
| 552 | #endif | |
| 553 | #undef ATOMIC_STORE_LOAD | |
| 554 | ||
| 555 | /* | |
| 556 | * Atomically compare the value stored at *p with cmpval and if the | |
| 557 | * two values are equal, update the value of *p with newval. Returns | |
| 558 | * zero if the compare failed, nonzero otherwise. | |
| 559 | */ | |
| 560 | #ifdef ISA_206_ATOMICS | |
| 561 | static __inline int | |
| 562 | atomic_cmpset_char(volatile u_char *p, u_char cmpval, u_char newval) | |
| 563 | { | |
| 564 | 	int	ret; | |
| 565 | ||
| 566 | 	__asm __volatile ( | |
| 567 | 		"1:\tlbarx %0, 0, %2\n\t"	/* load old value */ | |
| 568 | 		"cmplw %3, %0\n\t"		/* compare */ | |
| 569 | 		"bne- 2f\n\t"			/* exit if not equal */ | |
| 570 | 		"stbcx. %4, 0, %2\n\t" 	/* attempt to store */ | |
| 571 | 		"bne- 1b\n\t"			/* spin if failed */ | |
| 572 | 		"li %0, 1\n\t"			/* success - retval = 1 */ | |
| 573 | 		"b 3f\n\t"			/* we've succeeded */ | |
| 574 | 		"2:\n\t" | |
| 575 | 		"stbcx. %0, 0, %2\n\t" 	/* clear reservation (74xx) */ | |
| 576 | 		"li %0, 0\n\t"			/* failure - retval = 0 */ | |
| 577 | 		"3:\n\t" | |
| 578 | 		: "=&r" (ret), "=m" (*p) | |
| 579 | 		: "r" (p), "r" (cmpval), "r" (newval), "m" (*p) | |
| 580 | 		: "cr0", "memory"); | |
| 581 | ||
| 582 | 	return (ret); | |
| 583 | } | |
| 584 | ||
| 585 | static __inline int | |
| 586 | atomic_cmpset_short(volatile u_short *p, u_short cmpval, u_short newval) | |
| 587 | { | |
| 588 | 	int	ret; | |
| 589 | ||
| 590 | 	__asm __volatile ( | |
| 591 | 		"1:\tlharx %0, 0, %2\n\t"	/* load old value */ | |
| 592 | 		"cmplw %3, %0\n\t"		/* compare */ | |
| 593 | 		"bne- 2f\n\t"			/* exit if not equal */ | |
| 594 | 		"sthcx. %4, 0, %2\n\t" 	/* attempt to store */ | |
| 595 | 		"bne- 1b\n\t"			/* spin if failed */ | |
| 596 | 		"li %0, 1\n\t"			/* success - retval = 1 */ | |
| 597 | 		"b 3f\n\t"			/* we've succeeded */ | |
| 598 | 		"2:\n\t" | |
| 599 | 		"sthcx. %0, 0, %2\n\t" 	/* clear reservation (74xx) */ | |
| 600 | 		"li %0, 0\n\t"			/* failure - retval = 0 */ | |
| 601 | 		"3:\n\t" | |
| 602 | 		: "=&r" (ret), "=m" (*p) | |
| 603 | 		: "r" (p), "r" (cmpval), "r" (newval), "m" (*p) | |
| 604 | 		: "cr0", "memory"); | |
| 605 | ||
| 606 | 	return (ret); | |
| 607 | } | |
| 608 | #else | |
| 609 | static __inline int | |
| 610 | atomic_cmpset_masked(uint32_t *p, uint32_t cmpval, uint32_t newval, | |
| 611 | uint32_t mask) | |
| 612 | { | |
| 613 | 	int		ret; | |
| 614 | 	uint32_t	tmp; | |
| 615 | ||
| 616 | 	__asm __volatile ( | |
| 617 | 		"1:\tlwarx %2, 0, %3\n\t"	/* load old value */ | |
| 618 | 		"and %0, %2, %7\n\t" | |
| 619 | 		"cmplw %4, %0\n\t"		/* compare */ | |
| 620 | 		"bne- 2f\n\t"			/* exit if not equal */ | |
| 621 | 		"andc %2, %2, %7\n\t" | |
| 622 | 		"or %2, %2, %5\n\t" | |
| 623 | 		"stwcx. %2, 0, %3\n\t" 	/* attempt to store */ | |
| 624 | 		"bne- 1b\n\t"			/* spin if failed */ | |
| 625 | 		"li %0, 1\n\t"			/* success - retval = 1 */ | |
| 626 | 		"b 3f\n\t"			/* we've succeeded */ | |
| 627 | 		"2:\n\t" | |
| 628 | 		"stwcx. %2, 0, %3\n\t" 	/* clear reservation (74xx) */ | |
| 629 | 		"li %0, 0\n\t"			/* failure - retval = 0 */ | |
| 630 | 		"3:\n\t" | |
| 631 | 		: "=&r" (ret), "=m" (*p), "+&r" (tmp) | |
| 632 | 		: "r" (p), "r" (cmpval), "r" (newval), "m" (*p), | |
| 633 | 		 "r" (mask) | |
| 634 | 		: "cr0", "memory"); | |
| 635 | ||
| 636 | 	return (ret); | |
| 637 | } | |
| 638 | ||
| 639 | #define	_atomic_cmpset_masked_word(a,o,v,m) atomic_cmpset_masked(a, o, v, m) | |
| 640 | #endif | |
| 641 | ||
| 642 | static __inline int | |
| 643 | atomic_cmpset_int(volatile u_int* p, u_int cmpval, u_int newval) | |
| 644 | { | |
| 645 | 	int	ret; | |
| 646 | ||
| 647 | 	__asm __volatile ( | |
| 648 | 		"1:\tlwarx %0, 0, %2\n\t"	/* load old value */ | |
| 649 | 		"cmplw %3, %0\n\t"		/* compare */ | |
| 650 | 		"bne- 2f\n\t"			/* exit if not equal */ | |
| 651 | 		"stwcx. %4, 0, %2\n\t" 	/* attempt to store */ | |
| 652 | 		"bne- 1b\n\t"			/* spin if failed */ | |
| 653 | 		"li %0, 1\n\t"			/* success - retval = 1 */ | |
| 654 | 		"b 3f\n\t"			/* we've succeeded */ | |
| 655 | 		"2:\n\t" | |
| 656 | 		"stwcx. %0, 0, %2\n\t" 	/* clear reservation (74xx) */ | |
| 657 | 		"li %0, 0\n\t"			/* failure - retval = 0 */ | |
| 658 | 		"3:\n\t" | |
| 659 | 		: "=&r" (ret), "=m" (*p) | |
| 660 | 		: "r" (p), "r" (cmpval), "r" (newval), "m" (*p) | |
| 661 | 		: "cr0", "memory"); | |
| 662 | ||
| 663 | 	return (ret); | |
| 664 | } | |
| 665 | static __inline int | |
| 666 | atomic_cmpset_long(volatile u_long* p, u_long cmpval, u_long newval) | |
| 667 | { | |
| 668 | 	int ret; | |
| 669 | ||
| 670 | 	__asm __volatile ( | |
| 671 | 	 #ifdef __powerpc64__ | |
| 672 | 		"1:\tldarx %0, 0, %2\n\t"	/* load old value */ | |
| 673 | 		"cmpld %3, %0\n\t"		/* compare */ | |
| 674 | 		"bne- 2f\n\t"			/* exit if not equal */ | |
| 675 | 		"stdcx. %4, 0, %2\n\t"		/* attempt to store */ | |
| 676 | 	 #else | |
| 677 | 		"1:\tlwarx %0, 0, %2\n\t"	/* load old value */ | |
| 678 | 		"cmplw %3, %0\n\t"		/* compare */ | |
| 679 | 		"bne- 2f\n\t"			/* exit if not equal */ | |
| 680 | 		"stwcx. %4, 0, %2\n\t"		/* attempt to store */ | |
| 681 | 	 #endif | |
| 682 | 		"bne- 1b\n\t"			/* spin if failed */ | |
| 683 | 		"li %0, 1\n\t"			/* success - retval = 1 */ | |
| 684 | 		"b 3f\n\t"			/* we've succeeded */ | |
| 685 | 		"2:\n\t" | |
| 686 | 	 #ifdef __powerpc64__ | |
| 687 | 		"stdcx. %0, 0, %2\n\t"		/* clear reservation (74xx) */ | |
| 688 | 	 #else | |
| 689 | 		"stwcx. %0, 0, %2\n\t"		/* clear reservation (74xx) */ | |
| 690 | 	 #endif | |
| 691 | 		"li %0, 0\n\t"			/* failure - retval = 0 */ | |
| 692 | 		"3:\n\t" | |
| 693 | 		: "=&r" (ret), "=m" (*p) | |
| 694 | 		: "r" (p), "r" (cmpval), "r" (newval), "m" (*p) | |
| 695 | 		: "cr0", "memory"); | |
| 696 | ||
| 697 | 	return (ret); | |
| 698 | } | |
| 699 | ||
| 700 | #define	ATOMIC_CMPSET_ACQ_REL(type) \ | |
| 701 | static __inline int \ | |
| 702 | atomic_cmpset_acq_##type(volatile u_##type *p, \ | |
| 703 | 	 u_##type cmpval, u_##type newval)\ | |
| 704 | {\ | |
| 705 | 	u_##type retval; \ | |
| 706 | 	retval = atomic_cmpset_##type(p, cmpval, newval);\ | |
| 707 | 	__ATOMIC_ACQ();\ | |
| 708 | 	return (retval);\ | |
| 709 | }\ | |
| 710 | static __inline int \ | |
| 711 | atomic_cmpset_rel_##type(volatile u_##type *p, \ | |
| 712 | 	 u_##type cmpval, u_##type newval)\ | |
| 713 | {\ | |
| 714 | 	__ATOMIC_REL();\ | |
| 715 | 	return (atomic_cmpset_##type(p, cmpval, newval));\ | |
| 716 | }\ | |
| 717 | struct hack | |
| 718 | ||
| 719 | ATOMIC_CMPSET_ACQ_REL(int); | |
| 720 | ATOMIC_CMPSET_ACQ_REL(long); | |
| 721 | ||
| 722 | #ifdef ISA_206_ATOMICS | |
| 723 | #define	atomic_cmpset_8		atomic_cmpset_char | |
| 724 | #endif | |
| 725 | #define	atomic_cmpset_acq_8	atomic_cmpset_acq_char | |
| 726 | #define	atomic_cmpset_rel_8	atomic_cmpset_rel_char | |
| 727 | ||
| 728 | #ifdef ISA_206_ATOMICS | |
| 729 | #define	atomic_cmpset_16	atomic_cmpset_short | |
| 730 | #endif | |
| 731 | #define	atomic_cmpset_acq_16	atomic_cmpset_acq_short | |
| 732 | #define	atomic_cmpset_rel_16	atomic_cmpset_rel_short | |
| 733 | ||
| 734 | #define	atomic_cmpset_32	atomic_cmpset_int | |
| 735 | #define	atomic_cmpset_acq_32	atomic_cmpset_acq_int | |
| 736 | #define	atomic_cmpset_rel_32	atomic_cmpset_rel_int | |
| 737 | ||
| 738 | #ifdef __powerpc64__ | |
| 739 | #define	atomic_cmpset_64	atomic_cmpset_long | |
| 740 | #define	atomic_cmpset_acq_64	atomic_cmpset_acq_long | |
| 741 | #define	atomic_cmpset_rel_64	atomic_cmpset_rel_long | |
| 742 | ||
| 743 | #define	atomic_cmpset_ptr	atomic_cmpset_long | |
| 744 | #define	atomic_cmpset_acq_ptr	atomic_cmpset_acq_long | |
| 745 | #define	atomic_cmpset_rel_ptr	atomic_cmpset_rel_long | |
| 746 | #else | |
| 747 | #define	atomic_cmpset_ptr	atomic_cmpset_int | |
| 748 | #define	atomic_cmpset_acq_ptr	atomic_cmpset_acq_int | |
| 749 | #define	atomic_cmpset_rel_ptr	atomic_cmpset_rel_int | |
| 750 | #endif | |
| 751 | ||
| 752 | /* | |
| 753 | * Atomically compare the value stored at *p with *cmpval and if the | |
| 754 | * two values are equal, update the value of *p with newval. Returns | |
| 755 | * zero if the compare failed and sets *cmpval to the read value from *p, | |
| 756 | * nonzero otherwise. | |
| 757 | */ | |
| 758 | #ifdef ISA_206_ATOMICS | |
| 759 | static __inline int | |
| 760 | atomic_fcmpset_char(volatile u_char *p, u_char *cmpval, u_char newval) | |
| 761 | { | |
| 762 | 	int	ret; | |
| 763 | ||
| 764 | 	__asm __volatile ( | |
| 765 | 		"lbarx %0, 0, %3\n\t"		/* load old value */ | |
| 766 | 		"cmplw %4, %0\n\t"		/* compare */ | |
| 767 | 		"bne- 1f\n\t"			/* exit if not equal */ | |
| 768 | 		"stbcx. %5, 0, %3\n\t" 	/* attempt to store */ | |
| 769 | 		"bne- 1f\n\t"			/* exit if failed */ | |
| 770 | 		"li %0, 1\n\t"			/* success - retval = 1 */ | |
| 771 | 		"b 2f\n\t"			/* we've succeeded */ | |
| 772 | 		"1:\n\t" | |
| 773 | 		"stbcx. %0, 0, %3\n\t" 	/* clear reservation (74xx) */ | |
| 774 | 		"stbx %0, 0, %7\n\t" | |
| 775 | 		"li %0, 0\n\t"			/* failure - retval = 0 */ | |
| 776 | 		"2:\n\t" | |
| 777 | 		: "=&r" (ret), "=m" (*p), "=m" (*cmpval) | |
| 778 | 		: "r" (p), "r" (*cmpval), "r" (newval), "m" (*p), "r"(cmpval) | |
| 779 | 		: "cr0", "memory"); | |
| 780 | ||
| 781 | 	return (ret); | |
| 782 | } | |
| 783 | ||
| 784 | static __inline int | |
| 785 | atomic_fcmpset_short(volatile u_short *p, u_short *cmpval, u_short newval) | |
| 786 | { | |
| 787 | 	int	ret; | |
| 788 | ||
| 789 | 	__asm __volatile ( | |
| 790 | 		"lharx %0, 0, %3\n\t"		/* load old value */ | |
| 791 | 		"cmplw %4, %0\n\t"		/* compare */ | |
| 792 | 		"bne- 1f\n\t"			/* exit if not equal */ | |
| 793 | 		"sthcx. %5, 0, %3\n\t" 	/* attempt to store */ | |
| 794 | 		"bne- 1f\n\t"			/* exit if failed */ | |
| 795 | 		"li %0, 1\n\t"			/* success - retval = 1 */ | |
| 796 | 		"b 2f\n\t"			/* we've succeeded */ | |
| 797 | 		"1:\n\t" | |
| 798 | 		"sthcx. %0, 0, %3\n\t" 	/* clear reservation (74xx) */ | |
| 799 | 		"sthx %0, 0, %7\n\t" | |
| 800 | 		"li %0, 0\n\t"			/* failure - retval = 0 */ | |
| 801 | 		"2:\n\t" | |
| 802 | 		: "=&r" (ret), "=m" (*p), "=m" (*cmpval) | |
| 803 | 		: "r" (p), "r" (*cmpval), "r" (newval), "m" (*p), "r"(cmpval) | |
| 804 | 		: "cr0", "memory"); | |
| 805 | ||
| 806 | 	return (ret); | |
| 807 | } | |
| 808 | #endif	/* ISA_206_ATOMICS */ | |
| 809 | ||
| 810 | static __inline int | |
| 811 | atomic_fcmpset_int(volatile u_int *p, u_int *cmpval, u_int newval) | |
| 812 | { | |
| 813 | 	int	ret; | |
| 814 | ||
| 815 | 	__asm __volatile ( | |
| 816 | 		"lwarx %0, 0, %3\n\t"		/* load old value */ | |
| 817 | 		"cmplw %4, %0\n\t"		/* compare */ | |
| 818 | 		"bne- 1f\n\t"			/* exit if not equal */ | |
| 819 | 		"stwcx. %5, 0, %3\n\t" 	/* attempt to store */ | |
| 820 | 		"bne- 1f\n\t"			/* exit if failed */ | |
| 821 | 		"li %0, 1\n\t"			/* success - retval = 1 */ | |
| 822 | 		"b 2f\n\t"			/* we've succeeded */ | |
| 823 | 		"1:\n\t" | |
| 824 | 		"stwcx. %0, 0, %3\n\t" 	/* clear reservation (74xx) */ | |
| 825 | 		"stwx %0, 0, %7\n\t" | |
| 826 | 		"li %0, 0\n\t"			/* failure - retval = 0 */ | |
| 827 | 		"2:\n\t" | |
| 828 | 		: "=&r" (ret), "=m" (*p), "=m" (*cmpval) | |
| 829 | 		: "r" (p), "r" (*cmpval), "r" (newval), "m" (*p), "r"(cmpval) | |
| 830 | 		: "cr0", "memory"); | |
| 831 | ||
| 832 | 	return (ret); | |
| 833 | } | |
| 834 | static __inline int | |
| 835 | atomic_fcmpset_long(volatile u_long *p, u_long *cmpval, u_long newval) | |
| 836 | { | |
| 837 | 	int ret; | |
| 838 | ||
| 839 | 	__asm __volatile ( | |
| 840 | 	 #ifdef __powerpc64__ | |
| 841 | 		"ldarx %0, 0, %3\n\t"		/* load old value */ | |
| 842 | 		"cmpld %4, %0\n\t"		/* compare */ | |
| 843 | 		"bne- 1f\n\t"			/* exit if not equal */ | |
| 844 | 		"stdcx. %5, 0, %3\n\t"		/* attempt to store */ | |
| 845 | 	 #else | |
| 846 | 		"lwarx %0, 0, %3\n\t"		/* load old value */ | |
| 847 | 		"cmplw %4, %0\n\t"		/* compare */ | |
| 848 | 		"bne- 1f\n\t"			/* exit if not equal */ | |
| 849 | 		"stwcx. %5, 0, %3\n\t"		/* attempt to store */ | |
| 850 | 	 #endif | |
| 851 | 		"bne- 1f\n\t"			/* exit if failed */ | |
| 852 | 		"li %0, 1\n\t"			/* success - retval = 1 */ | |
| 853 | 		"b 2f\n\t"			/* we've succeeded */ | |
| 854 | 		"1:\n\t" | |
| 855 | 	 #ifdef __powerpc64__ | |
| 856 | 		"stdcx. %0, 0, %3\n\t"		/* clear reservation (74xx) */ | |
| 857 | 		"stdx %0, 0, %7\n\t" | |
| 858 | 	 #else | |
| 859 | 		"stwcx. %0, 0, %3\n\t"		/* clear reservation (74xx) */ | |
| 860 | 		"stwx %0, 0, %7\n\t" | |
| 861 | 	 #endif | |
| 862 | 		"li %0, 0\n\t"			/* failure - retval = 0 */ | |
| 863 | 		"2:\n\t" | |
| 864 | 		: "=&r" (ret), "=m" (*p), "=m" (*cmpval) | |
| 865 | 		: "r" (p), "r" (*cmpval), "r" (newval), "m" (*p), "r"(cmpval) | |
| 866 | 		: "cr0", "memory"); | |
| 867 | ||
| 868 | 	return (ret); | |
| 869 | } | |
| 870 | ||
| 871 | #define	ATOMIC_FCMPSET_ACQ_REL(type) \ | |
| 872 | static __inline int \ | |
| 873 | atomic_fcmpset_acq_##type(volatile u_##type *p, \ | |
| 874 | 	 u_##type *cmpval, u_##type newval)\ | |
| 875 | {\ | |
| 876 | 	u_##type retval; \ | |
| 877 | 	retval = atomic_fcmpset_##type(p, cmpval, newval);\ | |
| 878 | 	__ATOMIC_ACQ();\ | |
| 879 | 	return (retval);\ | |
| 880 | }\ | |
| 881 | static __inline int \ | |
| 882 | atomic_fcmpset_rel_##type(volatile u_##type *p, \ | |
| 883 | 	 u_##type *cmpval, u_##type newval)\ | |
| 884 | {\ | |
| 885 | 	__ATOMIC_REL();\ | |
| 886 | 	return (atomic_fcmpset_##type(p, cmpval, newval));\ | |
| 887 | }\ | |
| 888 | struct hack | |
| 889 | ||
| 890 | ATOMIC_FCMPSET_ACQ_REL(int); | |
| 891 | ATOMIC_FCMPSET_ACQ_REL(long); | |
| 892 | ||
| 893 | #ifdef ISA_206_ATOMICS | |
| 894 | #define	atomic_fcmpset_8	atomic_fcmpset_char | |
| 895 | #endif | |
| 896 | #define	atomic_fcmpset_acq_8	atomic_fcmpset_acq_char | |
| 897 | #define	atomic_fcmpset_rel_8	atomic_fcmpset_rel_char | |
| 898 | ||
| 899 | #ifdef ISA_206_ATOMICS | |
| 900 | #define	atomic_fcmpset_16	atomic_fcmpset_short | |
| 901 | #endif | |
| 902 | #define	atomic_fcmpset_acq_16	atomic_fcmpset_acq_short | |
| 903 | #define	atomic_fcmpset_rel_16	atomic_fcmpset_rel_short | |
| 904 | ||
| 905 | #define	atomic_fcmpset_32	atomic_fcmpset_int | |
| 906 | #define	atomic_fcmpset_acq_32	atomic_fcmpset_acq_int | |
| 907 | #define	atomic_fcmpset_rel_32	atomic_fcmpset_rel_int | |
| 908 | ||
| 909 | #ifdef __powerpc64__ | |
| 910 | #define	atomic_fcmpset_64	atomic_fcmpset_long | |
| 911 | #define	atomic_fcmpset_acq_64	atomic_fcmpset_acq_long | |
| 912 | #define	atomic_fcmpset_rel_64	atomic_fcmpset_rel_long | |
| 913 | ||
| 914 | #define	atomic_fcmpset_ptr	atomic_fcmpset_long | |
| 915 | #define	atomic_fcmpset_acq_ptr	atomic_fcmpset_acq_long | |
| 916 | #define	atomic_fcmpset_rel_ptr	atomic_fcmpset_rel_long | |
| 917 | #else | |
| 918 | #define	atomic_fcmpset_ptr	atomic_fcmpset_int | |
| 919 | #define	atomic_fcmpset_acq_ptr	atomic_fcmpset_acq_int | |
| 920 | #define	atomic_fcmpset_rel_ptr	atomic_fcmpset_rel_int | |
| 921 | #endif | |
| 922 | ||
| 923 | static __inline u_int | |
| 924 | atomic_fetchadd_int(volatile u_int *p, u_int v) | |
| 925 | { | |
| 926 | 	u_int value; | |
| 927 | ||
| 928 | 	do { | |
| 929 | 		value = *p; | |
| 930 | 	} while (!atomic_cmpset_int(p, value, value + v)); | |
| 931 | 	return (value); | |
| 932 | } | |
| 933 | ||
| 934 | static __inline u_long | |
| 935 | atomic_fetchadd_long(volatile u_long *p, u_long v) | |
| 936 | { | |
| 937 | 	u_long value; | |
| 938 | ||
| 939 | 	do { | |
| 940 | 		value = *p; | |
| 941 | 	} while (!atomic_cmpset_long(p, value, value + v)); | |
| 942 | 	return (value); | |
| 943 | } | |
| 944 | ||
| 945 | static __inline u_int | |
| 946 | atomic_swap_32(volatile u_int *p, u_int v) | |
| 947 | { | |
| 948 | 	u_int prev; | |
| 949 | ||
| 950 | 	__asm __volatile( | |
| 951 | 	"1:	lwarx	%0,0,%2\n" | |
| 952 | 	"	stwcx.	%3,0,%2\n" | |
| 953 | 	"	bne-	1b\n" | |
| 954 | 	: "=&r" (prev), "+m" (*(volatile u_int *)p) | |
| 955 | 	: "r" (p), "r" (v) | |
| 956 | 	: "cr0", "memory"); | |
| 957 | ||
| 958 | 	return (prev); | |
| 959 | } | |
| 960 | ||
| 961 | #ifdef __powerpc64__ | |
| 962 | static __inline u_long | |
| 963 | atomic_swap_64(volatile u_long *p, u_long v) | |
| 964 | { | |
| 965 | 	u_long prev; | |
| 966 | ||
| 967 | 	__asm __volatile( | |
| 968 | 	"1:	ldarx	%0,0,%2\n" | |
| 969 | 	"	stdcx.	%3,0,%2\n" | |
| 970 | 	"	bne-	1b\n" | |
| 971 | 	: "=&r" (prev), "+m" (*(volatile u_long *)p) | |
| 972 | 	: "r" (p), "r" (v) | |
| 973 | 	: "cr0", "memory"); | |
| 974 | ||
| 975 | 	return (prev); | |
| 976 | } | |
| 977 | #endif | |
| 978 | ||
| 979 | #define	atomic_fetchadd_32	atomic_fetchadd_int | |
| 980 | #define	atomic_swap_int		atomic_swap_32 | |
| 981 | ||
| 982 | #ifdef __powerpc64__ | |
| 983 | #define	atomic_fetchadd_64	atomic_fetchadd_long | |
| 984 | #define	atomic_swap_long	atomic_swap_64 | |
| 985 | #define	atomic_swap_ptr		atomic_swap_64 | |
| 986 | #else | |
| 987 | #define	atomic_swap_long(p,v)	atomic_swap_32((volatile u_int *)(p), v) | |
| 988 | #define	atomic_swap_ptr(p,v)	atomic_swap_32((volatile u_int *)(p), v) | |
| 989 | #endif | |
| 990 | ||
| 991 | static __inline int | |
| 992 | atomic_testandset_int(volatile u_int *p, u_int v) | |
| 993 | { | |
| 994 | 	u_int m = (1u << (v & 0x1f)); | |
| 995 | 	u_int res; | |
| 996 | 	u_int tmp; | |
| 997 | ||
| 998 | 	__asm __volatile( | |
| 999 | 	"1:	lwarx	%0,0,%3\n" | |
| 1000 | 	"	and	%1,%0,%4\n" | |
| 1001 | 	"	or	%0,%0,%4\n" | |
| 1002 | 	"	stwcx.	%0,0,%3\n" | |
| 1003 | 	"	bne-	1b\n" | |
| 1004 | 	: "=&r"(tmp), "=&r"(res), "+m"(*p) | |
| 1005 | 	: "r"(p), "r"(m) | |
| 1006 | 	: "cr0", "memory"); | |
| 1007 | ||
| 1008 | 	return (res != 0); | |
| 1009 | } | |
| 1010 | ||
| 1011 | static __inline int | |
| 1012 | atomic_testandclear_int(volatile u_int *p, u_int v) | |
| 1013 | { | |
| 1014 | 	u_int m = (1u << (v & 0x1f)); | |
| 1015 | 	u_int res; | |
| 1016 | 	u_int tmp; | |
| 1017 | ||
| 1018 | 	__asm __volatile( | |
| 1019 | 	"1:	lwarx	%0,0,%3\n" | |
| 1020 | 	"	and	%1,%0,%4\n" | |
| 1021 | 	"	andc	%0,%0,%4\n" | |
| 1022 | 	"	stwcx.	%0,0,%3\n" | |
| 1023 | 	"	bne-	1b\n" | |
| 1024 | 	: "=&r"(tmp), "=&r"(res), "+m"(*p) | |
| 1025 | 	: "r"(p), "r"(m) | |
| 1026 | 	: "cr0", "memory"); | |
| 1027 | ||
| 1028 | 	return (res != 0); | |
| 1029 | } | |
| 1030 | ||
| 1031 | #ifdef __powerpc64__ | |
| 1032 | static __inline int | |
| 1033 | atomic_testandset_long(volatile u_long *p, u_int v) | |
| 1034 | { | |
| 1035 | 	u_long m = (1ul << (v & 0x3f)); | |
| 1036 | 	u_long res; | |
| 1037 | 	u_long tmp; | |
| 1038 | ||
| 1039 | 	__asm __volatile( | |
| 1040 | 	"1:	ldarx	%0,0,%3\n" | |
| 1041 | 	"	and	%1,%0,%4\n" | |
| 1042 | 	"	or	%0,%0,%4\n" | |
| 1043 | 	"	stdcx.	%0,0,%3\n" | |
| 1044 | 	"	bne-	1b\n" | |
| 1045 | 	: "=&r"(tmp), "=&r"(res), "+m"(*(volatile u_long *)p) | |
| 1046 | 	: "r"(p), "r"(m) | |
| 1047 | 	: "cr0", "memory"); | |
| 1048 | ||
| 1049 | 	return (res != 0); | |
| 1050 | } | |
| 1051 | ||
| 1052 | static __inline int | |
| 1053 | atomic_testandclear_long(volatile u_long *p, u_int v) | |
| 1054 | { | |
| 1055 | 	u_long m = (1ul << (v & 0x3f)); | |
| 1056 | 	u_long res; | |
| 1057 | 	u_long tmp; | |
| 1058 | ||
| 1059 | 	__asm __volatile( | |
| 1060 | 	"1:	ldarx	%0,0,%3\n" | |
| 1061 | 	"	and	%1,%0,%4\n" | |
| 1062 | 	"	andc	%0,%0,%4\n" | |
| 1063 | 	"	stdcx.	%0,0,%3\n" | |
| 1064 | 	"	bne-	1b\n" | |
| 1065 | 	: "=&r"(tmp), "=&r"(res), "+m"(*p) | |
| 1066 | 	: "r"(p), "r"(m) | |
| 1067 | 	: "cr0", "memory"); | |
| 1068 | ||
| 1069 | 	return (res != 0); | |
| 1070 | } | |
| 1071 | #else | |
| 1072 | static __inline int | |
| 1073 | atomic_testandset_long(volatile u_long *p, u_int v) | |
| 1074 | { | |
| 1075 | 	return (atomic_testandset_int((volatile u_int *)p, v)); | |
| 1076 | } | |
| 1077 | ||
| 1078 | static __inline int | |
| 1079 | atomic_testandclear_long(volatile u_long *p, u_int v) | |
| 1080 | { | |
| 1081 | 	return (atomic_testandclear_int((volatile u_int *)p, v)); | |
| 1082 | } | |
| 1083 | #endif | |
| 1084 | ||
| 1085 | #define	atomic_testandclear_32	atomic_testandclear_int | |
| 1086 | #define	atomic_testandset_32	atomic_testandset_int | |
| 1087 | ||
| 1088 | static __inline int | |
| 1089 | atomic_testandset_acq_long(volatile u_long *p, u_int v) | |
| 1090 | { | |
| 1091 | 	u_int a = atomic_testandset_long(p, v); | |
| 1092 | 	__ATOMIC_ACQ(); | |
| 1093 | 	return (a); | |
| 1094 | } | |
| 1095 | ||
| 1096 | #define	atomic_testandclear_int		atomic_testandclear_int | |
| 1097 | #define	atomic_testandset_int		atomic_testandset_int | |
| 1098 | #define	atomic_testandclear_long	atomic_testandclear_long | |
| 1099 | #define	atomic_testandset_long		atomic_testandset_long | |
| 1100 | #define	atomic_testandset_acq_long	atomic_testandset_acq_long | |
| 1101 | ||
| 1102 | static __inline void | |
| 1103 | atomic_thread_fence_acq(void) | |
| 1104 | { | |
| 1105 | ||
| 1106 | 	powerpc_lwsync(); | |
| 1107 | } | |
| 1108 | ||
| 1109 | static __inline void | |
| 1110 | atomic_thread_fence_rel(void) | |
| 1111 | { | |
| 1112 | ||
| 1113 | 	powerpc_lwsync(); | |
| 1114 | } | |
| 1115 | ||
| 1116 | static __inline void | |
| 1117 | atomic_thread_fence_acq_rel(void) | |
| 1118 | { | |
| 1119 | ||
| 1120 | 	powerpc_lwsync(); | |
| 1121 | } | |
| 1122 | ||
| 1123 | static __inline void | |
| 1124 | atomic_thread_fence_seq_cst(void) | |
| 1125 | { | |
| 1126 | ||
| 1127 | 	__asm __volatile("sync" : : : "memory"); | |
| 1128 | } | |
| 1129 | ||
| 1130 | #ifndef ISA_206_ATOMICS | |
| 1131 | #include <sys/_atomic_subword.h> | |
| 1132 | #define	atomic_cmpset_char	atomic_cmpset_8 | |
| 1133 | #define	atomic_cmpset_short	atomic_cmpset_16 | |
| 1134 | #define	atomic_fcmpset_char	atomic_fcmpset_8 | |
| 1135 | #define	atomic_fcmpset_short	atomic_fcmpset_16 | |
| 1136 | #endif | |
| 1137 | ||
| 1138 | /* These need sys/_atomic_subword.h on non-ISA-2.06-atomic platforms. */ | |
| 1139 | ATOMIC_CMPSET_ACQ_REL(char); | |
| 1140 | ATOMIC_CMPSET_ACQ_REL(short); | |
| 1141 | ||
| 1142 | ATOMIC_FCMPSET_ACQ_REL(char); | |
| 1143 | ATOMIC_FCMPSET_ACQ_REL(short); | |
| 1144 | ||
| 1145 | #undef __ATOMIC_REL | |
| 1146 | #undef __ATOMIC_ACQ | |
| 1147 | ||
| 1148 | #endif /* ! _MACHINE_ATOMIC_H_ */ | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/machine/bat.h deleted-167| ... | ... | @@ -1,167 +0,0 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-2-Clause AND BSD-4-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 1999 The NetBSD Foundation, Inc. | |
| 5 | * All rights reserved. | |
| 6 | * | |
| 7 | * This code is derived from software contributed to The NetBSD Foundation | |
| 8 | * by Jason R. Thorpe. | |
| 9 | * | |
| 10 | * Redistribution and use in source and binary forms, with or without | |
| 11 | * modification, are permitted provided that the following conditions | |
| 12 | * are met: | |
| 13 | * 1. Redistributions of source code must retain the above copyright | |
| 14 | * notice, this list of conditions and the following disclaimer. | |
| 15 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 16 | * notice, this list of conditions and the following disclaimer in the | |
| 17 | * documentation and/or other materials provided with the distribution. | |
| 18 | * | |
| 19 | * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS | |
| 20 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | |
| 21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
| 22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | |
| 23 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
| 24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
| 25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
| 26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
| 27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
| 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
| 29 | * POSSIBILITY OF SUCH DAMAGE. | |
| 30 | */ | |
| 31 | ||
| 32 | /*- | |
| 33 | * Copyright (C) 1995, 1996 Wolfgang Solfrank. | |
| 34 | * Copyright (C) 1995, 1996 TooLs GmbH. | |
| 35 | * All rights reserved. | |
| 36 | * | |
| 37 | * Redistribution and use in source and binary forms, with or without | |
| 38 | * modification, are permitted provided that the following conditions | |
| 39 | * are met: | |
| 40 | * 1. Redistributions of source code must retain the above copyright | |
| 41 | * notice, this list of conditions and the following disclaimer. | |
| 42 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 43 | * notice, this list of conditions and the following disclaimer in the | |
| 44 | * documentation and/or other materials provided with the distribution. | |
| 45 | * 3. All advertising materials mentioning features or use of this software | |
| 46 | * must display the following acknowledgement: | |
| 47 | *	This product includes software developed by TooLs GmbH. | |
| 48 | * 4. The name of TooLs GmbH may not be used to endorse or promote products | |
| 49 | * derived from this software without specific prior written permission. | |
| 50 | * | |
| 51 | * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR | |
| 52 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |
| 53 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | |
| 54 | * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
| 55 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | |
| 56 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; | |
| 57 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | |
| 58 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | |
| 59 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | |
| 60 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 61 | * | |
| 62 | *	$NetBSD: bat.h,v 1.2 1999/12/18 01:36:06 thorpej Exp $ | |
| 63 | */ | |
| 64 | ||
| 65 | #ifndef	_MACHINE_BAT_H_ | |
| 66 | #define	_MACHINE_BAT_H_ | |
| 67 | ||
| 68 | #ifndef LOCORE | |
| 69 | struct bat { | |
| 70 | 	u_int32_t batu; | |
| 71 | 	u_int32_t batl; | |
| 72 | }; | |
| 73 | #endif | |
| 74 | ||
| 75 | /* Lower BAT bits (all but PowerPC 601): */ | |
| 76 | #define	BAT_PBS		0xfffe0000	/* physical block start */ | |
| 77 | #define	BAT_W		0x00000040	/* 1 = write-through, 0 = write-back */ | |
| 78 | #define	BAT_I		0x00000020	/* cache inhibit */ | |
| 79 | #define	BAT_M		0x00000010	/* memory coherency enable */ | |
| 80 | #define	BAT_G		0x00000008	/* guarded region */ | |
| 81 | ||
| 82 | #define	BAT_PP_NONE	0x00000000	/* no access permission */ | |
| 83 | #define	BAT_PP_RO_S	0x00000001	/* read-only (soft) */ | |
| 84 | #define	BAT_PP_RW	0x00000002	/* read/write */ | |
| 85 | #define	BAT_PP_RO	0x00000003	/* read-only */ | |
| 86 | ||
| 87 | /* Upper BAT bits (all but PowerPC 601): */ | |
| 88 | #define	BAT_EBS		0xfffe0000	/* effective block start */ | |
| 89 | #define	BAT_BL		0x00001ffc	/* block length */ | |
| 90 | #define	BAT_Vs		0x00000002	/* valid in supervisor mode */ | |
| 91 | #define	BAT_Vu		0x00000001	/* valid in user mode */ | |
| 92 | ||
| 93 | #define	BAT_V		(BAT_Vs|BAT_Vu) | |
| 94 | ||
| 95 | /* Block Length encoding (all but PowerPC 601): */ | |
| 96 | #define	BAT_BL_128K	0x00000000 | |
| 97 | #define	BAT_BL_256K	0x00000004 | |
| 98 | #define	BAT_BL_512K	0x0000000c | |
| 99 | #define	BAT_BL_1M	0x0000001c | |
| 100 | #define	BAT_BL_2M	0x0000003c | |
| 101 | #define	BAT_BL_4M	0x0000007c | |
| 102 | #define	BAT_BL_8M	0x000000fc | |
| 103 | #define	BAT_BL_16M	0x000001fc | |
| 104 | #define	BAT_BL_32M	0x000003fc | |
| 105 | #define	BAT_BL_64M	0x000007fc | |
| 106 | #define	BAT_BL_128M	0x00000ffc | |
| 107 | #define	BAT_BL_256M	0x00001ffc | |
| 108 | ||
| 109 | #define	BATU(va, len, v)						\ | |
| 110 | 	(((va) & BAT_EBS) | ((len) & BAT_BL) | ((v) & BAT_V)) | |
| 111 | ||
| 112 | #define	BATL(pa, wimg, pp)						\ | |
| 113 | 	(((pa) & BAT_PBS) | (wimg) | (pp)) | |
| 114 | ||
| 115 | /* Lower BAT bits (PowerPC 601): */ | |
| 116 | #define	BAT601_PBN	0xfffe0000	/* physical block number */ | |
| 117 | #define	BAT601_V	0x00000040	/* valid */ | |
| 118 | #define	BAT601_BSM	0x0000003f	/* block size mask */ | |
| 119 | ||
| 120 | /* Upper BAT bits (PowerPC 601): */ | |
| 121 | #define	BAT601_BLPI	0xfffe0000	/* block logical page index */ | |
| 122 | #define	BAT601_W	0x00000040	/* 1 = write-through, 0 = write-back */ | |
| 123 | #define	BAT601_I	0x00000020	/* cache inhibit */ | |
| 124 | #define	BAT601_M	0x00000010	/* memory coherency enable */ | |
| 125 | #define	BAT601_Ks	0x00000008	/* key-supervisor */ | |
| 126 | #define	BAT601_Ku	0x00000004	/* key-user */ | |
| 127 | ||
| 128 | /* | |
| 129 | * Permission bits on the PowerPC 601 are modified by the appropriate | |
| 130 | * Key bit: | |
| 131 | * | |
| 132 | *	Key	PP	Access | |
| 133 | *	0	NONE	read/write | |
| 134 | *	0	RO_S	read/write | |
| 135 | *	0	RW	read/write | |
| 136 | *	0	RO	read-only | |
| 137 | * | |
| 138 | *	1	NONE	none | |
| 139 | *	1	RO_S	read-only | |
| 140 | *	1	RW	read/write | |
| 141 | *	1	RO	read-only | |
| 142 | */ | |
| 143 | #define	BAT601_PP_NONE	0x00000000	/* no access permission */ | |
| 144 | #define	BAT601_PP_RO_S	0x00000001	/* read-only (soft) */ | |
| 145 | #define	BAT601_PP_RW	0x00000002	/* read/write */ | |
| 146 | #define	BAT601_PP_RO	0x00000003	/* read-only */ | |
| 147 | ||
| 148 | /* Block Size Mask encoding (PowerPC 601): */ | |
| 149 | #define	BAT601_BSM_128K	0x00000000 | |
| 150 | #define	BAT601_BSM_256K	0x00000001 | |
| 151 | #define	BAT601_BSM_512K	0x00000003 | |
| 152 | #define	BAT601_BSM_1M	0x00000007 | |
| 153 | #define	BAT601_BSM_2M	0x0000000f | |
| 154 | #define	BAT601_BSM_4M	0x0000001f | |
| 155 | #define	BAT601_BSM_8M	0x0000003f | |
| 156 | ||
| 157 | #define	BATU601(va, wim, key, pp)					\ | |
| 158 | 	(((va) & BAT601_BLPI) | (wim) | (key) | (pp)) | |
| 159 | ||
| 160 | #define	BATL601(pa, size, v)						\ | |
| 161 | 	(((pa) & BAT601_PBN) | (v) | (size)) | |
| 162 | ||
| 163 | #if defined(_KERNEL) && !defined(LOCORE) | |
| 164 | extern struct bat battable[16]; | |
| 165 | #endif | |
| 166 | ||
| 167 | #endif	/* _MACHINE_BAT_H_ */ | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/machine/bus.h+2-490| ... | ... | @@ -1,493 +1,5 @@ |
| 1 | /*	$NetBSD: bus.h,v 1.11 2003/07/28 17:35:54 thorpej Exp $	*/ | |
| 2 | ||
| 3 | 1 | /*- |
| 4 | * SPDX-License-Identifier: BSD-2-Clause AND BSD-4-Clause | |
| 5 | * | |
| 6 | * Copyright (c) 1996, 1997, 1998, 2001 The NetBSD Foundation, Inc. | |
| 7 | * All rights reserved. | |
| 8 | * | |
| 9 | * This code is derived from software contributed to The NetBSD Foundation | |
| 10 | * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility, | |
| 11 | * NASA Ames Research Center. | |
| 12 | * | |
| 13 | * Redistribution and use in source and binary forms, with or without | |
| 14 | * modification, are permitted provided that the following conditions | |
| 15 | * are met: | |
| 16 | * 1. Redistributions of source code must retain the above copyright | |
| 17 | * notice, this list of conditions and the following disclaimer. | |
| 18 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 19 | * notice, this list of conditions and the following disclaimer in the | |
| 20 | * documentation and/or other materials provided with the distribution. | |
| 21 | * | |
| 22 | * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS | |
| 23 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | |
| 24 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
| 25 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | |
| 26 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
| 27 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
| 28 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
| 29 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
| 30 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
| 31 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
| 32 | * POSSIBILITY OF SUCH DAMAGE. | |
| 2 | * This file is in the public domain. | |
| 33 | 3 | */ |
| 34 | 4 | |
| 35 | /*- | |
| 36 | * Copyright (c) 1996 Charles M. Hannum. All rights reserved. | |
| 37 | * Copyright (c) 1996 Christopher G. Demetriou. All rights reserved. | |
| 38 | * | |
| 39 | * Redistribution and use in source and binary forms, with or without | |
| 40 | * modification, are permitted provided that the following conditions | |
| 41 | * are met: | |
| 42 | * 1. Redistributions of source code must retain the above copyright | |
| 43 | * notice, this list of conditions and the following disclaimer. | |
| 44 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 45 | * notice, this list of conditions and the following disclaimer in the | |
| 46 | * documentation and/or other materials provided with the distribution. | |
| 47 | * 3. All advertising materials mentioning features or use of this software | |
| 48 | * must display the following acknowledgement: | |
| 49 | * This product includes software developed by Christopher G. Demetriou | |
| 50 | *	for the NetBSD Project. | |
| 51 | * 4. The name of the author may not be used to endorse or promote products | |
| 52 | * derived from this software without specific prior written permission | |
| 53 | * | |
| 54 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | |
| 55 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |
| 56 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | |
| 57 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | |
| 58 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | |
| 59 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
| 60 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
| 61 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
| 62 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | |
| 63 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 64 | */ | |
| 65 | ||
| 66 | #ifndef _MACHINE_BUS_H_ | |
| 67 | #define _MACHINE_BUS_H_ | |
| 68 | ||
| 69 | #include <machine/_bus.h> | |
| 70 | ||
| 71 | #define BUS_SPACE_ALIGNED_POINTER(p, t) ALIGNED_POINTER(p, t) | |
| 72 | ||
| 73 | #define BUS_SPACE_MAXADDR_24BIT	0xFFFFFFUL | |
| 74 | #define BUS_SPACE_MAXADDR_32BIT 0xFFFFFFFFUL | |
| 75 | #define BUS_SPACE_MAXSIZE_24BIT	0xFFFFFFUL | |
| 76 | #define BUS_SPACE_MAXSIZE_32BIT	0xFFFFFFFFUL | |
| 77 | ||
| 78 | #ifdef __powerpc64__ | |
| 79 | #define BUS_SPACE_MAXADDR 	0xFFFFFFFFFFFFFFFFUL | |
| 80 | #define BUS_SPACE_MAXSIZE 	0xFFFFFFFFFFFFFFFFUL | |
| 81 | #else | |
| 82 | #ifdef BOOKE | |
| 83 | #define BUS_SPACE_MAXADDR 	0xFFFFFFFFFULL | |
| 84 | #define BUS_SPACE_MAXSIZE 	0xFFFFFFFFUL | |
| 85 | #else | |
| 86 | #define BUS_SPACE_MAXADDR 	0xFFFFFFFFUL | |
| 87 | #define BUS_SPACE_MAXSIZE 	0xFFFFFFFFUL | |
| 88 | #endif | |
| 89 | #endif | |
| 90 | ||
| 91 | #define	BUS_SPACE_MAP_CACHEABLE		0x01 | |
| 92 | #define	BUS_SPACE_MAP_LINEAR		0x02 | |
| 93 | #define	BUS_SPACE_MAP_PREFETCHABLE 	0x04 | |
| 94 | ||
| 95 | #define	BUS_SPACE_UNRESTRICTED	(~0) | |
| 96 | ||
| 97 | #define	BUS_SPACE_BARRIER_READ	0x01 | |
| 98 | #define	BUS_SPACE_BARRIER_WRITE	0x02 | |
| 99 | ||
| 100 | struct bus_space_access; | |
| 101 | ||
| 102 | struct bus_space { | |
| 103 | 	/* mapping/unmapping */ | |
| 104 | 	int	(*bs_map)(bus_addr_t, bus_size_t, int, | |
| 105 | 	 bus_space_handle_t *); | |
| 106 | 	void	(*bs_unmap)(bus_size_t); | |
| 107 | 	int	(*bs_subregion)(bus_space_handle_t, bus_size_t, | |
| 108 | 	 bus_size_t, bus_space_handle_t *); | |
| 109 | ||
| 110 | 	/* allocation/deallocation */ | |
| 111 | 	int	(*bs_alloc)(bus_addr_t, bus_addr_t, bus_size_t, | |
| 112 | 	 bus_size_t, bus_size_t, int, bus_addr_t *, bus_space_handle_t *); | |
| 113 | 	void	(*bs_free)(bus_space_handle_t, bus_size_t); | |
| 114 | ||
| 115 | 	void	(*bs_barrier)(bus_space_handle_t, bus_size_t, | |
| 116 | 	 bus_size_t, int); | |
| 117 | ||
| 118 | 	/* Read single. */ | |
| 119 | 	uint8_t (*bs_r_1)(bus_space_handle_t, bus_size_t); | |
| 120 | 	uint16_t (*bs_r_2)(bus_space_handle_t, bus_size_t); | |
| 121 | 	uint32_t (*bs_r_4)(bus_space_handle_t, bus_size_t); | |
| 122 | 	uint64_t (*bs_r_8)(bus_space_handle_t, bus_size_t); | |
| 123 | ||
| 124 | 	uint16_t (*bs_r_s_2)(bus_space_handle_t, bus_size_t); | |
| 125 | 	uint32_t (*bs_r_s_4)(bus_space_handle_t, bus_size_t); | |
| 126 | 	uint64_t (*bs_r_s_8)(bus_space_handle_t, bus_size_t); | |
| 127 | ||
| 128 | 	/* read multiple */ | |
| 129 | 	void	(*bs_rm_1)(bus_space_handle_t, bus_size_t, uint8_t *, | |
| 130 | 	 bus_size_t); | |
| 131 | 	void	(*bs_rm_2)(bus_space_handle_t, bus_size_t, uint16_t *, | |
| 132 | 	 bus_size_t); | |
| 133 | 	void	(*bs_rm_4)(bus_space_handle_t, bus_size_t, uint32_t *, | |
| 134 | 	 bus_size_t); | |
| 135 | 	void	(*bs_rm_8)(bus_space_handle_t, bus_size_t, uint64_t *, | |
| 136 | 	 bus_size_t); | |
| 137 | ||
| 138 | 	void	(*bs_rm_s_2)(bus_space_handle_t, bus_size_t, uint16_t *, | |
| 139 | 	 bus_size_t); | |
| 140 | 	void	(*bs_rm_s_4)(bus_space_handle_t, bus_size_t, uint32_t *, | |
| 141 | 	 bus_size_t); | |
| 142 | 	void	(*bs_rm_s_8)(bus_space_handle_t, bus_size_t, uint64_t *, | |
| 143 | 	 bus_size_t); | |
| 144 | ||
| 145 | 	/* read region */ | |
| 146 | 	void	(*bs_rr_1)(bus_space_handle_t, bus_size_t, uint8_t *, | |
| 147 | 	 bus_size_t); | |
| 148 | 	void	(*bs_rr_2)(bus_space_handle_t, bus_size_t, uint16_t *, | |
| 149 | 	 bus_size_t); | |
| 150 | 	void	(*bs_rr_4)(bus_space_handle_t, bus_size_t, uint32_t *, | |
| 151 | 	 bus_size_t); | |
| 152 | 	void	(*bs_rr_8)(bus_space_handle_t, bus_size_t, uint64_t *, | |
| 153 | 	 bus_size_t); | |
| 154 | ||
| 155 | 	void	(*bs_rr_s_2)(bus_space_handle_t, bus_size_t, uint16_t *, | |
| 156 | 	 bus_size_t); | |
| 157 | 	void	(*bs_rr_s_4)(bus_space_handle_t, bus_size_t, uint32_t *, | |
| 158 | 	 bus_size_t); | |
| 159 | 	void	(*bs_rr_s_8)(bus_space_handle_t, bus_size_t, uint64_t *, | |
| 160 | 	 bus_size_t); | |
| 161 | ||
| 162 | 	/* write */ | |
| 163 | 	void	(*bs_w_1)(bus_space_handle_t, bus_size_t, uint8_t); | |
| 164 | 	void	(*bs_w_2)(bus_space_handle_t, bus_size_t, uint16_t); | |
| 165 | 	void	(*bs_w_4)(bus_space_handle_t, bus_size_t, uint32_t); | |
| 166 | 	void	(*bs_w_8)(bus_space_handle_t, bus_size_t, uint64_t); | |
| 167 | ||
| 168 | 	void	(*bs_w_s_2)(bus_space_handle_t, bus_size_t, uint16_t); | |
| 169 | 	void	(*bs_w_s_4)(bus_space_handle_t, bus_size_t, uint32_t); | |
| 170 | 	void	(*bs_w_s_8)(bus_space_handle_t, bus_size_t, uint64_t); | |
| 171 | ||
| 172 | 	/* write multiple */ | |
| 173 | 	void	(*bs_wm_1)(bus_space_handle_t, bus_size_t, | |
| 174 | 	 const uint8_t *, bus_size_t); | |
| 175 | 	void	(*bs_wm_2)(bus_space_handle_t, bus_size_t, | |
| 176 | 	 const uint16_t *, bus_size_t); | |
| 177 | 	void	(*bs_wm_4)(bus_space_handle_t, bus_size_t, | |
| 178 | 	 const uint32_t *, bus_size_t); | |
| 179 | 	void	(*bs_wm_8)(bus_space_handle_t, bus_size_t, | |
| 180 | 	 const uint64_t *, bus_size_t); | |
| 181 | ||
| 182 | 	void	(*bs_wm_s_2)(bus_space_handle_t, bus_size_t, | |
| 183 | 	 const uint16_t *, bus_size_t); | |
| 184 | 	void	(*bs_wm_s_4)(bus_space_handle_t, bus_size_t, | |
| 185 | 	 const uint32_t *, bus_size_t); | |
| 186 | 	void	(*bs_wm_s_8)(bus_space_handle_t, bus_size_t, | |
| 187 | 	 const uint64_t *, bus_size_t); | |
| 188 | ||
| 189 | 	/* write region */ | |
| 190 | 	void	(*bs_wr_1)(bus_space_handle_t, bus_size_t, | |
| 191 | 	 const uint8_t *, bus_size_t); | |
| 192 | 	void	(*bs_wr_2)(bus_space_handle_t, bus_size_t, | |
| 193 | 	 const uint16_t *, bus_size_t); | |
| 194 | 	void	(*bs_wr_4)(bus_space_handle_t, bus_size_t, | |
| 195 | 	 const uint32_t *, bus_size_t); | |
| 196 | 	void	(*bs_wr_8)(bus_space_handle_t, bus_size_t, | |
| 197 | 	 const uint64_t *, bus_size_t); | |
| 198 | ||
| 199 | 	void	(*bs_wr_s_2)(bus_space_handle_t, bus_size_t, | |
| 200 | 	 const uint16_t *, bus_size_t); | |
| 201 | 	void	(*bs_wr_s_4)(bus_space_handle_t, bus_size_t, | |
| 202 | 	 const uint32_t *, bus_size_t); | |
| 203 | 	void	(*bs_wr_s_8)(bus_space_handle_t, bus_size_t, | |
| 204 | 	 const uint64_t *, bus_size_t); | |
| 205 | ||
| 206 | 	/* set multiple */ | |
| 207 | 	void	(*bs_sm_1)(bus_space_handle_t, bus_size_t, uint8_t, | |
| 208 | 	 bus_size_t); | |
| 209 | 	void	(*bs_sm_2)(bus_space_handle_t, bus_size_t, uint16_t, | |
| 210 | 	 bus_size_t); | |
| 211 | 	void	(*bs_sm_4)(bus_space_handle_t, bus_size_t, uint32_t, | |
| 212 | 	 bus_size_t); | |
| 213 | 	void	(*bs_sm_8)(bus_space_handle_t, bus_size_t, uint64_t, | |
| 214 | 	 bus_size_t); | |
| 215 | ||
| 216 | 	void	(*bs_sm_s_2)(bus_space_handle_t, bus_size_t, uint16_t, | |
| 217 | 	 bus_size_t); | |
| 218 | 	void	(*bs_sm_s_4)(bus_space_handle_t, bus_size_t, uint32_t, | |
| 219 | 	 bus_size_t); | |
| 220 | 	void	(*bs_sm_s_8)(bus_space_handle_t, bus_size_t, uint64_t, | |
| 221 | 	 bus_size_t); | |
| 222 | ||
| 223 | 	/* set region */ | |
| 224 | 	void	(*bs_sr_1)(bus_space_handle_t, bus_size_t, uint8_t, | |
| 225 | 	 bus_size_t); | |
| 226 | 	void	(*bs_sr_2)(bus_space_handle_t, bus_size_t, uint16_t, | |
| 227 | 	 bus_size_t); | |
| 228 | 	void	(*bs_sr_4)(bus_space_handle_t, bus_size_t, uint32_t, | |
| 229 | 	 bus_size_t); | |
| 230 | 	void	(*bs_sr_8)(bus_space_handle_t, bus_size_t, uint64_t, | |
| 231 | 	 bus_size_t); | |
| 232 | ||
| 233 | 	void	(*bs_sr_s_2)(bus_space_handle_t, bus_size_t, uint16_t, | |
| 234 | 	 bus_size_t); | |
| 235 | 	void	(*bs_sr_s_4)(bus_space_handle_t, bus_size_t, uint32_t, | |
| 236 | 	 bus_size_t); | |
| 237 | 	void	(*bs_sr_s_8)(bus_space_handle_t, bus_size_t, uint64_t, | |
| 238 | 	 bus_size_t); | |
| 239 | ||
| 240 | 	/* copy region */ | |
| 241 | 	void	(*bs_cr_1)(bus_space_handle_t, bus_size_t, | |
| 242 | 	 bus_space_handle_t, bus_size_t, bus_size_t); | |
| 243 | 	void	(*bs_cr_2)(bus_space_handle_t, bus_size_t, | |
| 244 | 	 bus_space_handle_t, bus_size_t, bus_size_t); | |
| 245 | 	void	(*bs_cr_4)(bus_space_handle_t, bus_size_t, | |
| 246 | 	 bus_space_handle_t, bus_size_t, bus_size_t); | |
| 247 | 	void	(*bs_cr_8)(bus_space_handle_t, bus_size_t, | |
| 248 | 	 bus_space_handle_t, bus_size_t, bus_size_t); | |
| 249 | ||
| 250 | 	void	(*bs_cr_s_2)(bus_space_handle_t, bus_size_t, | |
| 251 | 	 bus_space_handle_t, bus_size_t, bus_size_t); | |
| 252 | 	void	(*bs_cr_s_4)(bus_space_handle_t, bus_size_t, | |
| 253 | 	 bus_space_handle_t, bus_size_t, bus_size_t); | |
| 254 | 	void	(*bs_cr_s_8)(bus_space_handle_t, bus_size_t, | |
| 255 | 	 bus_space_handle_t, bus_size_t, bus_size_t); | |
| 256 | }; | |
| 257 | ||
| 258 | extern struct bus_space bs_be_tag; | |
| 259 | extern struct bus_space bs_le_tag; | |
| 260 | ||
| 261 | #define	__bs_c(a,b)		__CONCAT(a,b) | |
| 262 | #define	__bs_opname(op,size)	__bs_c(__bs_c(__bs_c(bs_,op),_),size) | |
| 263 | ||
| 264 | #define	__bs_rs(sz, t, h, o)						\ | |
| 265 | 	(*(t)->__bs_opname(r,sz))(h, o) | |
| 266 | #define	__bs_ws(sz, t, h, o, v)				\ | |
| 267 | 	(*(t)->__bs_opname(w,sz))(h, o, v) | |
| 268 | #define	__bs_nonsingle(type, sz, t, h, o, a, c)				\ | |
| 269 | 	(*(t)->__bs_opname(type,sz))(h, o, a, c) | |
| 270 | #define	__bs_set(type, sz, t, h, o, v, c)				\ | |
| 271 | 	(*(t)->__bs_opname(type,sz))(h, o, v, c) | |
| 272 | #define	__bs_copy(sz, t, h1, o1, h2, o2, cnt)				\ | |
| 273 | 	(*(t)->__bs_opname(c,sz))(h1, o1, h2, o2, cnt) | |
| 274 | ||
| 275 | /* | |
| 276 | * Mapping and unmapping operations. | |
| 277 | */ | |
| 278 | #define bus_space_map(t, a, s, c, hp) (*(t)->bs_map)(a, s, c, hp) | |
| 279 | #define bus_space_unmap(t, h, s)	(*(t)->bs_unmap)(h, s) | |
| 280 | #define	bus_space_subregion(t, h, o, s, hp)	(*(t)->bs_subregion)(h, o, s, hp) | |
| 281 | ||
| 282 | /* | |
| 283 | * Allocation and deallocation operations. | |
| 284 | */ | |
| 285 | #define	bus_space_alloc(t, rs, re, s, a, b, c, ap, hp)	\ | |
| 286 | 	(*(t)->bs_alloc)(rs, re, s, a, b, c, ap, hp) | |
| 287 | #define	bus_space_free(t, h, s)				\ | |
| 288 | 	(*(t)->bs_free)(h, s) | |
| 289 | ||
| 290 | /* | |
| 291 | * Bus barrier operations. | |
| 292 | */ | |
| 293 | #define	bus_space_barrier(t, h, o, l, f)	(*(t)->bs_barrier)(h, o, l, f) | |
| 294 | ||
| 295 | /* | |
| 296 | * Bus read (single) operations. | |
| 297 | */ | |
| 298 | #define	bus_space_read_1(t, h, o)	__bs_rs(1,t,h,o) | |
| 299 | #define	bus_space_read_2(t, h, o)	__bs_rs(2,t,h,o) | |
| 300 | #define	bus_space_read_4(t, h, o)	__bs_rs(4,t,h,o) | |
| 301 | #define	bus_space_read_8(t, h, o)	__bs_rs(8,t,h,o) | |
| 302 | ||
| 303 | #define bus_space_read_stream_1 bus_space_read_1 | |
| 304 | #define	bus_space_read_stream_2(t, h, o)	__bs_rs(s_2,t,h,o) | |
| 305 | #define	bus_space_read_stream_4(t, h, o)	__bs_rs(s_4,t,h,o) | |
| 306 | #define	bus_space_read_stream_8(t, h, o)	__bs_rs(s_8,t,h,o) | |
| 307 | ||
| 308 | /* | |
| 309 | * Bus read multiple operations. | |
| 310 | */ | |
| 311 | #define	bus_space_read_multi_1(t, h, o, a, c)				\ | |
| 312 | 	__bs_nonsingle(rm,1,(t),(h),(o),(a),(c)) | |
| 313 | #define	bus_space_read_multi_2(t, h, o, a, c)				\ | |
| 314 | 	__bs_nonsingle(rm,2,(t),(h),(o),(a),(c)) | |
| 315 | #define	bus_space_read_multi_4(t, h, o, a, c)				\ | |
| 316 | 	__bs_nonsingle(rm,4,(t),(h),(o),(a),(c)) | |
| 317 | #define	bus_space_read_multi_8(t, h, o, a, c)				\ | |
| 318 | 	__bs_nonsingle(rm,8,(t),(h),(o),(a),(c)) | |
| 319 | ||
| 320 | #define bus_space_read_multi_stream_1 bus_space_read_multi_1 | |
| 321 | #define	bus_space_read_multi_stream_2(t, h, o, a, c)			\ | |
| 322 | 	__bs_nonsingle(rm,s_2,(t),(h),(o),(a),(c)) | |
| 323 | #define	bus_space_read_multi_stream_4(t, h, o, a, c)			\ | |
| 324 | 	__bs_nonsingle(rm,s_4,(t),(h),(o),(a),(c)) | |
| 325 | #define	bus_space_read_multi_stream_8(t, h, o, a, c)			\ | |
| 326 | 	__bs_nonsingle(rm,s_8,(t),(h),(o),(a),(c)) | |
| 327 | ||
| 328 | /* | |
| 329 | * Bus read region operations. | |
| 330 | */ | |
| 331 | #define	bus_space_read_region_1(t, h, o, a, c)				\ | |
| 332 | 	__bs_nonsingle(rr,1,(t),(h),(o),(a),(c)) | |
| 333 | #define	bus_space_read_region_2(t, h, o, a, c)				\ | |
| 334 | 	__bs_nonsingle(rr,2,(t),(h),(o),(a),(c)) | |
| 335 | #define	bus_space_read_region_4(t, h, o, a, c)				\ | |
| 336 | 	__bs_nonsingle(rr,4,(t),(h),(o),(a),(c)) | |
| 337 | #define	bus_space_read_region_8(t, h, o, a, c)				\ | |
| 338 | 	__bs_nonsingle(rr,8,(t),(h),(o),(a),(c)) | |
| 339 | ||
| 340 | #define bus_space_read_region_stream_1 bus_space_read_region_1 | |
| 341 | #define	bus_space_read_region_stream_2(t, h, o, a, c)			\ | |
| 342 | 	__bs_nonsingle(rr,s_2,(t),(h),(o),(a),(c)) | |
| 343 | #define	bus_space_read_region_stream_4(t, h, o, a, c)			\ | |
| 344 | 	__bs_nonsingle(rr,s_4,(t),(h),(o),(a),(c)) | |
| 345 | #define	bus_space_read_region_stream_8(t, h, o, a, c)			\ | |
| 346 | 	__bs_nonsingle(rr,s_8,(t),(h),(o),(a),(c)) | |
| 347 | ||
| 348 | /* | |
| 349 | * Bus write (single) operations. | |
| 350 | */ | |
| 351 | #define	bus_space_write_1(t, h, o, v)	__bs_ws(1,(t),(h),(o),(v)) | |
| 352 | #define	bus_space_write_2(t, h, o, v)	__bs_ws(2,(t),(h),(o),(v)) | |
| 353 | #define	bus_space_write_4(t, h, o, v)	__bs_ws(4,(t),(h),(o),(v)) | |
| 354 | #define	bus_space_write_8(t, h, o, v)	__bs_ws(8,(t),(h),(o),(v)) | |
| 355 | ||
| 356 | #define bus_space_write_stream_1 bus_space_write_1 | |
| 357 | #define	bus_space_write_stream_2(t, h, o, v)	__bs_ws(s_2,(t),(h),(o),(v)) | |
| 358 | #define	bus_space_write_stream_4(t, h, o, v)	__bs_ws(s_4,(t),(h),(o),(v)) | |
| 359 | #define	bus_space_write_stream_8(t, h, o, v)	__bs_ws(s_8,(t),(h),(o),(v)) | |
| 360 | ||
| 361 | /* | |
| 362 | * Bus write multiple operations. | |
| 363 | */ | |
| 364 | #define	bus_space_write_multi_1(t, h, o, a, c)				\ | |
| 365 | 	__bs_nonsingle(wm,1,(t),(h),(o),(a),(c)) | |
| 366 | #define	bus_space_write_multi_2(t, h, o, a, c)				\ | |
| 367 | 	__bs_nonsingle(wm,2,(t),(h),(o),(a),(c)) | |
| 368 | #define	bus_space_write_multi_4(t, h, o, a, c)				\ | |
| 369 | 	__bs_nonsingle(wm,4,(t),(h),(o),(a),(c)) | |
| 370 | #define	bus_space_write_multi_8(t, h, o, a, c)				\ | |
| 371 | 	__bs_nonsingle(wm,8,(t),(h),(o),(a),(c)) | |
| 372 | ||
| 373 | #define bus_space_write_multi_stream_1 bus_space_write_multi_1 | |
| 374 | #define	bus_space_write_multi_stream_2(t, h, o, a, c)			\ | |
| 375 | 	__bs_nonsingle(wm,s_2,(t),(h),(o),(a),(c)) | |
| 376 | #define	bus_space_write_multi_stream_4(t, h, o, a, c)			\ | |
| 377 | 	__bs_nonsingle(wm,s_4,(t),(h),(o),(a),(c)) | |
| 378 | #define	bus_space_write_multi_stream_8(t, h, o, a, c)			\ | |
| 379 | 	__bs_nonsingle(wm,s_8,(t),(h),(o),(a),(c)) | |
| 380 | ||
| 381 | /* | |
| 382 | * Bus write region operations. | |
| 383 | */ | |
| 384 | #define	bus_space_write_region_1(t, h, o, a, c)				\ | |
| 385 | 	__bs_nonsingle(wr,1,(t),(h),(o),(a),(c)) | |
| 386 | #define	bus_space_write_region_2(t, h, o, a, c)				\ | |
| 387 | 	__bs_nonsingle(wr,2,(t),(h),(o),(a),(c)) | |
| 388 | #define	bus_space_write_region_4(t, h, o, a, c)				\ | |
| 389 | 	__bs_nonsingle(wr,4,(t),(h),(o),(a),(c)) | |
| 390 | #define	bus_space_write_region_8(t, h, o, a, c)				\ | |
| 391 | 	__bs_nonsingle(wr,8,(t),(h),(o),(a),(c)) | |
| 392 | ||
| 393 | #define bus_space_write_region_stream_1 bus_space_write_region_1 | |
| 394 | #define	bus_space_write_region_stream_2(t, h, o, a, c)			\ | |
| 395 | 	__bs_nonsingle(wr,s_2,(t),(h),(o),(a),(c)) | |
| 396 | #define	bus_space_write_region_stream_4(t, h, o, a, c)			\ | |
| 397 | 	__bs_nonsingle(wr,s_4,(t),(h),(o),(a),(c)) | |
| 398 | #define	bus_space_write_region_stream_8(t, h, o, a, c)			\ | |
| 399 | 	__bs_nonsingle(wr,s_8,(t),(h),(o),(a),(c)) | |
| 400 | ||
| 401 | /* | |
| 402 | * Set multiple operations. | |
| 403 | */ | |
| 404 | #define	bus_space_set_multi_1(t, h, o, v, c)				\ | |
| 405 | 	__bs_set(sm,1,(t),(h),(o),(v),(c)) | |
| 406 | #define	bus_space_set_multi_2(t, h, o, v, c)				\ | |
| 407 | 	__bs_set(sm,2,(t),(h),(o),(v),(c)) | |
| 408 | #define	bus_space_set_multi_4(t, h, o, v, c)				\ | |
| 409 | 	__bs_set(sm,4,(t),(h),(o),(v),(c)) | |
| 410 | #define	bus_space_set_multi_8(t, h, o, v, c)				\ | |
| 411 | 	__bs_set(sm,8,(t),(h),(o),(v),(c)) | |
| 412 | ||
| 413 | #define bus_space_set_multi_stream_1 bus_space_set_multi_1 | |
| 414 | #define	bus_space_set_multi_stream_2(t, h, o, v, c)			\ | |
| 415 | 	__bs_set(sm,s_2,(t),(h),(o),(v),(c)) | |
| 416 | #define	bus_space_set_multi_stream_4(t, h, o, v, c)			\ | |
| 417 | 	__bs_set(sm,s_4,(t),(h),(o),(v),(c)) | |
| 418 | #define	bus_space_set_multi_stream_8(t, h, o, v, c)			\ | |
| 419 | 	__bs_set(sm,s_8,(t),(h),(o),(v),(c)) | |
| 420 | ||
| 421 | /* | |
| 422 | * Set region operations. | |
| 423 | */ | |
| 424 | #define	bus_space_set_region_1(t, h, o, v, c)				\ | |
| 425 | 	__bs_set(sr,1,(t),(h),(o),(v),(c)) | |
| 426 | #define	bus_space_set_region_2(t, h, o, v, c)				\ | |
| 427 | 	__bs_set(sr,2,(t),(h),(o),(v),(c)) | |
| 428 | #define	bus_space_set_region_4(t, h, o, v, c)				\ | |
| 429 | 	__bs_set(sr,4,(t),(h),(o),(v),(c)) | |
| 430 | #define	bus_space_set_region_8(t, h, o, v, c)				\ | |
| 431 | 	__bs_set(sr,8,(t),(h),(o),(v),(c)) | |
| 432 | ||
| 433 | #define bus_space_set_region_stream_1 bus_space_set_region_1 | |
| 434 | #define	bus_space_set_region_stream_2(t, h, o, v, c)			\ | |
| 435 | 	__bs_set(sr,s_2,(t),(h),(o),(v),(c)) | |
| 436 | #define	bus_space_set_region_stream_4(t, h, o, v, c)			\ | |
| 437 | 	__bs_set(sr,s_4,(t),(h),(o),(v),(c)) | |
| 438 | #define	bus_space_set_region_stream_8(t, h, o, v, c)			\ | |
| 439 | 	__bs_set(sr,s_8,(t),(h),(o),(v),(c)) | |
| 440 | ||
| 441 | #if 0 | |
| 442 | /* | |
| 443 | * Copy operations. | |
| 444 | */ | |
| 445 | #define	bus_space_copy_region_1(t, h1, o1, h2, o2, c)				\ | |
| 446 | 	__bs_copy(1, t, h1, o1, h2, o2, c) | |
| 447 | #define	bus_space_copy_region_2(t, h1, o1, h2, o2, c)				\ | |
| 448 | 	__bs_copy(2, t, h1, o1, h2, o2, c) | |
| 449 | #define	bus_space_copy_region_4(t, h1, o1, h2, o2, c)				\ | |
| 450 | 	__bs_copy(4, t, h1, o1, h2, o2, c) | |
| 451 | #define	bus_space_copy_region_8(t, h1, o1, h2, o2, c)				\ | |
| 452 | 	__bs_copy(8, t, h1, o1, h2, o2, c) | |
| 453 | ||
| 454 | #define bus_space_copy_region_stream_1 bus_space_copy_region_1 | |
| 455 | #define	bus_space_copy_region_stream_2(t, h1, o1, h2, o2, c)			\ | |
| 456 | 	__bs_copy(s_2, t, h1, o1, h2, o2, c) | |
| 457 | #define	bus_space_copy_region_stream_4(t, h1, o1, h2, o2, c)			\ | |
| 458 | 	__bs_copy(s_4, t, h1, o1, h2, o2, c) | |
| 459 | #define	bus_space_copy_region_stream_8(t, h1, o1, h2, o2, c)			\ | |
| 460 | 	__bs_copy(s_8, t, h1, o1, h2, o2, c) | |
| 461 | #endif | |
| 462 | ||
| 463 | #define BUS_PEEK_FUNC(width, type)					\ | |
| 464 | 	static inline int						\ | |
| 465 | 	bus_space_peek_##width(bus_space_tag_t tag,			\ | |
| 466 | 	 bus_space_handle_t hnd, bus_size_t offset, type *value)	\ | |
| 467 | 	{								\ | |
| 468 | 		type tmp;						\ | |
| 469 | 		tmp = bus_space_read_##width(tag, hnd, offset);		\ | |
| 470 | 		*value = (type)tmp;					\ | |
| 471 | 		return (0);						\ | |
| 472 | 	} | |
| 473 | BUS_PEEK_FUNC(1, uint8_t) | |
| 474 | BUS_PEEK_FUNC(2, uint16_t) | |
| 475 | BUS_PEEK_FUNC(4, uint32_t) | |
| 476 | BUS_PEEK_FUNC(8, uint64_t) | |
| 477 | ||
| 478 | #define BUS_POKE_FUNC(width, type)					\ | |
| 479 | 	static inline int						\ | |
| 480 | 	bus_space_poke_##width(bus_space_tag_t tag,			\ | |
| 481 | 	 bus_space_handle_t hnd, bus_size_t offset, type value)	\ | |
| 482 | 	{								\ | |
| 483 | 		bus_space_write_##width(tag, hnd, offset, value);	\ | |
| 484 | 		return (0); 						\ | |
| 485 | 	} | |
| 486 | BUS_POKE_FUNC(1, uint8_t) | |
| 487 | BUS_POKE_FUNC(2, uint16_t) | |
| 488 | BUS_POKE_FUNC(4, uint32_t) | |
| 489 | BUS_POKE_FUNC(8, uint64_t) | |
| 490 | ||
| 491 | #include <machine/bus_dma.h> | |
| 492 | ||
| 493 | #endif /* _MACHINE_BUS_H_ */ | |
| \ No newline at end of file | ||
| 5 | #include <x86/bus.h> | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/machine/bus_dma.h deleted-37| ... | ... | @@ -1,37 +0,0 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-2-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 2005 Scott Long | |
| 5 | * All rights reserved. | |
| 6 | * | |
| 7 | * Redistribution and use in source and binary forms, with or without | |
| 8 | * modification, are permitted provided that the following conditions | |
| 9 | * are met: | |
| 10 | * 1. Redistributions of source code must retain the above copyright | |
| 11 | * notice, this list of conditions and the following disclaimer. | |
| 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 13 | * notice, this list of conditions and the following disclaimer in the | |
| 14 | * documentation and/or other materials provided with the distribution. | |
| 15 | * | |
| 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |
| 17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
| 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | |
| 20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
| 21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
| 22 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
| 23 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
| 24 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
| 25 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
| 26 | * SUCH DAMAGE. | |
| 27 | */ | |
| 28 | ||
| 29 | #ifndef _POWERPC_BUS_DMA_H_ | |
| 30 | #define _POWERPC_BUS_DMA_H_ | |
| 31 | ||
| 32 | #include <sys/bus_dma.h> | |
| 33 | #include <sys/bus_dma_internal.h> | |
| 34 | ||
| 35 | int bus_dma_tag_set_iommu(bus_dma_tag_t, device_t iommu, void *cookie); | |
| 36 | ||
| 37 | #endif /* _POWERPC_BUS_DMA_H_ */ | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/machine/clock.h+2-15| ... | ... | @@ -1,18 +1,5 @@ |
| 1 | /*- | |
| 2 | * Kernel interface to machine-dependent clock driver. | |
| 3 | * Garrett Wollman, September 1994. | |
| 1 | /* | |
| 4 | 2 | * This file is in the public domain. |
| 5 | 3 | */ |
| 6 | 4 | |
| 7 | #ifndef _MACHINE_CLOCK_H_ | |
| 8 | #define	_MACHINE_CLOCK_H_ | |
| 9 | ||
| 10 | #ifdef _KERNEL | |
| 11 | ||
| 12 | struct trapframe; | |
| 13 | ||
| 14 | void	decr_intr(struct trapframe *); | |
| 15 | ||
| 16 | #endif | |
| 17 | ||
| 18 | #endif /* !_MACHINE_CLOCK_H_ */ | |
| \ No newline at end of file | ||
| 5 | #include <x86/clock.h> | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/machine/counter.h deleted-162| ... | ... | @@ -1,162 +0,0 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-2-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 2012, 2013 Konstantin Belousov <kib@FreeBSD.org> | |
| 5 | * All rights reserved. | |
| 6 | * | |
| 7 | * Redistribution and use in source and binary forms, with or without | |
| 8 | * modification, are permitted provided that the following conditions | |
| 9 | * are met: | |
| 10 | * 1. Redistributions of source code must retain the above copyright | |
| 11 | * notice, this list of conditions and the following disclaimer. | |
| 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 13 | * notice, this list of conditions and the following disclaimer in the | |
| 14 | * documentation and/or other materials provided with the distribution. | |
| 15 | * | |
| 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |
| 17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
| 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | |
| 20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
| 21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
| 22 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
| 23 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
| 24 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
| 25 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
| 26 | * SUCH DAMAGE. | |
| 27 | */ | |
| 28 | ||
| 29 | #ifndef __MACHINE_COUNTER_H__ | |
| 30 | #define __MACHINE_COUNTER_H__ | |
| 31 | ||
| 32 | #include <sys/pcpu.h> | |
| 33 | #ifdef INVARIANTS | |
| 34 | #include <sys/proc.h> | |
| 35 | #endif | |
| 36 | ||
| 37 | #define	EARLY_COUNTER	&__pcpu[0].pc_early_dummy_counter | |
| 38 | ||
| 39 | #ifdef __powerpc64__ | |
| 40 | ||
| 41 | #define	counter_enter()	do {} while (0) | |
| 42 | #define	counter_exit()	do {} while (0) | |
| 43 | ||
| 44 | #ifdef IN_SUBR_COUNTER_C | |
| 45 | static inline uint64_t | |
| 46 | counter_u64_read_one(uint64_t *p, int cpu) | |
| 47 | { | |
| 48 | ||
| 49 | 	return (*(uint64_t *)((char *)p + UMA_PCPU_ALLOC_SIZE * cpu)); | |
| 50 | } | |
| 51 | ||
| 52 | static inline uint64_t | |
| 53 | counter_u64_fetch_inline(uint64_t *p) | |
| 54 | { | |
| 55 | 	uint64_t r; | |
| 56 | 	int i; | |
| 57 | ||
| 58 | 	r = 0; | |
| 59 | 	CPU_FOREACH(i) | |
| 60 | 		r += counter_u64_read_one((uint64_t *)p, i); | |
| 61 | ||
| 62 | 	return (r); | |
| 63 | } | |
| 64 | ||
| 65 | static void | |
| 66 | counter_u64_zero_one_cpu(void *arg) | |
| 67 | { | |
| 68 | ||
| 69 | 	*((uint64_t *)((char *)arg + UMA_PCPU_ALLOC_SIZE * | |
| 70 | 	 PCPU_GET(cpuid))) = 0; | |
| 71 | } | |
| 72 | ||
| 73 | static inline void | |
| 74 | counter_u64_zero_inline(counter_u64_t c) | |
| 75 | { | |
| 76 | ||
| 77 | 	smp_rendezvous(smp_no_rendezvous_barrier, counter_u64_zero_one_cpu, | |
| 78 | 	 smp_no_rendezvous_barrier, c); | |
| 79 | } | |
| 80 | #endif | |
| 81 | ||
| 82 | #define	counter_u64_add_protected(c, i)	counter_u64_add(c, i) | |
| 83 | ||
| 84 | static inline void | |
| 85 | counter_u64_add(counter_u64_t c, int64_t inc) | |
| 86 | { | |
| 87 | 	uint64_t ccpu, old; | |
| 88 | ||
| 89 | 	__asm __volatile("\n" | |
| 90 | "1:\n\t" | |
| 91 | 	 "mfsprg	%0, 0\n\t" | |
| 92 | 	 "ldarx	%1, %0, %2\n\t" | |
| 93 | 	 "add	%1, %1, %3\n\t" | |
| 94 | 	 "stdcx.	%1, %0, %2\n\t" | |
| 95 | 	 "bne-	1b" | |
| 96 | 	 : "=&b" (ccpu), "=&r" (old) | |
| 97 | 	 : "r" ((char *)c - (char *)&__pcpu[0]), "r" (inc) | |
| 98 | 	 : "cr0", "memory"); | |
| 99 | } | |
| 100 | ||
| 101 | #else	/* !64bit */ | |
| 102 | ||
| 103 | #define	counter_enter()	critical_enter() | |
| 104 | #define	counter_exit()	critical_exit() | |
| 105 | ||
| 106 | #ifdef IN_SUBR_COUNTER_C | |
| 107 | /* XXXKIB non-atomic 64bit read */ | |
| 108 | static inline uint64_t | |
| 109 | counter_u64_read_one(uint64_t *p, int cpu) | |
| 110 | { | |
| 111 | ||
| 112 | 	return (*(uint64_t *)((char *)p + UMA_PCPU_ALLOC_SIZE * cpu)); | |
| 113 | } | |
| 114 | ||
| 115 | static inline uint64_t | |
| 116 | counter_u64_fetch_inline(uint64_t *p) | |
| 117 | { | |
| 118 | 	uint64_t r; | |
| 119 | 	int i; | |
| 120 | ||
| 121 | 	r = 0; | |
| 122 | 	for (i = 0; i < mp_ncpus; i++) | |
| 123 | 		r += counter_u64_read_one((uint64_t *)p, i); | |
| 124 | ||
| 125 | 	return (r); | |
| 126 | } | |
| 127 | ||
| 128 | /* XXXKIB non-atomic 64bit store, might interrupt increment */ | |
| 129 | static void | |
| 130 | counter_u64_zero_one_cpu(void *arg) | |
| 131 | { | |
| 132 | ||
| 133 | 	*((uint64_t *)((char *)arg + UMA_PCPU_ALLOC_SIZE * | |
| 134 | 	 PCPU_GET(cpuid))) = 0; | |
| 135 | } | |
| 136 | ||
| 137 | static inline void | |
| 138 | counter_u64_zero_inline(counter_u64_t c) | |
| 139 | { | |
| 140 | ||
| 141 | 	smp_rendezvous(smp_no_rendezvous_barrier, counter_u64_zero_one_cpu, | |
| 142 | 	 smp_no_rendezvous_barrier, c); | |
| 143 | } | |
| 144 | #endif | |
| 145 | ||
| 146 | #define	counter_u64_add_protected(c, inc)	do {	\ | |
| 147 | 	CRITICAL_ASSERT(curthread);			\ | |
| 148 | 	*(uint64_t *)zpcpu_get(c) += (inc);		\ | |
| 149 | } while (0) | |
| 150 | ||
| 151 | static inline void | |
| 152 | counter_u64_add(counter_u64_t c, int64_t inc) | |
| 153 | { | |
| 154 | ||
| 155 | 	counter_enter(); | |
| 156 | 	counter_u64_add_protected(c, inc); | |
| 157 | 	counter_exit(); | |
| 158 | } | |
| 159 | ||
| 160 | #endif	/* 64bit */ | |
| 161 | ||
| 162 | #endif	/* ! __MACHINE_COUNTER_H__ */ | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/machine/cpu.h deleted-157| ... | ... | @@ -1,157 +0,0 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-4-Clause | |
| 3 | * | |
| 4 | * Copyright (C) 1995-1997 Wolfgang Solfrank. | |
| 5 | * Copyright (C) 1995-1997 TooLs GmbH. | |
| 6 | * All rights reserved. | |
| 7 | * | |
| 8 | * Redistribution and use in source and binary forms, with or without | |
| 9 | * modification, are permitted provided that the following conditions | |
| 10 | * are met: | |
| 11 | * 1. Redistributions of source code must retain the above copyright | |
| 12 | * notice, this list of conditions and the following disclaimer. | |
| 13 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 14 | * notice, this list of conditions and the following disclaimer in the | |
| 15 | * documentation and/or other materials provided with the distribution. | |
| 16 | * 3. All advertising materials mentioning features or use of this software | |
| 17 | * must display the following acknowledgement: | |
| 18 | *	This product includes software developed by TooLs GmbH. | |
| 19 | * 4. The name of TooLs GmbH may not be used to endorse or promote products | |
| 20 | * derived from this software without specific prior written permission. | |
| 21 | * | |
| 22 | * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR | |
| 23 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |
| 24 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | |
| 25 | * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
| 26 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | |
| 27 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; | |
| 28 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | |
| 29 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | |
| 30 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | |
| 31 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 32 | * | |
| 33 | *	$NetBSD: cpu.h,v 1.11 2000/05/26 21:19:53 thorpej Exp $ | |
| 34 | */ | |
| 35 | ||
| 36 | #ifndef _MACHINE_CPU_H_ | |
| 37 | #define	_MACHINE_CPU_H_ | |
| 38 | ||
| 39 | #include <machine/frame.h> | |
| 40 | #include <machine/pcb.h> | |
| 41 | #include <machine/psl.h> | |
| 42 | ||
| 43 | /* | |
| 44 | * CPU Feature Attributes | |
| 45 | * | |
| 46 | * These are defined in the PowerPC ELF ABI for the AT_HWCAP vector, | |
| 47 | * and are exported to userland via the machdep.cpu_features | |
| 48 | * sysctl. | |
| 49 | */ | |
| 50 | ||
| 51 | extern u_long cpu_features; | |
| 52 | extern u_long cpu_features2; | |
| 53 | ||
| 54 | #define	PPC_FEATURE_32		0x80000000	/* Always true */ | |
| 55 | #define	PPC_FEATURE_64		0x40000000	/* Defined on a 64-bit CPU */ | |
| 56 | #define	PPC_FEATURE_601_INSTR	0x20000000	/* Defined on a 64-bit CPU */ | |
| 57 | #define	PPC_FEATURE_HAS_ALTIVEC	0x10000000	 | |
| 58 | #define	PPC_FEATURE_HAS_FPU	0x08000000 | |
| 59 | #define	PPC_FEATURE_HAS_MMU	0x04000000 | |
| 60 | #define	PPC_FEATURE_UNIFIED_CACHE 0x01000000 | |
| 61 | #define	PPC_FEATURE_HAS_SPE	0x00800000 | |
| 62 | #define	PPC_FEATURE_HAS_EFP_SINGLE	0x00400000 | |
| 63 | #define	PPC_FEATURE_HAS_EFP_DOUBLE	0x00200000 | |
| 64 | #define	PPC_FEATURE_NO_TB	0x00100000 | |
| 65 | #define	PPC_FEATURE_POWER4	0x00080000 | |
| 66 | #define	PPC_FEATURE_POWER5	0x00040000 | |
| 67 | #define	PPC_FEATURE_POWER5_PLUS	0x00020000 | |
| 68 | #define	PPC_FEATURE_CELL	0x00010000 | |
| 69 | #define	PPC_FEATURE_BOOKE	0x00008000 | |
| 70 | #define	PPC_FEATURE_SMT		0x00004000 | |
| 71 | #define	PPC_FEATURE_ICACHE_SNOOP	0x00002000 | |
| 72 | #define	PPC_FEATURE_ARCH_2_05	0x00001000 | |
| 73 | #define	PPC_FEATURE_HAS_DFP	0x00000400 | |
| 74 | #define	PPC_FEATURE_POWER6_EXT	0x00000200 | |
| 75 | #define	PPC_FEATURE_ARCH_2_06	0x00000100 | |
| 76 | #define	PPC_FEATURE_HAS_VSX	0x00000080 | |
| 77 | #define	PPC_FEATURE_TRUE_LE	0x00000002 | |
| 78 | #define	PPC_FEATURE_PPC_LE	0x00000001 | |
| 79 | ||
| 80 | #define	PPC_FEATURE2_ARCH_2_07	0x80000000 | |
| 81 | #define	PPC_FEATURE2_HTM	0x40000000 | |
| 82 | #define	PPC_FEATURE2_DSCR	0x20000000 | |
| 83 | #define	PPC_FEATURE2_EBB	0x10000000 | |
| 84 | #define	PPC_FEATURE2_ISEL	0x08000000 | |
| 85 | #define	PPC_FEATURE2_TAR	0x04000000 | |
| 86 | #define	PPC_FEATURE2_HAS_VEC_CRYPTO	0x02000000 | |
| 87 | #define	PPC_FEATURE2_HTM_NOSC	0x01000000 | |
| 88 | #define	PPC_FEATURE2_ARCH_3_00	0x00800000 | |
| 89 | #define	PPC_FEATURE2_HAS_IEEE128	0x00400000 | |
| 90 | #define	PPC_FEATURE2_DARN	0x00200000 | |
| 91 | #define	PPC_FEATURE2_SCV	0x00100000 | |
| 92 | #define	PPC_FEATURE2_HTM_NOSUSPEND	0x00080000 | |
| 93 | #define	PPC_FEATURE2_ARCH_3_1	0x00040000 | |
| 94 | #define	PPC_FEATURE2_MMA	0x00020000 | |
| 95 | ||
| 96 | #define	PPC_FEATURE_BITMASK						\ | |
| 97 | 	"\20"								\ | |
| 98 | 	"\040PPC32\037PPC64\036PPC601\035ALTIVEC\034FPU\033MMU\031UNIFIEDCACHE"	\ | |
| 99 | 	"\030SPE\027SPESFP\026DPESFP\025NOTB\024POWER4\023POWER5\022P5PLUS\021CELL"\ | |
| 100 | 	"\020BOOKE\017SMT\016ISNOOP\015ARCH205\013DFP\011ARCH206\010VSX"\ | |
| 101 | 	"\002TRUELE\001PPCLE" | |
| 102 | #define	PPC_FEATURE2_BITMASK						\ | |
| 103 | 	"\20"								\ | |
| 104 | 	"\040ARCH207\037HTM\036DSCR\034ISEL\033TAR\032VCRYPTO\031HTMNOSC" \ | |
| 105 | 	"\030ARCH300\027IEEE128\026DARN\025SCV\024HTMNOSUSP" | |
| 106 | ||
| 107 | #define	TRAPF_USERMODE(frame)	(((frame)->srr1 & PSL_PR) != 0) | |
| 108 | #define	TRAPF_PC(frame)		((frame)->srr0) | |
| 109 | ||
| 110 | /* | |
| 111 | * CTL_MACHDEP definitions. | |
| 112 | */ | |
| 113 | #define	CPU_CACHELINE	1 | |
| 114 | ||
| 115 | static __inline u_int64_t | |
| 116 | get_cyclecount(void) | |
| 117 | { | |
| 118 | 	u_int32_t _upper, _lower; | |
| 119 | 	u_int64_t _time; | |
| 120 | ||
| 121 | 	__asm __volatile( | |
| 122 | 		"mftb %0\n" | |
| 123 | 		"mftbu %1" | |
| 124 | 		: "=r" (_lower), "=r" (_upper)); | |
| 125 | ||
| 126 | 	_time = (u_int64_t)_upper; | |
| 127 | 	_time = (_time << 32) + _lower; | |
| 128 | 	return (_time); | |
| 129 | } | |
| 130 | ||
| 131 | #define	cpu_getstack(td)	((td)->td_frame->fixreg[1]) | |
| 132 | #define	cpu_spinwait()		__asm __volatile("or 27,27,27") /* yield */ | |
| 133 | #define	cpu_lock_delay()	DELAY(1) | |
| 134 | ||
| 135 | extern char btext[]; | |
| 136 | extern char etext[]; | |
| 137 | ||
| 138 | struct thread; | |
| 139 | ||
| 140 | #ifdef __powerpc64__ | |
| 141 | extern void enter_idle_powerx(void); | |
| 142 | extern uint64_t can_wakeup; | |
| 143 | extern register_t lpcr; | |
| 144 | #endif | |
| 145 | ||
| 146 | void	cpu_halt(void); | |
| 147 | void	cpu_reset(void); | |
| 148 | void	flush_disable_caches(void); | |
| 149 | void	fork_trampoline(void); | |
| 150 | int	cpu_machine_check(struct thread *, struct trapframe *, int *); | |
| 151 | ||
| 152 | ||
| 153 | #ifndef __powerpc64__ | |
| 154 | void	mpc745x_sleep(void); | |
| 155 | #endif | |
| 156 | ||
| 157 | #endif	/* _MACHINE_CPU_H_ */ | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/machine/cpufunc.h deleted-298| ... | ... | @@ -1,298 +0,0 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-2-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 1998 Doug Rabson | |
| 5 | * All rights reserved. | |
| 6 | * | |
| 7 | * Redistribution and use in source and binary forms, with or without | |
| 8 | * modification, are permitted provided that the following conditions | |
| 9 | * are met: | |
| 10 | * 1. Redistributions of source code must retain the above copyright | |
| 11 | * notice, this list of conditions and the following disclaimer. | |
| 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 13 | * notice, this list of conditions and the following disclaimer in the | |
| 14 | * documentation and/or other materials provided with the distribution. | |
| 15 | * | |
| 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |
| 17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
| 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | |
| 20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
| 21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
| 22 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
| 23 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
| 24 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
| 25 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
| 26 | * SUCH DAMAGE. | |
| 27 | */ | |
| 28 | ||
| 29 | #ifndef _MACHINE_CPUFUNC_H_ | |
| 30 | #define	_MACHINE_CPUFUNC_H_ | |
| 31 | ||
| 32 | #ifdef _KERNEL | |
| 33 | ||
| 34 | #include <sys/types.h> | |
| 35 | ||
| 36 | #include <machine/psl.h> | |
| 37 | #include <machine/spr.h> | |
| 38 | ||
| 39 | struct thread; | |
| 40 | ||
| 41 | #ifdef KDB | |
| 42 | void breakpoint(void); | |
| 43 | #else | |
| 44 | static __inline void | |
| 45 | breakpoint(void) | |
| 46 | { | |
| 47 | ||
| 48 | 	return; | |
| 49 | } | |
| 50 | #endif | |
| 51 | ||
| 52 | /* CPU register mangling inlines */ | |
| 53 | ||
| 54 | static __inline void | |
| 55 | mtmsr(register_t value) | |
| 56 | { | |
| 57 | ||
| 58 | 	__asm __volatile ("mtmsr %0; isync" :: "r"(value)); | |
| 59 | } | |
| 60 | ||
| 61 | #ifdef __powerpc64__ | |
| 62 | static __inline void | |
| 63 | mtmsrd(register_t value) | |
| 64 | { | |
| 65 | ||
| 66 | 	__asm __volatile ("mtmsrd %0; isync" :: "r"(value)); | |
| 67 | } | |
| 68 | #endif | |
| 69 | ||
| 70 | static __inline register_t | |
| 71 | mfmsr(void) | |
| 72 | { | |
| 73 | 	register_t value; | |
| 74 | ||
| 75 | 	__asm __volatile ("mfmsr %0" : "=r"(value)); | |
| 76 | ||
| 77 | 	return (value); | |
| 78 | } | |
| 79 | ||
| 80 | #ifndef __powerpc64__ | |
| 81 | static __inline void | |
| 82 | mtsrin(vm_offset_t va, register_t value) | |
| 83 | { | |
| 84 | ||
| 85 | 	__asm __volatile ("mtsrin %0,%1; isync" :: "r"(value), "r"(va)); | |
| 86 | } | |
| 87 | ||
| 88 | static __inline register_t | |
| 89 | mfsrin(vm_offset_t va) | |
| 90 | { | |
| 91 | 	register_t value; | |
| 92 | ||
| 93 | 	__asm __volatile ("mfsrin %0,%1" : "=r"(value) : "r"(va)); | |
| 94 | ||
| 95 | 	return (value); | |
| 96 | } | |
| 97 | #endif | |
| 98 | ||
| 99 | static __inline register_t | |
| 100 | mfctrl(void) | |
| 101 | { | |
| 102 | 	register_t value; | |
| 103 | ||
| 104 | 	__asm __volatile ("mfspr %0,136" : "=r"(value)); | |
| 105 | ||
| 106 | 	return (value); | |
| 107 | } | |
| 108 | ||
| 109 | static __inline void | |
| 110 | mtdec(register_t value) | |
| 111 | { | |
| 112 | ||
| 113 | 	__asm __volatile ("mtdec %0" :: "r"(value)); | |
| 114 | } | |
| 115 | ||
| 116 | static __inline register_t | |
| 117 | mfdec(void) | |
| 118 | { | |
| 119 | 	register_t value; | |
| 120 | ||
| 121 | 	__asm __volatile ("mfdec %0" : "=r"(value)); | |
| 122 | ||
| 123 | 	return (value); | |
| 124 | } | |
| 125 | ||
| 126 | static __inline uint32_t | |
| 127 | mfpvr(void) | |
| 128 | { | |
| 129 | 	uint32_t value; | |
| 130 | ||
| 131 | 	__asm __volatile ("mfpvr %0" : "=r"(value)); | |
| 132 | ||
| 133 | 	return (value); | |
| 134 | } | |
| 135 | ||
| 136 | static __inline u_quad_t | |
| 137 | mftb(void) | |
| 138 | { | |
| 139 | 	u_quad_t tb; | |
| 140 | #ifdef __powerpc64__ | |
| 141 | 	__asm __volatile ("mftb %0" : "=r"(tb)); | |
| 142 | #else | |
| 143 | 	uint32_t *tbup = (uint32_t *)&tb; | |
| 144 | 	uint32_t *tblp = tbup + 1; | |
| 145 | ||
| 146 | 	do { | |
| 147 | 		*tbup = mfspr(TBR_TBU); | |
| 148 | 		*tblp = mfspr(TBR_TBL); | |
| 149 | 	} while (*tbup != mfspr(TBR_TBU)); | |
| 150 | #endif | |
| 151 | ||
| 152 | 	return (tb); | |
| 153 | } | |
| 154 | ||
| 155 | static __inline void | |
| 156 | mttb(u_quad_t time) | |
| 157 | { | |
| 158 | ||
| 159 | 	mtspr(TBR_TBWL, 0); | |
| 160 | 	mtspr(TBR_TBWU, (uint32_t)(time >> 32)); | |
| 161 | 	mtspr(TBR_TBWL, (uint32_t)(time & 0xffffffff)); | |
| 162 | } | |
| 163 | ||
| 164 | static __inline register_t | |
| 165 | mffs(void) | |
| 166 | { | |
| 167 | 	uint64_t value; | |
| 168 | ||
| 169 | 	__asm __volatile ("mffs 0; stfd 0,0(%0)" | |
| 170 | 			:: "b"(&value)); | |
| 171 | ||
| 172 | 	return ((register_t)value); | |
| 173 | } | |
| 174 | ||
| 175 | static __inline void | |
| 176 | mtfsf(uint64_t value) | |
| 177 | { | |
| 178 | ||
| 179 | 	__asm __volatile ("lfd 0,0(%0); mtfsf 0xff,0" | |
| 180 | 			:: "b"(&value)); | |
| 181 | } | |
| 182 | ||
| 183 | static __inline void | |
| 184 | eieio(void) | |
| 185 | { | |
| 186 | ||
| 187 | 	__asm __volatile ("eieio" : : : "memory"); | |
| 188 | } | |
| 189 | ||
| 190 | static __inline void | |
| 191 | isync(void) | |
| 192 | { | |
| 193 | ||
| 194 | 	__asm __volatile ("isync" : : : "memory"); | |
| 195 | } | |
| 196 | ||
| 197 | static __inline void | |
| 198 | powerpc_sync(void) | |
| 199 | { | |
| 200 | ||
| 201 | 	__asm __volatile ("sync" : : : "memory"); | |
| 202 | } | |
| 203 | ||
| 204 | static __inline int | |
| 205 | cntlzd(uint64_t word) | |
| 206 | { | |
| 207 | 	uint64_t result; | |
| 208 | 	/* cntlzd %0, %1 */ | |
| 209 | 	__asm __volatile(".long 0x7c000074 | (%1 << 21) | (%0 << 16)" : | |
| 210 | 	 "=r"(result) : "r"(word)); | |
| 211 | ||
| 212 | 	return (int)result; | |
| 213 | } | |
| 214 | ||
| 215 | static __inline int | |
| 216 | cnttzd(uint64_t word) | |
| 217 | { | |
| 218 | 	uint64_t result; | |
| 219 | 	/* cnttzd %0, %1 */ | |
| 220 | 	__asm __volatile(".long 0x7c000474 | (%1 << 21) | (%0 << 16)" : | |
| 221 | 	 "=r"(result) : "r"(word)); | |
| 222 | ||
| 223 | 	return (int)result; | |
| 224 | } | |
| 225 | ||
| 226 | static __inline void | |
| 227 | ptesync(void) | |
| 228 | { | |
| 229 | 	__asm __volatile("ptesync"); | |
| 230 | } | |
| 231 | ||
| 232 | static __inline register_t | |
| 233 | intr_disable(void) | |
| 234 | { | |
| 235 | 	register_t msr; | |
| 236 | ||
| 237 | 	msr = mfmsr(); | |
| 238 | 	mtmsr(msr & ~PSL_EE); | |
| 239 | 	return (msr); | |
| 240 | } | |
| 241 | ||
| 242 | static __inline void | |
| 243 | intr_restore(register_t msr) | |
| 244 | { | |
| 245 | ||
| 246 | 	mtmsr(msr); | |
| 247 | } | |
| 248 | ||
| 249 | static __inline struct pcpu * | |
| 250 | get_pcpu(void) | |
| 251 | { | |
| 252 | 	struct pcpu *ret; | |
| 253 | ||
| 254 | 	__asm __volatile("mfsprg %0, 0" : "=r"(ret)); | |
| 255 | ||
| 256 | 	return (ret); | |
| 257 | } | |
| 258 | ||
| 259 | /* "NOP" operations to signify priorities to the kernel. */ | |
| 260 | static __inline void | |
| 261 | nop_prio_vlow(void) | |
| 262 | { | |
| 263 | 	__asm __volatile("or 31,31,31"); | |
| 264 | } | |
| 265 | ||
| 266 | static __inline void | |
| 267 | nop_prio_low(void) | |
| 268 | { | |
| 269 | 	__asm __volatile("or 1,1,1"); | |
| 270 | } | |
| 271 | ||
| 272 | static __inline void | |
| 273 | nop_prio_mlow(void) | |
| 274 | { | |
| 275 | 	__asm __volatile("or 6,6,6"); | |
| 276 | } | |
| 277 | ||
| 278 | static __inline void | |
| 279 | nop_prio_medium(void) | |
| 280 | { | |
| 281 | 	__asm __volatile("or 2,2,2"); | |
| 282 | } | |
| 283 | ||
| 284 | static __inline void | |
| 285 | nop_prio_mhigh(void) | |
| 286 | { | |
| 287 | 	__asm __volatile("or 5,5,5"); | |
| 288 | } | |
| 289 | ||
| 290 | static __inline void | |
| 291 | nop_prio_high(void) | |
| 292 | { | |
| 293 | 	__asm __volatile("or 3,3,3"); | |
| 294 | } | |
| 295 | ||
| 296 | #endif /* _KERNEL */ | |
| 297 | ||
| 298 | #endif /* !_MACHINE_CPUFUNC_H_ */ | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/machine/db_machdep.h deleted-87| ... | ... | @@ -1,87 +0,0 @@ |
| 1 | /*- | |
| 2 | * Mach Operating System | |
| 3 | * Copyright (c) 1992 Carnegie Mellon University | |
| 4 | * All Rights Reserved. | |
| 5 | * | |
| 6 | * Permission to use, copy, modify and distribute this software and its | |
| 7 | * documentation is hereby granted, provided that both the copyright | |
| 8 | * notice and this permission notice appear in all copies of the | |
| 9 | * software, derivative works or modified versions, and any portions | |
| 10 | * thereof, and that both notices appear in supporting documentation. | |
| 11 | * | |
| 12 | * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" | |
| 13 | * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR | |
| 14 | * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. | |
| 15 | * | |
| 16 | * Carnegie Mellon requests users of this software to return to | |
| 17 | * | |
| 18 | * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU | |
| 19 | * School of Computer Science | |
| 20 | * Carnegie Mellon University | |
| 21 | * Pittsburgh PA 15213-3890 | |
| 22 | * | |
| 23 | * any improvements or extensions that they make and grant Carnegie Mellon | |
| 24 | * the rights to redistribute these changes. | |
| 25 | * | |
| 26 | *	$OpenBSD: db_machdep.h,v 1.2 1997/03/21 00:48:48 niklas Exp $ | |
| 27 | *	$NetBSD: db_machdep.h,v 1.4.22.1 2000/08/05 11:10:43 wiz Exp $ | |
| 28 | */ | |
| 29 | ||
| 30 | /* | |
| 31 | * Machine-dependent defines for new kernel debugger. | |
| 32 | */ | |
| 33 | #ifndef _POWERPC_DB_MACHDEP_H_ | |
| 34 | #define	_POWERPC_DB_MACHDEP_H_ | |
| 35 | ||
| 36 | #include <vm/vm_param.h> | |
| 37 | #include <machine/elf.h> | |
| 38 | ||
| 39 | #define	DB_ELF_SYMBOLS | |
| 40 | #define	DB_ELFSIZE	__ELF_WORD_SIZE | |
| 41 | ||
| 42 | typedef	vm_offset_t	db_addr_t;	/* address - unsigned */ | |
| 43 | typedef	intptr_t	db_expr_t;	/* expression - signed */ | |
| 44 | ||
| 45 | #define	PC_REGS(regs)	((db_addr_t)kdb_thrctx->pcb_lr) | |
| 46 | ||
| 47 | #define	BKPT_INST	0x7C810808	/* breakpoint instruction */ | |
| 48 | ||
| 49 | #define	BKPT_SIZE	(4)		/* size of breakpoint inst */ | |
| 50 | #define	BKPT_SET(inst)	(BKPT_INST) | |
| 51 | ||
| 52 | #define db_clear_single_step	kdb_cpu_clear_singlestep | |
| 53 | #define db_set_single_step	kdb_cpu_set_singlestep | |
| 54 | ||
| 55 | #if 0 | |
| 56 | #define	SR_SINGLESTEP	0x400 | |
| 57 | #define	db_clear_single_step(regs)	((regs)->msr &= ~SR_SINGLESTEP) | |
| 58 | #define	db_set_single_step(regs)	((regs)->msr |= SR_SINGLESTEP) | |
| 59 | #endif | |
| 60 | ||
| 61 | #define	T_BREAKPOINT	0xffff | |
| 62 | #define	IS_BREAKPOINT_TRAP(type, code)	((type) == T_BREAKPOINT) | |
| 63 | ||
| 64 | #define T_WATCHPOINT	0xeeee | |
| 65 | #ifdef T_WATCHPOINT | |
| 66 | #define	IS_WATCHPOINT_TRAP(type, code)	((type) == T_WATCHPOINT) | |
| 67 | #else | |
| 68 | #define	IS_WATCHPOINT_TRAP(type, code)	0 | |
| 69 | #endif | |
| 70 | ||
| 71 | #define	M_RTS		0xfc0007fe | |
| 72 | #define	I_RTS		0x4c000020 | |
| 73 | #define	M_BC		0xfc000000 | |
| 74 | #define	I_BC		0x40000000 | |
| 75 | #define	M_B		0xfc000000 | |
| 76 | #define	I_B		0x50000000 | |
| 77 | #define	M_RFI		0xfc0007fe | |
| 78 | #define	I_RFI		0x4c000064 | |
| 79 | ||
| 80 | #define	inst_trap_return(ins)	(((ins)&M_RFI) == I_RFI) | |
| 81 | #define	inst_return(ins)	(((ins)&M_RTS) == I_RTS) | |
| 82 | #define	inst_call(ins)		(((ins)&M_BC ) == I_BC || \ | |
| 83 | 				 ((ins)&M_B ) == I_B ) | |
| 84 | #define	inst_load(ins)		0 | |
| 85 | #define	inst_store(ins)		0 | |
| 86 | ||
| 87 | #endif	/* _POWERPC_DB_MACHDEP_H_ */ | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/machine/dbdma.h deleted-153| ... | ... | @@ -1,153 +0,0 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-2-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 2008 Nathan Whitehorn | |
| 5 | * All rights reserved | |
| 6 | * | |
| 7 | * Redistribution and use in source and binary forms, with or without | |
| 8 | * modification, are permitted provided that the following conditions | |
| 9 | * are met: | |
| 10 | * 1. Redistributions of source code must retain the above copyright | |
| 11 | * notice, this list of conditions and the following disclaimer. | |
| 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 13 | * notice, this list of conditions and the following disclaimer in the | |
| 14 | * documentation and/or other materials provided with the distribution. | |
| 15 | * | |
| 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |
| 17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
| 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | |
| 20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
| 21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
| 22 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
| 23 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
| 24 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
| 25 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
| 26 | * SUCH DAMAGE. | |
| 27 | */ | |
| 28 | ||
| 29 | #ifndef _MACHINE_DBDMA_H_ | |
| 30 | #define _MACHINE_DBDMA_H_ | |
| 31 | ||
| 32 | #include <sys/param.h> | |
| 33 | #include <machine/bus.h> | |
| 34 | ||
| 35 | /* | |
| 36 | * Apple's DBDMA (Descriptor-based DMA) interface is a common DMA engine | |
| 37 | * used by a variety of custom Apple ASICs. It is described in the CHRP | |
| 38 | * specification and in the book Macintosh Technology in the Common | |
| 39 | * Hardware Reference Platform, copyright 1995 Apple Computer. | |
| 40 | */ | |
| 41 | ||
| 42 | /* DBDMA Command Values */ | |
| 43 | ||
| 44 | enum { | |
| 45 | 	DBDMA_OUTPUT_MORE	= 0, | |
| 46 | 	DBDMA_OUTPUT_LAST	= 1, | |
| 47 | 	DBDMA_INPUT_MORE	= 2, | |
| 48 | 	DBDMA_INPUT_LAST	= 3, | |
| 49 | ||
| 50 | 	DBDMA_STORE_QUAD	= 4, | |
| 51 | 	DBDMA_LOAD_QUAD		= 5, | |
| 52 | 	DBDMA_NOP		= 6, | |
| 53 | 	DBDMA_STOP		= 7 | |
| 54 | }; | |
| 55 | ||
| 56 | /* These codes are for the interrupt, branch, and wait flags */ | |
| 57 | ||
| 58 | enum { | |
| 59 | 	DBDMA_NEVER		= 0, | |
| 60 | 	DBDMA_COND_TRUE		= 1, | |
| 61 | 	DBDMA_COND_FALSE	= 2, | |
| 62 | 	DBDMA_ALWAYS		= 3 | |
| 63 | }; | |
| 64 | ||
| 65 | /* Channel status bits */ | |
| 66 | #define DBDMA_STATUS_RUN (0x01 << 15) | |
| 67 | #define DBDMA_STATUS_PAUSE (0x01 << 14) | |
| 68 | #define DBDMA_STATUS_FLUSH (0x01 << 13) | |
| 69 | #define DBDMA_STATUS_WAKE (0x01 << 12) | |
| 70 | #define DBDMA_STATUS_DEAD (0x01 << 11) | |
| 71 | #define DBDMA_STATUS_ACTIVE (0x01 << 10) | |
| 72 | ||
| 73 | /* Set by hardware if a branch was taken */ | |
| 74 | #define DBDMA_STATUS_BRANCH 8 | |
| 75 | ||
| 76 | struct dbdma_command; | |
| 77 | typedef struct dbdma_command dbdma_command_t; | |
| 78 | struct dbdma_channel; | |
| 79 | typedef struct dbdma_channel dbdma_channel_t; | |
| 80 | ||
| 81 | int dbdma_allocate_channel(struct resource *dbdma_regs, u_int offset, | |
| 82 | bus_dma_tag_t parent_dma, int slots, dbdma_channel_t **chan); | |
| 83 | ||
| 84 | int dbdma_resize_channel(dbdma_channel_t *chan, int newslots); | |
| 85 | int dbdma_free_channel(dbdma_channel_t *chan); | |
| 86 | ||
| 87 | void dbdma_run(dbdma_channel_t *chan); | |
| 88 | void dbdma_stop(dbdma_channel_t *chan); | |
| 89 | void dbdma_reset(dbdma_channel_t *chan); | |
| 90 | void dbdma_set_current_cmd(dbdma_channel_t *chan, int slot); | |
| 91 | ||
| 92 | void dbdma_pause(dbdma_channel_t *chan); | |
| 93 | void dbdma_wake(dbdma_channel_t *chan); | |
| 94 | ||
| 95 | /* | |
| 96 | * DBDMA uses a 16 bit channel control register to describe the current | |
| 97 | * state of DMA on the channel. The high-order bits (8-15) contain information | |
| 98 | * on the run state and are listed in the DBDMA_STATUS_* constants above. These | |
| 99 | * are manipulated with the dbdma_run/stop/reset() routines above. | |
| 100 | * | |
| 101 | * The low order bits (0-7) are device dependent status bits. These can be set | |
| 102 | * and read by both hardware and software. The mask is the set of bits to | |
| 103 | * modify; if mask is 0x03 and value is 0, the lowest order 2 bits will be | |
| 104 | * zeroed. | |
| 105 | */ | |
| 106 | ||
| 107 | uint16_t dbdma_get_chan_status(dbdma_channel_t *chan); | |
| 108 | ||
| 109 | uint8_t dbdma_get_device_status(dbdma_channel_t *chan); | |
| 110 | void dbdma_set_device_status(dbdma_channel_t *chan, uint8_t mask, | |
| 111 | uint8_t value); | |
| 112 | ||
| 113 | /* | |
| 114 | * Each DBDMA command word has the current channel status register and the | |
| 115 | * number of residual bytes (requested - actually transferred) written to it | |
| 116 | * at time of command completion. | |
| 117 | */ | |
| 118 | ||
| 119 | uint16_t dbdma_get_cmd_status(dbdma_channel_t *chan, int slot); | |
| 120 | uint16_t dbdma_get_residuals(dbdma_channel_t *chan, int slot); | |
| 121 | ||
| 122 | void dbdma_clear_cmd_status(dbdma_channel_t *chan, int slot); | |
| 123 | ||
| 124 | /* | |
| 125 | * The interrupt/branch/wait selector let you specify a set of values | |
| 126 | * of the device dependent status bits that will cause intterupt/branch/wait | |
| 127 | * conditions to be taken if the flags for these are set to one of the | |
| 128 | * DBDMA_COND_* values. | |
| 129 | * | |
| 130 | * The condition is considered true if (status & mask) == value. | |
| 131 | */ | |
| 132 | ||
| 133 | void dbdma_set_interrupt_selector(dbdma_channel_t *chan, uint8_t mask, | |
| 134 | uint8_t value); | |
| 135 | void dbdma_set_branch_selector(dbdma_channel_t *chan, uint8_t mask, | |
| 136 | uint8_t value); | |
| 137 | void dbdma_set_wait_selector(dbdma_channel_t *chan, uint8_t mask, | |
| 138 | uint8_t value); | |
| 139 | ||
| 140 | void dbdma_insert_command(dbdma_channel_t *chan, int slot, int command, | |
| 141 | int stream, bus_addr_t data, size_t count, uint8_t interrupt, | |
| 142 | uint8_t branch, uint8_t wait, uint32_t branch_slot); | |
| 143 | ||
| 144 | void dbdma_insert_stop(dbdma_channel_t *chan, int slot); | |
| 145 | void dbdma_insert_nop(dbdma_channel_t *chan, int slot); | |
| 146 | void dbdma_insert_branch(dbdma_channel_t *chan, int slot, int to_slot); | |
| 147 | ||
| 148 | void dbdma_sync_commands(dbdma_channel_t *chan, bus_dmasync_op_t op); | |
| 149 | ||
| 150 | void dbdma_save_state(dbdma_channel_t *chan); | |
| 151 | void dbdma_restore_state(dbdma_channel_t *chan); | |
| 152 | ||
| 153 | #endif /* _MACHINE_DBDMA_H_ */ | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/machine/dump.h+2-70| ... | ... | @@ -1,73 +1,5 @@ |
| 1 | 1 | /*- |
| 2 | * Copyright (c) 2014 EMC Corp. | |
| 3 | * Author: Conrad Meyer <conrad.meyer@isilon.com> | |
| 4 | * All rights reserved. | |
| 5 | * | |
| 6 | * Redistribution and use in source and binary forms, with or without | |
| 7 | * modification, are permitted provided that the following conditions | |
| 8 | * are met: | |
| 9 | * 1. Redistributions of source code must retain the above copyright | |
| 10 | * notice, this list of conditions and the following disclaimer. | |
| 11 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 12 | * notice, this list of conditions and the following disclaimer in the | |
| 13 | * documentation and/or other materials provided with the distribution. | |
| 14 | * | |
| 15 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |
| 16 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 17 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
| 18 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | |
| 19 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
| 20 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
| 21 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
| 22 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
| 23 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
| 24 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
| 25 | * SUCH DAMAGE. | |
| 2 | * This file is in the public domain. | |
| 26 | 3 | */ |
| 27 | 4 | |
| 28 | #ifndef _MACHINE_DUMP_H_ | |
| 29 | #define	_MACHINE_DUMP_H_ | |
| 30 | ||
| 31 | #define	KERNELDUMP_ARCH_VERSION	KERNELDUMP_POWERPC_VERSION | |
| 32 | #define	EM_VALUE		ELF_ARCH /* Defined in powerpc/include/elf.h */ | |
| 33 | #define	DUMPSYS_MD_PA_NPAIRS	(PHYS_AVAIL_SZ + 1) | |
| 34 | #define	DUMPSYS_NUM_AUX_HDRS	0 | |
| 35 | ||
| 36 | /* How often to check the dump progress bar? */ | |
| 37 | #define	DUMPSYS_PB_CHECK_BITS	20	/* Every 1MB */ | |
| 38 | ||
| 39 | void dumpsys_pa_init(void); | |
| 40 | void dumpsys_unmap_chunk(vm_paddr_t, size_t, void *); | |
| 41 | size_t dumpsys_scan_pmap(struct bitset *); | |
| 42 | void *dumpsys_dump_pmap_init(unsigned blkpgs); | |
| 43 | void *dumpsys_dump_pmap(void *ctx, void *buf, u_long *nbytes); | |
| 44 | ||
| 45 | static inline struct dump_pa * | |
| 46 | dumpsys_pa_next(struct dump_pa *p) | |
| 47 | { | |
| 48 | ||
| 49 | 	return (dumpsys_gen_pa_next(p)); | |
| 50 | } | |
| 51 | ||
| 52 | static inline void | |
| 53 | dumpsys_wbinv_all(void) | |
| 54 | { | |
| 55 | ||
| 56 | 	dumpsys_gen_wbinv_all(); | |
| 57 | } | |
| 58 | ||
| 59 | static inline int | |
| 60 | dumpsys_write_aux_headers(struct dumperinfo *di) | |
| 61 | { | |
| 62 | ||
| 63 | 	return (dumpsys_gen_write_aux_headers(di)); | |
| 64 | } | |
| 65 | ||
| 66 | static inline int | |
| 67 | dumpsys(struct dumperinfo *di) | |
| 68 | { | |
| 69 | ||
| 70 | 	return (dumpsys_generic(di)); | |
| 71 | } | |
| 72 | ||
| 73 | #endif /* !_MACHINE_DUMP_H_ */ | |
| \ No newline at end of file | ||
| 5 | #include <x86/dump.h> | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/machine/efi.h deleted-12| ... | ... | @@ -1,12 +0,0 @@ |
| 1 | /*- | |
| 2 | * This file is in the public domain since it's just boilerplate. | |
| 3 | */ | |
| 4 | ||
| 5 | #ifndef __POWERPC_INCLUDE_EFI_H_ | |
| 6 | #define __POWERPC_INCLUDE_EFI_H_ | |
| 7 | ||
| 8 | #define	EFIABI_ATTR | |
| 9 | ||
| 10 | /* Note: we don't actually support this on powerpc */ | |
| 11 | ||
| 12 | #endif /* __POWERPC_INCLUDE_EFI_H_ */ | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/machine/elf.h+2-143| ... | ... | @@ -1,146 +1,5 @@ |
| 1 | 1 | /*- |
| 2 | * SPDX-License-Identifier: BSD-2-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 2001 David E. O'Brien | |
| 5 | * Copyright (c) 1996-1997 John D. Polstra. | |
| 6 | * All rights reserved. | |
| 7 | * | |
| 8 | * Redistribution and use in source and binary forms, with or without | |
| 9 | * modification, are permitted provided that the following conditions | |
| 10 | * are met: | |
| 11 | * 1. Redistributions of source code must retain the above copyright | |
| 12 | * notice, this list of conditions and the following disclaimer. | |
| 13 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 14 | * notice, this list of conditions and the following disclaimer in the | |
| 15 | * documentation and/or other materials provided with the distribution. | |
| 16 | * | |
| 17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |
| 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 19 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
| 20 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | |
| 21 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
| 22 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
| 23 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
| 24 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
| 25 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
| 26 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
| 27 | * SUCH DAMAGE. | |
| 2 | * This file is in the public domain. | |
| 28 | 3 | */ |
| 29 | 4 | |
| 30 | #ifndef _MACHINE_ELF_H_ | |
| 31 | #define	_MACHINE_ELF_H_ 1 | |
| 32 | ||
| 33 | /* | |
| 34 | * EABI ELF definitions for the PowerPC architecture. | |
| 35 | * See "PowerPC Embedded Application Binary Interface, 32-Bit Impliementation" | |
| 36 | * [ppc-eabi-1995-01.pdf] for details. | |
| 37 | */ | |
| 38 | ||
| 39 | #ifndef __ELF_WORD_SIZE | |
| 40 | #ifdef __powerpc64__ | |
| 41 | #define	__ELF_WORD_SIZE	64	/* Used by <sys/elf_generic.h> */ | |
| 42 | #else | |
| 43 | #define	__ELF_WORD_SIZE	32	/* Used by <sys/elf_generic.h> */ | |
| 44 | #endif | |
| 45 | #endif | |
| 46 | ||
| 47 | #include <sys/elf32.h>	/* Definitions common to all 32 bit architectures. */ | |
| 48 | #include <sys/elf64.h>	/* Definitions common to all 64 bit architectures. */ | |
| 49 | #include <sys/elf_generic.h> | |
| 50 | ||
| 51 | #if __ELF_WORD_SIZE == 64 | |
| 52 | #define	ELF_ARCH	EM_PPC64 | |
| 53 | #define	ELF_MACHINE_OK(x) ((x) == EM_PPC64) | |
| 54 | #else | |
| 55 | #define	ELF_ARCH	EM_PPC | |
| 56 | #define	ELF_ARCH32	EM_PPC | |
| 57 | #define	ELF_MACHINE_OK(x) ((x) == EM_PPC) | |
| 58 | #endif | |
| 59 | ||
| 60 | /* | |
| 61 | * Auxiliary vector entries for passing information to the interpreter. | |
| 62 | * | |
| 63 | * The PowerPC supplement to the SVR4 ABI specification names this "auxv_t", | |
| 64 | * but POSIX lays claim to all symbols ending with "_t". | |
| 65 | */ | |
| 66 | ||
| 67 | typedef struct {	/* Auxiliary vector entry on initial stack */ | |
| 68 | 	int	a_type;			/* Entry type. */ | |
| 69 | 	union { | |
| 70 | #ifdef __powerpc64__ | |
| 71 | 		int	a_val;		/* Integer value */ | |
| 72 | #else | |
| 73 | 		long	a_val;		/* Integer value. */ | |
| 74 | 		void	*a_ptr;		/* Address. */ | |
| 75 | 		void	(*a_fcn)(void);	/* Function pointer (not used). */ | |
| 76 | #endif | |
| 77 | 	} a_un; | |
| 78 | } Elf32_Auxinfo; | |
| 79 | ||
| 80 | typedef struct {	/* Auxiliary vector entry on initial stack */ | |
| 81 | 	long	a_type;			/* Entry type. */ | |
| 82 | 	union { | |
| 83 | 		long	a_val;		/* Integer value. */ | |
| 84 | 		void	*a_ptr;		/* Address. */ | |
| 85 | 		void	(*a_fcn)(void);	/* Function pointer (not used). */ | |
| 86 | 	} a_un; | |
| 87 | } Elf64_Auxinfo; | |
| 88 | ||
| 89 | __ElfType(Auxinfo); | |
| 90 | ||
| 91 | /* | |
| 92 | * Relocation types. | |
| 93 | */ | |
| 94 | ||
| 95 | #define	R_PPC_COUNT		37	/* Count of defined relocation types. */ | |
| 96 | ||
| 97 | 					/* Count of defined relocation types. */ | |
| 98 | #define	R_PPC_EMB_COUNT		(R_PPC_EMB_RELSDA - R_PPC_EMB_NADDR32 + 1) | |
| 99 | ||
| 100 | /* Define "machine" characteristics */ | |
| 101 | #if BYTE_ORDER == LITTLE_ENDIAN | |
| 102 | #define	ELF_TARG_DATA	ELFDATA2LSB | |
| 103 | #else | |
| 104 | #define	ELF_TARG_DATA	ELFDATA2MSB | |
| 105 | #endif | |
| 106 | #if __ELF_WORD_SIZE == 64 | |
| 107 | #define	ELF_TARG_CLASS	ELFCLASS64 | |
| 108 | #define	ELF_TARG_MACH	EM_PPC64 | |
| 109 | #define	ELF_TARG_VER	1 | |
| 110 | #else | |
| 111 | #define	ELF_TARG_CLASS	ELFCLASS32 | |
| 112 | #define	ELF_TARG_MACH	EM_PPC | |
| 113 | #define	ELF_TARG_VER	1 | |
| 114 | #endif | |
| 115 | ||
| 116 | #define	ET_DYN_LOAD_ADDR 0x01010000 | |
| 117 | ||
| 118 | #define	AT_OLD_NULL		AT_NULL | |
| 119 | #define	AT_OLD_IGNORE		AT_IGNORE | |
| 120 | #define	AT_OLD_EXECFD		AT_EXECFD | |
| 121 | #define	AT_OLD_PHDR		AT_PHDR | |
| 122 | #define	AT_OLD_PHENT		AT_PHENT | |
| 123 | #define	AT_OLD_PHNUM		AT_PHNUM | |
| 124 | #define	AT_OLD_PAGESZ		AT_PAGESZ | |
| 125 | #define	AT_OLD_BASE		AT_BASE | |
| 126 | #define	AT_OLD_FLAGS		AT_FLAGS | |
| 127 | #define	AT_OLD_ENTRY		AT_ENTRY | |
| 128 | #define	AT_OLD_NOTELF		AT_NOTELF | |
| 129 | #define	AT_OLD_UID		AT_UID | |
| 130 | #define	AT_OLD_EUID		AT_EUID | |
| 131 | #define	AT_OLD_EXECPATH		13 | |
| 132 | #define	AT_OLD_CANARY		14 | |
| 133 | #define	AT_OLD_CANARYLEN	15 | |
| 134 | #define	AT_OLD_OSRELDATE	16 | |
| 135 | #define	AT_OLD_NCPUS		17 | |
| 136 | #define	AT_OLD_PAGESIZES	18 | |
| 137 | #define	AT_OLD_PAGESIZESLEN	19 | |
| 138 | #define	AT_OLD_STACKPROT	21 | |
| 139 | #define	AT_OLD_TIMEKEEP		AT_TIMEKEEP | |
| 140 | #define	AT_OLD_EHDRFLAGS	AT_EHDRFLAGS | |
| 141 | #define	AT_OLD_HWCAP		AT_HWCAP | |
| 142 | #define	AT_OLD_HWCAP2		AT_HWCAP2 | |
| 143 | ||
| 144 | #define	AT_OLD_COUNT	27	/* Count of defined aux entry types. */ | |
| 145 | ||
| 146 | #endif /* !_MACHINE_ELF_H_ */ | |
| \ No newline at end of file | ||
| 5 | #include <x86/elf.h> | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/machine/endian.h+2-37| ... | ... | @@ -1,40 +1,5 @@ |
| 1 | 1 | /*- |
| 2 | * SPDX-License-Identifier: BSD-3-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 1987, 1991, 1993 | |
| 5 | *	The Regents of the University of California. All rights reserved. | |
| 6 | * | |
| 7 | * Redistribution and use in source and binary forms, with or without | |
| 8 | * modification, are permitted provided that the following conditions | |
| 9 | * are met: | |
| 10 | * 1. Redistributions of source code must retain the above copyright | |
| 11 | * notice, this list of conditions and the following disclaimer. | |
| 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 13 | * notice, this list of conditions and the following disclaimer in the | |
| 14 | * documentation and/or other materials provided with the distribution. | |
| 15 | * 3. Neither the name of the University nor the names of its contributors | |
| 16 | * may be used to endorse or promote products derived from this software | |
| 17 | * without specific prior written permission. | |
| 18 | * | |
| 19 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | |
| 20 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 21 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
| 22 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
| 23 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
| 24 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
| 25 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
| 26 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
| 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
| 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
| 29 | * SUCH DAMAGE. | |
| 30 | * | |
| 31 | *	@(#)endian.h	8.1 (Berkeley) 6/10/93 | |
| 2 | * This file is in the public domain. | |
| 32 | 3 | */ |
| 33 | 4 | |
| 34 | #ifndef _MACHINE_ENDIAN_H_ | |
| 35 | #define	_MACHINE_ENDIAN_H_ | |
| 36 | ||
| 37 | #include <sys/_types.h> | |
| 38 | #include <sys/_endian.h> | |
| 39 | ||
| 40 | #endif /* !_MACHINE_ENDIAN_H_ */ | |
| \ No newline at end of file | ||
| 5 | #include <x86/endian.h> | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/machine/exec.h+4-4| ... | ... | @@ -1,8 +1,8 @@ |
| 1 | 1 | /*- |
| 2 | 2 | * SPDX-License-Identifier: BSD-3-Clause |
| 3 | 3 | * |
| 4 | * Copyright (c) 2001 David E. O'Brien | |
| 5 | * All rights reserved. | |
| 4 | * Copyright (c) 1992, 1993 | |
| 5 | *	The Regents of the University of California. All rights reserved. | |
| 6 | 6 | * |
| 7 | 7 | * Redistribution and use in source and binary forms, with or without |
| 8 | 8 | * modification, are permitted provided that the following conditions |
| ... | ... | @@ -12,11 +12,11 @@ |
| 12 | 12 | * 2. Redistributions in binary form must reproduce the above copyright |
| 13 | 13 | * notice, this list of conditions and the following disclaimer in the |
| 14 | 14 | * documentation and/or other materials provided with the distribution. |
| 15 | * 3. Neither the name of the author nor the names of any co-contributors | |
| 15 | * 3. Neither the name of the University nor the names of its contributors | |
| 16 | 16 | * may be used to endorse or promote products derived from this software |
| 17 | 17 | * without specific prior written permission. |
| 18 | 18 | * |
| 19 | * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND | |
| 19 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | |
| 20 | 20 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 21 | 21 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| 22 | 22 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE |
lib/libc/include/generic-freebsd/machine/float.h+2-97| ... | ... | @@ -1,100 +1,5 @@ |
| 1 | 1 | /*- |
| 2 | * SPDX-License-Identifier: BSD-3-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 1989 Regents of the University of California. | |
| 5 | * All rights reserved. | |
| 6 | * | |
| 7 | * Redistribution and use in source and binary forms, with or without | |
| 8 | * modification, are permitted provided that the following conditions | |
| 9 | * are met: | |
| 10 | * 1. Redistributions of source code must retain the above copyright | |
| 11 | * notice, this list of conditions and the following disclaimer. | |
| 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 13 | * notice, this list of conditions and the following disclaimer in the | |
| 14 | * documentation and/or other materials provided with the distribution. | |
| 15 | * 3. Neither the name of the University nor the names of its contributors | |
| 16 | * may be used to endorse or promote products derived from this software | |
| 17 | * without specific prior written permission. | |
| 18 | * | |
| 19 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | |
| 20 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 21 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
| 22 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
| 23 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
| 24 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
| 25 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
| 26 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
| 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
| 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
| 29 | * SUCH DAMAGE. | |
| 30 | * | |
| 31 | *	from: @(#)float.h	7.1 (Berkeley) 5/8/90 | |
| 32 | *	from: FreeBSD: src/sys/i386/include/float.h,v 1.8 1999/08/28 00:44:11 | |
| 2 | * This file is in the public domain. | |
| 33 | 3 | */ |
| 34 | 4 | |
| 35 | #ifndef _MACHINE_FLOAT_H_ | |
| 36 | #define _MACHINE_FLOAT_H_ 1 | |
| 37 | ||
| 38 | #include <sys/cdefs.h> | |
| 39 | ||
| 40 | #ifndef _SOFT_FLOAT | |
| 41 | __BEGIN_DECLS | |
| 42 | extern int __flt_rounds(void); | |
| 43 | __END_DECLS | |
| 44 | #define FLT_ROUNDS	__flt_rounds() | |
| 45 | #else | |
| 46 | #define FLT_ROUNDS	(-1) | |
| 47 | #endif | |
| 48 | ||
| 49 | #define FLT_RADIX	2		/* b */ | |
| 50 | #if __ISO_C_VISIBLE >= 1999 | |
| 51 | #define	FLT_EVAL_METHOD	0 | |
| 52 | #define	DECIMAL_DIG	17		/* max precision in decimal digits */ | |
| 53 | #endif | |
| 54 | ||
| 55 | #define FLT_MANT_DIG	24		/* p */ | |
| 56 | #define FLT_EPSILON	1.19209290E-07F	/* b**(1-p) */ | |
| 57 | #define FLT_DIG		6		/* floor((p-1)*log10(b))+(b == 10) */ | |
| 58 | #define FLT_MIN_EXP	(-125)		/* emin */ | |
| 59 | #define FLT_MIN		1.17549435E-38F	/* b**(emin-1) */ | |
| 60 | #define FLT_MIN_10_EXP	(-37)		/* ceil(log10(b**(emin-1))) */ | |
| 61 | #define FLT_MAX_EXP	128		/* emax */ | |
| 62 | #define FLT_MAX		3.40282347E+38F	/* (1-b**(-p))*b**emax */ | |
| 63 | #define FLT_MAX_10_EXP	38		/* floor(log10((1-b**(-p))*b**emax)) */ | |
| 64 | #if __ISO_C_VISIBLE >= 2011 | |
| 65 | #define	FLT_TRUE_MIN	1.40129846E-45F	/* b**(emin-p) */ | |
| 66 | #define	FLT_DECIMAL_DIG	9		/* ceil(1+p*log10(b)) */ | |
| 67 | #define	FLT_HAS_SUBNORM	1 | |
| 68 | #endif /* __ISO_C_VISIBLE >= 2011 */ | |
| 69 | ||
| 70 | #define DBL_MANT_DIG	53 | |
| 71 | #define DBL_EPSILON	2.2204460492503131E-16 | |
| 72 | #define DBL_DIG		15 | |
| 73 | #define DBL_MIN_EXP	(-1021) | |
| 74 | #define DBL_MIN		2.2250738585072014E-308 | |
| 75 | #define DBL_MIN_10_EXP	(-307) | |
| 76 | #define DBL_MAX_EXP	1024 | |
| 77 | #define DBL_MAX		1.7976931348623157E+308 | |
| 78 | #define DBL_MAX_10_EXP	308 | |
| 79 | #if __ISO_C_VISIBLE >= 2011 | |
| 80 | #define	DBL_TRUE_MIN	4.9406564584124654E-324 | |
| 81 | #define	DBL_DECIMAL_DIG	17 | |
| 82 | #define	DBL_HAS_SUBNORM	1 | |
| 83 | #endif /* __ISO_C_VISIBLE >= 2011 */ | |
| 84 | ||
| 85 | #define LDBL_MANT_DIG	DBL_MANT_DIG | |
| 86 | #define LDBL_EPSILON	((long double)DBL_EPSILON) | |
| 87 | #define LDBL_DIG	DBL_DIG | |
| 88 | #define LDBL_MIN_EXP	DBL_MIN_EXP | |
| 89 | #define LDBL_MIN	((long double)DBL_MIN) | |
| 90 | #define LDBL_MIN_10_EXP	DBL_MIN_10_EXP | |
| 91 | #define LDBL_MAX_EXP	DBL_MAX_EXP | |
| 92 | #define LDBL_MAX	((long double)DBL_MAX) | |
| 93 | #define LDBL_MAX_10_EXP	DBL_MAX_10_EXP | |
| 94 | #if __ISO_C_VISIBLE >= 2011 | |
| 95 | #define	LDBL_TRUE_MIN	((long double)DBL_TRUE_MIN) | |
| 96 | #define	LDBL_DECIMAL_DIG DBL_DECIMAL_DIG | |
| 97 | #define	LDBL_HAS_SUBNORM DBL_HAS_SUBNORM | |
| 98 | #endif /* __ISO_C_VISIBLE >= 2011 */ | |
| 99 | ||
| 100 | #endif /* _MACHINE_FLOAT_H_ */ | |
| \ No newline at end of file | ||
| 5 | #include <x86/float.h> | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/machine/floatingpoint.h+9-4| ... | ... | @@ -1,7 +1,7 @@ |
| 1 | 1 | /*- |
| 2 | * SPDX-License-Identifier: BSD-3-Clause | |
| 2 | * SPDX-License-Identifier: BSD-4-Clause | |
| 3 | 3 | * |
| 4 | * Copyright (c) 2004 Suleiman Souhlal <refugee@segfaulted.com> | |
| 4 | * Copyright (c) 1993 Andrew Moore, Talke Studio | |
| 5 | 5 | * All rights reserved. |
| 6 | 6 | * |
| 7 | 7 | * Redistribution and use in source and binary forms, with or without |
| ... | ... | @@ -12,11 +12,15 @@ |
| 12 | 12 | * 2. Redistributions in binary form must reproduce the above copyright |
| 13 | 13 | * notice, this list of conditions and the following disclaimer in the |
| 14 | 14 | * documentation and/or other materials provided with the distribution. |
| 15 | * 3. Neither the name of the author nor the names of any co-contributors | |
| 15 | * 3. All advertising materials mentioning features or use of this software | |
| 16 | * must display the following acknowledgement: | |
| 17 | *	This product includes software developed by the University of | |
| 18 | *	California, Berkeley and its contributors. | |
| 19 | * 4. Neither the name of the University nor the names of its contributors | |
| 16 | 20 | * may be used to endorse or promote products derived from this software |
| 17 | 21 | * without specific prior written permission. |
| 18 | 22 | * |
| 19 | * THIS SOFTWARE IS PROVIDED BY DAVID O'BRIEN AND CONTRIBUTORS ``AS IS'' AND | |
| 23 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | |
| 20 | 24 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 21 | 25 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| 22 | 26 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE |
| ... | ... | @@ -32,6 +36,7 @@ |
| 32 | 36 | #ifndef _FLOATINGPOINT_H_ |
| 33 | 37 | #define _FLOATINGPOINT_H_ |
| 34 | 38 | |
| 39 | #include <sys/cdefs.h> | |
| 35 | 40 | #include <machine/ieeefp.h> |
| 36 | 41 | |
| 37 | 42 | #endif /* !_FLOATINGPOINT_H_ */ |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/machine/fpu.h deleted-102| ... | ... | @@ -1,102 +0,0 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-4-Clause | |
| 3 | * | |
| 4 | * Copyright (C) 1996 Wolfgang Solfrank. | |
| 5 | * Copyright (C) 1996 TooLs GmbH. | |
| 6 | * All rights reserved. | |
| 7 | * | |
| 8 | * Redistribution and use in source and binary forms, with or without | |
| 9 | * modification, are permitted provided that the following conditions | |
| 10 | * are met: | |
| 11 | * 1. Redistributions of source code must retain the above copyright | |
| 12 | * notice, this list of conditions and the following disclaimer. | |
| 13 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 14 | * notice, this list of conditions and the following disclaimer in the | |
| 15 | * documentation and/or other materials provided with the distribution. | |
| 16 | * 3. All advertising materials mentioning features or use of this software | |
| 17 | * must display the following acknowledgement: | |
| 18 | *	This product includes software developed by TooLs GmbH. | |
| 19 | * 4. The name of TooLs GmbH may not be used to endorse or promote products | |
| 20 | * derived from this software without specific prior written permission. | |
| 21 | * | |
| 22 | * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR | |
| 23 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |
| 24 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | |
| 25 | * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
| 26 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | |
| 27 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; | |
| 28 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | |
| 29 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | |
| 30 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | |
| 31 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 32 | * | |
| 33 | *	$NetBSD: fpu.h,v 1.2 1999/12/07 15:14:56 danw Exp $ | |
| 34 | */ | |
| 35 | ||
| 36 | #ifndef	_MACHINE_FPU_H_ | |
| 37 | #define	_MACHINE_FPU_H_ | |
| 38 | ||
| 39 | #define	FPSCR_FX	0x80000000 | |
| 40 | #define	FPSCR_FEX	0x40000000 | |
| 41 | #define	FPSCR_VX	0x20000000 | |
| 42 | #define	FPSCR_OX	0x10000000 | |
| 43 | #define	FPSCR_UX	0x08000000 | |
| 44 | #define	FPSCR_ZX	0x04000000 | |
| 45 | #define	FPSCR_XX	0x02000000 | |
| 46 | #define	FPSCR_VXSNAN	0x01000000 | |
| 47 | #define	FPSCR_VXISI	0x00800000 | |
| 48 | #define	FPSCR_VXIDI	0x00400000 | |
| 49 | #define	FPSCR_VXZDZ	0x00200000 | |
| 50 | #define	FPSCR_VXIMZ	0x00100000 | |
| 51 | #define	FPSCR_VXVC	0x00080000 | |
| 52 | #define	FPSCR_FR	0x00040000 | |
| 53 | #define	FPSCR_FI	0x00020000 | |
| 54 | #define	FPSCR_FPRF	0x0001f000 | |
| 55 | #define	FPSCR_C		0x00010000 | |
| 56 | #define	FPSCR_FPCC	0x0000f000 | |
| 57 | #define	FPSCR_FL	0x00008000 | |
| 58 | #define	FPSCR_FG	0x00004000 | |
| 59 | #define	FPSCR_FE	0x00002000 | |
| 60 | #define	FPSCR_FU	0x00001000 | |
| 61 | #define	FPSCR_VXSOFT	0x00000400 | |
| 62 | #define	FPSCR_VXSQRT	0x00000200 | |
| 63 | #define	FPSCR_VXCVI	0x00000100 | |
| 64 | #define	FPSCR_VE	0x00000080 | |
| 65 | #define	FPSCR_OE	0x00000040 | |
| 66 | #define	FPSCR_UE	0x00000020 | |
| 67 | #define	FPSCR_ZE	0x00000010 | |
| 68 | #define	FPSCR_XE	0x00000008 | |
| 69 | #define	FPSCR_NI	0x00000004 | |
| 70 | #define	FPSCR_RN	0x00000003 | |
| 71 | ||
| 72 | #ifdef _KERNEL | |
| 73 | ||
| 74 | void enable_fpu(struct thread *); | |
| 75 | void save_fpu(struct thread *); | |
| 76 | void save_fpu_nodrop(struct thread *); | |
| 77 | void cleanup_fpscr(void); | |
| 78 | u_int get_fpu_exception(struct thread *); | |
| 79 | void enable_fpu_kern(void); | |
| 80 | void disable_fpu(struct thread *td); | |
| 81 | ||
| 82 | /* | |
| 83 | * Flags for fpu_kern_alloc_ctx(), fpu_kern_enter() and fpu_kern_thread(). | |
| 84 | */ | |
| 85 | #define	FPU_KERN_NORMAL	0x0000 | |
| 86 | #define	FPU_KERN_NOWAIT	0x0001 | |
| 87 | #define	FPU_KERN_KTHR	0x0002 | |
| 88 | #define	FPU_KERN_NOCTX	0x0004 | |
| 89 | ||
| 90 | struct fpu_kern_ctx; | |
| 91 | ||
| 92 | struct fpu_kern_ctx *fpu_kern_alloc_ctx(u_int flags); | |
| 93 | void	fpu_kern_free_ctx(struct fpu_kern_ctx *ctx); | |
| 94 | void	fpu_kern_enter(struct thread *td, struct fpu_kern_ctx *ctx, | |
| 95 | 	 u_int flags); | |
| 96 | int	fpu_kern_leave(struct thread *td, struct fpu_kern_ctx *ctx); | |
| 97 | int	fpu_kern_thread(u_int flags); | |
| 98 | int	is_fpu_kern_thread(u_int flags); | |
| 99 | ||
| 100 | #endif /* _KERNEL */ | |
| 101 | ||
| 102 | #endif	/* _MACHINE_FPU_H_ */ | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/machine/frame.h deleted-114| ... | ... | @@ -1,114 +0,0 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-4-Clause | |
| 3 | * | |
| 4 | * Copyright (C) 1995, 1996 Wolfgang Solfrank. | |
| 5 | * Copyright (C) 1995, 1996 TooLs GmbH. | |
| 6 | * All rights reserved. | |
| 7 | * | |
| 8 | * Redistribution and use in source and binary forms, with or without | |
| 9 | * modification, are permitted provided that the following conditions | |
| 10 | * are met: | |
| 11 | * 1. Redistributions of source code must retain the above copyright | |
| 12 | * notice, this list of conditions and the following disclaimer. | |
| 13 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 14 | * notice, this list of conditions and the following disclaimer in the | |
| 15 | * documentation and/or other materials provided with the distribution. | |
| 16 | * 3. All advertising materials mentioning features or use of this software | |
| 17 | * must display the following acknowledgement: | |
| 18 | *	This product includes software developed by TooLs GmbH. | |
| 19 | * 4. The name of TooLs GmbH may not be used to endorse or promote products | |
| 20 | * derived from this software without specific prior written permission. | |
| 21 | * | |
| 22 | * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR | |
| 23 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |
| 24 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | |
| 25 | * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
| 26 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | |
| 27 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; | |
| 28 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | |
| 29 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | |
| 30 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | |
| 31 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 32 | * | |
| 33 | *	$NetBSD: frame.h,v 1.2 1999/01/10 10:13:15 tsubai Exp $ | |
| 34 | */ | |
| 35 | ||
| 36 | #ifndef	_MACHINE_FRAME_H_ | |
| 37 | #define	_MACHINE_FRAME_H_ | |
| 38 | ||
| 39 | #include <sys/types.h> | |
| 40 | ||
| 41 | /* | |
| 42 | * We have to save all registers on every trap, because | |
| 43 | *	1. user could attach this process every time | |
| 44 | *	2. we must be able to restore all user registers in case of fork | |
| 45 | * Actually, we do not save the fp registers on trap, since | |
| 46 | * these are not used by the kernel. They are saved only when switching | |
| 47 | * between processes using the FPU. | |
| 48 | * | |
| 49 | * Change ordering to cluster together these register_t's.		XXX | |
| 50 | */ | |
| 51 | struct trapframe { | |
| 52 | 	register_t fixreg[32]; | |
| 53 | 	register_t lr; | |
| 54 | 	register_t cr; | |
| 55 | 	register_t xer; | |
| 56 | 	register_t ctr; | |
| 57 | 	register_t srr0; | |
| 58 | 	register_t srr1; | |
| 59 | 	register_t exc; | |
| 60 | 	register_t dar;	/* DAR/DEAR filled in on DSI traps */ | |
| 61 | 	union { | |
| 62 | 		struct { | |
| 63 | 			/* dsisr only filled on a DSI trap */ | |
| 64 | 			register_t dsisr; | |
| 65 | 		} aim; | |
| 66 | 		struct { | |
| 67 | 			register_t esr; | |
| 68 | 			register_t dbcr0; | |
| 69 | 		} booke; | |
| 70 | 	} cpu; | |
| 71 | }; | |
| 72 | ||
| 73 | /* | |
| 74 | * FRAMELEN is the size of the stack region used by the low-level trap | |
| 75 | * handler. It is the size of its data (trapframe) plus the callframe | |
| 76 | * header (sizeof(struct callframe) - 3 register widths). It must also | |
| 77 | * be 16-byte aligned. | |
| 78 | */ | |
| 79 | #define	FRAMELEN	roundup(sizeof(struct trapframe) + \ | |
| 80 | 			 sizeof(struct callframe) - 3*sizeof(register_t), 16) | |
| 81 | #define	trapframe(td)	((td)->td_frame) | |
| 82 | ||
| 83 | /* | |
| 84 | * Call frame for PowerPC used during fork. | |
| 85 | */ | |
| 86 | #ifdef __powerpc64__ | |
| 87 | struct callframe { | |
| 88 | 	register_t	cf_dummy_fp;	/* dummy frame pointer */ | |
| 89 | 	register_t	cf_cr; | |
| 90 | 	register_t	cf_lr; | |
| 91 | 	register_t	cf_compiler; | |
| 92 | 	register_t	cf_linkeditor; | |
| 93 | 	register_t	cf_toc; | |
| 94 | 	register_t	cf_func; | |
| 95 | 	register_t	cf_arg0; | |
| 96 | 	register_t	cf_arg1; | |
| 97 | 	register_t	_padding;	/* Maintain 16-byte alignment */ | |
| 98 | }; | |
| 99 | #else | |
| 100 | struct callframe { | |
| 101 | 	register_t	cf_dummy_fp;	/* dummy frame pointer */ | |
| 102 | 	register_t	cf_lr;		/* space for link register save */ | |
| 103 | 	register_t	cf_func; | |
| 104 | 	register_t	cf_arg0; | |
| 105 | 	register_t	cf_arg1; | |
| 106 | 	register_t	_padding;	/* Maintain 16-byte alignment */ | |
| 107 | }; | |
| 108 | #endif | |
| 109 | ||
| 110 | /* Definitions for syscalls */ | |
| 111 | #define	FIRSTARG	3				/* first arg in reg 3 */ | |
| 112 | #define	NARGREG		8				/* 8 args in regs */ | |
| 113 | ||
| 114 | #endif	/* _MACHINE_FRAME_H_ */ | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/machine/gdb_machdep.h deleted-140| ... | ... | @@ -1,140 +0,0 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-2-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 2006 Marcel Moolenaar | |
| 5 | * All rights reserved. | |
| 6 | * | |
| 7 | * Redistribution and use in source and binary forms, with or without | |
| 8 | * modification, are permitted provided that the following conditions | |
| 9 | * are met: | |
| 10 | * | |
| 11 | * 1. Redistributions of source code must retain the above copyright | |
| 12 | * notice, this list of conditions and the following disclaimer. | |
| 13 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 14 | * notice, this list of conditions and the following disclaimer in the | |
| 15 | * documentation and/or other materials provided with the distribution. | |
| 16 | * | |
| 17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | |
| 18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |
| 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | |
| 20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | |
| 21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | |
| 22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
| 23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
| 24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
| 25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | |
| 26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 27 | */ | |
| 28 | ||
| 29 | #ifndef _MACHINE_GDB_MACHDEP_H_ | |
| 30 | #define	_MACHINE_GDB_MACHDEP_H_ | |
| 31 | ||
| 32 | #ifdef BOOKE | |
| 33 | #define	PPC_GDB_NREGS0	1 | |
| 34 | #define	PPC_GDB_NREGS4	(70 + 1) | |
| 35 | #define	PPC_GDB_NREGS8	(1 + 32) | |
| 36 | #define	PPC_GDB_NREGS16	0 | |
| 37 | ||
| 38 | #else | |
| 39 | /* | |
| 40 | * 0 - 32*GPR(4/8) | |
| 41 | * 32 - 32*FPR(8) | |
| 42 | * 64 - PC, PS (4/8) | |
| 43 | * 66 - CR (4) | |
| 44 | * 67 - LR, CTR (4/8) | |
| 45 | * 69 - XER, FPSCR (4) | |
| 46 | * 71 - 32*VR(16) | |
| 47 | * 103 - VSCR, VRSAVE (4) | |
| 48 | */ | |
| 49 | ||
| 50 | #define	PPC_REGNUM_R0	0 | |
| 51 | #define	PPC_REGNUM_R31	(PPC_REGNUM_R0 + 31) | |
| 52 | #define	PPC_REGNUM_FR0	32 | |
| 53 | #define	PPC_REGNUM_FR31	(PPC_REGNUM_FR0 + 31) | |
| 54 | #define	PPC_REGNUM_PC	64 | |
| 55 | #define	PPC_REGNUM_PS	65 | |
| 56 | #define	PPC_REGNUM_CR	66 | |
| 57 | #define	PPC_REGNUM_LR	67 | |
| 58 | #define	PPC_REGNUM_CTR	68 | |
| 59 | #define	PPC_REGNUM_XER	69 | |
| 60 | #define	PPC_REGNUM_FPSCR 70 | |
| 61 | #define	PPC_REGNUM_VR0	71 | |
| 62 | #define	PPC_REGNUM_VR31	(PPC_REGNUM_VR0 + 31) | |
| 63 | ||
| 64 | #define	PPC_GDB_NREGS0	0 | |
| 65 | ||
| 66 | #ifdef __powerpc64__ | |
| 67 | #define	PPC_GDB_NREGS4	5 | |
| 68 | #define	PPC_GDB_NREGS8	(64 + 4) | |
| 69 | #else | |
| 70 | #define	PPC_GDB_NREGS4	(32 + 7 + 2) | |
| 71 | #define	PPC_GDB_NREGS8	32 | |
| 72 | #endif | |
| 73 | ||
| 74 | #define	PPC_GDB_NREGS16	32 | |
| 75 | #endif | |
| 76 | ||
| 77 | #define GDB_NREGS	(PPC_GDB_NREGS0 + PPC_GDB_NREGS4 + \ | |
| 78 | 			 PPC_GDB_NREGS8 + PPC_GDB_NREGS16) | |
| 79 | #define	GDB_REG_PC	64 | |
| 80 | ||
| 81 | #define	GDB_BUFSZ	(PPC_GDB_NREGS4 * 8 +	\ | |
| 82 | 			 PPC_GDB_NREGS8 * 16 +	\ | |
| 83 | 			 PPC_GDB_NREGS16 * 32) | |
| 84 | ||
| 85 | static __inline size_t | |
| 86 | gdb_cpu_regsz(int regnum) | |
| 87 | { | |
| 88 | ||
| 89 | #ifdef BOOKE | |
| 90 | 	if (regnum == 70) | |
| 91 | 		return (0); | |
| 92 | 	if (regnum == 71 || regnum >= 73) | |
| 93 | 		return (8); | |
| 94 | #else | |
| 95 | #ifdef __powerpc64__ | |
| 96 | 	if ((regnum >= PPC_REGNUM_R0 && regnum <= PPC_REGNUM_PS) || | |
| 97 | 	 regnum == PPC_REGNUM_LR || regnum == PPC_REGNUM_CTR) | |
| 98 | 		return (8); | |
| 99 | #else | |
| 100 | 	if (regnum >= PPC_REGNUM_FR0 && regnum <= PPC_REGNUM_FR31) | |
| 101 | 		return (8); | |
| 102 | #endif | |
| 103 | 	if (regnum >= PPC_REGNUM_VR0 && regnum <= PPC_REGNUM_VR31) | |
| 104 | 		return (16); | |
| 105 | #endif | |
| 106 | 	return (4); | |
| 107 | } | |
| 108 | ||
| 109 | static __inline int | |
| 110 | gdb_cpu_query(void) | |
| 111 | { | |
| 112 | ||
| 113 | 	return (0); | |
| 114 | } | |
| 115 | ||
| 116 | static __inline void * | |
| 117 | gdb_begin_write(void) | |
| 118 | { | |
| 119 | ||
| 120 | 	return (NULL); | |
| 121 | } | |
| 122 | ||
| 123 | static __inline void | |
| 124 | gdb_end_write(void *arg __unused) | |
| 125 | { | |
| 126 | ||
| 127 | } | |
| 128 | ||
| 129 | static __inline void | |
| 130 | gdb_cpu_stop_reason(int type __unused, int code __unused) | |
| 131 | { | |
| 132 | ||
| 133 | } | |
| 134 | ||
| 135 | void *gdb_cpu_getreg(int, size_t *); | |
| 136 | void gdb_cpu_setreg(int, void *); | |
| 137 | int gdb_cpu_signal(int, int); | |
| 138 | void gdb_cpu_do_offsets(void); | |
| 139 | ||
| 140 | #endif /* !_MACHINE_GDB_MACHDEP_H_ */ | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/machine/hid.h deleted-223| ... | ... | @@ -1,223 +0,0 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-3-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 2000 Tsubai Masanari. All rights reserved. | |
| 5 | * | |
| 6 | * Redistribution and use in source and binary forms, with or without | |
| 7 | * modification, are permitted provided that the following conditions | |
| 8 | * are met: | |
| 9 | * 1. Redistributions of source code must retain the above copyright | |
| 10 | * notice, this list of conditions and the following disclaimer. | |
| 11 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 12 | * notice, this list of conditions and the following disclaimer in the | |
| 13 | * documentation and/or other materials provided with the distribution. | |
| 14 | * 3. The name of the author may not be used to endorse or promote products | |
| 15 | * derived from this software without specific prior written permission. | |
| 16 | * | |
| 17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | |
| 18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |
| 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | |
| 20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | |
| 21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | |
| 22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
| 23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
| 24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
| 25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |
| 26 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 27 | * | |
| 28 | * $NetBSD: hid.h,v 1.2 2001/08/22 21:05:25 matt Exp $ | |
| 29 | */ | |
| 30 | ||
| 31 | #ifndef _POWERPC_HID_H_ | |
| 32 | #define _POWERPC_HID_H_ | |
| 33 | ||
| 34 | /* Hardware Implementation Dependent registers for the PowerPC */ | |
| 35 | #define	HID0_RADIX	0x0080000000000000	/* Enable Radix page tables (POWER9) */ | |
| 36 | ||
| 37 | #define HID0_EMCP	0x80000000 /* Enable machine check pin */ | |
| 38 | #define HID0_DBP	0x40000000 /* Disable 60x bus parity generation */ | |
| 39 | #define HID0_EBA	0x20000000 /* Enable 60x bus address parity checking */ | |
| 40 | #define HID0_EBD	0x10000000 /* Enable 60x bus data parity checking */ | |
| 41 | #define HID0_BCLK	0x08000000 /* CLK_OUT clock type selection */ | |
| 42 | #define HID0_EICE	0x04000000 /* Enable ICE output */ | |
| 43 | #define HID0_ECLK	0x02000000 /* CLK_OUT clock type selection */ | |
| 44 | #define HID0_PAR	0x01000000 /* Disable precharge of ARTRY */ | |
| 45 | #define HID0_STEN	0x01000000 /* Software table search enable (7450) */ | |
| 46 | #define HID0_DEEPNAP	0x01000000 /* Enable deep nap mode (970) */ | |
| 47 | #define HID0_HBATEN	0x00800000 /* High BAT enable (74[45][578]) */ | |
| 48 | #define HID0_DOZE	0x00800000 /* Enable doze mode */ | |
| 49 | #define HID0_NAP	0x00400000 /* Enable nap mode */ | |
| 50 | #define HID0_SLEEP	0x00200000 /* Enable sleep mode */ | |
| 51 | #define HID0_DPM	0x00100000 /* Enable Dynamic power management */ | |
| 52 | #define HID0_RISEG	0x00080000 /* Read I-SEG */ | |
| 53 | #define HID0_TG		0x00040000 /* Timebase Granularity (OEA64) */ | |
| 54 | #define HID0_BHTCLR	0x00040000 /* Clear branch history table (7450) */ | |
| 55 | #define HID0_EIEC	0x00040000 /* Enable internal error checking */ | |
| 56 | #define HID0_XAEN	0x00020000 /* Enable eXtended Addressing (7450) */ | |
| 57 | #define HID0_NHR	0x00010000 /* Not hard reset */ | |
| 58 | #define HID0_ICE	0x00008000 /* Enable i-cache */ | |
| 59 | #define HID0_DCE	0x00004000 /* Enable d-cache */ | |
| 60 | #define HID0_ILOCK	0x00002000 /* i-cache lock */ | |
| 61 | #define HID0_DLOCK	0x00001000 /* d-cache lock */ | |
| 62 | #define HID0_ICFI	0x00000800 /* i-cache flush invalidate */ | |
| 63 | #define HID0_DCFI	0x00000400 /* d-cache flush invalidate */ | |
| 64 | #define HID0_SPD	0x00000200 /* Disable speculative cache access */ | |
| 65 | #define HID0_XBSEN	0x00000100 /* Extended BAT block-size enable (7457) */ | |
| 66 | #define HID0_IFEM	0x00000100 /* Enable M-bit for I-fetch */ | |
| 67 | #define HID0_XBSEN	0x00000100 /* Extended BAT block size enable (7455+)*/ | |
| 68 | #define HID0_SGE	0x00000080 /* Enable store gathering */ | |
| 69 | #define HID0_DCFA	0x00000040 /* Data cache flush assist */ | |
| 70 | #define HID0_BTIC	0x00000020 /* Enable BTIC */ | |
| 71 | #define HID0_LRSTK	0x00000010 /* Link register stack enable (7450) */ | |
| 72 | #define HID0_ABE	0x00000008 /* Enable address broadcast */ | |
| 73 | #define HID0_FOLD	0x00000008 /* Branch folding enable (7450) */ | |
| 74 | #define HID0_BHT	0x00000004 /* Enable branch history table */ | |
| 75 | #define HID0_NOPTI	0x00000001 /* No-op the dcbt(st) */ | |
| 76 | ||
| 77 | #define HID0_AIM_TBEN	0x04000000 /* Time base enable (7450) */ | |
| 78 | ||
| 79 | #define HID0_E500_TBEN		0x00004000 /* Time Base and decr. enable */ | |
| 80 | #define HID0_E500_SEL_TBCLK	0x00002000 /* Select Time Base clock */ | |
| 81 | #define HID0_E500_MAS7UPDEN	0x00000080 /* Enable MAS7 update (e500v2) */ | |
| 82 | ||
| 83 | #define HID0_E500MC_L2MMU_MHD	0x40000000 /* L2MMU Multiple Hit Detection */ | |
| 84 | ||
| 85 | #define HID0_BITMASK							\ | |
| 86 | "\20"								\ | |
| 87 | "\040EMCP\037DBP\036EBA\035EBD\034BCLK\033EICE\032ECLK\031PAR"	\ | |
| 88 | "\030DOZE\027NAP\026SLEEP\025DPM\024RISEG\023EIEC\022res\021NHR"	\ | |
| 89 | "\020ICE\017DCE\016ILOCK\015DLOCK\014ICFI\013DCFI\012SPD\011IFEM"	\ | |
| 90 | "\010SGE\007DCFA\006BTIC\005FBIOB\004ABE\003BHT\002NOPDST\001NOPTI" | |
| 91 | ||
| 92 | #define HID0_7450_BITMASK						\ | |
| 93 | "\20"								\ | |
| 94 | "\040EMCP\037b1\036b2\035b3\034b4\033TBEN\032b6\031STEN"		\ | |
| 95 | "\030HBATEN\027NAP\026SLEEP\025DPM\024b12\023BHTCLR\022XAEN\021NHR"	\ | |
| 96 | "\020ICE\017DCE\016ILOCK\015DLOCK\014ICFI\013DCFI\012SPD\011XBSEN"	\ | |
| 97 | "\010SGE\007b25\006BTIC\005LRSTK\004FOLD\003BHT\002NOPDST\001NOPTI" | |
| 98 | ||
| 99 | #define HID0_E500_BITMASK						\ | |
| 100 | "\20"								\ | |
| 101 | "\040EMCP\037b1\036b2\035b3\034b4\033b5\032b6\031b7"		\ | |
| 102 | "\030DOZE\027NAP\026SLEEP\025b11\024b12\023b13\022b14\021b15"	\ | |
| 103 | "\020b16\017TBEN\016SEL_TBCLK\015b19\014b20\013b21\012b22\011b23"	\ | |
| 104 | "\010EN_MAS7_UPDATE\007DCFA\006b26\005b27\004b28\003b29\002b30\001NOPTI" | |
| 105 | ||
| 106 | #define HID0_970_BITMASK						\ | |
| 107 | "\20"								\ | |
| 108 | "\040ONEPPC\037SINGLE\036ISYNCSC\035SERGP\031DEEPNAP\030DOZE"	\ | |
| 109 | "\027NAP\025DPM\023TG\022HANGDETECT\021NHR\020INORDER"		\ | |
| 110 | "\016TBCTRL\015TBEN\012CIABREN\011HDICEEN\001ENATTN"		 | |
| 111 | ||
| 112 | #define HID0_E500MC_BITMASK						\ | |
| 113 | "\20"								\ | |
| 114 | "\040EMCP\037EN_L2MMU_MHD\036b2\035b3\034b4\033b5\032b6\031b7"	\ | |
| 115 | "\030b8\027b9\026b10\025b11\024b12\023b13\022b14\021b15"		\ | |
| 116 | "\020b16\017b17\016b18\015b19\014b20\013b21\012b22\011b23"		\ | |
| 117 | "\010EN_MAS7_UPDATE\007DCFA\006b26\005CIGLSO\004b28\003b29\002b30\001NOPTI" | |
| 118 | ||
| 119 | #define HID0_E5500_BITMASK						\ | |
| 120 | "\20"								\ | |
| 121 | "\040EMCP\037EN_L2MMU_MHD\036b2\035b3\034b4\033b5\032b6\031b7"	\ | |
| 122 | "\030b8\027b9\026b10\025b11\024b12\023b13\022b14\021b15"		\ | |
| 123 | "\020b16\017b17\016b18\015b19\014b20\013b21\012b22\011b23"		\ | |
| 124 | "\010b24\007DCFA\006b26\005CIGLSO\004b28\003b29\002b30\001NOPTI" | |
| 125 | ||
| 126 | /* | |
| 127 | * HID0 bit definitions per cpu model | |
| 128 | * | |
| 129 | * bit	603	604	750	7400	7410	7450	7457	e500 | |
| 130 | * 0	EMCP	EMCP	EMCP	EMCP	EMCP	-	-	EMCP | |
| 131 | * 1	-	ECP	DBP	-	-	-	-	- | |
| 132 | * 2	EBA	EBA	EBA	EBA	EDA	-	-	- | |
| 133 | * 3	EBD	EBD	EBD	EBD	EBD	-	-	- | |
| 134 | * 4	SBCLK	-	BCLK	BCKL	BCLK	-	-	- | |
| 135 | * 5	EICE	-	-	-	-	TBEN	TBEN	- | |
| 136 | * 6	ECLK	-	ECLK	ECLK	ECLK	-	-	- | |
| 137 | * 7	PAR	PAR	PAR	PAR	PAR	STEN	STEN	- | |
| 138 | * 8	DOZE	-	DOZE	DOZE	DOZE	-	HBATEN	DOZE | |
| 139 | * 9	NAP	-	NAP	NAP	NAP	NAP	NAP	NAP | |
| 140 | * 10	SLEEP	-	SLEEP	SLEEP	SLEEP	SLEEP	SLEEP	SLEEP | |
| 141 | * 11	DPM	-	DPM	DPM	DPM	DPM	DPM	- | |
| 142 | * 12	RISEG	-	-	RISEG	-	-	-	- | |
| 143 | * 13	-	-	-	EIEC	EIEC	BHTCLR	BHTCLR	- | |
| 144 | * 14	-	-	-	-	-	XAEN	XAEN	- | |
| 145 | * 15	-	NHR	NHR	NHR	NHR	NHR	NHR	- | |
| 146 | * 16	ICE	ICE	ICE	ICE	ICE	ICE	ICE	- | |
| 147 | * 17	DCE	DCE	DCE	DCE	DCE	DCE	DCE	TBEN | |
| 148 | * 18	ILOCK	ILOCK	ILOCK	ILOCK	ILOCK	ILOCK	ILOCK	SEL_TBCLK | |
| 149 | * 19	DLOCK	DLOCK	DLOCK	DLOCK	DLOCK	DLOCK	DLOCK	- | |
| 150 | * 20	ICFI	ICFI	ICFI	ICFI	ICFI	ICFI	ICFI	- | |
| 151 | * 21	DCFI	DCFI	DCFI	DCFI	DCFI	DCFI	DCFI	- | |
| 152 | * 22	-	-	SPD	SPD	SPG	SPD	SPD	- | |
| 153 | * 23	-	-	IFEM	IFTT	IFTT	-	XBSEN	- | |
| 154 | * 24	-	SIE	SGE	SGE	SGE	SGE	SGE	EN_MAS7_UPDATE | |
| 155 | * 25	-	-	DCFA	DCFA	DCFA	-	-	DCFA | |
| 156 | * 26	-	-	BTIC	BTIC	BTIC	BTIC	BTIC	- | |
| 157 | * 27	FBIOB	-	-	-	-	LRSTK	LRSTK	- | |
| 158 | * 28	-	-	ABE	-	-	FOLD	FOLD	- | |
| 159 | * 29	-	BHT	BHT	BHT	BHT	BHT	BHT	- | |
| 160 | * 30	-	-	-	NOPDST	NOPDST	NOPDST	NOPDST	- | |
| 161 | * 31	NOOPTI	-	NOOPTI	NOPTI	NOPTI	NOPTI	NOPTI	NOPTI | |
| 162 | * | |
| 163 | * bit	e500mc		e5500 | |
| 164 | * 0	EMCP		EMCP | |
| 165 | * 1	EN_L2MMU_MHD	EN_L2MMU_MHD | |
| 166 | * 2	-		- | |
| 167 | * 3	-		- | |
| 168 | * 4	-		- | |
| 169 | * 5	-		- | |
| 170 | * 6	-		- | |
| 171 | * 7	-		- | |
| 172 | * 8	-		- | |
| 173 | * 9	-		- | |
| 174 | * 10	-		- | |
| 175 | * 11	-		- | |
| 176 | * 12	-		- | |
| 177 | * 13	-		- | |
| 178 | * 14	-		- | |
| 179 | * 15	-		- | |
| 180 | * 16	-		- | |
| 181 | * 17	-		- | |
| 182 | * 18	-		- | |
| 183 | * 19	-		- | |
| 184 | * 20	-		- | |
| 185 | * 21	-		- | |
| 186 | * 22	-		- | |
| 187 | * 23	-		- | |
| 188 | * 24	EN_MAS7_UPDATE	- | |
| 189 | * 25	DCFA		DCFA | |
| 190 | * 26	-		- | |
| 191 | * 27	CIGLSO		CIGLSO | |
| 192 | * 28	-		- | |
| 193 | * 29	-		- | |
| 194 | * 30	-		- | |
| 195 | * 31	NOPTI		NOPTI | |
| 196 | * | |
| 197 | * 604: ECP = Enable cache parity checking | |
| 198 | * 604: SIE = Serial instruction execution disable | |
| 199 | * 7450: TBEN = Time Base Enable | |
| 200 | * 7450: STEN = Software table lookup enable | |
| 201 | * 7450: BHTCLR = Branch history clear | |
| 202 | * 7450: XAEN = Extended Addressing Enabled | |
| 203 | * 7450: LRSTK = Link Register Stack Enable | |
| 204 | * 7450: FOLD = Branch folding enable | |
| 205 | * 7457: HBATEN = High BAT Enable | |
| 206 | * 7457: XBSEN = Extended BAT Block Size Enable | |
| 207 | */ | |
| 208 | ||
| 209 | #define HID1_E500_ABE	0x00001000 /* Address broadcast enable */ | |
| 210 | #define HID1_E500_ASTME	0x00002000 /* Address bus streaming mode enable */ | |
| 211 | #define HID1_E500_RFXE	0x00020000 /* Read fault exception enable */ | |
| 212 | ||
| 213 | #define HID0_E500_DEFAULT_SET	(HID0_EMCP | HID0_E500_TBEN | \ | |
| 214 | 				 HID0_E500_MAS7UPDEN) | |
| 215 | #define HID1_E500_DEFAULT_SET	(HID1_E500_ABE | HID1_E500_ASTME) | |
| 216 | #define HID0_E500MC_DEFAULT_SET	(HID0_EMCP | HID0_E500MC_L2MMU_MHD | \ | |
| 217 | 				 HID0_E500_MAS7UPDEN) | |
| 218 | #define HID0_E5500_DEFAULT_SET	(HID0_EMCP | HID0_E500MC_L2MMU_MHD) | |
| 219 | ||
| 220 | #define HID5_970_DCBZ_SIZE_HI	0x00000080UL	/* dcbz does a 32-byte store */ | |
| 221 | #define HID4_970_DISABLE_LG_PG	0x00000004ULL	/* disables large pages */ | |
| 222 | ||
| 223 | #endif /* _POWERPC_HID_H_ */ | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/machine/ieee.h deleted-143| ... | ... | @@ -1,143 +0,0 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-3-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 1992, 1993 | |
| 5 | *	The Regents of the University of California. All rights reserved. | |
| 6 | * | |
| 7 | * This software was developed by the Computer Systems Engineering group | |
| 8 | * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and | |
| 9 | * contributed to Berkeley. | |
| 10 | * | |
| 11 | * All advertising materials mentioning features or use of this software | |
| 12 | * must display the following acknowledgement: | |
| 13 | *	This product includes software developed by the University of | |
| 14 | *	California, Lawrence Berkeley Laboratory. | |
| 15 | * | |
| 16 | * Redistribution and use in source and binary forms, with or without | |
| 17 | * modification, are permitted provided that the following conditions | |
| 18 | * are met: | |
| 19 | * 1. Redistributions of source code must retain the above copyright | |
| 20 | * notice, this list of conditions and the following disclaimer. | |
| 21 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 22 | * notice, this list of conditions and the following disclaimer in the | |
| 23 | * documentation and/or other materials provided with the distribution. | |
| 24 | * 3. Neither the name of the University nor the names of its contributors | |
| 25 | * may be used to endorse or promote products derived from this software | |
| 26 | * without specific prior written permission. | |
| 27 | * | |
| 28 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | |
| 29 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 30 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
| 31 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
| 32 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
| 33 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
| 34 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
| 35 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
| 36 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
| 37 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
| 38 | * SUCH DAMAGE. | |
| 39 | * | |
| 40 | *	@(#)ieee.h	8.1 (Berkeley) 6/11/93 | |
| 41 | *	from: NetBSD: ieee.h,v 1.1.1.1 1998/06/20 04:58:51 eeh Exp | |
| 42 | */ | |
| 43 | ||
| 44 | #ifndef _MACHINE_IEEE_H_ | |
| 45 | #define	_MACHINE_IEEE_H_ | |
| 46 | ||
| 47 | /* | |
| 48 | * ieee.h defines the machine-dependent layout of the machine's IEEE | |
| 49 | * floating point. It does *not* define (yet?) any of the rounding | |
| 50 | * mode bits, exceptions, and so forth. | |
| 51 | */ | |
| 52 | ||
| 53 | /* | |
| 54 | * Define the number of bits in each fraction and exponent. | |
| 55 | * | |
| 56 | *		 k	 k+1 | |
| 57 | * Note that 1.0 x 2 == 0.1 x 2 and that denorms are represented | |
| 58 | * | |
| 59 | *					 (-exp_bias+1) | |
| 60 | * as fractions that look like 0.fffff x 2 . This means that | |
| 61 | * | |
| 62 | *			 -126 | |
| 63 | * the number 0.10000 x 2 , for instance, is the same as the normalized | |
| 64 | * | |
| 65 | *		-127			 -128 | |
| 66 | * float 1.0 x 2 . Thus, to represent 2 , we need one leading zero | |
| 67 | * | |
| 68 | *				 -129 | |
| 69 | * in the fraction; to represent 2 , we need two, and so on. This | |
| 70 | * | |
| 71 | *						 (-exp_bias-fracbits+1) | |
| 72 | * implies that the smallest denormalized number is 2 | |
| 73 | * | |
| 74 | * for whichever format we are talking about: for single precision, for | |
| 75 | * | |
| 76 | *						-126		-149 | |
| 77 | * instance, we get .00000000000000000000001 x 2 , or 1.0 x 2 , and | |
| 78 | * | |
| 79 | * -149 == -127 - 23 + 1. | |
| 80 | */ | |
| 81 | #define	SNG_EXPBITS	8 | |
| 82 | #define	SNG_FRACBITS	23 | |
| 83 | ||
| 84 | #define	DBL_EXPBITS	11 | |
| 85 | #define	DBL_FRACBITS	52 | |
| 86 | ||
| 87 | #ifdef notyet | |
| 88 | #define	E80_EXPBITS	15 | |
| 89 | #define	E80_FRACBITS	64 | |
| 90 | #endif | |
| 91 | ||
| 92 | #define	EXT_EXPBITS	15 | |
| 93 | #define	EXT_FRACBITS	112 | |
| 94 | ||
| 95 | struct ieee_single { | |
| 96 | 	u_int	sng_sign:1; | |
| 97 | 	u_int	sng_exp:8; | |
| 98 | 	u_int	sng_frac:23; | |
| 99 | }; | |
| 100 | ||
| 101 | struct ieee_double { | |
| 102 | 	u_int	dbl_sign:1; | |
| 103 | 	u_int	dbl_exp:11; | |
| 104 | 	u_int	dbl_frach:20; | |
| 105 | 	u_int	dbl_fracl; | |
| 106 | }; | |
| 107 | ||
| 108 | struct ieee_ext { | |
| 109 | 	u_int	ext_sign:1; | |
| 110 | 	u_int	ext_exp:15; | |
| 111 | 	u_int	ext_frach:16; | |
| 112 | 	u_int	ext_frachm; | |
| 113 | 	u_int	ext_fraclm; | |
| 114 | 	u_int	ext_fracl; | |
| 115 | }; | |
| 116 | ||
| 117 | /* | |
| 118 | * Floats whose exponent is in [1..INFNAN) (of whatever type) are | |
| 119 | * `normal'. Floats whose exponent is INFNAN are either Inf or NaN. | |
| 120 | * Floats whose exponent is zero are either zero (iff all fraction | |
| 121 | * bits are zero) or subnormal values. | |
| 122 | * | |
| 123 | * A NaN is a `signalling NaN' if its QUIETNAN bit is clear in its | |
| 124 | * high fraction; if the bit is set, it is a `quiet NaN'. | |
| 125 | */ | |
| 126 | #define	SNG_EXP_INFNAN	255 | |
| 127 | #define	DBL_EXP_INFNAN	2047 | |
| 128 | #define	EXT_EXP_INFNAN	32767 | |
| 129 | ||
| 130 | #if 0 | |
| 131 | #define	SNG_QUIETNAN	(1 << 22) | |
| 132 | #define	DBL_QUIETNAN	(1 << 19) | |
| 133 | #define	EXT_QUIETNAN	(1 << 15) | |
| 134 | #endif | |
| 135 | ||
| 136 | /* | |
| 137 | * Exponent biases. | |
| 138 | */ | |
| 139 | #define	SNG_EXP_BIAS	127 | |
| 140 | #define	DBL_EXP_BIAS	1023 | |
| 141 | #define	EXT_EXP_BIAS	16383 | |
| 142 | ||
| 143 | #endif | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/machine/ieeefp.h deleted-42| ... | ... | @@ -1,42 +0,0 @@ |
| 1 | /* - | |
| 2 | * Written by J.T. Conklin, Apr 6, 1995 | |
| 3 | * Public domain. | |
| 4 | * $NetBSD: ieeefp.h,v 1.2 1999/07/07 01:52:26 danw Exp $ | |
| 5 | */ | |
| 6 | ||
| 7 | #ifndef _MACHINE_IEEEFP_H_ | |
| 8 | #define _MACHINE_IEEEFP_H_ | |
| 9 | ||
| 10 | /* Deprecated historical FPU control interface */ | |
| 11 | ||
| 12 | typedef int fp_except_t; | |
| 13 | #ifdef __SPE__ | |
| 14 | #define FP_X_OFL	0x01	/* overflow exception */ | |
| 15 | #define FP_X_UFL	0x02	/* underflow exception */ | |
| 16 | #define FP_X_DZ		0x04	/* divide-by-zero exception */ | |
| 17 | #define FP_X_INV	0x08	/* invalid operation exception */ | |
| 18 | #define FP_X_IMP	0x10	/* imprecise (loss of precision) */ | |
| 19 | #else | |
| 20 | #define FP_X_IMP	0x01	/* imprecise (loss of precision) */ | |
| 21 | #define FP_X_DZ		0x02	/* divide-by-zero exception */ | |
| 22 | #define FP_X_UFL	0x04	/* underflow exception */ | |
| 23 | #define FP_X_OFL	0x08	/* overflow exception */ | |
| 24 | #define FP_X_INV	0x10	/* invalid operation exception */ | |
| 25 | #endif | |
| 26 | ||
| 27 | typedef enum { | |
| 28 | FP_RN=0,			/* round to nearest representable number */ | |
| 29 | FP_RZ=1,			/* round to zero (truncate) */ | |
| 30 | FP_RP=2,			/* round toward positive infinity */ | |
| 31 | FP_RM=3			/* round toward negative infinity */ | |
| 32 | } fp_rnd_t; | |
| 33 | ||
| 34 | __BEGIN_DECLS | |
| 35 | extern fp_rnd_t fpgetround(void); | |
| 36 | extern fp_rnd_t fpsetround(fp_rnd_t); | |
| 37 | extern fp_except_t fpgetmask(void); | |
| 38 | extern fp_except_t fpsetmask(fp_except_t); | |
| 39 | extern fp_except_t fpgetsticky(void); | |
| 40 | __END_DECLS | |
| 41 | ||
| 42 | #endif /* _MACHINE_IEEEFP_H_ */ | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/machine/ifunc.h deleted-58| ... | ... | @@ -1,58 +0,0 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-2-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 2019 Brandon Bergren <bdragon@FreeBSD.org> | |
| 5 | * Copyright (c) 2015-2018 The FreeBSD Foundation. All rights reserved. | |
| 6 | * | |
| 7 | * Part of this software was developed by | |
| 8 | * Konstantin Belousov <kib@FreeBSD.org> | |
| 9 | * under sponsorship from the FreeBSD Foundation. | |
| 10 | * | |
| 11 | * Redistribution and use in source and binary forms, with or without | |
| 12 | * modification, are permitted provided that the following conditions | |
| 13 | * are met: | |
| 14 | * 1. Redistributions of source code must retain the above copyright | |
| 15 | * notice, this list of conditions and the following disclaimer. | |
| 16 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 17 | * notice, this list of conditions and the following disclaimer in the | |
| 18 | * documentation and/or other materials provided with the distribution. | |
| 19 | * | |
| 20 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |
| 21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 22 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
| 23 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | |
| 24 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
| 25 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
| 26 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
| 27 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
| 28 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
| 29 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
| 30 | * SUCH DAMAGE. | |
| 31 | */ | |
| 32 | ||
| 33 | #ifndef __POWERPC_IFUNC_H | |
| 34 | #define	__POWERPC_IFUNC_H | |
| 35 | ||
| 36 | #include <sys/types.h> | |
| 37 | ||
| 38 | #define	DEFINE_IFUNC(qual, ret_type, name, args)			\ | |
| 39 | static ret_type (*name##_resolver(void))args __used;		\ | |
| 40 | qual ret_type name args __attribute__((ifunc(#name "_resolver")));	\ | |
| 41 | static ret_type (*name##_resolver(void))args | |
| 42 | ||
| 43 | #define	DEFINE_UIFUNC(qual, ret_type, name, args)			\ | |
| 44 | static ret_type (*name##_resolver(register_t, register_t,		\ | |
| 45 | 	register_t, register_t, register_t, register_t, register_t,	\ | |
| 46 | 	register_t))args __used;					\ | |
| 47 | qual ret_type name args __attribute__((ifunc(#name "_resolver")));	\ | |
| 48 | static ret_type (*name##_resolver(					\ | |
| 49 | 	register_t cpu_features,					\ | |
| 50 | 	register_t cpu_features2,					\ | |
| 51 | 	register_t arg3 __unused,					\ | |
| 52 | 	register_t arg4 __unused,					\ | |
| 53 | 	register_t arg5 __unused,					\ | |
| 54 | 	register_t arg6 __unused,					\ | |
| 55 | 	register_t arg7 __unused,					\ | |
| 56 | 	register_t arg8 __unused))args | |
| 57 | ||
| 58 | #endif | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/machine/in_cksum.h-1| ... | ... | @@ -29,7 +29,6 @@ |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | 30 | * |
| 31 | 31 | *	from tahoe:	in_cksum.c	1.2	86/01/05 |
| 32 | *	from:		@(#)in_cksum.c	1.3 (Berkeley) 1/19/91 | |
| 33 | 32 | *	from: Id: in_cksum.c,v 1.8 1995/12/03 18:35:19 bde Exp |
| 34 | 33 | */ |
| 35 | 34 |
lib/libc/include/generic-freebsd/machine/intr_machdep.h deleted-64| ... | ... | @@ -1,64 +0,0 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-2-Clause | |
| 3 | * | |
| 4 | * Copyright (C) 2002 Benno Rice. | |
| 5 | * All rights reserved. | |
| 6 | * | |
| 7 | * Redistribution and use in source and binary forms, with or without | |
| 8 | * modification, are permitted provided that the following conditions | |
| 9 | * are met: | |
| 10 | * 1. Redistributions of source code must retain the above copyright | |
| 11 | * notice, this list of conditions and the following disclaimer. | |
| 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 13 | * notice, this list of conditions and the following disclaimer in the | |
| 14 | * documentation and/or other materials provided with the distribution. | |
| 15 | * | |
| 16 | * THIS SOFTWARE IS PROVIDED BY Benno Rice ``AS IS'' AND ANY EXPRESS OR | |
| 17 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |
| 18 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | |
| 19 | * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
| 20 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | |
| 21 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; | |
| 22 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | |
| 23 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | |
| 24 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | |
| 25 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 26 | */ | |
| 27 | ||
| 28 | #ifndef	_MACHINE_INTR_MACHDEP_H_ | |
| 29 | #define	_MACHINE_INTR_MACHDEP_H_ | |
| 30 | ||
| 31 | #define	INTR_VECTORS	256 | |
| 32 | ||
| 33 | #define	MAX_PICS		32 | |
| 34 | #define	MAP_IRQ(node, pin)	powerpc_get_irq(node, pin) | |
| 35 | ||
| 36 | /* | |
| 37 | * Default base address for MSI messages on PowerPC | |
| 38 | */ | |
| 39 | #define	MSI_INTEL_ADDR_BASE		0xfee00000 | |
| 40 | ||
| 41 | extern device_t root_pic; | |
| 42 | ||
| 43 | struct trapframe; | |
| 44 | ||
| 45 | driver_filter_t powerpc_ipi_handler; | |
| 46 | ||
| 47 | void	intrcnt_add(const char *name, u_long **countp); | |
| 48 | ||
| 49 | u_int	powerpc_register_pic(device_t, uint32_t, u_int, u_int, u_int); | |
| 50 | u_int	powerpc_get_irq(uint32_t, u_int); | |
| 51 | ||
| 52 | void	powerpc_dispatch_intr(u_int, struct trapframe *); | |
| 53 | int	powerpc_enable_intr(void); | |
| 54 | int	powerpc_setup_intr(const char *, u_int, driver_filter_t, driver_intr_t, | |
| 55 | 	 void *, enum intr_type, void **, int); | |
| 56 | int	powerpc_teardown_intr(void *); | |
| 57 | int	powerpc_bind_intr(u_int irq, u_char cpu); | |
| 58 | int	powerpc_config_intr(int, enum intr_trigger, enum intr_polarity); | |
| 59 | int	powerpc_fw_config_intr(int irq, int sense_code); | |
| 60 | ||
| 61 | void	powerpc_intr_mask(u_int irq); | |
| 62 | void	powerpc_intr_unmask(u_int irq); | |
| 63 | ||
| 64 | #endif /* _MACHINE_INTR_MACHDEP_H_ */ | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/machine/kdb.h deleted-67| ... | ... | @@ -1,67 +0,0 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-2-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 2004 Marcel Moolenaar | |
| 5 | * All rights reserved. | |
| 6 | * | |
| 7 | * Redistribution and use in source and binary forms, with or without | |
| 8 | * modification, are permitted provided that the following conditions | |
| 9 | * are met: | |
| 10 | * | |
| 11 | * 1. Redistributions of source code must retain the above copyright | |
| 12 | * notice, this list of conditions and the following disclaimer. | |
| 13 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 14 | * notice, this list of conditions and the following disclaimer in the | |
| 15 | * documentation and/or other materials provided with the distribution. | |
| 16 | * | |
| 17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | |
| 18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |
| 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | |
| 20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | |
| 21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | |
| 22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
| 23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
| 24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
| 25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | |
| 26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 27 | */ | |
| 28 | ||
| 29 | #ifndef _MACHINE_KDB_H_ | |
| 30 | #define _MACHINE_KDB_H_ | |
| 31 | ||
| 32 | #include <machine/cpufunc.h> | |
| 33 | #include <machine/frame.h> | |
| 34 | #include <machine/md_var.h> | |
| 35 | #include <machine/psl.h> | |
| 36 | #include <machine/spr.h> | |
| 37 | ||
| 38 | void kdb_cpu_clear_singlestep(void); | |
| 39 | void kdb_cpu_set_singlestep(void); | |
| 40 | ||
| 41 | static __inline void | |
| 42 | kdb_cpu_sync_icache(unsigned char *addr, size_t size) | |
| 43 | { | |
| 44 | ||
| 45 | 	__syncicache(addr, size); | |
| 46 | } | |
| 47 | ||
| 48 | static __inline void | |
| 49 | kdb_cpu_trap(int vector, int _) | |
| 50 | { | |
| 51 | } | |
| 52 | ||
| 53 | static __inline int | |
| 54 | kdb_cpu_set_watchpoint(vm_offset_t addr, vm_size_t size, int access) | |
| 55 | { | |
| 56 | ||
| 57 | 	return (ENXIO); | |
| 58 | } | |
| 59 | ||
| 60 | static __inline int | |
| 61 | kdb_cpu_clr_watchpoint(vm_offset_t addr, vm_size_t size) | |
| 62 | { | |
| 63 | ||
| 64 | 	return (0); | |
| 65 | } | |
| 66 | ||
| 67 | #endif /* _MACHINE_KDB_H_ */ | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/machine/limits.h-2| ... | ... | @@ -27,8 +27,6 @@ |
| 27 | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | * | |
| 31 | *	@(#)limits.h	8.3 (Berkeley) 1/4/94 | |
| 32 | 30 | */ |
| 33 | 31 | |
| 34 | 32 | #ifndef _MACHINE_LIMITS_H_ |
lib/libc/include/generic-freebsd/machine/machdep.h deleted-37| ... | ... | @@ -1,37 +0,0 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-2-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 2011-2012 Semihalf | |
| 5 | * All rights reserved. | |
| 6 | * | |
| 7 | * Redistribution and use in source and binary forms, with or without | |
| 8 | * modification, are permitted provided that the following conditions | |
| 9 | * are met: | |
| 10 | * 1. Redistributions of source code must retain the above copyright | |
| 11 | * notice, this list of conditions and the following disclaimer. | |
| 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 13 | * notice, this list of conditions and the following disclaimer in the | |
| 14 | * documentation and/or other materials provided with the distribution. | |
| 15 | * | |
| 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |
| 17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
| 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | |
| 20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
| 21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
| 22 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
| 23 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
| 24 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
| 25 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
| 26 | * SUCH DAMAGE. | |
| 27 | */ | |
| 28 | ||
| 29 | #ifndef _POWERPC_MACHDEP_H_ | |
| 30 | #define _POWERPC_MACHDEP_H_ | |
| 31 | ||
| 32 | void booke_disable_l2_cache(void); | |
| 33 | void booke_enable_l1_cache(void); | |
| 34 | void booke_enable_l2_cache(void); | |
| 35 | void booke_enable_bpred(void); | |
| 36 | ||
| 37 | #endif /* _POWERPC_MACHDEP_H_ */ | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/machine/md_var.h deleted-71| ... | ... | @@ -1,71 +0,0 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-2-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 1998 Doug Rabson | |
| 5 | * All rights reserved. | |
| 6 | * | |
| 7 | * Redistribution and use in source and binary forms, with or without | |
| 8 | * modification, are permitted provided that the following conditions | |
| 9 | * are met: | |
| 10 | * 1. Redistributions of source code must retain the above copyright | |
| 11 | * notice, this list of conditions and the following disclaimer. | |
| 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 13 | * notice, this list of conditions and the following disclaimer in the | |
| 14 | * documentation and/or other materials provided with the distribution. | |
| 15 | * | |
| 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |
| 17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
| 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | |
| 20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
| 21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
| 22 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
| 23 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
| 24 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
| 25 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
| 26 | * SUCH DAMAGE. | |
| 27 | */ | |
| 28 | ||
| 29 | #ifndef _MACHINE_MD_VAR_H_ | |
| 30 | #define	_MACHINE_MD_VAR_H_ | |
| 31 | ||
| 32 | /* | |
| 33 | * Miscellaneous machine-dependent declarations. | |
| 34 | */ | |
| 35 | ||
| 36 | extern	char	sigcode32[]; | |
| 37 | extern	int	szsigcode32; | |
| 38 | ||
| 39 | #ifdef __powerpc64__ | |
| 40 | extern	char	sigcode64[], sigcode64_elfv2[]; | |
| 41 | extern	int	szsigcode64, szsigcode64_elfv2; | |
| 42 | ||
| 43 | struct	dumperinfo; | |
| 44 | struct	minidumpstate; | |
| 45 | int	cpu_minidumpsys(struct dumperinfo *, const struct minidumpstate *); | |
| 46 | #endif | |
| 47 | ||
| 48 | extern	long	Maxmem; | |
| 49 | ||
| 50 | extern	vm_offset_t	kstack0; | |
| 51 | extern	vm_offset_t	kstack0_phys; | |
| 52 | ||
| 53 | extern	int powerpc_pow_enabled; | |
| 54 | extern	int cacheline_size; | |
| 55 | extern int hw_direct_map; | |
| 56 | ||
| 57 | void	__syncicache(void *, int); | |
| 58 | ||
| 59 | int	mem_valid(vm_offset_t addr, int len); | |
| 60 | ||
| 61 | void	decr_init(void); | |
| 62 | void	decr_ap_init(void); | |
| 63 | void	decr_tc_init(void); | |
| 64 | ||
| 65 | void	cpu_feature_setup(void); | |
| 66 | void	cpu_setup(u_int); | |
| 67 | ||
| 68 | struct	trapframe; | |
| 69 | void	powerpc_interrupt(struct trapframe *); | |
| 70 | ||
| 71 | #endif /* !_MACHINE_MD_VAR_H_ */ | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/machine/metadata.h+2-35| ... | ... | @@ -1,38 +1,5 @@ |
| 1 | 1 | /*- |
| 2 | * SPDX-License-Identifier: BSD-2-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 2001 Jake Burkholder. | |
| 5 | * All rights reserved. | |
| 6 | * | |
| 7 | * Redistribution and use in source and binary forms, with or without | |
| 8 | * modification, are permitted provided that the following conditions | |
| 9 | * are met: | |
| 10 | * 1. Redistributions of source code must retain the above copyright | |
| 11 | * notice, this list of conditions and the following disclaimer. | |
| 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 13 | * notice, this list of conditions and the following disclaimer in the | |
| 14 | * documentation and/or other materials provided with the distribution. | |
| 15 | * | |
| 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |
| 17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
| 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | |
| 20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
| 21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
| 22 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
| 23 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
| 24 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
| 25 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
| 26 | * SUCH DAMAGE. | |
| 2 | * This file is in the public domain. | |
| 27 | 3 | */ |
| 28 | 4 | |
| 29 | #ifndef _MACHINE_METADATA_H_ | |
| 30 | #define	_MACHINE_METADATA_H_ | |
| 31 | ||
| 32 | #define	MODINFOMD_ENVP		0x1001 | |
| 33 | #define	MODINFOMD_HOWTO		0x1002 | |
| 34 | #define	MODINFOMD_KERNEND	0x1003 | |
| 35 | #define	MODINFOMD_BOOTINFO	0x1004 | |
| 36 | #define	MODINFOMD_DTBP		0x1005 | |
| 37 | ||
| 38 | #endif /* !_MACHINE_METADATA_H_ */ | |
| \ No newline at end of file | ||
| 5 | #include <x86/metadata.h> | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/machine/minidump.h deleted-52| ... | ... | @@ -1,52 +0,0 @@ |
| 1 | /*- | |
| 2 | * Copyright (c) 2006 Peter Wemm | |
| 3 | * All rights reserved. | |
| 4 | * | |
| 5 | * Redistribution and use in source and binary forms, with or without | |
| 6 | * modification, are permitted provided that the following conditions | |
| 7 | * are met: | |
| 8 | * | |
| 9 | * 1. Redistributions of source code must retain the above copyright | |
| 10 | * notice, this list of conditions and the following disclaimer. | |
| 11 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 12 | * notice, this list of conditions and the following disclaimer in the | |
| 13 | * documentation and/or other materials provided with the distribution. | |
| 14 | * | |
| 15 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | |
| 16 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |
| 17 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | |
| 18 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | |
| 19 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | |
| 20 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
| 21 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
| 22 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
| 23 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | |
| 24 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 25 | * | |
| 26 | * From i386: FreeBSD: 157909 2006-04-21 04:28:43Z peter | |
| 27 | */ | |
| 28 | ||
| 29 | #ifndef	_MACHINE_MINIDUMP_H_ | |
| 30 | #define	_MACHINE_MINIDUMP_H_ 1 | |
| 31 | ||
| 32 | #define	MINIDUMP_MAGIC		"minidump FreeBSD/powerpc64" | |
| 33 | #define	MINIDUMP_VERSION	2 | |
| 34 | ||
| 35 | struct minidumphdr { | |
| 36 | 	char magic[32]; | |
| 37 | 	char mmu_name[32]; | |
| 38 | 	uint32_t version; | |
| 39 | 	uint32_t msgbufsize; | |
| 40 | 	uint32_t bitmapsize; | |
| 41 | 	uint32_t pmapsize; | |
| 42 | 	uint64_t kernbase; | |
| 43 | 	uint64_t kernend; | |
| 44 | 	uint64_t dmapbase; | |
| 45 | 	uint64_t dmapend; | |
| 46 | 	int hw_direct_map; | |
| 47 | 	uint64_t startkernel; | |
| 48 | 	uint64_t endkernel; | |
| 49 | 	uint32_t dumpavailsize; | |
| 50 | }; | |
| 51 | ||
| 52 | #endif /* _MACHINE_MINIDUMP_H_ */ | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/machine/mmuvar.h deleted-224| ... | ... | @@ -1,224 +0,0 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-2-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 2005 Peter Grehan | |
| 5 | * All rights reserved. | |
| 6 | * | |
| 7 | * Redistribution and use in source and binary forms, with or without | |
| 8 | * modification, are permitted provided that the following conditions | |
| 9 | * are met: | |
| 10 | * 1. Redistributions of source code must retain the above copyright | |
| 11 | * notice, this list of conditions and the following disclaimer. | |
| 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 13 | * notice, this list of conditions and the following disclaimer in the | |
| 14 | * documentation and/or other materials provided with the distribution. | |
| 15 | * | |
| 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |
| 17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
| 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | |
| 20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
| 21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
| 22 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
| 23 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
| 24 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
| 25 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
| 26 | * SUCH DAMAGE. | |
| 27 | */ | |
| 28 | ||
| 29 | #ifndef _MACHINE_MMUVAR_H_ | |
| 30 | #define _MACHINE_MMUVAR_H_ | |
| 31 | ||
| 32 | typedef	void	(*pmap_bootstrap_t)(vm_offset_t, vm_offset_t); | |
| 33 | typedef	void	(*pmap_cpu_bootstrap_t)(int); | |
| 34 | typedef	void	(*pmap_kenter_t)(vm_offset_t, vm_paddr_t pa); | |
| 35 | typedef	void	(*pmap_kenter_attr_t)(vm_offset_t, vm_paddr_t, vm_memattr_t); | |
| 36 | typedef	void	(*pmap_kremove_t)(vm_offset_t); | |
| 37 | typedef	void	*(*pmap_mapdev_t)(vm_paddr_t, vm_size_t); | |
| 38 | typedef	void	*(*pmap_mapdev_attr_t)(vm_paddr_t, vm_size_t, vm_memattr_t); | |
| 39 | typedef	void	(*pmap_unmapdev_t)(void *, vm_size_t); | |
| 40 | typedef	void	(*pmap_page_set_memattr_t)(vm_page_t, vm_memattr_t); | |
| 41 | typedef	int	(*pmap_change_attr_t)(vm_offset_t, vm_size_t, vm_memattr_t); | |
| 42 | typedef	int	(*pmap_map_user_ptr_t)(pmap_t, volatile const void *, | |
| 43 | 		 void **, size_t, size_t *); | |
| 44 | typedef	int	(*pmap_decode_kernel_ptr_t)(vm_offset_t, int *, vm_offset_t *); | |
| 45 | typedef	vm_paddr_t	(*pmap_kextract_t)(vm_offset_t); | |
| 46 | typedef	int	(*pmap_dev_direct_mapped_t)(vm_paddr_t, vm_size_t); | |
| 47 | ||
| 48 | typedef	void	(*pmap_page_array_startup_t)(long); | |
| 49 | typedef	void	(*pmap_advise_t)(pmap_t, vm_offset_t, vm_offset_t, int); | |
| 50 | typedef	void	(*pmap_clear_modify_t)(vm_page_t); | |
| 51 | typedef	void	(*pmap_remove_write_t)(vm_page_t); | |
| 52 | typedef	void	(*pmap_copy_t)(pmap_t, pmap_t, vm_offset_t, vm_size_t, vm_offset_t); | |
| 53 | typedef	void	(*pmap_copy_page_t)(vm_page_t, vm_page_t); | |
| 54 | typedef	void	(*pmap_copy_pages_t)(vm_page_t *, vm_offset_t, | |
| 55 | 		 vm_page_t *, vm_offset_t, int); | |
| 56 | typedef	int	(*pmap_enter_t)(pmap_t, vm_offset_t, vm_page_t, vm_prot_t, | |
| 57 | 		 u_int, int8_t); | |
| 58 | typedef	void	(*pmap_enter_object_t)(pmap_t, vm_offset_t, vm_offset_t, | |
| 59 | 		 vm_page_t, vm_prot_t); | |
| 60 | typedef	void	(*pmap_enter_quick_t)(pmap_t, vm_offset_t, vm_page_t, vm_prot_t); | |
| 61 | typedef	vm_paddr_t	(*pmap_extract_t)(pmap_t, vm_offset_t); | |
| 62 | typedef	vm_page_t	(*pmap_extract_and_hold_t)(pmap_t, vm_offset_t, vm_prot_t); | |
| 63 | typedef	void	(*pmap_growkernel_t)(vm_offset_t); | |
| 64 | typedef	void	(*pmap_init_t)(void); | |
| 65 | typedef	boolean_t	(*pmap_is_modified_t)(vm_page_t); | |
| 66 | typedef	boolean_t	(*pmap_is_prefaultable_t)(pmap_t, vm_offset_t); | |
| 67 | typedef	boolean_t	(*pmap_is_referenced_t)(vm_page_t); | |
| 68 | typedef	int	(*pmap_ts_referenced_t)(vm_page_t); | |
| 69 | typedef	vm_offset_t	(*pmap_map_t)(vm_offset_t *, vm_paddr_t, vm_paddr_t, int); | |
| 70 | typedef	void	(*pmap_object_init_pt_t)(pmap_t, vm_offset_t, vm_object_t, | |
| 71 | 		 vm_pindex_t, vm_size_t); | |
| 72 | typedef	boolean_t	(*pmap_page_exists_quick_t)(pmap_t, vm_page_t); | |
| 73 | typedef	boolean_t	(*pmap_page_is_mapped_t)(vm_page_t); | |
| 74 | typedef	void	(*pmap_page_init_t)(vm_page_t); | |
| 75 | typedef	int	(*pmap_page_wired_mappings_t)(vm_page_t); | |
| 76 | typedef	void	(*pmap_pinit0_t)(pmap_t); | |
| 77 | typedef	void	(*pmap_protect_t)(pmap_t, vm_offset_t, vm_offset_t, vm_prot_t); | |
| 78 | typedef	void	(*pmap_qenter_t)(vm_offset_t, vm_page_t *, int); | |
| 79 | typedef	void	(*pmap_qremove_t)(vm_offset_t, int); | |
| 80 | typedef	void	(*pmap_release_t)(pmap_t); | |
| 81 | typedef	void	(*pmap_remove_t)(pmap_t, vm_offset_t, vm_offset_t); | |
| 82 | typedef	void	(*pmap_remove_all_t)(vm_page_t); | |
| 83 | typedef	void	(*pmap_remove_pages_t)(pmap_t); | |
| 84 | typedef	void	(*pmap_unwire_t)(pmap_t, vm_offset_t, vm_offset_t); | |
| 85 | typedef	void	(*pmap_zero_page_t)(vm_page_t); | |
| 86 | typedef	void	(*pmap_zero_page_area_t)(vm_page_t, int, int); | |
| 87 | typedef	int	(*pmap_mincore_t)(pmap_t, vm_offset_t, vm_paddr_t *); | |
| 88 | typedef	void	(*pmap_activate_t)(struct thread	*); | |
| 89 | typedef void	(*pmap_deactivate_t)(struct thread	*); | |
| 90 | typedef	void	(*pmap_align_superpage_t)(vm_object_t, vm_ooffset_t, | |
| 91 | 		 vm_offset_t *, vm_size_t); | |
| 92 | ||
| 93 | typedef	void	(*pmap_sync_icache_t)(pmap_t, vm_offset_t, vm_size_t); | |
| 94 | typedef	void	(*pmap_dumpsys_map_chunk_t)(vm_paddr_t, size_t, void **); | |
| 95 | typedef	void	(*pmap_dumpsys_unmap_chunk_t)(vm_paddr_t, size_t, void *); | |
| 96 | typedef	void	(*pmap_dumpsys_pa_init_t)(void); | |
| 97 | typedef	size_t	(*pmap_dumpsys_scan_pmap_t)(struct bitset *dump_bitset); | |
| 98 | typedef	void	*(*pmap_dumpsys_dump_pmap_init_t)(unsigned); | |
| 99 | typedef	void	*(*pmap_dumpsys_dump_pmap_t)(void *, void *, u_long *); | |
| 100 | typedef	vm_offset_t	(*pmap_quick_enter_page_t)(vm_page_t); | |
| 101 | typedef	void	(*pmap_quick_remove_page_t)(vm_offset_t); | |
| 102 | typedef	bool	(*pmap_ps_enabled_t)(pmap_t); | |
| 103 | typedef	void	(*pmap_tlbie_all_t)(void); | |
| 104 | typedef void	(*pmap_installer_t)(void); | |
| 105 | ||
| 106 | struct pmap_funcs { | |
| 107 | 	pmap_installer_t	install; | |
| 108 | 	pmap_bootstrap_t	bootstrap; | |
| 109 | 	pmap_cpu_bootstrap_t	cpu_bootstrap; | |
| 110 | 	pmap_kenter_t		kenter; | |
| 111 | 	pmap_kenter_attr_t	kenter_attr; | |
| 112 | 	pmap_kremove_t		kremove; | |
| 113 | 	pmap_mapdev_t		mapdev; | |
| 114 | 	pmap_mapdev_attr_t	mapdev_attr; | |
| 115 | 	pmap_unmapdev_t		unmapdev; | |
| 116 | 	pmap_page_set_memattr_t	page_set_memattr; | |
| 117 | 	pmap_change_attr_t	change_attr; | |
| 118 | 	pmap_map_user_ptr_t	map_user_ptr; | |
| 119 | 	pmap_decode_kernel_ptr_t	decode_kernel_ptr; | |
| 120 | 	pmap_kextract_t		kextract; | |
| 121 | 	pmap_dev_direct_mapped_t	dev_direct_mapped; | |
| 122 | 	pmap_advise_t		advise; | |
| 123 | 	pmap_clear_modify_t	clear_modify; | |
| 124 | 	pmap_remove_write_t	remove_write; | |
| 125 | 	pmap_copy_t	copy; | |
| 126 | 	pmap_copy_page_t	copy_page; | |
| 127 | 	pmap_copy_pages_t	copy_pages; | |
| 128 | 	pmap_enter_t	enter; | |
| 129 | 	pmap_enter_object_t	enter_object; | |
| 130 | 	pmap_enter_quick_t	enter_quick; | |
| 131 | 	pmap_extract_t	extract; | |
| 132 | 	pmap_extract_and_hold_t	extract_and_hold; | |
| 133 | 	pmap_growkernel_t	growkernel; | |
| 134 | 	pmap_init_t	init; | |
| 135 | 	pmap_is_modified_t	is_modified; | |
| 136 | 	pmap_is_prefaultable_t	is_prefaultable; | |
| 137 | 	pmap_is_referenced_t	is_referenced; | |
| 138 | 	pmap_ts_referenced_t	ts_referenced; | |
| 139 | 	pmap_page_is_mapped_t	page_is_mapped; | |
| 140 | 	pmap_ps_enabled_t	ps_enabled; | |
| 141 | 	pmap_map_t	map; | |
| 142 | 	pmap_object_init_pt_t	object_init_pt; | |
| 143 | 	pmap_page_exists_quick_t	page_exists_quick; | |
| 144 | 	pmap_page_init_t	page_init; | |
| 145 | 	pmap_page_wired_mappings_t	page_wired_mappings; | |
| 146 | 	pmap_pinit_t	pinit; | |
| 147 | 	pmap_pinit0_t	pinit0; | |
| 148 | 	pmap_protect_t	protect; | |
| 149 | 	pmap_qenter_t	qenter; | |
| 150 | 	pmap_qremove_t	qremove; | |
| 151 | 	pmap_release_t	release; | |
| 152 | 	pmap_remove_t	remove; | |
| 153 | 	pmap_remove_all_t	remove_all; | |
| 154 | 	pmap_remove_pages_t	remove_pages; | |
| 155 | 	pmap_unwire_t	unwire; | |
| 156 | 	pmap_zero_page_t	zero_page; | |
| 157 | 	pmap_zero_page_area_t	zero_page_area; | |
| 158 | 	pmap_mincore_t	mincore; | |
| 159 | 	pmap_activate_t	activate; | |
| 160 | 	pmap_deactivate_t	deactivate; | |
| 161 | 	pmap_align_superpage_t	align_superpage; | |
| 162 | 	pmap_sync_icache_t	sync_icache; | |
| 163 | 	pmap_quick_enter_page_t	quick_enter_page; | |
| 164 | 	pmap_quick_remove_page_t	quick_remove_page; | |
| 165 | 	pmap_page_array_startup_t	page_array_startup; | |
| 166 | 	pmap_dumpsys_map_chunk_t	dumpsys_map_chunk; | |
| 167 | 	pmap_dumpsys_unmap_chunk_t	dumpsys_unmap_chunk; | |
| 168 | 	pmap_dumpsys_pa_init_t	dumpsys_pa_init; | |
| 169 | 	pmap_dumpsys_scan_pmap_t	dumpsys_scan_pmap; | |
| 170 | 	pmap_dumpsys_dump_pmap_init_t	dumpsys_dump_pmap_init; | |
| 171 | 	pmap_dumpsys_dump_pmap_t	dumpsys_dump_pmap; | |
| 172 | 	pmap_tlbie_all_t	tlbie_all; | |
| 173 | ||
| 174 | }; | |
| 175 | struct mmu_kobj { | |
| 176 | 	const char *name; | |
| 177 | 	const struct mmu_kobj *base; | |
| 178 | 	const struct pmap_funcs *funcs; | |
| 179 | }; | |
| 180 | ||
| 181 | typedef struct mmu_kobj		*mmu_t; | |
| 182 | ||
| 183 | /* The currently installed pmap object. */ | |
| 184 | extern mmu_t	mmu_obj; | |
| 185 | ||
| 186 | /* | |
| 187 | * Resolve a given pmap function. | |
| 188 | * 'func' is the function name less the 'pmap_' * prefix. | |
| 189 | */ | |
| 190 | #define PMAP_RESOLVE_FUNC(func) 		\ | |
| 191 | 	({					\ | |
| 192 | 	 pmap_##func##_t f;			\ | |
| 193 | 	 const struct mmu_kobj	*mmu = mmu_obj;	\ | |
| 194 | 	 do {					\ | |
| 195 | 	 f = mmu->funcs->func;		\ | |
| 196 | 	 if (f != NULL) break;		\ | |
| 197 | 	 mmu = mmu->base;			\ | |
| 198 | 	} while (mmu != NULL);			\ | |
| 199 | 	f;}) | |
| 200 | ||
| 201 | #define MMU_DEF(name, ident, methods)		\ | |
| 202 | 						\ | |
| 203 | const struct mmu_kobj name = {		\ | |
| 204 | 	ident, NULL, &methods			\ | |
| 205 | };						\ | |
| 206 | DATA_SET(mmu_set, name) | |
| 207 | ||
| 208 | #define MMU_DEF_INHERIT(name, ident, methods, base1)	\ | |
| 209 | 						\ | |
| 210 | const struct mmu_kobj name = {			\ | |
| 211 | 	ident, &base1, &methods,		\ | |
| 212 | };						\ | |
| 213 | DATA_SET(mmu_set, name) | |
| 214 | ||
| 215 | /* | |
| 216 | * Known MMU names | |
| 217 | */ | |
| 218 | #define MMU_TYPE_BOOKE	"mmu_booke"	/* Book-E MMU specification */ | |
| 219 | #define MMU_TYPE_OEA	"mmu_oea"	/* 32-bit OEA */ | |
| 220 | #define MMU_TYPE_G5	"mmu_g5"	/* 64-bit bridge (ibm 970) */ | |
| 221 | #define MMU_TYPE_RADIX	"mmu_radix"	/* 64-bit native ISA 3.0 (POWER9) radix */ | |
| 222 | #define MMU_TYPE_8xx	"mmu_8xx"	/* 8xx quicc TLB */ | |
| 223 | ||
| 224 | #endif /* _MACHINE_MMUVAR_H_ */ | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/machine/ofw_machdep.h+2-55| ... | ... | @@ -1,58 +1,5 @@ |
| 1 | 1 | /*- |
| 2 | * SPDX-License-Identifier: BSD-2-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 2001 by Thomas Moestl <tmm@FreeBSD.org>. | |
| 5 | * All rights reserved. | |
| 6 | * | |
| 7 | * Redistribution and use in source and binary forms, with or without | |
| 8 | * modification, are permitted provided that the following conditions | |
| 9 | * are met: | |
| 10 | * 1. Redistributions of source code must retain the above copyright | |
| 11 | * notice, this list of conditions and the following disclaimer. | |
| 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 13 | * notice, this list of conditions and the following disclaimer in the | |
| 14 | * documentation and/or other materials provided with the distribution. | |
| 15 | * | |
| 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | |
| 17 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |
| 18 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | |
| 19 | * IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, | |
| 20 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | |
| 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | |
| 22 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | |
| 23 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | |
| 24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE | |
| 25 | * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 2 | * This file is in the public domain. | |
| 26 | 3 | */ |
| 27 | 4 | |
| 28 | #ifndef _MACHINE_OFW_MACHDEP_H_ | |
| 29 | #define _MACHINE_OFW_MACHDEP_H_ | |
| 30 | ||
| 31 | #include <sys/cdefs.h> | |
| 32 | #include <sys/types.h> | |
| 33 | #include <sys/rman.h> | |
| 34 | #include <sys/bus.h> | |
| 35 | #include <dev/ofw/openfirm.h> | |
| 36 | #include <machine/platform.h> | |
| 37 | ||
| 38 | struct mem_region; | |
| 39 | struct numa_mem_region; | |
| 40 | ||
| 41 | typedef	uint32_t	cell_t; | |
| 42 | ||
| 43 | void OF_getetheraddr(device_t dev, u_char *addr); | |
| 44 | ||
| 45 | void OF_initial_setup(void *fdt_ptr, void *junk, int (*openfirm)(void *)); | |
| 46 | boolean_t OF_bootstrap(void); | |
| 47 | ||
| 48 | void OF_reboot(void); | |
| 49 | ||
| 50 | void ofw_mem_regions(struct mem_region *, int *, struct mem_region *, int *); | |
| 51 | void ofw_numa_mem_regions(struct numa_mem_region *, int *); | |
| 52 | void ofw_quiesce(void); /* Must be called before VM is up! */ | |
| 53 | void ofw_save_trap_vec(char *); | |
| 54 | int ofw_pcibus_get_domain(device_t dev, device_t child, int *domain); | |
| 55 | int ofw_pcibus_get_cpus(device_t dev, device_t child, enum cpu_sets op, | |
| 56 | 		size_t setsize, cpuset_t *cpuset); | |
| 57 | ||
| 58 | #endif /* _MACHINE_OFW_MACHDEP_H_ */ | |
| \ No newline at end of file | ||
| 5 | #include <x86/ofw_machdep.h> | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/machine/openpicreg.h deleted-141| ... | ... | @@ -1,141 +0,0 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-3-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 2000 Tsubai Masanari. All rights reserved. | |
| 5 | * | |
| 6 | * Redistribution and use in source and binary forms, with or without | |
| 7 | * modification, are permitted provided that the following conditions | |
| 8 | * are met: | |
| 9 | * 1. Redistributions of source code must retain the above copyright | |
| 10 | * notice, this list of conditions and the following disclaimer. | |
| 11 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 12 | * notice, this list of conditions and the following disclaimer in the | |
| 13 | * documentation and/or other materials provided with the distribution. | |
| 14 | * 3. The name of the author may not be used to endorse or promote products | |
| 15 | * derived from this software without specific prior written permission. | |
| 16 | * | |
| 17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | |
| 18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |
| 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | |
| 20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | |
| 21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | |
| 22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
| 23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
| 24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
| 25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |
| 26 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 27 | * | |
| 28 | * from NetBSD: openpicreg.h,v 1.3 2001/08/30 03:08:52 briggs Exp | |
| 29 | */ | |
| 30 | ||
| 31 | /* | |
| 32 | * Size of OpenPIC register space | |
| 33 | */ | |
| 34 | #define	OPENPIC_SIZE			0x40000 | |
| 35 | ||
| 36 | /* | |
| 37 | * Per Processor Registers [private access] (0x00000 - 0x00fff) | |
| 38 | */ | |
| 39 | ||
| 40 | /* IPI dispatch command reg */ | |
| 41 | #define	OPENPIC_IPI_DISPATCH(ipi)	(0x40 + (ipi) * 0x10) | |
| 42 | ||
| 43 | /* current task priority reg */ | |
| 44 | #define	OPENPIC_TPR			0x80 | |
| 45 | #define OPENPIC_TPR_MASK			0x0000000f | |
| 46 | ||
| 47 | #define	OPENPIC_WHOAMI			0x90 | |
| 48 | ||
| 49 | /* interrupt acknowledge reg */ | |
| 50 | #define	OPENPIC_IACK			0xa0 | |
| 51 | ||
| 52 | /* end of interrupt reg */ | |
| 53 | #define	OPENPIC_EOI			0xb0 | |
| 54 | ||
| 55 | /* | |
| 56 | * Global registers (0x01000-0x0ffff) | |
| 57 | */ | |
| 58 | ||
| 59 | /* feature reporting reg 0 */ | |
| 60 | #define OPENPIC_FEATURE			0x1000 | |
| 61 | #define	 OPENPIC_FEATURE_VERSION_MASK		0x000000ff | |
| 62 | #define	 OPENPIC_FEATURE_LAST_CPU_MASK		0x00001f00 | |
| 63 | #define	 OPENPIC_FEATURE_LAST_CPU_SHIFT		8 | |
| 64 | #define	 OPENPIC_FEATURE_LAST_IRQ_MASK		0x07ff0000 | |
| 65 | #define	 OPENPIC_FEATURE_LAST_IRQ_SHIFT		16 | |
| 66 | ||
| 67 | /* global config reg 0 */ | |
| 68 | #define OPENPIC_CONFIG			0x1020 | |
| 69 | #define OPENPIC_CONFIG_RESET			0x80000000 | |
| 70 | #define OPENPIC_CONFIG_8259_PASSTHRU_DISABLE	0x20000000 | |
| 71 | ||
| 72 | /* interrupt configuration mode (direct or serial) */ | |
| 73 | #define OPENPIC_ICR			0x1030 | |
| 74 | #define OPENPIC_ICR_SERIAL_MODE		(1 << 27) | |
| 75 | #define OPENPIC_ICR_SERIAL_RATIO_MASK		(0x7 << 28) | |
| 76 | #define OPENPIC_ICR_SERIAL_RATIO_SHIFT		28 | |
| 77 | ||
| 78 | /* vendor ID */ | |
| 79 | #define OPENPIC_VENDOR_ID		0x1080 | |
| 80 | ||
| 81 | /* processor initialization reg */ | |
| 82 | #define OPENPIC_PROC_INIT		0x1090 | |
| 83 | ||
| 84 | /* IPI vector/priority reg */ | |
| 85 | #define OPENPIC_IPI_VECTOR(ipi)		(0x10a0 + (ipi) * 0x10) | |
| 86 | ||
| 87 | /* spurious intr. vector */ | |
| 88 | #define OPENPIC_SPURIOUS_VECTOR		0x10e0 | |
| 89 | ||
| 90 | /* Timer registers */ | |
| 91 | #define	OPENPIC_TIMERS			4 | |
| 92 | #define	OPENPIC_TFREQ			0x10f0 | |
| 93 | #define	OPENPIC_TCNT(t)			(0x1100 + (t) * 0x40) | |
| 94 | #define	OPENPIC_TBASE(t)		(0x1110 + (t) * 0x40) | |
| 95 | #define	OPENPIC_TVEC(t)			(0x1120 + (t) * 0x40) | |
| 96 | #define	OPENPIC_TDST(t)			(0x1130 + (t) * 0x40) | |
| 97 | ||
| 98 | /* | |
| 99 | * Interrupt Source Configuration Registers (0x10000 - 0x1ffff) | |
| 100 | */ | |
| 101 | ||
| 102 | /* interrupt vector/priority reg */ | |
| 103 | #define OPENPIC_SRC_VECTOR_COUNT	64 | |
| 104 | #ifndef OPENPIC_SRC_VECTOR | |
| 105 | #define OPENPIC_SRC_VECTOR(irq)		(0x10000 + (irq) * 0x20) | |
| 106 | #endif | |
| 107 | #define OPENPIC_SENSE_LEVEL			0x00400000 | |
| 108 | #define OPENPIC_SENSE_EDGE			0x00000000 | |
| 109 | #define OPENPIC_POLARITY_POSITIVE		0x00800000 | |
| 110 | #define OPENPIC_POLARITY_NEGATIVE		0x00000000 | |
| 111 | #define OPENPIC_IMASK				0x80000000 | |
| 112 | #define OPENPIC_ACTIVITY			0x40000000 | |
| 113 | #define OPENPIC_PRIORITY_MASK			0x000f0000 | |
| 114 | #define OPENPIC_PRIORITY_SHIFT			16 | |
| 115 | #define OPENPIC_VECTOR_MASK			0x000000ff | |
| 116 | ||
| 117 | /* interrupt destination cpu */ | |
| 118 | #ifndef OPENPIC_IDEST | |
| 119 | #define OPENPIC_IDEST(irq)		(0x10010 + (irq) * 0x20) | |
| 120 | #endif | |
| 121 | ||
| 122 | /* | |
| 123 | * Per Processor Registers [global access] (0x20000 - 0x3ffff) | |
| 124 | */ | |
| 125 | ||
| 126 | #define	OPENPIC_PCPU_BASE(cpu)		(0x20000 + (cpu) * 0x1000) | |
| 127 | ||
| 128 | #define	OPENPIC_PCPU_IPI_DISPATCH(cpu, ipi)	\ | |
| 129 | 	(OPENPIC_PCPU_BASE(cpu) + OPENPIC_IPI_DISPATCH(ipi)) | |
| 130 | ||
| 131 | #define	OPENPIC_PCPU_TPR(cpu)		\ | |
| 132 | 	(OPENPIC_PCPU_BASE(cpu) + OPENPIC_TPR) | |
| 133 | ||
| 134 | #define	OPENPIC_PCPU_WHOAMI(cpu)		\ | |
| 135 | 	(OPENPIC_PCPU_BASE(cpu) + OPENPIC_WHOAMI) | |
| 136 | ||
| 137 | #define OPENPIC_PCPU_IACK(cpu)			\ | |
| 138 | 	(OPENPIC_PCPU_BASE(cpu) + OPENPIC_IACK) | |
| 139 | ||
| 140 | #define OPENPIC_PCPU_EOI(cpu)			\ | |
| 141 | 	(OPENPIC_PCPU_BASE(cpu) + OPENPIC_EOI) | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/machine/openpicvar.h deleted-90| ... | ... | @@ -1,90 +0,0 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-2-Clause | |
| 3 | * | |
| 4 | * Copyright (C) 2002 Benno Rice. | |
| 5 | * All rights reserved. | |
| 6 | * | |
| 7 | * Redistribution and use in source and binary forms, with or without | |
| 8 | * modification, are permitted provided that the following conditions | |
| 9 | * are met: | |
| 10 | * 1. Redistributions of source code must retain the above copyright | |
| 11 | * notice, this list of conditions and the following disclaimer. | |
| 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 13 | * notice, this list of conditions and the following disclaimer in the | |
| 14 | * documentation and/or other materials provided with the distribution. | |
| 15 | * | |
| 16 | * THIS SOFTWARE IS PROVIDED BY Benno Rice ``AS IS'' AND ANY EXPRESS OR | |
| 17 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |
| 18 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | |
| 19 | * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
| 20 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | |
| 21 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; | |
| 22 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | |
| 23 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | |
| 24 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | |
| 25 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 26 | */ | |
| 27 | ||
| 28 | #ifndef	_POWERPC_OPENPICVAR_H_ | |
| 29 | #define	_POWERPC_OPENPICVAR_H_ | |
| 30 | ||
| 31 | #define OPENPIC_DEVSTR	"OpenPIC Interrupt Controller" | |
| 32 | ||
| 33 | #define OPENPIC_IRQMAX	256	/* h/w allows more */ | |
| 34 | ||
| 35 | #define	OPENPIC_QUIRK_SINGLE_BIND	1	/* Bind interrupts to only 1 CPU */ | |
| 36 | #define	OPENPIC_QUIRK_HIDDEN_IRQS	2	/* May have IRQs beyond FRR[NIRQ] */ | |
| 37 | ||
| 38 | /* Names match the macros in openpicreg.h. */ | |
| 39 | struct openpic_timer { | |
| 40 | 	uint32_t	tcnt; | |
| 41 | 	uint32_t	tbase; | |
| 42 | 	uint32_t	tvec; | |
| 43 | 	uint32_t	tdst; | |
| 44 | }; | |
| 45 | ||
| 46 | struct openpic_softc { | |
| 47 | 	device_t	sc_dev; | |
| 48 | 	struct resource	*sc_memr; | |
| 49 | 	struct resource	*sc_intr; | |
| 50 | 	bus_space_tag_t sc_bt; | |
| 51 | 	bus_space_handle_t sc_bh; | |
| 52 | 	char		*sc_version; | |
| 53 | 	int		sc_rid; | |
| 54 | 	int		sc_irq; | |
| 55 | 	void		*sc_icookie; | |
| 56 | 	u_int		sc_ncpu; | |
| 57 | 	u_int		sc_nirq; | |
| 58 | 	int		sc_psim; | |
| 59 | 	u_int		sc_quirks; | |
| 60 | ||
| 61 | 	/* Saved states. */ | |
| 62 | 	uint32_t		sc_saved_config; | |
| 63 | 	uint32_t		sc_saved_ipis[4]; | |
| 64 | 	uint32_t		sc_saved_prios[4]; | |
| 65 | 	struct openpic_timer	sc_saved_timers[OPENPIC_TIMERS]; | |
| 66 | 	uint32_t		sc_saved_vectors[OPENPIC_SRC_VECTOR_COUNT]; | |
| 67 | ||
| 68 | }; | |
| 69 | ||
| 70 | /* | |
| 71 | * Bus-independent attach i/f | |
| 72 | */ | |
| 73 | int	openpic_common_attach(device_t, uint32_t); | |
| 74 | ||
| 75 | /* | |
| 76 | * PIC interface. | |
| 77 | */ | |
| 78 | void	openpic_bind(device_t dev, u_int irq, cpuset_t cpumask, void **); | |
| 79 | void	openpic_config(device_t, u_int, enum intr_trigger, enum intr_polarity); | |
| 80 | void	openpic_dispatch(device_t, struct trapframe *); | |
| 81 | void	openpic_enable(device_t, u_int, u_int, void **); | |
| 82 | void	openpic_eoi(device_t, u_int, void *); | |
| 83 | void	openpic_ipi(device_t, u_int); | |
| 84 | void	openpic_mask(device_t, u_int, void *); | |
| 85 | void	openpic_unmask(device_t, u_int, void *); | |
| 86 | ||
| 87 | int	openpic_suspend(device_t dev); | |
| 88 | int	openpic_resume(device_t dev); | |
| 89 | ||
| 90 | #endif /* _POWERPC_OPENPICVAR_H_ */ | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/machine/param.h deleted-162| ... | ... | @@ -1,162 +0,0 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-4-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 2001 David E. O'Brien | |
| 5 | * Copyright (c) 1990 The Regents of the University of California. | |
| 6 | * All rights reserved. | |
| 7 | * | |
| 8 | * This code is derived from software contributed to Berkeley by | |
| 9 | * William Jolitz. | |
| 10 | * | |
| 11 | * Redistribution and use in source and binary forms, with or without | |
| 12 | * modification, are permitted provided that the following conditions | |
| 13 | * are met: | |
| 14 | * 1. Redistributions of source code must retain the above copyright | |
| 15 | * notice, this list of conditions and the following disclaimer. | |
| 16 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 17 | * notice, this list of conditions and the following disclaimer in the | |
| 18 | * documentation and/or other materials provided with the distribution. | |
| 19 | * 3. All advertising materials mentioning features or use of this software | |
| 20 | * must display the following acknowledgement: | |
| 21 | *	This product includes software developed by the University of | |
| 22 | *	California, Berkeley and its contributors. | |
| 23 | * 4. Neither the name of the University nor the names of its contributors | |
| 24 | * may be used to endorse or promote products derived from this software | |
| 25 | * without specific prior written permission. | |
| 26 | * | |
| 27 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | |
| 28 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 29 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
| 30 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
| 31 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
| 32 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
| 33 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
| 34 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
| 35 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
| 36 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
| 37 | * SUCH DAMAGE. | |
| 38 | * | |
| 39 | *	from: @(#)param.h	5.8 (Berkeley) 6/28/91 | |
| 40 | */ | |
| 41 | ||
| 42 | #ifndef _POWERPC_INCLUDE_PARAM_H_ | |
| 43 | #define	_POWERPC_INCLUDE_PARAM_H_ | |
| 44 | ||
| 45 | /* | |
| 46 | * Machine dependent constants for PowerPC | |
| 47 | */ | |
| 48 | ||
| 49 | #include <machine/_align.h> | |
| 50 | ||
| 51 | /* Needed to display interrupts on OFW PCI */ | |
| 52 | #define __PCI_REROUTE_INTERRUPT | |
| 53 | ||
| 54 | #ifndef MACHINE | |
| 55 | #define	MACHINE		"powerpc" | |
| 56 | #endif | |
| 57 | #ifndef MACHINE_ARCH | |
| 58 | #ifdef __powerpc64__ | |
| 59 | #if defined(__LITTLE_ENDIAN__) | |
| 60 | #define	MACHINE_ARCH	"powerpc64le" | |
| 61 | #else | |
| 62 | #define	MACHINE_ARCH	"powerpc64" | |
| 63 | #endif | |
| 64 | #else | |
| 65 | #ifdef	__SPE__ | |
| 66 | #define	MACHINE_ARCH	"powerpcspe" | |
| 67 | #else | |
| 68 | #define	MACHINE_ARCH	"powerpc" | |
| 69 | #endif | |
| 70 | #endif | |
| 71 | #endif | |
| 72 | #define	MID_MACHINE	MID_POWERPC | |
| 73 | #ifdef __powerpc64__ | |
| 74 | #ifndef	MACHINE_ARCH32 | |
| 75 | #define	MACHINE_ARCH32	"powerpc" | |
| 76 | #endif | |
| 77 | #endif | |
| 78 | ||
| 79 | #ifdef SMP | |
| 80 | #ifndef MAXCPU | |
| 81 | #define	MAXCPU		256 | |
| 82 | #endif | |
| 83 | #else | |
| 84 | #define	MAXCPU		1 | |
| 85 | #endif | |
| 86 | ||
| 87 | #ifndef MAXMEMDOM | |
| 88 | #define	MAXMEMDOM	8 | |
| 89 | #endif | |
| 90 | ||
| 91 | #define	ALIGNBYTES	_ALIGNBYTES | |
| 92 | #define	ALIGN(p)	_ALIGN(p) | |
| 93 | /* | |
| 94 | * ALIGNED_POINTER is a boolean macro that checks whether an address | |
| 95 | * is valid to fetch data elements of type t from on this architecture. | |
| 96 | * This does not reflect the optimal alignment, just the possibility | |
| 97 | * (within reasonable limits). | |
| 98 | */ | |
| 99 | #define	ALIGNED_POINTER(p, t)	((((uintptr_t)(p)) & (sizeof (t) - 1)) == 0) | |
| 100 | ||
| 101 | /* | |
| 102 | * CACHE_LINE_SIZE is the compile-time maximum cache line size for an | |
| 103 | * architecture. It should be used with appropriate caution. | |
| 104 | */ | |
| 105 | #define	CACHE_LINE_SHIFT	7 | |
| 106 | #define	CACHE_LINE_SIZE		(1 << CACHE_LINE_SHIFT) | |
| 107 | ||
| 108 | #define	PAGE_SHIFT	12 | |
| 109 | #define	PAGE_SIZE	(1 << PAGE_SHIFT)	/* Page size */ | |
| 110 | #define	PAGE_MASK	(PAGE_SIZE - 1) | |
| 111 | #define	NPTEPG		(PAGE_SIZE/(sizeof (pt_entry_t))) | |
| 112 | #define	NPDEPG		(PAGE_SIZE/(sizeof (pt_entry_t))) | |
| 113 | ||
| 114 | #define L1_PAGE_SIZE_SHIFT 39 | |
| 115 | #define L1_PAGE_SIZE (1UL<<L1_PAGE_SIZE_SHIFT) | |
| 116 | #define L1_PAGE_MASK (L1_PAGE_SIZE-1) | |
| 117 | ||
| 118 | #define L2_PAGE_SIZE_SHIFT 30 | |
| 119 | #define L2_PAGE_SIZE (1UL<<L2_PAGE_SIZE_SHIFT) | |
| 120 | #define L2_PAGE_MASK (L2_PAGE_SIZE-1) | |
| 121 | ||
| 122 | #define L3_PAGE_SIZE_SHIFT 21 | |
| 123 | #define L3_PAGE_SIZE (1UL<<L3_PAGE_SIZE_SHIFT) | |
| 124 | #define L3_PAGE_MASK (L3_PAGE_SIZE-1) | |
| 125 | ||
| 126 | #define	MAXPAGESIZES	3	/* maximum number of supported page sizes */ | |
| 127 | ||
| 128 | #define	RELOCATABLE_KERNEL	1		/* kernel may relocate during startup */ | |
| 129 | ||
| 130 | #ifndef KSTACK_PAGES | |
| 131 | #ifdef __powerpc64__ | |
| 132 | #define	KSTACK_PAGES		12		/* includes pcb */ | |
| 133 | #else | |
| 134 | #define	KSTACK_PAGES		4		/* includes pcb */ | |
| 135 | #endif | |
| 136 | #endif | |
| 137 | #define	KSTACK_GUARD_PAGES	1	/* pages of kstack guard; 0 disables */ | |
| 138 | #define	USPACE		(kstack_pages * PAGE_SIZE)	/* total size of pcb */ | |
| 139 | ||
| 140 | #define	COPYFAULT		0x1 | |
| 141 | #define	FUSUFAULT		0x2 | |
| 142 | ||
| 143 | /* | |
| 144 | * Mach derived conversion macros | |
| 145 | */ | |
| 146 | #define	trunc_page(x)		((x) & ~(PAGE_MASK)) | |
| 147 | #define	round_page(x)		(((x) + PAGE_MASK) & ~PAGE_MASK) | |
| 148 | #define	trunc_2mpage(x)		((unsigned long)(x) & ~L3_PAGE_MASK) | |
| 149 | #define	round_2mpage(x)		((((unsigned long)(x)) + L3_PAGE_MASK) & ~L3_PAGE_MASK) | |
| 150 | #define	trunc_1gpage(x)		((unsigned long)(x) & ~L2_PAGE_MASK) | |
| 151 | ||
| 152 | #define	atop(x)			((x) >> PAGE_SHIFT) | |
| 153 | #define	ptoa(x)			((x) << PAGE_SHIFT) | |
| 154 | ||
| 155 | #define	powerpc_btop(x)		((x) >> PAGE_SHIFT) | |
| 156 | #define	powerpc_ptob(x)		((x) << PAGE_SHIFT) | |
| 157 | ||
| 158 | #define	pgtok(x)		((x) * (PAGE_SIZE / 1024UL)) | |
| 159 | ||
| 160 | #define btoc(x)			((vm_offset_t)(((x)+PAGE_MASK)>>PAGE_SHIFT)) | |
| 161 | ||
| 162 | #endif /* !_POWERPC_INCLUDE_PARAM_H_ */ | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/machine/pcb.h deleted-137| ... | ... | @@ -1,137 +0,0 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-4-Clause | |
| 3 | * | |
| 4 | * Copyright (C) 1995, 1996 Wolfgang Solfrank. | |
| 5 | * Copyright (C) 1995, 1996 TooLs GmbH. | |
| 6 | * All rights reserved. | |
| 7 | * | |
| 8 | * Redistribution and use in source and binary forms, with or without | |
| 9 | * modification, are permitted provided that the following conditions | |
| 10 | * are met: | |
| 11 | * 1. Redistributions of source code must retain the above copyright | |
| 12 | * notice, this list of conditions and the following disclaimer. | |
| 13 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 14 | * notice, this list of conditions and the following disclaimer in the | |
| 15 | * documentation and/or other materials provided with the distribution. | |
| 16 | * 3. All advertising materials mentioning features or use of this software | |
| 17 | * must display the following acknowledgement: | |
| 18 | *	This product includes software developed by TooLs GmbH. | |
| 19 | * 4. The name of TooLs GmbH may not be used to endorse or promote products | |
| 20 | * derived from this software without specific prior written permission. | |
| 21 | * | |
| 22 | * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR | |
| 23 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |
| 24 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | |
| 25 | * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
| 26 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | |
| 27 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; | |
| 28 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | |
| 29 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | |
| 30 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | |
| 31 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 32 | * | |
| 33 | *	$NetBSD: pcb.h,v 1.4 2000/06/04 11:57:17 tsubai Exp $ | |
| 34 | */ | |
| 35 | ||
| 36 | #ifndef _MACHINE_PCB_H_ | |
| 37 | #define	_MACHINE_PCB_H_ | |
| 38 | ||
| 39 | #include <sys/endian.h> | |
| 40 | ||
| 41 | #include <machine/setjmp.h> | |
| 42 | ||
| 43 | #ifndef _STANDALONE | |
| 44 | struct pcb { | |
| 45 | 	register_t	pcb_context[20];	/* non-volatile r12-r31 */ | |
| 46 | 	register_t	pcb_cr;			/* Condition register */ | |
| 47 | 	register_t	pcb_sp;			/* stack pointer */ | |
| 48 | 	register_t	pcb_toc;		/* toc pointer */ | |
| 49 | 	register_t	pcb_lr;			/* link register */ | |
| 50 | 	register_t	pcb_dscr;		/* dscr value */ | |
| 51 | 	register_t	pcb_fscr; | |
| 52 | 	register_t	pcb_tar; | |
| 53 | 	struct		pmap *pcb_pm;		/* pmap of our vmspace */ | |
| 54 | 	jmp_buf		*pcb_onfault;		/* For use during | |
| 55 | 						 copyin/copyout */ | |
| 56 | 	int		pcb_flags; | |
| 57 | #define	PCB_FPU		0x1	/* Process uses FPU */ | |
| 58 | #define	PCB_FPREGS	0x2	/* Process had FPU registers initialized */ | |
| 59 | #define	PCB_VEC		0x4	/* Process uses Altivec */ | |
| 60 | #define	PCB_VSX		0x8	/* Process had VSX initialized */ | |
| 61 | #define	PCB_CDSCR	0x10	/* Process had Custom DSCR initialized */ | |
| 62 | #define	PCB_HTM		0x20	/* Process had HTM initialized */ | |
| 63 | #define	PCB_CFSCR	0x40	/* Process had FSCR updated */ | |
| 64 | #define	PCB_KERN_FPU 0x80	/* Kernel is using FPU/Vector unit */ | |
| 65 | #define	PCB_KERN_FPU_NOSAVE 0x100 /* FPU/Vec state not saved for kernel use */ | |
| 66 | #define	PCB_VECREGS 0x200	/* Process had Altivec registers initialized */ | |
| 67 | 	struct fpu { | |
| 68 | 		union { | |
| 69 | #if _BYTE_ORDER == _BIG_ENDIAN | |
| 70 | 			double fpr; | |
| 71 | 			uint32_t vsr[4]; | |
| 72 | #else | |
| 73 | 			uint32_t vsr[4]; | |
| 74 | 			struct { | |
| 75 | 				double padding; | |
| 76 | 				double fpr; | |
| 77 | 			}; | |
| 78 | #endif | |
| 79 | 		} fpr[32]; | |
| 80 | 		double	fpscr;	/* FPSCR stored as double for easier access */ | |
| 81 | 	} pcb_fpu;		/* Floating point processor */ | |
| 82 | 	unsigned int	pcb_fpcpu;		/* which CPU had our FPU | |
| 83 | 							stuff. */ | |
| 84 | 	struct vec { | |
| 85 | 		uint32_t vr[32][4]; | |
| 86 | 		uint32_t spare[2]; | |
| 87 | 		uint32_t vrsave; | |
| 88 | 		uint32_t vscr;	/* aligned at vector element 3 */ | |
| 89 | 	} pcb_vec __aligned(16);	/* Vector processor */ | |
| 90 | 	unsigned int	pcb_veccpu;		/* which CPU had our vector | |
| 91 | 							stuff. */ | |
| 92 | 	struct htm { | |
| 93 | 		uint64_t tfhar; | |
| 94 | 		uint64_t texasr; | |
| 95 | 		uint64_t tfiar; | |
| 96 | 	} pcb_htm; | |
| 97 | ||
| 98 | 	struct ebb { | |
| 99 | 		uint64_t ebbhr; | |
| 100 | 		uint64_t ebbrr; | |
| 101 | 		uint64_t bescr; | |
| 102 | 	} pcb_ebb; | |
| 103 | ||
| 104 | 	struct lmon { | |
| 105 | 		uint64_t lmrr; | |
| 106 | 		uint64_t lmser; | |
| 107 | 	} pcb_lm; | |
| 108 | ||
| 109 | 	union { | |
| 110 | 		struct { | |
| 111 | 			vm_offset_t	usr_segm;	/* Base address */ | |
| 112 | 			register_t	usr_vsid;	/* USER_SR segment */ | |
| 113 | 		} aim; | |
| 114 | 		struct { | |
| 115 | 			register_t	dbcr0; | |
| 116 | 		} booke; | |
| 117 | 	} pcb_cpu; | |
| 118 | 	vm_offset_t pcb_lastill;	/* Last illegal instruction */ | |
| 119 | }; | |
| 120 | #endif | |
| 121 | ||
| 122 | #ifdef	_KERNEL | |
| 123 | ||
| 124 | struct trapframe; | |
| 125 | ||
| 126 | #ifndef curpcb | |
| 127 | extern struct pcb *curpcb; | |
| 128 | #endif | |
| 129 | ||
| 130 | extern struct pmap *curpm; | |
| 131 | extern struct proc *fpuproc; | |
| 132 | ||
| 133 | void	makectx(struct trapframe *, struct pcb *); | |
| 134 | void	savectx(struct pcb *) __returns_twice; | |
| 135 | ||
| 136 | #endif | |
| 137 | #endif	/* _MACHINE_PCB_H_ */ | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/machine/pcpu.h deleted-174| ... | ... | @@ -1,174 +0,0 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-2-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 1999 Luoqi Chen <luoqi@freebsd.org> | |
| 5 | * Copyright (c) Peter Wemm <peter@netplex.com.au> | |
| 6 | * All rights reserved. | |
| 7 | * | |
| 8 | * Redistribution and use in source and binary forms, with or without | |
| 9 | * modification, are permitted provided that the following conditions | |
| 10 | * are met: | |
| 11 | * 1. Redistributions of source code must retain the above copyright | |
| 12 | * notice, this list of conditions and the following disclaimer. | |
| 13 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 14 | * notice, this list of conditions and the following disclaimer in the | |
| 15 | * documentation and/or other materials provided with the distribution. | |
| 16 | * | |
| 17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |
| 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 19 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
| 20 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | |
| 21 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
| 22 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
| 23 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
| 24 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
| 25 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
| 26 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
| 27 | * SUCH DAMAGE. | |
| 28 | */ | |
| 29 | ||
| 30 | #ifndef	_MACHINE_PCPU_H_ | |
| 31 | #define	_MACHINE_PCPU_H_ | |
| 32 | ||
| 33 | #include <machine/cpufunc.h> | |
| 34 | #include <machine/slb.h> | |
| 35 | #include <machine/tlb.h> | |
| 36 | ||
| 37 | struct pmap; | |
| 38 | struct pvo_entry; | |
| 39 | #define	CPUSAVE_LEN	9 | |
| 40 | ||
| 41 | #define	PCPU_MD_COMMON_FIELDS						\ | |
| 42 | 	int		pc_inside_intr;					\ | |
| 43 | 	struct pmap	*pc_curpmap;		/* current pmap */	\ | |
| 44 | 	struct thread	*pc_fputhread;		/* current fpu user */ \ | |
| 45 | 	struct thread	*pc_vecthread;		/* current vec user */ \ | |
| 46 | 	struct thread	*pc_htmthread;		/* current htm user */ \ | |
| 47 | 	uintptr_t	pc_hwref;					\ | |
| 48 | 	int		pc_bsp;						\ | |
| 49 | 	volatile int	pc_awake;					\ | |
| 50 | 	uint32_t	pc_ipimask;					\ | |
| 51 | 	uint32_t	pc_flags;		/* cpu feature flags */ \ | |
| 52 | 	register_t	pc_tempsave[CPUSAVE_LEN];			\ | |
| 53 | 	register_t	pc_disisave[CPUSAVE_LEN];			\ | |
| 54 | 	register_t	pc_dbsave[CPUSAVE_LEN];				\ | |
| 55 | 	void		*pc_restore;					\ | |
| 56 | 	vm_offset_t	pc_qmap_addr; | |
| 57 | ||
| 58 | #define PCPU_MD_AIM32_FIELDS						\ | |
| 59 | 	struct pvo_entry *qmap_pvo;					\ | |
| 60 | 	struct mtx	qmap_lock;					\ | |
| 61 | 	char		__pad[128]; | |
| 62 | ||
| 63 | #define PCPU_MD_AIM64_FIELDS						\ | |
| 64 | 	struct slb	slb[64];					\ | |
| 65 | 	struct slb	**userslb;					\ | |
| 66 | 	register_t	slbsave[18];					\ | |
| 67 | 	uint8_t		slbstack[1024];				\ | |
| 68 | 	struct pvo_entry *qmap_pvo;					\ | |
| 69 | 	struct mtx	qmap_lock;					\ | |
| 70 | 	uint64_t	opal_hmi_flags;					\ | |
| 71 | 	char		__pad[1337]; | |
| 72 | ||
| 73 | #ifdef __powerpc64__ | |
| 74 | #define PCPU_MD_AIM_FIELDS	PCPU_MD_AIM64_FIELDS | |
| 75 | #else | |
| 76 | #define PCPU_MD_AIM_FIELDS	PCPU_MD_AIM32_FIELDS | |
| 77 | #endif | |
| 78 | ||
| 79 | /* CPU feature flags, can be used for cached flow control. */ | |
| 80 | #define	PC_FLAG_NOSRS		0x80000000 | |
| 81 | ||
| 82 | #define	BOOKE_CRITSAVE_LEN	(CPUSAVE_LEN + 2) | |
| 83 | #define	BOOKE_TLB_MAXNEST	4 | |
| 84 | #define	BOOKE_TLB_SAVELEN	16 | |
| 85 | #define	BOOKE_TLBSAVE_LEN	(BOOKE_TLB_SAVELEN * BOOKE_TLB_MAXNEST) | |
| 86 | ||
| 87 | #ifdef __powerpc64__ | |
| 88 | #define	BOOKE_PCPU_PAD	901 | |
| 89 | #else | |
| 90 | #define	BOOKE_PCPU_PAD	365 | |
| 91 | #endif | |
| 92 | #define PCPU_MD_BOOKE_FIELDS						\ | |
| 93 | 	register_t	critsave[BOOKE_CRITSAVE_LEN];		\ | |
| 94 | 	register_t	mchksave[CPUSAVE_LEN];			\ | |
| 95 | 	register_t	tlbsave[BOOKE_TLBSAVE_LEN];		\ | |
| 96 | 	register_t	tlb_level;				\ | |
| 97 | 	uintptr_t	*tlb_lock;				\ | |
| 98 | 	int		tid_next;					\ | |
| 99 | 	char		__pad[BOOKE_PCPU_PAD]; | |
| 100 | ||
| 101 | /* Definitions for register offsets within the exception tmp save areas */ | |
| 102 | #define	CPUSAVE_R27	0		/* where r27 gets saved */ | |
| 103 | #define	CPUSAVE_R28	1		/* where r28 gets saved */ | |
| 104 | #define	CPUSAVE_R29	2		/* where r29 gets saved */ | |
| 105 | #define	CPUSAVE_R30	3		/* where r30 gets saved */ | |
| 106 | #define	CPUSAVE_R31	4		/* where r31 gets saved */ | |
| 107 | #define	CPUSAVE_AIM_DAR		5	/* where SPR_DAR gets saved */ | |
| 108 | #define	CPUSAVE_AIM_DSISR	6	/* where SPR_DSISR gets saved */ | |
| 109 | #define	CPUSAVE_BOOKE_DEAR	5	/* where SPR_DEAR gets saved */ | |
| 110 | #define	CPUSAVE_BOOKE_ESR	6	/* where SPR_ESR gets saved */ | |
| 111 | #define	CPUSAVE_SRR0	7		/* where SRR0 gets saved */ | |
| 112 | #define	CPUSAVE_SRR1	8		/* where SRR1 gets saved */ | |
| 113 | #define	BOOKE_CRITSAVE_SRR0	9	/* where real SRR0 gets saved (critical) */ | |
| 114 | #define	BOOKE_CRITSAVE_SRR1	10	/* where real SRR0 gets saved (critical) */ | |
| 115 | ||
| 116 | /* Book-E TLBSAVE is more elaborate */ | |
| 117 | #define TLBSAVE_BOOKE_LR	0 | |
| 118 | #define TLBSAVE_BOOKE_CR	1 | |
| 119 | #define TLBSAVE_BOOKE_SRR0	2 | |
| 120 | #define TLBSAVE_BOOKE_SRR1	3 | |
| 121 | #define TLBSAVE_BOOKE_R20	4 | |
| 122 | #define TLBSAVE_BOOKE_R21	5 | |
| 123 | #define TLBSAVE_BOOKE_R22	6 | |
| 124 | #define TLBSAVE_BOOKE_R23	7 | |
| 125 | #define TLBSAVE_BOOKE_R24	8 | |
| 126 | #define TLBSAVE_BOOKE_R25	9 | |
| 127 | #define TLBSAVE_BOOKE_R26	10 | |
| 128 | #define TLBSAVE_BOOKE_R27	11 | |
| 129 | #define TLBSAVE_BOOKE_R28	12 | |
| 130 | #define TLBSAVE_BOOKE_R29	13 | |
| 131 | #define TLBSAVE_BOOKE_R30	14 | |
| 132 | #define TLBSAVE_BOOKE_R31	15 | |
| 133 | ||
| 134 | #define	PCPU_MD_FIELDS		\ | |
| 135 | 	PCPU_MD_COMMON_FIELDS	\ | |
| 136 | 	union {			\ | |
| 137 | 	 struct {		\ | |
| 138 | 		PCPU_MD_AIM_FIELDS	\ | |
| 139 | 	 } pc_aim;		\ | |
| 140 | 	 struct {		\ | |
| 141 | 		PCPU_MD_BOOKE_FIELDS	\ | |
| 142 | 	 } pc_booke;		\ | |
| 143 | 	} | |
| 144 | ||
| 145 | #ifdef _KERNEL | |
| 146 | ||
| 147 | #define pcpup	(get_pcpu()) | |
| 148 | ||
| 149 | static __inline __pure2 struct thread * | |
| 150 | __curthread(void) | |
| 151 | { | |
| 152 | 	struct thread *td; | |
| 153 | #ifdef __powerpc64__ | |
| 154 | 	__asm __volatile("mr %0,13" : "=r"(td)); | |
| 155 | #else | |
| 156 | 	__asm __volatile("mr %0,2" : "=r"(td)); | |
| 157 | #endif | |
| 158 | 	return (td); | |
| 159 | } | |
| 160 | #define curthread (__curthread()) | |
| 161 | ||
| 162 | #define	PCPU_GET(member)	(pcpup->pc_ ## member) | |
| 163 | ||
| 164 | /* | |
| 165 | * XXX The implementation of this operation should be made atomic | |
| 166 | * with respect to preemption. | |
| 167 | */ | |
| 168 | #define	PCPU_ADD(member, value)	(pcpup->pc_ ## member += (value)) | |
| 169 | #define	PCPU_PTR(member)	(&pcpup->pc_ ## member) | |
| 170 | #define	PCPU_SET(member,value)	(pcpup->pc_ ## member = (value)) | |
| 171 | ||
| 172 | #endif	/* _KERNEL */ | |
| 173 | ||
| 174 | #endif	/* !_MACHINE_PCPU_H_ */ | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/machine/pio.h deleted-304| ... | ... | @@ -1,304 +0,0 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-4-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 1997 Per Fogelstrom, Opsycon AB and RTMX Inc, USA. | |
| 5 | * | |
| 6 | * Redistribution and use in source and binary forms, with or without | |
| 7 | * modification, are permitted provided that the following conditions | |
| 8 | * are met: | |
| 9 | * 1. Redistributions of source code must retain the above copyright | |
| 10 | * notice, this list of conditions and the following disclaimer. | |
| 11 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 12 | * notice, this list of conditions and the following disclaimer in the | |
| 13 | * documentation and/or other materials provided with the distribution. | |
| 14 | * 3. All advertising materials mentioning features or use of this software | |
| 15 | * must display the following acknowledgement: | |
| 16 | *	This product includes software developed under OpenBSD by | |
| 17 | *	Per Fogelstrom Opsycon AB for RTMX Inc, North Carolina, USA. | |
| 18 | * 4. The name of the author may not be used to endorse or promote products | |
| 19 | * derived from this software without specific prior written permission. | |
| 20 | * | |
| 21 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS | |
| 22 | * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | |
| 23 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
| 24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY | |
| 25 | * 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 | *	$NetBSD: pio.h,v 1.1 1998/05/15 10:15:54 tsubai Exp $ | |
| 34 | *	$OpenBSD: pio.h,v 1.1 1997/10/13 10:53:47 pefo Exp $ | |
| 35 | */ | |
| 36 | ||
| 37 | #ifndef _MACHINE_PIO_H_ | |
| 38 | #define	_MACHINE_PIO_H_ | |
| 39 | /* | |
| 40 | * I/O macros. | |
| 41 | */ | |
| 42 | ||
| 43 | /* | |
| 44 | * Use sync so that bus space operations cannot sneak out the bottom of | |
| 45 | * mutex-protected sections (mutex release does not guarantee completion of | |
| 46 | * accesses to caching-inhibited memory on some systems) | |
| 47 | */ | |
| 48 | #define powerpc_iomb() __asm __volatile("sync" : : : "memory") | |
| 49 | ||
| 50 | static __inline void | |
| 51 | __outb(volatile u_int8_t *a, u_int8_t v) | |
| 52 | { | |
| 53 | 	*a = v; | |
| 54 | 	powerpc_iomb(); | |
| 55 | } | |
| 56 | ||
| 57 | static __inline void | |
| 58 | __outw(volatile u_int16_t *a, u_int16_t v) | |
| 59 | { | |
| 60 | 	*a = v; | |
| 61 | 	powerpc_iomb(); | |
| 62 | } | |
| 63 | ||
| 64 | static __inline void | |
| 65 | __outl(volatile u_int32_t *a, u_int32_t v) | |
| 66 | { | |
| 67 | 	*a = v; | |
| 68 | 	powerpc_iomb(); | |
| 69 | } | |
| 70 | ||
| 71 | static __inline void | |
| 72 | __outll(volatile u_int64_t *a, u_int64_t v) | |
| 73 | { | |
| 74 | 	*a = v; | |
| 75 | 	powerpc_iomb(); | |
| 76 | } | |
| 77 | ||
| 78 | static __inline void | |
| 79 | __outwrb(volatile u_int16_t *a, u_int16_t v) | |
| 80 | { | |
| 81 | 	__asm__ volatile("sthbrx %0, 0, %1" :: "r"(v), "r"(a)); | |
| 82 | 	powerpc_iomb(); | |
| 83 | } | |
| 84 | ||
| 85 | static __inline void | |
| 86 | __outlrb(volatile u_int32_t *a, u_int32_t v) | |
| 87 | { | |
| 88 | 	__asm__ volatile("stwbrx %0, 0, %1" :: "r"(v), "r"(a)); | |
| 89 | 	powerpc_iomb(); | |
| 90 | } | |
| 91 | ||
| 92 | static __inline u_int8_t | |
| 93 | __inb(volatile u_int8_t *a) | |
| 94 | { | |
| 95 | 	u_int8_t _v_; | |
| 96 | ||
| 97 | 	_v_ = *a; | |
| 98 | 	powerpc_iomb(); | |
| 99 | 	return _v_; | |
| 100 | } | |
| 101 | ||
| 102 | static __inline u_int16_t | |
| 103 | __inw(volatile u_int16_t *a) | |
| 104 | { | |
| 105 | 	u_int16_t _v_; | |
| 106 | ||
| 107 | 	_v_ = *a; | |
| 108 | 	powerpc_iomb(); | |
| 109 | 	return _v_; | |
| 110 | } | |
| 111 | ||
| 112 | static __inline u_int32_t | |
| 113 | __inl(volatile u_int32_t *a) | |
| 114 | { | |
| 115 | 	u_int32_t _v_; | |
| 116 | ||
| 117 | 	_v_ = *a; | |
| 118 | 	powerpc_iomb(); | |
| 119 | 	return _v_; | |
| 120 | } | |
| 121 | ||
| 122 | static __inline u_int64_t | |
| 123 | __inll(volatile u_int64_t *a) | |
| 124 | { | |
| 125 | 	u_int64_t _v_; | |
| 126 | ||
| 127 | 	_v_ = *a; | |
| 128 | 	powerpc_iomb(); | |
| 129 | 	return _v_; | |
| 130 | } | |
| 131 | ||
| 132 | static __inline u_int16_t | |
| 133 | __inwrb(volatile u_int16_t *a) | |
| 134 | { | |
| 135 | 	u_int16_t _v_; | |
| 136 | ||
| 137 | 	__asm__ volatile("lhbrx %0, 0, %1" : "=r"(_v_) : "r"(a)); | |
| 138 | 	powerpc_iomb(); | |
| 139 | 	return _v_; | |
| 140 | } | |
| 141 | ||
| 142 | static __inline u_int32_t | |
| 143 | __inlrb(volatile u_int32_t *a) | |
| 144 | { | |
| 145 | 	u_int32_t _v_; | |
| 146 | ||
| 147 | 	__asm__ volatile("lwbrx %0, 0, %1" : "=r"(_v_) : "r"(a)); | |
| 148 | 	powerpc_iomb(); | |
| 149 | 	return _v_; | |
| 150 | } | |
| 151 | ||
| 152 | #define	outb(a,v)	(__outb((volatile u_int8_t *)(a), v)) | |
| 153 | #define	out8(a,v)	outb(a,v) | |
| 154 | #define	outw(a,v)	(__outw((volatile u_int16_t *)(a), v)) | |
| 155 | #define	out16(a,v)	outw(a,v) | |
| 156 | #define	outl(a,v)	(__outl((volatile u_int32_t *)(a), v)) | |
| 157 | #define	out32(a,v)	outl(a,v) | |
| 158 | #define	outll(a,v)	(__outll((volatile u_int64_t *)(a), v)) | |
| 159 | #define	out64(a,v)	outll(a,v) | |
| 160 | #define	inb(a)		(__inb((volatile u_int8_t *)(a))) | |
| 161 | #define	in8(a)		inb(a) | |
| 162 | #define	inw(a)		(__inw((volatile u_int16_t *)(a))) | |
| 163 | #define	in16(a)		inw(a) | |
| 164 | #define	inl(a)		(__inl((volatile u_int32_t *)(a))) | |
| 165 | #define	in32(a)		inl(a) | |
| 166 | #define	inll(a)		(__inll((volatile u_int64_t *)(a))) | |
| 167 | #define	in64(a)		inll(a) | |
| 168 | ||
| 169 | #define	out8rb(a,v)	outb(a,v) | |
| 170 | #define	outwrb(a,v)	(__outwrb((volatile u_int16_t *)(a), v)) | |
| 171 | #define	out16rb(a,v)	outwrb(a,v) | |
| 172 | #define	outlrb(a,v)	(__outlrb((volatile u_int32_t *)(a), v)) | |
| 173 | #define	out32rb(a,v)	outlrb(a,v) | |
| 174 | #define	in8rb(a)	inb(a) | |
| 175 | #define	inwrb(a)	(__inwrb((volatile u_int16_t *)(a))) | |
| 176 | #define	in16rb(a)	inwrb(a) | |
| 177 | #define	inlrb(a)	(__inlrb((volatile u_int32_t *)(a))) | |
| 178 | #define	in32rb(a)	inlrb(a) | |
| 179 | ||
| 180 | static __inline void | |
| 181 | __outsb(volatile u_int8_t *a, const u_int8_t *s, size_t c) | |
| 182 | { | |
| 183 | 	while (c--) | |
| 184 | 		*a = *s++; | |
| 185 | 	powerpc_iomb(); | |
| 186 | } | |
| 187 | ||
| 188 | static __inline void | |
| 189 | __outsw(volatile u_int16_t *a, const u_int16_t *s, size_t c) | |
| 190 | { | |
| 191 | 	while (c--) | |
| 192 | 		*a = *s++; | |
| 193 | 	powerpc_iomb(); | |
| 194 | } | |
| 195 | ||
| 196 | static __inline void | |
| 197 | __outsl(volatile u_int32_t *a, const u_int32_t *s, size_t c) | |
| 198 | { | |
| 199 | 	while (c--) | |
| 200 | 		*a = *s++; | |
| 201 | 	powerpc_iomb(); | |
| 202 | } | |
| 203 | ||
| 204 | static __inline void | |
| 205 | __outsll(volatile u_int64_t *a, const u_int64_t *s, size_t c) | |
| 206 | { | |
| 207 | 	while (c--) | |
| 208 | 		*a = *s++; | |
| 209 | 	powerpc_iomb(); | |
| 210 | } | |
| 211 | ||
| 212 | static __inline void | |
| 213 | __outswrb(volatile u_int16_t *a, const u_int16_t *s, size_t c) | |
| 214 | { | |
| 215 | 	while (c--) | |
| 216 | 		__asm__ volatile("sthbrx %0, 0, %1" :: "r"(*s++), "r"(a)); | |
| 217 | 	powerpc_iomb(); | |
| 218 | } | |
| 219 | ||
| 220 | static __inline void | |
| 221 | __outslrb(volatile u_int32_t *a, const u_int32_t *s, size_t c) | |
| 222 | { | |
| 223 | 	while (c--) | |
| 224 | 		__asm__ volatile("stwbrx %0, 0, %1" :: "r"(*s++), "r"(a)); | |
| 225 | 	powerpc_iomb(); | |
| 226 | } | |
| 227 | ||
| 228 | static __inline void | |
| 229 | __insb(volatile u_int8_t *a, u_int8_t *d, size_t c) | |
| 230 | { | |
| 231 | 	while (c--) | |
| 232 | 		*d++ = *a; | |
| 233 | 	powerpc_iomb(); | |
| 234 | } | |
| 235 | ||
| 236 | static __inline void | |
| 237 | __insw(volatile u_int16_t *a, u_int16_t *d, size_t c) | |
| 238 | { | |
| 239 | 	while (c--) | |
| 240 | 		*d++ = *a; | |
| 241 | 	powerpc_iomb(); | |
| 242 | } | |
| 243 | ||
| 244 | static __inline void | |
| 245 | __insl(volatile u_int32_t *a, u_int32_t *d, size_t c) | |
| 246 | { | |
| 247 | 	while (c--) | |
| 248 | 		*d++ = *a; | |
| 249 | 	powerpc_iomb(); | |
| 250 | } | |
| 251 | ||
| 252 | static __inline void | |
| 253 | __insll(volatile u_int64_t *a, u_int64_t *d, size_t c) | |
| 254 | { | |
| 255 | 	while (c--) | |
| 256 | 		*d++ = *a; | |
| 257 | 	powerpc_iomb(); | |
| 258 | } | |
| 259 | ||
| 260 | static __inline void | |
| 261 | __inswrb(volatile u_int16_t *a, u_int16_t *d, size_t c) | |
| 262 | { | |
| 263 | 	while (c--) | |
| 264 | 		__asm__ volatile("lhbrx %0, 0, %1" : "=r"(*d++) : "r"(a)); | |
| 265 | 	powerpc_iomb(); | |
| 266 | } | |
| 267 | ||
| 268 | static __inline void | |
| 269 | __inslrb(volatile u_int32_t *a, u_int32_t *d, size_t c) | |
| 270 | { | |
| 271 | 	while (c--) | |
| 272 | 		__asm__ volatile("lwbrx %0, 0, %1" : "=r"(*d++) : "r"(a)); | |
| 273 | 	powerpc_iomb(); | |
| 274 | } | |
| 275 | ||
| 276 | #define	outsb(a,s,c)	(__outsb((volatile u_int8_t *)(a), s, c)) | |
| 277 | #define	outs8(a,s,c)	outsb(a,s,c) | |
| 278 | #define	outsw(a,s,c)	(__outsw((volatile u_int16_t *)(a), s, c)) | |
| 279 | #define	outs16(a,s,c)	outsw(a,s,c) | |
| 280 | #define	outsl(a,s,c)	(__outsl((volatile u_int32_t *)(a), s, c)) | |
| 281 | #define	outs32(a,s,c)	outsl(a,s,c) | |
| 282 | #define	outsll(a,s,c)	(__outsll((volatile u_int64_t *)(a), s, c)) | |
| 283 | #define	outs64(a,s,c)	outsll(a,s,c) | |
| 284 | #define	insb(a,d,c)	(__insb((volatile u_int8_t *)(a), d, c)) | |
| 285 | #define	ins8(a,d,c)	insb(a,d,c) | |
| 286 | #define	insw(a,d,c)	(__insw((volatile u_int16_t *)(a), d, c)) | |
| 287 | #define	ins16(a,d,c)	insw(a,d,c) | |
| 288 | #define	insl(a,d,c)	(__insl((volatile u_int32_t *)(a), d, c)) | |
| 289 | #define	ins32(a,d,c)	insl(a,d,c) | |
| 290 | #define	insll(a,d,c)	(__insll((volatile u_int64_t *)(a), d, c)) | |
| 291 | #define	ins64(a,d,c)	insll(a,d,c) | |
| 292 | ||
| 293 | #define	outs8rb(a,s,c)	outsb(a,s,c) | |
| 294 | #define	outswrb(a,s,c)	(__outswrb((volatile u_int16_t *)(a), s, c)) | |
| 295 | #define	outs16rb(a,s,c)	outswrb(a,s,c) | |
| 296 | #define	outslrb(a,s,c)	(__outslrb((volatile u_int32_t *)(a), s, c)) | |
| 297 | #define	outs32rb(a,s,c)	outslrb(a,s,c) | |
| 298 | #define	ins8rb(a,d,c)	insb(a,d,c) | |
| 299 | #define	inswrb(a,d,c)	(__inswrb((volatile u_int16_t *)(a), d, c)) | |
| 300 | #define	ins16rb(a,d,c)	inswrb(a,d,c) | |
| 301 | #define	inslrb(a,d,c)	(__inslrb((volatile u_int32_t *)(a), d, c)) | |
| 302 | #define	ins32rb(a,d,c)	inslrb(a,d,c) | |
| 303 | ||
| 304 | #endif /*_MACHINE_PIO_H_*/ | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/machine/platform.h deleted-76| ... | ... | @@ -1,76 +0,0 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-4-Clause | |
| 3 | * | |
| 4 | * Copyright (C) 1996 Wolfgang Solfrank. | |
| 5 | * Copyright (C) 1996 TooLs GmbH. | |
| 6 | * All rights reserved. | |
| 7 | * | |
| 8 | * Redistribution and use in source and binary forms, with or without | |
| 9 | * modification, are permitted provided that the following conditions | |
| 10 | * are met: | |
| 11 | * 1. Redistributions of source code must retain the above copyright | |
| 12 | * notice, this list of conditions and the following disclaimer. | |
| 13 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 14 | * notice, this list of conditions and the following disclaimer in the | |
| 15 | * documentation and/or other materials provided with the distribution. | |
| 16 | * 3. All advertising materials mentioning features or use of this software | |
| 17 | * must display the following acknowledgement: | |
| 18 | *	This product includes software developed by TooLs GmbH. | |
| 19 | * 4. The name of TooLs GmbH may not be used to endorse or promote products | |
| 20 | * derived from this software without specific prior written permission. | |
| 21 | * | |
| 22 | * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR | |
| 23 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |
| 24 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | |
| 25 | * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
| 26 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | |
| 27 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; | |
| 28 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | |
| 29 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | |
| 30 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | |
| 31 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 32 | * | |
| 33 | *	$NetBSD: powerpc.h,v 1.3 2000/06/01 00:49:59 matt Exp $ | |
| 34 | */ | |
| 35 | ||
| 36 | #ifndef	_MACHINE_PLATFORM_H_ | |
| 37 | #define	_MACHINE_PLATFORM_H_ | |
| 38 | ||
| 39 | #include <machine/ofw_machdep.h> | |
| 40 | #include <machine/smp.h> | |
| 41 | #include <machine/pcpu.h> | |
| 42 | ||
| 43 | struct mem_region { | |
| 44 | 	uint64_t	mr_start; | |
| 45 | 	uint64_t	mr_size; | |
| 46 | }; | |
| 47 | ||
| 48 | struct numa_mem_region { | |
| 49 | 	uint64_t	mr_start; | |
| 50 | 	uint64_t	mr_size; | |
| 51 | 	uint64_t	mr_domain; | |
| 52 | }; | |
| 53 | ||
| 54 | /* Documentation for these functions is in platform_if.m */ | |
| 55 | ||
| 56 | void	mem_regions(struct mem_region **, int *, struct mem_region **, int *); | |
| 57 | void	numa_mem_regions(struct numa_mem_region **, int *); | |
| 58 | vm_offset_t platform_real_maxaddr(void); | |
| 59 | ||
| 60 | u_long	platform_timebase_freq(struct cpuref *); | |
| 61 | ||
| 62 | int	platform_smp_first_cpu(struct cpuref *); | |
| 63 | int	platform_smp_next_cpu(struct cpuref *); | |
| 64 | int	platform_smp_get_bsp(struct cpuref *); | |
| 65 | int	platform_smp_start_cpu(struct pcpu *); | |
| 66 | void	platform_smp_timebase_sync(u_long tb, int ap); | |
| 67 | void	platform_smp_ap_init(void); | |
| 68 | void	platform_smp_probe_threads(void); | |
| 69 | int	platform_node_numa_domain(phandle_t); | |
| 70 | ||
| 71 | const char *installed_platform(void); | |
| 72 | void platform_probe_and_attach(void); | |
| 73 | ||
| 74 | void platform_sleep(void); | |
| 75 | ||
| 76 | #endif	/* _MACHINE_PLATFORM_H_ */ | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/machine/platformvar.h deleted-89| ... | ... | @@ -1,89 +0,0 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-2-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 2005 Peter Grehan | |
| 5 | * All rights reserved. | |
| 6 | * | |
| 7 | * Redistribution and use in source and binary forms, with or without | |
| 8 | * modification, are permitted provided that the following conditions | |
| 9 | * are met: | |
| 10 | * 1. Redistributions of source code must retain the above copyright | |
| 11 | * notice, this list of conditions and the following disclaimer. | |
| 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 13 | * notice, this list of conditions and the following disclaimer in the | |
| 14 | * documentation and/or other materials provided with the distribution. | |
| 15 | * | |
| 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |
| 17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
| 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | |
| 20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
| 21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
| 22 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
| 23 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
| 24 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
| 25 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
| 26 | * SUCH DAMAGE. | |
| 27 | */ | |
| 28 | ||
| 29 | #ifndef _MACHINE_PLATFORMVAR_H_ | |
| 30 | #define _MACHINE_PLATFORMVAR_H_ | |
| 31 | ||
| 32 | /* | |
| 33 | * A PowerPC platform implementation is declared with a kernel object and | |
| 34 | * an associated method table, similar to a device driver. | |
| 35 | * | |
| 36 | * e.g. | |
| 37 | * | |
| 38 | * static platform_method_t chrp_methods[] = { | |
| 39 | *	PLATFORMMETHOD(platform_probe,		chrp_probe), | |
| 40 | *	PLATFORMMETHOD(platform_mem_regions,	ofw_mem_regions), | |
| 41 | * ... | |
| 42 | *	PLATFORMMETHOD(platform_smp_first_cpu,	chrp_smp_first_cpu), | |
| 43 | *	{ 0, 0 } | |
| 44 | * }; | |
| 45 | * | |
| 46 | * static platform_def_t chrp_platform = { | |
| 47 | * 	"chrp", | |
| 48 | *	chrp_methods, | |
| 49 | *	sizeof(chrp_platform_softc),	// or 0 if no softc | |
| 50 | * }; | |
| 51 | * | |
| 52 | * PLATFORM_DEF(chrp_platform); | |
| 53 | */ | |
| 54 | ||
| 55 | #include <sys/kobj.h> | |
| 56 | ||
| 57 | struct platform_kobj { | |
| 58 | 	/* | |
| 59 | 	 * A platform instance is a kernel object | |
| 60 | 	 */ | |
| 61 | 	KOBJ_FIELDS; | |
| 62 | ||
| 63 | 	/* | |
| 64 | 	 * Utility elements that an instance may use | |
| 65 | 	 */ | |
| 66 | 	struct mtx	platform_mtx;	/* available for instance use */ | |
| 67 | 	void		*platform_iptr;	/* instance data pointer */ | |
| 68 | ||
| 69 | 	/* | |
| 70 | 	 * Opaque data that can be overlaid with an instance-private | |
| 71 | 	 * structure. Platform code can test that this is large enough at | |
| 72 | 	 * compile time with a sizeof() test againt it's softc. There | |
| 73 | 	 * is also a run-time test when the platform kernel object is | |
| 74 | 	 * registered. | |
| 75 | 	 */ | |
| 76 | #define PLATFORM_OPAQUESZ	64 | |
| 77 | 	u_int		platform_opaque[PLATFORM_OPAQUESZ]; | |
| 78 | }; | |
| 79 | ||
| 80 | typedef struct platform_kobj	*platform_t; | |
| 81 | typedef struct kobj_class	platform_def_t; | |
| 82 | #define platform_method_t	kobj_method_t | |
| 83 | ||
| 84 | #define PLATFORMMETHOD		KOBJMETHOD | |
| 85 | #define	PLATFORMMETHOD_END	KOBJMETHOD_END | |
| 86 | ||
| 87 | #define PLATFORM_DEF(name)	DATA_SET(platform_set, name) | |
| 88 | ||
| 89 | #endif /* _MACHINE_PLATFORMVAR_H_ */ | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/machine/pmap.h deleted-361| ... | ... | @@ -1,361 +0,0 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-3-Clause AND BSD-4-Clause | |
| 3 | * | |
| 4 | * Copyright (C) 2006 Semihalf, Marian Balakowicz <m8@semihalf.com> | |
| 5 | * All rights reserved. | |
| 6 | * | |
| 7 | * Adapted for Freescale's e500 core CPUs. | |
| 8 | * | |
| 9 | * Redistribution and use in source and binary forms, with or without | |
| 10 | * modification, are permitted provided that the following conditions | |
| 11 | * are met: | |
| 12 | * 1. Redistributions of source code must retain the above copyright | |
| 13 | * notice, this list of conditions and the following disclaimer. | |
| 14 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 15 | * notice, this list of conditions and the following disclaimer in the | |
| 16 | * documentation and/or other materials provided with the distribution. | |
| 17 | * 3. The name of the author may not be used to endorse or promote products | |
| 18 | * derived from this software without specific prior written permission. | |
| 19 | * | |
| 20 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | |
| 21 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |
| 22 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN | |
| 23 | * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
| 24 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED | |
| 25 | * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | |
| 26 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF | |
| 27 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | |
| 28 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | |
| 29 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 30 | */ | |
| 31 | /*- | |
| 32 | * Copyright (C) 1995, 1996 Wolfgang Solfrank. | |
| 33 | * Copyright (C) 1995, 1996 TooLs GmbH. | |
| 34 | * All rights reserved. | |
| 35 | * | |
| 36 | * Redistribution and use in source and binary forms, with or without | |
| 37 | * modification, are permitted provided that the following conditions | |
| 38 | * are met: | |
| 39 | * 1. Redistributions of source code must retain the above copyright | |
| 40 | * notice, this list of conditions and the following disclaimer. | |
| 41 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 42 | * notice, this list of conditions and the following disclaimer in the | |
| 43 | * documentation and/or other materials provided with the distribution. | |
| 44 | * 3. All advertising materials mentioning features or use of this software | |
| 45 | * must display the following acknowledgement: | |
| 46 | *	This product includes software developed by TooLs GmbH. | |
| 47 | * 4. The name of TooLs GmbH may not be used to endorse or promote products | |
| 48 | * derived from this software without specific prior written permission. | |
| 49 | * | |
| 50 | * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR | |
| 51 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |
| 52 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | |
| 53 | * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
| 54 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | |
| 55 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; | |
| 56 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | |
| 57 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | |
| 58 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | |
| 59 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 60 | * | |
| 61 | *	from: $NetBSD: pmap.h,v 1.17 2000/03/30 16:18:24 jdolecek Exp $ | |
| 62 | */ | |
| 63 | ||
| 64 | #ifndef	_MACHINE_PMAP_H_ | |
| 65 | #define	_MACHINE_PMAP_H_ | |
| 66 | ||
| 67 | #include <sys/queue.h> | |
| 68 | #include <sys/tree.h> | |
| 69 | #include <sys/_cpuset.h> | |
| 70 | #include <sys/_lock.h> | |
| 71 | #include <sys/_mutex.h> | |
| 72 | #include <machine/sr.h> | |
| 73 | #include <machine/pte.h> | |
| 74 | #include <machine/slb.h> | |
| 75 | #include <machine/tlb.h> | |
| 76 | #include <machine/vmparam.h> | |
| 77 | #ifdef __powerpc64__ | |
| 78 | #include <vm/vm_radix.h> | |
| 79 | #endif | |
| 80 | ||
| 81 | /* | |
| 82 | * The radix page table structure is described by levels 1-4. | |
| 83 | * See Fig 33. on p. 1002 of Power ISA v3.0B | |
| 84 | * | |
| 85 | * Page directories and tables must be size aligned. | |
| 86 | */ | |
| 87 | ||
| 88 | /* Root page directory - 64k -- each entry covers 512GB */ | |
| 89 | typedef uint64_t pml1_entry_t; | |
| 90 | /* l2 page directory - 4k -- each entry covers 1GB */ | |
| 91 | typedef uint64_t pml2_entry_t; | |
| 92 | /* l3 page directory - 4k -- each entry covers 2MB */ | |
| 93 | typedef uint64_t pml3_entry_t; | |
| 94 | /* l4 page directory - 256B/4k -- each entry covers 64k/4k */ | |
| 95 | typedef uint64_t pml4_entry_t; | |
| 96 | ||
| 97 | typedef uint64_t pt_entry_t; | |
| 98 | ||
| 99 | struct pmap; | |
| 100 | typedef struct pmap *pmap_t; | |
| 101 | ||
| 102 | #define	PMAP_ENTER_QUICK_LOCKED	0x10000000 | |
| 103 | ||
| 104 | #if !defined(NPMAPS) | |
| 105 | #define	NPMAPS		32768 | |
| 106 | #endif /* !defined(NPMAPS) */ | |
| 107 | ||
| 108 | struct	slbtnode; | |
| 109 | ||
| 110 | struct pvo_entry { | |
| 111 | 	LIST_ENTRY(pvo_entry) pvo_vlink;	/* Link to common virt page */ | |
| 112 | #ifndef __powerpc64__ | |
| 113 | 	LIST_ENTRY(pvo_entry) pvo_olink;	/* Link to overflow entry */ | |
| 114 | #endif | |
| 115 | 	union { | |
| 116 | 		RB_ENTRY(pvo_entry) pvo_plink;	/* Link to pmap entries */ | |
| 117 | 		SLIST_ENTRY(pvo_entry) pvo_dlink; /* Link to delete enty */ | |
| 118 | 	}; | |
| 119 | 	struct { | |
| 120 | #ifndef __powerpc64__ | |
| 121 | 		/* 32-bit fields */ | |
| 122 | 		pte_t	 pte; | |
| 123 | #endif | |
| 124 | 		/* 64-bit fields */ | |
| 125 | 		uintptr_t slot; | |
| 126 | 		vm_paddr_t pa; | |
| 127 | 		vm_prot_t prot; | |
| 128 | 	} pvo_pte; | |
| 129 | 	pmap_t		pvo_pmap;		/* Owning pmap */ | |
| 130 | 	vm_offset_t	pvo_vaddr;		/* VA of entry */ | |
| 131 | 	uint64_t	pvo_vpn;		/* Virtual page number */ | |
| 132 | }; | |
| 133 | LIST_HEAD(pvo_head, pvo_entry); | |
| 134 | SLIST_HEAD(pvo_dlist, pvo_entry); | |
| 135 | RB_HEAD(pvo_tree, pvo_entry); | |
| 136 | int pvo_vaddr_compare(struct pvo_entry *, struct pvo_entry *); | |
| 137 | RB_PROTOTYPE(pvo_tree, pvo_entry, pvo_plink, pvo_vaddr_compare); | |
| 138 | ||
| 139 | /* Used by 32-bit PMAP */ | |
| 140 | #define	PVO_PTEGIDX_MASK	0x007UL		/* which PTEG slot */ | |
| 141 | #define	PVO_PTEGIDX_VALID	0x008UL		/* slot is valid */ | |
| 142 | /* Used by 64-bit PMAP */ | |
| 143 | #define	PVO_HID			0x008UL		/* PVO entry in alternate hash*/ | |
| 144 | /* Used by both */ | |
| 145 | #define	PVO_WIRED		0x010UL		/* PVO entry is wired */ | |
| 146 | #define	PVO_MANAGED		0x020UL		/* PVO entry is managed */ | |
| 147 | #define	PVO_BOOTSTRAP		0x080UL		/* PVO entry allocated during | |
| 148 | 						 bootstrap */ | |
| 149 | #define	PVO_DEAD		0x100UL		/* waiting to be deleted */ | |
| 150 | #define	PVO_LARGE		0x200UL		/* large page */ | |
| 151 | #define	PVO_VADDR(pvo)		((pvo)->pvo_vaddr & ~ADDR_POFF) | |
| 152 | #define	PVO_PTEGIDX_GET(pvo)	((pvo)->pvo_vaddr & PVO_PTEGIDX_MASK) | |
| 153 | #define	PVO_PTEGIDX_ISSET(pvo)	((pvo)->pvo_vaddr & PVO_PTEGIDX_VALID) | |
| 154 | #define	PVO_PTEGIDX_CLR(pvo)	\ | |
| 155 | 	((void)((pvo)->pvo_vaddr &= ~(PVO_PTEGIDX_VALID|PVO_PTEGIDX_MASK))) | |
| 156 | #define	PVO_PTEGIDX_SET(pvo, i)	\ | |
| 157 | 	((void)((pvo)->pvo_vaddr |= (i)|PVO_PTEGIDX_VALID)) | |
| 158 | #define	PVO_VSID(pvo)		((pvo)->pvo_vpn >> 16) | |
| 159 | ||
| 160 | struct	pmap { | |
| 161 | 	struct		pmap_statistics	pm_stats; | |
| 162 | 	struct	mtx	pm_mtx; | |
| 163 | 	cpuset_t	pm_active; | |
| 164 | 	union { | |
| 165 | 		struct { | |
| 166 | 		 #ifdef __powerpc64__ | |
| 167 | 			struct slbtnode	*pm_slb_tree_root; | |
| 168 | 			struct slb	**pm_slb; | |
| 169 | 			int		pm_slb_len; | |
| 170 | 		 #else | |
| 171 | 			register_t	pm_sr[16]; | |
| 172 | 		 #endif | |
| 173 | ||
| 174 | 			struct pmap	*pmap_phys; | |
| 175 | 			struct pvo_tree pmap_pvo; | |
| 176 | 		}; | |
| 177 | #ifdef __powerpc64__ | |
| 178 | 		/* Radix support */ | |
| 179 | 		struct { | |
| 180 | 			pml1_entry_t	*pm_pml1;	/* KVA of root page directory */ | |
| 181 | 			struct vm_radix	 pm_radix;	/* spare page table pages */ | |
| 182 | 			TAILQ_HEAD(,pv_chunk)	pm_pvchunk;	/* list of mappings in pmap */ | |
| 183 | 			uint64_t	pm_pid; /* PIDR value */ | |
| 184 | 			int pm_flags; | |
| 185 | 		}; | |
| 186 | #endif | |
| 187 | 		struct { | |
| 188 | 			/* TID to identify this pmap entries in TLB */ | |
| 189 | 			tlbtid_t	pm_tid[MAXCPU]; | |
| 190 | ||
| 191 | #ifdef __powerpc64__ | |
| 192 | 			/* | |
| 193 | 			 * Page table directory, | |
| 194 | 			 * array of pointers to page directories. | |
| 195 | 			 */ | |
| 196 | 			pte_t ****pm_root; | |
| 197 | #else | |
| 198 | 			/* | |
| 199 | 			 * Page table directory, | |
| 200 | 			 * array of pointers to page tables. | |
| 201 | 			 */ | |
| 202 | 			pte_t		**pm_pdir; | |
| 203 | ||
| 204 | 			/* List of allocated ptbl bufs (ptbl kva regions). */ | |
| 205 | 			TAILQ_HEAD(, ptbl_buf)	pm_ptbl_list; | |
| 206 | #endif | |
| 207 | 		}; | |
| 208 | 	} __aligned(CACHE_LINE_SIZE); | |
| 209 | }; | |
| 210 | ||
| 211 | /* | |
| 212 | * pv_entries are allocated in chunks per-process. This avoids the | |
| 213 | * need to track per-pmap assignments. | |
| 214 | */ | |
| 215 | #define	_NPCPV	126 | |
| 216 | #define	_NPCM	howmany(_NPCPV, 64) | |
| 217 | ||
| 218 | #define	PV_CHUNK_HEADER							\ | |
| 219 | 	pmap_t			pc_pmap;				\ | |
| 220 | 	TAILQ_ENTRY(pv_chunk)	pc_list;				\ | |
| 221 | 	uint64_t		pc_map[_NPCM];	/* bitmap; 1 = free */	\ | |
| 222 | 	TAILQ_ENTRY(pv_chunk)	pc_lru; | |
| 223 | ||
| 224 | struct pv_entry { | |
| 225 | 	pmap_t pv_pmap; | |
| 226 | 	vm_offset_t pv_va; | |
| 227 | 	TAILQ_ENTRY(pv_entry) pv_link; | |
| 228 | }; | |
| 229 | typedef struct pv_entry *pv_entry_t; | |
| 230 | ||
| 231 | struct pv_chunk_header { | |
| 232 | 	PV_CHUNK_HEADER | |
| 233 | }; | |
| 234 | struct pv_chunk { | |
| 235 | 	PV_CHUNK_HEADER | |
| 236 | 	uint64_t	reserved; | |
| 237 | 	struct pv_entry		pc_pventry[_NPCPV]; | |
| 238 | }; | |
| 239 | ||
| 240 | struct	md_page { | |
| 241 | 	union { | |
| 242 | 		struct { | |
| 243 | 			volatile int32_t mdpg_attrs; | |
| 244 | 			vm_memattr_t	 mdpg_cache_attrs; | |
| 245 | 			struct	pvo_head mdpg_pvoh; | |
| 246 | 			int		pv_gen; /* (p) */ | |
| 247 | 		}; | |
| 248 | 		struct { | |
| 249 | 			int			pv_tracked; | |
| 250 | 		}; | |
| 251 | 	}; | |
| 252 | 	TAILQ_HEAD(, pv_entry)	pv_list; /* (p) */ | |
| 253 | }; | |
| 254 | ||
| 255 | #ifdef AIM | |
| 256 | #define	pmap_page_get_memattr(m)	((m)->md.mdpg_cache_attrs) | |
| 257 | #else | |
| 258 | #define	pmap_page_get_memattr(m)	VM_MEMATTR_DEFAULT | |
| 259 | #endif /* AIM */ | |
| 260 | ||
| 261 | /* | |
| 262 | * Return the VSID corresponding to a given virtual address. | |
| 263 | * If no VSID is currently defined, it will allocate one, and add | |
| 264 | * it to a free slot if available. | |
| 265 | * | |
| 266 | * NB: The PMAP MUST be locked already. | |
| 267 | */ | |
| 268 | uint64_t va_to_vsid(pmap_t pm, vm_offset_t va); | |
| 269 | ||
| 270 | /* Lock-free, non-allocating lookup routines */ | |
| 271 | uint64_t kernel_va_to_slbv(vm_offset_t va); | |
| 272 | struct slb *user_va_to_slb_entry(pmap_t pm, vm_offset_t va); | |
| 273 | ||
| 274 | uint64_t allocate_user_vsid(pmap_t pm, uint64_t esid, int large); | |
| 275 | void	free_vsid(pmap_t pm, uint64_t esid, int large); | |
| 276 | void	slb_insert_user(pmap_t pm, struct slb *slb); | |
| 277 | void	slb_insert_kernel(uint64_t slbe, uint64_t slbv); | |
| 278 | ||
| 279 | struct slbtnode *slb_alloc_tree(void); | |
| 280 | void slb_free_tree(pmap_t pm); | |
| 281 | struct slb **slb_alloc_user_cache(void); | |
| 282 | void	slb_free_user_cache(struct slb **); | |
| 283 | ||
| 284 | extern	struct pmap kernel_pmap_store; | |
| 285 | #define	kernel_pmap	(&kernel_pmap_store) | |
| 286 | ||
| 287 | #ifdef _KERNEL | |
| 288 | ||
| 289 | #define	PMAP_LOCK(pmap)		mtx_lock(&(pmap)->pm_mtx) | |
| 290 | #define	PMAP_LOCK_ASSERT(pmap, type) \ | |
| 291 | 				mtx_assert(&(pmap)->pm_mtx, (type)) | |
| 292 | #define	PMAP_LOCK_DESTROY(pmap)	mtx_destroy(&(pmap)->pm_mtx) | |
| 293 | #define	PMAP_LOCK_INIT(pmap)	mtx_init(&(pmap)->pm_mtx, \ | |
| 294 | 				 (pmap == kernel_pmap) ? "kernelpmap" : \ | |
| 295 | 				 "pmap", NULL, MTX_DEF | MTX_DUPOK) | |
| 296 | #define	PMAP_LOCKED(pmap)	mtx_owned(&(pmap)->pm_mtx) | |
| 297 | #define	PMAP_MTX(pmap)		(&(pmap)->pm_mtx) | |
| 298 | #define	PMAP_TRYLOCK(pmap)	mtx_trylock(&(pmap)->pm_mtx) | |
| 299 | #define	PMAP_UNLOCK(pmap)	mtx_unlock(&(pmap)->pm_mtx) | |
| 300 | ||
| 301 | #define	pmap_page_is_write_mapped(m)	(((m)->a.flags & PGA_WRITEABLE) != 0) | |
| 302 | ||
| 303 | #define	pmap_vm_page_alloc_check(m) | |
| 304 | ||
| 305 | void		pmap_bootstrap(vm_offset_t, vm_offset_t); | |
| 306 | void		pmap_kenter(vm_offset_t va, vm_paddr_t pa); | |
| 307 | void		pmap_kenter_attr(vm_offset_t va, vm_paddr_t pa, vm_memattr_t); | |
| 308 | void		pmap_kremove(vm_offset_t); | |
| 309 | void		*pmap_mapdev(vm_paddr_t, vm_size_t); | |
| 310 | void		*pmap_mapdev_attr(vm_paddr_t, vm_size_t, vm_memattr_t); | |
| 311 | void		pmap_unmapdev(void *, vm_size_t); | |
| 312 | void		pmap_page_set_memattr(vm_page_t, vm_memattr_t); | |
| 313 | int		pmap_change_attr(vm_offset_t, vm_size_t, vm_memattr_t); | |
| 314 | int		pmap_map_user_ptr(pmap_t pm, volatile const void *uaddr, | |
| 315 | 		 void **kaddr, size_t ulen, size_t *klen); | |
| 316 | int		pmap_decode_kernel_ptr(vm_offset_t addr, int *is_user, | |
| 317 | 		 vm_offset_t *decoded_addr); | |
| 318 | void		pmap_deactivate(struct thread *); | |
| 319 | vm_paddr_t	pmap_kextract(vm_offset_t); | |
| 320 | int		pmap_dev_direct_mapped(vm_paddr_t, vm_size_t); | |
| 321 | boolean_t	pmap_mmu_install(char *name, int prio); | |
| 322 | void		pmap_mmu_init(void); | |
| 323 | const char	*pmap_mmu_name(void); | |
| 324 | bool		pmap_ps_enabled(pmap_t pmap); | |
| 325 | int		pmap_nofault(pmap_t pmap, vm_offset_t va, vm_prot_t flags); | |
| 326 | boolean_t	pmap_page_is_mapped(vm_page_t m); | |
| 327 | #define	pmap_map_delete(pmap, sva, eva)	pmap_remove(pmap, sva, eva) | |
| 328 | ||
| 329 | void		pmap_page_array_startup(long count); | |
| 330 | ||
| 331 | #define	vtophys(va)	pmap_kextract((vm_offset_t)(va)) | |
| 332 | ||
| 333 | extern	vm_offset_t virtual_avail; | |
| 334 | extern	vm_offset_t virtual_end; | |
| 335 | extern	caddr_t crashdumpmap; | |
| 336 | ||
| 337 | extern	vm_offset_t msgbuf_phys; | |
| 338 | ||
| 339 | extern	int pmap_bootstrapped; | |
| 340 | extern	int radix_mmu; | |
| 341 | extern	int superpages_enabled; | |
| 342 | ||
| 343 | #ifdef AIM | |
| 344 | void pmap_early_io_map_init(void); | |
| 345 | #endif | |
| 346 | vm_offset_t pmap_early_io_map(vm_paddr_t pa, vm_size_t size); | |
| 347 | void pmap_early_io_unmap(vm_offset_t va, vm_size_t size); | |
| 348 | void pmap_track_page(pmap_t pmap, vm_offset_t va); | |
| 349 | void pmap_page_print_mappings(vm_page_t m); | |
| 350 | void pmap_tlbie_all(void); | |
| 351 | ||
| 352 | static inline int | |
| 353 | pmap_vmspace_copy(pmap_t dst_pmap __unused, pmap_t src_pmap __unused) | |
| 354 | { | |
| 355 | ||
| 356 | 	return (0); | |
| 357 | } | |
| 358 | ||
| 359 | #endif | |
| 360 | ||
| 361 | #endif /* !_MACHINE_PMAP_H_ */ | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/machine/pmc_mdep.h deleted-95| ... | ... | @@ -1,95 +0,0 @@ |
| 1 | /*- | |
| 2 | * This file is in the public domain. | |
| 3 | */ | |
| 4 | ||
| 5 | #ifndef _MACHINE_PMC_MDEP_H_ | |
| 6 | #define	_MACHINE_PMC_MDEP_H_ | |
| 7 | ||
| 8 | #define PMC_MDEP_CLASS_INDEX_POWERPC	1 | |
| 9 | ||
| 10 | union pmc_md_op_pmcallocate { | |
| 11 | 	uint32_t		pm_event; | |
| 12 | 	uint64_t		__pad[4]; | |
| 13 | }; | |
| 14 | ||
| 15 | /* Logging */ | |
| 16 | #ifdef __powerpc64__ | |
| 17 | #define	PMCLOG_READADDR		PMCLOG_READ64 | |
| 18 | #define	PMCLOG_EMITADDR		PMCLOG_EMIT64 | |
| 19 | #else | |
| 20 | #define	PMCLOG_READADDR		PMCLOG_READ32 | |
| 21 | #define	PMCLOG_EMITADDR		PMCLOG_EMIT32 | |
| 22 | #endif | |
| 23 | ||
| 24 | #define	mtpmr(reg, val)							\ | |
| 25 | 	__asm __volatile("mtpmr %0,%1" : : "K"(reg), "r"(val)) | |
| 26 | #define	mfpmr(reg)							\ | |
| 27 | 	( { register_t val;						\ | |
| 28 | 	 __asm __volatile("mfpmr %0,%1" : "=r"(val) : "K"(reg));	\ | |
| 29 | 	 val; } ) | |
| 30 | ||
| 31 | #define	PMR_PMC0	16 | |
| 32 | #define	PMR_PMC1	17 | |
| 33 | #define	PMR_PMC2	18 | |
| 34 | #define	PMR_PMC3	19 | |
| 35 | #define	PMR_PMLCa0	144 | |
| 36 | #define	 PMLCax_FC	 0x80000000 | |
| 37 | #define	 PMLCax_FCS	 0x40000000 | |
| 38 | #define	 PMLCax_FCU	 0x20000000 | |
| 39 | #define	 PMLCax_FCM1	 0x10000000 | |
| 40 | #define	 PMLCax_FCM0	 0x08000000 | |
| 41 | #define	 PMLCax_CE	 0x04000000 | |
| 42 | #define	 PMLCax_EVENT(x) ((x) << 16) | |
| 43 | #define	 PMLCax_FCGS1	 0x00000002 | |
| 44 | #define	 PMLCax_FCGS0	 0x00000001 | |
| 45 | #define	PMR_PMLCa1	145 | |
| 46 | #define	PMR_PMLCa2	146 | |
| 47 | #define	PMR_PMLCa3	147 | |
| 48 | #define	PMR_PMLCb0	272 | |
| 49 | #define	 PMLCbx_TRIGONCTL(x)	 ((x) << 28) | |
| 50 | #define	 PMLCbx_TRIGOFFCTL(x)	 ((x) << 24) | |
| 51 | #define	 PMLCbx_PMCC		 0x00800000 | |
| 52 | #define	 PMLCbx_PMP(x)		 ((x) << 13) | |
| 53 | #define	 PMLCbx_TREHMUL(x)	 ((x) << 8) | |
| 54 | #define	 PMLCbx_TRESHOLD(x)	 ((x) << 0) | |
| 55 | #define	PMR_PMLCb1	273 | |
| 56 | #define	PMR_PMLCb2	274 | |
| 57 | #define	PMR_PMLCb3	275 | |
| 58 | #define	PMR_PMGC0	400 | |
| 59 | #define	 PMGC_FAC	 0x80000000 | |
| 60 | #define	 PMGC_PMIE	 0x40000000 | |
| 61 | #define	 PMGC_FCECE	 0x20000000 | |
| 62 | #define	 PMGC_TBSEL(x)	 ((x) << 11) | |
| 63 | #define	 PMGC_TBEE	 0x00000100 | |
| 64 | #define	PMR_UPMC0	0 | |
| 65 | #define	PMR_UPMC1	1 | |
| 66 | #define	PMR_UPMC2	2 | |
| 67 | #define	PMR_UPMC3	3 | |
| 68 | #define	PMR_UPMLCa0	128 | |
| 69 | #define	PMR_UPMLCa1	129 | |
| 70 | #define	PMR_UPMLCa2	130 | |
| 71 | #define	PMR_UPMLCa3	131 | |
| 72 | #define	PMR_UPMLCb0	256 | |
| 73 | #define	PMR_UPMLCb1	257 | |
| 74 | #define	PMR_UPMLCb2	258 | |
| 75 | #define	PMR_UPMLCb3	259 | |
| 76 | #define	PMR_UPMGC0	384 | |
| 77 | ||
| 78 | #if	_KERNEL | |
| 79 | ||
| 80 | struct pmc_md_powerpc_pmc { | |
| 81 | 	uint64_t	pm_powerpc_overflowcnt; | |
| 82 | 	uint32_t	pm_powerpc_evsel; | |
| 83 | }; | |
| 84 | ||
| 85 | union pmc_md_pmc { | |
| 86 | 	struct pmc_md_powerpc_pmc	pm_powerpc; | |
| 87 | }; | |
| 88 | ||
| 89 | #define	PMC_TRAPFRAME_TO_PC(TF)	((TF)->srr0) | |
| 90 | #define	PMC_TRAPFRAME_TO_FP(TF)	((TF)->fixreg[1]) | |
| 91 | #define	PMC_TRAPFRAME_TO_SP(TF)	(0) | |
| 92 | ||
| 93 | #endif | |
| 94 | ||
| 95 | #endif /* !_MACHINE_PMC_MDEP_H_ */ | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/machine/proc.h deleted-61| ... | ... | @@ -1,61 +0,0 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-4-Clause | |
| 3 | * | |
| 4 | * Copyright (C) 1995, 1996 Wolfgang Solfrank. | |
| 5 | * Copyright (C) 1995, 1996 TooLs GmbH. | |
| 6 | * All rights reserved. | |
| 7 | * | |
| 8 | * Redistribution and use in source and binary forms, with or without | |
| 9 | * modification, are permitted provided that the following conditions | |
| 10 | * are met: | |
| 11 | * 1. Redistributions of source code must retain the above copyright | |
| 12 | * notice, this list of conditions and the following disclaimer. | |
| 13 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 14 | * notice, this list of conditions and the following disclaimer in the | |
| 15 | * documentation and/or other materials provided with the distribution. | |
| 16 | * 3. All advertising materials mentioning features or use of this software | |
| 17 | * must display the following acknowledgement: | |
| 18 | *	This product includes software developed by TooLs GmbH. | |
| 19 | * 4. The name of TooLs GmbH may not be used to endorse or promote products | |
| 20 | * derived from this software without specific prior written permission. | |
| 21 | * | |
| 22 | * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR | |
| 23 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |
| 24 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | |
| 25 | * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
| 26 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | |
| 27 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; | |
| 28 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | |
| 29 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | |
| 30 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | |
| 31 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 32 | * | |
| 33 | *	$NetBSD: proc.h,v 1.2 1997/04/16 22:57:48 thorpej Exp $ | |
| 34 | */ | |
| 35 | ||
| 36 | #ifndef _MACHINE_PROC_H_ | |
| 37 | #define	_MACHINE_PROC_H_ | |
| 38 | ||
| 39 | /* | |
| 40 | * Machine-dependent part of the proc structure | |
| 41 | */ | |
| 42 | struct mdthread { | |
| 43 | 	int	md_spinlock_count;	/* (k) */ | |
| 44 | 	register_t md_saved_msr;	/* (k) */ | |
| 45 | }; | |
| 46 | ||
| 47 | struct mdproc { | |
| 48 | 	/* | |
| 49 | 	 * Avoid empty structs because they are undefined behavior. | |
| 50 | 	 */ | |
| 51 | 	long	md_spare; | |
| 52 | }; | |
| 53 | ||
| 54 | #ifdef __powerpc64__ | |
| 55 | #define	KINFO_PROC_SIZE 1088 | |
| 56 | #define	KINFO_PROC32_SIZE 816 | |
| 57 | #else | |
| 58 | #define	KINFO_PROC_SIZE 816 | |
| 59 | #endif | |
| 60 | ||
| 61 | #endif /* !_MACHINE_PROC_H_ */ | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/machine/profile.h deleted-234| ... | ... | @@ -1,234 +0,0 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: MIT-CMU | |
| 3 | * | |
| 4 | * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University. | |
| 5 | * All rights reserved. | |
| 6 | * | |
| 7 | * Author: Chris G. Demetriou | |
| 8 | * | |
| 9 | * Permission to use, copy, modify and distribute this software and | |
| 10 | * its documentation is hereby granted, provided that both the copyright | |
| 11 | * notice and this permission notice appear in all copies of the | |
| 12 | * software, derivative works or modified versions, and any portions | |
| 13 | * thereof, and that both notices appear in supporting documentation. | |
| 14 | * | |
| 15 | * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" | |
| 16 | * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND | |
| 17 | * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. | |
| 18 | * | |
| 19 | * Carnegie Mellon requests users of this software to return to | |
| 20 | * | |
| 21 | * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU | |
| 22 | * School of Computer Science | |
| 23 | * Carnegie Mellon University | |
| 24 | * Pittsburgh PA 15213-3890 | |
| 25 | * | |
| 26 | * any improvements or extensions that they make and grant Carnegie the | |
| 27 | * rights to redistribute these changes. | |
| 28 | * | |
| 29 | *	from: NetBSD: profile.h,v 1.9 1997/04/06 08:47:37 cgd Exp | |
| 30 | *	from: FreeBSD: src/sys/alpha/include/profile.h,v 1.4 1999/12/29 | |
| 31 | */ | |
| 32 | ||
| 33 | #ifndef _MACHINE_PROFILE_H_ | |
| 34 | #define	_MACHINE_PROFILE_H_ | |
| 35 | ||
| 36 | #define	_MCOUNT_DECL	void __mcount | |
| 37 | ||
| 38 | #define	FUNCTION_ALIGNMENT	4 | |
| 39 | ||
| 40 | typedef __ptrdiff_t	fptrdiff_t; | |
| 41 | ||
| 42 | /* | |
| 43 | * The mcount trampoline macro, expanded in libc/gmon/mcount.c | |
| 44 | * | |
| 45 | * For PowerPC SVR4 ABI profiling, the compiler will insert | |
| 46 | * a data declaration and code sequence at the start of a routine of the form | |
| 47 | * | |
| 48 | * .function_mc: 	.data | |
| 49 | *			.align	2 | |
| 50 | *			.long	0 | |
| 51 | *			.text | |
| 52 | * | |
| 53 | * function:		mflr	%r0 | |
| 54 | *			addis	%r11,%r0, .function_mc@ha | |
| 55 | *			stw	%r0,4(%r1) | |
| 56 | *			addi	%r0,%r11, .function_mc@l | |
| 57 | *			bl	_mcount | |
| 58 | * | |
| 59 | * The link register is saved in the LR save word in the caller's | |
| 60 | * stack frame, r0 is set up to point to the allocated longword, | |
| 61 | * and control is transferred to _mcount. | |
| 62 | * | |
| 63 | * On return from _mcount, the routine should function as it would | |
| 64 | * with no profiling so _mcount must restore register state to that upon | |
| 65 | * entry. Any routine called by the _mcount trampoline will save | |
| 66 | * callee-save registers, so _mcount must make sure it saves volatile | |
| 67 | * registers that may have state after it returns i.e. parameter registers. | |
| 68 | * | |
| 69 | * The FreeBSD libc mcount routine ignores the r0 longword pointer, but | |
| 70 | * instead requires as parameters the current PC and called PC. The current | |
| 71 | * PC is obtained from the link register, as a result of "bl _mcount" in | |
| 72 | * the stub, while the caller's PC is obtained from the LR save word. | |
| 73 | * | |
| 74 | * On return from libc mcount, the return is done indirectly with the | |
| 75 | * ctr register rather than the link register, to allow the link register | |
| 76 | * to be restored to what it was on entry to the profiled routine. | |
| 77 | */ | |
| 78 | ||
| 79 | #if defined(__powerpc64__) | |
| 80 | ||
| 81 | #if !defined(_CALL_ELF) || _CALL_ELF == 1 | |
| 82 | #define MCOUNT_PREAMBLE \ | |
| 83 | 	"	.align	2			\n" \ | |
| 84 | 	"	.globl	_mcount			\n" \ | |
| 85 | 	"	.section \".opd\",\"aw\"	\n" \ | |
| 86 | 	"	.align	3			\n" \ | |
| 87 | 	"_mcount:				\n" \ | |
| 88 | 	"	.quad .L._mcount,.TOC.@tocbase,0\n" \ | |
| 89 | 	"	.previous			\n" \ | |
| 90 | 	"	.size _mcount,24		\n" \ | |
| 91 | 	"	.type	_mcount,@function	\n" \ | |
| 92 | 	"	.align	4			\n" \ | |
| 93 | 	".L._mcount:				\n" | |
| 94 | #else | |
| 95 | #define MCOUNT_PREAMBLE \ | |
| 96 | 	"	.globl	_mcount			\n" \ | |
| 97 | 	"	.type	_mcount,@function	\n" \ | |
| 98 | 	"	.align	4			\n" \ | |
| 99 | 	"_mcount:				\n" | |
| 100 | #endif | |
| 101 | ||
| 102 | #define	MCOUNT					\ | |
| 103 | __asm(	MCOUNT_PREAMBLE \ | |
| 104 | 	"	stdu	%r1,-(288+128)(%r1)	\n" \ | |
| 105 | 	"	std	%r3,48(%r1)		\n" \ | |
| 106 | 	"	std	%r4,56(%r1)		\n" \ | |
| 107 | 	"	std	%r5,64(%r1)		\n" \ | |
| 108 | 	"	std	%r6,72(%r1)		\n" \ | |
| 109 | 	"	std	%r7,80(%r1)		\n" \ | |
| 110 | 	"	std	%r8,88(%r1)		\n" \ | |
| 111 | 	"	std	%r9,96(%r1)		\n" \ | |
| 112 | 	"	std	%r10,104(%r1)		\n" \ | |
| 113 | 	"	mflr	%r4			\n" \ | |
| 114 | 	"	std	%r4,112(%r1)		\n" \ | |
| 115 | 	"	ld	%r3,0(%r1)		\n" \ | |
| 116 | 	"	ld	%r3,0(%r3)		\n" \ | |
| 117 | 	"	ld	%r3,16(%r3)		\n" \ | |
| 118 | 	"	bl	__mcount		\n" \ | |
| 119 | 	"	nop				\n" \ | |
| 120 | 	"	ld	%r4,112(%r1)		\n" \ | |
| 121 | 	"	mtlr	%r4			\n" \ | |
| 122 | 	"	ld	%r3,48(%r1)		\n" \ | |
| 123 | 	"	ld	%r4,56(%r1)		\n" \ | |
| 124 | 	"	ld	%r5,64(%r1)		\n" \ | |
| 125 | 	"	ld	%r6,72(%r1)		\n" \ | |
| 126 | 	"	ld	%r7,80(%r1)		\n" \ | |
| 127 | 	"	ld	%r8,88(%r1)		\n" \ | |
| 128 | 	"	ld	%r9,96(%r1)		\n" \ | |
| 129 | 	"	ld	%r10,104(%r1)		\n" \ | |
| 130 | 	"	addi	%r1,%r1,(288+128)	\n" \ | |
| 131 | 	"	blr				\n"); | |
| 132 | #else | |
| 133 | ||
| 134 | #ifdef PIC | |
| 135 | #define _PLT "@plt" | |
| 136 | #else | |
| 137 | #define _PLT | |
| 138 | #endif | |
| 139 | ||
| 140 | #define	MCOUNT					\ | |
| 141 | __asm(	"	.globl	_mcount			\n" \ | |
| 142 | 	"	.type	_mcount,@function	\n" \ | |
| 143 | 	"	.align	4			\n" \ | |
| 144 | 	"_mcount:				\n" \ | |
| 145 | 	"	stwu	%r1,-64(%r1)		\n" \ | |
| 146 | 	"	stw	%r3,16(%r1)		\n" \ | |
| 147 | 	"	stw	%r4,20(%r1)		\n" \ | |
| 148 | 	"	stw	%r5,24(%r1)		\n" \ | |
| 149 | 	"	stw	%r6,28(%r1)		\n" \ | |
| 150 | 	"	stw	%r7,32(%r1)		\n" \ | |
| 151 | 	"	stw	%r8,36(%r1)		\n" \ | |
| 152 | 	"	stw	%r9,40(%r1)		\n" \ | |
| 153 | 	"	stw	%r10,44(%r1)		\n" \ | |
| 154 | 	"	mflr	%r4			\n" \ | |
| 155 | 	"	stw	%r4,48(%r1)		\n" \ | |
| 156 | 	"	lwz	%r3,68(%r1)		\n" \ | |
| 157 | 	"	bl	__mcount" _PLT "	\n" \ | |
| 158 | 	"	lwz	%r3,68(%r1)		\n" \ | |
| 159 | 	"	mtlr	%r3			\n" \ | |
| 160 | 	"	lwz	%r4,48(%r1)		\n" \ | |
| 161 | 	"	mtctr	%r4			\n" \ | |
| 162 | 	"	lwz	%r3,16(%r1)		\n" \ | |
| 163 | 	"	lwz	%r4,20(%r1)		\n" \ | |
| 164 | 	"	lwz	%r5,24(%r1)		\n" \ | |
| 165 | 	"	lwz	%r6,28(%r1)		\n" \ | |
| 166 | 	"	lwz	%r7,32(%r1)		\n" \ | |
| 167 | 	"	lwz	%r8,36(%r1)		\n" \ | |
| 168 | 	"	lwz	%r9,40(%r1)		\n" \ | |
| 169 | 	"	lwz	%r10,44(%r1)		\n" \ | |
| 170 | 	"	addi	%r1,%r1,64		\n" \ | |
| 171 | 	"	bctr				\n" \ | |
| 172 | 	"_mcount_end:				\n" \ | |
| 173 | 	"	.size	_mcount,_mcount_end-_mcount"); | |
| 174 | #endif | |
| 175 | ||
| 176 | #ifdef _KERNEL | |
| 177 | #define	MCOUNT_ENTER(s)		s = intr_disable() | |
| 178 | #define	MCOUNT_EXIT(s)		intr_restore(s) | |
| 179 | #define	MCOUNT_DECL(s)		register_t s; | |
| 180 | ||
| 181 | #ifndef COMPILING_LINT | |
| 182 | #ifdef AIM | |
| 183 | #include <machine/trap.h> | |
| 184 | #define	__PROFILE_VECTOR_BASE	EXC_RST | |
| 185 | #define	__PROFILE_VECTOR_TOP	(EXC_LAST + 0x100) | |
| 186 | #endif	/* AIM */ | |
| 187 | #if defined(BOOKE) | |
| 188 | extern char interrupt_vector_base[]; | |
| 189 | extern char interrupt_vector_top[]; | |
| 190 | #define	__PROFILE_VECTOR_BASE	(uintfptr_t)interrupt_vector_base | |
| 191 | #define	__PROFILE_VECTOR_TOP	(uintfptr_t)interrupt_vector_top | |
| 192 | #endif	/* BOOKE_E500 */ | |
| 193 | ||
| 194 | #endif	/* !COMPILING_LINT */ | |
| 195 | ||
| 196 | #ifndef __PROFILE_VECTOR_BASE | |
| 197 | #define	__PROFILE_VECTOR_BASE	0 | |
| 198 | #endif | |
| 199 | #ifndef __PROFILE_VECTOR_TOP | |
| 200 | #define	__PROFILE_VECTOR_TOP	1 | |
| 201 | #endif | |
| 202 | ||
| 203 | static __inline void | |
| 204 | powerpc_profile_interrupt(void) | |
| 205 | { | |
| 206 | } | |
| 207 | ||
| 208 | static __inline void | |
| 209 | powerpc_profile_userspace(void) | |
| 210 | { | |
| 211 | } | |
| 212 | ||
| 213 | #define	MCOUNT_FROMPC_USER(pc)				\ | |
| 214 | 	((pc < (uintfptr_t)VM_MAXUSER_ADDRESS) ?	\ | |
| 215 | 	 (uintfptr_t)powerpc_profile_userspace : pc) | |
| 216 | ||
| 217 | #define	MCOUNT_FROMPC_INTR(pc)				\ | |
| 218 | 	((pc >= __PROFILE_VECTOR_BASE &&		\ | |
| 219 | 	 pc < __PROFILE_VECTOR_TOP) ?			\ | |
| 220 | 	 (uintfptr_t)powerpc_profile_interrupt : ~0U) | |
| 221 | ||
| 222 | void __mcount(uintfptr_t frompc, uintfptr_t selfpc); | |
| 223 | ||
| 224 | #else	/* !_KERNEL */ | |
| 225 | ||
| 226 | #ifdef __powerpc64__ | |
| 227 | typedef u_long	uintfptr_t; | |
| 228 | #else | |
| 229 | typedef u_int	uintfptr_t; | |
| 230 | #endif | |
| 231 | ||
| 232 | #endif	/* _KERNEL */ | |
| 233 | ||
| 234 | #endif /* !_MACHINE_PROFILE_H_ */ | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/machine/psl.h+2-98| ... | ... | @@ -1,101 +1,5 @@ |
| 1 | 1 | /*- |
| 2 | * SPDX-License-Identifier: BSD-4-Clause | |
| 3 | * | |
| 4 | * Copyright (C) 1995, 1996 Wolfgang Solfrank. | |
| 5 | * Copyright (C) 1995, 1996 TooLs GmbH. | |
| 6 | * All rights reserved. | |
| 7 | * | |
| 8 | * Redistribution and use in source and binary forms, with or without | |
| 9 | * modification, are permitted provided that the following conditions | |
| 10 | * are met: | |
| 11 | * 1. Redistributions of source code must retain the above copyright | |
| 12 | * notice, this list of conditions and the following disclaimer. | |
| 13 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 14 | * notice, this list of conditions and the following disclaimer in the | |
| 15 | * documentation and/or other materials provided with the distribution. | |
| 16 | * 3. All advertising materials mentioning features or use of this software | |
| 17 | * must display the following acknowledgement: | |
| 18 | *	This product includes software developed by TooLs GmbH. | |
| 19 | * 4. The name of TooLs GmbH may not be used to endorse or promote products | |
| 20 | * derived from this software without specific prior written permission. | |
| 21 | * | |
| 22 | * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR | |
| 23 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |
| 24 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | |
| 25 | * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
| 26 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | |
| 27 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; | |
| 28 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | |
| 29 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | |
| 30 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | |
| 31 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 32 | * | |
| 33 | *	$NetBSD: psl.h,v 1.5 2000/11/19 19:52:37 matt Exp $ | |
| 2 | * This file is in the public domain. | |
| 34 | 3 | */ |
| 35 | 4 | |
| 36 | #ifndef	_MACHINE_PSL_H_ | |
| 37 | #define	_MACHINE_PSL_H_ | |
| 38 | ||
| 39 | /* | |
| 40 | * Machine State Register (MSR) - All cores | |
| 41 | */ | |
| 42 | #define	PSL_VEC		0x02000000UL	/* AltiVec/SPE vector unit available */ | |
| 43 | #define	PSL_VSX		0x00800000UL	/* Vector-Scalar unit available */ | |
| 44 | #define	PSL_EE		0x00008000UL	/* external interrupt enable */ | |
| 45 | #define	PSL_PR		0x00004000UL	/* privilege mode (1 == user) */ | |
| 46 | #define	PSL_FP		0x00002000UL	/* floating point enable */ | |
| 47 | #define	PSL_ME		0x00001000UL	/* machine check enable */ | |
| 48 | #define	PSL_FE0		0x00000800UL	/* floating point interrupt mode 0 */ | |
| 49 | #define	PSL_FE1		0x00000100UL	/* floating point interrupt mode 1 */ | |
| 50 | #define	PSL_PMM		0x00000004UL	/* performance monitor mark */ | |
| 51 | #define	PSL_RI		0x00000002UL	/* recoverable interrupt */ | |
| 52 | ||
| 53 | /* Machine State Register - Book-E cores */ | |
| 54 | #ifdef __powerpc64__ | |
| 55 | #define	PSL_CM		0x80000000UL	/* Computation Mode (64-bit) */ | |
| 56 | #endif | |
| 57 | ||
| 58 | #define PSL_GS		0x10000000UL	/* Guest state */ | |
| 59 | #define PSL_UCLE	0x04000000UL	/* User mode cache lock enable */ | |
| 60 | #define PSL_WE		0x00040000UL	/* Wait state enable */ | |
| 61 | #define PSL_CE		0x00020000UL	/* Critical interrupt enable */ | |
| 62 | #define PSL_UBLE	0x00000400UL	/* BTB lock enable - e500 only */ | |
| 63 | #define PSL_DWE		0x00000400UL	/* Debug Wait Enable - 440 only*/ | |
| 64 | #define PSL_DE		0x00000200UL	/* Debug interrupt enable */ | |
| 65 | #define PSL_IS		0x00000020UL	/* Instruction address space */ | |
| 66 | #define PSL_DS		0x00000010UL	/* Data address space */ | |
| 67 | ||
| 68 | /* Machine State Register (MSR) - AIM cores */ | |
| 69 | #ifdef __powerpc64__ | |
| 70 | #define PSL_SF		0x8000000000000000UL	/* 64-bit addressing */ | |
| 71 | #define PSL_HV		0x1000000000000000UL	/* hyper-privileged mode */ | |
| 72 | #endif | |
| 73 | ||
| 74 | #define	PSL_POW		0x00040000UL	/* power management */ | |
| 75 | #define	PSL_ILE		0x00010000UL	/* interrupt endian mode (1 == le) */ | |
| 76 | #define	PSL_SE		0x00000400UL	/* single-step trace enable */ | |
| 77 | #define	PSL_BE		0x00000200UL	/* branch trace enable */ | |
| 78 | #define	PSL_IP		0x00000040UL	/* interrupt prefix - 601 only */ | |
| 79 | #define	PSL_IR		0x00000020UL	/* instruction address relocation */ | |
| 80 | #define	PSL_DR		0x00000010UL	/* data address relocation */ | |
| 81 | #define	PSL_LE		0x00000001UL	/* endian mode (1 == le) */ | |
| 82 | ||
| 83 | /* | |
| 84 | * Floating-point exception modes: | |
| 85 | */ | |
| 86 | #define	PSL_FE_DIS	0		/* none */ | |
| 87 | #define	PSL_FE_NONREC	PSL_FE1		/* imprecise non-recoverable */ | |
| 88 | #define	PSL_FE_REC	PSL_FE0		/* imprecise recoverable */ | |
| 89 | #define	PSL_FE_PREC	(PSL_FE0 | PSL_FE1) /* precise */ | |
| 90 | #define	PSL_FE_DFLT	PSL_FE_PREC	/* default == precise */ | |
| 91 | ||
| 92 | #ifndef LOCORE | |
| 93 | extern register_t psl_kernset;		/* Default MSR values for kernel */ | |
| 94 | extern register_t psl_userset;		/* Default MSR values for userland */ | |
| 95 | #ifdef __powerpc64__ | |
| 96 | extern register_t psl_userset32;	/* Default user MSR values for 32-bit */ | |
| 97 | #endif | |
| 98 | extern register_t psl_userstatic;	/* Bits of SRR1 userland may not set */ | |
| 99 | #endif | |
| 100 | ||
| 101 | #endif	/* _MACHINE_PSL_H_ */ | |
| \ No newline at end of file | ||
| 5 | #include <x86/psl.h> | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/machine/pte.h deleted-432| ... | ... | @@ -1,432 +0,0 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-4-Clause | |
| 3 | * | |
| 4 | * Copyright (C) 1995, 1996 Wolfgang Solfrank. | |
| 5 | * Copyright (C) 1995, 1996 TooLs GmbH. | |
| 6 | * All rights reserved. | |
| 7 | * | |
| 8 | * Redistribution and use in source and binary forms, with or without | |
| 9 | * modification, are permitted provided that the following conditions | |
| 10 | * are met: | |
| 11 | * 1. Redistributions of source code must retain the above copyright | |
| 12 | * notice, this list of conditions and the following disclaimer. | |
| 13 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 14 | * notice, this list of conditions and the following disclaimer in the | |
| 15 | * documentation and/or other materials provided with the distribution. | |
| 16 | * 3. All advertising materials mentioning features or use of this software | |
| 17 | * must display the following acknowledgement: | |
| 18 | *	This product includes software developed by TooLs GmbH. | |
| 19 | * 4. The name of TooLs GmbH may not be used to endorse or promote products | |
| 20 | * derived from this software without specific prior written permission. | |
| 21 | * | |
| 22 | * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR | |
| 23 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |
| 24 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | |
| 25 | * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
| 26 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | |
| 27 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; | |
| 28 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | |
| 29 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | |
| 30 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | |
| 31 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 32 | * | |
| 33 | *	$NetBSD: pte.h,v 1.2 1998/08/31 14:43:40 tsubai Exp $ | |
| 34 | */ | |
| 35 | ||
| 36 | #ifndef	_MACHINE_PTE_H_ | |
| 37 | #define	_MACHINE_PTE_H_ | |
| 38 | ||
| 39 | #if defined(AIM) | |
| 40 | ||
| 41 | /* | |
| 42 | * Page Table Entries | |
| 43 | */ | |
| 44 | #ifndef	LOCORE | |
| 45 | ||
| 46 | /* 32-bit PTE */ | |
| 47 | struct pte { | |
| 48 | 	u_int32_t pte_hi; | |
| 49 | 	u_int32_t pte_lo; | |
| 50 | }; | |
| 51 | ||
| 52 | struct pteg { | |
| 53 | 	struct	pte pt[8]; | |
| 54 | }; | |
| 55 | ||
| 56 | /* 64-bit (long) PTE */ | |
| 57 | struct lpte { | |
| 58 | 	u_int64_t pte_hi; | |
| 59 | 	u_int64_t pte_lo; | |
| 60 | }; | |
| 61 | ||
| 62 | struct lpteg { | |
| 63 | 	struct lpte pt[8]; | |
| 64 | }; | |
| 65 | ||
| 66 | /* Partition table entry */ | |
| 67 | struct pate { | |
| 68 | 	u_int64_t pagetab; | |
| 69 | 	u_int64_t proctab; | |
| 70 | }; | |
| 71 | ||
| 72 | /* Process table entry */ | |
| 73 | struct prte { | |
| 74 | 	u_int64_t proctab0; | |
| 75 | 	u_int64_t proctab1; | |
| 76 | }; | |
| 77 | ||
| 78 | typedef	struct pte pte_t; | |
| 79 | typedef	struct lpte lpte_t; | |
| 80 | #endif	/* LOCORE */ | |
| 81 | ||
| 82 | /* 32-bit PTE definitions */ | |
| 83 | ||
| 84 | /* High word: */ | |
| 85 | #define	PTE_VALID	0x80000000 | |
| 86 | #define	PTE_VSID_SHFT	7 | |
| 87 | #define	PTE_HID		0x00000040 | |
| 88 | #define	PTE_API		0x0000003f | |
| 89 | /* Low word: */ | |
| 90 | #define	PTE_RPGN	0xfffff000 | |
| 91 | #define	PTE_REF		0x00000100 | |
| 92 | #define	PTE_CHG		0x00000080 | |
| 93 | #define	PTE_WIMG	0x00000078 | |
| 94 | #define	PTE_W		0x00000040 | |
| 95 | #define	PTE_I		0x00000020 | |
| 96 | #define	PTE_M		0x00000010 | |
| 97 | #define	PTE_G		0x00000008 | |
| 98 | #define	PTE_PP		0x00000003 | |
| 99 | #define	PTE_SO		0x00000000	/* Super. Only (U: XX, S: RW) */ | |
| 100 | #define PTE_SW		0x00000001	/* Super. Write-Only (U: RO, S: RW) */ | |
| 101 | #define	PTE_BW		0x00000002	/* Supervisor (U: RW, S: RW) */ | |
| 102 | #define	PTE_BR		0x00000003	/* Both Read Only (U: RO, S: RO) */ | |
| 103 | #define	PTE_RW		PTE_BW | |
| 104 | #define	PTE_RO		PTE_BR | |
| 105 | ||
| 106 | #define	PTE_EXEC	0x00000200	/* pseudo bit in attrs; page is exec */ | |
| 107 | ||
| 108 | /* 64-bit PTE definitions */ | |
| 109 | ||
| 110 | /* High quadword: */ | |
| 111 | #define LPTE_VSID_SHIFT		12 | |
| 112 | #define LPTE_AVPN_MASK		0xFFFFFFFFFFFFFF80ULL | |
| 113 | #define LPTE_AVA_MASK		0x3FFFFFFFFFFFFF80ULL | |
| 114 | #define LPTE_API		0x0000000000000F80ULL | |
| 115 | #define LPTE_SWBITS		0x0000000000000078ULL | |
| 116 | #define LPTE_WIRED		0x0000000000000010ULL | |
| 117 | #define LPTE_LOCKED		0x0000000000000008ULL | |
| 118 | #define LPTE_BIG		0x0000000000000004ULL	/* 4kb/16Mb page */ | |
| 119 | #define LPTE_HID		0x0000000000000002ULL | |
| 120 | #define LPTE_VALID		0x0000000000000001ULL | |
| 121 | ||
| 122 | /* Low quadword: */ | |
| 123 | #define	LP_4K_16M	0x38	/* 4KB base, 16MB actual page size */ | |
| 124 | ||
| 125 | #define EXTEND_PTE(x)	UINT64_C(x)	/* make constants 64-bit */ | |
| 126 | #define	LPTE_RPGN	0xfffffffffffff000ULL | |
| 127 | #define	LPTE_LP_MASK	0x00000000000ff000ULL | |
| 128 | #define	LPTE_LP_SHIFT	12 | |
| 129 | #define	LPTE_LP_4K_16M	((unsigned long long)(LP_4K_16M) << LPTE_LP_SHIFT) | |
| 130 | #define	LPTE_REF	EXTEND_PTE( PTE_REF ) | |
| 131 | #define	LPTE_CHG	EXTEND_PTE( PTE_CHG ) | |
| 132 | #define	LPTE_WIMG	EXTEND_PTE( PTE_WIMG ) | |
| 133 | #define	LPTE_W		EXTEND_PTE( PTE_W ) | |
| 134 | #define	LPTE_I		EXTEND_PTE( PTE_I ) | |
| 135 | #define	LPTE_M		EXTEND_PTE( PTE_M ) | |
| 136 | #define	LPTE_G		EXTEND_PTE( PTE_G ) | |
| 137 | #define	LPTE_NOEXEC	0x0000000000000004ULL | |
| 138 | #define	LPTE_PP		EXTEND_PTE( PTE_PP ) | |
| 139 | ||
| 140 | #define	LPTE_SO		EXTEND_PTE( PTE_SO )	/* Super. Only */ | |
| 141 | #define	LPTE_SW		EXTEND_PTE( PTE_SW )	/* Super. Write-Only */ | |
| 142 | #define	LPTE_BW		EXTEND_PTE( PTE_BW )	/* Supervisor */ | |
| 143 | #define	LPTE_BR		EXTEND_PTE( PTE_BR )	/* Both Read Only */ | |
| 144 | #define	LPTE_RW		LPTE_BW | |
| 145 | #define	LPTE_RO		LPTE_BR | |
| 146 | ||
| 147 | /* HPT superpage definitions */ | |
| 148 | #define	HPT_SP_SHIFT		(VM_LEVEL_0_ORDER + PAGE_SHIFT) | |
| 149 | #define	HPT_SP_SIZE		(1 << HPT_SP_SHIFT) | |
| 150 | #define	HPT_SP_MASK		(HPT_SP_SIZE - 1) | |
| 151 | #define	HPT_SP_PAGES		(1 << VM_LEVEL_0_ORDER) | |
| 152 | ||
| 153 | /* POWER ISA 3.0 Radix Table Definitions */ | |
| 154 | #define	RPTE_VALID		0x8000000000000000ULL | |
| 155 | #define	RPTE_LEAF		0x4000000000000000ULL /* is a PTE: always 1 */ | |
| 156 | #define	RPTE_SW0		0x2000000000000000ULL | |
| 157 | #define	RPTE_RPN_MASK		0x00FFFFFFFFFFF000ULL | |
| 158 | #define	RPTE_RPN_SHIFT		12 | |
| 159 | #define	RPTE_SW1		0x0000000000000800ULL | |
| 160 | #define	RPTE_SW2		0x0000000000000400ULL | |
| 161 | #define	RPTE_SW3		0x0000000000000200ULL | |
| 162 | #define	RPTE_R			0x0000000000000100ULL | |
| 163 | #define	RPTE_C			0x0000000000000080ULL | |
| 164 | ||
| 165 | #define	RPTE_MANAGED		RPTE_SW1 | |
| 166 | #define	RPTE_WIRED		RPTE_SW2 | |
| 167 | #define	RPTE_PROMOTED		RPTE_SW3 | |
| 168 | ||
| 169 | #define	RPTE_ATTR_MASK		0x0000000000000030ULL | |
| 170 | #define	RPTE_ATTR_MEM		0x0000000000000000ULL /* PTE M */ | |
| 171 | #define	RPTE_ATTR_SAO		0x0000000000000010ULL /* PTE WIM */ | |
| 172 | #define	RPTE_ATTR_GUARDEDIO	0x0000000000000020ULL /* PTE IMG */ | |
| 173 | #define	RPTE_ATTR_UNGUARDEDIO	0x0000000000000030ULL /* PTE IM */ | |
| 174 | ||
| 175 | #define	RPTE_EAA_MASK		0x000000000000000FULL | |
| 176 | #define	RPTE_EAA_P		0x0000000000000008ULL /* Supervisor only */ | |
| 177 | #define	RPTE_EAA_R		0x0000000000000004ULL /* Read allowed */ | |
| 178 | #define	RPTE_EAA_W		0x0000000000000002ULL /* Write (+read) */ | |
| 179 | #define	RPTE_EAA_X		0x0000000000000001ULL /* Execute allowed */ | |
| 180 | ||
| 181 | #define	RPDE_VALID		RPTE_VALID | |
| 182 | #define	RPDE_LEAF		RPTE_LEAF /* is a PTE: always 0 */ | |
| 183 | #define	RPDE_NLB_MASK		0x00FFFFFFFFFFFF00ULL | |
| 184 | #define	RPDE_NLB_SHIFT		8 | |
| 185 | #define	RPDE_NLS_MASK		0x000000000000001FULL | |
| 186 | ||
| 187 | #define	PG_FRAME		(0x000ffffffffff000ul) | |
| 188 | #define	PG_PS_FRAME		(0x000fffffffe00000ul) | |
| 189 | /* | |
| 190 | * Extract bits from address | |
| 191 | */ | |
| 192 | #define	ADDR_SR_SHFT	28 | |
| 193 | #define	ADDR_PIDX	0x0ffff000UL | |
| 194 | #define	ADDR_PIDX_SHFT	12 | |
| 195 | #define	ADDR_API_SHFT	22 | |
| 196 | #define	ADDR_API_SHFT64	16 | |
| 197 | #define	ADDR_POFF	0x00000fffUL | |
| 198 | ||
| 199 | /* | |
| 200 | * Bits in DSISR: | |
| 201 | */ | |
| 202 | #define	DSISR_DIRECT	0x80000000 | |
| 203 | #define	DSISR_NOTFOUND	0x40000000 | |
| 204 | #define	DSISR_PROTECT	0x08000000 | |
| 205 | #define	DSISR_INVRX	0x04000000 | |
| 206 | #define	DSISR_STORE	0x02000000 | |
| 207 | #define	DSISR_DABR	0x00400000 | |
| 208 | #define	DSISR_SEGMENT	0x00200000 | |
| 209 | #define	DSISR_EAR	0x00100000 | |
| 210 | ||
| 211 | /* | |
| 212 | * Bits in SRR1 on ISI: | |
| 213 | */ | |
| 214 | #define	ISSRR1_NOTFOUND	0x40000000 | |
| 215 | #define	ISSRR1_DIRECT	0x10000000 | |
| 216 | #define	ISSRR1_PROTECT	0x08000000 | |
| 217 | #define	ISSRR1_SEGMENT	0x00200000 | |
| 218 | ||
| 219 | #else /* BOOKE */ | |
| 220 | ||
| 221 | #include <machine/tlb.h> | |
| 222 | ||
| 223 | /* | |
| 224 | * Flags for pte_remove() routine. | |
| 225 | */ | |
| 226 | #define PTBL_HOLD	0x00000001	/* do not unhold ptbl pages */ | |
| 227 | #define PTBL_UNHOLD	0x00000002	/* unhold and attempt to free ptbl pages */ | |
| 228 | ||
| 229 | #define PTBL_HOLD_FLAG(pmap)	(((pmap) == kernel_pmap) ? PTBL_HOLD : PTBL_UNHOLD) | |
| 230 | ||
| 231 | /* | |
| 232 | * Page Table Entry definitions and macros. | |
| 233 | * | |
| 234 | * RPN need only be 32-bit because Book-E has 36-bit addresses, and the smallest | |
| 235 | * page size is 4k (12-bit mask), so RPN can really fit into 24 bits. | |
| 236 | */ | |
| 237 | #ifndef	LOCORE | |
| 238 | typedef uint64_t pte_t; | |
| 239 | #endif | |
| 240 | ||
| 241 | /* RPN mask, TLB0 4K pages */ | |
| 242 | #define PTE_PA_MASK	PAGE_MASK | |
| 243 | ||
| 244 | #if defined(BOOKE_E500) | |
| 245 | ||
| 246 | /* PTE bits assigned to MAS2, MAS3 flags */ | |
| 247 | #define	PTE_MAS2_SHIFT	19 | |
| 248 | #define PTE_W		(MAS2_W << PTE_MAS2_SHIFT) | |
| 249 | #define PTE_I		(MAS2_I << PTE_MAS2_SHIFT) | |
| 250 | #define PTE_M		(MAS2_M << PTE_MAS2_SHIFT) | |
| 251 | #define PTE_G		(MAS2_G << PTE_MAS2_SHIFT) | |
| 252 | #define PTE_MAS2_MASK	(MAS2_G | MAS2_M | MAS2_I | MAS2_W) | |
| 253 | ||
| 254 | #define PTE_MAS3_SHIFT	2 | |
| 255 | #define PTE_UX		(MAS3_UX << PTE_MAS3_SHIFT) | |
| 256 | #define PTE_SX		(MAS3_SX << PTE_MAS3_SHIFT) | |
| 257 | #define PTE_UW		(MAS3_UW << PTE_MAS3_SHIFT) | |
| 258 | #define PTE_SW		(MAS3_SW << PTE_MAS3_SHIFT) | |
| 259 | #define PTE_UR		(MAS3_UR << PTE_MAS3_SHIFT) | |
| 260 | #define PTE_SR		(MAS3_SR << PTE_MAS3_SHIFT) | |
| 261 | #define PTE_MAS3_MASK	((MAS3_UX | MAS3_SX | MAS3_UW	\ | |
| 262 | 			| MAS3_SW | MAS3_UR | MAS3_SR) << PTE_MAS3_SHIFT) | |
| 263 | ||
| 264 | #define	PTE_PS_SHIFT	8 | |
| 265 | #define	PTE_PS_4KB	(2 << PTE_PS_SHIFT) | |
| 266 | ||
| 267 | #endif | |
| 268 | ||
| 269 | /* Other PTE flags */ | |
| 270 | #define PTE_VALID	0x00000001	/* Valid */ | |
| 271 | #define PTE_MODIFIED	0x00001000	/* Modified */ | |
| 272 | #define PTE_WIRED	0x00002000	/* Wired */ | |
| 273 | #define PTE_MANAGED	0x00000002	/* Managed */ | |
| 274 | #define PTE_REFERENCED	0x00040000	/* Referenced */ | |
| 275 | ||
| 276 | /* | |
| 277 | * Page Table Entry definitions and macros. | |
| 278 | * | |
| 279 | * We use the hardware page table entry format: | |
| 280 | * | |
| 281 | * 63 24 23 19 18 17 14 13 12 11 8 7 6 5 4 3 2 1 0 | |
| 282 | * --------------------------------------------------------------- | |
| 283 | * ARPN(12:51) WIMGE R U0:U3 SW0 C PSIZE UX SX UW SW UR SR SW1 V | |
| 284 | * --------------------------------------------------------------- | |
| 285 | */ | |
| 286 | ||
| 287 | /* PTE fields. */ | |
| 288 | #define PTE_TSIZE_SHIFT		(63-54) | |
| 289 | #define PTE_TSIZE_MASK		0x7 | |
| 290 | #define PTE_TSIZE_SHIFT_DIRECT	(63-55) | |
| 291 | #define PTE_TSIZE_MASK_DIRECT	0xf | |
| 292 | #define PTE_PS_DIRECT(ps)	(ps<<PTE_TSIZE_SHIFT_DIRECT)	/* Direct Entry Page Size */ | |
| 293 | #define PTE_PS(ps)		(ps<<PTE_TSIZE_SHIFT)	/* Page Size */ | |
| 294 | ||
| 295 | /* Macro argument must of pte_t type. */ | |
| 296 | #define PTE_TSIZE(pte)		(int)((*pte >> PTE_TSIZE_SHIFT) & PTE_TSIZE_MASK) | |
| 297 | #define PTE_TSIZE_DIRECT(pte)	(int)((*pte >> PTE_TSIZE_SHIFT_DIRECT) & PTE_TSIZE_MASK_DIRECT) | |
| 298 | ||
| 299 | /* Macro argument must of pte_t type. */ | |
| 300 | #define	PTE_ARPN_SHIFT		12 | |
| 301 | #define	PTE_FLAGS_MASK		0x00ffffff | |
| 302 | #define PTE_RPN_FROM_PA(pa)	(((pa) & ~PAGE_MASK) << PTE_ARPN_SHIFT) | |
| 303 | #define PTE_PA(pte)		((vm_paddr_t)(*pte >> PTE_ARPN_SHIFT) & ~PAGE_MASK) | |
| 304 | #define PTE_ISVALID(pte)	((*pte) & PTE_VALID) | |
| 305 | #define PTE_ISWIRED(pte)	((*pte) & PTE_WIRED) | |
| 306 | #define PTE_ISMANAGED(pte)	((*pte) & PTE_MANAGED) | |
| 307 | #define PTE_ISMODIFIED(pte)	((*pte) & PTE_MODIFIED) | |
| 308 | #define PTE_ISREFERENCED(pte)	((*pte) & PTE_REFERENCED) | |
| 309 | ||
| 310 | #endif /* BOOKE */ | |
| 311 | ||
| 312 | /* Book-E page table format, broken out for the generic pmap.h. */ | |
| 313 | #ifdef __powerpc64__ | |
| 314 | ||
| 315 | #include <machine/tlb.h> | |
| 316 | ||
| 317 | /* | |
| 318 | * The virtual address is: | |
| 319 | * | |
| 320 | * 4K page size | |
| 321 | * +-----+-----------+-------+-------------+-------------+----------------+ | |
| 322 | * | - | pg_root |pdir_l1| dir# | pte# | off in 4K page | | |
| 323 | * +-----+-----------+-------+-------------+-------------+----------------+ | |
| 324 | * 63 52 51 39 38 30 29 ^ 21 20 ^ 12 11 0 | |
| 325 | * | | | |
| 326 | * index in 1 page of pointers | |
| 327 | * | |
| 328 | * 1st level - Root page table | |
| 329 | * | |
| 330 | * pp2d consists of PG_ROOT_NENTRIES entries, each being a pointer to | |
| 331 | * second level entity, i.e. the page table directory (pdir). | |
| 332 | */ | |
| 333 | #define PG_ROOT_H		51 | |
| 334 | #define PG_ROOT_L		39 | |
| 335 | #define PG_ROOT_SIZE		(1UL << PG_ROOT_L)	/* va range mapped by pp2d */ | |
| 336 | #define PG_ROOT_SHIFT		PG_ROOT_L | |
| 337 | #define PG_ROOT_NUM		(PG_ROOT_H - PG_ROOT_L + 1) | |
| 338 | #define PG_ROOT_MASK		((1 << PG_ROOT_NUM) - 1) | |
| 339 | #define PG_ROOT_IDX(va)		((va >> PG_ROOT_SHIFT) & PG_ROOT_MASK) | |
| 340 | #define PG_ROOT_NENTRIES	(1 << PG_ROOT_NUM) | |
| 341 | #define PG_ROOT_ENTRY_SHIFT	3	/* log2 (sizeof(struct pte_entry **)) */ | |
| 342 | ||
| 343 | /* | |
| 344 | * 2nd level - page directory directory (pdir l1) | |
| 345 | * | |
| 346 | * pdir consists of PDIR_NENTRIES entries, each being a pointer to | |
| 347 | * second level entity, i.e. the actual page table (ptbl). | |
| 348 | */ | |
| 349 | #define PDIR_L1_H		(PG_ROOT_L-1) | |
| 350 | #define PDIR_L1_L		30 | |
| 351 | #define PDIR_L1_NUM		(PDIR_L1_H-PDIR_L1_L+1) | |
| 352 | #define PDIR_L1_SIZE		(1 << PDIR_L1_L)	/* va range mapped by pdir */ | |
| 353 | #define PDIR_L1_MASK		((1<<PDIR_L1_NUM)-1) | |
| 354 | #define PDIR_L1_SHIFT		PDIR_L1_L | |
| 355 | #define PDIR_L1_NENTRIES	(1<<PDIR_L1_NUM) | |
| 356 | #define PDIR_L1_IDX(va)		(((va) >> PDIR_L1_SHIFT) & PDIR_L1_MASK) | |
| 357 | #define PDIR_L1_ENTRY_SHIFT	3	/* log2 (sizeof(struct pte_entry *)) */ | |
| 358 | #define PDIR_L1_PAGES		((PDIR_L1_NENTRIES * (1<<PDIR_L1_ENTRY_SHIFT)) / PAGE_SIZE) | |
| 359 | ||
| 360 | /* | |
| 361 | * 3rd level - page table directory (pdir) | |
| 362 | * | |
| 363 | * pdir consists of PDIR_NENTRIES entries, each being a pointer to | |
| 364 | * second level entity, i.e. the actual page table (ptbl). | |
| 365 | */ | |
| 366 | #define PDIR_H			(PDIR_L1_L-1) | |
| 367 | #define PDIR_L			21 | |
| 368 | #define PDIR_NUM		(PDIR_H-PDIR_L+1) | |
| 369 | #define PDIR_SIZE		(1 << PDIR_L)	/* va range mapped by pdir */ | |
| 370 | #define PDIR_MASK		((1<<PDIR_NUM)-1) | |
| 371 | #define PDIR_SHIFT		PDIR_L | |
| 372 | #define PDIR_NENTRIES		(1<<PDIR_NUM) | |
| 373 | #define PDIR_IDX(va)		(((va) >> PDIR_SHIFT) & PDIR_MASK) | |
| 374 | #define PDIR_ENTRY_SHIFT	3	/* log2 (sizeof(struct pte_entry *)) */ | |
| 375 | #define PDIR_PAGES		((PDIR_NENTRIES * (1<<PDIR_ENTRY_SHIFT)) / PAGE_SIZE) | |
| 376 | ||
| 377 | /* | |
| 378 | * 4th level - page table (ptbl) | |
| 379 | * | |
| 380 | * Page table covers PTBL_NENTRIES page table entries. Page | |
| 381 | * table entry (pte) is 64 bit wide and defines mapping | |
| 382 | * for a single page. | |
| 383 | */ | |
| 384 | #define PTBL_H			(PDIR_L-1) | |
| 385 | #define PTBL_L			PAGE_SHIFT | |
| 386 | #define PTBL_NUM		(PTBL_H-PTBL_L+1) | |
| 387 | #define PTBL_MASK		((1<<PTBL_NUM)-1) | |
| 388 | #define PTBL_SHIFT		PTBL_L | |
| 389 | #define PTBL_SIZE		PAGE_SIZE	/* va range mapped by ptbl entry */ | |
| 390 | #define PTBL_NENTRIES		(1<<PTBL_NUM) | |
| 391 | #define PTBL_IDX(va)		((va >> PTBL_SHIFT) & PTBL_MASK) | |
| 392 | #define PTBL_ENTRY_SHIFT	 3	/* log2 (sizeof (struct pte_entry)) */ | |
| 393 | #define PTBL_PAGES		((PTBL_NENTRIES * (1<<PTBL_ENTRY_SHIFT)) / PAGE_SIZE) | |
| 394 | ||
| 395 | #else | |
| 396 | /* | |
| 397 | * 1st level - page table directory (pdir) | |
| 398 | * | |
| 399 | * pdir consists of 1024 entries, each being a pointer to | |
| 400 | * second level entity, i.e. the actual page table (ptbl). | |
| 401 | */ | |
| 402 | #define PDIR_SHIFT	22 | |
| 403 | #define PDIR_SIZE	(1 << PDIR_SHIFT)	/* va range mapped by pdir */ | |
| 404 | #define PDIR_MASK	(~(PDIR_SIZE - 1)) | |
| 405 | #define PDIR_NENTRIES	1024			/* number of page tables in pdir */ | |
| 406 | ||
| 407 | /* Returns pdir entry number for given va */ | |
| 408 | #define PDIR_IDX(va)	((va) >> PDIR_SHIFT) | |
| 409 | ||
| 410 | #define PDIR_ENTRY_SHIFT 2	/* entry size is 2^2 = 4 bytes */ | |
| 411 | ||
| 412 | /* | |
| 413 | * 2nd level - page table (ptbl) | |
| 414 | * | |
| 415 | * Page table covers 1024 page table entries. Page | |
| 416 | * table entry (pte) is 32 bit wide and defines mapping | |
| 417 | * for a single page. | |
| 418 | */ | |
| 419 | #define PTBL_SHIFT	PAGE_SHIFT | |
| 420 | #define PTBL_SIZE	PAGE_SIZE		/* va range mapped by ptbl entry */ | |
| 421 | #define PTBL_MASK	((PDIR_SIZE - 1) & ~((1 << PAGE_SHIFT) - 1)) | |
| 422 | #define PTBL_NENTRIES	1024			/* number of pages mapped by ptbl */ | |
| 423 | ||
| 424 | /* Returns ptbl entry number for given va */ | |
| 425 | #define PTBL_IDX(va)	(((va) & PTBL_MASK) >> PTBL_SHIFT) | |
| 426 | ||
| 427 | /* Size of ptbl in pages, 1024 entries, each sizeof(struct pte_entry). */ | |
| 428 | #define PTBL_PAGES	2 | |
| 429 | #define PTBL_ENTRY_SHIFT 3	/* entry size is 2^3 = 8 bytes */ | |
| 430 | ||
| 431 | #endif | |
| 432 | #endif /* _MACHINE_PTE_H_ */ | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/machine/ptrace.h+2-41| ... | ... | @@ -1,44 +1,5 @@ |
| 1 | 1 | /*- |
| 2 | * SPDX-License-Identifier: BSD-3-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 2014 Justin Hibbits | |
| 5 | * All rights reserved. | |
| 6 | * | |
| 7 | * Redistribution and use in source and binary forms, with or without | |
| 8 | * modification, are permitted provided that the following conditions | |
| 9 | * are met: | |
| 10 | * 1. Redistributions of source code must retain the above copyright | |
| 11 | * notice, this list of conditions and the following disclaimer. | |
| 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 13 | * notice, this list of conditions and the following disclaimer in the | |
| 14 | * documentation and/or other materials provided with the distribution. | |
| 15 | * 3. Neither the name of the University nor the names of its contributors | |
| 16 | * may be used to endorse or promote products derived from this software | |
| 17 | * without specific prior written permission. | |
| 18 | * | |
| 19 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | |
| 20 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 21 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
| 22 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
| 23 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
| 24 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
| 25 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
| 26 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
| 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
| 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
| 29 | * SUCH DAMAGE. | |
| 30 | * | |
| 31 | *	@(#)ptrace.h	8.1 (Berkeley) 6/11/93 | |
| 2 | * This file is in the public domain. | |
| 32 | 3 | */ |
| 33 | 4 | |
| 34 | #ifndef _MACHINE_PTRACE_H_ | |
| 35 | #define _MACHINE_PTRACE_H_ | |
| 36 | ||
| 37 | #define	__HAVE_PTRACE_MACHDEP | |
| 38 | ||
| 39 | #define PT_GETVRREGS	(PT_FIRSTMACH + 0) | |
| 40 | #define PT_SETVRREGS	(PT_FIRSTMACH + 1) | |
| 41 | #define PT_GETVSRREGS	(PT_FIRSTMACH + 2) | |
| 42 | #define PT_SETVSRREGS	(PT_FIRSTMACH + 3) | |
| 43 | ||
| 44 | #endif | |
| \ No newline at end of file | ||
| 5 | #include <x86/ptrace.h> | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/machine/reg.h+3-90| ... | ... | @@ -1,92 +1,5 @@ |
| 1 | /* $NetBSD: reg.h,v 1.4 2000/06/04 09:30:44 tsubai Exp $	*/ | |
| 2 | ||
| 3 | #ifndef _POWERPC_REG_H_ | |
| 4 | #define	_POWERPC_REG_H_ | |
| 5 | ||
| 6 | #include <sys/_types.h> | |
| 7 | ||
| 8 | /* Must match struct trapframe */ | |
| 9 | struct reg { | |
| 10 | 	__register_t fixreg[32]; | |
| 11 | 	__register_t lr; | |
| 12 | 	__register_t cr; | |
| 13 | 	__register_t xer; | |
| 14 | 	__register_t ctr; | |
| 15 | 	__register_t pc; | |
| 16 | }; | |
| 17 | ||
| 18 | struct fpreg { | |
| 19 | 	double fpreg[32]; | |
| 20 | 	double fpscr; | |
| 21 | }; | |
| 22 | ||
| 23 | /* Must match pcb.pcb_vec */ | |
| 24 | struct vmxreg { | |
| 25 | 	__uint32_t vr[32][4]; | |
| 26 | 	__uint32_t pad[2]; | |
| 27 | 	__uint32_t vrsave; | |
| 28 | 	__uint32_t vscr; | |
| 29 | }; | |
| 30 | ||
| 31 | struct dbreg { | |
| 32 | 	unsigned int	junk; | |
| 33 | }; | |
| 34 | ||
| 35 | #ifdef __LP64__ | |
| 36 | /* Must match struct trapframe */ | |
| 37 | struct reg32 { | |
| 38 | 	__int32_t fixreg[32]; | |
| 39 | 	__int32_t lr; | |
| 40 | 	__int32_t cr; | |
| 41 | 	__int32_t xer; | |
| 42 | 	__int32_t ctr; | |
| 43 | 	__int32_t pc; | |
| 44 | }; | |
| 45 | ||
| 46 | struct fpreg32 { | |
| 47 | 	struct fpreg data; | |
| 48 | }; | |
| 49 | ||
| 50 | struct vmxreg32 { | |
| 51 | 	struct vmxreg data; | |
| 52 | }; | |
| 53 | ||
| 54 | struct dbreg32 { | |
| 55 | 	struct dbreg data; | |
| 56 | }; | |
| 57 | ||
| 58 | #define __HAVE_REG32 | |
| 59 | #endif | |
| 60 | ||
| 61 | #ifdef _KERNEL | |
| 62 | /* | |
| 63 | * XXX these interfaces are MI, so they should be declared in a MI place. | |
| 64 | */ | |
| 65 | int	fill_regs(struct thread *, struct reg *); | |
| 66 | int	set_regs(struct thread *, struct reg *); | |
| 67 | int	fill_fpregs(struct thread *, struct fpreg *); | |
| 68 | int	set_fpregs(struct thread *, struct fpreg *); | |
| 69 | int	fill_dbregs(struct thread *, struct dbreg *); | |
| 70 | int	set_dbregs(struct thread *, struct dbreg *); | |
| 71 | ||
| 72 | /* | |
| 73 | * MD interfaces. | |
| 1 | /*- | |
| 2 | * This file is in the public domain. | |
| 74 | 3 | */ |
| 75 | void	cpu_save_thread_regs(struct thread *); | |
| 76 | ||
| 77 | #ifdef COMPAT_FREEBSD32 | |
| 78 | struct image_params; | |
| 79 | ||
| 80 | int	fill_regs32(struct thread *, struct reg32 *); | |
| 81 | int	set_regs32(struct thread *, struct reg32 *); | |
| 82 | void	ppc32_setregs(struct thread *, struct image_params *, uintptr_t); | |
| 83 | ||
| 84 | #define	fill_fpregs32(td, reg)	fill_fpregs(td,(struct fpreg *)reg) | |
| 85 | #define	set_fpregs32(td, reg)	set_fpregs(td,(struct fpreg *)reg) | |
| 86 | #define	fill_dbregs32(td, reg)	fill_dbregs(td,(struct dbreg *)reg) | |
| 87 | #define	set_dbregs32(td, reg)	set_dbregs(td,(struct dbreg *)reg) | |
| 88 | #endif | |
| 89 | ||
| 90 | #endif | |
| 91 | 4 | |
| 92 | #endif /* _POWERPC_REG_H_ */ | |
| \ No newline at end of file | ||
| 5 | #include <x86/reg.h> | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/machine/reloc.h+23-5| ... | ... | @@ -1,8 +1,8 @@ |
| 1 | 1 | /*- |
| 2 | 2 | * SPDX-License-Identifier: BSD-3-Clause |
| 3 | 3 | * |
| 4 | * Copyright (c) 1998 John Birrell <jb@cimlogic.com.au>. | |
| 5 | * All rights reserved. | |
| 4 | * Copyright (c) 1992, 1993 | |
| 5 | *	The Regents of the University of California. All rights reserved. | |
| 6 | 6 | * |
| 7 | 7 | * Redistribution and use in source and binary forms, with or without |
| 8 | 8 | * modification, are permitted provided that the following conditions |
| ... | ... | @@ -12,11 +12,11 @@ |
| 12 | 12 | * 2. Redistributions in binary form must reproduce the above copyright |
| 13 | 13 | * notice, this list of conditions and the following disclaimer in the |
| 14 | 14 | * documentation and/or other materials provided with the distribution. |
| 15 | * 3. Neither the name of the author nor the names of any co-contributors | |
| 15 | * 3. Neither the name of the University nor the names of its contributors | |
| 16 | 16 | * may be used to endorse or promote products derived from this software |
| 17 | 17 | * without specific prior written permission. |
| 18 | 18 | * |
| 19 | * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND | |
| 19 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | |
| 20 | 20 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 21 | 21 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| 22 | 22 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE |
| ... | ... | @@ -27,4 +27,22 @@ |
| 27 | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | */ | |
| \ No newline at end of file | ||
| 30 | */ | |
| 31 | ||
| 32 | #ifndef _I386_MACHINE_RELOC_H_ | |
| 33 | #define _I386_MACHINE_RELOC_H_ | |
| 34 | ||
| 35 | /* Relocation format. */ | |
| 36 | struct relocation_info { | |
| 37 | 	int r_address;			 /* offset in text or data segment */ | |
| 38 | 	unsigned int r_symbolnum : 24, /* ordinal number of add symbol */ | |
| 39 | 			 r_pcrel : 1, /* 1 if value should be pc-relative */ | |
| 40 | 			 r_length : 2, /* log base 2 of value's width */ | |
| 41 | 			 r_extern : 1, /* 1 if need to add symbol to value */ | |
| 42 | 			 r_baserel : 1, /* linkage table relative */ | |
| 43 | 			r_jmptable : 1, /* relocate to jump table */ | |
| 44 | 			r_relative : 1, /* load address relative */ | |
| 45 | 			 r_copy : 1; /* run time copy */ | |
| 46 | }; | |
| 47 | ||
| 48 | #endif | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/machine/resource.h deleted-44| ... | ... | @@ -1,44 +0,0 @@ |
| 1 | /*- | |
| 2 | * Copyright 1998 Massachusetts Institute of Technology | |
| 3 | * | |
| 4 | * Permission to use, copy, modify, and distribute this software and | |
| 5 | * its documentation for any purpose and without fee is hereby | |
| 6 | * granted, provided that both the above copyright notice and this | |
| 7 | * permission notice appear in all copies, that both the above | |
| 8 | * copyright notice and this permission notice appear in all | |
| 9 | * supporting documentation, and that the name of M.I.T. not be used | |
| 10 | * in advertising or publicity pertaining to distribution of the | |
| 11 | * software without specific, written prior permission. M.I.T. makes | |
| 12 | * no representations about the suitability of this software for any | |
| 13 | * purpose. It is provided "as is" without express or implied | |
| 14 | * warranty. | |
| 15 | * | |
| 16 | * THIS SOFTWARE IS PROVIDED BY M.I.T. ``AS IS''. M.I.T. DISCLAIMS | |
| 17 | * ALL EXPRESS OR IMPLIED WARRANTIES WITH REGARD TO THIS SOFTWARE, | |
| 18 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | |
| 19 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT | |
| 20 | * SHALL M.I.T. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
| 21 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |
| 22 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF | |
| 23 | * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | |
| 24 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | |
| 25 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT | |
| 26 | * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
| 27 | * SUCH DAMAGE. | |
| 28 | */ | |
| 29 | ||
| 30 | #ifndef _MACHINE_RESOURCE_H_ | |
| 31 | #define	_MACHINE_RESOURCE_H_	1 | |
| 32 | ||
| 33 | /* | |
| 34 | * Definitions of resource types for Intel Architecture machines | |
| 35 | * with support for legacy ISA devices and drivers. | |
| 36 | */ | |
| 37 | ||
| 38 | #define	SYS_RES_IRQ	1	/* interrupt lines */ | |
| 39 | #define	SYS_RES_DRQ	2	/* isa dma lines */ | |
| 40 | #define	SYS_RES_MEMORY	3	/* i/o memory */ | |
| 41 | #define	SYS_RES_IOPORT	4	/* i/o ports */ | |
| 42 | #define	PCI_RES_BUS	5	/* PCI bus numbers */ | |
| 43 | ||
| 44 | #endif /* !_MACHINE_RESOURCE_H_ */ | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/machine/rtas.h deleted-60| ... | ... | @@ -1,60 +0,0 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-2-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 2011 Nathan Whitehorn | |
| 5 | * All rights reserved. | |
| 6 | * | |
| 7 | * Redistribution and use in source and binary forms, with or without | |
| 8 | * modification, are permitted provided that the following conditions | |
| 9 | * are met: | |
| 10 | * 1. Redistributions of source code must retain the above copyright | |
| 11 | * notice, this list of conditions and the following disclaimer. | |
| 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 13 | * notice, this list of conditions and the following disclaimer in the | |
| 14 | * documentation and/or other materials provided with the distribution. | |
| 15 | * | |
| 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |
| 17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
| 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | |
| 20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
| 21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
| 22 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
| 23 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
| 24 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
| 25 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
| 26 | * SUCH DAMAGE. | |
| 27 | */ | |
| 28 | ||
| 29 | #ifndef _MACHINE_RTAS_H_ | |
| 30 | #define _MACHINE_RTAS_H_ | |
| 31 | ||
| 32 | #include <sys/cdefs.h> | |
| 33 | #include <sys/types.h> | |
| 34 | #include <dev/ofw/openfirm.h> | |
| 35 | ||
| 36 | /* | |
| 37 | * RTAS functions are defined by 32-bit integer tokens. These vary from | |
| 38 | * system to system, and can be looked up from their standardized names | |
| 39 | * using rtas_token_lookup(). If RTAS is not available, rtas_token_lookup() | |
| 40 | * and rtas_call_method() return -1; this can be checked in advance using | |
| 41 | * rtas_exists(). Otherwise, rtas_call_method() returns one of the RTAS | |
| 42 | * status codes from the bottom of this file. | |
| 43 | */ | |
| 44 | ||
| 45 | int rtas_exists(void); | |
| 46 | int rtas_call_method(cell_t token, int nargs, int nreturns, ...); | |
| 47 | cell_t rtas_token_lookup(const char *method); | |
| 48 | ||
| 49 | /* RTAS Status Codes: see CHRP or PAPR specification */ | |
| 50 | #define	RTAS_OK				0 | |
| 51 | #define	RTAS_HW_ERROR			-1 | |
| 52 | #define	RTAS_BUSY			-2 | |
| 53 | #define	RTAS_PARAM_ERROR		-3 | |
| 54 | #define	RTAS_STATE_CHANGE		-7 | |
| 55 | #define	RTAS_VENDOR_BEGIN		9000 | |
| 56 | #define	RTAS_EXTENDED_DELAY		9900 | |
| 57 | #define	RTAS_ISOLATION_ERROR		-9000 | |
| 58 | #define	RTAS_VENDOR_ERROR_BEGIN		-9004 | |
| 59 | ||
| 60 | #endif /* _MACHINE_RTAS_H_ */ | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/machine/runq.h deleted-55| ... | ... | @@ -1,55 +0,0 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-2-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 2001 Jake Burkholder <jake@FreeBSD.org> | |
| 5 | * All rights reserved. | |
| 6 | * | |
| 7 | * Redistribution and use in source and binary forms, with or without | |
| 8 | * modification, are permitted provided that the following conditions | |
| 9 | * are met: | |
| 10 | * 1. Redistributions of source code must retain the above copyright | |
| 11 | * notice, this list of conditions and the following disclaimer. | |
| 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 13 | * notice, this list of conditions and the following disclaimer in the | |
| 14 | * documentation and/or other materials provided with the distribution. | |
| 15 | * | |
| 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |
| 17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
| 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | |
| 20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
| 21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
| 22 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
| 23 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
| 24 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
| 25 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
| 26 | * SUCH DAMAGE. | |
| 27 | */ | |
| 28 | ||
| 29 | #ifndef	_MACHINE_RUNQ_H_ | |
| 30 | #define	_MACHINE_RUNQ_H_ | |
| 31 | ||
| 32 | #ifdef __powerpc64__ | |
| 33 | #define	RQB_LEN		(1UL)		/* Number of priority status words. */ | |
| 34 | #define	RQB_L2BPW	(6UL)		/* Log2(sizeof(rqb_word_t) * NBBY)). */ | |
| 35 | #else | |
| 36 | #define	RQB_LEN		(2)		/* Number of priority status words. */ | |
| 37 | #define	RQB_L2BPW	(5)		/* Log2(sizeof(rqb_word_t) * NBBY)). */ | |
| 38 | #endif | |
| 39 | #define	RQB_BPW		(1UL<<RQB_L2BPW) /* Bits in an rqb_word_t. */ | |
| 40 | ||
| 41 | #define	RQB_BIT(pri)	(1UL << ((pri) & (RQB_BPW - 1))) | |
| 42 | #define	RQB_WORD(pri)	((pri) >> RQB_L2BPW) | |
| 43 | ||
| 44 | #define	RQB_FFS(word)	(ffsl(word) - 1) | |
| 45 | ||
| 46 | /* | |
| 47 | * Type of run queue status word. | |
| 48 | */ | |
| 49 | #ifdef __powerpc64__ | |
| 50 | typedef	u_int64_t	rqb_word_t; | |
| 51 | #else | |
| 52 | typedef	u_int32_t	rqb_word_t; | |
| 53 | #endif | |
| 54 | ||
| 55 | #endif | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/machine/sdt_machdep.h created+12| ... | ... | @@ -0,0 +1,12 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-2-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 2024 Mark Johnston <markj@FreeBSD.org> | |
| 5 | */ | |
| 6 | ||
| 7 | #ifndef _SYS_SDT_MACHDEP_H_ | |
| 8 | #define	_SYS_SDT_MACHDEP_H_ | |
| 9 | ||
| 10 | #define	_SDT_ASM_PATCH_INSTR	"nop" | |
| 11 | ||
| 12 | #endif /* _SYS_SDT_MACHDEP_H_ */ | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/machine/setjmp.h+2-24| ... | ... | @@ -1,27 +1,5 @@ |
| 1 | 1 | /*- |
| 2 | *	$NetBSD: setjmp.h,v 1.3 1998/09/16 23:51:27 thorpej Exp $ | |
| 2 | * This file is in the public domain. | |
| 3 | 3 | */ |
| 4 | 4 | |
| 5 | #ifndef _MACHINE_SETJMP_H_ | |
| 6 | #define	_MACHINE_SETJMP_H_ | |
| 7 | ||
| 8 | #include <sys/cdefs.h> | |
| 9 | ||
| 10 | #ifdef _KERNEL | |
| 11 | #define	_JBLEN	25	/* Kernel doesn't save FP and Altivec regs */ | |
| 12 | #else | |
| 13 | #define	_JBLEN	100 | |
| 14 | #endif | |
| 15 | ||
| 16 | /* | |
| 17 | * jmp_buf and sigjmp_buf are encapsulated in different structs to force | |
| 18 | * compile-time diagnostics for mismatches. The structs are the same | |
| 19 | * internally to avoid some run-time errors for mismatches. | |
| 20 | */ | |
| 21 | #if __BSD_VISIBLE || __POSIX_VISIBLE || __XSI_VISIBLE | |
| 22 | typedef	struct _sigjmp_buf { long _sjb[_JBLEN + 1]; } sigjmp_buf[1]; | |
| 23 | #endif | |
| 24 | ||
| 25 | typedef	struct _jmp_buf { long _jb[_JBLEN + 1]; } jmp_buf[1]; | |
| 26 | ||
| 27 | #endif /* !_MACHINE_SETJMP_H_ */ | |
| \ No newline at end of file | ||
| 5 | #include <x86/setjmp.h> | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/machine/signal.h deleted-54| ... | ... | @@ -1,54 +0,0 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-4-Clause | |
| 3 | * | |
| 4 | * Copyright (C) 1995, 1996 Wolfgang Solfrank. | |
| 5 | * Copyright (C) 1995, 1996 TooLs GmbH. | |
| 6 | * All rights reserved. | |
| 7 | * | |
| 8 | * Redistribution and use in source and binary forms, with or without | |
| 9 | * modification, are permitted provided that the following conditions | |
| 10 | * are met: | |
| 11 | * 1. Redistributions of source code must retain the above copyright | |
| 12 | * notice, this list of conditions and the following disclaimer. | |
| 13 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 14 | * notice, this list of conditions and the following disclaimer in the | |
| 15 | * documentation and/or other materials provided with the distribution. | |
| 16 | * 3. All advertising materials mentioning features or use of this software | |
| 17 | * must display the following acknowledgement: | |
| 18 | *	This product includes software developed by TooLs GmbH. | |
| 19 | * 4. The name of TooLs GmbH may not be used to endorse or promote products | |
| 20 | * derived from this software without specific prior written permission. | |
| 21 | * | |
| 22 | * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR | |
| 23 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |
| 24 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | |
| 25 | * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
| 26 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | |
| 27 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; | |
| 28 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | |
| 29 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | |
| 30 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | |
| 31 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 32 | * | |
| 33 | *	$NetBSD: signal.h,v 1.4 1998/09/14 02:48:34 thorpej Exp $ | |
| 34 | */ | |
| 35 | ||
| 36 | #ifndef	_MACHINE_SIGNAL_H_ | |
| 37 | #define	_MACHINE_SIGNAL_H_ | |
| 38 | ||
| 39 | #include <sys/cdefs.h> | |
| 40 | ||
| 41 | typedef int sig_atomic_t; | |
| 42 | ||
| 43 | #if __BSD_VISIBLE | |
| 44 | #include <machine/frame.h> | |
| 45 | ||
| 46 | struct sigcontext { | |
| 47 | 	int sc_onstack;			/* saved onstack flag */ | |
| 48 | 	int __sc_mask13;		/* saved signal mask (old style) */ | |
| 49 | 	struct trapframe sc_frame;	/* saved registers */ | |
| 50 | 	struct __sigset sc_mask;	/* saved signal mask (new style) */ | |
| 51 | }; | |
| 52 | #endif | |
| 53 | ||
| 54 | #endif	/* !_MACHINE_SIGNAL_H_ */ | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/machine/slb.h deleted-92| ... | ... | @@ -1,92 +0,0 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-2-Clause | |
| 3 | * | |
| 4 | * Copyright (C) 2009 Nathan Whitehorn | |
| 5 | * All rights reserved. | |
| 6 | * | |
| 7 | * Redistribution and use in source and binary forms, with or without | |
| 8 | * modification, are permitted provided that the following conditions | |
| 9 | * are met: | |
| 10 | * 1. Redistributions of source code must retain the above copyright | |
| 11 | * notice, this list of conditions and the following disclaimer. | |
| 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 13 | * notice, this list of conditions and the following disclaimer in the | |
| 14 | * documentation and/or other materials provided with the distribution. | |
| 15 | * | |
| 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | |
| 17 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |
| 18 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | |
| 19 | * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
| 20 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | |
| 21 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; | |
| 22 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | |
| 23 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | |
| 24 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | |
| 25 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 26 | */ | |
| 27 | ||
| 28 | #ifndef _MACHINE_SLB_H_ | |
| 29 | #define	_MACHINE_SLB_H_ | |
| 30 | ||
| 31 | /* | |
| 32 | * Bit definitions for segment lookaside buffer entries. | |
| 33 | * | |
| 34 | * PowerPC Microprocessor Family: The Programming Environments for 64-bit | |
| 35 | * Microprocessors, section 7.4.2.1 | |
| 36 | * | |
| 37 | * Note that these bitmasks are relative to the values for one of the two | |
| 38 | * values for slbmte, slbmfee, and slbmfev, not the internal SLB | |
| 39 | * representation. | |
| 40 | */ | |
| 41 | ||
| 42 | #define	SLBV_KS		0x0000000000000800UL /* Supervisor-state prot key */ | |
| 43 | #define	SLBV_KP		0x0000000000000400UL /* User-state prot key */ | |
| 44 | #define	SLBV_N		0x0000000000000200UL /* No-execute protection */ | |
| 45 | #define	SLBV_L		0x0000000000000100UL /* Large page selector */ | |
| 46 | #define	SLBV_CLASS	0x0000000000000080UL /* Class selector */ | |
| 47 | #define	SLBV_VSID_MASK	0xfffffffffffff000UL /* Virtual segment ID mask */ | |
| 48 | #define	SLBV_VSID_SHIFT	12 | |
| 49 | ||
| 50 | /* | |
| 51 | * Make a predictable 1:1 map from ESIDs to VSIDs for the kernel. Hash table | |
| 52 | * coverage is increased by swizzling the ESID and multiplying by a prime | |
| 53 | * number (0x13bb). | |
| 54 | */ | |
| 55 | #define	KERNEL_VSID_BIT	0x0000001000000000UL /* Bit set in all kernel VSIDs */ | |
| 56 | #define KERNEL_VSID(esid) ((((((uint64_t)esid << 8) | ((uint64_t)esid >> 28)) \ | |
| 57 | 				* 0x13bbUL) & (KERNEL_VSID_BIT - 1)) | \ | |
| 58 | 				KERNEL_VSID_BIT) | |
| 59 | ||
| 60 | #define	SLBE_VALID	0x0000000008000000UL /* SLB entry valid */ | |
| 61 | #define	SLBE_INDEX_MASK	0x0000000000000fffUL /* SLB index mask*/ | |
| 62 | #define	SLBE_ESID_MASK	0xfffffffff0000000UL /* Effective segment ID mask */ | |
| 63 | #define	SLBE_ESID_SHIFT	28 | |
| 64 | ||
| 65 | /* | |
| 66 | * SLB page sizes encoding, as present in property ibm,segment-page-sizes | |
| 67 | * of CPU device tree node. | |
| 68 | * | |
| 69 | * See LoPAPR: CPU Node Properties, section C.6.1.4. | |
| 70 | */ | |
| 71 | #define	SLB_PGSZ_4K_4K	0 | |
| 72 | ||
| 73 | /* Virtual real-mode VSID in LPARs */ | |
| 74 | #define VSID_VRMA	0x1ffffff | |
| 75 | ||
| 76 | /* | |
| 77 | * User segment for copyin/out | |
| 78 | */ | |
| 79 | #define USER_SLB_SLOT 0 | |
| 80 | #define USER_SLB_SLBE (((USER_ADDR >> ADDR_SR_SHFT) << SLBE_ESID_SHIFT) | \ | |
| 81 | 			SLBE_VALID | USER_SLB_SLOT) | |
| 82 | ||
| 83 | struct slb { | |
| 84 | 	uint64_t	slbv; | |
| 85 | 	uint64_t	slbe; | |
| 86 | }; | |
| 87 | ||
| 88 | struct pmap; | |
| 89 | void	handle_kernel_slb_spill(int, register_t, register_t); | |
| 90 | int	handle_user_slb_spill(struct pmap *pm, vm_offset_t addr); | |
| 91 | ||
| 92 | #endif /* !_MACHINE_SLB_H_ */ | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/machine/smp.h deleted-64| ... | ... | @@ -1,64 +0,0 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-2-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 2008 Marcel Moolenaar | |
| 5 | * All rights reserved. | |
| 6 | * | |
| 7 | * Redistribution and use in source and binary forms, with or without | |
| 8 | * modification, are permitted provided that the following conditions | |
| 9 | * are met: | |
| 10 | * | |
| 11 | * 1. Redistributions of source code must retain the above copyright | |
| 12 | * notice, this list of conditions and the following disclaimer. | |
| 13 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 14 | * notice, this list of conditions and the following disclaimer in the | |
| 15 | * documentation and/or other materials provided with the distribution. | |
| 16 | * | |
| 17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | |
| 18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |
| 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | |
| 20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | |
| 21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | |
| 22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
| 23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
| 24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
| 25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | |
| 26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 27 | */ | |
| 28 | ||
| 29 | #ifndef _MACHINE_SMP_H_ | |
| 30 | #define _MACHINE_SMP_H_ | |
| 31 | ||
| 32 | #ifdef _KERNEL | |
| 33 | ||
| 34 | #define	IPI_AST			0 | |
| 35 | #define	IPI_PREEMPT		1 | |
| 36 | #define	IPI_RENDEZVOUS		2 | |
| 37 | #define	IPI_STOP		3 | |
| 38 | #define	IPI_STOP_HARD		3 | |
| 39 | #define	IPI_HARDCLOCK		4 | |
| 40 | ||
| 41 | #ifndef LOCORE | |
| 42 | ||
| 43 | #include <machine/pcb.h> | |
| 44 | #include <sys/_cpuset.h> | |
| 45 | ||
| 46 | void	ipi_all_but_self(int ipi); | |
| 47 | void	ipi_cpu(int cpu, u_int ipi); | |
| 48 | void	ipi_selected(cpuset_t cpus, int ipi); | |
| 49 | ||
| 50 | struct cpuref { | |
| 51 | 	uintptr_t	cr_hwref; | |
| 52 | 	u_int		cr_cpuid; | |
| 53 | 	u_int		cr_domain; | |
| 54 | }; | |
| 55 | ||
| 56 | void	pmap_cpu_bootstrap(int); | |
| 57 | void	cpudep_ap_early_bootstrap(void); | |
| 58 | uintptr_t cpudep_ap_bootstrap(void); | |
| 59 | void	cpudep_ap_setup(void); | |
| 60 | void	machdep_ap_bootstrap(void); | |
| 61 | ||
| 62 | #endif /* !LOCORE */ | |
| 63 | #endif /* _KERNEL */ | |
| 64 | #endif /* !_MACHINE_SMP_H */ | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/machine/spr.h deleted-863| ... | ... | @@ -1,863 +0,0 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-2-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 2001 The NetBSD Foundation, Inc. | |
| 5 | * All rights reserved. | |
| 6 | * | |
| 7 | * Redistribution and use in source and binary forms, with or without | |
| 8 | * modification, are permitted provided that the following conditions | |
| 9 | * are met: | |
| 10 | * 1. Redistributions of source code must retain the above copyright | |
| 11 | * notice, this list of conditions and the following disclaimer. | |
| 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 13 | * notice, this list of conditions and the following disclaimer in the | |
| 14 | * documentation and/or other materials provided with the distribution. | |
| 15 | * | |
| 16 | * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS | |
| 17 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | |
| 18 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
| 19 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | |
| 20 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
| 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
| 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
| 23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
| 24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
| 25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
| 26 | * POSSIBILITY OF SUCH DAMAGE. | |
| 27 | * | |
| 28 | * $NetBSD: spr.h,v 1.25 2002/08/14 15:38:40 matt Exp $ | |
| 29 | */ | |
| 30 | #ifndef _POWERPC_SPR_H_ | |
| 31 | #define	_POWERPC_SPR_H_ | |
| 32 | ||
| 33 | #ifndef _LOCORE | |
| 34 | #define	mtspr(reg, val)							\ | |
| 35 | 	__asm __volatile("mtspr %0,%1" : : "K"(reg), "r"(val)) | |
| 36 | #define	mfspr(reg)							\ | |
| 37 | 	( { register_t val;						\ | |
| 38 | 	 __asm __volatile("mfspr %0,%1" : "=r"(val) : "K"(reg));	\ | |
| 39 | 	 val; } ) | |
| 40 | ||
| 41 | #ifndef __powerpc64__ | |
| 42 | ||
| 43 | /* The following routines allow manipulation of the full 64-bit width | |
| 44 | * of SPRs on 64 bit CPUs in bridge mode */ | |
| 45 | ||
| 46 | #define mtspr64(reg,valhi,vallo,scratch)				\ | |
| 47 | 	__asm __volatile("						\ | |
| 48 | 		mfmsr %0; 						\ | |
| 49 | 		insrdi %0,%5,1,0; 					\ | |
| 50 | 		mtmsrd %0; 						\ | |
| 51 | 		isync; 							\ | |
| 52 | 									\ | |
| 53 | 		sld %1,%1,%4;						\ | |
| 54 | 		or %1,%1,%2;						\ | |
| 55 | 		mtspr %3,%1;						\ | |
| 56 | 		srd %1,%1,%4;						\ | |
| 57 | 									\ | |
| 58 | 		clrldi %0,%0,1; 					\ | |
| 59 | 		mtmsrd %0; 						\ | |
| 60 | 		isync;"							\ | |
| 61 | 	: "=r"(scratch), "=r"(valhi) : "r"(vallo), "K"(reg), "r"(32), "r"(1)) | |
| 62 | ||
| 63 | #define mfspr64upper(reg,scratch)					\ | |
| 64 | 	( { register_t val;						\ | |
| 65 | 	 __asm __volatile("						\ | |
| 66 | 		mfmsr %0; 						\ | |
| 67 | 		insrdi %0,%4,1,0; 					\ | |
| 68 | 		mtmsrd %0; 						\ | |
| 69 | 		isync; 							\ | |
| 70 | 									\ | |
| 71 | 		mfspr %1,%2;						\ | |
| 72 | 		srd %1,%1,%3;						\ | |
| 73 | 									\ | |
| 74 | 		clrldi %0,%0,1; 					\ | |
| 75 | 		mtmsrd %0; 						\ | |
| 76 | 		isync;" 						\ | |
| 77 | 	 : "=r"(scratch), "=r"(val) : "K"(reg), "r"(32), "r"(1));	\ | |
| 78 | 	 val; } ) | |
| 79 | ||
| 80 | #endif | |
| 81 | ||
| 82 | #endif /* _LOCORE */ | |
| 83 | ||
| 84 | /* | |
| 85 | * Special Purpose Register declarations. | |
| 86 | * | |
| 87 | * The first column in the comments indicates which PowerPC | |
| 88 | * architectures the SPR is valid on - 4 for 4xx series, | |
| 89 | * 6 for 6xx/7xx series and 8 for 8xx and 8xxx series. | |
| 90 | */ | |
| 91 | ||
| 92 | #define	SPR_MQ			0x000	/* .6. 601 MQ register */ | |
| 93 | #define	SPR_XER			0x001	/* 468 Fixed Point Exception Register */ | |
| 94 | #define	SPR_DSCR		0x003	/* .6. Data Stream Control Register (Unprivileged) */ | |
| 95 | #define	SPR_RTCU_R		0x004	/* .6. 601 RTC Upper - Read */ | |
| 96 | #define	SPR_RTCL_R		0x005	/* .6. 601 RTC Lower - Read */ | |
| 97 | #define	SPR_LR			0x008	/* 468 Link Register */ | |
| 98 | #define	SPR_CTR			0x009	/* 468 Count Register */ | |
| 99 | #define	SPR_DSCRP		0x011 /* Data Stream Control Register (Privileged) */ | |
| 100 | #define	SPR_DSISR		0x012	/* .68 DSI exception source */ | |
| 101 | #define	 DSISR_DIRECT		 0x80000000 /* Direct-store error exception */ | |
| 102 | #define	 DSISR_NOTFOUND	 0x40000000 /* Translation not found */ | |
| 103 | #define	 DSISR_PROTECT		 0x08000000 /* Memory access not permitted */ | |
| 104 | #define	 DSISR_INVRX		 0x04000000 /* Reserve-indexed insn direct-store access */ | |
| 105 | #define	 DSISR_STORE		 0x02000000 /* Store operation */ | |
| 106 | #define	 DSISR_DABR		 0x00400000 /* DABR match */ | |
| 107 | #define	 DSISR_SEGMENT		 0x00200000 /* XXX; not in 6xx PEM */ | |
| 108 | #define	 DSISR_EAR		 0x00100000 /* eciwx/ecowx && EAR[E] == 0 */ | |
| 109 | #define	 DSISR_MC_UE_DEFERRED	 0x00008000 /* UE deferred error */ | |
| 110 | #define	 DSISR_MC_UE_TABLEWALK	 0x00004000 /* UE deferred error during tablewalk */ | |
| 111 | #define	 DSISR_MC_DERAT_MULTIHIT	 0x00000800 /* D-ERAT multi-hit */ | |
| 112 | #define	 DSISR_MC_TLB_MULTIHIT	 0x00000400 /* TLB multi-hit */ | |
| 113 | #define	 DSISR_MC_TLBIE_ERR	 0x00000200 /* TLBIE or TLBIEL programming error */ | |
| 114 | #define	 DSISR_MC_SLB_PARITY	 0x00000100 /* SLB parity error */ | |
| 115 | #define	 DSISR_MC_SLB_MULTIHIT	 0x00000080 /* SLB Multi-hit detected (D-side) */ | |
| 116 | #define	 DSISR_MC_BAD_REAL_LD	 0x00000040 /* Bad real address for load. */ | |
| 117 | #define	 DSISR_MC_BAD_ADDR	 0x00000020 /* Bad address for load or store tablewalk */ | |
| 118 | #define	SPR_DAR			0x013	/* .68 Data Address Register */ | |
| 119 | #define	SPR_RTCU_W		0x014	/* .6. 601 RTC Upper - Write */ | |
| 120 | #define	SPR_RTCL_W		0x015	/* .6. 601 RTC Lower - Write */ | |
| 121 | #define	SPR_DEC			0x016	/* .68 DECrementer register */ | |
| 122 | #define	SPR_SDR1		0x019	/* .68 Page table base address register */ | |
| 123 | #define	SPR_SRR0		0x01a	/* 468 Save/Restore Register 0 */ | |
| 124 | #define	SPR_SRR1		0x01b	/* 468 Save/Restore Register 1 */ | |
| 125 | #define	 SRR1_ISI_PFAULT	 0x40000000 /* ISI page not found */ | |
| 126 | #define	 SRR1_ISI_NOEXECUTE	 0x10000000 /* Memory marked no-execute */ | |
| 127 | #define	 SRR1_ISI_PP		 0x08000000 /* PP bits forbid access */ | |
| 128 | #define	 SRR1_MCHK_DATA	 0x00200000 /* Machine check data in DSISR */ | |
| 129 | #define	 SRR1_MCHK_IFETCH_M	 0x081c0000 /* Machine check instr fetch mask */ | |
| 130 | #define	 SRR1_MCHK_IFETCH_SLBMH 0x000c0000 /* SLB multihit */ | |
| 131 | #define	SPR_CFAR		0x01c	/* Come From Address Register */ | |
| 132 | #define	SPR_AMR			0x01d	/* Authority Mask Register */ | |
| 133 | ||
| 134 | #define	SPR_PID			0x030	/* 4.. Process ID */ | |
| 135 | ||
| 136 | #define	SPR_DECAR		0x036	/* ..8 Decrementer auto reload */ | |
| 137 | #define	SPR_IAMR		0x03d	/* Instr. Authority Mask Reg */ | |
| 138 | ||
| 139 | #define	SPR_EIE			0x050	/* ..8 Exception Interrupt ??? */ | |
| 140 | #define	SPR_EID			0x051	/* ..8 Exception Interrupt ??? */ | |
| 141 | #define	SPR_NRI			0x052	/* ..8 Exception Interrupt ??? */ | |
| 142 | #define	SPR_FSCR		0x099	/* Facility Status and Control Register */ | |
| 143 | #define	 FSCR_IC_MASK		 0xFF00000000000000ULL	/* FSCR[0:7] is Interrupt Cause */ | |
| 144 | #define	 FSCR_IC_FP		 0x0000000000000000ULL	/* FP unavailable */ | |
| 145 | #define	 FSCR_IC_VSX		 0x0100000000000000ULL	/* VSX unavailable */ | |
| 146 | #define	 FSCR_IC_DSCR		 0x0200000000000000ULL	/* Access to the DSCR at SPRs 3 or 17 */ | |
| 147 | #define	 FSCR_IC_PM		 0x0300000000000000ULL	/* Read or write access of a Performance Monitor SPR in group A */ | |
| 148 | #define	 FSCR_IC_BHRB		 0x0400000000000000ULL	/* Execution of a BHRB Instruction */ | |
| 149 | #define	 FSCR_IC_HTM		 0x0500000000000000ULL	/* Access to a Transactional Memory */ | |
| 150 | /* Reserved 0x0600000000000000ULL */ | |
| 151 | #define	 FSCR_IC_EBB		 0x0700000000000000ULL	/* Access to Event-Based Branch */ | |
| 152 | #define	 FSCR_IC_TAR		 0x0800000000000000ULL	/* Access to Target Address Register */ | |
| 153 | #define	 FSCR_IC_STOP		 0x0900000000000000ULL	/* Access to the 'stop' instruction in privileged non-hypervisor state */ | |
| 154 | #define	 FSCR_IC_MSG		 0x0A00000000000000ULL	/* Access to 'msgsndp' or 'msgclrp' instructions */ | |
| 155 | #define	 FSCR_IC_LM		 0x0A00000000000000ULL	/* Access to load monitored facility */ | |
| 156 | #define	 FSCR_IC_SCV		 0x0C00000000000000ULL	/* Execution of a 'scv' instruction */ | |
| 157 | #define	 FSCR_SCV		 0x0000000000001000 /* scv instruction available */ | |
| 158 | #define	 FSCR_LM		 0x0000000000000800 /* Load monitored facilities available */ | |
| 159 | #define	 FSCR_MSGP		 0x0000000000000400 /* msgsndp and SPRs available */ | |
| 160 | #define	 FSCR_TAR		 0x0000000000000100 /* TAR register available */ | |
| 161 | #define	 FSCR_EBB		 0x0000000000000080 /* Event-based branch available */ | |
| 162 | #define	 FSCR_DSCR		 0x0000000000000004 /* DSCR available in PR state */ | |
| 163 | #define	SPR_UAMOR		0x09d	/* User Authority Mask Override Register */ | |
| 164 | #define	SPR_DPDES		0x0b0	/* .6. Directed Privileged Doorbell Exception State Register */ | |
| 165 | #define	SPR_USPRG0		0x100	/* 4.8 User SPR General 0 */ | |
| 166 | #define	SPR_VRSAVE		0x100	/* .6. AltiVec VRSAVE */ | |
| 167 | #define	SPR_SPRG0		0x110	/* 468 SPR General 0 */ | |
| 168 | #define	SPR_SPRG1		0x111	/* 468 SPR General 1 */ | |
| 169 | #define	SPR_SPRG2		0x112	/* 468 SPR General 2 */ | |
| 170 | #define	SPR_SPRG3		0x113	/* 468 SPR General 3 */ | |
| 171 | #define	SPR_SPRG4		0x114	/* 4.8 SPR General 4 */ | |
| 172 | #define	SPR_SPRG5		0x115	/* 4.8 SPR General 5 */ | |
| 173 | #define	SPR_SPRG6		0x116	/* 4.8 SPR General 6 */ | |
| 174 | #define	SPR_SPRG7		0x117	/* 4.8 SPR General 7 */ | |
| 175 | #define	SPR_SCOMC		0x114	/* ... SCOM Address Register (970) */ | |
| 176 | #define	SPR_SCOMD		0x115	/* ... SCOM Data Register (970) */ | |
| 177 | #define	SPR_ASR			0x118	/* ... Address Space Register (PPC64) */ | |
| 178 | #define	SPR_EAR			0x11a	/* .68 External Access Register */ | |
| 179 | #define	SPR_PVR			0x11f	/* 468 Processor Version Register */ | |
| 180 | #define	 MPC601		 0x0001 | |
| 181 | #define	 MPC603		 0x0003 | |
| 182 | #define	 MPC604		 0x0004 | |
| 183 | #define	 MPC602		 0x0005 | |
| 184 | #define	 MPC603e		 0x0006 | |
| 185 | #define	 MPC603ev		 0x0007 | |
| 186 | #define	 MPC750		 0x0008 | |
| 187 | #define	 MPC750CL		 0x7000	/* Nintendo Wii's Broadway */ | |
| 188 | #define	 MPC604ev		 0x0009 | |
| 189 | #define	 MPC7400		 0x000c | |
| 190 | #define	 MPC620		 0x0014 | |
| 191 | #define	 IBM403		 0x0020 | |
| 192 | #define	 IBM401A1		 0x0021 | |
| 193 | #define	 IBM401B2		 0x0022 | |
| 194 | #define	 IBM401C2		 0x0023 | |
| 195 | #define	 IBM401D2		 0x0024 | |
| 196 | #define	 IBM401E2		 0x0025 | |
| 197 | #define	 IBM401F2		 0x0026 | |
| 198 | #define	 IBM401G2		 0x0027 | |
| 199 | #define	 IBMRS64II		 0x0033 | |
| 200 | #define	 IBMRS64III		 0x0034 | |
| 201 | #define	 IBMPOWER4		 0x0035 | |
| 202 | #define	 IBMRS64III_2		 0x0036 | |
| 203 | #define	 IBMRS64IV		 0x0037 | |
| 204 | #define	 IBMPOWER4PLUS		 0x0038 | |
| 205 | #define	 IBM970		 0x0039 | |
| 206 | #define	 IBMPOWER5		 0x003a | |
| 207 | #define	 IBMPOWER5PLUS		 0x003b | |
| 208 | #define	 IBM970FX		 0x003c | |
| 209 | #define	 IBMPOWER6		 0x003e | |
| 210 | #define	 IBMPOWER7		 0x003f | |
| 211 | #define	 IBMPOWER3		 0x0040 | |
| 212 | #define	 IBMPOWER3PLUS		 0x0041 | |
| 213 | #define	 IBM970MP		 0x0044 | |
| 214 | #define	 IBM970GX		 0x0045 | |
| 215 | #define	 IBMPOWERPCA2		 0x0049 | |
| 216 | #define	 IBMPOWER7PLUS		 0x004a | |
| 217 | #define	 IBMPOWER8E		 0x004b | |
| 218 | #define	 IBMPOWER8NVL		 0x004c | |
| 219 | #define	 IBMPOWER8		 0x004d | |
| 220 | #define	 IBMPOWER9		 0x004e | |
| 221 | #define	 MPC860		 0x0050 | |
| 222 | #define	 IBMCELLBE		 0x0070 | |
| 223 | #define	 IBMPOWER10		 0x0080 | |
| 224 | #define	 MPC8240		 0x0081 | |
| 225 | #define	 IBMPOWER11		 0x0082 | |
| 226 | #define	 PA6T			 0x0090 | |
| 227 | #define	 IBM405GP		 0x4011 | |
| 228 | #define	 IBM405L		 0x4161 | |
| 229 | #define	 IBM750FX		 0x7000 | |
| 230 | #define	MPC745X_P(v)	((v & 0xFFF8) == 0x8000) | |
| 231 | #define	 MPC7450		 0x8000 | |
| 232 | #define	 MPC7455		 0x8001 | |
| 233 | #define	 MPC7457		 0x8002 | |
| 234 | #define	 MPC7447A		 0x8003 | |
| 235 | #define	 MPC7448		 0x8004 | |
| 236 | #define	 MPC7410		 0x800c | |
| 237 | #define	 MPC8245		 0x8081 | |
| 238 | #define	 FSL_E500v1		 0x8020 | |
| 239 | #define	 FSL_E500v2		 0x8021 | |
| 240 | #define	 FSL_E500mc		 0x8023 | |
| 241 | #define	 FSL_E5500		 0x8024 | |
| 242 | #define	 FSL_E6500		 0x8040 | |
| 243 | #define	 FSL_E300C1		 0x8083 | |
| 244 | #define	 FSL_E300C2		 0x8084 | |
| 245 | #define	 FSL_E300C3		 0x8085 | |
| 246 | #define	 FSL_E300C4		 0x8086 | |
| 247 | ||
| 248 | #define LPCR_PECE_WAKESET (LPCR_PECE_EXT | LPCR_PECE_DECR | LPCR_PECE_ME) | |
| 249 | ||
| 250 | #define	SPR_DBSR		0x130	/* ..8 Debug Status Register */ | |
| 251 | #define	 DBSR_IDE		 0x80000000 /* Imprecise debug event. */ | |
| 252 | #define	 DBSR_UDE		 0x40000000 /* Unconditional debug event. */ | |
| 253 | #define	 DBSR_MRR		 0x30000000 /* Most recent Reset (mask). */ | |
| 254 | #define	 DBSR_ICMP		 0x08000000 /* Instr. complete debug event. */ | |
| 255 | #define	 DBSR_BRT		 0x04000000 /* Branch taken debug event. */ | |
| 256 | #define	 DBSR_IRPT		 0x02000000 /* Interrupt taken debug event. */ | |
| 257 | #define	 DBSR_TRAP		 0x01000000 /* Trap instr. debug event. */ | |
| 258 | #define	 DBSR_IAC1		 0x00800000 /* Instr. address compare #1. */ | |
| 259 | #define	 DBSR_IAC2		 0x00400000 /* Instr. address compare #2. */ | |
| 260 | #define	 DBSR_IAC3		 0x00200000 /* Instr. address compare #3. */ | |
| 261 | #define	 DBSR_IAC4		 0x00100000 /* Instr. address compare #4. */ | |
| 262 | #define	 DBSR_DAC1R		 0x00080000 /* Data addr. read compare #1. */ | |
| 263 | #define	 DBSR_DAC1W		 0x00040000 /* Data addr. write compare #1. */ | |
| 264 | #define	 DBSR_DAC2R		 0x00020000 /* Data addr. read compare #2. */ | |
| 265 | #define	 DBSR_DAC2W		 0x00010000 /* Data addr. write compare #2. */ | |
| 266 | #define	 DBSR_RET		 0x00008000 /* Return debug event. */ | |
| 267 | #define	SPR_EPCR		0x133 | |
| 268 | #define	 EPCR_EXTGS		 0x80000000 | |
| 269 | #define	 EPCR_DTLBGS		 0x40000000 | |
| 270 | #define	 EPCR_ITLBGS		 0x20000000 | |
| 271 | #define	 EPCR_DSIGS		 0x10000000 | |
| 272 | #define	 EPCR_ISIGS		 0x08000000 | |
| 273 | #define	 EPCR_DUVGS		 0x04000000 | |
| 274 | #define	 EPCR_ICM		 0x02000000 | |
| 275 | #define	 EPCR_GICMGS		 0x01000000 | |
| 276 | #define	 EPCR_DGTMI		 0x00800000 | |
| 277 | #define	 EPCR_DMIUH		 0x00400000 | |
| 278 | #define	 EPCR_PMGS		 0x00200000 | |
| 279 | #define	SPR_DBCR0		0x134	/* ..8 Debug Control Register 0 */ | |
| 280 | #define	SPR_DBCR1		0x135	/* ..8 Debug Control Register 1 */ | |
| 281 | #define	SPR_DBCR2		0x136	/* ..8 Debug Control Register 2 */ | |
| 282 | #define	SPR_IAC1		0x138	/* ..8 Instruction Address Compare 1 */ | |
| 283 | #define	SPR_IAC2		0x139	/* ..8 Instruction Address Compare 2 */ | |
| 284 | #define	SPR_IAC3		0x13a	/* ..8 Instruction Address Compare 3 */ | |
| 285 | #define	SPR_IAC4		0x13b	/* ..8 Instruction Address Compare 4 */ | |
| 286 | ||
| 287 | #define	SPR_HSRR0		0x13a | |
| 288 | #define	SPR_HSRR1		0x13b | |
| 289 | #define	SPR_DAC1		0x13c	/* ..8 Data Address Compare 1 */ | |
| 290 | #define	SPR_DAC2		0x13d	/* ..8 Data Address Compare 2 */ | |
| 291 | #define	SPR_DVC1		0x13e	/* ..8 Data Value Compare 1 */ | |
| 292 | #define	SPR_DVC2		0x13f	/* ..8 Data Value Compare 2 */ | |
| 293 | ||
| 294 | #define	SPR_LPCR		0x13e	/* .6. Logical Partitioning Control */ | |
| 295 | #define	 LPCR_LPES		 0x008	/* Bit 60 */ | |
| 296 | #define	 LPCR_HVICE		 0x002	/* Hypervisor Virtualization Interrupt (Arch 3.0) */ | |
| 297 | #define	 LPCR_ILE		 (1ULL << 25) /* Interrupt Little-Endian (ISA 2.07) */ | |
| 298 | #define	 LPCR_UPRT		 (1ULL << 22) /* Use Process Table (ISA 3) */ | |
| 299 | #define	 LPCR_HR		 (1ULL << 20) /* Host Radix mode */ | |
| 300 | #define	 LPCR_PECE_DRBL (1ULL << 16) /* Directed Privileged Doorbell */ | |
| 301 | #define	 LPCR_PECE_HDRBL (1ULL << 15) /* Directed Hypervisor Doorbell */ | |
| 302 | #define	 LPCR_PECE_EXT (1ULL << 14) /* External exceptions */ | |
| 303 | #define	 LPCR_PECE_DECR (1ULL << 13) /* Decrementer exceptions */ | |
| 304 | #define	 LPCR_PECE_ME (1ULL << 12) /* Machine Check and Hypervisor */ | |
| 305 | /* Maintenance exceptions */ | |
| 306 | #define	SPR_LPID		0x13f	/* .6. Logical Partitioning Control */ | |
| 307 | #define	SPR_HMER		0x150	/* Hypervisor Maintenance Exception Register */ | |
| 308 | #define	SPR_HMEER		0x151	/* Hypervisor Maintenance Exception Enable Register */ | |
| 309 | #define	SPR_AMOR		0x15d	/* Authority Mask Override Register */ | |
| 310 | ||
| 311 | #define	SPR_TIR			0x1be	/* .6. Thread Identification Register */ | |
| 312 | #define	SPR_PTCR		0x1d0	/* Partition Table Control Register */ | |
| 313 | #define	SPR_SPEFSCR		0x200	/* ..8 Signal Processing Engine FSCR. */ | |
| 314 | #define	 SPEFSCR_SOVH		 0x80000000 | |
| 315 | #define	 SPEFSCR_OVH		 0x40000000 | |
| 316 | #define	 SPEFSCR_FGH		 0x20000000 | |
| 317 | #define	 SPEFSCR_FXH		 0x10000000 | |
| 318 | #define	 SPEFSCR_FINVH		 0x08000000 | |
| 319 | #define	 SPEFSCR_FDBZH		 0x04000000 | |
| 320 | #define	 SPEFSCR_FUNFH		 0x02000000 | |
| 321 | #define	 SPEFSCR_FOVFH		 0x01000000 | |
| 322 | #define	 SPEFSCR_FINXS		 0x00200000 | |
| 323 | #define	 SPEFSCR_FINVS		 0x00100000 | |
| 324 | #define	 SPEFSCR_FDBZS		 0x00080000 | |
| 325 | #define	 SPEFSCR_FUNFS		 0x00040000 | |
| 326 | #define	 SPEFSCR_FOVFS		 0x00020000 | |
| 327 | #define	 SPEFSCR_SOV		 0x00008000 | |
| 328 | #define	 SPEFSCR_OV		 0x00004000 | |
| 329 | #define	 SPEFSCR_FG		 0x00002000 | |
| 330 | #define	 SPEFSCR_FX		 0x00001000 | |
| 331 | #define	 SPEFSCR_FINV		 0x00000800 | |
| 332 | #define	 SPEFSCR_FDBZ		 0x00000400 | |
| 333 | #define	 SPEFSCR_FUNF		 0x00000200 | |
| 334 | #define	 SPEFSCR_FOVF		 0x00000100 | |
| 335 | #define	 SPEFSCR_FINXE		 0x00000040 | |
| 336 | #define	 SPEFSCR_FINVE		 0x00000020 | |
| 337 | #define	 SPEFSCR_FDBZE		 0x00000010 | |
| 338 | #define	 SPEFSCR_FUNFE		 0x00000008 | |
| 339 | #define	 SPEFSCR_FOVFE		 0x00000004 | |
| 340 | #define	 SPEFSCR_FRMC_M	 0x00000003 | |
| 341 | #define	 SPEFSCR_DFLT		 (SPEFSCR_FINVE | SPEFSCR_FDBZE | \ | |
| 342 | 				 SPEFSCR_FUNFE | SPEFSCR_FOVFE) | |
| 343 | #define	SPR_IBAT0U		0x210	/* .6. Instruction BAT Reg 0 Upper */ | |
| 344 | #define	SPR_IBAT0L		0x211	/* .6. Instruction BAT Reg 0 Lower */ | |
| 345 | #define	SPR_IBAT1U		0x212	/* .6. Instruction BAT Reg 1 Upper */ | |
| 346 | #define	SPR_IBAT1L		0x213	/* .6. Instruction BAT Reg 1 Lower */ | |
| 347 | #define	SPR_IBAT2U		0x214	/* .6. Instruction BAT Reg 2 Upper */ | |
| 348 | #define	SPR_IBAT2L		0x215	/* .6. Instruction BAT Reg 2 Lower */ | |
| 349 | #define	SPR_IBAT3U		0x216	/* .6. Instruction BAT Reg 3 Upper */ | |
| 350 | #define	SPR_IBAT3L		0x217	/* .6. Instruction BAT Reg 3 Lower */ | |
| 351 | #define	SPR_DBAT0U		0x218	/* .6. Data BAT Reg 0 Upper */ | |
| 352 | #define	SPR_DBAT0L		0x219	/* .6. Data BAT Reg 0 Lower */ | |
| 353 | #define	SPR_DBAT1U		0x21a	/* .6. Data BAT Reg 1 Upper */ | |
| 354 | #define	SPR_DBAT1L		0x21b	/* .6. Data BAT Reg 1 Lower */ | |
| 355 | #define	SPR_DBAT2U		0x21c	/* .6. Data BAT Reg 2 Upper */ | |
| 356 | #define	SPR_DBAT2L		0x21d	/* .6. Data BAT Reg 2 Lower */ | |
| 357 | #define	SPR_DBAT3U		0x21e	/* .6. Data BAT Reg 3 Upper */ | |
| 358 | #define	SPR_DBAT3L		0x21f	/* .6. Data BAT Reg 3 Lower */ | |
| 359 | #define	SPR_IBAT4U		0x230	/* .6. Instruction BAT Reg 4 Upper */ | |
| 360 | #define	SPR_DBCR3		0x231	/* ..8 Debug Control Register 3 */ | |
| 361 | #define	SPR_IBAT4L		0x231	/* .6. Instruction BAT Reg 4 Lower */ | |
| 362 | #define	SPR_IBAT5U		0x232	/* .6. Instruction BAT Reg 5 Upper */ | |
| 363 | #define	SPR_IBAT5L		0x233	/* .6. Instruction BAT Reg 5 Lower */ | |
| 364 | #define	SPR_DBCR4		0x233	/* ..8 Debug Control Register 4 */ | |
| 365 | #define	SPR_IBAT6U		0x234	/* .6. Instruction BAT Reg 6 Upper */ | |
| 366 | #define	SPR_DBCR5		0x234	/* ..8 Debug Control Register 5 */ | |
| 367 | #define	SPR_IBAT6L		0x235	/* .6. Instruction BAT Reg 6 Lower */ | |
| 368 | #define	SPR_IAC5		0x235	/* ..8 Instruction Address Compare 5 */ | |
| 369 | #define	SPR_IBAT7U		0x236	/* .6. Instruction BAT Reg 7 Upper */ | |
| 370 | #define	SPR_IAC6		0x236	/* ..8 Instruction Address Compare 6 */ | |
| 371 | #define	SPR_IBAT7L		0x237	/* .6. Instruction BAT Reg 7 Lower */ | |
| 372 | #define	SPR_IAC7		0x237	/* ..8 Instruction Address Compare 7 */ | |
| 373 | #define	SPR_DBAT4U		0x238	/* .6. Data BAT Reg 4 Upper */ | |
| 374 | #define	SPR_IAC8		0x238	/* ..8 Instruction Address Compare 8 */ | |
| 375 | #define	SPR_DBAT4L		0x239	/* .6. Data BAT Reg 4 Lower */ | |
| 376 | #define	SPR_DBAT5U		0x23a	/* .6. Data BAT Reg 5 Upper */ | |
| 377 | #define	SPR_DBAT5L		0x23b	/* .6. Data BAT Reg 5 Lower */ | |
| 378 | #define	SPR_DBAT6U		0x23c	/* .6. Data BAT Reg 6 Upper */ | |
| 379 | #define	SPR_DBAT6L		0x23d	/* .6. Data BAT Reg 6 Lower */ | |
| 380 | #define	SPR_DBAT7U		0x23e	/* .6. Data BAT Reg 7 Upper */ | |
| 381 | #define	SPR_DBAT7L		0x23f	/* .6. Data BAT Reg 7 Lower */ | |
| 382 | #define	SPR_DBCR6		0x25b	/* ..8 Debug Control Register 6 */ | |
| 383 | #define	SPR_SPRG8		0x25c	/* ..8 SPR General 8 */ | |
| 384 | ||
| 385 | #define	SPR_MMCRA		0x312	/* ... Monitor Mode Control Register A */ | |
| 386 | #define	SPR_PMC1		0x313	/* ... PMC 1 */ | |
| 387 | #define	SPR_PMC2		0x314	/* ... PMC 2 */ | |
| 388 | #define	SPR_PMC3		0x315	/* ... PMC 3 */ | |
| 389 | #define	SPR_PMC4		0x316	/* ... PMC 4 */ | |
| 390 | #define	SPR_PMC5		0x317	/* ... PMC 5 */ | |
| 391 | #define	SPR_PMC6		0x318	/* ... PMC 6 */ | |
| 392 | #define	SPR_PMC7		0x319	/* ... PMC 7 */ | |
| 393 | #define	SPR_PMC8		0x31a	/* ... PMC 8 */ | |
| 394 | ||
| 395 | #define	SPR_MMCR0		0x31b	/* ... Monitor Mode Control Register 0 */ | |
| 396 | #define	 SPR_MMCR0_FC		 0x80000000 /* Freeze counters */ | |
| 397 | #define	 SPR_MMCR0_FCS		 0x40000000 /* Freeze counters in supervisor mode */ | |
| 398 | #define	 SPR_MMCR0_FCP		 0x20000000 /* Freeze counters in user mode */ | |
| 399 | #define	 SPR_MMCR0_FCM1	 0x10000000 /* Freeze counters when mark=1 */ | |
| 400 | #define	 SPR_MMCR0_FCM0	 0x08000000 /* Freeze counters when mark=0 */ | |
| 401 | #define	 SPR_MMCR0_PMXE	 0x04000000 /* Enable PM interrupt */ | |
| 402 | #define	 SPR_MMCR0_PMAE	 0x04000000 /* PM Alert Enable */ | |
| 403 | #define	 SPR_MMCR0_FCECE	 0x02000000 /* Freeze counters after event */ | |
| 404 | #define	 SPR_MMCR0_TBSEL_15	 0x01800000 /* Count bit 15 of TBL */ | |
| 405 | #define	 SPR_MMCR0_TBSEL_19	 0x01000000 /* Count bit 19 of TBL */ | |
| 406 | #define	 SPR_MMCR0_TBSEL_23	 0x00800000 /* Count bit 23 of TBL */ | |
| 407 | #define	 SPR_MMCR0_TBSEL_31	 0x00000000 /* Count bit 31 of TBL */ | |
| 408 | #define	 SPR_MMCR0_TBEE	 0x00400000 /* Time-base event enable */ | |
| 409 | #define	 SPR_MMCR0_THRESHOLD(x) ((x) << 16) /* Threshold value */ | |
| 410 | #define	 SPR_MMCR0_PMC1CE	 0x00008000 /* PMC1 condition enable */ | |
| 411 | #define	 SPR_MMCR0_PMCNCE	 0x00004000 /* PMCn condition enable */ | |
| 412 | #define	 SPR_MMCR0_TRIGGER	 0x00002000 /* Trigger */ | |
| 413 | #define	 SPR_MMCR0_PMAO	 0x00000080 /* PM Alert Occurred */ | |
| 414 | #define	 SPR_MMCR0_FCPC	 0x00001000 /* Freeze Counters in Problem State Cond. */ | |
| 415 | #define	 SPR_MMCR0_FC56	 0x00000010 /* Freeze Counters 5-6 */ | |
| 416 | #define	 SPR_MMCR0_PMC1SEL(x)	 ((x) << 8) /* PMC1 selector (970) */ | |
| 417 | #define	 SPR_MMCR0_PMC2SEL(x)	 ((x) << 1) /* PMC2 selector (970) */ | |
| 418 | #define	 SPR_MMCR0_74XX_PMC1SEL(x)	(((x) & 0x3f) << 6) /* PMC1 selector */ | |
| 419 | #define	 SPR_MMCR0_74XX_PMC2SEL(x)	(((x) & 0x3f) << 0) /* PMC2 selector */ | |
| 420 | ||
| 421 | #define	SPR_MMCR1		0x31e	/* ... Monitor Mode Control Register 1 */ | |
| 422 | #define	 SPR_MMCR1_PMC3SEL(x)	 (((x) & 0x1f) << 27) /* PMC 3 selector */ | |
| 423 | #define	 SPR_MMCR1_PMC4SEL(x)	 (((x) & 0x1f) << 22) /* PMC 4 selector */ | |
| 424 | #define	 SPR_MMCR1_PMC5SEL(x)	 (((x) & 0x1f) << 17) /* PMC 5 selector */ | |
| 425 | #define	 SPR_MMCR1_PMC6SEL(x)	 (((x) & 0x1f) << 12) /* PMC 6 selector */ | |
| 426 | #define	 SPR_MMCR1_74XX_PMC6SEL(x)	(((x) & 0x3f) << 11) /* PMC 6 selector */ | |
| 427 | #define	 SPR_MMCR1_PMC7SEL(x)	 (((x) & 0x1f) << 7) /* PMC 7 selector */ | |
| 428 | #define	 SPR_MMCR1_PMC8SEL(x)	 (((x) & 0x1f) << 2) /* PMC 8 selector */ | |
| 429 | #define	 SPR_MMCR1_P8_PMCSEL_ALL	0xffffffff | |
| 430 | #define	 SPR_MMCR1_P8_PMCNSEL_MASK(n)	(0xffUL << ((3-(n))*8)) | |
| 431 | #define	 SPR_MMCR1_P8_PMCNSEL(n, v)	((unsigned long)(v) << ((3-(n))*8)) | |
| 432 | ||
| 433 | #define	SPR_MMCR2		0x311 | |
| 434 | #define	 SPR_MMCR2_CNBIT(n, bit) ((bit) << (((5 - (n)) * 9) + 10)) | |
| 435 | #define	 SPR_MMCR2_FCNS(n)	 SPR_MMCR2_CNBIT(n, 0x100ULL) | |
| 436 | #define	 SPR_MMCR2_FCNP0(n)	 SPR_MMCR2_CNBIT(n, 0x080ULL) | |
| 437 | #define	 SPR_MMCR2_FCNP1(n)	 SPR_MMCR2_CNBIT(n, 0x040ULL) | |
| 438 | #define	 SPR_MMCR2_FCNM1(n)	 SPR_MMCR2_CNBIT(n, 0x020ULL) | |
| 439 | #define	 SPR_MMCR2_FCNM0(n)	 SPR_MMCR2_CNBIT(n, 0x010ULL) | |
| 440 | #define	 SPR_MMCR2_FCNWAIT(n)	 SPR_MMCR2_CNBIT(n, 0x008ULL) | |
| 441 | #define	 SPR_MMCR2_FCNH(n)	 SPR_MMCR2_CNBIT(n, 0x004ULL) | |
| 442 | /* Freeze Counter N in Hypervisor/Supervisor/Problem states */ | |
| 443 | #define	 SPR_MMCR2_FCNHSP(n)					\ | |
| 444 | 		(SPR_MMCR2_FCNS(n) | SPR_MMCR2_FCNP0(n) |	\ | |
| 445 | 		 SPR_MMCR2_FCNP1(n) | SPR_MMCR2_FCNH(n)) | |
| 446 | ||
| 447 | #define	SPR_M_TWB		0x31c	/* ..8 MMU tablewalk base */ | |
| 448 | #define	 M_TWB_L1TB		0xfffff000 /* level-1 translation base */ | |
| 449 | #define	 M_TWB_L1INDX		0x00000ffc /* level-1 index */ | |
| 450 | #define	SPR_MD_TWC		0x31d	/* ..8 DMMU tablewalk control */ | |
| 451 | #define	SPR_MD_RPN		0x31e	/* ..8 DMMU real (phys) page number */ | |
| 452 | #define	SPR_MD_TW		0x31f	/* ..8 MMU tablewalk scratch */ | |
| 453 | #define	SPR_BESCRS		0x320	/* .6. Branch Event Status and Control Set Register */ | |
| 454 | #define	SPR_BESCRSU		0x321	/* .6. Branch Event Status and Control Set Register (upper 32-bit) */ | |
| 455 | #define	SPR_BESCRR		0x322	/* .6. Branch Event Status and Control Reset Register */ | |
| 456 | #define	SPR_BESCRRU		0x323	/* .6. Branch Event Status and Control Register (upper 32-bit) */ | |
| 457 | #define	SPR_EBBHR		0x324	/* .6. Event-based Branch Handler Register */ | |
| 458 | #define	SPR_EBBRR		0x325	/* .6. Event-based Branch Return Register */ | |
| 459 | #define	SPR_BESCR		0x326	/* .6. Branch Event Status and Control Register */ | |
| 460 | #define	SPR_LMRR		0x32d	/* .6. Load Monitored Region Register */ | |
| 461 | #define	SPR_LMSER		0x32e	/* .6. Load Monitored Section Enable Register */ | |
| 462 | #define	SPR_TAR			0x32f	/* .6. Branch Target Address Register */ | |
| 463 | #define	SPR_MI_CAM		0x330	/* ..8 IMMU CAM entry read */ | |
| 464 | #define	SPR_MI_RAM0		0x331	/* ..8 IMMU RAM entry read reg 0 */ | |
| 465 | #define	SPR_MI_RAM1		0x332	/* ..8 IMMU RAM entry read reg 1 */ | |
| 466 | #define	SPR_MD_CAM		0x338	/* ..8 IMMU CAM entry read */ | |
| 467 | #define	SPR_MD_RAM0		0x339	/* ..8 IMMU RAM entry read reg 0 */ | |
| 468 | #define	SPR_MD_RAM1		0x33a	/* ..8 IMMU RAM entry read reg 1 */ | |
| 469 | #define	SPR_PSSCR		0x357	/* Processor Stop Status and Control Register (ISA 3.0) */ | |
| 470 | #define	 PSSCR_PLS_S		 60 | |
| 471 | #define	 PSSCR_PLS_M		 (0xf << PSSCR_PLS_S) | |
| 472 | #define	 PSSCR_SD		 (1 << 22) | |
| 473 | #define	 PSSCR_ESL		 (1 << 21) | |
| 474 | #define	 PSSCR_EC		 (1 << 20) | |
| 475 | #define	 PSSCR_PSLL_S		 16 | |
| 476 | #define	 PSSCR_PSLL_M		 (0xf << PSSCR_PSLL_S) | |
| 477 | #define	 PSSCR_TR_S		 8 | |
| 478 | #define	 PSSCR_TR_M		 (0x3 << PSSCR_TR_S) | |
| 479 | #define	 PSSCR_MTL_S		 4 | |
| 480 | #define	 PSSCR_MTL_M		 (0xf << PSSCR_MTL_S) | |
| 481 | #define	 PSSCR_RL_S		 0 | |
| 482 | #define	 PSSCR_RL_M		 (0xf << PSSCR_RL_S) | |
| 483 | #define	SPR_PMCR 0x374 /* Processor Management Control Register */ | |
| 484 | #define	SPR_UMMCR2		0x3a0	/* .6. User Monitor Mode Control Register 2 */ | |
| 485 | #define	SPR_UMMCR0		0x3a8	/* .6. User Monitor Mode Control Register 0 */ | |
| 486 | #define	SPR_USIA		0x3ab	/* .6. User Sampled Instruction Address */ | |
| 487 | #define	SPR_UMMCR1		0x3ac	/* .6. User Monitor Mode Control Register 1 */ | |
| 488 | #define	SPR_MMCR2_74XX		0x3b0	/* .6. Monitor Mode Control Register 2 */ | |
| 489 | #define	 SPR_MMCR2_74XX_THRESHMULT_32	 0x80000000 /* Multiply MMCR0 threshold by 32 */ | |
| 490 | #define	 SPR_MMCR2_74XX_THRESHMULT_2	 0x00000000 /* Multiply MMCR0 threshold by 2 */ | |
| 491 | #define	SPR_PMC5_74XX		0x3b1	/* .6. Performance Counter Register 5 */ | |
| 492 | #define	SPR_PMC6_74XX		0x3b2	/* .6. Performance Counter Register 6 */ | |
| 493 | #define	SPR_MMCR0_74XX		0x3b8	/* .6. Monitor Mode Control Register 0 */ | |
| 494 | #define	SPR_PMC1_74XX		0x3b9	/* .6. Performance Counter Register 1 */ | |
| 495 | #define	SPR_PMC2_74XX		0x3ba	/* .6. Performance Counter Register 2 */ | |
| 496 | #define	SPR_SIA			0x3bb	/* .6. Sampled Instruction Address */ | |
| 497 | #define	SPR_MMCR1_74XX		0x3bc	/* .6. Monitor Mode Control Register 2 */ | |
| 498 | ||
| 499 | #define	SPR_PMC3_74XX		0x3bd	/* .6. Performance Counter Register 3 */ | |
| 500 | #define	SPR_PMC4_74XX		0x3be	/* .6. Performance Counter Register 4 */ | |
| 501 | #define	SPR_DMISS		0x3d0	/* .68 Data TLB Miss Address Register */ | |
| 502 | #define	SPR_DCMP		0x3d1	/* .68 Data TLB Compare Register */ | |
| 503 | #define	SPR_HASH1		0x3d2	/* .68 Primary Hash Address Register */ | |
| 504 | #define	SPR_HASH2		0x3d3	/* .68 Secondary Hash Address Register */ | |
| 505 | #define	SPR_IMISS		0x3d4	/* .68 Instruction TLB Miss Address Register */ | |
| 506 | #define	SPR_TLBMISS		0x3d4	/* .6. TLB Miss Address Register */ | |
| 507 | #define	SPR_DEAR		0x03d	/* ..8 Data Exception Address Register */ | |
| 508 | #define	SPR_ICMP		0x3d5	/* .68 Instruction TLB Compare Register */ | |
| 509 | #define	SPR_PTEHI		0x3d5	/* .6. Instruction TLB Compare Register */ | |
| 510 | #define	SPR_RPA			0x3d6	/* .68 Required Physical Address Register */ | |
| 511 | #define	SPR_PTELO		0x3d6	/* .6. Required Physical Address Register */ | |
| 512 | ||
| 513 | #define	SPR_TSR			0x150	/* ..8 Timer Status Register */ | |
| 514 | #define	SPR_TCR			0x154	/* ..8 Timer Control Register */ | |
| 515 | ||
| 516 | #define	 TSR_ENW		 0x80000000 /* Enable Next Watchdog */ | |
| 517 | #define	 TSR_WIS		 0x40000000 /* Watchdog Interrupt Status */ | |
| 518 | #define	 TSR_WRS_MASK		 0x30000000 /* Watchdog Reset Status */ | |
| 519 | #define	 TSR_WRS_NONE		 0x00000000 /* No watchdog reset has occurred */ | |
| 520 | #define	 TSR_WRS_CORE		 0x10000000 /* Core reset was forced by the watchdog */ | |
| 521 | #define	 TSR_WRS_CHIP		 0x20000000 /* Chip reset was forced by the watchdog */ | |
| 522 | #define	 TSR_WRS_SYSTEM	 0x30000000 /* System reset was forced by the watchdog */ | |
| 523 | #define	 TSR_PIS		 0x08000000 /* PIT Interrupt Status */ | |
| 524 | #define	 TSR_DIS		 0x08000000 /* Decrementer Interrupt Status */ | |
| 525 | #define	 TSR_FIS		 0x04000000 /* FIT Interrupt Status */ | |
| 526 | ||
| 527 | #define	 TCR_WP_MASK		 0xc0000000 /* Watchdog Period mask */ | |
| 528 | #define	 TCR_WP_2_17		 0x00000000 /* 2**17 clocks */ | |
| 529 | #define	 TCR_WP_2_21		 0x40000000 /* 2**21 clocks */ | |
| 530 | #define	 TCR_WP_2_25		 0x80000000 /* 2**25 clocks */ | |
| 531 | #define	 TCR_WP_2_29		 0xc0000000 /* 2**29 clocks */ | |
| 532 | #define	 TCR_WRC_MASK		 0x30000000 /* Watchdog Reset Control mask */ | |
| 533 | #define	 TCR_WRC_NONE		 0x00000000 /* No watchdog reset */ | |
| 534 | #define	 TCR_WRC_CORE		 0x10000000 /* Core reset */ | |
| 535 | #define	 TCR_WRC_CHIP		 0x20000000 /* Chip reset */ | |
| 536 | #define	 TCR_WRC_SYSTEM	 0x30000000 /* System reset */ | |
| 537 | #define	 TCR_WIE		 0x08000000 /* Watchdog Interrupt Enable */ | |
| 538 | #define	 TCR_PIE		 0x04000000 /* PIT Interrupt Enable */ | |
| 539 | #define	 TCR_DIE		 0x04000000 /* Pecrementer Interrupt Enable */ | |
| 540 | #define	 TCR_FP_MASK		 0x03000000 /* FIT Period */ | |
| 541 | #define	 TCR_FP_2_9		 0x00000000 /* 2**9 clocks */ | |
| 542 | #define	 TCR_FP_2_13		 0x01000000 /* 2**13 clocks */ | |
| 543 | #define	 TCR_FP_2_17		 0x02000000 /* 2**17 clocks */ | |
| 544 | #define	 TCR_FP_2_21		 0x03000000 /* 2**21 clocks */ | |
| 545 | #define	 TCR_FIE		 0x00800000 /* FIT Interrupt Enable */ | |
| 546 | #define	 TCR_ARE		 0x00400000 /* Auto Reload Enable */ | |
| 547 | ||
| 548 | #define	SPR_HID0		0x3f0	/* ..8 Hardware Implementation Register 0 */ | |
| 549 | #define	SPR_HID1		0x3f1	/* ..8 Hardware Implementation Register 1 */ | |
| 550 | #define	SPR_HID2		0x3f3	/* ..8 Hardware Implementation Register 2 */ | |
| 551 | #define	SPR_HID4		0x3f4	/* ..8 Hardware Implementation Register 4 */ | |
| 552 | #define	SPR_HID5		0x3f6	/* ..8 Hardware Implementation Register 5 */ | |
| 553 | #define	SPR_HID6		0x3f9	/* ..8 Hardware Implementation Register 6 */ | |
| 554 | ||
| 555 | #define	SPR_CELL_TSRL		0x380	/* ... Cell BE Thread Status Register */ | |
| 556 | #define	SPR_CELL_TSCR		0x399	/* ... Cell BE Thread Switch Register */ | |
| 557 | ||
| 558 | #if defined(AIM) | |
| 559 | #define	SPR_PIR			0x3ff	/* .6. Processor Identification Register */ | |
| 560 | #elif defined(BOOKE) | |
| 561 | #define	SPR_PIR			0x11e	/* ..8 Processor Identification Register */ | |
| 562 | #endif | |
| 563 | ||
| 564 | #define	 DBCR0_EDM		 0x80000000 /* External Debug Mode */ | |
| 565 | #define	 DBCR0_IDM		 0x40000000 /* Internal Debug Mode */ | |
| 566 | #define	 DBCR0_RST_MASK	 0x30000000 /* ReSeT */ | |
| 567 | #define	 DBCR0_RST_NONE	 0x00000000 /* No action */ | |
| 568 | #define	 DBCR0_RST_CORE	 0x10000000 /* Core reset */ | |
| 569 | #define	 DBCR0_RST_CHIP	 0x20000000 /* Chip reset */ | |
| 570 | #define	 DBCR0_RST_SYSTEM	 0x30000000 /* System reset */ | |
| 571 | #define	 DBCR0_IC		 0x08000000 /* Instruction Completion debug event */ | |
| 572 | #define	 DBCR0_BT		 0x04000000 /* Branch Taken debug event */ | |
| 573 | #define	 DBCR0_EDE		 0x02000000 /* Exception Debug Event */ | |
| 574 | #define	 DBCR0_TDE		 0x01000000 /* Trap Debug Event */ | |
| 575 | #define	 DBCR0_IA1		 0x00800000 /* IAC (Instruction Address Compare) 1 debug event */ | |
| 576 | #define	 DBCR0_IA2		 0x00400000 /* IAC 2 debug event */ | |
| 577 | #define	 DBCR0_IA12		 0x00200000 /* Instruction Address Range Compare 1-2 */ | |
| 578 | #define	 DBCR0_IA12X		 0x00100000 /* IA12 eXclusive */ | |
| 579 | #define	 DBCR0_IA3		 0x00080000 /* IAC 3 debug event */ | |
| 580 | #define	 DBCR0_IA4		 0x00040000 /* IAC 4 debug event */ | |
| 581 | #define	 DBCR0_IA34		 0x00020000 /* Instruction Address Range Compare 3-4 */ | |
| 582 | #define	 DBCR0_IA34X		 0x00010000 /* IA34 eXclusive */ | |
| 583 | #define	 DBCR0_IA12T		 0x00008000 /* Instruction Address Range Compare 1-2 range Toggle */ | |
| 584 | #define	 DBCR0_IA34T		 0x00004000 /* Instruction Address Range Compare 3-4 range Toggle */ | |
| 585 | #define	 DBCR0_FT		 0x00000001 /* Freeze Timers on debug event */ | |
| 586 | ||
| 587 | #define	SPR_IABR		0x3f2	/* ..8 Instruction Address Breakpoint Register 0 */ | |
| 588 | #define	SPR_DABR		0x3f5	/* .6. Data Address Breakpoint Register */ | |
| 589 | #define	SPR_MSSCR0		0x3f6	/* .6. Memory SubSystem Control Register */ | |
| 590 | #define	 MSSCR0_SHDEN		 0x80000000 /* 0: Shared-state enable */ | |
| 591 | #define	 MSSCR0_SHDPEN3	 0x40000000 /* 1: ~SHD[01] signal enable in MEI mode */ | |
| 592 | #define	 MSSCR0_L1INTVEN	 0x38000000 /* 2-4: L1 data cache ~HIT intervention enable */ | |
| 593 | #define	 MSSCR0_L2INTVEN	 0x07000000 /* 5-7: L2 data cache ~HIT intervention enable*/ | |
| 594 | #define	 MSSCR0_DL1HWF		 0x00800000 /* 8: L1 data cache hardware flush */ | |
| 595 | #define	 MSSCR0_MBO		 0x00400000 /* 9: must be one */ | |
| 596 | #define	 MSSCR0_EMODE		 0x00200000 /* 10: MPX bus mode (read-only) */ | |
| 597 | #define	 MSSCR0_ABD		 0x00100000 /* 11: address bus driven (read-only) */ | |
| 598 | #define	 MSSCR0_MBZ		 0x000fffff /* 12-31: must be zero */ | |
| 599 | #define	 MSSCR0_L2PFE		 0x00000003 /* 30-31: L2 prefetch enable */ | |
| 600 | #define	SPR_MSSSR0		0x3f7	/* .6. Memory Subsystem Status Register (MPC745x) */ | |
| 601 | #define	 MSSSR0_L2TAG		 0x00040000 /* 13: L2 tag parity error */ | |
| 602 | #define	 MSSSR0_L2DAT		 0x00020000 /* 14: L2 data parity error */ | |
| 603 | #define	 MSSSR0_L3TAG		 0x00010000 /* 15: L3 tag parity error */ | |
| 604 | #define	 MSSSR0_L3DAT		 0x00008000 /* 16: L3 data parity error */ | |
| 605 | #define	 MSSSR0_APE		 0x00004000 /* 17: Address parity error */ | |
| 606 | #define	 MSSSR0_DPE		 0x00002000 /* 18: Data parity error */ | |
| 607 | #define	 MSSSR0_TEA		 0x00001000 /* 19: Bus transfer error acknowledge */ | |
| 608 | #define	SPR_LDSTCR		0x3f8	/* .6. Load/Store Control Register */ | |
| 609 | #define	SPR_L2PM		0x3f8	/* .6. L2 Private Memory Control Register */ | |
| 610 | #define	SPR_L2CR		0x3f9	/* .6. L2 Control Register */ | |
| 611 | #define	 L2CR_L2E		 0x80000000 /* 0: L2 enable */ | |
| 612 | #define	 L2CR_L2PE		 0x40000000 /* 1: L2 data parity enable */ | |
| 613 | #define	 L2CR_L2SIZ		 0x30000000 /* 2-3: L2 size */ | |
| 614 | #define	 L2SIZ_2M		 0x00000000 | |
| 615 | #define	 L2SIZ_256K		 0x10000000 | |
| 616 | #define	 L2SIZ_512K		 0x20000000 | |
| 617 | #define	 L2SIZ_1M		 0x30000000 | |
| 618 | #define	 L2CR_L2CLK		 0x0e000000 /* 4-6: L2 clock ratio */ | |
| 619 | #define	 L2CLK_DIS		 0x00000000 /* disable L2 clock */ | |
| 620 | #define	 L2CLK_10		 0x02000000 /* core clock / 1 */ | |
| 621 | #define	 L2CLK_15		 0x04000000 /* / 1.5 */ | |
| 622 | #define	 L2CLK_20		 0x08000000 /* / 2 */ | |
| 623 | #define	 L2CLK_25		 0x0a000000 /* / 2.5 */ | |
| 624 | #define	 L2CLK_30		 0x0c000000 /* / 3 */ | |
| 625 | #define	 L2CR_L2RAM		 0x01800000 /* 7-8: L2 RAM type */ | |
| 626 | #define	 L2RAM_FLOWTHRU_BURST	 0x00000000 | |
| 627 | #define	 L2RAM_PIPELINE_BURST	 0x01000000 | |
| 628 | #define	 L2RAM_PIPELINE_LATE	 0x01800000 | |
| 629 | #define	 L2CR_L2DO		 0x00400000 /* 9: L2 data-only. | |
| 630 | 				 Setting this bit disables instruction | |
| 631 | 				 caching. */ | |
| 632 | #define	 L2CR_L2I		 0x00200000 /* 10: L2 global invalidate. */ | |
| 633 | #define	 L2CR_L2IO_7450	 0x00010000 /* 11: L2 instruction-only (MPC745x). */ | |
| 634 | #define	 L2CR_L2CTL		 0x00100000 /* 11: L2 RAM control (ZZ enable). | |
| 635 | 				 Enables automatic operation of the | |
| 636 | 				 L2ZZ (low-power mode) signal. */ | |
| 637 | #define	 L2CR_L2WT		 0x00080000 /* 12: L2 write-through. */ | |
| 638 | #define	 L2CR_L2TS		 0x00040000 /* 13: L2 test support. */ | |
| 639 | #define	 L2CR_L2OH		 0x00030000 /* 14-15: L2 output hold. */ | |
| 640 | #define	 L2CR_L2DO_7450	 0x00010000 /* 15: L2 data-only (MPC745x). */ | |
| 641 | #define	 L2CR_L2SL		 0x00008000 /* 16: L2 DLL slow. */ | |
| 642 | #define	 L2CR_L2DF		 0x00004000 /* 17: L2 differential clock. */ | |
| 643 | #define	 L2CR_L2BYP		 0x00002000 /* 18: L2 DLL bypass. */ | |
| 644 | #define	 L2CR_L2FA		 0x00001000 /* 19: L2 flush assist (for software flush). */ | |
| 645 | #define	 L2CR_L2HWF		 0x00000800 /* 20: L2 hardware flush. */ | |
| 646 | #define	 L2CR_L2IO		 0x00000400 /* 21: L2 instruction-only. */ | |
| 647 | #define	 L2CR_L2CLKSTP		 0x00000200 /* 22: L2 clock stop. */ | |
| 648 | #define	 L2CR_L2DRO		 0x00000100 /* 23: L2DLL rollover checkstop enable. */ | |
| 649 | #define	 L2CR_L2IP		 0x00000001 /* 31: L2 global invalidate in */ | |
| 650 | 					 /* progress (read only). */ | |
| 651 | #define	SPR_L3CR		0x3fa	/* .6. L3 Control Register */ | |
| 652 | #define	 L3CR_L3E		 0x80000000 /* 0: L3 enable */ | |
| 653 | #define	 L3CR_L3PE		 0x40000000 /* 1: L3 data parity enable */ | |
| 654 | #define	 L3CR_L3APE		 0x20000000 | |
| 655 | #define	 L3CR_L3SIZ		 0x10000000 /* 3: L3 size (0=1MB, 1=2MB) */ | |
| 656 | #define	 L3CR_L3CLKEN		 0x08000000 /* 4: Enables L3_CLK[0:1] */ | |
| 657 | #define	 L3CR_L3CLK		 0x03800000 | |
| 658 | #define	 L3CR_L3IO		 0x00400000 | |
| 659 | #define	 L3CR_L3CLKEXT		 0x00200000 | |
| 660 | #define	 L3CR_L3CKSPEXT	 0x00100000 | |
| 661 | #define	 L3CR_L3OH1		 0x00080000 | |
| 662 | #define	 L3CR_L3SPO		 0x00040000 | |
| 663 | #define	 L3CR_L3CKSP		 0x00030000 | |
| 664 | #define	 L3CR_L3PSP		 0x0000e000 | |
| 665 | #define	 L3CR_L3REP		 0x00001000 | |
| 666 | #define	 L3CR_L3HWF		 0x00000800 | |
| 667 | #define	 L3CR_L3I		 0x00000400 /* 21: L3 global invalidate */ | |
| 668 | #define	 L3CR_L3RT		 0x00000300 | |
| 669 | #define	 L3CR_L3NIRCA		 0x00000080 | |
| 670 | #define	 L3CR_L3DO		 0x00000040 | |
| 671 | #define	 L3CR_PMEN		 0x00000004 | |
| 672 | #define	 L3CR_PMSIZ		 0x00000003 | |
| 673 | ||
| 674 | #define	SPR_THRM1		0x3fc	/* .6. Thermal Management Register */ | |
| 675 | #define	SPR_THRM2		0x3fd	/* .6. Thermal Management Register */ | |
| 676 | #define	 SPR_THRM_TIN		 0x80000000 /* Thermal interrupt bit (RO) */ | |
| 677 | #define	 SPR_THRM_TIV		 0x40000000 /* Thermal interrupt valid (RO) */ | |
| 678 | #define	 SPR_THRM_THRESHOLD(x)	 ((x) << 23) /* Thermal sensor threshold */ | |
| 679 | #define	 SPR_THRM_TID		 0x00000004 /* Thermal interrupt direction */ | |
| 680 | #define	 SPR_THRM_TIE		 0x00000002 /* Thermal interrupt enable */ | |
| 681 | #define	 SPR_THRM_VALID		 0x00000001 /* Valid bit */ | |
| 682 | #define	SPR_THRM3		0x3fe	/* .6. Thermal Management Register */ | |
| 683 | #define	 SPR_THRM_TIMER(x)	 ((x) << 1) /* Sampling interval timer */ | |
| 684 | #define	 SPR_THRM_ENABLE	 0x00000001 /* TAU Enable */ | |
| 685 | #define	SPR_FPECR		0x3fe	/* .6. Floating-Point Exception Cause Register */ | |
| 686 | ||
| 687 | /* Time Base Register declarations */ | |
| 688 | #define	TBR_TBL			0x10c	/* 468 Time Base Lower - read */ | |
| 689 | #define	TBR_TBU			0x10d	/* 468 Time Base Upper - read */ | |
| 690 | #define	TBR_TBWL		0x11c	/* 468 Time Base Lower - supervisor, write */ | |
| 691 | #define	TBR_TBWU		0x11d	/* 468 Time Base Upper - supervisor, write */ | |
| 692 | ||
| 693 | /* Performance counter declarations */ | |
| 694 | #define	PMC_OVERFLOW		0x80000000 /* Counter has overflowed */ | |
| 695 | ||
| 696 | /* The first five countable [non-]events are common to many PMC's */ | |
| 697 | #define	PMCN_NONE		 0 /* Count nothing */ | |
| 698 | #define	PMCN_CYCLES		 1 /* Processor cycles */ | |
| 699 | #define	PMCN_ICOMP		 2 /* Instructions completed */ | |
| 700 | #define	PMCN_TBLTRANS		 3 /* TBL bit transitions */ | |
| 701 | #define	PCMN_IDISPATCH		 4 /* Instructions dispatched */ | |
| 702 | ||
| 703 | /* Similar things for the 970 PMC direct counters */ | |
| 704 | #define	PMC970N_NONE		0x8 /* Count nothing */ | |
| 705 | #define	PMC970N_CYCLES		0xf /* Processor cycles */ | |
| 706 | #define	PMC970N_ICOMP		0x9 /* Instructions completed */ | |
| 707 | ||
| 708 | #if defined(BOOKE) | |
| 709 | ||
| 710 | #define	SPR_MCARU		0x239	/* ..8 Machine Check Address register upper bits */ | |
| 711 | #define	SPR_MCSR		0x23c	/* ..8 Machine Check Syndrome register */ | |
| 712 | #define	 MCSR_MCP		 0x80000000 /* Machine check input signal to core */ | |
| 713 | #define	 MCSR_L2MMU_MHIT	 0x08000000 /* L2 MMU simultaneous hit */ | |
| 714 | #define	 MCSR_NMI		 0x00100000 /* Non-maskable interrupt */ | |
| 715 | #define	 MCSR_MAV		 0x00080000 /* MCAR address valid */ | |
| 716 | #define	 MCSR_MEA		 0x00040000 /* MCAR effective address */ | |
| 717 | #define	 MCSR_IF		 0x00010000 /* Instruction fetch error report */ | |
| 718 | #define	 MCSR_LD		 0x00008000 /* Load instruction error report */ | |
| 719 | #define	 MCSR_ST		 0x00004000 /* Store instruction error report */ | |
| 720 | #define	 MCSR_LDG		 0x00002000 /* Guarded load instruction error report */ | |
| 721 | #define	 MCSR_TLBSYNC		 0x00000002 /* Simultaneous TLBSYNC detected */ | |
| 722 | #define	SPR_MCAR		0x23d	/* ..8 Machine Check Address register */ | |
| 723 | ||
| 724 | #define	SPR_ESR			0x003e	/* ..8 Exception Syndrome Register */ | |
| 725 | #define	 ESR_PIL		 0x08000000 /* Program interrupt - illegal */ | |
| 726 | #define	 ESR_PPR		 0x04000000 /* Program interrupt - privileged */ | |
| 727 | #define	 ESR_PTR		 0x02000000 /* Program interrupt - trap */ | |
| 728 | #define	 ESR_ST		 0x00800000 /* Store operation */ | |
| 729 | #define	 ESR_DLK		 0x00200000 /* Data storage, D cache locking */ | |
| 730 | #define	 ESR_ILK		 0x00100000 /* Data storage, I cache locking */ | |
| 731 | #define	 ESR_BO		 0x00020000 /* Data/instruction storage, byte ordering */ | |
| 732 | #define	 ESR_SPE		 0x00000080 /* SPE exception bit */ | |
| 733 | ||
| 734 | #define	SPR_CSRR0		0x03a	/* ..8 58 Critical SRR0 */ | |
| 735 | #define	SPR_CSRR1		0x03b	/* ..8 59 Critical SRR1 */ | |
| 736 | #define	SPR_MCSRR0		0x23a	/* ..8 570 Machine check SRR0 */ | |
| 737 | #define	SPR_MCSRR1		0x23b	/* ..8 571 Machine check SRR1 */ | |
| 738 | #define	SPR_DSRR0		0x23e	/* ..8 574 Debug SRR0<E.ED> */ | |
| 739 | #define	SPR_DSRR1		0x23f	/* ..8 575 Debug SRR1<E.ED> */ | |
| 740 | ||
| 741 | #define	SPR_MMUCSR0		0x3f4	/* ..8 1012 MMU Control and Status Register 0 */ | |
| 742 | #define	 MMUCSR0_L2TLB0_FI	0x04	/* TLB0 flash invalidate */ | |
| 743 | #define	 MMUCSR0_L2TLB1_FI	0x02	/* TLB1 flash invalidate */ | |
| 744 | ||
| 745 | #define	SPR_SVR			0x3ff	/* ..8 1023 System Version Register */ | |
| 746 | #define	 SVR_MPC8533		 0x8034 | |
| 747 | #define	 SVR_MPC8533E		 0x803c | |
| 748 | #define	 SVR_MPC8541		 0x8072 | |
| 749 | #define	 SVR_MPC8541E		 0x807a | |
| 750 | #define	 SVR_MPC8548		 0x8031 | |
| 751 | #define	 SVR_MPC8548E		 0x8039 | |
| 752 | #define	 SVR_MPC8555		 0x8071 | |
| 753 | #define	 SVR_MPC8555E		 0x8079 | |
| 754 | #define	 SVR_MPC8572		 0x80e0 | |
| 755 | #define	 SVR_MPC8572E		 0x80e8 | |
| 756 | #define	 SVR_P1011		 0x80e5 | |
| 757 | #define	 SVR_P1011E		 0x80ed | |
| 758 | #define	 SVR_P1013		 0x80e7 | |
| 759 | #define	 SVR_P1013E		 0x80ef | |
| 760 | #define	 SVR_P1020		 0x80e4 | |
| 761 | #define	 SVR_P1020E		 0x80ec | |
| 762 | #define	 SVR_P1022		 0x80e6 | |
| 763 | #define	 SVR_P1022E		 0x80ee | |
| 764 | #define	 SVR_P2010		 0x80e3 | |
| 765 | #define	 SVR_P2010E		 0x80eb | |
| 766 | #define	 SVR_P2020		 0x80e2 | |
| 767 | #define	 SVR_P2020E		 0x80ea | |
| 768 | #define	 SVR_P2041		 0x8210 | |
| 769 | #define	 SVR_P2041E		 0x8218 | |
| 770 | #define	 SVR_P3041		 0x8211 | |
| 771 | #define	 SVR_P3041E		 0x8219 | |
| 772 | #define	 SVR_P4040		 0x8200 | |
| 773 | #define	 SVR_P4040E		 0x8208 | |
| 774 | #define	 SVR_P4080		 0x8201 | |
| 775 | #define	 SVR_P4080E		 0x8209 | |
| 776 | #define	 SVR_P5010		 0x8221 | |
| 777 | #define	 SVR_P5010E		 0x8229 | |
| 778 | #define	 SVR_P5020		 0x8220 | |
| 779 | #define	 SVR_P5020E		 0x8228 | |
| 780 | #define	 SVR_P5021		 0x8205 | |
| 781 | #define	 SVR_P5021E		 0x820d | |
| 782 | #define	 SVR_P5040		 0x8204 | |
| 783 | #define	 SVR_P5040E		 0x820c | |
| 784 | #define	SVR_VER(svr)		(((svr) >> 16) & 0xffff) | |
| 785 | ||
| 786 | #define	SPR_PID0		0x030	/* ..8 Process ID Register 0 */ | |
| 787 | #define	SPR_PID1		0x279	/* ..8 Process ID Register 1 */ | |
| 788 | #define	SPR_PID2		0x27a	/* ..8 Process ID Register 2 */ | |
| 789 | ||
| 790 | #define	SPR_TLB0CFG		0x2B0	/* ..8 TLB 0 Config Register */ | |
| 791 | #define	SPR_TLB1CFG		0x2B1	/* ..8 TLB 1 Config Register */ | |
| 792 | #define	 TLBCFG_ASSOC_MASK	0xff000000 /* Associativity of TLB */ | |
| 793 | #define	 TLBCFG_ASSOC_SHIFT	24 | |
| 794 | #define	 TLBCFG_NENTRY_MASK	0x00000fff /* Number of entries in TLB */ | |
| 795 | ||
| 796 | #define	SPR_IVPR		0x03f	/* ..8 Interrupt Vector Prefix Register */ | |
| 797 | #define	SPR_IVOR0		0x190	/* ..8 Critical input */ | |
| 798 | #define	SPR_IVOR1		0x191	/* ..8 Machine check */ | |
| 799 | #define	SPR_IVOR2		0x192 | |
| 800 | #define	SPR_IVOR3		0x193 | |
| 801 | #define	SPR_IVOR4		0x194 | |
| 802 | #define	SPR_IVOR5		0x195 | |
| 803 | #define	SPR_IVOR6		0x196 | |
| 804 | #define	SPR_IVOR7		0x197 | |
| 805 | #define	SPR_IVOR8		0x198 | |
| 806 | #define	SPR_IVOR9		0x199 | |
| 807 | #define	SPR_IVOR10		0x19a | |
| 808 | #define	SPR_IVOR11		0x19b | |
| 809 | #define	SPR_IVOR12		0x19c | |
| 810 | #define	SPR_IVOR13		0x19d | |
| 811 | #define	SPR_IVOR14		0x19e | |
| 812 | #define	SPR_IVOR15		0x19f | |
| 813 | #define	SPR_IVOR32		0x210 | |
| 814 | #define	SPR_IVOR33		0x211 | |
| 815 | #define	SPR_IVOR34		0x212 | |
| 816 | #define	SPR_IVOR35		0x213 | |
| 817 | ||
| 818 | #define	SPR_MAS0		0x270	/* ..8 MMU Assist Register 0 Book-E/e500 */ | |
| 819 | #define	SPR_MAS1		0x271	/* ..8 MMU Assist Register 1 Book-E/e500 */ | |
| 820 | #define	SPR_MAS2		0x272	/* ..8 MMU Assist Register 2 Book-E/e500 */ | |
| 821 | #define	SPR_MAS3		0x273	/* ..8 MMU Assist Register 3 Book-E/e500 */ | |
| 822 | #define	SPR_MAS4		0x274	/* ..8 MMU Assist Register 4 Book-E/e500 */ | |
| 823 | #define	SPR_MAS5		0x275	/* ..8 MMU Assist Register 5 Book-E */ | |
| 824 | #define	SPR_MAS6		0x276	/* ..8 MMU Assist Register 6 Book-E/e500 */ | |
| 825 | #define	SPR_MAS7		0x3B0	/* ..8 MMU Assist Register 7 Book-E/e500 */ | |
| 826 | #define	SPR_MAS8		0x155	/* ..8 MMU Assist Register 8 Book-E/e500 */ | |
| 827 | ||
| 828 | #define	SPR_L1CFG0		0x203	/* ..8 L1 cache configuration register 0 */ | |
| 829 | #define	SPR_L1CFG1		0x204	/* ..8 L1 cache configuration register 1 */ | |
| 830 | ||
| 831 | #define	SPR_CCR1		0x378 | |
| 832 | #define	 CCR1_L2COBE		0x00000040 | |
| 833 | ||
| 834 | #define	DCR_L2DCDCRAI		0x0000	/* L2 D-Cache DCR Address Pointer */ | |
| 835 | #define	DCR_L2DCDCRDI		0x0001	/* L2 D-Cache DCR Data Indirect */ | |
| 836 | #define	DCR_L2CR0		0x00	/* L2 Cache Configuration Register 0 */ | |
| 837 | #define	 L2CR0_AS		0x30000000 | |
| 838 | ||
| 839 | #define	SPR_L1CSR0		0x3F2	/* ..8 L1 Cache Control and Status Register 0 */ | |
| 840 | #define	 L1CSR0_DCPE		0x00010000	/* Data Cache Parity Enable */ | |
| 841 | #define	 L1CSR0_DCLFR		0x00000100	/* Data Cache Lock Bits Flash Reset */ | |
| 842 | #define	 L1CSR0_DCFI		0x00000002	/* Data Cache Flash Invalidate */ | |
| 843 | #define	 L1CSR0_DCE		0x00000001	/* Data Cache Enable */ | |
| 844 | #define	SPR_L1CSR1		0x3F3	/* ..8 L1 Cache Control and Status Register 1 */ | |
| 845 | #define	 L1CSR1_ICPE		0x00010000	/* Instruction Cache Parity Enable */ | |
| 846 | #define	 L1CSR1_ICUL		0x00000400 /* Instr Cache Unable to Lock */ | |
| 847 | #define	 L1CSR1_ICLFR		0x00000100	/* Instruction Cache Lock Bits Flash Reset */ | |
| 848 | #define	 L1CSR1_ICFI		0x00000002	/* Instruction Cache Flash Invalidate */ | |
| 849 | #define	 L1CSR1_ICE		0x00000001	/* Instruction Cache Enable */ | |
| 850 | ||
| 851 | #define	SPR_L2CFG0		0x207	/* ..8 L2 Configuration Register 0 */ | |
| 852 | #define	SPR_L2CSR0		0x3F9	/* ..8 L2 Cache Control and Status Register 0 */ | |
| 853 | #define	 L2CSR0_L2E		0x80000000	/* L2 Cache Enable */ | |
| 854 | #define	 L2CSR0_L2PE		0x40000000	/* L2 Cache Parity Enable */ | |
| 855 | #define	 L2CSR0_L2FI		0x00200000	/* L2 Cache Flash Invalidate */ | |
| 856 | #define	 L2CSR0_L2LFC		0x00000400	/* L2 Cache Lock Flags Clear */ | |
| 857 | ||
| 858 | #define	SPR_BUCSR		0x3F5	/* ..8 Branch Unit Control and Status Register */ | |
| 859 | #define	 BUCSR_BPEN		0x00000001	/* Branch Prediction Enable */ | |
| 860 | #define	 BUCSR_BBFI		0x00000200	/* Branch Buffer Flash Invalidate */ | |
| 861 | ||
| 862 | #endif /* BOOKE */ | |
| 863 | #endif /* !_POWERPC_SPR_H_ */ | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/machine/sr.h deleted-62| ... | ... | @@ -1,62 +0,0 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-2-Clause | |
| 3 | * | |
| 4 | * Copyright (C) 2002 Benno Rice. | |
| 5 | * All rights reserved. | |
| 6 | * | |
| 7 | * Redistribution and use in source and binary forms, with or without | |
| 8 | * modification, are permitted provided that the following conditions | |
| 9 | * are met: | |
| 10 | * 1. Redistributions of source code must retain the above copyright | |
| 11 | * notice, this list of conditions and the following disclaimer. | |
| 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 13 | * notice, this list of conditions and the following disclaimer in the | |
| 14 | * documentation and/or other materials provided with the distribution. | |
| 15 | * | |
| 16 | * THIS SOFTWARE IS PROVIDED BY Benno Rice ``AS IS'' AND ANY EXPRESS OR | |
| 17 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |
| 18 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | |
| 19 | * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
| 20 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | |
| 21 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; | |
| 22 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | |
| 23 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | |
| 24 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | |
| 25 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 26 | */ | |
| 27 | ||
| 28 | #ifndef _MACHINE_SR_H_ | |
| 29 | #define	_MACHINE_SR_H_ | |
| 30 | ||
| 31 | /* | |
| 32 | * Bit definitions for segment registers. | |
| 33 | * | |
| 34 | * PowerPC Microprocessor Family: The Programming Environments for 32-bit | |
| 35 | * Microprocessors, section 2.3.5 | |
| 36 | */ | |
| 37 | ||
| 38 | #define	SR_TYPE		0x80000000	/* Type selector */ | |
| 39 | #define	SR_KS		0x40000000	/* Supervisor-state protection key */ | |
| 40 | #define	SR_KP		0x20000000	/* User-state protection key */ | |
| 41 | #define	SR_N		0x10000000	/* No-execute protection */ | |
| 42 | #define	SR_VSID_MASK	0x00ffffff	/* Virtual Segment ID mask */ | |
| 43 | ||
| 44 | /* Kernel segment register usage */ | |
| 45 | #define	USER_SR		12 | |
| 46 | #define	KERNEL_SR	13 | |
| 47 | #define	KERNEL2_SR	14 | |
| 48 | #define	KERNEL3_SR	15 | |
| 49 | #define	KERNEL_VSIDBITS	0xfffffUL | |
| 50 | #define	KERNEL_SEGMENT	(0xfffff0 + KERNEL_SR) | |
| 51 | #define	KERNEL2_SEGMENT	(0xfffff0 + KERNEL2_SR) | |
| 52 | #define	EMPTY_SEGMENT	0xfffff0 | |
| 53 | #ifdef __powerpc64__ | |
| 54 | #define	USER_ADDR	0xc00ffffff0000000UL | |
| 55 | #else | |
| 56 | #define	USER_ADDR	((uintptr_t)USER_SR << ADDR_SR_SHFT) | |
| 57 | #endif | |
| 58 | #define	SEGMENT_LENGTH	0x10000000UL | |
| 59 | #define	SEGMENT_INVMASK	0x0fffffffUL | |
| 60 | #define	SEGMENT_MASK	~SEGMENT_INVMASK | |
| 61 | ||
| 62 | #endif /* !_MACHINE_SR_H_ */ | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/machine/stack.h deleted-54| ... | ... | @@ -1,54 +0,0 @@ |
| 1 | /*- | |
| 2 | * Mach Operating System | |
| 3 | * Copyright (c) 1992 Carnegie Mellon University | |
| 4 | * All Rights Reserved. | |
| 5 | * | |
| 6 | * Permission to use, copy, modify and distribute this software and its | |
| 7 | * documentation is hereby granted, provided that both the copyright | |
| 8 | * notice and this permission notice appear in all copies of the | |
| 9 | * software, derivative works or modified versions, and any portions | |
| 10 | * thereof, and that both notices appear in supporting documentation. | |
| 11 | * | |
| 12 | * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" | |
| 13 | * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR | |
| 14 | * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. | |
| 15 | * | |
| 16 | * Carnegie Mellon requests users of this software to return to | |
| 17 | * | |
| 18 | * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU | |
| 19 | * School of Computer Science | |
| 20 | * Carnegie Mellon University | |
| 21 | * Pittsburgh PA 15213-3890 | |
| 22 | * | |
| 23 | * any improvements or extensions that they make and grant Carnegie Mellon | |
| 24 | * the rights to redistribute these changes. | |
| 25 | */ | |
| 26 | ||
| 27 | #ifndef _MACHINE_STACK_H_ | |
| 28 | #define	_MACHINE_STACK_H_ | |
| 29 | ||
| 30 | extern int trapexit[]; | |
| 31 | extern int asttrapexit[]; | |
| 32 | extern int end[]; | |
| 33 | ||
| 34 | #ifdef _SYS_PROC_H_ | |
| 35 | ||
| 36 | #include <machine/pcb.h> | |
| 37 | ||
| 38 | /* Get the current kernel thread stack usage. */ | |
| 39 | #define	GET_STACK_USAGE(total, used) do {				\ | |
| 40 | 	struct thread *td = curthread;					\ | |
| 41 | 	(total) = td->td_kstack_pages * PAGE_SIZE - sizeof(struct pcb);	\ | |
| 42 | 	(used) = td->td_kstack + (total) - (vm_offset_t)&td;		\ | |
| 43 | } while (0) | |
| 44 | ||
| 45 | static __inline bool | |
| 46 | kstack_contains(struct thread *td, vm_offset_t va, size_t len) | |
| 47 | { | |
| 48 | 	return (va >= td->td_kstack && va + len >= va && | |
| 49 | 	 va + len <= td->td_kstack + td->td_kstack_pages * PAGE_SIZE - | |
| 50 | 	 sizeof(struct pcb)); | |
| 51 | } | |
| 52 | #endif	/* _SYS_PROC_H_ */ | |
| 53 | ||
| 54 | #endif /* !_MACHINE_STACK_H_ */ | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/machine/sysarch.h+2-40| ... | ... | @@ -1,43 +1,5 @@ |
| 1 | 1 | /*- |
| 2 | * SPDX-License-Identifier: BSD-3-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 1993 The Regents of the University of California. | |
| 5 | * All rights reserved. | |
| 6 | * | |
| 7 | * Redistribution and use in source and binary forms, with or without | |
| 8 | * modification, are permitted provided that the following conditions | |
| 9 | * are met: | |
| 10 | * 1. Redistributions of source code must retain the above copyright | |
| 11 | * notice, this list of conditions and the following disclaimer. | |
| 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 13 | * notice, this list of conditions and the following disclaimer in the | |
| 14 | * documentation and/or other materials provided with the distribution. | |
| 15 | * 3. Neither the name of the University nor the names of its contributors | |
| 16 | * may be used to endorse or promote products derived from this software | |
| 17 | * without specific prior written permission. | |
| 18 | * | |
| 19 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | |
| 20 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 21 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
| 22 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
| 23 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
| 24 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
| 25 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
| 26 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
| 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
| 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
| 29 | * SUCH DAMAGE. | |
| 2 | * This file is in the public domain. | |
| 30 | 3 | */ |
| 31 | 4 | |
| 32 | #ifndef _MACHINE_SYSARCH_H_ | |
| 33 | #define	_MACHINE_SYSARCH_H_ | |
| 34 | ||
| 35 | #ifndef _KERNEL | |
| 36 | #include <sys/cdefs.h> | |
| 37 | ||
| 38 | __BEGIN_DECLS | |
| 39 | int	sysarch(int, void *); | |
| 40 | __END_DECLS | |
| 41 | #endif | |
| 42 | ||
| 43 | #endif /* !_MACHINE_SYSARCH_H_ */ | |
| \ No newline at end of file | ||
| 5 | #include <x86/sysarch.h> | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/machine/tlb.h deleted-181| ... | ... | @@ -1,181 +0,0 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-3-Clause | |
| 3 | * | |
| 4 | * Copyright (C) 2006-2012 Semihalf. | |
| 5 | * All rights reserved. | |
| 6 | * | |
| 7 | * Redistribution and use in source and binary forms, with or without | |
| 8 | * modification, are permitted provided that the following conditions | |
| 9 | * are met: | |
| 10 | * 1. Redistributions of source code must retain the above copyright | |
| 11 | * notice, this list of conditions and the following disclaimer. | |
| 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 13 | * notice, this list of conditions and the following disclaimer in the | |
| 14 | * documentation and/or other materials provided with the distribution. | |
| 15 | * 3. The name of the author may not be used to endorse or promote products | |
| 16 | * derived from this software without specific prior written permission. | |
| 17 | * | |
| 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | |
| 19 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |
| 20 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN | |
| 21 | * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
| 22 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED | |
| 23 | * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | |
| 24 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF | |
| 25 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | |
| 26 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | |
| 27 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 28 | */ | |
| 29 | ||
| 30 | #ifndef	_MACHINE_TLB_H_ | |
| 31 | #define	_MACHINE_TLB_H_ | |
| 32 | ||
| 33 | #if defined(BOOKE_E500) | |
| 34 | ||
| 35 | /* PowerPC E500 MAS registers */ | |
| 36 | #define MAS0_TLBSEL(x)		((x << 28) & 0x10000000) | |
| 37 | #define MAS0_ESEL(x)		((x << 16) & 0x003F0000) | |
| 38 | ||
| 39 | #define MAS0_TLBSEL1		0x10000000 | |
| 40 | #define MAS0_TLBSEL0		0x00000000 | |
| 41 | #define MAS0_ESEL_TLB1MASK	0x000F0000 | |
| 42 | #define MAS0_ESEL_TLB0MASK	0x00030000 | |
| 43 | #define MAS0_ESEL_SHIFT		16 | |
| 44 | #define MAS0_NV_MASK		0x00000003 | |
| 45 | #define MAS0_NV_SHIFT		0 | |
| 46 | ||
| 47 | #define MAS1_VALID		0x80000000 | |
| 48 | #define MAS1_IPROT		0x40000000 | |
| 49 | #define MAS1_TID_MASK		0x00FF0000 | |
| 50 | #define MAS1_TID_SHIFT		16 | |
| 51 | #define MAS1_TS_MASK		0x00001000 | |
| 52 | #define MAS1_TS_SHIFT		12 | |
| 53 | #define MAS1_TSIZE_MASK		0x00000F00 | |
| 54 | #define MAS1_TSIZE_SHIFT	8 | |
| 55 | ||
| 56 | #define	TLB_SIZE_4K		1 | |
| 57 | #define	TLB_SIZE_16K		2 | |
| 58 | #define	TLB_SIZE_64K		3 | |
| 59 | #define	TLB_SIZE_256K		4 | |
| 60 | #define	TLB_SIZE_1M		5 | |
| 61 | #define	TLB_SIZE_4M		6 | |
| 62 | #define	TLB_SIZE_16M		7 | |
| 63 | #define	TLB_SIZE_64M		8 | |
| 64 | #define	TLB_SIZE_256M		9 | |
| 65 | #define	TLB_SIZE_1G		10 | |
| 66 | #define	TLB_SIZE_4G		11 | |
| 67 | ||
| 68 | #ifdef __powerpc64__ | |
| 69 | #define	MAS2_EPN_MASK		0xFFFFFFFFFFFFF000UL | |
| 70 | #else | |
| 71 | #define	MAS2_EPN_MASK		0xFFFFF000 | |
| 72 | #endif | |
| 73 | #define	MAS2_EPN_SHIFT		12 | |
| 74 | #define	MAS2_X0			0x00000040 | |
| 75 | #define	MAS2_X1			0x00000020 | |
| 76 | #define	MAS2_W			0x00000010 | |
| 77 | #define	MAS2_I			0x00000008 | |
| 78 | #define	MAS2_M			0x00000004 | |
| 79 | #define	MAS2_G			0x00000002 | |
| 80 | #define	MAS2_E			0x00000001 | |
| 81 | #define	MAS2_WIMGE_MASK		0x0000007F | |
| 82 | ||
| 83 | #define	MAS3_RPN		0xFFFFF000 | |
| 84 | #define	MAS3_RPN_SHIFT		12 | |
| 85 | #define	MAS3_U0			0x00000200 | |
| 86 | #define	MAS3_U1			0x00000100 | |
| 87 | #define	MAS3_U2			0x00000080 | |
| 88 | #define	MAS3_U3			0x00000040 | |
| 89 | #define	MAS3_UX			0x00000020 | |
| 90 | #define	MAS3_SX			0x00000010 | |
| 91 | #define	MAS3_UW			0x00000008 | |
| 92 | #define	MAS3_SW			0x00000004 | |
| 93 | #define	MAS3_UR			0x00000002 | |
| 94 | #define	MAS3_SR			0x00000001 | |
| 95 | ||
| 96 | #define MAS4_TLBSELD1		0x10000000 | |
| 97 | #define MAS4_TLBSELD0		0x00000000 | |
| 98 | #define MAS4_TIDSELD_MASK	0x00030000 | |
| 99 | #define MAS4_TIDSELD_SHIFT	16 | |
| 100 | #define MAS4_TSIZED_MASK	0x00000F00 | |
| 101 | #define MAS4_TSIZED_SHIFT	8 | |
| 102 | #define MAS4_X0D		0x00000040 | |
| 103 | #define MAS4_X1D		0x00000020 | |
| 104 | #define MAS4_WD			0x00000010 | |
| 105 | #define MAS4_ID			0x00000008 | |
| 106 | #define MAS4_MD			0x00000004 | |
| 107 | #define MAS4_GD			0x00000002 | |
| 108 | #define MAS4_ED			0x00000001 | |
| 109 | ||
| 110 | #define MAS6_SPID0_MASK		0x00FF0000 | |
| 111 | #define MAS6_SPID0_SHIFT	16 | |
| 112 | #define MAS6_SAS		0x00000001 | |
| 113 | ||
| 114 | #define MAS7_RPN		0x0000000F | |
| 115 | ||
| 116 | #define MAS1_GETTID(mas1)	(((mas1) & MAS1_TID_MASK) >> MAS1_TID_SHIFT) | |
| 117 | ||
| 118 | #define MAS2_TLB0_ENTRY_IDX_MASK	0x0007f000 | |
| 119 | #define MAS2_TLB0_ENTRY_IDX_SHIFT	12 | |
| 120 | ||
| 121 | /* | |
| 122 | * Maximum number of TLB1 entries used for a permanent mapping of kernel | |
| 123 | * region (kernel image plus statically allocated data). | |
| 124 | */ | |
| 125 | #define KERNEL_REGION_MAX_TLB_ENTRIES 4 | |
| 126 | ||
| 127 | /* | |
| 128 | * Use MAS2_X0 to mark entries which will be copied | |
| 129 | * to AP CPUs during SMP bootstrap. As result entries | |
| 130 | * marked with _TLB_ENTRY_SHARED will be shared by all CPUs. | |
| 131 | */ | |
| 132 | #define _TLB_ENTRY_SHARED	(MAS2_X0)	/* XXX under SMP? */ | |
| 133 | #define _TLB_ENTRY_IO	(MAS2_I | MAS2_G) | |
| 134 | #define _TLB_ENTRY_MEM	(MAS2_M) | |
| 135 | ||
| 136 | #define TLB1_MAX_ENTRIES	64 | |
| 137 | ||
| 138 | #if !defined(LOCORE) | |
| 139 | typedef struct tlb_entry { | |
| 140 | 	vm_paddr_t phys; | |
| 141 | 	vm_offset_t virt; | |
| 142 | 	vm_size_t size; | |
| 143 | 	uint32_t mas1; | |
| 144 | #ifdef __powerpc64__ | |
| 145 | 	uint64_t mas2; | |
| 146 | #else | |
| 147 | 	uint32_t mas2; | |
| 148 | #endif | |
| 149 | 	uint32_t mas3; | |
| 150 | 	uint32_t mas7; | |
| 151 | } tlb_entry_t; | |
| 152 | ||
| 153 | void tlb1_inval_entry(unsigned int); | |
| 154 | void tlb1_init(void); | |
| 155 | #endif /* !LOCORE */ | |
| 156 | ||
| 157 | #endif /* BOOKE_E500 */ | |
| 158 | ||
| 159 | #define TID_KERNEL	0	/* TLB TID to use for kernel (shared) translations */ | |
| 160 | #define TID_KRESERVED	1	/* Number of TIDs reserved for kernel */ | |
| 161 | #define TID_URESERVED	0	/* Number of TIDs reserved for user */ | |
| 162 | #define TID_MIN		(TID_KRESERVED + TID_URESERVED) | |
| 163 | #define TID_MAX		255 | |
| 164 | #define TID_NONE	-1 | |
| 165 | ||
| 166 | #define TLB_UNLOCKED	0 | |
| 167 | ||
| 168 | #if !defined(LOCORE) | |
| 169 | ||
| 170 | typedef int tlbtid_t; | |
| 171 | ||
| 172 | struct pmap; | |
| 173 | ||
| 174 | void tlb_lock(uintptr_t *); | |
| 175 | void tlb_unlock(uintptr_t *); | |
| 176 | void tlb1_ap_prep(void); | |
| 177 | int tlb1_set_entry(vm_offset_t, vm_paddr_t, vm_size_t, uint32_t); | |
| 178 | ||
| 179 | #endif /* !LOCORE */ | |
| 180 | ||
| 181 | #endif	/* _MACHINE_TLB_H_ */ | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/machine/tls.h+2-63| ... | ... | @@ -1,66 +1,5 @@ |
| 1 | 1 | /*- |
| 2 | * SPDX-License-Identifier: BSD-3-Clause | |
| 3 | * | |
| 4 | * Copyright 2004 by Peter Grehan. All rights reserved. | |
| 5 | * | |
| 6 | * Redistribution and use in source and binary forms, with or without | |
| 7 | * modification, are permitted provided that the following conditions | |
| 8 | * are met: | |
| 9 | * 1. Redistributions of source code must retain the above copyright | |
| 10 | * notice, this list of conditions and the following disclaimer. | |
| 11 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 12 | * notice, this list of conditions and the following disclaimer in the | |
| 13 | * documentation and/or other materials provided with the distribution. | |
| 14 | * 3. The name of the author may not be used to endorse or promote products | |
| 15 | * derived from this software without specific prior written permission. | |
| 16 | * | |
| 17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | |
| 18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |
| 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | |
| 20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | |
| 21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, | |
| 22 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | |
| 23 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED | |
| 24 | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | |
| 25 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
| 26 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
| 27 | * SUCH DAMAGE. | |
| 2 | * This file is in the public domain. | |
| 28 | 3 | */ |
| 29 | 4 | |
| 30 | #ifndef _MACHINE_TLS_H_ | |
| 31 | #define	_MACHINE_TLS_H_ | |
| 32 | ||
| 33 | #include <sys/_tls_variant_i.h> | |
| 34 | ||
| 35 | #define	TLS_DTV_OFFSET	0x8000 | |
| 36 | #define	TLS_TCB_ALIGN	TLS_TCB_SIZE | |
| 37 | #define	TLS_TP_OFFSET	0x7000 | |
| 38 | ||
| 39 | static __inline void | |
| 40 | _tcb_set(struct tcb *tcb) | |
| 41 | { | |
| 42 | #ifdef __powerpc64__ | |
| 43 | 	__asm __volatile("mr 13,%0" :: | |
| 44 | 	 "r" ((uint8_t *)tcb + TLS_TP_OFFSET + TLS_TCB_SIZE)); | |
| 45 | #else | |
| 46 | 	__asm __volatile("mr 2,%0" :: | |
| 47 | 	 "r" ((uint8_t *)tcb + TLS_TP_OFFSET + TLS_TCB_SIZE)); | |
| 48 | #endif | |
| 49 | } | |
| 50 | ||
| 51 | static __inline struct tcb * | |
| 52 | _tcb_get(void) | |
| 53 | { | |
| 54 | 	struct tcb *tcb; | |
| 55 | ||
| 56 | #ifdef __powerpc64__ | |
| 57 | 	__asm __volatile("addi %0,13,%1" : "=r" (tcb) : | |
| 58 | 	 "i" (-(TLS_TP_OFFSET + TLS_TCB_SIZE))); | |
| 59 | #else | |
| 60 | 	__asm __volatile("addi %0,2,%1" : "=r" (tcb) : | |
| 61 | 	 "i" (-(TLS_TP_OFFSET + TLS_TCB_SIZE))); | |
| 62 | #endif | |
| 63 | 	return (tcb); | |
| 64 | } | |
| 65 | ||
| 66 | #endif /* !_MACHINE_TLS_H_ */ | |
| \ No newline at end of file | ||
| 5 | #include <x86/tls.h> | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/machine/trap.h+2-157| ... | ... | @@ -1,160 +1,5 @@ |
| 1 | 1 | /*- |
| 2 | * SPDX-License-Identifier: BSD-4-Clause | |
| 3 | * | |
| 4 | * Copyright (C) 1995, 1996 Wolfgang Solfrank. | |
| 5 | * Copyright (C) 1995, 1996 TooLs GmbH. | |
| 6 | * All rights reserved. | |
| 7 | * | |
| 8 | * Redistribution and use in source and binary forms, with or without | |
| 9 | * modification, are permitted provided that the following conditions | |
| 10 | * are met: | |
| 11 | * 1. Redistributions of source code must retain the above copyright | |
| 12 | * notice, this list of conditions and the following disclaimer. | |
| 13 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 14 | * notice, this list of conditions and the following disclaimer in the | |
| 15 | * documentation and/or other materials provided with the distribution. | |
| 16 | * 3. All advertising materials mentioning features or use of this software | |
| 17 | * must display the following acknowledgement: | |
| 18 | *	This product includes software developed by TooLs GmbH. | |
| 19 | * 4. The name of TooLs GmbH may not be used to endorse or promote products | |
| 20 | * derived from this software without specific prior written permission. | |
| 21 | * | |
| 22 | * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR | |
| 23 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |
| 24 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | |
| 25 | * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
| 26 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | |
| 27 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; | |
| 28 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | |
| 29 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | |
| 30 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | |
| 31 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 32 | * | |
| 33 | * $NetBSD: trap.h,v 1.7 2002/02/22 13:51:40 kleink Exp $ | |
| 2 | * This file is in the public domain. | |
| 34 | 3 | */ |
| 35 | 4 | |
| 36 | #ifndef	_POWERPC_TRAP_H_ | |
| 37 | #define	_POWERPC_TRAP_H_ | |
| 38 | ||
| 39 | #define	EXC_RSVD	0x0000		/* Reserved */ | |
| 40 | #define	EXC_RST		0x0100		/* Reset; all but IBM4xx */ | |
| 41 | #define	EXC_MCHK	0x0200		/* Machine Check */ | |
| 42 | #define	EXC_DSI		0x0300		/* Data Storage Interrupt */ | |
| 43 | #define	EXC_DSE		0x0380		/* Data Segment Interrupt */ | |
| 44 | #define	EXC_ISI		0x0400		/* Instruction Storage Interrupt */ | |
| 45 | #define	EXC_ISE		0x0480		/* Instruction Segment Interrupt */ | |
| 46 | #define	EXC_EXI		0x0500		/* External Interrupt */ | |
| 47 | #define	EXC_ALI		0x0600		/* Alignment Interrupt */ | |
| 48 | #define	EXC_PGM		0x0700		/* Program Interrupt */ | |
| 49 | #define	EXC_FPU		0x0800		/* Floating-point Unavailable */ | |
| 50 | #define	EXC_DECR	0x0900		/* Decrementer Interrupt */ | |
| 51 | #define	EXC_SC		0x0c00		/* System Call */ | |
| 52 | #define	EXC_TRC		0x0d00		/* Trace */ | |
| 53 | #define	EXC_FPA		0x0e00		/* Floating-point Assist */ | |
| 54 | ||
| 55 | /* The following is only available on the 601: */ | |
| 56 | #define	EXC_RUNMODETRC	0x2000		/* Run Mode/Trace Exception */ | |
| 57 | ||
| 58 | /* The following are only available on 970(G5): */ | |
| 59 | #define	EXC_VECAST_G5	0x1700		/* AltiVec Assist */ | |
| 60 | ||
| 61 | /* The following are only available on 7400(G4): */ | |
| 62 | #define	EXC_VEC		0x0f20		/* AltiVec Unavailable */ | |
| 63 | #define	EXC_VECAST_G4	0x1600		/* AltiVec Assist */ | |
| 64 | ||
| 65 | /* The following are only available on 604/750/7400: */ | |
| 66 | #define	EXC_PERF	0x0f00		/* Performance Monitoring */ | |
| 67 | #define	EXC_BPT		0x1300		/* Instruction Breakpoint */ | |
| 68 | #define	EXC_SMI		0x1400		/* System Managment Interrupt */ | |
| 69 | ||
| 70 | /* The following are only available on 750/7400: */ | |
| 71 | #define	EXC_THRM	0x1700		/* Thermal Management Interrupt */ | |
| 72 | ||
| 73 | /* And these are only on the 603: */ | |
| 74 | #define	EXC_IMISS	0x1000		/* Instruction translation miss */ | |
| 75 | #define	EXC_DLMISS	0x1100		/* Data load translation miss */ | |
| 76 | #define	EXC_DSMISS	0x1200		/* Data store translation miss */ | |
| 77 | ||
| 78 | /* Power ISA 2.06+: */ | |
| 79 | #define	EXC_HDSI	0x0e00		/* Hypervisor Data Storage */ | |
| 80 | #define	EXC_HISI	0x0e20		/* Hypervisor Instruction Storage */ | |
| 81 | #define	EXC_HEA		0x0e40		/* Hypervisor Emulation Assistance */ | |
| 82 | #define	EXC_HMI		0x0e60		/* Hypervisor Maintenance */ | |
| 83 | #define	EXC_VSX		0x0f40		/* VSX Unavailable */ | |
| 84 | ||
| 85 | /* Power ISA 2.07+: */ | |
| 86 | #define	EXC_FAC		0x0f60		/* Facility Unavailable */ | |
| 87 | #define	EXC_HFAC	0x0f80		/* Hypervisor Facility Unavailable */ | |
| 88 | ||
| 89 | /* Power ISA 3.0+: */ | |
| 90 | #define	EXC_HVI		0x0ea0		/* Hypervisor Virtualization */ | |
| 91 | ||
| 92 | /* The following are available on 4xx and 85xx */ | |
| 93 | #define	EXC_CRIT	0x0100		/* Critical Input Interrupt */ | |
| 94 | #define	EXC_PIT		0x1000		/* Programmable Interval Timer */ | |
| 95 | #define	EXC_FIT		0x1010		/* Fixed Interval Timer */ | |
| 96 | #define	EXC_WDOG	0x1020		/* Watchdog Timer */ | |
| 97 | #define	EXC_DTMISS	0x1100		/* Data TLB Miss */ | |
| 98 | #define	EXC_ITMISS	0x1200		/* Instruction TLB Miss */ | |
| 99 | #define	EXC_APU		0x1300		/* Auxiliary Processing Unit */ | |
| 100 | #define	EXC_DEBUG	0x2f10		/* Debug trap */ | |
| 101 | #define	EXC_VECAST_E	0x2f20		/* Altivec Assist (Book-E) */ | |
| 102 | #define	EXC_SPFPD	0x2f30		/* SPE Floating-point Data */ | |
| 103 | #define	EXC_SPFPR	0x2f40		/* SPE Floating-point Round */ | |
| 104 | ||
| 105 | /* POWER8 */ | |
| 106 | #define EXC_SOFT_PATCH	0x1500		/* POWER8 Soft Patch Exception */ | |
| 107 | ||
| 108 | #define	EXC_LAST	0x2f00		/* Last possible exception vector */ | |
| 109 | ||
| 110 | #define	EXC_AST		0x3000		/* Fake AST vector */ | |
| 111 | ||
| 112 | /* Trap was in user mode */ | |
| 113 | #define	EXC_USER	0x10000 | |
| 114 | ||
| 115 | /* | |
| 116 | * EXC_ALI sets bits in the DSISR and DAR to provide enough | |
| 117 | * information to recover from the unaligned access without needing to | |
| 118 | * parse the offending instruction. This includes certain bits of the | |
| 119 | * opcode, and information about what registers are used. The opcode | |
| 120 | * indicator values below come from Appendix F of Book III of "The | |
| 121 | * PowerPC Architecture". | |
| 122 | */ | |
| 123 | ||
| 124 | #define EXC_ALI_OPCODE_INDICATOR(dsisr) ((dsisr >> 10) & 0x7f) | |
| 125 | #define EXC_ALI_LFD	0x09 | |
| 126 | #define EXC_ALI_STFD	0x0b | |
| 127 | ||
| 128 | /* Macros to extract register information */ | |
| 129 | #define EXC_ALI_RST(dsisr) ((dsisr >> 5) & 0x1f) /* source or target */ | |
| 130 | #define EXC_ALI_RA(dsisr) (dsisr & 0x1f) | |
| 131 | #define	EXC_ALI_INST_RST(instr)	((instr >> 21) & 0x1f) | |
| 132 | ||
| 133 | /* | |
| 134 | * SRR1 bits for program exception traps. These identify what caused | |
| 135 | * the program exception. See section 6.5.9 of the Power ISA Version | |
| 136 | * 2.05. | |
| 137 | */ | |
| 138 | ||
| 139 | #define	EXC_PGM_FPENABLED	(1UL << 20) | |
| 140 | #define	EXC_PGM_ILLEGAL		(1UL << 19) | |
| 141 | #define	EXC_PGM_PRIV		(1UL << 18) | |
| 142 | #define	EXC_PGM_TRAP		(1UL << 17) | |
| 143 | ||
| 144 | /* DTrace trap opcode. */ | |
| 145 | #define EXC_DTRACE	0x7ffff808 | |
| 146 | ||
| 147 | /* Magic pointer to store TOC base and other info for trap handlers on ppc64 */ | |
| 148 | #define	TRAP_ENTRY	0x1e8 | |
| 149 | #define	TRAP_GENTRAP	0x1f0 | |
| 150 | #define	TRAP_TOCBASE	0x1f8 | |
| 151 | ||
| 152 | #ifndef LOCORE | |
| 153 | struct	trapframe; | |
| 154 | struct	thread; | |
| 155 | extern int	(*hmi_handler)(struct trapframe *); | |
| 156 | void trap(struct trapframe *); | |
| 157 | int	ppc_instr_emulate(struct trapframe *, struct thread *); | |
| 158 | #endif | |
| 159 | ||
| 160 | #endif	/* _POWERPC_TRAP_H_ */ | |
| \ No newline at end of file | ||
| 5 | #include <x86/trap.h> | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/machine/ucontext.h deleted-91| ... | ... | @@ -1,91 +0,0 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-4-Clause | |
| 3 | * | |
| 4 | * Copyright (C) 1995, 1996 Wolfgang Solfrank. | |
| 5 | * Copyright (C) 1995, 1996 TooLs GmbH. | |
| 6 | * All rights reserved. | |
| 7 | * | |
| 8 | * Redistribution and use in source and binary forms, with or without | |
| 9 | * modification, are permitted provided that the following conditions | |
| 10 | * are met: | |
| 11 | * 1. Redistributions of source code must retain the above copyright | |
| 12 | * notice, this list of conditions and the following disclaimer. | |
| 13 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 14 | * notice, this list of conditions and the following disclaimer in the | |
| 15 | * documentation and/or other materials provided with the distribution. | |
| 16 | * 3. All advertising materials mentioning features or use of this software | |
| 17 | * must display the following acknowledgement: | |
| 18 | *	This product includes software developed by TooLs GmbH. | |
| 19 | * 4. The name of TooLs GmbH may not be used to endorse or promote products | |
| 20 | * derived from this software without specific prior written permission. | |
| 21 | * | |
| 22 | * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR | |
| 23 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |
| 24 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | |
| 25 | * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
| 26 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | |
| 27 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; | |
| 28 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | |
| 29 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | |
| 30 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | |
| 31 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 32 | * | |
| 33 | * $NetBSD: signal.h,v 1.4 1998/09/14 02:48:34 thorpej Exp $ | |
| 34 | */ | |
| 35 | ||
| 36 | #ifndef	_MACHINE_UCONTEXT_H_ | |
| 37 | #define	_MACHINE_UCONTEXT_H_ | |
| 38 | ||
| 39 | typedef struct __mcontext { | |
| 40 | 	int		mc_vers; | |
| 41 | 	int		mc_flags; | |
| 42 | #define _MC_FP_VALID	0x01 | |
| 43 | #define _MC_AV_VALID	0x02 | |
| 44 | 	int		mc_onstack;	 	/* saved onstack flag */ | |
| 45 | 	int		mc_len;			/* sizeof(__mcontext) */ | |
| 46 | 	__uint64_t	mc_avec[32*2];		/* vector register file */ | |
| 47 | 	__uint32_t	mc_av[2]; | |
| 48 | 	__register_t	mc_frame[42]; | |
| 49 | 	__uint64_t	mc_fpreg[33]; | |
| 50 | 	__uint64_t	mc_vsxfpreg[32];	/* low-order half of VSR0-31 */ | |
| 51 | } mcontext_t __aligned(16); | |
| 52 | ||
| 53 | #if defined(_KERNEL) && defined(__powerpc64__) | |
| 54 | typedef struct __mcontext32 { | |
| 55 | 	int		mc_vers; | |
| 56 | 	int		mc_flags; | |
| 57 | #define _MC_FP_VALID	0x01 | |
| 58 | #define _MC_AV_VALID	0x02 | |
| 59 | 	int		mc_onstack;	 	/* saved onstack flag */ | |
| 60 | 	int		mc_len;			/* sizeof(__mcontext) */ | |
| 61 | 	uint64_t	mc_avec[32*2];		/* vector register file */ | |
| 62 | 	uint32_t	mc_av[2]; | |
| 63 | 	uint32_t	mc_frame[42]; | |
| 64 | 	uint64_t	mc_fpreg[33]; | |
| 65 | 	uint64_t	mc_vsxfpreg[32];	/* low-order half of VSR0-31 */ | |
| 66 | } mcontext32_t __aligned(16); | |
| 67 | #endif | |
| 68 | ||
| 69 | /* GPRs and supervisor-level regs */ | |
| 70 | #define mc_gpr		mc_frame | |
| 71 | #define mc_lr		mc_frame[32] | |
| 72 | #define mc_cr		mc_frame[33] | |
| 73 | #define mc_xer		mc_frame[34] | |
| 74 | #define	mc_ctr		mc_frame[35] | |
| 75 | #define mc_srr0		mc_frame[36] | |
| 76 | #define mc_srr1		mc_frame[37] | |
| 77 | #define mc_exc		mc_frame[38] | |
| 78 | #define mc_dar		mc_frame[39] | |
| 79 | #define mc_dsisr	mc_frame[40] | |
| 80 | ||
| 81 | /* floating-point state */ | |
| 82 | #define mc_fpscr	mc_fpreg[32] | |
| 83 | ||
| 84 | /* altivec state */ | |
| 85 | #define mc_vscr		mc_av[0] | |
| 86 | #define mc_vrsave	mc_av[1] | |
| 87 | ||
| 88 | #define _MC_VERSION	0x1 | |
| 89 | #define _MC_VERSION_KSE 0xee	/* partial ucontext for libpthread */ | |
| 90 | ||
| 91 | #endif	/* !_MACHINE_UCONTEXT_H_ */ | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/machine/vdso.h+2-40| ... | ... | @@ -1,43 +1,5 @@ |
| 1 | 1 | /*- |
| 2 | * SPDX-License-Identifier: BSD-2-Clause | |
| 3 | * | |
| 4 | * Copyright 2012 Konstantin Belousov <kib@FreeBSD.ORG>. | |
| 5 | * All rights reserved. | |
| 6 | * | |
| 7 | * Redistribution and use in source and binary forms, with or without | |
| 8 | * modification, are permitted provided that the following conditions | |
| 9 | * are met: | |
| 10 | * 1. Redistributions of source code must retain the above copyright | |
| 11 | * notice, this list of conditions and the following disclaimer. | |
| 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 13 | * notice, this list of conditions and the following disclaimer in the | |
| 14 | * documentation and/or other materials provided with the distribution. | |
| 15 | * | |
| 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | |
| 17 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |
| 18 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | |
| 19 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | |
| 20 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | |
| 21 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
| 22 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
| 23 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
| 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | |
| 25 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 2 | * This file is in the public domain. | |
| 26 | 3 | */ |
| 27 | 4 | |
| 28 | #ifndef _POWERPC_VDSO_H | |
| 29 | #define	_POWERPC_VDSO_H | |
| 30 | ||
| 31 | #define	VDSO_TIMEHANDS_MD			\ | |
| 32 | 	uint32_t	th_res[8]; | |
| 33 | ||
| 34 | #define	VDSO_TH_ALGO_PPC_TB	VDSO_TH_ALGO_1 | |
| 35 | ||
| 36 | #ifdef _KERNEL | |
| 37 | #ifdef COMPAT_FREEBSD32 | |
| 38 | ||
| 39 | #define	VDSO_TIMEHANDS_MD32	VDSO_TIMEHANDS_MD | |
| 40 | ||
| 41 | #endif | |
| 42 | #endif | |
| 43 | #endif | |
| \ No newline at end of file | ||
| 5 | #include <x86/vdso.h> | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/machine/vm.h+11-10| ... | ... | @@ -1,7 +1,8 @@ |
| 1 | 1 | /*- |
| 2 | 2 | * SPDX-License-Identifier: BSD-2-Clause |
| 3 | 3 | * |
| 4 | * Copyright (c) 2009 Alan L. Cox <alc@cs.rice.edu> | |
| 4 | * Copyright (c) 2009 Hudson River Trading LLC | |
| 5 | * Written by: John H. Baldwin <jhb@FreeBSD.org> | |
| 5 | 6 | * All rights reserved. |
| 6 | 7 | * |
| 7 | 8 | * Redistribution and use in source and binary forms, with or without |
| ... | ... | @@ -29,17 +30,17 @@ |
| 29 | 30 | #ifndef _MACHINE_VM_H_ |
| 30 | 31 | #define	_MACHINE_VM_H_ |
| 31 | 32 | |
| 32 | #include <machine/pte.h> | |
| 33 | #include <machine/specialreg.h> | |
| 33 | 34 | |
| 34 | 35 | /* Memory attributes. */ |
| 35 | #define	VM_MEMATTR_DEFAULT		0 | |
| 36 | #define	VM_MEMATTR_UNCACHEABLE		0x01 | |
| 37 | #define	VM_MEMATTR_CACHEABLE		0x02 | |
| 38 | #define	VM_MEMATTR_WRITE_COMBINING	0x04 | |
| 39 | #define	VM_MEMATTR_WRITE_BACK		0x08 | |
| 40 | #define	VM_MEMATTR_WRITE_THROUGH	0x10 | |
| 41 | #define	VM_MEMATTR_PREFETCHABLE		0x20 | |
| 36 | #define	VM_MEMATTR_UNCACHEABLE		((vm_memattr_t)PAT_UNCACHEABLE) | |
| 37 | #define	VM_MEMATTR_WRITE_COMBINING	((vm_memattr_t)PAT_WRITE_COMBINING) | |
| 38 | #define	VM_MEMATTR_WRITE_THROUGH	((vm_memattr_t)PAT_WRITE_THROUGH) | |
| 39 | #define	VM_MEMATTR_WRITE_PROTECTED	((vm_memattr_t)PAT_WRITE_PROTECTED) | |
| 40 | #define	VM_MEMATTR_WRITE_BACK		((vm_memattr_t)PAT_WRITE_BACK) | |
| 41 | #define	VM_MEMATTR_WEAK_UNCACHEABLE	((vm_memattr_t)PAT_UNCACHED) | |
| 42 | 42 | |
| 43 | #define	VM_MEMATTR_DEVICE		VM_MEMATTR_DEFAULT | |
| 43 | #define	VM_MEMATTR_DEFAULT		VM_MEMATTR_WRITE_BACK | |
| 44 | #define	VM_MEMATTR_DEVICE		VM_MEMATTR_UNCACHEABLE | |
| 44 | 45 | |
| 45 | 46 | #endif /* !_MACHINE_VM_H_ */ |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/machine/vmm_snapshot.h created+1| ... | ... | @@ -0,0 +1 @@ |
| 1 | /* $FreeBSD$ */ | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/machine/vmparam.h deleted-329| ... | ... | @@ -1,329 +0,0 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-4-Clause | |
| 3 | * | |
| 4 | * Copyright (C) 1995, 1996 Wolfgang Solfrank. | |
| 5 | * Copyright (C) 1995, 1996 TooLs GmbH. | |
| 6 | * All rights reserved. | |
| 7 | * | |
| 8 | * Redistribution and use in source and binary forms, with or without | |
| 9 | * modification, are permitted provided that the following conditions | |
| 10 | * are met: | |
| 11 | * 1. Redistributions of source code must retain the above copyright | |
| 12 | * notice, this list of conditions and the following disclaimer. | |
| 13 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 14 | * notice, this list of conditions and the following disclaimer in the | |
| 15 | * documentation and/or other materials provided with the distribution. | |
| 16 | * 3. All advertising materials mentioning features or use of this software | |
| 17 | * must display the following acknowledgement: | |
| 18 | *	This product includes software developed by TooLs GmbH. | |
| 19 | * 4. The name of TooLs GmbH may not be used to endorse or promote products | |
| 20 | * derived from this software without specific prior written permission. | |
| 21 | * | |
| 22 | * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR | |
| 23 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |
| 24 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | |
| 25 | * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
| 26 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | |
| 27 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; | |
| 28 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | |
| 29 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | |
| 30 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | |
| 31 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 32 | * | |
| 33 | *	$NetBSD: vmparam.h,v 1.11 2000/02/11 19:25:16 thorpej Exp $ | |
| 34 | */ | |
| 35 | ||
| 36 | #ifndef _MACHINE_VMPARAM_H_ | |
| 37 | #define	_MACHINE_VMPARAM_H_ | |
| 38 | ||
| 39 | #ifndef LOCORE | |
| 40 | #include <machine/md_var.h> | |
| 41 | #endif | |
| 42 | ||
| 43 | #define	USRSTACK	SHAREDPAGE | |
| 44 | ||
| 45 | #ifndef	MAXTSIZ | |
| 46 | #define	MAXTSIZ		(1*1024*1024*1024)		/* max text size */ | |
| 47 | #endif | |
| 48 | ||
| 49 | #ifndef	DFLDSIZ | |
| 50 | #define	DFLDSIZ		(128*1024*1024)		/* default data size */ | |
| 51 | #endif | |
| 52 | ||
| 53 | #ifndef	MAXDSIZ | |
| 54 | #ifdef __powerpc64__ | |
| 55 | #define	MAXDSIZ		(32UL*1024*1024*1024)	/* max data size */ | |
| 56 | #else | |
| 57 | #define	MAXDSIZ		(1*1024*1024*1024)	/* max data size */ | |
| 58 | #endif | |
| 59 | #endif | |
| 60 | ||
| 61 | #ifndef	DFLSSIZ | |
| 62 | #define	DFLSSIZ		(8*1024*1024)		/* default stack size */ | |
| 63 | #endif | |
| 64 | ||
| 65 | #ifndef	MAXSSIZ | |
| 66 | #ifdef __powerpc64__ | |
| 67 | #define	MAXSSIZ		(512*1024*1024)		/* max stack size */ | |
| 68 | #else | |
| 69 | #define	MAXSSIZ		(64*1024*1024)		/* max stack size */ | |
| 70 | #endif | |
| 71 | #endif | |
| 72 | ||
| 73 | #ifdef AIM | |
| 74 | #define	VM_MAXUSER_ADDRESS32	0xfffff000 | |
| 75 | #else | |
| 76 | #define	VM_MAXUSER_ADDRESS32	0x7ffff000 | |
| 77 | #endif | |
| 78 | ||
| 79 | /* | |
| 80 | * Would like to have MAX addresses = 0, but this doesn't (currently) work | |
| 81 | */ | |
| 82 | #ifdef __powerpc64__ | |
| 83 | /* | |
| 84 | * Virtual addresses of things. Derived from the page directory and | |
| 85 | * page table indexes from pmap.h for precision. | |
| 86 | * | |
| 87 | * kernel map should be able to start at 0xc008000000000000 - | |
| 88 | * but at least the functional simulator doesn't like it | |
| 89 | * | |
| 90 | * 0x0000000000000000 - 0x000fffffffffffff user map | |
| 91 | * 0xc000000000000000 - 0xc007ffffffffffff direct map | |
| 92 | * 0xc008000000000000 - 0xc00fffffffffffff kernel map | |
| 93 | * | |
| 94 | */ | |
| 95 | #define	VM_MIN_ADDRESS		0x0000000000000000 | |
| 96 | #define	VM_MAXUSER_ADDRESS	0x000fffffc0000000 | |
| 97 | #define	VM_MAX_ADDRESS		0xc00fffffffffffff | |
| 98 | #define	VM_MIN_KERNEL_ADDRESS	0xc008000000000000 | |
| 99 | #define	VM_MAX_KERNEL_ADDRESS	0xc0080007ffffffff | |
| 100 | #define	VM_MAX_SAFE_KERNEL_ADDRESS	VM_MAX_KERNEL_ADDRESS | |
| 101 | #else | |
| 102 | #define	VM_MIN_ADDRESS		0 | |
| 103 | #define	VM_MAXUSER_ADDRESS	VM_MAXUSER_ADDRESS32 | |
| 104 | #define	VM_MAX_ADDRESS		0xffffffff | |
| 105 | #endif | |
| 106 | ||
| 107 | #define	SHAREDPAGE		(VM_MAXUSER_ADDRESS - PAGE_SIZE) | |
| 108 | ||
| 109 | #define	FREEBSD32_SHAREDPAGE	(VM_MAXUSER_ADDRESS32 - PAGE_SIZE) | |
| 110 | #define	FREEBSD32_USRSTACK	FREEBSD32_SHAREDPAGE | |
| 111 | ||
| 112 | #define	KERNBASE		0x00100100	/* start of kernel virtual */ | |
| 113 | ||
| 114 | #ifdef AIM | |
| 115 | #ifndef __powerpc64__ | |
| 116 | #define	VM_MIN_KERNEL_ADDRESS	((vm_offset_t)KERNEL_SR << ADDR_SR_SHFT) | |
| 117 | #define	VM_MAX_SAFE_KERNEL_ADDRESS (VM_MIN_KERNEL_ADDRESS + 2*SEGMENT_LENGTH -1) | |
| 118 | #define	VM_MAX_KERNEL_ADDRESS	(VM_MIN_KERNEL_ADDRESS + 3*SEGMENT_LENGTH - 1) | |
| 119 | #endif | |
| 120 | ||
| 121 | /* | |
| 122 | * Use the direct-mapped BAT registers for UMA small allocs. This | |
| 123 | * takes pressure off the small amount of available KVA. | |
| 124 | */ | |
| 125 | #define UMA_MD_SMALL_ALLOC | |
| 126 | ||
| 127 | #else /* Book-E */ | |
| 128 | ||
| 129 | /* Use the direct map for UMA small allocs on powerpc64. */ | |
| 130 | #ifdef __powerpc64__ | |
| 131 | #define UMA_MD_SMALL_ALLOC | |
| 132 | #else | |
| 133 | #define	VM_MIN_KERNEL_ADDRESS		0xc0000000 | |
| 134 | #define	VM_MAX_KERNEL_ADDRESS		0xffffefff | |
| 135 | #define	VM_MAX_SAFE_KERNEL_ADDRESS	VM_MAX_KERNEL_ADDRESS | |
| 136 | #endif | |
| 137 | ||
| 138 | #endif /* AIM/E500 */ | |
| 139 | ||
| 140 | #if !defined(LOCORE) | |
| 141 | struct pmap_physseg { | |
| 142 | 	struct pv_entry *pvent; | |
| 143 | 	char *attrs; | |
| 144 | }; | |
| 145 | #endif | |
| 146 | ||
| 147 | #ifdef __powerpc64__ | |
| 148 | #define	VM_PHYSSEG_MAX		63	/* 1? */ | |
| 149 | #else | |
| 150 | #define	VM_PHYSSEG_MAX		16	/* 1? */ | |
| 151 | #endif | |
| 152 | ||
| 153 | #define	PHYS_AVAIL_SZ	256	/* Allows up to 16GB Ram on pSeries with | |
| 154 | 				 * logical memory block size of 64MB. | |
| 155 | 				 * For more Ram increase the lmb or this value. | |
| 156 | 				 */ | |
| 157 | ||
| 158 | /* XXX This is non-sensical. Phys avail should hold contiguous regions. */ | |
| 159 | #define	PHYS_AVAIL_ENTRIES	PHYS_AVAIL_SZ | |
| 160 | ||
| 161 | /* | |
| 162 | * The physical address space is densely populated on 32-bit systems, | |
| 163 | * but may not be on 64-bit ones. | |
| 164 | */ | |
| 165 | #ifdef __powerpc64__ | |
| 166 | #define	VM_PHYSSEG_SPARSE | |
| 167 | #else | |
| 168 | #define	VM_PHYSSEG_DENSE | |
| 169 | #endif | |
| 170 | ||
| 171 | /* | |
| 172 | * Create two free page pools: VM_FREEPOOL_DEFAULT is the default pool | |
| 173 | * from which physical pages are allocated and VM_FREEPOOL_DIRECT is | |
| 174 | * the pool from which physical pages for small UMA objects are | |
| 175 | * allocated. | |
| 176 | */ | |
| 177 | #define	VM_NFREEPOOL		2 | |
| 178 | #define	VM_FREEPOOL_DEFAULT	0 | |
| 179 | #define	VM_FREEPOOL_DIRECT	1 | |
| 180 | ||
| 181 | /* | |
| 182 | * Create one free page list. | |
| 183 | */ | |
| 184 | #define	VM_NFREELIST		1 | |
| 185 | #define	VM_FREELIST_DEFAULT	0 | |
| 186 | ||
| 187 | #ifdef __powerpc64__ | |
| 188 | /* The largest allocation size is 16MB. */ | |
| 189 | #define	VM_NFREEORDER		13 | |
| 190 | #else | |
| 191 | /* The largest allocation size is 4MB. */ | |
| 192 | #define	VM_NFREEORDER		11 | |
| 193 | #endif | |
| 194 | ||
| 195 | #ifndef	VM_NRESERVLEVEL | |
| 196 | #ifdef __powerpc64__ | |
| 197 | /* Enable superpage reservations: 1 level. */ | |
| 198 | #define	VM_NRESERVLEVEL		1 | |
| 199 | #else | |
| 200 | /* Disable superpage reservations. */ | |
| 201 | #define	VM_NRESERVLEVEL		0 | |
| 202 | #endif | |
| 203 | #endif | |
| 204 | ||
| 205 | #ifndef	VM_LEVEL_0_ORDER | |
| 206 | /* Level 0 reservations consist of 512 (RPT) or 4096 (HPT) pages. */ | |
| 207 | #define	VM_LEVEL_0_ORDER	vm_level_0_order | |
| 208 | #ifndef	__ASSEMBLER__ | |
| 209 | extern	int vm_level_0_order; | |
| 210 | #endif | |
| 211 | #endif | |
| 212 | ||
| 213 | #ifndef	VM_LEVEL_0_ORDER_MAX | |
| 214 | #define	VM_LEVEL_0_ORDER_MAX	12 | |
| 215 | #endif | |
| 216 | ||
| 217 | #ifdef __powerpc64__ | |
| 218 | #ifdef	SMP | |
| 219 | #define	PA_LOCK_COUNT	256 | |
| 220 | #endif | |
| 221 | #endif | |
| 222 | ||
| 223 | #ifndef VM_INITIAL_PAGEIN | |
| 224 | #define	VM_INITIAL_PAGEIN	16 | |
| 225 | #endif | |
| 226 | ||
| 227 | #ifndef SGROWSIZ | |
| 228 | #define	SGROWSIZ	(128UL*1024)		/* amount to grow stack */ | |
| 229 | #endif | |
| 230 | ||
| 231 | /* | |
| 232 | * How many physical pages per kmem arena virtual page. | |
| 233 | */ | |
| 234 | #ifndef VM_KMEM_SIZE_SCALE | |
| 235 | #define	VM_KMEM_SIZE_SCALE	(3) | |
| 236 | #endif | |
| 237 | ||
| 238 | /* | |
| 239 | * Optional floor (in bytes) on the size of the kmem arena. | |
| 240 | */ | |
| 241 | #ifndef VM_KMEM_SIZE_MIN | |
| 242 | #define	VM_KMEM_SIZE_MIN	(12 * 1024 * 1024) | |
| 243 | #endif | |
| 244 | ||
| 245 | /* | |
| 246 | * Optional ceiling (in bytes) on the size of the kmem arena: 40% of the | |
| 247 | * usable KVA space. | |
| 248 | */ | |
| 249 | #ifndef VM_KMEM_SIZE_MAX | |
| 250 | #define VM_KMEM_SIZE_MAX	((VM_MAX_SAFE_KERNEL_ADDRESS - \ | |
| 251 | VM_MIN_KERNEL_ADDRESS + 1) * 2 / 5) | |
| 252 | #endif | |
| 253 | ||
| 254 | #ifdef __powerpc64__ | |
| 255 | #define	ZERO_REGION_SIZE	(2 * 1024 * 1024)	/* 2MB */ | |
| 256 | #else | |
| 257 | #define	ZERO_REGION_SIZE	(64 * 1024)	/* 64KB */ | |
| 258 | #endif | |
| 259 | ||
| 260 | /* | |
| 261 | * On 32-bit OEA, the only purpose for which sf_buf is used is to implement | |
| 262 | * an opaque pointer required by the machine-independent parts of the kernel. | |
| 263 | * That pointer references the vm_page that is "mapped" by the sf_buf. The | |
| 264 | * actual mapping is provided by the direct virtual-to-physical mapping. | |
| 265 | * | |
| 266 | * On OEA64 and Book-E, we need to do something a little more complicated. Use | |
| 267 | * the runtime-detected hw_direct_map to pick between the two cases. Our | |
| 268 | * friends in vm_machdep.c will do the same to ensure nothing gets confused. | |
| 269 | */ | |
| 270 | #define	SFBUF | |
| 271 | #define	SFBUF_NOMD | |
| 272 | ||
| 273 | /* | |
| 274 | * We (usually) have a direct map of all physical memory, so provide | |
| 275 | * a macro to use to get the kernel VA address for a given PA. Check the | |
| 276 | * value of PMAP_HAS_PMAP before using. | |
| 277 | */ | |
| 278 | #ifndef LOCORE | |
| 279 | #ifdef __powerpc64__ | |
| 280 | #define	DMAP_BASE_ADDRESS	0xc000000000000000UL | |
| 281 | #define	DMAP_MIN_ADDRESS	DMAP_BASE_ADDRESS | |
| 282 | #define	DMAP_MAX_ADDRESS	0xc007ffffffffffffUL | |
| 283 | #else | |
| 284 | #define	DMAP_BASE_ADDRESS	0x00000000UL | |
| 285 | #define	DMAP_MAX_ADDRESS	0xbfffffffUL | |
| 286 | #endif | |
| 287 | #endif | |
| 288 | ||
| 289 | #if defined(__powerpc64__) || defined(BOOKE) | |
| 290 | /* | |
| 291 | * powerpc64 and Book-E will provide their own page array allocators. | |
| 292 | * | |
| 293 | * On AIM, this will allocate a single virtual array, with pages from the | |
| 294 | * correct memory domains. | |
| 295 | * On Book-E this will let us put the array in TLB1, removing the need for TLB | |
| 296 | * thrashing. | |
| 297 | * | |
| 298 | * VM_MIN_KERNEL_ADDRESS is just a dummy. It will get set by the MMU driver. | |
| 299 | */ | |
| 300 | #define	PA_MIN_ADDRESS		VM_MIN_KERNEL_ADDRESS | |
| 301 | #define	PMAP_HAS_PAGE_ARRAY	1 | |
| 302 | #endif | |
| 303 | ||
| 304 | #if defined(__powerpc64__) | |
| 305 | /* | |
| 306 | * Need a page dump array for minidump. | |
| 307 | */ | |
| 308 | #define MINIDUMP_PAGE_TRACKING	1 | |
| 309 | #else | |
| 310 | /* | |
| 311 | * No minidump with 32-bit powerpc. | |
| 312 | */ | |
| 313 | #define MINIDUMP_PAGE_TRACKING	0 | |
| 314 | #endif | |
| 315 | ||
| 316 | #define	PMAP_HAS_DMAP	(hw_direct_map) | |
| 317 | #define PHYS_TO_DMAP(x) ({						\ | |
| 318 | 	KASSERT(hw_direct_map, ("Direct map not provided by PMAP"));	\ | |
| 319 | 	(x) | DMAP_BASE_ADDRESS; }) | |
| 320 | #define DMAP_TO_PHYS(x) ({						\ | |
| 321 | 	KASSERT(hw_direct_map, ("Direct map not provided by PMAP"));	\ | |
| 322 | 	(x) &~ DMAP_BASE_ADDRESS; }) | |
| 323 | ||
| 324 | /* | |
| 325 | * No non-transparent large page support in the pmap. | |
| 326 | */ | |
| 327 | #define	PMAP_HAS_LARGEPAGES	0 | |
| 328 | ||
| 329 | #endif /* _MACHINE_VMPARAM_H_ */ | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/math.h+24-13| ... | ... | @@ -10,12 +10,12 @@ |
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | 12 | /* |
| 13 | * from: @(#)fdlibm.h 5.1 93/09/24 | |
| 14 | 13 | */ |
| 15 | 14 | |
| 16 | 15 | #ifndef _MATH_H_ |
| 17 | 16 | #define	_MATH_H_ |
| 18 | 17 | |
| 18 | #include <sys/cdefs.h> | |
| 19 | 19 | #include <sys/_types.h> |
| 20 | 20 | #include <machine/_limits.h> |
| 21 | 21 | |
| ... | ... | @@ -32,13 +32,8 @@ extern const union __nan_un { |
| 32 | 32 | 	float		__uf; |
| 33 | 33 | } __nan; |
| 34 | 34 | |
| 35 | #if __GNUC_PREREQ__(3, 3) | |
| 36 | 35 | #define	__MATH_BUILTIN_CONSTANTS |
| 37 | #endif | |
| 38 | ||
| 39 | #if __GNUC_PREREQ__(3, 0) | |
| 40 | 36 | #define	__MATH_BUILTIN_RELOPS |
| 41 | #endif | |
| 42 | 37 | |
| 43 | 38 | #ifdef __MATH_BUILTIN_CONSTANTS |
| 44 | 39 | #define	HUGE_VAL	__builtin_huge_val() |
| ... | ... | @@ -77,10 +72,10 @@ extern const union __nan_un { |
| 77 | 72 | |
| 78 | 73 | #if __STDC_VERSION__ >= 201112L || __has_extension(c_generic_selections) |
| 79 | 74 | #define	__fp_type_select(x, f, d, ld) __extension__ _Generic((x),	\ |
| 80 | float: f(x),							\ | |
| 81 | double: d(x),							\ | |
| 82 | long double: ld(x)) | |
| 83 | #elif __GNUC_PREREQ__(3, 1) && !defined(__cplusplus) | |
| 75 | float: f,								\ | |
| 76 | double: d,								\ | |
| 77 | long double: ld)(x) | |
| 78 | #elif !defined(__cplusplus) | |
| 84 | 79 | #define	__fp_type_select(x, f, d, ld) __builtin_choose_expr(		\ |
| 85 | 80 | __builtin_types_compatible_p(__typeof(x), long double), ld(x),	\ |
| 86 | 81 | __builtin_choose_expr(						\ |
| ... | ... | @@ -143,6 +138,22 @@ typedef	__float_t	float_t; |
| 143 | 138 | #define	M_SQRT2		1.41421356237309504880	/* sqrt(2) */ |
| 144 | 139 | #define	M_SQRT1_2	0.70710678118654752440	/* 1/sqrt(2) */ |
| 145 | 140 | |
| 141 | #if __BSD_VISIBLE || __XSI_VISIBLE >= 800 | |
| 142 | #define	M_El		2.718281828459045235360287471352662498L	/* e */ | |
| 143 | #define	M_LOG2El	1.442695040888963407359924681001892137L	/* log_2 e */ | |
| 144 | #define	M_LOG10El	0.434294481903251827651128918916605082L	/* log_10 e */ | |
| 145 | #define	M_LN2l		0.693147180559945309417232121458176568L	/* log_e 2 */ | |
| 146 | #define	M_LN10l		2.302585092994045684017991454684364208L	/* log_e 10 */ | |
| 147 | #define	M_PIl		3.141592653589793238462643383279502884L	/* pi */ | |
| 148 | #define	M_PI_2l		1.570796326794896619231321691639751442L	/* pi/2 */ | |
| 149 | #define	M_PI_4l		0.785398163397448309615660845819875721L	/* pi/4 */ | |
| 150 | #define	M_1_PIl		0.318309886183790671537767526745028724L	/* 1/pi */ | |
| 151 | #define	M_2_PIl		0.636619772367581343075535053490057448L	/* 2/pi */ | |
| 152 | #define	M_2_SQRTPIl	1.128379167095512573896158903121545172L	/* 2/sqrt(pi) */ | |
| 153 | #define	M_SQRT2l	1.414213562373095048801688724209698079L	/* sqrt(2) */ | |
| 154 | #define	M_SQRT1_2l	0.707106781186547524400844362104849039L	/* 1/sqrt(2) */ | |
| 155 | #endif /* __BSD_VISIBLE || __XSI_VISIBLE >= 800 */ | |
| 156 | ||
| 146 | 157 | #define	MAXFLOAT	((float)3.40282346638528860e+38) |
| 147 | 158 | extern int signgam; |
| 148 | 159 | #endif /* __BSD_VISIBLE || __XSI_VISIBLE */ |
| ... | ... | @@ -182,21 +193,21 @@ int	__signbitf(float) __pure2; |
| 182 | 193 | int	__signbitl(long double) __pure2; |
| 183 | 194 | |
| 184 | 195 | static __inline int |
| 185 | __inline_isnan(__const double __x) | |
| 196 | __inline_isnan(const double __x) | |
| 186 | 197 | { |
| 187 | 198 | |
| 188 | 199 | 	return (__x != __x); |
| 189 | 200 | } |
| 190 | 201 | |
| 191 | 202 | static __inline int |
| 192 | __inline_isnanf(__const float __x) | |
| 203 | __inline_isnanf(const float __x) | |
| 193 | 204 | { |
| 194 | 205 | |
| 195 | 206 | 	return (__x != __x); |
| 196 | 207 | } |
| 197 | 208 | |
| 198 | 209 | static __inline int |
| 199 | __inline_isnanl(__const long double __x) | |
| 210 | __inline_isnanl(const long double __x) | |
| 200 | 211 | { |
| 201 | 212 | |
| 202 | 213 | 	return (__x != __x); |
lib/libc/include/generic-freebsd/memory.h-2| ... | ... | @@ -27,8 +27,6 @@ |
| 27 | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | * | |
| 31 | *	@(#)memory.h	8.1 (Berkeley) 6/2/93 | |
| 32 | 30 | */ |
| 33 | 31 | |
| 34 | 32 | #include <string.h> |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/mntopts.h created+114| ... | ... | @@ -0,0 +1,114 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-3-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 1994 | |
| 5 | * The Regents of the University of California. All rights reserved. | |
| 6 | * | |
| 7 | * Redistribution and use in source and binary forms, with or without | |
| 8 | * modification, are permitted provided that the following conditions | |
| 9 | * are met: | |
| 10 | * 1. Redistributions of source code must retain the above copyright | |
| 11 | * notice, this list of conditions and the following disclaimer. | |
| 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 13 | * notice, this list of conditions and the following disclaimer in the | |
| 14 | * documentation and/or other materials provided with the distribution. | |
| 15 | * 3. Neither the name of the University nor the names of its contributors | |
| 16 | * may be used to endorse or promote products derived from this software | |
| 17 | * without specific prior written permission. | |
| 18 | * | |
| 19 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | |
| 20 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 21 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
| 22 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
| 23 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
| 24 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
| 25 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
| 26 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
| 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
| 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
| 29 | * SUCH DAMAGE. | |
| 30 | */ | |
| 31 | ||
| 32 | #ifndef _MNTOPTS_H_ | |
| 33 | #define _MNTOPTS_H_ | |
| 34 | ||
| 35 | struct mntopt { | |
| 36 | 	const char *m_option;	/* option name */ | |
| 37 | 	int m_inverse;		/* if a negative option, e.g. "atime" */ | |
| 38 | 	long long m_flag;	/* bit to set, e.g. MNT_RDONLY */ | |
| 39 | 	int m_altloc;		/* 1 => set bit in altflags */ | |
| 40 | }; | |
| 41 | ||
| 42 | /* User-visible MNT_ flags. */ | |
| 43 | #define MOPT_ASYNC		{ "async",	0, MNT_ASYNC, 0 } | |
| 44 | #define MOPT_NOATIME		{ "atime",	1, MNT_NOATIME, 0 } | |
| 45 | #define MOPT_NOEXEC		{ "exec",	1, MNT_NOEXEC, 0 } | |
| 46 | #define MOPT_NOSUID		{ "suid",	1, MNT_NOSUID, 0 } | |
| 47 | #define MOPT_NOSYMFOLLOW	{ "symfollow", 1, MNT_NOSYMFOLLOW, 0 } | |
| 48 | #define MOPT_RDONLY		{ "rdonly",	0, MNT_RDONLY, 0 } | |
| 49 | #define MOPT_SYNC		{ "sync",	0, MNT_SYNCHRONOUS, 0 } | |
| 50 | #define MOPT_UNION		{ "union",	0, MNT_UNION, 0 } | |
| 51 | #define MOPT_USERQUOTA		{ "userquota",	0, 0, 0 } | |
| 52 | #define MOPT_GROUPQUOTA		{ "groupquota",	0, 0, 0 } | |
| 53 | #define MOPT_NOCLUSTERR		{ "clusterr",	1, MNT_NOCLUSTERR, 0 } | |
| 54 | #define MOPT_NOCLUSTERW		{ "clusterw",	1, MNT_NOCLUSTERW, 0 } | |
| 55 | #define MOPT_SUIDDIR		{ "suiddir",	0, MNT_SUIDDIR, 0 } | |
| 56 | #define MOPT_SNAPSHOT		{ "snapshot",	0, MNT_SNAPSHOT, 0 } | |
| 57 | #define MOPT_MULTILABEL		{ "multilabel",	0, MNT_MULTILABEL, 0 } | |
| 58 | #define MOPT_ACLS		{ "acls",	0, MNT_ACLS, 0 } | |
| 59 | #define MOPT_NFS4ACLS		{ "nfsv4acls",	0, MNT_NFS4ACLS, 0 } | |
| 60 | #define MOPT_AUTOMOUNTED	{ "automounted",0, MNT_AUTOMOUNTED, 0 } | |
| 61 | #define MOPT_UNTRUSTED		{ "untrusted", 0, MNT_UNTRUSTED, 0 } | |
| 62 | ||
| 63 | /* Control flags. */ | |
| 64 | #define MOPT_FORCE		{ "force",	0, MNT_FORCE, 0 } | |
| 65 | #define MOPT_UPDATE		{ "update",	0, MNT_UPDATE, 0 } | |
| 66 | #define MOPT_RO			{ "ro",		0, MNT_RDONLY, 0 } | |
| 67 | #define MOPT_RW			{ "rw",		1, MNT_RDONLY, 0 } | |
| 68 | #define	MOPT_NOCOVER		{ "cover",	1, MNT_NOCOVER, 0 } | |
| 69 | #define	MOPT_EMPTYDIR		{ "emptydir",	0, MNT_EMPTYDIR, 0 } | |
| 70 | /* This is parsed by mount(8), but is ignored by specific mount_*(8)s. */ | |
| 71 | #define MOPT_AUTO		{ "auto",	0, 0, 0 } | |
| 72 | ||
| 73 | /* A handy macro as terminator of MNT_ array. */ | |
| 74 | #define MOPT_END		{ NULL,		0, 0, 0 } | |
| 75 | ||
| 76 | #define MOPT_FSTAB_COMPAT						\ | |
| 77 | 	MOPT_RO,							\ | |
| 78 | 	MOPT_RW,							\ | |
| 79 | 	MOPT_AUTO | |
| 80 | ||
| 81 | /* Standard options which all mounts can understand. */ | |
| 82 | #define MOPT_STDOPTS							\ | |
| 83 | 	MOPT_USERQUOTA,							\ | |
| 84 | 	MOPT_GROUPQUOTA,						\ | |
| 85 | 	MOPT_FSTAB_COMPAT,						\ | |
| 86 | 	MOPT_NOATIME,							\ | |
| 87 | 	MOPT_NOEXEC,							\ | |
| 88 | 	MOPT_SUIDDIR,		/* must be before MOPT_NOSUID */	\ | |
| 89 | 	MOPT_NOSUID,							\ | |
| 90 | 	MOPT_NOSYMFOLLOW,						\ | |
| 91 | 	MOPT_RDONLY,							\ | |
| 92 | 	MOPT_UNION,							\ | |
| 93 | 	MOPT_NOCLUSTERR,						\ | |
| 94 | 	MOPT_NOCLUSTERW,						\ | |
| 95 | 	MOPT_MULTILABEL,						\ | |
| 96 | 	MOPT_ACLS,							\ | |
| 97 | 	MOPT_NFS4ACLS,							\ | |
| 98 | 	MOPT_AUTOMOUNTED,						\ | |
| 99 | 	MOPT_UNTRUSTED,							\ | |
| 100 | 	MOPT_NOCOVER,							\ | |
| 101 | 	MOPT_EMPTYDIR | |
| 102 | ||
| 103 | void getmntopts(const char *, const struct mntopt *, int *, int *); | |
| 104 | void rmslashes(char *, char *); | |
| 105 | int checkpath(const char *, char resolved_path[]); | |
| 106 | int checkpath_allow_file(const char *, char resolved_path[]); | |
| 107 | struct statfs *getmntpoint(const char *); | |
| 108 | int chkdoreload(struct statfs *, void (*)(const char *, ...) __printflike(1,2)); | |
| 109 | extern int getmnt_silent; | |
| 110 | void build_iovec(struct iovec **iov, int *iovlen, const char *name, void *val, size_t len); | |
| 111 | void build_iovec_argf(struct iovec **iov, int *iovlen, const char *name, const char *fmt, ...); | |
| 112 | void free_iovec(struct iovec **iovec, int *iovlen); | |
| 113 | ||
| 114 | #endif /* !_MNTOPTS_H_ */ | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/mpool.h-2| ... | ... | @@ -27,8 +27,6 @@ |
| 27 | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | * | |
| 31 | *	@(#)mpool.h	8.4 (Berkeley) 11/2/95 | |
| 32 | 30 | */ |
| 33 | 31 | |
| 34 | 32 | #ifndef _MPOOL_H_ |
lib/libc/include/generic-freebsd/mqueue.h-1| ... | ... | @@ -29,7 +29,6 @@ |
| 29 | 29 | #ifndef _MQUEUE_H_ |
| 30 | 30 | #define _MQUEUE_H_ |
| 31 | 31 | |
| 32 | #include <sys/cdefs.h> | |
| 33 | 32 | #include <sys/types.h> |
| 34 | 33 | #include <sys/mqueue.h> |
| 35 | 34 | #include <sys/signal.h> |
lib/libc/include/generic-freebsd/ndbm.h-2| ... | ... | @@ -30,8 +30,6 @@ |
| 30 | 30 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 31 | 31 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 32 | 32 | * SUCH DAMAGE. |
| 33 | * | |
| 34 | *	@(#)ndbm.h	8.1 (Berkeley) 6/2/93 | |
| 35 | 33 | */ |
| 36 | 34 | |
| 37 | 35 | #ifndef _NDBM_H_ |
lib/libc/include/generic-freebsd/net/altq/altq_rmclass.h-2| ... | ... | @@ -38,8 +38,6 @@ |
| 38 | 38 | |
| 39 | 39 | #include <net/altq/altq_classq.h> |
| 40 | 40 | |
| 41 | /* #pragma ident "@(#)rm_class.h 1.20 97/10/23 SMI" */ | |
| 42 | ||
| 43 | 41 | #ifdef __cplusplus |
| 44 | 42 | extern "C" { |
| 45 | 43 | #endif |
lib/libc/include/generic-freebsd/net/altq/altq_rmclass_debug.h-2| ... | ... | @@ -33,8 +33,6 @@ |
| 33 | 33 | #ifndef _ALTQ_ALTQ_RMCLASS_DEBUG_H_ |
| 34 | 34 | #define	_ALTQ_ALTQ_RMCLASS_DEBUG_H_ |
| 35 | 35 | |
| 36 | /* #pragma ident	"@(#)rm_class_debug.h	1.7	98/05/04 SMI" */ | |
| 37 | ||
| 38 | 36 | /* |
| 39 | 37 | * Cbq debugging macros |
| 40 | 38 | */ |
lib/libc/include/generic-freebsd/net/bpf.h+2-3| ... | ... | @@ -32,14 +32,12 @@ |
| 32 | 32 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 33 | 33 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 34 | 34 | * SUCH DAMAGE. |
| 35 | * | |
| 36 | * @(#)bpf.h	8.1 (Berkeley) 6/10/93 | |
| 37 | *	@(#)bpf.h	1.34 (LBL) 6/16/96 | |
| 38 | 35 | */ |
| 39 | 36 | |
| 40 | 37 | #ifndef _NET_BPF_H_ |
| 41 | 38 | #define _NET_BPF_H_ |
| 42 | 39 | |
| 40 | #include <sys/types.h> | |
| 43 | 41 | #include <sys/_eventhandler.h> |
| 44 | 42 | #include <sys/ck.h> |
| 45 | 43 | #include <net/dlt.h> |
| ... | ... | @@ -431,6 +429,7 @@ void	bpfdetach(struct ifnet *); |
| 431 | 429 | bool	bpf_peers_present_if(struct ifnet *); |
| 432 | 430 | #ifdef VIMAGE |
| 433 | 431 | int	bpf_get_bp_params(struct bpf_if *, u_int *, u_int *); |
| 432 | void	bpf_ifdetach(struct ifnet *); | |
| 434 | 433 | #endif |
| 435 | 434 | |
| 436 | 435 | void	bpfilterattach(int); |
lib/libc/include/generic-freebsd/net/bpfdesc.h-2| ... | ... | @@ -32,8 +32,6 @@ |
| 32 | 32 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 33 | 33 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 34 | 34 | * SUCH DAMAGE. |
| 35 | * | |
| 36 | * @(#)bpfdesc.h	8.1 (Berkeley) 6/10/93 | |
| 37 | 35 | */ |
| 38 | 36 | |
| 39 | 37 | #ifndef _NET_BPFDESC_H_ |
lib/libc/include/generic-freebsd/net/dlt.h-2| ... | ... | @@ -30,8 +30,6 @@ |
| 30 | 30 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 31 | 31 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 32 | 32 | * SUCH DAMAGE. |
| 33 | * | |
| 34 | * @(#)bpf.h 7.1 (Berkeley) 5/7/91 | |
| 35 | 33 | */ |
| 36 | 34 | |
| 37 | 35 | #ifndef _NET_DLT_H_ |
lib/libc/include/generic-freebsd/net/ethernet.h+28-1| ... | ... | @@ -40,7 +40,6 @@ |
| 40 | 40 | /* |
| 41 | 41 | * Ethernet-specific mbuf flags. |
| 42 | 42 | */ |
| 43 | #define	M_HASFCS	M_PROTO5	/* FCS included at end of frame */ | |
| 44 | 43 | #define	M_BRIDGE_INJECT	M_PROTO6	/* if_bridge-injected frame */ |
| 45 | 44 | |
| 46 | 45 | /* |
| ... | ... | @@ -63,6 +62,8 @@ struct ether_header { |
| 63 | 62 | 	u_char	ether_shost[ETHER_ADDR_LEN]; |
| 64 | 63 | 	u_short	ether_type; |
| 65 | 64 | } __packed; |
| 65 | _Static_assert(sizeof(struct ether_header) == ETHER_HDR_LEN, | |
| 66 | "size of struct ether_header is wrong"); | |
| 66 | 67 | |
| 67 | 68 | /* |
| 68 | 69 | * Structure of a 48-bit Ethernet address. |
| ... | ... | @@ -70,6 +71,8 @@ struct ether_header { |
| 70 | 71 | struct ether_addr { |
| 71 | 72 | 	u_char octet[ETHER_ADDR_LEN]; |
| 72 | 73 | } __packed; |
| 74 | _Static_assert(sizeof(struct ether_addr) == ETHER_ADDR_LEN, | |
| 75 | "size of struct ether_addr is wrong"); | |
| 73 | 76 | |
| 74 | 77 | #define	ETHER_IS_MULTICAST(addr) (*(addr) & 0x01) /* is address mcast/bcast? */ |
| 75 | 78 | #define	ETHER_IS_IPV6_MULTICAST(addr) \ |
| ... | ... | @@ -81,6 +84,28 @@ struct ether_addr { |
| 81 | 84 | 	(((addr)[0] | (addr)[1] | (addr)[2] | \ |
| 82 | 85 | 	 (addr)[3] | (addr)[4] | (addr)[5]) == 0x00) |
| 83 | 86 | |
| 87 | /* | |
| 88 | * 802.1q VID constants from IEEE 802.1Q-2014, table 9-2. | |
| 89 | */ | |
| 90 | ||
| 91 | /* Null VID: The tag contains only PCP (priority) and DEI information. */ | |
| 92 | #define	DOT1Q_VID_NULL		0x0 | |
| 93 | /* The default PVID for a bridge port. NB: bridge(4) does not honor this. */ | |
| 94 | #define	DOT1Q_VID_DEF_PVID	0x1 | |
| 95 | /* The default SR_PVID for SRP Stream related traffic. */ | |
| 96 | #define	DOT1Q_VID_DEF_SR_PVID	0x2 | |
| 97 | /* A VID reserved for implementation use, not permitted on the wire. */ | |
| 98 | #define	DOT1Q_VID_RSVD_IMPL	0xfff | |
| 99 | /* The lowest valid VID. */ | |
| 100 | #define	DOT1Q_VID_MIN		0x1 | |
| 101 | /* The highest valid VID. */ | |
| 102 | #define	DOT1Q_VID_MAX		0xffe | |
| 103 | ||
| 104 | /* | |
| 105 | * This is the type of the VLAN ID inside the tag, not the tag itself. | |
| 106 | */ | |
| 107 | typedef uint16_t ether_vlanid_t; | |
| 108 | ||
| 84 | 109 | /* |
| 85 | 110 | * 802.1q Virtual LAN header. |
| 86 | 111 | */ |
| ... | ... | @@ -91,6 +116,8 @@ struct ether_vlan_header { |
| 91 | 116 | 	uint16_t evl_tag; |
| 92 | 117 | 	uint16_t evl_proto; |
| 93 | 118 | } __packed; |
| 119 | _Static_assert(sizeof(struct ether_vlan_header) == ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN, | |
| 120 | "size of struct ether_vlan_header is wrong"); | |
| 94 | 121 | |
| 95 | 122 | #define	EVL_VLID_MASK		0x0FFF |
| 96 | 123 | #define	EVL_PRI_MASK		0xE000 |
lib/libc/include/generic-freebsd/net/if.h+3-3| ... | ... | @@ -27,8 +27,6 @@ |
| 27 | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | * | |
| 31 | *	@(#)if.h	8.1 (Berkeley) 6/10/93 | |
| 32 | 30 | */ |
| 33 | 31 | |
| 34 | 32 | #ifndef _NET_IF_H_ |
| ... | ... | @@ -257,7 +255,8 @@ struct if_data { |
| 257 | 255 | #define	IFCAP_B_TXTLS_RTLMT	31 /* can do TLS with rate limiting */ |
| 258 | 256 | #define	IFCAP_B_RXTLS4		32 /* can to TLS receive for TCP */ |
| 259 | 257 | #define	IFCAP_B_RXTLS6		33 /* can to TLS receive for TCP6 */ |
| 260 | #define	__IFCAP_B_SIZE		34 | |
| 258 | #define	IFCAP_B_IPSEC_OFFLOAD	34 /* inline IPSEC offload */ | |
| 259 | #define	__IFCAP_B_SIZE		35 | |
| 261 | 260 | |
| 262 | 261 | #define	IFCAP_B_MAX	(__IFCAP_B_MAX - 1) |
| 263 | 262 | #define	IFCAP_B_SIZE	(__IFCAP_B_SIZE) |
| ... | ... | @@ -300,6 +299,7 @@ struct if_data { |
| 300 | 299 | /* IFCAP2_* are integers, not bits. */ |
| 301 | 300 | #define	IFCAP2_RXTLS4		(IFCAP_B_RXTLS4 - 32) |
| 302 | 301 | #define	IFCAP2_RXTLS6		(IFCAP_B_RXTLS6 - 32) |
| 302 | #define	IFCAP2_IPSEC_OFFLOAD	(IFCAP_B_IPSEC_OFFLOAD - 32) | |
| 303 | 303 | |
| 304 | 304 | #define	IFCAP2_BIT(x)		(1UL << (x)) |
| 305 | 305 |
lib/libc/include/generic-freebsd/net/if_arp.h-2| ... | ... | @@ -27,8 +27,6 @@ |
| 27 | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | * | |
| 31 | *	@(#)if_arp.h	8.1 (Berkeley) 6/10/93 | |
| 32 | 30 | */ |
| 33 | 31 | |
| 34 | 32 | #ifndef _NET_IF_ARP_H_ |
lib/libc/include/generic-freebsd/net/if_bridgevar.h+58-5| ... | ... | @@ -74,7 +74,12 @@ |
| 74 | 74 | * Data structure and control definitions for bridge interfaces. |
| 75 | 75 | */ |
| 76 | 76 | |
| 77 | #ifndef	_NET_IF_BRIDGEVAR_H_ | |
| 78 | #define	_NET_IF_BRIDGEVAR_H_ | |
| 79 | ||
| 77 | 80 | #include <sys/types.h> |
| 81 | #include <sys/_bitset.h> | |
| 82 | #include <sys/bitset.h> | |
| 78 | 83 | #include <sys/callout.h> |
| 79 | 84 | #include <sys/queue.h> |
| 80 | 85 | #include <sys/condvar.h> |
| ... | ... | @@ -119,6 +124,22 @@ |
| 119 | 124 | #define	BRDGSPROTO		28	/* set protocol (ifbrparam) */ |
| 120 | 125 | #define	BRDGSTXHC		29	/* set tx hold count (ifbrparam) */ |
| 121 | 126 | #define	BRDGSIFAMAX		30	/* set max interface addrs (ifbreq) */ |
| 127 | #define	BRDGSIFPVID		31	/* set if PVID */ | |
| 128 | #define	BRDGSIFVLANSET		32	/* set if vlan set */ | |
| 129 | #define	BRDGGIFVLANSET		33	/* get if vlan set */ | |
| 130 | #define	BRDGGFLAGS		34	/* get bridge flags (ifbrparam) */ | |
| 131 | #define	BRDGSFLAGS		35	/* set bridge flags (ifbrparam) */ | |
| 132 | #define	BRDGGDEFPVID		36	/* get default pvid (ifbrparam) */ | |
| 133 | #define	BRDGSDEFPVID		37	/* set default pvid (ifbrparam) */ | |
| 134 | #define	BRDGSIFVLANPROTO	38	/* set if vlan protocol (ifbreq) */ | |
| 135 | ||
| 136 | /* BRDGSFLAGS, Bridge flags (non-interface-specific) */ | |
| 137 | typedef uint32_t ifbr_flags_t; | |
| 138 | ||
| 139 | #define	IFBRF_VLANFILTER	(1U<<0)	/* VLAN filtering enabled */ | |
| 140 | #define	IFBRF_DEFQINQ		(1U<<1)	/* 802.1ad Q-in-Q allowed by default */ | |
| 141 | ||
| 142 | #define	IFBRFBITS	"\020\01VLANFILTER\02DEFQINQ" | |
| 122 | 143 | |
| 123 | 144 | /* |
| 124 | 145 | * Generic bridge control request. |
| ... | ... | @@ -136,7 +157,9 @@ struct ifbreq { |
| 136 | 157 | 	uint32_t	ifbr_addrcnt;		/* member if addr number */ |
| 137 | 158 | 	uint32_t	ifbr_addrmax;		/* member if addr max */ |
| 138 | 159 | 	uint32_t	ifbr_addrexceeded;	/* member if addr violations */ |
| 139 | 	uint8_t		pad[32]; | |
| 160 | 	ether_vlanid_t	ifbr_pvid;		/* member if PVID */ | |
| 161 | 	uint16_t	ifbr_vlanproto;		/* member if VLAN protocol */ | |
| 162 | 	uint8_t		pad[28]; | |
| 140 | 163 | }; |
| 141 | 164 | |
| 142 | 165 | /* BRDGGIFFLAGS, BRDGSIFFLAGS */ |
| ... | ... | @@ -152,10 +175,11 @@ struct ifbreq { |
| 152 | 175 | #define	IFBIF_BSTP_ADMEDGE	0x0200	/* member stp admin edge enabled */ |
| 153 | 176 | #define	IFBIF_BSTP_ADMCOST	0x0400	/* member stp admin path cost */ |
| 154 | 177 | #define	IFBIF_PRIVATE		0x0800	/* if is a private segment */ |
| 178 | #define	IFBIF_QINQ		0x1000	/* if allows 802.1ad Q-in-Q */ | |
| 155 | 179 | |
| 156 | 180 | #define	IFBIFBITS	"\020\001LEARNING\002DISCOVER\003STP\004SPAN" \ |
| 157 | 181 | 			"\005STICKY\014PRIVATE\006EDGE\007AUTOEDGE\010PTP" \ |
| 158 | 			"\011AUTOPTP" | |
| 182 | 			"\011AUTOPTP\015QINQ" | |
| 159 | 183 | #define	IFBIFMASK	~(IFBIF_BSTP_EDGE|IFBIF_BSTP_AUTOEDGE|IFBIF_BSTP_PTP| \ |
| 160 | 184 | 			IFBIF_BSTP_AUTOPTP|IFBIF_BSTP_ADMEDGE| \ |
| 161 | 185 | 			IFBIF_BSTP_ADMCOST)	/* not saved */ |
| ... | ... | @@ -185,7 +209,7 @@ struct ifbareq { |
| 185 | 209 | 	unsigned long	ifba_expire;		/* address expire time */ |
| 186 | 210 | 	uint8_t		ifba_flags;		/* address flags */ |
| 187 | 211 | 	uint8_t		ifba_dst[ETHER_ADDR_LEN];/* destination address */ |
| 188 | 	uint16_t	ifba_vlan;		/* vlan id */ | |
| 212 | 	ether_vlanid_t	ifba_vlan;		/* vlan id */ | |
| 189 | 213 | }; |
| 190 | 214 | |
| 191 | 215 | #define	IFBAF_TYPEMASK	0x03	/* address type mask */ |
| ... | ... | @@ -227,7 +251,11 @@ struct ifbrparam { |
| 227 | 251 | #define	ifbrp_fwddelay	ifbrp_ifbrpu.ifbrpu_int8	/* fwd time (sec) */ |
| 228 | 252 | #define	ifbrp_maxage	ifbrp_ifbrpu.ifbrpu_int8	/* max age (sec) */ |
| 229 | 253 | #define	ifbrp_cexceeded ifbrp_ifbrpu.ifbrpu_int32	/* # of cache dropped |
| 230 | 							 * adresses */ | |
| 254 | 							 * addresses */ | |
| 255 | #define	ifbrp_flags	ifbrp_ifbrpu.ifbrpu_int32	/* bridge flags */ | |
| 256 | #define	ifbrp_defpvid	ifbrp_ifbrpu.ifbrpu_int16	/* default pvid */ | |
| 257 | #define	ifbrp_vlanproto	ifbrp_ifbrpu.ifbrpu_int8	/* vlan protocol */ | |
| 258 | ||
| 231 | 259 | /* |
| 232 | 260 | * Bridge current operational parameters structure. |
| 233 | 261 | */ |
| ... | ... | @@ -301,6 +329,26 @@ struct ifbpstpconf { |
| 301 | 329 | 	eaddr[5] = pv >> 0; \ |
| 302 | 330 | } while (0) |
| 303 | 331 | |
| 332 | /* | |
| 333 | * Bridge VLAN access request. | |
| 334 | */ | |
| 335 | #define	BRVLAN_SETSIZE	4096 | |
| 336 | typedef __BITSET_DEFINE(ifbvlan_set, BRVLAN_SETSIZE) ifbvlan_set_t; | |
| 337 | ||
| 338 | #define	BRVLAN_SET(set, bit)	__BIT_SET(BRVLAN_SETSIZE, (bit), set) | |
| 339 | #define	BRVLAN_CLR(set, bit)	__BIT_CLR(BRVLAN_SETSIZE, (bit), set) | |
| 340 | #define	BRVLAN_TEST(set, bit)	__BIT_ISSET(BRVLAN_SETSIZE, (bit), set) | |
| 341 | ||
| 342 | #define	BRDG_VLAN_OP_SET	1	/* replace current vlan set */ | |
| 343 | #define	BRDG_VLAN_OP_ADD	2	/* add vlans to current set */ | |
| 344 | #define	BRDG_VLAN_OP_DEL	3	/* remove vlans from current set */ | |
| 345 | ||
| 346 | struct ifbif_vlan_req { | |
| 347 | 	char		bv_ifname[IFNAMSIZ]; | |
| 348 | 	uint8_t		bv_op; | |
| 349 | 	ifbvlan_set_t	bv_set; | |
| 350 | }; | |
| 351 | ||
| 304 | 352 | #ifdef _KERNEL |
| 305 | 353 | |
| 306 | 354 | #define BRIDGE_INPUT(_ifp, _m)	do {			\ |
| ... | ... | @@ -320,5 +368,10 @@ struct ifbpstpconf { |
| 320 | 368 | } while (0) |
| 321 | 369 | |
| 322 | 370 | extern	void (*bridge_dn_p)(struct mbuf *, struct ifnet *); |
| 371 | extern	bool (*bridge_same_p)(const void *, const void *); | |
| 372 | extern	void *(*bridge_get_softc_p)(struct ifnet *); | |
| 373 | extern	bool (*bridge_member_ifaddrs_p)(void); | |
| 374 | ||
| 375 | #endif /* _KERNEL */ | |
| 323 | 376 | |
| 324 | #endif /* _KERNEL */ | |
| \ No newline at end of file | ||
| 377 | #endif /* _NET_IF_BRIDGEVAR_H_ */ | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/net/if_clone.h+1-4| ... | ... | @@ -27,8 +27,6 @@ |
| 27 | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | * | |
| 31 | *	From: @(#)if.h	8.1 (Berkeley) 6/10/93 | |
| 32 | 30 | */ |
| 33 | 31 | |
| 34 | 32 | #ifndef	_NET_IF_CLONE_H_ |
| ... | ... | @@ -150,13 +148,12 @@ typedef void (*if_clone_event_handler_t)(void *, struct if_clone *); |
| 150 | 148 | EVENTHANDLER_DECLARE(if_clone_event, if_clone_event_handler_t); |
| 151 | 149 | |
| 152 | 150 | /* The below interfaces used only by net/if.c. */ |
| 153 | void	vnet_if_clone_init(void); | |
| 154 | 151 | int	if_clone_create(char *, size_t, caddr_t); |
| 155 | 152 | int	if_clone_destroy(const char *); |
| 156 | 153 | int	if_clone_list(struct if_clonereq *); |
| 157 | 154 | void	if_clone_restoregroup(struct ifnet *); |
| 158 | 155 | |
| 159 | /* The below interfaces are used only by epair(4). */ | |
| 156 | /* The below interfaces are used only by epair(4) and tun(4)/tap(4). */ | |
| 160 | 157 | void	if_clone_addif(struct if_clone *, struct ifnet *); |
| 161 | 158 | int	if_clone_destroyif(struct if_clone *, struct ifnet *); |
| 162 | 159 |
lib/libc/include/generic-freebsd/net/if_dl.h+11-8| ... | ... | @@ -27,13 +27,13 @@ |
| 27 | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | * | |
| 31 | *	@(#)if_dl.h	8.1 (Berkeley) 6/10/93 | |
| 32 | 30 | */ |
| 33 | 31 | |
| 34 | 32 | #ifndef _NET_IF_DL_H_ |
| 35 | 33 | #define _NET_IF_DL_H_ |
| 36 | 34 | |
| 35 | #include <sys/_types.h> | |
| 36 | ||
| 37 | 37 | /* |
| 38 | 38 | * A Link-Level Sockaddr may specify the interface in one of two |
| 39 | 39 | * ways: either by means of a system-provided index number (computed |
| ... | ... | @@ -67,22 +67,25 @@ struct sockaddr_dl { |
| 67 | 67 | 				 contains both if name and ll address */ |
| 68 | 68 | }; |
| 69 | 69 | |
| 70 | #define LLADDR(s) ((caddr_t)((s)->sdl_data + (s)->sdl_nlen)) | |
| 71 | #define CLLADDR(s) ((c_caddr_t)((s)->sdl_data + (s)->sdl_nlen)) | |
| 70 | #define LLADDR(s) (&(s)->sdl_data[(s)->sdl_nlen]) | |
| 72 | 71 | #define LLINDEX(s) ((s)->sdl_index) |
| 73 | 72 | |
| 73 | #ifdef _KERNEL | |
| 74 | ||
| 74 | 75 | struct ifnet; |
| 75 | struct sockaddr_dl *link_alloc_sdl(size_t, int); | |
| 76 | struct sockaddr_dl *link_alloc_sdl(size_t size, int flags); | |
| 76 | 77 | void link_free_sdl(struct sockaddr *sa); |
| 77 | struct sockaddr_dl *link_init_sdl(struct ifnet *, struct sockaddr *, u_char); | |
| 78 | struct sockaddr_dl *link_init_sdl(struct ifnet *ifp, struct sockaddr *paddr, | |
| 79 | u_char iftypes); | |
| 78 | 80 | |
| 79 | #ifndef _KERNEL | |
| 81 | #else /* !_KERNEL */ | |
| 80 | 82 | |
| 81 | 83 | #include <sys/cdefs.h> |
| 82 | 84 | |
| 83 | 85 | __BEGIN_DECLS |
| 84 | void	link_addr(const char *, struct sockaddr_dl *); | |
| 86 | int	link_addr(const char *, struct sockaddr_dl *); | |
| 85 | 87 | char	*link_ntoa(const struct sockaddr_dl *); |
| 88 | int	link_ntoa_r(const struct sockaddr_dl *, char *, size_t *); | |
| 86 | 89 | __END_DECLS |
| 87 | 90 | |
| 88 | 91 | #endif /* !_KERNEL */ |
lib/libc/include/generic-freebsd/net/if_gif.h+2-1| ... | ... | @@ -120,7 +120,8 @@ int in6_gif_setopts(struct gif_softc *, u_int); |
| 120 | 120 | #define GIFGOPTS	_IOWR('i', 150, struct ifreq) |
| 121 | 121 | #define GIFSOPTS	_IOW('i', 151, struct ifreq) |
| 122 | 122 | |
| 123 | #define	GIF_NOCLAMP		0x0001 | |
| 123 | 124 | #define	GIF_IGNORE_SOURCE	0x0002 |
| 124 | #define	GIF_OPTMASK		(GIF_IGNORE_SOURCE) | |
| 125 | #define	GIF_OPTMASK		(GIF_NOCLAMP|GIF_IGNORE_SOURCE) | |
| 125 | 126 | |
| 126 | 127 | #endif /* _NET_IF_GIF_H_ */ |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/net/if_llc.h-2| ... | ... | @@ -29,8 +29,6 @@ |
| 29 | 29 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 30 | 30 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 31 | 31 | * SUCH DAMAGE. |
| 32 | * | |
| 33 | *	@(#)if_llc.h	8.1 (Berkeley) 6/10/93 | |
| 34 | 32 | */ |
| 35 | 33 | |
| 36 | 34 | #ifndef _NET_IF_LLC_H_ |
lib/libc/include/generic-freebsd/net/if_media.h+6| ... | ... | @@ -258,6 +258,8 @@ uint64_t	ifmedia_baudrate(int); |
| 258 | 258 | #define	IFM_400G_AUI8	IFM_X(117)	/* 400G-AUI8 */ |
| 259 | 259 | #define	IFM_50G_KR4	IFM_X(118)	/* 50GBase-KR4 */ |
| 260 | 260 | #define	IFM_40G_LM4	IFM_X(119)	/* 40GBase-LM4 */ |
| 261 | #define	IFM_100_BX	IFM_X(120)	/* 100Base-BX */ | |
| 262 | #define	IFM_1000_BX	IFM_X(121)	/* 1000Base-BX */ | |
| 261 | 263 | |
| 262 | 264 | /* |
| 263 | 265 | * Please update ieee8023ad_lacp.c:lacp_compose_key() |
| ... | ... | @@ -437,11 +439,13 @@ struct ifmedia_description { |
| 437 | 439 | 	{ IFM_100_T4,	"100baseT4" },					\ |
| 438 | 440 | 	{ IFM_100_VG,	"100baseVG" },					\ |
| 439 | 441 | 	{ IFM_100_T2,	"100baseT2" },					\ |
| 442 | 	{ IFM_100_BX,	"100baseBX" },					\ | |
| 440 | 443 | 	{ IFM_10_STP,	"10baseSTP" },					\ |
| 441 | 444 | 	{ IFM_10_FL,	"10baseFL" },					\ |
| 442 | 445 | 	{ IFM_1000_SX,	"1000baseSX" },					\ |
| 443 | 446 | 	{ IFM_1000_LX,	"1000baseLX" },					\ |
| 444 | 447 | 	{ IFM_1000_CX,	"1000baseCX" },					\ |
| 448 | 	{ IFM_1000_BX,	"1000baseBX" },					\ | |
| 445 | 449 | 	{ IFM_1000_T,	"1000baseT" },					\ |
| 446 | 450 | 	{ IFM_HPNA_1,	"homePNA" },					\ |
| 447 | 451 | 	{ IFM_10G_LR,	"10Gbase-LR" },					\ |
| ... | ... | @@ -784,11 +788,13 @@ struct ifmedia_baudrate { |
| 784 | 788 | 	{ IFM_ETHER | IFM_100_T4,	IF_Mbps(100) },			\ |
| 785 | 789 | 	{ IFM_ETHER | IFM_100_VG,	IF_Mbps(100) },			\ |
| 786 | 790 | 	{ IFM_ETHER | IFM_100_T2,	IF_Mbps(100) },			\ |
| 791 | 	{ IFM_ETHER | IFM_100_BX,	IF_Mbps(100) },			\ | |
| 787 | 792 | 	{ IFM_ETHER | IFM_1000_SX,	IF_Mbps(1000) },		\ |
| 788 | 793 | 	{ IFM_ETHER | IFM_10_STP,	IF_Mbps(10) },			\ |
| 789 | 794 | 	{ IFM_ETHER | IFM_10_FL,	IF_Mbps(10) },			\ |
| 790 | 795 | 	{ IFM_ETHER | IFM_1000_LX,	IF_Mbps(1000) },		\ |
| 791 | 796 | 	{ IFM_ETHER | IFM_1000_CX,	IF_Mbps(1000) },		\ |
| 797 | 	{ IFM_ETHER | IFM_1000_BX,	IF_Mbps(1000) },		\ | |
| 792 | 798 | 	{ IFM_ETHER | IFM_1000_T,	IF_Mbps(1000) },		\ |
| 793 | 799 | 	{ IFM_ETHER | IFM_HPNA_1,	IF_Mbps(1) },			\ |
| 794 | 800 | 	{ IFM_ETHER | IFM_10G_LR,	IF_Gbps(10ULL) },		\ |
lib/libc/include/generic-freebsd/net/if_ovpn.h+1| ... | ... | @@ -37,6 +37,7 @@ |
| 37 | 37 | enum ovpn_notif_type { |
| 38 | 38 | 	OVPN_NOTIF_DEL_PEER, |
| 39 | 39 | 	OVPN_NOTIF_ROTATE_KEY, |
| 40 | 	OVPN_NOTIF_FLOAT, | |
| 40 | 41 | }; |
| 41 | 42 | |
| 42 | 43 | enum ovpn_del_reason { |
lib/libc/include/generic-freebsd/net/if_pflog.h+5-5| ... | ... | @@ -33,8 +33,6 @@ |
| 33 | 33 | |
| 34 | 34 | #include <net/if.h> |
| 35 | 35 | |
| 36 | #define	PFLOGIFS_MAX	16 | |
| 37 | ||
| 38 | 36 | #define	PFLOG_RULESET_NAME_SIZE	16 |
| 39 | 37 | |
| 40 | 38 | struct pfloghdr { |
| ... | ... | @@ -51,7 +49,9 @@ struct pfloghdr { |
| 51 | 49 | 	uid_t		rule_uid; |
| 52 | 50 | 	pid_t		rule_pid; |
| 53 | 51 | 	u_int8_t	dir; |
| 54 | 	u_int8_t	pad[3]; | |
| 52 | 	u_int8_t	pad1;	/* rewritten, on OpenBSD */ | |
| 53 | 	sa_family_t	naf; | |
| 54 | 	u_int8_t	pad[1]; | |
| 55 | 55 | 	u_int32_t	ridentifier; |
| 56 | 56 | 	u_int8_t	reserve;	/* Appease broken software like Wireshark. */ |
| 57 | 57 | 	u_int8_t	pad2[3]; |
| ... | ... | @@ -69,9 +69,9 @@ struct pf_ruleset; |
| 69 | 69 | struct pfi_kif; |
| 70 | 70 | struct pf_pdesc; |
| 71 | 71 | |
| 72 | #define	PFLOG_PACKET(i,a,b,c,d,e,f,g,di) do {		\ | |
| 72 | #define	PFLOG_PACKET(b,t,c,d,e,f,g,h) do {		\ | |
| 73 | 73 | 	if (pflog_packet_ptr != NULL)			\ |
| 74 | 		pflog_packet_ptr(i,a,b,c,d,e,f,g,di);	\ | |
| 74 | 		pflog_packet_ptr(b,t,c,d,e,f,g,h);	\ | |
| 75 | 75 | } while (0) |
| 76 | 76 | #endif /* _KERNEL */ |
| 77 | 77 | #endif /* _NET_IF_PFLOG_H_ */ |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/net/if_pfsync.h+7-4| ... | ... | @@ -62,9 +62,10 @@ enum pfsync_msg_versions { |
| 62 | 62 | 	PFSYNC_MSG_VERSION_UNSPECIFIED = 0, |
| 63 | 63 | 	PFSYNC_MSG_VERSION_1301 = 1301, |
| 64 | 64 | 	PFSYNC_MSG_VERSION_1400 = 1400, |
| 65 | 	PFSYNC_MSG_VERSION_1500 = 1500, | |
| 65 | 66 | }; |
| 66 | 67 | |
| 67 | #define PFSYNC_MSG_VERSION_DEFAULT PFSYNC_MSG_VERSION_1400 | |
| 68 | #define PFSYNC_MSG_VERSION_DEFAULT PFSYNC_MSG_VERSION_1500 | |
| 68 | 69 | |
| 69 | 70 | #define	PFSYNC_ACT_CLR		0	/* clear all states */ |
| 70 | 71 | #define	PFSYNC_ACT_INS_1301	1	/* insert state */ |
| ... | ... | @@ -81,7 +82,9 @@ enum pfsync_msg_versions { |
| 81 | 82 | #define	PFSYNC_ACT_EOF		12	/* end of frame */ |
| 82 | 83 | #define PFSYNC_ACT_INS_1400	13	/* insert state */ |
| 83 | 84 | #define PFSYNC_ACT_UPD_1400	14	/* update state */ |
| 84 | #define	PFSYNC_ACT_MAX		15 | |
| 85 | #define PFSYNC_ACT_INS_1500	15	/* insert state */ | |
| 86 | #define PFSYNC_ACT_UPD_1500	16	/* update state */ | |
| 87 | #define	PFSYNC_ACT_MAX		17 | |
| 85 | 88 | |
| 86 | 89 | /* |
| 87 | 90 | * A pfsync frame is built from a header followed by several sections which |
| ... | ... | @@ -160,8 +163,8 @@ struct pfsync_ins_ack { |
| 160 | 163 | |
| 161 | 164 | struct pfsync_upd_c { |
| 162 | 165 | 	u_int64_t			id; |
| 163 | 	struct pfsync_state_peer	src; | |
| 164 | 	struct pfsync_state_peer	dst; | |
| 166 | 	struct pf_state_peer_export	src; | |
| 167 | 	struct pf_state_peer_export	dst; | |
| 165 | 168 | 	u_int32_t			creatorid; |
| 166 | 169 | 	u_int32_t			expire; |
| 167 | 170 | 	u_int8_t			timeout; |
lib/libc/include/generic-freebsd/net/if_private.h+2-2| ... | ... | @@ -27,8 +27,6 @@ |
| 27 | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | * | |
| 31 | *	From: @(#)if.h	8.1 (Berkeley) 6/10/93 | |
| 32 | 30 | */ |
| 33 | 31 | |
| 34 | 32 | #ifndef	_NET_IF_PRIVATE_H_ |
| ... | ... | @@ -140,6 +138,8 @@ struct ifnet { |
| 140 | 138 | 	int	(*if_requestencap)	/* make link header from request */ |
| 141 | 139 | 		(struct ifnet *, struct if_encap_req *); |
| 142 | 140 | |
| 141 | 	const struct if_ipsec_accel_methods *if_ipsec_accel_m; | |
| 142 | ||
| 143 | 143 | 	/* Statistics. */ |
| 144 | 144 | 	counter_u64_t	if_counters[IFCOUNTERS]; |
| 145 | 145 |
lib/libc/include/generic-freebsd/net/if_strings.h+5| ... | ... | @@ -60,10 +60,13 @@ |
| 60 | 60 | #define	IFCAP_TXTLS_RTLMT_NAME		"TXTLS_RTLMT" |
| 61 | 61 | #define	IFCAP_RXTLS4_NAME		"RXTLS4" |
| 62 | 62 | #define	IFCAP_RXTLS6_NAME		"RXTLS6" |
| 63 | #define	IFCAP_IPSEC_OFFLOAD_NAME	"IPSEC" | |
| 63 | 64 | |
| 64 | 65 | #define	IFCAP2_RXTLS4_NAME	IFCAP_RXTLS4_NAME |
| 65 | 66 | #define	IFCAP2_RXTLS6_NAME	IFCAP_RXTLS6_NAME |
| 67 | #define	IFCAP2_IPSEC_OFFLOAD_NAME IFCAP_IPSEC_OFFLOAD_NAME | |
| 66 | 68 | |
| 69 | #ifdef _WANT_IFCAP_BIT_NAMES | |
| 67 | 70 | static const char *ifcap_bit_names[] = { |
| 68 | 71 | 	IFCAP_RXCSUM_NAME, |
| 69 | 72 | 	IFCAP_TXCSUM_NAME, |
| ... | ... | @@ -99,11 +102,13 @@ static const char *ifcap_bit_names[] = { |
| 99 | 102 | 	IFCAP_TXTLS_RTLMT_NAME, |
| 100 | 103 | 	IFCAP_RXTLS4_NAME, |
| 101 | 104 | 	IFCAP_RXTLS6_NAME, |
| 105 | 	IFCAP_IPSEC_OFFLOAD_NAME, | |
| 102 | 106 | }; |
| 103 | 107 | |
| 104 | 108 | #ifdef IFCAP_B_SIZE |
| 105 | 109 | _Static_assert(sizeof(ifcap_bit_names) >= IFCAP_B_SIZE * sizeof(char *), |
| 106 | 110 | "ifcap bit names missing from ifcap_bit_names"); |
| 107 | 111 | #endif |
| 112 | #endif | |
| 108 | 113 | |
| 109 | 114 | #endif |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/net/if_tap.h+2| ... | ... | @@ -57,6 +57,8 @@ |
| 57 | 57 | #define	TAPGIFNAME		TUNGIFNAME |
| 58 | 58 | #define	TAPSVNETHDR		_IOW('t', 91, int) |
| 59 | 59 | #define	TAPGVNETHDR		_IOR('t', 94, int) |
| 60 | #define	TAPSTRANSIENT		TUNSTRANSIENT | |
| 61 | #define	TAPGTRANSIENT		TUNGTRANSIENT | |
| 60 | 62 | |
| 61 | 63 | /* VMware ioctl's */ |
| 62 | 64 | #define VMIO_SIOCSIFFLAGS	_IOWINT('V', 0) |
lib/libc/include/generic-freebsd/net/if_tun.h+2| ... | ... | @@ -43,5 +43,7 @@ struct tuninfo { |
| 43 | 43 | #define	TUNSIFPID	_IO('t', 95) |
| 44 | 44 | #define	TUNSIFHEAD	_IOW('t', 96, int) |
| 45 | 45 | #define	TUNGIFHEAD	_IOR('t', 97, int) |
| 46 | #define	TUNSTRANSIENT	_IOW('t', 98, int) | |
| 47 | #define	TUNGTRANSIENT	_IOR('t', 99, int) | |
| 46 | 48 | |
| 47 | 49 | #endif /* !_NET_IF_TUN_H_ */ |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/net/if_types.h+1-2| ... | ... | @@ -27,8 +27,6 @@ |
| 27 | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | * | |
| 31 | *	@(#)if_types.h	8.3 (Berkeley) 4/28/95 | |
| 32 | 30 | * $NetBSD: if_types.h,v 1.16 2000/04/19 06:30:53 itojun Exp $ |
| 33 | 31 | */ |
| 34 | 32 | |
| ... | ... | @@ -256,6 +254,7 @@ typedef enum { |
| 256 | 254 | 	IFT_PFLOG	= 0xf6,		/* PF packet filter logging */ |
| 257 | 255 | 	IFT_PFSYNC	= 0xf7,		/* PF packet filter synchronization */ |
| 258 | 256 | 	IFT_WIREGUARD	= 0xf8,		/* WireGuard tunnel */ |
| 257 | 	IFT_MBIM	= 0xf9,		/* Mobile Broadband Interface Model */ | |
| 259 | 258 | } ifType; |
| 260 | 259 | |
| 261 | 260 | /* |
lib/libc/include/generic-freebsd/net/if_var.h+37-6| ... | ... | @@ -27,8 +27,6 @@ |
| 27 | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | * | |
| 31 | *	From: @(#)if.h	8.1 (Berkeley) 6/10/93 | |
| 32 | 30 | */ |
| 33 | 31 | |
| 34 | 32 | #ifndef	_NET_IF_VAR_H_ |
| ... | ... | @@ -133,6 +131,25 @@ typedef void (*if_qflush_fn_t)(if_t); |
| 133 | 131 | typedef int (*if_transmit_fn_t)(if_t, struct mbuf *); |
| 134 | 132 | typedef	uint64_t (*if_get_counter_t)(if_t, ift_counter); |
| 135 | 133 | typedef	void (*if_reassign_fn_t)(if_t, struct vnet *, char *); |
| 134 | typedef int (*if_spdadd_fn_t)(if_t ifp, void *sp, void *inp, void **priv); | |
| 135 | typedef int (*if_spddel_fn_t)(if_t ifp, void *sp, void *priv); | |
| 136 | typedef int (*if_sa_newkey_fn_t)(if_t ifp, void *sav, u_int drv_spi, | |
| 137 | void **privp); | |
| 138 | typedef int (*if_sa_deinstall_fn_t)(if_t ifp, u_int drv_spi, void *priv); | |
| 139 | struct seclifetime; | |
| 140 | #define	IF_SA_CNT_UPD	0x80000000 | |
| 141 | enum IF_SA_CNT_WHICH { | |
| 142 | 	IF_SA_CNT_IFP_HW_VAL = 1, | |
| 143 | 	IF_SA_CNT_TOTAL_SW_VAL, | |
| 144 | 	IF_SA_CNT_TOTAL_HW_VAL, | |
| 145 | 	IF_SA_CNT_IFP_HW_UPD = IF_SA_CNT_IFP_HW_VAL | IF_SA_CNT_UPD, | |
| 146 | 	IF_SA_CNT_TOTAL_SW_UPD = IF_SA_CNT_TOTAL_SW_VAL | IF_SA_CNT_UPD, | |
| 147 | 	IF_SA_CNT_TOTAL_HW_UPD = IF_SA_CNT_TOTAL_HW_VAL | IF_SA_CNT_UPD, | |
| 148 | }; | |
| 149 | typedef int (*if_sa_cnt_fn_t)(if_t ifp, void *sa, | |
| 150 | uint32_t drv_spi, void *priv, struct seclifetime *lt); | |
| 151 | typedef int (*if_ipsec_hwassist_fn_t)(if_t ifp, void *sav, | |
| 152 | u_int drv_spi,void *priv); | |
| 136 | 153 | |
| 137 | 154 | struct ifnet_hw_tsomax { |
| 138 | 155 | 	u_int	tsomaxbytes;	/* TSO total burst length limit in bytes */ |
| ... | ... | @@ -280,12 +297,14 @@ typedef int (if_snd_tag_modify_t)(struct m_snd_tag *, union if_snd_tag_modify_pa |
| 280 | 297 | typedef int (if_snd_tag_query_t)(struct m_snd_tag *, union if_snd_tag_query_params *); |
| 281 | 298 | typedef void (if_snd_tag_free_t)(struct m_snd_tag *); |
| 282 | 299 | typedef struct m_snd_tag *(if_next_send_tag_t)(struct m_snd_tag *); |
| 300 | typedef int (if_snd_tag_status_str_t)(struct m_snd_tag *, char *buf, size_t *sz); | |
| 283 | 301 | |
| 284 | 302 | struct if_snd_tag_sw { |
| 285 | 303 | 	if_snd_tag_modify_t *snd_tag_modify; |
| 286 | 304 | 	if_snd_tag_query_t *snd_tag_query; |
| 287 | 305 | 	if_snd_tag_free_t *snd_tag_free; |
| 288 | 306 | 	if_next_send_tag_t *next_snd_tag; |
| 307 | 	if_snd_tag_status_str_t *snd_tag_status_str; | |
| 289 | 308 | 	u_int	type;			/* One of IF_SND_TAG_TYPE_*. */ |
| 290 | 309 | }; |
| 291 | 310 | |
| ... | ... | @@ -603,6 +622,7 @@ int if_setmtu(if_t ifp, int mtu); |
| 603 | 622 | int if_getmtu(const if_t ifp); |
| 604 | 623 | int if_getmtu_family(const if_t ifp, int family); |
| 605 | 624 | void if_notifymtu(if_t ifp); |
| 625 | void if_setppromisc(const if_t ifp, bool ppromisc); | |
| 606 | 626 | int if_setflagbits(if_t ifp, int set, int clear); |
| 607 | 627 | int if_setflags(if_t ifp, int flags); |
| 608 | 628 | int if_getflags(const if_t ifp); |
| ... | ... | @@ -626,11 +646,9 @@ void if_setrcvif(struct mbuf *m, if_t ifp); |
| 626 | 646 | void if_setvtag(struct mbuf *m, u_int16_t tag); |
| 627 | 647 | u_int16_t if_getvtag(struct mbuf *m); |
| 628 | 648 | int if_vlantrunkinuse(if_t ifp); |
| 629 | caddr_t if_getlladdr(const if_t ifp); | |
| 649 | char *if_getlladdr(const if_t ifp); | |
| 630 | 650 | struct vnet *if_getvnet(const if_t ifp); |
| 631 | 651 | void *if_gethandle(u_char); |
| 632 | void if_bpfmtap(if_t ifp, struct mbuf *m); | |
| 633 | void if_etherbpfmtap(if_t ifp, struct mbuf *m); | |
| 634 | 652 | void if_vlancap(if_t ifp); |
| 635 | 653 | int if_transmit(if_t ifp, struct mbuf *m); |
| 636 | 654 | void if_init(if_t ifp, void *ctx); |
| ... | ... | @@ -703,6 +721,20 @@ void if_setdebugnet_methods(if_t, struct debugnet_methods *); |
| 703 | 721 | void if_setreassignfn(if_t ifp, if_reassign_fn_t); |
| 704 | 722 | void if_setratelimitqueryfn(if_t ifp, if_ratelimit_query_t); |
| 705 | 723 | |
| 724 | /* | |
| 725 | * NB: The interface is not yet stable, drivers implementing IPSEC | |
| 726 | * offload need to be prepared to adapt to changes. | |
| 727 | */ | |
| 728 | struct if_ipsec_accel_methods { | |
| 729 | 	if_spdadd_fn_t		if_spdadd; | |
| 730 | 	if_spddel_fn_t		if_spddel; | |
| 731 | 	if_sa_newkey_fn_t	if_sa_newkey; | |
| 732 | 	if_sa_deinstall_fn_t	if_sa_deinstall; | |
| 733 | 	if_sa_cnt_fn_t		if_sa_cnt; | |
| 734 | 	if_ipsec_hwassist_fn_t	if_hwassist; | |
| 735 | }; | |
| 736 | void if_setipsec_accel_methods(if_t ifp, const struct if_ipsec_accel_methods *); | |
| 737 | ||
| 706 | 738 | /* TSO */ |
| 707 | 739 | void if_hw_tsomax_common(if_t ifp, struct ifnet_hw_tsomax *); |
| 708 | 740 | int if_hw_tsomax_update(if_t ifp, struct ifnet_hw_tsomax *); |
| ... | ... | @@ -724,7 +756,6 @@ int ether_poll_deregister(if_t ifp); |
| 724 | 756 | |
| 725 | 757 | #endif /* _KERNEL */ |
| 726 | 758 | |
| 727 | #include <net/if_private.h>	/* XXX: temporary until drivers converted. */ | |
| 728 | 759 | #include <net/ifq.h>	/* XXXAO: temporary unconditional include */ |
| 729 | 760 | |
| 730 | 761 | #endif /* !_NET_IF_VAR_H_ */ |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/net/if_vlan_var.h+1-5| ... | ... | @@ -126,11 +126,6 @@ struct	vlanreq { |
| 126 | 126 | |
| 127 | 127 | #define	VLAN_PCP_MAX		7 |
| 128 | 128 | |
| 129 | #define	DOT1Q_VID_NULL		0x0 | |
| 130 | #define	DOT1Q_VID_DEF_PVID	0x1 | |
| 131 | #define	DOT1Q_VID_DEF_SR_PVID	0x2 | |
| 132 | #define	DOT1Q_VID_RSVD_IMPL	0xfff | |
| 133 | ||
| 134 | 129 | /* |
| 135 | 130 | * 802.1q full tag. Proto and vid are stored in host byte order. |
| 136 | 131 | */ |
| ... | ... | @@ -166,6 +161,7 @@ extern	int (*vlan_tag_p)(struct ifnet *, uint16_t *); |
| 166 | 161 | extern	int (*vlan_pcp_p)(struct ifnet *, uint16_t *); |
| 167 | 162 | extern	int (*vlan_setcookie_p)(struct ifnet *, void *); |
| 168 | 163 | extern	void *(*vlan_cookie_p)(struct ifnet *); |
| 164 | extern	void (*vlan_input_p)(struct ifnet *, struct mbuf *); | |
| 169 | 165 | |
| 170 | 166 | #include <sys/_eventhandler.h> |
| 171 | 167 |
lib/libc/include/generic-freebsd/net/iflib.h+6-6| ... | ... | @@ -121,13 +121,13 @@ typedef struct if_pkt_info { |
| 121 | 121 | 	uint16_t		ipi_tso_segsz;	/* tso segment size */ |
| 122 | 122 | 	uint16_t		ipi_vtag;	/* VLAN tag */ |
| 123 | 123 | 	uint16_t		ipi_etype;	/* ether header type */ |
| 124 | 	uint8_t			ipi_tcp_hflags;	/* tcp header flags */ | |
| 125 | 	uint8_t			ipi_mflags;	/* packet mbuf flags */ | |
| 124 | 	uint16_t		ipi_tcp_hflags;	/* tcp header flags */ | |
| 126 | 125 | |
| 127 | 126 | 	uint32_t		ipi_tcp_seq;	/* tcp seqno */ |
| 128 | 127 | 	uint8_t			ipi_ip_tos;	/* IP ToS field data */ |
| 128 | 	uint8_t			ipi_mflags;	/* packet mbuf flags */ | |
| 129 | 129 | 	uint8_t			__spare0__; |
| 130 | 	uint16_t		__spare1__; | |
| 130 | 	uint8_t		__spare1__; | |
| 131 | 131 | } *if_pkt_info_t; |
| 132 | 132 | |
| 133 | 133 | typedef struct if_irq { |
| ... | ... | @@ -470,9 +470,9 @@ void iflib_irq_free(if_ctx_t ctx, if_irq_t irq); |
| 470 | 470 | void iflib_io_tqg_attach(struct grouptask *gt, void *uniq, int cpu, |
| 471 | 471 | const char *name); |
| 472 | 472 | |
| 473 | void iflib_config_gtask_init(void *ctx, struct grouptask *gtask, | |
| 474 | 			 gtask_fn_t *fn, const char *name); | |
| 475 | void iflib_config_gtask_deinit(struct grouptask *gtask); | |
| 473 | void iflib_config_task_init(if_ctx_t ctx, struct task *config_task, | |
| 474 | task_fn_t *fn); | |
| 475 | void iflib_config_task_enqueue(if_ctx_t ctx, struct task *config_task); | |
| 476 | 476 | |
| 477 | 477 | void iflib_tx_intr_deferred(if_ctx_t ctx, int txqid); |
| 478 | 478 | void iflib_rx_intr_deferred(if_ctx_t ctx, int rxqid); |
lib/libc/include/generic-freebsd/net/ifq.h-2| ... | ... | @@ -27,8 +27,6 @@ |
| 27 | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | * | |
| 31 | *	From: @(#)if.h	8.1 (Berkeley) 6/10/93 | |
| 32 | 30 | */ |
| 33 | 31 | |
| 34 | 32 | #ifndef	_NET_IFQ_H_ |
lib/libc/include/generic-freebsd/net/pfkeyv2.h+15-5| ... | ... | @@ -296,6 +296,13 @@ struct sadb_x_sa_replay { |
| 296 | 296 | }; |
| 297 | 297 | _Static_assert(sizeof(struct sadb_x_sa_replay) == 8, "struct size mismatch"); |
| 298 | 298 | |
| 299 | struct sadb_x_if_hw_offl { | |
| 300 | u_int16_t sadb_x_if_hw_offl_len; | |
| 301 | u_int16_t sadb_x_if_hw_offl_exttype; | |
| 302 | u_int32_t sadb_x_if_hw_offl_flags; | |
| 303 | u_int8_t sadb_x_if_hw_offl_if[32];	/* IF_NAMESIZE is 16, keep room */ | |
| 304 | }; | |
| 305 | ||
| 299 | 306 | #define SADB_EXT_RESERVED 0 |
| 300 | 307 | #define SADB_EXT_SA 1 |
| 301 | 308 | #define SADB_EXT_LIFETIME_CURRENT 2 |
| ... | ... | @@ -326,7 +333,10 @@ _Static_assert(sizeof(struct sadb_x_sa_replay) == 8, "struct size mismatch"); |
| 326 | 333 | #define SADB_X_EXT_SA_REPLAY 26	/* Replay window override. */ |
| 327 | 334 | #define	SADB_X_EXT_NEW_ADDRESS_SRC 27 |
| 328 | 335 | #define	SADB_X_EXT_NEW_ADDRESS_DST 28 |
| 329 | #define	SADB_EXT_MAX 28 | |
| 336 | #define	SADB_X_EXT_LFT_CUR_SW_OFFL 29 | |
| 337 | #define	SADB_X_EXT_LFT_CUR_HW_OFFL 30 | |
| 338 | #define	SADB_X_EXT_IF_HW_OFFL	 31 | |
| 339 | #define	SADB_EXT_MAX 31 | |
| 330 | 340 | |
| 331 | 341 | #define SADB_SATYPE_UNSPEC	0 |
| 332 | 342 | #define SADB_SATYPE_AH		2 |
| ... | ... | @@ -444,13 +454,13 @@ _Static_assert(sizeof(struct sadb_x_sa_replay) == 8, "struct size mismatch"); |
| 444 | 454 | /* Utilities */ |
| 445 | 455 | #define PFKEY_ALIGN8(a) (1 + (((a) - 1) | (8 - 1))) |
| 446 | 456 | #define	PFKEY_EXTLEN(msg) \ |
| 447 | 	PFKEY_UNUNIT64(((struct sadb_ext *)(msg))->sadb_ext_len) | |
| 457 | 	PFKEY_UNUNIT64(((const struct sadb_ext *)(msg))->sadb_ext_len) | |
| 448 | 458 | #define PFKEY_ADDR_PREFIX(ext) \ |
| 449 | 	(((struct sadb_address *)(ext))->sadb_address_prefixlen) | |
| 459 | 	(((const struct sadb_address *)(ext))->sadb_address_prefixlen) | |
| 450 | 460 | #define PFKEY_ADDR_PROTO(ext) \ |
| 451 | 	(((struct sadb_address *)(ext))->sadb_address_proto) | |
| 461 | 	(((const struct sadb_address *)(ext))->sadb_address_proto) | |
| 452 | 462 | #define PFKEY_ADDR_SADDR(ext) \ |
| 453 | 	((struct sockaddr *)((caddr_t)(ext) + sizeof(struct sadb_address))) | |
| 463 | 	((const struct sockaddr *)((c_caddr_t)(ext) + sizeof(struct sadb_address))) | |
| 454 | 464 | |
| 455 | 465 | /* in 64bits */ |
| 456 | 466 | #define	PFKEY_UNUNIT64(a)	((a) << 3) |
lib/libc/include/generic-freebsd/net/pflow.h created+382| ... | ... | @@ -0,0 +1,382 @@ |
| 1 | /*	$OpenBSD: if_pflow.h,v 1.19 2022/11/23 15:12:27 mvs Exp $	*/ | |
| 2 | ||
| 3 | /* | |
| 4 | * Copyright (c) 2008 Henning Brauer <henning@openbsd.org> | |
| 5 | * Copyright (c) 2008 Joerg Goltermann <jg@osn.de> | |
| 6 | * | |
| 7 | * Permission to use, copy, modify, and distribute this software for any | |
| 8 | * purpose with or without fee is hereby granted, provided that the above | |
| 9 | * copyright notice and this permission notice appear in all copies. | |
| 10 | * | |
| 11 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | |
| 12 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | |
| 13 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | |
| 14 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | |
| 15 | * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER IN | |
| 16 | * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT | |
| 17 | * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | |
| 18 | */ | |
| 19 | ||
| 20 | #ifndef _NET_IF_PFLOW_H_ | |
| 21 | #define _NET_IF_PFLOW_H_ | |
| 22 | ||
| 23 | #include <sys/cdefs.h> | |
| 24 | #include <sys/types.h> | |
| 25 | #include <sys/socket.h> | |
| 26 | ||
| 27 | #include <netinet/in.h> | |
| 28 | ||
| 29 | #ifdef _KERNEL | |
| 30 | #include <sys/param.h> | |
| 31 | #include <sys/lock.h> | |
| 32 | #include <sys/rmlock.h> | |
| 33 | #include <sys/interrupt.h> | |
| 34 | #include <net/if.h> | |
| 35 | #include <net/if_var.h> | |
| 36 | #include <net/if_private.h> | |
| 37 | #include <net/pfvar.h> | |
| 38 | ||
| 39 | #include <netinet/ip.h> | |
| 40 | #endif | |
| 41 | ||
| 42 | #define PFLOW_MAX_ENTRIES	128 | |
| 43 | ||
| 44 | #define PFLOW_ID_LEN	sizeof(u_int64_t) | |
| 45 | ||
| 46 | #define PFLOW_MAXFLOWS 30 | |
| 47 | #define PFLOW_ENGINE_TYPE 42 | |
| 48 | #define PFLOW_ENGINE_ID 42 | |
| 49 | #define PFLOW_MAXBYTES 0xffffffff | |
| 50 | #define PFLOW_TIMEOUT 30 | |
| 51 | #define PFLOW_TMPL_TIMEOUT 30 /* rfc 5101 10.3.6 (p.40) recommends 600 */ | |
| 52 | ||
| 53 | #define PFLOW_IPFIX_TMPL_SET_ID 2 | |
| 54 | ||
| 55 | /* RFC 5102 Information Element Identifiers */ | |
| 56 | ||
| 57 | #define PFIX_IE_octetDeltaCount			 1 | |
| 58 | #define PFIX_IE_packetDeltaCount		 2 | |
| 59 | #define PFIX_IE_protocolIdentifier		 4 | |
| 60 | #define PFIX_IE_ipClassOfService		 5 | |
| 61 | #define PFIX_IE_sourceTransportPort		 7 | |
| 62 | #define PFIX_IE_sourceIPv4Address		 8 | |
| 63 | #define PFIX_IE_ingressInterface		 10 | |
| 64 | #define PFIX_IE_destinationTransportPort	 11 | |
| 65 | #define PFIX_IE_destinationIPv4Address		 12 | |
| 66 | #define PFIX_IE_egressInterface			 14 | |
| 67 | #define PFIX_IE_flowEndSysUpTime		 21 | |
| 68 | #define PFIX_IE_flowStartSysUpTime		 22 | |
| 69 | #define PFIX_IE_sourceIPv6Address		 27 | |
| 70 | #define PFIX_IE_destinationIPv6Address		 28 | |
| 71 | #define PFIX_IE_flowStartMilliseconds		152 | |
| 72 | #define PFIX_IE_flowEndMilliseconds		153 | |
| 73 | #define PFIX_IE_postNATSourceIPv4Address	225 | |
| 74 | #define PFIX_IE_postNATDestinationIPv4Address	226 | |
| 75 | #define PFIX_IE_postNAPTSourceTransportPort	227 | |
| 76 | #define PFIX_IE_postNAPTDestinationTransportPort	228 | |
| 77 | #define PFIX_IE_natEvent			230 | |
| 78 | #define PFIX_NAT_EVENT_SESSION_CREATE		4 | |
| 79 | #define PFIX_NAT_EVENT_SESSION_DELETE		5 | |
| 80 | #define PFIX_IE_timeStamp			323 | |
| 81 | ||
| 82 | struct pflow_flow { | |
| 83 | 	u_int32_t	src_ip; | |
| 84 | 	u_int32_t	dest_ip; | |
| 85 | 	u_int32_t	nexthop_ip; | |
| 86 | 	u_int16_t	if_index_in; | |
| 87 | 	u_int16_t	if_index_out; | |
| 88 | 	u_int32_t	flow_packets; | |
| 89 | 	u_int32_t	flow_octets; | |
| 90 | 	u_int32_t	flow_start; | |
| 91 | 	u_int32_t	flow_finish; | |
| 92 | 	u_int16_t	src_port; | |
| 93 | 	u_int16_t	dest_port; | |
| 94 | 	u_int8_t	pad1; | |
| 95 | 	u_int8_t	tcp_flags; | |
| 96 | 	u_int8_t	protocol; | |
| 97 | 	u_int8_t	tos; | |
| 98 | 	u_int16_t	src_as; | |
| 99 | 	u_int16_t	dest_as; | |
| 100 | 	u_int8_t	src_mask; | |
| 101 | 	u_int8_t	dest_mask; | |
| 102 | 	u_int16_t	pad2; | |
| 103 | } __packed; | |
| 104 | ||
| 105 | struct pflow_set_header { | |
| 106 | 	u_int16_t	set_id; | |
| 107 | 	u_int16_t	set_length; /* total length of the set, | |
| 108 | 				 in octets, including the set header */ | |
| 109 | } __packed; | |
| 110 | ||
| 111 | #define PFLOW_SET_HDRLEN sizeof(struct pflow_set_header) | |
| 112 | ||
| 113 | struct pflow_tmpl_hdr { | |
| 114 | 	u_int16_t	tmpl_id; | |
| 115 | 	u_int16_t	field_count; | |
| 116 | } __packed; | |
| 117 | ||
| 118 | struct pflow_tmpl_fspec { | |
| 119 | 	u_int16_t	field_id; | |
| 120 | 	u_int16_t	len; | |
| 121 | } __packed; | |
| 122 | ||
| 123 | /* update pflow_clone_create() when changing pflow_ipfix_tmpl_ipv4 */ | |
| 124 | struct pflow_ipfix_tmpl_ipv4 { | |
| 125 | 	struct pflow_tmpl_hdr	h; | |
| 126 | 	struct pflow_tmpl_fspec	src_ip; | |
| 127 | 	struct pflow_tmpl_fspec	dest_ip; | |
| 128 | 	struct pflow_tmpl_fspec	if_index_in; | |
| 129 | 	struct pflow_tmpl_fspec	if_index_out; | |
| 130 | 	struct pflow_tmpl_fspec	packets; | |
| 131 | 	struct pflow_tmpl_fspec	octets; | |
| 132 | 	struct pflow_tmpl_fspec	start; | |
| 133 | 	struct pflow_tmpl_fspec	finish; | |
| 134 | 	struct pflow_tmpl_fspec	src_port; | |
| 135 | 	struct pflow_tmpl_fspec	dest_port; | |
| 136 | 	struct pflow_tmpl_fspec	tos; | |
| 137 | 	struct pflow_tmpl_fspec	protocol; | |
| 138 | #define PFLOW_IPFIX_TMPL_IPV4_FIELD_COUNT 12 | |
| 139 | #define PFLOW_IPFIX_TMPL_IPV4_ID 256 | |
| 140 | } __packed; | |
| 141 | ||
| 142 | /* update pflow_clone_create() when changing pflow_ipfix_tmpl_v6 */ | |
| 143 | struct pflow_ipfix_tmpl_ipv6 { | |
| 144 | 	struct pflow_tmpl_hdr	h; | |
| 145 | 	struct pflow_tmpl_fspec	src_ip; | |
| 146 | 	struct pflow_tmpl_fspec	dest_ip; | |
| 147 | 	struct pflow_tmpl_fspec	if_index_in; | |
| 148 | 	struct pflow_tmpl_fspec	if_index_out; | |
| 149 | 	struct pflow_tmpl_fspec	packets; | |
| 150 | 	struct pflow_tmpl_fspec	octets; | |
| 151 | 	struct pflow_tmpl_fspec	start; | |
| 152 | 	struct pflow_tmpl_fspec	finish; | |
| 153 | 	struct pflow_tmpl_fspec	src_port; | |
| 154 | 	struct pflow_tmpl_fspec	dest_port; | |
| 155 | 	struct pflow_tmpl_fspec	tos; | |
| 156 | 	struct pflow_tmpl_fspec	protocol; | |
| 157 | #define PFLOW_IPFIX_TMPL_IPV6_FIELD_COUNT 12 | |
| 158 | #define PFLOW_IPFIX_TMPL_IPV6_ID 257 | |
| 159 | } __packed; | |
| 160 | ||
| 161 | struct pflow_ipfix_tmpl_nat44 { | |
| 162 | 	struct pflow_tmpl_hdr	h; | |
| 163 | 	struct pflow_tmpl_fspec timestamp; | |
| 164 | 	struct pflow_tmpl_fspec nat_event; | |
| 165 | 	struct pflow_tmpl_fspec protocol; | |
| 166 | 	struct pflow_tmpl_fspec src_ip; | |
| 167 | 	struct pflow_tmpl_fspec src_port; | |
| 168 | 	struct pflow_tmpl_fspec postnat_src_ip; | |
| 169 | 	struct pflow_tmpl_fspec postnat_src_port; | |
| 170 | 	struct pflow_tmpl_fspec dst_ip; | |
| 171 | 	struct pflow_tmpl_fspec dst_port; | |
| 172 | 	struct pflow_tmpl_fspec postnat_dst_ip; | |
| 173 | 	struct pflow_tmpl_fspec postnat_dst_port; | |
| 174 | #define PFLOW_IPFIX_TMPL_NAT44_FIELD_COUNT 11 | |
| 175 | #define PFLOW_IPFIX_TMPL_NAT44_ID 258 | |
| 176 | }; | |
| 177 | ||
| 178 | struct pflow_ipfix_tmpl { | |
| 179 | 	struct pflow_set_header	set_header; | |
| 180 | 	struct pflow_ipfix_tmpl_ipv4	ipv4_tmpl; | |
| 181 | 	struct pflow_ipfix_tmpl_ipv6	ipv6_tmpl; | |
| 182 | 	struct pflow_ipfix_tmpl_nat44	nat44_tmpl; | |
| 183 | } __packed; | |
| 184 | ||
| 185 | struct pflow_ipfix_flow4 { | |
| 186 | 	u_int32_t	src_ip;		/* sourceIPv4Address*/ | |
| 187 | 	u_int32_t	dest_ip;	/* destinationIPv4Address */ | |
| 188 | 	u_int32_t	if_index_in;	/* ingressInterface */ | |
| 189 | 	u_int32_t	if_index_out;	/* egressInterface */ | |
| 190 | 	u_int64_t	flow_packets;	/* packetDeltaCount */ | |
| 191 | 	u_int64_t	flow_octets;	/* octetDeltaCount */ | |
| 192 | 	int64_t		flow_start;	/* flowStartMilliseconds */ | |
| 193 | 	int64_t		flow_finish;	/* flowEndMilliseconds */ | |
| 194 | 	u_int16_t	src_port;	/* sourceTransportPort */ | |
| 195 | 	u_int16_t	dest_port;	/* destinationTransportPort */ | |
| 196 | 	u_int8_t	tos;		/* ipClassOfService */ | |
| 197 | 	u_int8_t	protocol;	/* protocolIdentifier */ | |
| 198 | 	/* XXX padding needed? */ | |
| 199 | } __packed; | |
| 200 | ||
| 201 | struct pflow_ipfix_flow6 { | |
| 202 | 	struct in6_addr src_ip;		/* sourceIPv6Address */ | |
| 203 | 	struct in6_addr dest_ip;	/* destinationIPv6Address */ | |
| 204 | 	u_int32_t	if_index_in;	/* ingressInterface */ | |
| 205 | 	u_int32_t	if_index_out;	/* egressInterface */ | |
| 206 | 	u_int64_t	flow_packets;	/* packetDeltaCount */ | |
| 207 | 	u_int64_t	flow_octets;	/* octetDeltaCount */ | |
| 208 | 	int64_t		flow_start;	/* flowStartMilliseconds */ | |
| 209 | 	int64_t		flow_finish;	/* flowEndMilliseconds */ | |
| 210 | 	u_int16_t	src_port;	/* sourceTransportPort */ | |
| 211 | 	u_int16_t	dest_port;	/* destinationTransportPort */ | |
| 212 | 	u_int8_t	tos;		/* ipClassOfService */ | |
| 213 | 	u_int8_t	protocol;	/* protocolIdentifier */ | |
| 214 | 	/* XXX padding needed? */ | |
| 215 | } __packed; | |
| 216 | ||
| 217 | struct pflow_ipfix_nat4 { | |
| 218 | 	u_int64_t	timestamp;	/* timeStamp */ | |
| 219 | 	u_int8_t	nat_event;	/* natEvent */ | |
| 220 | 	u_int8_t	protocol;	/* protocolIdentifier */ | |
| 221 | 	u_int32_t	src_ip;		/* sourceIPv4Address */ | |
| 222 | 	u_int16_t	src_port;	/* sourceTransportPort */ | |
| 223 | 	u_int32_t	postnat_src_ip;	/* postNATSourceIPv4Address */ | |
| 224 | 	u_int16_t	postnat_src_port;/* postNAPTSourceTransportPort */ | |
| 225 | 	u_int32_t	dest_ip;	/* destinationIPv4Address */ | |
| 226 | 	u_int16_t	dest_port;	/* destinationTransportPort */ | |
| 227 | 	u_int32_t	postnat_dest_ip;/* postNATDestinationIPv4Address */ | |
| 228 | 	u_int16_t	postnat_dest_port;/* postNAPTDestinationTransportPort */ | |
| 229 | } __packed; | |
| 230 | ||
| 231 | #ifdef _KERNEL | |
| 232 | ||
| 233 | struct pflow_softc { | |
| 234 | 	int			 sc_id; | |
| 235 | ||
| 236 | 	struct mtx		 sc_lock; | |
| 237 | ||
| 238 | 	int			 sc_dying;	/* [N] */ | |
| 239 | 	struct vnet		*sc_vnet; | |
| 240 | ||
| 241 | 	unsigned int		 sc_count; | |
| 242 | 	unsigned int		 sc_count4; | |
| 243 | 	unsigned int		 sc_count6; | |
| 244 | 	unsigned int		 sc_count_nat4; | |
| 245 | 	unsigned int		 sc_maxcount; | |
| 246 | 	unsigned int		 sc_maxcount4; | |
| 247 | 	unsigned int		 sc_maxcount6; | |
| 248 | 	unsigned int		 sc_maxcount_nat4; | |
| 249 | 	u_int32_t		 sc_gcounter; | |
| 250 | 	u_int32_t		 sc_sequence; | |
| 251 | 	struct callout		 sc_tmo; | |
| 252 | 	struct callout		 sc_tmo6; | |
| 253 | 	struct callout		 sc_tmo_nat4; | |
| 254 | 	struct callout		 sc_tmo_tmpl; | |
| 255 | 	struct intr_event	*sc_swi_ie; | |
| 256 | 	void			*sc_swi_cookie; | |
| 257 | 	struct mbufq		 sc_outputqueue; | |
| 258 | 	struct task		 sc_outputtask; | |
| 259 | 	struct socket		*so;		/* [p] */ | |
| 260 | 	struct sockaddr		*sc_flowsrc; | |
| 261 | 	struct sockaddr		*sc_flowdst; | |
| 262 | 	struct pflow_ipfix_tmpl	 sc_tmpl_ipfix; | |
| 263 | 	u_int8_t		 sc_version; | |
| 264 | 	u_int32_t		 sc_observation_dom; | |
| 265 | 	struct mbuf		*sc_mbuf;	/* current cumulative mbuf */ | |
| 266 | 	struct mbuf		*sc_mbuf6;	/* current cumulative mbuf */ | |
| 267 | 	struct mbuf		*sc_mbuf_nat4; | |
| 268 | 	CK_LIST_ENTRY(pflow_softc) sc_next; | |
| 269 | 	struct epoch_context	 sc_epoch_ctx; | |
| 270 | }; | |
| 271 | ||
| 272 | #endif /* _KERNEL */ | |
| 273 | ||
| 274 | struct pflow_header { | |
| 275 | 	u_int16_t	version; | |
| 276 | 	u_int16_t	count; | |
| 277 | 	u_int32_t	uptime_ms; | |
| 278 | 	u_int32_t	time_sec; | |
| 279 | 	u_int32_t	time_nanosec; | |
| 280 | 	u_int32_t	flow_sequence; | |
| 281 | 	u_int8_t	engine_type; | |
| 282 | 	u_int8_t	engine_id; | |
| 283 | 	u_int8_t	reserved1; | |
| 284 | 	u_int8_t	reserved2; | |
| 285 | } __packed; | |
| 286 | ||
| 287 | #define PFLOW_HDRLEN sizeof(struct pflow_header) | |
| 288 | ||
| 289 | struct pflow_v10_header { | |
| 290 | 	u_int16_t	version; | |
| 291 | 	u_int16_t	length; | |
| 292 | 	u_int32_t	time_sec; | |
| 293 | 	u_int32_t	flow_sequence; | |
| 294 | 	u_int32_t	observation_dom; | |
| 295 | } __packed; | |
| 296 | ||
| 297 | #define PFLOW_IPFIX_HDRLEN sizeof(struct pflow_v10_header) | |
| 298 | ||
| 299 | struct pflowstats { | |
| 300 | 	u_int64_t	pflow_flows; | |
| 301 | 	u_int64_t	pflow_packets; | |
| 302 | 	u_int64_t	pflow_onomem; | |
| 303 | 	u_int64_t	pflow_oerrors; | |
| 304 | }; | |
| 305 | ||
| 306 | /* Supported flow protocols */ | |
| 307 | #define PFLOW_PROTO_5	5	/* original pflow */ | |
| 308 | #define PFLOW_PROTO_10	10	/* ipfix */ | |
| 309 | #define PFLOW_PROTO_MAX	11 | |
| 310 | ||
| 311 | #define PFLOW_PROTO_DEFAULT PFLOW_PROTO_5 | |
| 312 | ||
| 313 | struct pflow_protos { | |
| 314 | 	const char	*ppr_name; | |
| 315 | 	u_int8_t	 ppr_proto; | |
| 316 | }; | |
| 317 | ||
| 318 | #define PFLOW_PROTOS { \ | |
| 319 | 		{ "5",	PFLOW_PROTO_5 },	 \ | |
| 320 | 		{ "10",	PFLOW_PROTO_10 },	 \ | |
| 321 | } | |
| 322 | ||
| 323 | #define PFLOWNL_FAMILY_NAME	"pflow" | |
| 324 | ||
| 325 | enum { | |
| 326 | 	PFLOWNL_CMD_UNSPEC = 0, | |
| 327 | 	PFLOWNL_CMD_LIST = 1, | |
| 328 | 	PFLOWNL_CMD_CREATE = 2, | |
| 329 | 	PFLOWNL_CMD_DEL = 3, | |
| 330 | 	PFLOWNL_CMD_SET = 4, | |
| 331 | 	PFLOWNL_CMD_GET = 5, | |
| 332 | 	__PFLOWNL_CMD_MAX, | |
| 333 | }; | |
| 334 | #define PFLOWNL_CMD_MAX (__PFLOWNL_CMD_MAX - 1) | |
| 335 | ||
| 336 | enum pflow_list_type_t { | |
| 337 | 	PFLOWNL_L_UNSPEC, | |
| 338 | 	PFLOWNL_L_ID		= 1, /* u32 */ | |
| 339 | }; | |
| 340 | ||
| 341 | enum pflow_create_type_t { | |
| 342 | 	PFLOWNL_CREATE_UNSPEC, | |
| 343 | 	PFLOWNL_CREATE_ID	= 1, /* u32 */ | |
| 344 | }; | |
| 345 | ||
| 346 | enum pflow_del_type_t { | |
| 347 | 	PFLOWNL_DEL_UNSPEC, | |
| 348 | 	PFLOWNL_DEL_ID		= 1, /* u32 */ | |
| 349 | }; | |
| 350 | ||
| 351 | enum pflow_addr_type_t { | |
| 352 | 	PFLOWNL_ADDR_UNSPEC, | |
| 353 | 	PFLOWNL_ADDR_FAMILY	= 1, /* u8 */ | |
| 354 | 	PFLOWNL_ADDR_PORT	= 2, /* u16 */ | |
| 355 | 	PFLOWNL_ADDR_IP		= 3, /* struct in_addr */ | |
| 356 | 	PFLOWNL_ADDR_IP6	= 4, /* struct in6_addr */ | |
| 357 | }; | |
| 358 | ||
| 359 | enum pflow_get_type_t { | |
| 360 | 	PFLOWNL_GET_UNSPEC, | |
| 361 | 	PFLOWNL_GET_ID		= 1, /* u32 */ | |
| 362 | 	PFLOWNL_GET_VERSION	= 2, /* u16 */ | |
| 363 | 	PFLOWNL_GET_SRC		= 3, /* struct sockaddr_storage */ | |
| 364 | 	PFLOWNL_GET_DST		= 4, /* struct sockaddr_storage */ | |
| 365 | 	PFLOWNL_GET_OBSERVATION_DOMAIN	= 5, /* u32 */ | |
| 366 | 	PFLOWNL_GET_SOCKET_STATUS	= 6, /* u8 */ | |
| 367 | }; | |
| 368 | ||
| 369 | enum pflow_set_type_t { | |
| 370 | 	PFLOWNL_SET_UNSPEC, | |
| 371 | 	PFLOWNL_SET_ID		= 1, /* u32 */ | |
| 372 | 	PFLOWNL_SET_VERSION	= 2, /* u16 */ | |
| 373 | 	PFLOWNL_SET_SRC		= 3, /* struct sockaddr_storage */ | |
| 374 | 	PFLOWNL_SET_DST		= 4, /* struct sockaddr_storage */ | |
| 375 | 	PFLOWNL_SET_OBSERVATION_DOMAIN = 5, /* u32 */ | |
| 376 | }; | |
| 377 | ||
| 378 | #ifdef _KERNEL | |
| 379 | int pflow_sysctl(int *, u_int, void *, size_t *, void *, size_t); | |
| 380 | #endif /* _KERNEL */ | |
| 381 | ||
| 382 | #endif /* _NET_IF_PFLOW_H_ */ | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/net/pfvar.h+497-254| ... | ... | @@ -70,6 +70,8 @@ |
| 70 | 70 | |
| 71 | 71 | #ifdef _KERNEL |
| 72 | 72 | |
| 73 | #define PF_PFIL_NOREFRAGMENT 0x80000000 | |
| 74 | ||
| 73 | 75 | #if defined(__arm__) |
| 74 | 76 | #define PF_WANT_32_TO_64_COUNTER |
| 75 | 77 | #endif |
| ... | ... | @@ -127,6 +129,14 @@ pf_counter_u64_critical_exit(void) |
| 127 | 129 | 	critical_exit(); |
| 128 | 130 | } |
| 129 | 131 | |
| 132 | static inline void | |
| 133 | pf_counter_u64_rollup_protected(struct pf_counter_u64 *pfcu64, uint64_t n) | |
| 134 | { | |
| 135 | ||
| 136 | 	MPASS(curthread->td_critnest > 0); | |
| 137 | 	pfcu64->pfcu64_value += n; | |
| 138 | } | |
| 139 | ||
| 130 | 140 | static inline void |
| 131 | 141 | pf_counter_u64_add_protected(struct pf_counter_u64 *pfcu64, uint32_t n) |
| 132 | 142 | { |
| ... | ... | @@ -250,6 +260,13 @@ pf_counter_u64_critical_exit(void) |
| 250 | 260 | |
| 251 | 261 | } |
| 252 | 262 | |
| 263 | static inline void | |
| 264 | pf_counter_u64_rollup_protected(struct pf_counter_u64 *pfcu64, uint64_t n) | |
| 265 | { | |
| 266 | ||
| 267 | 	counter_u64_add(pfcu64->counter, n); | |
| 268 | } | |
| 269 | ||
| 253 | 270 | static inline void |
| 254 | 271 | pf_counter_u64_add_protected(struct pf_counter_u64 *pfcu64, uint32_t n) |
| 255 | 272 | { |
| ... | ... | @@ -309,10 +326,20 @@ pf_counter_u64_zero(struct pf_counter_u64 *pfcu64) |
| 309 | 326 | _Static_assert(sizeof(time_t) == 4 || sizeof(time_t) == 8, "unexpected time_t size"); |
| 310 | 327 | |
| 311 | 328 | SYSCTL_DECL(_net_pf); |
| 329 | MALLOC_DECLARE(M_PF); | |
| 312 | 330 | MALLOC_DECLARE(M_PFHASH); |
| 313 | 331 | MALLOC_DECLARE(M_PF_RULE_ITEM); |
| 314 | 332 | |
| 315 | 333 | SDT_PROVIDER_DECLARE(pf); |
| 334 | SDT_PROBE_DECLARE(pf, , test, reason_set); | |
| 335 | SDT_PROBE_DECLARE(pf, , log, log); | |
| 336 | ||
| 337 | #define DPFPRINTF(n, fmt, x...)				\ | |
| 338 | 	do {						\ | |
| 339 | 		SDT_PROBE2(pf, , log, log, (n), fmt);	\ | |
| 340 | 		if (V_pf_status.debug >= (n))	 	\ | |
| 341 | 			printf(fmt "\n", ##x); 		\ | |
| 342 | 	} while (0) | |
| 316 | 343 | |
| 317 | 344 | struct pfi_dynaddr { |
| 318 | 345 | 	TAILQ_ENTRY(pfi_dynaddr)	 entry; |
| ... | ... | @@ -329,14 +356,6 @@ struct pfi_dynaddr { |
| 329 | 356 | 	u_int8_t			 pfid_iflags;	/* PFI_AFLAG_* */ |
| 330 | 357 | }; |
| 331 | 358 | |
| 332 | /* | |
| 333 | * Address manipulation macros | |
| 334 | */ | |
| 335 | #define	HTONL(x)	(x) = htonl((__uint32_t)(x)) | |
| 336 | #define	HTONS(x)	(x) = htons((__uint16_t)(x)) | |
| 337 | #define	NTOHL(x)	(x) = ntohl((__uint32_t)(x)) | |
| 338 | #define	NTOHS(x)	(x) = ntohs((__uint16_t)(x)) | |
| 339 | ||
| 340 | 359 | #define	PF_NAME		"pf" |
| 341 | 360 | |
| 342 | 361 | #define	PF_HASHROW_ASSERT(h)	mtx_assert(&(h)->lock, MA_OWNED) |
| ... | ... | @@ -433,6 +452,16 @@ VNET_DECLARE(struct rmlock, pf_rules_lock); |
| 433 | 452 | #define	PF_RULES_RASSERT()	rm_assert(&V_pf_rules_lock, RA_RLOCKED) |
| 434 | 453 | #define	PF_RULES_WASSERT()	rm_assert(&V_pf_rules_lock, RA_WLOCKED) |
| 435 | 454 | |
| 455 | VNET_DECLARE(struct rmlock, pf_tags_lock); | |
| 456 | #define	V_pf_tags_lock		VNET(pf_tags_lock) | |
| 457 | ||
| 458 | #define	PF_TAGS_RLOCK_TRACKER	struct rm_priotracker _pf_tags_tracker | |
| 459 | #define	PF_TAGS_RLOCK()		rm_rlock(&V_pf_tags_lock, &_pf_tags_tracker) | |
| 460 | #define	PF_TAGS_RUNLOCK()	rm_runlock(&V_pf_tags_lock, &_pf_tags_tracker) | |
| 461 | #define	PF_TAGS_WLOCK()		rm_wlock(&V_pf_tags_lock) | |
| 462 | #define	PF_TAGS_WUNLOCK()	rm_wunlock(&V_pf_tags_lock) | |
| 463 | #define	PF_TAGS_WASSERT()	rm_assert(&V_pf_tags_lock, RA_WLOCKED) | |
| 464 | ||
| 436 | 465 | extern struct mtx_padalign pf_table_stats_lock; |
| 437 | 466 | #define	PF_TABLE_STATS_LOCK()	mtx_lock(&pf_table_stats_lock) |
| 438 | 467 | #define	PF_TABLE_STATS_UNLOCK()	mtx_unlock(&pf_table_stats_lock) |
| ... | ... | @@ -498,18 +527,6 @@ extern struct sx pf_end_lock; |
| 498 | 527 | 	(c == AF_INET6 && !(a)->addr32[0] && !(a)->addr32[1] && \ |
| 499 | 528 | 	!(a)->addr32[2] && !(a)->addr32[3] )) \ |
| 500 | 529 | |
| 501 | #define PF_MATCHA(n, a, m, b, f) \ | |
| 502 | 	pf_match_addr(n, a, m, b, f) | |
| 503 | ||
| 504 | #define PF_ACPY(a, b, f) \ | |
| 505 | 	pf_addrcpy(a, b, f) | |
| 506 | ||
| 507 | #define PF_AINC(a, f) \ | |
| 508 | 	pf_addr_inc(a, f) | |
| 509 | ||
| 510 | #define PF_POOLMASK(a, b, c, d, f) \ | |
| 511 | 	pf_poolmask(a, b, c, d, f) | |
| 512 | ||
| 513 | 530 | #else |
| 514 | 531 | |
| 515 | 532 | /* Just IPv6 */ |
| ... | ... | @@ -534,18 +551,6 @@ extern struct sx pf_end_lock; |
| 534 | 551 | 	!(a)->addr32[2] && \ |
| 535 | 552 | 	!(a)->addr32[3] ) \ |
| 536 | 553 | |
| 537 | #define PF_MATCHA(n, a, m, b, f) \ | |
| 538 | 	pf_match_addr(n, a, m, b, f) | |
| 539 | ||
| 540 | #define PF_ACPY(a, b, f) \ | |
| 541 | 	pf_addrcpy(a, b, f) | |
| 542 | ||
| 543 | #define PF_AINC(a, f) \ | |
| 544 | 	pf_addr_inc(a, f) | |
| 545 | ||
| 546 | #define PF_POOLMASK(a, b, c, d, f) \ | |
| 547 | 	pf_poolmask(a, b, c, d, f) | |
| 548 | ||
| 549 | 554 | #else |
| 550 | 555 | |
| 551 | 556 | /* Just IPv4 */ |
| ... | ... | @@ -560,27 +565,34 @@ extern struct sx pf_end_lock; |
| 560 | 565 | #define PF_AZERO(a, c) \ |
| 561 | 566 | 	(!(a)->addr32[0]) |
| 562 | 567 | |
| 563 | #define PF_MATCHA(n, a, m, b, f) \ | |
| 564 | 	pf_match_addr(n, a, m, b, f) | |
| 565 | ||
| 566 | #define PF_ACPY(a, b, f) \ | |
| 567 | 	(a)->v4.s_addr = (b)->v4.s_addr | |
| 568 | ||
| 569 | #define PF_AINC(a, f) \ | |
| 570 | 	do { \ | |
| 571 | 		(a)->addr32[0] = htonl(ntohl((a)->addr32[0]) + 1); \ | |
| 572 | 	} while (0) | |
| 573 | ||
| 574 | #define PF_POOLMASK(a, b, c, d, f) \ | |
| 575 | 	do { \ | |
| 576 | 		(a)->addr32[0] = ((b)->addr32[0] & (c)->addr32[0]) | \ | |
| 577 | 		(((c)->addr32[0] ^ 0xffffffff ) & (d)->addr32[0]); \ | |
| 578 | 	} while (0) | |
| 579 | ||
| 580 | 568 | #endif /* PF_INET_ONLY */ |
| 581 | 569 | #endif /* PF_INET6_ONLY */ |
| 582 | 570 | #endif /* PF_INET_INET6 */ |
| 583 | 571 | |
| 572 | #ifdef _KERNEL | |
| 573 | ||
| 574 | void				 unhandled_af(int) __dead2; | |
| 575 | ||
| 576 | static void inline | |
| 577 | pf_addrcpy(struct pf_addr *dst, const struct pf_addr *src, sa_family_t af) | |
| 578 | { | |
| 579 | 	switch (af) { | |
| 580 | #ifdef INET | |
| 581 | 	case AF_INET: | |
| 582 | 		memcpy(&dst->v4, &src->v4, sizeof(dst->v4)); | |
| 583 | 		break; | |
| 584 | #endif /* INET */ | |
| 585 | #ifdef INET6 | |
| 586 | 	case AF_INET6: | |
| 587 | 		memcpy(&dst->v6, &src->v6, sizeof(dst->v6)); | |
| 588 | 		break; | |
| 589 | #endif /* INET6 */ | |
| 590 | 	default: | |
| 591 | 		unhandled_af(af); | |
| 592 | 	} | |
| 593 | } | |
| 594 | #endif | |
| 595 | ||
| 584 | 596 | /* |
| 585 | 597 | * XXX callers not FIB-aware in our version of pf yet. |
| 586 | 598 | * OpenBSD fixed it later it seems, 2010/05/07 13:33:16 claudio. |
| ... | ... | @@ -600,19 +612,35 @@ extern struct sx pf_end_lock; |
| 600 | 612 | 		 &(aw)->v.a.mask, (x), (af))) ||			\ |
| 601 | 613 | 		((aw)->type == PF_ADDR_ADDRMASK &&			\ |
| 602 | 614 | 		 !PF_AZERO(&(aw)->v.a.mask, (af)) &&			\ |
| 603 | 		 !PF_MATCHA(0, &(aw)->v.a.addr,			\ | |
| 615 | 		 !pf_match_addr(0, &(aw)->v.a.addr,			\ | |
| 604 | 616 | 		 &(aw)->v.a.mask, (x), (af))))) !=			\ |
| 605 | 617 | 		(neg)							\ |
| 606 | 618 | 	) |
| 607 | 619 | |
| 608 | 620 | #define PF_ALGNMNT(off) (((off) % 2) == 0) |
| 609 | 621 | |
| 622 | /* | |
| 623 | * At the moment there are no rules which have both NAT and RDR actions, | |
| 624 | * apart from af-to rules, but those don't to source tracking for address | |
| 625 | * translation. And the r->rdr pool is used for both NAT and RDR. | |
| 626 | * So there is no PF_SN_RDR. | |
| 627 | */ | |
| 628 | enum pf_sn_types { PF_SN_LIMIT, PF_SN_NAT, PF_SN_ROUTE, PF_SN_MAX }; | |
| 629 | typedef enum pf_sn_types pf_sn_types_t; | |
| 630 | #define PF_SN_TYPE_NAMES { \ | |
| 631 | 	"limit source-track", \ | |
| 632 | 	"NAT/RDR sticky-address", \ | |
| 633 | 	"route sticky-address", \ | |
| 634 | 	NULL \ | |
| 635 | } | |
| 636 | ||
| 610 | 637 | #ifdef _KERNEL |
| 611 | 638 | |
| 612 | 639 | struct pf_kpooladdr { |
| 613 | 640 | 	struct pf_addr_wrap		 addr; |
| 614 | 641 | 	TAILQ_ENTRY(pf_kpooladdr)	 entries; |
| 615 | 642 | 	char				 ifname[IFNAMSIZ]; |
| 643 | 	sa_family_t		 	 af; | |
| 616 | 644 | 	struct pfi_kkif			*kif; |
| 617 | 645 | }; |
| 618 | 646 | |
| ... | ... | @@ -628,20 +656,27 @@ struct pf_kpool { |
| 628 | 656 | 	int			 tblidx; |
| 629 | 657 | 	u_int16_t		 proxy_port[2]; |
| 630 | 658 | 	u_int8_t		 opts; |
| 659 | 	sa_family_t		 ipv6_nexthop_af; | |
| 631 | 660 | }; |
| 632 | 661 | |
| 633 | 662 | struct pf_rule_actions { |
| 663 | 	struct pf_addr	 rt_addr; | |
| 664 | 	struct pfi_kkif	*rt_kif; | |
| 634 | 665 | 	int32_t		 rtableid; |
| 666 | 	uint32_t	 flags; | |
| 635 | 667 | 	uint16_t	 qid; |
| 636 | 668 | 	uint16_t	 pqid; |
| 637 | 669 | 	uint16_t	 max_mss; |
| 670 | 	uint16_t	 dnpipe; | |
| 671 | 	uint16_t	 dnrpipe;	/* Reverse direction pipe */ | |
| 672 | 	sa_family_t	 rt_af; | |
| 638 | 673 | 	uint8_t		 log; |
| 639 | 674 | 	uint8_t		 set_tos; |
| 640 | 675 | 	uint8_t		 min_ttl; |
| 641 | 	uint16_t	 dnpipe; | |
| 642 | 	uint16_t	 dnrpipe;	/* Reverse direction pipe */ | |
| 643 | 	uint32_t	 flags; | |
| 644 | 676 | 	uint8_t		 set_prio[2]; |
| 677 | 	uint8_t		 rt; | |
| 678 | 	uint8_t		 allow_opts; | |
| 679 | 	uint16_t	 max_pkt_size; | |
| 645 | 680 | }; |
| 646 | 681 | |
| 647 | 682 | union pf_keth_rule_ptr { |
| ... | ... | @@ -667,7 +702,6 @@ struct pf_keth_ruleset { |
| 667 | 702 | 		int			 open; |
| 668 | 703 | 		uint32_t		 ticket; |
| 669 | 704 | 	} active, inactive; |
| 670 | 	struct epoch_context	 epoch_ctx; | |
| 671 | 705 | 	struct vnet		*vnet; |
| 672 | 706 | 	struct pf_keth_anchor	*anchor; |
| 673 | 707 | }; |
| ... | ... | @@ -746,9 +780,10 @@ struct pf_keth_rule { |
| 746 | 780 | 	uint32_t		ridentifier; |
| 747 | 781 | }; |
| 748 | 782 | |
| 749 | union pf_krule_ptr { | |
| 750 | 	struct pf_krule		*ptr; | |
| 751 | 	u_int32_t		 nr; | |
| 783 | struct pf_kthreshold { | |
| 784 | 	uint32_t		 limit; | |
| 785 | 	uint32_t		 seconds; | |
| 786 | 	struct counter_rate	*cr; | |
| 752 | 787 | }; |
| 753 | 788 | |
| 754 | 789 | RB_HEAD(pf_krule_global, pf_krule); |
| ... | ... | @@ -757,10 +792,11 @@ RB_PROTOTYPE(pf_krule_global, pf_krule, entry_global, pf_krule_compare); |
| 757 | 792 | struct pf_krule { |
| 758 | 793 | 	struct pf_rule_addr	 src; |
| 759 | 794 | 	struct pf_rule_addr	 dst; |
| 760 | 	union pf_krule_ptr	 skip[PF_SKIP_COUNT]; | |
| 795 | 	struct pf_krule		*skip[PF_SKIP_COUNT]; | |
| 761 | 796 | 	char			 label[PF_RULE_MAX_LABEL_COUNT][PF_RULE_LABEL_SIZE]; |
| 762 | 797 | 	uint32_t		 ridentifier; |
| 763 | 798 | 	char			 ifname[IFNAMSIZ]; |
| 799 | 	char			 rcv_ifname[IFNAMSIZ]; | |
| 764 | 800 | 	char			 qname[PF_QNAME_SIZE]; |
| 765 | 801 | 	char			 pqname[PF_QNAME_SIZE]; |
| 766 | 802 | 	char			 tagname[PF_TAG_NAME_SIZE]; |
| ... | ... | @@ -769,7 +805,10 @@ struct pf_krule { |
| 769 | 805 | 	char			 overload_tblname[PF_TABLE_NAME_SIZE]; |
| 770 | 806 | |
| 771 | 807 | 	TAILQ_ENTRY(pf_krule)	 entries; |
| 772 | 	struct pf_kpool		 rpool; | |
| 808 | 	struct pf_kpool		 nat; | |
| 809 | 	struct pf_kpool		 rdr; | |
| 810 | 	struct pf_kpool		 route; | |
| 811 | 	struct pf_kthreshold	 pktrate; | |
| 773 | 812 | |
| 774 | 813 | 	struct pf_counter_u64	 evaluations; |
| 775 | 814 | 	struct pf_counter_u64	 packets[2]; |
| ... | ... | @@ -777,6 +816,7 @@ struct pf_krule { |
| 777 | 816 | 	time_t			*timestamp; |
| 778 | 817 | |
| 779 | 818 | 	struct pfi_kkif		*kif; |
| 819 | 	struct pfi_kkif		*rcv_kif; | |
| 780 | 820 | 	struct pf_kanchor	*anchor; |
| 781 | 821 | 	struct pfr_ktable	*overload_tbl; |
| 782 | 822 | |
| ... | ... | @@ -792,6 +832,7 @@ struct pf_krule { |
| 792 | 832 | 		u_int32_t		limit; |
| 793 | 833 | 		u_int32_t		seconds; |
| 794 | 834 | 	}			 max_src_conn_rate; |
| 835 | 	uint16_t		 max_pkt_size; | |
| 795 | 836 | 	u_int16_t		 qid; |
| 796 | 837 | 	u_int16_t		 pqid; |
| 797 | 838 | 	u_int16_t		 dnpipe; |
| ... | ... | @@ -804,7 +845,7 @@ struct pf_krule { |
| 804 | 845 | |
| 805 | 846 | 	counter_u64_t		 states_cur; |
| 806 | 847 | 	counter_u64_t		 states_tot; |
| 807 | 	counter_u64_t		 src_nodes; | |
| 848 | 	counter_u64_t		 src_nodes[PF_SN_MAX]; | |
| 808 | 849 | |
| 809 | 850 | 	u_int16_t		 return_icmp; |
| 810 | 851 | 	u_int16_t		 return_icmp6; |
| ... | ... | @@ -830,8 +871,8 @@ struct pf_krule { |
| 830 | 871 | 	u_int8_t		 keep_state; |
| 831 | 872 | 	sa_family_t		 af; |
| 832 | 873 | 	u_int8_t		 proto; |
| 833 | 	u_int8_t		 type; | |
| 834 | 	u_int8_t		 code; | |
| 874 | 	uint16_t		 type; | |
| 875 | 	uint16_t		 code; | |
| 835 | 876 | 	u_int8_t		 flags; |
| 836 | 877 | 	u_int8_t		 flagset; |
| 837 | 878 | 	u_int8_t		 min_ttl; |
| ... | ... | @@ -846,6 +887,8 @@ struct pf_krule { |
| 846 | 887 | 	u_int8_t		 flush; |
| 847 | 888 | 	u_int8_t		 prio; |
| 848 | 889 | 	u_int8_t		 set_prio[2]; |
| 890 | 	sa_family_t		 naf; | |
| 891 | 	u_int8_t		 rcvifnot; | |
| 849 | 892 | |
| 850 | 893 | 	struct { |
| 851 | 894 | 		struct pf_addr		addr; |
| ... | ... | @@ -869,21 +912,23 @@ SLIST_HEAD(pf_krule_slist, pf_krule_item); |
| 869 | 912 | |
| 870 | 913 | struct pf_ksrc_node { |
| 871 | 914 | 	LIST_ENTRY(pf_ksrc_node) entry; |
| 872 | 	struct pf_addr	 addr; | |
| 873 | 	struct pf_addr	 raddr; | |
| 915 | 	struct pf_addr		 addr; | |
| 916 | 	struct pf_addr		 raddr; | |
| 874 | 917 | 	struct pf_krule_slist	 match_rules; |
| 875 | 	union pf_krule_ptr rule; | |
| 876 | 	struct pfi_kkif	*rkif; | |
| 877 | 	counter_u64_t	 bytes[2]; | |
| 878 | 	counter_u64_t	 packets[2]; | |
| 879 | 	u_int32_t	 states; | |
| 880 | 	u_int32_t	 conn; | |
| 881 | 	struct pf_threshold	conn_rate; | |
| 882 | 	u_int32_t	 creation; | |
| 883 | 	u_int32_t	 expire; | |
| 884 | 	sa_family_t	 af; | |
| 885 | 	u_int8_t	 ruletype; | |
| 886 | 	struct mtx	*lock; | |
| 918 | 	struct pf_krule		*rule; | |
| 919 | 	struct pfi_kkif		*rkif; | |
| 920 | 	counter_u64_t		 bytes[2]; | |
| 921 | 	counter_u64_t		 packets[2]; | |
| 922 | 	u_int32_t		 states; | |
| 923 | 	u_int32_t		 conn; | |
| 924 | 	struct pf_kthreshold	 conn_rate; | |
| 925 | 	u_int32_t		 creation; | |
| 926 | 	u_int32_t		 expire; | |
| 927 | 	sa_family_t		 af; | |
| 928 | 	sa_family_t		 raf; | |
| 929 | 	u_int8_t		 ruletype; | |
| 930 | 	pf_sn_types_t		 type; | |
| 931 | 	struct mtx		*lock; | |
| 887 | 932 | }; |
| 888 | 933 | #endif |
| 889 | 934 | |
| ... | ... | @@ -925,6 +970,29 @@ struct pf_state_peer { |
| 925 | 970 | 	u_int8_t	pad[1]; |
| 926 | 971 | }; |
| 927 | 972 | |
| 973 | /* Keep synced with struct pf_udp_endpoint. */ | |
| 974 | struct pf_udp_endpoint_cmp { | |
| 975 | 	struct pf_addr	addr; | |
| 976 | 	uint16_t	port; | |
| 977 | 	sa_family_t	af; | |
| 978 | 	uint8_t		pad[1]; | |
| 979 | }; | |
| 980 | ||
| 981 | struct pf_udp_endpoint { | |
| 982 | 	struct pf_addr	addr; | |
| 983 | 	uint16_t	port; | |
| 984 | 	sa_family_t	af; | |
| 985 | 	uint8_t		pad[1]; | |
| 986 | ||
| 987 | 	struct pf_udp_mapping *mapping; | |
| 988 | 	LIST_ENTRY(pf_udp_endpoint) entry; | |
| 989 | }; | |
| 990 | ||
| 991 | struct pf_udp_mapping { | |
| 992 | 	struct pf_udp_endpoint endpoints[2]; | |
| 993 | 	u_int refs; | |
| 994 | }; | |
| 995 | ||
| 928 | 996 | /* Keep synced with struct pf_state_key. */ |
| 929 | 997 | struct pf_state_key_cmp { |
| 930 | 998 | 	struct pf_addr	 addr[2]; |
| ... | ... | @@ -945,6 +1013,11 @@ struct pf_state_key { |
| 945 | 1013 | 	TAILQ_HEAD(, pf_kstate)	 states[2]; |
| 946 | 1014 | }; |
| 947 | 1015 | |
| 1016 | #define PF_REVERSED_KEY(state, family)					\ | |
| 1017 | 	(((state)->key[PF_SK_WIRE]->af != (state)->key[PF_SK_STACK]->af) &&	\ | |
| 1018 | 	 ((state)->key[PF_SK_WIRE]->af != (family)) &&			\ | |
| 1019 | 	 ((state)->direction == PF_IN)) | |
| 1020 | ||
| 948 | 1021 | /* Keep synced with struct pf_kstate. */ |
| 949 | 1022 | struct pf_state_cmp { |
| 950 | 1023 | 	u_int64_t		 id; |
| ... | ... | @@ -959,7 +1032,7 @@ struct pf_state_scrub_export { |
| 959 | 1032 | #define PF_SCRUB_FLAG_VALID		0x01 |
| 960 | 1033 | 	uint8_t		scrub_flag; |
| 961 | 1034 | 	uint32_t	pfss_ts_mod;	/* timestamp modulation	*/ |
| 962 | }; | |
| 1035 | } __packed; | |
| 963 | 1036 | |
| 964 | 1037 | struct pf_state_key_export { |
| 965 | 1038 | 	struct pf_addr	 addr[2]; |
| ... | ... | @@ -976,7 +1049,7 @@ struct pf_state_peer_export { |
| 976 | 1049 | 	uint8_t		state;		/* active state level		*/ |
| 977 | 1050 | 	uint8_t		wscale;		/* window scaling factor	*/ |
| 978 | 1051 | 	uint8_t		dummy[6]; |
| 979 | }; | |
| 1052 | } __packed; | |
| 980 | 1053 | _Static_assert(sizeof(struct pf_state_peer_export) == 32, "size incorrect"); |
| 981 | 1054 | |
| 982 | 1055 | struct pf_state_export { |
| ... | ... | @@ -1040,7 +1113,7 @@ struct pf_kstate { |
| 1040 | 1113 | 	u_int16_t		 state_flags; |
| 1041 | 1114 | 	u_int8_t		 timeout; |
| 1042 | 1115 | 	u_int8_t		 sync_state; /* PFSYNC_S_x */ |
| 1043 | 	u_int8_t		 sync_updates; /* XXX */ | |
| 1116 | 	u_int8_t		 sync_updates; | |
| 1044 | 1117 | 	u_int			 refs; |
| 1045 | 1118 | 	struct mtx		*lock; |
| 1046 | 1119 | 	TAILQ_ENTRY(pf_kstate)	 sync_list; |
| ... | ... | @@ -1049,56 +1122,74 @@ struct pf_kstate { |
| 1049 | 1122 | 	struct pf_state_peer	 src; |
| 1050 | 1123 | 	struct pf_state_peer	 dst; |
| 1051 | 1124 | 	struct pf_krule_slist	 match_rules; |
| 1052 | 	union pf_krule_ptr	 rule; | |
| 1053 | 	union pf_krule_ptr	 anchor; | |
| 1054 | 	union pf_krule_ptr	 nat_rule; | |
| 1055 | 	struct pf_addr		 rt_addr; | |
| 1125 | 	struct pf_krule		*rule; | |
| 1126 | 	struct pf_krule		*anchor; | |
| 1127 | 	struct pf_krule		*nat_rule; | |
| 1056 | 1128 | 	struct pf_state_key	*key[2];	/* addresses stack and wire */ |
| 1129 | 	struct pf_udp_mapping	*udp_mapping; | |
| 1057 | 1130 | 	struct pfi_kkif		*kif; |
| 1058 | 1131 | 	struct pfi_kkif		*orig_kif;	/* The real kif, even if we're a floating state (i.e. if == V_pfi_all). */ |
| 1059 | 	struct pfi_kkif		*rt_kif; | |
| 1060 | 	struct pf_ksrc_node	*src_node; | |
| 1061 | 	struct pf_ksrc_node	*nat_src_node; | |
| 1132 | 	struct pf_ksrc_node	*sns[PF_SN_MAX];/* source nodes */ | |
| 1062 | 1133 | 	u_int64_t		 packets[2]; |
| 1063 | 1134 | 	u_int64_t		 bytes[2]; |
| 1064 | 	u_int32_t		 creation; | |
| 1065 | 	u_int32_t	 	 expire; | |
| 1135 | 	u_int64_t		 creation; | |
| 1136 | 	u_int64_t	 	 expire; | |
| 1066 | 1137 | 	u_int32_t		 pfsync_time; |
| 1067 | 1138 | 	struct pf_rule_actions	 act; |
| 1068 | 1139 | 	u_int16_t		 tag; |
| 1069 | 	u_int8_t		 rt; | |
| 1140 | 	u_int16_t		 if_index_in; | |
| 1141 | 	u_int16_t		 if_index_out; | |
| 1070 | 1142 | }; |
| 1071 | 1143 | |
| 1072 | 1144 | /* |
| 1073 | * Size <= fits 11 objects per page on LP64. Try to not grow the struct beyond that. | |
| 1145 | * 6 cache lines per struct, 10 structs per page. | |
| 1146 | * Try to not grow the struct beyond that. | |
| 1074 | 1147 | */ |
| 1075 | _Static_assert(sizeof(struct pf_kstate) <= 368, "pf_kstate size crosses 368 bytes"); | |
| 1148 | _Static_assert(sizeof(struct pf_kstate) <= 384, "pf_kstate size crosses 384 bytes"); | |
| 1149 | ||
| 1150 | enum pf_test_status { | |
| 1151 | 	PF_TEST_FAIL = -1, | |
| 1152 | 	PF_TEST_OK, | |
| 1153 | 	PF_TEST_QUICK | |
| 1154 | }; | |
| 1155 | ||
| 1156 | struct pf_test_ctx { | |
| 1157 | 	enum pf_test_status	 test_status; | |
| 1158 | 	struct pf_pdesc		*pd; | |
| 1159 | 	struct pf_rule_actions	 act; | |
| 1160 | 	uint8_t			 icmpcode; | |
| 1161 | 	uint8_t			 icmptype; | |
| 1162 | 	int			 icmp_dir; | |
| 1163 | 	int			 state_icmp; | |
| 1164 | 	int			 tag; | |
| 1165 | 	int			 rewrite; | |
| 1166 | 	u_short			 reason; | |
| 1167 | 	struct pf_src_node	*sns[PF_SN_MAX]; | |
| 1168 | 	struct pf_krule		*nr; | |
| 1169 | 	struct pf_krule		*tr; | |
| 1170 | 	struct pf_krule		**rm; | |
| 1171 | 	struct pf_krule		*a; | |
| 1172 | 	struct pf_krule		**am; | |
| 1173 | 	struct pf_kruleset	**rsm; | |
| 1174 | 	struct pf_kruleset	*arsm; | |
| 1175 | 	struct pf_kruleset	*aruleset; | |
| 1176 | 	struct pf_state_key	*sk; | |
| 1177 | 	struct pf_state_key	*nk; | |
| 1178 | 	struct tcphdr		*th; | |
| 1179 | 	struct pf_udp_mapping	*udp_mapping; | |
| 1180 | 	struct pf_kpool		*nat_pool; | |
| 1181 | 	uint16_t		 virtual_type; | |
| 1182 | 	uint16_t		 virtual_id; | |
| 1183 | 	int			 depth; | |
| 1184 | }; | |
| 1185 | ||
| 1186 | #define	PF_ANCHOR_STACK_MAX	32 | |
| 1076 | 1187 | #endif |
| 1077 | 1188 | |
| 1078 | 1189 | /* |
| 1079 | 1190 | * Unified state structures for pulling states out of the kernel |
| 1080 | 1191 | * used by pfsync(4) and the pf(4) ioctl. |
| 1081 | 1192 | */ |
| 1082 | struct pfsync_state_scrub { | |
| 1083 | 	u_int16_t	pfss_flags; | |
| 1084 | 	u_int8_t	pfss_ttl;	/* stashed TTL		*/ | |
| 1085 | #define PFSYNC_SCRUB_FLAG_VALID		0x01 | |
| 1086 | 	u_int8_t	scrub_flag; | |
| 1087 | 	u_int32_t	pfss_ts_mod;	/* timestamp modulation	*/ | |
| 1088 | } __packed; | |
| 1089 | ||
| 1090 | struct pfsync_state_peer { | |
| 1091 | 	struct pfsync_state_scrub scrub;	/* state is scrubbed	*/ | |
| 1092 | 	u_int32_t	seqlo;		/* Max sequence number sent	*/ | |
| 1093 | 	u_int32_t	seqhi;		/* Max the other end ACKd + win	*/ | |
| 1094 | 	u_int32_t	seqdiff;	/* Sequence number modulator	*/ | |
| 1095 | 	u_int16_t	max_win;	/* largest window (pre scaling)	*/ | |
| 1096 | 	u_int16_t	mss;		/* Maximum segment size option	*/ | |
| 1097 | 	u_int8_t	state;		/* active state level		*/ | |
| 1098 | 	u_int8_t	wscale;		/* window scaling factor	*/ | |
| 1099 | 	u_int8_t	pad[6]; | |
| 1100 | } __packed; | |
| 1101 | ||
| 1102 | 1193 | struct pfsync_state_key { |
| 1103 | 1194 | 	struct pf_addr	 addr[2]; |
| 1104 | 1195 | 	u_int16_t	 port[2]; |
| ... | ... | @@ -1108,8 +1199,8 @@ struct pfsync_state_1301 { |
| 1108 | 1199 | 	u_int64_t	 id; |
| 1109 | 1200 | 	char		 ifname[IFNAMSIZ]; |
| 1110 | 1201 | 	struct pfsync_state_key	key[2]; |
| 1111 | 	struct pfsync_state_peer src; | |
| 1112 | 	struct pfsync_state_peer dst; | |
| 1202 | 	struct pf_state_peer_export src; | |
| 1203 | 	struct pf_state_peer_export dst; | |
| 1113 | 1204 | 	struct pf_addr	 rt_addr; |
| 1114 | 1205 | 	u_int32_t	 rule; |
| 1115 | 1206 | 	u_int32_t	 anchor; |
| ... | ... | @@ -1127,16 +1218,16 @@ struct pfsync_state_1301 { |
| 1127 | 1218 | 	u_int8_t	 state_flags; |
| 1128 | 1219 | 	u_int8_t	 timeout; |
| 1129 | 1220 | 	u_int8_t	 sync_flags; |
| 1130 | 	u_int8_t	 updates; | |
| 1221 | 	u_int8_t	 updates;	/* unused */ | |
| 1131 | 1222 | } __packed; |
| 1132 | 1223 | |
| 1133 | 1224 | struct pfsync_state_1400 { |
| 1134 | 	/* The beginning of the struct is compatible with previous versions */ | |
| 1225 | 	/* The beginning of the struct is compatible with pfsync_state_1301 */ | |
| 1135 | 1226 | 	u_int64_t	 id; |
| 1136 | 1227 | 	char		 ifname[IFNAMSIZ]; |
| 1137 | 1228 | 	struct pfsync_state_key	key[2]; |
| 1138 | 	struct pfsync_state_peer src; | |
| 1139 | 	struct pfsync_state_peer dst; | |
| 1229 | 	struct pf_state_peer_export src; | |
| 1230 | 	struct pf_state_peer_export dst; | |
| 1140 | 1231 | 	struct pf_addr	 rt_addr; |
| 1141 | 1232 | 	u_int32_t	 rule; |
| 1142 | 1233 | 	u_int32_t	 anchor; |
| ... | ... | @@ -1154,7 +1245,7 @@ struct pfsync_state_1400 { |
| 1154 | 1245 | 	u_int8_t	 __spare; |
| 1155 | 1246 | 	u_int8_t	 timeout; |
| 1156 | 1247 | 	u_int8_t	 sync_flags; |
| 1157 | 	u_int8_t	 updates; | |
| 1248 | 	u_int8_t	 updates;	/* unused */ | |
| 1158 | 1249 | 	/* The rest is not */ |
| 1159 | 1250 | 	u_int16_t	 qid; |
| 1160 | 1251 | 	u_int16_t	 pqid; |
| ... | ... | @@ -1167,12 +1258,54 @@ struct pfsync_state_1400 { |
| 1167 | 1258 | 	u_int8_t	 set_prio[2]; |
| 1168 | 1259 | 	u_int8_t	 rt; |
| 1169 | 1260 | 	char		 rt_ifname[IFNAMSIZ]; |
| 1261 | } __packed; | |
| 1170 | 1262 | |
| 1263 | struct pfsync_state_1500 { | |
| 1264 | 	/* The beginning of the struct is compatible with pfsync_state_1301 */ | |
| 1265 | 	u_int64_t	 id; | |
| 1266 | 	char		 ifname[IFNAMSIZ]; | |
| 1267 | 	struct pfsync_state_key	key[2]; | |
| 1268 | 	struct pf_state_peer_export src; | |
| 1269 | 	struct pf_state_peer_export dst; | |
| 1270 | 	struct pf_addr	 rt_addr; | |
| 1271 | 	u_int32_t	 rule; | |
| 1272 | 	u_int32_t	 anchor; | |
| 1273 | 	u_int32_t	 nat_rule; | |
| 1274 | 	u_int32_t	 creation; | |
| 1275 | 	u_int32_t	 expire; | |
| 1276 | 	u_int32_t	 packets[2][2]; | |
| 1277 | 	u_int32_t	 bytes[2][2]; | |
| 1278 | 	u_int32_t	 creatorid; | |
| 1279 | 	/* The rest is not, use the opportunity to fix alignment */ | |
| 1280 | 	char		 tagname[PF_TAG_NAME_SIZE]; | |
| 1281 | 	char		 rt_ifname[IFNAMSIZ]; | |
| 1282 | 	char		 orig_ifname[IFNAMSIZ]; | |
| 1283 | 	int32_t		 rtableid; | |
| 1284 | 	u_int16_t	 state_flags; | |
| 1285 | 	u_int16_t	 qid; | |
| 1286 | 	u_int16_t	 pqid; | |
| 1287 | 	u_int16_t	 dnpipe; | |
| 1288 | 	u_int16_t	 dnrpipe; | |
| 1289 | 	u_int16_t	 max_mss; | |
| 1290 | 	sa_family_t	 wire_af; | |
| 1291 | 	sa_family_t	 stack_af; | |
| 1292 | 	sa_family_t	 rt_af; | |
| 1293 | 	u_int8_t	 wire_proto; | |
| 1294 | 	u_int8_t	 stack_proto; | |
| 1295 | 	u_int8_t	 log; | |
| 1296 | 	u_int8_t	 timeout; | |
| 1297 | 	u_int8_t	 direction; | |
| 1298 | 	u_int8_t	 rt; | |
| 1299 | 	u_int8_t	 min_ttl; | |
| 1300 | 	u_int8_t	 set_tos; | |
| 1301 | 	u_int8_t	 set_prio[2]; | |
| 1302 | 	u_int8_t	 spare[3];	/* Improve struct alignment */ | |
| 1171 | 1303 | } __packed; |
| 1172 | 1304 | |
| 1173 | 1305 | union pfsync_state_union { |
| 1174 | 1306 | 	struct pfsync_state_1301 pfs_1301; |
| 1175 | 1307 | 	struct pfsync_state_1400 pfs_1400; |
| 1308 | 	struct pfsync_state_1500 pfs_1500; | |
| 1176 | 1309 | } __packed; |
| 1177 | 1310 | |
| 1178 | 1311 | #ifdef _KERNEL |
| ... | ... | @@ -1184,6 +1317,8 @@ typedef	void		pfsync_delete_state_t(struct pf_kstate *); |
| 1184 | 1317 | typedef void		pfsync_clear_states_t(u_int32_t, const char *); |
| 1185 | 1318 | typedef int		pfsync_defer_t(struct pf_kstate *, struct mbuf *); |
| 1186 | 1319 | typedef void		pfsync_detach_ifnet_t(struct ifnet *); |
| 1320 | typedef void		pflow_export_state_t(const struct pf_kstate *); | |
| 1321 | typedef bool		pf_addr_filter_func_t(const sa_family_t, const struct pf_addr *); | |
| 1187 | 1322 | |
| 1188 | 1323 | VNET_DECLARE(pfsync_state_import_t *, pfsync_state_import_ptr); |
| 1189 | 1324 | #define V_pfsync_state_import_ptr	VNET(pfsync_state_import_ptr) |
| ... | ... | @@ -1197,6 +1332,8 @@ VNET_DECLARE(pfsync_clear_states_t *, pfsync_clear_states_ptr); |
| 1197 | 1332 | #define V_pfsync_clear_states_ptr	VNET(pfsync_clear_states_ptr) |
| 1198 | 1333 | VNET_DECLARE(pfsync_defer_t *, pfsync_defer_ptr); |
| 1199 | 1334 | #define V_pfsync_defer_ptr		VNET(pfsync_defer_ptr) |
| 1335 | VNET_DECLARE(pflow_export_state_t *,	pflow_export_state_ptr); | |
| 1336 | #define V_pflow_export_state_ptr	VNET(pflow_export_state_ptr) | |
| 1200 | 1337 | extern pfsync_detach_ifnet_t	*pfsync_detach_ifnet_ptr; |
| 1201 | 1338 | |
| 1202 | 1339 | void			pfsync_state_export(union pfsync_state_union *, |
| ... | ... | @@ -1207,9 +1344,9 @@ void			pf_state_export(struct pf_state_export *, |
| 1207 | 1344 | /* pflog */ |
| 1208 | 1345 | struct pf_kruleset; |
| 1209 | 1346 | struct pf_pdesc; |
| 1210 | typedef int pflog_packet_t(struct pfi_kkif *, struct mbuf *, sa_family_t, | |
| 1211 | u_int8_t, struct pf_krule *, struct pf_krule *, struct pf_kruleset *, | |
| 1212 | struct pf_pdesc *, int); | |
| 1347 | typedef int pflog_packet_t(uint8_t, u_int8_t, | |
| 1348 | struct pf_krule *, struct pf_krule *, struct pf_kruleset *, | |
| 1349 | struct pf_pdesc *, int, struct pf_krule *); | |
| 1213 | 1350 | extern pflog_packet_t		*pflog_packet_ptr; |
| 1214 | 1351 | |
| 1215 | 1352 | #endif /* _KERNEL */ |
| ... | ... | @@ -1219,39 +1356,10 @@ extern pflog_packet_t		*pflog_packet_ptr; |
| 1219 | 1356 | |
| 1220 | 1357 | /* for copies to/from network byte order */ |
| 1221 | 1358 | /* ioctl interface also uses network byte order */ |
| 1222 | #define pf_state_peer_hton(s,d) do {		\ | |
| 1223 | 	(d)->seqlo = htonl((s)->seqlo);		\ | |
| 1224 | 	(d)->seqhi = htonl((s)->seqhi);		\ | |
| 1225 | 	(d)->seqdiff = htonl((s)->seqdiff);	\ | |
| 1226 | 	(d)->max_win = htons((s)->max_win);	\ | |
| 1227 | 	(d)->mss = htons((s)->mss);		\ | |
| 1228 | 	(d)->state = (s)->state;		\ | |
| 1229 | 	(d)->wscale = (s)->wscale;		\ | |
| 1230 | 	if ((s)->scrub) {						\ | |
| 1231 | 		(d)->scrub.pfss_flags = 				\ | |
| 1232 | 		 htons((s)->scrub->pfss_flags & PFSS_TIMESTAMP);	\ | |
| 1233 | 		(d)->scrub.pfss_ttl = (s)->scrub->pfss_ttl;		\ | |
| 1234 | 		(d)->scrub.pfss_ts_mod = htonl((s)->scrub->pfss_ts_mod);\ | |
| 1235 | 		(d)->scrub.scrub_flag = PFSYNC_SCRUB_FLAG_VALID;	\ | |
| 1236 | 	}								\ | |
| 1237 | } while (0) | |
| 1238 | ||
| 1239 | #define pf_state_peer_ntoh(s,d) do {		\ | |
| 1240 | 	(d)->seqlo = ntohl((s)->seqlo);		\ | |
| 1241 | 	(d)->seqhi = ntohl((s)->seqhi);		\ | |
| 1242 | 	(d)->seqdiff = ntohl((s)->seqdiff);	\ | |
| 1243 | 	(d)->max_win = ntohs((s)->max_win);	\ | |
| 1244 | 	(d)->mss = ntohs((s)->mss);		\ | |
| 1245 | 	(d)->state = (s)->state;		\ | |
| 1246 | 	(d)->wscale = (s)->wscale;		\ | |
| 1247 | 	if ((s)->scrub.scrub_flag == PFSYNC_SCRUB_FLAG_VALID && 	\ | |
| 1248 | 	 (d)->scrub != NULL) {					\ | |
| 1249 | 		(d)->scrub->pfss_flags =				\ | |
| 1250 | 		 ntohs((s)->scrub.pfss_flags) & PFSS_TIMESTAMP;	\ | |
| 1251 | 		(d)->scrub->pfss_ttl = (s)->scrub.pfss_ttl;		\ | |
| 1252 | 		(d)->scrub->pfss_ts_mod = ntohl((s)->scrub.pfss_ts_mod);\ | |
| 1253 | 	}								\ | |
| 1254 | } while (0) | |
| 1359 | void	 pf_state_peer_hton(const struct pf_state_peer *, | |
| 1360 | 	 struct pf_state_peer_export *); | |
| 1361 | void	 pf_state_peer_ntoh(const struct pf_state_peer_export *, | |
| 1362 | 	 struct pf_state_peer *); | |
| 1255 | 1363 | |
| 1256 | 1364 | #define pf_state_counter_hton(s,d) do {				\ |
| 1257 | 1365 | 	d[0] = htonl((s>>32)&0xffffffff);			\ |
| ... | ... | @@ -1276,7 +1384,6 @@ struct pf_kruleset { |
| 1276 | 1384 | 		struct pf_krulequeue	 queues[2]; |
| 1277 | 1385 | 		struct { |
| 1278 | 1386 | 			struct pf_krulequeue	*ptr; |
| 1279 | 			struct pf_krule		**ptr_array; | |
| 1280 | 1387 | 			u_int32_t		 rcount; |
| 1281 | 1388 | 			u_int32_t		 ticket; |
| 1282 | 1389 | 			int			 open; |
| ... | ... | @@ -1329,7 +1436,6 @@ RB_PROTOTYPE(pf_kanchor_node, pf_kanchor, entry_node, pf_kanchor_compare); |
| 1329 | 1436 | 				 PFR_TFLAG_REFDANCHOR	| \ |
| 1330 | 1437 | 				 PFR_TFLAG_COUNTERS) |
| 1331 | 1438 | |
| 1332 | struct pf_kanchor_stackframe; | |
| 1333 | 1439 | struct pf_keth_anchor_stackframe; |
| 1334 | 1440 | |
| 1335 | 1441 | struct pfr_table { |
| ... | ... | @@ -1366,7 +1472,7 @@ struct pfr_astats { |
| 1366 | 1472 | 	struct pfr_addr	 pfras_a; |
| 1367 | 1473 | 	u_int64_t	 pfras_packets[PFR_DIR_MAX][PFR_OP_ADDR_MAX]; |
| 1368 | 1474 | 	u_int64_t	 pfras_bytes[PFR_DIR_MAX][PFR_OP_ADDR_MAX]; |
| 1369 | 	long		 pfras_tzero; | |
| 1475 | 	time_t		 pfras_tzero; | |
| 1370 | 1476 | }; |
| 1371 | 1477 | |
| 1372 | 1478 | enum { PFR_REFCNT_RULE, PFR_REFCNT_ANCHOR, PFR_REFCNT_MAX }; |
| ... | ... | @@ -1377,7 +1483,7 @@ struct pfr_tstats { |
| 1377 | 1483 | 	u_int64_t	 pfrts_bytes[PFR_DIR_MAX][PFR_OP_TABLE_MAX]; |
| 1378 | 1484 | 	u_int64_t	 pfrts_match; |
| 1379 | 1485 | 	u_int64_t	 pfrts_nomatch; |
| 1380 | 	long		 pfrts_tzero; | |
| 1486 | 	time_t		 pfrts_tzero; | |
| 1381 | 1487 | 	int		 pfrts_cnt; |
| 1382 | 1488 | 	int		 pfrts_refcnt[PFR_REFCNT_MAX]; |
| 1383 | 1489 | }; |
| ... | ... | @@ -1439,7 +1545,7 @@ struct pfr_ktstats { |
| 1439 | 1545 | 	struct pfr_kstate_counter	 pfrkts_bytes[PFR_DIR_MAX][PFR_OP_TABLE_MAX]; |
| 1440 | 1546 | 	struct pfr_kstate_counter	 pfrkts_match; |
| 1441 | 1547 | 	struct pfr_kstate_counter	 pfrkts_nomatch; |
| 1442 | 	long		 pfrkts_tzero; | |
| 1548 | 	time_t		 pfrkts_tzero; | |
| 1443 | 1549 | 	int		 pfrkts_cnt; |
| 1444 | 1550 | 	int		 pfrkts_refcnt[PFR_REFCNT_MAX]; |
| 1445 | 1551 | }; |
| ... | ... | @@ -1460,7 +1566,7 @@ union sockaddr_union { |
| 1460 | 1566 | |
| 1461 | 1567 | struct pfr_kcounters { |
| 1462 | 1568 | 	counter_u64_t		 pfrkc_counters; |
| 1463 | 	long			 pfrkc_tzero; | |
| 1569 | 	time_t			 pfrkc_tzero; | |
| 1464 | 1570 | }; |
| 1465 | 1571 | #define	pfr_kentry_counter(kc, dir, op, t)		\ |
| 1466 | 1572 | 	((kc)->pfrkc_counters +				\ |
| ... | ... | @@ -1518,7 +1624,7 @@ struct pfi_kkif { |
| 1518 | 1624 | #define	pfik_list	_pfik_glue._pfik_list |
| 1519 | 1625 | 	struct pf_counter_u64		 pfik_packets[2][2][2]; |
| 1520 | 1626 | 	struct pf_counter_u64		 pfik_bytes[2][2][2]; |
| 1521 | 	u_int32_t			 pfik_tzero; | |
| 1627 | 	time_t				 pfik_tzero; | |
| 1522 | 1628 | 	u_int				 pfik_flags; |
| 1523 | 1629 | 	struct ifnet			*pfik_ifp; |
| 1524 | 1630 | 	struct ifg_group		*pfik_group; |
| ... | ... | @@ -1532,6 +1638,7 @@ struct pfi_kkif { |
| 1532 | 1638 | |
| 1533 | 1639 | #define	PFI_IFLAG_REFS		0x0001	/* has state references */ |
| 1534 | 1640 | #define PFI_IFLAG_SKIP		0x0100	/* skip filtering on interface */ |
| 1641 | #define	PFI_IFLAG_ANY 		0x0200	/* match any non-loopback interface */ | |
| 1535 | 1642 | |
| 1536 | 1643 | #ifdef _KERNEL |
| 1537 | 1644 | struct pf_sctp_multihome_job; |
| ... | ... | @@ -1555,25 +1662,49 @@ struct pf_pdesc { |
| 1555 | 1662 | 		char any[0]; |
| 1556 | 1663 | 	} hdr; |
| 1557 | 1664 | |
| 1558 | 	struct pf_krule	*nat_rule;	/* nat/rdr rule applied to packet */ | |
| 1665 | 	struct pf_addr	 nsaddr;	/* src address after NAT */ | |
| 1666 | 	struct pf_addr	 ndaddr;	/* dst address after NAT */ | |
| 1667 | ||
| 1668 | 	struct pfi_kkif	*kif;		/* incomming interface */ | |
| 1669 | 	struct mbuf	*m; | |
| 1670 | ||
| 1559 | 1671 | 	struct pf_addr	*src;		/* src address */ |
| 1560 | 1672 | 	struct pf_addr	*dst;		/* dst address */ |
| 1561 | 	u_int16_t *sport; | |
| 1562 | 	u_int16_t *dport; | |
| 1673 | 	struct pf_addr	 osrc; | |
| 1674 | 	struct pf_addr	 odst; | |
| 1675 | 	u_int16_t	*pcksum;	/* proto cksum */ | |
| 1676 | 	u_int16_t	*sport; | |
| 1677 | 	u_int16_t	*dport; | |
| 1678 | 	u_int16_t	 osport; | |
| 1679 | 	u_int16_t	 odport; | |
| 1680 | 	u_int16_t	 nsport;	/* src port after NAT */ | |
| 1681 | 	u_int16_t	 ndport;	/* dst port after NAT */ | |
| 1563 | 1682 | 	struct pf_mtag	*pf_mtag; |
| 1564 | 1683 | 	struct pf_rule_actions	act; |
| 1565 | 1684 | |
| 1566 | 	u_int32_t	 p_len;		/* total length of payload */ | |
| 1685 | 	u_int32_t	 off;		/* protocol header offset */ | |
| 1686 | 	bool		 df;		/* IPv4 Don't fragment flag. */ | |
| 1687 | 	u_int32_t	 hdrlen;	/* protocol header length */ | |
| 1688 | 	u_int32_t	 p_len;		/* total length of protocol payload */ | |
| 1689 | 	u_int32_t	 extoff;	/* extentsion header offset */ | |
| 1690 | 	u_int32_t	 fragoff;	/* fragment header offset */ | |
| 1691 | 	u_int32_t	 jumbolen;	/* length from v6 jumbo header */ | |
| 1692 | 	u_int32_t	 badopts;	/* v4 options or v6 routing headers */ | |
| 1693 | #define	PF_OPT_OTHER		0x0001 | |
| 1694 | #define	PF_OPT_JUMBO		0x0002 | |
| 1695 | #define	PF_OPT_ROUTER_ALERT	0x0004 | |
| 1567 | 1696 | |
| 1568 | 1697 | 	u_int16_t	*ip_sum; |
| 1569 | 	u_int16_t	*proto_sum; | |
| 1570 | 1698 | 	u_int16_t	 flags;		/* Let SCRUB trigger behavior in |
| 1571 | 1699 | 					 * state code. Easier than tags */ |
| 1572 | 1700 | #define PFDESC_TCP_NORM	0x0001		/* TCP shall be statefully scrubbed */ |
| 1573 | #define PFDESC_IP_REAS	0x0002		/* IP frags would've been reassembled */ | |
| 1701 | 	u_int16_t	 virtual_proto; | |
| 1702 | #define PF_VPROTO_FRAGMENT	256 | |
| 1574 | 1703 | 	sa_family_t	 af; |
| 1704 | 	sa_family_t	 naf; | |
| 1575 | 1705 | 	u_int8_t	 proto; |
| 1576 | 1706 | 	u_int8_t	 tos; |
| 1707 | 	u_int8_t	 ttl; | |
| 1577 | 1708 | 	u_int8_t	 dir;		/* direction */ |
| 1578 | 1709 | 	u_int8_t	 sidx;		/* key index for source */ |
| 1579 | 1710 | 	u_int8_t	 didx;		/* key index for destination */ |
| ... | ... | @@ -1592,6 +1723,8 @@ struct pf_pdesc { |
| 1592 | 1723 | #define PFDESC_SCTP_ADD_IP	0x1000 |
| 1593 | 1724 | 	u_int16_t	 sctp_flags; |
| 1594 | 1725 | 	u_int32_t	 sctp_initiate_tag; |
| 1726 | 	u_int16_t	 sctp_dummy_sum; | |
| 1727 | 	struct pf_krule	*related_rule; | |
| 1595 | 1728 | |
| 1596 | 1729 | 	struct pf_sctp_multihome_jobs	sctp_multihome_jobs; |
| 1597 | 1730 | }; |
| ... | ... | @@ -1601,7 +1734,6 @@ struct pf_sctp_multihome_job { |
| 1601 | 1734 | 	struct pf_pdesc				 pd; |
| 1602 | 1735 | 	struct pf_addr				 src; |
| 1603 | 1736 | 	struct pf_addr				 dst; |
| 1604 | 	struct mbuf				*m; | |
| 1605 | 1737 | 	int					 op; |
| 1606 | 1738 | }; |
| 1607 | 1739 | |
| ... | ... | @@ -1647,6 +1779,7 @@ struct pf_sctp_multihome_job { |
| 1647 | 1779 | |
| 1648 | 1780 | #define REASON_SET(a, x) \ |
| 1649 | 1781 | 	do { \ |
| 1782 | 		SDT_PROBE2(pf, , test, reason_set, x, __LINE__); \ | |
| 1650 | 1783 | 		if ((a) != NULL) \ |
| 1651 | 1784 | 			*(a) = (x); \ |
| 1652 | 1785 | 		if (x < PFRES_MAX) \ |
| ... | ... | @@ -1697,6 +1830,13 @@ struct pf_divert { |
| 1697 | 1830 | #define PFFRAG_FRENT_HIWAT	5000	/* Number of fragment entries */ |
| 1698 | 1831 | #define PFR_KENTRY_HIWAT	200000	/* Number of table entries */ |
| 1699 | 1832 | |
| 1833 | struct pf_fragment_tag { | |
| 1834 | 	uint16_t	ft_hdrlen;	/* header length of reassembled pkt */ | |
| 1835 | 	uint16_t	ft_extoff;	/* last extension header offset or 0 */ | |
| 1836 | 	uint16_t	ft_maxlen;	/* maximum fragment payload length */ | |
| 1837 | 	uint32_t	ft_id;		/* fragment id */ | |
| 1838 | }; | |
| 1839 | ||
| 1700 | 1840 | /* |
| 1701 | 1841 | * Limit the length of the fragment queue traversal. Remember |
| 1702 | 1842 | * search entry points based on the fragment offset. |
| ... | ... | @@ -1773,6 +1913,7 @@ struct pf_kstate_kill { |
| 1773 | 1913 | 	char			psk_label[PF_RULE_LABEL_SIZE]; |
| 1774 | 1914 | 	u_int			psk_killed; |
| 1775 | 1915 | 	bool			psk_kill_match; |
| 1916 | 	bool			psk_nat; | |
| 1776 | 1917 | }; |
| 1777 | 1918 | #endif |
| 1778 | 1919 | |
| ... | ... | @@ -1944,29 +2085,25 @@ struct pfioc_iface { |
| 1944 | 2085 | #define DIOCADDRULE	_IOWR('D', 4, struct pfioc_rule) |
| 1945 | 2086 | #define DIOCADDRULENV	_IOWR('D', 4, struct pfioc_nv) |
| 1946 | 2087 | #define DIOCGETRULES	_IOWR('D', 6, struct pfioc_rule) |
| 1947 | #define DIOCGETRULE	_IOWR('D', 7, struct pfioc_rule) | |
| 1948 | 2088 | #define DIOCGETRULENV	_IOWR('D', 7, struct pfioc_nv) |
| 1949 | /* XXX cut 8 - 17 */ | |
| 1950 | #define DIOCCLRSTATES	_IOWR('D', 18, struct pfioc_state_kill) | |
| 1951 | 2089 | #define DIOCCLRSTATESNV	_IOWR('D', 18, struct pfioc_nv) |
| 1952 | 2090 | #define DIOCGETSTATE	_IOWR('D', 19, struct pfioc_state) |
| 1953 | 2091 | #define DIOCGETSTATENV	_IOWR('D', 19, struct pfioc_nv) |
| 1954 | 2092 | #define DIOCSETSTATUSIF _IOWR('D', 20, struct pfioc_if) |
| 1955 | #define DIOCGETSTATUS	_IOWR('D', 21, struct pf_status) | |
| 1956 | 2093 | #define DIOCGETSTATUSNV	_IOWR('D', 21, struct pfioc_nv) |
| 1957 | 2094 | #define DIOCCLRSTATUS	_IO ('D', 22) |
| 1958 | 2095 | #define DIOCNATLOOK	_IOWR('D', 23, struct pfioc_natlook) |
| 1959 | 2096 | #define DIOCSETDEBUG	_IOWR('D', 24, u_int32_t) |
| 2097 | #ifdef COMPAT_FREEBSD14 | |
| 1960 | 2098 | #define DIOCGETSTATES	_IOWR('D', 25, struct pfioc_states) |
| 2099 | #endif | |
| 1961 | 2100 | #define DIOCCHANGERULE	_IOWR('D', 26, struct pfioc_rule) |
| 1962 | /* XXX cut 26 - 28 */ | |
| 1963 | 2101 | #define DIOCSETTIMEOUT	_IOWR('D', 29, struct pfioc_tm) |
| 1964 | 2102 | #define DIOCGETTIMEOUT	_IOWR('D', 30, struct pfioc_tm) |
| 1965 | 2103 | #define DIOCADDSTATE	_IOWR('D', 37, struct pfioc_state) |
| 1966 | 2104 | #define DIOCCLRRULECTRS	_IO ('D', 38) |
| 1967 | 2105 | #define DIOCGETLIMIT	_IOWR('D', 39, struct pfioc_limit) |
| 1968 | 2106 | #define DIOCSETLIMIT	_IOWR('D', 40, struct pfioc_limit) |
| 1969 | #define DIOCKILLSTATES	_IOWR('D', 41, struct pfioc_state_kill) | |
| 1970 | 2107 | #define DIOCKILLSTATESNV	_IOWR('D', 41, struct pfioc_nv) |
| 1971 | 2108 | #define DIOCSTARTALTQ	_IO ('D', 42) |
| 1972 | 2109 | #define DIOCSTOPALTQ	_IO ('D', 43) |
| ... | ... | @@ -1985,7 +2122,6 @@ struct pfioc_iface { |
| 1985 | 2122 | #define DIOCGETADDRS	_IOWR('D', 53, struct pfioc_pooladdr) |
| 1986 | 2123 | #define DIOCGETADDR	_IOWR('D', 54, struct pfioc_pooladdr) |
| 1987 | 2124 | #define DIOCCHANGEADDR	_IOWR('D', 55, struct pfioc_pooladdr) |
| 1988 | /* XXX cut 55 - 57 */ | |
| 1989 | 2125 | #define	DIOCGETRULESETS	_IOWR('D', 58, struct pfioc_ruleset) |
| 1990 | 2126 | #define	DIOCGETRULESET	_IOWR('D', 59, struct pfioc_ruleset) |
| 1991 | 2127 | #define	DIOCRCLRTABLES	_IOWR('D', 60, struct pfioc_table) |
| ... | ... | @@ -2019,7 +2155,9 @@ struct pfioc_iface { |
| 2019 | 2155 | #define	DIOCKILLSRCNODES	_IOWR('D', 91, struct pfioc_src_node_kill) |
| 2020 | 2156 | #define	DIOCGIFSPEEDV0	_IOWR('D', 92, struct pf_ifspeed_v0) |
| 2021 | 2157 | #define	DIOCGIFSPEEDV1	_IOWR('D', 92, struct pf_ifspeed_v1) |
| 2158 | #ifdef COMPAT_FREEBSD14 | |
| 2022 | 2159 | #define DIOCGETSTATESV2	_IOWR('D', 93, struct pfioc_states_v2) |
| 2160 | #endif | |
| 2023 | 2161 | #define	DIOCGETSYNCOOKIES	_IOWR('D', 94, struct pfioc_nv) |
| 2024 | 2162 | #define	DIOCSETSYNCOOKIES	_IOWR('D', 95, struct pfioc_nv) |
| 2025 | 2163 | #define	DIOCKEEPCOUNTERS	_IOWR('D', 96, struct pfioc_nv) |
| ... | ... | @@ -2103,21 +2241,33 @@ struct pf_idhash { |
| 2103 | 2241 | 	struct mtx			lock; |
| 2104 | 2242 | }; |
| 2105 | 2243 | |
| 2244 | struct pf_udpendpointhash { | |
| 2245 | 	LIST_HEAD(, pf_udp_endpoint)	endpoints; | |
| 2246 | 	/* refcont is synchronized on the source endpoint's row lock */ | |
| 2247 | 	struct mtx			lock; | |
| 2248 | }; | |
| 2249 | ||
| 2106 | 2250 | extern u_long		pf_ioctl_maxcount; |
| 2107 | 2251 | VNET_DECLARE(u_long, pf_hashmask); |
| 2108 | 2252 | #define V_pf_hashmask	VNET(pf_hashmask) |
| 2109 | 2253 | VNET_DECLARE(u_long, pf_srchashmask); |
| 2110 | 2254 | #define V_pf_srchashmask	VNET(pf_srchashmask) |
| 2255 | VNET_DECLARE(u_long, pf_udpendpointhashmask); | |
| 2256 | #define V_pf_udpendpointhashmask	VNET(pf_udpendpointhashmask) | |
| 2111 | 2257 | #define	PF_HASHSIZ	(131072) |
| 2112 | 2258 | #define	PF_SRCHASHSIZ	(PF_HASHSIZ/4) |
| 2259 | #define	PF_UDPENDHASHSIZ	(PF_HASHSIZ/4) | |
| 2113 | 2260 | VNET_DECLARE(struct pf_keyhash *, pf_keyhash); |
| 2114 | 2261 | VNET_DECLARE(struct pf_idhash *, pf_idhash); |
| 2262 | VNET_DECLARE(struct pf_udpendpointhash *, pf_udpendpointhash); | |
| 2115 | 2263 | #define V_pf_keyhash	VNET(pf_keyhash) |
| 2116 | 2264 | #define	V_pf_idhash	VNET(pf_idhash) |
| 2265 | #define	V_pf_udpendpointhash	VNET(pf_udpendpointhash) | |
| 2117 | 2266 | VNET_DECLARE(struct pf_srchash *, pf_srchash); |
| 2118 | 2267 | #define	V_pf_srchash	VNET(pf_srchash) |
| 2119 | 2268 | |
| 2120 | #define PF_IDHASH(s)	(be64toh((s)->id) % (V_pf_hashmask + 1)) | |
| 2269 | #define	PF_IDHASHID(id)	(be64toh(id) % (V_pf_hashmask + 1)) | |
| 2270 | #define	PF_IDHASH(s)	PF_IDHASHID((s)->id) | |
| 2121 | 2271 | |
| 2122 | 2272 | VNET_DECLARE(void *, pf_swi_cookie); |
| 2123 | 2273 | #define V_pf_swi_cookie	VNET(pf_swi_cookie) |
| ... | ... | @@ -2130,7 +2280,7 @@ VNET_DECLARE(struct unrhdr64, pf_stateid); |
| 2130 | 2280 | TAILQ_HEAD(pf_altqqueue, pf_altq); |
| 2131 | 2281 | VNET_DECLARE(struct pf_altqqueue,	 pf_altqs[4]); |
| 2132 | 2282 | #define	V_pf_altqs			 VNET(pf_altqs) |
| 2133 | VNET_DECLARE(struct pf_kpalist,		 pf_pabuf); | |
| 2283 | VNET_DECLARE(struct pf_kpalist,		 pf_pabuf[3]); | |
| 2134 | 2284 | #define	V_pf_pabuf			 VNET(pf_pabuf) |
| 2135 | 2285 | |
| 2136 | 2286 | VNET_DECLARE(u_int32_t,			 ticket_altqs_active); |
| ... | ... | @@ -2171,6 +2321,8 @@ VNET_DECLARE(struct pf_krule *, pf_rulemarker); |
| 2171 | 2321 | #define V_pf_rulemarker VNET(pf_rulemarker) |
| 2172 | 2322 | #endif |
| 2173 | 2323 | |
| 2324 | int				 pf_start(void); | |
| 2325 | int				 pf_stop(void); | |
| 2174 | 2326 | void				 pf_initialize(void); |
| 2175 | 2327 | void				 pf_mtag_initialize(void); |
| 2176 | 2328 | void				 pf_mtag_cleanup(void); |
| ... | ... | @@ -2186,15 +2338,21 @@ VNET_DECLARE(uma_zone_t,	 pf_state_z); |
| 2186 | 2338 | #define	V_pf_state_z		 VNET(pf_state_z) |
| 2187 | 2339 | VNET_DECLARE(uma_zone_t,	 pf_state_key_z); |
| 2188 | 2340 | #define	V_pf_state_key_z	 VNET(pf_state_key_z) |
| 2341 | VNET_DECLARE(uma_zone_t,	 pf_udp_mapping_z); | |
| 2342 | #define	V_pf_udp_mapping_z	 VNET(pf_udp_mapping_z) | |
| 2189 | 2343 | VNET_DECLARE(uma_zone_t,	 pf_state_scrub_z); |
| 2190 | 2344 | #define	V_pf_state_scrub_z	 VNET(pf_state_scrub_z) |
| 2345 | VNET_DECLARE(uma_zone_t,	 pf_anchor_z); | |
| 2346 | #define	V_pf_anchor_z		 VNET(pf_anchor_z) | |
| 2347 | VNET_DECLARE(uma_zone_t,	 pf_eth_anchor_z); | |
| 2348 | #define	V_pf_eth_anchor_z	 VNET(pf_eth_anchor_z) | |
| 2191 | 2349 | |
| 2192 | 2350 | extern void			 pf_purge_thread(void *); |
| 2193 | 2351 | extern void			 pf_unload_vnet_purge(void); |
| 2194 | 2352 | extern void			 pf_intr(void *); |
| 2195 | 2353 | extern void			 pf_purge_expired_src_nodes(void); |
| 2196 | 2354 | |
| 2197 | extern int			 pf_unlink_state(struct pf_kstate *); | |
| 2355 | extern int			 pf_remove_state(struct pf_kstate *); | |
| 2198 | 2356 | extern int			 pf_state_insert(struct pfi_kkif *, |
| 2199 | 2357 | 				 struct pfi_kkif *, |
| 2200 | 2358 | 				 struct pf_state_key *, |
| ... | ... | @@ -2202,6 +2360,9 @@ extern int			 pf_state_insert(struct pfi_kkif *, |
| 2202 | 2360 | 				 struct pf_kstate *); |
| 2203 | 2361 | extern struct pf_kstate		*pf_alloc_state(int); |
| 2204 | 2362 | extern void			 pf_free_state(struct pf_kstate *); |
| 2363 | extern void			 pf_killstates(struct pf_kstate_kill *, | |
| 2364 | 				 unsigned int *); | |
| 2365 | extern unsigned int		 pf_clear_states(const struct pf_kstate_kill *); | |
| 2205 | 2366 | |
| 2206 | 2367 | static __inline void |
| 2207 | 2368 | pf_ref_state(struct pf_kstate *s) |
| ... | ... | @@ -2232,6 +2393,22 @@ pf_release_staten(struct pf_kstate *s, u_int n) |
| 2232 | 2393 | 		return (0); |
| 2233 | 2394 | } |
| 2234 | 2395 | |
| 2396 | static __inline uint64_t | |
| 2397 | pf_get_uptime(void) | |
| 2398 | { | |
| 2399 | 	struct timeval t; | |
| 2400 | 	microuptime(&t); | |
| 2401 | 	return ((t.tv_sec * 1000) + (t.tv_usec / 1000)); | |
| 2402 | } | |
| 2403 | ||
| 2404 | static __inline uint64_t | |
| 2405 | pf_get_time(void) | |
| 2406 | { | |
| 2407 | 	struct timeval t; | |
| 2408 | 	microtime(&t); | |
| 2409 | 	return ((t.tv_sec * 1000) + (t.tv_usec / 1000)); | |
| 2410 | } | |
| 2411 | ||
| 2235 | 2412 | extern struct pf_kstate		*pf_find_state_byid(uint64_t, uint32_t); |
| 2236 | 2413 | extern struct pf_kstate		*pf_find_state_all( |
| 2237 | 2414 | 				 const struct pf_state_key_cmp *, |
| ... | ... | @@ -2239,13 +2416,25 @@ extern struct pf_kstate		*pf_find_state_all( |
| 2239 | 2416 | extern bool			pf_find_state_all_exists( |
| 2240 | 2417 | 				 const struct pf_state_key_cmp *, |
| 2241 | 2418 | 				 u_int); |
| 2419 | extern struct pf_udp_mapping	*pf_udp_mapping_find(struct pf_udp_endpoint_cmp | |
| 2420 | 				 *endpoint); | |
| 2421 | extern struct pf_udp_mapping	*pf_udp_mapping_create(sa_family_t af, | |
| 2422 | 				 struct pf_addr *src_addr, uint16_t src_port, | |
| 2423 | 				 struct pf_addr *nat_addr, uint16_t nat_port); | |
| 2424 | extern int			 pf_udp_mapping_insert(struct pf_udp_mapping | |
| 2425 | 				 *mapping); | |
| 2426 | extern void			 pf_udp_mapping_release(struct pf_udp_mapping | |
| 2427 | 				 *mapping); | |
| 2428 | uint32_t			 pf_hashsrc(struct pf_addr *, sa_family_t); | |
| 2429 | extern bool			 pf_src_node_exists(struct pf_ksrc_node **, | |
| 2430 | 				 struct pf_srchash *); | |
| 2242 | 2431 | extern struct pf_ksrc_node	*pf_find_src_node(struct pf_addr *, |
| 2243 | 2432 | 				 struct pf_krule *, sa_family_t, |
| 2244 | 				 struct pf_srchash **, bool); | |
| 2433 | 				 struct pf_srchash **, pf_sn_types_t, bool); | |
| 2245 | 2434 | extern void			 pf_unlink_src_node(struct pf_ksrc_node *); |
| 2246 | 2435 | extern u_int			 pf_free_src_nodes(struct pf_ksrc_node_list *); |
| 2247 | 2436 | extern void			 pf_print_state(struct pf_kstate *); |
| 2248 | extern void			 pf_print_flags(u_int8_t); | |
| 2437 | extern void			 pf_print_flags(uint16_t); | |
| 2249 | 2438 | extern int			 pf_addr_wrap_neq(struct pf_addr_wrap *, |
| 2250 | 2439 | 				 struct pf_addr_wrap *); |
| 2251 | 2440 | extern u_int16_t		 pf_cksum_fixup(u_int16_t, u_int16_t, u_int16_t, |
| ... | ... | @@ -2257,80 +2446,85 @@ VNET_DECLARE(struct ifnet *,		 sync_ifp); |
| 2257 | 2446 | #define	V_sync_ifp		 	 VNET(sync_ifp); |
| 2258 | 2447 | VNET_DECLARE(struct pf_krule,		 pf_default_rule); |
| 2259 | 2448 | #define	V_pf_default_rule		 VNET(pf_default_rule) |
| 2260 | extern void			 pf_addrcpy(struct pf_addr *, struct pf_addr *, | |
| 2449 | extern void			 pf_addrcpy(struct pf_addr *, const struct pf_addr *, | |
| 2261 | 2450 | 				 sa_family_t); |
| 2262 | 2451 | void				pf_free_rule(struct pf_krule *); |
| 2263 | 2452 | |
| 2264 | 2453 | int	pf_test_eth(int, int, struct ifnet *, struct mbuf **, struct inpcb *); |
| 2265 | #ifdef INET | |
| 2266 | int	pf_test(int, int, struct ifnet *, struct mbuf **, struct inpcb *, | |
| 2454 | int	pf_scan_sctp(struct pf_pdesc *); | |
| 2455 | #if defined(INET) || defined(INET6) | |
| 2456 | int	pf_test(sa_family_t, int, int, struct ifnet *, struct mbuf **, struct inpcb *, | |
| 2267 | 2457 | 	 struct pf_rule_actions *); |
| 2268 | int	pf_normalize_ip(struct mbuf **, struct pfi_kkif *, u_short *, | |
| 2269 | 	 struct pf_pdesc *); | |
| 2458 | #endif | |
| 2459 | #ifdef INET | |
| 2460 | int	pf_normalize_ip(u_short *, struct pf_pdesc *); | |
| 2270 | 2461 | #endif /* INET */ |
| 2271 | 2462 | |
| 2272 | #ifdef INET6 | |
| 2273 | int	pf_test6(int, int, struct ifnet *, struct mbuf **, struct inpcb *, | |
| 2274 | 	 struct pf_rule_actions *); | |
| 2275 | int	pf_normalize_ip6(struct mbuf **, struct pfi_kkif *, u_short *, | |
| 2276 | 	 struct pf_pdesc *); | |
| 2277 | 2463 | void	pf_poolmask(struct pf_addr *, struct pf_addr*, |
| 2278 | 2464 | 	 struct pf_addr *, struct pf_addr *, sa_family_t); |
| 2279 | 2465 | void	pf_addr_inc(struct pf_addr *, sa_family_t); |
| 2280 | int	pf_refragment6(struct ifnet *, struct mbuf **, struct m_tag *, bool); | |
| 2466 | #ifdef INET6 | |
| 2467 | int	pf_normalize_ip6(int, u_short *, struct pf_pdesc *); | |
| 2468 | int	pf_max_frag_size(struct mbuf *); | |
| 2469 | int	pf_refragment6(struct ifnet *, struct mbuf **, struct m_tag *, | |
| 2470 | 	 struct ifnet *, bool); | |
| 2281 | 2471 | #endif /* INET6 */ |
| 2282 | 2472 | |
| 2283 | int	pf_multihome_scan_init(struct mbuf *, int, int, struct pf_pdesc *, | |
| 2284 | 	 struct pfi_kkif *); | |
| 2285 | int	pf_multihome_scan_asconf(struct mbuf *, int, int, struct pf_pdesc *, | |
| 2286 | 	 struct pfi_kkif *); | |
| 2473 | int	pf_multihome_scan_init(int, int, struct pf_pdesc *); | |
| 2474 | int	pf_multihome_scan_asconf(int, int, struct pf_pdesc *); | |
| 2287 | 2475 | |
| 2288 | 2476 | u_int32_t	pf_new_isn(struct pf_kstate *); |
| 2289 | void *pf_pull_hdr(struct mbuf *, int, void *, int, u_short *, u_short *, | |
| 2477 | void *pf_pull_hdr(const struct mbuf *, int, void *, int, u_short *, u_short *, | |
| 2290 | 2478 | 	 sa_family_t); |
| 2291 | 2479 | void	pf_change_a(void *, u_int16_t *, u_int32_t, u_int8_t); |
| 2292 | 2480 | void	pf_change_proto_a(struct mbuf *, void *, u_int16_t *, u_int32_t, |
| 2293 | 2481 | 	 u_int8_t); |
| 2294 | 2482 | void	pf_change_tcp_a(struct mbuf *, void *, u_int16_t *, u_int32_t); |
| 2295 | void	pf_patch_16_unaligned(struct mbuf *, u_int16_t *, void *, u_int16_t, | |
| 2296 | 	 bool, u_int8_t); | |
| 2297 | void	pf_patch_32_unaligned(struct mbuf *, u_int16_t *, void *, u_int32_t, | |
| 2298 | bool, u_int8_t); | |
| 2483 | int	pf_patch_16(struct pf_pdesc *, void *, u_int16_t, bool); | |
| 2484 | int	pf_patch_32(struct pf_pdesc *, void *, u_int32_t, bool); | |
| 2299 | 2485 | void	pf_send_deferred_syn(struct pf_kstate *); |
| 2300 | int	pf_match_addr(u_int8_t, struct pf_addr *, struct pf_addr *, | |
| 2301 | 	 struct pf_addr *, sa_family_t); | |
| 2302 | int	pf_match_addr_range(struct pf_addr *, struct pf_addr *, | |
| 2303 | 	 struct pf_addr *, sa_family_t); | |
| 2486 | int	pf_match_addr(u_int8_t, const struct pf_addr *, | |
| 2487 | 	 const struct pf_addr *, const struct pf_addr *, sa_family_t); | |
| 2488 | int	pf_match_addr_range(const struct pf_addr *, const struct pf_addr *, | |
| 2489 | 	 const struct pf_addr *, sa_family_t); | |
| 2304 | 2490 | int	pf_match_port(u_int8_t, u_int16_t, u_int16_t, u_int16_t); |
| 2305 | 2491 | |
| 2306 | 2492 | void	pf_normalize_init(void); |
| 2307 | 2493 | void	pf_normalize_cleanup(void); |
| 2308 | int	pf_normalize_tcp(struct pfi_kkif *, struct mbuf *, int, int, void *, | |
| 2309 | 	 struct pf_pdesc *); | |
| 2494 | int	pf_normalize_tcp(struct pf_pdesc *); | |
| 2310 | 2495 | void	pf_normalize_tcp_cleanup(struct pf_kstate *); |
| 2311 | int	pf_normalize_tcp_init(struct mbuf *, int, struct pf_pdesc *, | |
| 2312 | 	 struct tcphdr *, struct pf_state_peer *, struct pf_state_peer *); | |
| 2313 | int	pf_normalize_tcp_stateful(struct mbuf *, int, struct pf_pdesc *, | |
| 2496 | int	pf_normalize_tcp_init(struct pf_pdesc *, | |
| 2497 | 	 struct tcphdr *, struct pf_state_peer *); | |
| 2498 | int	pf_normalize_tcp_stateful(struct pf_pdesc *, | |
| 2314 | 2499 | 	 u_short *, struct tcphdr *, struct pf_kstate *, |
| 2315 | 2500 | 	 struct pf_state_peer *, struct pf_state_peer *, int *); |
| 2316 | int	pf_normalize_sctp_init(struct mbuf *, int, struct pf_pdesc *, | |
| 2501 | int	pf_normalize_sctp_init(struct pf_pdesc *, | |
| 2317 | 2502 | 	 struct pf_state_peer *, struct pf_state_peer *); |
| 2318 | int	pf_normalize_sctp(int, struct pfi_kkif *, struct mbuf *, int, | |
| 2319 | 	 int, void *, struct pf_pdesc *); | |
| 2503 | int	pf_normalize_sctp(struct pf_pdesc *); | |
| 2320 | 2504 | u_int32_t |
| 2321 | 2505 | 	pf_state_expires(const struct pf_kstate *); |
| 2322 | 2506 | void	pf_purge_expired_fragments(void); |
| 2323 | 2507 | void	pf_purge_fragments(uint32_t); |
| 2324 | 2508 | int	pf_routable(struct pf_addr *addr, sa_family_t af, struct pfi_kkif *, |
| 2325 | 2509 | 	 int); |
| 2326 | int	pf_socket_lookup(struct pf_pdesc *, struct mbuf *); | |
| 2510 | int	pf_socket_lookup(struct pf_pdesc *); | |
| 2327 | 2511 | struct pf_state_key *pf_alloc_state_key(int); |
| 2512 | int	pf_translate(struct pf_pdesc *, struct pf_addr *, u_int16_t, | |
| 2513 | 	 struct pf_addr *, u_int16_t, u_int16_t, int); | |
| 2514 | int	pf_translate_af(struct pf_pdesc *); | |
| 2515 | bool	pf_init_threshold(struct pf_kthreshold *, uint32_t, uint32_t); | |
| 2516 | uint16_t	pf_tagname2tag(const char *); | |
| 2517 | #ifdef ALTQ | |
| 2518 | uint16_t	pf_qname2qid(const char *, bool); | |
| 2519 | #endif /* ALTQ */ | |
| 2520 | ||
| 2328 | 2521 | void	pfr_initialize(void); |
| 2329 | 2522 | void	pfr_cleanup(void); |
| 2330 | 2523 | int	pfr_match_addr(struct pfr_ktable *, struct pf_addr *, sa_family_t); |
| 2331 | 2524 | void	pfr_update_stats(struct pfr_ktable *, struct pf_addr *, sa_family_t, |
| 2332 | 2525 | 	 u_int64_t, int, int, int); |
| 2333 | int	pfr_pool_get(struct pfr_ktable *, int *, struct pf_addr *, sa_family_t); | |
| 2526 | int	pfr_pool_get(struct pfr_ktable *, int *, struct pf_addr *, sa_family_t, | |
| 2527 | 	 pf_addr_filter_func_t, bool); | |
| 2334 | 2528 | void	pfr_dynaddr_update(struct pfr_ktable *, struct pfi_dynaddr *); |
| 2335 | 2529 | struct pfr_ktable * |
| 2336 | 2530 | 	pfr_attach_table(struct pf_kruleset *, char *); |
| ... | ... | @@ -2346,7 +2540,7 @@ int	pfr_get_tstats(struct pfr_table *, struct pfr_tstats *, int *, int); |
| 2346 | 2540 | int	pfr_clr_tstats(struct pfr_table *, int, int *, int); |
| 2347 | 2541 | int	pfr_set_tflags(struct pfr_table *, int, int, int, int *, int *, int); |
| 2348 | 2542 | int	pfr_clr_addrs(struct pfr_table *, int *, int); |
| 2349 | int	pfr_insert_kentry(struct pfr_ktable *, struct pfr_addr *, long); | |
| 2543 | int	pfr_insert_kentry(struct pfr_ktable *, struct pfr_addr *, time_t); | |
| 2350 | 2544 | int	pfr_add_addrs(struct pfr_table *, struct pfr_addr *, int, int *, |
| 2351 | 2545 | 	 int); |
| 2352 | 2546 | int	pfr_del_addrs(struct pfr_table *, struct pfr_addr *, int, int *, |
| ... | ... | @@ -2364,6 +2558,8 @@ int	pfr_ina_rollback(struct pfr_table *, u_int32_t, int *, int); |
| 2364 | 2558 | int	pfr_ina_commit(struct pfr_table *, u_int32_t, int *, int *, int); |
| 2365 | 2559 | int	pfr_ina_define(struct pfr_table *, struct pfr_addr *, int, int *, |
| 2366 | 2560 | 	 int *, u_int32_t, int); |
| 2561 | struct pfr_ktable | |
| 2562 | 	*pfr_ktable_select_active(struct pfr_ktable *); | |
| 2367 | 2563 | |
| 2368 | 2564 | MALLOC_DECLARE(PFI_MTYPE); |
| 2369 | 2565 | VNET_DECLARE(struct pfi_kkif *,		 pfi_all); |
| ... | ... | @@ -2390,21 +2586,23 @@ int		 pfi_set_flags(const char *, int); |
| 2390 | 2586 | int		 pfi_clear_flags(const char *, int); |
| 2391 | 2587 | |
| 2392 | 2588 | int		 pf_match_tag(struct mbuf *, struct pf_krule *, int *, int); |
| 2393 | int		 pf_tag_packet(struct mbuf *, struct pf_pdesc *, int); | |
| 2589 | int		 pf_tag_packet(struct pf_pdesc *, int); | |
| 2394 | 2590 | int		 pf_addr_cmp(struct pf_addr *, struct pf_addr *, |
| 2395 | 2591 | 		 sa_family_t); |
| 2396 | 2592 | |
| 2397 | u_int16_t	 pf_get_mss(struct mbuf *, int, u_int16_t, sa_family_t); | |
| 2398 | u_int8_t	 pf_get_wscale(struct mbuf *, int, u_int16_t, sa_family_t); | |
| 2593 | uint8_t*	 pf_find_tcpopt(u_int8_t *, u_int8_t *, size_t, | |
| 2594 | 		 u_int8_t, u_int8_t); | |
| 2595 | u_int16_t	 pf_get_mss(struct pf_pdesc *); | |
| 2596 | u_int8_t	 pf_get_wscale(struct pf_pdesc *); | |
| 2399 | 2597 | struct mbuf 	*pf_build_tcp(const struct pf_krule *, sa_family_t, |
| 2400 | 2598 | 		 const struct pf_addr *, const struct pf_addr *, |
| 2401 | 2599 | 		 u_int16_t, u_int16_t, u_int32_t, u_int32_t, |
| 2402 | 		 u_int8_t, u_int16_t, u_int16_t, u_int8_t, bool, | |
| 2403 | 		 u_int16_t, u_int16_t, int); | |
| 2600 | 		 u_int8_t, u_int16_t, u_int16_t, u_int8_t, int, | |
| 2601 | 		 u_int16_t, u_int16_t, u_int, int); | |
| 2404 | 2602 | void		 pf_send_tcp(const struct pf_krule *, sa_family_t, |
| 2405 | 2603 | 			 const struct pf_addr *, const struct pf_addr *, |
| 2406 | 2604 | 			 u_int16_t, u_int16_t, u_int32_t, u_int32_t, |
| 2407 | 			 u_int8_t, u_int16_t, u_int16_t, u_int8_t, bool, | |
| 2605 | 			 u_int8_t, u_int16_t, u_int16_t, u_int8_t, int, | |
| 2408 | 2606 | 			 u_int16_t, u_int16_t, int); |
| 2409 | 2607 | |
| 2410 | 2608 | void			 pf_syncookies_init(void); |
| ... | ... | @@ -2412,12 +2610,10 @@ void			 pf_syncookies_cleanup(void); |
| 2412 | 2610 | int			 pf_get_syncookies(struct pfioc_nv *); |
| 2413 | 2611 | int			 pf_set_syncookies(struct pfioc_nv *); |
| 2414 | 2612 | int			 pf_synflood_check(struct pf_pdesc *); |
| 2415 | void			 pf_syncookie_send(struct mbuf *m, int off, | |
| 2416 | 			 struct pf_pdesc *); | |
| 2613 | void			 pf_syncookie_send(struct pf_pdesc *); | |
| 2417 | 2614 | bool			 pf_syncookie_check(struct pf_pdesc *); |
| 2418 | 2615 | u_int8_t		 pf_syncookie_validate(struct pf_pdesc *); |
| 2419 | struct mbuf *		 pf_syncookie_recreate_syn(uint8_t, int, | |
| 2420 | 			 struct pf_pdesc *); | |
| 2616 | struct mbuf *		 pf_syncookie_recreate_syn(struct pf_pdesc *); | |
| 2421 | 2617 | |
| 2422 | 2618 | VNET_DECLARE(struct pf_kstatus, pf_status); |
| 2423 | 2619 | #define	V_pf_status	VNET(pf_status) |
| ... | ... | @@ -2432,6 +2628,20 @@ VNET_DECLARE(struct pf_limit, pf_limits[PF_LIMIT_MAX]); |
| 2432 | 2628 | #endif /* _KERNEL */ |
| 2433 | 2629 | |
| 2434 | 2630 | #ifdef _KERNEL |
| 2631 | struct pf_nl_pooladdr { | |
| 2632 | 	u_int32_t		 action; | |
| 2633 | 	u_int32_t		 ticket; | |
| 2634 | 	u_int32_t		 nr; | |
| 2635 | 	u_int32_t		 r_num; | |
| 2636 | 	u_int8_t		 r_action; | |
| 2637 | 	u_int8_t		 r_last; | |
| 2638 | 	u_int8_t		 af; | |
| 2639 | 	char			 anchor[MAXPATHLEN]; | |
| 2640 | 	struct pf_pooladdr	 addr; | |
| 2641 | 	/* Above this is identical to pfioc_pooladdr */ | |
| 2642 | 	int			 which; | |
| 2643 | }; | |
| 2644 | ||
| 2435 | 2645 | VNET_DECLARE(struct pf_kanchor_global,		 pf_anchors); |
| 2436 | 2646 | #define	V_pf_anchors				 VNET(pf_anchors) |
| 2437 | 2647 | VNET_DECLARE(struct pf_kanchor,			 pf_main_anchor); |
| ... | ... | @@ -2449,15 +2659,17 @@ void			 pf_init_kruleset(struct pf_kruleset *); |
| 2449 | 2659 | void			 pf_init_keth(struct pf_keth_ruleset *); |
| 2450 | 2660 | int			 pf_kanchor_setup(struct pf_krule *, |
| 2451 | 2661 | 			 const struct pf_kruleset *, const char *); |
| 2662 | int			 pf_kanchor_copyout(const struct pf_kruleset *, | |
| 2663 | 			 const struct pf_krule *, char *, size_t); | |
| 2452 | 2664 | int			 pf_kanchor_nvcopyout(const struct pf_kruleset *, |
| 2453 | 2665 | 			 const struct pf_krule *, nvlist_t *); |
| 2454 | int			 pf_kanchor_copyout(const struct pf_kruleset *, | |
| 2455 | 			 const struct pf_krule *, struct pfioc_rule *); | |
| 2456 | void			 pf_kanchor_remove(struct pf_krule *); | |
| 2666 | void			 pf_remove_kanchor(struct pf_krule *); | |
| 2457 | 2667 | void			 pf_remove_if_empty_kruleset(struct pf_kruleset *); |
| 2458 | 2668 | struct pf_kruleset	*pf_find_kruleset(const char *); |
| 2669 | struct pf_kruleset	*pf_get_leaf_kruleset(char *, char **); | |
| 2459 | 2670 | struct pf_kruleset	*pf_find_or_create_kruleset(const char *); |
| 2460 | 2671 | void			 pf_rs_initialize(void); |
| 2672 | void			 pf_rule_tree_free(struct pf_krule_global *); | |
| 2461 | 2673 | |
| 2462 | 2674 | |
| 2463 | 2675 | struct pf_krule		*pf_krule_alloc(void); |
| ... | ... | @@ -2474,15 +2686,33 @@ int			 pf_keth_anchor_nvcopyout( |
| 2474 | 2686 | struct pf_keth_ruleset	*pf_find_or_create_keth_ruleset(const char *); |
| 2475 | 2687 | void			 pf_keth_anchor_remove(struct pf_keth_rule *); |
| 2476 | 2688 | |
| 2689 | int			 pf_ioctl_getrules(struct pfioc_rule *); | |
| 2690 | int			 pf_ioctl_addrule(struct pf_krule *, uint32_t, | |
| 2691 | 			 uint32_t, const char *, const char *, uid_t uid, | |
| 2692 | 			 pid_t); | |
| 2693 | void			 pf_ioctl_clear_status(void); | |
| 2694 | int			 pf_ioctl_get_timeout(int, int *); | |
| 2695 | int			 pf_ioctl_set_timeout(int, int, int *); | |
| 2696 | int			 pf_ioctl_get_limit(int, unsigned int *); | |
| 2697 | int			 pf_ioctl_set_limit(int, unsigned int, unsigned int *); | |
| 2698 | int			 pf_ioctl_begin_addrs(uint32_t *); | |
| 2699 | int			 pf_ioctl_add_addr(struct pf_nl_pooladdr *); | |
| 2700 | int			 pf_ioctl_get_addrs(struct pf_nl_pooladdr *); | |
| 2701 | int			 pf_ioctl_get_addr(struct pf_nl_pooladdr *); | |
| 2702 | int			 pf_ioctl_get_rulesets(struct pfioc_ruleset *); | |
| 2703 | int			 pf_ioctl_get_ruleset(struct pfioc_ruleset *); | |
| 2704 | int			 pf_ioctl_natlook(struct pfioc_natlook *); | |
| 2705 | ||
| 2477 | 2706 | void			 pf_krule_free(struct pf_krule *); |
| 2707 | void			 pf_krule_clear_counters(struct pf_krule *); | |
| 2708 | void			 pf_addr_copyout(struct pf_addr_wrap *); | |
| 2478 | 2709 | #endif |
| 2479 | 2710 | |
| 2480 | 2711 | /* The fingerprint functions can be linked into userland programs (tcpdump) */ |
| 2481 | 2712 | int	pf_osfp_add(struct pf_osfp_ioctl *); |
| 2482 | 2713 | #ifdef _KERNEL |
| 2483 | 2714 | struct pf_osfp_enlist * |
| 2484 | 	pf_osfp_fingerprint(struct pf_pdesc *, struct mbuf *, int, | |
| 2485 | 	 const struct tcphdr *); | |
| 2715 | 	pf_osfp_fingerprint(struct pf_pdesc *, const struct tcphdr *); | |
| 2486 | 2716 | #endif /* _KERNEL */ |
| 2487 | 2717 | void	pf_osfp_flush(void); |
| 2488 | 2718 | int	pf_osfp_get(struct pf_osfp_ioctl *); |
| ... | ... | @@ -2491,12 +2721,10 @@ int	pf_osfp_match(struct pf_osfp_enlist *, pf_osfp_t); |
| 2491 | 2721 | #ifdef _KERNEL |
| 2492 | 2722 | void			 pf_print_host(struct pf_addr *, u_int16_t, sa_family_t); |
| 2493 | 2723 | |
| 2494 | void			 pf_step_into_anchor(struct pf_kanchor_stackframe *, int *, | |
| 2495 | 			 struct pf_kruleset **, int, struct pf_krule **, | |
| 2496 | 			 struct pf_krule **, int *); | |
| 2497 | int			 pf_step_out_of_anchor(struct pf_kanchor_stackframe *, int *, | |
| 2498 | 			 struct pf_kruleset **, int, struct pf_krule **, | |
| 2499 | 			 struct pf_krule **, int *); | |
| 2724 | enum pf_test_status	 pf_step_into_anchor(struct pf_test_ctx *, struct pf_krule *, | |
| 2725 | 			 struct pf_krule_slist *match_rules); | |
| 2726 | enum pf_test_status	 pf_match_rule(struct pf_test_ctx *, struct pf_kruleset *, | |
| 2727 | 			 struct pf_krule_slist *); | |
| 2500 | 2728 | void			 pf_step_into_keth_anchor(struct pf_keth_anchor_stackframe *, |
| 2501 | 2729 | 			 int *, struct pf_keth_ruleset **, |
| 2502 | 2730 | 			 struct pf_keth_rule **, struct pf_keth_rule **, |
| ... | ... | @@ -2506,33 +2734,48 @@ int			 pf_step_out_of_keth_anchor(struct pf_keth_anchor_stackframe *, |
| 2506 | 2734 | 			 struct pf_keth_rule **, struct pf_keth_rule **, |
| 2507 | 2735 | 			 int *); |
| 2508 | 2736 | |
| 2509 | u_short			 pf_map_addr(u_int8_t, struct pf_krule *, | |
| 2737 | u_short			 pf_map_addr(sa_family_t, struct pf_krule *, | |
| 2510 | 2738 | 			 struct pf_addr *, struct pf_addr *, |
| 2511 | 			 struct pfi_kkif **nkif, struct pf_addr *, | |
| 2512 | 			 struct pf_ksrc_node **); | |
| 2513 | struct pf_krule		*pf_get_translation(struct pf_pdesc *, struct mbuf *, | |
| 2514 | 			 int, struct pfi_kkif *, struct pf_ksrc_node **, | |
| 2515 | 			 struct pf_state_key **, struct pf_state_key **, | |
| 2739 | 			 struct pfi_kkif **nkif, sa_family_t *, | |
| 2740 | 			 struct pf_addr *, struct pf_kpool *); | |
| 2741 | u_short			 pf_map_addr_sn(u_int8_t, struct pf_krule *, | |
| 2516 | 2742 | 			 struct pf_addr *, struct pf_addr *, |
| 2517 | 			 uint16_t, uint16_t, struct pf_kanchor_stackframe *); | |
| 2518 | ||
| 2519 | struct pf_state_key	*pf_state_key_setup(struct pf_pdesc *, struct mbuf *, int, | |
| 2520 | 			 struct pf_addr *, struct pf_addr *, u_int16_t, u_int16_t); | |
| 2743 | 			 sa_family_t *, struct pfi_kkif **, | |
| 2744 | 			 struct pf_addr *, struct pf_kpool *, | |
| 2745 | 			 pf_sn_types_t); | |
| 2746 | int			 pf_get_transaddr_af(struct pf_krule *, | |
| 2747 | 			 struct pf_pdesc *); | |
| 2748 | u_short			 pf_get_translation(struct pf_test_ctx *); | |
| 2749 | u_short			 pf_get_transaddr(struct pf_test_ctx *, | |
| 2750 | 			 struct pf_krule *, | |
| 2751 | 			 u_int8_t, struct pf_kpool *); | |
| 2752 | int			 pf_translate_compat(struct pf_test_ctx *); | |
| 2753 | ||
| 2754 | int			 pf_state_key_setup(struct pf_pdesc *, | |
| 2755 | 			 u_int16_t, u_int16_t, | |
| 2756 | 			 struct pf_state_key **sk, struct pf_state_key **nk); | |
| 2521 | 2757 | struct pf_state_key	*pf_state_key_clone(const struct pf_state_key *); |
| 2522 | 2758 | void			 pf_rule_to_actions(struct pf_krule *, |
| 2523 | 2759 | 			 struct pf_rule_actions *); |
| 2524 | int			 pf_normalize_mss(struct mbuf *m, int off, | |
| 2525 | 			 struct pf_pdesc *pd); | |
| 2526 | #ifdef INET | |
| 2527 | void	pf_scrub_ip(struct mbuf **, struct pf_pdesc *); | |
| 2528 | #endif	/* INET */ | |
| 2529 | #ifdef INET6 | |
| 2530 | void	pf_scrub_ip6(struct mbuf **, struct pf_pdesc *); | |
| 2531 | #endif	/* INET6 */ | |
| 2760 | int			 pf_normalize_mss(struct pf_pdesc *pd); | |
| 2761 | #if defined(INET) || defined(INET6) | |
| 2762 | void	pf_scrub(struct pf_pdesc *); | |
| 2763 | #endif | |
| 2532 | 2764 | |
| 2533 | 2765 | struct pfi_kkif		*pf_kkif_create(int); |
| 2534 | 2766 | void			 pf_kkif_free(struct pfi_kkif *); |
| 2535 | 2767 | void			 pf_kkif_zero(struct pfi_kkif *); |
| 2768 | ||
| 2769 | ||
| 2770 | /* NAT64 functions. */ | |
| 2771 | int	 inet_nat64(int, const void *, void *, const void *, u_int8_t); | |
| 2772 | int	 inet_nat64_inet(const void *, void *, const void *, u_int8_t); | |
| 2773 | int	 inet_nat64_inet6(const void *, void *, const void *, u_int8_t); | |
| 2774 | ||
| 2775 | int	 inet_nat46(int, const void *, void *, const void *, u_int8_t); | |
| 2776 | int	 inet_nat46_inet(const void *, void *, const void *, u_int8_t); | |
| 2777 | int	 inet_nat46_inet6(const void *, void *, const void *, u_int8_t); | |
| 2778 | ||
| 2536 | 2779 | #endif /* _KERNEL */ |
| 2537 | 2780 | |
| 2538 | 2781 | #endif /* _NET_PFVAR_H_ */ |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/net/radix.h-2| ... | ... | @@ -27,8 +27,6 @@ |
| 27 | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | * | |
| 31 | *	@(#)radix.h	8.2 (Berkeley) 10/31/94 | |
| 32 | 30 | */ |
| 33 | 31 | |
| 34 | 32 | #ifndef _RADIX_H_ |
lib/libc/include/generic-freebsd/net/rndis.h+1-1| ... | ... | @@ -339,7 +339,7 @@ struct rndis_diag_info { |
| 339 | 339 | 	uint32_t rm_erroffset; |
| 340 | 340 | }; |
| 341 | 341 | |
| 342 | /* Keepalive messsage. May be sent by device. */ | |
| 342 | /* Keepalive message. May be sent by device. */ | |
| 343 | 343 | #define	REMOTE_NDIS_KEEPALIVE_MSG	0x00000008 |
| 344 | 344 | #define	REMOTE_NDIS_KEEPALIVE_CMPLT	0x80000008 |
| 345 | 345 |
lib/libc/include/generic-freebsd/net/route.h+2-2| ... | ... | @@ -27,8 +27,6 @@ |
| 27 | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | * | |
| 31 | *	@(#)route.h	8.4 (Berkeley) 1/9/95 | |
| 32 | 30 | */ |
| 33 | 31 | |
| 34 | 32 | #ifndef _NET_ROUTE_H_ |
| ... | ... | @@ -241,6 +239,7 @@ struct rtstat { |
| 241 | 239 | 	uint64_t rts_add_retry;		/* # of route addition retries */ |
| 242 | 240 | 	uint64_t rts_del_failure;	/* # of route deletion failure */ |
| 243 | 241 | 	uint64_t rts_del_retry;		/* # of route deletion retries */ |
| 242 | 	uint64_t rts_spare[5]; | |
| 244 | 243 | }; |
| 245 | 244 | |
| 246 | 245 | /* |
| ... | ... | @@ -296,6 +295,7 @@ struct rt_msghdr { |
| 296 | 295 | #define	RTM_DELMADDR	0x10	/* (4) mcast group membership being deleted */ |
| 297 | 296 | #define	RTM_IFANNOUNCE	0x11	/* (5) iface arrival/departure */ |
| 298 | 297 | #define	RTM_IEEE80211	0x12	/* (5) IEEE80211 wireless event */ |
| 298 | #define	RTM_IPFWLOG	0x13	/* (1) IPFW rule match log event */ | |
| 299 | 299 | |
| 300 | 300 | #endif /* NETLINK_COMPAT*/ |
| 301 | 301 |
lib/libc/include/generic-freebsd/net/route/route_ctl.h+5-5| ... | ... | @@ -61,11 +61,11 @@ int rib_del_route_px_gw(uint32_t fibnum, struct sockaddr *dst, int plen, |
| 61 | 61 | const struct sockaddr *gw, int op_flags, struct rib_cmd_info *rc); |
| 62 | 62 | |
| 63 | 63 | /* operation flags */ |
| 64 | #define	RTM_F_CREATE	0x01 | |
| 65 | #define	RTM_F_EXCL	0x02 | |
| 66 | #define	RTM_F_REPLACE	0x04 | |
| 67 | #define	RTM_F_APPEND	0x08 | |
| 68 | #define	RTM_F_FORCE	0x10 | |
| 64 | #define	RTM_F_CREATE	0x01	/* Create object if not exists */ | |
| 65 | #define	RTM_F_EXCL	0x02	/* (Deprecated) Do not replace or append if exists */ | |
| 66 | #define	RTM_F_REPLACE	0x04	/* Replace if route (even multipath) if exists */ | |
| 67 | #define	RTM_F_APPEND	0x08	/* Append path to the route */ | |
| 68 | #define	RTM_F_FORCE	0x10	/* Bump operation priority to highest */ | |
| 69 | 69 | |
| 70 | 70 | int rib_add_route(uint32_t fibnum, struct rt_addrinfo *info, |
| 71 | 71 | struct rib_cmd_info *rc); |
lib/libc/include/generic-freebsd/net/route/route_debug.h+5-4| ... | ... | @@ -116,10 +116,11 @@ SYSCTL_DECL(_net_route_debug); |
| 116 | 116 | * Example: [nhop_neigh] nhops_update_neigh: <message> |
| 117 | 117 | */ |
| 118 | 118 | #define	RT_LOG(_l, _fmt, ...)	RT_LOG_##_l(_l, _fmt, ## __VA_ARGS__) |
| 119 | #define	_RT_LOG(_l, _fmt, ...)	if (_DEBUG_PASS_MSG(_l)) {	\ | |
| 120 | 	_output("[" DEBUG_PREFIX_NAME "] %s: " _fmt "\n", __func__, ##__VA_ARGS__);	\ | |
| 121 | } | |
| 122 | ||
| 119 | #define	_RT_LOG(_l, _fmt, ...)	do {					\ | |
| 120 | 	if (_DEBUG_PASS_MSG(_l))					\ | |
| 121 | 		_output("[" DEBUG_PREFIX_NAME "] %s: " _fmt "\n",	\ | |
| 122 | 		 __func__, ##__VA_ARGS__);				\ | |
| 123 | } while (0) | |
| 123 | 124 | |
| 124 | 125 | /* |
| 125 | 126 | * Wrapper logic to avoid compiling high levels of debugging messages for |
lib/libc/include/generic-freebsd/net/sff8472.h+8-1| ... | ... | @@ -26,6 +26,9 @@ |
| 26 | 26 | * SUCH DAMAGE. |
| 27 | 27 | */ |
| 28 | 28 | |
| 29 | #ifndef _NET_SFF8472_H_ | |
| 30 | #define _NET_SFF8472_H_ | |
| 31 | ||
| 29 | 32 | /* |
| 30 | 33 | * The following set of constants are from Document SFF-8472 |
| 31 | 34 | * "Diagnostic Monitoring Interface for Optical Transceivers" revision |
| ... | ... | @@ -415,6 +418,7 @@ enum { |
| 415 | 418 | 	SFF_8024_ID_LAST	= SFF_8024_ID_QSFP_CMIS |
| 416 | 419 | }; |
| 417 | 420 | |
| 421 | #if defined(_WANT_SFF_8024_ID) || defined(_WANT_SFF_8472_ID) | |
| 418 | 422 | static const char *sff_8024_id[SFF_8024_ID_LAST + 1] = { |
| 419 | 423 | 	"Unknown", |
| 420 | 424 | 	"GBIC", |
| ... | ... | @@ -448,6 +452,7 @@ static const char *sff_8024_id[SFF_8024_ID_LAST + 1] = { |
| 448 | 452 | 	"x8MiniLink", |
| 449 | 453 | 	"QSFP+(CIMS)" |
| 450 | 454 | }; |
| 455 | #endif | |
| 451 | 456 | |
| 452 | 457 | /* Keep compatibility with old definitions */ |
| 453 | 458 | #define	SFF_8472_ID_UNKNOWN	SFF_8024_ID_UNKNOWN |
| ... | ... | @@ -523,4 +528,6 @@ static const char *sff_8024_id[SFF_8024_ID_LAST + 1] = { |
| 523 | 528 | * yielding a total range of 0 to 6.5535 mW (~ -40 to +8.2 dBm). |
| 524 | 529 | */ |
| 525 | 530 | |
| 526 | #define SFF_8472_POWER_FACTOR 10000.0 | |
| \ No newline at end of file | ||
| 531 | #define SFF_8472_POWER_FACTOR 10000.0 | |
| 532 | ||
| 533 | #endif | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/net/vnet.h+7-1| ... | ... | @@ -311,6 +311,12 @@ void	*vnet_data_alloc(int size); |
| 311 | 311 | void	 vnet_data_copy(void *start, int size); |
| 312 | 312 | void	 vnet_data_free(void *start_arg, int size); |
| 313 | 313 | |
| 314 | /* | |
| 315 | * Interfaces to manipulate the initial values of virtualized global variables. | |
| 316 | */ | |
| 317 | void vnet_save_init(void *, size_t); | |
| 318 | void vnet_restore_init(void *, size_t); | |
| 319 | ||
| 314 | 320 | /* |
| 315 | 321 | * Virtual sysinit mechanism, allowing network stack components to declare |
| 316 | 322 | * startup and shutdown methods to be run when virtual network stack |
| ... | ... | @@ -400,7 +406,7 @@ do {									\ |
| 400 | 406 | #define	CURVNET_SET(arg) |
| 401 | 407 | #define	CURVNET_SET_QUIET(arg) |
| 402 | 408 | #define	CURVNET_RESTORE() |
| 403 | #define	CURVNET_ASSERT_SET()						\ | |
| 409 | #define	CURVNET_ASSERT_SET() | |
| 404 | 410 | |
| 405 | 411 | #define	VNET_LIST_RLOCK() |
| 406 | 412 | #define	VNET_LIST_RLOCK_NOSLEEP() |
lib/libc/include/generic-freebsd/net80211/_ieee80211.h+26-2| ... | ... | @@ -536,6 +536,27 @@ struct ieee80211_mimo_info { |
| 536 | 536 | 	"\21AMPDU\22AMSDU\23HT\24SMPS\25RIFS\32TXLDPC\33RXAMSDUAMPDU" \ |
| 537 | 537 | 	"\34TXAMSDUAMPDU" |
| 538 | 538 | |
| 539 | /* | |
| 540 | * AKM (key management) suite capability list. | |
| 541 | * | |
| 542 | * These represent what's in 802.11-2016 - Table 9-133 - AKM Suite Selectors. | |
| 543 | * Note that they do not match what the table values are, in case other key | |
| 544 | * management suites want to be added with different OUIs. | |
| 545 | */ | |
| 546 | #define	IEEE80211_KEYMGMT_RSN_UNSPEC_802_1X		0x00000001 /* RSN suite 1 */ | |
| 547 | #define	IEEE80211_KEYMGMT_RSN_PSK_OVER_802_1X		0x00000002 /* RSN suite 2 */ | |
| 548 | #define	IEEE80211_KEYMGMT_RSN_FT_OVER_802_1X		0x00000004 /* RSN suite 3 */ | |
| 549 | #define	IEEE80211_KEYMGMT_RSN_FT_PSK			0x00000008 /* RSN suite 4 */ | |
| 550 | #define	IEEE80211_KEYMGMT_RSN_802_1X_SHA256		0x00000010 /* RSN suite 5 */ | |
| 551 | #define	IEEE80211_KEYMGMT_RSN_PSK_SHA256		0x00000020 /* RSN suite 6 */ | |
| 552 | #define	IEEE80211_KEYMGMT_RSN_TPK_HANDSHAKE		0x00000040 /* RSN suite 7 */ | |
| 553 | #define	IEEE80211_KEYMGMT_RSN_SAE			0x00000080 /* RSN suite 8 */ | |
| 554 | #define	IEEE80211_KEYMGMT_RSN_FT_SAE			0x00000100 /* RSN suite 9 */ | |
| 555 | #define	IEEE80211_KEYMGMT_RSN_APPEERKEY_SHA256		0x00000200 /* RSN suite 10 */ | |
| 556 | #define	IEEE80211_KEYMGMT_RSN_802_1X_SUITE_B		0x00000400 /* RSN suite 11 */ | |
| 557 | #define	IEEE80211_KEYMGMT_RSN_802_1X_SUITE_B_192	0x00000800 /* RSN suite 12 */ | |
| 558 | #define	IEEE80211_KEYMGMT_RSN_FT_802_1X_SHA384		0x00001000 /* RSN suite 13 */ | |
| 559 | ||
| 539 | 560 | /* |
| 540 | 561 | * RX status notification - which fields are valid. |
| 541 | 562 | */ |
| ... | ... | @@ -564,15 +585,18 @@ struct ieee80211_mimo_info { |
| 564 | 585 | #define	IEEE80211_RX_F_AMPDU		0x00000010 /* This is the start of an decap AMPDU list */ |
| 565 | 586 | #define	IEEE80211_RX_F_AMPDU_MORE	0x00000020 /* This is another decap AMPDU frame in the batch */ |
| 566 | 587 | #define	IEEE80211_RX_F_FAIL_FCSCRC	0x00000040 /* Failed CRC/FCS */ |
| 567 | #define	IEEE80211_RX_F_FAIL_MIC		0x00000080 /* Failed MIC check */ | |
| 588 | #define	IEEE80211_RX_F_FAIL_MMIC	0x00000080 /* Failed Michael MIC (MMIC) check */ | |
| 568 | 589 | #define	IEEE80211_RX_F_DECRYPTED	0x00000100 /* Hardware decrypted */ |
| 569 | 590 | #define	IEEE80211_RX_F_IV_STRIP		0x00000200 /* Decrypted; IV stripped */ |
| 570 | #define	IEEE80211_RX_F_MMIC_STRIP	0x00000400 /* Decrypted; MMIC stripped */ | |
| 591 | #define	IEEE80211_RX_F_MMIC_STRIP	0x00000400 /* Decrypted; Michael MIC (MMIC) stripped */ | |
| 571 | 592 | #define	IEEE80211_RX_F_SHORTGI		0x00000800 /* This is a short-GI frame */ |
| 572 | 593 | #define	IEEE80211_RX_F_CCK		0x00001000 |
| 573 | 594 | #define	IEEE80211_RX_F_OFDM		0x00002000 |
| 574 | 595 | #define	IEEE80211_RX_F_HT		0x00004000 |
| 575 | 596 | #define	IEEE80211_RX_F_VHT		0x00008000 |
| 597 | #define	IEEE80211_RX_F_PN_VALIDATED	0x00010000 /* Decrypted; PN validated */ | |
| 598 | #define	IEEE80211_RX_F_MIC_STRIP	0x00020000 /* Decrypted; MIC stripped */ | |
| 599 | #define	IEEE80211_RX_F_ICV_STRIP	0x00040000 /* Decrypted: ICV (ic_trailer) stripped */ | |
| 576 | 600 | |
| 577 | 601 | /* Channel width */ |
| 578 | 602 | #define	IEEE80211_RX_FW_20MHZ		1 |
lib/libc/include/generic-freebsd/net80211/ieee80211.h+665-45| ... | ... | @@ -4,6 +4,10 @@ |
| 4 | 4 | * Copyright (c) 2001 Atsushi Onoe |
| 5 | 5 | * Copyright (c) 2002-2009 Sam Leffler, Errno Consulting |
| 6 | 6 | * All rights reserved. |
| 7 | * Copyright (c) 2020-2025 The FreeBSD Foundation | |
| 8 | * | |
| 9 | * Portions of this software were developed by Björn Zeeb | |
| 10 | * under sponsorship from the FreeBSD Foundation. | |
| 7 | 11 | * |
| 8 | 12 | * Redistribution and use in source and binary forms, with or without |
| 9 | 13 | * modification, are permitted provided that the following conditions |
| ... | ... | @@ -28,6 +32,12 @@ |
| 28 | 32 | #ifndef _NET80211_IEEE80211_H_ |
| 29 | 33 | #define _NET80211_IEEE80211_H_ |
| 30 | 34 | |
| 35 | #include <sys/types.h> | |
| 36 | ||
| 37 | #ifndef _KERNEL | |
| 38 | #include <stdbool.h> | |
| 39 | #endif | |
| 40 | ||
| 31 | 41 | /* |
| 32 | 42 | * 802.11 protocol definitions. |
| 33 | 43 | */ |
| ... | ... | @@ -161,6 +171,7 @@ struct ieee80211_qosframe_addr4 { |
| 161 | 171 | /* 0001-0011 Reserved				0x10-0x30 */	/* Were: CF_ACK, CF_POLL, CF_ACPL */ |
| 162 | 172 | #define	IEEE80211_FC0_SUBTYPE_NODATA		0x40	/* Null */ |
| 163 | 173 | /* 0101-0111 Reserved				0x50-0x70 */	/* Were: CFACK, CFPOLL, CF_ACK_CF_ACK */ |
| 174 | #define	IEEE80211_FC0_SUBTYPE_QOS_MASK_ANY	0x80	/* QoS mask - matching any subtypes 8..15 */ | |
| 164 | 175 | #define	IEEE80211_FC0_SUBTYPE_QOS_DATA		0x80	/* QoS Data */ |
| 165 | 176 | #define	IEEE80211_FC0_SUBTYPE_QOS_DATA_CFACK	0x90	/* QoS Data +CF-Ack */ |
| 166 | 177 | #define	IEEE80211_FC0_SUBTYPE_QOS_DATA_CFPOLL	0xa0	/* QoS Data +CF-Poll */ |
| ... | ... | @@ -190,24 +201,98 @@ struct ieee80211_qosframe_addr4 { |
| 190 | 201 | #define	IEEE80211_CTL_EXT_TDD_BF		0x0b	/* TDD Beamforming, 80211ay-2021 */ |
| 191 | 202 | /* 1100-1111 Reserved				0xc-0xf */ |
| 192 | 203 | |
| 193 | #define	IEEE80211_IS_MGMT(wh)					\ | |
| 194 | 	(!! (((wh)->i_fc[0] & IEEE80211_FC0_TYPE_MASK)		\ | |
| 195 | 	 == IEEE80211_FC0_TYPE_MGT)) | |
| 204 | /* Check the version field */ | |
| 205 | #define	IEEE80211_IS_FC0_CHECK_VER(wh, v)			\ | |
| 206 | 	(((wh)->i_fc[0] & IEEE80211_FC0_VERSION_MASK) == (v)) | |
| 207 | ||
| 208 | /* Check the version and type field */ | |
| 209 | #define	IEEE80211_IS_FC0_CHECK_VER_TYPE(wh, v, t)			\ | |
| 210 | 	(((((wh)->i_fc[0] & IEEE80211_FC0_VERSION_MASK) == (v))) &&	\ | |
| 211 | 	 (((wh)->i_fc[0] & IEEE80211_FC0_TYPE_MASK) == (t))) | |
| 212 | ||
| 213 | /* Check the version, type and subtype field */ | |
| 214 | #define	IEEE80211_IS_FC0_CHECK_VER_TYPE_SUBTYPE(wh, v, t, st)		\ | |
| 215 | 	(((((wh)->i_fc[0] & IEEE80211_FC0_VERSION_MASK) == (v))) &&	\ | |
| 216 | 	 (((wh)->i_fc[0] & IEEE80211_FC0_TYPE_MASK) == (t)) &&		\ | |
| 217 | 	 (((wh)->i_fc[0] & IEEE80211_FC0_SUBTYPE_MASK) == (st))) | |
| 218 | ||
| 219 | #define	IEEE80211_IS_MGMT(wh)						\ | |
| 220 | 	(IEEE80211_IS_FC0_CHECK_VER_TYPE(wh, IEEE80211_FC0_VERSION_0,	\ | |
| 221 | 	 IEEE80211_FC0_TYPE_MGT)) | |
| 196 | 222 | #define	IEEE80211_IS_CTL(wh)					\ |
| 197 | 	(!! (((wh)->i_fc[0] & IEEE80211_FC0_TYPE_MASK)		\ | |
| 198 | 	 == IEEE80211_FC0_TYPE_CTL)) | |
| 223 | 	(IEEE80211_IS_FC0_CHECK_VER_TYPE(wh, IEEE80211_FC0_VERSION_0,	\ | |
| 224 | 	 IEEE80211_FC0_TYPE_CTL)) | |
| 199 | 225 | #define	IEEE80211_IS_DATA(wh)					\ |
| 200 | 	(!! (((wh)->i_fc[0] & IEEE80211_FC0_TYPE_MASK)		\ | |
| 201 | 	 == IEEE80211_FC0_TYPE_DATA)) | |
| 226 | 	(IEEE80211_IS_FC0_CHECK_VER_TYPE(wh, IEEE80211_FC0_VERSION_0,	\ | |
| 227 | 	 IEEE80211_FC0_TYPE_DATA)) | |
| 202 | 228 | #define	IEEE80211_IS_EXT(wh)					\ |
| 203 | 	(!! (((wh)->i_fc[0] & IEEE80211_FC0_TYPE_MASK)		\ | |
| 204 | 	 == IEEE80211_FC0_TYPE_EXT)) | |
| 229 | 	(IEEE80211_IS_FC0_CHECK_VER_TYPE(wh, IEEE80211_FC0_VERSION_0,	\ | |
| 230 | 	 IEEE80211_FC0_TYPE_EXT)) | |
| 231 | ||
| 232 | /* Management frame types */ | |
| 233 | ||
| 234 | #define	IEEE80211_IS_MGMT_BEACON(wh)			\ | |
| 235 | 	(IEEE80211_IS_FC0_CHECK_VER_TYPE_SUBTYPE(wh,	\ | |
| 236 | 	 IEEE80211_FC0_VERSION_0,			\ | |
| 237 | 	 IEEE80211_FC0_TYPE_MGT,			\ | |
| 238 | 	 IEEE80211_FC0_SUBTYPE_BEACON)) | |
| 205 | 239 | |
| 206 | #define	IEEE80211_FC0_QOSDATA \ | |
| 207 | 	(IEEE80211_FC0_TYPE_DATA|IEEE80211_FC0_SUBTYPE_QOS_DATA|IEEE80211_FC0_VERSION_0) | |
| 240 | #define	IEEE80211_IS_MGMT_PROBE_RESP(wh)		\ | |
| 241 | 	(IEEE80211_IS_FC0_CHECK_VER_TYPE_SUBTYPE(wh,	\ | |
| 242 | 	 IEEE80211_FC0_VERSION_0,			\ | |
| 243 | 	 IEEE80211_FC0_TYPE_MGT,			\ | |
| 244 | 	 IEEE80211_FC0_SUBTYPE_PROBE_RESP)) | |
| 245 | ||
| 246 | #define	IEEE80211_IS_MGMT_ACTION(wh)		\ | |
| 247 | 	(IEEE80211_IS_FC0_CHECK_VER_TYPE_SUBTYPE(wh,	\ | |
| 248 | 	 IEEE80211_FC0_VERSION_0,			\ | |
| 249 | 	 IEEE80211_FC0_TYPE_MGT,			\ | |
| 250 | 	 IEEE80211_FC0_SUBTYPE_ACTION)) | |
| 251 | ||
| 252 | /* Control frame types */ | |
| 253 | ||
| 254 | #define	IEEE80211_IS_CTL_PS_POLL(wh)			\ | |
| 255 | 	(IEEE80211_IS_FC0_CHECK_VER_TYPE_SUBTYPE(wh,	\ | |
| 256 | 	 IEEE80211_FC0_VERSION_0,			\ | |
| 257 | 	 IEEE80211_FC0_TYPE_CTL,			\ | |
| 258 | 	 IEEE80211_FC0_SUBTYPE_PS_POLL)) | |
| 259 | ||
| 260 | #define	IEEE80211_IS_CTL_BAR(wh)			\ | |
| 261 | 	(IEEE80211_IS_FC0_CHECK_VER_TYPE_SUBTYPE(wh,	\ | |
| 262 | 	 IEEE80211_FC0_VERSION_0,			\ | |
| 263 | 	 IEEE80211_FC0_TYPE_CTL,			\ | |
| 264 | 	 IEEE80211_FC0_SUBTYPE_BAR)) | |
| 265 | ||
| 266 | /* Data frame types */ | |
| 267 | ||
| 268 | /* | |
| 269 | * Return true if the frame is any of the QOS frame types, not just | |
| 270 | * data frames. Matching on the IEEE80211_FC0_SUBTYPE_QOS_ANY bit | |
| 271 | * being set also matches on subtypes 8..15. | |
| 272 | */ | |
| 273 | #define	IEEE80211_IS_QOS_ANY(wh)					\ | |
| 274 | 	((IEEE80211_IS_FC0_CHECK_VER_TYPE(wh, IEEE80211_FC0_VERSION_0,	\ | |
| 275 | 	 IEEE80211_FC0_TYPE_DATA)) &&					\ | |
| 276 | 	 ((wh)->i_fc[0] & IEEE80211_FC0_SUBTYPE_QOS_MASK_ANY)) | |
| 277 | ||
| 278 | /* | |
| 279 | * Return true if this frame is QOS data, and only QOS data. | |
| 280 | */ | |
| 281 | #define	IEEE80211_IS_QOSDATA(wh)			\ | |
| 282 | 	(IEEE80211_IS_FC0_CHECK_VER_TYPE_SUBTYPE(wh,	\ | |
| 283 | 	 IEEE80211_FC0_VERSION_0,			\ | |
| 284 | 	 IEEE80211_FC0_TYPE_DATA,			\ | |
| 285 | 	 IEEE80211_FC0_SUBTYPE_QOS_DATA)) | |
| 286 | ||
| 287 | /* | |
| 288 | * Return true if this frame is a QoS NULL data frame. | |
| 289 | */ | |
| 290 | #define	IEEE80211_IS_QOS_NULL(wh)			\ | |
| 291 | 	(IEEE80211_IS_FC0_CHECK_VER_TYPE_SUBTYPE(wh,	\ | |
| 292 | 	 IEEE80211_FC0_VERSION_0,			\ | |
| 293 | 	 IEEE80211_FC0_TYPE_DATA,			\ | |
| 294 | 	 IEEE80211_FC0_SUBTYPE_QOS_NULL)) | |
| 208 | 295 | |
| 209 | #define	IEEE80211_IS_QOSDATA(wh) \ | |
| 210 | 	((wh)->i_fc[0] == IEEE80211_FC0_QOSDATA) | |
| 211 | 296 | |
| 212 | 297 | #define	IEEE80211_FC1_DIR_MASK			0x03 |
| 213 | 298 | #define	IEEE80211_FC1_DIR_NODS			0x00	/* STA->STA */ |
| ... | ... | @@ -421,7 +506,7 @@ struct ieee80211_action { |
| 421 | 506 | #define	IEEE80211_ACTION_CAT_BA			3	/* 9.6.4 Block Ack */ |
| 422 | 507 | #define	IEEE80211_ACTION_CAT_PUBLIC		4	/* 9.6.7 Public */ |
| 423 | 508 | #define	IEEE80211_ACTION_CAT_RADIO_MEASUREMENT	5	/* 9.6.6 Radio Measurement */ |
| 424 | #define	IEEE80211_ACTION_CAT_FAST_BBS_TRANSITION 6	/* 9.6.8 Fast BSS Transition */ | |
| 509 | #define	IEEE80211_ACTION_CAT_FAST_BSS_TRANSITION 6	/* 9.6.8 Fast BSS Transition */ | |
| 425 | 510 | #define	IEEE80211_ACTION_CAT_HT			7	/* 9.6.11 HT */ |
| 426 | 511 | #define	IEEE80211_ACTION_CAT_SA_QUERY		8	/* 9.6.9 SA Query */ |
| 427 | 512 | #define	IEEE80211_ACTION_CAT_PROTECTED_DUAL_OF_PUBLIC_ACTION 9 /* 9.6.10 Protected Dual of Public Action */ |
| ... | ... | @@ -856,6 +941,7 @@ enum ieee80211_vht_mcs_support { |
| 856 | 941 | 	IEEE80211_VHT_MCS_NOT_SUPPORTED		= 3	/* not supported */ |
| 857 | 942 | }; |
| 858 | 943 | |
| 944 | /* 802.11ac-2013, 8.4.2.160.3 Supported VHT-MCS and NSS Set field */ | |
| 859 | 945 | struct ieee80211_vht_mcs_info { |
| 860 | 946 | 	uint16_t rx_mcs_map; |
| 861 | 947 | 	uint16_t rx_highest; |
| ... | ... | @@ -869,12 +955,15 @@ struct ieee80211_vht_cap { |
| 869 | 955 | 	struct ieee80211_vht_mcs_info	supp_mcs; |
| 870 | 956 | } __packed; |
| 871 | 957 | |
| 872 | /* 802.11ac-2013, Table 8-183x-VHT Operation Information subfields */ | |
| 958 | /* | |
| 959 | * 802.11ac-2013, Table 8-183x-VHT Operation Information subfields. | |
| 960 | * 802.11-2020, Table 9-274-VHT Operation Information subfields (for deprecations) | |
| 961 | */ | |
| 873 | 962 | enum ieee80211_vht_chanwidth { |
| 874 | 963 | 	IEEE80211_VHT_CHANWIDTH_USE_HT		= 0,	/* 20 MHz or 40 MHz */ |
| 875 | 964 | 	IEEE80211_VHT_CHANWIDTH_80MHZ		= 1,	/* 80MHz */ |
| 876 | 	IEEE80211_VHT_CHANWIDTH_160MHZ		= 2,	/* 160MHz */ | |
| 877 | 	IEEE80211_VHT_CHANWIDTH_80P80MHZ	= 3,	/* 80+80MHz */ | |
| 965 | 	IEEE80211_VHT_CHANWIDTH_160MHZ		= 2,	/* 160MHz (deprecated) */ | |
| 966 | 	IEEE80211_VHT_CHANWIDTH_80P80MHZ	= 3,	/* 80+80MHz (deprecated) */ | |
| 878 | 967 | 	/* 4..255 reserved. */ |
| 879 | 968 | }; |
| 880 | 969 | |
| ... | ... | @@ -898,7 +987,7 @@ struct ieee80211_vht_operation { |
| 898 | 987 | |
| 899 | 988 | #define	IEEE80211_VHTCAP_SUPP_CHAN_WIDTH_MASK	0x0000000C |
| 900 | 989 | #define	IEEE80211_VHTCAP_SUPP_CHAN_WIDTH_MASK_S	2 |
| 901 | #define	IEEE80211_VHTCAP_SUPP_CHAN_WIDTH_NONE		0 | |
| 990 | #define	IEEE80211_VHTCAP_SUPP_CHAN_WIDTH_NO160		0 | |
| 902 | 991 | #define	IEEE80211_VHTCAP_SUPP_CHAN_WIDTH_160MHZ		1 |
| 903 | 992 | #define	IEEE80211_VHTCAP_SUPP_CHAN_WIDTH_160_80P80MHZ	2 |
| 904 | 993 | #define	IEEE80211_VHTCAP_SUPP_CHAN_WIDTH_RESERVED	3 |
| ... | ... | @@ -969,11 +1058,15 @@ struct ieee80211_vht_operation { |
| 969 | 1058 | #define	IEEE80211_VHTCAP_TX_ANTENNA_PATTERN	0x20000000 |
| 970 | 1059 | #define	IEEE80211_VHTCAP_TX_ANTENNA_PATTERN_S	29 |
| 971 | 1060 | |
| 1061 | /* 802.11-2016, 9.4.2.158.2 VHT Capabilities Information field. */ | |
| 1062 | #define	IEEE80211_VHTCAP_EXT_NSS_BW		0xc0000000 | |
| 1063 | #define	IEEE80211_VHTCAP_EXT_NSS_BW_S		30 | |
| 1064 | ||
| 972 | 1065 | /* |
| 973 | 1066 | * XXX TODO: add the rest of the bits |
| 974 | 1067 | */ |
| 975 | 1068 | #define	IEEE80211_VHTCAP_BITS \ |
| 976 | 	"\20\1MPDU7991\2MPDU11454\3CHAN160\4CHAN8080\5RXLDPC\6SHORTGI80" \ | |
| 1069 | 	"\20\1MPDU7991\2MPDU11454\3CHAN160\4CHAN160+80P80\5RXLDPC\6SHORTGI80" \ | |
| 977 | 1070 | 	"\7SHORTGI160\10RXSTBC1\11RXSTBC2\12RXSTBC3\13RXSTBC4\14BFERCAP" \ |
| 978 | 1071 | 	"\15BFEECAP\27VHT\37RXANTPTN\40TXANTPTN" |
| 979 | 1072 | |
| ... | ... | @@ -1015,22 +1108,296 @@ struct ieee80211_ie_vht_txpwrenv { |
| 1015 | 1108 | #define	WLAN_ACTION_VHT_GROUPID_MGMT		1 |
| 1016 | 1109 | #define	WLAN_ACTION_VHT_OPMODE_NOTIF		2 |
| 1017 | 1110 | |
| 1111 | #if defined(_KERNEL) || defined(WANT_NET80211) | |
| 1112 | /* | |
| 1113 | * HE | |
| 1114 | */ | |
| 1115 | ||
| 1116 | /* | |
| 1117 | * 802.11ax-2021, 9.4.2.248.2 HE MAC Capabilities Information field. | |
| 1118 | */ | |
| 1119 | /* B0..B7 */ | |
| 1120 | #define	IEEE80211_HE_MAC_CAP0_HTC_HE			(1<<0) | |
| 1121 | #define	IEEE80211_HE_MAC_CAP0_TWT_REQ			(1<<1) | |
| 1122 | #define	IEEE80211_HE_MAC_CAP0_TWT_RES			(1<<2) | |
| 1123 | ||
| 1124 | /* B8..B15 */ | |
| 1125 | #define	IEEE80211_HE_MAC_CAP1_TF_MAC_PAD_DUR_16US	(1<<3) | |
| 1126 | #define	IEEE80211_HE_MAC_CAP1_TF_MAC_PAD_DUR_MASK	(1<<3 | 1<<2) | |
| 1127 | #define	IEEE80211_HE_MAC_CAP1_MULTI_TID_AGG_RX_QOS_8	(1<<6 | 1<<5 | 1<<4) | |
| 1128 | #define	IEEE80211_HE_MAC_CAP1_LINK_ADAPTATION		(1<<7) | |
| 1129 | /* Note: B15|B16 are split between octets %!$@??? */ | |
| 1130 | ||
| 1131 | /* B16..B23 */ | |
| 1132 | #define	IEEE80211_HE_MAC_CAP2_LINK_ADAPTATION		(1<<0) | |
| 1133 | #define	IEEE80211_HE_MAC_CAP2_ALL_ACK			(1<<1) | |
| 1134 | #define	IEEE80211_HE_MAC_CAP2_TRS			(1<<2) | |
| 1135 | #define	IEEE80211_HE_MAC_CAP2_BSR			(1<<3) | |
| 1136 | #define	IEEE80211_HE_MAC_CAP2_BCAST_TWT			(1<<4) | |
| 1137 | #define	IEEE80211_HE_MAC_CAP2_32BIT_BA_BITMAP		(1<<5) | |
| 1138 | #define	IEEE80211_HE_MAC_CAP2_MU_CASCADING		(1<<6) | |
| 1139 | #define	IEEE80211_HE_MAC_CAP2_ACK_EN			(1<<7) | |
| 1140 | ||
| 1141 | /* B24..B31 */ | |
| 1142 | #define	IEEE80211_HE_MAC_CAP3_OMI_CONTROL		(1<<1) | |
| 1143 | #define	IEEE80211_HE_MAC_CAP3_OFDMA_RA			(1<<2) | |
| 1144 | #define	IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_EXT_1	(1<<3) | |
| 1145 | #define	IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_EXT_2	(1<<4) | |
| 1146 | #define	IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_EXT_3	(1<<4 | 1<<3) | |
| 1147 | #define	IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_MASK	(1<<4 | 1<<3) | |
| 1148 | #define	IEEE80211_HE_MAC_CAP3_FLEX_TWT_SCHED		(1<<6) | |
| 1149 | #define	IEEE80211_HE_MAC_CAP3_RX_CTRL_FRAME_TO_MULTIBSS	(1<<7) | |
| 1150 | ||
| 1151 | /* B32..B39 */ | |
| 1152 | #define	IEEE80211_HE_MAC_CAP4_BSRP_BQRP_A_MPDU_AGG	(1<<0) | |
| 1153 | #define	IEEE80211_HE_MAC_CAP4_BQR			(1<<2) | |
| 1154 | #define	IEEE80211_HE_MAC_CAP4_OPS			(1<<5) | |
| 1155 | #define	IEEE80211_HE_MAC_CAP4_AMSDU_IN_AMPDU		(1<<6) | |
| 1156 | #define	IEEE80211_HE_MAC_CAP4_MULTI_TID_AGG_TX_QOS_B39	(1<<7) | |
| 1157 | /* Note: B39|B40|B41 are split between octets %!$@??? */ | |
| 1158 | ||
| 1159 | /* B40..B47 */ | |
| 1160 | #define	IEEE80211_HE_MAC_CAP5_MULTI_TID_AGG_TX_QOS_B40	(1<<0) | |
| 1161 | #define	IEEE80211_HE_MAC_CAP5_MULTI_TID_AGG_TX_QOS_B41	(1<<1) | |
| 1162 | #define	IEEE80211_HE_MAC_CAP5_SUBCHAN_SELECTIVE_TRANSMISSION	(1<<2) | |
| 1163 | #define	IEEE80211_HE_MAC_CAP5_UL_2x996_TONE_RU		(1<<3) | |
| 1164 | #define	IEEE80211_HE_MAC_CAP5_OM_CTRL_UL_MU_DATA_DIS_RX	(1<<4) | |
| 1165 | #define	IEEE80211_HE_MAC_CAP5_HE_DYNAMIC_SM_PS		(1<<5) | |
| 1166 | #define	IEEE80211_HE_MAC_CAP5_PUNCTURED_SOUNDING	(1<<6) | |
| 1167 | #define	IEEE80211_HE_MAC_CAP5_HT_VHT_TRIG_FRAME_RX	(1<<7) | |
| 1168 | ||
| 1169 | /* | |
| 1170 | * 802.11ax-2021, 9.4.2.248.3 HE PHY Capabilities Information field. | |
| 1171 | */ | |
| 1172 | /* B0..B7 */ | |
| 1173 | #define	IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_40MHZ_IN_2G		(1<<1) | |
| 1174 | #define	IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_40MHZ_80MHZ_IN_5G	(1<<2) | |
| 1175 | #define	IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_160MHZ_IN_5G		(1<<3) | |
| 1176 | #define	IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_80PLUS80_MHZ_IN_5G	(1<<4) | |
| 1177 | #define	IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_MASK_ALL		(1<<4 | 1<<3 | 1<<2 | 1<<1) | |
| 1178 | #define	IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_RU_MAPPING_IN_2G	(1<<5) | |
| 1179 | #define	IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_RU_MAPPING_IN_5G	(1<<6) | |
| 1180 | #define	IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_MASK			(1<<6 | 1<<5 | 1<<4 | 1<<3 | 1<<2 | 1<<1) | |
| 1181 | ||
| 1182 | /* B8..B15 */ | |
| 1183 | #define	IEEE80211_HE_PHY_CAP1_PREAMBLE_PUNC_RX_MASK	(1<<3 | 1<<2 | 1<<1 | 1<<0) | |
| 1184 | #define	IEEE80211_HE_PHY_CAP1_DEVICE_CLASS_A		(1<<4) | |
| 1185 | #define	IEEE80211_HE_PHY_CAP1_LDPC_CODING_IN_PAYLOAD	(1<<5) | |
| 1186 | #define	IEEE80211_HE_PHY_CAP1_HE_LTF_AND_GI_FOR_HE_PPDUS_0_8US	(1<<6) | |
| 1187 | #define	IEEE80211_HE_PHY_CAP1_MIDAMBLE_RX_TX_MAX_NSTS	(1<<7) | |
| 1188 | /* Note: B15|B16 are split between octets %!$@??? */ | |
| 1189 | ||
| 1190 | /* B16..B23 */ | |
| 1191 | #define	IEEE80211_HE_PHY_CAP2_MIDAMBLE_RX_TX_MAX_NSTS	(1<<0) | |
| 1192 | #define	IEEE80211_HE_PHY_CAP2_NDP_4x_LTF_AND_3_2US	(1<<1) | |
| 1193 | #define	IEEE80211_HE_PHY_CAP2_STBC_TX_UNDER_80MHZ	(1<<2) | |
| 1194 | #define	IEEE80211_HE_PHY_CAP2_STBC_RX_UNDER_80MHZ	(1<<3) | |
| 1195 | #define	IEEE80211_HE_PHY_CAP2_DOPPLER_TX		(1<<4) | |
| 1196 | #define	IEEE80211_HE_PHY_CAP2_DOPPLER_RX		(1<<5) | |
| 1197 | #define	IEEE80211_HE_PHY_CAP2_UL_MU_FULL_MU_MIMO	(1<<6) | |
| 1198 | #define	IEEE80211_HE_PHY_CAP2_UL_MU_PARTIAL_MU_MIMO	(1<<7) | |
| 1199 | ||
| 1200 | /* B24..B31 */ | |
| 1201 | #define	IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_TX_NO_DCM	0x00 | |
| 1202 | #define	IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_TX_BPSK	(1<<0) | |
| 1203 | #define	IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_TX_QPSK	(1<<1) | |
| 1204 | #define	IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_TX_16_QAM	(1<<1 | 1<<0) | |
| 1205 | #define	IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_TX_MASK	(1<<1 | 1<<0) | |
| 1206 | #define	IEEE80211_HE_PHY_CAP3_DCM_MAX_TX_NSS_1		0x00 | |
| 1207 | #define	IEEE80211_HE_PHY_CAP3_DCM_MAX_TX_NSS_2		(1<<2) | |
| 1208 | #define	IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_RX_NO_DCM	0x00 | |
| 1209 | #define	IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_RX_BPSK	(1<<3) | |
| 1210 | #define	IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_RX_QPSK	(1<<4) | |
| 1211 | #define	IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_RX_16_QAM	(1<<4 | 1<<3) | |
| 1212 | #define	IEEE80211_HE_PHY_CAP3_DCM_MAX_CONST_RX_MASK	(1<<4 | 1<<3) | |
| 1213 | #define	IEEE80211_HE_PHY_CAP3_DCM_MAX_RX_NSS_1		0x00 | |
| 1214 | #define	IEEE80211_HE_PHY_CAP3_DCM_MAX_RX_NSS_2		(1<<5) | |
| 1215 | #define	IEEE80211_HE_PHY_CAP3_RX_PARTIAL_BW_SU_IN_20MHZ_MU	(1<<6) | |
| 1216 | #define	IEEE80211_HE_PHY_CAP3_SU_BEAMFORMER		(1<<7) | |
| 1217 | ||
| 1218 | /* B32..B39 */ | |
| 1219 | #define	IEEE80211_HE_PHY_CAP4_SU_BEAMFORMEE			(1<<0) | |
| 1220 | #define	IEEE80211_HE_PHY_CAP4_MU_BEAMFORMER			(1<<1) | |
| 1221 | #define	IEEE80211_HE_PHY_CAP4_BEAMFORMEE_MAX_STS_UNDER_80MHZ_4	(1<<3 | 1<<2) | |
| 1222 | #define	IEEE80211_HE_PHY_CAP4_BEAMFORMEE_MAX_STS_UNDER_80MHZ_5	(1<<4) | |
| 1223 | #define	IEEE80211_HE_PHY_CAP4_BEAMFORMEE_MAX_STS_UNDER_80MHZ_8	(1<<4 | 1<<3 | 1<<2) | |
| 1224 | #define	IEEE80211_HE_PHY_CAP4_BEAMFORMEE_MAX_STS_UNDER_80MHZ_MASK	(1<<4 | 1<<3 | 1<<2) | |
| 1225 | #define	IEEE80211_HE_PHY_CAP4_BEAMFORMEE_MAX_STS_ABOVE_80MHZ_4	(1<<6 | 1<<5) | |
| 1226 | #define	IEEE80211_HE_PHY_CAP4_BEAMFORMEE_MAX_STS_ABOVE_80MHZ_5	(1<<7) | |
| 1227 | #define	IEEE80211_HE_PHY_CAP4_BEAMFORMEE_MAX_STS_ABOVE_80MHZ_8	(1<<7 | 1<<6 | 1<<5) | |
| 1228 | #define	IEEE80211_HE_PHY_CAP4_BEAMFORMEE_MAX_STS_ABOVE_80MHZ_MASK	(1<<7 | 1<<6 | 1<<5) | |
| 1229 | ||
| 1230 | /* B40..B47 */ | |
| 1231 | #define	IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_UNDER_80MHZ_2	(1<<0) | |
| 1232 | #define	IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_UNDER_80MHZ_MASK	(1<<2 | 1<<1 | 1<<0) | |
| 1233 | #define	IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_ABOVE_80MHZ_2	(1<<3) | |
| 1234 | #define	IEEE80211_HE_PHY_CAP5_BEAMFORMEE_NUM_SND_DIM_ABOVE_80MHZ_MASK	(1<<5 | 1<<4 | 1<<3) | |
| 1235 | #define	IEEE80211_HE_PHY_CAP5_NG16_SU_FEEDBACK			(1<<6) | |
| 1236 | #define	IEEE80211_HE_PHY_CAP5_NG16_MU_FEEDBACK			(1<<7) | |
| 1237 | ||
| 1238 | /* B48..B55 */ | |
| 1239 | #define	IEEE80211_HE_PHY_CAP6_CODEBOOK_SIZE_42_SU	(1<<0) | |
| 1240 | #define	IEEE80211_HE_PHY_CAP6_CODEBOOK_SIZE_75_MU	(1<<1) | |
| 1241 | #define	IEEE80211_HE_PHY_CAP6_TRIG_SU_BEAMFORMING_FB	(1<<2) | |
| 1242 | #define	IEEE80211_HE_PHY_CAP6_TRIG_MU_BEAMFORMING_PARTIAL_BW_FB	(1<<3) | |
| 1243 | #define	IEEE80211_HE_PHY_CAP6_TRIG_CQI_FB		(1<<4) | |
| 1244 | #define	IEEE80211_HE_PHY_CAP6_PARTIAL_BW_EXT_RANGE	(1<<5) | |
| 1245 | #define	IEEE80211_HE_PHY_CAP6_PARTIAL_BANDWIDTH_DL_MUMIMO	(1<<6) | |
| 1246 | #define	IEEE80211_HE_PHY_CAP6_PPE_THRESHOLD_PRESENT	(1<<7) | |
| 1247 | ||
| 1248 | /* B56..B63 */ | |
| 1249 | #define	IEEE80211_HE_PHY_CAP7_PSR_BASED_SR			(1<<0) | |
| 1250 | #define	IEEE80211_HE_PHY_CAP7_POWER_BOOST_FACTOR_SUPP		(1<<1) | |
| 1251 | #define	IEEE80211_HE_PHY_CAP7_HE_SU_MU_PPDU_4XLTF_AND_08_US_GI	(1<<2) | |
| 1252 | #define	IEEE80211_HE_PHY_CAP7_MAX_NC_1				(1<<3) | |
| 1253 | #define	IEEE80211_HE_PHY_CAP7_MAX_NC_2				(1<<4) | |
| 1254 | #define	IEEE80211_HE_PHY_CAP7_MAX_NC_MASK			(1<<5 | 1<<4 | 1<<3) | |
| 1255 | #define	IEEE80211_HE_PHY_CAP7_STBC_TX_ABOVE_80MHZ		(1<<6) | |
| 1256 | #define	IEEE80211_HE_PHY_CAP7_STBC_RX_ABOVE_80MHZ		(1<<7) | |
| 1257 | ||
| 1258 | /* B64..B71 */ | |
| 1259 | #define	IEEE80211_HE_PHY_CAP8_HE_ER_SU_PPDU_4XLTF_AND_08_US_GI	(1<<0) | |
| 1260 | #define	IEEE80211_HE_PHY_CAP8_20MHZ_IN_40MHZ_HE_PPDU_IN_2G	(1<<1) | |
| 1261 | #define	IEEE80211_HE_PHY_CAP8_20MHZ_IN_160MHZ_HE_PPDU		(1<<2) | |
| 1262 | #define	IEEE80211_HE_PHY_CAP8_80MHZ_IN_160MHZ_HE_PPDU		(1<<3) | |
| 1263 | #define	IEEE80211_HE_PHY_CAP8_HE_ER_SU_1XLTF_AND_08_US_GI	(1<<4) | |
| 1264 | #define	IEEE80211_HE_PHY_CAP8_DCM_MAX_RU_242			0x00 | |
| 1265 | #define	IEEE80211_HE_PHY_CAP8_DCM_MAX_RU_484			(1<<6) | |
| 1266 | #define	IEEE80211_HE_PHY_CAP8_DCM_MAX_RU_996			(1<<7) | |
| 1267 | #define	IEEE80211_HE_PHY_CAP8_DCM_MAX_RU_2x996			(1<<7 | 1<<6) | |
| 1268 | #define	IEEE80211_HE_PHY_CAP8_DCM_MAX_RU_MASK			(1<<7 | 1<<6) | |
| 1269 | ||
| 1270 | /* B72..B79 */ | |
| 1271 | #define	IEEE80211_HE_PHY_CAP9_LONGER_THAN_16_SIGB_OFDM_SYM	(1<<0) | |
| 1272 | #define	IEEE80211_HE_PHY_CAP9_NON_TRIGGERED_CQI_FEEDBACK	(1<<1) | |
| 1273 | #define	IEEE80211_HE_PHY_CAP9_TX_1024_QAM_LESS_THAN_242_TONE_RU	(1<<2) | |
| 1274 | #define	IEEE80211_HE_PHY_CAP9_RX_1024_QAM_LESS_THAN_242_TONE_RU	(1<<3) | |
| 1275 | #define	IEEE80211_HE_PHY_CAP9_RX_FULL_BW_SU_USING_MU_WITH_COMP_SIGB	(1<<4) | |
| 1276 | #define	IEEE80211_HE_PHY_CAP9_RX_FULL_BW_SU_USING_MU_WITH_NON_COMP_SIGB	(1<<5) | |
| 1277 | #define	IEEE80211_HE_PHY_CAP9_NOMINAL_PKT_PADDING_0US		0x00 | |
| 1278 | #define	IEEE80211_HE_PHY_CAP9_NOMINAL_PKT_PADDING_8US		1 | |
| 1279 | #define	IEEE80211_HE_PHY_CAP9_NOMINAL_PKT_PADDING_16US		2 | |
| 1280 | #define	IEEE80211_HE_PHY_CAP9_NOMINAL_PKT_PADDING_RESERVED	3 | |
| 1281 | #define	IEEE80211_HE_PHY_CAP9_NOMINAL_PKT_PADDING_POS		6 | |
| 1282 | #define	IEEE80211_HE_PHY_CAP9_NOMINAL_PKT_PADDING_MASK		(1<<7 | 1<<6) | |
| 1283 | ||
| 1284 | /* B80..B87 */ | |
| 1285 | #define	IEEE80211_HE_PHY_CAP10_HE_MU_M1RU_MAX_LTF		(1<<0) | |
| 1286 | ||
| 1287 | /* | |
| 1288 | * 802.11ax-2021, | |
| 1289 | * 9.4.2.248.2 HE MAC Capabilities Information field. | |
| 1290 | * 9.4.2.248.3 HE PHY Capabilities Information field. | |
| 1291 | */ | |
| 1292 | struct ieee80211_he_cap_elem { | |
| 1293 | 	uint8_t					mac_cap_info[6]; | |
| 1294 | 	uint8_t					phy_cap_info[11]; | |
| 1295 | } __packed; | |
| 1296 | ||
| 1297 | /* 802.11ax-2021, 9.4.2.248.4 Supported HE-MCS And NSS Set field. */ | |
| 1298 | enum ieee80211_he_mcs_support { | |
| 1299 | 	IEEE80211_HE_MCS_SUPPORT_0_7	= 0,	/* HE-MCS 0-7 for n NSS */ | |
| 1300 | 	IEEE80211_HE_MCS_SUPPORT_0_9	= 1,	/* HE-MCS 0-9 for n NSS */ | |
| 1301 | 	IEEE80211_HE_MCS_SUPPORT_0_11	= 2,	/* HE-MCS 0-11 for n NSS */ | |
| 1302 | 	IEEE80211_HE_MCS_NOT_SUPPORTED	= 3	/* n NSS not supported. */ | |
| 1303 | }; | |
| 1304 | ||
| 1305 | struct ieee80211_he_mcs_nss_supp { | |
| 1306 | 	uint16_t				rx_mcs_80; | |
| 1307 | 	uint16_t				tx_mcs_80; | |
| 1308 | 	uint16_t				rx_mcs_160; | |
| 1309 | 	uint16_t				tx_mcs_160; | |
| 1310 | 	uint16_t				rx_mcs_80p80; | |
| 1311 | 	uint16_t				tx_mcs_80p80; | |
| 1312 | } __packed; | |
| 1313 | ||
| 1314 | #define	IEEE80211_HE_CAP_PPE_THRES_MAX		25 | |
| 1315 | ||
| 1316 | /* XXX this should only be internal. */ | |
| 1317 | struct net80211_he_cap { | |
| 1318 | 	bool					has_he; | |
| 1319 | 	struct ieee80211_he_cap_elem		he_cap_elem; | |
| 1320 | 	struct ieee80211_he_mcs_nss_supp	he_mcs_nss_supp; | |
| 1321 | 	uint8_t					ppe_thres[IEEE80211_HE_CAP_PPE_THRES_MAX]; | |
| 1322 | }; | |
| 1323 | ||
| 1324 | /* 802.11ax-2021, 9.4.2.249 HE Operation element. */ | |
| 1325 | #define	IEEE80211_HE_OPERATION_ER_SU_DISABLE		(1<<16) | |
| 1326 | #define	IEEE80211_HE_OPERATION_BSS_COLOR_OFFSET		24 | |
| 1327 | #define	IEEE80211_HE_OPERATION_BSS_COLOR_DISABLED	(1<<31) | |
| 1328 | ||
| 1329 | struct ieee80211_he_operation { | |
| 1330 | 	uint32_t				he_oper_params;	/* (3) params | (1) bss color info */ | |
| 1331 | 	uint16_t				he_mcs_nss_set; | |
| 1332 | 	uint8_t					optional[0]; | |
| 1333 | } __packed; | |
| 1334 | ||
| 1335 | /* 802.11ax-2021, 9.4.2.251 MU EDCA Parameter Set element. */ | |
| 1336 | struct ieee80211_he_mu_edca_param_ac_rec { | |
| 1337 | 	uint8_t					aifsn; | |
| 1338 | 	uint8_t					ecw_min_max; | |
| 1339 | 	uint8_t					mu_edca_timer; | |
| 1340 | } __packed; | |
| 1341 | ||
| 1342 | struct ieee80211_mu_edca_param_set { | |
| 1343 | 	uint8_t					mu_qos_info; | |
| 1344 | 	union { | |
| 1345 | 		struct { | |
| 1346 | 			struct ieee80211_he_mu_edca_param_ac_rec ac_be; | |
| 1347 | 			struct ieee80211_he_mu_edca_param_ac_rec ac_bk; | |
| 1348 | 			struct ieee80211_he_mu_edca_param_ac_rec ac_vi; | |
| 1349 | 			struct ieee80211_he_mu_edca_param_ac_rec ac_vo; | |
| 1350 | 		}; | |
| 1351 | 		struct ieee80211_he_mu_edca_param_ac_rec param_ac_recs[4]; | |
| 1352 | 	}; | |
| 1353 | } __packed; | |
| 1354 | ||
| 1355 | /* 802.11ax-2021, 9.4.2.252 Spatial Reuse Parameter Set element */ | |
| 1356 | /* Figure 9-788r-SR Control field format */ | |
| 1357 | #define	IEEE80211_HE_SPR_NON_SRG_OBSS_PD_SR_DISALLOWED	(1<<1) | |
| 1358 | #define	IEEE80211_HE_SPR_NON_SRG_OFFSET_PRESENT		(1<<2) | |
| 1359 | #define	IEEE80211_HE_SPR_SRG_INFORMATION_PRESENT	(1<<3) | |
| 1360 | #define	IEEE80211_HE_SPR_HESIGA_SR_VAL15_ALLOWED	(1<<4) | |
| 1361 | ||
| 1362 | /* 802.11ax-2021, 9.4.2.263 HE 6 GHz Band Capabilities element */ | |
| 1363 | /* Figure 9-788aj-Capabilities Information field format */ | |
| 1364 | #define	IEEE80211_HE_6GHZ_CAP_MIN_MPDU_START		(1<<2 | 1<<1 | 1<<0) | |
| 1365 | #define	IEEE80211_HE_6GHZ_CAP_MAX_AMPDU_LEN_EXP		(1<<5 | 1<<4 | 1<<3) | |
| 1366 | #define	IEEE80211_HE_6GHZ_CAP_MAX_MPDU_LEN		(1<<7 | 1<<6) | |
| 1367 | #define	IEEE80211_HE_6GHZ_CAP_SM_PS			(1<<10 | 1<<9) | |
| 1368 | #define	IEEE80211_HE_6GHZ_CAP_RX_ANTPAT_CONS		(1<<12) | |
| 1369 | #define	IEEE80211_HE_6GHZ_CAP_TX_ANTPAT_CONS		(1<<13) | |
| 1370 | ||
| 1371 | struct ieee80211_he_6ghz_capa { | |
| 1372 | 	uint16_t capa; | |
| 1373 | }; | |
| 1374 | #endif	/* _KERNEL || WANT_NET80211 */ | |
| 1375 | ||
| 1018 | 1376 | /* |
| 1019 | 1377 | * Management information element payloads. |
| 1378 | * | |
| 1379 | * 802.11-2020 Table 9-92 (Element IDs). | |
| 1380 | * 802.11ax-2021 | |
| 1020 | 1381 | */ |
| 1021 | 1382 | |
| 1022 | 1383 | enum { |
| 1023 | 1384 | 	IEEE80211_ELEMID_SSID		= 0, |
| 1024 | 1385 | 	IEEE80211_ELEMID_RATES		= 1, |
| 1025 | 	IEEE80211_ELEMID_FHPARMS	= 2, | |
| 1386 | 	/* 2 Reserved */ | |
| 1387 | 	IEEE80211_ELEMID_FHPARMS	= 2,	/* remove? */ | |
| 1026 | 1388 | 	IEEE80211_ELEMID_DSPARMS	= 3, |
| 1027 | 	IEEE80211_ELEMID_CFPARMS	= 4, | |
| 1389 | 	/* 4 Reserved */ | |
| 1390 | 	IEEE80211_ELEMID_CFPARMS	= 4,	/* remove? */ | |
| 1028 | 1391 | 	IEEE80211_ELEMID_TIM		= 5, |
| 1029 | 1392 | 	IEEE80211_ELEMID_IBSSPARMS	= 6, |
| 1030 | 1393 | 	IEEE80211_ELEMID_COUNTRY	= 7, |
| 1394 | 	/* 8, 9 reserved */ | |
| 1395 | 	IEEE80211_ELEMID_REQUEST	= 10, | |
| 1031 | 1396 | 	IEEE80211_ELEMID_BSSLOAD	= 11, |
| 1397 | 	IEEE80211_ELEMID_EDCA_PARAM_SET	= 12, | |
| 1032 | 1398 | 	IEEE80211_ELEMID_TSPEC		= 13, |
| 1033 | 1399 | 	IEEE80211_ELEMID_TCLAS		= 14, |
| 1400 | 	IEEE80211_ELEMID_SCHEDULE	= 15, | |
| 1034 | 1401 | 	IEEE80211_ELEMID_CHALLENGE	= 16, |
| 1035 | 1402 | 	/* 17-31 reserved for challenge text extension */ |
| 1036 | 1403 | 	IEEE80211_ELEMID_PWRCNSTR	= 32, |
| ... | ... | @@ -1044,28 +1411,77 @@ enum { |
| 1044 | 1411 | 	IEEE80211_ELEMID_QUIET		= 40, |
| 1045 | 1412 | 	IEEE80211_ELEMID_IBSSDFS	= 41, |
| 1046 | 1413 | 	IEEE80211_ELEMID_ERP		= 42, |
| 1414 | 	IEEE80211_ELEMID_TS_DELAY	= 43, | |
| 1415 | 	IEEE80211_ELEMID_TCLAS_PROCES	= 44, | |
| 1047 | 1416 | 	IEEE80211_ELEMID_HTCAP		= 45, |
| 1048 | 1417 | 	IEEE80211_ELEMID_QOS		= 46, |
| 1418 | 	/* 47 reserved */ | |
| 1049 | 1419 | 	IEEE80211_ELEMID_RESERVED_47	= 47, |
| 1050 | 1420 | 	IEEE80211_ELEMID_RSN		= 48, |
| 1421 | 	/* 49 reserved */ | |
| 1051 | 1422 | 	IEEE80211_ELEMID_XRATES		= 50, |
| 1052 | 1423 | 	IEEE80211_ELEMID_APCHANREP	= 51, |
| 1053 | 	IEEE80211_ELEMID_MOBILITY_DOMAIN	= 54, | |
| 1054 | 	IEEE80211_ELEMID_HTINFO		= 61, | |
| 1424 | 	IEEE80211_ELEMID_NEIGHBOR_REP	= 52, | |
| 1425 | 	IEEE80211_ELEMID_RCPI		= 53, | |
| 1426 | 	IEEE80211_ELEMID_MOBILITY_DOMAIN = 54,	/* MDE */ | |
| 1427 | 	IEEE80211_ELEMID_FAST_BSS_TRANS	= 55,	/* FTE */ | |
| 1428 | 	IEEE80211_ELEMID_TIMEOUT_INTVL	= 56, | |
| 1429 | 	IEEE80211_ELEMID_RIC_DATA	= 57,	/* RDE */ | |
| 1430 | 	IEEE80211_ELEMID_DSE_REG_LOC	= 58, | |
| 1431 | 	IEEE80211_ELEMID_SUP_OP_CLASS	= 59, | |
| 1432 | 	IEEE80211_ELEMID_EXT_CSA	= 60, | |
| 1433 | 	IEEE80211_ELEMID_HTINFO		= 61,	/* HTOPER */ | |
| 1055 | 1434 | 	IEEE80211_ELEMID_SECCHAN_OFFSET	= 62, |
| 1056 | 	IEEE80211_ELEMID_RRM_ENACAPS	= 70, | |
| 1435 | 	IEEE80211_ELEMID_BSS_AVG_ACC_DELAY = 63, | |
| 1436 | 	IEEE80211_ELEMID_ANTENNA	= 64, | |
| 1437 | 	IEEE80211_ELEMID_RSNI		= 65, | |
| 1438 | 	IEEE80211_ELEMID_MEAS_PILOT_TRANS = 66, | |
| 1439 | 	IEEE80211_ELEMID_BSS_AVAIL_AD_CAP = 67, | |
| 1440 | 	IEEE80211_ELEMID_BSS_AC_ACC_DELAY = 68, | |
| 1441 | 	IEEE80211_ELEMID_TIME_ADV	= 69, | |
| 1442 | 	IEEE80211_ELEMID_RRM_ENACAPS	= 70,	/* RM_ENCAPS */ | |
| 1057 | 1443 | 	IEEE80211_ELEMID_MULTIBSSID	= 71, |
| 1058 | 1444 | 	IEEE80211_ELEMID_COEX_2040	= 72, |
| 1059 | 	IEEE80211_ELEMID_INTOL_CHN_REPORT	= 73, | |
| 1445 | 	IEEE80211_ELEMID_2040_INTOL_CHAN_REPORT	= 73, | |
| 1060 | 1446 | 	IEEE80211_ELEMID_OVERLAP_BSS_SCAN_PARAM = 74, |
| 1447 | 	IEEE80211_ELEMID_RIC_DESC	= 75, | |
| 1448 | 	IEEE80211_ELEMID_MGMT_MIC	= 76, | |
| 1449 | 	/* 77 reserved */ | |
| 1450 | 	IEEE80211_ELEMID_EVENT_REQ	= 78, | |
| 1451 | 	IEEE80211_ELEMID_EVENT_REP	= 79, | |
| 1452 | 	IEEE80211_ELEMID_DIAGNOSTIC_REQ	= 80, | |
| 1453 | 	IEEE80211_ELEMID_DIAGNOSTIC_REP	= 81, | |
| 1454 | 	IEEE80211_ELEMID_LOCATION_PARAM	= 82, | |
| 1455 | 	IEEE80211_ELEMID_NONTRANS_BSSID_CAP = 83, | |
| 1456 | 	IEEE80211_ELEMID_SSID_LIST	= 84, | |
| 1457 | 	IEEE80211_ELEMID_MULTI_BSSID_IDX = 85, | |
| 1458 | 	IEEE80211_ELEMID_FMS_DESC	= 86, | |
| 1459 | 	IEEE80211_ELEMID_FMS_REQ	= 87, | |
| 1460 | 	IEEE80211_ELEMID_FMS_RESP	= 88, | |
| 1461 | 	IEEE80211_ELEMID_QOS_TRAFFIC_CAP = 89, | |
| 1462 | 	IEEE80211_ELEMID_BSS_MAX_IDLE_P	= 90, | |
| 1061 | 1463 | 	IEEE80211_ELEMID_TSF_REQ	= 91, |
| 1062 | 1464 | 	IEEE80211_ELEMID_TSF_RESP	= 92, |
| 1063 | 1465 | 	IEEE80211_ELEMID_WNM_SLEEP_MODE	= 93, |
| 1064 | 1466 | 	IEEE80211_ELEMID_TIM_BCAST_REQ	= 94, |
| 1065 | 1467 | 	IEEE80211_ELEMID_TIM_BCAST_RESP	= 95, |
| 1066 | 	IEEE80211_ELEMID_TPC		= 150, | |
| 1067 | 	IEEE80211_ELEMID_CCKM		= 156, | |
| 1068 | 	IEEE80211_ELEMID_VENDOR		= 221,	/* vendor private */ | |
| 1468 | 	IEEE80211_ELEMID_COL_INTERF_REP = 96, | |
| 1469 | 	IEEE80211_ELEMID_CHAN_USAGE	= 97, | |
| 1470 | 	IEEE80211_ELEMID_TIME_ZONE	= 98, | |
| 1471 | 	IEEE80211_ELEMID_DMS_REQ	= 99, | |
| 1472 | 	IEEE80211_ELEMID_DMS_RESP	= 100, | |
| 1473 | 	IEEE80211_ELEMID_LINK_ID	= 101, | |
| 1474 | 	IEEE80211_ELEMID_WAKEUP_SCHED	= 102, | |
| 1475 | 	/* 103 reserved */ | |
| 1476 | 	IEEE80211_ELEMID_CHAN_SW_TIMING	= 104, | |
| 1477 | 	IEEE80211_ELEMID_PTI_CONTROL	= 105, | |
| 1478 | 	IEEE80211_ELEMID_TPU_BUF_STATUS	= 106, | |
| 1479 | 	IEEE80211_ELEMID_INTERWORKING	= 107, | |
| 1480 | 	IEEE80211_ELEMID_ADV_PROTO	= 108, | |
| 1481 | 	IEEE80211_ELEMID_EXP_BW_REQ	= 109, | |
| 1482 | 	IEEE80211_ELEMID_QOS_MAP	= 110, | |
| 1483 | 	IEEE80211_ELEMID_ROAM_CONSORT	= 111, | |
| 1484 | 	IEEE80211_ELEMID_EMERG_ALERT_ID	= 112, | |
| 1069 | 1485 | |
| 1070 | 1486 | 	/* |
| 1071 | 1487 | 	 * 802.11s IEs |
| ... | ... | @@ -1095,17 +1511,180 @@ enum { |
| 1095 | 1511 | 	IEEE80211_ELEMID_MESHPXU	= 137, |
| 1096 | 1512 | 	IEEE80211_ELEMID_MESHPXUC	= 138, |
| 1097 | 1513 | 	IEEE80211_ELEMID_MESHAH		= 60, /* XXX: remove */ |
| 1098 | ||
| 1099 | 	/* 802.11ac-2013, Table 8-54-Element IDs */ | |
| 1514 | 	/* XXX 139 */ | |
| 1515 | ||
| 1516 | 	IEEE80211_ELEMID_MIC		= 140, | |
| 1517 | 	IEEE80211_ELEMID_DEST_URI	= 141, | |
| 1518 | 	IEEE80211_ELEMID_U_APSD_COEX	= 142, | |
| 1519 | 	IEEE80211_ELEMID_DMG_WAKEUP_SCHED = 143, | |
| 1520 | 	IEEE80211_ELEMID_EXT_SCHED	= 144, | |
| 1521 | 	IEEE80211_ELEMID_STA_AVAIL	= 145, | |
| 1522 | 	IEEE80211_ELEMID_DMG_TSPEC	= 146, | |
| 1523 | 	IEEE80211_ELEMID_NEXT_DMG_ATI	= 147, | |
| 1524 | 	IEEE80211_ELEMID_DMG_CAP	= 148, | |
| 1525 | 	/* 149-150 reserved. */ | |
| 1526 | 	IEEE80211_ELEMID_TPC		= 150, /* XXX: remove */ | |
| 1527 | 	IEEE80211_ELEMID_DMG_OPER	= 151, | |
| 1528 | 	IEEE80211_ELEMID_DMG_BSS_PARAM_CHANGE = 152, | |
| 1529 | 	IEEE80211_ELEMID_DMG_BEAM_REF	= 153, | |
| 1530 | 	IEEE80211_ELEMID_CHAN_MEAS_FEEDB = 154, | |
| 1531 | 	/* 155-156 reserved. */ | |
| 1532 | 	IEEE80211_ELEMID_CCKM		= 156, /* XXX: remove? */ | |
| 1533 | 	IEEE80211_ELEMID_AWAKE_WIN	= 157, | |
| 1534 | 	IEEE80211_ELEMID_MULTI_BAND	= 158, | |
| 1535 | 	IEEE80211_ELEMID_ADDBA_EXT	= 159, | |
| 1536 | 	IEEE80211_ELEMID_NEXTPCP_LIST	= 160, | |
| 1537 | 	IEEE80211_ELEMID_PCP_HANDOVER	= 161, | |
| 1538 | 	IEEE80211_ELEMID_DMG_LINK_MARGIN = 162, | |
| 1539 | 	IEEE80211_ELEMID_SW_STREAM	= 163, | |
| 1540 | 	IEEE80211_ELEMID_SESS_TRANS	= 164, | |
| 1541 | 	/* 165 reserved. */ | |
| 1542 | 	IEEE80211_ELEMID_CLUSTER_REP	= 166, | |
| 1543 | 	IEEE80211_ELEMID_RELAY_CAP	= 167, | |
| 1544 | 	IEEE80211_ELEMID_RELAY_TRANS_PARAM_SET = 168, | |
| 1545 | 	IEEE80211_ELEMID_BEAMLINK_MAINT	= 169, | |
| 1546 | 	IEEE80211_ELEMID_MULTI_MAC_SUBL	= 170, | |
| 1547 | 	IEEE80211_ELEMID_U_PID		= 171, | |
| 1548 | 	IEEE80211_ELEMID_DMG_LINK_ADAP_ACK = 172, | |
| 1549 | 	/* 173 reserved. */ | |
| 1550 | 	IEEE80211_ELEMID_MCCAOP_ADV_OV	= 174, | |
| 1551 | 	IEEE80211_ELEMID_QUIET_PERIOD_REQ = 175, | |
| 1552 | 	/* 176 reserved. */ | |
| 1553 | 	IEEE80211_ELEMID_QUIET_PERIOD_RESP = 177, | |
| 1554 | 	/* 178-180 reserved. */ | |
| 1555 | 	IEEE80211_ELEMID_QMF_POLICY	= 181, | |
| 1556 | 	IEEE80211_ELEMID_ECAPC_POLICY	= 182, | |
| 1557 | 	IEEE80211_ELEMID_CLUSTER_TIME_OFFSET = 183, | |
| 1558 | 	IEEE80211_ELEMID_INTRA_ACC_CAT_PRIO = 184, | |
| 1559 | 	IEEE80211_ELEMID_SCS_DESCR	= 185, | |
| 1560 | 	IEEE80211_ELEMID_QLOAD_REPORT	= 186, | |
| 1561 | 	IEEE80211_ELEMID_HCCA_TXOP_UP_CNT = 187, | |
| 1562 | 	IEEE80211_ELEMID_HL_STREAM_ID	= 188, | |
| 1563 | 	IEEE80211_ELEMID_GCR_GROUP_ADDR	= 189, | |
| 1564 | 	IEEE80211_ELEMID_ANTENNA_SECTOR_ID_PAT = 190, | |
| 1100 | 1565 | 	IEEE80211_ELEMID_VHT_CAP	= 191, |
| 1101 | 1566 | 	IEEE80211_ELEMID_VHT_OPMODE	= 192, |
| 1102 | 1567 | 	IEEE80211_ELEMID_EXTENDED_BSS_LOAD = 193, |
| 1103 | 	IEEE80211_ELEMID_WIDE_BW_CHANNEL_SWITCH = 194, | |
| 1104 | 	IEEE80211_ELEMID_VHT_PWR_ENV	= 195, | |
| 1568 | 	IEEE80211_ELEMID_WIDE_BW_CHAN_SW = 194, | |
| 1569 | 	IEEE80211_ELEMID_VHT_PWR_ENV	= 195,	/* TX_PWR_ENV */ | |
| 1105 | 1570 | 	IEEE80211_ELEMID_CHANNEL_SWITCH_WRAPPER = 196, |
| 1106 | 1571 | 	IEEE80211_ELEMID_AID		= 197, |
| 1107 | 1572 | 	IEEE80211_ELEMID_QUIET_CHANNEL	= 198, |
| 1108 | 1573 | 	IEEE80211_ELEMID_OPMODE_NOTIF	= 199, |
| 1574 | 	IEEE80211_ELEMID_UPSIM		= 200, | |
| 1575 | 	IEEE80211_ELEMID_RED_NEIGH_REP	= 201, | |
| 1576 | 	IEEE80211_ELEMID_TVHT_OP	= 202, | |
| 1577 | 	/* 203 reserved. */ | |
| 1578 | 	IEEE80211_ELEMID_DEVICE_LOC	= 204, | |
| 1579 | 	IEEE80211_ELEMID_WHITE_SPACE_MAP = 205, | |
| 1580 | 	IEEE80211_ELEMID_FINE_TIME_MEAS_PARAM = 206, | |
| 1581 | 	IEEE80211_ELEMID_SIG_OPEN_LOOP_LINK_MARGIN_IDX	= 207, | |
| 1582 | 	IEEE80211_ELEMID_RPS		= 208, | |
| 1583 | 	IEEE80211_ELEMID_PAGE_SLICE	= 209, | |
| 1584 | 	IEEE80211_ELEMID_AID_REQ	= 210, | |
| 1585 | 	IEEE80211_ELEMID_AID_RESP	= 211, | |
| 1586 | 	IEEE80211_ELEMID_SIG_SECTOR_OP	= 212, | |
| 1587 | 	IEEE80211_ELEMID_SIG_BEACON_COMPAT = 213, | |
| 1588 | 	IEEE80211_ELEMID_SHORT_BEACON_INTVL = 214, | |
| 1589 | 	IEEE80211_ELEMID_CHANGE_SEQ	= 215, | |
| 1590 | 	IEEE80211_ELEMID_TWT		= 216, | |
| 1591 | 	IEEE80211_ELEMID_SIG_CAPS	= 217, | |
| 1592 | 	/* 218-219 reserved. */ | |
| 1593 | 	IEEE80211_ELEMID_SUBCHAN_SELECT_TRANS = 220, | |
| 1594 | 	IEEE80211_ELEMID_VENDOR		= 221,	/* vendor private */ | |
| 1595 | 	IEEE80211_ELEMID_AUTH_CONTROL	= 222, | |
| 1596 | 	IEEE80211_ELEMID_TSF_TIMER_ACC	= 223, | |
| 1597 | 	IEEE80211_ELEMID_S1G_RELAY	= 224, | |
| 1598 | 	IEEE80211_ELEMID_REACHABLE_ADDR	= 225, | |
| 1599 | 	IEEE80211_ELEMID_SIG_RELAY_DISC	= 226, | |
| 1600 | 	/* 227 reserved. */ | |
| 1601 | 	IEEE80211_ELEMID_AID_ANNOUNCEMENT = 228, | |
| 1602 | 	IEEE80211_ELEMID_PV1_PROBE_RESP_OPT = 229, | |
| 1603 | 	IEEE80211_ELEMID_EL_OP		= 230, | |
| 1604 | 	IEEE80211_ELEMID_SECTORIZED_GRP_ID_LIST	= 231, | |
| 1605 | 	IEEE80211_ELEMID_SIG_OP		= 232, | |
| 1606 | 	IEEE80211_ELEMID_HDR_COMPRESSION = 233, | |
| 1607 | 	IEEE80211_ELEMID_SST_OP		= 234, | |
| 1608 | 	IEEE80211_ELEMID_MAD		= 235, | |
| 1609 | 	IEEE80211_ELEMID_SIG_RELAY_ACT	= 236, | |
| 1610 | 	IEEE80211_ELEMID_CAG_NUMBER	= 237, | |
| 1611 | 	/* 238 reserved. */ | |
| 1612 | 	IEEE80211_ELEMID_AP_CSN		= 239, | |
| 1613 | 	IEEE80211_ELEMID_FILS_INDICATION = 240, | |
| 1614 | 	IEEE80211_ELEMID_DILS		= 241, | |
| 1615 | 	IEEE80211_ELEMID_FRAGMENT	= 242, | |
| 1616 | 	/* 243 reserved. */ | |
| 1617 | 	IEEE80211_ELEMID_RSN_EXT	= 244, | |
| 1618 | 	/* 245-254 reserved. */ | |
| 1619 | 	IEEE80211_ELEMID_EXTFIELD	= 255 | |
| 1620 | }; | |
| 1621 | ||
| 1622 | enum ieee80211_elemid_ext { | |
| 1623 | 	IEEE80211_ELEMID_EXT_ASSOC_DELAY_INFO		= 1, | |
| 1624 | 	IEEE80211_ELEMID_EXT_FILS_REQ_PARAMS		= 2, | |
| 1625 | 	IEEE80211_ELEMID_EXT_FILS_KEY_CONFIRM		= 3, | |
| 1626 | 	IEEE80211_ELEMID_EXT_FILS_SESSION		= 4, | |
| 1627 | 	IEEE80211_ELEMID_EXT_FILS_HLP_CONTAINER		= 5, | |
| 1628 | 	IEEE80211_ELEMID_EXT_FILS_IP_ADDR_ASSIGNMENT	= 6, | |
| 1629 | 	IEEE80211_ELEMID_EXT_KEY_DELIVERY		= 7, | |
| 1630 | 	IEEE80211_ELEMID_EXT_FILS_WRAPPED_DATA		= 8, | |
| 1631 | 	IEEE80211_ELEMID_EXT_FTM_SYNC_INFO		= 9, | |
| 1632 | 	IEEE80211_ELEMID_EXT_EXT_REQ			= 10, | |
| 1633 | 	IEEE80211_ELEMID_EXT_EST_SERVICE_PARAM_INBOUND	= 11, | |
| 1634 | 	IEEE80211_ELEMID_EXT_FILS_PUBLIC_KEY		= 12, | |
| 1635 | 	IEEE80211_ELEMID_EXT_FILS_NONCE			= 13, | |
| 1636 | 	IEEE80211_ELEMID_EXT_FUTURE_CHAN_GUIDANCE	= 14, | |
| 1637 | 	IEEE80211_ELEMID_EXT_SERVICE_HINT		= 15, | |
| 1638 | 	IEEE80211_ELEMID_EXT_SERVICE_HASH		= 16, | |
| 1639 | 	IEEE80211_ELEMID_EXT_CDMG_CAPA			= 17, | |
| 1640 | 	IEEE80211_ELEMID_EXT_DYN_BW_CTRL		= 18, | |
| 1641 | 	IEEE80211_ELEMID_EXT_CDMG_EXT_SCHEDULE		= 19, | |
| 1642 | 	IEEE80211_ELEMID_EXT_SSW_REPORT			= 20, | |
| 1643 | 	IEEE80211_ELEMID_EXT_CLUSTER_PROBE		= 21, | |
| 1644 | 	IEEE80211_ELEMID_EXT_EXT_CLUSTER_REPORT		= 22, | |
| 1645 | 	IEEE80211_ELEMID_EXT_CLUSTER_SW_ANNOUNCEMENT	= 23, | |
| 1646 | 	IEEE80211_ELEMID_EXT_ENHANCED_BEAM_TRACKING	= 24, | |
| 1647 | 	IEEE80211_ELEMID_EXT_SPSH_REPORT		= 25, | |
| 1648 | 	IEEE80211_ELEMID_EXT_CLUSTER_INTERF_ASSESS	= 26, | |
| 1649 | 	IEEE80211_ELEMID_EXT_CMMG_CAPA			= 27, | |
| 1650 | 	IEEE80211_ELEMID_EXT_CMMG_OPER			= 28, | |
| 1651 | 	IEEE80211_ELEMID_EXT_CMMG_OPMODE_NOTIF		= 29, | |
| 1652 | 	IEEE80211_ELEMID_EXT_CMMG_LINK_MARGIN		= 30, | |
| 1653 | 	IEEE80211_ELEMID_EXT_CMMG_LINK_ADAP_ACK		= 31, | |
| 1654 | 	/* 32 reserved. */ | |
| 1655 | 	IEEE80211_ELEMID_EXT_PASSWORD_ID		= 33, | |
| 1656 | 	IEEE80211_ELEMID_EXT_GLK_GCR_PARAM_SET		= 34, | |
| 1657 | 	IEEE80211_ELEMID_EXT_HE_CAPA			= 35, | |
| 1658 | 	IEEE80211_ELEMID_EXT_HE_OPER			= 36, | |
| 1659 | 	IEEE80211_ELEMID_EXT_UORA_PARAM_SET		= 37, | |
| 1660 | 	IEEE80211_ELEMID_EXT_MU_EDCA_PARAM_SET		= 38, | |
| 1661 | 	IEEE80211_ELEMID_EXT_SPATIAL_REUSE_PARAM_SET	= 39, | |
| 1662 | 	IEEE80211_ELEMID_EXT_GAS_EXTENSION		= 40, | |
| 1663 | 	IEEE80211_ELEMID_EXT_NDP_FEEDB_REPORT_PARAM	= 41, | |
| 1664 | 	IEEE80211_ELEMID_EXT_BSS_COLOR_CHG_ANNOUNCE	= 42, | |
| 1665 | 	IEEE80211_ELEMID_EXT_QUIET_TIMME_PERIOD		= 43, | |
| 1666 | 	IEEE80211_ELEMID_EXT_VENDOR_SPECIFIC_REQ_ELEM	= 44, | |
| 1667 | 	IEEE80211_ELEMID_EXT_ESS_REPORT			= 45, | |
| 1668 | 	IEEE80211_ELEMID_EXT_OPS			= 46, | |
| 1669 | 	IEEE80211_ELEMID_EXT_HE_BSS_LOAD		= 47, | |
| 1670 | 	/* 48-51 reserved. */ | |
| 1671 | 	IEEE80211_ELEMID_EXT_MAC_CH_SW_TIME		= 52, | |
| 1672 | 	IEEE80211_ELEMID_EXT_EST_SERVICE_PARAM_OUTBOUND	= 53, | |
| 1673 | 	IEEE80211_ELEMID_EXT_OCI			= 54, | |
| 1674 | 	IEEE80211_ELEMID_EXT_MULTI_BSSID_CONFIG		= 55, | |
| 1675 | 	IEEE80211_ELEMID_EXT_NON_INHERITANCE		= 56, | |
| 1676 | 	IEEE80211_ELEMID_EXT_KNOWN_BSSID		= 57, | |
| 1677 | 	IEEE80211_ELEMID_EXT_SHORT_SSID_LIST		= 58, | |
| 1678 | 	IEEE80211_ELEMID_EXT_HE_6GHZ_BAND_CAPA		= 59, | |
| 1679 | 	IEEE80211_ELEMID_EXT_ULMU_POWER_CAAP		= 60, | |
| 1680 | 	/* 61-87 reserved. */ | |
| 1681 | 	IEEE80211_ELEMID_EXT_MSCS_DESCRIPTOR		= 88, | |
| 1682 | 	IEEE80211_ELEMID_EXT_TCLAS_MASK			= 89, | |
| 1683 | 	IEEE80211_ELEMID_EXT_SUPPL_CLASS_2_CAPA		= 90, | |
| 1684 | 	IEEE80211_ELEMID_EXT_OCT_SOURCE			= 91, | |
| 1685 | 	IEEE80211_ELEMID_EXT_REJECTED_GROUPS		= 92, | |
| 1686 | 	IEEE80211_ELEMID_EXT_ANTI_CLOGGING_TAOKEN_CONTAINER = 93, | |
| 1687 | 	/* 94-255 reserved. */ | |
| 1109 | 1688 | }; |
| 1110 | 1689 | |
| 1111 | 1690 | struct ieee80211_tim_ie { |
| ... | ... | @@ -1266,7 +1845,7 @@ struct ieee80211_csa_ie { |
| 1266 | 1845 | #define	WPA_CSE_NULL		0x00 |
| 1267 | 1846 | #define	WPA_CSE_WEP40		0x01 |
| 1268 | 1847 | #define	WPA_CSE_TKIP		0x02 |
| 1269 | #define	WPA_CSE_CCMP		0x04 | |
| 1848 | #define	WPA_CSE_CCMP		0x04		/* CCMP 128-bit */ | |
| 1270 | 1849 | #define	WPA_CSE_WEP104		0x05 |
| 1271 | 1850 | |
| 1272 | 1851 | #define	WPA_ASE_NONE		0x00 |
| ... | ... | @@ -1275,21 +1854,62 @@ struct ieee80211_csa_ie { |
| 1275 | 1854 | |
| 1276 | 1855 | #define	WPS_OUI_TYPE		0x04 |
| 1277 | 1856 | |
| 1857 | /* 802.11-2016 Table 9-131 - Cipher Suite Selectors */ | |
| 1278 | 1858 | #define	RSN_OUI			0xac0f00 |
| 1279 | 1859 | #define	RSN_VERSION		1		/* current supported version */ |
| 1280 | 1860 | |
| 1281 | #define	RSN_CSE_NULL		0x00 | |
| 1282 | #define	RSN_CSE_WEP40		0x01 | |
| 1283 | #define	RSN_CSE_TKIP		0x02 | |
| 1284 | #define	RSN_CSE_WRAP		0x03 | |
| 1285 | #define	RSN_CSE_CCMP		0x04 | |
| 1286 | #define	RSN_CSE_WEP104		0x05 | |
| 1287 | ||
| 1288 | #define	RSN_ASE_NONE		0x00 | |
| 1289 | #define	RSN_ASE_8021X_UNSPEC	0x01 | |
| 1290 | #define	RSN_ASE_8021X_PSK	0x02 | |
| 1291 | ||
| 1292 | #define	RSN_CAP_PREAUTH		0x01 | |
| 1861 | /* RSN cipher suite element */ | |
| 1862 | #define	RSN_CSE_NULL		0 | |
| 1863 | #define	RSN_CSE_WEP40		1 | |
| 1864 | #define	RSN_CSE_TKIP		2 | |
| 1865 | #define	RSN_CSE_WRAP		3		/* Reserved in the 802.11-2016 */ | |
| 1866 | #define	RSN_CSE_CCMP		4		/* CCMP 128 bit */ | |
| 1867 | #define	RSN_CSE_WEP104		5 | |
| 1868 | #define	RSN_CSE_BIP_CMAC_128	6 | |
| 1869 | /* 7 - "Group addressed traffic not allowed" */ | |
| 1870 | #define	RSN_CSE_GCMP_128	8 | |
| 1871 | #define	RSN_CSE_GCMP_256	9 | |
| 1872 | #define	RSN_CSE_CCMP_256	10 | |
| 1873 | #define	RSN_CSE_BIP_GMAC_128	11 | |
| 1874 | #define	RSN_CSE_BIP_GMAC_256	12 | |
| 1875 | #define	RSN_CSE_BIP_CMAC_256	13 | |
| 1876 | ||
| 1877 | /* 802.11-2016 Table 9-133 - AKM suite selectors */ | |
| 1878 | /* RSN AKM suite element */ | |
| 1879 | #define	RSN_ASE_NONE		0 | |
| 1880 | #define	RSN_ASE_8021X_UNSPEC	1 | |
| 1881 | #define	RSN_ASE_8021X_PSK	2 | |
| 1882 | #define	RSN_ASE_FT_8021X	3		/* SHA-256 */ | |
| 1883 | #define	RSN_ASE_FT_PSK		4		/* SHA-256 */ | |
| 1884 | #define	RSN_ASE_8021X_UNSPEC_SHA256	5 | |
| 1885 | #define	RSN_ASE_8021X_PSK_SHA256	6 | |
| 1886 | #define	RSN_ASE_8021X_TDLS	7		/* SHA-256 */ | |
| 1887 | #define	RSN_ASE_SAE_UNSPEC	8		/* SHA-256 */ | |
| 1888 | #define	RSN_ASE_FT_SAE		9		/* SHA-256 */ | |
| 1889 | #define	RSN_ASE_AP_PEERKEY	10		/* SHA-256 */ | |
| 1890 | #define	RSN_ASE_8021X_SUITE_B_SHA256	11 | |
| 1891 | #define	RSN_ASE_8021X_SUITE_B_SHA384	12 | |
| 1892 | #define	RSN_ASE_FT_8021X_SHA384	13 | |
| 1893 | ||
| 1894 | /* 802.11-2016 Figure 9-257 - RSN Capabilities (2 byte field) */ | |
| 1895 | #define	RSN_CAP_PREAUTH		0x0001 | |
| 1896 | #define	RSN_CAP_NO_PAIRWISE	0x0002 | |
| 1897 | #define	RSN_CAP_PTKSA_REPLAY_COUNTER	0x000c	/* 2 bit field */ | |
| 1898 | #define	RSN_CAP_GTKSA_REPLAY_COUNTER	0x0030	/* 2 bit field */ | |
| 1899 | #define	RSN_CAP_MFP_REQUIRED	0x0040 | |
| 1900 | #define	RSN_CAP_MFP_CAPABLE	0x0080 | |
| 1901 | #define	RSN_CAP_JOINT_MULTIBAND_RSNA		0x0100 | |
| 1902 | #define	RSN_CAP_PEERKEY_ENABLED	0x0200 | |
| 1903 | #define	RSN_CAP_SPP_AMSDU_CAPABLE	0x0400 | |
| 1904 | #define	RSN_CAP_SPP_AMSDU_REQUIRED	0x0800 | |
| 1905 | #define	RSN_CAP_PBAC_CAPABLE	0x1000 | |
| 1906 | #define	RSN_CAP_EXT_KEYID_CAPABLE	0x0200 | |
| 1907 | ||
| 1908 | /* 802.11-2016 Table 9-134 PTKSA/GTKSA/STKSA replay counters usage */ | |
| 1909 | #define		RSN_CAP_REPLAY_COUNTER_1_PER	0 | |
| 1910 | #define		RSN_CAP_REPLAY_COUNTER_2_PER	1 | |
| 1911 | #define		RSN_CAP_REPLAY_COUNTER_4_PER	2 | |
| 1912 | #define		RSN_CAP_REPLAY_COUNTER_16_PER	3 | |
| 1293 | 1913 | |
| 1294 | 1914 | #define	WME_OUI			0xf25000 |
| 1295 | 1915 | #define	WME_OUI_TYPE		0x02 |
lib/libc/include/generic-freebsd/net80211/ieee80211_amrr.h+4| ... | ... | @@ -49,6 +49,10 @@ struct ieee80211_amrr_node { |
| 49 | 49 | 	struct ieee80211_amrr *amn_amrr;/* backpointer */ |
| 50 | 50 | 	int	amn_rix;		/* current rate index */ |
| 51 | 51 | 	int	amn_ticks;		/* time of last update */ |
| 52 | 	/* for VHT, since there's no VHT RIX right now */ | |
| 53 | 	int	amn_vht_mcs; | |
| 54 | 	int	amn_vht_nss; | |
| 55 | ||
| 52 | 56 | 	/* statistics */ |
| 53 | 57 | 	u_int	amn_txcnt; |
| 54 | 58 | 	u_int	amn_success; |
lib/libc/include/generic-freebsd/net80211/ieee80211_crypto.h+57-7| ... | ... | @@ -118,8 +118,8 @@ struct ieee80211_key { |
| 118 | 118 | 	 IEEE80211_KEY_NOIVMGT|IEEE80211_KEY_NOMIC|IEEE80211_KEY_NOMICMGT) |
| 119 | 119 | |
| 120 | 120 | #define	IEEE80211_KEY_BITS \ |
| 121 | 	"\20\1XMIT\2RECV\3GROUP\4SWENCRYPT\5SWDECRYPT\6SWENMIC\7SWDEMIC" \ | |
| 122 | 	"\10DEVKEY\11CIPHER0\12CIPHER1" | |
| 121 | 	"\20\1XMIT\2RECV\3GROUP\4NOREPLAY\5SWENCRYPT\6SWDECRYPT\7SWENMIC\10SWDEMIC" \ | |
| 122 | 	"\11DEVKEY\12CIPHER0\13CIPHER1\14NOIV\15NOIVMGT\16NOMIC\17NOMICMGT" | |
| 123 | 123 | |
| 124 | 124 | #define	IEEE80211_KEYIX_NONE	((ieee80211_keyix) -1) |
| 125 | 125 | |
| ... | ... | @@ -137,8 +137,17 @@ struct ieee80211_key { |
| 137 | 137 | #define	IEEE80211_CIPHER_TKIPMIC	4	/* TKIP MIC capability */ |
| 138 | 138 | #define	IEEE80211_CIPHER_CKIP		5 |
| 139 | 139 | #define	IEEE80211_CIPHER_NONE		6	/* pseudo value */ |
| 140 | #define	IEEE80211_CIPHER_AES_CCM_256	7 | |
| 141 | #define	IEEE80211_CIPHER_BIP_CMAC_128	8 | |
| 142 | #define	IEEE80211_CIPHER_BIP_CMAC_256	9 | |
| 143 | #define	IEEE80211_CIPHER_BIP_GMAC_128	10 | |
| 144 | #define	IEEE80211_CIPHER_BIP_GMAC_256	11 | |
| 145 | #define	IEEE80211_CIPHER_AES_GCM_128	12 | |
| 146 | #define	IEEE80211_CIPHER_AES_GCM_256	13 | |
| 140 | 147 | |
| 141 | #define	IEEE80211_CIPHER_MAX		(IEEE80211_CIPHER_NONE+1) | |
| 148 | #define	IEEE80211_CIPHER_LAST		13 | |
| 149 | ||
| 150 | #define	IEEE80211_CIPHER_MAX		(IEEE80211_CIPHER_LAST+1) | |
| 142 | 151 | |
| 143 | 152 | /* capability bits in ic_cryptocaps/iv_cryptocaps */ |
| 144 | 153 | #define	IEEE80211_CRYPTO_WEP		(1<<IEEE80211_CIPHER_WEP) |
| ... | ... | @@ -147,9 +156,18 @@ struct ieee80211_key { |
| 147 | 156 | #define	IEEE80211_CRYPTO_AES_CCM	(1<<IEEE80211_CIPHER_AES_CCM) |
| 148 | 157 | #define	IEEE80211_CRYPTO_TKIPMIC	(1<<IEEE80211_CIPHER_TKIPMIC) |
| 149 | 158 | #define	IEEE80211_CRYPTO_CKIP		(1<<IEEE80211_CIPHER_CKIP) |
| 159 | #define	IEEE80211_CRYPTO_AES_CCM_256	(1<<IEEE80211_CIPHER_AES_CCM_256) | |
| 160 | #define	IEEE80211_CRYPTO_BIP_CMAC_128	(1<<IEEE80211_CIPHER_BIP_CMAC_128) | |
| 161 | #define	IEEE80211_CRYPTO_BIP_CMAC_256	(1<<IEEE80211_CIPHER_BIP_CMAC_256) | |
| 162 | #define	IEEE80211_CRYPTO_BIP_GMAC_128	(1<<IEEE80211_CIPHER_BIP_GMAC_128) | |
| 163 | #define	IEEE80211_CRYPTO_BIP_GMAC_256	(1<<IEEE80211_CIPHER_BIP_GMAC_256) | |
| 164 | #define	IEEE80211_CRYPTO_AES_GCM_128	(1<<IEEE80211_CIPHER_AES_GCM_128) | |
| 165 | #define	IEEE80211_CRYPTO_AES_GCM_256	(1<<IEEE80211_CIPHER_AES_GCM_256) | |
| 150 | 166 | |
| 151 | 167 | #define	IEEE80211_CRYPTO_BITS \ |
| 152 | 	"\20\1WEP\2TKIP\3AES\4AES_CCM\5TKIPMIC\6CKIP" | |
| 168 | 	"\20\1WEP\2TKIP\3AES\4AES_CCM\5TKIPMIC\6CKIP\10AES_CCM_256" \ | |
| 169 | 	"\11BIP_CMAC_128\12BIP_CMAC_256\13BIP_GMAC_128\14BIP_CMAC_256" \ | |
| 170 | 	"\15AES_GCM_128\16AES_GCM_256" | |
| 153 | 171 | |
| 154 | 172 | #if defined(__KERNEL__) || defined(_KERNEL) |
| 155 | 173 | |
| ... | ... | @@ -162,6 +180,12 @@ MALLOC_DECLARE(M_80211_CRYPTO); |
| 162 | 180 | |
| 163 | 181 | void	ieee80211_crypto_attach(struct ieee80211com *); |
| 164 | 182 | void	ieee80211_crypto_detach(struct ieee80211com *); |
| 183 | void	ieee80211_crypto_set_supported_software_ciphers(struct ieee80211com *, | |
| 184 | 	 uint32_t cipher_set); | |
| 185 | void	ieee80211_crypto_set_supported_hardware_ciphers(struct ieee80211com *, | |
| 186 | 	 uint32_t cipher_set); | |
| 187 | void	ieee80211_crypto_set_supported_driver_keymgmt(struct ieee80211com *, | |
| 188 | 	 uint32_t keymgmt_set); | |
| 165 | 189 | void	ieee80211_crypto_vattach(struct ieee80211vap *); |
| 166 | 190 | void	ieee80211_crypto_vdetach(struct ieee80211vap *); |
| 167 | 191 | int	ieee80211_crypto_newkey(struct ieee80211vap *, |
| ... | ... | @@ -192,6 +216,11 @@ struct ieee80211_cipher { |
| 192 | 216 | 	void	(*ic_setiv)(struct ieee80211_key *, uint8_t *); |
| 193 | 217 | 	int	(*ic_encap)(struct ieee80211_key *, struct mbuf *); |
| 194 | 218 | 	int	(*ic_decap)(struct ieee80211_key *, struct mbuf *, int); |
| 219 | 	/* | |
| 220 | 	 * ic_enmic() and ic_demic() are currently only used by TKIP. | |
| 221 | 	 * Please see ieee80211_crypto_enmic() and ieee80211_crypto_demic() | |
| 222 | 	 * for more information. | |
| 223 | 	 */ | |
| 195 | 224 | 	int	(*ic_enmic)(struct ieee80211_key *, struct mbuf *, int); |
| 196 | 225 | 	int	(*ic_demic)(struct ieee80211_key *, struct mbuf *, int); |
| 197 | 226 | }; |
| ... | ... | @@ -216,8 +245,24 @@ int	ieee80211_crypto_decap(struct ieee80211_node *, |
| 216 | 245 | 		struct mbuf *, int, struct ieee80211_key **); |
| 217 | 246 | int ieee80211_crypto_demic(struct ieee80211vap *vap, struct ieee80211_key *k, |
| 218 | 247 | 		struct mbuf *, int); |
| 219 | /* | |
| 220 | * Add any MIC. | |
| 248 | /** | |
| 249 | * @brief Add any pre-fragmentation MIC to an MSDU. | |
| 250 | * | |
| 251 | * This is called before 802.11 fragmentation. Crypto types that implement | |
| 252 | * a MIC/ICV check per MSDU will not implement this function. | |
| 253 | * | |
| 254 | * As an example, TKIP implements a Michael MIC check over the entire | |
| 255 | * unencrypted MSDU before fragmenting it into MPDUs and passing each | |
| 256 | * MPDU to be separately encrypted with their own MIC/ICV. | |
| 257 | * | |
| 258 | * Please see 802.11-2020 12.5.2.1.2 (TKIP cryptographic encapsulation) | |
| 259 | * for more information. | |
| 260 | * | |
| 261 | * @param vap	the current VAP | |
| 262 | * @param k	the current key | |
| 263 | * @param m	the mbuf representing the MSDU | |
| 264 | * @param f	set to 1 to force a MSDU MIC check, even if HW encrypted | |
| 265 | * @returns	0 if error / MIC encap failed, 1 if OK | |
| 221 | 266 | */ |
| 222 | 267 | static __inline int |
| 223 | 268 | ieee80211_crypto_enmic(struct ieee80211vap *vap, |
| ... | ... | @@ -249,6 +294,11 @@ void	ieee80211_notify_replay_failure(struct ieee80211vap *, |
| 249 | 294 | 		const struct ieee80211_frame *, const struct ieee80211_key *, |
| 250 | 295 | 		uint64_t rsc, int tid); |
| 251 | 296 | void	ieee80211_notify_michael_failure(struct ieee80211vap *, |
| 252 | 		const struct ieee80211_frame *, u_int keyix); | |
| 297 | 		const struct ieee80211_frame *, ieee80211_keyix keyix); | |
| 298 | ||
| 299 | /* AAD assembly for CCMP/GCMP. */ | |
| 300 | uint16_t	ieee80211_crypto_init_aad(const struct ieee80211_frame *, | |
| 301 | 		uint8_t *, int); | |
| 302 | ||
| 253 | 303 | #endif /* defined(__KERNEL__) || defined(_KERNEL) */ |
| 254 | 304 | #endif /* _NET80211_IEEE80211_CRYPTO_H_ */ |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/net80211/ieee80211_crypto_gcm.h created+58| ... | ... | @@ -0,0 +1,58 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-2-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 2012, Jouni Malinen <j@w1.fi> | |
| 5 | * All rights reserved. | |
| 6 | * | |
| 7 | * Galois/Counter Mode (GCM) and GMAC with AES | |
| 8 | * | |
| 9 | * Redistribution and use in source and binary forms, with or without | |
| 10 | * modification, are permitted provided that the following conditions | |
| 11 | * are met: | |
| 12 | * 1. Redistributions of source code must retain the above copyright | |
| 13 | * notice, this list of conditions and the following disclaimer. | |
| 14 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 15 | * notice, this list of conditions and the following disclaimer in the | |
| 16 | * documentation and/or other materials provided with the distribution. | |
| 17 | * | |
| 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | |
| 19 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |
| 20 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | |
| 21 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | |
| 22 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | |
| 23 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
| 24 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
| 25 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
| 26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | |
| 27 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 28 | */ | |
| 29 | #ifndef	__IEEE80211_CRYPTO_GCM_H__ | |
| 30 | #define	__IEEE80211_CRYPTO_GCM_H__ | |
| 31 | ||
| 32 | #if defined(__KERNEL__) || defined(_KERNEL) | |
| 33 | ||
| 34 | #include <crypto/rijndael/rijndael.h> | |
| 35 | ||
| 36 | #define AES_BLOCK_LEN 16 | |
| 37 | ||
| 38 | /* | |
| 39 | * buffer is 2x the AES_BLOCK_LEN, but the AAD contents may be variable | |
| 40 | * and are padded. | |
| 41 | */ | |
| 42 | #define	GCM_AAD_LEN	(AES_BLOCK_LEN * 2) | |
| 43 | ||
| 44 | /* GCMP is always 128 bit / 16 byte MIC */ | |
| 45 | #define	GCMP_MIC_LEN	16 | |
| 46 | ||
| 47 | void	ieee80211_crypto_aes_gcm_ae(rijndael_ctx *aes, const uint8_t *iv, | |
| 48 | 	 size_t iv_len, const uint8_t *plain, size_t plain_len, | |
| 49 | 	 const uint8_t *aad, size_t aad_len, uint8_t *crypt, uint8_t *tag); | |
| 50 | ||
| 51 | int	ieee80211_crypto_aes_gcm_ad(rijndael_ctx *aes, const uint8_t *iv, | |
| 52 | 	 size_t iv_len, const uint8_t *crypt, size_t crypt_len, | |
| 53 | 	 const uint8_t *aad, size_t aad_len, const uint8_t *tag, | |
| 54 | 	 uint8_t *plain); | |
| 55 | ||
| 56 | #endif	/* __KERNEL__ */ | |
| 57 | ||
| 58 | #endif	/* __IEEE80211_CRYPTO_GCM_H__ */ | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/net80211/ieee80211_freebsd.h+49-14| ... | ... | @@ -73,6 +73,8 @@ typedef struct { |
| 73 | 73 | 	mtx_assert(IEEE80211_LOCK_OBJ(_ic), MA_OWNED) |
| 74 | 74 | #define	IEEE80211_UNLOCK_ASSERT(_ic) \ |
| 75 | 75 | 	mtx_assert(IEEE80211_LOCK_OBJ(_ic), MA_NOTOWNED) |
| 76 | #define	IEEE80211_IS_LOCKED(_ic) \ | |
| 77 | 	mtx_owned(IEEE80211_LOCK_OBJ(_ic)) | |
| 76 | 78 | |
| 77 | 79 | /* |
| 78 | 80 | * Transmit lock. |
| ... | ... | @@ -91,12 +93,22 @@ typedef struct { |
| 91 | 93 | } while (0) |
| 92 | 94 | #define	IEEE80211_TX_LOCK_OBJ(_ic)	(&(_ic)->ic_txlock.mtx) |
| 93 | 95 | #define	IEEE80211_TX_LOCK_DESTROY(_ic) mtx_destroy(IEEE80211_TX_LOCK_OBJ(_ic)) |
| 94 | #define	IEEE80211_TX_LOCK(_ic)	 mtx_lock(IEEE80211_TX_LOCK_OBJ(_ic)) | |
| 95 | #define	IEEE80211_TX_UNLOCK(_ic)	 mtx_unlock(IEEE80211_TX_LOCK_OBJ(_ic)) | |
| 96 | #define	IEEE80211_TX_LOCK_ASSERT(_ic) \ | |
| 97 | 	mtx_assert(IEEE80211_TX_LOCK_OBJ(_ic), MA_OWNED) | |
| 98 | #define	IEEE80211_TX_UNLOCK_ASSERT(_ic) \ | |
| 99 | 	mtx_assert(IEEE80211_TX_LOCK_OBJ(_ic), MA_NOTOWNED) | |
| 96 | #define	IEEE80211_TX_LOCK(_ic) do { \ | |
| 97 | 	if (!IEEE80211_CONF_SEQNO_OFFLOAD(_ic)) \ | |
| 98 | 		mtx_lock(IEEE80211_TX_LOCK_OBJ(_ic)); \ | |
| 99 | 	} while (0); | |
| 100 | #define	IEEE80211_TX_UNLOCK(_ic) do { \ | |
| 101 | 	if (!IEEE80211_CONF_SEQNO_OFFLOAD(_ic)) \ | |
| 102 | 		mtx_unlock(IEEE80211_TX_LOCK_OBJ(_ic)); \ | |
| 103 | 	} while (0); | |
| 104 | #define	IEEE80211_TX_LOCK_ASSERT(_ic) do { \ | |
| 105 | 	if (!IEEE80211_CONF_SEQNO_OFFLOAD(_ic)) \ | |
| 106 | 		mtx_assert(IEEE80211_TX_LOCK_OBJ(_ic), MA_OWNED); \ | |
| 107 | 	} while (0) | |
| 108 | #define	IEEE80211_TX_UNLOCK_ASSERT(_ic) { \ | |
| 109 | 	if (!IEEE80211_CONF_SEQNO_OFFLOAD(_ic)) \ | |
| 110 | 		mtx_assert(IEEE80211_TX_LOCK_OBJ(_ic), MA_NOTOWNED); \ | |
| 111 | 	} while (0) | |
| 100 | 112 | |
| 101 | 113 | /* |
| 102 | 114 | * Stageq / ni_tx_superg lock |
| ... | ... | @@ -260,9 +272,9 @@ void	ieee80211_flush_ifq(struct ifqueue *, struct ieee80211vap *); |
| 260 | 272 | void	ieee80211_vap_destroy(struct ieee80211vap *); |
| 261 | 273 | const char *	ieee80211_get_vap_ifname(struct ieee80211vap *); |
| 262 | 274 | |
| 263 | #define	IFNET_IS_UP_RUNNING(_ifp) \ | |
| 264 | 	(((_ifp)->if_flags & IFF_UP) && \ | |
| 265 | 	 ((_ifp)->if_drv_flags & IFF_DRV_RUNNING)) | |
| 275 | #define	IFNET_IS_UP_RUNNING(_ifp)				\ | |
| 276 | 	(((if_getflags(_ifp) & IFF_UP) != 0) &&			\ | |
| 277 | 	 ((if_getdrvflags(_ifp) & IFF_DRV_RUNNING) != 0)) | |
| 266 | 278 | |
| 267 | 279 | #define	msecs_to_ticks(ms)	MSEC_2_TICKS(ms) |
| 268 | 280 | #define	ticks_to_msecs(t)	TICKS_2_MSEC(t) |
| ... | ... | @@ -329,11 +341,16 @@ struct mbuf *ieee80211_getmgtframe(uint8_t **frm, int headroom, int pktlen); |
| 329 | 341 | #define	M_AGE_SUB(m,adj)	(m->m_pkthdr.csum_data -= adj) |
| 330 | 342 | |
| 331 | 343 | /* |
| 332 | * Store the sequence number. | |
| 344 | * Store / retrieve the sequence number in an mbuf. | |
| 345 | * | |
| 346 | * The sequence number being stored/retreived is the 12 bit | |
| 347 | * base sequence number, not the 16 bit sequence number field. | |
| 348 | * I.e., it's from 0..4095 inclusive, with no 4 bit padding for | |
| 349 | * fragment numbers. | |
| 333 | 350 | */ |
| 334 | 351 | #define	M_SEQNO_SET(m, seqno) \ |
| 335 | 	((m)->m_pkthdr.tso_segsz = (seqno)) | |
| 336 | #define	M_SEQNO_GET(m)	((m)->m_pkthdr.tso_segsz) | |
| 352 | 	((m)->m_pkthdr.tso_segsz = ((seqno) % IEEE80211_SEQ_RANGE)) | |
| 353 | #define	M_SEQNO_GET(m)	(((m)->m_pkthdr.tso_segsz) % IEEE80211_SEQ_RANGE) | |
| 337 | 354 | |
| 338 | 355 | #define	MTAG_ABI_NET80211	1132948340	/* net80211 ABI */ |
| 339 | 356 | |
| ... | ... | @@ -417,8 +434,7 @@ MODULE_DEPEND(wlan_##name, wlan, 1, 1, 1) |
| 417 | 434 | /* |
| 418 | 435 | * Crypto modules implement cipher support. |
| 419 | 436 | */ |
| 420 | #define	IEEE80211_CRYPTO_MODULE(name, version)				\ | |
| 421 | _IEEE80211_POLICY_MODULE(crypto, name, version);			\ | |
| 437 | #define	IEEE80211_CRYPTO_MODULE_ADD(name)				\ | |
| 422 | 438 | static void								\ |
| 423 | 439 | name##_modevent(int type)						\ |
| 424 | 440 | {									\ |
| ... | ... | @@ -429,6 +445,10 @@ name##_modevent(int type)						\ |
| 429 | 445 | }									\ |
| 430 | 446 | TEXT_SET(crypto##_set, name##_modevent) |
| 431 | 447 | |
| 448 | #define	IEEE80211_CRYPTO_MODULE(name, version)				\ | |
| 449 | 	_IEEE80211_POLICY_MODULE(crypto, name, version);		\ | |
| 450 | 	IEEE80211_CRYPTO_MODULE_ADD(name) | |
| 451 | ||
| 432 | 452 | /* |
| 433 | 453 | * Scanner modules provide scanning policy. |
| 434 | 454 | */ |
| ... | ... | @@ -535,6 +555,21 @@ struct debugnet80211_methods { |
| 535 | 555 | #define DEBUGNET80211_SET(ic, driver) |
| 536 | 556 | #endif /* DEBUGNET */ |
| 537 | 557 | |
| 558 | void ieee80211_vap_sync_mac_address(struct ieee80211vap *); | |
| 559 | void ieee80211_vap_copy_mac_address(struct ieee80211vap *); | |
| 560 | void ieee80211_vap_deliver_data(struct ieee80211vap *, struct mbuf *); | |
| 561 | bool ieee80211_vap_ifp_check_is_monitor(struct ieee80211vap *); | |
| 562 | bool ieee80211_vap_ifp_check_is_simplex(struct ieee80211vap *); | |
| 563 | bool ieee80211_vap_ifp_check_is_running(struct ieee80211vap *); | |
| 564 | void ieee80211_vap_ifp_set_running_state(struct ieee80211vap *, bool); | |
| 565 | const uint8_t * ieee80211_vap_get_broadcast_address(struct ieee80211vap *); | |
| 566 | ||
| 567 | void	net80211_printf(const char *fmt, ...) __printflike(1, 2); | |
| 568 | void	net80211_vap_printf(const struct ieee80211vap *, const char *fmt, ...) | |
| 569 | 	 __printflike(2, 3); | |
| 570 | void	net80211_ic_printf(const struct ieee80211com *, const char *fmt, ...) | |
| 571 | 	 __printflike(2, 3); | |
| 572 | ||
| 538 | 573 | #endif /* _KERNEL */ |
| 539 | 574 | |
| 540 | 575 | /* XXX this stuff belongs elsewhere */ |
lib/libc/include/generic-freebsd/net80211/ieee80211_ht.h+8-1| ... | ... | @@ -87,7 +87,8 @@ struct ieee80211_tx_ampdu { |
| 87 | 87 | 	 (IEEE80211_AGGR_RUNNING|IEEE80211_AGGR_XCHGPEND|IEEE80211_AGGR_NAK)) != 0) |
| 88 | 88 | |
| 89 | 89 | #define	IEEE80211_AGGR_BITS \ |
| 90 | 	"\20\1IMMEDIATE\2XCHGPEND\3RUNNING\4SETUP\5NAK" | |
| 90 | 	"\20\1IMMEDIATE\2XCHGPEND\3RUNNING\4SETUP\5NAK" \ | |
| 91 | 	"\6BARPEND\7WAITRX\10AMSDU" | |
| 91 | 92 | |
| 92 | 93 | /* |
| 93 | 94 | * Traffic estimator support. We estimate packets/sec for |
| ... | ... | @@ -240,5 +241,11 @@ int	ieee80211_ampdu_tx_request_ext(struct ieee80211_node *ni, int tid); |
| 240 | 241 | int	ieee80211_ampdu_tx_request_active_ext(struct ieee80211_node *ni, |
| 241 | 242 | 	 int tid, int status); |
| 242 | 243 | void	ieee80211_htinfo_notify(struct ieee80211vap *vap); |
| 244 | int	ieee80211_ht_get_node_ampdu_density(const struct ieee80211_node *ni); | |
| 245 | int	ieee80211_ht_get_node_ampdu_limit(const struct ieee80211_node *ni); | |
| 246 | bool	ieee80211_ht_check_tx_shortgi_20(const struct ieee80211_node *ni); | |
| 247 | bool	ieee80211_ht_check_tx_shortgi_40(const struct ieee80211_node *ni); | |
| 248 | bool	ieee80211_ht_check_tx_ht40(const struct ieee80211_node *ni); | |
| 249 | bool	ieee80211_ht_check_tx_ht(const struct ieee80211_node *ht); | |
| 243 | 250 | |
| 244 | 251 | #endif /* _NET80211_IEEE80211_HT_H_ */ |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/net80211/ieee80211_ioctl.h+10-2| ... | ... | @@ -253,6 +253,14 @@ struct ieee80211_stats { |
| 253 | 253 | 	uint32_t	is_ff_encapfail;	/* failed FF encap */ |
| 254 | 254 | 	uint32_t	is_amsdu_encapfail;	/* failed A-MSDU encap */ |
| 255 | 255 | |
| 256 | 	uint32_t	is_crypto_gcmp;		/* gcmp crypto done in s/w */ | |
| 257 | 	uint32_t	is_rx_gcmpreplay;	/* rx seq# violation (GCMP) */ | |
| 258 | 	uint32_t	is_rx_gcmpformat;	/* rx format bad (GCMP) */ | |
| 259 | 	uint32_t	is_rx_gcmpmic;		/* rx MIC check failed (GCMP) */ | |
| 260 | 	uint32_t	is_crypto_gcmp_nomem;	/* gcmp crypto failed; no mem */ | |
| 261 | 	uint32_t	is_crypto_gcmp_nospc;	/* gcmp crypto failed; no mbuf space */ | |
| 262 | 	uint32_t	is_crypto_swcipherfail;	/* no support for SW cipher */ | |
| 263 | ||
| 256 | 264 | 	uint32_t	is_spare[5]; |
| 257 | 265 | }; |
| 258 | 266 | |
| ... | ... | @@ -551,13 +559,13 @@ struct ieee80211_regdomain_req { |
| 551 | 559 | 	IEEE80211_REGDOMAIN_SIZE((_req)->chaninfo.ic_nchans) |
| 552 | 560 | |
| 553 | 561 | /* |
| 554 | * Get driver capabilities. Driver, hardware crypto, and | |
| 562 | * Get driver capabilities. Driver, hardware/software crypto, and | |
| 555 | 563 | * HT/802.11n capabilities, and a table that describes what |
| 556 | 564 | * the radio can do. |
| 557 | 565 | */ |
| 558 | 566 | struct ieee80211_devcaps_req { |
| 559 | 567 | 	uint32_t	dc_drivercaps;		/* general driver caps */ |
| 560 | 	uint32_t	dc_cryptocaps;		/* hardware crypto support */ | |
| 568 | 	uint32_t	dc_cryptocaps;		/* software + hardware crypto support */ | |
| 561 | 569 | 	uint32_t	dc_htcaps;		/* HT/802.11n support */ |
| 562 | 570 | 	uint32_t	dc_vhtcaps;		/* VHT/802.11ac capabilities */ |
| 563 | 571 | 	struct ieee80211req_chaninfo dc_chaninfo; |
lib/libc/include/generic-freebsd/net80211/ieee80211_node.h+91-5| ... | ... | @@ -108,6 +108,69 @@ enum ieee80211_mesh_mlstate { |
| 108 | 108 | #define	IEEE80211_MESH_MLSTATE_BITS \ |
| 109 | 109 | 	"\20\1IDLE\2OPENSNT\2OPENRCV\3CONFIRMRCV\4ESTABLISHED\5HOLDING" |
| 110 | 110 | |
| 111 | /* | |
| 112 | * This enum was shared with the LinuxKPI enum ieee80211_sta_rx_bandwidth | |
| 113 | * describing up-to which channel width the station can receive. | |
| 114 | * Rather than using hardcoded MHz values for the channel width use an enum with | |
| 115 | * flags. This allows us to keep the uint8_t slot for ni_chw in | |
| 116 | * struct ieee80211_node it means we do not have to sync to the value for | |
| 117 | * LinuxKPI (just the names). | |
| 118 | * | |
| 119 | * NB: BW_20 needs to 0 and values need to be sorted! Cannot make it | |
| 120 | * bitfield-alike for use with %b. | |
| 121 | */ | |
| 122 | enum net80211_sta_rx_bw { | |
| 123 | 	NET80211_STA_RX_BW_20		= 0x00, | |
| 124 | 	NET80211_STA_RX_BW_40, | |
| 125 | 	NET80211_STA_RX_BW_80, | |
| 126 | 	NET80211_STA_RX_BW_160, | |
| 127 | 	NET80211_STA_RX_BW_320, | |
| 128 | } __packed; | |
| 129 | ||
| 130 | static inline const char * | |
| 131 | net80211_ni_chw_to_str(enum net80211_sta_rx_bw bw) | |
| 132 | { | |
| 133 | 	switch (bw) { | |
| 134 | 	case NET80211_STA_RX_BW_20:	return ("BW_20"); | |
| 135 | 	case NET80211_STA_RX_BW_40:	return ("BW_40"); | |
| 136 | 	case NET80211_STA_RX_BW_80:	return ("BW_80"); | |
| 137 | 	case NET80211_STA_RX_BW_160:	return ("BW_160"); | |
| 138 | 	case NET80211_STA_RX_BW_320:	return ("BW_320"); | |
| 139 | 	} | |
| 140 | } | |
| 141 | ||
| 142 | enum ieee80211_node_txrate_type { | |
| 143 | 	IEEE80211_NODE_TXRATE_UNDEFINED		= 0, | |
| 144 | 	IEEE80211_NODE_TXRATE_LEGACY		= 1, /* CCK/OFDM, HT for now */ | |
| 145 | 	IEEE80211_NODE_TXRATE_HT		= 2, /* HT */ | |
| 146 | 	IEEE80211_NODE_TXRATE_VHT		= 3, /* VHT */ | |
| 147 | }; | |
| 148 | ||
| 149 | struct ieee80211_node_txrate { | |
| 150 | 	enum ieee80211_node_txrate_type type; | |
| 151 | 	uint8_t		nss;		/* VHT - number of spatial streams */ | |
| 152 | 	uint8_t		mcs;		/* HT/VHT - MCS */ | |
| 153 | 	uint8_t		dot11rate;	/* Legacy/HT - dot11rate / ratecode */ | |
| 154 | }; | |
| 155 | ||
| 156 | #define	IEEE80211_NODE_TXRATE_INIT_LEGACY(rate) \ | |
| 157 | 	(struct ieee80211_node_txrate) { .type = IEEE80211_NODE_TXRATE_LEGACY, \ | |
| 158 | 	 .nss = 0, \ | |
| 159 | 	 .mcs = 0, \ | |
| 160 | 	 .dot11rate = (rate) } | |
| 161 | ||
| 162 | #define	IEEE80211_NODE_TXRATE_INIT_HT(i_mcs) \ | |
| 163 | 	(struct ieee80211_node_txrate) { .type = IEEE80211_NODE_TXRATE_HT, \ | |
| 164 | 	 .nss = 0, \ | |
| 165 | 	 .mcs = (i_mcs), \ | |
| 166 | 	 .dot11rate = (i_mcs) | IEEE80211_RATE_MCS } | |
| 167 | ||
| 168 | #define	IEEE80211_NODE_TXRATE_INIT_VHT(i_nss, i_mcs) \ | |
| 169 | 	(struct ieee80211_node_txrate) { .type = IEEE80211_NODE_TXRATE_VHT, \ | |
| 170 | 	 .nss = (i_nss), \ | |
| 171 | 	 .mcs = (i_mcs), \ | |
| 172 | 	 .dot11rate = 0 } | |
| 173 | ||
| 111 | 174 | /* |
| 112 | 175 | * Node specific information. Note that drivers are expected |
| 113 | 176 | * to derive from this structure to add device-specific per-node |
| ... | ... | @@ -222,15 +285,15 @@ struct ieee80211_node { |
| 222 | 285 | 	uint8_t			ni_ht2ndchan;	/* HT 2nd channel */ |
| 223 | 286 | 	uint8_t			ni_htopmode;	/* HT operating mode */ |
| 224 | 287 | 	uint8_t			ni_htstbc;	/* HT */ |
| 225 | 	uint8_t			ni_chw;		/* negotiated channel width */ | |
| 288 | 	enum net80211_sta_rx_bw ni_chw;	/* negotiated channel width */ | |
| 226 | 289 | 	struct ieee80211_htrateset ni_htrates;	/* negotiated ht rate set */ |
| 227 | 290 | 	struct ieee80211_tx_ampdu ni_tx_ampdu[WME_NUM_TID]; |
| 228 | 291 | 	struct ieee80211_rx_ampdu ni_rx_ampdu[WME_NUM_TID]; |
| 229 | 292 | |
| 230 | 293 | 	/* VHT state */ |
| 231 | 294 | 	uint32_t		ni_vhtcap; |
| 232 | 	uint16_t		ni_vht_basicmcs; | |
| 233 | 	uint16_t		ni_vht_pad2; | |
| 295 | 	uint16_t		ni_vht_basicmcs;	/* Basic VHT MCS bitmap from IE */ | |
| 296 | 	uint16_t		ni_vht_tx_map;		/* Negotiated MCS TX map with peer */ | |
| 234 | 297 | 	struct ieee80211_vht_mcs_info	ni_vht_mcsinfo; |
| 235 | 298 | 	uint8_t			ni_vht_chan1;	/* 20/40/80/160 - VHT chan1 */ |
| 236 | 299 | 	uint8_t			ni_vht_chan2;	/* 80+80 - VHT chan2 */ |
| ... | ... | @@ -244,7 +307,7 @@ struct ieee80211_node { |
| 244 | 307 | 	/* others */ |
| 245 | 308 | 	short			ni_inact;	/* inactivity mark count */ |
| 246 | 309 | 	short			ni_inact_reload;/* inactivity reload value */ |
| 247 | 	int			ni_txrate;	/* legacy rate/MCS */ | |
| 310 | 	struct ieee80211_node_txrate	ni_txrate;	/* current transmit rate */ | |
| 248 | 311 | 	struct ieee80211_psq	ni_psq;		/* power save queue */ |
| 249 | 312 | 	struct ieee80211_nodestats ni_stats;	/* per-node statistics */ |
| 250 | 313 | |
| ... | ... | @@ -279,7 +342,7 @@ MALLOC_DECLARE(M_80211_NODE_IE); |
| 279 | 342 | #define	IEEE80211_NODE_BITS \ |
| 280 | 343 | 	"\20\1AUTH\2QOS\3ERP\5PWR_MGT\6AREF\7HT\10HTCOMPAT\11WPS\12TSN" \ |
| 281 | 344 | 	"\13AMPDU_RX\14AMPDU_TX\15MIMO_PS\16MIMO_RTS\17RIFS\20SGI20\21SGI40" \ |
| 282 | 	"\22ASSOCID" | |
| 345 | 	"\22ASSOCID\23AMSDU_RX\24AMSDU_TX\25VHT\26LDPC\27UAPSD" | |
| 283 | 346 | |
| 284 | 347 | #define	IEEE80211_NODE_AID(ni)	IEEE80211_AID(ni->ni_associd) |
| 285 | 348 | |
| ... | ... | @@ -467,4 +530,27 @@ void	ieee80211_node_join(struct ieee80211_node *,int); |
| 467 | 530 | void	ieee80211_node_leave(struct ieee80211_node *); |
| 468 | 531 | int8_t	ieee80211_getrssi(struct ieee80211vap *); |
| 469 | 532 | void	ieee80211_getsignal(struct ieee80211vap *, int8_t *, int8_t *); |
| 533 | ||
| 534 | /* TX sequence space related routines */ | |
| 535 | ieee80211_seq	ieee80211_tx_seqno_fetch_incr(struct ieee80211_node *, | |
| 536 | 	uint8_t); | |
| 537 | ieee80211_seq	ieee80211_tx_seqno_fetch(const struct ieee80211_node *, | |
| 538 | 	uint8_t); | |
| 539 | ||
| 540 | /* | |
| 541 | * Node transmit rate specific manipulation. | |
| 542 | * | |
| 543 | * This should eventually be refactored into its own type. | |
| 544 | */ | |
| 545 | uint8_t	ieee80211_node_get_txrate_dot11rate(struct ieee80211_node *); | |
| 546 | void	ieee80211_node_get_txrate(struct ieee80211_node *, | |
| 547 | 		struct ieee80211_node_txrate *); | |
| 548 | void	ieee80211_node_set_txrate(struct ieee80211_node *, | |
| 549 | 	 const struct ieee80211_node_txrate *); | |
| 550 | void	ieee80211_node_set_txrate_dot11rate(struct ieee80211_node *, uint8_t); | |
| 551 | void	ieee80211_node_set_txrate_ht_mcsrate(struct ieee80211_node *, uint8_t); | |
| 552 | uint32_t	ieee80211_node_get_txrate_kbit(struct ieee80211_node *); | |
| 553 | void	ieee80211_node_set_txrate_vht_rate(struct ieee80211_node *ni, | |
| 554 | 	 uint8_t nss, uint8_t mcs); | |
| 555 | ||
| 470 | 556 | #endif /* _NET80211_IEEE80211_NODE_H_ */ |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/net80211/ieee80211_phy.h+9| ... | ... | @@ -221,5 +221,14 @@ uint32_t	ieee80211_compute_duration_ht(uint32_t frameLen, |
| 221 | 221 | 			uint16_t rate, int streams, int isht40, |
| 222 | 222 | 			int isShortGI); |
| 223 | 223 | |
| 224 | enum net80211_sta_rx_bw; | |
| 225 | ||
| 226 | uint16_t	ieee80211_phy_vht_get_mcs_mask(enum net80211_sta_rx_bw, | |
| 227 | 		 uint8_t); | |
| 228 | bool		ieee80211_phy_vht_validate_mcs(enum net80211_sta_rx_bw, | |
| 229 | 		 uint8_t, uint8_t); | |
| 230 | uint32_t	ieee80211_phy_vht_get_mcs_kbit(enum net80211_sta_rx_bw, | |
| 231 | 		 uint8_t, uint8_t, bool); | |
| 232 | ||
| 224 | 233 | #endif	/* _KERNEL */ |
| 225 | 234 | #endif	/* !_NET80211_IEEE80211_PHY_H_ */ |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/net80211/ieee80211_proto.h+4| ... | ... | @@ -123,6 +123,10 @@ struct mbuf *	ieee80211_ff_encap1(struct ieee80211vap *, struct mbuf *, |
| 123 | 123 | 		const struct ether_header *); |
| 124 | 124 | void	ieee80211_tx_complete(struct ieee80211_node *, |
| 125 | 125 | 		struct mbuf *, int); |
| 126 | void	ieee80211_output_seqno_assign(struct ieee80211_node *, | |
| 127 | 		int, struct mbuf *); | |
| 128 | void	ieee80211_output_beacon_seqno_assign(struct ieee80211_node *, | |
| 129 | 		struct mbuf *); | |
| 126 | 130 | |
| 127 | 131 | /* |
| 128 | 132 | * The formation of ProbeResponse frames requires guidance to |
lib/libc/include/generic-freebsd/net80211/ieee80211_ratectl.h+2-2| ... | ... | @@ -127,12 +127,12 @@ ieee80211_ratectl_node_deinit(struct ieee80211_node *ni) |
| 127 | 127 | 	vap->iv_rate->ir_node_deinit(ni); |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | static int __inline | |
| 130 | static void __inline | |
| 131 | 131 | ieee80211_ratectl_rate(struct ieee80211_node *ni, void *arg, uint32_t iarg) |
| 132 | 132 | { |
| 133 | 133 | 	const struct ieee80211vap *vap = ni->ni_vap; |
| 134 | 134 | |
| 135 | 	return vap->iv_rate->ir_rate(ni, arg, iarg); | |
| 135 | 	vap->iv_rate->ir_rate(ni, arg, iarg); | |
| 136 | 136 | } |
| 137 | 137 | |
| 138 | 138 | static __inline void |
lib/libc/include/generic-freebsd/net80211/ieee80211_var.h+45-9| ... | ... | @@ -100,6 +100,8 @@ |
| 100 | 100 | 	 ((ic)->ic_flags_ext & IEEE80211_FEXT_SEQNO_OFFLOAD) |
| 101 | 101 | #define	IEEE80211_CONF_FRAG_OFFLOAD(ic)	\ |
| 102 | 102 | 	 ((ic)->ic_flags_ext & IEEE80211_FEXT_FRAG_OFFLOAD) |
| 103 | #define	IEEE80211_CONF_AMPDU_OFFLOAD(ic)	\ | |
| 104 | 	 ((ic)->ic_flags_ext & IEEE80211_FEXT_AMPDU_OFFLOAD) | |
| 103 | 105 | |
| 104 | 106 | /* |
| 105 | 107 | * 802.11 control state is split into a common portion that maps |
| ... | ... | @@ -163,8 +165,12 @@ struct ieee80211com { |
| 163 | 165 | 	uint32_t		ic_caps;	/* capabilities */ |
| 164 | 166 | 	uint32_t		ic_htcaps;	/* HT capabilities */ |
| 165 | 167 | 	uint32_t		ic_htextcaps;	/* HT extended capabilities */ |
| 166 | 	uint32_t		ic_cryptocaps;	/* crypto capabilities */ | |
| 168 | 				/* driver-supported software crypto caps */ | |
| 169 | 	uint32_t		ic_sw_cryptocaps; | |
| 170 | 	uint32_t		ic_cryptocaps;	/* hardware crypto caps */ | |
| 167 | 171 | 						/* set of mode capabilities */ |
| 172 | 				/* driver/net80211 sw KEYMGMT capabilities */ | |
| 173 | 	uint32_t		ic_sw_keymgmtcaps; | |
| 168 | 174 | 	uint8_t			ic_modecaps[IEEE80211_MODE_BYTES]; |
| 169 | 175 | 	uint8_t			ic_promisc;	/* vap's needing promisc mode */ |
| 170 | 176 | 	uint8_t			ic_allmulti;	/* vap's needing all multicast*/ |
| ... | ... | @@ -693,13 +699,14 @@ MALLOC_DECLARE(M_80211_VAP); |
| 693 | 699 | #define	IEEE80211_FEXT_VHT	0x00400000	/* CONF: VHT support */ |
| 694 | 700 | #define	IEEE80211_FEXT_QUIET_IE	0x00800000	/* STATUS: quiet IE in a beacon has been added */ |
| 695 | 701 | #define	IEEE80211_FEXT_UAPSD	0x01000000	/* CONF: enable U-APSD */ |
| 702 | #define	IEEE80211_FEXT_AMPDU_OFFLOAD	0x02000000	/* CONF: driver/fw handles AMPDU[-TX] itself */ | |
| 696 | 703 | |
| 697 | 704 | #define	IEEE80211_FEXT_BITS \ |
| 698 | 705 | 	"\20\2INACT\3SCANWAIT\4BGSCAN\5WPS\6TSN\7SCANREQ\10RESUME" \ |
| 699 | 706 | 	"\0114ADDR\12NONEPR_PR\13SWBMISS\14DFS\15DOTD\16STATEWAIT\17REINIT" \ |
| 700 | 707 | 	"\20BPF\21WDSLEGACY\22PROBECHAN\23UNIQMAC\24SCAN_OFFLOAD\25SEQNO_OFFLOAD" \ |
| 701 | 708 | 	 "\26FRAG_OFFLOAD\27VHT" \ |
| 702 | 	"\30QUIET_IE\31UAPSD" | |
| 709 | 	"\30QUIET_IE\31UAPSD\32AMPDU_OFFLOAD" | |
| 703 | 710 | |
| 704 | 711 | /* ic_flags_ht/iv_flags_ht */ |
| 705 | 712 | #define	IEEE80211_FHT_NONHT_PR	 0x00000001	/* STATUS: non-HT sta present */ |
| ... | ... | @@ -728,17 +735,29 @@ MALLOC_DECLARE(M_80211_VAP); |
| 728 | 735 | |
| 729 | 736 | #define	IEEE80211_FVEN_BITS	"\20" |
| 730 | 737 | |
| 738 | /* | |
| 739 | * These flags are compared in ieee80211_setupcurchan(). | |
| 740 | * Thus 160 should be > 80P80. | |
| 741 | */ | |
| 731 | 742 | #define	IEEE80211_FVHT_VHT	0x000000001	/* CONF: VHT supported */ |
| 732 | 743 | #define	IEEE80211_FVHT_USEVHT40	0x000000002	/* CONF: Use VHT40 */ |
| 733 | 744 | #define	IEEE80211_FVHT_USEVHT80	0x000000004	/* CONF: Use VHT80 */ |
| 734 | #define	IEEE80211_FVHT_USEVHT160	0x000000008	/* CONF: Use VHT160 */ | |
| 735 | #define	IEEE80211_FVHT_USEVHT80P80	0x000000010	/* CONF: Use VHT 80+80 */ | |
| 736 | #define	IEEE80211_FVHT_MASK						\ | |
| 745 | #define	IEEE80211_FVHT_USEVHT80P80	0x000000008	/* CONF: Use VHT 80+80 */ | |
| 746 | #define	IEEE80211_FVHT_USEVHT160	0x000000010	/* CONF: Use VHT160 */ | |
| 747 | #define	IEEE80211_FVHT_STBC_TX	0x00000020	/* CONF: STBC tx enabled */ | |
| 748 | #define	IEEE80211_FVHT_STBC_RX	0x00000040	/* CONF: STBC rx enabled */ | |
| 749 | ||
| 750 | #define	IEEE80211_FVHT_CHANWIDTH_MASK					\ | |
| 737 | 751 | 	(IEEE80211_FVHT_VHT | IEEE80211_FVHT_USEVHT40 |			\ |
| 738 | 752 | 	IEEE80211_FVHT_USEVHT80 | IEEE80211_FVHT_USEVHT160 |		\ |
| 739 | 753 | 	IEEE80211_FVHT_USEVHT80P80) |
| 754 | ||
| 755 | #define	IEEE80211_FVHT_MASK						\ | |
| 756 | 	(IEEE80211_FVHT_CHANWIDTH_MASK |				\ | |
| 757 | 	IEEE80211_FVHT_STBC_TX | IEEE80211_FVHT_STBC_RX) | |
| 758 | ||
| 740 | 759 | #define	IEEE80211_VFHT_BITS \ |
| 741 | 	"\20\1VHT\2VHT40\3VHT80\4VHT160\5VHT80P80" | |
| 760 | 	"\20\1VHT\2VHT40\3VHT80\4VHT80P80\5VHT160\6STBC_TX\7STBC_RX" | |
| 742 | 761 | |
| 743 | 762 | #define	IEEE80211_COM_DETACHED	0x00000001	/* ieee80211_ifdetach called */ |
| 744 | 763 | #define	IEEE80211_COM_REF_ADD	0x00000002	/* add / remove reference */ |
| ... | ... | @@ -746,9 +765,17 @@ MALLOC_DECLARE(M_80211_VAP); |
| 746 | 765 | #define	IEEE80211_COM_REF_S	1 |
| 747 | 766 | #define	IEEE80211_COM_REF_MAX	(IEEE80211_COM_REF >> IEEE80211_COM_REF_S) |
| 748 | 767 | |
| 749 | int	ic_printf(struct ieee80211com *, const char *, ...) __printflike(2, 3); | |
| 768 | /* TODO: Transition macro */ | |
| 769 | #define	ic_printf	net80211_ic_printf | |
| 770 | ||
| 750 | 771 | void	ieee80211_ifattach(struct ieee80211com *); |
| 751 | 772 | void	ieee80211_ifdetach(struct ieee80211com *); |
| 773 | void	ieee80211_set_software_ciphers(struct ieee80211com *, | |
| 774 | 	 uint32_t cipher_suite); | |
| 775 | void	ieee80211_set_hardware_ciphers(struct ieee80211com *, | |
| 776 | 	 uint32_t cipher_suite); | |
| 777 | void	ieee80211_set_driver_keymgmt_suites(struct ieee80211com *ic, | |
| 778 | 	 uint32_t keymgmt_set); | |
| 752 | 779 | int	ieee80211_vap_setup(struct ieee80211com *, struct ieee80211vap *, |
| 753 | 780 | 		const char name[IFNAMSIZ], int unit, |
| 754 | 781 | 		enum ieee80211_opmode opmode, int flags, |
| ... | ... | @@ -772,7 +799,8 @@ void	ieee80211_iterate_coms(ieee80211_com_iter_func *, void *); |
| 772 | 799 | int	ieee80211_media_change(struct ifnet *); |
| 773 | 800 | void	ieee80211_media_status(struct ifnet *, struct ifmediareq *); |
| 774 | 801 | int	ieee80211_ioctl(struct ifnet *, u_long, caddr_t); |
| 775 | int	ieee80211_rate2media(struct ieee80211com *, int, | |
| 802 | int	ieee80211_rate2media(struct ieee80211com *, | |
| 803 | 		const struct ieee80211_node_txrate *, | |
| 776 | 804 | 		enum ieee80211_phymode); |
| 777 | 805 | int	ieee80211_media2rate(int); |
| 778 | 806 | int	ieee80211_mhz2ieee(u_int, u_int); |
| ... | ... | @@ -814,6 +842,14 @@ char	ieee80211_channel_type_char(const struct ieee80211_channel *c); |
| 814 | 842 | #define	ieee80211_get_home_channel(_ic)		((_ic)->ic_bsschan) |
| 815 | 843 | #define	ieee80211_get_vap_desired_channel(_iv)	((_iv)->iv_des_chan) |
| 816 | 844 | |
| 845 | bool	ieee80211_is_key_global(const struct ieee80211vap *vap, | |
| 846 | 	 const struct ieee80211_key *key); | |
| 847 | bool	ieee80211_is_key_unicast(const struct ieee80211vap *vap, | |
| 848 | 	 const struct ieee80211_key *key); | |
| 849 | ||
| 850 | bool	ieee80211_is_ctl_frame_for_vap(struct ieee80211_node *, | |
| 851 | 	 const struct mbuf *); | |
| 852 | ||
| 817 | 853 | void	ieee80211_radiotap_attach(struct ieee80211com *, |
| 818 | 854 | 	 struct ieee80211_radiotap_header *th, int tlen, |
| 819 | 855 | 		uint32_t tx_radiotap, |
| ... | ... | @@ -976,7 +1012,7 @@ ieee80211_get_node_txpower(struct ieee80211_node *ni) |
| 976 | 1012 | * Debugging facilities compiled in when IEEE80211_DEBUG is defined. |
| 977 | 1013 | * |
| 978 | 1014 | * The intent is that any problem in the net80211 layer can be |
| 979 | * diagnosed by inspecting the statistics (dumped by the wlanstats | |
| 1015 | * diagnosed by inspecting the statistics (dumped by the wlanstat | |
| 980 | 1016 | * program) and/or the msgs generated by net80211. Messages are |
| 981 | 1017 | * broken into functional classes and can be controlled with the |
| 982 | 1018 | * wlandebug program. Certain of these msg groups are for facilities |
lib/libc/include/generic-freebsd/net80211/ieee80211_vht.h+8-4| ... | ... | @@ -40,8 +40,7 @@ void	ieee80211_parse_vhtcap(struct ieee80211_node *, const uint8_t *); |
| 40 | 40 | |
| 41 | 41 | int	ieee80211_vht_updateparams(struct ieee80211_node *, |
| 42 | 42 | 	 const uint8_t *, const uint8_t *); |
| 43 | void	ieee80211_setup_vht_rates(struct ieee80211_node *, | |
| 44 | 	 const uint8_t *, const uint8_t *); | |
| 43 | void	ieee80211_setup_vht_rates(struct ieee80211_node *); | |
| 45 | 44 | |
| 46 | 45 | void	ieee80211_vht_timeout(struct ieee80211vap *vap); |
| 47 | 46 | |
| ... | ... | @@ -53,8 +52,7 @@ uint8_t *	ieee80211_add_vhtinfo(uint8_t *frm, struct ieee80211_node *); |
| 53 | 52 | uint8_t *ieee80211_add_vhtcap_ch(uint8_t *, struct ieee80211vap *, |
| 54 | 53 | struct ieee80211_channel *); |
| 55 | 54 | |
| 56 | void	ieee80211_vht_update_cap(struct ieee80211_node *, | |
| 57 | 	 const uint8_t *, const uint8_t *); | |
| 55 | void	ieee80211_vht_update_cap(struct ieee80211_node *, const uint8_t *); | |
| 58 | 56 | |
| 59 | 57 | struct ieee80211_channel * |
| 60 | 58 | 	ieee80211_vht_adjust_channel(struct ieee80211com *, |
| ... | ... | @@ -65,4 +63,10 @@ void	ieee80211_vht_get_vhtcap_ie(struct ieee80211_node *ni, |
| 65 | 63 | void	ieee80211_vht_get_vhtinfo_ie(struct ieee80211_node *ni, |
| 66 | 64 | 	 struct ieee80211_vht_operation *, int); |
| 67 | 65 | |
| 66 | bool	ieee80211_vht_check_tx_vht(const struct ieee80211_node *); | |
| 67 | bool	ieee80211_vht_check_tx_bw(const struct ieee80211_node *, | |
| 68 | 	 enum net80211_sta_rx_bw); | |
| 69 | bool	ieee80211_vht_node_check_tx_valid_mcs(const struct ieee80211_node *, | |
| 70 | 	 enum net80211_sta_rx_bw bw, uint8_t, uint8_t); | |
| 71 | ||
| 68 | 72 | #endif	/* _NET80211_IEEE80211_VHT_H_ */ |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/netdb.h-1| ... | ... | @@ -51,7 +51,6 @@ |
| 51 | 51 | */ |
| 52 | 52 | |
| 53 | 53 | /* |
| 54 | * @(#)netdb.h	8.1 (Berkeley) 6/2/93 | |
| 55 | 54 | * From: Id: netdb.h,v 8.9 1996/11/19 08:39:29 vixie Exp $ |
| 56 | 55 | */ |
| 57 | 56 |
lib/libc/include/generic-freebsd/netgraph/bluetooth/include/ng_btsocket_hci_raw.h+1-2| ... | ... | @@ -78,11 +78,10 @@ int ng_btsocket_hci_raw_control (struct socket *, u_long, void *, |
| 78 | 78 | int ng_btsocket_hci_raw_ctloutput (struct socket *, struct sockopt *); |
| 79 | 79 | void ng_btsocket_hci_raw_detach (struct socket *); |
| 80 | 80 | int ng_btsocket_hci_raw_disconnect (struct socket *); |
| 81 | int ng_btsocket_hci_raw_peeraddr (struct socket *, struct sockaddr **); | |
| 82 | 81 | int ng_btsocket_hci_raw_send (struct socket *, int, struct mbuf *, |
| 83 | 82 | struct sockaddr *, struct mbuf *, |
| 84 | 83 | struct thread *); |
| 85 | int ng_btsocket_hci_raw_sockaddr (struct socket *, struct sockaddr **); | |
| 84 | int ng_btsocket_hci_raw_sockaddr (struct socket *, struct sockaddr *); | |
| 86 | 85 | |
| 87 | 86 | #endif /* _KERNEL */ |
| 88 | 87 |
lib/libc/include/generic-freebsd/netgraph/bluetooth/include/ng_btsocket_l2cap.h+4-5| ... | ... | @@ -105,11 +105,11 @@ int ng_btsocket_l2cap_raw_control (struct socket *, u_long, void *, |
| 105 | 105 | struct ifnet *, struct thread *); |
| 106 | 106 | void ng_btsocket_l2cap_raw_detach (struct socket *); |
| 107 | 107 | int ng_btsocket_l2cap_raw_disconnect (struct socket *); |
| 108 | int ng_btsocket_l2cap_raw_peeraddr (struct socket *, struct sockaddr **); | |
| 108 | int ng_btsocket_l2cap_raw_peeraddr (struct socket *, struct sockaddr *); | |
| 109 | 109 | int ng_btsocket_l2cap_raw_send (struct socket *, int, struct mbuf *, |
| 110 | 110 | struct sockaddr *, struct mbuf *, |
| 111 | 111 | struct thread *); |
| 112 | int ng_btsocket_l2cap_raw_sockaddr (struct socket *, struct sockaddr **); | |
| 112 | int ng_btsocket_l2cap_raw_sockaddr (struct socket *, struct sockaddr *); | |
| 113 | 113 | |
| 114 | 114 | #endif /* _KERNEL */ |
| 115 | 115 | |
| ... | ... | @@ -191,7 +191,6 @@ typedef struct ng_btsocket_l2cap_pcb *	ng_btsocket_l2cap_pcb_p; |
| 191 | 191 | |
| 192 | 192 | void ng_btsocket_l2cap_abort (struct socket *); |
| 193 | 193 | void ng_btsocket_l2cap_close (struct socket *); |
| 194 | int ng_btsocket_l2cap_accept (struct socket *, struct sockaddr **); | |
| 195 | 194 | int ng_btsocket_l2cap_attach (struct socket *, int, struct thread *); |
| 196 | 195 | int ng_btsocket_l2cap_bind (struct socket *, struct sockaddr *, |
| 197 | 196 | struct thread *); |
| ... | ... | @@ -203,11 +202,11 @@ int ng_btsocket_l2cap_ctloutput (struct socket *, struct sockopt *); |
| 203 | 202 | void ng_btsocket_l2cap_detach (struct socket *); |
| 204 | 203 | int ng_btsocket_l2cap_disconnect (struct socket *); |
| 205 | 204 | int ng_btsocket_l2cap_listen (struct socket *, int, struct thread *); |
| 206 | int ng_btsocket_l2cap_peeraddr (struct socket *, struct sockaddr **); | |
| 205 | int ng_btsocket_l2cap_peeraddr (struct socket *, struct sockaddr *); | |
| 207 | 206 | int ng_btsocket_l2cap_send (struct socket *, int, struct mbuf *, |
| 208 | 207 | struct sockaddr *, struct mbuf *, |
| 209 | 208 | struct thread *); |
| 210 | int ng_btsocket_l2cap_sockaddr (struct socket *, struct sockaddr **); | |
| 209 | int ng_btsocket_l2cap_sockaddr (struct socket *, struct sockaddr *); | |
| 211 | 210 | |
| 212 | 211 | #endif /* _KERNEL */ |
| 213 | 212 |
lib/libc/include/generic-freebsd/netgraph/bluetooth/include/ng_btsocket_rfcomm.h+3-3| ... | ... | @@ -316,7 +316,7 @@ typedef struct ng_btsocket_rfcomm_pcb *	ng_btsocket_rfcomm_pcb_p; |
| 316 | 316 | |
| 317 | 317 | void ng_btsocket_rfcomm_abort (struct socket *); |
| 318 | 318 | void ng_btsocket_rfcomm_close (struct socket *); |
| 319 | int ng_btsocket_rfcomm_accept (struct socket *, struct sockaddr **); | |
| 319 | int ng_btsocket_rfcomm_accept (struct socket *, struct sockaddr *); | |
| 320 | 320 | int ng_btsocket_rfcomm_attach (struct socket *, int, struct thread *); |
| 321 | 321 | int ng_btsocket_rfcomm_bind (struct socket *, struct sockaddr *, |
| 322 | 322 | struct thread *); |
| ... | ... | @@ -328,11 +328,11 @@ int ng_btsocket_rfcomm_ctloutput (struct socket *, struct sockopt *); |
| 328 | 328 | void ng_btsocket_rfcomm_detach (struct socket *); |
| 329 | 329 | int ng_btsocket_rfcomm_disconnect (struct socket *); |
| 330 | 330 | int ng_btsocket_rfcomm_listen (struct socket *, int, struct thread *); |
| 331 | int ng_btsocket_rfcomm_peeraddr (struct socket *, struct sockaddr **); | |
| 331 | int ng_btsocket_rfcomm_peeraddr (struct socket *, struct sockaddr *); | |
| 332 | 332 | int ng_btsocket_rfcomm_send (struct socket *, int, struct mbuf *, |
| 333 | 333 | struct sockaddr *, struct mbuf *, |
| 334 | 334 | struct thread *); |
| 335 | int ng_btsocket_rfcomm_sockaddr (struct socket *, struct sockaddr **); | |
| 335 | int ng_btsocket_rfcomm_sockaddr (struct socket *, struct sockaddr *); | |
| 336 | 336 | |
| 337 | 337 | #endif /* _KERNEL */ |
| 338 | 338 |
lib/libc/include/generic-freebsd/netgraph/bluetooth/include/ng_btsocket_sco.h+3-3| ... | ... | @@ -106,7 +106,7 @@ typedef struct ng_btsocket_sco_pcb *	ng_btsocket_sco_pcb_p; |
| 106 | 106 | |
| 107 | 107 | void ng_btsocket_sco_abort (struct socket *); |
| 108 | 108 | void ng_btsocket_sco_close (struct socket *); |
| 109 | int ng_btsocket_sco_accept (struct socket *, struct sockaddr **); | |
| 109 | int ng_btsocket_sco_accept (struct socket *, struct sockaddr *); | |
| 110 | 110 | int ng_btsocket_sco_attach (struct socket *, int, struct thread *); |
| 111 | 111 | int ng_btsocket_sco_bind (struct socket *, struct sockaddr *, |
| 112 | 112 | struct thread *); |
| ... | ... | @@ -118,11 +118,11 @@ int ng_btsocket_sco_ctloutput (struct socket *, struct sockopt *); |
| 118 | 118 | void ng_btsocket_sco_detach (struct socket *); |
| 119 | 119 | int ng_btsocket_sco_disconnect (struct socket *); |
| 120 | 120 | int ng_btsocket_sco_listen (struct socket *, int, struct thread *); |
| 121 | int ng_btsocket_sco_peeraddr (struct socket *, struct sockaddr **); | |
| 121 | int ng_btsocket_sco_peeraddr (struct socket *, struct sockaddr *); | |
| 122 | 122 | int ng_btsocket_sco_send (struct socket *, int, struct mbuf *, |
| 123 | 123 | struct sockaddr *, struct mbuf *, |
| 124 | 124 | struct thread *); |
| 125 | int ng_btsocket_sco_sockaddr (struct socket *, struct sockaddr **); | |
| 125 | int ng_btsocket_sco_sockaddr (struct socket *, struct sockaddr *); | |
| 126 | 126 | |
| 127 | 127 | #endif /* _KERNEL */ |
| 128 | 128 |
lib/libc/include/generic-freebsd/netgraph/bluetooth/include/ng_hci.h+79-1| ... | ... | @@ -114,6 +114,8 @@ |
| 114 | 114 | #define NG_HCI_LMP_FLOW_CONTROL_LAG0		0x10 |
| 115 | 115 | #define NG_HCI_LMP_FLOW_CONTROL_LAG1		0x20 |
| 116 | 116 | #define NG_HCI_LMP_FLOW_CONTROL_LAG2		0x40 |
| 117 | /* ------------------- byte 6 --------------------*/ | |
| 118 | #define	NG_HCI_LMP_SECURE_SIMPLE_PAIRING	0x08 | |
| 117 | 119 | |
| 118 | 120 | /* Link types */ |
| 119 | 121 | #define NG_HCI_LINK_SCO				0x00 /* Voice */ |
| ... | ... | @@ -446,7 +448,7 @@ typedef struct { |
| 446 | 448 | typedef bdaddr_t *	bdaddr_p; |
| 447 | 449 | |
| 448 | 450 | /* Any BD_ADDR. Note: This is actually 7 bytes (count '\0' terminator) */ |
| 449 | #define NG_HCI_BDADDR_ANY	((bdaddr_p) "\000\000\000\000\000\000") | |
| 451 | #define NG_HCI_BDADDR_ANY	(&(const bdaddr_t){"\000\000\000\000\000\000"}) | |
| 450 | 452 | |
| 451 | 453 | /* HCI status return parameter */ |
| 452 | 454 | typedef struct { |
| ... | ... | @@ -860,6 +862,50 @@ typedef struct { |
| 860 | 862 | } __attribute__ ((packed)) ng_hci_read_clock_offset_cp; |
| 861 | 863 | /* No return parameter(s) */ |
| 862 | 864 | |
| 865 | #define	NG_HCI_IO_CAPABILITY_REQUEST_REPLY		0x002b | |
| 866 | typedef struct { | |
| 867 | 	bdaddr_t	bdaddr; | |
| 868 | 	u_int8_t	io_capability; | |
| 869 | 	u_int8_t	oob_data_present; | |
| 870 | 	u_int8_t	authentication_requirements; | |
| 871 | } __attribute__ ((packed)) ng_hci_io_capability_request_reply_cp; | |
| 872 | ||
| 873 | typedef struct { | |
| 874 | 	u_int8_t	status; | |
| 875 | 	bdaddr_t	bdaddr; | |
| 876 | } __attribute__ ((packed)) ng_hci_io_capability_request_reply_rp; | |
| 877 | ||
| 878 | #define	NG_HCI_USER_CONFIRMATION_REQUEST_REPLY		0x002c | |
| 879 | typedef struct { | |
| 880 | 	bdaddr_t	bdaddr; | |
| 881 | } __attribute__ ((packed)) ng_hci_user_confirmation_request_reply_cp; | |
| 882 | ||
| 883 | typedef struct { | |
| 884 | 	u_int8_t	status; | |
| 885 | 	bdaddr_t	bdaddr; | |
| 886 | } __attribute__ ((packed)) ng_hci_user_confirmation_request_reply_rp; | |
| 887 | ||
| 888 | #define	NG_HCI_USER_CONFIRMATION_REQUEST_NEGATIVE_REPLY	0x002d | |
| 889 | typedef struct { | |
| 890 | 	bdaddr_t	bdaddr; | |
| 891 | } __attribute__((packed)) ng_hci_user_confirmation_request_negative_reply_cp; | |
| 892 | ||
| 893 | typedef struct { | |
| 894 | 	u_int8_t	status; | |
| 895 | 	bdaddr_t	bdaddr; | |
| 896 | } __attribute__ ((packed)) ng_hci_user_confirmation_request_negative_reply_rp; | |
| 897 | ||
| 898 | #define	NG_HCI_IO_CAPABILITY_REQUEST_NEGATIVE_REPLY	0x0034 | |
| 899 | typedef struct { | |
| 900 | 	bdaddr_t	bdaddr; | |
| 901 | 	u_int8_t	reason; | |
| 902 | } __attribute__ ((packed)) ng_hci_io_capability_request_negative_reply_cp; | |
| 903 | ||
| 904 | typedef struct { | |
| 905 | 	u_int8_t	status; | |
| 906 | 	bdaddr_t	bdaddr; | |
| 907 | } __attribute__ ((packed)) ng_hci_io_capability_request_negative_reply_rp; | |
| 908 | ||
| 863 | 909 | /************************************************************************** |
| 864 | 910 | ************************************************************************** |
| 865 | 911 | ** Link policy commands and return parameters |
| ... | ... | @@ -1374,6 +1420,13 @@ typedef struct { |
| 1374 | 1420 | |
| 1375 | 1421 | typedef ng_hci_status_rp	ng_hci_write_page_scan_rp; |
| 1376 | 1422 | |
| 1423 | #define	NG_HCI_OCF_WRITE_SIMPLE_PAIRING		0x0056 | |
| 1424 | typedef struct { | |
| 1425 | 	u_int8_t simple_pairing; /* 1 -> enabled, 0 -> disabled */ | |
| 1426 | } __attribute__ ((packed)) ng_hci_write_simple_pairing_cp; | |
| 1427 | ||
| 1428 | typedef ng_hci_status_rp	ng_hci_write_simple_pairing_rp; | |
| 1429 | ||
| 1377 | 1430 | #define NG_HCI_OCF_READ_LE_HOST_SUPPORTED 0x6c |
| 1378 | 1431 | typedef struct { |
| 1379 | 1432 | 	u_int8_t	status; /* 0x00 - success */ |
| ... | ... | @@ -1389,6 +1442,13 @@ typedef struct { |
| 1389 | 1442 | |
| 1390 | 1443 | typedef ng_hci_status_rp	ng_hci_write_le_host_supported_rp; |
| 1391 | 1444 | |
| 1445 | #define	NG_HCI_OCF_WRITE_SECURE_CONNECTIONS_HOST_SUPPORT	0x007a | |
| 1446 | typedef struct { | |
| 1447 | 	u_int8_t support; /* 0 - disabled, 1 - enabled */ | |
| 1448 | } __attribute__ ((packed)) ng_hci_write_secure_connections_host_support_cp; | |
| 1449 | ||
| 1450 | typedef ng_hci_status_rp ng_hci_write_secure_connections_host_support_rp; | |
| 1451 | ||
| 1392 | 1452 | /************************************************************************** |
| 1393 | 1453 | ************************************************************************** |
| 1394 | 1454 | ** Informational commands and return parameters |
| ... | ... | @@ -2025,6 +2085,24 @@ typedef struct { |
| 2025 | 2085 | 	bdaddr_t	bdaddr; /* destination address */ |
| 2026 | 2086 | 	u_int8_t	page_scan_rep_mode; /* page scan repetition mode */ |
| 2027 | 2087 | } __attribute__ ((packed)) ng_hci_page_scan_rep_mode_change_ep; |
| 2088 | ||
| 2089 | #define	NG_HCI_EVENT_IO_CAPABILITY_REQUEST	0x31 | |
| 2090 | typedef struct { | |
| 2091 | 	bdaddr_t	bdaddr; | |
| 2092 | } __attribute__ ((packed)) ng_hci_io_capability_request_ep; | |
| 2093 | ||
| 2094 | #define	NG_HCI_EVENT_USER_CONFIRMATION_REQUEST	0x33 | |
| 2095 | typedef struct { | |
| 2096 | 	bdaddr_t	bdaddr; | |
| 2097 | 	u_int32_t	numeric_value; | |
| 2098 | } __attribute__ ((packed)) ng_hci_user_confirmation_request_ep; | |
| 2099 | ||
| 2100 | #define	NG_HCI_EVENT_SIMPLE_PAIRING_COMPLETE	0x36 | |
| 2101 | typedef struct { | |
| 2102 | 	u_int8_t	status; | |
| 2103 | 	bdaddr_t	bdaddr; | |
| 2104 | } __attribute__ ((packed)) ng_hci_simple_pairing_complete_ep; | |
| 2105 | ||
| 2028 | 2106 | #define NG_HCI_EVENT_LE				0x3e |
| 2029 | 2107 | typedef struct { |
| 2030 | 2108 | 	u_int8_t	subevent_code;	 |
lib/libc/include/generic-freebsd/netgraph/netflow/ng_netflow.h+2-2| ... | ... | @@ -259,7 +259,7 @@ struct flow_entry_data { |
| 259 | 259 | 	u_long		bytes; |
| 260 | 260 | 	long		first;		/* uptime on first packet */ |
| 261 | 261 | 	long		last;		/* uptime on last packet */ |
| 262 | 	u_char		tcp_flags;	/* cumulative OR */ | |
| 262 | 	uint16_t	tcp_flags;	/* cumulative OR */ | |
| 263 | 263 | }; |
| 264 | 264 | |
| 265 | 265 | struct flow6_entry_data { |
| ... | ... | @@ -277,7 +277,7 @@ struct flow6_entry_data { |
| 277 | 277 | 	u_long		bytes; |
| 278 | 278 | 	long		first;		/* uptime on first packet */ |
| 279 | 279 | 	long		last;		/* uptime on last packet */ |
| 280 | 	u_char		tcp_flags;	/* cumulative OR */ | |
| 280 | 	uint16_t	tcp_flags;	/* cumulative OR */ | |
| 281 | 281 | }; |
| 282 | 282 | |
| 283 | 283 | /* |
lib/libc/include/generic-freebsd/netgraph/netgraph.h+14-5| ... | ... | @@ -69,11 +69,20 @@ |
| 69 | 69 | * modules. |
| 70 | 70 | */ |
| 71 | 71 | #define _NG_ABI_VERSION 12 |
| 72 | #ifdef	NETGRAPH_DEBUG /*----------------------------------------------*/ | |
| 73 | #define NG_ABI_VERSION	(_NG_ABI_VERSION + 0x10000) | |
| 74 | #else	/* NETGRAPH_DEBUG */ /*----------------------------------------------*/ | |
| 75 | #define NG_ABI_VERSION	_NG_ABI_VERSION | |
| 76 | #endif	/* NETGRAPH_DEBUG */ /*----------------------------------------------*/ | |
| 72 | ||
| 73 | #ifdef	NETGRAPH_DEBUG | |
| 74 | #define	_NG_ABI_PREFIX1 0x10000 | |
| 75 | #else | |
| 76 | #define	_NG_ABI_PREFIX1 0 | |
| 77 | #endif | |
| 78 | ||
| 79 | #ifdef	INVARIANTS | |
| 80 | #define	_NG_ABI_PREFIX2 0x20000 | |
| 81 | #else | |
| 82 | #define	_NG_ABI_PREFIX2 0 | |
| 83 | #endif | |
| 84 | ||
| 85 | #define NG_ABI_VERSION	(_NG_ABI_PREFIX1 + _NG_ABI_PREFIX2 + _NG_ABI_VERSION) | |
| 77 | 86 | |
| 78 | 87 | /* |
| 79 | 88 | * Forward references for the basic structures so we can |
lib/libc/include/generic-freebsd/netgraph/ng_message.h+4-1| ... | ... | @@ -42,7 +42,10 @@ |
| 42 | 42 | #ifndef _NETGRAPH_NG_MESSAGE_H_ |
| 43 | 43 | #define _NETGRAPH_NG_MESSAGE_H_ |
| 44 | 44 | |
| 45 | /* ASCII string size limits */ | |
| 45 | /* | |
| 46 | * ASCII string size limits | |
| 47 | * Check with struct sockaddr_ng if changing. | |
| 48 | */ | |
| 46 | 49 | #define	NG_TYPESIZ	32	/* max type name len (including null) */ |
| 47 | 50 | #define	NG_HOOKSIZ	32	/* max hook name len (including null) */ |
| 48 | 51 | #define	NG_NODESIZ	32	/* max node name len (including null) */ |
lib/libc/include/generic-freebsd/netgraph/ng_nat.h+1| ... | ... | @@ -53,6 +53,7 @@ struct ng_nat_mode { |
| 53 | 53 | #define NG_NAT_PROXY_ONLY		0x40 |
| 54 | 54 | #define NG_NAT_REVERSE			0x80 |
| 55 | 55 | #define NG_NAT_UNREGISTERED_CGN		0x100 |
| 56 | #define NG_NAT_UDP_EIM			0x200 | |
| 56 | 57 | |
| 57 | 58 | #define NG_NAT_DESC_LENGTH	64 |
| 58 | 59 | #define NG_NAT_REDIRPROTO_ADDR	(IPPROTO_MAX + 3) 	/* LibAlias' LINK_ADDR, also unused in in.h */ |
lib/libc/include/generic-freebsd/netgraph/ng_socket.h+1-1| ... | ... | @@ -60,7 +60,7 @@ enum { |
| 60 | 60 | struct sockaddr_ng { |
| 61 | 61 | 	unsigned char	sg_len;		/* total length */ |
| 62 | 62 | 	sa_family_t	sg_family;	/* address family */ |
| 63 | 	char		sg_data[14];	/* actually longer; address value */ | |
| 63 | 	char		sg_data[32];	/* see NG_NODESIZ in ng_message.h */ | |
| 64 | 64 | }; |
| 65 | 65 | |
| 66 | 66 | #endif /* _NETGRAPH_NG_SOCKET_H_ */ |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/netinet/cc/cc.h+31-35| ... | ... | @@ -87,21 +87,12 @@ int	cc_deregister_algo(struct cc_algo *remove_cc); |
| 87 | 87 | #endif /* _KERNEL */ |
| 88 | 88 | |
| 89 | 89 | #if defined(_KERNEL) || defined(_WANT_TCPCB) |
| 90 | /* | |
| 91 | * Wrapper around transport structs that contain same-named congestion | |
| 92 | * control variables. Allows algos to be shared amongst multiple CC aware | |
| 93 | * transprots. | |
| 94 | */ | |
| 95 | 90 | struct cc_var { |
| 96 | 91 | 	void		*cc_data; /* Per-connection private CC algorithm data. */ |
| 97 | 92 | 	int		bytes_this_ack; /* # bytes acked by the current ACK. */ |
| 98 | 93 | 	tcp_seq		curack; /* Most recent ACK. */ |
| 99 | 94 | 	uint32_t	flags; /* Flags for cc_var (see below) */ |
| 100 | 	int		type; /* Indicates which ptr is valid in ccvc. */ | |
| 101 | 	union ccv_container { | |
| 102 | 		struct tcpcb		*tcp; | |
| 103 | 		struct sctp_nets	*sctp; | |
| 104 | 	} ccvc; | |
| 95 | 	struct tcpcb	*tp; /* Pointer to tcpcb */ | |
| 105 | 96 | 	uint16_t	nsegs; /* # segments coalesced into current chain. */ |
| 106 | 97 | 	uint8_t		labc; /* Dont use system abc use passed in */ |
| 107 | 98 | }; |
| ... | ... | @@ -113,32 +104,34 @@ struct cc_var { |
| 113 | 104 | #define	CCF_ACKNOW		0x0008	/* Will this ack be sent now? */ |
| 114 | 105 | #define	CCF_IPHDR_CE		0x0010	/* Does this packet set CE bit? */ |
| 115 | 106 | #define	CCF_TCPHDR_CWR		0x0020	/* Does this packet set CWR bit? */ |
| 116 | #define	CCF_MAX_CWND		0x0040	/* Have we reached maximum cwnd? */ | |
| 117 | #define	CCF_CHG_MAX_CWND	0x0080	/* CUBIC max_cwnd changed, for K */ | |
| 118 | #define	CCF_USR_IWND		0x0100	/* User specified initial window */ | |
| 119 | #define	CCF_USR_IWND_INIT_NSEG	0x0200	/* Convert segs to bytes on conn init */ | |
| 107 | #define	CCF_UNUSED1		0x0040 | |
| 108 | #define	CCF_UNUSED2		0x0080 | |
| 109 | #define	CCF_UNUSED3		0x0100 | |
| 110 | #define	CCF_UNUSED4		0x0200 | |
| 120 | 111 | #define CCF_HYSTART_ALLOWED	0x0400	/* If the CC supports it Hystart is allowed */ |
| 121 | 112 | #define CCF_HYSTART_CAN_SH_CWND	0x0800 /* Can hystart when going CSS -> CA slam the cwnd */ |
| 122 | 113 | #define CCF_HYSTART_CONS_SSTH	0x1000	/* Should hystart use the more conservative ssthresh */ |
| 123 | 114 | |
| 124 | /* ACK types passed to the ack_received() hook. */ | |
| 125 | #define	CC_ACK		0x0001	/* Regular in sequence ACK. */ | |
| 126 | #define	CC_DUPACK	0x0002	/* Duplicate ACK. */ | |
| 127 | #define	CC_PARTIALACK	0x0004	/* Not yet. */ | |
| 128 | #define	CC_SACK		0x0008	/* Not yet. */ | |
| 129 | 115 | #endif /* defined(_KERNEL) || defined(_WANT_TCPCB) */ |
| 130 | ||
| 131 | /* | |
| 132 | * Congestion signal types passed to the cong_signal() hook. The highest order 8 | |
| 133 | * bits (0x01000000 - 0x80000000) are reserved for CC algos to declare their own | |
| 134 | * congestion signal types. | |
| 135 | */ | |
| 136 | #define	CC_ECN		0x00000001	/* ECN marked packet received. */ | |
| 137 | #define	CC_RTO		0x00000002	/* RTO fired. */ | |
| 138 | #define	CC_RTO_ERR	0x00000004	/* RTO fired in error. */ | |
| 139 | #define	CC_NDUPACK	0x00000008	/* Threshold of dupack's reached. */ | |
| 140 | ||
| 141 | #define	CC_SIGPRIVMASK	0xFF000000	/* Mask to check if sig is private. */ | |
| 116 | typedef enum { | |
| 117 | #if defined(_KERNEL) || defined(_WANT_TCPCB) | |
| 118 | 	/* ACK types passed to the ack_received() hook. */ | |
| 119 | 	CC_ACK =	0x0001,	/* Regular in sequence ACK. */ | |
| 120 | 	CC_DUPACK =	0x0002,	/* Duplicate ACK. */ | |
| 121 | 	CC_PARTIALACK =	0x0004,	/* Not yet. */ | |
| 122 | 	CC_SACK =	0x0008,	/* Not yet. */ | |
| 123 | #endif /* defined(_KERNEL) || defined(_WANT_TCPCB) */ | |
| 124 | 	/* Congestion signal types passed to the cong_signal() hook. */ | |
| 125 | 	CC_ECN =	0x0100,	/* ECN marked packet received. */ | |
| 126 | 	CC_RTO =	0x0200,	/* RTO fired. */ | |
| 127 | 	CC_RTO_ERR =	0x0400,	/* RTO fired in error. */ | |
| 128 | 	CC_NDUPACK =	0x0800,	/* Threshold of dupack's reached. */ | |
| 129 | 	/* | |
| 130 | 	 * The highest order 8 bits (0x01000000 - 0x80000000) are reserved | |
| 131 | 	 * for CC algos to declare their own congestion signal types. | |
| 132 | 	 */ | |
| 133 | 	CC_SIGPRIVMASK = 0xFF000000	/* Mask to check if sig is private. */ | |
| 134 | } ccsignal_t; | |
| 142 | 135 | |
| 143 | 136 | #ifdef _KERNEL |
| 144 | 137 | /* |
| ... | ... | @@ -175,10 +168,10 @@ struct cc_algo { |
| 175 | 168 | 	void	(*conn_init)(struct cc_var *ccv); |
| 176 | 169 | |
| 177 | 170 | 	/* Called on receipt of an ack. */ |
| 178 | 	void	(*ack_received)(struct cc_var *ccv, uint16_t type); | |
| 171 | 	void	(*ack_received)(struct cc_var *ccv, ccsignal_t type); | |
| 179 | 172 | |
| 180 | 173 | 	/* Called on detection of a congestion signal. */ |
| 181 | 	void	(*cong_signal)(struct cc_var *ccv, uint32_t type); | |
| 174 | 	void	(*cong_signal)(struct cc_var *ccv, ccsignal_t type); | |
| 182 | 175 | |
| 183 | 176 | 	/* Called after exiting congestion recovery. */ |
| 184 | 177 | 	void	(*post_recovery)(struct cc_var *ccv); |
| ... | ... | @@ -236,8 +229,11 @@ extern struct rwlock cc_list_lock; |
| 236 | 229 | */ |
| 237 | 230 | void newreno_cc_post_recovery(struct cc_var *); |
| 238 | 231 | void newreno_cc_after_idle(struct cc_var *); |
| 239 | void newreno_cc_cong_signal(struct cc_var *, uint32_t ); | |
| 240 | void newreno_cc_ack_received(struct cc_var *, uint16_t); | |
| 232 | void newreno_cc_cong_signal(struct cc_var *, ccsignal_t); | |
| 233 | void newreno_cc_ack_received(struct cc_var *, ccsignal_t); | |
| 234 | u_int newreno_cc_cwnd_on_multiplicative_decrease(struct cc_var *ccv, uint32_t mss); | |
| 235 | u_int newreno_cc_cwnd_in_cong_avoid(struct cc_var *ccv); | |
| 236 | u_int newreno_cc_cwnd_in_slow_start(struct cc_var *ccv); | |
| 241 | 237 | |
| 242 | 238 | /* Called to temporarily keep an algo from going away during change */ |
| 243 | 239 | void cc_refer(struct cc_algo *algo); |
lib/libc/include/generic-freebsd/netinet/cc/cc_cubic.h+102-88| ... | ... | @@ -83,26 +83,28 @@ |
| 83 | 83 | #define CUBICFLAG_RTO_EVENT		0x00000008	/* RTO experienced */ |
| 84 | 84 | #define CUBICFLAG_HYSTART_ENABLED	0x00000010	/* Hystart++ is enabled */ |
| 85 | 85 | #define CUBICFLAG_HYSTART_IN_CSS	0x00000020	/* We are in Hystart++ CSS */ |
| 86 | #define CUBICFLAG_IN_TF			0x00000040	/* We are in TCP friendly region */ | |
| 86 | 87 | |
| 87 | 88 | /* Kernel only bits */ |
| 88 | 89 | #ifdef _KERNEL |
| 89 | 90 | struct cubic { |
| 90 | 	/* CUBIC K in fixed point form with CUBIC_SHIFT worth of precision. */ | |
| 91 | 	/* | |
| 92 | 	 * CUBIC K in fixed point form with CUBIC_SHIFT worth of precision. | |
| 93 | 	 * Also means the time period in seconds it takes to increase the | |
| 94 | 	 * congestion window size at the beginning of the current congestion | |
| 95 | 	 * avoidance stage to W_max. | |
| 96 | 	 */ | |
| 91 | 97 | 	int64_t		K; |
| 92 | 98 | 	/* Sum of RTT samples across an epoch in usecs. */ |
| 93 | 99 | 	int64_t		sum_rtt_usecs; |
| 94 | 	/* Size of cwnd just before cwnd was reduced in the last congestion event */ | |
| 95 | 	uint64_t	W_max; | |
| 96 | 	/* An estimate for the congestion window in the Reno-friendly region */ | |
| 97 | 	uint64_t	W_est; | |
| 98 | 	/* The cwnd at the beginning of the current congestion avoidance stage */ | |
| 99 | 	uint64_t	cwnd_epoch; | |
| 100 | 	/* | |
| 101 | 	 * Size of cwnd at the time of setting ssthresh most recently, | |
| 102 | 	 * either upon exiting the first slow start, or just before cwnd | |
| 103 | 	 * was reduced in the last congestion event | |
| 104 | 	 */ | |
| 105 | 	uint64_t	cwnd_prior; | |
| 100 | 	/* Size of cwnd (in bytes) just before cwnd was reduced in the last congestion event. */ | |
| 101 | 	uint32_t	W_max; | |
| 102 | 	/* An estimate (in bytes) for the congestion window in the Reno-friendly region */ | |
| 103 | 	uint32_t	W_est; | |
| 104 | 	/* An estimate (in bytes) for the congestion window in the CUBIC region */ | |
| 105 | 	uint32_t	W_cubic; | |
| 106 | 	/* The cwnd (in bytes) at the beginning of the current congestion avoidance stage. */ | |
| 107 | 	uint32_t	cwnd_epoch; | |
| 106 | 108 | 	/* various flags */ |
| 107 | 109 | 	uint32_t	flags; |
| 108 | 110 | 	/* Minimum observed rtt in usecs. */ |
| ... | ... | @@ -117,12 +119,8 @@ struct cubic { |
| 117 | 119 | 	int		undo_t_epoch; |
| 118 | 120 | 	/* Few variables to restore the state after RTO_ERR */ |
| 119 | 121 | 	int64_t		undo_K; |
| 120 | 	uint64_t	undo_cwnd_prior; | |
| 121 | 	uint64_t	undo_W_max; | |
| 122 | 	uint64_t	undo_W_est; | |
| 123 | 	uint64_t	undo_cwnd_epoch; | |
| 124 | 	/* Number of congestion events experienced */ | |
| 125 | 	uint64_t	num_cong_events; | |
| 122 | 	uint32_t	undo_W_max; | |
| 123 | 	uint32_t	undo_cwnd_epoch; | |
| 126 | 124 | 	uint32_t css_baseline_minrtt; |
| 127 | 125 | 	uint32_t css_current_round_minrtt; |
| 128 | 126 | 	uint32_t css_lastround_minrtt; |
| ... | ... | @@ -141,60 +139,103 @@ struct cubic { |
| 141 | 139 | extern int hz; |
| 142 | 140 | |
| 143 | 141 | /* |
| 144 | * Implementation based on the formulae found in the CUBIC Internet Draft | |
| 145 | * "draft-ietf-tcpm-cubic-04". | |
| 142 | * Implementation based on the formulas in RFC9438. | |
| 146 | 143 | * |
| 147 | 144 | */ |
| 148 | 145 | |
| 149 | static __inline float | |
| 150 | theoretical_cubic_k(double wmax_pkts) | |
| 146 | ||
| 147 | /* | |
| 148 | * Returns K, the time period in seconds it takes to increase the congestion | |
| 149 | * window size at the beginning of the current congestion avoidance stage to | |
| 150 | * W_max. | |
| 151 | */ | |
| 152 | static inline float | |
| 153 | theoretical_cubic_k(uint32_t wmax_segs, uint32_t cwnd_epoch_segs) | |
| 151 | 154 | { |
| 152 | 155 | 	double C; |
| 153 | 156 | |
| 154 | 157 | 	C = 0.4; |
| 158 | 	if (wmax_segs <= cwnd_epoch_segs) | |
| 159 | 		return 0.0; | |
| 155 | 160 | |
| 156 | 	return (pow((wmax_pkts * 0.3) / C, (1.0 / 3.0)) * pow(2, CUBIC_SHIFT)); | |
| 161 | 	/* | |
| 162 | 	 * Figure 2: K = ((W_max - cwnd_epoch) / C)^(1/3) | |
| 163 | 	 */ | |
| 164 | 	return (pow((wmax_segs - cwnd_epoch_segs) / C, (1.0 / 3.0)) * pow(2, CUBIC_SHIFT)); | |
| 157 | 165 | } |
| 158 | 166 | |
| 159 | static __inline unsigned long | |
| 160 | theoretical_cubic_cwnd(int ticks_since_epoch, unsigned long wmax, uint32_t smss) | |
| 167 | /* | |
| 168 | * Returns the congestion window in segments at time t in seconds based on the | |
| 169 | * cubic increase function, where t is the elapsed time in seconds from the | |
| 170 | * beginning of the current congestion avoidance stage, as described in RFC9438 | |
| 171 | * Section 4.2. | |
| 172 | */ | |
| 173 | static inline unsigned long | |
| 174 | theoretical_cubic_cwnd(int ticks_elapsed, uint32_t wmax_segs, uint32_t cwnd_epoch_segs) | |
| 161 | 175 | { |
| 162 | 	double C, wmax_pkts; | |
| 176 | 	double C, t; | |
| 177 | 	float K; | |
| 163 | 178 | |
| 164 | 179 | 	C = 0.4; |
| 165 | 	wmax_pkts = wmax / (double)smss; | |
| 180 | 	t = ticks_elapsed / (double)hz; | |
| 181 | 	K = theoretical_cubic_k(wmax_segs, cwnd_epoch_segs); | |
| 166 | 182 | |
| 167 | 	return (smss * (wmax_pkts + | |
| 168 | 	 (C * pow(ticks_since_epoch / (double)hz - | |
| 169 | 	 theoretical_cubic_k(wmax_pkts) / pow(2, CUBIC_SHIFT), 3.0)))); | |
| 183 | 	/* | |
| 184 | 	 * Figure 1: W_cubic(t) = C * (t - K)^3 + W_max | |
| 185 | 	 */ | |
| 186 | 	return (C * pow(t - K / pow(2, CUBIC_SHIFT), 3.0) + wmax_segs); | |
| 170 | 187 | } |
| 171 | 188 | |
| 172 | static __inline unsigned long | |
| 173 | theoretical_reno_cwnd(int ticks_since_epoch, int rtt_ticks, unsigned long wmax, | |
| 174 | uint32_t smss) | |
| 189 | /* | |
| 190 | * Returns estimated Reno congestion window in segments. | |
| 191 | */ | |
| 192 | static inline unsigned long | |
| 193 | theoretical_reno_cwnd(int ticks_elapsed, int rtt_ticks, uint32_t wmax_segs) | |
| 175 | 194 | { |
| 176 | 195 | |
| 177 | 	return ((wmax * 0.5) + ((ticks_since_epoch / (float)rtt_ticks) * smss)); | |
| 196 | 	return (wmax_segs * 0.5 + ticks_elapsed / (float)rtt_ticks); | |
| 178 | 197 | } |
| 179 | 198 | |
| 180 | static __inline unsigned long | |
| 181 | theoretical_tf_cwnd(int ticks_since_epoch, int rtt_ticks, unsigned long wmax, | |
| 182 | uint32_t smss) | |
| 199 | /* | |
| 200 | * Returns an estimate for the congestion window in segments in the | |
| 201 | * Reno-friendly region -- that is, an estimate for the congestion window of | |
| 202 | * Reno, as described in RFC9438 Section 4.3, where: | |
| 203 | * cwnd: Current congestion window in segments. | |
| 204 | * cwnd_prior: Size of cwnd in segments at the time of setting ssthresh most | |
| 205 | * recently, either upon exiting the first slow start or just before | |
| 206 | * cwnd was reduced in the last congestion event. | |
| 207 | * W_est: An estimate for the congestion window in segments in the Reno-friendly | |
| 208 | * region -- that is, an estimate for the congestion window of Reno. | |
| 209 | */ | |
| 210 | static inline unsigned long | |
| 211 | theoretical_tf_cwnd(unsigned long W_est, unsigned long segs_acked, unsigned long cwnd, | |
| 212 | unsigned long cwnd_prior) | |
| 183 | 213 | { |
| 214 | 	float cubic_alpha, cubic_beta; | |
| 184 | 215 | |
| 185 | 	return ((wmax * 0.7) + ((3 * 0.3) / (2 - 0.3) * | |
| 186 | 	 (ticks_since_epoch / (float)rtt_ticks) * smss)); | |
| 216 | 	/* RFC9438 Section 4.6: The parameter β_cubic SHOULD be set to 0.7. */ | |
| 217 | 	cubic_beta = 0.7; | |
| 218 | ||
| 219 | 	if (W_est >= cwnd_prior) | |
| 220 | 		cubic_alpha = 1.0; | |
| 221 | 	else | |
| 222 | 		cubic_alpha = (3.0 * (1.0 - cubic_beta)) / (1.0 + cubic_beta); | |
| 223 | ||
| 224 | 	/* | |
| 225 | 	 * Figure 4: W_est = W_est + α_cubic * segments_acked / cwnd | |
| 226 | 	 */ | |
| 227 | 	return (W_est + cubic_alpha * segs_acked / cwnd); | |
| 187 | 228 | } |
| 188 | 229 | |
| 189 | 230 | #endif /* !_KERNEL */ |
| 190 | 231 | |
| 191 | 232 | /* |
| 192 | 233 | * Compute the CUBIC K value used in the cwnd calculation, using an |
| 193 | * implementation of eqn 2 in the I-D. The method used | |
| 194 | * here is adapted from Apple Computer Technical Report #KT-32. | |
| 234 | * implementation mentioned in Figure. 2 of RFC9438. | |
| 235 | * The method used here is adapted from Apple Computer Technical Report #KT-32. | |
| 195 | 236 | */ |
| 196 | static __inline int64_t | |
| 197 | cubic_k(unsigned long wmax_pkts) | |
| 237 | static inline int64_t | |
| 238 | cubic_k(uint32_t wmax_segs, uint32_t cwnd_epoch_segs) | |
| 198 | 239 | { |
| 199 | 240 | 	int64_t s, K; |
| 200 | 241 | 	uint16_t p; |
| ... | ... | @@ -202,8 +243,13 @@ cubic_k(unsigned long wmax_pkts) |
| 202 | 243 | 	K = s = 0; |
| 203 | 244 | 	p = 0; |
| 204 | 245 | |
| 205 | 	/* (wmax * beta)/C with CUBIC_SHIFT worth of precision. */ | |
| 206 | 	s = ((wmax_pkts * ONE_SUB_CUBIC_BETA) << CUBIC_SHIFT) / CUBIC_C_FACTOR; | |
| 246 | 	/* Handle the corner case where W_max <= cwnd_epoch */ | |
| 247 | 	if (wmax_segs <= cwnd_epoch_segs) { | |
| 248 | 		return 0; | |
| 249 | 	} | |
| 250 | ||
| 251 | 	/* (wmax - cwnd_epoch) / C with CUBIC_SHIFT worth of precision. */ | |
| 252 | 	s = ((wmax_segs - cwnd_epoch_segs) << (2 * CUBIC_SHIFT)) / CUBIC_C_FACTOR; | |
| 207 | 253 | |
| 208 | 254 | 	/* Rebase s to be between 1 and 1/8 with a shift of CUBIC_SHIFT. */ |
| 209 | 255 | 	while (s >= 256) { |
| ... | ... | @@ -224,13 +270,14 @@ cubic_k(unsigned long wmax_pkts) |
| 224 | 270 | } |
| 225 | 271 | |
| 226 | 272 | /* |
| 227 | * Compute the new cwnd value using an implementation of eqn 1 from the I-D. | |
| 273 | * Compute and return the new cwnd value in bytes using an implementation | |
| 274 | * mentioned in Figure. 1 of RFC9438. | |
| 228 | 275 | * Thanks to Kip Macy for help debugging this function. |
| 229 | 276 | * |
| 230 | 277 | * XXXLAS: Characterise bounds for overflow. |
| 231 | 278 | */ |
| 232 | static __inline unsigned long | |
| 233 | cubic_cwnd(int usecs_since_epoch, unsigned long wmax, uint32_t smss, int64_t K) | |
| 279 | static inline uint32_t | |
| 280 | cubic_cwnd(int usecs_since_epoch, uint32_t wmax, uint32_t smss, int64_t K) | |
| 234 | 281 | { |
| 235 | 282 | 	int64_t cwnd; |
| 236 | 283 | |
| ... | ... | @@ -249,7 +296,7 @@ cubic_cwnd(int usecs_since_epoch, unsigned long wmax, uint32_t smss, int64_t K) |
| 249 | 296 | 	cwnd *= (cwnd * cwnd); |
| 250 | 297 | |
| 251 | 298 | 	/* |
| 252 | 	 * C(t - K)^3 + wmax | |
| 299 | 	 * Figure 1: C * (t - K)^3 + wmax | |
| 253 | 300 | 	 * The down shift by CUBIC_SHIFT_4 is because cwnd has 4 lots of |
| 254 | 301 | 	 * CUBIC_SHIFT included in the value. 3 from the cubing of cwnd above, |
| 255 | 302 | 	 * and an extra from multiplying through by CUBIC_C_FACTOR. |
| ... | ... | @@ -264,46 +311,13 @@ cubic_cwnd(int usecs_since_epoch, unsigned long wmax, uint32_t smss, int64_t K) |
| 264 | 311 | } |
| 265 | 312 | |
| 266 | 313 | /* |
| 267 | * Compute an approximation of the NewReno cwnd some number of usecs after a | |
| 268 | * congestion event. RTT should be the average RTT estimate for the path | |
| 269 | * measured over the previous congestion epoch and wmax is the value of cwnd at | |
| 270 | * the last congestion event. The "TCP friendly" concept in the CUBIC I-D is | |
| 271 | * rather tricky to understand and it turns out this function is not required. | |
| 272 | * It is left here for reference. | |
| 273 | * | |
| 274 | * XXX: Not used | |
| 314 | * Compute the "TCP friendly" cwnd by newreno in congestion avoidance state. | |
| 275 | 315 | */ |
| 276 | static __inline unsigned long | |
| 277 | reno_cwnd(int usecs_since_epoch, int rtt_usecs, unsigned long wmax, | |
| 278 | uint32_t smss) | |
| 316 | static inline uint32_t | |
| 317 | tf_cwnd(struct cc_var *ccv) | |
| 279 | 318 | { |
| 280 | ||
| 281 | 	/* | |
| 282 | 	 * For NewReno, beta = 0.5, therefore: W_tcp(t) = wmax*0.5 + t/RTT | |
| 283 | 	 * W_tcp(t) deals with cwnd/wmax in pkts, so because our cwnd is in | |
| 284 | 	 * bytes, we have to multiply by smss. | |
| 285 | 	 */ | |
| 286 | 	return (((wmax * RENO_BETA) + (((usecs_since_epoch * smss) | |
| 287 | 	 << CUBIC_SHIFT) / rtt_usecs)) >> CUBIC_SHIFT); | |
| 288 | } | |
| 289 | ||
| 290 | /* | |
| 291 | * Compute an approximation of the "TCP friendly" cwnd some number of usecs | |
| 292 | * after a congestion event that is designed to yield the same average cwnd as | |
| 293 | * NewReno while using CUBIC's beta of 0.7. RTT should be the average RTT | |
| 294 | * estimate for the path measured over the previous congestion epoch and wmax is | |
| 295 | * the value of cwnd at the last congestion event. | |
| 296 | */ | |
| 297 | static __inline unsigned long | |
| 298 | tf_cwnd(int usecs_since_epoch, int rtt_usecs, unsigned long wmax, | |
| 299 | uint32_t smss) | |
| 300 | { | |
| 301 | ||
| 302 | 	/* Equation 4 of I-D. */ | |
| 303 | 	return (((wmax * CUBIC_BETA) + | |
| 304 | 	 (((THREE_X_PT3 * (unsigned long)usecs_since_epoch * | |
| 305 | 	 (unsigned long)smss) << CUBIC_SHIFT) / (TWO_SUB_PT3 * rtt_usecs))) | |
| 306 | 	 >> CUBIC_SHIFT); | |
| 319 | 	/* newreno is "TCP friendly" */ | |
| 320 | 	return newreno_cc_cwnd_in_cong_avoid(ccv); | |
| 307 | 321 | } |
| 308 | 322 | |
| 309 | 323 | #endif /* _NETINET_CC_CUBIC_H_ */ |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/netinet/cc/cc_module.h+1-12| ... | ... | @@ -43,18 +43,7 @@ |
| 43 | 43 | #ifndef _NETINET_CC_MODULE_H_ |
| 44 | 44 | #define _NETINET_CC_MODULE_H_ |
| 45 | 45 | |
| 46 | /* | |
| 47 | * Allows a CC algorithm to manipulate a commonly named CC variable regardless | |
| 48 | * of the transport protocol and associated C struct. | |
| 49 | * XXXLAS: Out of action until the work to support SCTP is done. | |
| 50 | * | |
| 51 | #define	CCV(ccv, what)							\ | |
| 52 | (*(									\ | |
| 53 | 	(ccv)->type == IPPROTO_TCP ?	&(ccv)->ccvc.tcp->what :	\ | |
| 54 | 					&(ccv)->ccvc.sctp->what		\ | |
| 55 | )) | |
| 56 | */ | |
| 57 | #define	CCV(ccv, what) (ccv)->ccvc.tcp->what | |
| 46 | #define	CCV(ccv, what) (ccv)->tp->what | |
| 58 | 47 | |
| 59 | 48 | #define	DECLARE_CC_MODULE(ccname, ccalgo) 				\ |
| 60 | 49 | 	static moduledata_t cc_##ccname = {				\ |
lib/libc/include/generic-freebsd/netinet/dccp.h+1-1| ... | ... | @@ -64,7 +64,7 @@ struct dccphdr { |
| 64 | 64 | uint8_t seq[6]; |
| 65 | 65 | } longseq; |
| 66 | 66 | } d_seqno; |
| 67 | }; | |
| 67 | } __packed; | |
| 68 | 68 | |
| 69 | 69 | #define d_seqno_short d_seqno.shortseq; |
| 70 | 70 | #define d_seqno_long d_seqno.longseq.seq; |
lib/libc/include/generic-freebsd/netinet/icmp6.h+43-46| ... | ... | @@ -58,13 +58,13 @@ |
| 58 | 58 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 59 | 59 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 60 | 60 | * SUCH DAMAGE. |
| 61 | * | |
| 62 | *	@(#)ip_icmp.h	8.1 (Berkeley) 6/10/93 | |
| 63 | 61 | */ |
| 64 | 62 | |
| 65 | 63 | #ifndef _NETINET_ICMP6_H_ |
| 66 | 64 | #define _NETINET_ICMP6_H_ |
| 67 | 65 | |
| 66 | #include <sys/stdint.h> | |
| 67 | ||
| 68 | 68 | #define ICMPV6_PLD_MAXLEN	1232	/* IPV6_MMTU - sizeof(struct ip6_hdr) |
| 69 | 69 | 					 - sizeof(struct icmp6_hdr) */ |
| 70 | 70 | |
| ... | ... | @@ -309,7 +309,8 @@ struct nd_opt_hdr {		/* Neighbor discovery option header */ |
| 309 | 309 | #define ND_OPT_ROUTE_INFO		24	/* RFC 4191 */ |
| 310 | 310 | #define ND_OPT_RDNSS			25	/* RFC 6106 */ |
| 311 | 311 | #define ND_OPT_DNSSL			31	/* RFC 6106 */ |
| 312 | #define ND_OPT_MAX			31 | |
| 312 | #define ND_OPT_PREF64			38	/* RFC 8781 */ | |
| 313 | #define ND_OPT_MAX			38 | |
| 313 | 314 | |
| 314 | 315 | struct nd_opt_prefix_info {	/* prefix information */ |
| 315 | 316 | 	u_int8_t	nd_opt_pi_type; |
| ... | ... | @@ -375,6 +376,14 @@ struct nd_opt_dnssl {		/* DNSSL option (RFC 6106) */ |
| 375 | 376 | 	/* followed by list of DNS search domains */ |
| 376 | 377 | } __packed; |
| 377 | 378 | |
| 379 | struct nd_opt_pref64 {		/* PREF64 option (RFC 8781) */ | |
| 380 | 	uint8_t		nd_opt_pref64_type; | |
| 381 | 	uint8_t		nd_opt_pref64_len; | |
| 382 | 	/* bits 0-12 are the SL, bits 13-15 are the PLC */ | |
| 383 | 	uint16_t	nd_opt_pref64_sl_plc; | |
| 384 | 	char		nd_opt_prefix[12]; | |
| 385 | } __packed; | |
| 386 | ||
| 378 | 387 | /* |
| 379 | 388 | * icmp6 namelookup |
| 380 | 389 | */ |
| ... | ... | @@ -574,22 +583,6 @@ do {								\ |
| 574 | 583 | * Variables related to this implementation |
| 575 | 584 | * of the internet control message protocol version 6. |
| 576 | 585 | */ |
| 577 | struct icmp6errstat { | |
| 578 | 	uint64_t icp6errs_dst_unreach_noroute; | |
| 579 | 	uint64_t icp6errs_dst_unreach_admin; | |
| 580 | 	uint64_t icp6errs_dst_unreach_beyondscope; | |
| 581 | 	uint64_t icp6errs_dst_unreach_addr; | |
| 582 | 	uint64_t icp6errs_dst_unreach_noport; | |
| 583 | 	uint64_t icp6errs_packet_too_big; | |
| 584 | 	uint64_t icp6errs_time_exceed_transit; | |
| 585 | 	uint64_t icp6errs_time_exceed_reassembly; | |
| 586 | 	uint64_t icp6errs_paramprob_header; | |
| 587 | 	uint64_t icp6errs_paramprob_nextheader; | |
| 588 | 	uint64_t icp6errs_paramprob_option; | |
| 589 | 	uint64_t icp6errs_redirect; /* we regard redirect as an error here */ | |
| 590 | 	uint64_t icp6errs_unknown; | |
| 591 | }; | |
| 592 | ||
| 593 | 586 | struct icmp6stat { |
| 594 | 587 | /* statistics related to icmp6 packets generated */ |
| 595 | 588 | 	uint64_t icp6s_error;		/* # of calls to icmp6_error */ |
| ... | ... | @@ -609,25 +602,19 @@ struct icmp6stat { |
| 609 | 602 | 	uint64_t icp6s_reflect; |
| 610 | 603 | 	uint64_t icp6s_inhist[256]; |
| 611 | 604 | 	uint64_t icp6s_nd_toomanyopt;	/* too many ND options */ |
| 612 | 	struct icmp6errstat icp6s_outerrhist; | |
| 613 | #define icp6s_odst_unreach_noroute \ | |
| 614 | 	icp6s_outerrhist.icp6errs_dst_unreach_noroute | |
| 615 | #define icp6s_odst_unreach_admin icp6s_outerrhist.icp6errs_dst_unreach_admin | |
| 616 | #define icp6s_odst_unreach_beyondscope \ | |
| 617 | 	icp6s_outerrhist.icp6errs_dst_unreach_beyondscope | |
| 618 | #define icp6s_odst_unreach_addr icp6s_outerrhist.icp6errs_dst_unreach_addr | |
| 619 | #define icp6s_odst_unreach_noport icp6s_outerrhist.icp6errs_dst_unreach_noport | |
| 620 | #define icp6s_opacket_too_big icp6s_outerrhist.icp6errs_packet_too_big | |
| 621 | #define icp6s_otime_exceed_transit \ | |
| 622 | 	icp6s_outerrhist.icp6errs_time_exceed_transit | |
| 623 | #define icp6s_otime_exceed_reassembly \ | |
| 624 | 	icp6s_outerrhist.icp6errs_time_exceed_reassembly | |
| 625 | #define icp6s_oparamprob_header icp6s_outerrhist.icp6errs_paramprob_header | |
| 626 | #define icp6s_oparamprob_nextheader \ | |
| 627 | 	icp6s_outerrhist.icp6errs_paramprob_nextheader | |
| 628 | #define icp6s_oparamprob_option icp6s_outerrhist.icp6errs_paramprob_option | |
| 629 | #define icp6s_oredirect icp6s_outerrhist.icp6errs_redirect | |
| 630 | #define icp6s_ounknown icp6s_outerrhist.icp6errs_unknown | |
| 605 | 	uint64_t icp6s_odst_unreach_noroute; | |
| 606 | 	uint64_t icp6s_odst_unreach_admin; | |
| 607 | 	uint64_t icp6s_odst_unreach_beyondscope; | |
| 608 | 	uint64_t icp6s_odst_unreach_addr; | |
| 609 | 	uint64_t icp6s_odst_unreach_noport; | |
| 610 | 	uint64_t icp6s_opacket_too_big; | |
| 611 | 	uint64_t icp6s_otime_exceed_transit; | |
| 612 | 	uint64_t icp6s_otime_exceed_reassembly; | |
| 613 | 	uint64_t icp6s_oparamprob_header; | |
| 614 | 	uint64_t icp6s_oparamprob_nextheader; | |
| 615 | 	uint64_t icp6s_oparamprob_option; | |
| 616 | 	uint64_t icp6s_oredirect; | |
| 617 | 	uint64_t icp6s_ounknown; | |
| 631 | 618 | 	uint64_t icp6s_pmtuchg;		/* path MTU changes */ |
| 632 | 619 | 	uint64_t icp6s_nd_badopt;	/* bad ND options */ |
| 633 | 620 | 	uint64_t icp6s_badns;		/* bad neighbor solicitation */ |
| ... | ... | @@ -645,6 +632,7 @@ struct icmp6stat { |
| 645 | 632 | |
| 646 | 633 | #ifdef _KERNEL |
| 647 | 634 | #include <sys/counter.h> |
| 635 | #include <netinet/in_kdtrace.h> | |
| 648 | 636 | |
| 649 | 637 | #ifdef SYSCTL_DECL |
| 650 | 638 | SYSCTL_DECL(_net_inet6_icmp6); |
| ... | ... | @@ -655,16 +643,28 @@ VNET_PCPUSTAT_DECLARE(struct icmp6stat, icmp6stat); |
| 655 | 643 | * In-kernel consumers can use these accessor macros directly to update |
| 656 | 644 | * stats. |
| 657 | 645 | */ |
| 658 | #define	ICMP6STAT_ADD(name, val)	\ | |
| 659 | VNET_PCPUSTAT_ADD(struct icmp6stat, icmp6stat, name, (val)) | |
| 660 | #define	ICMP6STAT_INC(name)		ICMP6STAT_ADD(name, 1) | |
| 646 | #define ICMP6STAT_ADD(name, val) \ | |
| 647 | 	do { \ | |
| 648 | 		MIB_SDT_PROBE1(icmp6, count, name, (val)); \ | |
| 649 | 		VNET_PCPUSTAT_ADD(struct icmp6stat, icmp6stat, name, (val)); \ | |
| 650 | 	} while (0) | |
| 651 | #define ICMP6STAT_INC(name) ICMP6STAT_ADD(name, 1) | |
| 652 | #define ICMP6STAT_INC2(name, type) \ | |
| 653 | 	do { \ | |
| 654 | 		MIB_SDT_PROBE2(icmp6, count, name, 1, type); \ | |
| 655 | 		VNET_PCPUSTAT_ADD(struct icmp6stat, icmp6stat, name[type], 1); \ | |
| 656 | 	} while (0) | |
| 661 | 657 | |
| 662 | 658 | /* |
| 663 | 659 | * Kernel module consumers must use this accessor macro. |
| 664 | 660 | */ |
| 665 | 661 | void	kmod_icmp6stat_inc(int statnum); |
| 666 | #define	KMOD_ICMP6STAT_INC(name)	\ | |
| 667 | kmod_icmp6stat_inc(offsetof(struct icmp6stat, name) / sizeof(uint64_t)) | |
| 662 | #define KMOD_ICMP6STAT_INC(name) \ | |
| 663 | 	do { \ | |
| 664 | 		MIB_SDT_PROBE1(icmp6, count, name, 1); \ | |
| 665 | 		kmod_icmp6stat_inc( \ | |
| 666 | 		 offsetof(struct icmp6stat, name) / sizeof(uint64_t)); \ | |
| 667 | 	} while (0) | |
| 668 | 668 | #endif |
| 669 | 669 | |
| 670 | 670 | /* |
| ... | ... | @@ -713,9 +713,6 @@ void	icmp6_redirect_input(struct mbuf *, int); |
| 713 | 713 | void	icmp6_redirect_output(struct mbuf *, struct nhop_object *); |
| 714 | 714 | int	icmp6_ratelimit(const struct in6_addr *, const int, const int); |
| 715 | 715 | |
| 716 | struct	ip6ctlparam; | |
| 717 | void	icmp6_mtudisc_update(struct ip6ctlparam *, int); | |
| 718 | ||
| 719 | 716 | /* XXX: is this the right place for these macros? */ |
| 720 | 717 | #define icmp6_ifstat_inc(ifp, tag) \ |
| 721 | 718 | do {								\ |
lib/libc/include/generic-freebsd/netinet/icmp_var.h+22-12| ... | ... | @@ -27,8 +27,6 @@ |
| 27 | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | * | |
| 31 | *	@(#)icmp_var.h	8.1 (Berkeley) 6/10/93 | |
| 32 | 30 | */ |
| 33 | 31 | |
| 34 | 32 | #ifndef _NETINET_ICMP_VAR_H_ |
| ... | ... | @@ -59,22 +57,36 @@ struct	icmpstat { |
| 59 | 57 | |
| 60 | 58 | #ifdef _KERNEL |
| 61 | 59 | #include <sys/counter.h> |
| 60 | #include <netinet/in_kdtrace.h> | |
| 62 | 61 | |
| 63 | 62 | VNET_PCPUSTAT_DECLARE(struct icmpstat, icmpstat); |
| 64 | 63 | /* |
| 65 | 64 | * In-kernel consumers can use these accessor macros directly to update |
| 66 | 65 | * stats. |
| 67 | 66 | */ |
| 68 | #define	ICMPSTAT_ADD(name, val)	\ | |
| 69 | VNET_PCPUSTAT_ADD(struct icmpstat, icmpstat, name, (val)) | |
| 67 | #define ICMPSTAT_ADD(name, val) \ | |
| 68 | 	do { \ | |
| 69 | 		MIB_SDT_PROBE1(icmp, count, name, (val)); \ | |
| 70 | 		VNET_PCPUSTAT_ADD(struct icmpstat, icmpstat, name, (val)); \ | |
| 71 | 	} while (0) | |
| 72 | ||
| 70 | 73 | #define	ICMPSTAT_INC(name)	ICMPSTAT_ADD(name, 1) |
| 74 | #define ICMPSTAT_INC2(name, type) \ | |
| 75 | 	do { \ | |
| 76 | 		MIB_SDT_PROBE2(icmp, count, name, 1, type); \ | |
| 77 | 		VNET_PCPUSTAT_ADD(struct icmpstat, icmpstat, name[type], 1); \ | |
| 78 | 	} while (0) | |
| 71 | 79 | |
| 72 | 80 | /* |
| 73 | 81 | * Kernel module consumers must use this accessor macro. |
| 74 | 82 | */ |
| 75 | 83 | void	kmod_icmpstat_inc(int statnum); |
| 76 | #define	KMOD_ICMPSTAT_INC(name)						\ | |
| 77 | kmod_icmpstat_inc(offsetof(struct icmpstat, name) / sizeof(uint64_t)) | |
| 84 | #define KMOD_ICMPSTAT_INC(name) \ | |
| 85 | 	do { \ | |
| 86 | 		MIB_SDT_PROBE1(icmp, count, name, 1); \ | |
| 87 | 		kmod_icmpstat_inc( \ | |
| 88 | 		 offsetof(struct icmpstat, name) / sizeof(uint64_t)); \ | |
| 89 | 	} while (0) | |
| 78 | 90 | #endif |
| 79 | 91 | |
| 80 | 92 | /* |
| ... | ... | @@ -88,15 +100,13 @@ void	kmod_icmpstat_inc(int statnum); |
| 88 | 100 | SYSCTL_DECL(_net_inet_icmp); |
| 89 | 101 | |
| 90 | 102 | extern int badport_bandlim(int); |
| 91 | #define BANDLIM_UNLIMITED -1 | |
| 92 | 103 | #define BANDLIM_ICMP_UNREACH 0 |
| 93 | 104 | #define BANDLIM_ICMP_ECHO 1 |
| 94 | 105 | #define BANDLIM_ICMP_TSTAMP 2 |
| 95 | #define BANDLIM_RST_CLOSEDPORT 3 /* No connection, and no listeners */ | |
| 96 | #define BANDLIM_RST_OPENPORT 4 /* No connection, listener */ | |
| 97 | #define BANDLIM_ICMP6_UNREACH 5 | |
| 98 | #define BANDLIM_SCTP_OOTB 6 | |
| 99 | #define BANDLIM_MAX 7 | |
| 106 | #define BANDLIM_TCP_RST 3 | |
| 107 | #define BANDLIM_ICMP6_UNREACH 4 | |
| 108 | #define BANDLIM_SCTP_OOTB 5 | |
| 109 | #define BANDLIM_MAX 6 | |
| 100 | 110 | #endif |
| 101 | 111 | |
| 102 | 112 | #endif |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/netinet/if_ether.h-2| ... | ... | @@ -27,8 +27,6 @@ |
| 27 | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | * | |
| 31 | *	@(#)if_ether.h	8.3 (Berkeley) 5/2/95 | |
| 32 | 30 | */ |
| 33 | 31 | |
| 34 | 32 | #ifndef _NETINET_IF_ETHER_H_ |
lib/libc/include/generic-freebsd/netinet/igmp.h-2| ... | ... | @@ -31,8 +31,6 @@ |
| 31 | 31 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 32 | 32 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 33 | 33 | * SUCH DAMAGE. |
| 34 | * | |
| 35 | *	@(#)igmp.h	8.1 (Berkeley) 6/10/93 | |
| 36 | 34 | */ |
| 37 | 35 | |
| 38 | 36 | #ifndef _NETINET_IGMP_H_ |
lib/libc/include/generic-freebsd/netinet/igmp_var.h-2| ... | ... | @@ -31,8 +31,6 @@ |
| 31 | 31 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 32 | 32 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 33 | 33 | * SUCH DAMAGE. |
| 34 | * | |
| 35 | *	from: @(#)igmp_var.h	8.1 (Berkeley) 7/19/93 | |
| 36 | 34 | */ |
| 37 | 35 | |
| 38 | 36 | #ifndef _NETINET_IGMP_VAR_H_ |
lib/libc/include/generic-freebsd/netinet/in.h+12-7| ... | ... | @@ -27,8 +27,6 @@ |
| 27 | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | * | |
| 31 | *	@(#)in.h	8.3 (Berkeley) 1/3/94 | |
| 32 | 30 | */ |
| 33 | 31 | |
| 34 | 32 | #ifndef _NETINET_IN_H_ |
| ... | ... | @@ -674,13 +672,13 @@ int	getsourcefilter(int, uint32_t, struct sockaddr *, socklen_t, |
| 674 | 672 | struct ifnet; struct mbuf;	/* forward declarations for Standard C */ |
| 675 | 673 | struct in_ifaddr; |
| 676 | 674 | |
| 677 | int	 in_broadcast(struct in_addr, struct ifnet *); | |
| 678 | int	 in_ifaddr_broadcast(struct in_addr, struct in_ifaddr *); | |
| 679 | int	 in_canforward(struct in_addr); | |
| 680 | int	 in_localaddr(struct in_addr); | |
| 675 | bool	 in_ifnet_broadcast(struct in_addr, struct ifnet *); | |
| 676 | bool	 in_ifaddr_broadcast(struct in_addr, struct in_ifaddr *); | |
| 677 | bool	 in_canforward(struct in_addr); | |
| 678 | bool	 in_localaddr(struct in_addr); | |
| 681 | 679 | bool	 in_localip(struct in_addr); |
| 682 | 680 | bool	 in_localip_fib(struct in_addr, uint16_t); |
| 683 | int	 in_ifhasaddr(struct ifnet *, struct in_addr); | |
| 681 | bool	 in_ifhasaddr(struct ifnet *, struct in_addr); | |
| 684 | 682 | struct in_ifaddr *in_findlocal(uint32_t, bool); |
| 685 | 683 | int	 inet_aton(const char *, struct in_addr *); /* in libkern */ |
| 686 | 684 | char	*inet_ntoa_r(struct in_addr ina, char *buf); /* in libkern */ |
| ... | ... | @@ -688,6 +686,13 @@ char	*inet_ntop(int, const void *, char *, socklen_t); /* in libkern */ |
| 688 | 686 | int	 inet_pton(int af, const char *, void *); /* in libkern */ |
| 689 | 687 | void	 in_ifdetach(struct ifnet *); |
| 690 | 688 | |
| 689 | static inline bool | |
| 690 | in_broadcast(struct in_addr in) | |
| 691 | { | |
| 692 | 	return (in.s_addr == __htonl(INADDR_BROADCAST) || | |
| 693 | 	 in.s_addr == __htonl(INADDR_ANY)); | |
| 694 | } | |
| 695 | ||
| 691 | 696 | #define	in_hosteq(s, t)	((s).s_addr == (t).s_addr) |
| 692 | 697 | #define	in_nullhost(x)	((x).s_addr == INADDR_ANY) |
| 693 | 698 | #define	in_allhosts(x)	((x).s_addr == htonl(INADDR_ALLHOSTS_GROUP)) |
lib/libc/include/generic-freebsd/netinet/in_kdtrace.h+367| ... | ... | @@ -28,6 +28,8 @@ |
| 28 | 28 | #ifndef _SYS_IN_KDTRACE_H_ |
| 29 | 29 | #define	_SYS_IN_KDTRACE_H_ |
| 30 | 30 | |
| 31 | #include <sys/sdt.h> | |
| 32 | ||
| 31 | 33 | #define	IP_PROBE(probe, arg0, arg1, arg2, arg3, arg4, arg5)		\ |
| 32 | 34 | 	SDT_PROBE6(ip, , , probe, arg0, arg1, arg2, arg3, arg4, arg5) |
| 33 | 35 | #define	UDP_PROBE(probe, arg0, arg1, arg2, arg3, arg4)			\ |
| ... | ... | @@ -52,6 +54,371 @@ SDT_PROVIDER_DECLARE(tcp); |
| 52 | 54 | SDT_PROVIDER_DECLARE(udp); |
| 53 | 55 | SDT_PROVIDER_DECLARE(udplite); |
| 54 | 56 | |
| 57 | #ifdef KDTRACE_MIB_SDT | |
| 58 | SDT_PROVIDER_DECLARE(mib); | |
| 59 | ||
| 60 | SDT_PROBE_DECLARE(mib, ip, count, ips_total); | |
| 61 | SDT_PROBE_DECLARE(mib, ip, count, ips_badsum); | |
| 62 | SDT_PROBE_DECLARE(mib, ip, count, ips_tooshort); | |
| 63 | SDT_PROBE_DECLARE(mib, ip, count, ips_toosmall); | |
| 64 | SDT_PROBE_DECLARE(mib, ip, count, ips_badhlen); | |
| 65 | SDT_PROBE_DECLARE(mib, ip, count, ips_badlen); | |
| 66 | SDT_PROBE_DECLARE(mib, ip, count, ips_fragments); | |
| 67 | SDT_PROBE_DECLARE(mib, ip, count, ips_fragdropped); | |
| 68 | SDT_PROBE_DECLARE(mib, ip, count, ips_fragtimeout); | |
| 69 | SDT_PROBE_DECLARE(mib, ip, count, ips_forward); | |
| 70 | SDT_PROBE_DECLARE(mib, ip, count, ips_fastforward); | |
| 71 | SDT_PROBE_DECLARE(mib, ip, count, ips_cantforward); | |
| 72 | SDT_PROBE_DECLARE(mib, ip, count, ips_redirectsent); | |
| 73 | SDT_PROBE_DECLARE(mib, ip, count, ips_noproto); | |
| 74 | SDT_PROBE_DECLARE(mib, ip, count, ips_delivered); | |
| 75 | SDT_PROBE_DECLARE(mib, ip, count, ips_localout); | |
| 76 | SDT_PROBE_DECLARE(mib, ip, count, ips_odropped); | |
| 77 | SDT_PROBE_DECLARE(mib, ip, count, ips_reassembled); | |
| 78 | SDT_PROBE_DECLARE(mib, ip, count, ips_fragmented); | |
| 79 | SDT_PROBE_DECLARE(mib, ip, count, ips_ofragments); | |
| 80 | SDT_PROBE_DECLARE(mib, ip, count, ips_cantfrag); | |
| 81 | SDT_PROBE_DECLARE(mib, ip, count, ips_badoptions); | |
| 82 | SDT_PROBE_DECLARE(mib, ip, count, ips_noroute); | |
| 83 | SDT_PROBE_DECLARE(mib, ip, count, ips_badvers); | |
| 84 | SDT_PROBE_DECLARE(mib, ip, count, ips_rawout); | |
| 85 | SDT_PROBE_DECLARE(mib, ip, count, ips_toolong); | |
| 86 | SDT_PROBE_DECLARE(mib, ip, count, ips_notmember); | |
| 87 | SDT_PROBE_DECLARE(mib, ip, count, ips_nogif); | |
| 88 | SDT_PROBE_DECLARE(mib, ip, count, ips_badaddr); | |
| 89 | ||
| 90 | SDT_PROBE_DECLARE(mib, ip6, count, ip6s_total); | |
| 91 | SDT_PROBE_DECLARE(mib, ip6, count, ip6s_tooshort); | |
| 92 | SDT_PROBE_DECLARE(mib, ip6, count, ip6s_toosmall); | |
| 93 | SDT_PROBE_DECLARE(mib, ip6, count, ip6s_fragments); | |
| 94 | SDT_PROBE_DECLARE(mib, ip6, count, ip6s_fragdropped); | |
| 95 | SDT_PROBE_DECLARE(mib, ip6, count, ip6s_fragtimeout); | |
| 96 | SDT_PROBE_DECLARE(mib, ip6, count, ip6s_fragoverflow); | |
| 97 | SDT_PROBE_DECLARE(mib, ip6, count, ip6s_forward); | |
| 98 | SDT_PROBE_DECLARE(mib, ip6, count, ip6s_cantforward); | |
| 99 | SDT_PROBE_DECLARE(mib, ip6, count, ip6s_redirectsent); | |
| 100 | SDT_PROBE_DECLARE(mib, ip6, count, ip6s_delivered); | |
| 101 | SDT_PROBE_DECLARE(mib, ip6, count, ip6s_localout); | |
| 102 | SDT_PROBE_DECLARE(mib, ip6, count, ip6s_odropped); | |
| 103 | SDT_PROBE_DECLARE(mib, ip6, count, ip6s_reassembled); | |
| 104 | SDT_PROBE_DECLARE(mib, ip6, count, ip6s_atomicfrags); | |
| 105 | SDT_PROBE_DECLARE(mib, ip6, count, ip6s_fragmented); | |
| 106 | SDT_PROBE_DECLARE(mib, ip6, count, ip6s_ofragments); | |
| 107 | SDT_PROBE_DECLARE(mib, ip6, count, ip6s_cantfrag); | |
| 108 | SDT_PROBE_DECLARE(mib, ip6, count, ip6s_badoptions); | |
| 109 | SDT_PROBE_DECLARE(mib, ip6, count, ip6s_noroute); | |
| 110 | SDT_PROBE_DECLARE(mib, ip6, count, ip6s_badvers); | |
| 111 | SDT_PROBE_DECLARE(mib, ip6, count, ip6s_rawout); | |
| 112 | SDT_PROBE_DECLARE(mib, ip6, count, ip6s_badscope); | |
| 113 | SDT_PROBE_DECLARE(mib, ip6, count, ip6s_notmember); | |
| 114 | SDT_PROBE_DECLARE(mib, ip6, count, ip6s_nxthist); | |
| 115 | SDT_PROBE_DECLARE(mib, ip6, count, ip6s_m1); | |
| 116 | SDT_PROBE_DECLARE(mib, ip6, count, ip6s_m2m); | |
| 117 | SDT_PROBE_DECLARE(mib, ip6, count, ip6s_mext1); | |
| 118 | SDT_PROBE_DECLARE(mib, ip6, count, ip6s_mext2m); | |
| 119 | SDT_PROBE_DECLARE(mib, ip6, count, ip6s_exthdrtoolong); | |
| 120 | SDT_PROBE_DECLARE(mib, ip6, count, ip6s_nogif); | |
| 121 | SDT_PROBE_DECLARE(mib, ip6, count, ip6s_toomanyhdr); | |
| 122 | SDT_PROBE_DECLARE(mib, ip6, count, ip6s_sources_none); | |
| 123 | SDT_PROBE_DECLARE(mib, ip6, count, ip6s_sources_sameif); | |
| 124 | SDT_PROBE_DECLARE(mib, ip6, count, ip6s_sources_otherif); | |
| 125 | SDT_PROBE_DECLARE(mib, ip6, count, ip6s_sources_samescope); | |
| 126 | SDT_PROBE_DECLARE(mib, ip6, count, ip6s_sources_otherscope); | |
| 127 | SDT_PROBE_DECLARE(mib, ip6, count, ip6s_sources_deprecated); | |
| 128 | SDT_PROBE_DECLARE(mib, ip6, count, ip6s_sources_rule); | |
| 129 | ||
| 130 | SDT_PROBE_DECLARE(mib, icmp, count, icps_error); | |
| 131 | SDT_PROBE_DECLARE(mib, icmp, count, icps_oldshort); | |
| 132 | SDT_PROBE_DECLARE(mib, icmp, count, icps_oldicmp); | |
| 133 | SDT_PROBE_DECLARE(mib, icmp, count, icps_outhist); | |
| 134 | SDT_PROBE_DECLARE(mib, icmp, count, icps_badcode); | |
| 135 | SDT_PROBE_DECLARE(mib, icmp, count, icps_tooshort); | |
| 136 | SDT_PROBE_DECLARE(mib, icmp, count, icps_checksum); | |
| 137 | SDT_PROBE_DECLARE(mib, icmp, count, icps_badlen); | |
| 138 | SDT_PROBE_DECLARE(mib, icmp, count, icps_reflect); | |
| 139 | SDT_PROBE_DECLARE(mib, icmp, count, icps_inhist); | |
| 140 | SDT_PROBE_DECLARE(mib, icmp, count, icps_bmcastecho); | |
| 141 | SDT_PROBE_DECLARE(mib, icmp, count, icps_bmcasttstamp); | |
| 142 | SDT_PROBE_DECLARE(mib, icmp, count, icps_badaddr); | |
| 143 | SDT_PROBE_DECLARE(mib, icmp, count, icps_noroute); | |
| 144 | ||
| 145 | SDT_PROBE_DECLARE(mib, icmp6, count, icp6s_error); | |
| 146 | SDT_PROBE_DECLARE(mib, icmp6, count, icp6s_canterror); | |
| 147 | SDT_PROBE_DECLARE(mib, icmp6, count, icp6s_toofreq); | |
| 148 | SDT_PROBE_DECLARE(mib, icmp6, count, icp6s_outhist); | |
| 149 | SDT_PROBE_DECLARE(mib, icmp6, count, icp6s_badcode); | |
| 150 | SDT_PROBE_DECLARE(mib, icmp6, count, icp6s_tooshort); | |
| 151 | SDT_PROBE_DECLARE(mib, icmp6, count, icp6s_checksum); | |
| 152 | SDT_PROBE_DECLARE(mib, icmp6, count, icp6s_badlen); | |
| 153 | SDT_PROBE_DECLARE(mib, icmp6, count, icp6s_dropped); | |
| 154 | SDT_PROBE_DECLARE(mib, icmp6, count, icp6s_reflect); | |
| 155 | SDT_PROBE_DECLARE(mib, icmp6, count, icp6s_inhist); | |
| 156 | SDT_PROBE_DECLARE(mib, icmp6, count, icp6s_nd_toomanyopt); | |
| 157 | SDT_PROBE_DECLARE(mib, icmp6, count, icp6s_odst_unreach_noroute); | |
| 158 | SDT_PROBE_DECLARE(mib, icmp6, count, icp6s_odst_unreach_admin); | |
| 159 | SDT_PROBE_DECLARE(mib, icmp6, count, icp6s_odst_unreach_beyondscope); | |
| 160 | SDT_PROBE_DECLARE(mib, icmp6, count, icp6s_odst_unreach_addr); | |
| 161 | SDT_PROBE_DECLARE(mib, icmp6, count, icp6s_odst_unreach_noport); | |
| 162 | SDT_PROBE_DECLARE(mib, icmp6, count, icp6s_opacket_too_big); | |
| 163 | SDT_PROBE_DECLARE(mib, icmp6, count, icp6s_otime_exceed_transit); | |
| 164 | SDT_PROBE_DECLARE(mib, icmp6, count, icp6s_otime_exceed_reassembly); | |
| 165 | SDT_PROBE_DECLARE(mib, icmp6, count, icp6s_oparamprob_header); | |
| 166 | SDT_PROBE_DECLARE(mib, icmp6, count, icp6s_oparamprob_nextheader); | |
| 167 | SDT_PROBE_DECLARE(mib, icmp6, count, icp6s_oparamprob_option); | |
| 168 | SDT_PROBE_DECLARE(mib, icmp6, count, icp6s_oredirect); | |
| 169 | SDT_PROBE_DECLARE(mib, icmp6, count, icp6s_ounknown); | |
| 170 | SDT_PROBE_DECLARE(mib, icmp6, count, icp6s_pmtuchg); | |
| 171 | SDT_PROBE_DECLARE(mib, icmp6, count, icp6s_nd_badopt); | |
| 172 | SDT_PROBE_DECLARE(mib, icmp6, count, icp6s_badns); | |
| 173 | SDT_PROBE_DECLARE(mib, icmp6, count, icp6s_badna); | |
| 174 | SDT_PROBE_DECLARE(mib, icmp6, count, icp6s_badrs); | |
| 175 | SDT_PROBE_DECLARE(mib, icmp6, count, icp6s_badra); | |
| 176 | SDT_PROBE_DECLARE(mib, icmp6, count, icp6s_badredirect); | |
| 177 | SDT_PROBE_DECLARE(mib, icmp6, count, icp6s_overflowdefrtr); | |
| 178 | SDT_PROBE_DECLARE(mib, icmp6, count, icp6s_overflowprfx); | |
| 179 | SDT_PROBE_DECLARE(mib, icmp6, count, icp6s_overflownndp); | |
| 180 | SDT_PROBE_DECLARE(mib, icmp6, count, icp6s_overflowredirect); | |
| 181 | SDT_PROBE_DECLARE(mib, icmp6, count, icp6s_invlhlim); | |
| 182 | ||
| 183 | SDT_PROBE_DECLARE(mib, udp, count, udps_ipackets); | |
| 184 | SDT_PROBE_DECLARE(mib, udp, count, udps_hdrops); | |
| 185 | SDT_PROBE_DECLARE(mib, udp, count, udps_badsum); | |
| 186 | SDT_PROBE_DECLARE(mib, udp, count, udps_nosum); | |
| 187 | SDT_PROBE_DECLARE(mib, udp, count, udps_badlen); | |
| 188 | SDT_PROBE_DECLARE(mib, udp, count, udps_noport); | |
| 189 | SDT_PROBE_DECLARE(mib, udp, count, udps_noportbcast); | |
| 190 | SDT_PROBE_DECLARE(mib, udp, count, udps_fullsock); | |
| 191 | SDT_PROBE_DECLARE(mib, udp, count, udps_pcbcachemiss); | |
| 192 | SDT_PROBE_DECLARE(mib, udp, count, udps_pcbhashmiss); | |
| 193 | SDT_PROBE_DECLARE(mib, udp, count, udps_opackets); | |
| 194 | SDT_PROBE_DECLARE(mib, udp, count, udps_fastout); | |
| 195 | SDT_PROBE_DECLARE(mib, udp, count, udps_noportmcast); | |
| 196 | SDT_PROBE_DECLARE(mib, udp, count, udps_filtermcast); | |
| 197 | ||
| 198 | SDT_PROBE_DECLARE(mib, tcp, count, tcps_connattempt); | |
| 199 | SDT_PROBE_DECLARE(mib, tcp, count, tcps_accepts); | |
| 200 | SDT_PROBE_DECLARE(mib, tcp, count, tcps_connects); | |
| 201 | SDT_PROBE_DECLARE(mib, tcp, count, tcps_drops); | |
| 202 | SDT_PROBE_DECLARE(mib, tcp, count, tcps_conndrops); | |
| 203 | SDT_PROBE_DECLARE(mib, tcp, count, tcps_minmssdrops); | |
| 204 | SDT_PROBE_DECLARE(mib, tcp, count, tcps_closed); | |
| 205 | SDT_PROBE_DECLARE(mib, tcp, count, tcps_segstimed); | |
| 206 | SDT_PROBE_DECLARE(mib, tcp, count, tcps_rttupdated); | |
| 207 | SDT_PROBE_DECLARE(mib, tcp, count, tcps_delack); | |
| 208 | SDT_PROBE_DECLARE(mib, tcp, count, tcps_timeoutdrop); | |
| 209 | SDT_PROBE_DECLARE(mib, tcp, count, tcps_rexmttimeo); | |
| 210 | SDT_PROBE_DECLARE(mib, tcp, count, tcps_persisttimeo); | |
| 211 | SDT_PROBE_DECLARE(mib, tcp, count, tcps_keeptimeo); | |
| 212 | SDT_PROBE_DECLARE(mib, tcp, count, tcps_keepprobe); | |
| 213 | SDT_PROBE_DECLARE(mib, tcp, count, tcps_keepdrops); | |
| 214 | SDT_PROBE_DECLARE(mib, tcp, count, tcps_progdrops); | |
| 215 | ||
| 216 | SDT_PROBE_DECLARE(mib, tcp, count, tcps_sndtotal); | |
| 217 | SDT_PROBE_DECLARE(mib, tcp, count, tcps_sndpack); | |
| 218 | SDT_PROBE_DECLARE(mib, tcp, count, tcps_sndbyte); | |
| 219 | SDT_PROBE_DECLARE(mib, tcp, count, tcps_sndrexmitpack); | |
| 220 | SDT_PROBE_DECLARE(mib, tcp, count, tcps_sndrexmitbyte); | |
| 221 | SDT_PROBE_DECLARE(mib, tcp, count, tcps_sndrexmitbad); | |
| 222 | SDT_PROBE_DECLARE(mib, tcp, count, tcps_sndacks); | |
| 223 | SDT_PROBE_DECLARE(mib, tcp, count, tcps_sndprobe); | |
| 224 | SDT_PROBE_DECLARE(mib, tcp, count, tcps_sndurg); | |
| 225 | SDT_PROBE_DECLARE(mib, tcp, count, tcps_sndwinup); | |
| 226 | SDT_PROBE_DECLARE(mib, tcp, count, tcps_sndctrl); | |
| 227 | ||
| 228 | SDT_PROBE_DECLARE(mib, tcp, count, tcps_rcvtotal); | |
| 229 | SDT_PROBE_DECLARE(mib, tcp, count, tcps_rcvpack); | |
| 230 | SDT_PROBE_DECLARE(mib, tcp, count, tcps_rcvbyte); | |
| 231 | SDT_PROBE_DECLARE(mib, tcp, count, tcps_rcvbadsum); | |
| 232 | SDT_PROBE_DECLARE(mib, tcp, count, tcps_rcvbadoff); | |
| 233 | SDT_PROBE_DECLARE(mib, tcp, count, tcps_rcvreassfull); | |
| 234 | SDT_PROBE_DECLARE(mib, tcp, count, tcps_rcvshort); | |
| 235 | SDT_PROBE_DECLARE(mib, tcp, count, tcps_rcvduppack); | |
| 236 | SDT_PROBE_DECLARE(mib, tcp, count, tcps_rcvdupbyte); | |
| 237 | SDT_PROBE_DECLARE(mib, tcp, count, tcps_rcvpartduppack); | |
| 238 | SDT_PROBE_DECLARE(mib, tcp, count, tcps_rcvpartdupbyte); | |
| 239 | SDT_PROBE_DECLARE(mib, tcp, count, tcps_rcvoopack); | |
| 240 | SDT_PROBE_DECLARE(mib, tcp, count, tcps_rcvoobyte); | |
| 241 | SDT_PROBE_DECLARE(mib, tcp, count, tcps_rcvpackafterwin); | |
| 242 | SDT_PROBE_DECLARE(mib, tcp, count, tcps_rcvbyteafterwin); | |
| 243 | SDT_PROBE_DECLARE(mib, tcp, count, tcps_rcvafterclose); | |
| 244 | SDT_PROBE_DECLARE(mib, tcp, count, tcps_rcvwinprobe); | |
| 245 | SDT_PROBE_DECLARE(mib, tcp, count, tcps_rcvdupack); | |
| 246 | SDT_PROBE_DECLARE(mib, tcp, count, tcps_rcvacktoomuch); | |
| 247 | SDT_PROBE_DECLARE(mib, tcp, count, tcps_rcvackpack); | |
| 248 | SDT_PROBE_DECLARE(mib, tcp, count, tcps_rcvackbyte); | |
| 249 | SDT_PROBE_DECLARE(mib, tcp, count, tcps_rcvwinupd); | |
| 250 | SDT_PROBE_DECLARE(mib, tcp, count, tcps_pawsdrop); | |
| 251 | SDT_PROBE_DECLARE(mib, tcp, count, tcps_predack); | |
| 252 | SDT_PROBE_DECLARE(mib, tcp, count, tcps_preddat); | |
| 253 | SDT_PROBE_DECLARE(mib, tcp, count, tcps_pcbcachemiss); | |
| 254 | SDT_PROBE_DECLARE(mib, tcp, count, tcps_cachedrtt); | |
| 255 | SDT_PROBE_DECLARE(mib, tcp, count, tcps_cachedrttvar); | |
| 256 | SDT_PROBE_DECLARE(mib, tcp, count, tcps_cachedssthresh); | |
| 257 | SDT_PROBE_DECLARE(mib, tcp, count, tcps_usedrtt); | |
| 258 | SDT_PROBE_DECLARE(mib, tcp, count, tcps_usedrttvar); | |
| 259 | SDT_PROBE_DECLARE(mib, tcp, count, tcps_usedssthresh); | |
| 260 | SDT_PROBE_DECLARE(mib, tcp, count, tcps_persistdrop); | |
| 261 | SDT_PROBE_DECLARE(mib, tcp, count, tcps_badsyn); | |
| 262 | SDT_PROBE_DECLARE(mib, tcp, count, tcps_mturesent); | |
| 263 | SDT_PROBE_DECLARE(mib, tcp, count, tcps_listendrop); | |
| 264 | SDT_PROBE_DECLARE(mib, tcp, count, tcps_badrst); | |
| 265 | ||
| 266 | SDT_PROBE_DECLARE(mib, tcp, count, tcps_sc_added); | |
| 267 | SDT_PROBE_DECLARE(mib, tcp, count, tcps_sc_retransmitted); | |
| 268 | SDT_PROBE_DECLARE(mib, tcp, count, tcps_sc_dupsyn); | |
| 269 | SDT_PROBE_DECLARE(mib, tcp, count, tcps_sc_dropped); | |
| 270 | SDT_PROBE_DECLARE(mib, tcp, count, tcps_sc_completed); | |
| 271 | SDT_PROBE_DECLARE(mib, tcp, count, tcps_sc_bucketoverflow); | |
| 272 | SDT_PROBE_DECLARE(mib, tcp, count, tcps_sc_cacheoverflow); | |
| 273 | SDT_PROBE_DECLARE(mib, tcp, count, tcps_sc_reset); | |
| 274 | SDT_PROBE_DECLARE(mib, tcp, count, tcps_sc_stale); | |
| 275 | SDT_PROBE_DECLARE(mib, tcp, count, tcps_sc_aborted); | |
| 276 | SDT_PROBE_DECLARE(mib, tcp, count, tcps_sc_badack); | |
| 277 | SDT_PROBE_DECLARE(mib, tcp, count, tcps_sc_unreach); | |
| 278 | SDT_PROBE_DECLARE(mib, tcp, count, tcps_sc_zonefail); | |
| 279 | SDT_PROBE_DECLARE(mib, tcp, count, tcps_sc_sendcookie); | |
| 280 | SDT_PROBE_DECLARE(mib, tcp, count, tcps_sc_recvcookie); | |
| 281 | SDT_PROBE_DECLARE(mib, tcp, count, tcps_sc_spurcookie); | |
| 282 | SDT_PROBE_DECLARE(mib, tcp, count, tcps_sc_failcookie); | |
| 283 | ||
| 284 | SDT_PROBE_DECLARE(mib, tcp, count, tcps_hc_added); | |
| 285 | SDT_PROBE_DECLARE(mib, tcp, count, tcps_hc_bucketoverflow); | |
| 286 | ||
| 287 | SDT_PROBE_DECLARE(mib, tcp, count, tcps_finwait2_drops); | |
| 288 | ||
| 289 | SDT_PROBE_DECLARE(mib, tcp, count, tcps_sack_recovery_episode); | |
| 290 | SDT_PROBE_DECLARE(mib, tcp, count, tcps_sack_rexmits); | |
| 291 | SDT_PROBE_DECLARE(mib, tcp, count, tcps_sack_rexmits_tso); | |
| 292 | SDT_PROBE_DECLARE(mib, tcp, count, tcps_sack_rexmit_bytes); | |
| 293 | SDT_PROBE_DECLARE(mib, tcp, count, tcps_sack_rcv_blocks); | |
| 294 | SDT_PROBE_DECLARE(mib, tcp, count, tcps_sack_send_blocks); | |
| 295 | SDT_PROBE_DECLARE(mib, tcp, count, tcps_sack_lostrexmt); | |
| 296 | SDT_PROBE_DECLARE(mib, tcp, count, tcps_sack_sboverflow); | |
| 297 | ||
| 298 | SDT_PROBE_DECLARE(mib, tcp, count, tcps_ecn_rcvce); | |
| 299 | SDT_PROBE_DECLARE(mib, tcp, count, tcps_ecn_rcvect0); | |
| 300 | SDT_PROBE_DECLARE(mib, tcp, count, tcps_ecn_rcvect1); | |
| 301 | SDT_PROBE_DECLARE(mib, tcp, count, tcps_ecn_shs); | |
| 302 | SDT_PROBE_DECLARE(mib, tcp, count, tcps_ecn_rcwnd); | |
| 303 | ||
| 304 | SDT_PROBE_DECLARE(mib, tcp, count, tcps_sig_rcvgoodsig); | |
| 305 | SDT_PROBE_DECLARE(mib, tcp, count, tcps_sig_rcvbadsig); | |
| 306 | SDT_PROBE_DECLARE(mib, tcp, count, tcps_sig_err_buildsig); | |
| 307 | SDT_PROBE_DECLARE(mib, tcp, count, tcps_sig_err_sigopt); | |
| 308 | SDT_PROBE_DECLARE(mib, tcp, count, tcps_sig_err_nosigopt); | |
| 309 | ||
| 310 | SDT_PROBE_DECLARE(mib, tcp, count, tcps_pmtud_blackhole_activated); | |
| 311 | SDT_PROBE_DECLARE(mib, tcp, count, tcps_pmtud_blackhole_activated_min_mss); | |
| 312 | SDT_PROBE_DECLARE(mib, tcp, count, tcps_pmtud_blackhole_failed); | |
| 313 | ||
| 314 | SDT_PROBE_DECLARE(mib, tcp, count, tcps_tunneled_pkts); | |
| 315 | SDT_PROBE_DECLARE(mib, tcp, count, tcps_tunneled_errs); | |
| 316 | ||
| 317 | SDT_PROBE_DECLARE(mib, tcp, count, tcps_dsack_count); | |
| 318 | SDT_PROBE_DECLARE(mib, tcp, count, tcps_dsack_bytes); | |
| 319 | SDT_PROBE_DECLARE(mib, tcp, count, tcps_dsack_tlp_bytes); | |
| 320 | ||
| 321 | SDT_PROBE_DECLARE(mib, tcp, count, tcps_tw_recycles); | |
| 322 | SDT_PROBE_DECLARE(mib, tcp, count, tcps_tw_resets); | |
| 323 | SDT_PROBE_DECLARE(mib, tcp, count, tcps_tw_responds); | |
| 324 | ||
| 325 | SDT_PROBE_DECLARE(mib, tcp, count, tcps_ace_nect); | |
| 326 | SDT_PROBE_DECLARE(mib, tcp, count, tcps_ace_ect1); | |
| 327 | SDT_PROBE_DECLARE(mib, tcp, count, tcps_ace_ect0); | |
| 328 | SDT_PROBE_DECLARE(mib, tcp, count, tcps_ace_ce); | |
| 329 | ||
| 330 | SDT_PROBE_DECLARE(mib, tcp, count, tcps_ecn_sndect0); | |
| 331 | SDT_PROBE_DECLARE(mib, tcp, count, tcps_ecn_sndect1); | |
| 332 | ||
| 333 | SDT_PROBE_DECLARE(mib, tcp, count, tcps_tlpresends); | |
| 334 | SDT_PROBE_DECLARE(mib, tcp, count, tcps_tlpresend_bytes); | |
| 335 | ||
| 336 | SDT_PROBE_DECLARE(mib, tcp, count, tcps_rcvghostack); | |
| 337 | SDT_PROBE_DECLARE(mib, tcp, count, tcps_rcvacktooold); | |
| 338 | ||
| 339 | SDT_PROBE_DECLARE(mib, ipsec, count, ips_in_polvio); | |
| 340 | SDT_PROBE_DECLARE(mib, ipsec, count, ips_in_nomem); | |
| 341 | SDT_PROBE_DECLARE(mib, ipsec, count, ips_in_inval); | |
| 342 | SDT_PROBE_DECLARE(mib, ipsec, count, ips_out_polvio); | |
| 343 | SDT_PROBE_DECLARE(mib, ipsec, count, ips_out_nosa); | |
| 344 | SDT_PROBE_DECLARE(mib, ipsec, count, ips_out_nomem); | |
| 345 | SDT_PROBE_DECLARE(mib, ipsec, count, ips_out_noroute); | |
| 346 | SDT_PROBE_DECLARE(mib, ipsec, count, ips_out_inval); | |
| 347 | SDT_PROBE_DECLARE(mib, ipsec, count, ips_out_bundlesa); | |
| 348 | ||
| 349 | SDT_PROBE_DECLARE(mib, ipsec, count, ips_spdcache_hits); | |
| 350 | SDT_PROBE_DECLARE(mib, ipsec, count, ips_spdcache_misses); | |
| 351 | ||
| 352 | SDT_PROBE_DECLARE(mib, ipsec, count, ips_clcopied); | |
| 353 | SDT_PROBE_DECLARE(mib, ipsec, count, ips_mbinserted); | |
| 354 | SDT_PROBE_DECLARE(mib, ipsec, count, ips_input_front); | |
| 355 | SDT_PROBE_DECLARE(mib, ipsec, count, ips_input_middle); | |
| 356 | SDT_PROBE_DECLARE(mib, ipsec, count, ips_input_end); | |
| 357 | ||
| 358 | SDT_PROBE_DECLARE(mib, esp, count, esps_hdrops); | |
| 359 | SDT_PROBE_DECLARE(mib, esp, count, esps_nopf); | |
| 360 | SDT_PROBE_DECLARE(mib, esp, count, esps_notdb); | |
| 361 | SDT_PROBE_DECLARE(mib, esp, count, esps_badkcr); | |
| 362 | SDT_PROBE_DECLARE(mib, esp, count, esps_qfull); | |
| 363 | SDT_PROBE_DECLARE(mib, esp, count, esps_noxform); | |
| 364 | SDT_PROBE_DECLARE(mib, esp, count, esps_badilen); | |
| 365 | SDT_PROBE_DECLARE(mib, esp, count, esps_wrap); | |
| 366 | SDT_PROBE_DECLARE(mib, esp, count, esps_badenc); | |
| 367 | SDT_PROBE_DECLARE(mib, esp, count, esps_badauth); | |
| 368 | SDT_PROBE_DECLARE(mib, esp, count, esps_replay); | |
| 369 | SDT_PROBE_DECLARE(mib, esp, count, esps_input); | |
| 370 | SDT_PROBE_DECLARE(mib, esp, count, esps_output); | |
| 371 | SDT_PROBE_DECLARE(mib, esp, count, esps_invalid); | |
| 372 | SDT_PROBE_DECLARE(mib, esp, count, esps_ibytes); | |
| 373 | SDT_PROBE_DECLARE(mib, esp, count, esps_obytes); | |
| 374 | SDT_PROBE_DECLARE(mib, esp, count, esps_toobig); | |
| 375 | SDT_PROBE_DECLARE(mib, esp, count, esps_pdrops); | |
| 376 | SDT_PROBE_DECLARE(mib, esp, count, esps_crypto); | |
| 377 | SDT_PROBE_DECLARE(mib, esp, count, esps_tunnel); | |
| 378 | SDT_PROBE_DECLARE(mib, esp, count, esps_hist); | |
| 379 | ||
| 380 | SDT_PROBE_DECLARE(mib, ah, count, ahs_hdrops); | |
| 381 | SDT_PROBE_DECLARE(mib, ah, count, ahs_nopf); | |
| 382 | SDT_PROBE_DECLARE(mib, ah, count, ahs_notdb); | |
| 383 | SDT_PROBE_DECLARE(mib, ah, count, ahs_badkcr); | |
| 384 | SDT_PROBE_DECLARE(mib, ah, count, ahs_badauth); | |
| 385 | SDT_PROBE_DECLARE(mib, ah, count, ahs_noxform); | |
| 386 | SDT_PROBE_DECLARE(mib, ah, count, ahs_qfull); | |
| 387 | SDT_PROBE_DECLARE(mib, ah, count, ahs_wrap); | |
| 388 | SDT_PROBE_DECLARE(mib, ah, count, ahs_replay); | |
| 389 | SDT_PROBE_DECLARE(mib, ah, count, ahs_badauthl); | |
| 390 | SDT_PROBE_DECLARE(mib, ah, count, ahs_input); | |
| 391 | SDT_PROBE_DECLARE(mib, ah, count, ahs_output); | |
| 392 | SDT_PROBE_DECLARE(mib, ah, count, ahs_invalid); | |
| 393 | SDT_PROBE_DECLARE(mib, ah, count, ahs_ibytes); | |
| 394 | SDT_PROBE_DECLARE(mib, ah, count, ahs_obytes); | |
| 395 | SDT_PROBE_DECLARE(mib, ah, count, ahs_toobig); | |
| 396 | SDT_PROBE_DECLARE(mib, ah, count, ahs_pdrops); | |
| 397 | SDT_PROBE_DECLARE(mib, ah, count, ahs_crypto); | |
| 398 | SDT_PROBE_DECLARE(mib, ah, count, ahs_tunnel); | |
| 399 | SDT_PROBE_DECLARE(mib, ah, count, ahs_hist); | |
| 400 | ||
| 401 | SDT_PROBE_DECLARE(mib, ipcomp, count, ipcomps_hdrops); | |
| 402 | SDT_PROBE_DECLARE(mib, ipcomp, count, ipcomps_nopf); | |
| 403 | SDT_PROBE_DECLARE(mib, ipcomp, count, ipcomps_notdb); | |
| 404 | SDT_PROBE_DECLARE(mib, ipcomp, count, ipcomps_badkcr); | |
| 405 | SDT_PROBE_DECLARE(mib, ipcomp, count, ipcomps_qfull); | |
| 406 | SDT_PROBE_DECLARE(mib, ipcomp, count, ipcomps_noxform); | |
| 407 | SDT_PROBE_DECLARE(mib, ipcomp, count, ipcomps_wrap); | |
| 408 | SDT_PROBE_DECLARE(mib, ipcomp, count, ipcomps_input); | |
| 409 | SDT_PROBE_DECLARE(mib, ipcomp, count, ipcomps_output); | |
| 410 | SDT_PROBE_DECLARE(mib, ipcomp, count, ipcomps_invalid); | |
| 411 | SDT_PROBE_DECLARE(mib, ipcomp, count, ipcomps_ibytes); | |
| 412 | SDT_PROBE_DECLARE(mib, ipcomp, count, ipcomps_obytes); | |
| 413 | SDT_PROBE_DECLARE(mib, ipcomp, count, ipcomps_toobig); | |
| 414 | SDT_PROBE_DECLARE(mib, ipcomp, count, ipcomps_pdrops); | |
| 415 | SDT_PROBE_DECLARE(mib, ipcomp, count, ipcomps_crypto); | |
| 416 | SDT_PROBE_DECLARE(mib, ipcomp, count, ipcomps_hist); | |
| 417 | SDT_PROBE_DECLARE(mib, ipcomp, count, ipcomps_threshold); | |
| 418 | SDT_PROBE_DECLARE(mib, ipcomp, count, ipcomps_uncompr); | |
| 419 | ||
| 420 | #endif | |
| 421 | ||
| 55 | 422 | SDT_PROBE_DECLARE(ip, , , receive); |
| 56 | 423 | SDT_PROBE_DECLARE(ip, , , send); |
| 57 | 424 |
lib/libc/include/generic-freebsd/netinet/in_pcb.h+45-58| ... | ... | @@ -32,8 +32,6 @@ |
| 32 | 32 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 33 | 33 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 34 | 34 | * SUCH DAMAGE. |
| 35 | * | |
| 36 | *	@(#)in_pcb.h	8.1 (Berkeley) 6/10/93 | |
| 37 | 35 | */ |
| 38 | 36 | |
| 39 | 37 | #ifndef _NETINET_IN_PCB_H_ |
| ... | ... | @@ -66,7 +64,6 @@ |
| 66 | 64 | * protocol-specific control block) are stored here. |
| 67 | 65 | */ |
| 68 | 66 | CK_LIST_HEAD(inpcbhead, inpcb); |
| 69 | CK_LIST_HEAD(inpcbporthead, inpcbport); | |
| 70 | 67 | CK_LIST_HEAD(inpcblbgrouphead, inpcblbgroup); |
| 71 | 68 | typedef	uint64_t	inp_gen_t; |
| 72 | 69 | |
| ... | ... | @@ -135,8 +132,9 @@ struct in_conninfo { |
| 135 | 132 | /* |
| 136 | 133 | * struct inpcb captures the network layer state for TCP, UDP, and raw IPv4 and |
| 137 | 134 | * IPv6 sockets. In the case of TCP and UDP, further per-connection state is |
| 138 | * hung off of inp_ppcb most of the time. Almost all fields of struct inpcb | |
| 139 | * are static after creation or protected by a per-inpcb rwlock, inp_lock. | |
| 135 | * located in a larger protocol specific structure that embeds inpcb in it. | |
| 136 | * Almost all fields of struct inpcb are static after creation or protected by | |
| 137 | * a per-inpcb rwlock, inp_lock. | |
| 140 | 138 | * |
| 141 | 139 | * A inpcb database is indexed by addresses/ports hash as well as list of |
| 142 | 140 | * all pcbs that belong to a certain proto. Database lookups or list traversals |
| ... | ... | @@ -168,7 +166,10 @@ struct inpcbpolicy; |
| 168 | 166 | struct m_snd_tag; |
| 169 | 167 | struct inpcb { |
| 170 | 168 | 	/* Cache line #1 (amd64) */ |
| 171 | 	CK_LIST_ENTRY(inpcb) inp_hash_exact;	/* hash table linkage */ | |
| 169 | 	union { | |
| 170 | 		CK_LIST_ENTRY(inpcb) inp_hash_exact;	/* hash table linkage */ | |
| 171 | 		LIST_ENTRY(inpcb) inp_lbgroup_list;	/* lb group list */ | |
| 172 | 	}; | |
| 172 | 173 | 	CK_LIST_ENTRY(inpcb) inp_hash_wild;	/* hash table linkage */ |
| 173 | 174 | 	struct rwlock	inp_lock; |
| 174 | 175 | 	/* Cache line #2 (amd64) */ |
| ... | ... | @@ -179,7 +180,6 @@ struct inpcb { |
| 179 | 180 | 	int	inp_flags;		/* (i) generic IP/datagram flags */ |
| 180 | 181 | 	int	inp_flags2;		/* (i) generic IP/datagram flags #2*/ |
| 181 | 182 | 	uint8_t inp_numa_domain;	/* numa domain */ |
| 182 | 	void	*inp_ppcb;		/* (i) pointer to per-protocol pcb */ | |
| 183 | 183 | 	struct	socket *inp_socket;	/* (i) back pointer to socket */ |
| 184 | 184 | 	struct	inpcbinfo *inp_pcbinfo;	/* (c) PCB list info */ |
| 185 | 185 | 	struct	ucred	*inp_cred;	/* (c) cache of socket cred */ |
| ... | ... | @@ -220,7 +220,6 @@ struct inpcb { |
| 220 | 220 | 		short	in6p_hops; |
| 221 | 221 | 	}; |
| 222 | 222 | 	CK_LIST_ENTRY(inpcb) inp_portlist;	/* (r:e/w:h) port list */ |
| 223 | 	struct	inpcbport *inp_phd;	/* (r:e/w:h) head of this list */ | |
| 224 | 223 | 	inp_gen_t	inp_gencnt;	/* (c) generation count */ |
| 225 | 224 | 	void		*spare_ptr;	/* Spare pointer. */ |
| 226 | 225 | 	rt_gen_t	inp_rt_cookie;	/* generation for route entry */ |
| ... | ... | @@ -268,8 +267,7 @@ struct xinpcb { |
| 268 | 267 | 	struct xsocket	xi_socket;		/* (s,p) */ |
| 269 | 268 | 	struct in_conninfo inp_inc;		/* (s,p) */ |
| 270 | 269 | 	uint64_t	inp_gencnt;		/* (s,p) */ |
| 271 | 	kvaddr_t	inp_ppcb;		/* (s) netstat(1) */ | |
| 272 | 	int64_t		inp_spare64[4]; | |
| 270 | 	int64_t		inp_spare64[5]; | |
| 273 | 271 | 	uint32_t	inp_flow;		/* (s) */ |
| 274 | 272 | 	uint32_t	inp_flowid;		/* (s) */ |
| 275 | 273 | 	uint32_t	inp_flowtype;		/* (s) */ |
| ... | ... | @@ -305,6 +303,30 @@ struct sockopt_parameters { |
| 305 | 303 | 	char sop_optval[]; |
| 306 | 304 | }; |
| 307 | 305 | |
| 306 | #ifdef _SYS_KTLS_H_ | |
| 307 | struct xktls_session { | |
| 308 | 	uint32_t tsz;	/* total sz of elm, next elm is at this+tsz */ | |
| 309 | 	uint32_t fsz;	/* size of the struct up to keys */ | |
| 310 | 	uint64_t inp_gencnt; | |
| 311 | 	kvaddr_t so_pcb; | |
| 312 | 	struct in_conninfo coninf; | |
| 313 | 	u_short rx_vlan_id; | |
| 314 | 	struct xktls_session_onedir rcv; | |
| 315 | 	struct xktls_session_onedir snd; | |
| 316 | /* | |
| 317 | * Next are | |
| 318 | * - keydata for rcv, first cipher of length rcv.cipher_key_len, then | |
| 319 | * authentication of length rcv.auth_key_len; | |
| 320 | * - driver data (string) of length rcv.drv_st_len, if the rcv session is | |
| 321 | * offloaded to ifnet rcv.ifnet; | |
| 322 | * - keydata for snd, first cipher of length snd.cipher_key_len, then | |
| 323 | * authentication of length snd.auth_key_len; | |
| 324 | * - driver data (string) of length snd.drv_st_len, if the snd session is | |
| 325 | * offloaded to ifnet snd.ifnet; | |
| 326 | */ | |
| 327 | }; | |
| 328 | #endif /* _SYS_KTLS_H_ */ | |
| 329 | ||
| 308 | 330 | #ifdef	_KERNEL |
| 309 | 331 | int	sysctl_setsockopt(SYSCTL_HANDLER_ARGS, struct inpcbinfo *pcbinfo, |
| 310 | 332 | 	 int (*ctloutput_set)(struct inpcb *, struct sockopt *)); |
| ... | ... | @@ -370,7 +392,7 @@ struct inpcbinfo { |
| 370 | 392 | 	/* |
| 371 | 393 | 	 * Global hash of inpcbs, hashed by only local port number. |
| 372 | 394 | 	 */ |
| 373 | 	struct inpcbporthead	*ipi_porthashbase;	/* (h) */ | |
| 395 | 	struct inpcbhead	*ipi_porthashbase;	/* (h) */ | |
| 374 | 396 | 	u_long			 ipi_porthashmask;	/* (h) */ |
| 375 | 397 | |
| 376 | 398 | 	/* |
| ... | ... | @@ -392,11 +414,9 @@ struct inpcbinfo { |
| 392 | 414 | */ |
| 393 | 415 | struct inpcbstorage { |
| 394 | 416 | 	uma_zone_t	ips_zone; |
| 395 | 	uma_zone_t	ips_portzone; | |
| 396 | 417 | 	uma_init	ips_pcbinit; |
| 397 | 418 | 	size_t		ips_size; |
| 398 | 419 | 	const char *	ips_zone_name; |
| 399 | 	const char *	ips_portzone_name; | |
| 400 | 420 | 	const char *	ips_infolock_name; |
| 401 | 421 | 	const char *	ips_hashlock_name; |
| 402 | 422 | }; |
| ... | ... | @@ -414,7 +434,6 @@ static struct inpcbstorage prot = {					\ |
| 414 | 434 | 	.ips_size = sizeof(struct ppcb),				\ |
| 415 | 435 | 	.ips_pcbinit = prot##_inpcb_init,				\ |
| 416 | 436 | 	.ips_zone_name = zname,						\ |
| 417 | 	.ips_portzone_name = zname " ports",				\ | |
| 418 | 437 | 	.ips_infolock_name = iname,					\ |
| 419 | 438 | 	.ips_hashlock_name = hname,					\ |
| 420 | 439 | };									\ |
| ... | ... | @@ -423,28 +442,6 @@ SYSINIT(prot##_inpcbstorage_init, SI_SUB_PROTO_DOMAIN,			\ |
| 423 | 442 | SYSUNINIT(prot##_inpcbstorage_uninit, SI_SUB_PROTO_DOMAIN,		\ |
| 424 | 443 | SI_ORDER_SECOND, in_pcbstorage_destroy, &prot) |
| 425 | 444 | |
| 426 | /* | |
| 427 | * Load balance groups used for the SO_REUSEPORT_LB socket option. Each group | |
| 428 | * (or unique address:port combination) can be re-used at most | |
| 429 | * INPCBLBGROUP_SIZMAX (256) times. The inpcbs are stored in il_inp which | |
| 430 | * is dynamically resized as processes bind/unbind to that specific group. | |
| 431 | */ | |
| 432 | struct inpcblbgroup { | |
| 433 | 	CK_LIST_ENTRY(inpcblbgroup) il_list; | |
| 434 | 	struct epoch_context il_epoch_ctx; | |
| 435 | 	struct ucred	*il_cred; | |
| 436 | 	uint16_t	il_lport;			/* (c) */ | |
| 437 | 	u_char		il_vflag;			/* (c) */ | |
| 438 | 	uint8_t		il_numa_domain; | |
| 439 | 	uint32_t	il_pad2; | |
| 440 | 	union in_dependaddr il_dependladdr;		/* (c) */ | |
| 441 | #define	il_laddr	il_dependladdr.id46_addr.ia46_addr4 | |
| 442 | #define	il6_laddr	il_dependladdr.id6_addr | |
| 443 | 	uint32_t	il_inpsiz; /* max count in il_inp[] (h) */ | |
| 444 | 	uint32_t	il_inpcnt; /* cur count in il_inp[] (h) */ | |
| 445 | 	struct inpcb	*il_inp[];			/* (h) */ | |
| 446 | }; | |
| 447 | ||
| 448 | 445 | #define INP_LOCK_DESTROY(inp)	rw_destroy(&(inp)->inp_lock) |
| 449 | 446 | #define INP_RLOCK(inp)		rw_rlock(&(inp)->inp_lock) |
| 450 | 447 | #define INP_WLOCK(inp)		rw_wlock(&(inp)->inp_lock) |
| ... | ... | @@ -481,12 +478,8 @@ void inp_unlock_assert(struct inpcb *); |
| 481 | 478 | |
| 482 | 479 | void	inp_apply_all(struct inpcbinfo *, void (*func)(struct inpcb *, void *), |
| 483 | 480 | 	 void *arg); |
| 484 | int 	inp_ip_tos_get(const struct inpcb *inp); | |
| 485 | void 	inp_ip_tos_set(struct inpcb *inp, int val); | |
| 486 | 481 | struct socket * |
| 487 | 482 | 	inp_inpcbtosocket(struct inpcb *inp); |
| 488 | struct tcpcb * | |
| 489 | 	inp_inpcbtotcpcb(struct inpcb *inp); | |
| 490 | 483 | void 	inp_4tuple_get(struct inpcb *inp, uint32_t *laddr, uint16_t *lp, |
| 491 | 484 | 		uint32_t *faddr, uint16_t *fp); |
| 492 | 485 | |
| ... | ... | @@ -578,7 +571,7 @@ void 	inp_4tuple_get(struct inpcb *inp, uint32_t *laddr, uint16_t *lp, |
| 578 | 571 | #define	INP_DROPPED		0x04000000 /* protocol drop flag */ |
| 579 | 572 | #define	INP_SOCKREF		0x08000000 /* strong socket reference */ |
| 580 | 573 | #define	INP_RESERVED_0 0x10000000 /* reserved field */ |
| 581 | #define	INP_RESERVED_1 0x20000000 /* reserved field */ | |
| 574 | #define	INP_BOUNDFIB		0x20000000 /* Bound to a specific FIB. */ | |
| 582 | 575 | #define	IN6P_RFC2292		0x40000000 /* used RFC2292 API on the socket */ |
| 583 | 576 | #define	IN6P_MTU		0x80000000 /* receive path MTU */ |
| 584 | 577 | |
| ... | ... | @@ -624,10 +617,11 @@ typedef	enum { |
| 624 | 617 | 	INPLOOKUP_WILDCARD = 0x00000001,	/* Allow wildcard sockets. */ |
| 625 | 618 | 	INPLOOKUP_RLOCKPCB = 0x00000002,	/* Return inpcb read-locked. */ |
| 626 | 619 | 	INPLOOKUP_WLOCKPCB = 0x00000004,	/* Return inpcb write-locked. */ |
| 620 | 	INPLOOKUP_FIB = 0x00000008,		/* inp must be from same FIB. */ | |
| 627 | 621 | } inp_lookup_t; |
| 628 | 622 | |
| 629 | 623 | #define	INPLOOKUP_MASK	(INPLOOKUP_WILDCARD | INPLOOKUP_RLOCKPCB | \ |
| 630 | 	 INPLOOKUP_WLOCKPCB) | |
| 624 | 	 INPLOOKUP_WLOCKPCB | INPLOOKUP_FIB) | |
| 631 | 625 | #define	INPLOOKUP_LOCKMASK	(INPLOOKUP_RLOCKPCB | INPLOOKUP_WLOCKPCB) |
| 632 | 626 | |
| 633 | 627 | #define	sotoinpcb(so)	((struct inpcb *)(so)->so_pcb) |
| ... | ... | @@ -665,34 +659,29 @@ void	in_pcbstorage_destroy(void *); |
| 665 | 659 | |
| 666 | 660 | void	in_pcbpurgeif0(struct inpcbinfo *, struct ifnet *); |
| 667 | 661 | int	in_pcballoc(struct socket *, struct inpcbinfo *); |
| 668 | int	in_pcbbind(struct inpcb *, struct sockaddr_in *, struct ucred *); | |
| 662 | #define	INPBIND_FIB	0x0001	/* bind to the PCB's FIB only */ | |
| 663 | int	in_pcbbind(struct inpcb *, struct sockaddr_in *, int, struct ucred *); | |
| 669 | 664 | int	in_pcbbind_setup(struct inpcb *, struct sockaddr_in *, in_addr_t *, |
| 670 | 	 u_short *, struct ucred *); | |
| 671 | int	in_pcbconnect(struct inpcb *, struct sockaddr_in *, struct ucred *, | |
| 672 | 	 bool); | |
| 673 | int	in_pcbconnect_setup(struct inpcb *, struct sockaddr_in *, in_addr_t *, | |
| 674 | 	 u_short *, in_addr_t *, u_short *, struct ucred *); | |
| 665 | 	 u_short *, int, struct ucred *); | |
| 666 | int	in_pcbconnect(struct inpcb *, struct sockaddr_in *, struct ucred *); | |
| 675 | 667 | void	in_pcbdisconnect(struct inpcb *); |
| 676 | 668 | void	in_pcbdrop(struct inpcb *); |
| 677 | 669 | void	in_pcbfree(struct inpcb *); |
| 678 | int	in_pcbinshash(struct inpcb *); | |
| 679 | int	in_pcbladdr(struct inpcb *, struct in_addr *, struct in_addr *, | |
| 670 | int	in_pcbladdr(const struct inpcb *, struct in_addr *, struct in_addr *, | |
| 680 | 671 | 	 struct ucred *); |
| 681 | 672 | int	in_pcblbgroup_numa(struct inpcb *, int arg); |
| 673 | void	in_pcblisten(struct inpcb *); | |
| 682 | 674 | struct inpcb * |
| 683 | 675 | 	in_pcblookup(struct inpcbinfo *, struct in_addr, u_int, |
| 684 | 676 | 	 struct in_addr, u_int, int, struct ifnet *); |
| 685 | 677 | struct inpcb * |
| 686 | 678 | 	in_pcblookup_mbuf(struct inpcbinfo *, struct in_addr, u_int, |
| 687 | 679 | 	 struct in_addr, u_int, int, struct ifnet *, struct mbuf *); |
| 688 | void	in_pcbnotifyall(struct inpcbinfo *pcbinfo, struct in_addr, | |
| 689 | 	 int, struct inpcb *(*)(struct inpcb *, int)); | |
| 690 | 680 | void	in_pcbref(struct inpcb *); |
| 691 | void	in_pcbrehash(struct inpcb *); | |
| 692 | void	in_pcbremhash_locked(struct inpcb *); | |
| 693 | 681 | bool	in_pcbrele(struct inpcb *, inp_lookup_t); |
| 694 | 682 | bool	in_pcbrele_rlocked(struct inpcb *); |
| 695 | 683 | bool	in_pcbrele_wlocked(struct inpcb *); |
| 684 | bool	in_pcbrele_rlock(struct inpcb *inp); | |
| 696 | 685 | |
| 697 | 686 | typedef bool inp_match_t(const struct inpcb *, void *); |
| 698 | 687 | struct inpcb_iterator { |
| ... | ... | @@ -724,10 +713,8 @@ struct inpcb_iterator { |
| 724 | 713 | struct inpcb *inp_next(struct inpcb_iterator *); |
| 725 | 714 | void	in_losing(struct inpcb *); |
| 726 | 715 | void	in_pcbsetsolabel(struct socket *so); |
| 727 | int	in_getpeeraddr(struct socket *so, struct sockaddr **nam); | |
| 728 | int	in_getsockaddr(struct socket *so, struct sockaddr **nam); | |
| 729 | struct sockaddr * | |
| 730 | 	in_sockaddr(in_port_t port, struct in_addr *addr); | |
| 716 | int	in_getpeeraddr(struct socket *, struct sockaddr *sa); | |
| 717 | int	in_getsockaddr(struct socket *, struct sockaddr *sa); | |
| 731 | 718 | void	in_pcbsosetlabel(struct socket *so); |
| 732 | 719 | #ifdef RATELIMIT |
| 733 | 720 | int |
lib/libc/include/generic-freebsd/netinet/in_pcb_var.h+28-9| ... | ... | @@ -32,8 +32,6 @@ |
| 32 | 32 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 33 | 33 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 34 | 34 | * SUCH DAMAGE. |
| 35 | * | |
| 36 | *	@(#)in_pcb.h	8.1 (Berkeley) 6/10/93 | |
| 37 | 35 | */ |
| 38 | 36 | |
| 39 | 37 | #ifndef _NETINET_IN_PCB_VAR_H_ |
| ... | ... | @@ -52,16 +50,37 @@ int	inp_trylock(struct inpcb *inp, const inp_lookup_t lock); |
| 52 | 50 | bool	inp_smr_lock(struct inpcb *, const inp_lookup_t); |
| 53 | 51 | int	in_pcb_lport(struct inpcb *, struct in_addr *, u_short *, |
| 54 | 52 | 	 struct ucred *, int); |
| 55 | int	in_pcb_lport_dest(struct inpcb *inp, struct sockaddr *lsa, | |
| 53 | int	in_pcb_lport_dest(const struct inpcb *inp, struct sockaddr *lsa, | |
| 56 | 54 | u_short *lportp, struct sockaddr *fsa, u_short fport, |
| 57 | 55 | struct ucred *cred, int lookupflags); |
| 58 | struct inpcb *	in_pcblookup_local(struct inpcbinfo *, struct in_addr, u_short, | |
| 59 | 	 int, struct ucred *); | |
| 56 | struct inpcb *in_pcblookup_local(struct inpcbinfo *, struct in_addr, u_short, | |
| 57 | 	 int, int, struct ucred *); | |
| 58 | int in_pcbinshash(struct inpcb *); | |
| 59 | void in_pcbrehash(struct inpcb *); | |
| 60 | void in_pcbremhash_locked(struct inpcb *); | |
| 60 | 61 | |
| 61 | struct inpcbport { | |
| 62 | 	struct inpcbhead phd_pcblist; | |
| 63 | 	CK_LIST_ENTRY(inpcbport) phd_hash; | |
| 64 | 	u_short phd_port; | |
| 62 | /* | |
| 63 | * Load balance groups used for the SO_REUSEPORT_LB socket option. Each group | |
| 64 | * (or unique address:port combination) can be re-used at most | |
| 65 | * INPCBLBGROUP_SIZMAX (256) times. The inpcbs are stored in il_inp which | |
| 66 | * is dynamically resized as processes bind/unbind to that specific group. | |
| 67 | */ | |
| 68 | struct inpcblbgroup { | |
| 69 | 	CK_LIST_ENTRY(inpcblbgroup) il_list; | |
| 70 | 	LIST_HEAD(, inpcb) il_pending;	/* PCBs waiting for listen() */ | |
| 71 | 	struct epoch_context il_epoch_ctx; | |
| 72 | 	struct ucred	*il_cred; | |
| 73 | 	uint16_t	il_lport;			/* (c) */ | |
| 74 | 	u_char		il_vflag;			/* (c) */ | |
| 75 | 	uint8_t		il_numa_domain; | |
| 76 | 	int		il_fibnum; | |
| 77 | 	union in_dependaddr il_dependladdr;		/* (c) */ | |
| 78 | #define	il_laddr	il_dependladdr.id46_addr.ia46_addr4 | |
| 79 | #define	il6_laddr	il_dependladdr.id6_addr | |
| 80 | 	uint32_t	il_inpsiz; /* max count in il_inp[] (h) */ | |
| 81 | 	uint32_t	il_inpcnt; /* cur count in il_inp[] (h) */ | |
| 82 | 	uint32_t	il_pendcnt; /* cur count in il_pending (h) */ | |
| 83 | 	struct inpcb	*il_inp[];			/* (h) */ | |
| 65 | 84 | }; |
| 66 | 85 | |
| 67 | 86 | #endif /* !_NETINET_IN_PCB_VAR_H_ */ |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/netinet/in_systm.h+4-2| ... | ... | @@ -27,13 +27,13 @@ |
| 27 | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | * | |
| 31 | *	@(#)in_systm.h	8.1 (Berkeley) 6/10/93 | |
| 32 | 30 | */ |
| 33 | 31 | |
| 34 | 32 | #ifndef _NETINET_IN_SYSTM_H_ |
| 35 | 33 | #define _NETINET_IN_SYSTM_H_ |
| 36 | 34 | |
| 35 | #include <sys/types.h> | |
| 36 | ||
| 37 | 37 | /* |
| 38 | 38 | * Miscellaneous internetwork |
| 39 | 39 | * definitions for kernel. |
| ... | ... | @@ -58,8 +58,10 @@ typedef	u_int32_t n_time;		/* ms since 00:00 UTC, byte rev */ |
| 58 | 58 | #ifdef _KERNEL |
| 59 | 59 | struct inpcb; |
| 60 | 60 | struct ucred; |
| 61 | struct thread; | |
| 61 | 62 | |
| 62 | 63 | int	cr_canseeinpcb(struct ucred *cred, struct inpcb *inp); |
| 64 | bool	cr_canexport_ktlskeys(struct thread *td, struct inpcb *inp); | |
| 63 | 65 | |
| 64 | 66 | uint32_t	 iptime(void); |
| 65 | 67 | #endif |
lib/libc/include/generic-freebsd/netinet/in_var.h+6-2| ... | ... | @@ -27,8 +27,6 @@ |
| 27 | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | * | |
| 31 | *	@(#)in_var.h	8.2 (Berkeley) 1/9/95 | |
| 32 | 30 | */ |
| 33 | 31 | |
| 34 | 32 | #ifndef _NETINET_IN_VAR_H_ |
| ... | ... | @@ -99,6 +97,11 @@ struct in_ifaddr { |
| 99 | 97 | #define IN_LNAOF(in, ifa) \ |
| 100 | 98 | 	((ntohl((in).s_addr) & ~((struct in_ifaddr *)(ifa)->ia_subnetmask)) |
| 101 | 99 | |
| 100 | #ifdef _KERNEL | |
| 101 | #define IN_ARE_MASKED_ADDR_EQUAL(d, a, m)	(		\ | |
| 102 | 	((((d).s_addr ^ (a).s_addr) & (m).s_addr)) == 0 ) | |
| 103 | #endif | |
| 104 | ||
| 102 | 105 | #define LLTABLE(ifp)	\ |
| 103 | 106 | 	((struct in_ifinfo *)(ifp)->if_afdata[AF_INET])->ii_llt |
| 104 | 107 | /* |
| ... | ... | @@ -456,6 +459,7 @@ int	in_joingroup_locked(struct ifnet *, const struct in_addr *, |
| 456 | 459 | int	in_leavegroup(struct in_multi *, /*const*/ struct in_mfilter *); |
| 457 | 460 | int	in_leavegroup_locked(struct in_multi *, |
| 458 | 461 | 	 /*const*/ struct in_mfilter *); |
| 462 | int	in_mask2len(struct in_addr *); | |
| 459 | 463 | int	in_control(struct socket *, u_long, void *, struct ifnet *, |
| 460 | 464 | 	 struct thread *); |
| 461 | 465 | int	in_control_ioctl(u_long, void *, struct ifnet *, |
lib/libc/include/generic-freebsd/netinet/ip.h+4-5| ... | ... | @@ -28,14 +28,13 @@ |
| 28 | 28 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 29 | 29 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 30 | 30 | * SUCH DAMAGE. |
| 31 | * | |
| 32 | *	@(#)ip.h	8.2 (Berkeley) 6/1/94 | |
| 33 | 31 | */ |
| 34 | 32 | |
| 35 | 33 | #ifndef _NETINET_IP_H_ |
| 36 | 34 | #define	_NETINET_IP_H_ |
| 37 | 35 | |
| 38 | #include <sys/cdefs.h> | |
| 36 | #include <sys/types.h> | |
| 37 | #include <netinet/in.h> | |
| 39 | 38 | |
| 40 | 39 | /* |
| 41 | 40 | * Definitions for internet protocol version 4. |
| ... | ... | @@ -68,7 +67,7 @@ struct ip { |
| 68 | 67 | 	u_char	ip_p;			/* protocol */ |
| 69 | 68 | 	u_short	ip_sum;			/* checksum */ |
| 70 | 69 | 	struct	in_addr ip_src,ip_dst;	/* source and dest address */ |
| 71 | } __packed __aligned(2); | |
| 70 | } __packed; | |
| 72 | 71 | |
| 73 | 72 | #define	IP_MAXPACKET	65535		/* maximum packet size */ |
| 74 | 73 | |
| ... | ... | @@ -188,7 +187,7 @@ struct	ip_timestamp { |
| 188 | 187 | 			uint32_t ipt_time;	/* network format */ |
| 189 | 188 | 		} ipt_ta[1]; |
| 190 | 189 | 	} ipt_timestamp; |
| 191 | }; | |
| 190 | } __packed; | |
| 192 | 191 | |
| 193 | 192 | /* Flag bits for ipt_flg. */ |
| 194 | 193 | #define	IPOPT_TS_TSONLY		0		/* timestamps only */ |
lib/libc/include/generic-freebsd/netinet/ip6.h-2| ... | ... | @@ -58,8 +58,6 @@ |
| 58 | 58 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 59 | 59 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 60 | 60 | * SUCH DAMAGE. |
| 61 | * | |
| 62 | *	@(#)ip.h	8.1 (Berkeley) 6/10/93 | |
| 63 | 61 | */ |
| 64 | 62 | |
| 65 | 63 | #ifndef _NETINET_IP6_H_ |
lib/libc/include/generic-freebsd/netinet/ip_carp.h+51-4| ... | ... | @@ -31,6 +31,7 @@ |
| 31 | 31 | #ifndef _IP_CARP_H |
| 32 | 32 | #define	_IP_CARP_H |
| 33 | 33 | |
| 34 | #ifdef _KERNEL | |
| 34 | 35 | /* |
| 35 | 36 | * The CARP header layout is as follows: |
| 36 | 37 | * |
| ... | ... | @@ -77,14 +78,53 @@ struct carp_header { |
| 77 | 78 | 	unsigned char	carp_md[20];	/* SHA1 HMAC */ |
| 78 | 79 | } __packed; |
| 79 | 80 | |
| 80 | #ifdef CTASSERT | |
| 81 | 81 | CTASSERT(sizeof(struct carp_header) == 36); |
| 82 | ||
| 83 | /* | |
| 84 | * The VRRPv3 header layout is as follows: | |
| 85 | * See RFC9568, 5.1. VRRP Packet Format | |
| 86 | * | |
| 87 | * 0 1 2 3 | |
| 88 | * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 | |
| 89 | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | |
| 90 | * |Version| Type | Virtual Rtr ID| Priority |Count IPvX Addr| | |
| 91 | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | |
| 92 | * |(rsvd) | Max Adver Int | Checksum | | |
| 93 | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | |
| 94 | * | | | |
| 95 | * + + | |
| 96 | * | IPvX Address(es) | | |
| 97 | * + + | |
| 98 | * + + | |
| 99 | * + + | |
| 100 | * + + | |
| 101 | * | | | |
| 102 | * + + | |
| 103 | * | | | |
| 104 | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | |
| 105 | * | |
| 106 | */ | |
| 107 | ||
| 108 | struct vrrpv3_header { | |
| 109 | #if BYTE_ORDER == LITTLE_ENDIAN | |
| 110 | 	uint8_t		vrrp_type:4, | |
| 111 | 			vrrp_version:4; | |
| 112 | #endif | |
| 113 | #if BYTE_ORDER == BIG_ENDIAN | |
| 114 | 	uint8_t		vrrp_version:4, | |
| 115 | 			vrrp_type:4; | |
| 82 | 116 | #endif |
| 117 | 	uint8_t		vrrp_vrtid; | |
| 118 | 	uint8_t		vrrp_priority; | |
| 119 | 	uint8_t		vrrp_count_addr; | |
| 120 | 	uint16_t	vrrp_max_adver_int; | |
| 121 | 	uint16_t	vrrp_checksum; | |
| 122 | } __packed; | |
| 83 | 123 | |
| 84 | #define	CARP_DFLTTL		255 | |
| 124 | CTASSERT(sizeof(struct vrrpv3_header) == 8); | |
| 125 | #endif /* _KERNEL */ | |
| 85 | 126 | |
| 86 | /* carp_version */ | |
| 87 | #define	CARP_VERSION		2 | |
| 127 | #define	CARP_DFLTTL		255 | |
| 88 | 128 | |
| 89 | 129 | /* carp_type */ |
| 90 | 130 | #define	CARP_ADVERTISEMENT	0x01 |
| ... | ... | @@ -94,6 +134,8 @@ CTASSERT(sizeof(struct carp_header) == 36); |
| 94 | 134 | /* carp_advbase */ |
| 95 | 135 | #define	CARP_DFLTINTV		1 |
| 96 | 136 | |
| 137 | #define	VRRP_TYPE_ADVERTISEMENT	0x01 | |
| 138 | #define	VRRP_MAX_INTERVAL	(0x1000 - 1) | |
| 97 | 139 | /* |
| 98 | 140 | * Statistics. |
| 99 | 141 | */ |
| ... | ... | @@ -136,6 +178,11 @@ struct carpreq { |
| 136 | 178 | #define	SIOCSVH	_IOWR('i', 245, struct ifreq) |
| 137 | 179 | #define	SIOCGVH	_IOWR('i', 246, struct ifreq) |
| 138 | 180 | |
| 181 | typedef enum carp_version { | |
| 182 | 	CARP_VERSION_CARP	= 2, | |
| 183 | 	CARP_VERSION_VRRPv3	= 3, | |
| 184 | } carp_version_t; | |
| 185 | ||
| 139 | 186 | #ifdef _KERNEL |
| 140 | 187 | int		carp_ioctl(struct ifreq *, u_long, struct thread *); |
| 141 | 188 | int		carp_attach(struct ifaddr *, int); |
lib/libc/include/generic-freebsd/netinet/ip_carp_nl.h+3| ... | ... | @@ -32,6 +32,9 @@ enum carp_nl_type_t { |
| 32 | 32 | 	CARP_NL_ADDR		= 7,	/* in_addr_t */ |
| 33 | 33 | 	CARP_NL_ADDR6		= 8,	/* in6_addr_t */ |
| 34 | 34 | 	CARP_NL_IFNAME		= 9,	/* string */ |
| 35 | 	CARP_NL_VERSION		= 10,	/* u8 */ | |
| 36 | 	CARP_NL_VRRP_PRIORITY	= 11,	/* u8 */ | |
| 37 | 	CARP_NL_VRRP_ADV_INTER	= 12,	/* u16, 12-bit field in centiseconds*/ | |
| 35 | 38 | }; |
| 36 | 39 | |
| 37 | 40 | #endif |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/netinet/ip_compat.h+4-12| ... | ... | @@ -2,8 +2,6 @@ |
| 2 | 2 | * Copyright (C) 2012 by Darren Reed. |
| 3 | 3 | * |
| 4 | 4 | * See the IPFILTER.LICENCE file for details on licencing. |
| 5 | * | |
| 6 | * @(#)ip_compat.h	1.8 1/14/96 | |
| 7 | 5 | * Id: ip_compat.h,v 2.142.2.57 2007/10/10 09:51:42 darrenr Exp $ |
| 8 | 6 | */ |
| 9 | 7 | |
| ... | ... | @@ -689,12 +687,6 @@ typedef	struct	tcpiphdr	tcpiphdr_t; |
| 689 | 687 | #ifndef	IP_HL_A |
| 690 | 688 | # define	IP_HL_A(x,y)	(x)->ip_hl = ((y) & 0xf) |
| 691 | 689 | #endif |
| 692 | #ifndef	TCP_X2 | |
| 693 | # define	TCP_X2(x)	(x)->th_x2 | |
| 694 | #endif | |
| 695 | #ifndef	TCP_X2_A | |
| 696 | # define	TCP_X2_A(x,y)	(x)->th_x2 = (y) | |
| 697 | #endif | |
| 698 | 690 | #ifndef	TCP_OFF |
| 699 | 691 | # define	TCP_OFF(x)	(x)->th_off |
| 700 | 692 | #endif |
| ... | ... | @@ -703,9 +695,6 @@ typedef	struct	tcpiphdr	tcpiphdr_t; |
| 703 | 695 | #endif |
| 704 | 696 | #define	IPMINLEN(i, h)	((i)->ip_len >= (IP_HL(i) * 4 + sizeof(struct h))) |
| 705 | 697 | |
| 706 | #define	TCPF_ALL	(TH_FIN|TH_SYN|TH_RST|TH_PUSH|TH_ACK|TH_URG|\ | |
| 707 | 			 TH_ECN|TH_CWR) | |
| 708 | ||
| 709 | 698 | #if !SOLARIS && !defined(m_act) |
| 710 | 699 | # define	m_act	m_nextpkt |
| 711 | 700 | #endif |
| ... | ... | @@ -1136,7 +1125,10 @@ typedef	struct	tcpiphdr	tcpiphdr_t; |
| 1136 | 1125 | #ifndef TH_CWR |
| 1137 | 1126 | # define	TH_CWR	0x80 |
| 1138 | 1127 | #endif |
| 1139 | #define	TH_ECNALL	(TH_ECN|TH_CWR) | |
| 1128 | #ifndef TH_AE | |
| 1129 | # define	TH_AE	0x100 | |
| 1130 | #endif | |
| 1131 | #define	TH_ECNALL	(TH_ECN|TH_CWR|TH_AE) | |
| 1140 | 1132 | |
| 1141 | 1133 | /* |
| 1142 | 1134 | * TCP States |
lib/libc/include/generic-freebsd/netinet/ip_dummynet.h+2-1| ... | ... | @@ -145,7 +145,7 @@ struct dn_fs { |
| 145 | 145 | 	uint32_t fs_nr;		/* the flowset number */ |
| 146 | 146 | 	uint32_t flags;		/* userland flags */ |
| 147 | 147 | 	int qsize;		/* queue size in slots or bytes */ |
| 148 | 	int32_t plr;		/* PLR, pkt loss rate (2^31-1 means 100%) */ | |
| 148 | 	int32_t pl_state;	/* packet loss state */ | |
| 149 | 149 | 	uint32_t buckets;	/* buckets used for the queue hash table */ |
| 150 | 150 | |
| 151 | 151 | 	struct ipfw_flow_id flow_mask; |
| ... | ... | @@ -168,6 +168,7 @@ struct dn_fs { |
| 168 | 168 | 	int min_th ;		/* minimum threshold for queue (scaled) */ |
| 169 | 169 | 	int max_p ;		/* maximum value for p_b (scaled) */ |
| 170 | 170 | |
| 171 | 	int32_t plr[4];		/* PLR, pkt loss rate (2^31-1 means 100%) */ | |
| 171 | 172 | }; |
| 172 | 173 | |
| 173 | 174 | /* |
lib/libc/include/generic-freebsd/netinet/ip_fil.h-2| ... | ... | @@ -2,8 +2,6 @@ |
| 2 | 2 | * Copyright (C) 2012 by Darren Reed. |
| 3 | 3 | * |
| 4 | 4 | * See the IPFILTER.LICENCE file for details on licencing. |
| 5 | * | |
| 6 | * @(#)ip_fil.h	1.35 6/5/96 | |
| 7 | 5 | * Id: ip_fil.h,v 2.170.2.51 2007/10/10 09:48:03 darrenr Exp $ |
| 8 | 6 | */ |
| 9 | 7 |
lib/libc/include/generic-freebsd/netinet/ip_frag.h-2| ... | ... | @@ -2,8 +2,6 @@ |
| 2 | 2 | * Copyright (C) 2012 by Darren Reed. |
| 3 | 3 | * |
| 4 | 4 | * See the IPFILTER.LICENCE file for details on licencing. |
| 5 | * | |
| 6 | * @(#)ip_frag.h	1.5 3/24/96 | |
| 7 | 5 | * Id: ip_frag.h,v 2.23.2.1 2004/03/29 16:21:56 darrenr Exp |
| 8 | 6 | */ |
| 9 | 7 |
lib/libc/include/generic-freebsd/netinet/ip_fw.h+251-176| ... | ... | @@ -75,6 +75,10 @@ typedef struct _ip_fw3_opheader { |
| 75 | 75 | 	uint16_t reserved[2];	/* Align to 64-bit boundary */ |
| 76 | 76 | } ip_fw3_opheader; |
| 77 | 77 | |
| 78 | #define	IP_FW3_OPVER_0		0 | |
| 79 | #define	IP_FW3_OPVER_1		1	/* 32bit rulenum */ | |
| 80 | #define	IP_FW3_OPVER		IP_FW3_OPVER_1 | |
| 81 | ||
| 78 | 82 | /* IP_FW3 opcodes */ |
| 79 | 83 | #define	IP_FW_TABLE_XADD	86	/* add entry */ |
| 80 | 84 | #define	IP_FW_TABLE_XDEL	87	/* delete entry */ |
| ... | ... | @@ -109,6 +113,7 @@ typedef struct _ip_fw3_opheader { |
| 109 | 113 | |
| 110 | 114 | #define	IP_FW_DUMP_SOPTCODES	116	/* Dump available sopts/versions */ |
| 111 | 115 | #define	IP_FW_DUMP_SRVOBJECTS	117	/* Dump existing named objects */ |
| 116 | #define	IP_FW_SKIPTO_CACHE	118	/* Manage skipto cache */ | |
| 112 | 117 | |
| 113 | 118 | #define	IP_FW_NAT64STL_CREATE	130	/* Create stateless NAT64 instance */ |
| 114 | 119 | #define	IP_FW_NAT64STL_DESTROY	131	/* Destroy stateless NAT64 instance */ |
| ... | ... | @@ -162,162 +167,153 @@ typedef struct _ip_fw3_opheader { |
| 162 | 167 | */ |
| 163 | 168 | |
| 164 | 169 | enum ipfw_opcodes {		/* arguments (4 byte each)	*/ |
| 165 | 	O_NOP, | |
| 166 | ||
| 167 | 	O_IP_SRC,		/* u32 = IP			*/ | |
| 168 | 	O_IP_SRC_MASK,		/* ip = IP/mask			*/ | |
| 169 | 	O_IP_SRC_ME,		/* none				*/ | |
| 170 | 	O_IP_SRC_SET,		/* u32=base, arg1=len, bitmap	*/ | |
| 171 | ||
| 172 | 	O_IP_DST,		/* u32 = IP			*/ | |
| 173 | 	O_IP_DST_MASK,		/* ip = IP/mask			*/ | |
| 174 | 	O_IP_DST_ME,		/* none				*/ | |
| 175 | 	O_IP_DST_SET,		/* u32=base, arg1=len, bitmap	*/ | |
| 176 | ||
| 177 | 	O_IP_SRCPORT,		/* (n)port list:mask 4 byte ea	*/ | |
| 178 | 	O_IP_DSTPORT,		/* (n)port list:mask 4 byte ea	*/ | |
| 179 | 	O_PROTO,		/* arg1=protocol		*/ | |
| 180 | ||
| 181 | 	O_MACADDR2,		/* 2 mac addr:mask		*/ | |
| 182 | 	O_MAC_TYPE,		/* same as srcport		*/ | |
| 183 | ||
| 184 | 	O_LAYER2,		/* none				*/ | |
| 185 | 	O_IN,			/* none				*/ | |
| 186 | 	O_FRAG,			/* none				*/ | |
| 187 | ||
| 188 | 	O_RECV,			/* none				*/ | |
| 189 | 	O_XMIT,			/* none				*/ | |
| 190 | 	O_VIA,			/* none				*/ | |
| 191 | ||
| 192 | 	O_IPOPT,		/* arg1 = 2*u8 bitmap		*/ | |
| 193 | 	O_IPLEN,		/* arg1 = len			*/ | |
| 194 | 	O_IPID,			/* arg1 = id			*/ | |
| 195 | ||
| 196 | 	O_IPTOS,		/* arg1 = id			*/ | |
| 197 | 	O_IPPRECEDENCE,		/* arg1 = precedence << 5	*/ | |
| 198 | 	O_IPTTL,		/* arg1 = TTL			*/ | |
| 199 | ||
| 200 | 	O_IPVER,		/* arg1 = version		*/ | |
| 201 | 	O_UID,			/* u32 = id			*/ | |
| 202 | 	O_GID,			/* u32 = id			*/ | |
| 203 | 	O_ESTAB,		/* none (tcp established)	*/ | |
| 204 | 	O_TCPFLAGS,		/* arg1 = 2*u8 bitmap		*/ | |
| 205 | 	O_TCPWIN,		/* arg1 = desired win		*/ | |
| 206 | 	O_TCPSEQ,		/* u32 = desired seq.		*/ | |
| 207 | 	O_TCPACK,		/* u32 = desired seq.		*/ | |
| 208 | 	O_ICMPTYPE,		/* u32 = icmp bitmap		*/ | |
| 209 | 	O_TCPOPTS,		/* arg1 = 2*u8 bitmap		*/ | |
| 210 | ||
| 211 | 	O_VERREVPATH,		/* none				*/ | |
| 212 | 	O_VERSRCREACH,		/* none				*/ | |
| 213 | ||
| 214 | 	O_PROBE_STATE,		/* none				*/ | |
| 215 | 	O_KEEP_STATE,		/* none				*/ | |
| 216 | 	O_LIMIT,		/* ipfw_insn_limit		*/ | |
| 217 | 	O_LIMIT_PARENT,		/* dyn_type, not an opcode.	*/ | |
| 170 | 	O_NOP		= 0, | |
| 171 | ||
| 172 | 	O_IP_SRC	= 1,	/* u32 = IP			*/ | |
| 173 | 	O_IP_SRC_MASK	= 2,	/* ip = IP/mask			*/ | |
| 174 | 	O_IP_SRC_ME	= 3,	/* none				*/ | |
| 175 | 	O_IP_SRC_SET	= 4,	/* u32=base, arg1=len, bitmap	*/ | |
| 176 | ||
| 177 | 	O_IP_DST	= 5,	/* u32 = IP			*/ | |
| 178 | 	O_IP_DST_MASK	= 6,	/* ip = IP/mask			*/ | |
| 179 | 	O_IP_DST_ME	= 7,	/* none				*/ | |
| 180 | 	O_IP_DST_SET	= 8,	/* u32=base, arg1=len, bitmap	*/ | |
| 181 | ||
| 182 | 	O_IP_SRCPORT	= 9,	/* (n)port list:mask 4 byte ea	*/ | |
| 183 | 	O_IP_DSTPORT	= 10,	/* (n)port list:mask 4 byte ea	*/ | |
| 184 | 	O_PROTO		= 11,	/* arg1=protocol		*/ | |
| 185 | ||
| 186 | 	O_MACADDR2	= 12,	/* 2 mac addr:mask		*/ | |
| 187 | 	O_MAC_TYPE	= 13,	/* same as srcport		*/ | |
| 188 | ||
| 189 | 	O_LAYER2	= 14,	/* none				*/ | |
| 190 | 	O_IN		= 15,	/* none				*/ | |
| 191 | 	O_FRAG		= 16,	/* none				*/ | |
| 192 | ||
| 193 | 	O_RECV		= 17,	/* none				*/ | |
| 194 | 	O_XMIT		= 18,	/* none				*/ | |
| 195 | 	O_VIA		= 19,	/* none				*/ | |
| 196 | ||
| 197 | 	O_IPOPT		= 20,	/* arg1 = 2*u8 bitmap		*/ | |
| 198 | 	O_IPLEN		= 21,	/* arg1 = len			*/ | |
| 199 | 	O_IPID		= 22,	/* arg1 = id			*/ | |
| 200 | ||
| 201 | 	O_IPTOS		= 23,	/* arg1 = id			*/ | |
| 202 | 	O_IPPRECEDENCE	= 24,	/* arg1 = precedence << 5	*/ | |
| 203 | 	O_IPTTL		= 25,	/* arg1 = TTL			*/ | |
| 204 | ||
| 205 | 	O_IPVER		= 26,	/* arg1 = version		*/ | |
| 206 | 	O_UID		= 27,	/* u32 = id			*/ | |
| 207 | 	O_GID		= 28,	/* u32 = id			*/ | |
| 208 | 	O_ESTAB		= 29,	/* none (tcp established)	*/ | |
| 209 | 	O_TCPFLAGS	= 30,	/* arg1 = 2*u8 bitmap		*/ | |
| 210 | 	O_TCPWIN	= 31,	/* arg1 = desired win		*/ | |
| 211 | 	O_TCPSEQ	= 32,	/* u32 = desired seq.		*/ | |
| 212 | 	O_TCPACK	= 33,	/* u32 = desired seq.		*/ | |
| 213 | 	O_ICMPTYPE	= 34,	/* u32 = icmp bitmap		*/ | |
| 214 | 	O_TCPOPTS	= 35,	/* arg1 = 2*u8 bitmap		*/ | |
| 215 | ||
| 216 | 	O_VERREVPATH	= 36,	/* none				*/ | |
| 217 | 	O_VERSRCREACH	= 37,	/* none				*/ | |
| 218 | ||
| 219 | 	O_PROBE_STATE	= 38,	/* v0:arg1=kidx, v1:kidx=kidx	*/ | |
| 220 | 	O_KEEP_STATE	= 39,	/* v0:arg1=kidx, v1:kidx=kidx	*/ | |
| 221 | 	O_LIMIT		= 40,	/* ipfw_insn_limit		*/ | |
| 222 | 	O_LIMIT_PARENT	= 41,	/* dyn_type, not an opcode.	*/ | |
| 218 | 223 | |
| 219 | 224 | 	/* |
| 220 | 225 | 	 * These are really 'actions'. |
| 221 | 226 | 	 */ |
| 222 | 227 | |
| 223 | 	O_LOG,			/* ipfw_insn_log		*/ | |
| 224 | 	O_PROB,			/* u32 = match probability	*/ | |
| 225 | ||
| 226 | 	O_CHECK_STATE,		/* none				*/ | |
| 227 | 	O_ACCEPT,		/* none				*/ | |
| 228 | 	O_DENY,			/* none 			*/ | |
| 229 | 	O_REJECT,		/* arg1=icmp arg (same as deny)	*/ | |
| 230 | 	O_COUNT,		/* none				*/ | |
| 231 | 	O_SKIPTO,		/* arg1=next rule number	*/ | |
| 232 | 	O_PIPE,			/* arg1=pipe number		*/ | |
| 233 | 	O_QUEUE,		/* arg1=queue number		*/ | |
| 234 | 	O_DIVERT,		/* arg1=port number		*/ | |
| 235 | 	O_TEE,			/* arg1=port number		*/ | |
| 236 | 	O_FORWARD_IP,		/* fwd sockaddr			*/ | |
| 237 | 	O_FORWARD_MAC,		/* fwd mac			*/ | |
| 238 | 	O_NAT, /* nope */ | |
| 239 | 	O_REASS, /* none */ | |
| 228 | 	O_LOG		= 42,	/* ipfw_insn_log		*/ | |
| 229 | 	O_PROB		= 43,	/* u32 = match probability	*/ | |
| 230 | ||
| 231 | 	O_CHECK_STATE	= 44,	/* v0:arg1=kidx, v1:kidx=kidx	*/ | |
| 232 | 	O_ACCEPT	= 45,	/* none				*/ | |
| 233 | 	O_DENY		= 46,	/* none				*/ | |
| 234 | 	O_REJECT	= 47,	/* arg1=icmp arg (same as deny)	*/ | |
| 235 | 	O_COUNT		= 48,	/* none				*/ | |
| 236 | 	O_SKIPTO	= 49,	/* v0:arg1=next rule number	*/ | |
| 237 | 				/* v1:kidx= next rule number	*/ | |
| 238 | 	O_PIPE		= 50,	/* arg1=pipe number		*/ | |
| 239 | 	O_QUEUE		= 51,	/* arg1=queue number		*/ | |
| 240 | 	O_DIVERT	= 52,	/* arg1=port number		*/ | |
| 241 | 	O_TEE		= 53,	/* arg1=port number		*/ | |
| 242 | 	O_FORWARD_IP	= 54,	/* fwd sockaddr			*/ | |
| 243 | 	O_FORWARD_MAC	= 55,	/* fwd mac			*/ | |
| 244 | 	O_NAT		= 56,	/* nope */ | |
| 245 | 	O_REASS		= 57,	/* none */ | |
| 240 | 246 | |
| 241 | 247 | 	/* |
| 242 | 248 | 	 * More opcodes. |
| 243 | 249 | 	 */ |
| 244 | 	O_IPSEC,		/* has ipsec history 		*/ | |
| 245 | 	O_IP_SRC_LOOKUP,	/* arg1=table number, u32=value	*/ | |
| 246 | 	O_IP_DST_LOOKUP,	/* arg1=table number, u32=value	*/ | |
| 247 | 	O_ANTISPOOF,		/* none				*/ | |
| 248 | 	O_JAIL,			/* u32 = id			*/ | |
| 249 | 	O_ALTQ,			/* u32 = altq classif. qid	*/ | |
| 250 | 	O_DIVERTED,		/* arg1=bitmap (1:loop, 2:out)	*/ | |
| 251 | 	O_TCPDATALEN,		/* arg1 = tcp data len		*/ | |
| 252 | 	O_IP6_SRC,		/* address without mask		*/ | |
| 253 | 	O_IP6_SRC_ME,		/* my addresses			*/ | |
| 254 | 	O_IP6_SRC_MASK,		/* address with the mask	*/ | |
| 255 | 	O_IP6_DST, | |
| 256 | 	O_IP6_DST_ME, | |
| 257 | 	O_IP6_DST_MASK, | |
| 258 | 	O_FLOW6ID,		/* for flow id tag in the ipv6 pkt */ | |
| 259 | 	O_ICMP6TYPE,		/* icmp6 packet type filtering	*/ | |
| 260 | 	O_EXT_HDR,		/* filtering for ipv6 extension header */ | |
| 261 | 	O_IP6, | |
| 250 | 	O_IPSEC		= 58,	/* has ipsec history 		*/ | |
| 251 | 	O_IP_SRC_LOOKUP	= 59,	/* v0:arg1=table number, u32=value */ | |
| 252 | 				/* v1:kidx=name, u32=value, arg1=key */ | |
| 253 | 	O_IP_DST_LOOKUP	= 60,	/* arg1=table number, u32=value	*/ | |
| 254 | 				/* v1:kidx=name, u32=value, arg1=key */ | |
| 255 | 	O_ANTISPOOF	= 61,	/* none				*/ | |
| 256 | 	O_JAIL		= 62,	/* u32 = id			*/ | |
| 257 | 	O_ALTQ		= 63,	/* u32 = altq classif. qid	*/ | |
| 258 | 	O_DIVERTED	= 64,	/* arg1=bitmap (1:loop, 2:out)	*/ | |
| 259 | 	O_TCPDATALEN	= 65,	/* arg1 = tcp data len		*/ | |
| 260 | 	O_IP6_SRC	= 66,	/* address without mask		*/ | |
| 261 | 	O_IP6_SRC_ME	= 67,	/* my addresses			*/ | |
| 262 | 	O_IP6_SRC_MASK	= 68,	/* address with the mask	*/ | |
| 263 | 	O_IP6_DST	= 69, | |
| 264 | 	O_IP6_DST_ME	= 70, | |
| 265 | 	O_IP6_DST_MASK	= 71, | |
| 266 | 	O_FLOW6ID	= 72,	/* for flow id tag in the ipv6 pkt */ | |
| 267 | 	O_ICMP6TYPE	= 73,	/* icmp6 packet type filtering	*/ | |
| 268 | 	O_EXT_HDR	= 74,	/* filtering for ipv6 extension header */ | |
| 269 | 	O_IP6		= 75, | |
| 262 | 270 | |
| 263 | 271 | 	/* |
| 264 | 272 | 	 * actions for ng_ipfw |
| 265 | 273 | 	 */ |
| 266 | 	O_NETGRAPH,		/* send to ng_ipfw		*/ | |
| 267 | 	O_NGTEE,		/* copy to ng_ipfw		*/ | |
| 274 | 	O_NETGRAPH	= 76,	/* send to ng_ipfw		*/ | |
| 275 | 	O_NGTEE		= 77,	/* copy to ng_ipfw		*/ | |
| 268 | 276 | |
| 269 | 	O_IP4, | |
| 277 | 	O_IP4		= 78, | |
| 270 | 278 | |
| 271 | 	O_UNREACH6,		/* arg1=icmpv6 code arg (deny) */ | |
| 279 | 	O_UNREACH6	= 79,	/* arg1=icmpv6 code arg (deny) */ | |
| 272 | 280 | |
| 273 | 	O_TAG, 		/* arg1=tag number */ | |
| 274 | 	O_TAGGED,		/* arg1=tag number */ | |
| 281 | 	O_TAG		= 80,	/* arg1=tag number */ | |
| 282 | 	O_TAGGED	= 81,	/* arg1=tag number */ | |
| 275 | 283 | |
| 276 | 	O_SETFIB,		/* arg1=FIB number */ | |
| 277 | 	O_FIB,			/* arg1=FIB desired fib number */ | |
| 284 | 	O_SETFIB	= 82,	/* arg1=FIB number */ | |
| 285 | 	O_FIB		= 83,	/* arg1=FIB desired fib number */ | |
| 278 | 286 | |
| 279 | 	O_SOCKARG,		/* socket argument */ | |
| 287 | 	O_SOCKARG	= 84,	/* socket argument */ | |
| 280 | 288 | |
| 281 | 	O_CALLRETURN,		/* arg1=called rule number */ | |
| 289 | 	O_CALLRETURN	= 85,	/* v0:arg1=called rule number */ | |
| 290 | 				/* v1:kidx=called rule number */ | |
| 282 | 291 | |
| 283 | 	O_FORWARD_IP6,		/* fwd sockaddr_in6 */ | |
| 292 | 	O_FORWARD_IP6	= 86,	/* fwd sockaddr_in6 */ | |
| 284 | 293 | |
| 285 | 	O_DSCP,			/* 2 u32 = DSCP mask */ | |
| 286 | 	O_SETDSCP,		/* arg1=DSCP value */ | |
| 287 | 	O_IP_FLOW_LOOKUP,	/* arg1=table number, u32=value	*/ | |
| 294 | 	O_DSCP		= 87,	/* 2 u32 = DSCP mask */ | |
| 295 | 	O_SETDSCP	= 88,	/* arg1=DSCP value */ | |
| 296 | 	O_IP_FLOW_LOOKUP = 89,	/* v0:arg1=table number, u32=value	*/ | |
| 297 | 				/* v1:kidx=name, u32=value */ | |
| 288 | 298 | |
| 289 | 	O_EXTERNAL_ACTION,	/* arg1=id of external action handler */ | |
| 290 | 	O_EXTERNAL_INSTANCE,	/* arg1=id of eaction handler instance */ | |
| 291 | 	O_EXTERNAL_DATA,	/* variable length data */ | |
| 299 | 	O_EXTERNAL_ACTION = 90,	/* v0:arg1=id of external action handler */ | |
| 300 | 				/* v1:kidx=id of external action handler */ | |
| 301 | 	O_EXTERNAL_INSTANCE = 91, /* v0:arg1=id of eaction handler instance */ | |
| 302 | 				/* v1:kidx=id of eaction handler instance */ | |
| 303 | 	O_EXTERNAL_DATA	= 92,	/* variable length data */ | |
| 292 | 304 | |
| 293 | 	O_SKIP_ACTION,		/* none				*/ | |
| 294 | 	O_TCPMSS,		/* arg1=MSS value */ | |
| 305 | 	O_SKIP_ACTION	= 93,	/* none				*/ | |
| 306 | 	O_TCPMSS	= 94,	/* arg1=MSS value */ | |
| 295 | 307 | |
| 296 | 	O_MAC_SRC_LOOKUP,	/* arg1=table number, u32=value */ | |
| 297 | 	O_MAC_DST_LOOKUP,	/* arg1=table number, u32=value */ | |
| 308 | 	O_MAC_SRC_LOOKUP = 95,	/* kidx=name, u32=value, arg1=key */ | |
| 309 | 	O_MAC_DST_LOOKUP = 96,	/* kidx=name, u32=value, arg1=key */ | |
| 298 | 310 | |
| 299 | 	O_SETMARK,		/* u32 = value */ | |
| 300 | 	O_MARK,			/* 2 u32 = value, bitmask */ | |
| 311 | 	O_SETMARK	= 97,	/* u32 = value */ | |
| 312 | 	O_MARK		= 98,	/* 2 u32 = value, bitmask */ | |
| 301 | 313 | |
| 302 | 314 | 	O_LAST_OPCODE		/* not an opcode!		*/ |
| 303 | 315 | }; |
| 304 | 316 | |
| 305 | /* | |
| 306 | * Defines key types used by lookup instruction | |
| 307 | */ | |
| 308 | enum ipfw_table_lookup_type { | |
| 309 | 	LOOKUP_DST_IP, | |
| 310 | 	LOOKUP_SRC_IP, | |
| 311 | 	LOOKUP_DST_PORT, | |
| 312 | 	LOOKUP_SRC_PORT, | |
| 313 | 	LOOKUP_UID, | |
| 314 | 	LOOKUP_JAIL, | |
| 315 | 	LOOKUP_DSCP, | |
| 316 | 	LOOKUP_DST_MAC, | |
| 317 | 	LOOKUP_SRC_MAC, | |
| 318 | 	LOOKUP_MARK, | |
| 319 | }; | |
| 320 | ||
| 321 | 317 | /* |
| 322 | 318 | * The extension header are filtered only for presence using a bit |
| 323 | 319 | * vector with a flag for each header. |
| ... | ... | @@ -392,6 +388,11 @@ typedef struct	_ipfw_insn_u32 { |
| 392 | 388 | 	u_int32_t d[1];	/* one or more */ |
| 393 | 389 | } ipfw_insn_u32; |
| 394 | 390 | |
| 391 | typedef struct _ipfw_insn_kidx { | |
| 392 | 	ipfw_insn o; | |
| 393 | 	uint32_t kidx; | |
| 394 | } ipfw_insn_kidx; | |
| 395 | ||
| 395 | 396 | /* |
| 396 | 397 | * This is used to store IP addr-mask pairs. |
| 397 | 398 | */ |
| ... | ... | @@ -401,6 +402,47 @@ typedef struct	_ipfw_insn_ip { |
| 401 | 402 | 	struct in_addr	mask; |
| 402 | 403 | } ipfw_insn_ip; |
| 403 | 404 | |
| 405 | typedef struct _ipfw_insn_table { | |
| 406 | 	ipfw_insn o;	/* arg1 is optional lookup key */ | |
| 407 | 	uint32_t kidx;	/* table name index */ | |
| 408 | 	uint32_t value;	/* table value */ | |
| 409 | } ipfw_insn_table; | |
| 410 | ||
| 411 | #define	IPFW_LOOKUP_TYPE_MASK		0x00FF | |
| 412 | #define	IPFW_LOOKUP_TYPE(insn)		((insn)->arg1 & IPFW_LOOKUP_TYPE_MASK) | |
| 413 | #define	IPFW_SET_LOOKUP_TYPE(insn, type)	do {	\ | |
| 414 | 	(insn)->arg1 &= ~IPFW_LOOKUP_TYPE_MASK;		\ | |
| 415 | 	(insn)->arg1 |= (type) & IPFW_LOOKUP_TYPE_MASK;	\ | |
| 416 | } while (0) | |
| 417 | ||
| 418 | /* | |
| 419 | * Defines key types used by lookup instruction | |
| 420 | */ | |
| 421 | enum ipfw_table_lookup_type { | |
| 422 | 	LOOKUP_NONE = 0, | |
| 423 | 	LOOKUP_DST_IP, | |
| 424 | 	LOOKUP_SRC_IP, | |
| 425 | 	LOOKUP_DST_PORT, | |
| 426 | 	LOOKUP_SRC_PORT, | |
| 427 | 	LOOKUP_UID, | |
| 428 | 	LOOKUP_JAIL, | |
| 429 | 	LOOKUP_DSCP, | |
| 430 | 	LOOKUP_DST_MAC, | |
| 431 | 	LOOKUP_SRC_MAC, | |
| 432 | 	LOOKUP_MARK, | |
| 433 | 	LOOKUP_RULENUM, | |
| 434 | }; | |
| 435 | ||
| 436 | enum ipfw_return_type { | |
| 437 | 	RETURN_NEXT_RULENUM = 0, | |
| 438 | 	RETURN_NEXT_RULE, | |
| 439 | }; | |
| 440 | ||
| 441 | enum ipfw_skipto_cache_op { | |
| 442 | 	SKIPTO_CACHE_DISABLE = 0, | |
| 443 | 	SKIPTO_CACHE_ENABLE, | |
| 444 | }; | |
| 445 | ||
| 404 | 446 | /* |
| 405 | 447 | * This is used to forward to a given address (ip). |
| 406 | 448 | */ |
| ... | ... | @@ -434,7 +476,8 @@ typedef struct	_ipfw_insn_if { |
| 434 | 476 | 	union { |
| 435 | 477 | 		struct in_addr ip; |
| 436 | 478 | 		int glob; |
| 437 | 		uint16_t kidx; | |
| 479 | 		uint16_t kidx_v0; | |
| 480 | 		uint32_t kidx; | |
| 438 | 481 | 	} p; |
| 439 | 482 | 	char name[IFNAMSIZ]; |
| 440 | 483 | } ipfw_insn_if; |
| ... | ... | @@ -452,6 +495,7 @@ typedef struct _ipfw_insn_altq { |
| 452 | 495 | */ |
| 453 | 496 | typedef struct	_ipfw_insn_limit { |
| 454 | 497 | 	ipfw_insn o; |
| 498 | 	u_int32_t kidx; | |
| 455 | 499 | 	u_int8_t _pad; |
| 456 | 500 | 	u_int8_t limit_mask;	/* combination of DYN_* below	*/ |
| 457 | 501 | #define	DYN_SRC_ADDR	0x1 |
| ... | ... | @@ -462,6 +506,9 @@ typedef struct	_ipfw_insn_limit { |
| 462 | 506 | 	u_int16_t conn_limit; |
| 463 | 507 | } ipfw_insn_limit; |
| 464 | 508 | |
| 509 | /* MAC/InfiniBand/etc address length */ | |
| 510 | #define	IPFW_MAX_L2_ADDR_LEN	20 | |
| 511 | ||
| 465 | 512 | /* |
| 466 | 513 | * This is used for log instructions. |
| 467 | 514 | */ |
| ... | ... | @@ -471,6 +518,22 @@ typedef struct _ipfw_insn_log { |
| 471 | 518 | 	u_int32_t log_left;	/* how many left to log 	*/ |
| 472 | 519 | } ipfw_insn_log; |
| 473 | 520 | |
| 521 | /* ipfw_insn_log->o.arg1 bitmasks */ | |
| 522 | #define	IPFW_LOG_DEFAULT	0x0000 | |
| 523 | #define	IPFW_LOG_SYSLOG		(1 << 15) | |
| 524 | #define	IPFW_LOG_IPFW0		(1 << 14) | |
| 525 | #define	IPFW_LOG_RTSOCK		(1 << 13) | |
| 526 | ||
| 527 | typedef struct _ipfwlog_rtsock_hdr_v2 { | |
| 528 | 	uint32_t	rulenum; | |
| 529 | 	uint32_t	tablearg; | |
| 530 | 	ipfw_insn	cmd; | |
| 531 | 	u_char		ether_shost[IPFW_MAX_L2_ADDR_LEN]; | |
| 532 | 	u_char		ether_dhost[IPFW_MAX_L2_ADDR_LEN]; | |
| 533 | 	uint32_t	mark; | |
| 534 | 	char		comment[0]; | |
| 535 | } ipfwlog_rtsock_hdr_v2; | |
| 536 | ||
| 474 | 537 | /* Legacy NAT structures, compat only */ |
| 475 | 538 | #ifndef	_KERNEL |
| 476 | 539 | /* |
| ... | ... | @@ -604,6 +667,10 @@ typedef struct _ipfw_insn_icmp6 { |
| 604 | 667 | */ |
| 605 | 668 | } ipfw_insn_icmp6; |
| 606 | 669 | |
| 670 | /* Convert pointer to instruction with specified type */ | |
| 671 | #define	insntod(p, type)	((ipfw_insn_ ## type *)(p)) | |
| 672 | #define	insntoc(p, type)	((const ipfw_insn_ ## type *)(p)) | |
| 673 | ||
| 607 | 674 | /* |
| 608 | 675 | * Here we have the structure representing an ipfw rule. |
| 609 | 676 | * |
| ... | ... | @@ -719,30 +786,29 @@ struct ipfw_flow_id { |
| 719 | 786 | /* |
| 720 | 787 | * Dynamic ipfw rule. |
| 721 | 788 | */ |
| 722 | typedef struct _ipfw_dyn_rule ipfw_dyn_rule; | |
| 723 | ||
| 724 | struct _ipfw_dyn_rule { | |
| 725 | 	ipfw_dyn_rule	*next;		/* linked list of rules.	*/ | |
| 726 | 	struct ip_fw *rule;		/* pointer to rule		*/ | |
| 727 | 	/* 'rule' is used to pass up the rule number (from the parent)	*/ | |
| 789 | #define	IPFW_DYN_ORPHANED	0x40000	/* state's parent rule was deleted */ | |
| 728 | 790 | |
| 729 | 	ipfw_dyn_rule *parent;		/* pointer to parent rule	*/ | |
| 730 | 	u_int64_t	pcnt;		/* packet match counter		*/ | |
| 731 | 	u_int64_t	bcnt;		/* byte match counter		*/ | |
| 791 | typedef struct _ipfw_dyn_rule { | |
| 732 | 792 | 	struct ipfw_flow_id id;		/* (masked) flow id		*/ |
| 733 | 	u_int32_t	expire;		/* expire time			*/ | |
| 734 | 	u_int32_t	bucket;		/* which bucket in hash table	*/ | |
| 735 | 	u_int32_t	state;		/* state of this rule (typically a | |
| 793 | 	uint8_t		set; | |
| 794 | 	uint8_t		type;		/* rule type			*/ | |
| 795 | 	uint16_t	pad; | |
| 796 | 	uint32_t	expire;		/* expire time			*/ | |
| 797 | 	uint32_t	rulenum;	/* parent's rule number		*/ | |
| 798 | 	uint32_t	kidx;		/* index of named object	*/ | |
| 799 | 	uint64_t	pcnt;		/* packet match counter		*/ | |
| 800 | 	uint64_t	bcnt;		/* byte match counter		*/ | |
| 801 | 	uint32_t	hashval;	/* hash value			*/ | |
| 802 | 	union { | |
| 803 | 		uint32_t state;		/* state of this rule (typically a | |
| 736 | 804 | 					 * combination of TCP flags) |
| 737 | 805 | 					 */ |
| 738 | #define	IPFW_DYN_ORPHANED	0x40000	/* state's parent rule was deleted */ | |
| 739 | 	u_int32_t	ack_fwd;	/* most recent ACKs in forward	*/ | |
| 740 | 	u_int32_t	ack_rev;	/* and reverse directions (used	*/ | |
| 806 | 		uint32_t count;		/* number of linked states	*/ | |
| 807 | 	}; | |
| 808 | 	uint32_t	ack_fwd;	/* most recent ACKs in forward	*/ | |
| 809 | 	uint32_t	ack_rev;	/* and reverse directions (used	*/ | |
| 741 | 810 | 					/* to generate keepalives)	*/ |
| 742 | 	u_int16_t	dyn_type;	/* rule type			*/ | |
| 743 | 	u_int16_t	count;		/* refcount			*/ | |
| 744 | 	u_int16_t	kidx;		/* index of named object */ | |
| 745 | } __packed __aligned(8); | |
| 811 | } __packed __aligned(8) ipfw_dyn_rule; | |
| 746 | 812 | |
| 747 | 813 | /* |
| 748 | 814 | * Definitions for IP option names. |
| ... | ... | @@ -794,16 +860,6 @@ struct _ipfw_dyn_rule { |
| 794 | 860 | #define	IPFW_VTYPE_NH6		0x00000400	/* IPv6 nexthop */ |
| 795 | 861 | #define	IPFW_VTYPE_MARK		0x00000800	/* [fw]mark */ |
| 796 | 862 | |
| 797 | /* MAC/InfiniBand/etc address length */ | |
| 798 | #define	IPFW_MAX_L2_ADDR_LEN	20 | |
| 799 | ||
| 800 | typedef struct	_ipfw_table_entry { | |
| 801 | 	in_addr_t	addr;		/* network address		*/ | |
| 802 | 	u_int32_t	value;		/* value			*/ | |
| 803 | 	u_int16_t	tbl;		/* table number			*/ | |
| 804 | 	u_int8_t	masklen;	/* mask length			*/ | |
| 805 | } ipfw_table_entry; | |
| 806 | ||
| 807 | 863 | typedef struct	_ipfw_table_xentry { |
| 808 | 864 | 	uint16_t	len;		/* Total entry length		*/ |
| 809 | 865 | 	uint8_t		type;		/* entry type			*/ |
| ... | ... | @@ -819,13 +875,6 @@ typedef struct	_ipfw_table_xentry { |
| 819 | 875 | } ipfw_table_xentry; |
| 820 | 876 | #define	IPFW_TCF_INET	0x01		/* CIDR flags: IPv4 record	*/ |
| 821 | 877 | |
| 822 | typedef struct	_ipfw_table { | |
| 823 | 	u_int32_t	size;		/* size of entries in bytes	*/ | |
| 824 | 	u_int32_t	cnt;		/* # of entries			*/ | |
| 825 | 	u_int16_t	tbl;		/* table number			*/ | |
| 826 | 	ipfw_table_entry ent[0];	/* entries			*/ | |
| 827 | } ipfw_table; | |
| 828 | ||
| 829 | 878 | typedef struct	_ipfw_xtable { |
| 830 | 879 | 	ip_fw3_opheader	opheader;	/* IP_FW3 opcode */ |
| 831 | 880 | 	uint32_t	size;		/* size of entries in bytes	*/ |
| ... | ... | @@ -865,10 +914,10 @@ typedef struct _ipfw_obj_data { |
| 865 | 914 | /* Object name TLV */ |
| 866 | 915 | typedef struct _ipfw_obj_ntlv { |
| 867 | 916 | 	ipfw_obj_tlv	head;		/* TLV header			*/ |
| 868 | 	uint16_t	idx;		/* Name index			*/ | |
| 917 | 	uint32_t	idx;		/* Name index			*/ | |
| 869 | 918 | 	uint8_t		set;		/* set, if applicable		*/ |
| 870 | 919 | 	uint8_t		type;		/* object type, if applicable	*/ |
| 871 | 	uint32_t	spare;		/* unused			*/ | |
| 920 | 	uint16_t	spare;		/* unused			*/ | |
| 872 | 921 | 	char		name[64];	/* Null-terminated name		*/ |
| 873 | 922 | } ipfw_obj_ntlv; |
| 874 | 923 | |
| ... | ... | @@ -891,19 +940,40 @@ struct tflow_entry { |
| 891 | 940 | 	} a; |
| 892 | 941 | }; |
| 893 | 942 | |
| 943 | #define	IPFW_TVALUE_TYPE_MASK		0xFF00 | |
| 944 | #define	IPFW_TVALUE_TYPE(insn)		(((insn)->arg1 & IPFW_TVALUE_TYPE_MASK) >> 8) | |
| 945 | #define	IPFW_SET_TVALUE_TYPE(insn, type)	do {	\ | |
| 946 | 	(insn)->arg1 &= ~IPFW_TVALUE_TYPE_MASK;		\ | |
| 947 | 	(insn)->arg1 |= ((type) << 8) & IPFW_TVALUE_TYPE_MASK;	\ | |
| 948 | } while (0) | |
| 949 | ||
| 950 | enum ipfw_table_value_type { | |
| 951 | 	TVALUE_TAG = 0, | |
| 952 | 	TVALUE_PIPE, | |
| 953 | 	TVALUE_DIVERT, | |
| 954 | 	TVALUE_SKIPTO, | |
| 955 | 	TVALUE_NETGRAPH, | |
| 956 | 	TVALUE_FIB, | |
| 957 | 	TVALUE_NAT, | |
| 958 | 	TVALUE_NH4, | |
| 959 | 	TVALUE_DSCP, | |
| 960 | 	TVALUE_LIMIT, | |
| 961 | 	TVALUE_MARK, | |
| 962 | }; | |
| 963 | ||
| 894 | 964 | /* 64-byte structure representing multi-field table value */ |
| 895 | 965 | typedef struct _ipfw_table_value { |
| 896 | 966 | 	uint32_t	tag;		/* O_TAG/O_TAGGED */ |
| 897 | 	uint32_t	pipe;		/* O_PIPE/O_QUEUE */ | |
| 967 | 	uint16_t	pipe;		/* O_PIPE/O_QUEUE */ | |
| 898 | 968 | 	uint16_t	divert;		/* O_DIVERT/O_TEE */ |
| 899 | 	uint16_t	skipto;		/* skipto, CALLRET */ | |
| 969 | 	uint32_t	skipto;		/* skipto, CALLRET */ | |
| 900 | 970 | 	uint32_t	netgraph;	/* O_NETGRAPH/O_NGTEE */ |
| 901 | 	uint32_t	fib;		/* O_SETFIB */ | |
| 902 | 971 | 	uint32_t	nat;		/* O_NAT */ |
| 903 | 972 | 	uint32_t	nh4; |
| 973 | 	uint16_t	fib;		/* O_SETFIB */ | |
| 904 | 974 | 	uint8_t		dscp; |
| 905 | 975 | 	uint8_t		spare0; |
| 906 | 	uint16_t	kidx;		/* value kernel index */ | |
| 976 | 	uint32_t	kidx;		/* value kernel index */ | |
| 907 | 977 | 	struct in6_addr	nh6; |
| 908 | 978 | 	uint32_t	limit;		/* O_LIMIT */ |
| 909 | 979 | 	uint32_t	zoneid;		/* scope zone id for nh6 */ |
| ... | ... | @@ -918,8 +988,7 @@ typedef struct	_ipfw_obj_tentry { |
| 918 | 988 | 	uint8_t		masklen;	/* mask length			*/ |
| 919 | 989 | 	uint8_t		result;		/* request result		*/ |
| 920 | 990 | 	uint8_t		spare0; |
| 921 | 	uint16_t	idx;		/* Table name index		*/ | |
| 922 | 	uint16_t	spare1; | |
| 991 | 	uint32_t	idx;		/* Table name index		*/ | |
| 923 | 992 | 	union { |
| 924 | 993 | 		/* Longest field needs to be aligned by 8-byte boundary	*/ |
| 925 | 994 | 		struct in_addr		addr;		/* IPv4 address		*/ |
| ... | ... | @@ -966,8 +1035,8 @@ typedef struct _ipfw_obj_ctlv { |
| 966 | 1035 | typedef struct _ipfw_range_tlv { |
| 967 | 1036 | 	ipfw_obj_tlv	head;		/* TLV header			*/ |
| 968 | 1037 | 	uint32_t	flags;		/* Range flags			*/ |
| 969 | 	uint16_t	start_rule;	/* Range start			*/ | |
| 970 | 	uint16_t	end_rule;	/* Range end			*/ | |
| 1038 | 	uint32_t	start_rule;	/* Range start			*/ | |
| 1039 | 	uint32_t	end_rule;	/* Range end			*/ | |
| 971 | 1040 | 	uint32_t	set;		/* Range set to match		 */ |
| 972 | 1041 | 	uint32_t	new_set;	/* New set to move/swap to	*/ |
| 973 | 1042 | } ipfw_range_tlv; |
| ... | ... | @@ -1051,10 +1120,16 @@ typedef struct _ipfw_ta_info { |
| 1051 | 1120 | 	uint64_t	spare1; |
| 1052 | 1121 | } ipfw_ta_info; |
| 1053 | 1122 | |
| 1123 | typedef struct _ipfw_cmd_header {	/* control command header	*/ | |
| 1124 | 	ip_fw3_opheader	opheader;	/* IP_FW3 opcode		*/ | |
| 1125 | 	uint32_t	size;		/* Total size (incl. header)	*/ | |
| 1126 | 	uint32_t	cmd;		/* command			*/ | |
| 1127 | } ipfw_cmd_header; | |
| 1128 | ||
| 1054 | 1129 | typedef struct _ipfw_obj_header { |
| 1055 | 1130 | 	ip_fw3_opheader	opheader;	/* IP_FW3 opcode		*/ |
| 1056 | 	uint32_t	spare; | |
| 1057 | 	uint16_t	idx;		/* object name index		*/ | |
| 1131 | 	uint32_t	idx;		/* object name index		*/ | |
| 1132 | 	uint16_t	spare; | |
| 1058 | 1133 | 	uint8_t		objtype;	/* object type			*/ |
| 1059 | 1134 | 	uint8_t		objsubtype;	/* object subtype		*/ |
| 1060 | 1135 | 	ipfw_obj_ntlv	ntlv;		/* object name tlv		*/ |
lib/libc/include/generic-freebsd/netinet/ip_icmp.h-2| ... | ... | @@ -27,8 +27,6 @@ |
| 27 | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | * | |
| 31 | *	@(#)ip_icmp.h	8.1 (Berkeley) 6/10/93 | |
| 32 | 30 | */ |
| 33 | 31 | |
| 34 | 32 | #ifndef _NETINET_IP_ICMP_H_ |
lib/libc/include/generic-freebsd/netinet/ip_mroute.h-2| ... | ... | @@ -31,8 +31,6 @@ |
| 31 | 31 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 32 | 32 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 33 | 33 | * SUCH DAMAGE. |
| 34 | * | |
| 35 | *	@(#)ip_mroute.h	8.1 (Berkeley) 6/10/93 | |
| 36 | 34 | */ |
| 37 | 35 | |
| 38 | 36 | #ifndef _NETINET_IP_MROUTE_H_ |
lib/libc/include/generic-freebsd/netinet/ip_nat.h-2| ... | ... | @@ -2,8 +2,6 @@ |
| 2 | 2 | * Copyright (C) 2012 by Darren Reed. |
| 3 | 3 | * |
| 4 | 4 | * See the IPFILTER.LICENCE file for details on licencing. |
| 5 | * | |
| 6 | * @(#)ip_nat.h	1.5 2/4/96 | |
| 7 | 5 | * Id: ip_nat.h,v 2.90.2.20 2007/09/25 08:27:32 darrenr Exp $ |
| 8 | 6 | */ |
| 9 | 7 |
lib/libc/include/generic-freebsd/netinet/ip_scan.h-2| ... | ... | @@ -2,8 +2,6 @@ |
| 2 | 2 | * Copyright (C) 2012 by Darren Reed. |
| 3 | 3 | * |
| 4 | 4 | * See the IPFILTER.LICENCE file for details on licencing. |
| 5 | * | |
| 6 | * @(#)ip_fil.h	1.35 6/5/96 | |
| 7 | 5 | * $Id$ |
| 8 | 6 | */ |
| 9 | 7 |
lib/libc/include/generic-freebsd/netinet/ip_state.h-2| ... | ... | @@ -2,8 +2,6 @@ |
| 2 | 2 | * Copyright (C) 2012 by Darren Reed. |
| 3 | 3 | * |
| 4 | 4 | * See the IPFILTER.LICENCE file for details on licencing. |
| 5 | * | |
| 6 | * @(#)ip_state.h	1.3 1/12/96 (C) 1995 Darren Reed | |
| 7 | 5 | * Id: ip_state.h,v 2.68.2.10 2007/10/16 09:33:24 darrenr Exp $ |
| 8 | 6 | */ |
| 9 | 7 | #ifndef	__IP_STATE_H__ |
lib/libc/include/generic-freebsd/netinet/ip_sync.h-2| ... | ... | @@ -2,8 +2,6 @@ |
| 2 | 2 | * Copyright (C) 2012 by Darren Reed. |
| 3 | 3 | * |
| 4 | 4 | * See the IPFILTER.LICENCE file for details on licencing. |
| 5 | * | |
| 6 | * @(#)ip_fil.h	1.35 6/5/96 | |
| 7 | 5 | * $Id$ |
| 8 | 6 | */ |
| 9 | 7 |
lib/libc/include/generic-freebsd/netinet/ip_var.h+25-12| ... | ... | @@ -27,8 +27,6 @@ |
| 27 | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | * | |
| 31 | *	@(#)ip_var.h	8.2 (Berkeley) 1/9/95 | |
| 32 | 30 | */ |
| 33 | 31 | |
| 34 | 32 | #ifndef _NETINET_IP_VAR_H_ |
| ... | ... | @@ -49,7 +47,7 @@ struct ipovly { |
| 49 | 47 | 	u_short	ih_len;			/* protocol length */ |
| 50 | 48 | 	struct	in_addr ih_src;		/* source internet address */ |
| 51 | 49 | 	struct	in_addr ih_dst;		/* destination internet address */ |
| 52 | }; | |
| 50 | } __packed; | |
| 53 | 51 | |
| 54 | 52 | #ifdef _KERNEL |
| 55 | 53 | /* |
| ... | ... | @@ -138,15 +136,19 @@ struct	ipstat { |
| 138 | 136 | |
| 139 | 137 | #include <sys/counter.h> |
| 140 | 138 | #include <net/vnet.h> |
| 139 | #include <netinet/in_kdtrace.h> | |
| 141 | 140 | |
| 142 | 141 | VNET_PCPUSTAT_DECLARE(struct ipstat, ipstat); |
| 143 | 142 | /* |
| 144 | 143 | * In-kernel consumers can use these accessor macros directly to update |
| 145 | 144 | * stats. |
| 146 | 145 | */ |
| 147 | #define	IPSTAT_ADD(name, val)	\ | |
| 148 | VNET_PCPUSTAT_ADD(struct ipstat, ipstat, name, (val)) | |
| 149 | #define	IPSTAT_SUB(name, val)	IPSTAT_ADD(name, -(val)) | |
| 146 | #define IPSTAT_ADD(name, val) \ | |
| 147 | 	do { \ | |
| 148 | 		MIB_SDT_PROBE1(ip, count, name, (val)); \ | |
| 149 | 		VNET_PCPUSTAT_ADD(struct ipstat, ipstat, name, (val)); \ | |
| 150 | 	} while (0) | |
| 151 | #define IPSTAT_SUB(name, val) IPSTAT_ADD(name, -(val)) | |
| 150 | 152 | #define	IPSTAT_INC(name)	IPSTAT_ADD(name, 1) |
| 151 | 153 | #define	IPSTAT_DEC(name)	IPSTAT_SUB(name, 1) |
| 152 | 154 | |
| ... | ... | @@ -154,11 +156,19 @@ VNET_PCPUSTAT_DECLARE(struct ipstat, ipstat); |
| 154 | 156 | * Kernel module consumers must use this accessor macro. |
| 155 | 157 | */ |
| 156 | 158 | void	kmod_ipstat_inc(int statnum); |
| 157 | #define	KMOD_IPSTAT_INC(name)	\ | |
| 158 | kmod_ipstat_inc(offsetof(struct ipstat, name) / sizeof(uint64_t)) | |
| 159 | void	kmod_ipstat_dec(int statnum); | |
| 160 | #define	KMOD_IPSTAT_DEC(name)	\ | |
| 161 | kmod_ipstat_dec(offsetof(struct ipstat, name) / sizeof(uint64_t)) | |
| 159 | #define KMOD_IPSTAT_INC(name) \ | |
| 160 | 	do { \ | |
| 161 | 		MIB_SDT_PROBE1(ip, count, name, 1); \ | |
| 162 | 		kmod_ipstat_inc( \ | |
| 163 | 		 offsetof(struct ipstat, name) / sizeof(uint64_t)); \ | |
| 164 | 	} while (0) | |
| 165 | void kmod_ipstat_dec(int statnum); | |
| 166 | #define KMOD_IPSTAT_DEC(name) \ | |
| 167 | 	do { \ | |
| 168 | 		MIB_SDT_PROBE1(ip, count, name, -1); \ | |
| 169 | 		kmod_ipstat_dec( \ | |
| 170 | 		 offsetof(struct ipstat, name) / sizeof(uint64_t)); \ | |
| 171 | 	} while (0) | |
| 162 | 172 | |
| 163 | 173 | /* flags passed to ip_output as last parameter */ |
| 164 | 174 | #define	IP_FORWARDING		0x1		/* most of ip header exists */ |
| ... | ... | @@ -194,6 +204,7 @@ extern int	(*legal_vif_num)(int); |
| 194 | 204 | extern u_long	(*ip_mcast_src)(int); |
| 195 | 205 | VNET_DECLARE(int, rsvp_on); |
| 196 | 206 | VNET_DECLARE(int, drop_redirect); |
| 207 | VNET_DECLARE(int, ip_random_id); | |
| 197 | 208 | |
| 198 | 209 | #define	V_ip_id			VNET(ip_id) |
| 199 | 210 | #define	V_ip_defttl		VNET(ip_defttl) |
| ... | ... | @@ -206,6 +217,7 @@ VNET_DECLARE(int, drop_redirect); |
| 206 | 217 | #define	V_ip_mrouter		VNET(ip_mrouter) |
| 207 | 218 | #define	V_rsvp_on		VNET(rsvp_on) |
| 208 | 219 | #define	V_drop_redirect		VNET(drop_redirect) |
| 220 | #define	V_ip_random_id		VNET(ip_random_id) | |
| 209 | 221 | |
| 210 | 222 | void	inp_freemoptions(struct ip_moptions *); |
| 211 | 223 | int	inp_getmoptions(struct inpcb *, struct sockopt *); |
| ... | ... | @@ -225,7 +237,7 @@ struct mbuf * |
| 225 | 237 | 	ip_reass(struct mbuf *); |
| 226 | 238 | void	ip_savecontrol(struct inpcb *, struct mbuf **, struct ip *, |
| 227 | 239 | 	 struct mbuf *); |
| 228 | void	ip_fillid(struct ip *); | |
| 240 | void	ip_fillid(struct ip *, bool); | |
| 229 | 241 | int	rip_ctloutput(struct socket *, struct sockopt *); |
| 230 | 242 | int	ipip_input(struct mbuf **, int *, int); |
| 231 | 243 | int	rsvp_input(struct mbuf **, int *, int); |
| ... | ... | @@ -259,6 +271,7 @@ VNET_DECLARE(struct pfil_head *, inet_local_pfil_head); |
| 259 | 271 | #define	PFIL_INET_LOCAL_NAME	"inet-local" |
| 260 | 272 | |
| 261 | 273 | void	in_delayed_cksum(struct mbuf *m); |
| 274 | void	in_delayed_cksum_o(struct mbuf *m, uint16_t o); | |
| 262 | 275 | |
| 263 | 276 | /* Hooks for ipfw, dummynet, divert etc. Most are declared in raw_ip.c */ |
| 264 | 277 | /* |
lib/libc/include/generic-freebsd/netinet/ipf_rb.h-2| ... | ... | @@ -305,13 +305,11 @@ _n##_rb_walktree(struct _n##_rb_head *head, _n##_rb_walker_t func, void *arg)\ |
| 305 | 305 | 	_t *prev;							\ |
| 306 | 306 | 	_t *next;							\ |
| 307 | 307 | 	_t *node = head->top._f.right;					\ |
| 308 | 	_t *base;							\ | |
| 309 | 308 | 									\ |
| 310 | 309 | 	while (node != &_n##_rb_zero)					\ |
| 311 | 310 | 		node = node->_f.left;					\ |
| 312 | 311 | 									\ |
| 313 | 312 | 	for (;;) {							\ |
| 314 | 		base = node;						\ | |
| 315 | 313 | 		prev = node;						\ |
| 316 | 314 | 		while ((node->_f.parent->_f.right == node) &&		\ |
| 317 | 315 | 		 (node != &_n##_rb_zero))	{			\ |
lib/libc/include/generic-freebsd/netinet/ipl.h-2| ... | ... | @@ -2,8 +2,6 @@ |
| 2 | 2 | * Copyright (C) 2012 by Darren Reed. |
| 3 | 3 | * |
| 4 | 4 | * See the IPFILTER.LICENCE file for details on licencing. |
| 5 | * | |
| 6 | * @(#)ipl.h	1.21 6/5/96 | |
| 7 | 5 | * Id: ipl.h,v 2.52.2.30 2007/10/16 09:41:00 darrenr Exp $ |
| 8 | 6 | */ |
| 9 | 7 |
lib/libc/include/generic-freebsd/netinet/pim.h+1-1| ... | ... | @@ -71,7 +71,7 @@ struct pim { |
| 71 | 71 | #endif /* ! _PIM_VT */ |
| 72 | 72 | 	uint8_t		pim_reserved;	/* Reserved			*/ |
| 73 | 73 | 	uint16_t	pim_cksum;	/* IP-style checksum		*/ |
| 74 | }; | |
| 74 | } __packed; | |
| 75 | 75 | /* KAME-related name backward compatibility */ |
| 76 | 76 | #define pim_ver pim_vers |
| 77 | 77 | #define pim_rsv pim_reserved |
lib/libc/include/generic-freebsd/netinet/sctp.h-1| ... | ... | @@ -35,7 +35,6 @@ |
| 35 | 35 | #ifndef _NETINET_SCTP_H_ |
| 36 | 36 | #define _NETINET_SCTP_H_ |
| 37 | 37 | |
| 38 | #include <sys/cdefs.h> | |
| 39 | 38 | #include <sys/types.h> |
| 40 | 39 | |
| 41 | 40 | #define SCTP_PACKED __attribute__((packed)) |
lib/libc/include/generic-freebsd/netinet/sctp_os.h-3| ... | ... | @@ -39,9 +39,6 @@ |
| 39 | 39 | * General kernel memory allocation: |
| 40 | 40 | * SCTP_MALLOC(element, type, size, name) |
| 41 | 41 | * SCTP_FREE(element) |
| 42 | * Kernel memory allocation for "soname"- memory must be zeroed. | |
| 43 | * SCTP_MALLOC_SONAME(name, type, size) | |
| 44 | * SCTP_FREE_SONAME(name) | |
| 45 | 42 | */ |
| 46 | 43 | |
| 47 | 44 | /* |
lib/libc/include/generic-freebsd/netinet/sctp_os_bsd.h+1-8| ... | ... | @@ -219,13 +219,6 @@ MALLOC_DECLARE(SCTP_M_MCORE); |
| 219 | 219 | |
| 220 | 220 | #define SCTP_FREE(var, type)	free(var, type) |
| 221 | 221 | |
| 222 | #define SCTP_MALLOC_SONAME(var, type, size) \ | |
| 223 | 	do { \ | |
| 224 | 		var = (type)malloc(size, M_SONAME, M_WAITOK | M_ZERO); \ | |
| 225 | 	} while (0) | |
| 226 | ||
| 227 | #define SCTP_FREE_SONAME(var)	free(var, M_SONAME) | |
| 228 | ||
| 229 | 222 | #define SCTP_PROCESS_STRUCT struct proc * |
| 230 | 223 | |
| 231 | 224 | /* |
| ... | ... | @@ -349,7 +342,7 @@ typedef struct callout sctp_os_timer_t; |
| 349 | 342 | } while(0) |
| 350 | 343 | |
| 351 | 344 | /* Other m_pkthdr type things */ |
| 352 | #define SCTP_IS_IT_BROADCAST(dst, m) ((m->m_flags & M_PKTHDR) ? in_broadcast(dst, m->m_pkthdr.rcvif) : 0) | |
| 345 | #define SCTP_IS_IT_BROADCAST(dst, m) ((m->m_flags & M_PKTHDR) ? in_ifnet_broadcast(dst, m->m_pkthdr.rcvif) : 0) | |
| 353 | 346 | #define SCTP_IS_IT_LOOPBACK(m) ((m->m_flags & M_PKTHDR) && ((m->m_pkthdr.rcvif == NULL) || (m->m_pkthdr.rcvif->if_type == IFT_LOOP))) |
| 354 | 347 | |
| 355 | 348 | /* This converts any input packet header |
lib/libc/include/generic-freebsd/netinet/sctp_var.h+4-4| ... | ... | @@ -331,17 +331,17 @@ void |
| 331 | 331 | sctp_notify(struct sctp_inpcb *, struct sctp_tcb *, struct sctp_nets *, |
| 332 | 332 | uint8_t, uint8_t, uint16_t, uint32_t); |
| 333 | 333 | int sctp_flush(struct socket *, int); |
| 334 | int sctp_shutdown(struct socket *); | |
| 334 | int sctp_shutdown(struct socket *, enum shutdown_how); | |
| 335 | 335 | int |
| 336 | 336 | sctp_bindx(struct socket *, int, struct sockaddr_storage *, |
| 337 | 337 | int, int, struct proc *); |
| 338 | 338 | |
| 339 | 339 | /* can't use sctp_assoc_t here */ |
| 340 | 340 | int sctp_peeloff(struct socket *, struct socket *, int, caddr_t, int *); |
| 341 | int sctp_ingetaddr(struct socket *, struct sockaddr **); | |
| 342 | int sctp_peeraddr(struct socket *, struct sockaddr **); | |
| 341 | int sctp_ingetaddr(struct socket *, struct sockaddr *); | |
| 342 | int sctp_peeraddr(struct socket *, struct sockaddr *); | |
| 343 | 343 | int sctp_listen(struct socket *, int, struct thread *); |
| 344 | int sctp_accept(struct socket *, struct sockaddr **); | |
| 344 | int sctp_accept(struct socket *, struct sockaddr *); | |
| 345 | 345 | |
| 346 | 346 | #endif				/* _KERNEL */ |
| 347 | 347 |
lib/libc/include/generic-freebsd/netinet/tcp.h+204-166| ... | ... | @@ -27,14 +27,11 @@ |
| 27 | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | * | |
| 31 | *	@(#)tcp.h	8.1 (Berkeley) 6/10/93 | |
| 32 | 30 | */ |
| 33 | 31 | |
| 34 | 32 | #ifndef _NETINET_TCP_H_ |
| 35 | 33 | #define _NETINET_TCP_H_ |
| 36 | 34 | |
| 37 | #include <sys/cdefs.h> | |
| 38 | 35 | #include <sys/types.h> |
| 39 | 36 | |
| 40 | 37 | #if __BSD_VISIBLE |
| ... | ... | @@ -74,13 +71,31 @@ struct tcphdr { |
| 74 | 71 | #define	TH_RES3	0x200 |
| 75 | 72 | #define	TH_RES2	0x400 |
| 76 | 73 | #define	TH_RES1	0x800 |
| 77 | #define	TH_FLAGS	(TH_FIN|TH_SYN|TH_RST|TH_PUSH|TH_ACK|TH_URG|TH_ECE|TH_CWR) | |
| 74 | #define	TH_FLAGS	(TH_FIN|TH_SYN|TH_RST|TH_PUSH|TH_ACK|TH_URG|TH_ECE|TH_CWR|TH_AE) | |
| 78 | 75 | #define	PRINT_TH_FLAGS	"\20\1FIN\2SYN\3RST\4PUSH\5ACK\6URG\7ECE\10CWR\11AE" |
| 79 | 76 | |
| 80 | 77 | 	u_short	th_win;			/* window */ |
| 81 | 78 | 	u_short	th_sum;			/* checksum */ |
| 82 | 79 | 	u_short	th_urp;			/* urgent pointer */ |
| 83 | }; | |
| 80 | } __packed; | |
| 81 | ||
| 82 | static __inline uint16_t | |
| 83 | __tcp_get_flags(const struct tcphdr *th) | |
| 84 | { | |
| 85 | 	return (((uint16_t)th->th_x2 << 8) | th->th_flags); | |
| 86 | } | |
| 87 | ||
| 88 | static __inline void | |
| 89 | __tcp_set_flags(struct tcphdr *th, uint16_t flags) | |
| 90 | { | |
| 91 | 	th->th_x2 = (flags >> 8) & 0x0f; | |
| 92 | 	th->th_flags = flags & 0xff; | |
| 93 | } | |
| 94 | ||
| 95 | #ifdef _KERNEL | |
| 96 | #define tcp_get_flags(th) __tcp_get_flags(th) | |
| 97 | #define tcp_set_flags(th, flags) __tcp_set_flags(th, flags) | |
| 98 | #endif | |
| 84 | 99 | |
| 85 | 100 | #define	PADTCPOLEN(len)		((((len) / 4) + !!((len) % 4)) * 4) |
| 86 | 101 | |
| ... | ... | @@ -151,8 +166,6 @@ struct tcphdr { |
| 151 | 166 | |
| 152 | 167 | #define TCP_MAX_WINSHIFT	14	/* maximum window shift */ |
| 153 | 168 | |
| 154 | #define TCP_MAXBURST		4	/* maximum segments in a burst */ | |
| 155 | ||
| 156 | 169 | #define TCP_MAXHLEN	(0xf<<2)	/* max length of header in bytes */ |
| 157 | 170 | #define TCP_MAXOLEN	(TCP_MAXHLEN - sizeof(struct tcphdr)) |
| 158 | 171 | 					/* max space left for options */ |
| ... | ... | @@ -167,165 +180,170 @@ struct tcphdr { |
| 167 | 180 | * values and are not masked together. Some values appear to be |
| 168 | 181 | * bitmasks for historical reasons. |
| 169 | 182 | */ |
| 170 | #define	TCP_NODELAY	1	/* don't delay send to coalesce packets */ | |
| 183 | #define	TCP_NODELAY		1	/* don't delay send to coalesce packets */ | |
| 171 | 184 | #if __BSD_VISIBLE |
| 172 | #define	TCP_MAXSEG	2	/* set maximum segment size */ | |
| 173 | #define TCP_NOPUSH	4	/* don't push last block of write */ | |
| 174 | #define TCP_NOOPT	8	/* don't use TCP options */ | |
| 175 | #define TCP_MD5SIG	16	/* use MD5 digests (RFC2385) */ | |
| 176 | #define	TCP_INFO	32	/* retrieve tcp_info structure */ | |
| 177 | #define	TCP_STATS	33	/* retrieve stats blob structure */ | |
| 178 | #define	TCP_LOG		34	/* configure event logging for connection */ | |
| 179 | #define	TCP_LOGBUF	35	/* retrieve event log for connection */ | |
| 180 | #define	TCP_LOGID	36	/* configure log ID to correlate connections */ | |
| 181 | #define	TCP_LOGDUMP	37	/* dump connection log events to device */ | |
| 182 | #define	TCP_LOGDUMPID	38	/* dump events from connections with same ID to | |
| 183 | 				 device */ | |
| 184 | #define	TCP_TXTLS_ENABLE 39	/* TLS framing and encryption for transmit */ | |
| 185 | #define	TCP_TXTLS_MODE	40	/* Transmit TLS mode */ | |
| 186 | #define	TCP_RXTLS_ENABLE 41	/* TLS framing and encryption for receive */ | |
| 187 | #define	TCP_RXTLS_MODE	42	/* Receive TLS mode */ | |
| 188 | #define	TCP_IWND_NB	43	/* Override initial window (units: bytes) */ | |
| 189 | #define	TCP_IWND_NSEG	44	/* Override initial window (units: MSS segs) */ | |
| 185 | #define	TCP_MAXSEG		2	/* set maximum segment size */ | |
| 186 | #define	TCP_NOPUSH		4	/* don't push last block of write */ | |
| 187 | #define	TCP_NOOPT		8	/* don't use TCP options */ | |
| 188 | #define	TCP_MD5SIG		16	/* use MD5 digests (RFC2385) */ | |
| 189 | #define	TCP_INFO		32	/* retrieve tcp_info structure */ | |
| 190 | #define	TCP_STATS		33	/* retrieve stats blob structure */ | |
| 191 | #define	TCP_LOG			34	/* configure event logging for connection */ | |
| 192 | #define	TCP_LOGBUF		35	/* retrieve event log for connection */ | |
| 193 | #define	TCP_LOGID		36	/* configure log ID to correlate connections */ | |
| 194 | #define	TCP_LOGDUMP		37	/* dump connection log events to device */ | |
| 195 | #define	TCP_LOGDUMPID		38	/* dump events from connections with same ID to | |
| 196 | 					 device */ | |
| 197 | #define	TCP_TXTLS_ENABLE	39	/* TLS framing and encryption for transmit */ | |
| 198 | #define	TCP_TXTLS_MODE		40	/* Transmit TLS mode */ | |
| 199 | #define	TCP_RXTLS_ENABLE	41	/* TLS framing and encryption for receive */ | |
| 200 | #define	TCP_RXTLS_MODE		42	/* Receive TLS mode */ | |
| 201 | #define	TCP_IWND_NB		43	/* Override initial window (units: bytes) */ | |
| 202 | #define	TCP_IWND_NSEG		44	/* Override initial window (units: MSS segs) */ | |
| 190 | 203 | #ifdef _KERNEL |
| 191 | #define	TCP_USE_DDP	45	/* Use direct data placement for so_rcvbuf */ | |
| 204 | #define	TCP_USE_DDP		45	/* Use direct data placement for so_rcvbuf */ | |
| 192 | 205 | #endif |
| 193 | #define	TCP_LOGID_CNT	46	/* get number of connections with the same ID */ | |
| 194 | #define	TCP_LOG_TAG	47	/* configure tag for grouping logs */ | |
| 195 | #define	TCP_USER_LOG	48	/* userspace log event */ | |
| 196 | #define	TCP_CONGESTION	64	/* get/set congestion control algorithm */ | |
| 197 | #define	TCP_CCALGOOPT	65	/* get/set cc algorithm specific options */ | |
| 198 | #define	TCP_MAXUNACKTIME 68	/* maximum time without making progress (sec) */ | |
| 199 | #define	TCP_MAXPEAKRATE 69	/* maximum peak rate allowed (kbps) */ | |
| 200 | #define TCP_IDLE_REDUCE 70	/* Reduce cwnd on idle input */ | |
| 201 | #define TCP_REMOTE_UDP_ENCAPS_PORT 71	/* Enable TCP over UDP tunneling via the specified port */ | |
| 202 | #define TCP_DELACK 	72	/* socket option for delayed ack */ | |
| 203 | #define TCP_FIN_IS_RST 73	/* A fin from the peer is treated has a RST */ | |
| 204 | #define TCP_LOG_LIMIT 74	/* Limit to number of records in tcp-log */ | |
| 205 | #define TCP_SHARED_CWND_ALLOWED 75 	/* Use of a shared cwnd is allowed */ | |
| 206 | #define TCP_PROC_ACCOUNTING 76	/* Do accounting on tcp cpu usage and counts */ | |
| 207 | #define TCP_USE_CMP_ACKS 77 	/* The transport can handle the Compressed mbuf acks */ | |
| 208 | #define	TCP_PERF_INFO	78	/* retrieve accounting counters */ | |
| 209 | #define	TCP_LRD		79	/* toggle Lost Retransmission Detection for A/B testing */ | |
| 210 | #define	TCP_KEEPINIT	128	/* N, time to establish connection */ | |
| 211 | #define	TCP_KEEPIDLE	256	/* L,N,X start keeplives after this period */ | |
| 212 | #define	TCP_KEEPINTVL	512	/* L,N interval between keepalives */ | |
| 213 | #define	TCP_KEEPCNT	1024	/* L,N number of keepalives before close */ | |
| 214 | #define	TCP_FASTOPEN	1025	/* enable TFO / was created via TFO */ | |
| 215 | #define	TCP_PCAP_OUT	2048	/* number of output packets to keep */ | |
| 216 | #define	TCP_PCAP_IN	4096	/* number of input packets to keep */ | |
| 217 | #define TCP_FUNCTION_BLK 8192	/* Set the tcp function pointers to the specified stack */ | |
| 218 | #define TCP_FUNCTION_ALIAS 8193	/* Get the current tcp function pointer name alias */ | |
| 206 | #define	TCP_LOGID_CNT		46	/* get number of connections with the same ID */ | |
| 207 | #define	TCP_LOG_TAG		47	/* configure tag for grouping logs */ | |
| 208 | #define	TCP_USER_LOG		48	/* userspace log event */ | |
| 209 | #define	TCP_CONGESTION		64	/* get/set congestion control algorithm */ | |
| 210 | #define	TCP_CCALGOOPT		65	/* get/set cc algorithm specific options */ | |
| 211 | #define	TCP_MAXUNACKTIME	68	/* maximum time without making progress (sec) */ | |
| 212 | /* unused			69	*/ | |
| 213 | #define	TCP_IDLE_REDUCE		70	/* Reduce cwnd on idle input */ | |
| 214 | #define	TCP_REMOTE_UDP_ENCAPS_PORT 71	/* Enable TCP over UDP tunneling via the specified port */ | |
| 215 | #define	TCP_DELACK		72	/* socket option for delayed ack */ | |
| 216 | #define	TCP_FIN_IS_RST		73	/* A fin from the peer is treated has a RST */ | |
| 217 | #define	TCP_LOG_LIMIT		74	/* Limit to number of records in tcp-log */ | |
| 218 | #define	TCP_SHARED_CWND_ALLOWED	75	/* Use of a shared cwnd is allowed */ | |
| 219 | #define	TCP_PROC_ACCOUNTING	76	/* Do accounting on tcp cpu usage and counts */ | |
| 220 | #define	TCP_USE_CMP_ACKS	77	/* The transport can handle the Compressed mbuf acks */ | |
| 221 | #define	TCP_PERF_INFO		78	/* retrieve accounting counters */ | |
| 222 | #define	TCP_KEEPINIT		128	/* N, time to establish connection */ | |
| 223 | #define	TCP_KEEPIDLE		256	/* L,N,X start keeplives after this period */ | |
| 224 | #define	TCP_KEEPINTVL		512	/* L,N interval between keepalives */ | |
| 225 | #define	TCP_KEEPCNT		1024	/* L,N number of keepalives before close */ | |
| 226 | #define	TCP_FASTOPEN		1025	/* enable TFO / was created via TFO */ | |
| 227 | /* unused			2048	 was TCP_PCAP_OUT */ | |
| 228 | /* unused			4096	 was TCP_PCAP_IN */ | |
| 229 | #define	TCP_FUNCTION_BLK	8192	/* Set the tcp function pointers to the specified stack */ | |
| 230 | #define	TCP_FUNCTION_ALIAS	8193	/* Get the current tcp function pointer name alias */ | |
| 219 | 231 | /* Options for Rack and BBR */ |
| 220 | #define	TCP_REUSPORT_LB_NUMA 1026	/* set listen socket numa domain */ | |
| 221 | #define TCP_RACK_MBUF_QUEUE 1050 /* Do we allow mbuf queuing if supported */ | |
| 222 | #define TCP_RACK_PROP	 1051 /* Not used */ | |
| 223 | #define TCP_RACK_TLP_REDUCE 1052 /* RACK TLP cwnd reduction (bool) */ | |
| 224 | #define TCP_RACK_PACE_REDUCE 1053 /* RACK Pacingv reduction factor (divisor) */ | |
| 225 | #define TCP_RACK_PACE_MAX_SEG 1054 /* Max TSO size we will send */ | |
| 226 | #define TCP_RACK_PACE_ALWAYS 1055 /* Use the always pace method */ | |
| 227 | #define TCP_RACK_PROP_RATE 1056 /* Not used */ | |
| 228 | #define TCP_RACK_PRR_SENDALOT 1057 /* Allow PRR to send more than one seg */ | |
| 229 | #define TCP_RACK_MIN_TO 1058 /* Minimum time between rack t-o's in ms */ | |
| 230 | #define TCP_RACK_EARLY_RECOV 1059 /* Not used */ | |
| 231 | #define TCP_RACK_EARLY_SEG 1060 /* If early recovery max segments */ | |
| 232 | #define TCP_RACK_REORD_THRESH 1061 /* RACK reorder threshold (shift amount) */ | |
| 233 | #define TCP_RACK_REORD_FADE 1062 /* Does reordering fade after ms time */ | |
| 234 | #define TCP_RACK_TLP_THRESH 1063 /* RACK TLP theshold i.e. srtt+(srtt/N) */ | |
| 235 | #define TCP_RACK_PKT_DELAY 1064 /* RACK added ms i.e. rack-rtt + reord + N */ | |
| 236 | #define TCP_RACK_TLP_INC_VAR 1065 /* Does TLP include rtt variance in t-o */ | |
| 237 | #define TCP_BBR_IWINTSO	 1067 /* Initial TSO window for BBRs first sends */ | |
| 238 | #define TCP_BBR_RECFORCE 1068 /* Enter recovery force out a segment disregard pacer no longer valid */ | |
| 239 | #define TCP_BBR_STARTUP_PG 1069 /* Startup pacing gain */ | |
| 240 | #define TCP_BBR_DRAIN_PG 1070 /* Drain pacing gain */ | |
| 241 | #define TCP_BBR_RWND_IS_APP 1071 /* Rwnd limited is considered app limited */ | |
| 242 | #define TCP_BBR_PROBE_RTT_INT 1072 /* How long in useconds between probe-rtt */ | |
| 243 | #define TCP_BBR_ONE_RETRAN 1073 /* Is only one segment allowed out during retran */ | |
| 244 | #define TCP_BBR_STARTUP_LOSS_EXIT 1074	/* Do we exit a loss during startup if not 20% incr */ | |
| 245 | #define TCP_BBR_USE_LOWGAIN 1075 /* lower the gain in PROBE_BW enable */ | |
| 246 | #define TCP_BBR_LOWGAIN_THRESH 1076 /* Unused after 2.3 morphs to TSLIMITS >= 2.3 */ | |
| 247 | #define TCP_BBR_TSLIMITS 1076	 /* Do we use experimental Timestamp limiting for our algo */ | |
| 248 | #define TCP_BBR_LOWGAIN_HALF 1077 /* Unused after 2.3 */ | |
| 249 | #define TCP_BBR_PACE_OH 1077 /* Reused in 4.2 for pacing overhead setting */ | |
| 250 | #define TCP_BBR_LOWGAIN_FD 1078 /* Unused after 2.3 */ | |
| 251 | #define TCP_BBR_HOLD_TARGET 1078	/* For 4.3 on */ | |
| 252 | #define TCP_BBR_USEDEL_RATE 1079 /* Enable use of delivery rate for loss recovery */ | |
| 253 | #define TCP_BBR_MIN_RTO 1080 /* Min RTO in milliseconds */ | |
| 254 | #define TCP_BBR_MAX_RTO	 1081 /* Max RTO in milliseconds */ | |
| 255 | #define TCP_BBR_REC_OVER_HPTS 1082 /* Recovery override htps settings 0/1/3 */ | |
| 256 | #define TCP_BBR_UNLIMITED 1083 /* Not used before 2.3 and morphs to algorithm >= 2.3 */ | |
| 257 | #define TCP_BBR_ALGORITHM 1083 /* What measurement algo does BBR use netflix=0, google=1 */ | |
| 258 | #define TCP_BBR_DRAIN_INC_EXTRA 1084 /* Does the 3/4 drain target include the extra gain */ | |
| 259 | #define TCP_BBR_STARTUP_EXIT_EPOCH 1085 /* what epoch gets us out of startup */ | |
| 260 | #define TCP_BBR_PACE_PER_SEC 1086 | |
| 261 | #define TCP_BBR_PACE_DEL_TAR 1087 | |
| 262 | #define TCP_BBR_PACE_SEG_MAX 1088 | |
| 263 | #define TCP_BBR_PACE_SEG_MIN 1089 | |
| 264 | #define TCP_BBR_PACE_CROSS 1090 | |
| 265 | #define TCP_RACK_IDLE_REDUCE_HIGH 1092 /* Reduce the highest cwnd seen to IW on idle */ | |
| 266 | #define TCP_RACK_MIN_PACE 1093 	/* Do we enforce rack min pace time */ | |
| 267 | #define TCP_RACK_MIN_PACE_SEG 1094	/* If so what is the seg threshould */ | |
| 268 | #define TCP_RACK_GP_INCREASE 1094	/* After 4.1 its the GP increase in older rack */ | |
| 269 | #define TCP_RACK_TLP_USE 1095 | |
| 270 | #define TCP_BBR_ACK_COMP_ALG 1096 	/* Not used */ | |
| 271 | #define TCP_BBR_TMR_PACE_OH 1096	/* Recycled in 4.2 */ | |
| 272 | #define TCP_BBR_EXTRA_GAIN 1097 | |
| 273 | #define TCP_RACK_DO_DETECTION 1097	/* Recycle of extra gain for rack, attack detection */ | |
| 274 | #define TCP_BBR_RACK_RTT_USE 1098	/* what RTT should we use 0, 1, or 2? */ | |
| 275 | #define TCP_BBR_RETRAN_WTSO 1099 | |
| 276 | #define TCP_DATA_AFTER_CLOSE 1100 | |
| 277 | #define TCP_BBR_PROBE_RTT_GAIN 1101 | |
| 278 | #define TCP_BBR_PROBE_RTT_LEN 1102 | |
| 279 | #define TCP_BBR_SEND_IWND_IN_TSO 1103	/* Do we burst out whole iwin size chunks at start? */ | |
| 280 | #define TCP_BBR_USE_RACK_RR	 1104	/* Do we use the rack rapid recovery for pacing rxt's */ | |
| 281 | #define TCP_BBR_USE_RACK_CHEAT TCP_BBR_USE_RACK_RR /* Compat. */ | |
| 282 | #define TCP_BBR_HDWR_PACE 1105	/* Enable/disable hardware pacing */ | |
| 283 | #define TCP_BBR_UTTER_MAX_TSO 1106	/* Do we enforce an utter max TSO size */ | |
| 284 | #define TCP_BBR_EXTRA_STATE 1107	/* Special exit-persist catch up */ | |
| 285 | #define TCP_BBR_FLOOR_MIN_TSO 1108 /* The min tso size */ | |
| 286 | #define TCP_BBR_MIN_TOPACEOUT 1109	/* Do we suspend pacing until */ | |
| 287 | #define TCP_BBR_TSTMP_RAISES 1110	/* Can a timestamp measurement raise the b/w */ | |
| 288 | #define TCP_BBR_POLICER_DETECT 1111	/* Turn on/off google mode policer detection */ | |
| 289 | #define TCP_BBR_RACK_INIT_RATE 1112	/* Set an initial pacing rate for when we have no b/w in kbits per sec */ | |
| 290 | #define TCP_RACK_RR_CONF	1113 /* Rack rapid recovery configuration control*/ | |
| 291 | #define TCP_RACK_CHEAT_NOT_CONF_RATE TCP_RACK_RR_CONF | |
| 292 | #define TCP_RACK_GP_INCREASE_CA 1114	/* GP increase for Congestion Avoidance */ | |
| 293 | #define TCP_RACK_GP_INCREASE_SS 1115	/* GP increase for Slow Start */ | |
| 294 | #define TCP_RACK_GP_INCREASE_REC 1116	/* GP increase for Recovery */ | |
| 295 | #define TCP_RACK_FORCE_MSEG	1117	/* Override to use the user set max-seg value */ | |
| 296 | #define TCP_RACK_PACE_RATE_CA 1118 /* Pacing rate for Congestion Avoidance */ | |
| 297 | #define TCP_RACK_PACE_RATE_SS 1119 /* Pacing rate for Slow Start */ | |
| 298 | #define TCP_RACK_PACE_RATE_REC 1120 /* Pacing rate for Recovery */ | |
| 299 | #define TCP_NO_PRR 	1122 /* If pacing, don't use prr */ | |
| 300 | #define TCP_RACK_NONRXT_CFG_RATE 1123 /* In recovery does a non-rxt use the cfg rate */ | |
| 301 | #define TCP_SHARED_CWND_ENABLE 1124 	/* Use a shared cwnd if allowed */ | |
| 302 | #define TCP_TIMELY_DYN_ADJ 1125 /* Do we attempt dynamic multipler adjustment with timely. */ | |
| 303 | #define TCP_RACK_NO_PUSH_AT_MAX 1126 /* For timely do not push if we are over max rtt */ | |
| 304 | #define TCP_RACK_PACE_TO_FILL 1127 /* If we are not in recovery, always pace to fill the cwnd in 1 RTT */ | |
| 305 | #define TCP_SHARED_CWND_TIME_LIMIT 1128 /* we should limit to low time values the scwnd life */ | |
| 306 | #define TCP_RACK_PROFILE 1129	/* Select a profile that sets multiple options */ | |
| 307 | #define TCP_HDWR_RATE_CAP 1130 /* Allow hardware rates to cap pacing rate */ | |
| 308 | #define TCP_PACING_RATE_CAP 1131 /* Highest rate allowed in pacing in bytes per second (uint64_t) */ | |
| 309 | #define TCP_HDWR_UP_ONLY 1132	/* Allow the pacing rate to climb but not descend (with the exception of fill-cw */ | |
| 310 | #define TCP_RACK_ABC_VAL 1133	/* Set a local ABC value different then the system default */ | |
| 311 | #define TCP_REC_ABC_VAL 1134	/* Do we use the ABC value for recovery or the override one from sysctl */ | |
| 312 | #define TCP_RACK_MEASURE_CNT 1135 /* How many measurements are required in GP pacing */ | |
| 313 | #define TCP_DEFER_OPTIONS 1136 /* Defer options until the proper number of measurements occur, does not defer TCP_RACK_MEASURE_CNT */ | |
| 314 | #define TCP_FAST_RSM_HACK 1137	/* Not used in modern stacks */ | |
| 315 | #define TCP_RACK_PACING_BETA 1138	/* Changing the beta for pacing */ | |
| 316 | #define TCP_RACK_PACING_BETA_ECN 1139	/* Changing the beta for ecn with pacing */ | |
| 317 | #define TCP_RACK_TIMER_SLOP 1140	/* Set or get the timer slop used */ | |
| 318 | #define TCP_RACK_DSACK_OPT 1141		/* How do we setup rack timer DSACK options bit 1/2 */ | |
| 319 | #define TCP_RACK_ENABLE_HYSTART 1142	/* Do we allow hystart in the CC modules */ | |
| 320 | #define TCP_RACK_SET_RXT_OPTIONS 1143	/* Set the bits in the retransmit options */ | |
| 321 | #define TCP_RACK_HI_BETA 1144 /* Turn on/off high beta */ | |
| 322 | #define TCP_RACK_SPLIT_LIMIT 1145	/* Set a split limit for split allocations */ | |
| 323 | #define TCP_RACK_PACING_DIVISOR 1146 /* Pacing divisor given to rate-limit code for burst sizing */ | |
| 324 | #define TCP_RACK_PACE_MIN_SEG 1147	/* Pacing min seg size rack will use */ | |
| 325 | #define TCP_RACK_DGP_IN_REC 1148	/* Do we use full DGP in recovery? */ | |
| 326 | #define TCP_RXT_CLAMP 1149 /* Do we apply a threshold to rack so if excess rxt clamp cwnd? */ | |
| 327 | #define TCP_HYBRID_PACING 1150	/* Hybrid pacing enablement */ | |
| 328 | #define TCP_PACING_DND	 1151	/* When pacing with rr_config=3 can sacks disturb us */ | |
| 232 | #define	TCP_REUSPORT_LB_NUMA	1026	/* set listen socket numa domain */ | |
| 233 | #define	TCP_RACK_MBUF_QUEUE	1050	/* Do we allow mbuf queuing if supported */ | |
| 234 | /* unused			1051	*/ | |
| 235 | #define	TCP_RACK_TLP_REDUCE 	1052	/* RACK TLP cwnd reduction (bool) */ | |
| 236 | /* unused			1053	*/ | |
| 237 | #define	TCP_RACK_PACE_MAX_SEG	1054	/* Max TSO size we will send */ | |
| 238 | #define	TCP_RACK_PACE_ALWAYS	1055	/* Use the always pace method */ | |
| 239 | /* unused			1056	*/ | |
| 240 | #define	TCP_RACK_PRR_SENDALOT	1057	/* Allow PRR to send more than one seg */ | |
| 241 | #define	TCP_RACK_MIN_TO		1058	/* Minimum time between rack t-o's in ms */ | |
| 242 | /* unused			1059	*/ | |
| 243 | #define	TCP_RACK_EARLY_SEG	1060	/* If early recovery max segments */ | |
| 244 | #define	TCP_RACK_REORD_THRESH	1061	/* RACK reorder threshold (shift amount) */ | |
| 245 | #define	TCP_RACK_REORD_FADE	1062	/* Does reordering fade after ms time */ | |
| 246 | #define	TCP_RACK_TLP_THRESH	1063	/* RACK TLP theshold i.e. srtt+(srtt/N) */ | |
| 247 | #define	TCP_RACK_PKT_DELAY	1064	/* RACK added ms i.e. rack-rtt + reord + N */ | |
| 248 | /* unused			1065	*/ | |
| 249 | /* unused			1066	*/ | |
| 250 | #define	TCP_BBR_IWINTSO		1067	/* Initial TSO window for BBRs first sends */ | |
| 251 | /* unused			1068	*/ | |
| 252 | #define	TCP_BBR_STARTUP_PG	1069	/* Startup pacing gain */ | |
| 253 | #define	TCP_BBR_DRAIN_PG	1070	/* Drain pacing gain */ | |
| 254 | /* unused			1071	*/ | |
| 255 | #define	TCP_BBR_PROBE_RTT_INT	1072	/* How long in useconds between probe-rtt */ | |
| 256 | /* unused			1073	*/ | |
| 257 | #define	TCP_BBR_STARTUP_LOSS_EXIT 1074	/* Do we exit a loss during startup if not 20% incr */ | |
| 258 | /* unused			1075	*/ | |
| 259 | #define	TCP_BBR_TSLIMITS	1076	/* Do we use experimental Timestamp limiting for our algo */ | |
| 260 | #define	TCP_BBR_PACE_OH		1077	/* pacing overhead setting */ | |
| 261 | /* unused			1078	*/ | |
| 262 | #define	TCP_BBR_USEDEL_RATE	1079	/* Enable use of delivery rate for loss recovery */ | |
| 263 | #define	TCP_BBR_MIN_RTO		1080	/* Min RTO in milliseconds */ | |
| 264 | #define	TCP_BBR_MAX_RTO		1081	/* Max RTO in milliseconds */ | |
| 265 | /* unused			1082	*/ | |
| 266 | #define	TCP_BBR_ALGORITHM	1083	/* What measurement algo does BBR use netflix=0, google=1 */ | |
| 267 | /* unused			1084	*/ | |
| 268 | /* unused			1085	*/ | |
| 269 | #define	TCP_BBR_PACE_PER_SEC	1086 | |
| 270 | #define	TCP_BBR_PACE_DEL_TAR	1087 | |
| 271 | #define	TCP_BBR_PACE_SEG_MAX	1088 | |
| 272 | #define	TCP_BBR_PACE_SEG_MIN	1089 | |
| 273 | #define	TCP_BBR_PACE_CROSS	1090 | |
| 274 | /* unused			1091	*/ | |
| 275 | /* unused			1092	*/ | |
| 276 | /* unused			1093	*/ | |
| 277 | /* unused			1094	*/ | |
| 278 | #define	TCP_RACK_TLP_USE	1095 | |
| 279 | #define	TCP_BBR_TMR_PACE_OH	1096	/* ??? */ | |
| 280 | #define	TCP_RACK_DO_DETECTION	1097	/* Recycle of extra gain for rack, attack detection */ | |
| 281 | #define	TCP_BBR_RACK_RTT_USE	1098	/* what RTT should we use 0, 1, or 2? */ | |
| 282 | #define	TCP_BBR_RETRAN_WTSO	1099 | |
| 283 | #define	TCP_DATA_AFTER_CLOSE	1100 | |
| 284 | #define	TCP_BBR_PROBE_RTT_GAIN	1101 | |
| 285 | #define	TCP_BBR_PROBE_RTT_LEN	1102 | |
| 286 | #define	TCP_BBR_SEND_IWND_IN_TSO 1103	/* Do we burst out whole iwin size chunks at start? */ | |
| 287 | #define	TCP_BBR_USE_RACK_RR	1104	/* Do we use the rack rapid recovery for pacing rxt's */ | |
| 288 | #define	TCP_BBR_USE_RACK_CHEAT 	TCP_BBR_USE_RACK_RR /* Compat. */ | |
| 289 | #define	TCP_BBR_HDWR_PACE	1105	/* Enable/disable hardware pacing */ | |
| 290 | #define	TCP_BBR_UTTER_MAX_TSO	1106	/* Do we enforce an utter max TSO size */ | |
| 291 | #define	TCP_BBR_EXTRA_STATE	1107	/* Special exit-persist catch up */ | |
| 292 | #define	TCP_BBR_FLOOR_MIN_TSO	1108	/* The min tso size */ | |
| 293 | #define	TCP_BBR_MIN_TOPACEOUT	1109	/* Do we suspend pacing until */ | |
| 294 | #define	TCP_BBR_TSTMP_RAISES	1110	/* Can a timestamp measurement raise the b/w */ | |
| 295 | #define	TCP_BBR_POLICER_DETECT	1111	/* Turn on/off google mode policer detection */ | |
| 296 | #define	TCP_BBR_RACK_INIT_RATE	1112	/* Set an initial pacing rate for when we have no b/w in kbits per sec */ | |
| 297 | #define	TCP_RACK_RR_CONF	1113	/* Rack rapid recovery configuration control*/ | |
| 298 | #define	TCP_RACK_GP_INCREASE_CA	1114	/* GP increase for Congestion Avoidance */ | |
| 299 | #define	TCP_RACK_GP_INCREASE_SS	1115	/* GP increase for Slow Start */ | |
| 300 | #define	TCP_RACK_GP_INCREASE_REC 1116	/* GP increase for Recovery */ | |
| 301 | #define	TCP_RACK_FORCE_MSEG	1117	/* Override to use the user set max-seg value */ | |
| 302 | #define	TCP_RACK_PACE_RATE_CA	1118	/* Pacing rate for Congestion Avoidance */ | |
| 303 | #define	TCP_RACK_PACE_RATE_SS	1119	/* Pacing rate for Slow Start */ | |
| 304 | #define	TCP_RACK_PACE_RATE_REC	1120	/* Pacing rate for Recovery */ | |
| 305 | #define	TCP_NO_PRR		1122	/* If pacing, don't use prr */ | |
| 306 | #define	TCP_RACK_NONRXT_CFG_RATE 1123	/* In recovery does a non-rxt use the cfg rate */ | |
| 307 | #define	TCP_SHARED_CWND_ENABLE	1124	/* Use a shared cwnd if allowed */ | |
| 308 | #define	TCP_TIMELY_DYN_ADJ	1125	/* Do we attempt dynamic multipler adjustment with timely. */ | |
| 309 | #define	TCP_RACK_NO_PUSH_AT_MAX	1126	/* For timely do not push if we are over max rtt */ | |
| 310 | #define	TCP_RACK_PACE_TO_FILL	1127	/* If we are not in recovery, always pace to fill the cwnd in 1 RTT */ | |
| 311 | #define	TCP_SHARED_CWND_TIME_LIMIT 1128	/* we should limit to low time values the scwnd life */ | |
| 312 | #define	TCP_RACK_PROFILE	1129	/* Select a profile that sets multiple options */ | |
| 313 | #define	TCP_HDWR_RATE_CAP	1130	/* Allow hardware rates to cap pacing rate */ | |
| 314 | #define	TCP_PACING_RATE_CAP	1131	/* Highest rate allowed in pacing in bytes per second (uint64_t) */ | |
| 315 | #define	TCP_HDWR_UP_ONLY	1132	/* Allow the pacing rate to climb but not descend (with the exception of fill-cw */ | |
| 316 | #define	TCP_RACK_ABC_VAL	1133	/* Set a local ABC value different then the system default */ | |
| 317 | #define	TCP_REC_ABC_VAL		1134	/* Do we use the ABC value for recovery or the override one from sysctl */ | |
| 318 | #define	TCP_RACK_MEASURE_CNT	1135	/* How many measurements are required in GP pacing */ | |
| 319 | #define	TCP_DEFER_OPTIONS	1136	/* Defer options until the proper number of measurements occur, does not defer TCP_RACK_MEASURE_CNT */ | |
| 320 | /* unused			1137	*/ | |
| 321 | #define	TCP_RACK_PACING_BETA	1138	/* Changing the beta for pacing */ | |
| 322 | #define	TCP_RACK_PACING_BETA_ECN 1139	/* Changing the beta for ecn with pacing */ | |
| 323 | #define	TCP_RACK_TIMER_SLOP	1140	/* Set or get the timer slop used */ | |
| 324 | #define	TCP_RACK_DSACK_OPT	1141	/* How do we setup rack timer DSACK options bit 1/2 */ | |
| 325 | #define	TCP_RACK_ENABLE_HYSTART	1142	/* Do we allow hystart in the CC modules */ | |
| 326 | #define	TCP_RACK_SET_RXT_OPTIONS 1143	/* Set the bits in the retransmit options */ | |
| 327 | #define	TCP_RACK_HI_BETA	1144	/* Turn on/off high beta */ | |
| 328 | #define	TCP_RACK_SPLIT_LIMIT	1145	/* Set a split limit for split allocations */ | |
| 329 | #define	TCP_RACK_PACING_DIVISOR	1146	/* Pacing divisor given to rate-limit code for burst sizing */ | |
| 330 | #define	TCP_RACK_PACE_MIN_SEG	1147	/* Pacing min seg size rack will use */ | |
| 331 | #define	TCP_RACK_DGP_IN_REC	1148	/* Do we use full DGP in recovery? */ | |
| 332 | /* unused			1149	*/ | |
| 333 | #define	TCP_HYBRID_PACING	1150	/* Hybrid pacing enablement */ | |
| 334 | #define	TCP_PACING_DND		1151	/* When pacing with rr_config=3 can sacks disturb us */ | |
| 335 | #define	TCP_SS_EEXIT		1152	/* Do we do early exit from slowtart if no b/w growth */ | |
| 336 | #define	TCP_DGP_UPPER_BOUNDS	1153	/* SS and CA upper bound in percentage */ | |
| 337 | #define	TCP_NO_TIMELY		1154	/* Disable/enable Timely */ | |
| 338 | #define	TCP_HONOR_HPTS_MIN	1155	/* Do we honor hpts min to */ | |
| 339 | #define	TCP_REC_IS_DYN		1156	/* Do we allow timely to change recovery multiplier? */ | |
| 340 | #define	TCP_SIDECHAN_DIS	1157	/* Disable/enable the side-channel */ | |
| 341 | #define	TCP_FILLCW_RATE_CAP	1158	/* Set a cap for DGP's fillcw */ | |
| 342 | /* unused			1159	*/ | |
| 343 | #define	TCP_STACK_SPEC_INFO	1160	/* Get stack specific information (if present) */ | |
| 344 | #define	RACK_CSPR_IS_FCC	1161 | |
| 345 | #define	TCP_GP_USE_LTBW		1162	/* how we use lt_bw 0=not, 1=min, 2=max */ | |
| 346 | ||
| 329 | 347 | |
| 330 | 348 | /* Start of reserved space for third-party user-settable options. */ |
| 331 | 349 | #define	TCP_VENDOR	SO_VENDOR |
| ... | ... | @@ -436,8 +454,9 @@ struct tcp_info { |
| 436 | 454 | 	u_int32_t	tcpi_rcv_adv;		/* Peer advertised window */ |
| 437 | 455 | 	u_int32_t	tcpi_dupacks;		/* Consecutive dup ACKs recvd */ |
| 438 | 456 | |
| 457 | 	u_int32_t	tcpi_rttmin;		/* Min observed RTT */ | |
| 439 | 458 | 	/* Padding to grow without breaking ABI. */ |
| 440 | 	u_int32_t	__tcpi_pad[10];		/* Padding. */ | |
| 459 | 	u_int32_t	__tcpi_pad[14];		/* Padding. */ | |
| 441 | 460 | }; |
| 442 | 461 | |
| 443 | 462 | /* |
| ... | ... | @@ -449,9 +468,23 @@ struct tcp_fastopen { |
| 449 | 468 | 	int enable; |
| 450 | 469 | 	uint8_t psk[TCP_FASTOPEN_PSK_LEN]; |
| 451 | 470 | }; |
| 452 | #endif | |
| 471 | ||
| 453 | 472 | #define TCP_FUNCTION_NAME_LEN_MAX 32 |
| 454 | 473 | |
| 474 | struct stack_specific_info { | |
| 475 | 	char stack_name[TCP_FUNCTION_NAME_LEN_MAX]; | |
| 476 | 	uint64_t policer_last_bw;	/* Only valid if detection enabled and policer detected */ | |
| 477 | 	uint64_t bytes_transmitted; | |
| 478 | 	uint64_t bytes_retransmitted; | |
| 479 | 	uint32_t policer_detection_enabled: 1, | |
| 480 | 		 policer_detected : 1, /* transport thinks a policer is on path */ | |
| 481 | 		 highly_buffered : 1,	/* transport considers the path highly buffered */ | |
| 482 | 		 spare : 29; | |
| 483 | 	uint32_t policer_bucket_size;	/* Only valid if detection enabled and policer detected */ | |
| 484 | 	uint32_t current_round; | |
| 485 | 	uint32_t _rack_i_pad[18]; | |
| 486 | }; | |
| 487 | ||
| 455 | 488 | struct tcp_function_set { |
| 456 | 489 | 	char function_set_name[TCP_FUNCTION_NAME_LEN_MAX]; |
| 457 | 490 | 	uint32_t pcbcnt; |
| ... | ... | @@ -477,6 +510,7 @@ struct tcp_snd_req { |
| 477 | 510 | 	uint64_t start; |
| 478 | 511 | 	uint64_t end; |
| 479 | 512 | 	uint32_t flags; |
| 513 | 	uint32_t playout_ms; | |
| 480 | 514 | }; |
| 481 | 515 | |
| 482 | 516 | union tcp_log_userdata { |
| ... | ... | @@ -507,9 +541,12 @@ struct tcp_log_user { |
| 507 | 541 | #define TCP_HYBRID_PACING_H_MS		0x0008		/* A client hint for maxseg is present */ |
| 508 | 542 | #define TCP_HYBRID_PACING_ENABLE	0x0010		/* We are enabling hybrid pacing else disable */ |
| 509 | 543 | #define TCP_HYBRID_PACING_S_MSS		0x0020		/* Clent wants us to set the mss overriding gp est in CU */ |
| 510 | #define TCP_HYBRID_PACING_SETMSS	0x1000		/* Internal flag that tellsus we set the mss on this entry */ | |
| 544 | #define TCP_HAS_PLAYOUT_MS		0x0040		/* The client included the chunk playout milliseconds: deprecate */ | |
| 545 | /* the below are internal only flags */ | |
| 546 | #define TCP_HYBRID_PACING_USER_MASK	0x0FFF		/* Non-internal flags mask */ | |
| 547 | #define TCP_HYBRID_PACING_SETMSS	0x1000		/* Internal flag that tells us we set the mss on this entry */ | |
| 511 | 548 | #define TCP_HYBRID_PACING_WASSET	0x2000		/* We init to this to know if a hybrid command was issued */ |
| 512 | ||
| 549 | #define TCP_HYBRID_PACING_SENDTIME	0x4000		/* Duplicate tm to last, use sendtime for catch up mode */ | |
| 513 | 550 | |
| 514 | 551 | struct tcp_hybrid_req { |
| 515 | 552 | 	struct tcp_snd_req req; |
| ... | ... | @@ -536,4 +573,5 @@ struct tcp_hybrid_req { |
| 536 | 573 | #define TCP_REUSPORT_LB_NUMA_NODOM	(-2) /* remove numa binding */ |
| 537 | 574 | #define TCP_REUSPORT_LB_NUMA_CURDOM	(-1) /* bind to current domain */ |
| 538 | 575 | |
| 576 | #endif /* __BSD_VISIBLE */ | |
| 539 | 577 | #endif /* !_NETINET_TCP_H_ */ |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/netinet/tcp_ecn.h+2-3| ... | ... | @@ -27,8 +27,6 @@ |
| 27 | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | * | |
| 31 | *	@(#)tcp_ecn.h	8.4 (Berkeley) 5/24/95 | |
| 32 | 30 | */ |
| 33 | 31 | |
| 34 | 32 | #ifndef _NETINET_TCP_ECN_H_ |
| ... | ... | @@ -40,6 +38,8 @@ |
| 40 | 38 | #include <netinet/tcp_var.h> |
| 41 | 39 | #include <netinet/tcp_syncache.h> |
| 42 | 40 | |
| 41 | #define TH_ACE_SHIFT 6 | |
| 42 | ||
| 43 | 43 | void	 tcp_ecn_input_syn_sent(struct tcpcb *, uint16_t, int); |
| 44 | 44 | void	 tcp_ecn_input_parallel_syn(struct tcpcb *, uint16_t, int); |
| 45 | 45 | int	 tcp_ecn_input_segment(struct tcpcb *, uint16_t, int, int, int); |
| ... | ... | @@ -48,7 +48,6 @@ int	 tcp_ecn_output_established(struct tcpcb *, uint16_t *, int, bool); |
| 48 | 48 | void	 tcp_ecn_syncache_socket(struct tcpcb *, struct syncache *); |
| 49 | 49 | int	 tcp_ecn_syncache_add(uint16_t, int); |
| 50 | 50 | uint16_t tcp_ecn_syncache_respond(uint16_t, struct syncache *); |
| 51 | int	 tcp_ecn_get_ace(uint16_t); | |
| 52 | 51 | |
| 53 | 52 | #endif /* _KERNEL */ |
| 54 | 53 |
lib/libc/include/generic-freebsd/netinet/tcp_fastopen.h+1| ... | ... | @@ -79,6 +79,7 @@ struct tcp_fastopen_ccache { |
| 79 | 79 | 	uint32_t 	secret; |
| 80 | 80 | }; |
| 81 | 81 | |
| 82 | struct tcpcb; | |
| 82 | 83 | #ifdef TCP_RFC7413 |
| 83 | 84 | void	tcp_fastopen_init(void); |
| 84 | 85 | void	tcp_fastopen_destroy(void); |
lib/libc/include/generic-freebsd/netinet/tcp_fsm.h-2| ... | ... | @@ -28,8 +28,6 @@ |
| 28 | 28 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 29 | 29 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 30 | 30 | * SUCH DAMAGE. |
| 31 | * | |
| 32 | *	@(#)tcp_fsm.h	8.1 (Berkeley) 6/10/93 | |
| 33 | 31 | */ |
| 34 | 32 | |
| 35 | 33 | #ifndef _NETINET_TCP_FSM_H_ |
lib/libc/include/generic-freebsd/netinet/tcp_hpts.h+46-91| ... | ... | @@ -26,14 +26,38 @@ |
| 26 | 26 | #ifndef __tcp_hpts_h__ |
| 27 | 27 | #define __tcp_hpts_h__ |
| 28 | 28 | |
| 29 | /* Number of useconds in a hpts tick */ | |
| 30 | #define HPTS_TICKS_PER_SLOT 10 | |
| 29 | /* Number of useconds represented by an hpts slot */ | |
| 30 | #define HPTS_USECS_PER_SLOT 10 | |
| 31 | 31 | #define HPTS_MS_TO_SLOTS(x) ((x * 100) + 1) |
| 32 | 32 | #define HPTS_USEC_TO_SLOTS(x) ((x+9) /10) |
| 33 | 33 | #define HPTS_USEC_IN_SEC 1000000 |
| 34 | 34 | #define HPTS_MSEC_IN_SEC 1000 |
| 35 | 35 | #define HPTS_USEC_IN_MSEC 1000 |
| 36 | 36 | |
| 37 | static inline uint32_t | |
| 38 | tcp_tv_to_hpts_slot(const struct timeval *sv) | |
| 39 | { | |
| 40 | 	return ((sv->tv_sec * 100000) + (sv->tv_usec / HPTS_USECS_PER_SLOT)); | |
| 41 | } | |
| 42 | ||
| 43 | static inline uint32_t | |
| 44 | tcp_tv_to_usec(const struct timeval *sv) | |
| 45 | { | |
| 46 | 	return ((uint32_t) ((sv->tv_sec * HPTS_USEC_IN_SEC) + sv->tv_usec)); | |
| 47 | } | |
| 48 | ||
| 49 | static inline uint32_t | |
| 50 | tcp_tv_to_msec(const struct timeval *sv) | |
| 51 | { | |
| 52 | 	return ((uint32_t) ((sv->tv_sec * HPTS_MSEC_IN_SEC) + (sv->tv_usec/HPTS_USEC_IN_MSEC))); | |
| 53 | } | |
| 54 | ||
| 55 | static inline uint64_t | |
| 56 | tcp_tv_to_lusec(const struct timeval *sv) | |
| 57 | { | |
| 58 | 	return ((uint64_t)((sv->tv_sec * HPTS_USEC_IN_SEC) + sv->tv_usec)); | |
| 59 | } | |
| 60 | ||
| 37 | 61 | struct hpts_diag { |
| 38 | 62 | 	uint32_t p_hpts_active; 	/* bbr->flex7 x */ |
| 39 | 63 | 	uint32_t p_nxt_slot;		/* bbr->flex1 x */ |
| ... | ... | @@ -66,52 +90,16 @@ struct hpts_diag { |
| 66 | 90 | #define PACE_PKT_OUTPUT 0x40	/* Output Packets being paced */ |
| 67 | 91 | #define PACE_TMR_MASK (PACE_TMR_KEEP|PACE_TMR_PERSIT|PACE_TMR_RXT|PACE_TMR_TLP|PACE_TMR_RACK|PACE_TMR_DELACK) |
| 68 | 92 | |
| 69 | #define DEFAULT_CONNECTION_THESHOLD 100 | |
| 93 | #ifdef _KERNEL | |
| 70 | 94 | |
| 71 | 95 | /* |
| 72 | * When using the hpts, a TCP stack must make sure | |
| 73 | * that once a INP_DROPPED flag is applied to a INP | |
| 74 | * that it does not expect tcp_output() to ever be | |
| 75 | * called by the hpts. The hpts will *not* call | |
| 76 | * any output (or input) functions on a TCB that | |
| 77 | * is in the DROPPED state. | |
| 78 | * | |
| 79 | * This implies final ACK's and RST's that might | |
| 80 | * be sent when a TCB is still around must be | |
| 81 | * sent from a routine like tcp_respond(). | |
| 82 | */ | |
| 83 | #define LOWEST_SLEEP_ALLOWED 50 | |
| 84 | #define DEFAULT_MIN_SLEEP 250	/* How many usec's is default for hpts sleep | |
| 85 | 				 * this determines min granularity of the | |
| 86 | 				 * hpts. If 1, granularity is 10useconds at | |
| 87 | 				 * the cost of more CPU (context switching). | |
| 88 | 				 * Note do not set this to 0. | |
| 89 | 				 */ | |
| 90 | #define DYNAMIC_MIN_SLEEP DEFAULT_MIN_SLEEP | |
| 91 | #define DYNAMIC_MAX_SLEEP 5000	/* 5ms */ | |
| 92 | ||
| 93 | /* Thresholds for raising/lowering sleep */ | |
| 94 | #define TICKS_INDICATE_MORE_SLEEP 100		/* This would be 1ms */ | |
| 95 | #define TICKS_INDICATE_LESS_SLEEP 1000		/* This would indicate 10ms */ | |
| 96 | /** | |
| 97 | * | |
| 98 | * Dynamic adjustment of sleeping times is done in "new" mode | |
| 99 | * where we are depending on syscall returns and lro returns | |
| 100 | * to push hpts forward mainly and the timer is only a backstop. | |
| 101 | * | |
| 102 | * When we are in the "new" mode i.e. conn_cnt > conn_cnt_thresh | |
| 103 | * then we do a dynamic adjustment on the time we sleep. | |
| 104 | * Our threshold is if the lateness of the first client served (in ticks) is | |
| 105 | * greater than or equal too ticks_indicate_more_sleep (10ms | |
| 106 | * or 10000 ticks). If we were that late, the actual sleep time | |
| 107 | * is adjusted down by 50%. If the ticks_ran is less than | |
| 108 | * ticks_indicate_more_sleep (100 ticks or 1000usecs). | |
| 109 | * | |
| 110 | */ | |
| 96 | * The following are the definitions for the kernel HPTS interface for managing | |
| 97 | * the HPTS ring and the TCBs on it. | |
| 98 | */ | |
| 111 | 99 | |
| 112 | #ifdef _KERNEL | |
| 113 | 100 | void tcp_hpts_init(struct tcpcb *); |
| 114 | 101 | void tcp_hpts_remove(struct tcpcb *); |
| 102 | ||
| 115 | 103 | static inline bool |
| 116 | 104 | tcp_in_hpts(struct tcpcb *tp) |
| 117 | 105 | { |
| ... | ... | @@ -149,57 +137,17 @@ uint32_t tcp_hpts_insert_diag(struct tcpcb *tp, uint32_t slot, int32_t line, |
| 149 | 137 | #define	tcp_hpts_insert(inp, slot)	\ |
| 150 | 138 | 	tcp_hpts_insert_diag((inp), (slot), __LINE__, NULL) |
| 151 | 139 | |
| 152 | void __tcp_set_hpts(struct tcpcb *tp, int32_t line); | |
| 153 | #define tcp_set_hpts(a) __tcp_set_hpts(a, __LINE__) | |
| 154 | ||
| 155 | void tcp_set_inp_to_drop(struct inpcb *inp, uint16_t reason); | |
| 156 | ||
| 157 | void tcp_lro_hpts_init(void); | |
| 158 | void tcp_lro_hpts_uninit(void); | |
| 159 | ||
| 160 | extern int32_t tcp_min_hptsi_time; | |
| 161 | ||
| 162 | #endif /* _KERNEL */ | |
| 163 | ||
| 164 | /* | |
| 165 | * The following functions should also be available | |
| 166 | * to userspace as well. | |
| 167 | */ | |
| 168 | static __inline uint32_t | |
| 169 | tcp_tv_to_hptstick(const struct timeval *sv) | |
| 170 | { | |
| 171 | 	return ((sv->tv_sec * 100000) + (sv->tv_usec / HPTS_TICKS_PER_SLOT)); | |
| 172 | } | |
| 173 | ||
| 174 | static __inline uint32_t | |
| 175 | tcp_tv_to_usectick(const struct timeval *sv) | |
| 176 | { | |
| 177 | 	return ((uint32_t) ((sv->tv_sec * HPTS_USEC_IN_SEC) + sv->tv_usec)); | |
| 178 | } | |
| 179 | ||
| 180 | static __inline uint32_t | |
| 181 | tcp_tv_to_mssectick(const struct timeval *sv) | |
| 182 | { | |
| 183 | 	return ((uint32_t) ((sv->tv_sec * HPTS_MSEC_IN_SEC) + (sv->tv_usec/HPTS_USEC_IN_MSEC))); | |
| 184 | } | |
| 185 | ||
| 186 | static __inline uint64_t | |
| 187 | tcp_tv_to_lusectick(const struct timeval *sv) | |
| 188 | { | |
| 189 | 	return ((uint64_t)((sv->tv_sec * HPTS_USEC_IN_SEC) + sv->tv_usec)); | |
| 190 | } | |
| 191 | ||
| 192 | #ifdef _KERNEL | |
| 140 | void tcp_set_hpts(struct tcpcb *tp); | |
| 193 | 141 | |
| 194 | 142 | extern int32_t tcp_min_hptsi_time; |
| 195 | 143 | |
| 196 | 144 | static inline int32_t |
| 197 | 145 | get_hpts_min_sleep_time(void) |
| 198 | 146 | { |
| 199 | 	return (tcp_min_hptsi_time + HPTS_TICKS_PER_SLOT); | |
| 147 | 	return (tcp_min_hptsi_time + HPTS_USECS_PER_SLOT); | |
| 200 | 148 | } |
| 201 | 149 | |
| 202 | static __inline uint32_t | |
| 150 | static inline uint32_t | |
| 203 | 151 | tcp_gethptstick(struct timeval *sv) |
| 204 | 152 | { |
| 205 | 153 | 	struct timeval tv; |
| ... | ... | @@ -207,10 +155,10 @@ tcp_gethptstick(struct timeval *sv) |
| 207 | 155 | 	if (sv == NULL) |
| 208 | 156 | 		sv = &tv; |
| 209 | 157 | 	microuptime(sv); |
| 210 | 	return (tcp_tv_to_hptstick(sv)); | |
| 158 | 	return (tcp_tv_to_hpts_slot(sv)); | |
| 211 | 159 | } |
| 212 | 160 | |
| 213 | static __inline uint64_t | |
| 161 | static inline uint64_t | |
| 214 | 162 | tcp_get_u64_usecs(struct timeval *tv) |
| 215 | 163 | { |
| 216 | 164 | 	struct timeval tvd; |
| ... | ... | @@ -218,10 +166,10 @@ tcp_get_u64_usecs(struct timeval *tv) |
| 218 | 166 | 	if (tv == NULL) |
| 219 | 167 | 		tv = &tvd; |
| 220 | 168 | 	microuptime(tv); |
| 221 | 	return (tcp_tv_to_lusectick(tv)); | |
| 169 | 	return (tcp_tv_to_lusec(tv)); | |
| 222 | 170 | } |
| 223 | 171 | |
| 224 | static __inline uint32_t | |
| 172 | static inline uint32_t | |
| 225 | 173 | tcp_get_usecs(struct timeval *tv) |
| 226 | 174 | { |
| 227 | 175 | 	struct timeval tvd; |
| ... | ... | @@ -229,8 +177,15 @@ tcp_get_usecs(struct timeval *tv) |
| 229 | 177 | 	if (tv == NULL) |
| 230 | 178 | 		tv = &tvd; |
| 231 | 179 | 	microuptime(tv); |
| 232 | 	return (tcp_tv_to_usectick(tv)); | |
| 180 | 	return (tcp_tv_to_usec(tv)); | |
| 233 | 181 | } |
| 234 | 182 | |
| 183 | /* | |
| 184 | * LRO HPTS initialization and uninitialization, only for internal use by the | |
| 185 | * HPTS code. | |
| 186 | */ | |
| 187 | void tcp_lro_hpts_init(void); | |
| 188 | void tcp_lro_hpts_uninit(void); | |
| 189 | ||
| 235 | 190 | #endif /* _KERNEL */ |
| 236 | 191 | #endif /* __tcp_hpts_h__ */ |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/netinet/tcp_log_buf.h+22-26| ... | ... | @@ -60,14 +60,6 @@ struct tcp_log_verbose |
| 60 | 60 | 	uint8_t		_pad[4]; |
| 61 | 61 | } ALIGN_TCP_LOG; |
| 62 | 62 | |
| 63 | /* Internal RACK state variables. */ | |
| 64 | struct tcp_log_rack | |
| 65 | { | |
| 66 | 	uint32_t	tlr_rack_rtt;		/* rc_rack_rtt */ | |
| 67 | 	uint8_t		tlr_state;		/* Internal RACK state */ | |
| 68 | 	uint8_t		_pad[3];		/* Padding */ | |
| 69 | }; | |
| 70 | ||
| 71 | 63 | struct tcp_log_bbr { |
| 72 | 64 | 	uint64_t cur_del_rate; |
| 73 | 65 | 	uint64_t delRate; |
| ... | ... | @@ -126,7 +118,6 @@ struct tcp_log_sendfile { |
| 126 | 118 | */ |
| 127 | 119 | union tcp_log_stackspecific |
| 128 | 120 | { |
| 129 | 	struct tcp_log_rack u_rack; | |
| 130 | 121 | 	struct tcp_log_bbr u_bbr; |
| 131 | 122 | 	struct tcp_log_sendfile u_sf; |
| 132 | 123 | 	struct tcp_log_raw u_raw;	/* "raw" log access */ |
| ... | ... | @@ -185,7 +176,6 @@ struct tcp_log_buffer |
| 185 | 176 | 	uint8_t		_pad[3];	/* Padding */ |
| 186 | 177 | 	/* Per-stack info */ |
| 187 | 178 | 	union tcp_log_stackspecific tlb_stackinfo; |
| 188 | #define	tlb_rack	tlb_stackinfo.u_rack | |
| 189 | 179 | |
| 190 | 180 | 	/* The packet */ |
| 191 | 181 | 	uint32_t	tlb_len;	/* The packet's data length */ |
| ... | ... | @@ -201,14 +191,14 @@ enum tcp_log_events { |
| 201 | 191 | 	TCP_LOG_OUT,		/* Transmit (without other event) 2 */ |
| 202 | 192 | 	TCP_LOG_RTO,		/* Retransmit timeout 3 */ |
| 203 | 193 | 	TCP_LOG_SB_WAKE,	/* Awaken socket buffer 4 */ |
| 204 | 	TCP_LOG_BAD_RETRAN,	/* Detected bad retransmission 5 */ | |
| 194 | 	TCP_UNUSED_5,		/* Detected bad retransmission 5 */ | |
| 205 | 195 | 	TCP_LOG_PRR,		/* Doing PRR 6 */ |
| 206 | 	TCP_LOG_REORDER,	/* Detected reorder 7 */ | |
| 196 | 	TCP_UNUSED_7,		/* Detected reorder 7 */ | |
| 207 | 197 | 	TCP_LOG_HPTS,		/* Hpts sending a packet 8 */ |
| 208 | 198 | 	BBR_LOG_BBRUPD,		/* We updated BBR info 9 */ |
| 209 | 199 | 	BBR_LOG_BBRSND,		/* We did a slot calculation and sending is done 10 */ |
| 210 | 200 | 	BBR_LOG_ACKCLEAR,	/* A ack clears all outstanding 11 */ |
| 211 | 	BBR_LOG_INQUEUE,	/* The tcb had a packet input to it 12 */ | |
| 201 | 	TCP_UNUSED_12,		/* The tcb had a packet input to it 12 */ | |
| 212 | 202 | 	BBR_LOG_TIMERSTAR,	/* Start a timer 13 */ |
| 213 | 203 | 	BBR_LOG_TIMERCANC,	/* Cancel a timer 14 */ |
| 214 | 204 | 	BBR_LOG_ENTREC,		/* Entered recovery 15 */ |
| ... | ... | @@ -245,7 +235,7 @@ enum tcp_log_events { |
| 245 | 235 | 	BBR_LOG_REDUCE,		/* old bbr log reduce for 4.1 and earlier 46*/ |
| 246 | 236 | 	TCP_LOG_RTT,		/* A rtt (in useconds) is being sampled and applied to the srtt algo 47 */ |
| 247 | 237 | 	BBR_LOG_SETTINGS_CHG,	/* Settings changed for loss response 48 */ |
| 248 | 	BBR_LOG_SRTT_GAIN_EVENT, /* SRTT gaining -- now not used 49 */ | |
| 238 | 	TCP_UNUSED_49,		/* SRTT gaining -- now not used 49 */ | |
| 249 | 239 | 	TCP_LOG_REASS,		/* Reassembly buffer logging 50 */ |
| 250 | 240 | 	TCP_HDWR_PACE_SIZE,	/* TCP pacing size set (rl and rack uses this) 51 */ |
| 251 | 241 | 	BBR_LOG_HDWR_PACE,	/* TCP Hardware pacing log 52 */ |
| ... | ... | @@ -253,9 +243,9 @@ enum tcp_log_events { |
| 253 | 243 | 	TCP_LOG_CONNEND,	/* End of connection 54 */ |
| 254 | 244 | 	TCP_LOG_LRO,		/* LRO entry 55 */ |
| 255 | 245 | 	TCP_SACK_FILTER_RES,	/* Results of SACK Filter 56 */ |
| 256 | 	TCP_SAD_DETECT,		/* Sack Attack Detection 57 */ | |
| 246 | 	TCP_UNUSED_57,		/* Sack Attack Detection 57 */ | |
| 257 | 247 | 	TCP_TIMELY_WORK,	/* Logs regarding Timely CC tweaks 58 */ |
| 258 | 	TCP_LOG_USER_EVENT,	/* User space event data 59 */ | |
| 248 | 	TCP_UNUSED_59,		/* User space event data 59 */ | |
| 259 | 249 | 	TCP_LOG_SENDFILE,	/* sendfile() logging for TCP connections 60 */ |
| 260 | 250 | 	TCP_LOG_REQ_T,		/* logging of request tracking 61 */ |
| 261 | 251 | 	TCP_LOG_ACCOUNTING,	/* Log of TCP Accounting data 62 */ |
| ... | ... | @@ -267,7 +257,9 @@ enum tcp_log_events { |
| 267 | 257 | 	TCP_RACK_TP_TRIGGERED,	/* A rack tracepoint is triggered 68 */ |
| 268 | 258 | 	TCP_HYBRID_PACING_LOG,	/* Hybrid pacing log 69 */ |
| 269 | 259 | 	TCP_LOG_PRU,		/* TCP protocol user request 70 */ |
| 270 | 	TCP_LOG_END		/* End (keep at end) 71 */ | |
| 260 | 	TCP_UNUSED_71,		/* old TCP Policer detectionn, not used 71 */ | |
| 261 | 	TCP_PCM_MEASURE,	/* TCP Path Capacity Measurement 72 */ | |
| 262 | 	TCP_LOG_END		/* End (keep at end) 73 */ | |
| 271 | 263 | }; |
| 272 | 264 | |
| 273 | 265 | enum tcp_log_states { |
| ... | ... | @@ -371,10 +363,11 @@ struct tcp_log_dev_log_queue { |
| 371 | 363 | #define TCP_TP_COLLAPSED_RXT	0x00000004	/* When we actually retransmit a collapsed window rsm */ |
| 372 | 364 | #define TCP_TP_REQ_LOG_FAIL	0x00000005	/* We tried to allocate a Request log but had no space */ |
| 373 | 365 | #define TCP_TP_RESET_RCV	0x00000006	/* Triggers when we receive a RST */ |
| 374 | #define TCP_TP_EXCESS_RXT	0x00000007	/* When we get excess RXT's clamping the cwnd */ | |
| 366 | #define TCP_TP_POLICER_DET	0x00000007	/* When we detect a policer */ | |
| 367 | #define TCP_TP_EXCESS_RXT	TCP_TP_POLICER_DET	/* alias */ | |
| 375 | 368 | #define TCP_TP_SAD_TRIGGERED	0x00000008	/* Sack Attack Detection triggers */ |
| 376 | ||
| 377 | 369 | #define TCP_TP_SAD_SUSPECT	0x0000000a	/* A sack has supicious information in it */ |
| 370 | #define TCP_TP_PACED_BOTTOM	0x0000000b	/* We have paced at the bottom */ | |
| 378 | 371 | |
| 379 | 372 | #ifdef _KERNEL |
| 380 | 373 | |
| ... | ... | @@ -384,12 +377,12 @@ extern int32_t tcp_trace_point_count; |
| 384 | 377 | |
| 385 | 378 | /* |
| 386 | 379 | * Returns true if any sort of BB logging is enabled, |
| 387 | * commonly used throughout the codebase. | |
| 380 | * commonly used throughout the codebase. | |
| 388 | 381 | */ |
| 389 | 382 | static inline int |
| 390 | 383 | tcp_bblogging_on(struct tcpcb *tp) |
| 391 | 384 | { |
| 392 | 	if (tp->_t_logstate <= TCP_LOG_STATE_OFF) | |
| 385 | 	if (tp->_t_logstate <= TCP_LOG_STATE_OFF) | |
| 393 | 386 | 		return (0); |
| 394 | 387 | 	if (tp->_t_logstate == TCP_LOG_VIA_BBPOINTS) |
| 395 | 388 | 		return (0); |
| ... | ... | @@ -434,7 +427,7 @@ tcp_set_bblog_state(struct tcpcb *tp, uint8_t ls, uint8_t bbpoint) |
| 434 | 427 | 	} |
| 435 | 428 | } |
| 436 | 429 | |
| 437 | static inline uint32_t | |
| 430 | static inline uint32_t | |
| 438 | 431 | tcp_get_bblog_state(struct tcpcb *tp) |
| 439 | 432 | { |
| 440 | 433 | 	return (tp->_t_logstate); |
| ... | ... | @@ -546,12 +539,12 @@ struct tcpcb; |
| 546 | 539 | 			 NULL, NULL, 0, NULL);			\ |
| 547 | 540 | 	} while (0) |
| 548 | 541 | #endif /* TCP_LOG_FORCEVERBOSE */ |
| 542 | /* Assumes/requires the caller has already checked tcp_bblogging_on(tp). */ | |
| 549 | 543 | #define	TCP_LOG_EVENTP(tp, th, rxbuf, txbuf, eventid, errornum, len, stackinfo, th_hostorder, tv) \ |
| 550 | 544 | 	do {								\ |
| 551 | 		if (tcp_bblogging_on(tp))				\ | |
| 552 | 			tcp_log_event(tp, th, rxbuf, txbuf, eventid,	\ | |
| 553 | 			 errornum, len, stackinfo, th_hostorder,	\ | |
| 554 | 			 NULL, NULL, 0, tv);				\ | |
| 545 | 		KASSERT(tcp_bblogging_on(tp), ("bblogging is off")); \ | |
| 546 | 		tcp_log_event(tp, th, rxbuf, txbuf, eventid, errornum, len,	\ | |
| 547 | 			stackinfo, th_hostorder, NULL, NULL, 0, tv); \ | |
| 555 | 548 | 	} while (0) |
| 556 | 549 | |
| 557 | 550 | #ifdef TCP_BLACKBOX |
| ... | ... | @@ -577,6 +570,9 @@ void tcp_log_flowend(struct tcpcb *tp); |
| 577 | 570 | void tcp_log_sendfile(struct socket *so, off_t offset, size_t nbytes, |
| 578 | 571 | int flags); |
| 579 | 572 | int tcp_log_apply_ratio(struct tcpcb *tp, int ratio); |
| 573 | #ifdef DDB | |
| 574 | void db_print_bblog_entries(struct tcp_log_stailq *log_entries, int indent); | |
| 575 | #endif | |
| 580 | 576 | #else /* !TCP_BLACKBOX */ |
| 581 | 577 | #define tcp_log_verbose	(false) |
| 582 | 578 |
lib/libc/include/generic-freebsd/netinet/tcp_offload.h+2| ... | ... | @@ -38,6 +38,8 @@ |
| 38 | 38 | |
| 39 | 39 | extern int registered_toedevs; |
| 40 | 40 | |
| 41 | struct tcpcb; | |
| 42 | ||
| 41 | 43 | int tcp_offload_connect(struct socket *, struct sockaddr *); |
| 42 | 44 | void tcp_offload_listen_start(struct tcpcb *); |
| 43 | 45 | void tcp_offload_listen_stop(struct tcpcb *); |
lib/libc/include/generic-freebsd/netinet/tcp_pcap.h deleted-39| ... | ... | @@ -1,39 +0,0 @@ |
| 1 | /*- | |
| 2 | * Copyright (c) 2015 | |
| 3 | *	Jonathan Looney. All rights reserved. | |
| 4 | * | |
| 5 | * Redistribution and use in source and binary forms, with or without | |
| 6 | * modification, are permitted provided that the following conditions | |
| 7 | * are met: | |
| 8 | * 1. Redistributions of source code must retain the above copyright | |
| 9 | * notice, this list of conditions and the following disclaimer. | |
| 10 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 11 | * notice, this list of conditions and the following disclaimer in the | |
| 12 | * documentation and/or other materials provided with the distribution. | |
| 13 | * | |
| 14 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |
| 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 16 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
| 17 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | |
| 18 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
| 19 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
| 20 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
| 21 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
| 22 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
| 23 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
| 24 | * SUCH DAMAGE. | |
| 25 | */ | |
| 26 | ||
| 27 | #ifndef _NETINET_TCP_PCAP_H_ | |
| 28 | #define _NETINET_TCP_PCAP_H_ | |
| 29 | ||
| 30 | void tcp_pcap_init(void); | |
| 31 | void tcp_pcap_add(struct tcphdr *th, struct mbuf *m, struct mbufq *queue); | |
| 32 | void tcp_pcap_drain(struct mbufq *queue); | |
| 33 | void tcp_pcap_tcpcb_init(struct tcpcb *tp); | |
| 34 | void tcp_pcap_set_sock_max(struct mbufq *queue, int newval); | |
| 35 | int tcp_pcap_get_sock_max(struct mbufq *queue); | |
| 36 | ||
| 37 | extern int tcp_pcap_aggressive_free; | |
| 38 | ||
| 39 | #endif /* _NETINET_TCP_PCAP_H_ */ | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/netinet/tcp_ratelimit.h+9| ... | ... | @@ -94,6 +94,8 @@ CK_LIST_HEAD(head_tcp_rate_set, tcp_rate_set); |
| 94 | 94 | #ifndef ETHERNET_SEGMENT_SIZE |
| 95 | 95 | #define ETHERNET_SEGMENT_SIZE 1514 |
| 96 | 96 | #endif |
| 97 | struct tcpcb; | |
| 98 | ||
| 97 | 99 | #ifdef RATELIMIT |
| 98 | 100 | #define DETAILED_RATELIMIT_SYSCTL 1	/* |
| 99 | 101 | 					 * Undefine this if you don't want |
| ... | ... | @@ -131,6 +133,9 @@ tcp_get_pacing_burst_size_w_divisor(struct tcpcb *tp, uint64_t bw, uint32_t segs |
| 131 | 133 | void |
| 132 | 134 | tcp_rl_log_enobuf(const struct tcp_hwrate_limit_table *rte); |
| 133 | 135 | |
| 136 | void | |
| 137 | tcp_rl_release_ifnet(struct ifnet *ifp); | |
| 138 | ||
| 134 | 139 | #else |
| 135 | 140 | static inline const struct tcp_hwrate_limit_table * |
| 136 | 141 | tcp_set_pacing_rate(struct tcpcb *tp, struct ifnet *ifp, |
| ... | ... | @@ -218,6 +223,10 @@ tcp_rl_log_enobuf(const struct tcp_hwrate_limit_table *rte) |
| 218 | 223 | { |
| 219 | 224 | } |
| 220 | 225 | |
| 226 | static inline void | |
| 227 | tcp_rl_release_ifnet(struct ifnet *ifp) | |
| 228 | { | |
| 229 | } | |
| 221 | 230 | #endif |
| 222 | 231 | |
| 223 | 232 | /* |
lib/libc/include/generic-freebsd/netinet/tcp_seq.h-2| ... | ... | @@ -27,8 +27,6 @@ |
| 27 | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | * | |
| 31 | *	@(#)tcp_seq.h	8.3 (Berkeley) 6/21/95 | |
| 32 | 30 | */ |
| 33 | 31 | |
| 34 | 32 | #ifndef _NETINET_TCP_SEQ_H_ |
lib/libc/include/generic-freebsd/netinet/tcp_stacks/rack_bbr_common.h+9-14| ... | ... | @@ -89,30 +89,25 @@ int ctf_do_queued_segments(struct tcpcb *tp, int have_pkt); |
| 89 | 89 | uint32_t ctf_outstanding(struct tcpcb *tp); |
| 90 | 90 | uint32_t ctf_flight_size(struct tcpcb *tp, uint32_t rc_sacked); |
| 91 | 91 | int |
| 92 | _ctf_drop_checks(struct tcpopt *to, struct mbuf *m, struct tcphdr *th, | |
| 92 | ctf_drop_checks(struct tcpopt *to, struct mbuf *m, struct tcphdr *th, | |
| 93 | 93 | struct tcpcb *tp, int32_t *tlenp, |
| 94 | int32_t *thf, int32_t *drop_hdrlen, int32_t *ret_val, | |
| 95 | uint32_t *ts, uint32_t *cnt); | |
| 96 | void ctf_ack_war_checks(struct tcpcb *tp, uint32_t *ts, uint32_t *cnt); | |
| 97 | #define ctf_drop_checks(a, b, c, d, e, f, g, h) _ctf_drop_checks(a, b, c, d, e, f, g, h, NULL, NULL) | |
| 94 | int32_t *thf, int32_t *drop_hdrlen, int32_t *ret_val); | |
| 95 | void ctf_ack_war_checks(struct tcpcb *tp); | |
| 98 | 96 | |
| 99 | 97 | void |
| 100 | __ctf_do_dropafterack(struct mbuf *m, struct tcpcb *tp, | |
| 98 | ctf_do_dropafterack(struct mbuf *m, struct tcpcb *tp, | |
| 101 | 99 | struct tcphdr *th, int32_t thflags, int32_t tlen, |
| 102 | int32_t *ret_val, uint32_t *ts, uint32_t *cnt); | |
| 103 | ||
| 104 | #define ctf_do_dropafterack(a, b, c, d, e, f) __ctf_do_dropafterack(a, b, c, d, e, f, NULL, NULL) | |
| 100 | int32_t *ret_val); | |
| 105 | 101 | |
| 106 | 102 | void |
| 107 | 103 | ctf_do_dropwithreset(struct mbuf *m, struct tcpcb *tp, |
| 108 | 	struct tcphdr *th, int32_t rstreason, int32_t tlen); | |
| 104 | 	struct tcphdr *th, int32_t tlen); | |
| 109 | 105 | void |
| 110 | 106 | ctf_do_drop(struct mbuf *m, struct tcpcb *tp); |
| 111 | 107 | |
| 112 | 108 | int |
| 113 | __ctf_process_rst(struct mbuf *m, struct tcphdr *th, | |
| 114 | struct socket *so, struct tcpcb *tp, uint32_t *ts, uint32_t *cnt); | |
| 115 | #define ctf_process_rst(m, t, s, p) __ctf_process_rst(m, t, s, p, NULL, NULL) | |
| 109 | ctf_process_rst(struct mbuf *m, struct tcphdr *th, | |
| 110 | struct socket *so, struct tcpcb *tp); | |
| 116 | 111 | |
| 117 | 112 | void |
| 118 | 113 | ctf_challenge_ack(struct mbuf *m, struct tcphdr *th, |
| ... | ... | @@ -130,7 +125,7 @@ ctf_calc_rwin(struct socket *so, struct tcpcb *tp); |
| 130 | 125 | |
| 131 | 126 | void |
| 132 | 127 | ctf_do_dropwithreset_conn(struct mbuf *m, struct tcpcb *tp, struct tcphdr *th, |
| 133 | int32_t rstreason, int32_t tlen); | |
| 128 | int32_t tlen); | |
| 134 | 129 | |
| 135 | 130 | uint32_t |
| 136 | 131 | ctf_fixed_maxseg(struct tcpcb *tp); |
lib/libc/include/generic-freebsd/netinet/tcp_stacks/sack_filter.h+83-13| ... | ... | @@ -25,19 +25,84 @@ |
| 25 | 25 | * SUCH DAMAGE. |
| 26 | 26 | */ |
| 27 | 27 | |
| 28 | /* | |
| 29 | * Seven entry's is carefully choosen to | |
| 30 | * fit in one cache line. We can easily | |
| 31 | * change this to 15 (but it gets very | |
| 32 | * little extra filtering). To change it | |
| 33 | * to be larger than 15 would require either | |
| 34 | * sf_bits becoming a uint32_t and then you | |
| 35 | * could go to 31.. or change it to a full | |
| 36 | * bitstring.. It is really doubtful you | |
| 37 | * will get much benefit beyond 7, in testing | |
| 38 | * there was a small amount but very very small. | |
| 28 | /** | |
| 29 | * | |
| 30 | * The Sack filter is designed to do two functions, first it trys to reduce | |
| 31 | * the processing of sacks. Consider that often times you get something like | |
| 32 | * | |
| 33 | * ack 1 (sack 100:200) | |
| 34 | * ack 1 (sack 100:300) | |
| 35 | * ack 1 (sack(100:400) | |
| 36 | * | |
| 37 | * You really want to process the 100:200 and then on the next sack process | |
| 38 | * only 200:300 (the new data) and then finally on the third 300:400. The filter | |
| 39 | * removes from your processing routines the already processed sack information so | |
| 40 | * that after the filter completes you only have "new" sacks that you have not | |
| 41 | * processed. This saves computation time so you do not need to worry about | |
| 42 | * previously processed sack information. | |
| 43 | * | |
| 44 | * The second thing that the sack filter does is help protect against malicious | |
| 45 | * attackers that are trying to attack any linked lists (or other data structures) | |
| 46 | * that are used in sack processing. Consider an attacker sending in sacks for | |
| 47 | * every other byte of data outstanding. This could in theory drastically split | |
| 48 | * up any scoreboard you are maintaining and make you search through a very large | |
| 49 | * linked list (or other structure) eating up CPU. If you split far enough and | |
| 50 | * fracture your data structure enough you could potentially be crippled by a malicious | |
| 51 | * peer. How the filter works here is it filters out sacks that are less than an MSS. | |
| 52 | * We do this because generally a packet (aka MSS) should be kept whole. The only place | |
| 53 | * we allow a smaller SACK is when the SACK touches the end of our socket buffer. This allows | |
| 54 | * TLP to still work properly and yet protects us from splitting. The filter also only allows | |
| 55 | * a set number of splits (defined in SACK_FILTER_BLOCKS). If more than that many sacks locations | |
| 56 | * are being sent we discard additional ones until the earlier holes are filled up. The maximum | |
| 57 | * the current filter can be is 15, which we have moved to since we want to be as generous as | |
| 58 | * possible with allowing for loss. However, in previous testing of the filter it was found | |
| 59 | * that there was very little benefit from moving from 7 to 15 sack points. Though at | |
| 60 | * that previous set of tests, we would just discard earlier information in the filter. Now | |
| 61 | * that we do not do that i.e. discard information and instead drop sack data we have raised | |
| 62 | * the value to the max i.e. 15. If you want to expand beyond 15 one would have to either increase | |
| 63 | * the size of the sf_bits to a uint32_t which could then get you a maximum of 31 splits or | |
| 64 | * move to a true bitstring. If this is done however it further increases your risk to | |
| 65 | * sack attacks, the bigger the number of splits (filter blocks) that are allowed | |
| 66 | * the larger your processing arrays will grow as well as the filter. | |
| 67 | * | |
| 68 | * Note that this protection does not prevent an attacker from asking for a 20 byte | |
| 69 | * MSS, that protection must be done elsewhere during the negotiation of the connection | |
| 70 | * and is done now by just ignoring sack's from connections with too small of MSS which | |
| 71 | * prevents sack from working and thus makes the connection less efficient but protects | |
| 72 | * the system from harm. | |
| 73 | * | |
| 74 | * We may actually want to consider dropping the size of the array back to 7 to further | |
| 75 | * protect the system which would be a more cautious approach. | |
| 76 | * | |
| 77 | * TCP Developer information: | |
| 78 | * | |
| 79 | * To use the sack filter its actually pretty simple. All you do is the normal sorting | |
| 80 | * and sanity checks of your sacks but then after that you call out to sack_filter_blks() | |
| 81 | * passing in the tcpcb, the sack-filter you are using (memory you have allocated) the | |
| 82 | * pointer to the sackblk array and how many sorted valid blocks there are as well | |
| 83 | * as what the new th_ack point is. The filter will return to you the number of | |
| 84 | * blocks left after filtering. It will reshape the blocks based on the previous | |
| 85 | * sacks you have received and processed. If sack_filter_blks() returns 0 then no | |
| 86 | * new sack data is present to be processed. | |
| 87 | * | |
| 88 | * Whenever you reach the point of snd_una == snd_max, you should call sack_filter_clear with | |
| 89 | * the snd_una point. You also need to call this if you invalidate your sack array for any | |
| 90 | * reason (such as RTO's or MTU changes or some other thing that makes you think all | |
| 91 | * data is now un-acknowledged). You can also pass in sack_filter_blks(tp, sf, NULL, 0, th_ack) to | |
| 92 | * advance the cum-ack point. You can use sack_filter_blks_used(sf) to determine if you have filter blocks as | |
| 93 | * well. So putting these two together, anytime the cum-ack moves forward you probably want to | |
| 94 | * do: | |
| 95 | * if (sack_filter_blks_used(sf)) | |
| 96 | * sack_filter_blks(tp, sf, NULL, 0, th_ack); | |
| 97 | * | |
| 98 | * If for some reason you have ran the sack-filter and something goes wrong (you can't allocate space | |
| 99 | * for example to split your sack-array. You can "undo" the data within the sack filter by calling | |
| 100 | * sack_filter_rject(sf, in) passing in the list of blocks to be "removed" from the sack-filter. | |
| 101 | * You can see an example of this use in bbr.c though rack.c has never found it needed. | |
| 102 | * | |
| 39 | 103 | */ |
| 40 | #define SACK_FILTER_BLOCKS 7 | |
| 104 | ||
| 105 | #define SACK_FILTER_BLOCKS 15 | |
| 41 | 106 | |
| 42 | 107 | struct sack_filter { |
| 43 | 108 | 	tcp_seq sf_ack; |
| ... | ... | @@ -48,8 +113,13 @@ struct sack_filter { |
| 48 | 113 | }; |
| 49 | 114 | #ifdef _KERNEL |
| 50 | 115 | void sack_filter_clear(struct sack_filter *sf, tcp_seq seq); |
| 51 | int sack_filter_blks(struct sack_filter *sf, struct sackblk *in, int numblks, | |
| 116 | int sack_filter_blks(struct tcpcb *tp, struct sack_filter *sf, struct sackblk *in, int numblks, | |
| 52 | 117 | 		 tcp_seq th_ack); |
| 53 | 118 | void sack_filter_reject(struct sack_filter *sf, struct sackblk *in); |
| 119 | static inline uint8_t sack_filter_blks_used(struct sack_filter *sf) | |
| 120 | { | |
| 121 | 	return (sf->sf_used); | |
| 122 | } | |
| 123 | ||
| 54 | 124 | #endif |
| 55 | 125 | #endif |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/netinet/tcp_stacks/tailq_hash.h+7-1| ... | ... | @@ -13,10 +13,12 @@ |
| 13 | 13 | #define MAX_ALLOWED_SEQ_RANGE (SEQ_BUCKET_SIZE * (MAX_HASH_ENTRIES-1)) |
| 14 | 14 | |
| 15 | 15 | struct tailq_hash { |
| 16 | 	struct rack_head ht[MAX_HASH_ENTRIES]; | |
| 17 | 16 | 	uint32_t min; |
| 18 | 17 | 	uint32_t max; |
| 19 | 18 | 	uint32_t count; |
| 19 | 	struct rack_sendmap *rsm_min; | |
| 20 | 	struct rack_sendmap *rsm_max; | |
| 21 | 	struct rack_head ht[MAX_HASH_ENTRIES]; | |
| 20 | 22 | }; |
| 21 | 23 | |
| 22 | 24 | struct rack_sendmap * |
| ... | ... | @@ -53,6 +55,10 @@ tqhash_init(struct tailq_hash *hs); |
| 53 | 55 | int |
| 54 | 56 | tqhash_trim(struct tailq_hash *hs, uint32_t th_ack); |
| 55 | 57 | |
| 58 | void | |
| 59 | tqhash_update_end(struct tailq_hash *hs, struct rack_sendmap *rsm, | |
| 60 | uint32_t th_ack); | |
| 61 | ||
| 56 | 62 | |
| 57 | 63 | #define	TQHASH_FOREACH(var, head) \ |
| 58 | 64 | 	for ((var) = tqhash_min((head));		\ |
lib/libc/include/generic-freebsd/netinet/tcp_stacks/tcp_bbr.h-2| ... | ... | @@ -347,8 +347,6 @@ struct bbr_log_sysctl_out { |
| 347 | 347 | /* |
| 348 | 348 | * Locking for the rack control block. |
| 349 | 349 | * a) Locked by INP_WLOCK |
| 350 | * b) Locked by the hpts-mutex | |
| 351 | * | |
| 352 | 350 | */ |
| 353 | 351 | #define BBR_STATE_STARTUP 0x01 |
| 354 | 352 | #define BBR_STATE_DRAIN 0x02 |
lib/libc/include/generic-freebsd/netinet/tcp_stacks/tcp_rack.h+89-66| ... | ... | @@ -48,6 +48,8 @@ |
| 48 | 48 | #define RACK_MERGED	 0x080000/* The RSM was merged */ |
| 49 | 49 | #define RACK_PMTU_CHG	 0x100000/* The path mtu changed on this guy */ |
| 50 | 50 | #define RACK_STRADDLE	 0x200000/* The seq straddles the bucket line */ |
| 51 | #define RACK_WAS_LOST	 0x400000/* Is the rsm considered lost */ | |
| 52 | #define RACK_IS_PCM 0x800000/* A PCM measurement is being taken */ | |
| 51 | 53 | #define RACK_NUM_OF_RETRANS 3 |
| 52 | 54 | |
| 53 | 55 | #define RACK_INITIAL_RTO 1000000 /* 1 second in microseconds */ |
| ... | ... | @@ -63,6 +65,7 @@ struct rack_sendmap { |
| 63 | 65 | 	uint32_t r_rtr_bytes;	/* How many bytes have been retransmitted */ |
| 64 | 66 | 	uint32_t r_flags : 24,	/* Flags as defined above */ |
| 65 | 67 | 		 r_rtr_cnt : 8;	/* Retran count, index this -1 to get time */ |
| 68 | 	uint32_t r_act_rxt_cnt; /* The actual total count of transmits */ | |
| 66 | 69 | 	struct mbuf *m; |
| 67 | 70 | 	uint32_t soff; |
| 68 | 71 | 	uint32_t orig_m_len;	/* The original mbuf len when we sent (can update) */ |
| ... | ... | @@ -174,6 +177,8 @@ struct rack_rtt_sample { |
| 174 | 177 | #define RACK_TO_FRM_PERSIST 5 |
| 175 | 178 | #define RACK_TO_FRM_DELACK 6 |
| 176 | 179 | |
| 180 | #define RCV_PATH_RTT_MS 10	/* How many ms between recv path RTT's */ | |
| 181 | ||
| 177 | 182 | struct rack_opts_stats { |
| 178 | 183 | 	uint64_t tcp_rack_tlp_reduce; |
| 179 | 184 | 	uint64_t tcp_rack_pace_always; |
| ... | ... | @@ -194,7 +199,6 @@ struct rack_opts_stats { |
| 194 | 199 | 	uint64_t tcp_rack_min_pace_seg; |
| 195 | 200 | 	uint64_t tcp_rack_pace_rate_ca; |
| 196 | 201 | 	uint64_t tcp_rack_rr; |
| 197 | 	uint64_t tcp_rack_do_detection; | |
| 198 | 202 | 	uint64_t tcp_rack_rrr_no_conf_rate; |
| 199 | 203 | 	uint64_t tcp_initial_rate; |
| 200 | 204 | 	uint64_t tcp_initial_win; |
| ... | ... | @@ -232,7 +236,7 @@ struct rack_opts_stats { |
| 232 | 236 | 	uint64_t tcp_rack_rtt_use; |
| 233 | 237 | 	uint64_t tcp_data_after_close; |
| 234 | 238 | 	uint64_t tcp_defer_opt; |
| 235 | 	uint64_t tcp_rxt_clamp; | |
| 239 | 	uint64_t tcp_pol_detect; | |
| 236 | 240 | 	uint64_t tcp_rack_beta; |
| 237 | 241 | 	uint64_t tcp_rack_beta_ecn; |
| 238 | 242 | 	uint64_t tcp_rack_timer_slop; |
| ... | ... | @@ -242,6 +246,11 @@ struct rack_opts_stats { |
| 242 | 246 | 	uint64_t tcp_rack_pacing_divisor; |
| 243 | 247 | 	uint64_t tcp_rack_min_seg; |
| 244 | 248 | 	uint64_t tcp_dgp_in_rec; |
| 249 | 	uint64_t tcp_notimely; | |
| 250 | 	uint64_t tcp_honor_hpts; | |
| 251 | 	uint64_t tcp_dyn_rec; | |
| 252 | 	uint64_t tcp_fillcw_rate_cap; | |
| 253 | 	uint64_t tcp_pol_mss; | |
| 245 | 254 | }; |
| 246 | 255 | |
| 247 | 256 | /* RTT shrink reasons */ |
| ... | ... | @@ -263,6 +272,9 @@ struct rack_opts_stats { |
| 263 | 272 | #define TLP_USE_TWO_TWO 3	/* Use 2.2 behavior */ |
| 264 | 273 | #define RACK_MIN_BW 8000	/* 64kbps in Bps */ |
| 265 | 274 | |
| 275 | #define CCSP_DIS_MASK	0x0001 | |
| 276 | #define HYBRID_DIS_MASK	0x0002 | |
| 277 | ||
| 266 | 278 | /* Rack quality indicators for GPUT measurements */ |
| 267 | 279 | #define RACK_QUALITY_NONE	0	/* No quality stated */ |
| 268 | 280 | #define RACK_QUALITY_HIGH 	1	/* A normal measurement of a GP RTT */ |
| ... | ... | @@ -315,10 +327,9 @@ extern counter_u64_t rack_opts_arry[RACK_OPTS_SIZE]; |
| 315 | 327 | /* |
| 316 | 328 | * Locking for the rack control block. |
| 317 | 329 | * a) Locked by INP_WLOCK |
| 318 | * b) Locked by the hpts-mutex | |
| 319 | * | |
| 320 | 330 | */ |
| 321 | 331 | #define RACK_GP_HIST 4	/* How much goodput history do we maintain? */ |
| 332 | #define RETRAN_CNT_SIZE 16 | |
| 322 | 333 | |
| 323 | 334 | #define RACK_NUM_FSB_DEBUG 16 |
| 324 | 335 | #ifdef _KERNEL |
| ... | ... | @@ -342,6 +353,26 @@ struct rack_fast_send_blk { |
| 342 | 353 | |
| 343 | 354 | struct tailq_hash; |
| 344 | 355 | |
| 356 | struct rack_pcm_info { | |
| 357 | 	/* Base send time and s/e filled in by rack_log_output */ | |
| 358 | 	uint64_t send_time; | |
| 359 | 	uint32_t sseq; | |
| 360 | 	uint32_t eseq; | |
| 361 | 	/* Ack's fill in the rest of the data */ | |
| 362 | 	uint16_t cnt; | |
| 363 | 	/* Maximum acks present */ | |
| 364 | 	uint16_t cnt_alloc; | |
| 365 | }; | |
| 366 | ||
| 367 | #define RACK_DEFAULT_PCM_ARRAY 16 | |
| 368 | ||
| 369 | struct rack_pcm_stats { | |
| 370 | 	uint32_t sseq; | |
| 371 | 	uint32_t eseq; | |
| 372 | 	uint64_t ack_time; | |
| 373 | }; | |
| 374 | ||
| 375 | ||
| 345 | 376 | struct rack_control { |
| 346 | 377 | 	/* Second cache line 0x40 from tcp_rack */ |
| 347 | 378 | 	struct tailq_hash *tqh; /* Tree of all segments Lock(a) */ |
| ... | ... | @@ -423,20 +454,14 @@ struct rack_control { |
| 423 | 454 | 	uint16_t rack_per_of_gp_rec; /* 100 = 100%, so from 65536 = 655 x bw, 0=off */ |
| 424 | 455 | 	uint16_t rack_per_of_gp_probertt; /* 100 = 100%, so from 65536 = 655 x bw, 0=off */ |
| 425 | 456 | 	uint32_t rc_high_rwnd; |
| 426 | 	uint32_t ack_count; | |
| 427 | 	uint32_t sack_count; | |
| 428 | 	uint32_t sack_noextra_move; | |
| 429 | 	uint32_t sack_moved_extra; | |
| 430 | 457 | 	struct rack_rtt_sample rack_rs; |
| 431 | 458 | 	const struct tcp_hwrate_limit_table *crte; |
| 432 | 459 | 	uint32_t rc_agg_early; |
| 433 | 460 | 	uint32_t rc_agg_delayed; |
| 434 | 461 | 	uint32_t rc_tlp_rxt_last_time; |
| 435 | 	uint32_t rc_saved_cwnd; | |
| 436 | 462 | 	uint64_t rc_gp_output_ts; /* chg*/ |
| 437 | 463 | 	uint64_t rc_gp_cumack_ts; /* chg*/ |
| 438 | 464 | 	struct timeval act_rcv_time; |
| 439 | 	struct timeval rc_last_time_decay;	/* SAD time decay happened here */ | |
| 440 | 465 | 	uint64_t gp_bw; |
| 441 | 466 | 	uint64_t init_rate; |
| 442 | 467 | #ifdef NETFLIX_SHARED_CWND |
| ... | ... | @@ -452,19 +477,29 @@ struct rack_control { |
| 452 | 477 | 	struct tcp_sendfile_track *rc_last_sft; |
| 453 | 478 | 	uint32_t lt_seq;	/* Seq at start of lt_bw gauge */ |
| 454 | 479 | 	int32_t rc_rtt_diff;		/* Timely style rtt diff of our gp_srtt */ |
| 455 | 	uint64_t last_sndbytes; | |
| 456 | 	uint64_t last_snd_rxt_bytes; | |
| 457 | 	uint64_t rxt_threshold; | |
| 458 | 480 | 	uint64_t last_tmit_time_acked;	/* Holds the last cumack point's last send time */ |
| 459 | 	uint32_t last_rnd_rxt_clamped; | |
| 460 | 	uint32_t num_of_clamps_applied; | |
| 461 | 	uint32_t clamp_options; | |
| 462 | 	uint32_t max_clamps; | |
| 481 | 	/* Recovery stats */ | |
| 482 | 	uint64_t last_sendtime; | |
| 483 | ||
| 484 | 	uint64_t last_gpest; | |
| 485 | 	uint64_t last_tm_mark;		/* Last tm mark used */ | |
| 486 | 	uint64_t fillcw_cap;		/* B/W cap on fill cw */ | |
| 487 | 	struct rack_pcm_info pcm_i; | |
| 488 | 	struct rack_pcm_stats *pcm_s; | |
| 489 | 	uint32_t gp_gain_req;		/* Percent off gp gain req */ | |
| 490 | 	uint32_t last_rnd_of_gp_rise; | |
| 491 | 	uint32_t gp_rnd_thresh; | |
| 492 | 	uint32_t ss_hi_fs; | |
| 493 | 	uint32_t gate_to_fs; | |
| 494 | 	uint32_t pcm_max_seg; | |
| 495 | 	uint32_t last_pcm_round; | |
| 496 | 	uint32_t pcm_idle_rounds; | |
| 463 | 497 | |
| 464 | 498 | 	uint32_t rc_gp_srtt;		/* Current GP srtt */ |
| 465 | 499 | 	uint32_t rc_prev_gp_srtt;	/* Previous RTT */ |
| 466 | 500 | 	uint32_t rc_entry_gp_rtt;	/* Entry to PRTT gp-rtt */ |
| 467 | 501 | 	uint32_t rc_loss_at_start;	/* At measurement window where was our lost value */ |
| 502 | 	uint32_t rc_considered_lost;	/* Count in recovery of non-retransmitted bytes considered lost */ | |
| 468 | 503 | |
| 469 | 504 | 	uint32_t dsack_round_end;	/* In a round of seeing a DSACK */ |
| 470 | 505 | 	uint32_t current_round;		/* Starting at zero */ |
| ... | ... | @@ -491,22 +526,23 @@ struct rack_control { |
| 491 | 526 | 	uint32_t rc_snd_max_at_rto;	/* For non-sack when the RTO occurred what was snd-max */ |
| 492 | 527 | 	uint32_t rc_out_at_rto; |
| 493 | 528 | 	int32_t rc_scw_index; |
| 529 | 	uint32_t max_reduction; | |
| 530 | 	uint32_t side_chan_dis_mask; 	/* Bit mask of socket opt's disabled */ | |
| 494 | 531 | 	uint32_t rc_tlp_threshold;	/* Socket option value Lock(a) */ |
| 495 | 532 | 	uint32_t rc_last_timeout_snduna; |
| 496 | 533 | 	uint32_t last_tlp_acked_start; |
| 497 | 534 | 	uint32_t last_tlp_acked_end; |
| 498 | 	uint32_t challenge_ack_ts; | |
| 499 | 	uint32_t challenge_ack_cnt; | |
| 500 | 535 | 	uint32_t rc_min_to;	/* Socket option value Lock(a) */ |
| 501 | 536 | 	uint32_t rc_pkt_delay;	/* Socket option value Lock(a) */ |
| 502 | 537 | 	uint32_t persist_lost_ends; |
| 503 | 	uint32_t ack_during_sd; | |
| 504 | 	uint32_t input_pkt; | |
| 505 | 	uint32_t saved_input_pkt; | |
| 506 | 	uint32_t saved_rxt_clamp_val; 	/* The encoded value we used to setup clamping */ | |
| 507 | 	struct newreno rc_saved_beta;	/* | |
| 508 | 					 * For newreno cc: | |
| 509 | 					 * rc_saved_cc are the values we have had | |
| 538 | 	uint32_t cleared_app_ack_seq; | |
| 539 | 	uint32_t last_rcv_tstmp_for_rtt; | |
| 540 | 	uint32_t last_time_of_arm_rcv; | |
| 541 | 	uint32_t rto_ssthresh; | |
| 542 | 	uint32_t rc_saved_beta; | |
| 543 | 	uint32_t rc_saved_beta_ecn;	/* | |
| 544 | 					 * For newreno cc: rc_saved_beta and | |
| 545 | 					 * rc_saved_beta_ecn are the values we have had | |
| 510 | 546 | 					 * set by the user, if pacing is not happening |
| 511 | 547 | 					 * (i.e. its early and we have not turned on yet |
| 512 | 548 | 					 * or it was turned off). The minute pacing |
| ... | ... | @@ -516,10 +552,12 @@ struct rack_control { |
| 516 | 552 | 					 * we also set the flag (if ecn_beta is set) to make |
| 517 | 553 | 					 * new_reno do less of a backoff for ecn (think abe). |
| 518 | 554 | 					 */ |
| 555 | 	uint16_t rc_cnt_of_retran[RETRAN_CNT_SIZE]; | |
| 519 | 556 | 	uint16_t rc_early_recovery_segs;	/* Socket option value Lock(a) */ |
| 520 | 557 | 	uint16_t rc_reorder_shift;	/* Socket option value Lock(a) */ |
| 521 | 558 | 	uint8_t rack_per_upper_bound_ss; |
| 522 | 559 | 	uint8_t rack_per_upper_bound_ca; |
| 560 | 	uint8_t cleared_app_ack; | |
| 523 | 561 | 	uint8_t dsack_persist; |
| 524 | 562 | 	uint8_t rc_no_push_at_mrtt;	/* No push when we exceed max rtt */ |
| 525 | 563 | 	uint8_t num_measurements;	/* Number of measurements (up to 0xff, we freeze at 0xff) */ |
| ... | ... | @@ -528,37 +566,15 @@ struct rack_control { |
| 528 | 566 | 	uint8_t rc_tlp_cwnd_reduce;	/* Socket option value Lock(a) */ |
| 529 | 567 | 	uint8_t rc_prr_sendalot;/* Socket option value Lock(a) */ |
| 530 | 568 | 	uint8_t rc_rate_sample_method; |
| 531 | 	uint8_t rc_dgp_bl_agg;		/* Buffer Level aggression during DGP */ | |
| 532 | 	uint8_t full_dgp_in_rec;	/* Flag to say if we do full DGP in recovery */ | |
| 533 | 569 | 	uint8_t client_suggested_maxseg;	/* Not sure what to do with this yet */ |
| 534 | 	uint8_t pacing_discount_amm;	/* | |
| 535 | 					 * This is a multipler to the base discount that | |
| 536 | 					 * can be used to increase the discount. | |
| 537 | 					 */ | |
| 538 | 	uint8_t already_had_a_excess; | |
| 570 | 	uint8_t use_gp_not_last; | |
| 571 | 	uint8_t pacing_method;	 /* If pace_always, what type of pacing */ | |
| 539 | 572 | }; |
| 540 | 573 | #endif |
| 541 | 574 | |
| 542 | /* DGP with no buffer level mitigations */ | |
| 543 | #define DGP_LEVEL0	0 | |
| 544 | ||
| 545 | /* | |
| 546 | * DGP with buffer level mitigation where BL:4 caps fillcw and BL:5 | |
| 547 | * turns off fillcw. | |
| 548 | */ | |
| 549 | #define DGP_LEVEL1	1 | |
| 550 | ||
| 551 | /* | |
| 552 | * DGP with buffer level mitigation where BL:3 caps fillcw and BL:4 turns off fillcw | |
| 553 | * and BL:5 reduces by 10% | |
| 554 | */ | |
| 555 | #define DGP_LEVEL2	2 | |
| 556 | ||
| 557 | /* | |
| 558 | * DGP with buffer level mitigation where BL:2 caps fillcw and BL:3 turns off | |
| 559 | * fillcw BL:4 reduces by 10% and BL:5 reduces by 20% | |
| 560 | */ | |
| 561 | #define DGP_LEVEL3	3 | |
| 575 | #define RACK_PACING_NONE 0x00 | |
| 576 | #define RACK_DGP_PACING 0x01 | |
| 577 | #define RACK_REG_PACING 0x02 | |
| 562 | 578 | |
| 563 | 579 | /* Hybrid pacing log defines */ |
| 564 | 580 | #define HYBRID_LOG_NO_ROOM	0	/* No room for the clients request */ |
| ... | ... | @@ -579,7 +595,6 @@ struct rack_control { |
| 579 | 595 | #define HYBRID_LOG_SENT_LOST	15	/* A closing sent/lost report */ |
| 580 | 596 | |
| 581 | 597 | #define RACK_TIMELY_CNT_BOOST 5	/* At 5th increase boost */ |
| 582 | #define RACK_MINRTT_FILTER_TIM 10 /* Seconds */ | |
| 583 | 598 | |
| 584 | 599 | #define RACK_HYSTART_OFF	0 |
| 585 | 600 | #define RACK_HYSTART_ON		1	/* hystart++ on */ |
| ... | ... | @@ -590,19 +605,20 @@ struct rack_control { |
| 590 | 605 | 					 */ |
| 591 | 606 | |
| 592 | 607 | #define MAX_USER_SET_SEG 0x3f	/* The max we can set is 63 which is probably too many */ |
| 608 | #define RACK_FREE_CNT_MAX 0x2f	/* Max our counter can do */ | |
| 593 | 609 | |
| 594 | 610 | #ifdef _KERNEL |
| 595 | 611 | |
| 596 | 612 | struct tcp_rack { |
| 597 | 613 | 	/* First cache line 0x00 */ |
| 598 | 	TAILQ_ENTRY(tcp_rack) r_hpts;	/* hptsi queue next Lock(b) */ | |
| 599 | 614 | 	int32_t(*r_substate) (struct mbuf *, struct tcphdr *, |
| 600 | 615 | 	 struct socket *, struct tcpcb *, struct tcpopt *, |
| 601 | 616 | 	 int32_t, int32_t, uint32_t, int, int, uint8_t);	/* Lock(a) */ |
| 602 | 617 | 	struct tcpcb *rc_tp;	/* The tcpcb Lock(a) */ |
| 603 | 618 | 	struct inpcb *rc_inp;	/* The inpcb Lock(a) */ |
| 604 | 	uint8_t rc_free_cnt;	/* Number of free entries on the rc_free list | |
| 605 | 				 * Lock(a) */ | |
| 619 | 	uint8_t rc_free_cnt : 6, | |
| 620 | 		rc_skip_timely : 1, | |
| 621 | 		pcm_enabled : 1;	/* Is PCM enabled */ | |
| 606 | 622 | 	uint8_t client_bufferlvl : 3, /* Expected range [0,5]: 0=unset, 1=low/empty */ |
| 607 | 623 | 		rack_deferred_inited : 1, |
| 608 | 624 | 	 /* ******************************************************************** */ |
| ... | ... | @@ -612,11 +628,11 @@ struct tcp_rack { |
| 612 | 628 | 		shape_rxt_to_pacing_min : 1, |
| 613 | 629 | 	 /* ******************************************************************** */ |
| 614 | 630 | 		rc_ack_required: 1, |
| 615 | 		r_pacing_discount : 1; | |
| 631 | 		r_use_hpts_min : 1; | |
| 616 | 632 | 	uint8_t no_prr_addback : 1, |
| 617 | 633 | 		gp_ready : 1, |
| 618 | 634 | 		defer_options: 1, |
| 619 | 		excess_rxt_on: 1,	/* Are actions on for excess retransmissions? */ | |
| 635 | 		dis_lt_bw : 1, | |
| 620 | 636 | 		rc_ack_can_sendout_data: 1, /* |
| 621 | 637 | 					 * If set it will override pacing restrictions on not sending |
| 622 | 638 | 					 * data when the pacing timer is running. I.e. you set this |
| ... | ... | @@ -659,7 +675,7 @@ struct tcp_rack { |
| 659 | 675 | 		 r_rack_hw_rate_caps: 1, |
| 660 | 676 | 		 r_up_only: 1, |
| 661 | 677 | 		 r_via_fill_cw : 1, |
| 662 | 		 r_fill_less_agg : 1; | |
| 678 | 		 r_rcvpath_rtt_up : 1; | |
| 663 | 679 | |
| 664 | 680 | 	uint8_t rc_user_set_max_segs : 7,	/* Socket option value Lock(a) */ |
| 665 | 681 | 		rc_fillcw_apply_discount; |
| ... | ... | @@ -673,7 +689,7 @@ struct tcp_rack { |
| 673 | 689 | 		rc_highly_buffered: 1,		/* The path is highly buffered */ |
| 674 | 690 | 		rc_dragged_bottom: 1, |
| 675 | 691 | 		rc_pace_dnd : 1,		/* The pace do not disturb bit */ |
| 676 | 		rc_avali2 : 1, | |
| 692 | 		rc_initial_ss_comp : 1, | |
| 677 | 693 | 		rc_gp_filled : 1, |
| 678 | 694 | 		rc_hw_nobuf : 1; |
| 679 | 695 | 	uint8_t r_state : 4, 	/* Current rack state Lock(a) */ |
| ... | ... | @@ -696,8 +712,8 @@ struct tcp_rack { |
| 696 | 712 | 	uint8_t app_limited_needs_set : 1, |
| 697 | 713 | 		use_fixed_rate : 1, |
| 698 | 714 | 		rc_has_collapsed : 1, |
| 699 | 		r_cwnd_was_clamped : 1, | |
| 700 | 		r_clamped_gets_lower : 1, | |
| 715 | 		use_lesser_lt_bw : 1, | |
| 716 | 		cspr_is_fcc : 1, | |
| 701 | 717 | 		rack_hdrw_pacing : 1, /* We are doing Hardware pacing */ |
| 702 | 718 | 		rack_hdw_pace_ena : 1, /* Is hardware pacing enabled? */ |
| 703 | 719 | 		rack_attempt_hdwr_pace : 1; /* Did we attempt hdwr pacing (if allowed) */ |
| ... | ... | @@ -712,8 +728,7 @@ struct tcp_rack { |
| 712 | 728 | 		set_pacing_done_a_iw : 1, |
| 713 | 729 | 		use_rack_rr : 1, |
| 714 | 730 | 		alloc_limit_reported : 1, |
| 715 | 		sack_attack_disable : 1, | |
| 716 | 		do_detection : 1, | |
| 731 | 		rack_avail : 2, | |
| 717 | 732 | 		rc_force_max_seg : 1; |
| 718 | 733 | 	uint8_t r_early : 1, |
| 719 | 734 | 		r_late : 1, |
| ... | ... | @@ -722,7 +737,11 @@ struct tcp_rack { |
| 722 | 737 | 		r_persist_lt_bw_off : 1, |
| 723 | 738 | 		r_collapse_point_valid : 1, |
| 724 | 739 | 		dgp_on : 1; |
| 725 | 	uint16_t rc_init_win : 8, | |
| 740 | 	uint16_t rto_from_rec: 1, | |
| 741 | 		avail_bit: 4, | |
| 742 | 		pcm_in_progress: 1, | |
| 743 | 		pcm_needed: 1, | |
| 744 | 		rc_sendvars_notset : 1,		/* Inside rack_init send variables (snd_max/una etc) were not set */ | |
| 726 | 745 | 		rc_gp_rtt_set : 1, |
| 727 | 746 | 		rc_gp_dyn_mul : 1, |
| 728 | 747 | 		rc_gp_saw_rec : 1, |
| ... | ... | @@ -735,5 +754,9 @@ struct tcp_rack { |
| 735 | 754 | 	struct rack_control r_ctl; |
| 736 | 755 | } __aligned(CACHE_LINE_SIZE); |
| 737 | 756 | |
| 757 | ||
| 758 | void rack_update_pcm_ack(struct tcp_rack *rack, int was_cumack, | |
| 759 | 	uint32_t ss, uint32_t es); | |
| 760 | ||
| 738 | 761 | #endif |
| 739 | 762 | #endif |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/netinet/tcp_syncache.h+7-6| ... | ... | @@ -27,8 +27,6 @@ |
| 27 | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | * | |
| 31 | *	@(#)tcp_var.h	8.4 (Berkeley) 5/24/95 | |
| 32 | 30 | */ |
| 33 | 31 | |
| 34 | 32 | #ifndef _NETINET_TCP_SYNCACHE_H_ |
| ... | ... | @@ -47,12 +45,11 @@ struct socket *	 syncache_add(struct in_conninfo *, struct tcpopt *, |
| 47 | 45 | 	 void *, void *, uint8_t, uint16_t); |
| 48 | 46 | void	 syncache_chkrst(struct in_conninfo *, struct tcphdr *, struct mbuf *, |
| 49 | 47 | 	 uint16_t); |
| 50 | void	 syncache_badack(struct in_conninfo *, uint16_t); | |
| 51 | 48 | int	 syncache_pcblist(struct sysctl_req *); |
| 52 | 49 | |
| 53 | 50 | struct syncache { |
| 54 | 51 | 	TAILQ_ENTRY(syncache)	sc_hash; |
| 55 | 	struct		in_conninfo sc_inc;	/* addresses */ | |
| 52 | 	struct in_conninfo	sc_inc;		/* addresses */ | |
| 56 | 53 | 	int		sc_rxttime;		/* retransmit time */ |
| 57 | 54 | 	u_int16_t	sc_rxmits;		/* retransmit counter */ |
| 58 | 55 | 	u_int16_t	sc_port;		/* remote UDP encaps port */ |
| ... | ... | @@ -61,7 +58,7 @@ struct syncache { |
| 61 | 58 | 	u_int32_t	sc_flowlabel;		/* IPv6 flowlabel */ |
| 62 | 59 | 	tcp_seq		sc_irs;			/* seq from peer */ |
| 63 | 60 | 	tcp_seq		sc_iss;			/* our ISS */ |
| 64 | 	struct		mbuf *sc_ipopts;	/* source route */ | |
| 61 | 	struct mbuf	*sc_ipopts;		/* source route */ | |
| 65 | 62 | 	u_int16_t	sc_peer_mss;		/* peer's MSS */ |
| 66 | 63 | 	u_int16_t	sc_wnd;			/* advertised window */ |
| 67 | 64 | 	u_int8_t	sc_ip_ttl;		/* TTL / Hop Limit */ |
| ... | ... | @@ -69,7 +66,9 @@ struct syncache { |
| 69 | 66 | 	u_int8_t	sc_requested_s_scale:4, |
| 70 | 67 | 			sc_requested_r_scale:4; |
| 71 | 68 | 	u_int16_t	sc_flags; |
| 72 | #if defined(TCP_OFFLOAD) || !defined(TCP_OFFLOAD_DISABLE) | |
| 69 | 	u_int32_t	sc_challenge_ack_cnt;	/* chall. ACKs sent in epoch */ | |
| 70 | 	sbintime_t	sc_challenge_ack_end;	/* End of chall. ack epoch */ | |
| 71 | #if defined(TCP_OFFLOAD) | |
| 73 | 72 | 	struct toedev	*sc_tod;		/* entry added by this TOE */ |
| 74 | 73 | 	void		*sc_todctx;		/* TOE driver context */ |
| 75 | 74 | #endif |
| ... | ... | @@ -129,7 +128,9 @@ struct tcp_syncache { |
| 129 | 128 | 	u_int	cache_limit; |
| 130 | 129 | 	u_int	rexmt_limit; |
| 131 | 130 | 	uint32_t hash_secret; |
| 131 | #ifdef VIMAGE | |
| 132 | 132 | 	struct vnet *vnet; |
| 133 | #endif | |
| 133 | 134 | 	struct syncookie_secret secret; |
| 134 | 135 | 	struct mtx pause_mtx; |
| 135 | 136 | 	struct callout pause_co; |
lib/libc/include/generic-freebsd/netinet/tcp_timer.h+18-18| ... | ... | @@ -27,13 +27,13 @@ |
| 27 | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | * | |
| 31 | *	@(#)tcp_timer.h	8.1 (Berkeley) 6/10/93 | |
| 32 | 30 | */ |
| 33 | 31 | |
| 34 | 32 | #ifndef _NETINET_TCP_TIMER_H_ |
| 35 | 33 | #define _NETINET_TCP_TIMER_H_ |
| 36 | 34 | |
| 35 | #ifdef _KERNEL | |
| 36 | ||
| 37 | 37 | /* |
| 38 | 38 | * The TCPT_REXMT timer is used to force retransmissions. |
| 39 | 39 | * The TCP has the TCPT_REXMT timer set whenever segments |
| ... | ... | @@ -73,21 +73,22 @@ |
| 73 | 73 | /* |
| 74 | 74 | * Time constants. |
| 75 | 75 | */ |
| 76 | #define	TCPTV_MSL	( 30*hz)		/* max seg lifetime (hah!) */ | |
| 76 | #define	TCPTV_MSL	MSEC_2_TICKS(30000)	/* max seg lifetime (hah!) */ | |
| 77 | #define	TCPTV_MSL_LOCAL	MSEC_2_TICKS(10)	/* max seg lifetime for local comm */ | |
| 77 | 78 | #define	TCPTV_SRTTBASE	0			/* base roundtrip time; |
| 78 | 79 | 						 if 0, no idea yet */ |
| 79 | #define	TCPTV_RTOBASE	( 1*hz)		/* assumed RTO if no info */ | |
| 80 | #define	TCPTV_RTOBASE	MSEC_2_TICKS(1000)	/* assumed RTO if no info */ | |
| 80 | 81 | |
| 81 | #define	TCPTV_PERSMIN	( 5*hz)		/* minimum persist interval */ | |
| 82 | #define	TCPTV_PERSMAX	( 60*hz)		/* maximum persist interval */ | |
| 82 | #define	TCPTV_PERSMIN	MSEC_2_TICKS(5000)	/* minimum persist interval */ | |
| 83 | #define	TCPTV_PERSMAX	MSEC_2_TICKS(60000)	/* maximum persist interval */ | |
| 83 | 84 | |
| 84 | #define	TCPTV_KEEP_INIT	( 75*hz)		/* initial connect keepalive */ | |
| 85 | #define	TCPTV_KEEP_IDLE	(120*60*hz)		/* dflt time before probing */ | |
| 86 | #define	TCPTV_KEEPINTVL	( 75*hz)		/* default probe interval */ | |
| 85 | #define	TCPTV_KEEP_INIT	MSEC_2_TICKS(75000)	/* initial connect keepalive */ | |
| 86 | #define	TCPTV_KEEP_IDLE	MSEC_2_TICKS(120*60*1000)	/* dflt time before probing */ | |
| 87 | #define	TCPTV_KEEPINTVL	MSEC_2_TICKS(75000)	/* default probe interval */ | |
| 87 | 88 | #define	TCPTV_KEEPCNT	8			/* max probes before drop */ |
| 88 | 89 | #define	TCPTV_MAXUNACKTIME	0		/* max time without making progress */ |
| 89 | 90 | |
| 90 | #define TCPTV_FINWAIT2_TIMEOUT (60*hz) /* FIN_WAIT_2 timeout if no receiver */ | |
| 91 | #define	TCPTV_FINWAIT2_TIMEOUT	MSEC_2_TICKS(60000)	/* FIN_WAIT_2 timeout if no receiver */ | |
| 91 | 92 | |
| 92 | 93 | /* |
| 93 | 94 | * Minimum retransmit timer is 3 ticks, for algorithmic stability. |
| ... | ... | @@ -109,15 +110,13 @@ |
| 109 | 110 | * The prior minimum of 1*hz (1 second) badly breaks throughput on any |
| 110 | 111 | * networks faster then a modem that has minor (e.g. 1%) packet loss. |
| 111 | 112 | */ |
| 112 | #define	TCPTV_MIN	( hz/33 )		/* minimum allowable value */ | |
| 113 | #define TCPTV_CPU_VAR	( hz/5 )		/* cpu variance allowed (200ms) */ | |
| 114 | #define	TCPTV_REXMTMAX	( 64*hz)		/* max allowable REXMT value */ | |
| 115 | ||
| 116 | #define TCPTV_TWTRUNC	8			/* RTO factor to truncate TW */ | |
| 113 | #define	TCPTV_MIN	MSEC_2_TICKS(30)	/* minimum allowable value */ | |
| 114 | #define	TCPTV_CPU_VAR	MSEC_2_TICKS(200)	/* cpu variance allowed (200ms) */ | |
| 115 | #define	TCPTV_REXMTMAX	MSEC_2_TICKS(64000)	/* max allowable REXMT value */ | |
| 117 | 116 | |
| 118 | 117 | #define	TCP_MAXRXTSHIFT	12			/* maximum retransmits */ |
| 119 | 118 | |
| 120 | #define	TCPTV_DELACK	( hz/25 )		/* 40ms timeout */ | |
| 119 | #define	TCPTV_DELACK	MSEC_2_TICKS(40)	/* 40ms timeout */ | |
| 121 | 120 | |
| 122 | 121 | /* |
| 123 | 122 | * If we exceed this number of retransmits for a single segment, we'll consider |
| ... | ... | @@ -137,8 +136,6 @@ |
| 137 | 136 | 		(tv) = (tvmax); \ |
| 138 | 137 | } while(0) |
| 139 | 138 | |
| 140 | #ifdef _KERNEL | |
| 141 | ||
| 142 | 139 | #define	TP_KEEPINIT(tp)	((tp)->t_keepinit ? (tp)->t_keepinit : tcp_keepinit) |
| 143 | 140 | #define	TP_KEEPIDLE(tp)	((tp)->t_keepidle ? (tp)->t_keepidle : tcp_keepidle) |
| 144 | 141 | #define	TP_KEEPINTVL(tp) ((tp)->t_keepintvl ? (tp)->t_keepintvl : tcp_keepintvl) |
| ... | ... | @@ -167,6 +164,7 @@ extern int tcp_maxunacktime;		/* max time without making progress */ |
| 167 | 164 | extern int tcp_maxpersistidle; |
| 168 | 165 | extern int tcp_rexmit_initial; |
| 169 | 166 | extern int tcp_rexmit_min; |
| 167 | extern int tcp_rexmit_max; | |
| 170 | 168 | extern int tcp_rexmit_slop; |
| 171 | 169 | extern int tcp_ttl;			/* time to live for TCP segs */ |
| 172 | 170 | extern int tcp_backoff[]; |
| ... | ... | @@ -186,6 +184,8 @@ VNET_DECLARE(int, tcp_v6pmtud_blackhole_mss); |
| 186 | 184 | #define V_tcp_v6pmtud_blackhole_mss	VNET(tcp_v6pmtud_blackhole_mss) |
| 187 | 185 | VNET_DECLARE(int, tcp_msl); |
| 188 | 186 | #define V_tcp_msl			VNET(tcp_msl) |
| 187 | VNET_DECLARE(int, tcp_msl_local); | |
| 188 | #define V_tcp_msl_local			VNET(tcp_msl_local) | |
| 189 | 189 | |
| 190 | 190 | #endif /* _KERNEL */ |
| 191 | 191 |
lib/libc/include/generic-freebsd/netinet/tcp_var.h+89-112| ... | ... | @@ -27,8 +27,6 @@ |
| 27 | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | * | |
| 31 | *	@(#)tcp_var.h	8.4 (Berkeley) 5/24/95 | |
| 32 | 30 | */ |
| 33 | 31 | |
| 34 | 32 | #ifndef _NETINET_TCP_VAR_H_ |
| ... | ... | @@ -130,6 +128,8 @@ struct sackhint { |
| 130 | 128 | 	uint32_t	recover_fs;	/* Flight Size at the start of Loss recovery */ |
| 131 | 129 | 	uint32_t	prr_delivered;	/* Total bytes delivered using PRR */ |
| 132 | 130 | 	uint32_t	prr_out;	/* Bytes sent during IN_RECOVERY */ |
| 131 | 	int32_t		hole_bytes;	/* current number of bytes in scoreboard holes */ | |
| 132 | 	int32_t		lost_bytes;	/* number of rfc6675 IsLost() bytes */ | |
| 133 | 133 | }; |
| 134 | 134 | |
| 135 | 135 | #define SEGQ_EMPTY(tp) TAILQ_EMPTY(&(tp)->t_segq) |
| ... | ... | @@ -141,7 +141,8 @@ STAILQ_HEAD(tcp_log_stailq, tcp_log_mem); |
| 141 | 141 | #define TCP_TRK_TRACK_FLG_OPEN 0x02	/* End is not valid (open range request) */ |
| 142 | 142 | #define TCP_TRK_TRACK_FLG_SEQV 0x04	/* We had a sendfile that touched it */ |
| 143 | 143 | #define TCP_TRK_TRACK_FLG_COMP 0x08	/* Sendfile as placed the last bits (range req only) */ |
| 144 | #define TCP_TRK_TRACK_FLG_FSND	 0x10	/* First send has been done into the seq space */ | |
| 144 | #define TCP_TRK_TRACK_FLG_FSND	0x10	/* First send has been done into the seq space */ | |
| 145 | #define TCP_TRK_TRACK_FLG_LSND	0x20	/* We were able to set the Last Sent */ | |
| 145 | 146 | #define MAX_TCP_TRK_REQ 5		/* Max we will have at once */ |
| 146 | 147 | |
| 147 | 148 | struct tcp_sendfile_track { |
| ... | ... | @@ -154,11 +155,14 @@ struct tcp_sendfile_track { |
| 154 | 155 | 	uint64_t cspr;		/* Client suggested pace rate */ |
| 155 | 156 | 	uint64_t sent_at_fs;	/* What was t_sndbytes as we begun sending */ |
| 156 | 157 | 	uint64_t rxt_at_fs;	/* What was t_snd_rxt_bytes as we begun sending */ |
| 158 | 	uint64_t sent_at_ls;	/* Sent value at the last send */ | |
| 159 | 	uint64_t rxt_at_ls;	/* Retransmit value at the last send */ | |
| 157 | 160 | 	tcp_seq start_seq;	/* First TCP Seq assigned */ |
| 158 | 161 | 	tcp_seq end_seq;	/* If range req last seq */ |
| 159 | 162 | 	uint32_t flags;		/* Type of request open etc */ |
| 160 | 163 | 	uint32_t sbcc_at_s;	/* When we allocate what is the sb_cc */ |
| 161 | 164 | 	uint32_t hint_maxseg;	/* Client hinted maxseg */ |
| 165 | 	uint32_t playout_ms;	/* Client playout ms */ | |
| 162 | 166 | 	uint32_t hybrid_flags;	/* Hybrid flags on this request */ |
| 163 | 167 | }; |
| 164 | 168 | |
| ... | ... | @@ -178,7 +182,7 @@ struct tcp_sendfile_track { |
| 178 | 182 | * snd_una). When the response comes back indicating |
| 179 | 183 | * that there was data (return value 1), then the caller |
| 180 | 184 | * can build a sendmap entry based on the range and the |
| 181 | * times. The next query would then be done at the | |
| 185 | * times. The next query would then be done at the | |
| 182 | 186 | * newly created sendmap_end. Repeated until sendmap_end == snd_max. |
| 183 | 187 | * |
| 184 | 188 | * Flags in sendmap_flags are defined below as well. |
| ... | ... | @@ -193,7 +197,7 @@ struct tcp_sendfile_track { |
| 193 | 197 | * The rack_times are a misc collection of information that |
| 194 | 198 | * the old stack might possibly fill in. Of course its possible |
| 195 | 199 | * that an old stack may not have a piece of information. If so |
| 196 | * then setting that value to zero is advised. Setting any | |
| 200 | * then setting that value to zero is advised. Setting any | |
| 197 | 201 | * timestamp passed should only place a zero in it when it |
| 198 | 202 | * is unfilled. This may mean that a time is off by a micro-second |
| 199 | 203 | * but this is ok in the grand scheme of things. |
| ... | ... | @@ -201,13 +205,13 @@ struct tcp_sendfile_track { |
| 201 | 205 | * When switching stacks it is desireable to get as much information |
| 202 | 206 | * from the old stack to the new stack as possible. Though not always |
| 203 | 207 | * will the stack be compatible in the types of information. The |
| 204 | * init() function needs to take care when it begins changing | |
| 208 | * init() function needs to take care when it begins changing | |
| 205 | 209 | * things such as inp_flags2 and the timer units to position these |
| 206 | 210 | * changes at a point where it is unlikely they will fail after |
| 207 | 211 | * making such changes. A stack optionally can have an "undo" |
| 208 | * function | |
| 212 | * function | |
| 209 | 213 | * |
| 210 | * To transfer information to the old stack from the new in | |
| 214 | * To transfer information to the old stack from the new in | |
| 211 | 215 | * respect to LRO and the inp_flags2, the new stack should set |
| 212 | 216 | * the inp_flags2 to what it supports. The old stack in its |
| 213 | 217 | * fini() function should call the tcp_handle_orphaned_packets() |
| ... | ... | @@ -448,7 +452,6 @@ struct tcpcb { |
| 448 | 452 | 	tcp_seq gput_seq;		/* Outbound measurement seq */ |
| 449 | 453 | 	tcp_seq gput_ack;		/* Inbound measurement ack */ |
| 450 | 454 | 	int32_t t_stats_gput_prev;	/* XXXLAS: Prev gput measurement */ |
| 451 | 	uint32_t t_maxpeakrate;		/* max peak rate set by user, bytes/s */ | |
| 452 | 455 | 	uint32_t t_sndtlppack;		/* tail loss probe packets sent */ |
| 453 | 456 | 	uint64_t t_sndtlpbyte;		/* total tail loss probe bytes sent */ |
| 454 | 457 | 	uint64_t t_sndbytes;		/* total bytes sent */ |
| ... | ... | @@ -496,10 +499,6 @@ struct tcpcb { |
| 496 | 499 | 	uint64_t tcp_cnt_counters[TCP_NUM_CNT_COUNTERS]; |
| 497 | 500 | 	uint64_t tcp_proc_time[TCP_NUM_CNT_COUNTERS]; |
| 498 | 501 | #endif |
| 499 | #ifdef TCPPCAP | |
| 500 | 	struct mbufq t_inpkts;		/* List of saved input packets. */ | |
| 501 | 	struct mbufq t_outpkts;		/* List of saved output packets. */ | |
| 502 | #endif | |
| 503 | 502 | }; |
| 504 | 503 | #endif	/* _KERNEL || _WANT_TCPCB */ |
| 505 | 504 | |
| ... | ... | @@ -529,31 +528,12 @@ typedef enum { |
| 529 | 528 | /* Minimum map entries limit value, if set */ |
| 530 | 529 | #define TCP_MIN_MAP_ENTRIES_LIMIT	128 |
| 531 | 530 | |
| 532 | /* | |
| 533 | * TODO: We yet need to brave plowing in | |
| 534 | * to tcp_input() and the pru_usrreq() block. | |
| 535 | * Right now these go to the old standards which | |
| 536 | * are somewhat ok, but in the long term may | |
| 537 | * need to be changed. If we do tackle tcp_input() | |
| 538 | * then we need to get rid of the tcp_do_segment() | |
| 539 | * function below. | |
| 540 | */ | |
| 541 | 531 | /* Flags for tcp functions */ |
| 542 | 532 | #define	TCP_FUNC_BEING_REMOVED	0x01 	/* Can no longer be referenced */ |
| 543 | 533 | #define	TCP_FUNC_OUTPUT_CANDROP	0x02 	/* tfb_tcp_output may ask tcp_drop */ |
| 544 | 534 | #define	TCP_FUNC_DEFAULT_OK	0x04 	/* Can be used as default */ |
| 545 | 535 | |
| 546 | 536 | /** |
| 547 | * If defining the optional tcp_timers, in the | |
| 548 | * tfb_tcp_timer_stop call you must use the | |
| 549 | * callout_async_drain() function with the | |
| 550 | * tcp_timer_discard callback. You should check | |
| 551 | * the return of callout_async_drain() and if 0 | |
| 552 | * increment tt_draincnt. Since the timer sub-system | |
| 553 | * does not know your callbacks you must provide a | |
| 554 | * stop_all function that loops through and calls | |
| 555 | * tcp_timer_stop() with each of your defined timers. | |
| 556 | * | |
| 557 | 537 | * tfb_tcp_handoff_ok is a mandatory function allowing |
| 558 | 538 | * to query a stack, if it can take over a tcpcb. |
| 559 | 539 | * You return 0 to say you can take over and run your stack, |
| ... | ... | @@ -564,13 +544,13 @@ typedef enum { |
| 564 | 544 | * do is: |
| 565 | 545 | * a) Make sure that the inp_flags2 is setup correctly |
| 566 | 546 | * for LRO. There are two flags that the previous |
| 567 | * stack may have set INP_MBUF_ACKCMP and | |
| 547 | * stack may have set INP_MBUF_ACKCMP and | |
| 568 | 548 | * INP_SUPPORTS_MBUFQ. If the new stack does not |
| 569 | 549 | * support these it *should* clear the flags. |
| 570 | 550 | * b) Make sure that the timers are in the proper |
| 571 | 551 | * granularity that the stack wants. The stack |
| 572 | 552 | * should check the t_tmr_granularity field. Currently |
| 573 | * there are two values that it may hold | |
| 553 | * there are two values that it may hold | |
| 574 | 554 | * TCP_TMR_GRANULARITY_TICKS and TCP_TMR_GRANULARITY_USEC. |
| 575 | 555 | * Use the functions tcp_timer_convert(tp, granularity); |
| 576 | 556 | * to move the timers to the correct format for your stack. |
| ... | ... | @@ -578,14 +558,14 @@ typedef enum { |
| 578 | 558 | * The new stack may also optionally query the tfb_chg_query |
| 579 | 559 | * function if the old stack has one. The new stack may ask |
| 580 | 560 | * for one of three entries and can also state to the old |
| 581 | * stack its support for the INP_MBUF_ACKCMP and | |
| 561 | * stack its support for the INP_MBUF_ACKCMP and | |
| 582 | 562 | * INP_SUPPORTS_MBUFQ. This is important since if there are |
| 583 | 563 | * queued ack's without that statement the old stack will |
| 584 | 564 | * be forced to discard the queued acks. The requests that |
| 585 | 565 | * can be made for information by the new stacks are: |
| 586 | 566 | * |
| 587 | 567 | * Note also that the tfb_tcp_fb_init() when called can |
| 588 | * determine if a query is needed by looking at the | |
| 568 | * determine if a query is needed by looking at the | |
| 589 | 569 | * value passed in the ptr. The ptr is designed to be |
| 590 | 570 | * set in with any allocated memory, but the address |
| 591 | 571 | * of the condtion (ptr == &tp->t_fb_ptr) will be |
| ... | ... | @@ -593,17 +573,17 @@ typedef enum { |
| 593 | 573 | * setup of a tcb (which means no query would be needed). |
| 594 | 574 | * If, however, the value is not t_fb_ptr, then the caller |
| 595 | 575 | * is in the middle of a stack switch and is the new stack. |
| 596 | * A query would be appropriate (if the new stack support | |
| 576 | * A query would be appropriate (if the new stack support | |
| 597 | 577 | * the query mechanism). |
| 598 | 578 | * |
| 599 | 579 | * TCP_QUERY_SENDMAP - Query of outstanding data. |
| 600 | 580 | * TCP_QUERY_TIMERS_UP	- Query about running timers. |
| 601 | * TCP_SUPPORTED_LRO - Declaration in req_param of | |
| 602 | * the inp_flags2 supported by | |
| 581 | * TCP_SUPPORTED_LRO - Declaration in req_param of | |
| 582 | * the inp_flags2 supported by | |
| 603 | 583 | * the new stack. |
| 604 | 584 | * TCP_QUERY_RACK_TIMES	- Enquire about various timestamps |
| 605 | 585 | * and states the old stack may be in. |
| 606 | * | |
| 586 | * | |
| 607 | 587 | * tfb_tcp_fb_fini is changed to add a flag to tell |
| 608 | 588 | * the old stack if the tcb is being destroyed or |
| 609 | 589 | * not. A one in the flag means the TCB is being |
| ... | ... | @@ -639,6 +619,8 @@ struct tcp_function_block { |
| 639 | 619 | 	void	(*tfb_switch_failed)(struct tcpcb *); |
| 640 | 620 | 	bool	(*tfb_early_wake_check)(struct tcpcb *); |
| 641 | 621 | 	int (*tfb_compute_pipe)(struct tcpcb *tp); |
| 622 | 	int (*tfb_stack_info)(struct tcpcb *tp, struct stack_specific_info *); | |
| 623 | 	void	(*tfb_inherit)(struct tcpcb *tp, struct inpcb *h_inp); | |
| 642 | 624 | 	volatile uint32_t tfb_refcnt; |
| 643 | 625 | 	uint32_t tfb_flags; |
| 644 | 626 | 	uint8_t	tfb_id; |
| ... | ... | @@ -807,7 +789,7 @@ tcp_packets_this_ack(struct tcpcb *tp, tcp_seq ack) |
| 807 | 789 | #define	TF_TSO		0x01000000	/* TSO enabled on this connection */ |
| 808 | 790 | #define	TF_TOE		0x02000000	/* this connection is offloaded */ |
| 809 | 791 | #define	TF_CLOSED	0x04000000	/* close(2) called on socket */ |
| 810 | #define	TF_UNUSED1	0x08000000	/* unused */ | |
| 792 | #define TF_SENTSYN 0x08000000 /* At least one syn has been sent */ | |
| 811 | 793 | #define	TF_LRD		0x10000000	/* Lost Retransmission Detection */ |
| 812 | 794 | #define	TF_CONGRECOVERY	0x20000000	/* congestion recovery mode */ |
| 813 | 795 | #define	TF_WASCRECOVERY	0x40000000	/* was in congestion recovery */ |
| ... | ... | @@ -825,14 +807,6 @@ tcp_packets_this_ack(struct tcpcb *tp, tcp_seq ack) |
| 825 | 807 | #define	ENTER_RECOVERY(t_flags) t_flags |= (TF_CONGRECOVERY | TF_FASTRECOVERY) |
| 826 | 808 | #define	EXIT_RECOVERY(t_flags) t_flags &= ~(TF_CONGRECOVERY | TF_FASTRECOVERY) |
| 827 | 809 | |
| 828 | #if defined(_KERNEL) | |
| 829 | #if !defined(TCP_RFC7413) | |
| 830 | #define	IS_FASTOPEN(t_flags)		(false) | |
| 831 | #else | |
| 832 | #define	IS_FASTOPEN(t_flags)		(t_flags & TF_FASTOPEN) | |
| 833 | #endif | |
| 834 | #endif | |
| 835 | ||
| 836 | 810 | #define	BYTES_THIS_ACK(tp, th)	(th->th_ack - tp->snd_una) |
| 837 | 811 | |
| 838 | 812 | /* |
| ... | ... | @@ -864,6 +838,8 @@ tcp_packets_this_ack(struct tcpcb *tp, tcp_seq ack) |
| 864 | 838 | #define	TF2_MBUF_QUEUE_READY	0x00020000 /* Inputs can be queued */ |
| 865 | 839 | #define	TF2_DONT_SACK_QUEUE	0x00040000 /* Don't wake on sack */ |
| 866 | 840 | #define	TF2_CANNOT_DO_ECN	0x00080000 /* The stack does not do ECN */ |
| 841 | #define	TF2_PROC_SACK_PROHIBIT	0x00100000 /* Due to small MSS size do not process sack's */ | |
| 842 | #define	TF2_IPSEC_TSO		0x00200000 /* IPSEC + TSO supported */ | |
| 867 | 843 | #define	TF2_NO_ISS_CHECK	0x00400000 /* Don't check SEG.ACK against ISS */ |
| 868 | 844 | |
| 869 | 845 | /* |
| ... | ... | @@ -902,24 +878,13 @@ struct tcpopt { |
| 902 | 878 | #define	TO_SYN		0x01		/* parse SYN-only options */ |
| 903 | 879 | |
| 904 | 880 | struct hc_metrics_lite {	/* must stay in sync with hc_metrics */ |
| 905 | 	uint32_t	rmx_mtu;	/* MTU for this path */ | |
| 906 | 	uint32_t	rmx_ssthresh;	/* outbound gateway buffer limit */ | |
| 907 | 	uint32_t	rmx_rtt;	/* estimated round trip time */ | |
| 908 | 	uint32_t	rmx_rttvar;	/* estimated rtt variance */ | |
| 909 | 	uint32_t	rmx_cwnd;	/* congestion window */ | |
| 910 | 	uint32_t	rmx_sendpipe; /* outbound delay-bandwidth product */ | |
| 911 | 	uint32_t	rmx_recvpipe; /* inbound delay-bandwidth product */ | |
| 912 | }; | |
| 913 | ||
| 914 | /* | |
| 915 | * Used by tcp_maxmtu() to communicate interface specific features | |
| 916 | * and limits at the time of connection setup. | |
| 917 | */ | |
| 918 | struct tcp_ifcap { | |
| 919 | 	int	ifcap; | |
| 920 | 	u_int	tsomax; | |
| 921 | 	u_int	tsomaxsegcount; | |
| 922 | 	u_int	tsomaxsegsize; | |
| 881 | 	uint32_t	hc_mtu;		/* MTU for this path */ | |
| 882 | 	uint32_t	hc_ssthresh;	/* outbound gateway buffer limit */ | |
| 883 | 	uint32_t	hc_rtt;		/* estimated round trip time */ | |
| 884 | 	uint32_t	hc_rttvar;	/* estimated rtt variance */ | |
| 885 | 	uint32_t	hc_cwnd;	/* congestion window */ | |
| 886 | 	uint32_t	hc_sendpipe;	/* outbound delay-bandwidth product */ | |
| 887 | 	uint32_t	hc_recvpipe;	/* inbound delay-bandwidth product */ | |
| 923 | 888 | }; |
| 924 | 889 | |
| 925 | 890 | #ifndef _NETINET_IN_PCB_H_ |
| ... | ... | @@ -962,9 +927,12 @@ struct in_conninfo; |
| 962 | 927 | 	 + (tp)->t_rttvar) >> TCP_DELTA_SHIFT) |
| 963 | 928 | |
| 964 | 929 | /* |
| 965 | * TCP statistics. | |
| 966 | * Many of these should be kept per connection, | |
| 967 | * but that's inconvenient at the moment. | |
| 930 | * Global (per-VNET) TCP statistics. The below structure represents what we | |
| 931 | * export to the userland, but in the kernel we have an array of counter_u64_t | |
| 932 | * with as many elements as there are members in the structure. The counters | |
| 933 | * shall be increased by TCPSTAT_INC() or KMOD_TCPSTAT_INC(). Adding a new | |
| 934 | * counter also requires adding corresponding SDT probes into in_kdtrace.h and | |
| 935 | * into in_kdtrace.c. | |
| 968 | 936 | */ |
| 969 | 937 | struct	tcpstat { |
| 970 | 938 | 	uint64_t tcps_connattempt;	/* connections initiated */ |
| ... | ... | @@ -1050,6 +1018,8 @@ struct	tcpstat { |
| 1050 | 1018 | 	uint64_t tcps_sc_zonefail;	/* zalloc() failed */ |
| 1051 | 1019 | 	uint64_t tcps_sc_sendcookie;	/* SYN cookie sent */ |
| 1052 | 1020 | 	uint64_t tcps_sc_recvcookie;	/* SYN cookie received */ |
| 1021 | 	uint64_t tcps_sc_spurcookie;	/* SYN cookie spurious, rejected */ | |
| 1022 | 	uint64_t tcps_sc_failcookie;	/* SYN cookie failed, rejected */ | |
| 1053 | 1023 | |
| 1054 | 1024 | 	uint64_t tcps_hc_added;		/* entry added to hostcache */ |
| 1055 | 1025 | 	uint64_t tcps_hc_bucketoverflow;/* hostcache per bucket limit hit */ |
| ... | ... | @@ -1059,6 +1029,7 @@ struct	tcpstat { |
| 1059 | 1029 | 	/* SACK related stats */ |
| 1060 | 1030 | 	uint64_t tcps_sack_recovery_episode; /* SACK recovery episodes */ |
| 1061 | 1031 | 	uint64_t tcps_sack_rexmits;	 /* SACK rexmit segments */ |
| 1032 | 	uint64_t tcps_sack_rexmits_tso;	 /* SACK rexmit TSO chunks */ | |
| 1062 | 1033 | 	uint64_t tcps_sack_rexmit_bytes; /* SACK rexmit bytes */ |
| 1063 | 1034 | 	uint64_t tcps_sack_rcv_blocks;	 /* SACK blocks (options) received */ |
| 1064 | 1035 | 	uint64_t tcps_sack_send_blocks;	 /* SACK blocks (options) sent */ |
| ... | ... | @@ -1120,31 +1091,39 @@ struct	tcpstat { |
| 1120 | 1091 | 	uint64_t tcps_rcvghostack;	/* received ACK for data never sent */ |
| 1121 | 1092 | 	uint64_t tcps_rcvacktooold;	/* received ACK for data too long ago */ |
| 1122 | 1093 | |
| 1123 | 	uint64_t _pad[2];		/* 2 TBD placeholder for STABLE */ | |
| 1094 | ||
| 1095 | 	uint64_t _pad[1];		/* 1 TBD placeholder for STABLE */ | |
| 1124 | 1096 | }; |
| 1125 | 1097 | |
| 1126 | 1098 | #define	tcps_rcvmemdrop	tcps_rcvreassfull	/* compat */ |
| 1127 | 1099 | |
| 1128 | 1100 | #ifdef _KERNEL |
| 1129 | #define	TI_UNLOCKED	1 | |
| 1130 | #define	TI_RLOCKED	2 | |
| 1131 | 1101 | #include <sys/counter.h> |
| 1102 | #include <netinet/in_kdtrace.h> | |
| 1132 | 1103 | |
| 1133 | 1104 | VNET_PCPUSTAT_DECLARE(struct tcpstat, tcpstat);	/* tcp statistics */ |
| 1134 | 1105 | /* |
| 1135 | 1106 | * In-kernel consumers can use these accessor macros directly to update |
| 1136 | 1107 | * stats. |
| 1137 | 1108 | */ |
| 1138 | #define	TCPSTAT_ADD(name, val)	\ | |
| 1139 | VNET_PCPUSTAT_ADD(struct tcpstat, tcpstat, name, (val)) | |
| 1109 | #define TCPSTAT_ADD(name, val) \ | |
| 1110 | 	do { \ | |
| 1111 | 		MIB_SDT_PROBE1(tcp, count, name, (val)); \ | |
| 1112 | 		VNET_PCPUSTAT_ADD(struct tcpstat, tcpstat, name, (val)); \ | |
| 1113 | 	} while (0) | |
| 1140 | 1114 | #define	TCPSTAT_INC(name)	TCPSTAT_ADD(name, 1) |
| 1141 | 1115 | |
| 1142 | 1116 | /* |
| 1143 | 1117 | * Kernel module consumers must use this accessor macro. |
| 1144 | 1118 | */ |
| 1145 | 1119 | void	kmod_tcpstat_add(int statnum, int val); |
| 1146 | #define	KMOD_TCPSTAT_ADD(name, val)					\ | |
| 1147 | kmod_tcpstat_add(offsetof(struct tcpstat, name) / sizeof(uint64_t), val) | |
| 1120 | #define KMOD_TCPSTAT_ADD(name, val) \ | |
| 1121 | 	do { \ | |
| 1122 | 		MIB_SDT_PROBE1(tcp, count, name, (val)); \ | |
| 1123 | 		kmod_tcpstat_add(offsetof(struct tcpstat, name) / \ | |
| 1124 | 			sizeof(uint64_t), \ | |
| 1125 | 		 val); \ | |
| 1126 | 	} while (0) | |
| 1148 | 1127 | #define	KMOD_TCPSTAT_INC(name)	KMOD_TCPSTAT_ADD(name, 1) |
| 1149 | 1128 | |
| 1150 | 1129 | /* |
| ... | ... | @@ -1260,6 +1239,9 @@ struct tcp_function_info { |
| 1260 | 1239 | #define	TCPCTL_SACK		14	/* Selective Acknowledgement,rfc 2018 */ |
| 1261 | 1240 | #define	TCPCTL_DROP		15	/* drop tcp connection */ |
| 1262 | 1241 | #define	TCPCTL_STATES		16	/* connection counts by TCP state */ |
| 1242 | #define	TCPCTL_KTLSLIST		17	/* connections with active ktls | |
| 1243 | 					 session */ | |
| 1244 | #define	TCPCTL_KTLSLIST_WKEYS	18	/* KTLSLIST with key data exported */ | |
| 1263 | 1245 | |
| 1264 | 1246 | #ifdef _KERNEL |
| 1265 | 1247 | #ifdef SYSCTL_DECL |
| ... | ... | @@ -1283,6 +1265,7 @@ VNET_DECLARE(uint32_t, tcp_ack_war_time_window); |
| 1283 | 1265 | VNET_DECLARE(int, tcp_autorcvbuf_max); |
| 1284 | 1266 | VNET_DECLARE(int, tcp_autosndbuf_inc); |
| 1285 | 1267 | VNET_DECLARE(int, tcp_autosndbuf_max); |
| 1268 | VNET_DECLARE(int, tcp_bind_all_fibs); | |
| 1286 | 1269 | VNET_DECLARE(int, tcp_delack_enabled); |
| 1287 | 1270 | VNET_DECLARE(int, tcp_do_autorcvbuf); |
| 1288 | 1271 | VNET_DECLARE(int, tcp_do_autosndbuf); |
| ... | ... | @@ -1317,6 +1300,7 @@ VNET_DECLARE(int, tcp_retries); |
| 1317 | 1300 | VNET_DECLARE(int, tcp_sack_globalholes); |
| 1318 | 1301 | VNET_DECLARE(int, tcp_sack_globalmaxholes); |
| 1319 | 1302 | VNET_DECLARE(int, tcp_sack_maxholes); |
| 1303 | VNET_DECLARE(int, tcp_sack_tso); | |
| 1320 | 1304 | VNET_DECLARE(int, tcp_sc_rst_sock_fail); |
| 1321 | 1305 | VNET_DECLARE(int, tcp_sendspace); |
| 1322 | 1306 | VNET_DECLARE(int, tcp_udp_tunneling_overhead); |
| ... | ... | @@ -1335,6 +1319,7 @@ VNET_DECLARE(struct inpcbinfo, tcbinfo); |
| 1335 | 1319 | #define	V_tcp_autorcvbuf_max		VNET(tcp_autorcvbuf_max) |
| 1336 | 1320 | #define	V_tcp_autosndbuf_inc		VNET(tcp_autosndbuf_inc) |
| 1337 | 1321 | #define	V_tcp_autosndbuf_max		VNET(tcp_autosndbuf_max) |
| 1322 | #define	V_tcp_bind_all_fibs		VNET(tcp_bind_all_fibs) | |
| 1338 | 1323 | #define	V_tcp_delack_enabled		VNET(tcp_delack_enabled) |
| 1339 | 1324 | #define	V_tcp_do_autorcvbuf		VNET(tcp_do_autorcvbuf) |
| 1340 | 1325 | #define	V_tcp_do_autosndbuf		VNET(tcp_do_autosndbuf) |
| ... | ... | @@ -1366,6 +1351,7 @@ VNET_DECLARE(struct inpcbinfo, tcbinfo); |
| 1366 | 1351 | #define	V_tcp_sack_globalholes		VNET(tcp_sack_globalholes) |
| 1367 | 1352 | #define	V_tcp_sack_globalmaxholes	VNET(tcp_sack_globalmaxholes) |
| 1368 | 1353 | #define	V_tcp_sack_maxholes		VNET(tcp_sack_maxholes) |
| 1354 | #define	V_tcp_sack_tso			VNET(tcp_sack_tso) | |
| 1369 | 1355 | #define	V_tcp_sc_rst_sock_fail		VNET(tcp_sc_rst_sock_fail) |
| 1370 | 1356 | #define	V_tcp_sendspace			VNET(tcp_sendspace) |
| 1371 | 1357 | #define	V_tcp_udp_tunneling_overhead	VNET(tcp_udp_tunneling_overhead) |
| ... | ... | @@ -1393,8 +1379,7 @@ int	 tcp_reass(struct tcpcb *, struct tcphdr *, tcp_seq *, int *, |
| 1393 | 1379 | void	 tcp_reass_global_init(void); |
| 1394 | 1380 | void	 tcp_reass_flush(struct tcpcb *); |
| 1395 | 1381 | void	 tcp_dooptions(struct tcpopt *, u_char *, int, int); |
| 1396 | void	tcp_dropwithreset(struct mbuf *, struct tcphdr *, | |
| 1397 | 		 struct tcpcb *, int, int); | |
| 1382 | void	 tcp_dropwithreset(struct mbuf *, struct tcphdr *, struct tcpcb *, int); | |
| 1398 | 1383 | void	tcp_pulloutofband(struct socket *, |
| 1399 | 1384 | 		 struct tcphdr *, struct mbuf *, int); |
| 1400 | 1385 | void	tcp_xmit_timer(struct tcpcb *, int); |
| ... | ... | @@ -1447,24 +1432,23 @@ extern counter_u64_t tcp_comp_total; |
| 1447 | 1432 | extern counter_u64_t tcp_uncomp_total; |
| 1448 | 1433 | extern counter_u64_t tcp_bad_csums; |
| 1449 | 1434 | |
| 1450 | #ifdef TCP_SAD_DETECTION | |
| 1451 | /* Various SACK attack thresholds */ | |
| 1452 | extern int32_t tcp_force_detection; | |
| 1453 | extern int32_t tcp_sad_limit; | |
| 1454 | extern int32_t tcp_sack_to_ack_thresh; | |
| 1455 | extern int32_t tcp_sack_to_move_thresh; | |
| 1456 | extern int32_t tcp_restoral_thresh; | |
| 1457 | extern int32_t tcp_sad_decay_val; | |
| 1458 | extern int32_t tcp_sad_pacing_interval; | |
| 1459 | extern int32_t tcp_sad_low_pps; | |
| 1460 | extern int32_t tcp_map_minimum; | |
| 1461 | extern int32_t tcp_attack_on_turns_on_logging; | |
| 1462 | #endif | |
| 1463 | 1435 | extern uint32_t tcp_ack_war_time_window; |
| 1464 | 1436 | extern uint32_t tcp_ack_war_cnt; |
| 1465 | 1437 | |
| 1438 | /* | |
| 1439 | * Used by tcp_maxmtu() to communicate interface specific features | |
| 1440 | * and limits at the time of connection setup. | |
| 1441 | */ | |
| 1442 | struct tcp_ifcap { | |
| 1443 | 	int	ifcap; | |
| 1444 | 	u_int	tsomax; | |
| 1445 | 	u_int	tsomaxsegcount; | |
| 1446 | 	u_int	tsomaxsegsize; | |
| 1447 | 	bool	ipsec_tso; | |
| 1448 | }; | |
| 1466 | 1449 | uint32_t tcp_maxmtu(struct in_conninfo *, struct tcp_ifcap *); |
| 1467 | 1450 | uint32_t tcp_maxmtu6(struct in_conninfo *, struct tcp_ifcap *); |
| 1451 | ||
| 1468 | 1452 | void	 tcp6_use_min_mtu(struct tcpcb *); |
| 1469 | 1453 | u_int	 tcp_maxseg(const struct tcpcb *); |
| 1470 | 1454 | u_int	 tcp_fixed_maxseg(const struct tcpcb *); |
| ... | ... | @@ -1478,6 +1462,7 @@ int	 tcp_default_output(struct tcpcb *); |
| 1478 | 1462 | void	 tcp_state_change(struct tcpcb *, int); |
| 1479 | 1463 | void	 tcp_respond(struct tcpcb *, void *, |
| 1480 | 1464 | 	 struct tcphdr *, struct mbuf *, tcp_seq, tcp_seq, uint16_t); |
| 1465 | bool	 tcp_challenge_ack_check(sbintime_t *, uint32_t *); | |
| 1481 | 1466 | void	 tcp_send_challenge_ack(struct tcpcb *, struct tcphdr *, struct mbuf *); |
| 1482 | 1467 | bool	 tcp_twcheck(struct inpcb *, struct tcpopt *, struct tcphdr *, |
| 1483 | 1468 | 	 struct mbuf *, int); |
| ... | ... | @@ -1497,10 +1482,10 @@ void	 tcp_hc_init(void); |
| 1497 | 1482 | #ifdef VIMAGE |
| 1498 | 1483 | void	 tcp_hc_destroy(void); |
| 1499 | 1484 | #endif |
| 1500 | void	 tcp_hc_get(struct in_conninfo *, struct hc_metrics_lite *); | |
| 1501 | uint32_t tcp_hc_getmtu(struct in_conninfo *); | |
| 1502 | void	 tcp_hc_updatemtu(struct in_conninfo *, uint32_t); | |
| 1503 | void	 tcp_hc_update(struct in_conninfo *, struct hc_metrics_lite *); | |
| 1485 | void	 tcp_hc_get(const struct in_conninfo *, struct hc_metrics_lite *); | |
| 1486 | uint32_t tcp_hc_getmtu(const struct in_conninfo *); | |
| 1487 | void	 tcp_hc_updatemtu(const struct in_conninfo *, uint32_t); | |
| 1488 | void	 tcp_hc_update(const struct in_conninfo *, struct hc_metrics_lite *); | |
| 1504 | 1489 | void 	 cc_after_idle(struct tcpcb *tp); |
| 1505 | 1490 | |
| 1506 | 1491 | extern	struct protosw tcp_protosw;		/* shared for TOE */ |
| ... | ... | @@ -1513,14 +1498,17 @@ sackstatus_t |
| 1513 | 1498 | 	 tcp_sack_doack(struct tcpcb *, struct tcpopt *, tcp_seq); |
| 1514 | 1499 | int	 tcp_dsack_block_exists(struct tcpcb *); |
| 1515 | 1500 | void	 tcp_update_dsack_list(struct tcpcb *, tcp_seq, tcp_seq); |
| 1516 | void	 tcp_update_sack_list(struct tcpcb *tp, tcp_seq rcv_laststart, tcp_seq rcv_lastend); | |
| 1501 | void	 tcp_update_sack_list(struct tcpcb *tp, tcp_seq rcv_laststart, | |
| 1502 | 	 tcp_seq rcv_lastend); | |
| 1517 | 1503 | void	 tcp_clean_dsack_blocks(struct tcpcb *tp); |
| 1518 | 1504 | void	 tcp_clean_sackreport(struct tcpcb *tp); |
| 1519 | 1505 | int	 tcp_sack_adjust(struct tcpcb *tp); |
| 1520 | 1506 | struct sackhole *tcp_sack_output(struct tcpcb *tp, int *sack_bytes_rexmt); |
| 1521 | void	 tcp_do_prr_ack(struct tcpcb *, struct tcphdr *, struct tcpopt *, sackstatus_t); | |
| 1507 | void	 tcp_do_prr_ack(struct tcpcb *, struct tcphdr *, struct tcpopt *, | |
| 1508 | 	 sackstatus_t, u_int *); | |
| 1522 | 1509 | void	 tcp_lost_retransmission(struct tcpcb *, struct tcphdr *); |
| 1523 | void	 tcp_sack_partialack(struct tcpcb *, struct tcphdr *); | |
| 1510 | void	 tcp_sack_partialack(struct tcpcb *, struct tcphdr *, u_int *); | |
| 1511 | void	 tcp_resend_sackholes(struct tcpcb *tp); | |
| 1524 | 1512 | void	 tcp_free_sackholes(struct tcpcb *tp); |
| 1525 | 1513 | void	 tcp_sack_lost_retransmission(struct tcpcb *, struct tcphdr *); |
| 1526 | 1514 | int	 tcp_newreno(struct tcpcb *, struct tcphdr *); |
| ... | ... | @@ -1530,6 +1518,8 @@ void	 tcp_sndbuf_autoscale(struct tcpcb *, struct socket *, uint32_t); |
| 1530 | 1518 | int	 tcp_stats_sample_rollthedice(struct tcpcb *tp, void *seed_bytes, |
| 1531 | 1519 | size_t seed_len); |
| 1532 | 1520 | int tcp_can_enable_pacing(void); |
| 1521 | int tcp_incr_dgp_pacing_cnt(void); | |
| 1522 | void tcp_dec_dgp_pacing_cnt(void); | |
| 1533 | 1523 | void tcp_decrement_paced_conn(void); |
| 1534 | 1524 | void tcp_change_time_units(struct tcpcb *, int); |
| 1535 | 1525 | void tcp_handle_orphaned_packets(struct tcpcb *); |
| ... | ... | @@ -1598,19 +1588,6 @@ tcp_fields_to_net(struct tcphdr *th) |
| 1598 | 1588 | 	th->th_win = htons(th->th_win); |
| 1599 | 1589 | 	th->th_urp = htons(th->th_urp); |
| 1600 | 1590 | } |
| 1601 | ||
| 1602 | static inline uint16_t | |
| 1603 | tcp_get_flags(const struct tcphdr *th) | |
| 1604 | { | |
| 1605 | return (((uint16_t)th->th_x2 << 8) | th->th_flags); | |
| 1606 | } | |
| 1607 | ||
| 1608 | static inline void | |
| 1609 | tcp_set_flags(struct tcphdr *th, uint16_t flags) | |
| 1610 | { | |
| 1611 | th->th_x2 = (flags >> 8) & 0x0f; | |
| 1612 | th->th_flags = flags & 0xff; | |
| 1613 | } | |
| 1614 | 1591 | #endif /* _KERNEL */ |
| 1615 | 1592 | |
| 1616 | 1593 | #endif /* _NETINET_TCP_VAR_H_ */ |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/netinet/tcpip.h-2| ... | ... | @@ -27,8 +27,6 @@ |
| 27 | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | * | |
| 31 | *	@(#)tcpip.h	8.1 (Berkeley) 6/10/93 | |
| 32 | 30 | */ |
| 33 | 31 | |
| 34 | 32 | #ifndef _NETINET_TCPIP_H_ |
lib/libc/include/generic-freebsd/netinet/toecore.h+2-1| ... | ... | @@ -36,6 +36,7 @@ |
| 36 | 36 | #include <netinet/tcp.h> |
| 37 | 37 | #include <sys/_eventhandler.h> |
| 38 | 38 | |
| 39 | struct tcpcb; | |
| 39 | 40 | struct tcpopt; |
| 40 | 41 | struct tcphdr; |
| 41 | 42 | struct in_conninfo; |
| ... | ... | @@ -65,7 +66,7 @@ struct toedev { |
| 65 | 66 | 	void (*tod_input)(struct toedev *, struct tcpcb *, struct mbuf *); |
| 66 | 67 | |
| 67 | 68 | 	/* |
| 68 | 	 * This is called by the kernel during pru_rcvd for an offloaded TCP | |
| 69 | 	 * This is called by the kernel during pr_rcvd() for an offloaded TCP | |
| 69 | 70 | 	 * connection and provides an opportunity for the TOE driver to manage |
| 70 | 71 | 	 * its rx window and credits. |
| 71 | 72 | 	 */ |
lib/libc/include/generic-freebsd/netinet/udp.h+1-3| ... | ... | @@ -28,8 +28,6 @@ |
| 28 | 28 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 29 | 29 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 30 | 30 | * SUCH DAMAGE. |
| 31 | * | |
| 32 | *	@(#)udp.h	8.1 (Berkeley) 6/10/93 | |
| 33 | 31 | */ |
| 34 | 32 | |
| 35 | 33 | #ifndef _NETINET_UDP_H_ |
| ... | ... | @@ -46,7 +44,7 @@ struct udphdr { |
| 46 | 44 | 	u_short	uh_dport;		/* destination port */ |
| 47 | 45 | 	u_short	uh_ulen;		/* udp length */ |
| 48 | 46 | 	u_short	uh_sum;			/* udp checksum */ |
| 49 | }; | |
| 47 | } __packed; | |
| 50 | 48 | |
| 51 | 49 | /* |
| 52 | 50 | * User-settable options (used with setsockopt). |
lib/libc/include/generic-freebsd/netinet/udp_var.h+20-11| ... | ... | @@ -28,8 +28,6 @@ |
| 28 | 28 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 29 | 29 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 30 | 30 | * SUCH DAMAGE. |
| 31 | * | |
| 32 | *	@(#)udp_var.h	8.1 (Berkeley) 6/10/93 | |
| 33 | 31 | */ |
| 34 | 32 | |
| 35 | 33 | #ifndef _NETINET_UDP_VAR_H_ |
| ... | ... | @@ -95,6 +93,7 @@ struct udpstat { |
| 95 | 93 | #ifdef _KERNEL |
| 96 | 94 | #include <netinet/in_pcb.h> |
| 97 | 95 | #include <sys/counter.h> |
| 96 | #include <netinet/in_kdtrace.h> | |
| 98 | 97 | struct mbuf; |
| 99 | 98 | |
| 100 | 99 | typedef bool	udp_tun_func_t(struct mbuf *, int, struct inpcb *, |
| ... | ... | @@ -121,7 +120,7 @@ struct udpcb { |
| 121 | 120 | 	void 		*u_tun_ctx;	/* Tunneling callback context. */ |
| 122 | 121 | }; |
| 123 | 122 | |
| 124 | #define	intoudpcb(ip)	__containerof((inp), struct udpcb, u_inpcb) | |
| 123 | #define	intoudpcb(ip)	__containerof((ip), struct udpcb, u_inpcb) | |
| 125 | 124 | #define	sotoudpcb(so)	(intoudpcb(sotoinpcb(so))) |
| 126 | 125 | |
| 127 | 126 | VNET_PCPUSTAT_DECLARE(struct udpstat, udpstat); |
| ... | ... | @@ -129,18 +128,26 @@ VNET_PCPUSTAT_DECLARE(struct udpstat, udpstat); |
| 129 | 128 | * In-kernel consumers can use these accessor macros directly to update |
| 130 | 129 | * stats. |
| 131 | 130 | */ |
| 132 | #define	UDPSTAT_ADD(name, val) \ | |
| 133 | VNET_PCPUSTAT_ADD(struct udpstat, udpstat, name, (val)) | |
| 134 | #define	UDPSTAT_INC(name)	UDPSTAT_ADD(name, 1) | |
| 131 | #define UDPSTAT_ADD(name, val) \ | |
| 132 | 	do { \ | |
| 133 | 		MIB_SDT_PROBE1(udp, count, name, (val)); \ | |
| 134 | 		VNET_PCPUSTAT_ADD(struct udpstat, udpstat, name, (val)); \ | |
| 135 | 	} while (0) | |
| 136 | #define UDPSTAT_INC(name) UDPSTAT_ADD(name, 1) | |
| 135 | 137 | |
| 136 | 138 | /* |
| 137 | 139 | * Kernel module consumers must use this accessor macro. |
| 138 | 140 | */ |
| 139 | 141 | void	kmod_udpstat_inc(int statnum); |
| 140 | #define	KMOD_UDPSTAT_INC(name)	\ | |
| 141 | kmod_udpstat_inc(offsetof(struct udpstat, name) / sizeof(uint64_t)) | |
| 142 | #define KMOD_UDPSTAT_INC(name) \ | |
| 143 | 	do { \ | |
| 144 | 		MIB_SDT_PROBE1(udp, count, name, 1); \ | |
| 145 | 		kmod_udpstat_inc( \ | |
| 146 | 		 offsetof(struct udpstat, name) / sizeof(uint64_t)); \ | |
| 147 | 	} while (0) | |
| 142 | 148 | |
| 143 | 149 | SYSCTL_DECL(_net_inet_udp); |
| 150 | SYSCTL_DECL(_net_inet_udplite); | |
| 144 | 151 | |
| 145 | 152 | VNET_DECLARE(struct inpcbinfo, udbinfo); |
| 146 | 153 | VNET_DECLARE(struct inpcbinfo, ulitecbinfo); |
| ... | ... | @@ -149,13 +156,15 @@ VNET_DECLARE(struct inpcbinfo, ulitecbinfo); |
| 149 | 156 | |
| 150 | 157 | extern u_long			udp_sendspace; |
| 151 | 158 | extern u_long			udp_recvspace; |
| 152 | VNET_DECLARE(int, udp_cksum); | |
| 159 | VNET_DECLARE(int, udp_bind_all_fibs); | |
| 153 | 160 | VNET_DECLARE(int, udp_blackhole); |
| 154 | 161 | VNET_DECLARE(bool, udp_blackhole_local); |
| 162 | VNET_DECLARE(int, udp_cksum); | |
| 155 | 163 | VNET_DECLARE(int, udp_log_in_vain); |
| 156 | #define	V_udp_cksum		VNET(udp_cksum) | |
| 164 | #define	V_udp_bind_all_fibs	VNET(udp_bind_all_fibs) | |
| 157 | 165 | #define	V_udp_blackhole		VNET(udp_blackhole) |
| 158 | 166 | #define	V_udp_blackhole_local	VNET(udp_blackhole_local) |
| 167 | #define	V_udp_cksum		VNET(udp_cksum) | |
| 159 | 168 | #define	V_udp_log_in_vain	VNET(udp_log_in_vain) |
| 160 | 169 | |
| 161 | 170 | VNET_DECLARE(int, zero_checksum_port); |
| ... | ... | @@ -170,7 +179,7 @@ udp_get_inpcbinfo(int protocol) |
| 170 | 179 | int		udp_ctloutput(struct socket *, struct sockopt *); |
| 171 | 180 | void		udplite_input(struct mbuf *, int); |
| 172 | 181 | struct inpcb	*udp_notify(struct inpcb *inp, int errno); |
| 173 | int		udp_shutdown(struct socket *so); | |
| 182 | int		udp_shutdown(struct socket *, enum shutdown_how); | |
| 174 | 183 | |
| 175 | 184 | int		udp_set_kernel_tunneling(struct socket *so, udp_tun_func_t f, |
| 176 | 185 | 		 udp_tun_icmp_t i, void *ctx); |
lib/libc/include/generic-freebsd/netinet6/in6.h+7-8| ... | ... | @@ -58,8 +58,6 @@ |
| 58 | 58 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 59 | 59 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 60 | 60 | * SUCH DAMAGE. |
| 61 | * | |
| 62 | *	@(#)in.h	8.3 (Berkeley) 1/3/94 | |
| 63 | 61 | */ |
| 64 | 62 | |
| 65 | 63 | #ifndef __KAME_NETINET_IN_H_INCLUDED_ |
| ... | ... | @@ -360,11 +358,11 @@ extern const struct in6_addr in6addr_linklocal_allv2routers; |
| 360 | 358 | |
| 361 | 359 | #define IFA6_IS_DEPRECATED(a) \ |
| 362 | 360 | 	((a)->ia6_lifetime.ia6t_pltime != ND6_INFINITE_LIFETIME && \ |
| 363 | 	 (u_int32_t)((time_uptime - (a)->ia6_updatetime)) > \ | |
| 361 | 	 (u_int32_t)((time_uptime - (a)->ia6_updatetime)) >= \ | |
| 364 | 362 | 	 (a)->ia6_lifetime.ia6t_pltime) |
| 365 | 363 | #define IFA6_IS_INVALID(a) \ |
| 366 | 364 | 	((a)->ia6_lifetime.ia6t_vltime != ND6_INFINITE_LIFETIME && \ |
| 367 | 	 (u_int32_t)((time_uptime - (a)->ia6_updatetime)) > \ | |
| 365 | 	 (u_int32_t)((time_uptime - (a)->ia6_updatetime)) >= \ | |
| 368 | 366 | 	 (a)->ia6_lifetime.ia6t_vltime) |
| 369 | 367 | #endif /* _KERNEL */ |
| 370 | 368 | |
| ... | ... | @@ -666,6 +664,8 @@ struct ip6_hdr; |
| 666 | 664 | |
| 667 | 665 | int	in6_cksum(struct mbuf *, uint8_t, uint32_t, uint32_t); |
| 668 | 666 | int	in6_cksum_partial(struct mbuf *, uint8_t, uint32_t, uint32_t, uint32_t); |
| 667 | int	in6_cksum_partial_l2(struct mbuf *m, uint8_t nxt, uint32_t off_l3, | |
| 668 | 	 uint32_t off_l4, uint32_t len, uint32_t cov); | |
| 669 | 669 | int	in6_cksum_pseudo(struct ip6_hdr *, uint32_t, uint8_t, uint16_t); |
| 670 | 670 | |
| 671 | 671 | int	in6_localaddr(struct in6_addr *); |
| ... | ... | @@ -679,11 +679,10 @@ extern void in6_if_up(struct ifnet *); |
| 679 | 679 | struct sockaddr; |
| 680 | 680 | |
| 681 | 681 | void	in6_sin6_2_sin(struct sockaddr_in *sin, |
| 682 | 			 struct sockaddr_in6 *sin6); | |
| 683 | void	in6_sin_2_v4mapsin6(struct sockaddr_in *sin, | |
| 684 | 				 struct sockaddr_in6 *sin6); | |
| 682 | 	 const struct sockaddr_in6 *sin6); | |
| 683 | void	in6_sin_2_v4mapsin6(const struct sockaddr_in *sin, | |
| 684 | 	 struct sockaddr_in6 *sin6); | |
| 685 | 685 | void	in6_sin6_2_sin_in_sock(struct sockaddr *nam); |
| 686 | void	in6_sin_2_v4mapsin6_in_sock(struct sockaddr **nam); | |
| 687 | 686 | extern void addrsel_policy_init(void); |
| 688 | 687 | |
| 689 | 688 | #define	satosin6(sa)	((struct sockaddr_in6 *)(sa)) |
lib/libc/include/generic-freebsd/netinet6/in6_ifattach.h-1| ... | ... | @@ -39,7 +39,6 @@ void in6_ifattach(struct ifnet *, struct ifnet *); |
| 39 | 39 | void in6_ifattach_destroy(void); |
| 40 | 40 | void in6_ifdetach(struct ifnet *); |
| 41 | 41 | void in6_ifdetach_destroy(struct ifnet *); |
| 42 | int in6_get_tmpifid(struct ifnet *, u_int8_t *, const u_int8_t *, int); | |
| 43 | 42 | void in6_tmpaddrtimer(void *); |
| 44 | 43 | int in6_get_hw_ifid(struct ifnet *, struct in6_addr *); |
| 45 | 44 | int in6_nigroup(struct ifnet *, const char *, int, struct in6_addr *); |
lib/libc/include/generic-freebsd/netinet6/in6_pcb.h+14-26| ... | ... | @@ -58,8 +58,6 @@ |
| 58 | 58 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 59 | 59 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 60 | 60 | * SUCH DAMAGE. |
| 61 | * | |
| 62 | *	@(#)in_pcb.h	8.1 (Berkeley) 6/10/93 | |
| 63 | 61 | */ |
| 64 | 62 | |
| 65 | 63 | #ifndef _NETINET6_IN6_PCB_H_ |
| ... | ... | @@ -72,40 +70,30 @@ |
| 72 | 70 | |
| 73 | 71 | void	in6_pcbpurgeif0(struct inpcbinfo *, struct ifnet *); |
| 74 | 72 | void	in6_losing(struct inpcb *); |
| 75 | int	in6_pcbbind(struct inpcb *, struct sockaddr_in6 *, struct ucred *); | |
| 73 | int	in6_pcbbind(struct inpcb *, struct sockaddr_in6 *, int, struct ucred *); | |
| 76 | 74 | int	in6_pcbconnect(struct inpcb *, struct sockaddr_in6 *, struct ucred *, |
| 77 | 75 | 	 bool); |
| 78 | 76 | void	in6_pcbdisconnect(struct inpcb *); |
| 79 | struct	inpcb * | |
| 80 | 	in6_pcblookup_local(struct inpcbinfo *, | |
| 81 | 				 struct in6_addr *, u_short, int, | |
| 82 | 				 struct ucred *); | |
| 83 | struct inpcb * | |
| 84 | 	in6_pcblookup_hash_locked(struct inpcbinfo *pcbinfo, | |
| 77 | struct inpcb *in6_pcblookup_local(struct inpcbinfo *, const struct in6_addr *, | |
| 78 | 	 u_short, int, int, struct ucred *); | |
| 79 | struct inpcb *in6_pcblookup_hash_locked(struct inpcbinfo *pcbinfo, | |
| 85 | 80 | 	 const struct in6_addr *faddr, u_int fport_arg, |
| 86 | 81 | 	 const struct in6_addr *laddr, u_int lport_arg, |
| 87 | 	 int lookupflags, uint8_t); | |
| 88 | struct	inpcb * | |
| 89 | 	in6_pcblookup(struct inpcbinfo *, struct in6_addr *, | |
| 90 | 			 u_int, struct in6_addr *, u_int, int, | |
| 91 | 			 struct ifnet *); | |
| 92 | struct	inpcb * | |
| 93 | 	in6_pcblookup_mbuf(struct inpcbinfo *, struct in6_addr *, | |
| 94 | 			 u_int, struct in6_addr *, u_int, int, | |
| 95 | 			 struct ifnet *ifp, struct mbuf *); | |
| 82 | 	 int lookupflags, uint8_t numa_domain, int fib); | |
| 83 | struct inpcb *in6_pcblookup(struct inpcbinfo *, const struct in6_addr *, u_int, | |
| 84 | 	 const struct in6_addr *, u_int, int, struct ifnet *); | |
| 85 | struct inpcb *in6_pcblookup_mbuf(struct inpcbinfo *, const struct in6_addr *, | |
| 86 | 	 u_int, const struct in6_addr *, u_int, int, struct ifnet *ifp, | |
| 87 | 	 struct mbuf *); | |
| 96 | 88 | void	in6_pcbnotify(struct inpcbinfo *, struct sockaddr_in6 *, u_int, |
| 97 | 89 | 			 const struct sockaddr_in6 *, u_int, int, void *, |
| 98 | 90 | 			 struct inpcb *(*)(struct inpcb *, int)); |
| 99 | 91 | struct inpcb * |
| 100 | 92 | 	in6_rtchange(struct inpcb *, int); |
| 101 | struct sockaddr * | |
| 102 | 	in6_sockaddr(in_port_t port, struct in6_addr *addr_p); | |
| 103 | struct sockaddr * | |
| 104 | 	in6_v4mapsin6_sockaddr(in_port_t port, struct in_addr *addr_p); | |
| 105 | int	in6_getpeeraddr(struct socket *so, struct sockaddr **nam); | |
| 106 | int	in6_getsockaddr(struct socket *so, struct sockaddr **nam); | |
| 107 | int	in6_mapped_sockaddr(struct socket *so, struct sockaddr **nam); | |
| 108 | int	in6_mapped_peeraddr(struct socket *so, struct sockaddr **nam); | |
| 93 | int	in6_getpeeraddr(struct socket *, struct sockaddr *); | |
| 94 | int	in6_getsockaddr(struct socket *, struct sockaddr *); | |
| 95 | int	in6_mapped_sockaddr(struct socket *, struct sockaddr *); | |
| 96 | int	in6_mapped_peeraddr(struct socket *, struct sockaddr *); | |
| 109 | 97 | int	in6_selecthlim(struct inpcb *, struct ifnet *); |
| 110 | 98 | int	in6_pcbsetport(struct in6_addr *, struct inpcb *, struct ucred *); |
| 111 | 99 | void	init_sin6(struct sockaddr_in6 *sin6, struct mbuf *m, int); |
lib/libc/include/generic-freebsd/netinet6/in6_var.h+2-10| ... | ... | @@ -58,8 +58,6 @@ |
| 58 | 58 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 59 | 59 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 60 | 60 | * SUCH DAMAGE. |
| 61 | * | |
| 62 | *	@(#)in_var.h	8.1 (Berkeley) 6/10/93 | |
| 63 | 61 | */ |
| 64 | 62 | |
| 65 | 63 | #ifndef _NETINET6_IN6_VAR_H_ |
| ... | ... | @@ -117,7 +115,7 @@ struct in6_ifextra { |
| 117 | 115 | SLIST_HEAD(in6_multi_head, in6_multi); |
| 118 | 116 | MALLOC_DECLARE(M_IP6MADDR); |
| 119 | 117 | |
| 120 | struct	in6_ifaddr { | |
| 118 | struct in6_ifaddr { | |
| 121 | 119 | 	struct	ifaddr ia_ifa;		/* protocol-independent info */ |
| 122 | 120 | #define	ia_ifp		ia_ifa.ifa_ifp |
| 123 | 121 | #define ia_flags	ia_ifa.ifa_flags |
| ... | ... | @@ -325,8 +323,7 @@ struct in6_prflags { |
| 325 | 323 | 	struct prf_ra { |
| 326 | 324 | 		u_char onlink : 1; |
| 327 | 325 | 		u_char autonomous : 1; |
| 328 | 		u_char ra_derived: 1; | |
| 329 | 		u_char reserved : 5; | |
| 326 | 		u_char reserved : 6; | |
| 330 | 327 | 	} prf_ra; |
| 331 | 328 | 	u_char prf_reserved1; |
| 332 | 329 | 	u_short prf_reserved2; |
| ... | ... | @@ -357,7 +354,6 @@ struct in6_prefixreq { |
| 357 | 354 | |
| 358 | 355 | #define ipr_raf_onlink		ipr_flags.prf_ra.onlink |
| 359 | 356 | #define ipr_raf_auto		ipr_flags.prf_ra.autonomous |
| 360 | #define ipr_raf_ra_derived	ipr_flags.prf_ra.ra_derived | |
| 361 | 357 | |
| 362 | 358 | #define ipr_statef_onlink	ipr_flags.prf_state.onlink |
| 363 | 359 | |
| ... | ... | @@ -551,9 +547,6 @@ do {								\ |
| 551 | 547 | 		 ((ifp)->if_afdata[AF_INET6]))->in6_ifstat[	\ |
| 552 | 548 | 		 offsetof(struct in6_ifstat, tag) / sizeof(uint64_t)], 1);\ |
| 553 | 549 | } while (/*CONSTCOND*/ 0) |
| 554 | ||
| 555 | VNET_DECLARE(unsigned long, in6_maxmtu); | |
| 556 | #define	V_in6_maxmtu			VNET(in6_maxmtu) | |
| 557 | 550 | #endif /* _KERNEL */ |
| 558 | 551 | |
| 559 | 552 | /* |
| ... | ... | @@ -877,7 +870,6 @@ void	in6_domifdetach(struct ifnet *, void *); |
| 877 | 870 | int	in6_domifmtu(struct ifnet *); |
| 878 | 871 | struct rib_head *in6_inithead(uint32_t fibnum); |
| 879 | 872 | void	in6_detachhead(struct rib_head *rh); |
| 880 | void	in6_setmaxmtu(void); | |
| 881 | 873 | int	in6_if2idlen(struct ifnet *); |
| 882 | 874 | struct in6_ifaddr *in6ifa_ifpforlinklocal(struct ifnet *, int); |
| 883 | 875 | struct in6_ifaddr *in6ifa_ifpwithaddr(struct ifnet *, const struct in6_addr *); |
lib/libc/include/generic-freebsd/netinet6/ip6_var.h+51-26| ... | ... | @@ -58,8 +58,6 @@ |
| 58 | 58 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 59 | 59 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 60 | 60 | * SUCH DAMAGE. |
| 61 | * | |
| 62 | *	@(#)ip_var.h	8.1 (Berkeley) 6/10/93 | |
| 63 | 61 | */ |
| 64 | 62 | |
| 65 | 63 | #ifndef _NETINET6_IP6_VAR_H_ |
| ... | ... | @@ -132,27 +130,26 @@ struct	ip6po_nhinfo { |
| 132 | 130 | #define ip6po_nexthop	ip6po_nhinfo.ip6po_nhi_nexthop |
| 133 | 131 | #define ip6po_nextroute	ip6po_nhinfo.ip6po_nhi_route |
| 134 | 132 | |
| 133 | /* | |
| 134 | * Note that fields with valid data must be flagged in ip6po_valid. | |
| 135 | * This is done to reduce cache misses in ip6_output(). Before | |
| 136 | * ip6po_valid, ip6_output needed to check all the individual fields | |
| 137 | * of ip6_pktopts needed to be checked themselves, and they are spread | |
| 138 | * across 4 cachelines. ip6_output() is currently the only consumer of | |
| 139 | * these flags, as it is in the critical path of every packet sent. | |
| 140 | */ | |
| 135 | 141 | struct	ip6_pktopts { |
| 136 | 	struct	mbuf *ip6po_m;	/* Pointer to mbuf storing the data */ | |
| 137 | 	int	ip6po_hlim;	/* Hoplimit for outgoing packets */ | |
| 138 | ||
| 139 | 	/* Outgoing IF/address information */ | |
| 140 | 	struct	in6_pktinfo *ip6po_pktinfo; | |
| 141 | ||
| 142 | 	/* Next-hop address information */ | |
| 143 | 	struct	ip6po_nhinfo ip6po_nhinfo; | |
| 144 | ||
| 145 | 	struct	ip6_hbh *ip6po_hbh; /* Hop-by-Hop options header */ | |
| 146 | ||
| 147 | 	/* Destination options header (before a routing header) */ | |
| 148 | 	struct	ip6_dest *ip6po_dest1; | |
| 149 | ||
| 150 | 	/* Routing header related info. */ | |
| 151 | 	struct	ip6po_rhinfo ip6po_rhinfo; | |
| 152 | ||
| 153 | 	/* Destination options header (after a routing header) */ | |
| 154 | 	struct	ip6_dest *ip6po_dest2; | |
| 142 | 	uint32_t ip6po_valid; | |
| 143 | #define IP6PO_VALID_HLIM	0x0001 | |
| 144 | #define IP6PO_VALID_PKTINFO	0x0002 | |
| 145 | #define IP6PO_VALID_NHINFO	0x0004 | |
| 146 | #define IP6PO_VALID_HBH		0x0008 | |
| 147 | #define IP6PO_VALID_DEST1	0x0010 | |
| 148 | #define IP6PO_VALID_RHINFO	0x0020 | |
| 149 | #define IP6PO_VALID_DEST2	0x0040 | |
| 150 | #define IP6PO_VALID_TC		0x0080 | |
| 155 | 151 | |
| 152 | 	int	ip6po_hlim;	/* Hoplimit for outgoing packets */ | |
| 156 | 153 | 	int	ip6po_tclass;	/* traffic class */ |
| 157 | 154 | |
| 158 | 155 | 	int	ip6po_minmtu; /* fragment vs PMTU discovery policy */ |
| ... | ... | @@ -173,6 +170,25 @@ struct	ip6_pktopts { |
| 173 | 170 | #endif |
| 174 | 171 | #define IP6PO_DONTFRAG	0x04	/* disable fragmentation (IPV6_DONTFRAG) */ |
| 175 | 172 | #define IP6PO_USECOA	0x08	/* use care of address */ |
| 173 | ||
| 174 | 	struct	mbuf *ip6po_m;	/* Pointer to mbuf storing the data */ | |
| 175 | ||
| 176 | 	/* Outgoing IF/address information */ | |
| 177 | 	struct	in6_pktinfo *ip6po_pktinfo; | |
| 178 | ||
| 179 | 	/* Next-hop address information */ | |
| 180 | 	struct	ip6po_nhinfo ip6po_nhinfo; | |
| 181 | ||
| 182 | 	struct	ip6_hbh *ip6po_hbh; /* Hop-by-Hop options header */ | |
| 183 | ||
| 184 | 	/* Destination options header (before a routing header) */ | |
| 185 | 	struct	ip6_dest *ip6po_dest1; | |
| 186 | ||
| 187 | 	/* Routing header related info. */ | |
| 188 | 	struct	ip6po_rhinfo ip6po_rhinfo; | |
| 189 | ||
| 190 | 	/* Destination options header (after a routing header) */ | |
| 191 | 	struct	ip6_dest *ip6po_dest2; | |
| 176 | 192 | }; |
| 177 | 193 | |
| 178 | 194 | /* |
| ... | ... | @@ -247,13 +263,22 @@ struct	ip6stat { |
| 247 | 263 | |
| 248 | 264 | #ifdef _KERNEL |
| 249 | 265 | #include <sys/counter.h> |
| 266 | #include <netinet/in_kdtrace.h> | |
| 250 | 267 | |
| 251 | 268 | VNET_PCPUSTAT_DECLARE(struct ip6stat, ip6stat); |
| 252 | #define	IP6STAT_ADD(name, val)	\ | |
| 253 | VNET_PCPUSTAT_ADD(struct ip6stat, ip6stat, name, (val)) | |
| 254 | #define	IP6STAT_SUB(name, val)	IP6STAT_ADD(name, -(val)) | |
| 269 | #define	IP6STAT_ADD(name, val) \ | |
| 270 | 	do { \ | |
| 271 | 		MIB_SDT_PROBE1(ip6, count, name, (val)); \ | |
| 272 | 		VNET_PCPUSTAT_ADD(struct ip6stat, ip6stat, name, (val)); \ | |
| 273 | 	} while (0) | |
| 274 | #define IP6STAT_SUB(name, val) IP6STAT_ADD(name, -(val)) | |
| 255 | 275 | #define	IP6STAT_INC(name)	IP6STAT_ADD(name, 1) |
| 256 | #define	IP6STAT_DEC(name)	IP6STAT_SUB(name, 1) | |
| 276 | #define IP6STAT_INC2(name, type) \ | |
| 277 | 	do { \ | |
| 278 | 		MIB_SDT_PROBE2(ip6, count, name, 1, type); \ | |
| 279 | 		VNET_PCPUSTAT_ADD(struct ip6stat, ip6stat, name, 1); \ | |
| 280 | 	} while (0) | |
| 281 | #define IP6STAT_DEC(name) IP6STAT_SUB(name, 1) | |
| 257 | 282 | #endif |
| 258 | 283 | |
| 259 | 284 | #ifdef _KERNEL |
| ... | ... | @@ -389,7 +414,7 @@ int	route6_input(struct mbuf **, int *, int); |
| 389 | 414 | void	frag6_init(void); |
| 390 | 415 | void	frag6_destroy(void); |
| 391 | 416 | int	frag6_input(struct mbuf **, int *, int); |
| 392 | void	frag6_drain(void); | |
| 417 | void	frag6_drain(void *, int); | |
| 393 | 418 | |
| 394 | 419 | void	rip6_init(void); |
| 395 | 420 | int	rip6_ctloutput(struct socket *, struct sockopt *); |
lib/libc/include/generic-freebsd/netinet6/ip_fw_nat64.h+7-3| ... | ... | @@ -84,9 +84,9 @@ struct ipfw_nat64lsn_stats { |
| 84 | 84 | 	uint64_t	spgcreated;	/* Number of portgroups created */ |
| 85 | 85 | 	uint64_t	spgdeleted;	/* Number of portgroups deleted */ |
| 86 | 86 | 	uint64_t	hostcount;	/* Number of hosts */ |
| 87 | 	uint64_t	tcpchunks;	/* Number of TCP chunks */ | |
| 88 | 	uint64_t	udpchunks;	/* Number of UDP chunks */ | |
| 89 | 	uint64_t	icmpchunks;	/* Number of ICMP chunks */ | |
| 87 | 	uint64_t	tcpchunks;	/* Number of TCP portgroups */ | |
| 88 | 	uint64_t	udpchunks;	/* Number of UDP portgroups */ | |
| 89 | 	uint64_t	icmpchunks;	/* Number of ICMP portgroups */ | |
| 90 | 90 | |
| 91 | 91 | 	uint64_t	_reserved[4]; |
| 92 | 92 | }; |
| ... | ... | @@ -95,6 +95,10 @@ struct ipfw_nat64lsn_stats { |
| 95 | 95 | #define	NAT64_ALLOW_PRIVATE	0x0002	/* Allow private IPv4 address |
| 96 | 96 | 					 * translation |
| 97 | 97 | 					 */ |
| 98 | #define	NAT64LSN_ALLOW_SWAPCONF	0x0004	/* Allow configuration exchange | |
| 99 | 					 * between NAT64LSN instances | |
| 100 | 					 * during the sets swapping. | |
| 101 | 					 */ | |
| 98 | 102 | typedef struct _ipfw_nat64stl_cfg { |
| 99 | 103 | 	char		name[64];	/* NAT name			*/ |
| 100 | 104 | 	ipfw_obj_ntlv	ntlv6;		/* object name tlv		*/ |
lib/libc/include/generic-freebsd/netinet6/nd6.h+4-3| ... | ... | @@ -184,10 +184,10 @@ struct	in6_ndifreq { |
| 184 | 184 | #define RETRANS_TIMER			1000	/* msec */ |
| 185 | 185 | #define MIN_RANDOM_FACTOR		512	/* 1024 * 0.5 */ |
| 186 | 186 | #define MAX_RANDOM_FACTOR		1536	/* 1024 * 1.5 */ |
| 187 | #define DEF_TEMP_VALID_LIFETIME		604800	/* 1 week */ | |
| 187 | #define DEF_TEMP_VALID_LIFETIME		172800	/* 2 days */ | |
| 188 | 188 | #define DEF_TEMP_PREFERRED_LIFETIME	86400	/* 1 day */ |
| 189 | 189 | #define TEMPADDR_REGEN_ADVANCE		5	/* sec */ |
| 190 | #define MAX_TEMP_DESYNC_FACTOR		600	/* 10 min */ | |
| 190 | #define TEMP_MAX_DESYNC_FACTOR_BASE	300	/* 5 min */ | |
| 191 | 191 | #define ND_COMPUTE_RTIME(x) \ |
| 192 | 192 | 		(((MIN_RANDOM_FACTOR * (x >> 10)) + (arc4random() & \ |
| 193 | 193 | 		((MAX_RANDOM_FACTOR - MIN_RANDOM_FACTOR) * (x >> 10)))) /1000) |
| ... | ... | @@ -242,7 +242,6 @@ struct nd_prefix { |
| 242 | 242 | #define ndpr_raf		ndpr_flags |
| 243 | 243 | #define ndpr_raf_onlink		ndpr_flags.onlink |
| 244 | 244 | #define ndpr_raf_auto		ndpr_flags.autonomous |
| 245 | #define ndpr_raf_ra_derived	ndpr_flags.ra_derived | |
| 246 | 245 | #define ndpr_raf_router		ndpr_flags.router |
| 247 | 246 | |
| 248 | 247 | struct nd_pfxrouter { |
| ... | ... | @@ -293,11 +292,13 @@ VNET_DECLARE(struct mtx, nd6_onlink_mtx); |
| 293 | 292 | /* nd6_rtr.c */ |
| 294 | 293 | VNET_DECLARE(int, nd6_defifindex); |
| 295 | 294 | VNET_DECLARE(int, ip6_desync_factor);	/* seconds */ |
| 295 | VNET_DECLARE(uint32_t, ip6_temp_max_desync_factor); /* seconds */ | |
| 296 | 296 | VNET_DECLARE(u_int32_t, ip6_temp_preferred_lifetime); /* seconds */ |
| 297 | 297 | VNET_DECLARE(u_int32_t, ip6_temp_valid_lifetime); /* seconds */ |
| 298 | 298 | VNET_DECLARE(int, ip6_temp_regen_advance); /* seconds */ |
| 299 | 299 | #define	V_nd6_defifindex		VNET(nd6_defifindex) |
| 300 | 300 | #define	V_ip6_desync_factor		VNET(ip6_desync_factor) |
| 301 | #define	V_ip6_temp_max_desync_factor	VNET(ip6_temp_max_desync_factor) | |
| 301 | 302 | #define	V_ip6_temp_preferred_lifetime	VNET(ip6_temp_preferred_lifetime) |
| 302 | 303 | #define	V_ip6_temp_valid_lifetime	VNET(ip6_temp_valid_lifetime) |
| 303 | 304 | #define	V_ip6_temp_regen_advance	VNET(ip6_temp_regen_advance) |
lib/libc/include/generic-freebsd/netinet6/tcp6_var.h-2| ... | ... | @@ -56,8 +56,6 @@ |
| 56 | 56 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 57 | 57 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 58 | 58 | * SUCH DAMAGE. |
| 59 | * | |
| 60 | *	@(#)tcp_var.h	8.4 (Berkeley) 5/24/95 | |
| 61 | 59 | */ |
| 62 | 60 | |
| 63 | 61 | #ifndef _NETINET_TCP6_VAR_H_ |
lib/libc/include/generic-freebsd/netinet6/udp6_var.h-2| ... | ... | @@ -57,8 +57,6 @@ |
| 57 | 57 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 58 | 58 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 59 | 59 | * SUCH DAMAGE. |
| 60 | * | |
| 61 | *	@(#)udp_var.h	8.1 (Berkeley) 6/10/93 | |
| 62 | 60 | */ |
| 63 | 61 | |
| 64 | 62 | #ifndef _NETINET6_UDP6_VAR_H_ |
lib/libc/include/generic-freebsd/netipsec/ah_var.h+11-2| ... | ... | @@ -71,13 +71,22 @@ struct ahstat { |
| 71 | 71 | |
| 72 | 72 | #ifdef _KERNEL |
| 73 | 73 | #include <sys/counter.h> |
| 74 | #include <netinet/in_kdtrace.h> | |
| 74 | 75 | |
| 75 | 76 | VNET_DECLARE(int, ah_enable); |
| 76 | 77 | VNET_DECLARE(int, ah_cleartos); |
| 77 | 78 | VNET_PCPUSTAT_DECLARE(struct ahstat, ahstat); |
| 78 | 79 | |
| 79 | #define	AHSTAT_ADD(name, val)	\ | |
| 80 | VNET_PCPUSTAT_ADD(struct ahstat, ahstat, name , (val)) | |
| 80 | #define AHSTAT_ADD(name, val) \ | |
| 81 | 	do { \ | |
| 82 | 		MIB_SDT_PROBE1(ah, count, name, (val)); \ | |
| 83 | 		VNET_PCPUSTAT_ADD(struct ahstat, ahstat, name, (val)); \ | |
| 84 | 	} while (0) | |
| 85 | #define AHSTAT_INC2(name, type) \ | |
| 86 | 	do { \ | |
| 87 | 		MIB_SDT_PROBE2(ah, count, name, 1, (type)); \ | |
| 88 | 		VNET_PCPUSTAT_ADD(struct ahstat, ahstat, name[type], 1); \ | |
| 89 | 	} while (0) | |
| 81 | 90 | #define	AHSTAT_INC(name)	AHSTAT_ADD(name, 1) |
| 82 | 91 | #define	V_ah_enable		VNET(ah_enable) |
| 83 | 92 | #define	V_ah_cleartos		VNET(ah_cleartos) |
lib/libc/include/generic-freebsd/netipsec/esp_var.h+14-2| ... | ... | @@ -72,13 +72,25 @@ struct espstat { |
| 72 | 72 | |
| 73 | 73 | #ifdef _KERNEL |
| 74 | 74 | #include <sys/counter.h> |
| 75 | #include <netinet/in_kdtrace.h> | |
| 75 | 76 | |
| 76 | 77 | VNET_DECLARE(int, esp_enable); |
| 78 | VNET_DECLARE(int, esp_ctr_compatibility); | |
| 79 | #define V_esp_ctr_compatibility VNET(esp_ctr_compatibility) | |
| 77 | 80 | VNET_PCPUSTAT_DECLARE(struct espstat, espstat); |
| 78 | 81 | |
| 79 | #define	ESPSTAT_ADD(name, val)	\ | |
| 80 | VNET_PCPUSTAT_ADD(struct espstat, espstat, name, (val)) | |
| 82 | #define ESPSTAT_ADD(name, val) \ | |
| 83 | 	do { \ | |
| 84 | 		MIB_SDT_PROBE1(esp, count, name, (val)); \ | |
| 85 | 		VNET_PCPUSTAT_ADD(struct espstat, espstat, name, (val)); \ | |
| 86 | 	} while (0) | |
| 81 | 87 | #define	ESPSTAT_INC(name)	ESPSTAT_ADD(name, 1) |
| 88 | #define ESPSTAT_INC2(name, type) \ | |
| 89 | 	do { \ | |
| 90 | 		MIB_SDT_PROBE2(esp, count, name, 1, (type)); \ | |
| 91 | 		VNET_PCPUSTAT_ADD(struct espstat, espstat, name[type], 1); \ | |
| 92 | 	} while (0) | |
| 93 | ||
| 82 | 94 | #define	V_esp_enable	VNET(esp_enable) |
| 83 | 95 | #endif /* _KERNEL */ |
| 84 | 96 | #endif /*_NETIPSEC_ESP_VAR_H_*/ |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/netipsec/ipcomp_var.h+12-2| ... | ... | @@ -66,12 +66,22 @@ struct ipcompstat { |
| 66 | 66 | |
| 67 | 67 | #ifdef _KERNEL |
| 68 | 68 | #include <sys/counter.h> |
| 69 | #include <netinet/in_kdtrace.h> | |
| 69 | 70 | |
| 70 | 71 | VNET_DECLARE(int, ipcomp_enable); |
| 71 | 72 | VNET_PCPUSTAT_DECLARE(struct ipcompstat, ipcompstat); |
| 72 | 73 | |
| 73 | #define	IPCOMPSTAT_ADD(name, val)	\ | |
| 74 | VNET_PCPUSTAT_ADD(struct ipcompstat, ipcompstat, name, (val)) | |
| 74 | #define IPCOMPSTAT_ADD(name, val) \ | |
| 75 | 	do { \ | |
| 76 | 		MIB_SDT_PROBE1(ipcomp, count, name, (val)); \ | |
| 77 | 		VNET_PCPUSTAT_ADD(struct ipcompstat, ipcompstat, name, (val)); \ | |
| 78 | 	} while (0) | |
| 79 | #define IPCOMPSTAT_INC2(name, type) \ | |
| 80 | 	do { \ | |
| 81 | 		MIB_SDT_PROBE2(ipcomp, count, name, 1, (type)); \ | |
| 82 | 		VNET_PCPUSTAT_ADD(struct ipcompstat, ipcompstat, name[type], \ | |
| 83 | 		 1); \ | |
| 84 | 	} while (0) | |
| 75 | 85 | #define	IPCOMPSTAT_INC(name)		IPCOMPSTAT_ADD(name, 1) |
| 76 | 86 | #define	V_ipcomp_enable		VNET(ipcomp_enable) |
| 77 | 87 | #endif /* _KERNEL */ |
lib/libc/include/generic-freebsd/netipsec/ipsec.h+44-17| ... | ... | @@ -46,6 +46,9 @@ |
| 46 | 46 | #include <sys/_lock.h> |
| 47 | 47 | #include <sys/_mutex.h> |
| 48 | 48 | #include <sys/_rwlock.h> |
| 49 | #include <sys/sysctl.h> | |
| 50 | ||
| 51 | #include <netinet/in_kdtrace.h> | |
| 49 | 52 | |
| 50 | 53 | #define	IPSEC_ASSERT(_c,_m) KASSERT(_c, _m) |
| 51 | 54 | |
| ... | ... | @@ -71,6 +74,12 @@ struct ipsecrequest { |
| 71 | 74 | 	u_int level;		/* IPsec level defined below. */ |
| 72 | 75 | }; |
| 73 | 76 | |
| 77 | struct ipsec_accel_adddel_sp_tq { | |
| 78 | 	struct vnet *adddel_vnet; | |
| 79 | 	struct task adddel_task; | |
| 80 | 	int adddel_scheduled; | |
| 81 | }; | |
| 82 | ||
| 74 | 83 | /* Security Policy Data Base */ |
| 75 | 84 | struct secpolicy { |
| 76 | 85 | 	TAILQ_ENTRY(secpolicy) chain; |
| ... | ... | @@ -93,7 +102,7 @@ struct secpolicy { |
| 93 | 102 | 	uint32_t id;			/* It's unique number on the system. */ |
| 94 | 103 | 	/* |
| 95 | 104 | 	 * lifetime handler. |
| 96 | 	 * the policy can be used without limitiation if both lifetime and | |
| 105 | 	 * the policy can be used without limitation if both lifetime and | |
| 97 | 106 | 	 * validtime are zero. |
| 98 | 107 | 	 * "lifetime" is passed by sadb_lifetime.sadb_lifetime_addtime. |
| 99 | 108 | 	 * "validtime" is passed by sadb_lifetime.sadb_lifetime_usetime. |
| ... | ... | @@ -102,6 +111,11 @@ struct secpolicy { |
| 102 | 111 | 	time_t lastused;	/* updated every when kernel sends a packet */ |
| 103 | 112 | 	long lifetime;		/* duration of the lifetime of this policy */ |
| 104 | 113 | 	long validtime;		/* duration this policy is valid without use */ |
| 114 | 	CK_LIST_HEAD(, ifp_handle_sp) accel_ifps; | |
| 115 | 	struct ipsec_accel_adddel_sp_tq accel_add_tq; | |
| 116 | 	struct ipsec_accel_adddel_sp_tq accel_del_tq; | |
| 117 | 	struct inpcb *ipsec_accel_add_sp_inp; | |
| 118 | 	const char *accel_ifname; | |
| 105 | 119 | }; |
| 106 | 120 | |
| 107 | 121 | /* |
| ... | ... | @@ -246,6 +260,7 @@ struct ipsecstat { |
| 246 | 260 | #define	IPSECCTL_DEBUG			12 |
| 247 | 261 | #define	IPSECCTL_ESP_RANDPAD		13 |
| 248 | 262 | #define	IPSECCTL_MIN_PMTU		14 |
| 263 | #define	IPSECCTL_RANDOM_ID		15 | |
| 249 | 264 | |
| 250 | 265 | #ifdef _KERNEL |
| 251 | 266 | #include <sys/counter.h> |
| ... | ... | @@ -279,12 +294,17 @@ VNET_DECLARE(int, ip4_ah_net_deflev); |
| 279 | 294 | VNET_DECLARE(int, ip4_ipsec_dfbit); |
| 280 | 295 | VNET_DECLARE(int, ip4_ipsec_min_pmtu); |
| 281 | 296 | VNET_DECLARE(int, ip4_ipsec_ecn); |
| 297 | VNET_DECLARE(int, ip4_ipsec_random_id); | |
| 282 | 298 | VNET_DECLARE(int, crypto_support); |
| 283 | 299 | VNET_DECLARE(int, async_crypto); |
| 284 | 300 | VNET_DECLARE(int, natt_cksum_policy); |
| 285 | 301 | |
| 286 | #define	IPSECSTAT_INC(name)	\ | |
| 287 | VNET_PCPUSTAT_ADD(struct ipsecstat, ipsec4stat, name, 1) | |
| 302 | #define IPSECSTAT_INC(name) \ | |
| 303 | 	do { \ | |
| 304 | 		MIB_SDT_PROBE1(ipsec, count, name, 1); \ | |
| 305 | 		VNET_PCPUSTAT_ADD(struct ipsecstat, ipsec4stat, name, 1); \ | |
| 306 | 	} while (0) | |
| 307 | ||
| 288 | 308 | #define	V_ip4_esp_trans_deflev	VNET(ip4_esp_trans_deflev) |
| 289 | 309 | #define	V_ip4_esp_net_deflev	VNET(ip4_esp_net_deflev) |
| 290 | 310 | #define	V_ip4_ah_trans_deflev	VNET(ip4_ah_trans_deflev) |
| ... | ... | @@ -292,6 +312,7 @@ VNET_DECLARE(int, natt_cksum_policy); |
| 292 | 312 | #define	V_ip4_ipsec_dfbit	VNET(ip4_ipsec_dfbit) |
| 293 | 313 | #define	V_ip4_ipsec_min_pmtu	VNET(ip4_ipsec_min_pmtu) |
| 294 | 314 | #define	V_ip4_ipsec_ecn		VNET(ip4_ipsec_ecn) |
| 315 | #define	V_ip4_ipsec_random_id	VNET(ip4_ipsec_random_id) | |
| 295 | 316 | #define	V_crypto_support	VNET(crypto_support) |
| 296 | 317 | #define	V_async_crypto		VNET(async_crypto) |
| 297 | 318 | #define	V_natt_cksum_policy	VNET(natt_cksum_policy) |
| ... | ... | @@ -307,6 +328,7 @@ VNET_DECLARE(int, natt_cksum_policy); |
| 307 | 328 | #endif |
| 308 | 329 | |
| 309 | 330 | struct inpcb; |
| 331 | struct ip; | |
| 310 | 332 | struct m_tag; |
| 311 | 333 | struct secasvar; |
| 312 | 334 | struct sockopt; |
| ... | ... | @@ -318,7 +340,7 @@ int ipsec_if_input(struct mbuf *, struct secasvar *, uint32_t); |
| 318 | 340 | struct ipsecrequest *ipsec_newisr(void); |
| 319 | 341 | void ipsec_delisr(struct ipsecrequest *); |
| 320 | 342 | struct secpolicy *ipsec4_checkpolicy(const struct mbuf *, struct inpcb *, |
| 321 | int *, int); | |
| 343 | struct ip *, int *, int); | |
| 322 | 344 | |
| 323 | 345 | u_int ipsec_get_reqlevel(struct secpolicy *, u_int); |
| 324 | 346 | |
| ... | ... | @@ -333,27 +355,32 @@ size_t ipsec_hdrsiz_internal(struct secpolicy *); |
| 333 | 355 | |
| 334 | 356 | void ipsec_setspidx_inpcb(struct inpcb *, struct secpolicyindex *, u_int); |
| 335 | 357 | |
| 336 | void ipsec4_setsockaddrs(const struct mbuf *, union sockaddr_union *, | |
| 337 | union sockaddr_union *); | |
| 358 | void ipsec4_setsockaddrs(const struct mbuf *, const struct ip *, | |
| 359 | union sockaddr_union *, union sockaddr_union *); | |
| 338 | 360 | int ipsec4_common_input_cb(struct mbuf *, struct secasvar *, int, int); |
| 339 | int ipsec4_check_pmtu(struct mbuf *, struct secpolicy *, int); | |
| 340 | int ipsec4_process_packet(struct mbuf *, struct secpolicy *, struct inpcb *); | |
| 361 | int ipsec4_check_pmtu(struct ifnet *, struct mbuf *, struct ip *ip1, | |
| 362 | struct secpolicy *, int); | |
| 363 | int ipsec4_process_packet(struct ifnet *, struct mbuf *, struct ip *ip1, | |
| 364 | struct secpolicy *, struct inpcb *, u_long); | |
| 341 | 365 | int ipsec_process_done(struct mbuf *, struct secpolicy *, struct secasvar *, |
| 342 | 366 | u_int); |
| 343 | 367 | |
| 344 | extern	void m_checkalignment(const char* where, struct mbuf *m0, | |
| 345 | 		int off, int len); | |
| 346 | extern	struct mbuf *m_makespace(struct mbuf *m0, int skip, int hlen, int *off); | |
| 347 | extern	caddr_t m_pad(struct mbuf *m, int n); | |
| 348 | extern	int m_striphdr(struct mbuf *m, int skip, int hlen); | |
| 368 | void m_checkalignment(const char* where, struct mbuf *m0, | |
| 369 | int off, int len); | |
| 370 | struct mbuf *m_makespace(struct mbuf *m0, int skip, int hlen, int *off); | |
| 371 | caddr_t m_pad(struct mbuf *m, int n); | |
| 372 | int m_striphdr(struct mbuf *m, int skip, int hlen); | |
| 373 | ||
| 374 | SYSCTL_DECL(_net_inet_ipsec); | |
| 375 | SYSCTL_DECL(_net_inet6_ipsec6); | |
| 349 | 376 | |
| 350 | 377 | #endif /* _KERNEL */ |
| 351 | 378 | |
| 352 | 379 | #ifndef _KERNEL |
| 353 | extern caddr_t ipsec_set_policy(char *, int); | |
| 354 | extern int ipsec_get_policylen(caddr_t); | |
| 355 | extern char *ipsec_dump_policy(caddr_t, char *); | |
| 356 | extern const char *ipsec_strerror(void); | |
| 380 | caddr_t ipsec_set_policy(const char *, int); | |
| 381 | int ipsec_get_policylen(c_caddr_t); | |
| 382 | char *ipsec_dump_policy(c_caddr_t, const char *); | |
| 383 | const char *ipsec_strerror(void); | |
| 357 | 384 | |
| 358 | 385 | #endif /* ! KERNEL */ |
| 359 | 386 |
lib/libc/include/generic-freebsd/netipsec/ipsec6.h+3-2| ... | ... | @@ -66,8 +66,9 @@ struct secpolicy *ipsec6_checkpolicy(const struct mbuf *, |
| 66 | 66 | void ipsec6_setsockaddrs(const struct mbuf *, union sockaddr_union *, |
| 67 | 67 | union sockaddr_union *); |
| 68 | 68 | int ipsec6_common_input_cb(struct mbuf *, struct secasvar *, int, int); |
| 69 | int ipsec6_check_pmtu(struct mbuf *, struct secpolicy *, int); | |
| 70 | int ipsec6_process_packet(struct mbuf *, struct secpolicy *, struct inpcb *); | |
| 69 | int ipsec6_check_pmtu(struct ifnet *, struct mbuf *, struct secpolicy *, int); | |
| 70 | int ipsec6_process_packet(struct ifnet *, struct mbuf *, struct secpolicy *, | |
| 71 | struct inpcb *, u_long); | |
| 71 | 72 | |
| 72 | 73 | int ip6_ipsec_filtertunnel(struct mbuf *); |
| 73 | 74 | int ip6_ipsec_pcbctl(struct inpcb *, struct sockopt *); |
lib/libc/include/generic-freebsd/netipsec/ipsec_offload.h created+217| ... | ... | @@ -0,0 +1,217 @@ |
| 1 | /*- | |
| 2 | * Copyright (c) 2021,2022 NVIDIA CORPORATION & AFFILIATES. ALL RIGHTS RESERVED. | |
| 3 | * | |
| 4 | * Redistribution and use in source and binary forms, with or without | |
| 5 | * modification, are permitted provided that the following conditions | |
| 6 | * are met: | |
| 7 | * 1. Redistributions of source code must retain the above copyright | |
| 8 | * notice, this list of conditions and the following disclaimer. | |
| 9 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 10 | * notice, this list of conditions and the following disclaimer in the | |
| 11 | * documentation and/or other materials provided with the distribution. | |
| 12 | * | |
| 13 | * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS `AS IS' AND | |
| 14 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 15 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
| 16 | * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE | |
| 17 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
| 18 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
| 19 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
| 20 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
| 21 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
| 22 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
| 23 | * SUCH DAMAGE. | |
| 24 | */ | |
| 25 | ||
| 26 | #ifndef _NETIPSEC_IPSEC_OFFLOAD_H_ | |
| 27 | #define _NETIPSEC_IPSEC_OFFLOAD_H_ | |
| 28 | ||
| 29 | #ifdef _KERNEL | |
| 30 | #include <sys/errno.h> | |
| 31 | #include <net/if.h> | |
| 32 | #include <net/if_var.h> | |
| 33 | #include <netipsec/xform.h> | |
| 34 | ||
| 35 | struct secpolicy; | |
| 36 | struct secasvar; | |
| 37 | struct inpcb; | |
| 38 | ||
| 39 | struct ipsec_accel_out_tag { | |
| 40 | 	struct m_tag tag; | |
| 41 | 	uint16_t drv_spi; | |
| 42 | }; | |
| 43 | ||
| 44 | struct ipsec_accel_in_tag { | |
| 45 | 	struct m_tag tag; | |
| 46 | 	struct xform_history xh; /* Must be first to mimic IPSEC_IN_DONE */ | |
| 47 | 	uint16_t drv_spi; | |
| 48 | }; | |
| 49 | ||
| 50 | #define	IPSEC_ACCEL_DRV_SPI_BYPASS	2 | |
| 51 | #define	IPSEC_ACCEL_DRV_SPI_MIN		3 | |
| 52 | #define	IPSEC_ACCEL_DRV_SPI_MAX		0xffff | |
| 53 | ||
| 54 | extern void (*ipsec_accel_sa_newkey_p)(struct secasvar *sav); | |
| 55 | extern void (*ipsec_accel_sa_install_input_p)(struct secasvar *sav, | |
| 56 | const union sockaddr_union *dst_address, int sproto, uint32_t spi); | |
| 57 | extern void (*ipsec_accel_forget_sav_p)(struct secasvar *sav); | |
| 58 | extern void (*ipsec_accel_spdadd_p)(struct secpolicy *sp, struct inpcb *inp); | |
| 59 | extern void (*ipsec_accel_spddel_p)(struct secpolicy *sp); | |
| 60 | extern int (*ipsec_accel_sa_lifetime_op_p)(struct secasvar *sav, | |
| 61 | struct seclifetime *lft_c, if_t ifp, enum IF_SA_CNT_WHICH op, | |
| 62 | struct rm_priotracker *sahtree_trackerp); | |
| 63 | extern void (*ipsec_accel_sync_p)(void); | |
| 64 | extern bool (*ipsec_accel_is_accel_sav_p)(struct secasvar *sav); | |
| 65 | extern struct mbuf *(*ipsec_accel_key_setaccelif_p)(struct secasvar *sav); | |
| 66 | extern void (*ipsec_accel_on_ifdown_p)(struct ifnet *ifp); | |
| 67 | extern void (*ipsec_accel_drv_sa_lifetime_update_p)(struct secasvar *sav, | |
| 68 | if_t ifp, u_int drv_spi, uint64_t octets, uint64_t allocs); | |
| 69 | extern int (*ipsec_accel_drv_sa_lifetime_fetch_p)(struct secasvar *sav, | |
| 70 | if_t ifp, u_int drv_spi, uint64_t *octets, uint64_t *allocs); | |
| 71 | extern bool (*ipsec_accel_fill_xh_p)(if_t ifp, uint32_t drv_spi, | |
| 72 | struct xform_history *xh); | |
| 73 | ||
| 74 | #ifdef IPSEC_OFFLOAD | |
| 75 | /* | |
| 76 | * Have to use ipsec_accel_sa_install_input_p indirection because | |
| 77 | * key.c is unconditionally included into the static kernel. | |
| 78 | */ | |
| 79 | static inline void | |
| 80 | ipsec_accel_sa_newkey(struct secasvar *sav) | |
| 81 | { | |
| 82 | 	void (*p)(struct secasvar *sav); | |
| 83 | ||
| 84 | 	p = atomic_load_ptr(&ipsec_accel_sa_newkey_p); | |
| 85 | 	if (p != NULL) | |
| 86 | 		p(sav); | |
| 87 | } | |
| 88 | ||
| 89 | static inline void | |
| 90 | ipsec_accel_forget_sav(struct secasvar *sav) | |
| 91 | { | |
| 92 | 	void (*p)(struct secasvar *sav); | |
| 93 | ||
| 94 | 	p = atomic_load_ptr(&ipsec_accel_forget_sav_p); | |
| 95 | 	if (p != NULL) | |
| 96 | 		p(sav); | |
| 97 | } | |
| 98 | ||
| 99 | static inline void | |
| 100 | ipsec_accel_spdadd(struct secpolicy *sp, struct inpcb *inp) | |
| 101 | { | |
| 102 | 	void (*p)(struct secpolicy *sp, struct inpcb *inp); | |
| 103 | ||
| 104 | 	p = atomic_load_ptr(&ipsec_accel_spdadd_p); | |
| 105 | 	if (p != NULL) | |
| 106 | 		p(sp, inp); | |
| 107 | } | |
| 108 | ||
| 109 | static inline void | |
| 110 | ipsec_accel_spddel(struct secpolicy *sp) | |
| 111 | { | |
| 112 | 	void (*p)(struct secpolicy *sp); | |
| 113 | ||
| 114 | 	p = atomic_load_ptr(&ipsec_accel_spddel_p); | |
| 115 | 	if (p != NULL) | |
| 116 | 		p(sp); | |
| 117 | } | |
| 118 | ||
| 119 | static inline int | |
| 120 | ipsec_accel_sa_lifetime_op(struct secasvar *sav, | |
| 121 | struct seclifetime *lft_c, if_t ifp, enum IF_SA_CNT_WHICH op, | |
| 122 | struct rm_priotracker *sahtree_trackerp) | |
| 123 | { | |
| 124 | 	int (*p)(struct secasvar *sav, struct seclifetime *lft_c, if_t ifp, | |
| 125 | 	 enum IF_SA_CNT_WHICH op, struct rm_priotracker *sahtree_trackerp); | |
| 126 | ||
| 127 | 	p = atomic_load_ptr(&ipsec_accel_sa_lifetime_op_p); | |
| 128 | 	if (p != NULL) | |
| 129 | 		return (p(sav, lft_c, ifp, op, sahtree_trackerp)); | |
| 130 | 	return (ENOTSUP); | |
| 131 | } | |
| 132 | ||
| 133 | static inline void | |
| 134 | ipsec_accel_sync(void) | |
| 135 | { | |
| 136 | 	void (*p)(void); | |
| 137 | ||
| 138 | 	p = atomic_load_ptr(&ipsec_accel_sync_p); | |
| 139 | 	if (p != NULL) | |
| 140 | 		p(); | |
| 141 | } | |
| 142 | ||
| 143 | static inline bool | |
| 144 | ipsec_accel_is_accel_sav(struct secasvar *sav) | |
| 145 | { | |
| 146 | 	bool (*p)(struct secasvar *sav); | |
| 147 | ||
| 148 | 	p = atomic_load_ptr(&ipsec_accel_is_accel_sav_p); | |
| 149 | 	if (p != NULL) | |
| 150 | 		return (p(sav)); | |
| 151 | 	return (false); | |
| 152 | } | |
| 153 | ||
| 154 | static inline struct mbuf * | |
| 155 | ipsec_accel_key_setaccelif(struct secasvar *sav) | |
| 156 | { | |
| 157 | 	struct mbuf *(*p)(struct secasvar *sav); | |
| 158 | ||
| 159 | 	p = atomic_load_ptr(&ipsec_accel_key_setaccelif_p); | |
| 160 | 	if (p != NULL) | |
| 161 | 		return (p(sav)); | |
| 162 | 	return (NULL); | |
| 163 | } | |
| 164 | ||
| 165 | static inline bool | |
| 166 | ipsec_accel_fill_xh(if_t ifp, uint32_t drv_spi, struct xform_history *xh) | |
| 167 | { | |
| 168 | 	bool (*p)(if_t ifp, uint32_t drv_spi, struct xform_history *xh); | |
| 169 | ||
| 170 | 	p = atomic_load_ptr(&ipsec_accel_fill_xh_p); | |
| 171 | 	if (p != NULL) | |
| 172 | 		return (p(ifp, drv_spi, xh)); | |
| 173 | 	return (false); | |
| 174 | } | |
| 175 | ||
| 176 | #else | |
| 177 | #define	ipsec_accel_sa_newkey(a) | |
| 178 | #define	ipsec_accel_forget_sav(a) | |
| 179 | #define	ipsec_accel_spdadd(a, b) | |
| 180 | #define	ipsec_accel_spddel(a) | |
| 181 | #define	ipsec_accel_sa_lifetime_op(a, b, c, d, e) | |
| 182 | #define	ipsec_accel_sync() | |
| 183 | #define	ipsec_accel_is_accel_sav(a) | |
| 184 | #define	ipsec_accel_key_setaccelif(a) | |
| 185 | #define	ipsec_accel_fill_xh(a, b, c)	(false) | |
| 186 | #endif | |
| 187 | ||
| 188 | void ipsec_accel_forget_sav_impl(struct secasvar *sav); | |
| 189 | void ipsec_accel_spdadd_impl(struct secpolicy *sp, struct inpcb *inp); | |
| 190 | void ipsec_accel_spddel_impl(struct secpolicy *sp); | |
| 191 | ||
| 192 | #ifdef IPSEC_OFFLOAD | |
| 193 | int ipsec_accel_input(struct mbuf *m, int offset, int proto); | |
| 194 | bool ipsec_accel_output(struct ifnet *ifp, struct mbuf *m, | |
| 195 | struct inpcb *inp, struct secpolicy *sp, struct secasvar *sav, int af, | |
| 196 | int mtu, int *hwassist); | |
| 197 | void ipsec_accel_forget_sav(struct secasvar *sav); | |
| 198 | struct xform_history; | |
| 199 | #else | |
| 200 | #define	ipsec_accel_input(a, b, c) (ENXIO) | |
| 201 | #define	ipsec_accel_output(a, b, c, d, e, f, g, h) ({	\ | |
| 202 | 	*h = 0;						\ | |
| 203 | 	false;						\ | |
| 204 | }) | |
| 205 | #define	ipsec_accel_forget_sav(a) | |
| 206 | #endif | |
| 207 | ||
| 208 | struct ipsec_accel_in_tag *ipsec_accel_input_tag_lookup(const struct mbuf *); | |
| 209 | void ipsec_accel_on_ifdown(struct ifnet *ifp); | |
| 210 | void ipsec_accel_drv_sa_lifetime_update(struct secasvar *sav, if_t ifp, | |
| 211 | u_int drv_spi, uint64_t octets, uint64_t allocs); | |
| 212 | int ipsec_accel_drv_sa_lifetime_fetch(struct secasvar *sav, | |
| 213 | if_t ifp, u_int drv_spi, uint64_t *octets, uint64_t *allocs); | |
| 214 | ||
| 215 | #endif	/* _KERNEL */ | |
| 216 | ||
| 217 | #endif	/* _NETIPSEC_IPSEC_OFFLOAD_H_ */ | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/netipsec/ipsec_support.h+20-14| ... | ... | @@ -29,6 +29,8 @@ |
| 29 | 29 | |
| 30 | 30 | #ifdef _KERNEL |
| 31 | 31 | #if defined(IPSEC) || defined(IPSEC_SUPPORT) |
| 32 | struct ifnet; | |
| 33 | struct ip; | |
| 32 | 34 | struct mbuf; |
| 33 | 35 | struct inpcb; |
| 34 | 36 | struct tcphdr; |
| ... | ... | @@ -49,14 +51,17 @@ int ipsec_init_pcbpolicy(struct inpcb *); |
| 49 | 51 | int ipsec_delete_pcbpolicy(struct inpcb *); |
| 50 | 52 | int ipsec_copy_pcbpolicy(struct inpcb *, struct inpcb *); |
| 51 | 53 | |
| 52 | #ifdef INET | |
| 54 | #if defined(INET) || defined(INET6) | |
| 53 | 55 | int udp_ipsec_input(struct mbuf *, int, int); |
| 54 | 56 | int udp_ipsec_pcbctl(struct inpcb *, struct sockopt *); |
| 57 | #endif | |
| 58 | #ifdef INET | |
| 55 | 59 | int ipsec4_in_reject(const struct mbuf *, struct inpcb *); |
| 60 | int ipsec4_in_reject1(const struct mbuf *m, struct ip *ip1, struct inpcb *inp); | |
| 56 | 61 | int ipsec4_input(struct mbuf *, int, int); |
| 57 | 62 | int ipsec4_forward(struct mbuf *); |
| 58 | 63 | int ipsec4_pcbctl(struct inpcb *, struct sockopt *); |
| 59 | int ipsec4_output(struct mbuf *, struct inpcb *); | |
| 64 | int ipsec4_output(struct ifnet *, struct mbuf *, struct inpcb *, u_long); | |
| 60 | 65 | int ipsec4_capability(struct mbuf *, u_int); |
| 61 | 66 | int ipsec4_ctlinput(ipsec_ctlinput_param_t); |
| 62 | 67 | #endif /* INET */ |
| ... | ... | @@ -66,7 +71,7 @@ int ipsec6_input(struct mbuf *, int, int); |
| 66 | 71 | int ipsec6_in_reject(const struct mbuf *, struct inpcb *); |
| 67 | 72 | int ipsec6_forward(struct mbuf *); |
| 68 | 73 | int ipsec6_pcbctl(struct inpcb *, struct sockopt *); |
| 69 | int ipsec6_output(struct mbuf *, struct inpcb *); | |
| 74 | int ipsec6_output(struct ifnet *, struct mbuf *, struct inpcb *, u_long); | |
| 70 | 75 | int ipsec6_capability(struct mbuf *, u_int); |
| 71 | 76 | int ipsec6_ctlinput(ipsec_ctlinput_param_t); |
| 72 | 77 | #endif /* INET6 */ |
| ... | ... | @@ -75,7 +80,8 @@ struct ipsec_methods { |
| 75 | 80 | 	int	(*input)(struct mbuf *, int, int); |
| 76 | 81 | 	int	(*check_policy)(const struct mbuf *, struct inpcb *); |
| 77 | 82 | 	int	(*forward)(struct mbuf *); |
| 78 | 	int	(*output)(struct mbuf *, struct inpcb *); | |
| 83 | 	int	(*output)(struct ifnet *, struct mbuf *, struct inpcb *, | |
| 84 | 		 u_long); | |
| 79 | 85 | 	int	(*pcbctl)(struct inpcb *, struct sockopt *); |
| 80 | 86 | 	size_t	(*hdrsize)(struct inpcb *); |
| 81 | 87 | 	int	(*capability)(struct mbuf *, u_int); |
| ... | ... | @@ -164,10 +170,10 @@ extern const struct ipsec_support * const ipv6_ipsec_support; |
| 164 | 170 | #define	IPSEC_CTLINPUT(proto, param)		\ |
| 165 | 171 | (*(proto ## _ipsec_support)->methods->ctlinput)(param) |
| 166 | 172 | |
| 167 | #define	UDPENCAP_INPUT(m, ...)			\ | |
| 168 | (*ipv4_ipsec_support->methods->udp_input)(m, __VA_ARGS__) | |
| 169 | #define	UDPENCAP_PCBCTL(inp, sopt)		\ | |
| 170 | (*ipv4_ipsec_support->methods->udp_pcbctl)(inp, sopt) | |
| 173 | #define	UDPENCAP_INPUT(proto, m, ...)			\ | |
| 174 | (*(proto ## _ipsec_support)->methods->udp_input)(m, __VA_ARGS__) | |
| 175 | #define	UDPENCAP_PCBCTL(proto, inp, sopt)		\ | |
| 176 | (*(proto ## _ipsec_support)->methods->udp_pcbctl)(inp, sopt) | |
| 171 | 177 | |
| 172 | 178 | #elif defined(IPSEC_SUPPORT) |
| 173 | 179 | struct ipsec_support { |
| ... | ... | @@ -185,8 +191,8 @@ int ipsec_kmod_input(struct ipsec_support * const, struct mbuf *, int, int); |
| 185 | 191 | int ipsec_kmod_check_policy(struct ipsec_support * const, struct mbuf *, |
| 186 | 192 | struct inpcb *); |
| 187 | 193 | int ipsec_kmod_forward(struct ipsec_support * const, struct mbuf *); |
| 188 | int ipsec_kmod_output(struct ipsec_support * const, struct mbuf *, | |
| 189 | struct inpcb *); | |
| 194 | int ipsec_kmod_output(struct ipsec_support * const, struct ifnet *, | |
| 195 | struct mbuf *, struct inpcb *, u_long); | |
| 190 | 196 | int ipsec_kmod_pcbctl(struct ipsec_support * const, struct inpcb *, |
| 191 | 197 | struct sockopt *); |
| 192 | 198 | int ipsec_kmod_capability(struct ipsec_support * const, struct mbuf *, u_int); |
| ... | ... | @@ -196,10 +202,10 @@ int ipsec_kmod_udp_input(struct ipsec_support * const, struct mbuf *, int, int); |
| 196 | 202 | int ipsec_kmod_udp_pcbctl(struct ipsec_support * const, struct inpcb *, |
| 197 | 203 | struct sockopt *); |
| 198 | 204 | |
| 199 | #define	UDPENCAP_INPUT(m, ...)		\ | |
| 200 | ipsec_kmod_udp_input(ipv4_ipsec_support, m, __VA_ARGS__) | |
| 201 | #define	UDPENCAP_PCBCTL(inp, sopt)	\ | |
| 202 | ipsec_kmod_udp_pcbctl(ipv4_ipsec_support, inp, sopt) | |
| 205 | #define	UDPENCAP_INPUT(proto, m, ...)		\ | |
| 206 | ipsec_kmod_udp_input(proto ## _ipsec_support, m, __VA_ARGS__) | |
| 207 | #define	UDPENCAP_PCBCTL(proto, inp, sopt)	\ | |
| 208 | ipsec_kmod_udp_pcbctl(proto ## _ipsec_support, inp, sopt) | |
| 203 | 209 | |
| 204 | 210 | #define	IPSEC_INPUT(proto, ...)		\ |
| 205 | 211 | ipsec_kmod_input(proto ## _ipsec_support, __VA_ARGS__) |
lib/libc/include/generic-freebsd/netipsec/key.h+7| ... | ... | @@ -36,6 +36,7 @@ |
| 36 | 36 | |
| 37 | 37 | #ifdef _KERNEL |
| 38 | 38 | |
| 39 | struct mbuf; | |
| 39 | 40 | struct secpolicy; |
| 40 | 41 | struct secpolicyindex; |
| 41 | 42 | struct secasvar; |
| ... | ... | @@ -49,6 +50,7 @@ struct xformsw; |
| 49 | 50 | |
| 50 | 51 | struct secpolicy *key_newsp(void); |
| 51 | 52 | struct secpolicy *key_allocsp(struct secpolicyindex *, u_int); |
| 53 | struct secpolicy *key_do_allocsp(struct secpolicyindex *spidx, u_int dir); | |
| 52 | 54 | struct secpolicy *key_msg2sp(struct sadb_x_policy *, size_t, int *); |
| 53 | 55 | int key_sp2msg(struct secpolicy *, void *, size_t *); |
| 54 | 56 | void key_addref(struct secpolicy *); |
| ... | ... | @@ -59,6 +61,7 @@ int key_havesp_any(void); |
| 59 | 61 | void key_bumpspgen(void); |
| 60 | 62 | uint32_t key_getspgen(void); |
| 61 | 63 | uint32_t key_newreqid(void); |
| 64 | struct mbuf *key_setaccelif(const char *ifname); | |
| 62 | 65 | |
| 63 | 66 | struct secasvar *key_allocsa(union sockaddr_union *, uint8_t, uint32_t); |
| 64 | 67 | struct secasvar *key_allocsa_tunnel(union sockaddr_union *, |
| ... | ... | @@ -84,6 +87,10 @@ extern void key_sa_recordxfer(struct secasvar *, struct mbuf *); |
| 84 | 87 | uint16_t key_portfromsaddr(struct sockaddr *); |
| 85 | 88 | void key_porttosaddr(struct sockaddr *, uint16_t port); |
| 86 | 89 | |
| 90 | struct rm_priotracker; | |
| 91 | void ipsec_sahtree_runlock(struct rm_priotracker *); | |
| 92 | void ipsec_sahtree_rlock(struct rm_priotracker *); | |
| 93 | ||
| 87 | 94 | #ifdef MALLOC_DECLARE |
| 88 | 95 | MALLOC_DECLARE(M_IPSEC_SA); |
| 89 | 96 | MALLOC_DECLARE(M_IPSEC_SAH); |
lib/libc/include/generic-freebsd/netipsec/keydb.h+14| ... | ... | @@ -36,9 +36,11 @@ |
| 36 | 36 | |
| 37 | 37 | #ifdef _KERNEL |
| 38 | 38 | #include <sys/counter.h> |
| 39 | #include <sys/ck.h> | |
| 39 | 40 | #include <sys/lock.h> |
| 40 | 41 | #include <sys/mutex.h> |
| 41 | 42 | #include <sys/rmlock.h> |
| 43 | #include <sys/_task.h> | |
| 42 | 44 | |
| 43 | 45 | #include <netipsec/key_var.h> |
| 44 | 46 | #include <opencrypto/_cryptodev.h> |
| ... | ... | @@ -125,6 +127,7 @@ struct xformsw; |
| 125 | 127 | struct enc_xform; |
| 126 | 128 | struct auth_hash; |
| 127 | 129 | struct comp_algo; |
| 130 | struct ifp_handle_sav; | |
| 128 | 131 | |
| 129 | 132 | /* |
| 130 | 133 | * Security Association |
| ... | ... | @@ -185,8 +188,19 @@ struct secasvar { |
| 185 | 188 | |
| 186 | 189 | 	uint64_t cntr;			/* counter for GCM and CTR */ |
| 187 | 190 | 	volatile u_int refcnt;		/* reference count */ |
| 191 | 	CK_LIST_HEAD(, ifp_handle_sav) accel_ifps; | |
| 192 | 	uintptr_t	accel_forget_tq; | |
| 193 | 	const char	*accel_ifname; | |
| 194 | 	uint32_t	accel_flags; | |
| 195 | 	counter_u64_t	accel_lft_sw; | |
| 196 | 	uint64_t	accel_hw_allocs; | |
| 197 | 	uint64_t	accel_hw_octets; | |
| 198 | 	uint64_t	accel_firstused; | |
| 188 | 199 | }; |
| 189 | 200 | |
| 201 | #define	SADB_KEY_ACCEL_INST	0x00000001 | |
| 202 | #define	SADB_KEY_ACCEL_DEINST	0x00000002 | |
| 203 | ||
| 190 | 204 | #define	SECASVAR_RLOCK_TRACKER		struct rm_priotracker _secas_tracker |
| 191 | 205 | #define	SECASVAR_RLOCK(_sav)		rm_rlock((_sav)->lock, &_secas_tracker) |
| 192 | 206 | #define	SECASVAR_RUNLOCK(_sav)		rm_runlock((_sav)->lock, &_secas_tracker) |
lib/libc/include/generic-freebsd/netlink/ktest_netlink_message_writer.h+3-17| ... | ... | @@ -30,28 +30,14 @@ |
| 30 | 30 | |
| 31 | 31 | #if defined(_KERNEL) && defined(INVARIANTS) |
| 32 | 32 | |
| 33 | bool nlmsg_get_buf_type_wrapper(struct nl_writer *nw, int size, int type, bool waitok); | |
| 34 | void nlmsg_set_callback_wrapper(struct nl_writer *nw); | |
| 35 | struct mbuf *nl_get_mbuf_chain_wrapper(int len, int malloc_flags); | |
| 33 | bool nlmsg_get_buf_wrapper(struct nl_writer *nw, size_t size, bool waitok); | |
| 36 | 34 | |
| 37 | 35 | #ifndef KTEST_CALLER |
| 38 | 36 | |
| 39 | 37 | bool |
| 40 | nlmsg_get_buf_type_wrapper(struct nl_writer *nw, int size, int type, bool waitok) | |
| 38 | nlmsg_get_buf_wrapper(struct nl_writer *nw, size_t size, bool waitok) | |
| 41 | 39 | { |
| 42 | 	return (nlmsg_get_buf_type(nw, size, type, waitok)); | |
| 43 | } | |
| 44 | ||
| 45 | void | |
| 46 | nlmsg_set_callback_wrapper(struct nl_writer *nw) | |
| 47 | { | |
| 48 | 	nlmsg_set_callback(nw); | |
| 49 | } | |
| 50 | ||
| 51 | struct mbuf * | |
| 52 | nl_get_mbuf_chain_wrapper(int len, int malloc_flags) | |
| 53 | { | |
| 54 | 	return (nl_get_mbuf_chain(len, malloc_flags)); | |
| 40 | 	return (nlmsg_get_buf(nw, size, waitok)); | |
| 55 | 41 | } |
| 56 | 42 | #endif |
| 57 | 43 |
lib/libc/include/generic-freebsd/netlink/netlink.h+11-15| ... | ... | @@ -61,7 +61,7 @@ |
| 61 | 61 | #ifndef _NETLINK_NETLINK_H_ |
| 62 | 62 | #define _NETLINK_NETLINK_H_ |
| 63 | 63 | |
| 64 | #include <sys/types.h> | |
| 64 | #include <sys/param.h> | |
| 65 | 65 | #include <sys/socket.h> |
| 66 | 66 | |
| 67 | 67 | struct sockaddr_nl { |
| ... | ... | @@ -194,11 +194,8 @@ enum nlmsginfo_attrs { |
| 194 | 194 | }; |
| 195 | 195 | |
| 196 | 196 | |
| 197 | #ifndef roundup2 | |
| 198 | #define	roundup2(x, y)	(((x)+((y)-1))&(~((y)-1))) /* if y is powers of two */ | |
| 199 | #endif | |
| 200 | 197 | #define	NL_ITEM_ALIGN_SIZE		sizeof(uint32_t) |
| 201 | #define	NL_ITEM_ALIGN(_len)		roundup2(_len, NL_ITEM_ALIGN_SIZE) | |
| 198 | #define	NL_ITEM_ALIGN(_len)		__align_up(_len, NL_ITEM_ALIGN_SIZE) | |
| 202 | 199 | #define	NL_ITEM_DATA(_ptr, _off)	((void *)((char *)(_ptr) + _off)) |
| 203 | 200 | #define	NL_ITEM_DATA_CONST(_ptr, _off)	((const void *)((const char *)(_ptr) + _off)) |
| 204 | 201 | |
| ... | ... | @@ -208,25 +205,24 @@ enum nlmsginfo_attrs { |
| 208 | 205 | #define	NL_ITEM_ITER(_ptr, _len, _LEN_MACRO)	\ |
| 209 | 206 | 	((_len) -= _LEN_MACRO(_ptr), NL_ITEM_NEXT(_ptr, _LEN_MACRO)) |
| 210 | 207 | |
| 208 | /* part of netlink(3) API */ | |
| 209 | #define	NLMSG_ALIGNTO			NL_ITEM_ALIGN_SIZE | |
| 210 | #define	NLMSG_ALIGN(_len)		NL_ITEM_ALIGN(_len) | |
| 211 | 211 | |
| 212 | 212 | #ifndef _KERNEL |
| 213 | 213 | /* part of netlink(3) API */ |
| 214 | #define NLMSG_ALIGNTO			NL_ITEM_ALIGN_SIZE | |
| 215 | #define NLMSG_ALIGN(_len)		NL_ITEM_ALIGN(_len) | |
| 216 | #define NLMSG_HDRLEN			((int)sizeof(struct nlmsghdr)) | |
| 217 | #define NLMSG_LENGTH(_len)		((_len) + NLMSG_HDRLEN) | |
| 218 | #define NLMSG_SPACE(_len)		NLMSG_ALIGN(NLMSG_LENGTH(_len)) | |
| 219 | #define NLMSG_DATA(_hdr)		NL_ITEM_DATA(_hdr, NLMSG_HDRLEN) | |
| 220 | #define	_NLMSG_LEN(_hdr)		((int)(_hdr)->nlmsg_len) | |
| 214 | #define	NLMSG_HDRLEN			(sizeof(struct nlmsghdr)) | |
| 215 | #define	NLMSG_LENGTH(_len)		((_len) + NLMSG_HDRLEN) | |
| 216 | #define	NLMSG_SPACE(_len)		NLMSG_ALIGN(NLMSG_LENGTH(_len)) | |
| 217 | #define	NLMSG_DATA(_hdr)		NL_ITEM_DATA(_hdr, NLMSG_HDRLEN) | |
| 218 | #define	_NLMSG_LEN(_hdr)		((_hdr)->nlmsg_len) | |
| 221 | 219 | #define	_NLMSG_ALIGNED_LEN(_hdr)	NLMSG_ALIGN(_NLMSG_LEN(_hdr)) |
| 222 | 220 | #define	NLMSG_OK(_hdr, _len)		NL_ITEM_OK(_hdr, _len, NLMSG_HDRLEN, _NLMSG_LEN) |
| 223 | 221 | #define NLMSG_PAYLOAD(_hdr,_len)	(_NLMSG_LEN(_hdr) - NLMSG_SPACE((_len))) |
| 224 | 222 | #define	NLMSG_NEXT(_hdr, _len)		NL_ITEM_ITER(_hdr, _len, _NLMSG_ALIGNED_LEN) |
| 225 | 223 | |
| 226 | 224 | #else |
| 227 | #define NLMSG_ALIGNTO 4U | |
| 228 | #define NLMSG_ALIGN(len) (((len) + NLMSG_ALIGNTO - 1) & ~(NLMSG_ALIGNTO - 1)) | |
| 229 | #define NLMSG_HDRLEN ((int)NLMSG_ALIGN(sizeof(struct nlmsghdr))) | |
| 225 | #define	NLMSG_HDRLEN			(NLMSG_ALIGN(sizeof(struct nlmsghdr))) | |
| 230 | 226 | #endif |
| 231 | 227 | |
| 232 | 228 | /* |
lib/libc/include/generic-freebsd/netlink/netlink_ctl.h+11-16| ... | ... | @@ -47,8 +47,8 @@ MALLOC_DECLARE(M_NETLINK); |
| 47 | 47 | |
| 48 | 48 | #define NLA_ALIGN_SIZE sizeof(uint32_t) |
| 49 | 49 | #define NLA_ALIGN(_len) _roundup2(_len, NLA_ALIGN_SIZE) |
| 50 | #define	NLA_HDRLEN		((int)sizeof(struct nlattr)) | |
| 51 | #define	NLA_DATA_LEN(_nla)	((int)((_nla)->nla_len - NLA_HDRLEN)) | |
| 50 | #define	NLA_HDRLEN		((uint16_t)sizeof(struct nlattr)) | |
| 51 | #define	NLA_DATA_LEN(_nla)	((_nla)->nla_len - NLA_HDRLEN) | |
| 52 | 52 | #define	NLA_DATA(_nla)		NL_ITEM_DATA(_nla, NLA_HDRLEN) |
| 53 | 53 | #define	NLA_DATA_CONST(_nla)	NL_ITEM_DATA_CONST(_nla, NLA_HDRLEN) |
| 54 | 54 | #define	NLA_TYPE(_nla)		((_nla)->nla_type & 0x3FFF) |
| ... | ... | @@ -65,8 +65,6 @@ MALLOC_DECLARE(M_NETLINK); |
| 65 | 65 | 		((char *)NLA_NEXT(_attr) <= (char *)_end);	\ |
| 66 | 66 | 		_attr = (_len -= NLA_ALIGN(_attr->nla_len), NLA_NEXT(_attr))) |
| 67 | 67 | |
| 68 | #define	NL_ARRAY_LEN(_a)	(sizeof(_a) / sizeof((_a)[0])) | |
| 69 | ||
| 70 | 68 | #include <netlink/netlink_message_writer.h> |
| 71 | 69 | #include <netlink/netlink_message_parser.h> |
| 72 | 70 | |
| ... | ... | @@ -79,7 +77,6 @@ bool netlink_register_proto(int proto, const char *proto_name, nl_handler_f hand |
| 79 | 77 | bool netlink_unregister_proto(int proto); |
| 80 | 78 | |
| 81 | 79 | /* Common helpers */ |
| 82 | bool nl_has_listeners(int netlink_family, uint32_t groups_mask); | |
| 83 | 80 | bool nlp_has_priv(struct nlpcb *nlp, int priv); |
| 84 | 81 | struct ucred *nlp_get_cred(struct nlpcb *nlp); |
| 85 | 82 | uint32_t nlp_get_pid(const struct nlpcb *nlp); |
| ... | ... | @@ -94,18 +91,16 @@ struct genl_cmd { |
| 94 | 91 | 	uint32_t	cmd_num; |
| 95 | 92 | }; |
| 96 | 93 | |
| 97 | uint32_t genl_register_family(const char *family_name, size_t hdrsize, | |
| 98 | int family_version, int max_attr_idx); | |
| 99 | bool genl_unregister_family(const char *family_name); | |
| 100 | bool genl_register_cmds(const char *family_name, const struct genl_cmd *cmds, | |
| 101 | int count); | |
| 102 | uint32_t genl_register_group(const char *family_name, const char *group_name); | |
| 103 | ||
| 104 | struct genl_family; | |
| 105 | const char *genl_get_family_name(const struct genl_family *gf); | |
| 106 | uint32_t genl_get_family_id(const struct genl_family *gf); | |
| 94 | uint16_t genl_register_family(const char *family_name, size_t hdrsize, | |
| 95 | uint16_t family_version, uint16_t max_attr_idx); | |
| 96 | void genl_unregister_family(uint16_t family); | |
| 97 | bool genl_register_cmds(uint16_t family, const struct genl_cmd *cmds, | |
| 98 | u_int count); | |
| 99 | uint32_t genl_register_group(uint16_t family, const char *group_name); | |
| 100 | void genl_unregister_group(uint16_t family, uint32_t group); | |
| 107 | 101 | |
| 108 | typedef void (*genl_family_event_handler_t)(void *arg, const struct genl_family *gf, int action); | |
| 102 | typedef void (*genl_family_event_handler_t)(void *arg, const char *family_name, | |
| 103 | uint16_t family_id, u_int action); | |
| 109 | 104 | EVENTHANDLER_DECLARE(genl_family_event, genl_family_event_handler_t); |
| 110 | 105 | |
| 111 | 106 | struct thread; |
lib/libc/include/generic-freebsd/netlink/netlink_linux.h+5-6| ... | ... | @@ -27,6 +27,7 @@ |
| 27 | 27 | |
| 28 | 28 | #ifndef _NETLINK_LINUX_VAR_H_ |
| 29 | 29 | #define _NETLINK_LINUX_VAR_H_ |
| 30 | #ifdef _KERNEL | |
| 30 | 31 | |
| 31 | 32 | /* |
| 32 | 33 | * The file contains headers for the bridge interface between |
| ... | ... | @@ -34,16 +35,13 @@ |
| 34 | 35 | */ |
| 35 | 36 | struct nlpcb; |
| 36 | 37 | struct nl_pstate; |
| 38 | struct nl_writer; | |
| 37 | 39 | |
| 38 | typedef struct mbuf *mbufs_to_linux_cb_t(int netlink_family, struct mbuf *m, | |
| 39 | struct nlpcb *nlp); | |
| 40 | typedef struct mbuf *msgs_to_linux_cb_t(int netlink_family, char *buf, int data_length, | |
| 41 | struct nlpcb *nlp); | |
| 42 | typedef struct nlmsghdr *msg_from_linux_cb_t(int netlink_family, struct nlmsghdr *hdr, | |
| 40 | typedef struct nl_buf * msgs_to_linux_cb_t(struct nl_buf *, struct nlpcb *); | |
| 41 | typedef int msg_from_linux_cb_t(int netlink_family, struct nlmsghdr **hdr, | |
| 43 | 42 | struct nl_pstate *npt); |
| 44 | 43 | |
| 45 | 44 | struct linux_netlink_provider { |
| 46 | 	mbufs_to_linux_cb_t	*mbufs_to_linux; | |
| 47 | 45 | 	msgs_to_linux_cb_t	*msgs_to_linux; |
| 48 | 46 | 	msg_from_linux_cb_t	*msg_from_linux; |
| 49 | 47 | |
| ... | ... | @@ -51,4 +49,5 @@ struct linux_netlink_provider { |
| 51 | 49 | |
| 52 | 50 | extern struct linux_netlink_provider *linux_netlink_p; |
| 53 | 51 | |
| 52 | #endif | |
| 54 | 53 | #endif |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/netlink/netlink_message_parser.h+80-56| ... | ... | @@ -64,15 +64,15 @@ lb_clear(struct linear_buffer *lb) |
| 64 | 64 | #define	NL_MAX_ERROR_BUF	128 |
| 65 | 65 | #define	SCRATCH_BUFFER_SIZE	(1024 + NL_MAX_ERROR_BUF) |
| 66 | 66 | struct nl_pstate { |
| 67 | struct linear_buffer lb;		/* Per-message scratch buffer */ | |
| 68 | struct nlpcb		*nlp;		/* Originator socket */ | |
| 69 | 	struct nl_writer	*nw;		/* Message writer to use */ | |
| 70 | 	struct nlmsghdr		*hdr;		/* Current parsed message header */ | |
| 71 | 	uint32_t		err_off;	/* error offset from hdr start */ | |
| 72 | int			error;		/* last operation error */ | |
| 73 | 	char			*err_msg;	/* Description of last error */ | |
| 74 | 	struct nlattr		*cookie;	/* NLA to return to the userspace */ | |
| 75 | 	bool			strict;		/* Strict parsing required */ | |
| 67 | 	struct linear_buffer	lb;	/* Per-message scratch buffer */ | |
| 68 | 	struct nlpcb		*nlp;	/* Originator socket */ | |
| 69 | 	struct nl_writer	*nw;	/* Message writer to use */ | |
| 70 | 	struct nlmsghdr		*hdr;	/* Current parsed message header */ | |
| 71 | 	uint32_t		err_off; /* error offset from hdr start */ | |
| 72 | 	int			error;	/* last operation error */ | |
| 73 | 	char			*err_msg; /* Description of last error */ | |
| 74 | 	struct nlattr		*cookie; /* NLA to return to the userspace */ | |
| 75 | 	bool			strict;	/* Strict parsing required */ | |
| 76 | 76 | }; |
| 77 | 77 | |
| 78 | 78 | static inline void * |
| ... | ... | @@ -80,10 +80,10 @@ npt_alloc(struct nl_pstate *npt, int len) |
| 80 | 80 | { |
| 81 | 81 | 	return (lb_alloc(&npt->lb, len)); |
| 82 | 82 | } |
| 83 | #define npt_alloc_sockaddr(_npt, _len) ((struct sockaddr *)(npt_alloc(_npt, _len))) | |
| 83 | #define npt_alloc_sockaddr(_npt, _len)	\ | |
| 84 | 	((struct sockaddr *)(npt_alloc((_npt), (_len)))) | |
| 84 | 85 | |
| 85 | typedef int parse_field_f(void *hdr, struct nl_pstate *npt, | |
| 86 | void *target); | |
| 86 | typedef int parse_field_f(void *hdr, struct nl_pstate *npt, void *target); | |
| 87 | 87 | struct nlfield_parser { |
| 88 | 88 | 	uint16_t	off_in; |
| 89 | 89 | 	uint16_t	off_out; |
| ... | ... | @@ -98,29 +98,28 @@ int nlf_get_u16(void *src, struct nl_pstate *npt, void *target); |
| 98 | 98 | int nlf_get_u32(void *src, struct nl_pstate *npt, void *target); |
| 99 | 99 | int nlf_get_u8_u32(void *src, struct nl_pstate *npt, void *target); |
| 100 | 100 | |
| 101 | ||
| 102 | 101 | struct nlattr_parser; |
| 103 | 102 | typedef int parse_attr_f(struct nlattr *attr, struct nl_pstate *npt, |
| 104 | 103 | const void *arg, void *target); |
| 105 | 104 | struct nlattr_parser { |
| 106 | 	uint16_t			type;	/* Attribute type */ | |
| 107 | 	uint16_t			off;	/* field offset in the target structure */ | |
| 108 | 	parse_attr_f			*cb;	/* parser function to call */ | |
| 109 | 	const void			*arg; | |
| 105 | 	uint16_t	type;	/* Attribute type */ | |
| 106 | 	uint16_t	off;	/* field offset in the target structure */ | |
| 107 | 	parse_attr_f	*cb;	/* parser function to call */ | |
| 108 | 	const void	*arg; | |
| 110 | 109 | }; |
| 111 | 110 | |
| 112 | 111 | typedef bool strict_parser_f(void *hdr, struct nl_pstate *npt); |
| 113 | 112 | typedef bool post_parser_f(void *parsed_attrs, struct nl_pstate *npt); |
| 114 | 113 | |
| 115 | 114 | struct nlhdr_parser { |
| 116 | 	int				nl_hdr_off; /* aligned netlink header size */ | |
| 117 | 	int				out_hdr_off; /* target header size */ | |
| 118 | 	int				fp_size; | |
| 119 | 	int				np_size; | |
| 115 | 	u_int			nl_hdr_off; /* aligned netlink header size */ | |
| 116 | 	u_int			out_hdr_off; /* target header size */ | |
| 117 | 	u_int			fp_size; | |
| 118 | 	u_int			np_size; | |
| 120 | 119 | 	const struct nlfield_parser	*fp; /* array of header field parsers */ |
| 121 | 120 | 	const struct nlattr_parser	*np; /* array of attribute parsers */ |
| 122 | 	strict_parser_f			*sp; /* Pre-parse strict validation function */ | |
| 123 | 	post_parser_f			*post_parse; | |
| 121 | 	strict_parser_f		*sp; /* Pre-parse strict validation function */ | |
| 122 | 	post_parser_f		*post_parse; | |
| 124 | 123 | }; |
| 125 | 124 | |
| 126 | 125 | #define	NL_DECLARE_PARSER_EXT(_name, _t, _sp, _fp, _np, _pp)	\ |
| ... | ... | @@ -128,8 +127,8 @@ static const struct nlhdr_parser _name = {			\ |
| 128 | 127 | 	.nl_hdr_off = sizeof(_t),				\ |
| 129 | 128 | 	.fp = &((_fp)[0]),					\ |
| 130 | 129 | 	.np = &((_np)[0]),					\ |
| 131 | 	.fp_size = NL_ARRAY_LEN(_fp),				\ | |
| 132 | 	.np_size = NL_ARRAY_LEN(_np),				\ | |
| 130 | 	.fp_size = nitems(_fp),					\ | |
| 131 | 	.np_size = nitems(_np),					\ | |
| 133 | 132 | 	.sp = _sp,						\ |
| 134 | 133 | 	.post_parse = _pp,					\ |
| 135 | 134 | } |
| ... | ... | @@ -146,29 +145,37 @@ static const struct nlhdr_parser _name = {		\ |
| 146 | 145 | 	.out_hdr_off = sizeof(_o),			\ |
| 147 | 146 | 	.fp = &((_fp)[0]),				\ |
| 148 | 147 | 	.np = &((_np)[0]),				\ |
| 149 | 	.fp_size = NL_ARRAY_LEN(_fp),			\ | |
| 150 | 	.np_size = NL_ARRAY_LEN(_np),			\ | |
| 148 | 	.fp_size = nitems(_fp),				\ | |
| 149 | 	.np_size = nitems(_np),				\ | |
| 151 | 150 | } |
| 152 | 151 | |
| 153 | #define	NL_DECLARE_ATTR_PARSER(_name, _np)		\ | |
| 152 | #define	NL_DECLARE_ATTR_PARSER_EXT(_name, _np, _pp)	\ | |
| 154 | 153 | static const struct nlhdr_parser _name = {		\ |
| 155 | 154 | 	.np = &((_np)[0]),				\ |
| 156 | 	.np_size = NL_ARRAY_LEN(_np),			\ | |
| 155 | 	.np_size = nitems(_np),				\ | |
| 156 | 	.post_parse = (_pp)				\ | |
| 157 | 157 | } |
| 158 | 158 | |
| 159 | #define	NL_DECLARE_ATTR_PARSER(_name, _np)		\ | |
| 160 | 	NL_DECLARE_ATTR_PARSER_EXT(_name, _np, NULL) | |
| 161 | ||
| 159 | 162 | #define	NL_ATTR_BMASK_SIZE	128 |
| 160 | 163 | BITSET_DEFINE(nlattr_bmask, NL_ATTR_BMASK_SIZE); |
| 161 | 164 | |
| 162 | void nl_get_attrs_bmask_raw(struct nlattr *nla_head, int len, struct nlattr_bmask *bm); | |
| 163 | bool nl_has_attr(const struct nlattr_bmask *bm, unsigned int nla_type); | |
| 165 | void nl_get_attrs_bmask_raw(struct nlattr *nla_head, uint32_t len, | |
| 166 | struct nlattr_bmask *bm); | |
| 167 | bool nl_has_attr(const struct nlattr_bmask *bm, uint16_t nla_type); | |
| 164 | 168 | |
| 165 | int nl_parse_attrs_raw(struct nlattr *nla_head, int len, const struct nlattr_parser *ps, | |
| 166 | int pslen, struct nl_pstate *npt, void *target); | |
| 169 | int nl_parse_attrs_raw(struct nlattr *nla_head, uint16_t len, | |
| 170 | const struct nlattr_parser *ps, u_int pslen, struct nl_pstate *npt, | |
| 171 | void *target); | |
| 167 | 172 | |
| 168 | 173 | int nlattr_get_flag(struct nlattr *nla, struct nl_pstate *npt, |
| 169 | 174 | const void *arg, void *target); |
| 170 | 175 | int nlattr_get_ip(struct nlattr *nla, struct nl_pstate *npt, |
| 171 | 176 | const void *arg, void *target); |
| 177 | int nlattr_get_bool(struct nlattr *nla, struct nl_pstate *npt, | |
| 178 | const void *arg, void *target); | |
| 172 | 179 | int nlattr_get_uint8(struct nlattr *nla, struct nl_pstate *npt, |
| 173 | 180 | const void *arg, void *target); |
| 174 | 181 | int nlattr_get_uint16(struct nlattr *nla, struct nl_pstate *npt, |
| ... | ... | @@ -187,16 +194,23 @@ int nlattr_get_ifpz(struct nlattr *nla, struct nl_pstate *npt, |
| 187 | 194 | const void *arg, void *target); |
| 188 | 195 | int nlattr_get_ipvia(struct nlattr *nla, struct nl_pstate *npt, |
| 189 | 196 | const void *arg, void *target); |
| 197 | int nlattr_get_chara(struct nlattr *nla, struct nl_pstate *npt, | |
| 198 | const void *arg, void *target); | |
| 190 | 199 | int nlattr_get_string(struct nlattr *nla, struct nl_pstate *npt, |
| 191 | 200 | const void *arg, void *target); |
| 192 | 201 | int nlattr_get_stringn(struct nlattr *nla, struct nl_pstate *npt, |
| 193 | 202 | const void *arg, void *target); |
| 203 | int nlattr_get_bytes(struct nlattr *nla, struct nl_pstate *npt, | |
| 204 | const void *arg, void *target); | |
| 194 | 205 | int nlattr_get_nla(struct nlattr *nla, struct nl_pstate *npt, |
| 195 | 206 | const void *arg, void *target); |
| 196 | 207 | int nlattr_get_nested(struct nlattr *nla, struct nl_pstate *npt, |
| 197 | 208 | const void *arg, void *target); |
| 209 | int nlattr_get_nested_ptr(struct nlattr *nla, struct nl_pstate *npt, | |
| 210 | const void *arg, void *target); | |
| 198 | 211 | |
| 199 | bool nlmsg_report_err_msg(struct nl_pstate *npt, const char *fmt, ...); | |
| 212 | bool nlmsg_report_err_msg(struct nl_pstate *npt, const char *fmt, ...) | |
| 213 | 	__printflike(2, 3); | |
| 200 | 214 | |
| 201 | 215 | #define	NLMSG_REPORT_ERR_MSG(_npt, _fmt, ...) {	\ |
| 202 | 216 | 	nlmsg_report_err_msg(_npt, _fmt, ## __VA_ARGS__); \ |
| ... | ... | @@ -213,20 +227,26 @@ void nlmsg_report_cookie_u32(struct nl_pstate *npt, uint32_t val); |
| 213 | 227 | * the list of direct function calls without iteration. |
| 214 | 228 | */ |
| 215 | 229 | static inline int |
| 216 | nl_parse_header(void *hdr, int len, const struct nlhdr_parser *parser, | |
| 230 | nl_parse_header(void *hdr, uint32_t len, const struct nlhdr_parser *parser, | |
| 217 | 231 | struct nl_pstate *npt, void *target) |
| 218 | 232 | { |
| 219 | 233 | 	int error; |
| 220 | 234 | |
| 221 | 235 | 	if (__predict_false(len < parser->nl_hdr_off)) { |
| 236 | 		void *tmp_hdr; | |
| 237 | ||
| 222 | 238 | 		if (npt->strict) { |
| 223 | 			nlmsg_report_err_msg(npt, "header too short: expected %d, got %d", | |
| 239 | 			nlmsg_report_err_msg(npt, | |
| 240 | 			 "header too short: expected %d, got %d", | |
| 224 | 241 | 			 parser->nl_hdr_off, len); |
| 225 | 242 | 			return (EINVAL); |
| 226 | 243 | 		} |
| 227 | 244 | |
| 228 | 		/* Compat with older applications: pretend there's a full header */ | |
| 229 | 		void *tmp_hdr = npt_alloc(npt, parser->nl_hdr_off); | |
| 245 | 		/* | |
| 246 | 		 * Compatibility with older applications: | |
| 247 | 		 * pretend there's a full header. | |
| 248 | 		 */ | |
| 249 | 		tmp_hdr = npt_alloc(npt, parser->nl_hdr_off); | |
| 230 | 250 | 		if (tmp_hdr == NULL) |
| 231 | 251 | 			return (EINVAL); |
| 232 | 252 | 		memcpy(tmp_hdr, hdr, len); |
| ... | ... | @@ -238,7 +258,7 @@ nl_parse_header(void *hdr, int len, const struct nlhdr_parser *parser, |
| 238 | 258 | 		return (EINVAL); |
| 239 | 259 | |
| 240 | 260 | 	/* Extract fields first */ |
| 241 | 	for (int i = 0; i < parser->fp_size; i++) { | |
| 261 | 	for (u_int i = 0; i < parser->fp_size; i++) { | |
| 242 | 262 | 		const struct nlfield_parser *fp = &parser->fp[i]; |
| 243 | 263 | 		void *src = (char *)hdr + fp->off_in; |
| 244 | 264 | 		void *dst = (char *)target + fp->off_out; |
| ... | ... | @@ -248,9 +268,9 @@ nl_parse_header(void *hdr, int len, const struct nlhdr_parser *parser, |
| 248 | 268 | 			return (error); |
| 249 | 269 | 	} |
| 250 | 270 | |
| 251 | 	struct nlattr *nla_head = (struct nlattr *)((char *)hdr + parser->nl_hdr_off); | |
| 252 | 	error = nl_parse_attrs_raw(nla_head, len - parser->nl_hdr_off, parser->np, | |
| 253 | 	 parser->np_size, npt, target); | |
| 271 | 	error = nl_parse_attrs_raw( | |
| 272 | 	 (struct nlattr *)((char *)hdr + parser->nl_hdr_off), | |
| 273 | 	 len - parser->nl_hdr_off, parser->np, parser->np_size, npt, target); | |
| 254 | 274 | |
| 255 | 275 | 	if (parser->post_parse != NULL && error == 0) { |
| 256 | 276 | 		if (!parser->post_parse(target, npt)) |
| ... | ... | @@ -264,10 +284,8 @@ static inline int |
| 264 | 284 | nl_parse_nested(struct nlattr *nla, const struct nlhdr_parser *parser, |
| 265 | 285 | struct nl_pstate *npt, void *target) |
| 266 | 286 | { |
| 267 | 	struct nlattr *nla_head = (struct nlattr *)NLA_DATA(nla); | |
| 268 | ||
| 269 | 	return (nl_parse_attrs_raw(nla_head, NLA_DATA_LEN(nla), parser->np, | |
| 270 | 	 parser->np_size, npt, target)); | |
| 287 | 	return (nl_parse_attrs_raw((struct nlattr *)NLA_DATA(nla), | |
| 288 | 	 NLA_DATA_LEN(nla), parser->np, parser->np_size, npt, target)); | |
| 271 | 289 | } |
| 272 | 290 | |
| 273 | 291 | /* |
| ... | ... | @@ -283,30 +301,36 @@ nl_verify_parsers(const struct nlhdr_parser **parser, int count) |
| 283 | 301 | 		for (int j = 0; j < p->np_size; j++) { |
| 284 | 302 | 			MPASS(p->np[j].type > attr_type); |
| 285 | 303 | 			attr_type = p->np[j].type; |
| 304 | ||
| 305 | 			/* Recurse into nested objects. */ | |
| 306 | 			if (p->np[j].cb == nlattr_get_nested || | |
| 307 | 			 p->np[j].cb == nlattr_get_nested_ptr) { | |
| 308 | 				const struct nlhdr_parser *np = | |
| 309 | 				 (const struct nlhdr_parser *)p->np[j].arg; | |
| 310 | 				nl_verify_parsers(&np, 1); | |
| 311 | 			} | |
| 286 | 312 | 		} |
| 287 | 313 | 	} |
| 288 | 314 | #endif |
| 289 | 315 | } |
| 290 | 316 | void nl_verify_parsers(const struct nlhdr_parser **parser, int count); |
| 291 | #define	NL_VERIFY_PARSERS(_p)	nl_verify_parsers((_p), NL_ARRAY_LEN(_p)) | |
| 317 | #define	NL_VERIFY_PARSERS(_p)	nl_verify_parsers((_p), nitems(_p)) | |
| 292 | 318 | |
| 293 | 319 | static inline int |
| 294 | 320 | nl_parse_nlmsg(struct nlmsghdr *hdr, const struct nlhdr_parser *parser, |
| 295 | 321 | struct nl_pstate *npt, void *target) |
| 296 | 322 | { |
| 297 | 	return (nl_parse_header(hdr + 1, hdr->nlmsg_len - sizeof(*hdr), parser, npt, target)); | |
| 323 | 	return (nl_parse_header(hdr + 1, hdr->nlmsg_len - sizeof(*hdr), parser, | |
| 324 | 	 npt, target)); | |
| 298 | 325 | } |
| 299 | 326 | |
| 300 | 327 | static inline void |
| 301 | nl_get_attrs_bmask_nlmsg(struct nlmsghdr *hdr, const struct nlhdr_parser *parser, | |
| 302 | struct nlattr_bmask *bm) | |
| 328 | nl_get_attrs_bmask_nlmsg(struct nlmsghdr *hdr, | |
| 329 | const struct nlhdr_parser *parser, struct nlattr_bmask *bm) | |
| 303 | 330 | { |
| 304 | 	struct nlattr *nla_head; | |
| 305 | ||
| 306 | 	nla_head = (struct nlattr *)((char *)(hdr + 1) + parser->nl_hdr_off); | |
| 307 | 	int len = hdr->nlmsg_len - sizeof(*hdr) - parser->nl_hdr_off; | |
| 308 | ||
| 309 | 	nl_get_attrs_bmask_raw(nla_head, len, bm); | |
| 331 | 	nl_get_attrs_bmask_raw( | |
| 332 | 	 (struct nlattr *)((char *)(hdr + 1) + parser->nl_hdr_off), | |
| 333 | 	 hdr->nlmsg_len - sizeof(*hdr) - parser->nl_hdr_off, bm); | |
| 310 | 334 | } |
| 311 | 335 | |
| 312 | 336 | #endif |
lib/libc/include/generic-freebsd/netlink/netlink_message_writer.h+59-115| ... | ... | @@ -37,62 +37,45 @@ |
| 37 | 37 | * It is not meant to be included directly |
| 38 | 38 | */ |
| 39 | 39 | |
| 40 | struct mbuf; | |
| 40 | struct nl_buf; | |
| 41 | 41 | struct nl_writer; |
| 42 | typedef bool nl_writer_cb(struct nl_writer *nw, void *buf, int buflen, int cnt); | |
| 42 | typedef bool nl_writer_cb(struct nl_writer *nw); | |
| 43 | 43 | |
| 44 | 44 | struct nl_writer { |
| 45 | 	int			alloc_len;	/* allocated buffer length */ | |
| 46 | 	int			offset;		/* offset from the start of the buffer */ | |
| 47 | 	struct nlmsghdr		*hdr;		/* Pointer to the currently-filled msg */ | |
| 48 | 	char			*data;		/* pointer to the contiguous storage */ | |
| 49 | 	void			*_storage;	/* Underlying storage pointer */ | |
| 50 | 	nl_writer_cb		*cb;		/* Callback to flush data */ | |
| 45 | 	struct nl_buf		*buf;	/* Underlying storage pointer */ | |
| 46 | 	struct nlmsghdr		*hdr;	/* Pointer to the currently-filled msg */ | |
| 47 | 	nl_writer_cb		*cb;	/* Callback to flush data */ | |
| 51 | 48 | 	union { |
| 52 | 		void		*ptr; | |
| 49 | 		struct nlpcb	*nlp; | |
| 53 | 50 | 		struct { |
| 54 | 51 | 			uint16_t	proto; |
| 55 | 52 | 			uint16_t	id; |
| 53 | 			int		priv; | |
| 56 | 54 | 		} group; |
| 57 | 	} arg; | |
| 58 | 	int			num_messages;	/* Number of messages in the buffer */ | |
| 59 | 	int			malloc_flag;	/* M_WAITOK or M_NOWAIT */ | |
| 60 | 	uint8_t			writer_type;	/* NS_WRITER_TYPE_* */ | |
| 61 | 	uint8_t			writer_target;	/* NS_WRITER_TARGET_* */ | |
| 62 | 	bool			ignore_limit;	/* If true, ignores RCVBUF limit */ | |
| 63 | 	bool			enomem;		/* True if ENOMEM occured */ | |
| 64 | 	bool			suppress_ack;	/* If true, don't send NLMSG_ERR */ | |
| 55 | 	}; | |
| 56 | 	u_int		num_messages;	/* Number of messages in the buffer */ | |
| 57 | 	int		malloc_flag;	/* M_WAITOK or M_NOWAIT */ | |
| 58 | 	bool		ignore_limit;	/* If true, ignores RCVBUF limit */ | |
| 59 | 	bool		enomem;		/* True if ENOMEM occured */ | |
| 60 | 	bool		suppress_ack;	/* If true, don't send NLMSG_ERR */ | |
| 65 | 61 | }; |
| 66 | #define	NS_WRITER_TARGET_SOCKET	0 | |
| 67 | #define	NS_WRITER_TARGET_GROUP	1 | |
| 68 | #define	NS_WRITER_TARGET_CHAIN	2 | |
| 69 | ||
| 70 | #define	NS_WRITER_TYPE_MBUF	0 | |
| 71 | #define NS_WRITER_TYPE_BUF	1 | |
| 72 | #define NS_WRITER_TYPE_LBUF	2 | |
| 73 | #define NS_WRITER_TYPE_MBUFC	3 | |
| 74 | #define NS_WRITER_TYPE_STUB	4 | |
| 75 | ||
| 76 | 62 | |
| 77 | 63 | #define	NLMSG_SMALL	128 |
| 78 | 64 | #define	NLMSG_LARGE	2048 |
| 79 | 65 | |
| 80 | 66 | /* Message and attribute writing */ |
| 81 | ||
| 82 | struct nlpcb; | |
| 83 | ||
| 84 | 67 | #if defined(NETLINK) || defined(NETLINK_MODULE) |
| 85 | 68 | /* Provide optimized calls to the functions inside the same linking unit */ |
| 86 | 69 | |
| 87 | bool _nlmsg_get_unicast_writer(struct nl_writer *nw, int expected_size, struct nlpcb *nlp); | |
| 88 | bool _nlmsg_get_group_writer(struct nl_writer *nw, int expected_size, int proto, int group_id); | |
| 89 | bool _nlmsg_get_chain_writer(struct nl_writer *nw, int expected_size, struct mbuf **pm); | |
| 70 | bool _nl_writer_unicast(struct nl_writer *, size_t, struct nlpcb *nlp, bool); | |
| 71 | bool _nl_writer_group(struct nl_writer *, size_t, uint16_t, uint16_t, int, | |
| 72 | bool); | |
| 90 | 73 | bool _nlmsg_flush(struct nl_writer *nw); |
| 91 | 74 | void _nlmsg_ignore_limit(struct nl_writer *nw); |
| 92 | 75 | |
| 93 | bool _nlmsg_refill_buffer(struct nl_writer *nw, int required_size); | |
| 94 | bool _nlmsg_add(struct nl_writer *nw, uint32_t portid, uint32_t seq, uint16_t type, | |
| 95 | uint16_t flags, uint32_t len); | |
| 76 | bool _nlmsg_refill_buffer(struct nl_writer *nw, size_t required_len); | |
| 77 | bool _nlmsg_add(struct nl_writer *nw, uint32_t portid, uint32_t seq, | |
| 78 | uint16_t type, uint16_t flags, uint32_t len); | |
| 96 | 79 | bool _nlmsg_end(struct nl_writer *nw); |
| 97 | 80 | void _nlmsg_abort(struct nl_writer *nw); |
| 98 | 81 | |
| ... | ... | @@ -100,21 +83,17 @@ bool _nlmsg_end_dump(struct nl_writer *nw, int error, struct nlmsghdr *hdr); |
| 100 | 83 | |
| 101 | 84 | |
| 102 | 85 | static inline bool |
| 103 | nlmsg_get_unicast_writer(struct nl_writer *nw, int expected_size, struct nlpcb *nlp) | |
| 104 | { | |
| 105 | 	return (_nlmsg_get_unicast_writer(nw, expected_size, nlp)); | |
| 106 | } | |
| 107 | ||
| 108 | static inline bool | |
| 109 | nlmsg_get_group_writer(struct nl_writer *nw, int expected_size, int proto, int group_id) | |
| 86 | nl_writer_unicast(struct nl_writer *nw, size_t size, struct nlpcb *nlp, | |
| 87 | bool waitok) | |
| 110 | 88 | { |
| 111 | 	return (_nlmsg_get_group_writer(nw, expected_size, proto, group_id)); | |
| 89 | 	return (_nl_writer_unicast(nw, size, nlp, waitok)); | |
| 112 | 90 | } |
| 113 | 91 | |
| 114 | 92 | static inline bool |
| 115 | nlmsg_get_chain_writer(struct nl_writer *nw, int expected_size, struct mbuf **pm) | |
| 93 | nl_writer_group(struct nl_writer *nw, size_t size, uint16_t proto, | |
| 94 | uint16_t group_id, int priv, bool waitok) | |
| 116 | 95 | { |
| 117 | 	return (_nlmsg_get_chain_writer(nw, expected_size, pm)); | |
| 96 | 	return (_nl_writer_group(nw, size, proto, group_id, priv, waitok)); | |
| 118 | 97 | } |
| 119 | 98 | |
| 120 | 99 | static inline bool |
| ... | ... | @@ -130,7 +109,7 @@ nlmsg_ignore_limit(struct nl_writer *nw) |
| 130 | 109 | } |
| 131 | 110 | |
| 132 | 111 | static inline bool |
| 133 | nlmsg_refill_buffer(struct nl_writer *nw, int required_size) | |
| 112 | nlmsg_refill_buffer(struct nl_writer *nw, size_t required_size) | |
| 134 | 113 | { |
| 135 | 114 | 	return (_nlmsg_refill_buffer(nw, required_size)); |
| 136 | 115 | } |
| ... | ... | @@ -163,15 +142,15 @@ nlmsg_end_dump(struct nl_writer *nw, int error, struct nlmsghdr *hdr) |
| 163 | 142 | #else |
| 164 | 143 | /* Provide access to the functions via netlink_glue.c */ |
| 165 | 144 | |
| 166 | bool nlmsg_get_unicast_writer(struct nl_writer *nw, int expected_size, struct nlpcb *nlp); | |
| 167 | bool nlmsg_get_group_writer(struct nl_writer *nw, int expected_size, int proto, int group_id); | |
| 168 | bool nlmsg_get_chain_writer(struct nl_writer *nw, int expected_size, struct mbuf **pm); | |
| 145 | bool nl_writer_unicast(struct nl_writer *, size_t, struct nlpcb *, bool waitok); | |
| 146 | bool nl_writer_group(struct nl_writer *, size_t, uint16_t, uint16_t, int, | |
| 147 | bool waitok); | |
| 169 | 148 | bool nlmsg_flush(struct nl_writer *nw); |
| 170 | 149 | void nlmsg_ignore_limit(struct nl_writer *nw); |
| 171 | 150 | |
| 172 | bool nlmsg_refill_buffer(struct nl_writer *nw, int required_size); | |
| 173 | bool nlmsg_add(struct nl_writer *nw, uint32_t portid, uint32_t seq, uint16_t type, | |
| 174 | uint16_t flags, uint32_t len); | |
| 151 | bool nlmsg_refill_buffer(struct nl_writer *nw, size_t required_size); | |
| 152 | bool nlmsg_add(struct nl_writer *nw, uint32_t portid, uint32_t seq, | |
| 153 | uint16_t type, uint16_t flags, uint32_t len); | |
| 175 | 154 | bool nlmsg_end(struct nl_writer *nw); |
| 176 | 155 | void nlmsg_abort(struct nl_writer *nw); |
| 177 | 156 | |
| ... | ... | @@ -186,18 +165,12 @@ nlmsg_reply(struct nl_writer *nw, const struct nlmsghdr *hdr, int payload_len) |
| 186 | 165 | 	 hdr->nlmsg_flags, payload_len)); |
| 187 | 166 | } |
| 188 | 167 | |
| 189 | #define nlmsg_data(_hdr)	((void *)((_hdr) + 1)) | |
| 190 | ||
| 191 | 168 | /* |
| 192 | 169 | * KPI similar to mtodo(): |
| 193 | 170 | * current (uncompleted) header is guaranteed to be contiguous, |
| 194 | 171 | * but can be reallocated, thus pointers may need to be readjusted. |
| 195 | 172 | */ |
| 196 | static inline int | |
| 197 | nlattr_save_offset(const struct nl_writer *nw) | |
| 198 | { | |
| 199 | 	return (nw->offset - ((char *)nw->hdr - nw->data)); | |
| 200 | } | |
| 173 | u_int nlattr_save_offset(const struct nl_writer *nw); | |
| 201 | 174 | |
| 202 | 175 | static inline void * |
| 203 | 176 | _nlattr_restore_offset(const struct nl_writer *nw, int off) |
| ... | ... | @@ -213,22 +186,7 @@ nlattr_set_len(const struct nl_writer *nw, int off) |
| 213 | 186 | 	nla->nla_len = nlattr_save_offset(nw) - off; |
| 214 | 187 | } |
| 215 | 188 | |
| 216 | static inline void * | |
| 217 | nlmsg_reserve_data_raw(struct nl_writer *nw, size_t sz) | |
| 218 | { | |
| 219 | 	sz = NETLINK_ALIGN(sz); | |
| 220 | ||
| 221 | 	if (__predict_false(nw->offset + sz > nw->alloc_len)) { | |
| 222 | 		if (!nlmsg_refill_buffer(nw, sz)) | |
| 223 | 			return (NULL); | |
| 224 | 	} | |
| 225 | ||
| 226 | 	void *data_ptr = &nw->data[nw->offset]; | |
| 227 | 	nw->offset += sz; | |
| 228 | 	bzero(data_ptr, sz); | |
| 229 | ||
| 230 | 	return (data_ptr); | |
| 231 | } | |
| 189 | void *nlmsg_reserve_data_raw(struct nl_writer *nw, size_t sz); | |
| 232 | 190 | #define nlmsg_reserve_object(_ns, _t)	((_t *)nlmsg_reserve_data_raw(_ns, sizeof(_t))) |
| 233 | 191 | #define nlmsg_reserve_data(_ns, _sz, _t)	((_t *)nlmsg_reserve_data_raw(_ns, _sz)) |
| 234 | 192 | |
| ... | ... | @@ -258,109 +216,95 @@ _nlmsg_reserve_attr(struct nl_writer *nw, uint16_t nla_type, uint16_t sz) |
| 258 | 216 | } |
| 259 | 217 | #define	nlmsg_reserve_attr(_ns, _at, _t)	((_t *)_nlmsg_reserve_attr(_ns, _at, NLA_ALIGN(sizeof(_t)))) |
| 260 | 218 | |
| 261 | static inline bool | |
| 262 | nlattr_add(struct nl_writer *nw, int attr_type, int attr_len, const void *data) | |
| 263 | { | |
| 264 | 	int required_len = NLA_ALIGN(attr_len + sizeof(struct nlattr)); | |
| 265 | ||
| 266 | 	if (__predict_false(nw->offset + required_len > nw->alloc_len)) { | |
| 267 | 		if (!nlmsg_refill_buffer(nw, required_len)) | |
| 268 | 			return (false); | |
| 269 | 	} | |
| 270 | ||
| 271 | 	struct nlattr *nla = (struct nlattr *)(&nw->data[nw->offset]); | |
| 272 | ||
| 273 | 	nla->nla_len = attr_len + sizeof(struct nlattr); | |
| 274 | 	nla->nla_type = attr_type; | |
| 275 | 	if (attr_len > 0) { | |
| 276 | 		if ((attr_len % 4) != 0) { | |
| 277 | 			/* clear padding bytes */ | |
| 278 | 			bzero((char *)nla + required_len - 4, 4); | |
| 279 | 		} | |
| 280 | 		memcpy((nla + 1), data, attr_len); | |
| 281 | 	} | |
| 282 | 	nw->offset += required_len; | |
| 283 | 	return (true); | |
| 284 | } | |
| 219 | bool nlattr_add(struct nl_writer *nw, uint16_t attr_type, uint16_t attr_len, | |
| 220 | const void *data); | |
| 285 | 221 | |
| 286 | 222 | static inline bool |
| 287 | 223 | nlattr_add_raw(struct nl_writer *nw, const struct nlattr *nla_src) |
| 288 | 224 | { |
| 289 | 	int attr_len = nla_src->nla_len - sizeof(struct nlattr); | |
| 225 | 	MPASS(nla_src->nla_len >= sizeof(struct nlattr)); | |
| 290 | 226 | |
| 291 | 	MPASS(attr_len >= 0); | |
| 227 | 	return (nlattr_add(nw, nla_src->nla_type, | |
| 228 | 	 nla_src->nla_len - sizeof(struct nlattr), | |
| 229 | 	 (const void *)(nla_src + 1))); | |
| 230 | } | |
| 292 | 231 | |
| 293 | 	return (nlattr_add(nw, nla_src->nla_type, attr_len, (const void *)(nla_src + 1))); | |
| 232 | static inline bool | |
| 233 | nlattr_add_bool(struct nl_writer *nw, uint16_t attrtype, bool value) | |
| 234 | { | |
| 235 | 	return (nlattr_add(nw, attrtype, sizeof(bool), &value)); | |
| 294 | 236 | } |
| 295 | 237 | |
| 296 | 238 | static inline bool |
| 297 | nlattr_add_u8(struct nl_writer *nw, int attrtype, uint8_t value) | |
| 239 | nlattr_add_u8(struct nl_writer *nw, uint16_t attrtype, uint8_t value) | |
| 298 | 240 | { |
| 299 | 241 | 	return (nlattr_add(nw, attrtype, sizeof(uint8_t), &value)); |
| 300 | 242 | } |
| 301 | 243 | |
| 302 | 244 | static inline bool |
| 303 | nlattr_add_u16(struct nl_writer *nw, int attrtype, uint16_t value) | |
| 245 | nlattr_add_u16(struct nl_writer *nw, uint16_t attrtype, uint16_t value) | |
| 304 | 246 | { |
| 305 | 247 | 	return (nlattr_add(nw, attrtype, sizeof(uint16_t), &value)); |
| 306 | 248 | } |
| 307 | 249 | |
| 308 | 250 | static inline bool |
| 309 | nlattr_add_u32(struct nl_writer *nw, int attrtype, uint32_t value) | |
| 251 | nlattr_add_u32(struct nl_writer *nw, uint16_t attrtype, uint32_t value) | |
| 310 | 252 | { |
| 311 | 253 | 	return (nlattr_add(nw, attrtype, sizeof(uint32_t), &value)); |
| 312 | 254 | } |
| 313 | 255 | |
| 314 | 256 | static inline bool |
| 315 | nlattr_add_u64(struct nl_writer *nw, int attrtype, uint64_t value) | |
| 257 | nlattr_add_u64(struct nl_writer *nw, uint16_t attrtype, uint64_t value) | |
| 316 | 258 | { |
| 317 | 259 | 	return (nlattr_add(nw, attrtype, sizeof(uint64_t), &value)); |
| 318 | 260 | } |
| 319 | 261 | |
| 320 | 262 | static inline bool |
| 321 | nlattr_add_s8(struct nl_writer *nw, int attrtype, int8_t value) | |
| 263 | nlattr_add_s8(struct nl_writer *nw, uint16_t attrtype, int8_t value) | |
| 322 | 264 | { |
| 323 | 265 | 	return (nlattr_add(nw, attrtype, sizeof(int8_t), &value)); |
| 324 | 266 | } |
| 325 | 267 | |
| 326 | 268 | static inline bool |
| 327 | nlattr_add_s16(struct nl_writer *nw, int attrtype, int16_t value) | |
| 269 | nlattr_add_s16(struct nl_writer *nw, uint16_t attrtype, int16_t value) | |
| 328 | 270 | { |
| 329 | 271 | 	return (nlattr_add(nw, attrtype, sizeof(int16_t), &value)); |
| 330 | 272 | } |
| 331 | 273 | |
| 332 | 274 | static inline bool |
| 333 | nlattr_add_s32(struct nl_writer *nw, int attrtype, int32_t value) | |
| 275 | nlattr_add_s32(struct nl_writer *nw, uint16_t attrtype, int32_t value) | |
| 334 | 276 | { |
| 335 | 277 | 	return (nlattr_add(nw, attrtype, sizeof(int32_t), &value)); |
| 336 | 278 | } |
| 337 | 279 | |
| 338 | 280 | static inline bool |
| 339 | nlattr_add_s64(struct nl_writer *nw, int attrtype, int64_t value) | |
| 281 | nlattr_add_s64(struct nl_writer *nw, uint16_t attrtype, int64_t value) | |
| 340 | 282 | { |
| 341 | 283 | 	return (nlattr_add(nw, attrtype, sizeof(int64_t), &value)); |
| 342 | 284 | } |
| 343 | 285 | |
| 344 | 286 | static inline bool |
| 345 | nlattr_add_flag(struct nl_writer *nw, int attrtype) | |
| 287 | nlattr_add_flag(struct nl_writer *nw, uint16_t attrtype) | |
| 346 | 288 | { |
| 347 | 289 | 	return (nlattr_add(nw, attrtype, 0, NULL)); |
| 348 | 290 | } |
| 349 | 291 | |
| 350 | 292 | static inline bool |
| 351 | nlattr_add_string(struct nl_writer *nw, int attrtype, const char *str) | |
| 293 | nlattr_add_string(struct nl_writer *nw, uint16_t attrtype, const char *str) | |
| 352 | 294 | { |
| 353 | 295 | 	return (nlattr_add(nw, attrtype, strlen(str) + 1, str)); |
| 354 | 296 | } |
| 355 | 297 | |
| 356 | 298 | static inline bool |
| 357 | nlattr_add_in_addr(struct nl_writer *nw, int attrtype, const struct in_addr *in) | |
| 299 | nlattr_add_in_addr(struct nl_writer *nw, uint16_t attrtype, | |
| 300 | const struct in_addr *in) | |
| 358 | 301 | { |
| 359 | 302 | 	return (nlattr_add(nw, attrtype, sizeof(*in), in)); |
| 360 | 303 | } |
| 361 | 304 | |
| 362 | 305 | static inline bool |
| 363 | nlattr_add_in6_addr(struct nl_writer *nw, int attrtype, const struct in6_addr *in6) | |
| 306 | nlattr_add_in6_addr(struct nl_writer *nw, uint16_t attrtype, | |
| 307 | const struct in6_addr *in6) | |
| 364 | 308 | { |
| 365 | 309 | 	return (nlattr_add(nw, attrtype, sizeof(*in6), in6)); |
| 366 | 310 | } |
lib/libc/include/generic-freebsd/netlink/netlink_snl.h+70-31| ... | ... | @@ -31,6 +31,12 @@ |
| 31 | 31 | * Simple Netlink Library |
| 32 | 32 | */ |
| 33 | 33 | |
| 34 | #include <sys/param.h> | |
| 35 | #include <sys/socket.h> | |
| 36 | ||
| 37 | #include <netlink/netlink.h> | |
| 38 | #include <netlink/netlink_bitset.h> | |
| 39 | ||
| 34 | 40 | #include <assert.h> |
| 35 | 41 | #include <errno.h> |
| 36 | 42 | #include <stdalign.h> |
| ... | ... | @@ -41,11 +47,6 @@ |
| 41 | 47 | #include <string.h> |
| 42 | 48 | #include <unistd.h> |
| 43 | 49 | |
| 44 | #include <sys/types.h> | |
| 45 | #include <sys/socket.h> | |
| 46 | #include <netlink/netlink.h> | |
| 47 | #include <netlink/netlink_bitset.h> | |
| 48 | ||
| 49 | 50 | #define _roundup2(x, y) (((x)+((y)-1))&(~((y)-1))) |
| 50 | 51 | |
| 51 | 52 | #define NETLINK_ALIGN_SIZE sizeof(uint32_t) |
| ... | ... | @@ -68,8 +69,6 @@ |
| 68 | 69 | 		((char *)NLA_NEXT(_attr) <= _NLA_END(_start, _len));	\ |
| 69 | 70 | 		_attr = NLA_NEXT(_attr)) |
| 70 | 71 | |
| 71 | #define	NL_ARRAY_LEN(_a)	(sizeof(_a) / sizeof((_a)[0])) | |
| 72 | ||
| 73 | 72 | struct linear_buffer { |
| 74 | 73 | 	char			*base;	/* Base allocated memory pointer */ |
| 75 | 74 | 	uint32_t		offset;	/* Currently used offset */ |
| ... | ... | @@ -133,6 +132,7 @@ struct snl_field_parser { |
| 133 | 132 | 	uint16_t		off_out; |
| 134 | 133 | 	snl_parse_field_f	*cb; |
| 135 | 134 | }; |
| 135 | static const struct snl_field_parser snl_f_p_empty[] = {}; | |
| 136 | 136 | |
| 137 | 137 | typedef bool snl_parse_attr_f(struct snl_state *ss, struct nlattr *attr, |
| 138 | 138 | const void *arg, void *target); |
| ... | ... | @@ -166,8 +166,8 @@ static const struct snl_hdr_parser _name = {				\ |
| 166 | 166 | 	.out_size = _sz_out,						\ |
| 167 | 167 | 	.fp = &((_fp)[0]),						\ |
| 168 | 168 | 	.np = &((_np)[0]),						\ |
| 169 | 	.fp_size = NL_ARRAY_LEN(_fp),					\ | |
| 170 | 	.np_size = NL_ARRAY_LEN(_np),					\ | |
| 169 | 	.fp_size = nitems(_fp),						\ | |
| 170 | 	.np_size = nitems(_np),						\ | |
| 171 | 171 | 	.cb_post = _cb,							\ |
| 172 | 172 | } |
| 173 | 173 | |
| ... | ... | @@ -179,7 +179,7 @@ static const struct snl_hdr_parser _name = {				\ |
| 179 | 179 | 	.in_hdr_size = _sz_h_in,					\ |
| 180 | 180 | 	.out_size = _sz_out,						\ |
| 181 | 181 | 	.fp = &((_fp)[0]),						\ |
| 182 | 	.fp_size = NL_ARRAY_LEN(_fp),					\ | |
| 182 | 	.fp_size = nitems(_fp),						\ | |
| 183 | 183 | 	.cb_post = _cb,							\ |
| 184 | 184 | } |
| 185 | 185 | |
| ... | ... | @@ -190,7 +190,7 @@ static const struct snl_hdr_parser _name = {				\ |
| 190 | 190 | static const struct snl_hdr_parser _name = {				\ |
| 191 | 191 | 	.out_size = _sz_out,						\ |
| 192 | 192 | 	.np = &((_np)[0]),						\ |
| 193 | 	.np_size = NL_ARRAY_LEN(_np),					\ | |
| 193 | 	.np_size = nitems(_np),						\ | |
| 194 | 194 | 	.cb_post = _cb,							\ |
| 195 | 195 | } |
| 196 | 196 | |
| ... | ... | @@ -240,14 +240,13 @@ snl_clear_lb(struct snl_state *ss) |
| 240 | 240 | static void |
| 241 | 241 | snl_free(struct snl_state *ss) |
| 242 | 242 | { |
| 243 | 	if (ss->init_done) { | |
| 243 | 	if (ss->init_done) | |
| 244 | 244 | 		close(ss->fd); |
| 245 | 		if (ss->buf != NULL) | |
| 246 | 			free(ss->buf); | |
| 247 | 		if (ss->lb != NULL) { | |
| 248 | 			snl_clear_lb(ss); | |
| 249 | 			lb_free(ss->lb); | |
| 250 | 		} | |
| 245 | 	if (ss->buf != NULL) | |
| 246 | 		free(ss->buf); | |
| 247 | 	if (ss->lb != NULL) { | |
| 248 | 		snl_clear_lb(ss); | |
| 249 | 		lb_free(ss->lb); | |
| 251 | 250 | 	} |
| 252 | 251 | } |
| 253 | 252 | |
| ... | ... | @@ -290,6 +289,16 @@ snl_init(struct snl_state *ss, int netlink_family) |
| 290 | 289 | 	return (true); |
| 291 | 290 | } |
| 292 | 291 | |
| 292 | static inline bool | |
| 293 | snl_clone(struct snl_state *ss, const struct snl_state *orig) | |
| 294 | { | |
| 295 | 	*ss = (struct snl_state){ | |
| 296 | 		.fd = orig->fd, | |
| 297 | 		.init_done = false, | |
| 298 | 	}; | |
| 299 | 	return ((ss->lb = lb_init(SCRATCH_BUFFER_SIZE)) != NULL); | |
| 300 | } | |
| 301 | ||
| 293 | 302 | static inline bool |
| 294 | 303 | snl_send(struct snl_state *ss, void *data, int sz) |
| 295 | 304 | { |
| ... | ... | @@ -418,7 +427,7 @@ snl_verify_parsers(const struct snl_hdr_parser **parser, int count) |
| 418 | 427 | 		} |
| 419 | 428 | 	} |
| 420 | 429 | } |
| 421 | #define	SNL_VERIFY_PARSERS(_p)	snl_verify_parsers((_p), NL_ARRAY_LEN(_p)) | |
| 430 | #define	SNL_VERIFY_PARSERS(_p)	snl_verify_parsers((_p), nitems(_p)) | |
| 422 | 431 | |
| 423 | 432 | static const struct snl_attr_parser * |
| 424 | 433 | find_parser(const struct snl_attr_parser *ps, int pslen, int key) |
| ... | ... | @@ -526,6 +535,29 @@ snl_attr_get_flag(struct snl_state *ss __unused, struct nlattr *nla, const void |
| 526 | 535 | 	return (false); |
| 527 | 536 | } |
| 528 | 537 | |
| 538 | static inline bool | |
| 539 | snl_attr_get_bytes(struct snl_state *ss __unused, struct nlattr *nla, const void *arg, | |
| 540 | void *target) | |
| 541 | { | |
| 542 | 	if ((size_t)NLA_DATA_LEN(nla) != (size_t)arg) | |
| 543 | 		return (false); | |
| 544 | ||
| 545 | 	memcpy(target, NLA_DATA_CONST(nla), (size_t)arg); | |
| 546 | ||
| 547 | 	return (true); | |
| 548 | } | |
| 549 | ||
| 550 | static inline bool | |
| 551 | snl_attr_get_bool(struct snl_state *ss __unused, struct nlattr *nla, | |
| 552 | const void *arg __unused, void *target) | |
| 553 | { | |
| 554 | 	if (NLA_DATA_LEN(nla) == sizeof(bool)) { | |
| 555 | 		*((bool *)target) = *((const bool *)NLA_DATA_CONST(nla)); | |
| 556 | 		return (true); | |
| 557 | 	} | |
| 558 | 	return (false); | |
| 559 | } | |
| 560 | ||
| 529 | 561 | static inline bool |
| 530 | 562 | snl_attr_get_uint8(struct snl_state *ss __unused, struct nlattr *nla, |
| 531 | 563 | const void *arg __unused, void *target) |
| ... | ... | @@ -1086,20 +1118,22 @@ snl_reserve_msg_data_raw(struct snl_writer *nw, size_t sz) |
| 1086 | 1118 | #define snl_reserve_msg_object(_ns, _t)	((_t *)snl_reserve_msg_data_raw(_ns, sizeof(_t))) |
| 1087 | 1119 | #define snl_reserve_msg_data(_ns, _sz, _t)	((_t *)snl_reserve_msg_data_raw(_ns, _sz)) |
| 1088 | 1120 | |
| 1089 | static inline void * | |
| 1090 | _snl_reserve_msg_attr(struct snl_writer *nw, uint16_t nla_type, uint16_t sz) | |
| 1121 | static inline struct nlattr * | |
| 1122 | snl_reserve_msg_attr_raw(struct snl_writer *nw, uint16_t nla_type, uint16_t sz) | |
| 1091 | 1123 | { |
| 1092 | 	sz += sizeof(struct nlattr); | |
| 1124 | 	struct nlattr *nla; | |
| 1093 | 1125 | |
| 1094 | 	struct nlattr *nla = snl_reserve_msg_data(nw, sz, struct nlattr); | |
| 1126 | 	sz += sizeof(struct nlattr); | |
| 1127 | 	nla = snl_reserve_msg_data(nw, sz, struct nlattr); | |
| 1095 | 1128 | 	if (__predict_false(nla == NULL)) |
| 1096 | 1129 | 		return (NULL); |
| 1097 | 1130 | 	nla->nla_type = nla_type; |
| 1098 | 1131 | 	nla->nla_len = sz; |
| 1099 | 1132 | |
| 1100 | 	return ((void *)(nla + 1)); | |
| 1133 | 	return (nla); | |
| 1101 | 1134 | } |
| 1102 | #define	snl_reserve_msg_attr(_ns, _at, _t)	((_t *)_snl_reserve_msg_attr(_ns, _at, sizeof(_t))) | |
| 1135 | #define	snl_reserve_msg_attr(_ns, _at, _t)	\ | |
| 1136 | 	((_t *)(snl_reserve_msg_attr_raw(_ns, _at, sizeof(_t)) + 1)) | |
| 1103 | 1137 | |
| 1104 | 1138 | static inline bool |
| 1105 | 1139 | snl_add_msg_attr(struct snl_writer *nw, int attr_type, int attr_len, const void *data) |
| ... | ... | @@ -1136,6 +1170,12 @@ snl_add_msg_attr_raw(struct snl_writer *nw, const struct nlattr *nla_src) |
| 1136 | 1170 | 	return (snl_add_msg_attr(nw, nla_src->nla_type, attr_len, (const void *)(nla_src + 1))); |
| 1137 | 1171 | } |
| 1138 | 1172 | |
| 1173 | static inline bool | |
| 1174 | snl_add_msg_attr_bool(struct snl_writer *nw, int attrtype, bool value) | |
| 1175 | { | |
| 1176 | 	return (snl_add_msg_attr(nw, attrtype, sizeof(bool), &value)); | |
| 1177 | } | |
| 1178 | ||
| 1139 | 1179 | static inline bool |
| 1140 | 1180 | snl_add_msg_attr_u8(struct snl_writer *nw, int attrtype, uint8_t value) |
| 1141 | 1181 | { |
| ... | ... | @@ -1233,9 +1273,13 @@ snl_end_attr_nested(const struct snl_writer *nw, int off) |
| 1233 | 1273 | static inline struct nlmsghdr * |
| 1234 | 1274 | snl_create_msg_request(struct snl_writer *nw, int nlmsg_type) |
| 1235 | 1275 | { |
| 1276 | 	struct nlmsghdr *hdr; | |
| 1277 | ||
| 1236 | 1278 | 	assert(nw->hdr == NULL); |
| 1237 | 1279 | |
| 1238 | 	struct nlmsghdr *hdr = snl_reserve_msg_object(nw, struct nlmsghdr); | |
| 1280 | 	if (__predict_false((hdr = | |
| 1281 | 	 snl_reserve_msg_object(nw, struct nlmsghdr)) == NULL)) | |
| 1282 | 		return (NULL); | |
| 1239 | 1283 | 	hdr->nlmsg_type = nlmsg_type; |
| 1240 | 1284 | 	hdr->nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK; |
| 1241 | 1285 | 	nw->hdr = hdr; |
| ... | ... | @@ -1283,9 +1327,4 @@ snl_send_msgs(struct snl_writer *nw) |
| 1283 | 1327 | 	return (snl_send(nw->ss, nw->base, offset)); |
| 1284 | 1328 | } |
| 1285 | 1329 | |
| 1286 | static const struct snl_hdr_parser *snl_all_core_parsers[] = { | |
| 1287 | 	&snl_errmsg_parser, &snl_donemsg_parser, | |
| 1288 | 	&_nla_bit_parser, &_nla_bitset_parser, | |
| 1289 | }; | |
| 1290 | ||
| 1291 | 1330 | #endif |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/netlink/netlink_snl_generic.h+64-23| ... | ... | @@ -33,16 +33,24 @@ |
| 33 | 33 | |
| 34 | 34 | /* Genetlink helpers */ |
| 35 | 35 | static inline struct nlmsghdr * |
| 36 | snl_create_genl_msg_request(struct snl_writer *nw, int genl_family, uint8_t genl_cmd) | |
| 36 | snl_create_genl_msg_request(struct snl_writer *nw, uint16_t genl_family, | |
| 37 | uint8_t genl_cmd) | |
| 37 | 38 | { |
| 39 | 	struct nlmsghdr *hdr; | |
| 40 | 	struct genlmsghdr *ghdr; | |
| 41 | ||
| 38 | 42 | 	assert(nw->hdr == NULL); |
| 39 | 43 | |
| 40 | 	struct nlmsghdr *hdr = snl_reserve_msg_object(nw, struct nlmsghdr); | |
| 44 | 	hdr = snl_reserve_msg_object(nw, struct nlmsghdr); | |
| 45 | 	if (__predict_false(hdr == NULL)) | |
| 46 | 		return (NULL); | |
| 41 | 47 | 	hdr->nlmsg_type = genl_family; |
| 42 | 48 | 	hdr->nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK; |
| 43 | 	nw->hdr = hdr; | |
| 44 | 	struct genlmsghdr *ghdr = snl_reserve_msg_object(nw, struct genlmsghdr); | |
| 49 | 	ghdr = snl_reserve_msg_object(nw, struct genlmsghdr); | |
| 50 | 	if (__predict_false(ghdr == NULL)) | |
| 51 | 		return (NULL); | |
| 45 | 52 | 	ghdr->cmd = genl_cmd; |
| 53 | 	nw->hdr = hdr; | |
| 46 | 54 | |
| 47 | 55 | 	return (hdr); |
| 48 | 56 | } |
| ... | ... | @@ -52,37 +60,52 @@ static struct snl_field_parser snl_fp_genl[] = {}; |
| 52 | 60 | #define	SNL_DECLARE_GENL_PARSER(_name, _np)	SNL_DECLARE_PARSER(_name,\ |
| 53 | 61 | struct genlmsghdr, snl_fp_genl, _np) |
| 54 | 62 | |
| 55 | struct snl_genl_ctrl_mcast_group { | |
| 63 | struct _snl_genl_ctrl_mcast_group { | |
| 56 | 64 | 	uint32_t mcast_grp_id; |
| 57 | 	char *mcast_grp_name; | |
| 65 | 	const char *mcast_grp_name; | |
| 58 | 66 | }; |
| 59 | 67 | |
| 60 | struct snl_genl_ctrl_mcast_groups { | |
| 68 | struct _snl_genl_ctrl_mcast_groups { | |
| 61 | 69 | 	uint32_t num_groups; |
| 62 | 	struct snl_genl_ctrl_mcast_group **groups; | |
| 70 | 	struct _snl_genl_ctrl_mcast_group **groups; | |
| 63 | 71 | }; |
| 64 | 72 | |
| 65 | #define	_OUT(_field)	offsetof(struct snl_genl_ctrl_mcast_group, _field) | |
| 73 | #define	_OUT(_field)	offsetof(struct _snl_genl_ctrl_mcast_group, _field) | |
| 66 | 74 | static struct snl_attr_parser _nla_p_getmc[] = { |
| 67 | 	{ .type = CTRL_ATTR_MCAST_GRP_NAME, .off = _OUT(mcast_grp_name), .cb = snl_attr_get_string }, | |
| 68 | 	{ .type = CTRL_ATTR_MCAST_GRP_ID, .off = _OUT(mcast_grp_id), .cb = snl_attr_get_uint32 }, | |
| 75 | 	{ | |
| 76 | 		.type = CTRL_ATTR_MCAST_GRP_NAME, | |
| 77 | 		.off = _OUT(mcast_grp_name), | |
| 78 | 		.cb = snl_attr_get_string, | |
| 79 | 	}, | |
| 80 | 	{ | |
| 81 | 		.type = CTRL_ATTR_MCAST_GRP_ID, | |
| 82 | 		.off = _OUT(mcast_grp_id), | |
| 83 | 		.cb = snl_attr_get_uint32, | |
| 84 | 	}, | |
| 69 | 85 | }; |
| 70 | 86 | #undef _OUT |
| 71 | 87 | SNL_DECLARE_ATTR_PARSER_EXT(_genl_ctrl_mc_parser, |
| 72 | 		sizeof(struct snl_genl_ctrl_mcast_group), | |
| 73 | 		_nla_p_getmc, NULL); | |
| 88 | sizeof(struct _snl_genl_ctrl_mcast_group), _nla_p_getmc, NULL); | |
| 74 | 89 | |
| 75 | 90 | struct _getfamily_attrs { |
| 76 | 91 | 	uint16_t family_id; |
| 77 | 	char	*family_name; | |
| 78 | 	struct snl_genl_ctrl_mcast_groups mcast_groups; | |
| 92 | 	const char *family_name; | |
| 93 | 	struct _snl_genl_ctrl_mcast_groups mcast_groups; | |
| 79 | 94 | }; |
| 80 | 95 | |
| 81 | 96 | #define	_IN(_field)	offsetof(struct genlmsghdr, _field) |
| 82 | 97 | #define	_OUT(_field)	offsetof(struct _getfamily_attrs, _field) |
| 83 | 98 | static struct snl_attr_parser _nla_p_getfam[] = { |
| 84 | 	{ .type = CTRL_ATTR_FAMILY_ID , .off = _OUT(family_id), .cb = snl_attr_get_uint16 }, | |
| 85 | 	{ .type = CTRL_ATTR_FAMILY_NAME, .off = _OUT(family_name), .cb = snl_attr_get_string }, | |
| 99 | 	{ | |
| 100 | 		.type = CTRL_ATTR_FAMILY_ID, | |
| 101 | 		.off = _OUT(family_id), | |
| 102 | 		.cb = snl_attr_get_uint16, | |
| 103 | 	}, | |
| 104 | 	{ | |
| 105 | 		.type = CTRL_ATTR_FAMILY_NAME, | |
| 106 | 		.off = _OUT(family_name), | |
| 107 | 		.cb = snl_attr_get_string, | |
| 108 | 	}, | |
| 86 | 109 | 	{ |
| 87 | 110 | 		.type = CTRL_ATTR_MCAST_GROUPS, |
| 88 | 111 | 		.off = _OUT(mcast_groups), |
| ... | ... | @@ -95,7 +118,7 @@ static struct snl_attr_parser _nla_p_getfam[] = { |
| 95 | 118 | SNL_DECLARE_GENL_PARSER(_genl_ctrl_getfam_parser, _nla_p_getfam); |
| 96 | 119 | |
| 97 | 120 | static bool |
| 98 | snl_get_genl_family_info(struct snl_state *ss, const char *family_name, | |
| 121 | _snl_get_genl_family_info(struct snl_state *ss, const char *family_name, | |
| 99 | 122 | struct _getfamily_attrs *attrs) |
| 100 | 123 | { |
| 101 | 124 | 	struct snl_writer nw; |
| ... | ... | @@ -104,7 +127,7 @@ snl_get_genl_family_info(struct snl_state *ss, const char *family_name, |
| 104 | 127 | 	memset(attrs, 0, sizeof(*attrs)); |
| 105 | 128 | |
| 106 | 129 | 	snl_init_writer(ss, &nw); |
| 107 | 	hdr = snl_create_genl_msg_request(&nw, GENL_ID_CTRL, CTRL_CMD_GETFAMILY); | |
| 130 | 	snl_create_genl_msg_request(&nw, GENL_ID_CTRL, CTRL_CMD_GETFAMILY); | |
| 108 | 131 | 	snl_add_msg_attr_string(&nw, CTRL_ATTR_FAMILY_NAME, family_name); |
| 109 | 132 | 	if ((hdr = snl_finalize_msg(&nw)) == NULL || !snl_send_message(ss, hdr)) |
| 110 | 133 | 		return (false); |
| ... | ... | @@ -123,12 +146,30 @@ snl_get_genl_family(struct snl_state *ss, const char *family_name) |
| 123 | 146 | { |
| 124 | 147 | 	struct _getfamily_attrs attrs = {}; |
| 125 | 148 | |
| 126 | 	snl_get_genl_family_info(ss, family_name, &attrs); | |
| 149 | 	if (__predict_false(!_snl_get_genl_family_info(ss, family_name, | |
| 150 | 	 &attrs))) | |
| 151 | 		return (0); | |
| 127 | 152 | 	return (attrs.family_id); |
| 128 | 153 | } |
| 129 | 154 | |
| 130 | static const struct snl_hdr_parser *snl_all_genl_parsers[] = { | |
| 131 | 	&_genl_ctrl_getfam_parser, &_genl_ctrl_mc_parser, | |
| 132 | }; | |
| 155 | static inline uint16_t | |
| 156 | snl_get_genl_mcast_group(struct snl_state *ss, const char *family_name, | |
| 157 | const char *group_name, uint16_t *family_id) | |
| 158 | { | |
| 159 | 	struct _getfamily_attrs attrs = {}; | |
| 160 | ||
| 161 | 	if (__predict_false(!_snl_get_genl_family_info(ss, family_name, | |
| 162 | 	 &attrs))) | |
| 163 | 		return (0); | |
| 164 | 	if (attrs.family_id == 0) | |
| 165 | 		return (0); | |
| 166 | 	if (family_id != NULL) | |
| 167 | 		*family_id = attrs.family_id; | |
| 168 | 	for (u_int i = 0; i < attrs.mcast_groups.num_groups; i++) | |
| 169 | 		if (strcmp(attrs.mcast_groups.groups[i]->mcast_grp_name, | |
| 170 | group_name) == 0) | |
| 171 | 			return (attrs.mcast_groups.groups[i]->mcast_grp_id); | |
| 172 | 	return (0); | |
| 173 | } | |
| 133 | 174 | |
| 134 | 175 | #endif |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/netlink/netlink_snl_route_parsers.h-7| ... | ... | @@ -389,11 +389,4 @@ _cb_p_nh(struct snl_state *ss __unused, void *_target) |
| 389 | 389 | SNL_DECLARE_PARSER_EXT(snl_nhmsg_parser, sizeof(struct nhmsg), |
| 390 | 390 | 		sizeof(struct snl_parsed_nhop), _fp_p_nh, _nla_p_nh, _cb_p_nh); |
| 391 | 391 | |
| 392 | static const struct snl_hdr_parser *snl_all_route_parsers[] = { | |
| 393 | 	&_metrics_mp_nh_parser, &_mpath_nh_parser, &_metrics_parser, &snl_rtm_route_parser, | |
| 394 | 	&_link_fbsd_parser, &snl_rtm_link_parser, &snl_rtm_link_parser_simple, | |
| 395 | 	&_neigh_fbsd_parser, &snl_rtm_neigh_parser, | |
| 396 | 	&_addr_fbsd_parser, &snl_rtm_addr_parser, &_nh_fbsd_parser, &snl_nhmsg_parser, | |
| 397 | }; | |
| 398 | ||
| 399 | 392 | #endif |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/netlink/netlink_var.h+23-58| ... | ... | @@ -43,33 +43,32 @@ |
| 43 | 43 | |
| 44 | 44 | struct ucred; |
| 45 | 45 | |
| 46 | struct nl_io_queue { | |
| 47 | 	STAILQ_HEAD(, mbuf)	head; | |
| 48 | 	int			length; | |
| 49 | 	int			hiwat; | |
| 46 | struct nl_buf { | |
| 47 | 	TAILQ_ENTRY(nl_buf)	tailq; | |
| 48 | 	u_int			buflen; | |
| 49 | 	u_int			datalen; | |
| 50 | 	u_int			offset; | |
| 51 | 	char			data[]; | |
| 50 | 52 | }; |
| 51 | 53 | |
| 52 | 54 | #define	NLP_MAX_GROUPS		128 |
| 53 | 55 | |
| 56 | BITSET_DEFINE(nl_groups, NLP_MAX_GROUPS); | |
| 54 | 57 | struct nlpcb { |
| 55 | 58 | struct socket *nl_socket; |
| 56 | 	uint64_t	 nl_groups[NLP_MAX_GROUPS / 64]; | |
| 59 | 	struct nl_groups	nl_groups; | |
| 57 | 60 | 	uint32_t nl_port; |
| 58 | 61 | 	uint32_t	 nl_flags; |
| 59 | 62 | 	uint32_t	 nl_process_id; |
| 60 | 63 | int nl_proto; |
| 61 | bool			nl_active; | |
| 62 | 64 | 	bool			nl_bound; |
| 63 | 65 | bool			nl_task_pending; |
| 64 | 66 | 	bool			nl_tx_blocked; /* No new requests accepted */ |
| 65 | 67 | 	bool			nl_linux; /* true if running under compat */ |
| 66 | 68 | 	bool			nl_unconstrained_vnet; /* true if running under VNET jail (or without jail) */ |
| 67 | 69 | 	bool			nl_need_thread_setup; |
| 68 | 	struct nl_io_queue	rx_queue; | |
| 69 | 	struct nl_io_queue	tx_queue; | |
| 70 | 70 | 	struct taskqueue	*nl_taskqueue; |
| 71 | 71 | 	struct task		nl_task; |
| 72 | 	struct ucred		*nl_cred; /* Copy of nl_socket->so_cred */ | |
| 73 | 72 | 	uint64_t		nl_dropped_bytes; |
| 74 | 73 | 	uint64_t		nl_dropped_messages; |
| 75 | 74 | CK_LIST_ENTRY(nlpcb) nl_next; |
| ... | ... | @@ -96,31 +95,19 @@ struct nlpcb { |
| 96 | 95 | SYSCTL_DECL(_net_netlink); |
| 97 | 96 | SYSCTL_DECL(_net_netlink_debug); |
| 98 | 97 | |
| 99 | struct nl_io { | |
| 100 | 	struct callout				callout; | |
| 101 | 	struct mbuf				*head; | |
| 102 | 	struct mbuf 				*last; | |
| 103 | 	int64_t					length; | |
| 104 | }; | |
| 105 | ||
| 106 | 98 | struct nl_control { |
| 107 | 99 | 	CK_LIST_HEAD(nl_pid_head, nlpcb)	ctl_port_head; |
| 108 | 100 | 	CK_LIST_HEAD(nlpcb_head, nlpcb)		ctl_pcb_head; |
| 109 | 101 | 	CK_LIST_ENTRY(nl_control)		ctl_next; |
| 110 | 	struct nl_io				ctl_io; | |
| 111 | 102 | 	struct rmlock				ctl_lock; |
| 112 | 103 | }; |
| 113 | VNET_DECLARE(struct nl_control *, nl_ctl); | |
| 104 | VNET_DECLARE(struct nl_control, nl_ctl); | |
| 114 | 105 | #define	V_nl_ctl	VNET(nl_ctl) |
| 115 | 106 | |
| 116 | ||
| 117 | 107 | struct sockaddr_nl; |
| 118 | 108 | struct sockaddr; |
| 119 | 109 | struct nlmsghdr; |
| 120 | 110 | |
| 121 | /* netlink_module.c */ | |
| 122 | struct nl_control *vnet_nl_ctl_init(void); | |
| 123 | ||
| 124 | 111 | int nl_verify_proto(int proto); |
| 125 | 112 | const char *nl_get_proto_name(int proto); |
| 126 | 113 | |
| ... | ... | @@ -133,57 +120,34 @@ struct nl_proto_handler { |
| 133 | 120 | extern struct nl_proto_handler *nl_handlers; |
| 134 | 121 | |
| 135 | 122 | /* netlink_domain.c */ |
| 136 | void nl_send_group(struct mbuf *m, int cnt, int proto, int group_id); | |
| 123 | bool nl_send_group(struct nl_writer *); | |
| 124 | void nl_clear_group(u_int); | |
| 137 | 125 | void nl_osd_register(void); |
| 138 | 126 | void nl_osd_unregister(void); |
| 139 | 127 | void nl_set_thread_nlp(struct thread *td, struct nlpcb *nlp); |
| 140 | 128 | |
| 141 | 129 | /* netlink_io.c */ |
| 142 | #define	NL_IOF_UNTRANSLATED	0x01 | |
| 143 | #define	NL_IOF_IGNORE_LIMIT	0x02 | |
| 144 | bool nl_send_one(struct mbuf *m, struct nlpcb *nlp, int cnt, int io_flags); | |
| 130 | bool nl_send(struct nl_writer *, struct nlpcb *); | |
| 145 | 131 | void nlmsg_ack(struct nlpcb *nlp, int error, struct nlmsghdr *nlmsg, |
| 146 | 132 | struct nl_pstate *npt); |
| 147 | 133 | void nl_on_transmit(struct nlpcb *nlp); |
| 148 | void nl_init_io(struct nlpcb *nlp); | |
| 149 | void nl_free_io(struct nlpcb *nlp); | |
| 150 | 134 | |
| 151 | 135 | void nl_taskqueue_handler(void *_arg, int pending); |
| 152 | int nl_receive_async(struct mbuf *m, struct socket *so); | |
| 136 | void nl_schedule_taskqueue(struct nlpcb *nlp); | |
| 153 | 137 | void nl_process_receive_locked(struct nlpcb *nlp); |
| 154 | 138 | void nl_set_source_metadata(struct mbuf *m, int num_messages); |
| 155 | void nl_add_msg_info(struct mbuf *m); | |
| 156 | ||
| 157 | /* netlink_message_writer.c */ | |
| 158 | void nl_init_msg_zone(void); | |
| 159 | void nl_destroy_msg_zone(void); | |
| 160 | ||
| 161 | /* netlink_generic.c */ | |
| 162 | struct genl_family { | |
| 163 | 	const char	*family_name; | |
| 164 | 	uint16_t	family_hdrsize; | |
| 165 | 	uint16_t	family_id; | |
| 166 | 	uint16_t	family_version; | |
| 167 | 	uint16_t	family_attr_max; | |
| 168 | 	uint16_t	family_cmd_size; | |
| 169 | 	uint16_t	family_num_groups; | |
| 170 | 	struct genl_cmd	*family_cmds; | |
| 171 | }; | |
| 172 | ||
| 173 | struct genl_group { | |
| 174 | 	struct genl_family	*group_family; | |
| 175 | 	const char		*group_name; | |
| 176 | }; | |
| 177 | ||
| 178 | struct genl_family *genl_get_family(uint32_t family_id); | |
| 179 | struct genl_group *genl_get_group(uint32_t group_id); | |
| 139 | struct nl_buf *nl_buf_alloc(size_t len, int mflag); | |
| 140 | void nl_buf_free(struct nl_buf *nb); | |
| 180 | 141 | |
| 181 | 142 | #define	MAX_FAMILIES	20 |
| 182 | 143 | #define	MAX_GROUPS	64 |
| 183 | 144 | |
| 184 | 145 | #define	MIN_GROUP_NUM	48 |
| 185 | 146 | |
| 147 | #define	CTRL_FAMILY_ID		0 | |
| 186 | 148 | #define	CTRL_FAMILY_NAME	"nlctrl" |
| 149 | #define	CTRL_GROUP_ID		0 | |
| 150 | #define	CTRL_GROUP_NAME		"notify" | |
| 187 | 151 | |
| 188 | 152 | struct ifnet; |
| 189 | 153 | struct nl_parsed_link; |
| ... | ... | @@ -194,14 +158,15 @@ struct nl_pstate; |
| 194 | 158 | struct nl_function_wrapper { |
| 195 | 159 | 	bool (*nlmsg_add)(struct nl_writer *nw, uint32_t portid, uint32_t seq, uint16_t type, |
| 196 | 160 | 	 uint16_t flags, uint32_t len); |
| 197 | 	bool (*nlmsg_refill_buffer)(struct nl_writer *nw, int required_len); | |
| 161 | 	bool (*nlmsg_refill_buffer)(struct nl_writer *nw, size_t required_len); | |
| 198 | 162 | 	bool (*nlmsg_flush)(struct nl_writer *nw); |
| 199 | 163 | 	bool (*nlmsg_end)(struct nl_writer *nw); |
| 200 | 164 | 	void (*nlmsg_abort)(struct nl_writer *nw); |
| 201 | 165 | 	void (*nlmsg_ignore_limit)(struct nl_writer *nw); |
| 202 | 	bool (*nlmsg_get_unicast_writer)(struct nl_writer *nw, int size, struct nlpcb *nlp); | |
| 203 | 	bool (*nlmsg_get_group_writer)(struct nl_writer *nw, int size, int protocol, int group_id); | |
| 204 | 	bool (*nlmsg_get_chain_writer)(struct nl_writer *nw, int size, struct mbuf **pm); | |
| 166 | 	bool (*nl_writer_unicast)(struct nl_writer *nw, size_t size, | |
| 167 | 	 struct nlpcb *nlp, bool waitok); | |
| 168 | 	bool (*nl_writer_group)(struct nl_writer *nw, size_t size, | |
| 169 | 	 uint16_t protocol, uint16_t group_id, int priv, bool waitok); | |
| 205 | 170 | 	bool (*nlmsg_end_dump)(struct nl_writer *nw, int error, struct nlmsghdr *hdr); |
| 206 | 171 | 	int (*nl_modify_ifp_generic)(struct ifnet *ifp, struct nl_parsed_link *lattrs, |
| 207 | 172 | 	 const struct nlattr_bmask *bm, struct nl_pstate *npt); |
lib/libc/include/generic-freebsd/netlink/route/route.h+4-3| ... | ... | @@ -134,9 +134,10 @@ enum rt_scope_t { |
| 134 | 134 | |
| 135 | 135 | /* |
| 136 | 136 | * Routing table identifiers. |
| 137 | * FreeBSD route table numbering starts from 0, where 0 is a valid default routing table. | |
| 138 | * Indicating "all tables" via netlink can be done by not including RTA_TABLE attribute | |
| 139 | * and keeping rtm_table=0 (compatibility) or setting RTA_TABLE value to RT_TABLE_UNSPEC. | |
| 137 | * FreeBSD route table numbering starts from 0, where 0 is a valid default | |
| 138 | * routing table. Indicating "all tables" via netlink can be done by not | |
| 139 | * including RTA_TABLE attribute and keeping rtm_table=0 (compatibility) or | |
| 140 | * setting RTA_TABLE value to RT_TABLE_UNSPEC. | |
| 140 | 141 | */ |
| 141 | 142 | #define	RT_TABLE_MAIN	0		/* RT_DEFAULT_FIB */ |
| 142 | 143 | #define	RT_TABLE_UNSPEC	0xFFFFFFFF	/* RT_ALL_FIBS */ |
lib/libc/include/generic-freebsd/netlink/route/route_var.h+1| ... | ... | @@ -69,6 +69,7 @@ struct nl_parsed_link { |
| 69 | 69 | 	char		*ifla_cloner; |
| 70 | 70 | 	char		*ifla_ifalias; |
| 71 | 71 | 	struct nlattr	*ifla_idata; |
| 72 | 	struct nlattr	*ifla_address; | |
| 72 | 73 | 	unsigned short	ifi_type; |
| 73 | 74 | 	int		ifi_index; |
| 74 | 75 | 	uint32_t	ifla_link; |
lib/libc/include/generic-freebsd/netpfil/pf/pf.h+33-9| ... | ... | @@ -49,7 +49,7 @@ |
| 49 | 49 | enum	{ PF_INOUT, PF_IN, PF_OUT }; |
| 50 | 50 | enum	{ PF_PASS, PF_DROP, PF_SCRUB, PF_NOSCRUB, PF_NAT, PF_NONAT, |
| 51 | 51 | 	 PF_BINAT, PF_NOBINAT, PF_RDR, PF_NORDR, PF_SYNPROXY_DROP, PF_DEFER, |
| 52 | 	 PF_MATCH }; | |
| 52 | 	 PF_MATCH, PF_AFRT, PF_RT }; | |
| 53 | 53 | enum	{ PF_RULESET_SCRUB, PF_RULESET_FILTER, PF_RULESET_NAT, |
| 54 | 54 | 	 PF_RULESET_BINAT, PF_RULESET_RDR, PF_RULESET_MAX }; |
| 55 | 55 | enum	{ PF_OP_NONE, PF_OP_IRG, PF_OP_EQ, PF_OP_NE, PF_OP_LT, |
| ... | ... | @@ -113,29 +113,38 @@ enum	{ |
| 113 | 113 | #define PFTM_OTHER_FIRST_PACKET_VAL	60	/* First packet */ |
| 114 | 114 | #define PFTM_OTHER_SINGLE_VAL		30	/* Unidirectional */ |
| 115 | 115 | #define PFTM_OTHER_MULTIPLE_VAL		60	/* Bidirectional */ |
| 116 | #define PFTM_FRAG_VAL			30	/* Fragment expire */ | |
| 116 | #define PFTM_FRAG_VAL			60	/* Fragment expire */ | |
| 117 | 117 | #define PFTM_INTERVAL_VAL		10	/* Expire interval */ |
| 118 | 118 | #define PFTM_SRC_NODE_VAL		0	/* Source tracking */ |
| 119 | 119 | #define PFTM_TS_DIFF_VAL		30	/* Allowed TS diff */ |
| 120 | 120 | |
| 121 | 121 | enum	{ PF_NOPFROUTE, PF_FASTROUTE, PF_ROUTETO, PF_DUPTO, PF_REPLYTO }; |
| 122 | 122 | enum	{ PF_LIMIT_STATES, PF_LIMIT_SRC_NODES, PF_LIMIT_FRAGS, |
| 123 | 	 PF_LIMIT_TABLE_ENTRIES, PF_LIMIT_MAX }; | |
| 123 | 	 PF_LIMIT_TABLE_ENTRIES, PF_LIMIT_ANCHORS, PF_LIMIT_ETH_ANCHORS, | |
| 124 | 	 PF_LIMIT_MAX }; | |
| 124 | 125 | #define PF_POOL_IDMASK		0x0f |
| 125 | 126 | enum	{ PF_POOL_NONE, PF_POOL_BITMASK, PF_POOL_RANDOM, |
| 126 | 127 | 	 PF_POOL_SRCHASH, PF_POOL_ROUNDROBIN }; |
| 127 | 128 | enum	{ PF_ADDR_ADDRMASK, PF_ADDR_NOROUTE, PF_ADDR_DYNIFTL, |
| 128 | 129 | 	 PF_ADDR_TABLE, PF_ADDR_URPFFAILED, |
| 129 | 	 PF_ADDR_RANGE }; | |
| 130 | 	 PF_ADDR_RANGE, PF_ADDR_NONE }; | |
| 130 | 131 | #define PF_POOL_TYPEMASK	0x0f |
| 131 | 132 | #define PF_POOL_STICKYADDR	0x20 |
| 133 | #define PF_POOL_ENDPI		0x40 | |
| 134 | #define PF_POOL_IPV6NH		0x80 | |
| 132 | 135 | #define	PF_WSCALE_FLAG		0x80 |
| 133 | 136 | #define	PF_WSCALE_MASK		0x0f |
| 134 | 137 | |
| 138 | #define PF_POOL_DYNTYPE(_o)					\ | |
| 139 | 	((((_o) & PF_POOL_TYPEMASK) == PF_POOL_ROUNDROBIN) ||	\ | |
| 140 | 	(((_o) & PF_POOL_TYPEMASK) == PF_POOL_RANDOM) ||	\ | |
| 141 | 	(((_o) & PF_POOL_TYPEMASK) == PF_POOL_SRCHASH)) | |
| 142 | ||
| 135 | 143 | #define	PF_LOG			0x01 |
| 136 | 144 | #define	PF_LOG_ALL		0x02 |
| 137 | #define	PF_LOG_SOCKET_LOOKUP	0x04 | |
| 145 | #define	PF_LOG_USER		0x04 | |
| 138 | 146 | #define	PF_LOG_FORCE		0x08 |
| 147 | #define	PF_LOG_MATCHES		0x10 | |
| 139 | 148 | |
| 140 | 149 | /* Reasons code for passing/dropping a packet */ |
| 141 | 150 | #define PFRES_MATCH	0		/* Explicit match of a rule */ |
| ... | ... | @@ -154,7 +163,8 @@ enum	{ PF_ADDR_ADDRMASK, PF_ADDR_NOROUTE, PF_ADDR_DYNIFTL, |
| 154 | 163 | #define PFRES_SRCLIMIT	13		/* Source node/conn limit */ |
| 155 | 164 | #define PFRES_SYNPROXY	14		/* SYN proxy */ |
| 156 | 165 | #define PFRES_MAPFAILED	15		/* pf_map_addr() failed */ |
| 157 | #define PFRES_MAX	16		/* total+1 */ | |
| 166 | #define PFRES_TRANSLATE	16		/* No translation address available */ | |
| 167 | #define PFRES_MAX	17		/* total+1 */ | |
| 158 | 168 | |
| 159 | 169 | #define PFRES_NAMES { \ |
| 160 | 170 | 	"match", \ |
| ... | ... | @@ -173,6 +183,7 @@ enum	{ PF_ADDR_ADDRMASK, PF_ADDR_NOROUTE, PF_ADDR_DYNIFTL, |
| 173 | 183 | 	"src-limit", \ |
| 174 | 184 | 	"synproxy", \ |
| 175 | 185 | 	"map-failed", \ |
| 186 | 	"translate", \ | |
| 176 | 187 | 	NULL \ |
| 177 | 188 | } |
| 178 | 189 | |
| ... | ... | @@ -480,6 +491,9 @@ struct pf_osfp_ioctl { |
| 480 | 491 | }; |
| 481 | 492 | |
| 482 | 493 | #define	PF_ANCHOR_NAME_SIZE	 64 |
| 494 | #define	PF_ANCHOR_MAXPATH	(MAXPATHLEN - PF_ANCHOR_NAME_SIZE - 1) | |
| 495 | #define	PF_ANCHOR_HIWAT		512 | |
| 496 | #define	PF_OPTIMIZER_TABLE_PFX	"__automatic_" | |
| 483 | 497 | |
| 484 | 498 | struct pf_rule { |
| 485 | 499 | 	struct pf_rule_addr	 src; |
| ... | ... | @@ -489,8 +503,8 @@ struct pf_rule { |
| 489 | 503 | #define PF_SKIP_AF		2 |
| 490 | 504 | #define PF_SKIP_PROTO		3 |
| 491 | 505 | #define PF_SKIP_SRC_ADDR	4 |
| 492 | #define PF_SKIP_SRC_PORT	5 | |
| 493 | #define PF_SKIP_DST_ADDR	6 | |
| 506 | #define PF_SKIP_DST_ADDR	5 | |
| 507 | #define PF_SKIP_SRC_PORT	6 | |
| 494 | 508 | #define PF_SKIP_DST_PORT	7 |
| 495 | 509 | #define PF_SKIP_COUNT		8 |
| 496 | 510 | 	union pf_rule_ptr	 skip[PF_SKIP_COUNT]; |
| ... | ... | @@ -614,6 +628,9 @@ struct pf_rule { |
| 614 | 628 | #define	PFRULE_SET_TOS		0x00002000 |
| 615 | 629 | #define	PFRULE_IFBOUND		0x00010000 /* if-bound */ |
| 616 | 630 | #define	PFRULE_STATESLOPPY	0x00020000 /* sloppy state tracking */ |
| 631 | #define	PFRULE_PFLOW		0x00040000 | |
| 632 | #define	PFRULE_ALLOW_RELATED	0x00080000 | |
| 633 | #define	PFRULE_AFTO		0x00200000 /* af-to rule */ | |
| 617 | 634 | |
| 618 | 635 | #ifdef _KERNEL |
| 619 | 636 | #define	PFRULE_REFS		0x0080	/* rule has references */ |
| ... | ... | @@ -626,7 +643,7 @@ struct pf_rule { |
| 626 | 643 | /* pf_state->state_flags, pf_rule_actions->flags, pf_krule->scrub_flags */ |
| 627 | 644 | #define	PFSTATE_ALLOWOPTS	0x0001 |
| 628 | 645 | #define	PFSTATE_SLOPPY		0x0002 |
| 629 | /* was	PFSTATE_PFLOW		0x0004 */ | |
| 646 | #define	PFSTATE_PFLOW		0x0004 | |
| 630 | 647 | #define	PFSTATE_NOSYNC		0x0008 |
| 631 | 648 | #define	PFSTATE_ACK		0x0010 |
| 632 | 649 | #define	PFSTATE_NODF		0x0020 |
| ... | ... | @@ -642,6 +659,12 @@ struct pf_rule { |
| 642 | 659 | #define	PFSTATE_SCRUBMASK (PFSTATE_NODF|PFSTATE_RANDOMID|PFSTATE_SCRUB_TCP) |
| 643 | 660 | #define	PFSTATE_SETMASK (PFSTATE_SETTOS|PFSTATE_SETPRIO) |
| 644 | 661 | |
| 662 | /* pfctl_state->src_node_flags */ | |
| 663 | #define PFSTATE_SRC_NODE_LIMIT		0x01 | |
| 664 | #define PFSTATE_SRC_NODE_NAT		0x02 | |
| 665 | #define PFSTATE_SRC_NODE_ROUTE		0x04 | |
| 666 | #define PFSTATE_SRC_NODE_LIMIT_GLOBAL	0x10 | |
| 667 | ||
| 645 | 668 | #define PFSTATE_HIWAT		100000	/* default state table size */ |
| 646 | 669 | #define PFSTATE_ADAPT_START	60000	/* default adaptive timeout start */ |
| 647 | 670 | #define PFSTATE_ADAPT_END	120000	/* default adaptive timeout end */ |
| ... | ... | @@ -670,6 +693,7 @@ struct pf_src_node { |
| 670 | 693 | 	u_int32_t	 creation; |
| 671 | 694 | 	u_int32_t	 expire; |
| 672 | 695 | 	sa_family_t	 af; |
| 696 | 	sa_family_t	 naf; | |
| 673 | 697 | 	u_int8_t	 ruletype; |
| 674 | 698 | }; |
| 675 | 699 |
lib/libc/include/generic-freebsd/netpfil/pf/pf_mtag.h+1-1| ... | ... | @@ -41,7 +41,7 @@ |
| 41 | 41 | #define	PF_MTAG_FLAG_TRANSLATE_LOCALHOST	0x04 |
| 42 | 42 | #define	PF_MTAG_FLAG_PACKET_LOOPED		0x08 |
| 43 | 43 | #define	PF_MTAG_FLAG_FASTFWD_OURS_PRESENT	0x10 |
| 44 | /*						0x20 unused */ | |
| 44 | #define	PF_MTAG_FLAG_DUMMYNETED			0x20 | |
| 45 | 45 | #define	PF_MTAG_FLAG_DUPLICATED			0x40 |
| 46 | 46 | #define	PF_MTAG_FLAG_SYNCOOKIE_RECREATED	0x80 |
| 47 | 47 |
lib/libc/include/generic-freebsd/netpfil/pf/pf_nl.h created+492| ... | ... | @@ -0,0 +1,492 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-2-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 2023 Alexander V. Chernikov <melifaro@FreeBSD.org> | |
| 5 | * Copyright (c) 2023 Rubicon Communications, LLC (Netgate) | |
| 6 | * | |
| 7 | * Redistribution and use in source and binary forms, with or without | |
| 8 | * modification, are permitted provided that the following conditions | |
| 9 | * are met: | |
| 10 | * 1. Redistributions of source code must retain the above copyright | |
| 11 | * notice, this list of conditions and the following disclaimer. | |
| 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 13 | * notice, this list of conditions and the following disclaimer in the | |
| 14 | * documentation and/or other materials provided with the distribution. | |
| 15 | * | |
| 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |
| 17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
| 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | |
| 20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
| 21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
| 22 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
| 23 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
| 24 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
| 25 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
| 26 | * SUCH DAMAGE. | |
| 27 | * | |
| 28 | */ | |
| 29 | ||
| 30 | #ifndef _NETPFIL_PF_PF_NL_H_ | |
| 31 | #define _NETPFIL_PF_PF_NL_H_ | |
| 32 | ||
| 33 | /* Genetlink family */ | |
| 34 | #define PFNL_FAMILY_NAME	"pfctl" | |
| 35 | ||
| 36 | /* available commands */ | |
| 37 | enum { | |
| 38 | 	PFNL_CMD_UNSPEC = 0, | |
| 39 | 	PFNL_CMD_GETSTATES = 1, | |
| 40 | 	PFNL_CMD_GETCREATORS = 2, | |
| 41 | 	PFNL_CMD_START = 3, | |
| 42 | 	PFNL_CMD_STOP = 4, | |
| 43 | 	PFNL_CMD_ADDRULE = 5, | |
| 44 | 	PFNL_CMD_GETRULES = 6, | |
| 45 | 	PFNL_CMD_GETRULE = 7, | |
| 46 | 	PFNL_CMD_CLRSTATES = 8, | |
| 47 | 	PFNL_CMD_KILLSTATES = 9, | |
| 48 | 	PFNL_CMD_SET_STATUSIF = 10, | |
| 49 | 	PFNL_CMD_GET_STATUS = 11, | |
| 50 | 	PFNL_CMD_CLEAR_STATUS = 12, | |
| 51 | 	PFNL_CMD_NATLOOK = 13, | |
| 52 | 	PFNL_CMD_SET_DEBUG = 14, | |
| 53 | 	PFNL_CMD_SET_TIMEOUT = 15, | |
| 54 | 	PFNL_CMD_GET_TIMEOUT = 16, | |
| 55 | 	PFNL_CMD_SET_LIMIT = 17, | |
| 56 | 	PFNL_CMD_GET_LIMIT = 18, | |
| 57 | 	PFNL_CMD_BEGIN_ADDRS = 19, | |
| 58 | 	PFNL_CMD_ADD_ADDR = 20, | |
| 59 | 	PFNL_CMD_GET_ADDRS = 21, | |
| 60 | 	PFNL_CMD_GET_ADDR = 22, | |
| 61 | 	PFNL_CMD_GET_RULESETS = 23, | |
| 62 | 	PFNL_CMD_GET_RULESET = 24, | |
| 63 | 	PFNL_CMD_GET_SRCNODES = 25, | |
| 64 | 	PFNL_CMD_CLEAR_TABLES = 26, | |
| 65 | 	PFNL_CMD_ADD_TABLE = 27, | |
| 66 | 	PFNL_CMD_DEL_TABLE = 28, | |
| 67 | 	PFNL_CMD_GET_TSTATS = 29, | |
| 68 | 	PFNL_CMD_CLR_TSTATS = 30, | |
| 69 | 	PFNL_CMD_CLR_ADDRS = 31, | |
| 70 | 	PFNL_CMD_TABLE_ADD_ADDR = 32, | |
| 71 | 	PFNL_CMD_TABLE_DEL_ADDR = 33, | |
| 72 | 	__PFNL_CMD_MAX, | |
| 73 | }; | |
| 74 | #define PFNL_CMD_MAX (__PFNL_CMD_MAX -1) | |
| 75 | ||
| 76 | enum pfstate_key_type_t { | |
| 77 | 	PF_STK_UNSPEC, | |
| 78 | 	PF_STK_ADDR0		= 1, /* ip */ | |
| 79 | 	PF_STK_ADDR1		= 2, /* ip */ | |
| 80 | 	PF_STK_PORT0		= 3, /* u16 */ | |
| 81 | 	PF_STK_PORT1		= 4, /* u16 */ | |
| 82 | 	PF_STK_AF		= 5, /* u8 */ | |
| 83 | 	PF_STK_PROTO		= 6, /* u16 */ | |
| 84 | }; | |
| 85 | ||
| 86 | enum pfstate_peer_type_t { | |
| 87 | 	PF_STP_UNSPEC, | |
| 88 | 	PF_STP_PFSS_FLAGS	= 1, /* u16 */ | |
| 89 | 	PF_STP_PFSS_TTL		= 2, /* u8 */ | |
| 90 | 	PF_STP_SCRUB_FLAG	= 3, /* u8 */ | |
| 91 | 	PF_STP_PFSS_TS_MOD	= 4, /* u32 */ | |
| 92 | 	PF_STP_SEQLO		= 5, /* u32 */ | |
| 93 | 	PF_STP_SEQHI		= 6, /* u32 */ | |
| 94 | 	PF_STP_SEQDIFF		= 7, /* u32 */ | |
| 95 | 	PF_STP_MAX_WIN		= 8, /* u16 */ | |
| 96 | 	PF_STP_MSS		= 9, /* u16 */ | |
| 97 | 	PF_STP_STATE		= 10, /* u8 */ | |
| 98 | 	PF_STP_WSCALE		= 11, /* u8 */ | |
| 99 | }; | |
| 100 | ||
| 101 | enum pfstate_type_t { | |
| 102 | 	PF_ST_UNSPEC, | |
| 103 | 	PF_ST_ID		= 1, /* u32, state id */ | |
| 104 | 	PF_ST_CREATORID		= 2, /* u32, */ | |
| 105 | 	PF_ST_IFNAME		= 3, /* string */ | |
| 106 | 	PF_ST_ORIG_IFNAME	= 4, /* string */ | |
| 107 | 	PF_ST_KEY_WIRE		= 5, /* nested, pfstate_key_type_t */ | |
| 108 | 	PF_ST_KEY_STACK		= 6, /* nested, pfstate_key_type_t */ | |
| 109 | 	PF_ST_PEER_SRC		= 7, /* nested, pfstate_peer_type_t*/ | |
| 110 | 	PF_ST_PEER_DST		= 8, /* nested, pfstate_peer_type_t */ | |
| 111 | 	PF_ST_RT_ADDR		= 9, /* ip */ | |
| 112 | 	PF_ST_RULE		= 10, /* u32 */ | |
| 113 | 	PF_ST_ANCHOR		= 11, /* u32 */ | |
| 114 | 	PF_ST_NAT_RULE		= 12, /* u32 */ | |
| 115 | 	PF_ST_CREATION		= 13, /* u32 */ | |
| 116 | 	PF_ST_EXPIRE		= 14, /* u32 */ | |
| 117 | 	PF_ST_PACKETS0		= 15, /* u64 */ | |
| 118 | 	PF_ST_PACKETS1		= 16, /* u64 */ | |
| 119 | 	PF_ST_BYTES0		= 17, /* u64 */ | |
| 120 | 	PF_ST_BYTES1		= 18, /* u64 */ | |
| 121 | 	PF_ST_AF		= 19, /* u8 */ | |
| 122 | 	PF_ST_PROTO		= 21, /* u8 */ | |
| 123 | 	PF_ST_DIRECTION		= 22, /* u8 */ | |
| 124 | 	PF_ST_LOG		= 23, /* u8 */ | |
| 125 | 	PF_ST_TIMEOUT		= 24, /* u8 */ | |
| 126 | 	PF_ST_STATE_FLAGS	= 25, /* u8 */ | |
| 127 | 	PF_ST_SYNC_FLAGS	= 26, /* u8 */ | |
| 128 | 	PF_ST_UPDATES		= 27, /* u8 */ | |
| 129 | 	PF_ST_VERSION		= 28, /* u64 */ | |
| 130 | 	PF_ST_FILTER_ADDR	= 29, /* in6_addr */ | |
| 131 | 	PF_ST_FILTER_MASK	= 30, /* in6_addr */ | |
| 132 | 	PF_ST_RTABLEID		= 31, /* i32 */ | |
| 133 | 	PF_ST_MIN_TTL		= 32, /* u8 */ | |
| 134 | 	PF_ST_MAX_MSS		= 33, /* u16 */ | |
| 135 | 	PF_ST_DNPIPE		= 34, /* u16 */ | |
| 136 | 	PF_ST_DNRPIPE		= 35, /* u16 */ | |
| 137 | 	PF_ST_RT		= 36, /* u8 */ | |
| 138 | 	PF_ST_RT_IFNAME		= 37, /* string */ | |
| 139 | 	PF_ST_SRC_NODE_FLAGS	= 38, /* u8 */ | |
| 140 | 	PF_ST_RT_AF		= 39, /* u8 */ | |
| 141 | }; | |
| 142 | ||
| 143 | enum pf_addr_type_t { | |
| 144 | 	PF_AT_UNSPEC, | |
| 145 | 	PF_AT_ADDR		= 1, /* in6_addr */ | |
| 146 | 	PF_AT_MASK		= 2, /* in6_addr */ | |
| 147 | 	PF_AT_IFNAME		= 3, /* string */ | |
| 148 | 	PF_AT_TABLENAME		= 4, /* string */ | |
| 149 | 	PF_AT_TYPE		= 5, /* u8 */ | |
| 150 | 	PF_AT_IFLAGS		= 6, /* u8 */ | |
| 151 | 	PF_AT_TBLCNT		= 7, /* u32 */ | |
| 152 | 	PF_AT_DYNCNT		= 8, /* u32 */ | |
| 153 | }; | |
| 154 | ||
| 155 | enum pfrule_addr_type_t { | |
| 156 | 	PF_RAT_UNSPEC, | |
| 157 | 	PF_RAT_ADDR		= 1, /* nested, pf_addr_type_t */ | |
| 158 | 	PF_RAT_SRC_PORT		= 2, /* u16 */ | |
| 159 | 	PF_RAT_DST_PORT		= 3, /* u16 */ | |
| 160 | 	PF_RAT_NEG		= 4, /* u8 */ | |
| 161 | 	PF_RAT_OP		= 5, /* u8 */ | |
| 162 | }; | |
| 163 | ||
| 164 | enum pf_labels_type_t { | |
| 165 | 	PF_LT_UNSPEC, | |
| 166 | 	PF_LT_LABEL		= 1, /* string */ | |
| 167 | }; | |
| 168 | ||
| 169 | enum pf_mape_portset_type_t | |
| 170 | { | |
| 171 | 	PF_MET_UNSPEC, | |
| 172 | 	PF_MET_OFFSET		= 1, /* u8 */ | |
| 173 | 	PF_MET_PSID_LEN		= 2, /* u8 */ | |
| 174 | 	PF_MET_PSID		= 3, /* u16 */ | |
| 175 | }; | |
| 176 | ||
| 177 | enum pf_rpool_type_t | |
| 178 | { | |
| 179 | 	PF_PT_UNSPEC, | |
| 180 | 	PF_PT_KEY		= 1, /* bytes, sizeof(struct pf_poolhashkey) */ | |
| 181 | 	PF_PT_COUNTER		= 2, /* in6_addr */ | |
| 182 | 	PF_PT_TBLIDX		= 3, /* u32 */ | |
| 183 | 	PF_PT_PROXY_SRC_PORT	= 4, /* u16 */ | |
| 184 | 	PF_PT_PROXY_DST_PORT	= 5, /* u16 */ | |
| 185 | 	PF_PT_OPTS		= 6, /* u8 */ | |
| 186 | 	PF_PT_MAPE		= 7, /* nested, pf_mape_portset_type_t */ | |
| 187 | }; | |
| 188 | ||
| 189 | enum pf_timeout_type_t { | |
| 190 | 	PF_TT_UNSPEC, | |
| 191 | 	PF_TT_TIMEOUT		= 1, /* u32 */ | |
| 192 | }; | |
| 193 | ||
| 194 | enum pf_rule_uid_type_t { | |
| 195 | 	PF_RUT_UNSPEC, | |
| 196 | 	PF_RUT_UID_LOW		= 1, /* u32 */ | |
| 197 | 	PF_RUT_UID_HIGH		= 2, /* u32 */ | |
| 198 | 	PF_RUT_OP		= 3, /* u8 */ | |
| 199 | }; | |
| 200 | ||
| 201 | enum pf_rule_type_t { | |
| 202 | 	PF_RT_UNSPEC, | |
| 203 | 	PF_RT_SRC		= 1, /* nested, pf_rule_addr_type_t */ | |
| 204 | 	PF_RT_DST		= 2, /* nested, pf_rule_addr_type_t */ | |
| 205 | 	PF_RT_RIDENTIFIER	= 3, /* u32 */ | |
| 206 | 	PF_RT_LABELS		= 4, /* nested, pf_labels_type_t */ | |
| 207 | 	PF_RT_IFNAME		= 5, /* string */ | |
| 208 | 	PF_RT_QNAME		= 6, /* string */ | |
| 209 | 	PF_RT_PQNAME		= 7, /* string */ | |
| 210 | 	PF_RT_TAGNAME		= 8, /* string */ | |
| 211 | 	PF_RT_MATCH_TAGNAME	= 9, /* string */ | |
| 212 | 	PF_RT_OVERLOAD_TBLNAME	= 10, /* string */ | |
| 213 | 	PF_RT_RPOOL_RDR		= 11, /* nested, pf_rpool_type_t */ | |
| 214 | 	PF_RT_OS_FINGERPRINT	= 12, /* u32 */ | |
| 215 | 	PF_RT_RTABLEID		= 13, /* u32 */ | |
| 216 | 	PF_RT_TIMEOUT		= 14, /* nested, pf_timeout_type_t */ | |
| 217 | 	PF_RT_MAX_STATES	= 15, /* u32 */ | |
| 218 | 	PF_RT_MAX_SRC_NODES	= 16, /* u32 */ | |
| 219 | 	PF_RT_MAX_SRC_STATES	= 17, /* u32 */ | |
| 220 | 	PF_RT_MAX_SRC_CONN_RATE_LIMIT	= 18, /* u32 */ | |
| 221 | 	PF_RT_MAX_SRC_CONN_RATE_SECS	= 19, /* u32 */ | |
| 222 | 	PF_RT_DNPIPE		= 20, /* u16 */ | |
| 223 | 	PF_RT_DNRPIPE		= 21, /* u16 */ | |
| 224 | 	PF_RT_DNFLAGS		= 22, /* u32 */ | |
| 225 | 	PF_RT_NR		= 23, /* u32 */ | |
| 226 | 	PF_RT_PROB		= 24, /* u32 */ | |
| 227 | 	PF_RT_CUID		= 25, /* u32 */ | |
| 228 | 	PF_RT_CPID		= 26, /* u32 */ | |
| 229 | 	PF_RT_RETURN_ICMP	= 27, /* u16 */ | |
| 230 | 	PF_RT_RETURN_ICMP6	= 28, /* u16 */ | |
| 231 | 	PF_RT_MAX_MSS		= 29, /* u16 */ | |
| 232 | 	PF_RT_SCRUB_FLAGS	= 30, /* u16 */ | |
| 233 | 	PF_RT_UID		= 31, /* nested, pf_rule_uid_type_t */ | |
| 234 | 	PF_RT_GID		= 32, /* nested, pf_rule_uid_type_t */ | |
| 235 | 	PF_RT_RULE_FLAG		= 33, /* u32 */ | |
| 236 | 	PF_RT_ACTION		= 34, /* u8 */ | |
| 237 | 	PF_RT_DIRECTION		= 35, /* u8 */ | |
| 238 | 	PF_RT_LOG		= 36, /* u8 */ | |
| 239 | 	PF_RT_LOGIF		= 37, /* u8 */ | |
| 240 | 	PF_RT_QUICK		= 38, /* u8 */ | |
| 241 | 	PF_RT_IF_NOT		= 39, /* u8 */ | |
| 242 | 	PF_RT_MATCH_TAG_NOT	= 40, /* u8 */ | |
| 243 | 	PF_RT_NATPASS		= 41, /* u8 */ | |
| 244 | 	PF_RT_KEEP_STATE	= 42, /* u8 */ | |
| 245 | 	PF_RT_AF		= 43, /* u8 */ | |
| 246 | 	PF_RT_PROTO		= 44, /* u8 */ | |
| 247 | 	PF_RT_TYPE		= 45, /* u8 */ | |
| 248 | 	PF_RT_CODE		= 46, /* u8 */ | |
| 249 | 	PF_RT_FLAGS		= 47, /* u8 */ | |
| 250 | 	PF_RT_FLAGSET		= 48, /* u8 */ | |
| 251 | 	PF_RT_MIN_TTL		= 49, /* u8 */ | |
| 252 | 	PF_RT_ALLOW_OPTS	= 50, /* u8 */ | |
| 253 | 	PF_RT_RT		= 51, /* u8 */ | |
| 254 | 	PF_RT_RETURN_TTL	= 52, /* u8 */ | |
| 255 | 	PF_RT_TOS		= 53, /* u8 */ | |
| 256 | 	PF_RT_SET_TOS		= 54, /* u8 */ | |
| 257 | 	PF_RT_ANCHOR_RELATIVE	= 55, /* u8 */ | |
| 258 | 	PF_RT_ANCHOR_WILDCARD	= 56, /* u8 */ | |
| 259 | 	PF_RT_FLUSH		= 57, /* u8 */ | |
| 260 | 	PF_RT_PRIO		= 58, /* u8 */ | |
| 261 | 	PF_RT_SET_PRIO		= 59, /* u8 */ | |
| 262 | 	PF_RT_SET_PRIO_REPLY	= 60, /* u8 */ | |
| 263 | 	PF_RT_DIVERT_ADDRESS	= 61, /* in6_addr */ | |
| 264 | 	PF_RT_DIVERT_PORT	= 62, /* u16 */ | |
| 265 | 	PF_RT_PACKETS_IN	= 63, /* u64 */ | |
| 266 | 	PF_RT_PACKETS_OUT	= 64, /* u64 */ | |
| 267 | 	PF_RT_BYTES_IN		= 65, /* u64 */ | |
| 268 | 	PF_RT_BYTES_OUT		= 66, /* u64 */ | |
| 269 | 	PF_RT_EVALUATIONS	= 67, /* u64 */ | |
| 270 | 	PF_RT_TIMESTAMP		= 68, /* u64 */ | |
| 271 | 	PF_RT_STATES_CUR	= 69, /* u64 */ | |
| 272 | 	PF_RT_STATES_TOTAL	= 70, /* u64 */ | |
| 273 | 	PF_RT_SRC_NODES		= 71, /* u64 */ | |
| 274 | 	PF_RT_ANCHOR_CALL	= 72, /* string */ | |
| 275 | 	PF_RT_RCV_IFNAME	= 73, /* string */ | |
| 276 | 	PF_RT_MAX_SRC_CONN	= 74, /* u32 */ | |
| 277 | 	PF_RT_RPOOL_NAT		= 75, /* nested, pf_rpool_type_t */ | |
| 278 | 	PF_RT_NAF		= 76, /* u8 */ | |
| 279 | 	PF_RT_RPOOL_RT		= 77, /* nested, pf_rpool_type_t */ | |
| 280 | 	PF_RT_RCV_IFNOT		= 78, /* bool */ | |
| 281 | 	PF_RT_SRC_NODES_LIMIT	= 79, /* u64 */ | |
| 282 | 	PF_RT_SRC_NODES_NAT	= 80, /* u64 */ | |
| 283 | 	PF_RT_SRC_NODES_ROUTE	= 81, /* u64 */ | |
| 284 | 	PF_RT_PKTRATE		= 82, /* nested, pf_threshold_type_t */ | |
| 285 | 	PF_RT_MAX_PKT_SIZE	= 83, /* u16 */ | |
| 286 | 	PF_RT_TYPE_2		= 84, /* u16 */ | |
| 287 | 	PF_RT_CODE_2		= 85, /* u16 */ | |
| 288 | }; | |
| 289 | ||
| 290 | enum pf_addrule_type_t { | |
| 291 | 	PF_ART_UNSPEC, | |
| 292 | 	PF_ART_TICKET		= 1, /* u32 */ | |
| 293 | 	PF_ART_POOL_TICKET	= 2, /* u32 */ | |
| 294 | 	PF_ART_ANCHOR		= 3, /* string */ | |
| 295 | 	PF_ART_ANCHOR_CALL	= 4, /* string */ | |
| 296 | 	PF_ART_RULE		= 5, /* nested, pfrule_type_t */ | |
| 297 | }; | |
| 298 | ||
| 299 | enum pf_getrules_type_t { | |
| 300 | 	PF_GR_UNSPEC, | |
| 301 | 	PF_GR_ANCHOR		= 1, /* string */ | |
| 302 | 	PF_GR_ACTION		= 2, /* u8 */ | |
| 303 | 	PF_GR_NR		= 3, /* u32 */ | |
| 304 | 	PF_GR_TICKET		= 4, /* u32 */ | |
| 305 | 	PF_GR_CLEAR		= 5, /* u8 */ | |
| 306 | }; | |
| 307 | ||
| 308 | enum pf_clear_states_type_t { | |
| 309 | 	PF_CS_UNSPEC, | |
| 310 | 	PF_CS_CMP_ID		= 1, /* u64 */ | |
| 311 | 	PF_CS_CMP_CREATORID	= 2, /* u32 */ | |
| 312 | 	PF_CS_CMP_DIR		= 3, /* u8 */ | |
| 313 | 	PF_CS_AF		= 4, /* u8 */ | |
| 314 | 	PF_CS_PROTO		= 5, /* u8 */ | |
| 315 | 	PF_CS_SRC		= 6, /* nested, pf_addr_wrap */ | |
| 316 | 	PF_CS_DST		= 7, /* nested, pf_addr_wrap */ | |
| 317 | 	PF_CS_RT_ADDR		= 8, /* nested, pf_addr_wrap */ | |
| 318 | 	PF_CS_IFNAME		= 9, /* string */ | |
| 319 | 	PF_CS_LABEL		= 10, /* string */ | |
| 320 | 	PF_CS_KILL_MATCH	= 11, /* bool */ | |
| 321 | 	PF_CS_NAT		= 12, /* bool */ | |
| 322 | 	PF_CS_KILLED		= 13, /* u32 */ | |
| 323 | }; | |
| 324 | ||
| 325 | enum pf_set_statusif_types_t { | |
| 326 | 	PF_SS_UNSPEC, | |
| 327 | 	PF_SS_IFNAME		= 1, /* string */ | |
| 328 | }; | |
| 329 | ||
| 330 | enum pf_counter_types_t { | |
| 331 | 	PF_C_UNSPEC, | |
| 332 | 	PF_C_COUNTER		= 1, /* u64 */ | |
| 333 | 	PF_C_NAME		= 2, /* string */ | |
| 334 | 	PF_C_ID			= 3, /* u32 */ | |
| 335 | }; | |
| 336 | ||
| 337 | enum pf_get_status_types_t { | |
| 338 | 	PF_GS_UNSPEC, | |
| 339 | 	PF_GS_IFNAME		= 1, /* string */ | |
| 340 | 	PF_GS_RUNNING		= 2, /* bool */ | |
| 341 | 	PF_GS_SINCE		= 3, /* u32 */ | |
| 342 | 	PF_GS_DEBUG		= 4, /* u32 */ | |
| 343 | 	PF_GS_HOSTID		= 5, /* u32 */ | |
| 344 | 	PF_GS_STATES		= 6, /* u32 */ | |
| 345 | 	PF_GS_SRC_NODES		= 7, /* u32 */ | |
| 346 | 	PF_GS_REASSEMBLE	= 8, /* u32 */ | |
| 347 | 	PF_GS_SYNCOOKIES_ACTIVE	= 9, /* bool */ | |
| 348 | 	PF_GS_COUNTERS		= 10, /* nested, */ | |
| 349 | 	PF_GS_LCOUNTERS		= 11, /* nested, */ | |
| 350 | 	PF_GS_FCOUNTERS		= 12, /* nested, */ | |
| 351 | 	PF_GS_SCOUNTERS		= 13, /* nested, */ | |
| 352 | 	PF_GS_CHKSUM		= 14, /* byte array */ | |
| 353 | 	PF_GS_PCOUNTERS		= 15, /* u64 array */ | |
| 354 | 	PF_GS_BCOUNTERS		= 16, /* u64 array */ | |
| 355 | }; | |
| 356 | ||
| 357 | enum pf_natlook_types_t { | |
| 358 | 	PF_NL_UNSPEC, | |
| 359 | 	PF_NL_AF		= 1, /* u8 */ | |
| 360 | 	PF_NL_DIRECTION		= 2, /* u8 */ | |
| 361 | 	PF_NL_PROTO		= 3, /* u8 */ | |
| 362 | 	PF_NL_SRC_ADDR		= 4, /* in6_addr */ | |
| 363 | 	PF_NL_DST_ADDR		= 5, /* in6_addr */ | |
| 364 | 	PF_NL_SRC_PORT		= 6, /* u16 */ | |
| 365 | 	PF_NL_DST_PORT		= 7, /* u16 */ | |
| 366 | }; | |
| 367 | ||
| 368 | enum pf_set_debug_types_t { | |
| 369 | 	PF_SD_UNSPEC, | |
| 370 | 	PF_SD_LEVEL		= 1, /* u32 */ | |
| 371 | }; | |
| 372 | ||
| 373 | enum pf_timeout_types_t { | |
| 374 | 	PF_TO_UNSPEC, | |
| 375 | 	PF_TO_TIMEOUT		= 1, /* u32 */ | |
| 376 | 	PF_TO_SECONDS		= 2, /* u32 */ | |
| 377 | }; | |
| 378 | ||
| 379 | enum pf_limit_types_t { | |
| 380 | 	PF_LI_UNSPEC, | |
| 381 | 	PF_LI_INDEX		= 1, /* u32 */ | |
| 382 | 	PF_LI_LIMIT		= 2, /* u32 */ | |
| 383 | }; | |
| 384 | ||
| 385 | enum pf_begin_addrs_types_t { | |
| 386 | 	PF_BA_UNSPEC, | |
| 387 | 	PF_BA_TICKET		= 1, /* u32 */ | |
| 388 | }; | |
| 389 | ||
| 390 | enum pf_pool_addr_types_t { | |
| 391 | 	PF_PA_UNSPEC, | |
| 392 | 	PF_PA_ADDR		= 1, /* nested, pf_addr_wrap */ | |
| 393 | 	PF_PA_IFNAME		= 2, /* string */ | |
| 394 | }; | |
| 395 | ||
| 396 | enum pf_add_addr_types_t { | |
| 397 | 	PF_AA_UNSPEC, | |
| 398 | 	PF_AA_ACTION		= 1, /* u32 */ | |
| 399 | 	PF_AA_TICKET		= 2, /* u32 */ | |
| 400 | 	PF_AA_NR		= 3, /* u32 */ | |
| 401 | 	PF_AA_R_NUM		= 4, /* u32 */ | |
| 402 | 	PF_AA_R_ACTION		= 5, /* u8 */ | |
| 403 | 	PF_AA_R_LAST		= 6, /* u8 */ | |
| 404 | 	PF_AA_AF		= 7, /* u8 */ | |
| 405 | 	PF_AA_ANCHOR		= 8, /* string */ | |
| 406 | 	PF_AA_ADDR		= 9, /* nested, pf_pooladdr */ | |
| 407 | 	PF_AA_WHICH		= 10, /* u32 */ | |
| 408 | }; | |
| 409 | ||
| 410 | enum pf_get_rulesets_types_t { | |
| 411 | 	PF_RS_UNSPEC, | |
| 412 | 	PF_RS_PATH		= 1, /* string */ | |
| 413 | 	PF_RS_NR		= 2, /* u32 */ | |
| 414 | 	PF_RS_NAME		= 3, /* string */ | |
| 415 | }; | |
| 416 | ||
| 417 | enum pf_threshold_types_t { | |
| 418 | 	PF_TH_UNSPEC, | |
| 419 | 	PF_TH_LIMIT		= 1, /* u32 */ | |
| 420 | 	PF_TH_SECONDS		= 2, /* u32 */ | |
| 421 | 	PF_TH_COUNT		= 3, /* u32 */ | |
| 422 | 	PF_TH_LAST		= 4, /* u32 */ | |
| 423 | }; | |
| 424 | ||
| 425 | enum pf_srcnodes_types_t { | |
| 426 | 	PF_SN_UNSPEC, | |
| 427 | 	PF_SN_ADDR		= 1, /* nested, pf_addr */ | |
| 428 | 	PF_SN_RADDR		= 2, /* nested, pf_addr */ | |
| 429 | 	PF_SN_RULE_NR		= 3, /* u32 */ | |
| 430 | 	PF_SN_BYTES_IN		= 4, /* u64 */ | |
| 431 | 	PF_SN_BYTES_OUT		= 5, /* u64 */ | |
| 432 | 	PF_SN_PACKETS_IN	= 6, /* u64 */ | |
| 433 | 	PF_SN_PACKETS_OUT	= 7, /* u64 */ | |
| 434 | 	PF_SN_STATES		= 8, /* u32 */ | |
| 435 | 	PF_SN_CONNECTIONS	= 9, /* u32 */ | |
| 436 | 	PF_SN_AF		= 10, /* u8 */ | |
| 437 | 	PF_SN_RULE_TYPE		= 11, /* u8 */ | |
| 438 | 	PF_SN_CREATION		= 12, /* u64 */ | |
| 439 | 	PF_SN_EXPIRE		= 13, /* u64 */ | |
| 440 | 	PF_SN_CONNECTION_RATE	= 14, /* nested, pf_threshold */ | |
| 441 | 	PF_SN_RAF		= 15, /* u8 */ | |
| 442 | 	PF_SN_NODE_TYPE		= 16, /* u8 */ | |
| 443 | }; | |
| 444 | ||
| 445 | enum pf_tables_t { | |
| 446 | 	PF_T_UNSPEC, | |
| 447 | 	PF_T_ANCHOR		= 1, /* string */ | |
| 448 | 	PF_T_NAME		= 2, /* string */ | |
| 449 | 	PF_T_TABLE_FLAGS	= 3, /* u32 */ | |
| 450 | 	PF_T_FLAGS		= 4, /* u32 */ | |
| 451 | 	PF_T_NBR_DELETED	= 5, /* u32 */ | |
| 452 | 	PF_T_NBR_ADDED		= 6, /* u32 */ | |
| 453 | }; | |
| 454 | ||
| 455 | enum pf_tstats_t { | |
| 456 | 	PF_TS_UNSPEC, | |
| 457 | 	PF_TS_TABLE		= 1, /* nested, pfr_table */ | |
| 458 | 	PF_TS_PACKETS		= 2, /* u64 array */ | |
| 459 | 	PF_TS_BYTES		= 3, /* u64 array */ | |
| 460 | 	PF_TS_MATCH		= 4, /* u64 */ | |
| 461 | 	PF_TS_NOMATCH		= 5, /* u64 */ | |
| 462 | 	PF_TS_TZERO		= 6, /* u64 */ | |
| 463 | 	PF_TS_CNT		= 7, /* u64 */ | |
| 464 | 	PF_TS_REFCNT		= 8, /* u64 array */ | |
| 465 | 	PF_TS_NZERO		= 9, /* u64 */ | |
| 466 | }; | |
| 467 | ||
| 468 | enum pfr_addr_t { | |
| 469 | 	PFR_A_UNSPEC, | |
| 470 | 	PFR_A_AF		= 1, /* uint8_t */ | |
| 471 | 	PFR_A_NET		= 2, /* uint8_t */ | |
| 472 | 	PFR_A_NOT		= 3, /* bool */ | |
| 473 | 	PFR_A_ADDR		= 4, /* in6_addr */ | |
| 474 | }; | |
| 475 | ||
| 476 | enum pf_table_addrs_t { | |
| 477 | 	PF_TA_UNSPEC, | |
| 478 | 	PF_TA_TABLE		= 1, /* nested, pf_table_t */ | |
| 479 | 	PF_TA_ADDR		= 2, /* nested, pfr_addr_t */ | |
| 480 | 	PF_TA_FLAGS		= 3, /* u32 */ | |
| 481 | 	PF_TA_NBR_ADDED		= 4, /* u32 */ | |
| 482 | 	PF_TA_NBR_DELETED	= 5, /* u32 */ | |
| 483 | }; | |
| 484 | ||
| 485 | #ifdef _KERNEL | |
| 486 | ||
| 487 | void	pf_nl_register(void); | |
| 488 | void	pf_nl_unregister(void); | |
| 489 | ||
| 490 | #endif | |
| 491 | ||
| 492 | #endif | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/nfs/nfsdiskless.h-2| ... | ... | @@ -30,8 +30,6 @@ |
| 30 | 30 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 31 | 31 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 32 | 32 | * SUCH DAMAGE. |
| 33 | * | |
| 34 | *	@(#)nfsdiskless.h	8.2 (Berkeley) 3/30/95 | |
| 35 | 33 | */ |
| 36 | 34 | |
| 37 | 35 | #ifndef _NFSCLIENT_NFSDISKLESS_H_ |
lib/libc/include/generic-freebsd/nfs/nfsproto.h-2| ... | ... | @@ -30,8 +30,6 @@ |
| 30 | 30 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 31 | 31 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 32 | 32 | * SUCH DAMAGE. |
| 33 | * | |
| 34 | *	@(#)nfsproto.h 8.2 (Berkeley) 3/30/95 | |
| 35 | 33 | */ |
| 36 | 34 | |
| 37 | 35 | #ifndef _NFS_NFSPROTO_H_ |
lib/libc/include/generic-freebsd/nfs/xdr_subs.h-2| ... | ... | @@ -30,8 +30,6 @@ |
| 30 | 30 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 31 | 31 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 32 | 32 | * SUCH DAMAGE. |
| 33 | * | |
| 34 | *	@(#)xdr_subs.h	8.3 (Berkeley) 3/30/95 | |
| 35 | 33 | */ |
| 36 | 34 | |
| 37 | 35 | #ifndef _NFS_XDR_SUBS_H_ |
lib/libc/include/generic-freebsd/nfsclient/nfs.h-2| ... | ... | @@ -30,8 +30,6 @@ |
| 30 | 30 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 31 | 31 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 32 | 32 | * SUCH DAMAGE. |
| 33 | * | |
| 34 | *	@(#)nfs.h	8.4 (Berkeley) 5/1/95 | |
| 35 | 33 | */ |
| 36 | 34 | |
| 37 | 35 | #ifndef _NFSCLIENT_NFS_H_ |
lib/libc/include/generic-freebsd/nfsclient/nfsargs.h-2| ... | ... | @@ -30,8 +30,6 @@ |
| 30 | 30 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 31 | 31 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 32 | 32 | * SUCH DAMAGE. |
| 33 | * | |
| 34 | *	@(#)nfs.h	8.4 (Berkeley) 5/1/95 | |
| 35 | 33 | */ |
| 36 | 34 | |
| 37 | 35 | #ifndef _NFSCLIENT_NFSARGS_H_ |
lib/libc/include/generic-freebsd/nfsclient/nfsmount.h-2| ... | ... | @@ -30,8 +30,6 @@ |
| 30 | 30 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 31 | 31 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 32 | 32 | * SUCH DAMAGE. |
| 33 | * | |
| 34 | *	@(#)nfsmount.h	8.3 (Berkeley) 3/30/95 | |
| 35 | 33 | */ |
| 36 | 34 | |
| 37 | 35 | #ifndef _NFSCLIENT_NFSMOUNT_H_ |
lib/libc/include/generic-freebsd/nfsclient/nfsnode.h-2| ... | ... | @@ -30,8 +30,6 @@ |
| 30 | 30 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 31 | 31 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 32 | 32 | * SUCH DAMAGE. |
| 33 | * | |
| 34 | *	@(#)nfsnode.h	8.9 (Berkeley) 5/14/95 | |
| 35 | 33 | */ |
| 36 | 34 | |
| 37 | 35 | #ifndef _NFSCLIENT_NFSNODE_H_ |
lib/libc/include/generic-freebsd/nfsclient/nfsstats.h-2| ... | ... | @@ -30,8 +30,6 @@ |
| 30 | 30 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 31 | 31 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 32 | 32 | * SUCH DAMAGE. |
| 33 | * | |
| 34 | *	@(#)nfs.h	8.4 (Berkeley) 5/1/95 | |
| 35 | 33 | */ |
| 36 | 34 | |
| 37 | 35 | #ifndef _NFSCLIENT_NFSSTATS_H_ |
lib/libc/include/generic-freebsd/nfsserver/nfs.h-2| ... | ... | @@ -30,8 +30,6 @@ |
| 30 | 30 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 31 | 31 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 32 | 32 | * SUCH DAMAGE. |
| 33 | * | |
| 34 | *	@(#)nfs.h	8.4 (Berkeley) 5/1/95 | |
| 35 | 33 | */ |
| 36 | 34 | |
| 37 | 35 | #ifndef _NFSSERVER_NFS_H_ |
lib/libc/include/generic-freebsd/nfsserver/nfsrvstats.h-2| ... | ... | @@ -30,8 +30,6 @@ |
| 30 | 30 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 31 | 31 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 32 | 32 | * SUCH DAMAGE. |
| 33 | * | |
| 34 | *	@(#)nfs.h	8.4 (Berkeley) 5/1/95 | |
| 35 | 33 | */ |
| 36 | 34 | |
| 37 | 35 | #ifndef _NFSSERVER_NFSRVSTATS_H_ |
lib/libc/include/generic-freebsd/nl_types.h-1| ... | ... | @@ -34,7 +34,6 @@ |
| 34 | 34 | #ifndef _NL_TYPES_H_ |
| 35 | 35 | #define _NL_TYPES_H_ |
| 36 | 36 | |
| 37 | #include <sys/cdefs.h> | |
| 38 | 37 | #include <sys/types.h> |
| 39 | 38 | |
| 40 | 39 | #ifdef _NLS_PRIVATE |
lib/libc/include/generic-freebsd/nlist.h-2| ... | ... | @@ -32,8 +32,6 @@ |
| 32 | 32 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 33 | 33 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 34 | 34 | * SUCH DAMAGE. |
| 35 | * | |
| 36 | *	@(#)nlist.h	8.2 (Berkeley) 1/21/94 | |
| 37 | 35 | */ |
| 38 | 36 | |
| 39 | 37 | #ifndef _NLIST_H_ |
lib/libc/include/generic-freebsd/osreldate.h+1-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /*- |
| 2 | * Copyright (c) 1992-2023 The FreeBSD Project. | |
| 2 | * Copyright (c) 1992-2025 The FreeBSD Project. | |
| 3 | 3 | * |
| 4 | 4 | */ |
| 5 | 5 | #ifdef _KERNEL |
lib/libc/include/generic-freebsd/paths.h+1-3| ... | ... | @@ -27,8 +27,6 @@ |
| 27 | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | * | |
| 31 | *	@(#)paths.h	8.1 (Berkeley) 6/2/93 | |
| 32 | 30 | */ |
| 33 | 31 | |
| 34 | 32 | #ifndef _PATHS_H_ |
| ... | ... | @@ -63,7 +61,6 @@ |
| 63 | 61 | #define	_PATH_FIRMWARE	"/usr/share/firmware" |
| 64 | 62 | #define	_PATH_FTPUSERS	"/etc/ftpusers" |
| 65 | 63 | #define	_PATH_FWMEM	"/dev/fwmem" |
| 66 | #define	_PATH_GBDE	"/sbin/gbde" | |
| 67 | 64 | #define	_PATH_GELI	"/sbin/geli" |
| 68 | 65 | #define	_PATH_HALT	"/sbin/halt" |
| 69 | 66 | #ifdef COMPAT_libcompat |
| ... | ... | @@ -84,6 +81,7 @@ |
| 84 | 81 | #define	_PATH_MOUNT	"/sbin/mount" |
| 85 | 82 | #define	_PATH_NEWFS	"/sbin/newfs" |
| 86 | 83 | #define	_PATH_NOLOGIN	"/var/run/nologin" |
| 84 | #define	_PATH_NOSHUTDOWN "/var/run/noshutdown" | |
| 87 | 85 | #define	_PATH_RCP	"/bin/rcp" |
| 88 | 86 | #define	_PATH_REBOOT	"/sbin/reboot" |
| 89 | 87 | #define	_PATH_RLOGIN	"/usr/bin/rlogin" |
lib/libc/include/generic-freebsd/poll.h+6-2| ... | ... | @@ -96,7 +96,7 @@ struct pollfd { |
| 96 | 96 | |
| 97 | 97 | #ifndef _KERNEL |
| 98 | 98 | |
| 99 | #if __BSD_VISIBLE | |
| 99 | #if __POSIX_VISIBLE >= 202405 | |
| 100 | 100 | #include <sys/_types.h> |
| 101 | 101 | |
| 102 | 102 | #include <sys/_sigset.h> |
| ... | ... | @@ -109,9 +109,13 @@ typedef	__sigset_t	sigset_t; |
| 109 | 109 | |
| 110 | 110 | #endif |
| 111 | 111 | |
| 112 | #if defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE > 0 | |
| 113 | #include <ssp/poll.h> | |
| 114 | #endif | |
| 115 | ||
| 112 | 116 | __BEGIN_DECLS |
| 113 | 117 | int	poll(struct pollfd _pfd[], nfds_t _nfds, int _timeout); |
| 114 | #if __BSD_VISIBLE | |
| 118 | #if __POSIX_VISIBLE >= 202405 | |
| 115 | 119 | int	ppoll(struct pollfd _pfd[], nfds_t _nfds, |
| 116 | 120 | 	 const struct timespec *__restrict _timeout, |
| 117 | 121 | 	 const sigset_t *__restrict _newsigmask); |
lib/libc/include/generic-freebsd/protocols/dumprestore.h-2| ... | ... | @@ -32,8 +32,6 @@ |
| 32 | 32 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 33 | 33 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 34 | 34 | * SUCH DAMAGE. |
| 35 | * | |
| 36 | *	@(#)dumprestore.h	8.2 (Berkeley) 1/21/94 | |
| 37 | 35 | */ |
| 38 | 36 | |
| 39 | 37 | #ifndef _PROTOCOLS_DUMPRESTORE_H_ |
lib/libc/include/generic-freebsd/protocols/routed.h-2| ... | ... | @@ -27,8 +27,6 @@ |
| 27 | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | * | |
| 31 | *	@(#)routed.h	8.1 (Berkeley) 6/2/93 | |
| 32 | 30 | *	$Revision: 2.26 $ |
| 33 | 31 | */ |
| 34 | 32 |
lib/libc/include/generic-freebsd/protocols/rwhod.h-2| ... | ... | @@ -27,8 +27,6 @@ |
| 27 | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | * | |
| 31 | *	@(#)rwhod.h	8.1 (Berkeley) 6/2/93 | |
| 32 | 30 | */ |
| 33 | 31 | |
| 34 | 32 | #ifndef _PROTOCOLS_RWHOD_H_ |
lib/libc/include/generic-freebsd/protocols/talkd.h-2| ... | ... | @@ -27,8 +27,6 @@ |
| 27 | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | * | |
| 31 | *	@(#)talkd.h	8.1 (Berkeley) 6/2/93 | |
| 32 | 30 | */ |
| 33 | 31 | |
| 34 | 32 | #ifndef _PROTOCOLS_TALKD_H_ |
lib/libc/include/generic-freebsd/protocols/timed.h-2| ... | ... | @@ -27,8 +27,6 @@ |
| 27 | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | * | |
| 31 | *	@(#)timed.h	8.1 (Berkeley) 6/2/93 | |
| 32 | 30 | */ |
| 33 | 31 | |
| 34 | 32 | #ifndef	_PROTOCOLS_TIMED_H_ |
lib/libc/include/generic-freebsd/pthread_np.h+2-7| ... | ... | @@ -34,11 +34,6 @@ |
| 34 | 34 | #include <sys/param.h> |
| 35 | 35 | #include <sys/cpuset.h> |
| 36 | 36 | |
| 37 | /* | |
| 38 | * Non-POSIX type definitions: | |
| 39 | */ | |
| 40 | typedef void	(*pthread_switch_routine_t)(pthread_t, pthread_t); | |
| 41 | ||
| 42 | 37 | /* |
| 43 | 38 | * Non-POSIX thread function prototype definitions: |
| 44 | 39 | */ |
| ... | ... | @@ -64,11 +59,11 @@ int pthread_resume_np(pthread_t); |
| 64 | 59 | int pthread_peekjoin_np(pthread_t, void **); |
| 65 | 60 | void pthread_set_name_np(pthread_t, const char *); |
| 66 | 61 | int pthread_setaffinity_np(pthread_t, size_t, const cpuset_t *); |
| 62 | void pthread_signals_block_np(void); | |
| 63 | void pthread_signals_unblock_np(void); | |
| 67 | 64 | int pthread_single_np(void); |
| 68 | 65 | void pthread_suspend_all_np(void); |
| 69 | 66 | int pthread_suspend_np(pthread_t); |
| 70 | int pthread_switch_add_np(pthread_switch_routine_t); | |
| 71 | int pthread_switch_delete_np(pthread_switch_routine_t); | |
| 72 | 67 | int pthread_timedjoin_np(pthread_t, void **, const struct timespec *); |
| 73 | 68 | __END_DECLS |
| 74 | 69 |
lib/libc/include/generic-freebsd/pwd.h-2| ... | ... | @@ -32,8 +32,6 @@ |
| 32 | 32 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 33 | 33 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 34 | 34 | * SUCH DAMAGE. |
| 35 | * | |
| 36 | *	@(#)pwd.h	8.2 (Berkeley) 1/21/94 | |
| 37 | 35 | */ |
| 38 | 36 | |
| 39 | 37 | #ifndef _PWD_H_ |
lib/libc/include/generic-freebsd/ranlib.h-2| ... | ... | @@ -27,8 +27,6 @@ |
| 27 | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | * | |
| 31 | *	@(#)ranlib.h	8.1 (Berkeley) 6/2/93 | |
| 32 | 30 | */ |
| 33 | 31 | |
| 34 | 32 | #ifndef _RANLIB_H_ |
lib/libc/include/generic-freebsd/regex.h-2| ... | ... | @@ -31,8 +31,6 @@ |
| 31 | 31 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 32 | 32 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 33 | 33 | * SUCH DAMAGE. |
| 34 | * | |
| 35 | *	@(#)regex.h	8.2 (Berkeley) 1/3/94 | |
| 36 | 34 | */ |
| 37 | 35 | |
| 38 | 36 | #ifndef _REGEX_H_ |
lib/libc/include/generic-freebsd/resolv.h-1| ... | ... | @@ -47,7 +47,6 @@ |
| 47 | 47 | */ |
| 48 | 48 | |
| 49 | 49 | /*% |
| 50 | *	@(#)resolv.h	8.1 (Berkeley) 6/2/93 | |
| 51 | 50 | *	$Id: resolv.h,v 1.30 2009/03/03 01:52:48 each Exp $ |
| 52 | 51 | */ |
| 53 | 52 |
lib/libc/include/generic-freebsd/rpc/auth.h-4| ... | ... | @@ -28,10 +28,6 @@ |
| 28 | 28 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
| 29 | 29 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
| 30 | 30 | * POSSIBILITY OF SUCH DAMAGE. |
| 31 | * | |
| 32 | *	from: @(#)auth.h 1.17 88/02/08 SMI | |
| 33 | *	from: @(#)auth.h	2.3 88/08/07 4.0 RPCSRC | |
| 34 | *	from: @(#)auth.h	1.43 	98/02/02 SMI | |
| 35 | 31 | */ |
| 36 | 32 | |
| 37 | 33 | /* |
lib/libc/include/generic-freebsd/rpc/auth_des.h-3| ... | ... | @@ -1,4 +1,3 @@ |
| 1 | /*	@(#)auth_des.h	2.2 88/07/29 4.0 RPCSRC; from 1.3 88/02/08 SMI */ | |
| 2 | 1 | /*- |
| 3 | 2 | * SPDX-License-Identifier: BSD-3-Clause |
| 4 | 3 | * |
| ... | ... | @@ -28,8 +27,6 @@ |
| 28 | 27 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
| 29 | 28 | * POSSIBILITY OF SUCH DAMAGE. |
| 30 | 29 | * |
| 31 | *	from: @(#)auth_des.h 2.2 88/07/29 4.0 RPCSRC | |
| 32 | *	from: @(#)auth_des.h 1.14 94/04/25 SMI | |
| 33 | 30 | */ |
| 34 | 31 | |
| 35 | 32 | /* |
lib/libc/include/generic-freebsd/rpc/auth_unix.h-3| ... | ... | @@ -26,9 +26,6 @@ |
| 26 | 26 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
| 27 | 27 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
| 28 | 28 | * POSSIBILITY OF SUCH DAMAGE. |
| 29 | * | |
| 30 | *	from: @(#)auth_unix.h 1.8 88/02/08 SMI | |
| 31 | *	from: @(#)auth_unix.h	2.2 88/07/29 4.0 RPCSRC | |
| 32 | 29 | */ |
| 33 | 30 | |
| 34 | 31 | /* |
lib/libc/include/generic-freebsd/rpc/clnt.h-3| ... | ... | @@ -28,9 +28,6 @@ |
| 28 | 28 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
| 29 | 29 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
| 30 | 30 | * POSSIBILITY OF SUCH DAMAGE. |
| 31 | * | |
| 32 | *	from: @(#)clnt.h 1.31 94/04/29 SMI | |
| 33 | *	from: @(#)clnt.h	2.1 88/07/29 4.0 RPCSRC | |
| 34 | 31 | */ |
| 35 | 32 | |
| 36 | 33 | /* |
lib/libc/include/generic-freebsd/rpc/clnt_nl.h created+42| ... | ... | @@ -0,0 +1,42 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-2-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 2025 Gleb Smirnoff <glebius@FreeBSD.org> | |
| 5 | * | |
| 6 | * Redistribution and use in source and binary forms, with or without | |
| 7 | * modification, are permitted provided that the following conditions | |
| 8 | * are met: | |
| 9 | * 1. Redistributions of source code must retain the above copyright | |
| 10 | * notice, this list of conditions and the following disclaimer. | |
| 11 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 12 | * notice, this list of conditions and the following disclaimer in the | |
| 13 | * documentation and/or other materials provided with the distribution. | |
| 14 | * | |
| 15 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |
| 16 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 17 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
| 18 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | |
| 19 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
| 20 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
| 21 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
| 22 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
| 23 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
| 24 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
| 25 | * SUCH DAMAGE. | |
| 26 | */ | |
| 27 | ||
| 28 | #ifndef _RPC_CLNT_NL_H | |
| 29 | #define _RPC_CLNT_NL_H | |
| 30 | ||
| 31 | enum rpcnl_cmds_t { | |
| 32 | 	RPCNL_REQUEST = 1,	/* mcast: kernel -> userland */ | |
| 33 | 	RPCNL_REPLY,		/* unicast: userland -> kernel */ | |
| 34 | }; | |
| 35 | ||
| 36 | enum rpcnl_attr_t { | |
| 37 | 	RPCNL_REQUEST_GROUP = 1, | |
| 38 | 	RPCNL_REQUEST_BODY, | |
| 39 | 	RPCNL_REPLY_GROUP, | |
| 40 | 	RPCNL_REPLY_BODY, | |
| 41 | }; | |
| 42 | #endif /* _RPC_CLNT_NL_H */ | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/rpc/clnt_stat.h-2| ... | ... | @@ -11,8 +11,6 @@ |
| 11 | 11 | #ifndef	_RPC_CLNT_STAT_H |
| 12 | 12 | #define	_RPC_CLNT_STAT_H |
| 13 | 13 | |
| 14 | /* #pragma ident	"@(#)clnt_stat.h	1.2	97/04/28 SMI" */ | |
| 15 | ||
| 16 | 14 | #ifdef __cplusplus |
| 17 | 15 | extern "C" { |
| 18 | 16 | #endif |
lib/libc/include/generic-freebsd/rpc/des.h-21| ... | ... | @@ -1,4 +1,3 @@ |
| 1 | /* @(#)des.h	2.2 88/08/10 4.0 RPCSRC; from 2.7 88/02/08 SMI */ | |
| 2 | 1 | /*- |
| 3 | 2 | * SPDX-License-Identifier: BSD-3-Clause |
| 4 | 3 | * |
| ... | ... | @@ -57,26 +56,6 @@ struct desparams { |
| 57 | 56 | #	define des_buf	UDES.UDES_buf	/* otherwise, pointer to data */ |
| 58 | 57 | }; |
| 59 | 58 | |
| 60 | #ifdef notdef | |
| 61 | ||
| 62 | /* | |
| 63 | * These ioctls are only implemented in SunOS. Maybe someday | |
| 64 | * if somebody writes a driver for DES hardware that works | |
| 65 | * with FreeBSD, we can being that back. | |
| 66 | */ | |
| 67 | ||
| 68 | /* | |
| 69 | * Encrypt an arbitrary sized buffer | |
| 70 | */ | |
| 71 | #define	DESIOCBLOCK	_IOWR('d', 6, struct desparams) | |
| 72 | ||
| 73 | /* | |
| 74 | * Encrypt of small amount of data, quickly | |
| 75 | */ | |
| 76 | #define DESIOCQUICK	_IOWR('d', 7, struct desparams) | |
| 77 | ||
| 78 | #endif | |
| 79 | ||
| 80 | 59 | /* |
| 81 | 60 | * Software DES. |
| 82 | 61 | */ |
lib/libc/include/generic-freebsd/rpc/des_crypt.h-1| ... | ... | @@ -1,5 +1,4 @@ |
| 1 | 1 | /* |
| 2 | * @(#)des_crypt.h	2.1 88/08/11 4.0 RPCSRC;	from 1.4 88/02/08 (C) 1986 SMI | |
| 3 | 2 | * |
| 4 | 3 | * des_crypt.h, des library routine interface |
| 5 | 4 | * Copyright (C) 1986, Sun Microsystems, Inc. |
lib/libc/include/generic-freebsd/rpc/key_prot.h-4| ... | ... | @@ -42,10 +42,6 @@ extern "C" { |
| 42 | 42 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 43 | 43 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 44 | 44 | */ |
| 45 | /* From: #pragma ident	"@(#)key_prot.x	1.7	94/04/29 SMI" */ | |
| 46 | /* Copyright (c) 1990, 1991 Sun Microsystems, Inc. */ | |
| 47 | #include <sys/cdefs.h> | |
| 48 | ||
| 49 | 45 | /* |
| 50 | 46 | * Compiled from key_prot.x using rpcgen. |
| 51 | 47 | * DO NOT EDIT THIS FILE! |
lib/libc/include/generic-freebsd/rpc/pmap_clnt.h-3| ... | ... | @@ -28,9 +28,6 @@ |
| 28 | 28 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
| 29 | 29 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
| 30 | 30 | * POSSIBILITY OF SUCH DAMAGE. |
| 31 | * | |
| 32 | *	from: @(#)pmap_clnt.h 1.11 88/02/08 SMI | |
| 33 | *	from: @(#)pmap_clnt.h	2.1 88/07/29 4.0 RPCSRC | |
| 34 | 31 | */ |
| 35 | 32 | |
| 36 | 33 | /* |
lib/libc/include/generic-freebsd/rpc/pmap_prot.h-3| ... | ... | @@ -28,9 +28,6 @@ |
| 28 | 28 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
| 29 | 29 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
| 30 | 30 | * POSSIBILITY OF SUCH DAMAGE. |
| 31 | * | |
| 32 | *	from: @(#)pmap_prot.h 1.14 88/02/08 SMI | |
| 33 | *	from: @(#)pmap_prot.h	2.1 88/07/29 4.0 RPCSRC | |
| 34 | 31 | */ |
| 35 | 32 | |
| 36 | 33 | /* |
lib/libc/include/generic-freebsd/rpc/pmap_rmt.h-3| ... | ... | @@ -28,9 +28,6 @@ |
| 28 | 28 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
| 29 | 29 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
| 30 | 30 | * POSSIBILITY OF SUCH DAMAGE. |
| 31 | * | |
| 32 | *	from: @(#)pmap_rmt.h 1.2 88/02/08 SMI | |
| 33 | *	from: @(#)pmap_rmt.h	2.1 88/07/29 4.0 RPCSRC | |
| 34 | 31 | */ |
| 35 | 32 | |
| 36 | 33 | /* |
lib/libc/include/generic-freebsd/rpc/raw.h-3| ... | ... | @@ -36,9 +36,6 @@ |
| 36 | 36 | #ifndef _RPC_RAW_H |
| 37 | 37 | #define	_RPC_RAW_H |
| 38 | 38 | |
| 39 | /* 	from: @(#)raw.h	1.11	94/04/25 SMI */ | |
| 40 | /*	from: @(#)raw.h 1.2 88/10/25 SMI	*/ | |
| 41 | ||
| 42 | 39 | #ifdef	__cplusplus |
| 43 | 40 | extern "C" { |
| 44 | 41 | #endif |
lib/libc/include/generic-freebsd/rpc/rpc.h-3| ... | ... | @@ -28,9 +28,6 @@ |
| 28 | 28 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
| 29 | 29 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
| 30 | 30 | * POSSIBILITY OF SUCH DAMAGE. |
| 31 | * | |
| 32 | *	from: @(#)rpc.h 1.9 88/02/08 SMI | |
| 33 | *	from: @(#)rpc.h	2.4 89/07/11 4.0 RPCSRC | |
| 34 | 31 | */ |
| 35 | 32 | |
| 36 | 33 | /* |
lib/libc/include/generic-freebsd/rpc/rpc_com.h-2| ... | ... | @@ -44,8 +44,6 @@ |
| 44 | 44 | |
| 45 | 45 | #include <sys/cdefs.h> |
| 46 | 46 | |
| 47 | /* #pragma ident	"@(#)rpc_com.h	1.11	93/07/05 SMI" */ | |
| 48 | ||
| 49 | 47 | /* |
| 50 | 48 | * The max size of the transport, if the size cannot be determined |
| 51 | 49 | * by other means. |
lib/libc/include/generic-freebsd/rpc/rpc_msg.h-3| ... | ... | @@ -28,9 +28,6 @@ |
| 28 | 28 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
| 29 | 29 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
| 30 | 30 | * POSSIBILITY OF SUCH DAMAGE. |
| 31 | * | |
| 32 | *	from: @(#)rpc_msg.h 1.7 86/07/16 SMI | |
| 33 | *	from: @(#)rpc_msg.h	2.1 88/07/29 4.0 RPCSRC | |
| 34 | 31 | */ |
| 35 | 32 | |
| 36 | 33 | /* |
lib/libc/include/generic-freebsd/rpc/rpcb_clnt.h-1| ... | ... | @@ -55,7 +55,6 @@ |
| 55 | 55 | #ifndef _RPC_RPCB_CLNT_H |
| 56 | 56 | #define	_RPC_RPCB_CLNT_H |
| 57 | 57 | |
| 58 | /* #pragma ident	"@(#)rpcb_clnt.h	1.13	94/04/25 SMI" */ | |
| 59 | 58 | /* rpcb_clnt.h 1.3 88/12/05 SMI */ |
| 60 | 59 | |
| 61 | 60 | #include <rpc/types.h> |
lib/libc/include/generic-freebsd/rpc/rpcb_prot.h-2| ... | ... | @@ -44,8 +44,6 @@ extern "C" { |
| 44 | 44 | */ |
| 45 | 45 | /* from rpcb_prot.x */ |
| 46 | 46 | |
| 47 | /* #pragma ident	"@(#)rpcb_prot.x	1.5	94/04/29 SMI" */ | |
| 48 | ||
| 49 | 47 | #ifndef _KERNEL |
| 50 | 48 | |
| 51 | 49 |
lib/libc/include/generic-freebsd/rpc/rpcb_prot.x-2| ... | ... | @@ -33,8 +33,6 @@ |
| 33 | 33 | |
| 34 | 34 | #ifdef RPC_HDR |
| 35 | 35 | % |
| 36 | %/* #pragma ident	"@(#)rpcb_prot.x	1.5	94/04/29 SMI" */ | |
| 37 | % | |
| 38 | 36 | %#ifndef _KERNEL |
| 39 | 37 | % |
| 40 | 38 | #endif |
lib/libc/include/generic-freebsd/rpc/rpcent.h-4| ... | ... | @@ -42,10 +42,6 @@ |
| 42 | 42 | #ifndef _RPC_RPCENT_H |
| 43 | 43 | #define _RPC_RPCENT_H |
| 44 | 44 | |
| 45 | /*	#pragma ident "@(#)rpcent.h 1.13 94/04/25 SMI"	*/ | |
| 46 | /* @(#)rpcent.h 1.1 88/12/06 SMI */ | |
| 47 | ||
| 48 | ||
| 49 | 45 | struct rpcent { |
| 50 | 46 | char *r_name; /* name of server for this rpc program */ |
| 51 | 47 | char **r_aliases; /* alias list */ |
lib/libc/include/generic-freebsd/rpc/rpcsec_tls.h+7-26| ... | ... | @@ -28,20 +28,8 @@ |
| 28 | 28 | #ifndef	_RPC_RPCSEC_TLS_H_ |
| 29 | 29 | #define	_RPC_RPCSEC_TLS_H_ |
| 30 | 30 | |
| 31 | /* Operation values for rpctls syscall. */ | |
| 32 | #define	RPCTLS_SYSC_CLSETPATH	1 | |
| 33 | #define	RPCTLS_SYSC_CLSOCKET	2 | |
| 34 | #define	RPCTLS_SYSC_CLSHUTDOWN	3 | |
| 35 | #define	RPCTLS_SYSC_SRVSETPATH	4 | |
| 36 | #define	RPCTLS_SYSC_SRVSOCKET	5 | |
| 37 | #define	RPCTLS_SYSC_SRVSHUTDOWN	6 | |
| 38 | #define	RPCTLS_SYSC_SRVSTARTUP	7 | |
| 39 | ||
| 40 | /* Max nprocs for SRV startup */ | |
| 41 | #define	RPCTLS_SRV_MAXNPROCS	16 | |
| 42 | ||
| 43 | /* System call used by the rpctlscd, rpctlssd daemons. */ | |
| 44 | int	rpctls_syscall(int, const char *); | |
| 31 | /* System call used by the rpc.tlsclntd(8), rpc.tlsservd(8) daemons. */ | |
| 32 | int	rpctls_syscall(uint64_t); | |
| 45 | 33 | |
| 46 | 34 | /* Flag bits to indicate certificate results. */ |
| 47 | 35 | #define	RPCTLS_FLAGS_HANDSHAKE	0x01 |
| ... | ... | @@ -61,15 +49,11 @@ int	rpctls_syscall(int, const char *); |
| 61 | 49 | #ifdef _KERNEL |
| 62 | 50 | /* Functions that perform upcalls to the rpctlsd daemon. */ |
| 63 | 51 | enum clnt_stat	rpctls_connect(CLIENT *newclient, char *certname, |
| 64 | 		 struct socket *so, uint64_t *sslp, uint32_t *reterr); | |
| 65 | enum clnt_stat	rpctls_cl_handlerecord(uint64_t sec, uint64_t usec, | |
| 66 | 		 uint64_t ssl, uint32_t *reterr); | |
| 67 | enum clnt_stat	rpctls_srv_handlerecord(uint64_t sec, uint64_t usec, | |
| 68 | 		 uint64_t ssl, int procpos, uint32_t *reterr); | |
| 69 | enum clnt_stat	rpctls_cl_disconnect(uint64_t sec, uint64_t usec, | |
| 70 | 		 uint64_t ssl, uint32_t *reterr); | |
| 71 | enum clnt_stat	rpctls_srv_disconnect(uint64_t sec, uint64_t usec, | |
| 72 | 		 uint64_t ssl, int procpos, uint32_t *reterr); | |
| 52 | 		 struct socket *so, uint32_t *reterr); | |
| 53 | enum clnt_stat	rpctls_cl_handlerecord(void *socookie, uint32_t *reterr); | |
| 54 | enum clnt_stat	rpctls_srv_handlerecord(void *socookie, uint32_t *reterr); | |
| 55 | enum clnt_stat	rpctls_cl_disconnect(void *socookie, uint32_t *reterr); | |
| 56 | enum clnt_stat	rpctls_srv_disconnect(void *socookie, uint32_t *reterr); | |
| 73 | 57 | |
| 74 | 58 | /* Initialization function for rpcsec_tls. */ |
| 75 | 59 | int		rpctls_init(void); |
| ... | ... | @@ -81,9 +65,6 @@ bool		rpctls_getinfo(u_int *maxlen, bool rpctlscd_run, |
| 81 | 65 | /* String for AUTH_TLS reply verifier. */ |
| 82 | 66 | #define	RPCTLS_START_STRING	"STARTTLS" |
| 83 | 67 | |
| 84 | /* ssl refno value to indicate TLS handshake being done. */ | |
| 85 | #define	RPCTLS_REFNO_HANDSHAKE	0xFFFFFFFFFFFFFFFFULL | |
| 86 | ||
| 87 | 68 | /* Macros for VIMAGE. */ |
| 88 | 69 | /* Just define the KRPC_VNETxxx() macros as VNETxxx() macros. */ |
| 89 | 70 | #define	KRPC_VNET_NAME(n)		VNET_NAME(n) |
lib/libc/include/generic-freebsd/rpc/svc.h+13-3| ... | ... | @@ -28,9 +28,6 @@ |
| 28 | 28 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
| 29 | 29 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
| 30 | 30 | * POSSIBILITY OF SUCH DAMAGE. |
| 31 | * | |
| 32 | *	from: @(#)svc.h 1.35 88/12/17 SMI | |
| 33 | *	from: @(#)svc.h 1.27 94/04/25 SMI | |
| 34 | 31 | */ |
| 35 | 32 | |
| 36 | 33 | /* |
| ... | ... | @@ -458,6 +455,19 @@ extern SVCXPRT *svc_fd_create(const int, const u_int, const u_int); |
| 458 | 455 | */ |
| 459 | 456 | extern SVCXPRT *svcunixfd_create(int, u_int, u_int); |
| 460 | 457 | |
| 458 | /* | |
| 459 | * netlink(4) server creation. To be used to service requests that | |
| 460 | * originate from an in-kernel client. | |
| 461 | */ | |
| 462 | extern SVCXPRT *svc_nl_create(const char *); | |
| 463 | ||
| 464 | /* | |
| 465 | * Arguments to SVC_CONTROL(svc_nl) | |
| 466 | */ | |
| 467 | enum { | |
| 468 | 	SVCNL_GET_XIDKEY = 1,	/* obtain pthread specific key for xid */ | |
| 469 | }; | |
| 470 | ||
| 461 | 471 | /* |
| 462 | 472 | * Memory based rpc (for speed check and testing) |
| 463 | 473 | */ |
lib/libc/include/generic-freebsd/rpc/svc_auth.h-3| ... | ... | @@ -28,9 +28,6 @@ |
| 28 | 28 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
| 29 | 29 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
| 30 | 30 | * POSSIBILITY OF SUCH DAMAGE. |
| 31 | * | |
| 32 | *	from: @(#)svc_auth.h 1.6 86/07/16 SMI | |
| 33 | *	@(#)svc_auth.h	2.1 88/07/29 4.0 RPCSRC | |
| 34 | 31 | */ |
| 35 | 32 | |
| 36 | 33 | /* |
lib/libc/include/generic-freebsd/rpc/svc_soc.h-1| ... | ... | @@ -41,7 +41,6 @@ |
| 41 | 41 | #define _RPC_SVC_SOC_H |
| 42 | 42 | #include <sys/cdefs.h> |
| 43 | 43 | |
| 44 | /* #pragma ident "@(#)svc_soc.h 1.11 94/04/25 SMI" */ | |
| 45 | 44 | /* svc_soc.h 1.8 89/05/01 SMI */ |
| 46 | 45 | |
| 47 | 46 | /* |
lib/libc/include/generic-freebsd/rpc/types.h-3| ... | ... | @@ -28,9 +28,6 @@ |
| 28 | 28 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
| 29 | 29 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
| 30 | 30 | * POSSIBILITY OF SUCH DAMAGE. |
| 31 | * | |
| 32 | *	from: @(#)types.h 1.18 87/07/24 SMI | |
| 33 | *	from: @(#)types.h	2.3 88/08/15 4.0 RPCSRC | |
| 34 | 31 | */ |
| 35 | 32 | |
| 36 | 33 | /* |
lib/libc/include/generic-freebsd/rpc/xdr.h-3| ... | ... | @@ -28,9 +28,6 @@ |
| 28 | 28 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
| 29 | 29 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
| 30 | 30 | * POSSIBILITY OF SUCH DAMAGE. |
| 31 | * | |
| 32 | *	from: @(#)xdr.h 1.19 87/04/22 SMI | |
| 33 | *	from: @(#)xdr.h	2.2 88/07/29 4.0 RPCSRC | |
| 34 | 31 | */ |
| 35 | 32 | |
| 36 | 33 | /* |
lib/libc/include/generic-freebsd/rpcsvc/bootparam_prot.x-6| ... | ... | @@ -45,12 +45,6 @@ |
| 45 | 45 | %#include <sys/errno.h> |
| 46 | 46 | %#include <sys/param.h> |
| 47 | 47 | %#include <sys/syslimits.h> |
| 48 | #else | |
| 49 | %#ifndef lint | |
| 50 | %/*static char sccsid[] = "from: @(#)bootparam_prot.x 1.2 87/06/24 Copyr 1987 Sun Micro";*/ | |
| 51 | %/*static char sccsid[] = "from: @(#)bootparam_prot.x	2.1 88/08/01 4.0 RPCSRC";*/ | |
| 52 | %#endif /* not lint */ | |
| 53 | %#include <sys/cdefs.h> | |
| 54 | 48 | #endif |
| 55 | 49 | |
| 56 | 50 | const MAX_MACHINE_NAME = 255; |
lib/libc/include/generic-freebsd/rpcsvc/crypt.x-4| ... | ... | @@ -30,10 +30,6 @@ |
| 30 | 30 | * SUCH DAMAGE. |
| 31 | 31 | */ |
| 32 | 32 | |
| 33 | #ifndef RPC_HDR | |
| 34 | %#include <sys/cdefs.h> | |
| 35 | #endif | |
| 36 | ||
| 37 | 33 | /* |
| 38 | 34 | * This protocol definition exists because of the U.S. government and |
| 39 | 35 | * its stupid export laws. We can't export DES code from the United |
lib/libc/include/generic-freebsd/rpcsvc/key_prot.h-4| ... | ... | @@ -42,10 +42,6 @@ extern "C" { |
| 42 | 42 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 43 | 43 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 44 | 44 | */ |
| 45 | /* From: #pragma ident	"@(#)key_prot.x	1.7	94/04/29 SMI" */ | |
| 46 | /* Copyright (c) 1990, 1991 Sun Microsystems, Inc. */ | |
| 47 | #include <sys/cdefs.h> | |
| 48 | ||
| 49 | 45 | /* |
| 50 | 46 | * Compiled from key_prot.x using rpcgen. |
| 51 | 47 | * DO NOT EDIT THIS FILE! |
lib/libc/include/generic-freebsd/rpcsvc/key_prot.x-4| ... | ... | @@ -45,10 +45,6 @@ |
| 45 | 45 | * requirements. |
| 46 | 46 | */ |
| 47 | 47 | |
| 48 | %/* From: #pragma ident	"@(#)key_prot.x	1.7	94/04/29 SMI" */ | |
| 49 | %/* Copyright (c) 1990, 1991 Sun Microsystems, Inc. */ | |
| 50 | %#include <sys/cdefs.h> | |
| 51 | % | |
| 52 | 48 | %/* |
| 53 | 49 | % * Compiled from key_prot.x using rpcgen. |
| 54 | 50 | % * DO NOT EDIT THIS FILE! |
lib/libc/include/generic-freebsd/rpcsvc/klm_prot.x-8| ... | ... | @@ -38,14 +38,6 @@ |
| 38 | 38 | * above the kernel. |
| 39 | 39 | */ |
| 40 | 40 | |
| 41 | #ifndef RPC_HDR | |
| 42 | %#ifndef lint | |
| 43 | %/*static char sccsid[] = "from: @(#)klm_prot.x 1.7 87/07/08 Copyr 1987 Sun Micro";*/ | |
| 44 | %/*static char sccsid[] = "from: @(#)klm_prot.x	2.1 88/08/01 4.0 RPCSRC";*/ | |
| 45 | %#endif /* not lint */ | |
| 46 | %#include <sys/cdefs.h> | |
| 47 | #endif | |
| 48 | ||
| 49 | 41 | const	LM_MAXSTRLEN = 1024; |
| 50 | 42 | |
| 51 | 43 | /* |
lib/libc/include/generic-freebsd/rpcsvc/mount.x-8| ... | ... | @@ -33,14 +33,6 @@ |
| 33 | 33 | * Protocol description for the mount program |
| 34 | 34 | */ |
| 35 | 35 | |
| 36 | #ifndef RPC_HDR | |
| 37 | %#ifndef lint | |
| 38 | %/*static char sccsid[] = "from: @(#)mount.x 1.2 87/09/18 Copyr 1987 Sun Micro";*/ | |
| 39 | %/*static char sccsid[] = "from: @(#)mount.x	2.1 88/08/01 4.0 RPCSRC";*/ | |
| 40 | %#endif /* not lint */ | |
| 41 | %#include <sys/cdefs.h> | |
| 42 | #endif | |
| 43 | ||
| 44 | 36 | const MNTPATHLEN = 1024;	/* maximum bytes in a pathname argument */ |
| 45 | 37 | const MNTNAMLEN = 255;		/* maximum bytes in a name argument */ |
| 46 | 38 | const FHSIZE = 32;		/* size in bytes of a file handle */ |
lib/libc/include/generic-freebsd/rpcsvc/nfs_prot.x-8| ... | ... | @@ -29,14 +29,6 @@ |
| 29 | 29 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 30 | 30 | */ |
| 31 | 31 | |
| 32 | #ifndef RPC_HDR | |
| 33 | %#ifndef lint | |
| 34 | %/*static char sccsid[] = "from: @(#)nfs_prot.x 1.2 87/10/12 Copyr 1987 Sun Micro";*/ | |
| 35 | %/*static char sccsid[] = "from: @(#)nfs_prot.x	2.1 88/08/01 4.0 RPCSRC";*/ | |
| 36 | %#endif /* not lint */ | |
| 37 | %#include <sys/cdefs.h> | |
| 38 | #endif | |
| 39 | ||
| 40 | 32 | const NFS_PORT = 2049; |
| 41 | 33 | const NFS_MAXDATA = 8192; |
| 42 | 34 | const NFS_MAXPATHLEN = 1024; |
lib/libc/include/generic-freebsd/rpcsvc/nis.x-5| ... | ... | @@ -29,12 +29,7 @@ |
| 29 | 29 | % * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 30 | 30 | % */ |
| 31 | 31 | |
| 32 | #ifndef RPC_HDR | |
| 33 | %#include <sys/cdefs.h> | |
| 34 | #endif | |
| 35 | ||
| 36 | 32 | /* |
| 37 | * From 4.1 : @(#)nis.x	1.61 Copyright 1989 Sun Microsystems | |
| 38 | 33 | * |
| 39 | 34 | * RPC Language Protocol description file for NIS Plus |
| 40 | 35 | * This version : 1.61 |
lib/libc/include/generic-freebsd/rpcsvc/nis_cache.x-6| ... | ... | @@ -35,12 +35,6 @@ |
| 35 | 35 | *	All Rights Reserved. |
| 36 | 36 | */ |
| 37 | 37 | |
| 38 | /* From: %#pragma ident	"@(#)nis_cache.x	1.11	94/05/03 SMI" */ | |
| 39 | ||
| 40 | #ifndef RPC_HDR | |
| 41 | %#include <sys/cdefs.h> | |
| 42 | #endif | |
| 43 | ||
| 44 | 38 | #ifdef RPC_HDR |
| 45 | 39 | %#include <rpc/types.h> |
| 46 | 40 | %#include <rpcsvc/nis.h> |
lib/libc/include/generic-freebsd/rpcsvc/nis_callback.x-7| ... | ... | @@ -36,14 +36,7 @@ |
| 36 | 36 | *	All Rights Reserved. |
| 37 | 37 | */ |
| 38 | 38 | |
| 39 | /* From: %#pragma ident	"@(#)nis_callback.x	1.7	94/05/03 SMI" */ | |
| 40 | ||
| 41 | #ifndef RPC_HDR | |
| 42 | %#include <sys/cdefs.h> | |
| 43 | #endif | |
| 44 | ||
| 45 | 39 | /* |
| 46 | * "@(#)zns_cback.x 1.2 90/09/10 Copyr 1990 Sun Micro" | |
| 47 | 40 | * |
| 48 | 41 | * RPCL description of the Callback Service. |
| 49 | 42 | */ |
lib/libc/include/generic-freebsd/rpcsvc/nis_db.h-2| ... | ... | @@ -42,8 +42,6 @@ |
| 42 | 42 | #define	_RPCSVC_NIS_DB_H |
| 43 | 43 | |
| 44 | 44 | |
| 45 | /* From: #pragma ident	"@(#)nis_db.h	1.8	94/05/03 SMI" */ | |
| 46 | ||
| 47 | 45 | /* |
| 48 | 46 | * Note: although the version of <rpcsvc/nis_db.h> shipped with Solaris |
| 49 | 47 | * 2.5/2.5.x is actually older than this one (according to the ident |
lib/libc/include/generic-freebsd/rpcsvc/nis_object.x-2| ... | ... | @@ -36,8 +36,6 @@ |
| 36 | 36 | *	All Rights Reserved. |
| 37 | 37 | */ |
| 38 | 38 | |
| 39 | /* From: %#pragma ident	"@(#)nis_object.x	1.10	94/05/03 SMI" */ | |
| 40 | ||
| 41 | 39 | #if RPC_HDR |
| 42 | 40 | % |
| 43 | 41 | %#ifndef __nis_object_h |
lib/libc/include/generic-freebsd/rpcsvc/nis_tags.h-1| ... | ... | @@ -45,7 +45,6 @@ |
| 45 | 45 | #ifndef	_RPCSVC_NIS_TAGS_H |
| 46 | 46 | #define	_RPCSVC_NIS_TAGS_H |
| 47 | 47 | |
| 48 | /* From: #pragma ident	"@(#)nis_tags.h	1.10	94/05/03 SMI" */ | |
| 49 | 48 | /* from file: zns_tags.h	1.7 Copyright (c) 1990 Sun Microsystems */ |
| 50 | 49 | |
| 51 | 50 | #ifdef	__cplusplus |
lib/libc/include/generic-freebsd/rpcsvc/nislib.h-2| ... | ... | @@ -39,8 +39,6 @@ |
| 39 | 39 | #ifndef	_RPCSVC_NISLIB_H |
| 40 | 40 | #define	_RPCSVC_NISLIB_H |
| 41 | 41 | |
| 42 | /* From: #pragma ident	"@(#)nislib.h	1.16	94/05/03 SMI" */ | |
| 43 | ||
| 44 | 42 | #ifdef __cplusplus |
| 45 | 43 | extern "C" { |
| 46 | 44 | #endif |
lib/libc/include/generic-freebsd/rpcsvc/nlm_prot.x+1-7| ... | ... | @@ -8,14 +8,8 @@ |
| 8 | 8 | #ifdef RPC_HDR |
| 9 | 9 | %#define LM_MAXSTRLEN	1024 |
| 10 | 10 | %#define MAXNAMELEN	LM_MAXSTRLEN+1 |
| 11 | #else | |
| 12 | %#include <sys/cdefs.h> | |
| 13 | %#ifndef lint | |
| 14 | %/*static char sccsid[] = "from: @(#)nlm_prot.x 1.8 87/09/21 Copyr 1987 Sun Micro";*/ | |
| 15 | %/*static char sccsid[] = "from: * @(#)nlm_prot.x	2.1 88/08/01 4.0 RPCSRC";*/ | |
| 16 | %__RCSID("$NetBSD: nlm_prot.x,v 1.6 2000/06/07 14:30:15 bouyer Exp $"); | |
| 17 | %#endif /* not lint */ | |
| 18 | 11 | #endif |
| 12 | /* $NetBSD: nlm_prot.x,v 1.6 2000/06/07 14:30:15 bouyer Exp $ */ | |
| 19 | 13 | |
| 20 | 14 | /* |
| 21 | 15 | * status of a call to the lock manager |
lib/libc/include/generic-freebsd/rpcsvc/rex.x-8| ... | ... | @@ -33,14 +33,6 @@ |
| 33 | 33 | * Remote execution (rex) protocol specification |
| 34 | 34 | */ |
| 35 | 35 | |
| 36 | #ifndef RPC_HDR | |
| 37 | %#ifndef lint | |
| 38 | %/*static char sccsid[] = "from: @(#)rex.x 1.3 87/09/18 Copyr 1987 Sun Micro";*/ | |
| 39 | %/*static char sccsid[] = "from: @(#)rex.x	2.1 88/08/01 4.0 RPCSRC";*/ | |
| 40 | %#endif /* not lint */ | |
| 41 | %#include <sys/cdefs.h> | |
| 42 | #endif | |
| 43 | ||
| 44 | 36 | const STRINGSIZE = 1024; |
| 45 | 37 | typedef string rexstring<1024>; |
| 46 | 38 |
lib/libc/include/generic-freebsd/rpcsvc/rnusers.x-8| ... | ... | @@ -33,14 +33,6 @@ |
| 33 | 33 | * Find out about remote users |
| 34 | 34 | */ |
| 35 | 35 | |
| 36 | #ifndef RPC_HDR | |
| 37 | %#ifndef lint | |
| 38 | %/*static char sccsid[] = "from: @(#)rnusers.x 1.2 87/09/20 Copyr 1987 Sun Micro";*/ | |
| 39 | %/*static char sccsid[] = "from: @(#)rnusers.x	2.1 88/08/01 4.0 RPCSRC";*/ | |
| 40 | %#endif /* not lint */ | |
| 41 | %#include <sys/cdefs.h> | |
| 42 | #endif | |
| 43 | ||
| 44 | 36 | const MAXUSERS = 100; |
| 45 | 37 | const MAXUTLEN = 256; |
| 46 | 38 |
lib/libc/include/generic-freebsd/rpcsvc/rquota.x-7| ... | ... | @@ -1,15 +1,8 @@ |
| 1 | /* @(#)rquota.x	2.1 88/08/01 4.0 RPCSRC */ | |
| 2 | /* @(#)rquota.x 1.2 87/09/20 Copyr 1987 Sun Micro */ | |
| 3 | ||
| 4 | 1 | /* |
| 5 | 2 | * Remote quota protocol |
| 6 | 3 | * Requires unix authentication |
| 7 | 4 | */ |
| 8 | 5 | |
| 9 | #ifndef RPC_HDR | |
| 10 | %#include <sys/cdefs.h> | |
| 11 | #endif | |
| 12 | ||
| 13 | 6 | const RQ_PATHLEN = 1024; |
| 14 | 7 | |
| 15 | 8 | struct sq_dqblk { |
lib/libc/include/generic-freebsd/rpcsvc/rstat.x-7| ... | ... | @@ -44,13 +44,6 @@ |
| 44 | 44 | % |
| 45 | 45 | %#endif /* ndef FSCALE */ |
| 46 | 46 | |
| 47 | #else | |
| 48 | ||
| 49 | %#ifndef lint | |
| 50 | %/*static char sccsid[] = "from: @(#)rstat.x 1.2 87/09/18 Copyr 1987 Sun Micro";*/ | |
| 51 | %/*static char sccsid[] = "from: @(#)rstat.x	2.2 88/08/01 4.0 RPCSRC";*/ | |
| 52 | %#endif /* not lint */ | |
| 53 | %#include <sys/cdefs.h> | |
| 54 | 47 | #endif /* def RPC_HDR */ |
| 55 | 48 | |
| 56 | 49 | const RSTAT_CPUSTATES = 4; |
lib/libc/include/generic-freebsd/rpcsvc/rwall.h-2| ... | ... | @@ -45,8 +45,6 @@ extern "C" { |
| 45 | 45 | * Copyright (c) 1984, 1990 by Sun Microsystems, Inc. |
| 46 | 46 | */ |
| 47 | 47 | |
| 48 | /* from @(#)rwall.x	1.6 91/03/11 TIRPC 1.0 */ | |
| 49 | ||
| 50 | 48 | #ifndef _rpcsvc_rwall_h |
| 51 | 49 | #define _rpcsvc_rwall_h |
| 52 | 50 |
lib/libc/include/generic-freebsd/rpcsvc/rwall.x-2| ... | ... | @@ -31,8 +31,6 @@ |
| 31 | 31 | %/* |
| 32 | 32 | % * Copyright (c) 1984, 1990 by Sun Microsystems, Inc. |
| 33 | 33 | % */ |
| 34 | % | |
| 35 | %/* from @(#)rwall.x	1.6 91/03/11 TIRPC 1.0 */ | |
| 36 | 34 | |
| 37 | 35 | #ifdef RPC_HDR |
| 38 | 36 | % |
lib/libc/include/generic-freebsd/rpcsvc/sm_inter.x-7| ... | ... | @@ -1,6 +1,3 @@ |
| 1 | /* @(#)sm_inter.x	2.2 88/08/01 4.0 RPCSRC */ | |
| 2 | /* @(#)sm_inter.x 1.7 87/06/24 Copyr 1987 Sun Micro */ | |
| 3 | ||
| 4 | 1 | /*- |
| 5 | 2 | * Copyright (c) 2010, Oracle America, Inc. |
| 6 | 3 | * |
| ... | ... | @@ -38,10 +35,6 @@ |
| 38 | 35 | * |
| 39 | 36 | */ |
| 40 | 37 | |
| 41 | #ifndef RPC_HDR | |
| 42 | %#include <sys/cdefs.h> | |
| 43 | #endif | |
| 44 | ||
| 45 | 38 | program SM_PROG { |
| 46 | 39 | 	version SM_VERS { |
| 47 | 40 | 		/* res_stat = stat_succ if status monitor agrees to monitor */ |
lib/libc/include/generic-freebsd/rpcsvc/spray.x-8| ... | ... | @@ -34,14 +34,6 @@ |
| 34 | 34 | * Useful for testing flakiness of network interfaces |
| 35 | 35 | */ |
| 36 | 36 | |
| 37 | #ifndef RPC_HDR | |
| 38 | %#ifndef lint | |
| 39 | %/*static char sccsid[] = "from: @(#)spray.x 1.2 87/09/18 Copyr 1987 Sun Micro";*/ | |
| 40 | %/*static char sccsid[] = "from: @(#)spray.x	2.1 88/08/01 4.0 RPCSRC";*/ | |
| 41 | %#endif /* not lint */ | |
| 42 | %#include <sys/cdefs.h> | |
| 43 | #endif | |
| 44 | ||
| 45 | 37 | const SPRAYMAX = 8845;	/* max amount can spray */ |
| 46 | 38 | |
| 47 | 39 | /* |
lib/libc/include/generic-freebsd/rpcsvc/yp.x-6| ... | ... | @@ -1,5 +1,3 @@ |
| 1 | /* @(#)yp.x	2.1 88/08/01 4.0 RPCSRC */ | |
| 2 | ||
| 3 | 1 | /*- |
| 4 | 2 | * Copyright (c) 2010, Oracle America, Inc. |
| 5 | 3 | * |
| ... | ... | @@ -35,10 +33,6 @@ |
| 35 | 33 | * Protocol description file for the Yellow Pages Service |
| 36 | 34 | */ |
| 37 | 35 | |
| 38 | #ifndef RPC_HDR | |
| 39 | %#include <sys/cdefs.h> | |
| 40 | #endif | |
| 41 | ||
| 42 | 36 | const YPMAXRECORD = 16777216; |
| 43 | 37 | const YPMAXDOMAIN = 64; |
| 44 | 38 | const YPMAXMAP = 64; |
lib/libc/include/generic-freebsd/rpcsvc/yp_prot.h+1-1| ... | ... | @@ -271,7 +271,7 @@ struct ypbind_setdom { |
| 271 | 271 | * |
| 272 | 272 | * Sun says: |
| 273 | 273 | * "Protocol between clients (ypxfr, only) and yppush |
| 274 | * yppush speaks a protocol in the transient range, which | |
| 274 | * speaks a protocol in the transient range, which | |
| 275 | 275 | * is supplied to ypxfr as a command-line parameter when it |
| 276 | 276 | * is activated by ypserv." |
| 277 | 277 | * |
lib/libc/include/generic-freebsd/rpcsvc/yppasswd.x-8| ... | ... | @@ -34,14 +34,6 @@ |
| 34 | 34 | * Requires unix authentication |
| 35 | 35 | */ |
| 36 | 36 | |
| 37 | #ifndef RPC_HDR | |
| 38 | %#ifndef lint | |
| 39 | %/*static char sccsid[] = "from: @(#)yppasswd.x 1.1 87/04/13 Copyr 1987 Sun Micro";*/ | |
| 40 | %/*static char sccsid[] = "from: @(#)yppasswd.x	2.1 88/08/01 4.0 RPCSRC";*/ | |
| 41 | %#endif /* not lint */ | |
| 42 | %#include <sys/cdefs.h> | |
| 43 | #endif | |
| 44 | ||
| 45 | 37 | program YPPASSWDPROG { |
| 46 | 38 | 	version YPPASSWDVERS { |
| 47 | 39 | 		/* |
lib/libc/include/generic-freebsd/rpcsvc/ypupdate_prot.h-1| ... | ... | @@ -45,7 +45,6 @@ extern "C" { |
| 45 | 45 | * Copyright (c) 1986, 1990 by Sun Microsystems, Inc. |
| 46 | 46 | */ |
| 47 | 47 | |
| 48 | /* from @(#)ypupdate_prot.x	1.3 91/03/11 TIRPC 1.0 */ | |
| 49 | 48 | |
| 50 | 49 | /* |
| 51 | 50 | * Compiled from ypupdate_prot.x using rpcgen |
lib/libc/include/generic-freebsd/rpcsvc/ypupdate_prot.x-1| ... | ... | @@ -32,7 +32,6 @@ |
| 32 | 32 | % * Copyright (c) 1986, 1990 by Sun Microsystems, Inc. |
| 33 | 33 | % */ |
| 34 | 34 | % |
| 35 | %/* from @(#)ypupdate_prot.x	1.3 91/03/11 TIRPC 1.0 */ | |
| 36 | 35 | #ifndef RPC_HDR |
| 37 | 36 | %#include <sys/cdefs.h> |
| 38 | 37 | #endif |
lib/libc/include/generic-freebsd/runetype.h-2| ... | ... | @@ -30,8 +30,6 @@ |
| 30 | 30 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 31 | 31 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 32 | 32 | * SUCH DAMAGE. |
| 33 | * | |
| 34 | *	@(#)runetype.h	8.1 (Berkeley) 6/2/93 | |
| 35 | 33 | */ |
| 36 | 34 | |
| 37 | 35 | #ifndef	_RUNETYPE_H_ |
lib/libc/include/generic-freebsd/sched.h-1| ... | ... | @@ -29,7 +29,6 @@ |
| 29 | 29 | #ifndef __SCHED_H__ |
| 30 | 30 | #define __SCHED_H__ |
| 31 | 31 | |
| 32 | #include <sys/cdefs.h> | |
| 33 | 32 | #include <sys/types.h> |
| 34 | 33 | #include <sys/sched.h> |
| 35 | 34 | #if __BSD_VISIBLE |
lib/libc/include/generic-freebsd/security/audit/audit.h+439-303| ... | ... | @@ -1,19 +1,18 @@ |
| 1 | 1 | /*- |
| 2 | 2 | * SPDX-License-Identifier: BSD-3-Clause |
| 3 | 3 | * |
| 4 | * Copyright (c) 2005-2009 Apple Inc. | |
| 5 | * Copyright (c) 2016 Robert N. M. Watson | |
| 4 | * Copyright (c) 1999-2005 Apple Inc. | |
| 5 | * Copyright (c) 2016-2018 Robert N. M. Watson | |
| 6 | 6 | * All rights reserved. |
| 7 | 7 | * |
| 8 | * Portions of this software were developed by BAE Systems, the University of | |
| 9 | * Cambridge Computer Laboratory, and Memorial University under DARPA/AFRL | |
| 10 | * contract FA8650-15-C-7558 ("CADETS"), as part of the DARPA Transparent | |
| 11 | * Computing (TC) research program. | |
| 8 | * This software was developed by BAE Systems, the University of Cambridge | |
| 9 | * Computer Laboratory, and Memorial University under DARPA/AFRL contract | |
| 10 | * FA8650-15-C-7558 ("CADETS"), as part of the DARPA Transparent Computing | |
| 11 | * (TC) research program. | |
| 12 | 12 | * |
| 13 | 13 | * Redistribution and use in source and binary forms, with or without |
| 14 | 14 | * modification, are permitted provided that the following conditions |
| 15 | 15 | * are met: |
| 16 | * | |
| 17 | 16 | * 1. Redistributions of source code must retain the above copyright |
| 18 | 17 | * notice, this list of conditions and the following disclaimer. |
| 19 | 18 | * 2. Redistributions in binary form must reproduce the above copyright |
| ... | ... | @@ -23,323 +22,460 @@ |
| 23 | 22 | * its contributors may be used to endorse or promote products derived |
| 24 | 23 | * from this software without specific prior written permission. |
| 25 | 24 | * |
| 26 | * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY | |
| 27 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | |
| 28 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |
| 29 | * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY | |
| 30 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | |
| 31 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | |
| 32 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | |
| 33 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
| 34 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | |
| 35 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 36 | */ | |
| 37 | ||
| 38 | #ifndef	_BSM_AUDIT_H | |
| 39 | #define	_BSM_AUDIT_H | |
| 40 | ||
| 41 | #include <sys/param.h> | |
| 42 | #include <sys/types.h> | |
| 43 | ||
| 44 | #define	AUDIT_RECORD_MAGIC	0x828a0f1b | |
| 45 | #define	MAX_AUDIT_RECORDS	20 | |
| 46 | #define	MAXAUDITDATA		(0x8000 - 1) | |
| 47 | #define	MAX_AUDIT_RECORD_SIZE	MAXAUDITDATA | |
| 48 | #define	MIN_AUDIT_FILE_SIZE	(512 * 1024) | |
| 49 | ||
| 50 | /* | |
| 51 | * Minimum noumber of free blocks on the filesystem containing the audit | |
| 52 | * log necessary to avoid a hard log rotation. DO NOT SET THIS VALUE TO 0 | |
| 53 | * as the kernel does an unsigned compare, plus we want to leave a few blocks | |
| 54 | * free so userspace can terminate the log, etc. | |
| 55 | */ | |
| 56 | #define	AUDIT_HARD_LIMIT_FREE_BLOCKS	4 | |
| 57 | ||
| 58 | /* | |
| 59 | * Triggers for the audit daemon. | |
| 25 | * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND | |
| 26 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 27 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
| 28 | * ARE DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR | |
| 29 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
| 30 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
| 31 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
| 32 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | |
| 33 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING | |
| 34 | * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
| 35 | * POSSIBILITY OF SUCH DAMAGE. | |
| 60 | 36 | */ |
| 61 | #define	AUDIT_TRIGGER_MIN		1 | |
| 62 | #define	AUDIT_TRIGGER_LOW_SPACE		1	/* Below low watermark. */ | |
| 63 | #define	AUDIT_TRIGGER_ROTATE_KERNEL	2	/* Kernel requests rotate. */ | |
| 64 | #define	AUDIT_TRIGGER_READ_FILE		3	/* Re-read config file. */ | |
| 65 | #define	AUDIT_TRIGGER_CLOSE_AND_DIE	4	/* Terminate audit. */ | |
| 66 | #define	AUDIT_TRIGGER_NO_SPACE		5	/* Below min free space. */ | |
| 67 | #define	AUDIT_TRIGGER_ROTATE_USER	6	/* User requests rotate. */ | |
| 68 | #define	AUDIT_TRIGGER_INITIALIZE	7	/* User initialize of auditd. */ | |
| 69 | #define	AUDIT_TRIGGER_EXPIRE_TRAILS	8	/* User expiration of trails. */ | |
| 70 | #define	AUDIT_TRIGGER_MAX		8 | |
| 71 | 37 | |
| 72 | 38 | /* |
| 73 | * The special device filename (FreeBSD). | |
| 39 | * This header includes function prototypes and type definitions that are | |
| 40 | * necessary for the kernel as a whole to interact with the audit subsystem. | |
| 74 | 41 | */ |
| 75 | #define	AUDITDEV_FILENAME	"audit" | |
| 76 | #define	AUDIT_TRIGGER_FILE	("/dev/" AUDITDEV_FILENAME) | |
| 77 | 42 | |
| 78 | /* | |
| 79 | * Pre-defined audit IDs | |
| 80 | */ | |
| 81 | #define	AU_DEFAUDITID	(uid_t)(-1) | |
| 82 | #define	AU_DEFAUDITSID	 0 | |
| 83 | #define	AU_ASSIGN_ASID	-1 | |
| 43 | #ifndef _SECURITY_AUDIT_KERNEL_H_ | |
| 44 | #define	_SECURITY_AUDIT_KERNEL_H_ | |
| 84 | 45 | |
| 85 | /* | |
| 86 | * IPC types. | |
| 87 | */ | |
| 88 | #define	AT_IPC_MSG	((u_char)1)	/* Message IPC id. */ | |
| 89 | #define	AT_IPC_SEM	((u_char)2)	/* Semaphore IPC id. */ | |
| 90 | #define	AT_IPC_SHM	((u_char)3)	/* Shared mem IPC id. */ | |
| 46 | #ifndef _KERNEL | |
| 47 | #error "no user-serviceable parts inside" | |
| 48 | #endif | |
| 91 | 49 | |
| 92 | /* | |
| 93 | * Audit conditions. | |
| 94 | */ | |
| 95 | #define	AUC_UNSET		0 | |
| 96 | #define	AUC_AUDITING		1 | |
| 97 | #define	AUC_NOAUDIT		2 | |
| 98 | #define	AUC_DISABLED		-1 | |
| 50 | #include <bsm/audit.h> | |
| 99 | 51 | |
| 100 | /* | |
| 101 | * auditon(2) commands. | |
| 102 | */ | |
| 103 | #define	A_OLDGETPOLICY	2 | |
| 104 | #define	A_OLDSETPOLICY	3 | |
| 105 | #define	A_GETKMASK	4 | |
| 106 | #define	A_SETKMASK	5 | |
| 107 | #define	A_OLDGETQCTRL	6 | |
| 108 | #define	A_OLDSETQCTRL	7 | |
| 109 | #define	A_GETCWD	8 | |
| 110 | #define	A_GETCAR	9 | |
| 111 | #define	A_GETSTAT	12 | |
| 112 | #define	A_SETSTAT	13 | |
| 113 | #define	A_SETUMASK	14 | |
| 114 | #define	A_SETSMASK	15 | |
| 115 | #define	A_OLDGETCOND	20 | |
| 116 | #define	A_OLDSETCOND	21 | |
| 117 | #define	A_GETCLASS	22 | |
| 118 | #define	A_SETCLASS	23 | |
| 119 | #define	A_GETPINFO	24 | |
| 120 | #define	A_SETPMASK	25 | |
| 121 | #define	A_SETFSIZE	26 | |
| 122 | #define	A_GETFSIZE	27 | |
| 123 | #define	A_GETPINFO_ADDR	28 | |
| 124 | #define	A_GETKAUDIT	29 | |
| 125 | #define	A_SETKAUDIT	30 | |
| 126 | #define	A_SENDTRIGGER	31 | |
| 127 | #define	A_GETSINFO_ADDR	32 | |
| 128 | #define	A_GETPOLICY	33 | |
| 129 | #define	A_SETPOLICY	34 | |
| 130 | #define	A_GETQCTRL	35 | |
| 131 | #define	A_SETQCTRL	36 | |
| 132 | #define	A_GETCOND	37 | |
| 133 | #define	A_SETCOND	38 | |
| 134 | #define	A_GETEVENT	39	/* Get audit event-to-name mapping. */ | |
| 135 | #define	A_SETEVENT	40	/* Set audit event-to-name mapping. */ | |
| 52 | #include <sys/file.h> | |
| 53 | #include <sys/sysctl.h> | |
| 136 | 54 | |
| 137 | 55 | /* |
| 138 | * Audit policy controls. | |
| 139 | */ | |
| 140 | #define	AUDIT_CNT	0x0001 | |
| 141 | #define	AUDIT_AHLT	0x0002 | |
| 142 | #define	AUDIT_ARGV	0x0004 | |
| 143 | #define	AUDIT_ARGE	0x0008 | |
| 144 | #define	AUDIT_SEQ	0x0010 | |
| 145 | #define	AUDIT_WINDATA	0x0020 | |
| 146 | #define	AUDIT_USER	0x0040 | |
| 147 | #define	AUDIT_GROUP	0x0080 | |
| 148 | #define	AUDIT_TRAIL	0x0100 | |
| 149 | #define	AUDIT_PATH	0x0200 | |
| 150 | #define	AUDIT_SCNT	0x0400 | |
| 151 | #define	AUDIT_PUBLIC	0x0800 | |
| 152 | #define	AUDIT_ZONENAME	0x1000 | |
| 153 | #define	AUDIT_PERZONE	0x2000 | |
| 154 | ||
| 155 | /* | |
| 156 | * Default audit queue control parameters. | |
| 157 | */ | |
| 158 | #define	AQ_HIWATER	100 | |
| 159 | #define	AQ_MAXHIGH	10000 | |
| 160 | #define	AQ_LOWATER	10 | |
| 161 | #define	AQ_BUFSZ	MAXAUDITDATA | |
| 162 | #define	AQ_MAXBUFSZ	1048576 | |
| 163 | ||
| 164 | /* | |
| 165 | * Default minimum percentage free space on file system. | |
| 166 | */ | |
| 167 | #define	AU_FS_MINFREE	20 | |
| 168 | ||
| 169 | /* | |
| 170 | * Type definitions used indicating the length of variable length addresses | |
| 171 | * in tokens containing addresses, such as header fields. | |
| 172 | */ | |
| 173 | #define	AU_IPv4		4 | |
| 174 | #define	AU_IPv6		16 | |
| 175 | ||
| 176 | __BEGIN_DECLS | |
| 177 | ||
| 178 | typedef	uid_t		au_id_t; | |
| 179 | typedef	pid_t		au_asid_t; | |
| 180 | typedef	u_int16_t	au_event_t; | |
| 181 | typedef	u_int16_t	au_emod_t; | |
| 182 | typedef	u_int32_t	au_class_t; | |
| 183 | typedef	u_int64_t	au_asflgs_t __attribute__ ((aligned (8))); | |
| 184 | ||
| 185 | struct au_tid { | |
| 186 | 	u_int32_t	port;		/* XXX dev_t compatibility */ | |
| 187 | 	u_int32_t	machine; | |
| 188 | }; | |
| 189 | typedef	struct au_tid	au_tid_t; | |
| 190 | ||
| 191 | struct au_tid_addr { | |
| 192 | 	u_int32_t	at_port;	/* XXX dev_t compatibility */ | |
| 193 | 	u_int32_t	at_type; | |
| 194 | 	u_int32_t	at_addr[4]; | |
| 195 | }; | |
| 196 | typedef	struct au_tid_addr	au_tid_addr_t; | |
| 197 | ||
| 198 | struct au_mask { | |
| 199 | 	unsigned int am_success; /* Success bits. */ | |
| 200 | 	unsigned int am_failure; /* Failure bits. */ | |
| 201 | }; | |
| 202 | typedef	struct au_mask	au_mask_t; | |
| 203 | ||
| 204 | struct auditinfo { | |
| 205 | 	au_id_t		ai_auid;	/* Audit user ID. */ | |
| 206 | 	au_mask_t	ai_mask;	/* Audit masks. */ | |
| 207 | 	au_tid_t	ai_termid;	/* Terminal ID. */ | |
| 208 | 	au_asid_t	ai_asid;	/* Audit session ID. */ | |
| 209 | }; | |
| 210 | typedef	struct auditinfo	auditinfo_t; | |
| 211 | ||
| 212 | struct auditinfo_addr { | |
| 213 | 	au_id_t		ai_auid;	/* Audit user ID. */ | |
| 214 | 	au_mask_t	ai_mask;	/* Audit masks. */ | |
| 215 | 	au_tid_addr_t	ai_termid;	/* Terminal ID. */ | |
| 216 | 	au_asid_t	ai_asid;	/* Audit session ID. */ | |
| 217 | 	au_asflgs_t	ai_flags;	/* Audit session flags. */ | |
| 218 | }; | |
| 219 | typedef	struct auditinfo_addr	auditinfo_addr_t; | |
| 220 | ||
| 221 | struct auditpinfo { | |
| 222 | 	pid_t		ap_pid;		/* ID of target process. */ | |
| 223 | 	au_id_t		ap_auid;	/* Audit user ID. */ | |
| 224 | 	au_mask_t	ap_mask;	/* Audit masks. */ | |
| 225 | 	au_tid_t	ap_termid;	/* Terminal ID. */ | |
| 226 | 	au_asid_t	ap_asid;	/* Audit session ID. */ | |
| 227 | }; | |
| 228 | typedef	struct auditpinfo	auditpinfo_t; | |
| 229 | ||
| 230 | struct auditpinfo_addr { | |
| 231 | 	pid_t		ap_pid;		/* ID of target process. */ | |
| 232 | 	au_id_t		ap_auid;	/* Audit user ID. */ | |
| 233 | 	au_mask_t	ap_mask;	/* Audit masks. */ | |
| 234 | 	au_tid_addr_t	ap_termid;	/* Terminal ID. */ | |
| 235 | 	au_asid_t	ap_asid;	/* Audit session ID. */ | |
| 236 | 	au_asflgs_t	ap_flags;	/* Audit session flags. */ | |
| 237 | }; | |
| 238 | typedef	struct auditpinfo_addr	auditpinfo_addr_t; | |
| 239 | ||
| 240 | struct au_session { | |
| 241 | 	auditinfo_addr_t	*as_aia_p;	/* Ptr to full audit info. */ | |
| 242 | 	au_mask_t		 as_mask;	/* Process Audit Masks. */ | |
| 243 | }; | |
| 244 | typedef struct au_session au_session_t; | |
| 245 | ||
| 246 | /* | |
| 247 | * Contents of token_t are opaque outside of libbsm. | |
| 248 | */ | |
| 249 | typedef	struct au_token	token_t; | |
| 250 | ||
| 251 | /* | |
| 252 | * Kernel audit queue control parameters: | |
| 253 | * 			Default:		Maximum: | |
| 254 | * 	aq_hiwater:	AQ_HIWATER (100)	AQ_MAXHIGH (10000) | |
| 255 | * 	aq_lowater:	AQ_LOWATER (10)		<aq_hiwater | |
| 256 | * 	aq_bufsz:	AQ_BUFSZ (32767)	AQ_MAXBUFSZ (1048576) | |
| 257 | * 	aq_delay:	20			20000 (not used) | |
| 56 | * Audit subsystem condition flags. The audit_trail_enabled flag is set and | |
| 57 | * removed automatically as a result of configuring log files, and can be | |
| 58 | * observed but should not be directly manipulated. The audit suspension | |
| 59 | * flag permits audit to be temporarily disabled without reconfiguring the | |
| 60 | * audit target. | |
| 61 | * | |
| 62 | * As DTrace can also request system-call auditing, a further | |
| 63 | * audit_syscalls_enabled flag tracks whether newly entering system calls | |
| 64 | * should be considered for auditing or not. | |
| 65 | * | |
| 66 | * XXXRW: Move trail flags to audit_private.h, as they no longer need to be | |
| 67 | * visible outside the audit code...? | |
| 258 | 68 | */ |
| 259 | struct au_qctrl { | |
| 260 | 	int	aq_hiwater;	/* Max # of audit recs in queue when */ | |
| 261 | 				/* threads with new ARs get blocked. */ | |
| 69 | extern u_int	audit_dtrace_enabled; | |
| 70 | extern int	audit_trail_enabled; | |
| 71 | extern int	audit_trail_suspended; | |
| 72 | extern bool	audit_syscalls_enabled; | |
| 262 | 73 | |
| 263 | 	int	aq_lowater;	/* # of audit recs in queue when */ | |
| 264 | 				/* blocked threads get unblocked. */ | |
| 265 | ||
| 266 | 	int	aq_bufsz;	/* Max size of audit record for audit(2). */ | |
| 267 | 	int	aq_delay;	/* Queue delay (not used). */ | |
| 268 | 	int	aq_minfree;	/* Minimum filesystem percent free space. */ | |
| 269 | }; | |
| 270 | typedef	struct au_qctrl	au_qctrl_t; | |
| 271 | ||
| 272 | /* | |
| 273 | * Structure for the audit statistics. | |
| 274 | */ | |
| 275 | struct audit_stat { | |
| 276 | 	unsigned int	as_version; | |
| 277 | 	unsigned int	as_numevent; | |
| 278 | 	int		as_generated; | |
| 279 | 	int		as_nonattrib; | |
| 280 | 	int		as_kernel; | |
| 281 | 	int		as_audit; | |
| 282 | 	int		as_auditctl; | |
| 283 | 	int		as_enqueue; | |
| 284 | 	int		as_written; | |
| 285 | 	int		as_wblocked; | |
| 286 | 	int		as_rblocked; | |
| 287 | 	int		as_dropped; | |
| 288 | 	int		as_totalsize; | |
| 289 | 	unsigned int	as_memused; | |
| 290 | }; | |
| 291 | typedef	struct audit_stat	au_stat_t; | |
| 74 | void	 audit_syscall_enter(unsigned short code, struct thread *td); | |
| 75 | void	 audit_syscall_exit(int error, struct thread *td); | |
| 292 | 76 | |
| 293 | 77 | /* |
| 294 | * Structure for the audit file statistics. | |
| 78 | * The remaining kernel functions are conditionally compiled in as they are | |
| 79 | * wrapped by a macro, and the macro should be the only place in the source | |
| 80 | * tree where these functions are referenced. | |
| 295 | 81 | */ |
| 296 | struct audit_fstat { | |
| 297 | 	u_int64_t	af_filesz; | |
| 298 | 	u_int64_t	af_currsz; | |
| 299 | }; | |
| 300 | typedef	struct audit_fstat	au_fstat_t; | |
| 82 | #ifdef AUDIT | |
| 83 | struct ipc_perm; | |
| 84 | struct sockaddr; | |
| 85 | union auditon_udata; | |
| 86 | void	 audit_arg_addr(void * addr); | |
| 87 | void	 audit_arg_exit(int status, int retval); | |
| 88 | void	 audit_arg_len(int len); | |
| 89 | void	 audit_arg_atfd1(int atfd); | |
| 90 | void	 audit_arg_atfd2(int atfd); | |
| 91 | void	 audit_arg_fd(int fd); | |
| 92 | void	 audit_arg_fflags(int fflags); | |
| 93 | void	 audit_arg_gid(gid_t gid); | |
| 94 | void	 audit_arg_uid(uid_t uid); | |
| 95 | void	 audit_arg_egid(gid_t egid); | |
| 96 | void	 audit_arg_euid(uid_t euid); | |
| 97 | void	 audit_arg_rgid(gid_t rgid); | |
| 98 | void	 audit_arg_ruid(uid_t ruid); | |
| 99 | void	 audit_arg_sgid(gid_t sgid); | |
| 100 | void	 audit_arg_suid(uid_t suid); | |
| 101 | void	 audit_arg_groupset(gid_t *gidset, int gidset_size); | |
| 102 | void	 audit_arg_login(char *login); | |
| 103 | void	 audit_arg_ctlname(int *name, int namelen); | |
| 104 | void	 audit_arg_mask(int mask); | |
| 105 | void	 audit_arg_mode(mode_t mode); | |
| 106 | void	 audit_arg_dev(int dev); | |
| 107 | void	 audit_arg_value(long value); | |
| 108 | void	 audit_arg_owner(uid_t uid, gid_t gid); | |
| 109 | void	 audit_arg_pid(pid_t pid); | |
| 110 | void	 audit_arg_process(struct proc *p); | |
| 111 | void	 audit_arg_signum(u_int signum); | |
| 112 | void	 audit_arg_socket(int sodomain, int sotype, int soprotocol); | |
| 113 | void	 audit_arg_sockaddr(struct thread *td, int dirfd, struct sockaddr *sa); | |
| 114 | void	 audit_arg_auid(uid_t auid); | |
| 115 | void	 audit_arg_auditinfo(struct auditinfo *au_info); | |
| 116 | void	 audit_arg_auditinfo_addr(struct auditinfo_addr *au_info); | |
| 117 | void	 audit_arg_upath1(struct thread *td, int dirfd, char *upath); | |
| 118 | void	 audit_arg_upath1_canon(char *upath); | |
| 119 | void	 audit_arg_upath2(struct thread *td, int dirfd, char *upath); | |
| 120 | void	 audit_arg_upath2_canon(char *upath); | |
| 121 | void	 audit_arg_upath1_vp(struct thread *td, struct vnode *rdir, | |
| 122 | 	 struct vnode *cdir, char *upath); | |
| 123 | void	 audit_arg_upath2_vp(struct thread *td, struct vnode *rdir, | |
| 124 | 	 struct vnode *cdir, char *upath); | |
| 125 | void	 audit_arg_vnode1(struct vnode *vp); | |
| 126 | void	 audit_arg_vnode2(struct vnode *vp); | |
| 127 | void	 audit_arg_text(const char *text); | |
| 128 | void	 audit_arg_cmd(int cmd); | |
| 129 | void	 audit_arg_svipc_cmd(int cmd); | |
| 130 | void	 audit_arg_svipc_perm(struct ipc_perm *perm); | |
| 131 | void	 audit_arg_svipc_id(int id); | |
| 132 | void	 audit_arg_svipc_addr(void *addr); | |
| 133 | void	 audit_arg_svipc_which(int which); | |
| 134 | void	 audit_arg_posix_ipc_perm(uid_t uid, gid_t gid, mode_t mode); | |
| 135 | void	 audit_arg_auditon(union auditon_udata *udata); | |
| 136 | void	 audit_arg_file(struct proc *p, struct file *fp); | |
| 137 | void	 audit_arg_argv(char *argv, int argc, int length); | |
| 138 | void	 audit_arg_envv(char *envv, int envc, int length); | |
| 139 | void	 audit_arg_rights(cap_rights_t *rightsp); | |
| 140 | void	 audit_arg_fcntl_rights(uint32_t fcntlrights); | |
| 141 | void	 audit_sysclose(struct thread *td, int fd, struct file *fp); | |
| 142 | void	 audit_cred_copy(struct ucred *src, struct ucred *dest); | |
| 143 | void	 audit_cred_destroy(struct ucred *cred); | |
| 144 | void	 audit_cred_init(struct ucred *cred); | |
| 145 | void	 audit_cred_kproc0(struct ucred *cred); | |
| 146 | void	 audit_cred_proc1(struct ucred *cred); | |
| 147 | void	 audit_proc_coredump(struct thread *td, char *path, int errcode); | |
| 148 | void	 audit_thread_alloc(struct thread *td); | |
| 149 | void	 audit_thread_free(struct thread *td); | |
| 301 | 150 | |
| 302 | 151 | /* |
| 303 | * Audit to event class mapping. | |
| 152 | * Define macros to wrap the audit_arg_* calls by checking the global | |
| 153 | * audit_syscalls_enabled flag before performing the actual call. | |
| 304 | 154 | */ |
| 305 | struct au_evclass_map { | |
| 306 | 	au_event_t	ec_number; | |
| 307 | 	au_class_t	ec_class; | |
| 308 | }; | |
| 309 | typedef	struct au_evclass_map	au_evclass_map_t; | |
| 155 | #define	AUDITING_TD(td)		(__predict_false((td)->td_pflags & TDP_AUDITREC)) | |
| 156 | ||
| 157 | #define	AUDIT_ARG_ADDR(addr) do {					\ | |
| 158 | 	if (AUDITING_TD(curthread))					\ | |
| 159 | 		audit_arg_addr((addr));					\ | |
| 160 | } while (0) | |
| 161 | ||
| 162 | #define	AUDIT_ARG_ARGV(argv, argc, length) do {				\ | |
| 163 | 	if (AUDITING_TD(curthread))					\ | |
| 164 | 		audit_arg_argv((argv), (argc), (length));		\ | |
| 165 | } while (0) | |
| 166 | ||
| 167 | #define	AUDIT_ARG_ATFD1(atfd) do {					\ | |
| 168 | 	if (AUDITING_TD(curthread))					\ | |
| 169 | 		audit_arg_atfd1((atfd));				\ | |
| 170 | } while (0) | |
| 171 | ||
| 172 | #define	AUDIT_ARG_ATFD2(atfd) do {					\ | |
| 173 | 	if (AUDITING_TD(curthread))					\ | |
| 174 | 		audit_arg_atfd2((atfd));				\ | |
| 175 | } while (0) | |
| 176 | ||
| 177 | #define	AUDIT_ARG_AUDITON(udata) do {					\ | |
| 178 | 	if (AUDITING_TD(curthread))					\ | |
| 179 | 		audit_arg_auditon((udata));				\ | |
| 180 | } while (0) | |
| 181 | ||
| 182 | #define	AUDIT_ARG_CMD(cmd) do {						\ | |
| 183 | 	if (AUDITING_TD(curthread))					\ | |
| 184 | 		audit_arg_cmd((cmd));					\ | |
| 185 | } while (0) | |
| 186 | ||
| 187 | #define	AUDIT_ARG_DEV(dev) do {						\ | |
| 188 | 	if (AUDITING_TD(curthread))					\ | |
| 189 | 		audit_arg_dev((dev));					\ | |
| 190 | } while (0) | |
| 191 | ||
| 192 | #define	AUDIT_ARG_EGID(egid) do {					\ | |
| 193 | 	if (AUDITING_TD(curthread))					\ | |
| 194 | 		audit_arg_egid((egid));					\ | |
| 195 | } while (0) | |
| 196 | ||
| 197 | #define	AUDIT_ARG_ENVV(envv, envc, length) do {				\ | |
| 198 | 	if (AUDITING_TD(curthread))					\ | |
| 199 | 		audit_arg_envv((envv), (envc), (length));		\ | |
| 200 | } while (0) | |
| 201 | ||
| 202 | #define	AUDIT_ARG_EXIT(status, retval) do {				\ | |
| 203 | 	if (AUDITING_TD(curthread))					\ | |
| 204 | 		audit_arg_exit((status), (retval));			\ | |
| 205 | } while (0) | |
| 206 | ||
| 207 | #define	AUDIT_ARG_EUID(euid) do {					\ | |
| 208 | 	if (AUDITING_TD(curthread))					\ | |
| 209 | 		audit_arg_euid((euid));					\ | |
| 210 | } while (0) | |
| 211 | ||
| 212 | #define	AUDIT_ARG_FD(fd) do {						\ | |
| 213 | 	if (AUDITING_TD(curthread))					\ | |
| 214 | 		audit_arg_fd((fd));					\ | |
| 215 | } while (0) | |
| 216 | ||
| 217 | #define	AUDIT_ARG_FILE(p, fp) do {					\ | |
| 218 | 	if (AUDITING_TD(curthread))					\ | |
| 219 | 		audit_arg_file((p), (fp));				\ | |
| 220 | } while (0) | |
| 221 | ||
| 222 | #define	AUDIT_ARG_FFLAGS(fflags) do {					\ | |
| 223 | 	if (AUDITING_TD(curthread))					\ | |
| 224 | 		audit_arg_fflags((fflags));				\ | |
| 225 | } while (0) | |
| 226 | ||
| 227 | #define	AUDIT_ARG_GID(gid) do {						\ | |
| 228 | 	if (AUDITING_TD(curthread))					\ | |
| 229 | 		audit_arg_gid((gid));					\ | |
| 230 | } while (0) | |
| 231 | ||
| 232 | #define	AUDIT_ARG_GROUPSET(gidset, gidset_size) do {			\ | |
| 233 | 	if (AUDITING_TD(curthread))					\ | |
| 234 | 		audit_arg_groupset((gidset), (gidset_size));		\ | |
| 235 | } while (0) | |
| 236 | ||
| 237 | #define	AUDIT_ARG_LOGIN(login) do {					\ | |
| 238 | 	if (AUDITING_TD(curthread))					\ | |
| 239 | 		audit_arg_login((login));				\ | |
| 240 | } while (0) | |
| 241 | ||
| 242 | #define	AUDIT_ARG_MODE(mode) do {					\ | |
| 243 | 	if (AUDITING_TD(curthread))					\ | |
| 244 | 		audit_arg_mode((mode));					\ | |
| 245 | } while (0) | |
| 246 | ||
| 247 | #define	AUDIT_ARG_OWNER(uid, gid) do {					\ | |
| 248 | 	if (AUDITING_TD(curthread))					\ | |
| 249 | 		audit_arg_owner((uid), (gid));				\ | |
| 250 | } while (0) | |
| 251 | ||
| 252 | #define	AUDIT_ARG_PID(pid) do {						\ | |
| 253 | 	if (AUDITING_TD(curthread))					\ | |
| 254 | 		audit_arg_pid((pid));					\ | |
| 255 | } while (0) | |
| 256 | ||
| 257 | #define	AUDIT_ARG_POSIX_IPC_PERM(uid, gid, mode) do {			\ | |
| 258 | 	if (AUDITING_TD(curthread))					\ | |
| 259 | 		audit_arg_posix_ipc_perm((uid), (gid), (mod));		\ | |
| 260 | } while (0) | |
| 261 | ||
| 262 | #define	AUDIT_ARG_PROCESS(p) do {					\ | |
| 263 | 	if (AUDITING_TD(curthread))					\ | |
| 264 | 		audit_arg_process((p));					\ | |
| 265 | } while (0) | |
| 266 | ||
| 267 | #define	AUDIT_ARG_RGID(rgid) do {					\ | |
| 268 | 	if (AUDITING_TD(curthread))					\ | |
| 269 | 		audit_arg_rgid((rgid));					\ | |
| 270 | } while (0) | |
| 271 | ||
| 272 | #define	AUDIT_ARG_RIGHTS(rights) do {					\ | |
| 273 | 	if (AUDITING_TD(curthread))					\ | |
| 274 | 		audit_arg_rights((rights));				\ | |
| 275 | } while (0) | |
| 276 | ||
| 277 | #define	AUDIT_ARG_FCNTL_RIGHTS(fcntlrights) do {			\ | |
| 278 | 	if (AUDITING_TD(curthread))					\ | |
| 279 | 		audit_arg_fcntl_rights((fcntlrights));			\ | |
| 280 | } while (0) | |
| 281 | ||
| 282 | #define	AUDIT_ARG_RUID(ruid) do {					\ | |
| 283 | 	if (AUDITING_TD(curthread))					\ | |
| 284 | 		audit_arg_ruid((ruid));					\ | |
| 285 | } while (0) | |
| 286 | ||
| 287 | #define	AUDIT_ARG_SIGNUM(signum) do {					\ | |
| 288 | 	if (AUDITING_TD(curthread))					\ | |
| 289 | 		audit_arg_signum((signum));				\ | |
| 290 | } while (0) | |
| 291 | ||
| 292 | #define	AUDIT_ARG_SGID(sgid) do {					\ | |
| 293 | 	if (AUDITING_TD(curthread))					\ | |
| 294 | 		audit_arg_sgid((sgid));					\ | |
| 295 | } while (0) | |
| 296 | ||
| 297 | #define	AUDIT_ARG_SOCKET(sodomain, sotype, soprotocol) do {		\ | |
| 298 | 	if (AUDITING_TD(curthread))					\ | |
| 299 | 		audit_arg_socket((sodomain), (sotype), (soprotocol));	\ | |
| 300 | } while (0) | |
| 301 | ||
| 302 | #define	AUDIT_ARG_SOCKADDR(td, dirfd, sa) do {				\ | |
| 303 | 	if (AUDITING_TD(curthread))					\ | |
| 304 | 		audit_arg_sockaddr((td), (dirfd), (sa));		\ | |
| 305 | } while (0) | |
| 306 | ||
| 307 | #define	AUDIT_ARG_SUID(suid) do {					\ | |
| 308 | 	if (AUDITING_TD(curthread))					\ | |
| 309 | 		audit_arg_suid((suid));					\ | |
| 310 | } while (0) | |
| 311 | ||
| 312 | #define	AUDIT_ARG_SVIPC_CMD(cmd) do {					\ | |
| 313 | 	if (AUDITING_TD(curthread))					\ | |
| 314 | 		audit_arg_svipc_cmd((cmd));				\ | |
| 315 | } while (0) | |
| 316 | ||
| 317 | #define	AUDIT_ARG_SVIPC_PERM(perm) do {					\ | |
| 318 | 	if (AUDITING_TD(curthread))					\ | |
| 319 | 		audit_arg_svipc_perm((perm));				\ | |
| 320 | } while (0) | |
| 321 | ||
| 322 | #define	AUDIT_ARG_SVIPC_ID(id) do {					\ | |
| 323 | 	if (AUDITING_TD(curthread))					\ | |
| 324 | 		audit_arg_svipc_id((id));				\ | |
| 325 | } while (0) | |
| 326 | ||
| 327 | #define	AUDIT_ARG_SVIPC_ADDR(addr) do {					\ | |
| 328 | 	if (AUDITING_TD(curthread))					\ | |
| 329 | 		audit_arg_svipc_addr((addr));				\ | |
| 330 | } while (0) | |
| 331 | ||
| 332 | #define	AUDIT_ARG_SVIPC_WHICH(which) do {				\ | |
| 333 | 	if (AUDITING_TD(curthread))					\ | |
| 334 | 		audit_arg_svipc_which((which));				\ | |
| 335 | } while (0) | |
| 336 | ||
| 337 | #define	AUDIT_ARG_TEXT(text) do {					\ | |
| 338 | 	if (AUDITING_TD(curthread))					\ | |
| 339 | 		audit_arg_text((text));					\ | |
| 340 | } while (0) | |
| 341 | ||
| 342 | #define	AUDIT_ARG_UID(uid) do {						\ | |
| 343 | 	if (AUDITING_TD(curthread))					\ | |
| 344 | 		audit_arg_uid((uid));					\ | |
| 345 | } while (0) | |
| 346 | ||
| 347 | #define	AUDIT_ARG_UPATH1(td, dirfd, upath) do {				\ | |
| 348 | 	if (AUDITING_TD(curthread))					\ | |
| 349 | 		audit_arg_upath1((td), (dirfd), (upath));		\ | |
| 350 | } while (0) | |
| 351 | ||
| 352 | #define	AUDIT_ARG_UPATH1_CANON(upath) do {				\ | |
| 353 | 	if (AUDITING_TD(curthread))					\ | |
| 354 | 		audit_arg_upath1_canon((upath));			\ | |
| 355 | } while (0) | |
| 356 | ||
| 357 | #define	AUDIT_ARG_UPATH2(td, dirfd, upath) do {				\ | |
| 358 | 	if (AUDITING_TD(curthread))					\ | |
| 359 | 		audit_arg_upath2((td), (dirfd), (upath));		\ | |
| 360 | } while (0) | |
| 361 | ||
| 362 | #define	AUDIT_ARG_UPATH2_CANON(upath) do {				\ | |
| 363 | 	if (AUDITING_TD(curthread))					\ | |
| 364 | 		audit_arg_upath2_canon((upath));			\ | |
| 365 | } while (0) | |
| 366 | ||
| 367 | #define	AUDIT_ARG_UPATH1_VP(td, rdir, cdir, upath) do {			\ | |
| 368 | 	if (AUDITING_TD(curthread))					\ | |
| 369 | 		audit_arg_upath1_vp((td), (rdir), (cdir), (upath));	\ | |
| 370 | } while (0) | |
| 371 | ||
| 372 | #define	AUDIT_ARG_UPATH2_VP(td, rdir, cdir, upath) do {			\ | |
| 373 | 	if (AUDITING_TD(curthread))					\ | |
| 374 | 		audit_arg_upath2_vp((td), (rdir), (cdir), (upath));	\ | |
| 375 | } while (0) | |
| 376 | ||
| 377 | #define	AUDIT_ARG_VALUE(value) do {					\ | |
| 378 | 	if (AUDITING_TD(curthread))					\ | |
| 379 | 		audit_arg_value((value));				\ | |
| 380 | } while (0) | |
| 381 | ||
| 382 | #define	AUDIT_ARG_VNODE1(vp) do {					\ | |
| 383 | 	if (AUDITING_TD(curthread))					\ | |
| 384 | 		audit_arg_vnode1((vp));					\ | |
| 385 | } while (0) | |
| 386 | ||
| 387 | #define	AUDIT_ARG_VNODE2(vp) do {					\ | |
| 388 | 	if (AUDITING_TD(curthread))					\ | |
| 389 | 		audit_arg_vnode2((vp));					\ | |
| 390 | } while (0) | |
| 391 | ||
| 392 | #define	AUDIT_SYSCALL_ENABLED()	audit_syscalls_enabled | |
| 393 | ||
| 394 | #define	AUDIT_SYSCALL_ENTER(code, td)	({				\ | |
| 395 | 	bool _audit_entered = false;					\ | |
| 396 | 	if (audit_syscalls_enabled) {					\ | |
| 397 | 		audit_syscall_enter(code, td);				\ | |
| 398 | 		_audit_entered = true;					\ | |
| 399 | 	}								\ | |
| 400 | 	_audit_entered;							\ | |
| 401 | }) | |
| 310 | 402 | |
| 311 | 403 | /* |
| 312 | * Event-to-name mapping. | |
| 404 | * Wrap the audit_syscall_exit() function so that it is called only when | |
| 405 | * we have a audit record on the thread. Audit records can persist after | |
| 406 | * auditing is disabled, so we don't just check audit_syscalls_enabled here. | |
| 313 | 407 | */ |
| 314 | #define	EVNAMEMAP_NAME_SIZE	64 | |
| 315 | struct au_evname_map { | |
| 316 | 	au_event_t	en_number; | |
| 317 | 	char		en_name[EVNAMEMAP_NAME_SIZE]; | |
| 318 | }; | |
| 319 | typedef struct au_evname_map	au_evname_map_t; | |
| 408 | #define	AUDIT_SYSCALL_EXIT(error, td)	do {				\ | |
| 409 | 	if (AUDITING_TD(td))						\ | |
| 410 | 		audit_syscall_exit(error, td);				\ | |
| 411 | } while (0) | |
| 320 | 412 | |
| 321 | 413 | /* |
| 322 | * Audit system calls. | |
| 414 | * A Macro to wrap the audit_sysclose() function. | |
| 323 | 415 | */ |
| 324 | #if !defined(_KERNEL) && !defined(KERNEL) | |
| 325 | int	audit(const void *, int); | |
| 326 | int	auditon(int, void *, int); | |
| 327 | int	auditctl(const char *); | |
| 328 | int	getauid(au_id_t *); | |
| 329 | int	setauid(const au_id_t *); | |
| 330 | int	getaudit(struct auditinfo *); | |
| 331 | int	setaudit(const struct auditinfo *); | |
| 332 | int	getaudit_addr(struct auditinfo_addr *, int); | |
| 333 | int	setaudit_addr(const struct auditinfo_addr *, int); | |
| 334 | ||
| 335 | #ifdef __APPLE_API_PRIVATE | |
| 336 | #include <mach/port.h> | |
| 337 | mach_port_name_t audit_session_self(void); | |
| 338 | au_asid_t	 audit_session_join(mach_port_name_t port); | |
| 339 | #endif /* __APPLE_API_PRIVATE */ | |
| 340 | ||
| 341 | #endif /* defined(_KERNEL) || defined(KERNEL) */ | |
| 342 | ||
| 343 | __END_DECLS | |
| 344 | ||
| 345 | #endif /* !_BSM_AUDIT_H */ | |
| \ No newline at end of file | ||
| 416 | #define	AUDIT_SYSCLOSE(td, fd)	do {					\ | |
| 417 | 	if (AUDITING_TD(td))						\ | |
| 418 | 		audit_sysclose(td, fd);					\ | |
| 419 | } while (0) | |
| 420 | ||
| 421 | #else /* !AUDIT */ | |
| 422 | ||
| 423 | #define	AUDIT_ARG_ADDR(addr) | |
| 424 | #define	AUDIT_ARG_ARGV(argv, argc, length) | |
| 425 | #define	AUDIT_ARG_ATFD1(atfd) | |
| 426 | #define	AUDIT_ARG_ATFD2(atfd) | |
| 427 | #define	AUDIT_ARG_AUDITON(udata) | |
| 428 | #define	AUDIT_ARG_CMD(cmd) | |
| 429 | #define	AUDIT_ARG_DEV(dev) | |
| 430 | #define	AUDIT_ARG_EGID(egid) | |
| 431 | #define	AUDIT_ARG_ENVV(envv, envc, length) | |
| 432 | #define	AUDIT_ARG_EXIT(status, retval) | |
| 433 | #define	AUDIT_ARG_EUID(euid) | |
| 434 | #define	AUDIT_ARG_FD(fd) | |
| 435 | #define	AUDIT_ARG_FILE(p, fp) | |
| 436 | #define	AUDIT_ARG_FFLAGS(fflags) | |
| 437 | #define	AUDIT_ARG_GID(gid) | |
| 438 | #define	AUDIT_ARG_GROUPSET(gidset, gidset_size) | |
| 439 | #define	AUDIT_ARG_LOGIN(login) | |
| 440 | #define	AUDIT_ARG_MODE(mode) | |
| 441 | #define	AUDIT_ARG_OWNER(uid, gid) | |
| 442 | #define	AUDIT_ARG_PID(pid) | |
| 443 | #define	AUDIT_ARG_POSIX_IPC_PERM(uid, gid, mode) | |
| 444 | #define	AUDIT_ARG_PROCESS(p) | |
| 445 | #define	AUDIT_ARG_RGID(rgid) | |
| 446 | #define	AUDIT_ARG_RIGHTS(rights) | |
| 447 | #define	AUDIT_ARG_FCNTL_RIGHTS(fcntlrights) | |
| 448 | #define	AUDIT_ARG_RUID(ruid) | |
| 449 | #define	AUDIT_ARG_SIGNUM(signum) | |
| 450 | #define	AUDIT_ARG_SGID(sgid) | |
| 451 | #define	AUDIT_ARG_SOCKET(sodomain, sotype, soprotocol) | |
| 452 | #define	AUDIT_ARG_SOCKADDR(td, dirfd, sa) | |
| 453 | #define	AUDIT_ARG_SUID(suid) | |
| 454 | #define	AUDIT_ARG_SVIPC_CMD(cmd) | |
| 455 | #define	AUDIT_ARG_SVIPC_PERM(perm) | |
| 456 | #define	AUDIT_ARG_SVIPC_ID(id) | |
| 457 | #define	AUDIT_ARG_SVIPC_ADDR(addr) | |
| 458 | #define	AUDIT_ARG_SVIPC_WHICH(which) | |
| 459 | #define	AUDIT_ARG_TEXT(text) | |
| 460 | #define	AUDIT_ARG_UID(uid) | |
| 461 | #define	AUDIT_ARG_UPATH1(td, dirfd, upath) | |
| 462 | #define	AUDIT_ARG_UPATH1_CANON(upath) | |
| 463 | #define	AUDIT_ARG_UPATH2(td, dirfd, upath) | |
| 464 | #define	AUDIT_ARG_UPATH2_CANON(upath) | |
| 465 | #define	AUDIT_ARG_UPATH1_VP(td, rdir, cdir, upath) | |
| 466 | #define	AUDIT_ARG_UPATH2_VP(td, rdir, cdir, upath) | |
| 467 | #define	AUDIT_ARG_VALUE(value) | |
| 468 | #define	AUDIT_ARG_VNODE1(vp) | |
| 469 | #define	AUDIT_ARG_VNODE2(vp) | |
| 470 | ||
| 471 | #define	AUDITING_TD(td)		0 | |
| 472 | ||
| 473 | #define	AUDIT_SYSCALL_ENABLED()	0 | |
| 474 | #define	AUDIT_SYSCALL_ENTER(code, td)	0 | |
| 475 | #define	AUDIT_SYSCALL_EXIT(error, td) | |
| 476 | ||
| 477 | #define	AUDIT_SYSCLOSE(p, fd) | |
| 478 | ||
| 479 | #endif /* AUDIT */ | |
| 480 | ||
| 481 | #endif /* !_SECURITY_AUDIT_KERNEL_H_ */ | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/security/mac_grantbylabel/mac_grantbylabel.h created+63| ... | ... | @@ -0,0 +1,63 @@ |
| 1 | /* | |
| 2 | * SPDX-License-Identifier: BSD-2-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 2018-2023, Juniper Networks, Inc. | |
| 5 | * All rights reserved. | |
| 6 | * | |
| 7 | * Redistribution and use in source and binary forms, with or without | |
| 8 | * modification, are permitted provided that the following conditions | |
| 9 | * are met: | |
| 10 | * 1. Redistributions of source code must retain the above copyright | |
| 11 | * notice, this list of conditions and the following disclaimer. | |
| 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 13 | * notice, this list of conditions and the following disclaimer in the | |
| 14 | * documentation and/or other materials provided with the distribution. | |
| 15 | * | |
| 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | |
| 17 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |
| 18 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | |
| 19 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | |
| 20 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, | |
| 21 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | |
| 22 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED | |
| 23 | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | |
| 24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
| 25 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
| 26 | * SUCH DAMAGE. | |
| 27 | */ | |
| 28 | ||
| 29 | #ifndef	_SECURITY_MAC_GRANTBYLABEL_H | |
| 30 | #define	_SECURITY_MAC_GRANTBYLABEL_H | |
| 31 | ||
| 32 | #include <security/mac_veriexec/mac_veriexec.h> | |
| 33 | ||
| 34 | #define	MAC_GRANTBYLABEL_NAME	"mac_grantbylabel" | |
| 35 | ||
| 36 | /* the bits we use to represent tokens */ | |
| 37 | #define GBL_EMPTY	(1<<0) | |
| 38 | #define GBL_BIND	(1<<1) | |
| 39 | #define GBL_IPC		(1<<2) | |
| 40 | #define GBL_NET		(1<<3) | |
| 41 | #define GBL_PROC	(1<<4) | |
| 42 | #define GBL_RTSOCK	(1<<5) | |
| 43 | #define GBL_SYSCTL	(1<<6) | |
| 44 | #define GBL_VACCESS	(1<<7) | |
| 45 | #define GBL_VERIEXEC	(1<<8) | |
| 46 | #define GBL_KMEM	(1<<9) | |
| 47 | #define GBL_MAX		9 | |
| 48 | ||
| 49 | /* this should suffice for now */ | |
| 50 | typedef uint32_t	gbl_label_t; | |
| 51 | ||
| 52 | #define MAC_GRANTBYLABEL_FETCH_GBL	1 | |
| 53 | #define MAC_GRANTBYLABEL_FETCH_PID_GBL	2 | |
| 54 | ||
| 55 | struct mac_grantbylabel_fetch_gbl_args { | |
| 56 | 	union { | |
| 57 | 		int	fd; | |
| 58 | 		pid_t	pid; | |
| 59 | 	} u; | |
| 60 | 	gbl_label_t	gbl; | |
| 61 | }; | |
| 62 | ||
| 63 | #endif | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/setjmp.h-2| ... | ... | @@ -32,8 +32,6 @@ |
| 32 | 32 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 33 | 33 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 34 | 34 | * SUCH DAMAGE. |
| 35 | * | |
| 36 | *	@(#)setjmp.h	8.2 (Berkeley) 1/21/94 | |
| 37 | 35 | */ |
| 38 | 36 | |
| 39 | 37 | #ifndef _SETJMP_H_ |
lib/libc/include/generic-freebsd/signal.h+14-2| ... | ... | @@ -27,8 +27,6 @@ |
| 27 | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | * | |
| 31 | *	@(#)signal.h	8.3 (Berkeley) 3/30/94 | |
| 32 | 30 | */ |
| 33 | 31 | |
| 34 | 32 | #ifndef _SIGNAL_H_ |
| ... | ... | @@ -42,6 +40,10 @@ |
| 42 | 40 | #include <sys/_ucontext.h> |
| 43 | 41 | #endif |
| 44 | 42 | |
| 43 | #if __POSIX_VISIBLE >= 202405 || __BSD_VISIBLE | |
| 44 | #define SIG2STR_MAX	32	/* size of buffer required for sig2str() */ | |
| 45 | #endif | |
| 46 | ||
| 45 | 47 | __NULLABILITY_PRAGMA_PUSH |
| 46 | 48 | |
| 47 | 49 | #if __BSD_VISIBLE |
| ... | ... | @@ -70,6 +72,10 @@ typedef __pthread_t pthread_t; |
| 70 | 72 | #endif |
| 71 | 73 | #endif /* __POSIX_VISIBLE || __XSI_VISIBLE */ |
| 72 | 74 | |
| 75 | #if !defined(_STANDALONE) && defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE > 0 | |
| 76 | #include <ssp/signal.h> | |
| 77 | #endif | |
| 78 | ||
| 73 | 79 | __BEGIN_DECLS |
| 74 | 80 | int	raise(int); |
| 75 | 81 | |
| ... | ... | @@ -117,9 +123,15 @@ int	siginterrupt(int, int); |
| 117 | 123 | #endif |
| 118 | 124 | |
| 119 | 125 | #if __POSIX_VISIBLE >= 200809 |
| 126 | void	psiginfo(const siginfo_t *, const char *); | |
| 120 | 127 | void	psignal(int, const char *); |
| 121 | 128 | #endif |
| 122 | 129 | |
| 130 | #if __POSIX_VISIBLE >= 202405 || __BSD_VISIBLE | |
| 131 | int sig2str(int, char *); | |
| 132 | int str2sig(const char * __restrict, int * __restrict); | |
| 133 | #endif | |
| 134 | ||
| 123 | 135 | #if __BSD_VISIBLE |
| 124 | 136 | int	sigandset(sigset_t *dest, const sigset_t *left, const sigset_t *right); |
| 125 | 137 | int	sigblock(int); |
lib/libc/include/generic-freebsd/ssp/poll.h created+60| ... | ... | @@ -0,0 +1,60 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-2-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 2024, Klara, Inc. | |
| 5 | * | |
| 6 | * Redistribution and use in source and binary forms, with or without | |
| 7 | * modification, are permitted provided that the following conditions | |
| 8 | * are met: | |
| 9 | * 1. Redistributions of source code must retain the above copyright | |
| 10 | * notice, this list of conditions and the following disclaimer. | |
| 11 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 12 | * notice, this list of conditions and the following disclaimer in the | |
| 13 | * documentation and/or other materials provided with the distribution. | |
| 14 | * | |
| 15 | * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS | |
| 16 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | |
| 17 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
| 18 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | |
| 19 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
| 20 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
| 21 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
| 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
| 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
| 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
| 25 | * POSSIBILITY OF SUCH DAMAGE. | |
| 26 | */ | |
| 27 | #ifndef _SSP_POLL_H_ | |
| 28 | #define _SSP_POLL_H_ | |
| 29 | ||
| 30 | #include <ssp/ssp.h> | |
| 31 | ||
| 32 | #if __SSP_FORTIFY_LEVEL > 0 | |
| 33 | ||
| 34 | __BEGIN_DECLS | |
| 35 | ||
| 36 | __ssp_redirect_raw_impl(int, poll, poll, | |
| 37 | (struct pollfd fds[], nfds_t nfds, int timeout)) | |
| 38 | { | |
| 39 | 	if (__ssp_bos(fds) / sizeof(fds[0]) < nfds) | |
| 40 | 		__chk_fail(); | |
| 41 | ||
| 42 | 	return (__ssp_real(poll)(fds, nfds, timeout)); | |
| 43 | } | |
| 44 | ||
| 45 | #if __POSIX_VISIBLE >= 202405 | |
| 46 | __ssp_redirect_raw_impl(int, ppoll, ppoll, | |
| 47 | (struct pollfd fds[], nfds_t nfds, | |
| 48 | const struct timespec *__restrict timeout, | |
| 49 | const sigset_t *__restrict newsigmask)) | |
| 50 | { | |
| 51 | 	if (__ssp_bos(fds) / sizeof(fds[0]) < nfds) | |
| 52 | 		__chk_fail(); | |
| 53 | ||
| 54 | 	return (__ssp_real(ppoll)(fds, nfds, timeout, newsigmask)); | |
| 55 | } | |
| 56 | #endif	/* __POSIX_VISIBLE >= 202405 */ | |
| 57 | __END_DECLS | |
| 58 | ||
| 59 | #endif /* __SSP_FORTIFY_LEVEL > 0 */ | |
| 60 | #endif /* _SSP_POLL_H_ */ | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/ssp/random.h created+42| ... | ... | @@ -0,0 +1,42 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-2-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 2024, Klara, Inc. | |
| 5 | * | |
| 6 | * Redistribution and use in source and binary forms, with or without | |
| 7 | * modification, are permitted provided that the following conditions | |
| 8 | * are met: | |
| 9 | * 1. Redistributions of source code must retain the above copyright | |
| 10 | * notice, this list of conditions and the following disclaimer. | |
| 11 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 12 | * notice, this list of conditions and the following disclaimer in the | |
| 13 | * documentation and/or other materials provided with the distribution. | |
| 14 | * | |
| 15 | * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS | |
| 16 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | |
| 17 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
| 18 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | |
| 19 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
| 20 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
| 21 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
| 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
| 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
| 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
| 25 | * POSSIBILITY OF SUCH DAMAGE. | |
| 26 | */ | |
| 27 | #ifndef _SSP_RANDOM_H_ | |
| 28 | #define _SSP_RANDOM_H_ | |
| 29 | ||
| 30 | #include <ssp/ssp.h> | |
| 31 | ||
| 32 | #if __SSP_FORTIFY_LEVEL > 0 | |
| 33 | ||
| 34 | __BEGIN_DECLS | |
| 35 | ||
| 36 | __ssp_redirect(ssize_t, getrandom, (void *__buf, size_t __len, | |
| 37 | unsigned int __flags), (__buf, __len, __flags)); | |
| 38 | ||
| 39 | __END_DECLS | |
| 40 | ||
| 41 | #endif /* __SSP_FORTIFY_LEVEL > 0 */ | |
| 42 | #endif /* _SSP_RANDOM_H_ */ | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/ssp/signal.h created+52| ... | ... | @@ -0,0 +1,52 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-2-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 2025, Ricardo Branco <rbranco@suse.de> | |
| 5 | * | |
| 6 | * Redistribution and use in source and binary forms, with or without | |
| 7 | * modification, are permitted provided that the following conditions | |
| 8 | * are met: | |
| 9 | * 1. Redistributions of source code must retain the above copyright | |
| 10 | * notice, this list of conditions and the following disclaimer. | |
| 11 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 12 | * notice, this list of conditions and the following disclaimer in the | |
| 13 | * documentation and/or other materials provided with the distribution. | |
| 14 | * | |
| 15 | * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS | |
| 16 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | |
| 17 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
| 18 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | |
| 19 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
| 20 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
| 21 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
| 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
| 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
| 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
| 25 | * POSSIBILITY OF SUCH DAMAGE. | |
| 26 | */ | |
| 27 | #ifndef _SSP_SIGNAL_H_ | |
| 28 | #define _SSP_SIGNAL_H_ | |
| 29 | ||
| 30 | #include <ssp/ssp.h> | |
| 31 | ||
| 32 | #if __SSP_FORTIFY_LEVEL > 0 | |
| 33 | ||
| 34 | #include <signal.h> | |
| 35 | ||
| 36 | __BEGIN_DECLS | |
| 37 | ||
| 38 | #if __POSIX_VISIBLE >= 202405 || __BSD_VISIBLE | |
| 39 | __ssp_redirect_raw_impl(int, sig2str, sig2str, | |
| 40 | (int signum, char *__restrict str)) | |
| 41 | { | |
| 42 | 	if (__ssp_bos(str) < SIG2STR_MAX) | |
| 43 | 		__chk_fail(); | |
| 44 | ||
| 45 | 	return (__ssp_real(sig2str)(signum, str)); | |
| 46 | } | |
| 47 | #endif | |
| 48 | ||
| 49 | __END_DECLS | |
| 50 | ||
| 51 | #endif /* __SSP_FORTIFY_LEVEL > 0 */ | |
| 52 | #endif /* _SSP_SIGNAL_H_ */ | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/ssp/socket.h created+120| ... | ... | @@ -0,0 +1,120 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-2-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 2024, Klara, Inc. | |
| 5 | * | |
| 6 | * Redistribution and use in source and binary forms, with or without | |
| 7 | * modification, are permitted provided that the following conditions | |
| 8 | * are met: | |
| 9 | * 1. Redistributions of source code must retain the above copyright | |
| 10 | * notice, this list of conditions and the following disclaimer. | |
| 11 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 12 | * notice, this list of conditions and the following disclaimer in the | |
| 13 | * documentation and/or other materials provided with the distribution. | |
| 14 | * | |
| 15 | * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS | |
| 16 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | |
| 17 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
| 18 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | |
| 19 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
| 20 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
| 21 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
| 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
| 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
| 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
| 25 | * POSSIBILITY OF SUCH DAMAGE. | |
| 26 | */ | |
| 27 | #ifndef _SSP_SOCKET_H_ | |
| 28 | #define _SSP_SOCKET_H_ | |
| 29 | ||
| 30 | #include <ssp/ssp.h> | |
| 31 | ||
| 32 | #if __SSP_FORTIFY_LEVEL > 0 | |
| 33 | ||
| 34 | #include <sys/_null.h> | |
| 35 | ||
| 36 | __BEGIN_DECLS | |
| 37 | ||
| 38 | __ssp_inline void | |
| 39 | __ssp_check_msghdr(struct msghdr *hdr) | |
| 40 | { | |
| 41 | 	if (__ssp_bos(hdr->msg_name) < hdr->msg_namelen) | |
| 42 | 		__chk_fail(); | |
| 43 | ||
| 44 | 	__ssp_check_iovec(hdr->msg_iov, hdr->msg_iovlen); | |
| 45 | ||
| 46 | 	if (__ssp_bos(hdr->msg_control) < hdr->msg_controllen) | |
| 47 | 		__chk_fail(); | |
| 48 | } | |
| 49 | ||
| 50 | __ssp_redirect_raw_impl(int, getpeername, getpeername, | |
| 51 | (int fdes, struct sockaddr *__restrict name, socklen_t *__restrict namelen)) | |
| 52 | { | |
| 53 | 	size_t namesz = __ssp_bos(name); | |
| 54 | ||
| 55 | 	if (namesz != (size_t)-1 && namesz < *namelen) | |
| 56 | 		__chk_fail(); | |
| 57 | ||
| 58 | 	return (__ssp_real(getpeername)(fdes, name, namelen)); | |
| 59 | } | |
| 60 | ||
| 61 | __ssp_redirect_raw_impl(int, getsockname, getsockname, | |
| 62 | (int fdes, struct sockaddr *__restrict name, | |
| 63 | socklen_t *__restrict namelen)) | |
| 64 | { | |
| 65 | 	size_t namesz = __ssp_bos(name); | |
| 66 | ||
| 67 | 	if (namesz != (size_t)-1 && namesz < *namelen) | |
| 68 | 		__chk_fail(); | |
| 69 | ||
| 70 | 	return (__ssp_real(getsockname)(fdes, name, namelen)); | |
| 71 | } | |
| 72 | ||
| 73 | __ssp_redirect(ssize_t, recv, (int __sock, void *__buf, size_t __len, | |
| 74 | int __flags), (__sock, __buf, __len, __flags)); | |
| 75 | ||
| 76 | __ssp_redirect_raw_impl(ssize_t, recvfrom, recvfrom, | |
| 77 | (int s, void *buf, size_t len, int flags, | |
| 78 | struct sockaddr *__restrict from, | |
| 79 | socklen_t *__restrict fromlen)) | |
| 80 | { | |
| 81 | 	if (__ssp_bos(buf) < len) | |
| 82 | 		__chk_fail(); | |
| 83 | 	if (from != NULL && __ssp_bos(from) < *fromlen) | |
| 84 | 		__chk_fail(); | |
| 85 | ||
| 86 | 	return (__ssp_real(recvfrom)(s, buf, len, flags, from, fromlen)); | |
| 87 | } | |
| 88 | ||
| 89 | __ssp_redirect_raw_impl(ssize_t, recvmsg, recvmsg, | |
| 90 | (int s, struct msghdr *hdr, int flags)) | |
| 91 | { | |
| 92 | 	__ssp_check_msghdr(hdr); | |
| 93 | 	return (__ssp_real(recvmsg)(s, hdr, flags)); | |
| 94 | } | |
| 95 | ||
| 96 | #if __BSD_VISIBLE | |
| 97 | struct timespec; | |
| 98 | ||
| 99 | __ssp_redirect_raw_impl(ssize_t, recvmmsg, recvmmsg, | |
| 100 | (int s, struct mmsghdr *__restrict hdrvec, size_t vlen, int flags, | |
| 101 | const struct timespec *__restrict timeout)) | |
| 102 | { | |
| 103 | 	const size_t vecsz = __ssp_bos(hdrvec); | |
| 104 | 	size_t i; | |
| 105 | ||
| 106 | 	if (vecsz != (size_t)-1 && vecsz / sizeof(*hdrvec) < vlen) | |
| 107 | 		__chk_fail(); | |
| 108 | ||
| 109 | 	for (i = 0; i < vlen; i++) { | |
| 110 | 		__ssp_check_msghdr(&hdrvec[i].msg_hdr); | |
| 111 | 	} | |
| 112 | ||
| 113 | 	return (__ssp_real(recvmmsg)(s, hdrvec, vlen, flags, timeout)); | |
| 114 | } | |
| 115 | #endif | |
| 116 | ||
| 117 | __END_DECLS | |
| 118 | ||
| 119 | #endif /* __SSP_FORTIFY_LEVEL > 0 */ | |
| 120 | #endif /* _SSP_SOCKET_H_ */ | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/ssp/ssp.h created+127| ... | ... | @@ -0,0 +1,127 @@ |
| 1 | /*	$NetBSD: ssp.h,v 1.13 2015/09/03 20:43:47 plunky Exp $	*/ | |
| 2 | ||
| 3 | /*- | |
| 4 | * | |
| 5 | * SPDX-License-Identifier: BSD-2-Clause | |
| 6 | * | |
| 7 | * Copyright (c) 2006, 2011 The NetBSD Foundation, Inc. | |
| 8 | * All rights reserved. | |
| 9 | * | |
| 10 | * This code is derived from software contributed to The NetBSD Foundation | |
| 11 | * by Christos Zoulas. | |
| 12 | * | |
| 13 | * Redistribution and use in source and binary forms, with or without | |
| 14 | * modification, are permitted provided that the following conditions | |
| 15 | * are met: | |
| 16 | * 1. Redistributions of source code must retain the above copyright | |
| 17 | * notice, this list of conditions and the following disclaimer. | |
| 18 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 19 | * notice, this list of conditions and the following disclaimer in the | |
| 20 | * documentation and/or other materials provided with the distribution. | |
| 21 | * | |
| 22 | * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS | |
| 23 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | |
| 24 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
| 25 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | |
| 26 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
| 27 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
| 28 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
| 29 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
| 30 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
| 31 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
| 32 | * POSSIBILITY OF SUCH DAMAGE. | |
| 33 | */ | |
| 34 | #ifndef _SSP_SSP_H_ | |
| 35 | #define _SSP_SSP_H_ | |
| 36 | ||
| 37 | #include <sys/cdefs.h> | |
| 38 | ||
| 39 | #if !defined(__cplusplus) | |
| 40 | # if defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE > 0 && \ | |
| 41 | (__OPTIMIZE__ > 0 || defined(__clang__)) | |
| 42 | # if _FORTIFY_SOURCE > 1 | |
| 43 | # define __SSP_FORTIFY_LEVEL 2 | |
| 44 | # else | |
| 45 | # define __SSP_FORTIFY_LEVEL 1 | |
| 46 | # endif | |
| 47 | # else | |
| 48 | # define __SSP_FORTIFY_LEVEL 0 | |
| 49 | # endif | |
| 50 | #else | |
| 51 | # define __SSP_FORTIFY_LEVEL 0 | |
| 52 | #endif | |
| 53 | ||
| 54 | #define	__ssp_var(type)	__CONCAT(__ssp_ ## type, __COUNTER__) | |
| 55 | ||
| 56 | /* __ssp_real is used by the implementation in libc */ | |
| 57 | #if __SSP_FORTIFY_LEVEL == 0 | |
| 58 | #define __ssp_real_(fun)	fun | |
| 59 | #else | |
| 60 | #define __ssp_real_(fun)	__ssp_real_ ## fun | |
| 61 | #endif | |
| 62 | #define __ssp_real(fun)		__ssp_real_(fun) | |
| 63 | ||
| 64 | #define __ssp_inline static __inline __attribute__((__always_inline__)) | |
| 65 | ||
| 66 | #define __ssp_bos(ptr) __builtin_object_size(ptr, __SSP_FORTIFY_LEVEL > 1) | |
| 67 | #define __ssp_bos0(ptr) __builtin_object_size(ptr, 0) | |
| 68 | ||
| 69 | #define __ssp_check(buf, len, bos) \ | |
| 70 | 	if (bos(buf) != (size_t)-1 && (size_t)len > bos(buf)) \ | |
| 71 | 		__chk_fail() | |
| 72 | ||
| 73 | #define __ssp_redirect_raw_impl(rtype, fun, symbol, args) \ | |
| 74 | rtype __ssp_real_(fun) args __RENAME(symbol); \ | |
| 75 | __ssp_inline rtype fun args __RENAME(__ssp_protected_ ## fun); \ | |
| 76 | __ssp_inline rtype fun args | |
| 77 | ||
| 78 | #define __ssp_redirect_raw(rtype, fun, symbol, args, call, cond, bos, len) \ | |
| 79 | __ssp_redirect_raw_impl(rtype, fun, symbol, args) { \ | |
| 80 | 	if (cond) \ | |
| 81 | 		__ssp_check(__buf, len, bos); \ | |
| 82 | 	return __ssp_real_(fun) call; \ | |
| 83 | } | |
| 84 | ||
| 85 | #define __ssp_redirect(rtype, fun, args, call) \ | |
| 86 | __ssp_redirect_raw(rtype, fun, fun, args, call, 1, __ssp_bos, __len) | |
| 87 | #define __ssp_redirect0(rtype, fun, args, call) \ | |
| 88 | __ssp_redirect_raw(rtype, fun, fun, args, call, 1, __ssp_bos0, __len) | |
| 89 | ||
| 90 | #include <sys/_types.h> | |
| 91 | #include <machine/_limits.h> | |
| 92 | ||
| 93 | __ssp_inline int | |
| 94 | __ssp_overlap(const void *leftp, const void *rightp, __size_t sz) | |
| 95 | { | |
| 96 | 	__uintptr_t left = (__uintptr_t)leftp; | |
| 97 | 	__uintptr_t right = (__uintptr_t)rightp; | |
| 98 | ||
| 99 | 	if (left <= right) | |
| 100 | 		return (__SIZE_T_MAX - sz < left || right < left + sz); | |
| 101 | ||
| 102 | 	return (__SIZE_T_MAX - sz < right || left < right + sz); | |
| 103 | } | |
| 104 | ||
| 105 | #include <sys/_iovec.h> | |
| 106 | ||
| 107 | __BEGIN_DECLS | |
| 108 | void __stack_chk_fail(void) __dead2; | |
| 109 | void __chk_fail(void) __dead2; | |
| 110 | __END_DECLS | |
| 111 | ||
| 112 | __ssp_inline void | |
| 113 | __ssp_check_iovec(const struct iovec *iov, int iovcnt) | |
| 114 | { | |
| 115 | 	const size_t iovsz = __ssp_bos(iov); | |
| 116 | 	int i; | |
| 117 | ||
| 118 | 	if (iovsz != (size_t)-1 && iovsz / sizeof(*iov) < (size_t)iovcnt) | |
| 119 | 		__chk_fail(); | |
| 120 | ||
| 121 | 	for (i = 0; i < iovcnt; i++) { | |
| 122 | 		if (__ssp_bos(iov[i].iov_base) < iov[i].iov_len) | |
| 123 | 			__chk_fail(); | |
| 124 | 	} | |
| 125 | } | |
| 126 | ||
| 127 | #endif /* _SSP_SSP_H_ */ | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/ssp/stdio.h created+107| ... | ... | @@ -0,0 +1,107 @@ |
| 1 | /*	$NetBSD: stdio.h,v 1.5 2011/07/17 20:54:34 joerg Exp $	*/ | |
| 2 | ||
| 3 | /*- | |
| 4 | * | |
| 5 | * SPDX-License-Identifier: BSD-2-Clause | |
| 6 | * | |
| 7 | * Copyright (c) 2006 The NetBSD Foundation, Inc. | |
| 8 | * All rights reserved. | |
| 9 | * | |
| 10 | * This code is derived from software contributed to The NetBSD Foundation | |
| 11 | * by Christos Zoulas. | |
| 12 | * | |
| 13 | * Redistribution and use in source and binary forms, with or without | |
| 14 | * modification, are permitted provided that the following conditions | |
| 15 | * are met: | |
| 16 | * 1. Redistributions of source code must retain the above copyright | |
| 17 | * notice, this list of conditions and the following disclaimer. | |
| 18 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 19 | * notice, this list of conditions and the following disclaimer in the | |
| 20 | * documentation and/or other materials provided with the distribution. | |
| 21 | * | |
| 22 | * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS | |
| 23 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | |
| 24 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
| 25 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | |
| 26 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
| 27 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
| 28 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
| 29 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
| 30 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
| 31 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
| 32 | * POSSIBILITY OF SUCH DAMAGE. | |
| 33 | */ | |
| 34 | #ifndef _SSP_STDIO_H_ | |
| 35 | #define _SSP_STDIO_H_ | |
| 36 | ||
| 37 | #include <ssp/ssp.h> | |
| 38 | ||
| 39 | __BEGIN_DECLS | |
| 40 | #if __SSP_FORTIFY_LEVEL > 0 | |
| 41 | #if __POSIX_VISIBLE | |
| 42 | __ssp_redirect_raw(char *, ctermid, ctermid, (char *__buf), (__buf), | |
| 43 | __buf != NULL, __ssp_bos, L_ctermid); | |
| 44 | #if __BSD_VISIBLE | |
| 45 | __ssp_redirect_raw(char *, ctermid_r, ctermid_r, (char *__buf), (__buf), | |
| 46 | __buf != NULL, __ssp_bos, L_ctermid); | |
| 47 | #endif /* __BSD_VISIBLE */ | |
| 48 | #endif /* __POSIX_VISIBLE */ | |
| 49 | __ssp_redirect(size_t, fread, (void *__restrict __buf, size_t __len, | |
| 50 | size_t __nmemb, FILE *__restrict __fp), (__buf, __len, __nmemb, __fp)); | |
| 51 | __ssp_redirect(size_t, fread_unlocked, (void *__restrict __buf, size_t __len, | |
| 52 | size_t __nmemb, FILE *__restrict __fp), (__buf, __len, __nmemb, __fp)); | |
| 53 | #if __EXT1_VISIBLE | |
| 54 | __ssp_redirect(char *, gets_s, (char *__buf, rsize_t __len), (__buf, __len)); | |
| 55 | #endif /* __EXT1_VISIBLE */ | |
| 56 | __ssp_redirect_raw(char *, tmpnam, tmpnam, (char *__buf), (__buf), 1, | |
| 57 | __ssp_bos, L_tmpnam); | |
| 58 | #endif | |
| 59 | ||
| 60 | int __sprintf_chk(char *__restrict, int, size_t, const char *__restrict, ...) | |
| 61 | __printflike(4, 5); | |
| 62 | int __vsprintf_chk(char *__restrict, int, size_t, const char *__restrict, | |
| 63 | __va_list) | |
| 64 | __printflike(4, 0); | |
| 65 | int __snprintf_chk(char *__restrict, size_t, int, size_t, | |
| 66 | const char *__restrict, ...) | |
| 67 | __printflike(5, 6); | |
| 68 | int __vsnprintf_chk(char *__restrict, size_t, int, size_t, | |
| 69 | const char *__restrict, __va_list) | |
| 70 | __printflike(5, 0); | |
| 71 | char *__fgets_chk(char *, int, size_t, FILE *); | |
| 72 | __END_DECLS | |
| 73 | ||
| 74 | #if __SSP_FORTIFY_LEVEL > 0 | |
| 75 | ||
| 76 | #define sprintf(str, ...) __extension__ ({	\ | |
| 77 | char *_ssp_str = (str);	\ | |
| 78 | __builtin___sprintf_chk(_ssp_str, 0, __ssp_bos(_ssp_str),		\ | |
| 79 | __VA_ARGS__); \ | |
| 80 | }) | |
| 81 | ||
| 82 | #define vsprintf(str, fmt, ap) __extension__ ({	\ | |
| 83 | char *_ssp_str = (str);		\ | |
| 84 | __builtin___vsprintf_chk(_ssp_str, 0, __ssp_bos(_ssp_str), fmt,	\ | |
| 85 | ap);				\ | |
| 86 | }) | |
| 87 | ||
| 88 | #define snprintf(str, len, ...) __extension__ ({	\ | |
| 89 | char *_ssp_str = (str);		\ | |
| 90 | __builtin___snprintf_chk(_ssp_str, len, 0, __ssp_bos(_ssp_str),	\ | |
| 91 | __VA_ARGS__);			\ | |
| 92 | }) | |
| 93 | ||
| 94 | #define vsnprintf(str, len, fmt, ap) __extension__ ({	\ | |
| 95 | char *_ssp_str = (str);		\ | |
| 96 | __builtin___vsnprintf_chk(_ssp_str, len, 0, __ssp_bos(_ssp_str),	\ | |
| 97 | fmt, ap);			\ | |
| 98 | }) | |
| 99 | ||
| 100 | #define fgets(str, len, fp) __extension__ ({		\ | |
| 101 | char *_ssp_str = (str);		\ | |
| 102 | __fgets_chk(_ssp_str, len, __ssp_bos(_ssp_str), fp);	\ | |
| 103 | }) | |
| 104 | ||
| 105 | #endif /* __SSP_FORTIFY_LEVEL > 0 */ | |
| 106 | ||
| 107 | #endif /* _SSP_STDIO_H_ */ | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/ssp/stdlib.h created+57| ... | ... | @@ -0,0 +1,57 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-2-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 2024, Klara, Inc. | |
| 5 | * | |
| 6 | * Redistribution and use in source and binary forms, with or without | |
| 7 | * modification, are permitted provided that the following conditions | |
| 8 | * are met: | |
| 9 | * 1. Redistributions of source code must retain the above copyright | |
| 10 | * notice, this list of conditions and the following disclaimer. | |
| 11 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 12 | * notice, this list of conditions and the following disclaimer in the | |
| 13 | * documentation and/or other materials provided with the distribution. | |
| 14 | * | |
| 15 | * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS | |
| 16 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | |
| 17 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
| 18 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | |
| 19 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
| 20 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
| 21 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
| 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
| 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
| 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
| 25 | * POSSIBILITY OF SUCH DAMAGE. | |
| 26 | */ | |
| 27 | #ifndef _SSP_STDLIB_H_ | |
| 28 | #define _SSP_STDLIB_H_ | |
| 29 | ||
| 30 | #include <ssp/ssp.h> | |
| 31 | ||
| 32 | #if __SSP_FORTIFY_LEVEL > 0 | |
| 33 | ||
| 34 | #include <limits.h> | |
| 35 | ||
| 36 | __BEGIN_DECLS | |
| 37 | ||
| 38 | __ssp_redirect(void, arc4random_buf, (void *__buf, size_t __len), | |
| 39 | (__buf, __len)); | |
| 40 | ||
| 41 | __ssp_redirect(int, getenv_r, | |
| 42 | (const char *name, char * _Nonnull __buf, size_t __len), | |
| 43 | (name, __buf, __len)); | |
| 44 | ||
| 45 | __ssp_redirect_raw_impl(char *, realpath, realpath, | |
| 46 | (const char *__restrict path, char *__restrict buf)) | |
| 47 | { | |
| 48 | 	if (__ssp_bos(buf) < PATH_MAX) | |
| 49 | 		__chk_fail(); | |
| 50 | ||
| 51 | 	return (__ssp_real(realpath)(path, buf)); | |
| 52 | } | |
| 53 | ||
| 54 | __END_DECLS | |
| 55 | ||
| 56 | #endif /* __SSP_FORTIFY_LEVEL > 0 */ | |
| 57 | #endif /* _SSP_STDLIB_H_ */ | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/ssp/string.h created+141| ... | ... | @@ -0,0 +1,141 @@ |
| 1 | /*	$NetBSD: string.h,v 1.14 2020/09/05 13:37:59 mrg Exp $	*/ | |
| 2 | ||
| 3 | /*- | |
| 4 | * | |
| 5 | * SPDX-License-Identifier: BSD-2-Clause | |
| 6 | * | |
| 7 | * Copyright (c) 2006 The NetBSD Foundation, Inc. | |
| 8 | * All rights reserved. | |
| 9 | * | |
| 10 | * This code is derived from software contributed to The NetBSD Foundation | |
| 11 | * by Christos Zoulas. | |
| 12 | * | |
| 13 | * Redistribution and use in source and binary forms, with or without | |
| 14 | * modification, are permitted provided that the following conditions | |
| 15 | * are met: | |
| 16 | * 1. Redistributions of source code must retain the above copyright | |
| 17 | * notice, this list of conditions and the following disclaimer. | |
| 18 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 19 | * notice, this list of conditions and the following disclaimer in the | |
| 20 | * documentation and/or other materials provided with the distribution. | |
| 21 | * | |
| 22 | * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS | |
| 23 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | |
| 24 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
| 25 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | |
| 26 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
| 27 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
| 28 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
| 29 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
| 30 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
| 31 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
| 32 | * POSSIBILITY OF SUCH DAMAGE. | |
| 33 | */ | |
| 34 | #ifndef _SSP_STRING_H_ | |
| 35 | #define _SSP_STRING_H_ | |
| 36 | ||
| 37 | #include <ssp/ssp.h> | |
| 38 | ||
| 39 | __BEGIN_DECLS | |
| 40 | void *__memcpy_chk(void *, const void *, size_t, size_t); | |
| 41 | void *__memmove_chk(void *, const void *, size_t, size_t); | |
| 42 | void *__memset_chk(void *, int, size_t, size_t); | |
| 43 | char *__stpcpy_chk(char *, const char *, size_t); | |
| 44 | char *__stpncpy_chk(char *, const char *, size_t, size_t); | |
| 45 | char *__strcat_chk(char *, const char *, size_t); | |
| 46 | char *__strcpy_chk(char *, const char *, size_t); | |
| 47 | char *__strncat_chk(char *, const char *, size_t, size_t); | |
| 48 | size_t __strlcat_chk(char *, const char *, size_t, size_t); | |
| 49 | char *__strncpy_chk(char *, const char *, size_t, size_t); | |
| 50 | size_t __strlcpy_chk(char *, const char *, size_t, size_t); | |
| 51 | __END_DECLS | |
| 52 | ||
| 53 | #if __SSP_FORTIFY_LEVEL > 0 | |
| 54 | ||
| 55 | #define __ssp_bos_check3_typed_var(fun, dsttype, dsrvar, dst, srctype, srcvar, \ | |
| 56 | src, lenvar, len) __extension__ ({				\ | |
| 57 | srctype srcvar = (src);				\ | |
| 58 | dsttype dstvar = (dst);				\ | |
| 59 | size_t lenvar = (len);				\ | |
| 60 | ((__ssp_bos0(dstvar) != (size_t)-1) ?		\ | |
| 61 | __builtin___ ## fun ## _chk(dstvar, srcvar, lenvar,	\ | |
| 62 | __ssp_bos0(dstvar)) :				\ | |
| 63 | __ ## fun ## _ichk(dstvar, srcvar, lenvar));	\ | |
| 64 | }) | |
| 65 | ||
| 66 | #define __ssp_bos_check3_typed(fun, dsttype, dst, srctype, src, len)	\ | |
| 67 | __ssp_bos_check3_typed_var(fun, dsttype, __ssp_var(dstv), dst,	\ | |
| 68 | srctype, __ssp_var(srcv), src, __ssp_var(lenv), len) | |
| 69 | ||
| 70 | #define __ssp_bos_check3(fun, dst, src, len)		\ | |
| 71 | __ssp_bos_check3_typed_var(fun, void *, __ssp_var(dstv), dst,	\ | |
| 72 | const void *, __ssp_var(srcv), src, __ssp_var(lenv), len) | |
| 73 | ||
| 74 | #define __ssp_bos_check2_var(fun, dstvar, dst, srcvar, src) __extension__ ({ 	\ | |
| 75 | const void *srcvar = (src);				\ | |
| 76 | void *dstvar = (dst);				\ | |
| 77 | ((__ssp_bos0(dstvar) != (size_t)-1) ?		\ | |
| 78 | __builtin___ ## fun ## _chk(dstvar, srcvar,		\ | |
| 79 | __ssp_bos0(dstvar)) :				\ | |
| 80 | __ ## fun ## _ichk(dstvar, srcvar));		\ | |
| 81 | }) | |
| 82 | ||
| 83 | #define __ssp_bos_check2(fun, dst, src)			\ | |
| 84 | __ssp_bos_check2_var(fun, __ssp_var(dstv), dst, __ssp_var(srcv), src) | |
| 85 | ||
| 86 | #define __ssp_bos_icheck3_restrict(fun, type1, type2) \ | |
| 87 | static __inline type1 __ ## fun ## _ichk(type1 __restrict, type2 __restrict, size_t); \ | |
| 88 | static __inline __attribute__((__always_inline__)) type1 \ | |
| 89 | __ ## fun ## _ichk(type1 __restrict dst, type2 __restrict src, size_t len) { \ | |
| 90 | 	return __builtin___ ## fun ## _chk(dst, src, len, __ssp_bos0(dst)); \ | |
| 91 | } | |
| 92 | ||
| 93 | #define __ssp_bos_icheck3(fun, type1, type2) \ | |
| 94 | static __inline type1 __ ## fun ## _ichk(type1, type2, size_t); \ | |
| 95 | static __inline __attribute__((__always_inline__)) type1 \ | |
| 96 | __ ## fun ## _ichk(type1 dst, type2 src, size_t len) { \ | |
| 97 | 	return __builtin___ ## fun ## _chk(dst, src, len, __ssp_bos0(dst)); \ | |
| 98 | } | |
| 99 | ||
| 100 | #define __ssp_bos_icheck2_restrict(fun, type1, type2) \ | |
| 101 | static __inline type1 __ ## fun ## _ichk(type1, type2); \ | |
| 102 | static __inline __attribute__((__always_inline__)) type1 \ | |
| 103 | __ ## fun ## _ichk(type1 __restrict dst, type2 __restrict src) { \ | |
| 104 | 	return __builtin___ ## fun ## _chk(dst, src, __ssp_bos0(dst)); \ | |
| 105 | } | |
| 106 | ||
| 107 | __BEGIN_DECLS | |
| 108 | __ssp_bos_icheck3_restrict(memcpy, void *, const void *) | |
| 109 | __ssp_bos_icheck3_restrict(mempcpy, void *, const void *) | |
| 110 | __ssp_bos_icheck3(memmove, void *, const void *) | |
| 111 | __ssp_bos_icheck3(memset, void *, int) | |
| 112 | __ssp_redirect(void *, memset_explicit, (void *__buf, int __ch, size_t __len), | |
| 113 | (__buf, __ch, __len)); | |
| 114 | __ssp_bos_icheck2_restrict(stpcpy, char *, const char *) | |
| 115 | __ssp_bos_icheck3_restrict(stpncpy, char *, const char *) | |
| 116 | __ssp_bos_icheck2_restrict(strcpy, char *, const char *) | |
| 117 | __ssp_bos_icheck2_restrict(strcat, char *, const char *) | |
| 118 | __ssp_redirect0(int, strerror_r, (int __errnum, char *__buf, size_t __len), | |
| 119 | (__errnum, __buf, __len)); | |
| 120 | __ssp_bos_icheck3_restrict(strncpy, char *, const char *) | |
| 121 | __ssp_bos_icheck3_restrict(strncat, char *, const char *) | |
| 122 | __END_DECLS | |
| 123 | ||
| 124 | #define memcpy(dst, src, len) __ssp_bos_check3(memcpy, dst, src, len) | |
| 125 | #define mempcpy(dst, src, len) __ssp_bos_check3(mempcpy, dst, src, len) | |
| 126 | #define memmove(dst, src, len) __ssp_bos_check3(memmove, dst, src, len) | |
| 127 | #define memset(dst, val, len) \ | |
| 128 | __ssp_bos_check3_typed(memset, void *, dst, int, val, len) | |
| 129 | #define stpcpy(dst, src) __ssp_bos_check2(stpcpy, dst, src) | |
| 130 | #define stpncpy(dst, src, len) __ssp_bos_check3(stpncpy, dst, src, len) | |
| 131 | #define strcpy(dst, src) __ssp_bos_check2(strcpy, dst, src) | |
| 132 | #define strcat(dst, src) __ssp_bos_check2(strcat, dst, src) | |
| 133 | #define strlcpy(dst, src, dstlen) \ | |
| 134 | __strlcpy_chk(dst, src, dstlen, __ssp_bos(dst)) | |
| 135 | #define strncpy(dst, src, len) __ssp_bos_check3(strncpy, dst, src, len) | |
| 136 | #define strlcat(dst, src, dstlen) \ | |
| 137 | __strlcat_chk(dst, src, dstlen, __ssp_bos(dst)) | |
| 138 | #define strncat(dst, src, len) __ssp_bos_check3(strncat, dst, src, len) | |
| 139 | ||
| 140 | #endif /* __SSP_FORTIFY_LEVEL > 0 */ | |
| 141 | #endif /* _SSP_STRING_H_ */ | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/ssp/strings.h created+72| ... | ... | @@ -0,0 +1,72 @@ |
| 1 | /*	$NetBSD: strings.h,v 1.3 2008/04/28 20:22:54 martin Exp $	*/ | |
| 2 | ||
| 3 | /*- | |
| 4 | * | |
| 5 | * SPDX-License-Identifier: BSD-2-Clause | |
| 6 | * | |
| 7 | * Copyright (c) 2007 The NetBSD Foundation, Inc. | |
| 8 | * All rights reserved. | |
| 9 | * | |
| 10 | * This code is derived from software contributed to The NetBSD Foundation | |
| 11 | * by Christos Zoulas. | |
| 12 | * | |
| 13 | * Redistribution and use in source and binary forms, with or without | |
| 14 | * modification, are permitted provided that the following conditions | |
| 15 | * are met: | |
| 16 | * 1. Redistributions of source code must retain the above copyright | |
| 17 | * notice, this list of conditions and the following disclaimer. | |
| 18 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 19 | * notice, this list of conditions and the following disclaimer in the | |
| 20 | * documentation and/or other materials provided with the distribution. | |
| 21 | * | |
| 22 | * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS | |
| 23 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | |
| 24 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
| 25 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | |
| 26 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
| 27 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
| 28 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
| 29 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
| 30 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
| 31 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
| 32 | * POSSIBILITY OF SUCH DAMAGE. | |
| 33 | */ | |
| 34 | #ifndef _SSP_STRINGS_H_ | |
| 35 | #define _SSP_STRINGS_H_ | |
| 36 | ||
| 37 | #include <ssp/ssp.h> | |
| 38 | #include <string.h> | |
| 39 | ||
| 40 | #if __SSP_FORTIFY_LEVEL > 0 | |
| 41 | ||
| 42 | #define _ssp_bcopy(srcvar, src, dstvar, dst, lenvar, len) __extension__ ({ \ | |
| 43 | const void *srcvar = (src);			\ | |
| 44 | void *dstvar = (dst);			\ | |
| 45 | size_t lenvar = (len);			\ | |
| 46 | ((__ssp_bos0(dstvar) != (size_t)-1) ?	\ | |
| 47 | __builtin___memmove_chk(dstvar, srcvar, lenvar,	\ | |
| 48 | __ssp_bos0(dstvar)) :			\ | |
| 49 | __memmove_ichk(dstvar, srcvar, lenvar));	\ | |
| 50 | }) | |
| 51 | ||
| 52 | #define	bcopy(src, dst, len)			\ | |
| 53 | _ssp_bcopy(__ssp_var(srcv), src, __ssp_var(dstv), dst, __ssp_var(lenv), len) | |
| 54 | ||
| 55 | #define _ssp_bzero(dstvar, dst, lenvar, len) __extension__ ({		\ | |
| 56 | void *dstvar = (dst);			\ | |
| 57 | size_t lenvar = (len);			\ | |
| 58 | ((__ssp_bos0(dstvar) != (size_t)-1) ?	\ | |
| 59 | __builtin___memset_chk(dstvar, 0, lenvar,	\ | |
| 60 | __ssp_bos0(dstvar)) : \ | |
| 61 | __memset_ichk(dstvar, 0, lenvar));		\ | |
| 62 | }) | |
| 63 | ||
| 64 | #define	bzero(dst, len)	_ssp_bzero(__ssp_var(dstv), dst, __ssp_var(lenv), len) | |
| 65 | ||
| 66 | __BEGIN_DECLS | |
| 67 | __ssp_redirect(void, explicit_bzero, (void *__buf, size_t __len), | |
| 68 | (__buf, __len)); | |
| 69 | __END_DECLS | |
| 70 | ||
| 71 | #endif /* __SSP_FORTIFY_LEVEL > 0 */ | |
| 72 | #endif /* _SSP_STRINGS_H_ */ | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/ssp/uio.h created+53| ... | ... | @@ -0,0 +1,53 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-2-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 2024, Klara, Inc. | |
| 5 | * | |
| 6 | * Redistribution and use in source and binary forms, with or without | |
| 7 | * modification, are permitted provided that the following conditions | |
| 8 | * are met: | |
| 9 | * 1. Redistributions of source code must retain the above copyright | |
| 10 | * notice, this list of conditions and the following disclaimer. | |
| 11 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 12 | * notice, this list of conditions and the following disclaimer in the | |
| 13 | * documentation and/or other materials provided with the distribution. | |
| 14 | * | |
| 15 | * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS | |
| 16 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | |
| 17 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
| 18 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | |
| 19 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
| 20 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
| 21 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
| 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
| 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
| 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
| 25 | * POSSIBILITY OF SUCH DAMAGE. | |
| 26 | */ | |
| 27 | #ifndef _SSP_UIO_H_ | |
| 28 | #define _SSP_UIO_H_ | |
| 29 | ||
| 30 | #include <ssp/ssp.h> | |
| 31 | ||
| 32 | #if __SSP_FORTIFY_LEVEL > 0 | |
| 33 | ||
| 34 | __BEGIN_DECLS | |
| 35 | ||
| 36 | __ssp_redirect_raw_impl(ssize_t, readv, readv, | |
| 37 | (int fd, const struct iovec *iov, int iovcnt)) | |
| 38 | { | |
| 39 | 	__ssp_check_iovec(iov, iovcnt); | |
| 40 | 	return (__ssp_real(readv)(fd, iov, iovcnt)); | |
| 41 | } | |
| 42 | ||
| 43 | __ssp_redirect_raw_impl(ssize_t, preadv, preadv, | |
| 44 | (int fd, const struct iovec *iov, int iovcnt, off_t offset)) | |
| 45 | { | |
| 46 | 	__ssp_check_iovec(iov, iovcnt); | |
| 47 | 	return (__ssp_real(preadv)(fd, iov, iovcnt, offset)); | |
| 48 | } | |
| 49 | ||
| 50 | __END_DECLS | |
| 51 | ||
| 52 | #endif /* __SSP_FORTIFY_LEVEL > 0 */ | |
| 53 | #endif /* _SSP_UIO_H_ */ | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/ssp/unistd.h created+90| ... | ... | @@ -0,0 +1,90 @@ |
| 1 | /*	$NetBSD: unistd.h,v 1.7 2015/06/25 18:41:03 joerg Exp $	*/ | |
| 2 | ||
| 3 | /*- | |
| 4 | * | |
| 5 | * SPDX-License-Identifier: BSD-2-Clause | |
| 6 | * | |
| 7 | * Copyright (c) 2006 The NetBSD Foundation, Inc. | |
| 8 | * All rights reserved. | |
| 9 | * | |
| 10 | * This code is derived from software contributed to The NetBSD Foundation | |
| 11 | * by Christos Zoulas. | |
| 12 | * | |
| 13 | * Redistribution and use in source and binary forms, with or without | |
| 14 | * modification, are permitted provided that the following conditions | |
| 15 | * are met: | |
| 16 | * 1. Redistributions of source code must retain the above copyright | |
| 17 | * notice, this list of conditions and the following disclaimer. | |
| 18 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 19 | * notice, this list of conditions and the following disclaimer in the | |
| 20 | * documentation and/or other materials provided with the distribution. | |
| 21 | * | |
| 22 | * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS | |
| 23 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | |
| 24 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
| 25 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | |
| 26 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
| 27 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
| 28 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
| 29 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
| 30 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
| 31 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
| 32 | * POSSIBILITY OF SUCH DAMAGE. | |
| 33 | */ | |
| 34 | #ifndef _SSP_UNISTD_H_ | |
| 35 | #define _SSP_UNISTD_H_ | |
| 36 | ||
| 37 | #include <ssp/ssp.h> | |
| 38 | ||
| 39 | #if __SSP_FORTIFY_LEVEL > 0 | |
| 40 | __BEGIN_DECLS | |
| 41 | ||
| 42 | #ifndef _FORTIFY_SOURCE_read | |
| 43 | #define	_FORTIFY_SOURCE_read	read | |
| 44 | #endif | |
| 45 | ||
| 46 | __ssp_inline size_t | |
| 47 | __ssp_gid_bos(const void *ptr) | |
| 48 | { | |
| 49 | 	size_t ptrsize = __ssp_bos(ptr); | |
| 50 | ||
| 51 | 	if (ptrsize == (size_t)-1) | |
| 52 | 		return (ptrsize); | |
| 53 | ||
| 54 | 	return (ptrsize / sizeof(gid_t)); | |
| 55 | } | |
| 56 | ||
| 57 | __ssp_redirect_raw(int, getgrouplist, getgrouplist, | |
| 58 | (const char *__name, gid_t __base, gid_t *__buf, int *__lenp), | |
| 59 | (__name, __base, __buf, __lenp), 1, __ssp_gid_bos, *__lenp); | |
| 60 | ||
| 61 | __ssp_redirect_raw(int, getgroups, getgroups, (int __len, gid_t *__buf), | |
| 62 | (__len, __buf), 1, __ssp_gid_bos, __len); | |
| 63 | ||
| 64 | __ssp_redirect(int, getloginclass, (char *__buf, size_t __len), | |
| 65 | (__buf, __len)); | |
| 66 | ||
| 67 | __ssp_redirect(ssize_t, _FORTIFY_SOURCE_read, (int __fd, void *__buf, | |
| 68 | size_t __len), (__fd, __buf, __len)); | |
| 69 | __ssp_redirect(ssize_t, pread, (int __fd, void *__buf, size_t __len, | |
| 70 | off_t __offset), (__fd, __buf, __len, __offset)); | |
| 71 | ||
| 72 | __ssp_redirect(ssize_t, readlink, (const char *__restrict __path, \ | |
| 73 | char *__restrict __buf, size_t __len), (__path, __buf, __len)); | |
| 74 | __ssp_redirect(ssize_t, readlinkat, (int __fd, const char *__restrict __path, | |
| 75 | 	char *__restrict __buf, size_t __len), (__fd, __path, __buf, __len)); | |
| 76 | ||
| 77 | __ssp_redirect_raw(char *, getcwd, getcwd, (char *__buf, size_t __len), | |
| 78 | (__buf, __len), __buf != 0, __ssp_bos, __len); | |
| 79 | ||
| 80 | __ssp_redirect(int, getdomainname, (char *__buf, int __len), (__buf, __len)); | |
| 81 | __ssp_redirect(int, getentropy, (void *__buf, size_t __len), (__buf, __len)); | |
| 82 | __ssp_redirect(int, gethostname, (char *__buf, size_t __len), (__buf, __len)); | |
| 83 | __ssp_redirect(int, getlogin_r, (char *__buf, size_t __len), (__buf, __len)); | |
| 84 | __ssp_redirect(int, ttyname_r, (int __fd, char *__buf, size_t __len), | |
| 85 | (__fd, __buf, __len)); | |
| 86 | ||
| 87 | __END_DECLS | |
| 88 | ||
| 89 | #endif /* __SSP_FORTIFY_LEVEL > 0 */ | |
| 90 | #endif /* _SSP_UNISTD_H_ */ | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/ssp/wchar.h created+229| ... | ... | @@ -0,0 +1,229 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-2-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 2024, Klara, Inc. | |
| 5 | * | |
| 6 | * Redistribution and use in source and binary forms, with or without | |
| 7 | * modification, are permitted provided that the following conditions | |
| 8 | * are met: | |
| 9 | * 1. Redistributions of source code must retain the above copyright | |
| 10 | * notice, this list of conditions and the following disclaimer. | |
| 11 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 12 | * notice, this list of conditions and the following disclaimer in the | |
| 13 | * documentation and/or other materials provided with the distribution. | |
| 14 | * | |
| 15 | * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS | |
| 16 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | |
| 17 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
| 18 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | |
| 19 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
| 20 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
| 21 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
| 22 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
| 23 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
| 24 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
| 25 | * POSSIBILITY OF SUCH DAMAGE. | |
| 26 | */ | |
| 27 | #ifndef _SSP_WCHAR_H_ | |
| 28 | #define _SSP_WCHAR_H_ | |
| 29 | ||
| 30 | #include <ssp/ssp.h> | |
| 31 | ||
| 32 | #if __SSP_FORTIFY_LEVEL > 0 | |
| 33 | ||
| 34 | __ssp_inline int | |
| 35 | __ssp_wchar_overlap(const void *leftp, const void *rightp, size_t len) | |
| 36 | { | |
| 37 | ||
| 38 | 	if (len > __SIZE_T_MAX / sizeof(wchar_t)) | |
| 39 | 		return (1); | |
| 40 | 	return (__ssp_overlap(leftp, rightp, len * sizeof(wchar_t))); | |
| 41 | } | |
| 42 | ||
| 43 | /* | |
| 44 | * __ssp_wbos for w*() calls where the size parameters are in sizeof(wchar_t) | |
| 45 | * units, so the result needs to be scaled appropriately. | |
| 46 | */ | |
| 47 | __ssp_inline size_t | |
| 48 | __ssp_wbos(void *ptr) | |
| 49 | { | |
| 50 | 	const size_t ptrsize = __ssp_bos(ptr); | |
| 51 | ||
| 52 | 	if (ptrsize == (size_t)-1) | |
| 53 | 		return (ptrsize); | |
| 54 | ||
| 55 | 	return (ptrsize / sizeof(wchar_t)); | |
| 56 | } | |
| 57 | ||
| 58 | __BEGIN_DECLS | |
| 59 | __ssp_redirect_raw_impl(wchar_t *, wmemcpy, wmemcpy, | |
| 60 | (wchar_t *__restrict buf, const wchar_t *__restrict src, size_t len)) | |
| 61 | { | |
| 62 | 	const size_t slen = __ssp_wbos(buf); | |
| 63 | ||
| 64 | 	if (len > slen) | |
| 65 | 		__chk_fail(); | |
| 66 | 	if (__ssp_wchar_overlap(src, buf, len)) | |
| 67 | 		__chk_fail(); | |
| 68 | ||
| 69 | 	return (__ssp_real(wmemcpy)(buf, src, len)); | |
| 70 | } | |
| 71 | ||
| 72 | __ssp_redirect_raw_impl(wchar_t *, wmempcpy, wmempcpy, | |
| 73 | (wchar_t *__restrict buf, const wchar_t *__restrict src, size_t len)) | |
| 74 | { | |
| 75 | 	const size_t slen = __ssp_wbos(buf); | |
| 76 | ||
| 77 | 	if (len > slen) | |
| 78 | 		__chk_fail(); | |
| 79 | 	if (__ssp_wchar_overlap(src, buf, len)) | |
| 80 | 		__chk_fail(); | |
| 81 | ||
| 82 | 	return (__ssp_real(wmempcpy)(buf, src, len)); | |
| 83 | } | |
| 84 | ||
| 85 | __ssp_redirect_raw_impl(wchar_t *, wmemmove, wmemmove, | |
| 86 | (wchar_t *buf, const wchar_t *src, size_t len)) | |
| 87 | { | |
| 88 | 	const size_t slen = __ssp_wbos(buf); | |
| 89 | ||
| 90 | 	if (len > slen) | |
| 91 | 		__chk_fail(); | |
| 92 | ||
| 93 | 	return (__ssp_real(wmemmove)(buf, src, len)); | |
| 94 | } | |
| 95 | ||
| 96 | __ssp_redirect_raw_impl(wchar_t *, wmemset, wmemset, | |
| 97 | (wchar_t *buf, wchar_t c, size_t len)) | |
| 98 | { | |
| 99 | 	const size_t slen = __ssp_wbos(buf); | |
| 100 | ||
| 101 | 	if (len > slen) | |
| 102 | 		__chk_fail(); | |
| 103 | 	return (__ssp_real(wmemset)(buf, c, len)); | |
| 104 | } | |
| 105 | ||
| 106 | __ssp_redirect_raw_impl(wchar_t *, wcpcpy, wcpcpy, | |
| 107 | (wchar_t *__restrict buf, const wchar_t *__restrict src)) | |
| 108 | { | |
| 109 | 	const size_t slen = __ssp_wbos(buf); | |
| 110 | 	const size_t len = wcslen(src); | |
| 111 | ||
| 112 | 	if (len >= slen) | |
| 113 | 		__chk_fail(); | |
| 114 | 	if (__ssp_wchar_overlap(buf, src, len)) | |
| 115 | 		__chk_fail(); | |
| 116 | ||
| 117 | 	(void)__ssp_real(wmemcpy)(buf, src, len + 1); | |
| 118 | 	return (buf + len); | |
| 119 | } | |
| 120 | ||
| 121 | __ssp_redirect_raw_impl(wchar_t *, wcpncpy, wcpncpy, | |
| 122 | (wchar_t *__restrict buf, const wchar_t *__restrict src, size_t len)) | |
| 123 | { | |
| 124 | 	const size_t slen = __ssp_wbos(buf); | |
| 125 | ||
| 126 | 	if (len > slen) | |
| 127 | 		__chk_fail(); | |
| 128 | 	if (__ssp_wchar_overlap(buf, src, len)) | |
| 129 | 		__chk_fail(); | |
| 130 | ||
| 131 | 	return (__ssp_real(wcpncpy)(buf, src, len)); | |
| 132 | } | |
| 133 | ||
| 134 | __ssp_redirect_raw_impl(wchar_t *, wcscat, wcscat, | |
| 135 | (wchar_t *__restrict buf, const wchar_t *__restrict src)) | |
| 136 | { | |
| 137 | 	size_t slen = __ssp_wbos(buf); | |
| 138 | 	wchar_t *cp; | |
| 139 | ||
| 140 | 	cp = buf; | |
| 141 | 	while (*cp != L'\0') { | |
| 142 | 		cp++; | |
| 143 | 		if (slen-- == 0) | |
| 144 | 			__chk_fail(); | |
| 145 | 	} | |
| 146 | ||
| 147 | 	while (*src != L'\0') { | |
| 148 | 		if (slen-- == 0) | |
| 149 | 			__chk_fail(); | |
| 150 | 		*cp++ = *src++; | |
| 151 | 	} | |
| 152 | ||
| 153 | 	if (slen-- == 0) | |
| 154 | 		__chk_fail(); | |
| 155 | 	*cp = '\0'; | |
| 156 | 	return (buf); | |
| 157 | } | |
| 158 | ||
| 159 | __ssp_redirect_raw_impl(wchar_t *, wcscpy, wcscpy, | |
| 160 | (wchar_t *__restrict buf, const wchar_t *__restrict src)) | |
| 161 | { | |
| 162 | 	const size_t slen = __ssp_wbos(buf); | |
| 163 | 	size_t len = wcslen(src) + 1; | |
| 164 | ||
| 165 | 	if (len > slen) | |
| 166 | 		__chk_fail(); | |
| 167 | 	if (__ssp_wchar_overlap(buf, src, len)) | |
| 168 | 		__chk_fail(); | |
| 169 | ||
| 170 | 	return (__ssp_real(wmemcpy)(buf, src, len)); | |
| 171 | } | |
| 172 | ||
| 173 | __ssp_redirect_raw_impl(wchar_t *, wcsncat, wcsncat, | |
| 174 | (wchar_t *__restrict buf, const wchar_t *__restrict src, size_t len)) | |
| 175 | { | |
| 176 | 	const size_t slen = __ssp_wbos(buf); | |
| 177 | ||
| 178 | 	if (len == 0) | |
| 179 | 		return (buf); | |
| 180 | 	if (len > slen) | |
| 181 | 		__chk_fail(); | |
| 182 | 	if (__ssp_wchar_overlap(buf, src, len)) | |
| 183 | 		__chk_fail(); | |
| 184 | ||
| 185 | 	return (__ssp_real(wcsncat)(buf, src, len)); | |
| 186 | } | |
| 187 | ||
| 188 | __ssp_redirect_raw_impl(size_t, wcslcat, wcslcat, | |
| 189 | (wchar_t *__restrict buf, const wchar_t *__restrict src, size_t len)) | |
| 190 | { | |
| 191 | 	const size_t slen = __ssp_wbos(buf); | |
| 192 | ||
| 193 | 	if (len > slen) | |
| 194 | 		__chk_fail(); | |
| 195 | 	if (__ssp_wchar_overlap(buf, src, len)) | |
| 196 | 		__chk_fail(); | |
| 197 | ||
| 198 | 	return (__ssp_real(wcslcat)(buf, src, len)); | |
| 199 | } | |
| 200 | ||
| 201 | __ssp_redirect_raw_impl(wchar_t *, wcsncpy, wcsncpy, | |
| 202 | (wchar_t *__restrict buf, const wchar_t *__restrict src, size_t len)) | |
| 203 | { | |
| 204 | 	const size_t slen = __ssp_wbos(buf); | |
| 205 | ||
| 206 | 	if (len > slen) | |
| 207 | 		__chk_fail(); | |
| 208 | 	if (__ssp_wchar_overlap(buf, src, len)) | |
| 209 | 		__chk_fail(); | |
| 210 | ||
| 211 | 	return (__ssp_real(wcsncpy)(buf, src, len)); | |
| 212 | } | |
| 213 | ||
| 214 | __ssp_redirect_raw_impl(size_t, wcslcpy, wcslcpy, | |
| 215 | (wchar_t *__restrict buf, const wchar_t *__restrict src, size_t len)) | |
| 216 | { | |
| 217 | 	const size_t slen = __ssp_wbos(buf); | |
| 218 | ||
| 219 | 	if (len > slen) | |
| 220 | 		__chk_fail(); | |
| 221 | 	if (__ssp_wchar_overlap(buf, src, len)) | |
| 222 | 		__chk_fail(); | |
| 223 | ||
| 224 | 	return (__ssp_real(wcslcpy)(buf, src, len)); | |
| 225 | } | |
| 226 | __END_DECLS | |
| 227 | ||
| 228 | #endif /* __SSP_FORTIFY_LEVEL > 0 */ | |
| 229 | #endif /* _SSP_WCHAR_H_ */ | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/stab.h-2| ... | ... | @@ -27,8 +27,6 @@ |
| 27 | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | * | |
| 31 | *	@(#)stab.h	8.1 (Berkeley) 6/2/93 | |
| 32 | 30 | */ |
| 33 | 31 | |
| 34 | 32 | #ifndef _STAB_H_ |
lib/libc/include/generic-freebsd/stdarg.h+3-34| ... | ... | @@ -1,37 +1,6 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-2-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 2017 Poul-Henning Kamp. All rights reserved. | |
| 5 | * | |
| 6 | * Redistribution and use in source and binary forms, with or without | |
| 7 | * modification, are permitted provided that the following conditions | |
| 8 | * are met: | |
| 9 | * 1. Redistributions of source code must retain the above copyright | |
| 10 | * notice, this list of conditions and the following disclaimer. | |
| 11 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 12 | * notice, this list of conditions and the following disclaimer in the | |
| 13 | * documentation and/or other materials provided with the distribution. | |
| 14 | * | |
| 15 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |
| 16 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 17 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
| 18 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | |
| 19 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
| 20 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
| 21 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
| 22 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
| 23 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
| 24 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
| 25 | * SUCH DAMAGE. | |
| 26 | */ | |
| 27 | ||
| 28 | #ifndef _MACHINE_STDARG_H_ | |
| 29 | #define	_MACHINE_STDARG_H_ | |
| 1 | #ifndef __SYS_STDARG_H__ | |
| 2 | #define	__SYS_STDARG_H__ | |
| 30 | 3 | |
| 31 | 4 | #include <sys/_stdarg.h> |
| 32 | 5 | |
| 33 | #ifndef va_start | |
| 34 | #error this file needs to be ported to your compiler | |
| 35 | #endif | |
| 36 | ||
| 37 | #endif /* !_MACHINE_STDARG_H_ */ | |
| \ No newline at end of file | ||
| 6 | #endif	/* __SYS_STDARG_H__ */ | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/stdatomic.h+2-1| ... | ... | @@ -33,7 +33,8 @@ |
| 33 | 33 | #include <sys/cdefs.h> |
| 34 | 34 | #include <sys/_types.h> |
| 35 | 35 | |
| 36 | #if __has_extension(c_atomic) || __has_extension(cxx_atomic) | |
| 36 | #if (__has_extension(c_atomic) || __has_extension(cxx_atomic)) && \ | |
| 37 | defined(__clang__) | |
| 37 | 38 | #define	__CLANG_ATOMICS |
| 38 | 39 | #elif __GNUC_PREREQ__(4, 7) |
| 39 | 40 | #define	__GNUC_ATOMICS |
lib/libc/include/generic-freebsd/stdckdint.h+3-3| ... | ... | @@ -13,7 +13,7 @@ |
| 13 | 13 | |
| 14 | 14 | #if __GNUC_PREREQ__(5, 1) || __has_builtin(__builtin_add_overflow) |
| 15 | 15 | #define ckd_add(result, a, b)						\ |
| 16 | 	(_Bool)__builtin_add_overflow((a), (b), (result)) | |
| 16 | 	__builtin_add_overflow((a), (b), (result)) | |
| 17 | 17 | #else |
| 18 | 18 | #define ckd_add(result, a, b)						\ |
| 19 | 19 | 	_Static_assert(0, "checked addition not supported") |
| ... | ... | @@ -21,7 +21,7 @@ |
| 21 | 21 | |
| 22 | 22 | #if __GNUC_PREREQ__(5, 1) || __has_builtin(__builtin_sub_overflow) |
| 23 | 23 | #define ckd_sub(result, a, b)						\ |
| 24 | 	(_Bool)__builtin_sub_overflow((a), (b), (result)) | |
| 24 | 	__builtin_sub_overflow((a), (b), (result)) | |
| 25 | 25 | #else |
| 26 | 26 | #define ckd_sub(result, a, b)						\ |
| 27 | 27 | 	_Static_assert(0, "checked subtraction not supported") |
| ... | ... | @@ -29,7 +29,7 @@ |
| 29 | 29 | |
| 30 | 30 | #if __GNUC_PREREQ__(5, 1) || __has_builtin(__builtin_mul_overflow) |
| 31 | 31 | #define ckd_mul(result, a, b)						\ |
| 32 | 	(_Bool)__builtin_mul_overflow((a), (b), (result)) | |
| 32 | 	__builtin_mul_overflow((a), (b), (result)) | |
| 33 | 33 | #else |
| 34 | 34 | #define ckd_mul(result, a, b)						\ |
| 35 | 35 | 	_Static_assert(0, "checked multiplication not supported") |
lib/libc/include/generic-freebsd/stddef.h+4-11| ... | ... | @@ -27,29 +27,20 @@ |
| 27 | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | * | |
| 31 | *	@(#)stddef.h	8.1 (Berkeley) 6/2/93 | |
| 32 | 30 | */ |
| 33 | 31 | |
| 34 | 32 | #ifndef _STDDEF_H_ |
| 35 | 33 | #define _STDDEF_H_ |
| 36 | 34 | |
| 37 | #include <sys/cdefs.h> | |
| 38 | 35 | #include <sys/_null.h> |
| 39 | 36 | #include <sys/_types.h> |
| 37 | #include <sys/_visible.h> | |
| 40 | 38 | |
| 41 | 39 | #ifndef _PTRDIFF_T_DECLARED |
| 42 | 40 | typedef	__ptrdiff_t	ptrdiff_t; |
| 43 | 41 | #define	_PTRDIFF_T_DECLARED |
| 44 | 42 | #endif |
| 45 | 43 | |
| 46 | #if __BSD_VISIBLE | |
| 47 | #ifndef _RUNE_T_DECLARED | |
| 48 | typedef	__rune_t	rune_t; | |
| 49 | #define	_RUNE_T_DECLARED | |
| 50 | #endif | |
| 51 | #endif | |
| 52 | ||
| 53 | 44 | #ifndef _SIZE_T_DECLARED |
| 54 | 45 | typedef	__size_t	size_t; |
| 55 | 46 | #define	_SIZE_T_DECLARED |
| ... | ... | @@ -70,7 +61,9 @@ typedef	__max_align_t	max_align_t; |
| 70 | 61 | #endif |
| 71 | 62 | #endif |
| 72 | 63 | |
| 73 | #define	offsetof(type, field)	__offsetof(type, field) | |
| 64 | #ifndef offsetof | |
| 65 | #define	offsetof(type, field)	__builtin_offsetof(type, field) | |
| 66 | #endif | |
| 74 | 67 | |
| 75 | 68 | #if __EXT1_VISIBLE |
| 76 | 69 | /* ISO/IEC 9899:2011 K.3.3.2 */ |
lib/libc/include/generic-freebsd/stdio.h+26-21| ... | ... | @@ -30,8 +30,6 @@ |
| 30 | 30 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 31 | 31 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 32 | 32 | * SUCH DAMAGE. |
| 33 | * | |
| 34 | *	@(#)stdio.h	8.5 (Berkeley) 4/29/95 | |
| 35 | 33 | */ |
| 36 | 34 | |
| 37 | 35 | #ifndef	_STDIO_H_ |
| ... | ... | @@ -50,10 +48,13 @@ typedef	__size_t	size_t; |
| 50 | 48 | #define	_SIZE_T_DECLARED |
| 51 | 49 | #endif |
| 52 | 50 | |
| 51 | #if __EXT1_VISIBLE | |
| 52 | /* ISO/IEC 9899:2011 K.3.3.2 */ | |
| 53 | 53 | #ifndef _RSIZE_T_DEFINED |
| 54 | 54 | #define _RSIZE_T_DEFINED |
| 55 | 55 | typedef size_t rsize_t; |
| 56 | 56 | #endif |
| 57 | #endif /* __EXT1_VISIBLE */ | |
| 57 | 58 | |
| 58 | 59 | #if __POSIX_VISIBLE >= 200809 |
| 59 | 60 | #ifndef _OFF_T_DECLARED |
| ... | ... | @@ -73,7 +74,7 @@ typedef	__off64_t	off64_t; |
| 73 | 74 | |
| 74 | 75 | #if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE |
| 75 | 76 | #ifndef _VA_LIST_DECLARED |
| 76 | typedef	__va_list	va_list; | |
| 77 | typedef	__builtin_va_list	va_list; | |
| 77 | 78 | #define	_VA_LIST_DECLARED |
| 78 | 79 | #endif |
| 79 | 80 | #endif |
| ... | ... | @@ -240,6 +241,21 @@ __END_DECLS |
| 240 | 241 | #define	stdout	__stdoutp |
| 241 | 242 | #define	stderr	__stderrp |
| 242 | 243 | |
| 244 | /* | |
| 245 | * Functions defined in all versions of POSIX 1003.1. | |
| 246 | */ | |
| 247 | #if __BSD_VISIBLE || (__POSIX_VISIBLE && __POSIX_VISIBLE <= 199506) | |
| 248 | #define	L_cuserid	17	/* size for cuserid(3); MAXLOGNAME, legacy */ | |
| 249 | #endif | |
| 250 | ||
| 251 | #if __POSIX_VISIBLE | |
| 252 | #define	L_ctermid	1024	/* size for ctermid(3); PATH_MAX */ | |
| 253 | #endif /* __POSIX_VISIBLE */ | |
| 254 | ||
| 255 | #if !defined(_STANDALONE) && defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE > 0 | |
| 256 | #include <ssp/stdio.h> | |
| 257 | #endif | |
| 258 | ||
| 243 | 259 | __BEGIN_DECLS |
| 244 | 260 | #ifdef _XLOCALE_H_ |
| 245 | 261 | #include <xlocale/_stdio.h> |
| ... | ... | @@ -254,7 +270,7 @@ int	 ferror(FILE *); |
| 254 | 270 | int	 fflush(FILE *); |
| 255 | 271 | int	 fgetc(FILE *); |
| 256 | 272 | int	 fgetpos(FILE * __restrict, fpos_t * __restrict); |
| 257 | char	*fgets(char * __restrict, int, FILE * __restrict); | |
| 273 | char	*(fgets)(char * __restrict, int, FILE * __restrict); | |
| 258 | 274 | FILE	*fopen(const char * __restrict, const char * __restrict); |
| 259 | 275 | int	 fprintf(FILE * __restrict, const char * __restrict, ...); |
| 260 | 276 | int	 fputc(int, FILE *); |
| ... | ... | @@ -282,7 +298,7 @@ void	 rewind(FILE *); |
| 282 | 298 | int	 scanf(const char * __restrict, ...); |
| 283 | 299 | void	 setbuf(FILE * __restrict, char * __restrict); |
| 284 | 300 | int	 setvbuf(FILE * __restrict, char * __restrict, int, size_t); |
| 285 | int	 sprintf(char * __restrict, const char * __restrict, ...); | |
| 301 | int	 (sprintf)(char * __restrict, const char * __restrict, ...); | |
| 286 | 302 | int	 sscanf(const char * __restrict, const char * __restrict, ...); |
| 287 | 303 | FILE	*tmpfile(void); |
| 288 | 304 | char	*tmpnam(char *); |
| ... | ... | @@ -290,13 +306,13 @@ int	 ungetc(int, FILE *); |
| 290 | 306 | int	 vfprintf(FILE * __restrict, const char * __restrict, |
| 291 | 307 | 	 __va_list); |
| 292 | 308 | int	 vprintf(const char * __restrict, __va_list); |
| 293 | int	 vsprintf(char * __restrict, const char * __restrict, | |
| 309 | int	 (vsprintf)(char * __restrict, const char * __restrict, | |
| 294 | 310 | 	 __va_list); |
| 295 | 311 | |
| 296 | 312 | #if __ISO_C_VISIBLE >= 1999 || __POSIX_VISIBLE >= 199506 |
| 297 | int	 snprintf(char * __restrict, size_t, const char * __restrict, | |
| 313 | int	 (snprintf)(char * __restrict, size_t, const char * __restrict, | |
| 298 | 314 | 	 ...) __printflike(3, 4); |
| 299 | int	 vsnprintf(char * __restrict, size_t, const char * __restrict, | |
| 315 | int	 (vsnprintf)(char * __restrict, size_t, const char * __restrict, | |
| 300 | 316 | 	 __va_list) __printflike(3, 0); |
| 301 | 317 | #endif |
| 302 | 318 | #if __ISO_C_VISIBLE >= 1999 |
| ... | ... | @@ -307,16 +323,7 @@ int	 vsscanf(const char * __restrict, const char * __restrict, __va_list) |
| 307 | 323 | 	 __scanflike(2, 0); |
| 308 | 324 | #endif |
| 309 | 325 | |
| 310 | /* | |
| 311 | * Functions defined in all versions of POSIX 1003.1. | |
| 312 | */ | |
| 313 | #if __BSD_VISIBLE || (__POSIX_VISIBLE && __POSIX_VISIBLE <= 199506) | |
| 314 | #define	L_cuserid	17	/* size for cuserid(3); MAXLOGNAME, legacy */ | |
| 315 | #endif | |
| 316 | ||
| 317 | 326 | #if __POSIX_VISIBLE |
| 318 | #define	L_ctermid	1024	/* size for ctermid(3); PATH_MAX */ | |
| 319 | ||
| 320 | 327 | char	*ctermid(char *); |
| 321 | 328 | FILE	*fdopen(int, const char *); |
| 322 | 329 | int	 fileno(FILE *); |
| ... | ... | @@ -415,6 +422,7 @@ FILE	*funopen(const void *, |
| 415 | 422 | #define	fropen(cookie, fn) funopen(cookie, fn, 0, 0, 0) |
| 416 | 423 | #define	fwopen(cookie, fn) funopen(cookie, 0, fn, 0, 0) |
| 417 | 424 | |
| 425 | #if __BSD_VISIBLE | |
| 418 | 426 | typedef __ssize_t cookie_read_function_t(void *, char *, size_t); |
| 419 | 427 | typedef __ssize_t cookie_write_function_t(void *, const char *, size_t); |
| 420 | 428 | typedef int cookie_seek_function_t(void *, off64_t *, int); |
| ... | ... | @@ -426,6 +434,7 @@ typedef struct { |
| 426 | 434 | 	cookie_close_function_t	*close; |
| 427 | 435 | } cookie_io_functions_t; |
| 428 | 436 | FILE	*fopencookie(void *, const char *, cookie_io_functions_t); |
| 437 | #endif | |
| 429 | 438 | |
| 430 | 439 | /* |
| 431 | 440 | * Portability hacks. See <sys/types.h>. |
| ... | ... | @@ -497,10 +506,6 @@ extern int __isthreaded; |
| 497 | 506 | #define	ferror(p)	(!__isthreaded ? __sferror(p) : (ferror)(p)) |
| 498 | 507 | #define	clearerr(p)	(!__isthreaded ? __sclearerr(p) : (clearerr)(p)) |
| 499 | 508 | |
| 500 | #if __POSIX_VISIBLE | |
| 501 | #define	fileno(p)	(!__isthreaded ? __sfileno(p) : (fileno)(p)) | |
| 502 | #endif | |
| 503 | ||
| 504 | 509 | #define	getc(fp)	(!__isthreaded ? __sgetc(fp) : (getc)(fp)) |
| 505 | 510 | #define	putc(x, fp)	(!__isthreaded ? __sputc(x, fp) : (putc)(x, fp)) |
| 506 | 511 |
lib/libc/include/generic-freebsd/stdlib.h+22-21| ... | ... | @@ -27,8 +27,6 @@ |
| 27 | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | * | |
| 31 | *	@(#)stdlib.h	8.5 (Berkeley) 5/19/95 | |
| 32 | 30 | */ |
| 33 | 31 | |
| 34 | 32 | #ifndef _STDLIB_H_ |
| ... | ... | @@ -40,13 +38,6 @@ |
| 40 | 38 | |
| 41 | 39 | __NULLABILITY_PRAGMA_PUSH |
| 42 | 40 | |
| 43 | #if __BSD_VISIBLE | |
| 44 | #ifndef _RUNE_T_DECLARED | |
| 45 | typedef	__rune_t	rune_t; | |
| 46 | #define	_RUNE_T_DECLARED | |
| 47 | #endif | |
| 48 | #endif | |
| 49 | ||
| 50 | 41 | #ifndef _SIZE_T_DECLARED |
| 51 | 42 | typedef	__size_t	size_t; |
| 52 | 43 | #define	_SIZE_T_DECLARED |
| ... | ... | @@ -78,6 +69,10 @@ typedef struct { |
| 78 | 69 | */ |
| 79 | 70 | #define	RAND_MAX	0x7fffffff |
| 80 | 71 | |
| 72 | #if !defined(_STANDALONE) && defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE > 0 | |
| 73 | #include <ssp/stdlib.h> | |
| 74 | #endif | |
| 75 | ||
| 81 | 76 | __BEGIN_DECLS |
| 82 | 77 | #ifdef _XLOCALE_H_ |
| 83 | 78 | #include <xlocale/_stdlib.h> |
| ... | ... | @@ -86,9 +81,9 @@ extern int __mb_cur_max; |
| 86 | 81 | extern int ___mb_cur_max(void); |
| 87 | 82 | #define	MB_CUR_MAX	((size_t)___mb_cur_max()) |
| 88 | 83 | |
| 89 | _Noreturn void	 abort(void); | |
| 84 | _Noreturn void	 abort(void) __noexcept; | |
| 90 | 85 | int	 abs(int) __pure2; |
| 91 | int	 atexit(void (* _Nonnull)(void)); | |
| 86 | int	 atexit(void (* _Nonnull)(void)) __noexcept; | |
| 92 | 87 | double	 atof(const char *); |
| 93 | 88 | int	 atoi(const char *); |
| 94 | 89 | long	 atol(const char *); |
| ... | ... | @@ -100,6 +95,9 @@ div_t	 div(int, int) __pure2; |
| 100 | 95 | _Noreturn void	 exit(int); |
| 101 | 96 | void	 free(void *); |
| 102 | 97 | char	*getenv(const char *); |
| 98 | #if __BSD_VISIBLE | |
| 99 | int	 getenv_r(const char *, char * _Nonnull, size_t); | |
| 100 | #endif | |
| 103 | 101 | long	 labs(long) __pure2; |
| 104 | 102 | ldiv_t	 ldiv(long, long) __pure2; |
| 105 | 103 | void	*malloc(size_t) __malloc_like __result_use_check __alloc_size(1); |
| ... | ... | @@ -156,7 +154,7 @@ unsigned long long |
| 156 | 154 | 	 strtoull(const char * __restrict, char ** __restrict, int); |
| 157 | 155 | #endif /* __LONG_LONG_SUPPORTED */ |
| 158 | 156 | |
| 159 | _Noreturn void	 _Exit(int); | |
| 157 | _Noreturn void	 _Exit(int) __noexcept; | |
| 160 | 158 | #endif /* __ISO_C_VISIBLE >= 1999 */ |
| 161 | 159 | |
| 162 | 160 | /* |
| ... | ... | @@ -165,9 +163,9 @@ _Noreturn void	 _Exit(int); |
| 165 | 163 | #if __ISO_C_VISIBLE >= 2011 || __cplusplus >= 201103L |
| 166 | 164 | void *	aligned_alloc(size_t, size_t) __malloc_like __alloc_align(1) |
| 167 | 165 | 	 __alloc_size(2); |
| 168 | int	at_quick_exit(void (*)(void)); | |
| 166 | int	at_quick_exit(void (*)(void)) __noexcept; | |
| 169 | 167 | _Noreturn void |
| 170 | 	quick_exit(int); | |
| 168 | 	quick_exit(int) /* __noexcept -- not ready ABI issues? */; | |
| 171 | 169 | #endif /* __ISO_C_VISIBLE >= 2011 */ |
| 172 | 170 | /* |
| 173 | 171 | * Extensions made by POSIX relative to C. |
| ... | ... | @@ -339,23 +337,26 @@ __uint64_t |
| 339 | 337 | * parameter, and both are different from the ones expected by the historical |
| 340 | 338 | * FreeBSD qsort_r() interface. |
| 341 | 339 | * |
| 342 | * Apply a workaround where we explicitly link against the historical | |
| 343 | * interface, qsort_r@FBSD_1.0, in case when qsort_r() is called with | |
| 344 | * the last parameter with a function pointer that exactly matches the | |
| 345 | * historical FreeBSD qsort_r() comparator signature, so applications | |
| 346 | * written for the historical interface can continue to work without | |
| 347 | * modification. | |
| 340 | * Apply a workaround where we explicitly link against the historical interface, | |
| 341 | * qsort_r@FBSD_1.0, in case when qsort_r() is called with the last parameter | |
| 342 | * with a function pointer that exactly matches the historical FreeBSD qsort_r() | |
| 343 | * comparator signature, so applications written for the historical interface | |
| 344 | * can continue to work without modification. Toolchains that don't support | |
| 345 | * symbol versioning don't define __sym_compat, so only provide this symbol in | |
| 346 | * supported environments. | |
| 348 | 347 | */ |
| 348 | #ifdef __sym_compat | |
| 349 | 349 | #if defined(__generic) || defined(__cplusplus) |
| 350 | 350 | void __qsort_r_compat(void *, size_t, size_t, void *, |
| 351 | 351 | 	 int (*)(void *, const void *, const void *)); |
| 352 | 352 | __sym_compat(qsort_r, __qsort_r_compat, FBSD_1.0); |
| 353 | 353 | #endif |
| 354 | #endif | |
| 354 | 355 | #if defined(__generic) && !defined(__cplusplus) |
| 355 | 356 | #define	qsort_r(base, nel, width, arg4, arg5)				\ |
| 356 | 357 | __generic(arg5, int (*)(void *, const void *, const void *),	\ |
| 357 | 358 | __qsort_r_compat, qsort_r)(base, nel, width, arg4, arg5) |
| 358 | #elif defined(__cplusplus) | |
| 359 | #elif defined(__cplusplus) && defined(__sym_compat) | |
| 359 | 360 | __END_DECLS |
| 360 | 361 | extern "C++" { |
| 361 | 362 | static inline void qsort_r(void *base, size_t nmemb, size_t size, |
lib/libc/include/generic-freebsd/string.h+24-17| ... | ... | @@ -27,8 +27,6 @@ |
| 27 | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | * | |
| 31 | *	@(#)string.h	8.1 (Berkeley) 6/2/93 | |
| 32 | 30 | */ |
| 33 | 31 | |
| 34 | 32 | #ifndef _STRING_H_ |
| ... | ... | @@ -51,8 +49,12 @@ typedef	__size_t	size_t; |
| 51 | 49 | #define	_SIZE_T_DECLARED |
| 52 | 50 | #endif |
| 53 | 51 | |
| 52 | #if !defined(_STANDALONE) && defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE > 0 | |
| 53 | #include <ssp/string.h> | |
| 54 | #endif | |
| 55 | ||
| 54 | 56 | __BEGIN_DECLS |
| 55 | #if __XSI_VISIBLE >= 600 | |
| 57 | #if __XSI_VISIBLE >= 600 || __ISO_C_VISIBLE >= 2023 | |
| 56 | 58 | void	*memccpy(void * __restrict, const void * __restrict, int, size_t); |
| 57 | 59 | #endif |
| 58 | 60 | void	*memchr(const void *, int, size_t) __pure; |
| ... | ... | @@ -60,23 +62,26 @@ void	*memchr(const void *, int, size_t) __pure; |
| 60 | 62 | void	*memrchr(const void *, int, size_t) __pure; |
| 61 | 63 | #endif |
| 62 | 64 | int	 memcmp(const void *, const void *, size_t) __pure; |
| 63 | void	*memcpy(void * __restrict, const void * __restrict, size_t); | |
| 65 | void	*(memcpy)(void * __restrict, const void * __restrict, size_t); | |
| 64 | 66 | #if __BSD_VISIBLE |
| 65 | 67 | void	*memmem(const void *, size_t, const void *, size_t) __pure; |
| 66 | 68 | #endif |
| 67 | void	*memmove(void *, const void *, size_t); | |
| 69 | void	*(memmove)(void *, const void *, size_t); | |
| 68 | 70 | #if __BSD_VISIBLE |
| 69 | void	*mempcpy(void * __restrict, const void * __restrict, size_t); | |
| 71 | void	*(mempcpy)(void * __restrict, const void * __restrict, size_t); | |
| 72 | #endif | |
| 73 | void	*(memset)(void *, int, size_t); | |
| 74 | #if __BSD_VISIBLE || __ISO_C_VISIBLE >= 2023 | |
| 75 | void	*memset_explicit(void *, int, size_t); | |
| 70 | 76 | #endif |
| 71 | void	*memset(void *, int, size_t); | |
| 72 | 77 | #if __POSIX_VISIBLE >= 200809 |
| 73 | char	*stpcpy(char * __restrict, const char * __restrict); | |
| 74 | char	*stpncpy(char * __restrict, const char * __restrict, size_t); | |
| 78 | char	*(stpcpy)(char * __restrict, const char * __restrict); | |
| 79 | char	*(stpncpy)(char * __restrict, const char * __restrict, size_t); | |
| 75 | 80 | #endif |
| 76 | 81 | #if __BSD_VISIBLE |
| 77 | 82 | char	*strcasestr(const char *, const char *) __pure; |
| 78 | 83 | #endif |
| 79 | char	*strcat(char * __restrict, const char * __restrict); | |
| 84 | char	*(strcat)(char * __restrict, const char * __restrict); | |
| 80 | 85 | char	*strchr(const char *, int) __pure; |
| 81 | 86 | #if __BSD_VISIBLE |
| 82 | 87 | char	*strchrnul(const char*, int) __pure; |
| ... | ... | @@ -84,9 +89,9 @@ int	 strverscmp(const char *, const char *) __pure; |
| 84 | 89 | #endif |
| 85 | 90 | int	 strcmp(const char *, const char *) __pure; |
| 86 | 91 | int	 strcoll(const char *, const char *); |
| 87 | char	*strcpy(char * __restrict, const char * __restrict); | |
| 92 | char	*(strcpy)(char * __restrict, const char * __restrict); | |
| 88 | 93 | size_t	 strcspn(const char *, const char *) __pure; |
| 89 | #if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE | |
| 94 | #if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE || __ISO_C_VISIBLE >= 2023 | |
| 90 | 95 | char	*strdup(const char *) __malloc_like; |
| 91 | 96 | #endif |
| 92 | 97 | char	*strerror(int); |
| ... | ... | @@ -94,8 +99,8 @@ char	*strerror(int); |
| 94 | 99 | int	 strerror_r(int, char *, size_t); |
| 95 | 100 | #endif |
| 96 | 101 | #if __BSD_VISIBLE |
| 97 | size_t	 strlcat(char * __restrict, const char * __restrict, size_t); | |
| 98 | size_t	 strlcpy(char * __restrict, const char * __restrict, size_t); | |
| 102 | size_t	 (strlcat)(char * __restrict, const char * __restrict, size_t); | |
| 103 | size_t	 (strlcpy)(char * __restrict, const char * __restrict, size_t); | |
| 99 | 104 | #endif |
| 100 | 105 | size_t	 strlen(const char *) __pure; |
| 101 | 106 | #if __BSD_VISIBLE |
| ... | ... | @@ -107,11 +112,13 @@ typedef	__mode_t	mode_t; |
| 107 | 112 | |
| 108 | 113 | void	 strmode(mode_t, char *); |
| 109 | 114 | #endif |
| 110 | char	*strncat(char * __restrict, const char * __restrict, size_t); | |
| 115 | char	*(strncat)(char * __restrict, const char * __restrict, size_t); | |
| 111 | 116 | int	 strncmp(const char *, const char *, size_t) __pure; |
| 112 | char	*strncpy(char * __restrict, const char * __restrict, size_t); | |
| 113 | #if __POSIX_VISIBLE >= 200809 | |
| 117 | char	*(strncpy)(char * __restrict, const char * __restrict, size_t); | |
| 118 | #if __POSIX_VISIBLE >= 200809 || __ISO_C_VISIBLE >= 2023 | |
| 114 | 119 | char	*strndup(const char *, size_t) __malloc_like; |
| 120 | #endif | |
| 121 | #if __POSIX_VISIBLE >= 200809 | |
| 115 | 122 | size_t	 strnlen(const char *, size_t) __pure; |
| 116 | 123 | #endif |
| 117 | 124 | #if __BSD_VISIBLE |
lib/libc/include/generic-freebsd/stringlist.h+1-1| ... | ... | @@ -30,7 +30,7 @@ |
| 30 | 30 | |
| 31 | 31 | #ifndef _STRINGLIST_H |
| 32 | 32 | #define _STRINGLIST_H |
| 33 | #include <sys/cdefs.h> | |
| 33 | ||
| 34 | 34 | #include <sys/types.h> |
| 35 | 35 | |
| 36 | 36 | /* |
lib/libc/include/generic-freebsd/strings.h+6-2| ... | ... | @@ -37,11 +37,15 @@ typedef	__size_t	size_t; |
| 37 | 37 | #define	_SIZE_T_DECLARED |
| 38 | 38 | #endif |
| 39 | 39 | |
| 40 | #if !defined(_STANDALONE) && defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE > 0 | |
| 41 | #include <ssp/strings.h> | |
| 42 | #endif | |
| 43 | ||
| 40 | 44 | __BEGIN_DECLS |
| 41 | 45 | #if __BSD_VISIBLE || __POSIX_VISIBLE <= 200112 |
| 42 | 46 | int	 bcmp(const void *, const void *, size_t) __pure;	/* LEGACY */ |
| 43 | void	 bcopy(const void *, void *, size_t);			/* LEGACY */ | |
| 44 | void	 bzero(void *, size_t);					/* LEGACY */ | |
| 47 | void	 (bcopy)(const void *, void *, size_t);			/* LEGACY */ | |
| 48 | void	 (bzero)(void *, size_t);				/* LEGACY */ | |
| 45 | 49 | #endif |
| 46 | 50 | #if __BSD_VISIBLE |
| 47 | 51 | void	 explicit_bzero(void *, size_t); |
lib/libc/include/generic-freebsd/sys/_atomic64e.h+1-1| ... | ... | @@ -55,7 +55,7 @@ int	atomic_fcmpset_64(volatile u_int64_t *, u_int64_t *, u_int64_t); |
| 55 | 55 | |
| 56 | 56 | u_int64_t atomic_fetchadd_64(volatile u_int64_t *, u_int64_t); |
| 57 | 57 | |
| 58 | u_int64_t	atomic_load_64(volatile u_int64_t *); | |
| 58 | u_int64_t	atomic_load_64(const volatile u_int64_t *); | |
| 59 | 59 | #define	atomic_load_acq_64	atomic_load_64 |
| 60 | 60 | |
| 61 | 61 | void	atomic_readandclear_64(volatile u_int64_t *); |
lib/libc/include/generic-freebsd/sys/_atomic_subword.h+20-56| ... | ... | @@ -176,7 +176,7 @@ atomic_fcmpset_16(__volatile uint16_t *addr, uint16_t *old, uint16_t val) |
| 176 | 176 | |
| 177 | 177 | #ifndef atomic_load_acq_8 |
| 178 | 178 | static __inline uint8_t |
| 179 | atomic_load_acq_8(volatile uint8_t *p) | |
| 179 | atomic_load_acq_8(const volatile uint8_t *p) | |
| 180 | 180 | { |
| 181 | 181 | 	int shift; |
| 182 | 182 | 	uint8_t ret; |
| ... | ... | @@ -189,7 +189,7 @@ atomic_load_acq_8(volatile uint8_t *p) |
| 189 | 189 | |
| 190 | 190 | #ifndef atomic_load_acq_16 |
| 191 | 191 | static __inline uint16_t |
| 192 | atomic_load_acq_16(volatile uint16_t *p) | |
| 192 | atomic_load_acq_16(const volatile uint16_t *p) | |
| 193 | 193 | { |
| 194 | 194 | 	int shift; |
| 195 | 195 | 	uint16_t ret; |
| ... | ... | @@ -205,67 +205,31 @@ atomic_load_acq_16(volatile uint16_t *p) |
| 205 | 205 | #undef _ATOMIC_BYTE_SHIFT |
| 206 | 206 | #undef _ATOMIC_HWORD_SHIFT |
| 207 | 207 | |
| 208 | /* | |
| 209 | * Provide generic testandset_long implementation based on fcmpset long | |
| 210 | * primitive. It may not be ideal for any given arch, so machine/atomic.h | |
| 211 | * should define the macro atomic_testandset_long to override with an | |
| 212 | * MD-specific version. | |
| 213 | * | |
| 214 | * (Organizationally, this isn't really subword atomics. But atomic_common is | |
| 215 | * included too early in machine/atomic.h, so it isn't a good place for derived | |
| 216 | * primitives like this.) | |
| 217 | */ | |
| 218 | #ifndef atomic_testandset_acq_long | |
| 219 | static __inline int | |
| 220 | atomic_testandset_acq_long(volatile u_long *p, u_int v) | |
| 221 | { | |
| 222 | 	u_long bit, old; | |
| 223 | 	bool ret; | |
| 224 | ||
| 225 | 	bit = (1ul << (v % (sizeof(*p) * NBBY))); | |
| 226 | ||
| 227 | 	old = atomic_load_acq_long(p); | |
| 228 | 	ret = false; | |
| 229 | 	while (!ret && (old & bit) == 0) | |
| 230 | 		ret = atomic_fcmpset_acq_long(p, &old, old | bit); | |
| 231 | ||
| 232 | 	return (!ret); | |
| 233 | } | |
| 234 | #endif | |
| 235 | ||
| 236 | #ifndef atomic_testandset_long | |
| 237 | static __inline int | |
| 238 | atomic_testandset_long(volatile u_long *p, u_int v) | |
| 208 | #ifndef atomic_set_16 | |
| 209 | static __inline void | |
| 210 | atomic_set_16(volatile uint16_t *p, uint16_t bit) | |
| 239 | 211 | { |
| 240 | 	u_long bit, old; | |
| 241 | 	bool ret; | |
| 242 | ||
| 243 | 	bit = (1ul << (v % (sizeof(*p) * NBBY))); | |
| 244 | ||
| 245 | 	old = atomic_load_long(p); | |
| 246 | 	ret = false; | |
| 247 | 	while (!ret && (old & bit) == 0) | |
| 248 | 		ret = atomic_fcmpset_long(p, &old, old | bit); | |
| 212 | 	uint16_t v; | |
| 249 | 213 | |
| 250 | 	return (!ret); | |
| 214 | 	v = atomic_load_16(p); | |
| 215 | 	for (;;) { | |
| 216 | 		if (atomic_fcmpset_16(p, &v, v | bit)) | |
| 217 | 			break; | |
| 218 | 	} | |
| 251 | 219 | } |
| 252 | 220 | #endif |
| 253 | 221 | |
| 254 | #ifndef atomic_testandclear_long | |
| 255 | static __inline int | |
| 256 | atomic_testandclear_long(volatile u_long *p, u_int v) | |
| 222 | #ifndef atomic_clear_16 | |
| 223 | static __inline void | |
| 224 | atomic_clear_16(volatile uint16_t *p, uint16_t bit) | |
| 257 | 225 | { |
| 258 | 	u_long bit, old; | |
| 259 | 	bool ret; | |
| 260 | ||
| 261 | 	bit = (1ul << (v % (sizeof(*p) * NBBY))); | |
| 226 | 	uint16_t v; | |
| 262 | 227 | |
| 263 | 	old = atomic_load_long(p); | |
| 264 | 	ret = false; | |
| 265 | 	while (!ret && (old & bit) != 0) | |
| 266 | 		ret = atomic_fcmpset_long(p, &old, old & ~bit); | |
| 267 | ||
| 268 | 	return (ret); | |
| 228 | 	v = atomic_load_16(p); | |
| 229 | 	for (;;) { | |
| 230 | 		if (atomic_fcmpset_16(p, &v, v & ~bit)) | |
| 231 | 			break; | |
| 232 | 	} | |
| 269 | 233 | } |
| 270 | 234 | #endif |
| 271 | 235 |
lib/libc/include/generic-freebsd/sys/_bitset.h+2-2| ... | ... | @@ -36,7 +36,7 @@ |
| 36 | 36 | * Macros addressing word and bit within it, tuned to make compiler |
| 37 | 37 | * optimize cases when SETSIZE fits into single machine word. |
| 38 | 38 | */ |
| 39 | #define	_BITSET_BITS		(sizeof(long) * 8) | |
| 39 | #define	_BITSET_BITS		(sizeof(unsigned long) * 8) | |
| 40 | 40 | |
| 41 | 41 | #define	__howmany(x, y)	(((x) + ((y) - 1)) / (y)) |
| 42 | 42 | |
| ... | ... | @@ -44,7 +44,7 @@ |
| 44 | 44 | |
| 45 | 45 | #define	__BITSET_DEFINE(_t, _s)						\ |
| 46 | 46 | struct _t {								\ |
| 47 | long __bits[__bitset_words((_s))];				\ | |
| 47 | unsigned long __bits[__bitset_words((_s))];			\ | |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | /* |
lib/libc/include/generic-freebsd/sys/_callout.h-2| ... | ... | @@ -32,8 +32,6 @@ |
| 32 | 32 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 33 | 33 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 34 | 34 | * SUCH DAMAGE. |
| 35 | * | |
| 36 | *	@(#)callout.h	8.2 (Berkeley) 1/21/94 | |
| 37 | 35 | */ |
| 38 | 36 | |
| 39 | 37 | #ifndef _SYS__CALLOUT_H |
lib/libc/include/generic-freebsd/sys/_clock_id.h+5-1| ... | ... | @@ -74,11 +74,15 @@ |
| 74 | 74 | #define	CLOCK_PROCESS_CPUTIME_ID 15 |
| 75 | 75 | #endif /* __POSIX_VISIBLE >= 199309 */ |
| 76 | 76 | |
| 77 | #ifdef __BSD_VISIBLE | |
| 78 | #define	CLOCK_TAI		16 | |
| 79 | #endif | |
| 80 | ||
| 77 | 81 | /* |
| 78 | 82 | * Linux compatible names. |
| 79 | 83 | */ |
| 80 | 84 | #if __BSD_VISIBLE |
| 81 | #define	CLOCK_BOOTTIME		CLOCK_UPTIME | |
| 85 | #define	CLOCK_BOOTTIME		CLOCK_MONOTONIC | |
| 82 | 86 | #define	CLOCK_REALTIME_COARSE	CLOCK_REALTIME_FAST |
| 83 | 87 | #define	CLOCK_MONOTONIC_COARSE	CLOCK_MONOTONIC_FAST |
| 84 | 88 | #endif |
lib/libc/include/generic-freebsd/sys/_cpuset.h+2| ... | ... | @@ -35,6 +35,8 @@ |
| 35 | 35 | #include <sys/_bitset.h> |
| 36 | 36 | |
| 37 | 37 | #ifdef _KERNEL |
| 38 | #include <machine/param.h> | |
| 39 | ||
| 38 | 40 | #define	CPU_SETSIZE	MAXCPU |
| 39 | 41 | #endif |
| 40 | 42 |
lib/libc/include/generic-freebsd/sys/_domainset.h+2| ... | ... | @@ -32,6 +32,8 @@ |
| 32 | 32 | #include <sys/_bitset.h> |
| 33 | 33 | |
| 34 | 34 | #ifdef _KERNEL |
| 35 | #include <machine/param.h> | |
| 36 | ||
| 35 | 37 | #define	DOMAINSET_SETSIZE	MAXMEMDOM |
| 36 | 38 | #endif |
| 37 | 39 |
lib/libc/include/generic-freebsd/sys/_endian.h+4-2| ... | ... | @@ -69,8 +69,10 @@ |
| 69 | 69 | |
| 70 | 70 | /* |
| 71 | 71 | * POSIX Issue 8 will require these for endian.h. Define them there and in the |
| 72 | * traditional BSD compilation environment. Since issue 8 doesn't yet have an | |
| 73 | * assigned date, use strictly greater than issue 7's date. | |
| 72 | * traditional BSD compilation environment. PDP_ENDIAN isn't strictly in Issue | |
| 73 | * 8, but is allowed as implementations can define any *_ENDIAN symbol. Since | |
| 74 | * issue 8 doesn't yet have an assigned date, use strictly greater than issue | |
| 75 | * 7's date. | |
| 74 | 76 | */ |
| 75 | 77 | #if __BSD_VISIBLE || _POSIX_C_SOURCE > 200809 |
| 76 | 78 | #define	LITTLE_ENDIAN _LITTLE_ENDIAN |
lib/libc/include/generic-freebsd/sys/_exterr.h created+25| ... | ... | @@ -0,0 +1,25 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-2-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 2025 The FreeBSD Foundation | |
| 5 | * All rights reserved. | |
| 6 | * | |
| 7 | * This software were developed by Konstantin Belousov <kib@FreeBSD.org> | |
| 8 | * under sponsorship from the FreeBSD Foundation. | |
| 9 | */ | |
| 10 | ||
| 11 | #ifndef _SYS__EXTERR_H_ | |
| 12 | #define	_SYS__EXTERR_H_ | |
| 13 | ||
| 14 | #include <sys/_types.h> | |
| 15 | ||
| 16 | struct kexterr { | |
| 17 | 	int error; | |
| 18 | 	const char *msg; | |
| 19 | 	__uint64_t p1; | |
| 20 | 	__uint64_t p2; | |
| 21 | 	unsigned cat; | |
| 22 | 	unsigned src_line; | |
| 23 | }; | |
| 24 | ||
| 25 | #endif | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/sys/_iovec.h+24-2| ... | ... | @@ -27,8 +27,6 @@ |
| 27 | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | * | |
| 31 | *	@(#)uio.h	8.5 (Berkeley) 2/22/94 | |
| 32 | 30 | */ |
| 33 | 31 | |
| 34 | 32 | #ifndef _SYS__IOVEC_H_ |
| ... | ... | @@ -46,4 +44,28 @@ struct iovec { |
| 46 | 44 | 	size_t	 iov_len;	/* Length. */ |
| 47 | 45 | }; |
| 48 | 46 | |
| 47 | #ifdef _KERNEL | |
| 48 | #define	IOVEC_INIT(iovp, base, len) 					\ | |
| 49 | 	*(iovp) = (struct iovec){ .iov_base = (base), .iov_len = (len) } | |
| 50 | ||
| 51 | /* String with length including NUL terminator */ | |
| 52 | #define	IOVEC_INIT_CSTR(iovp, str)	do {				\ | |
| 53 | 	void *__str = (str);						\ | |
| 54 | 	IOVEC_INIT(iovp, __str, strlen(__str) + 1);			\ | |
| 55 | } while(0) | |
| 56 | ||
| 57 | /* Object with size from sizeof() */ | |
| 58 | #define	IOVEC_INIT_OBJ(iovp, obj)					\ | |
| 59 | 	IOVEC_INIT(iovp, &(obj), sizeof(obj)) | |
| 60 | ||
| 61 | #define	IOVEC_ADVANCE(iovp, amt)	do {				\ | |
| 62 | 	struct iovec *__iovp = (iovp);					\ | |
| 63 | 	size_t __amt = (amt);						\ | |
| 64 | 	KASSERT(__amt <= __iovp->iov_len, ("%s: amount %zu > iov_len	\ | |
| 65 | 	 %zu", __func__, __amt, __iovp->iov_len));			\ | |
| 66 | 	__iovp->iov_len -= __amt;					\ | |
| 67 | 	__iovp->iov_base = (char *)__iovp->iov_base + __amt;		\ | |
| 68 | } while(0) | |
| 69 | #endif /* _KERNEL */ | |
| 70 | ||
| 49 | 71 | #endif /* !_SYS__IOVEC_H_ */ |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/sys/_lock.h+2-2| ... | ... | @@ -33,8 +33,8 @@ |
| 33 | 33 | |
| 34 | 34 | struct lock_object { |
| 35 | 35 | 	const	char *lo_name;		/* Individual lock name. */ |
| 36 | 	u_int	lo_flags; | |
| 37 | 	u_int	lo_data;		/* General class specific data. */ | |
| 36 | 	unsigned int lo_flags; | |
| 37 | 	unsigned int lo_data;		/* General class specific data. */ | |
| 38 | 38 | 	struct	witness *lo_witness;	/* Data for witness. */ |
| 39 | 39 | }; |
| 40 | 40 |
lib/libc/include/generic-freebsd/sys/_maxphys.h created+10| ... | ... | @@ -0,0 +1,10 @@ |
| 1 | /*- | |
| 2 | * This file is in the public domain. | |
| 3 | */ | |
| 4 | #ifndef MAXPHYS | |
| 5 | #ifdef __ILP32__ | |
| 6 | #define MAXPHYS		(128 * 1024) | |
| 7 | #else | |
| 8 | #define MAXPHYS		(1024 * 1024) | |
| 9 | #endif | |
| 10 | #endif | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/sys/_mutex.h+4-2| ... | ... | @@ -31,6 +31,8 @@ |
| 31 | 31 | #ifndef _SYS__MUTEX_H_ |
| 32 | 32 | #define	_SYS__MUTEX_H_ |
| 33 | 33 | |
| 34 | #include <sys/_types.h> | |
| 35 | #include <sys/_lock.h> | |
| 34 | 36 | #include <machine/param.h> |
| 35 | 37 | |
| 36 | 38 | /* |
| ... | ... | @@ -44,7 +46,7 @@ |
| 44 | 46 | */ |
| 45 | 47 | struct mtx { |
| 46 | 48 | 	struct lock_object	lock_object;	/* Common lock properties. */ |
| 47 | 	volatile uintptr_t	mtx_lock;	/* Owner and flags. */ | |
| 49 | 	volatile __uintptr_t	mtx_lock;	/* Owner and flags. */ | |
| 48 | 50 | }; |
| 49 | 51 | |
| 50 | 52 | /* |
| ... | ... | @@ -58,7 +60,7 @@ struct mtx { |
| 58 | 60 | */ |
| 59 | 61 | struct mtx_padalign { |
| 60 | 62 | 	struct lock_object	lock_object;	/* Common lock properties. */ |
| 61 | 	volatile uintptr_t	mtx_lock;	/* Owner and flags. */ | |
| 63 | 	volatile __uintptr_t	mtx_lock;	/* Owner and flags. */ | |
| 62 | 64 | } __aligned(CACHE_LINE_SIZE); |
| 63 | 65 | |
| 64 | 66 | #endif /* !_SYS__MUTEX_H_ */ |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/sys/_null.h+1-3| ... | ... | @@ -31,9 +31,7 @@ |
| 31 | 31 | #if !defined(__cplusplus) |
| 32 | 32 | #define	NULL	((void *)0) |
| 33 | 33 | #else |
| 34 | #if __cplusplus >= 201103L | |
| 35 | #define	NULL	nullptr | |
| 36 | #elif defined(__GNUG__) && defined(__GNUC__) && __GNUC__ >= 4 | |
| 34 | #if defined(__GNUG__) && defined(__GNUC__) && __GNUC__ >= 4 | |
| 37 | 35 | #define	NULL	__null |
| 38 | 36 | #else |
| 39 | 37 | #if defined(__LP64__) |
lib/libc/include/generic-freebsd/sys/_nv.h created+45| ... | ... | @@ -0,0 +1,45 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-2-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 2009-2013 The FreeBSD Foundation | |
| 5 | * | |
| 6 | * This software was developed by Pawel Jakub Dawidek under sponsorship from | |
| 7 | * the FreeBSD Foundation. | |
| 8 | * | |
| 9 | * Redistribution and use in source and binary forms, with or without | |
| 10 | * modification, are permitted provided that the following conditions | |
| 11 | * are met: | |
| 12 | * 1. Redistributions of source code must retain the above copyright | |
| 13 | * notice, this list of conditions and the following disclaimer. | |
| 14 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 15 | * notice, this list of conditions and the following disclaimer in the | |
| 16 | * documentation and/or other materials provided with the distribution. | |
| 17 | * | |
| 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND | |
| 19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
| 21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE | |
| 22 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
| 23 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
| 24 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
| 25 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
| 26 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
| 27 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
| 28 | * SUCH DAMAGE. | |
| 29 | */ | |
| 30 | ||
| 31 | #ifndef	__NV_H_ | |
| 32 | #define	__NV_H_ | |
| 33 | ||
| 34 | #ifndef _KERNEL | |
| 35 | #include <sys/nv_namespace.h> | |
| 36 | #endif | |
| 37 | ||
| 38 | #ifndef	_NVLIST_T_DECLARED | |
| 39 | #define	_NVLIST_T_DECLARED | |
| 40 | struct nvlist; | |
| 41 | ||
| 42 | typedef struct nvlist nvlist_t; | |
| 43 | #endif | |
| 44 | ||
| 45 | #endif	/* !__NV_H_ */ | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/sys/_param.h created+28| ... | ... | @@ -0,0 +1,28 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-3-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 1982, 1986, 1989, 1993 | |
| 5 | *	The Regents of the University of California. All rights reserved. | |
| 6 | * (c) UNIX System Laboratories, Inc. | |
| 7 | */ | |
| 8 | ||
| 9 | #ifndef _SYS__PARAM_H_ | |
| 10 | #define _SYS__PARAM_H_ | |
| 11 | ||
| 12 | #define NBBY	8		/* number of bits in a byte */ | |
| 13 | #define NBPW	sizeof(int)	/* number of bytes per word (integer) */ | |
| 14 | ||
| 15 | /* | |
| 16 | * Macros for counting and rounding. | |
| 17 | */ | |
| 18 | #define	nitems(x)	(sizeof((x)) / sizeof((x)[0])) | |
| 19 | #ifndef howmany | |
| 20 | #define howmany(x, y)	(((x)+((y)-1))/(y)) | |
| 21 | #endif | |
| 22 | #define	rounddown(x, y)	(((x)/(y))*(y)) | |
| 23 | #define	rounddown2(x, y) __align_down(x, y) /* if y is power of two */ | |
| 24 | #define	roundup(x, y)	((((x)+((y)-1))/(y))*(y)) /* to any y */ | |
| 25 | #define	roundup2(x, y)	__align_up(x, y) /* if y is powers of two */ | |
| 26 | #define powerof2(x)	((((x)-1)&(x))==0) | |
| 27 | ||
| 28 | #endif /* _SYS__PARAM_H_ */ | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/sys/_rmlock.h+8-2| ... | ... | @@ -32,6 +32,14 @@ |
| 32 | 32 | #ifndef _SYS__RMLOCK_H_ |
| 33 | 33 | #define	_SYS__RMLOCK_H_ |
| 34 | 34 | |
| 35 | #include <sys/_cpuset.h> | |
| 36 | #include <sys/_lock.h> | |
| 37 | #include <sys/_mutex.h> | |
| 38 | #include <sys/queue.h> | |
| 39 | #include <sys/_sx.h> | |
| 40 | ||
| 41 | struct thread; | |
| 42 | ||
| 35 | 43 | /* |
| 36 | 44 | * Mostly reader/occasional writer lock. |
| 37 | 45 | */ |
| ... | ... | @@ -66,8 +74,6 @@ struct rm_priotracker { |
| 66 | 74 | 	LIST_ENTRY(rm_priotracker) rmp_qentry; |
| 67 | 75 | }; |
| 68 | 76 | |
| 69 | #include <sys/_mutex.h> | |
| 70 | ||
| 71 | 77 | struct rmslock_pcpu; |
| 72 | 78 | |
| 73 | 79 | struct rmslock { |
lib/libc/include/generic-freebsd/sys/_rwlock.h+4-2| ... | ... | @@ -28,6 +28,8 @@ |
| 28 | 28 | #ifndef _SYS__RWLOCK_H_ |
| 29 | 29 | #define	_SYS__RWLOCK_H_ |
| 30 | 30 | |
| 31 | #include <sys/_types.h> | |
| 32 | #include <sys/_lock.h> | |
| 31 | 33 | #include <machine/param.h> |
| 32 | 34 | |
| 33 | 35 | /* |
| ... | ... | @@ -41,7 +43,7 @@ |
| 41 | 43 | */ |
| 42 | 44 | struct rwlock { |
| 43 | 45 | 	struct lock_object	lock_object; |
| 44 | 	volatile uintptr_t	rw_lock; | |
| 46 | 	volatile __uintptr_t	rw_lock; | |
| 45 | 47 | }; |
| 46 | 48 | |
| 47 | 49 | /* |
| ... | ... | @@ -55,7 +57,7 @@ struct rwlock { |
| 55 | 57 | */ |
| 56 | 58 | struct rwlock_padalign { |
| 57 | 59 | 	struct lock_object	lock_object; |
| 58 | 	volatile uintptr_t	rw_lock; | |
| 60 | 	volatile __uintptr_t	rw_lock; | |
| 59 | 61 | } __aligned(CACHE_LINE_SIZE); |
| 60 | 62 | |
| 61 | 63 | #endif /* !_SYS__RWLOCK_H_ */ |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/sys/_sigaltstack.h created+65| ... | ... | @@ -0,0 +1,65 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-3-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 1982, 1986, 1989, 1991, 1993 | |
| 5 | *	The Regents of the University of California. All rights reserved. | |
| 6 | * (c) UNIX System Laboratories, Inc. | |
| 7 | * All or some portions of this file are derived from material licensed | |
| 8 | * to the University of California by American Telephone and Telegraph | |
| 9 | * Co. or Unix System Laboratories, Inc. and are reproduced herein with | |
| 10 | * the permission of UNIX System Laboratories, Inc. | |
| 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 | * 3. Neither the name of the University nor the names of its contributors | |
| 21 | * may be used to endorse or promote products derived from this software | |
| 22 | * without specific prior written permission. | |
| 23 | * | |
| 24 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | |
| 25 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
| 27 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
| 28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
| 29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
| 30 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
| 31 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
| 32 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
| 33 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
| 34 | * SUCH DAMAGE. | |
| 35 | */ | |
| 36 | ||
| 37 | #ifndef _SYS__SIGALTSTACK_H_ | |
| 38 | #define	_SYS__SIGALTSTACK_H_ | |
| 39 | ||
| 40 | #include <sys/_types.h> | |
| 41 | ||
| 42 | #if __XSI_VISIBLE | |
| 43 | #if __BSD_VISIBLE | |
| 44 | #define	__stack_t sigaltstack | |
| 45 | #endif | |
| 46 | typedef	struct __stack_t stack_t; | |
| 47 | ||
| 48 | #define	SS_ONSTACK	0x0001	/* take signal on alternate stack */ | |
| 49 | #define	SS_DISABLE	0x0004	/* disable taking signals on alternate stack */ | |
| 50 | #define	MINSIGSTKSZ	__MINSIGSTKSZ		/* minimum stack size */ | |
| 51 | #define	SIGSTKSZ	(MINSIGSTKSZ + 32768)	/* recommended stack size */ | |
| 52 | #endif | |
| 53 | ||
| 54 | /* | |
| 55 | * Structure used in sigaltstack call. Its definition is always | |
| 56 | * needed for __ucontext. If __BSD_VISIBLE is defined, the structure | |
| 57 | * tag is actually sigaltstack. | |
| 58 | */ | |
| 59 | struct __stack_t { | |
| 60 | 	void	*ss_sp;			/* signal stack base */ | |
| 61 | 	__size_t ss_size;		/* signal stack length */ | |
| 62 | 	int	ss_flags;		/* SS_DISABLE and/or SS_ONSTACK */ | |
| 63 | }; | |
| 64 | ||
| 65 | #endif /* !_SYS__SIGALTSTACK_H_ */ | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/sys/_sigset.h-2| ... | ... | @@ -32,8 +32,6 @@ |
| 32 | 32 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 33 | 33 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 34 | 34 | * SUCH DAMAGE. |
| 35 | * | |
| 36 | *	@(#)signal.h	8.4 (Berkeley) 5/4/95 | |
| 37 | 35 | */ |
| 38 | 36 | |
| 39 | 37 | #ifndef _SYS__SIGSET_H_ |
lib/libc/include/generic-freebsd/sys/_sockaddr_storage.h-2| ... | ... | @@ -27,8 +27,6 @@ |
| 27 | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | * | |
| 31 | *	@(#)socket.h	8.4 (Berkeley) 2/21/94 | |
| 32 | 30 | */ |
| 33 | 31 | |
| 34 | 32 | #ifndef _SYS__SOCKADDR_STORAGE_H_ |
lib/libc/include/generic-freebsd/sys/_stdarg.h+3-4| ... | ... | @@ -31,12 +31,11 @@ |
| 31 | 31 | #ifndef _SYS__STDARG_H_ |
| 32 | 32 | #define _SYS__STDARG_H_ |
| 33 | 33 | |
| 34 | #include <sys/cdefs.h> | |
| 35 | #include <sys/_types.h> | |
| 34 | #include <sys/_visible.h> | |
| 36 | 35 | |
| 37 | 36 | #ifndef _VA_LIST_DECLARED |
| 38 | #define _VA_LIST_DECLARED | |
| 39 | typedef __va_list va_list; | |
| 37 | #define	_VA_LIST_DECLARED | |
| 38 | typedef	__builtin_va_list	va_list; | |
| 40 | 39 | #endif |
| 41 | 40 | |
| 42 | 41 | #define	va_start(ap, last)	__builtin_va_start((ap), (last)) |
lib/libc/include/generic-freebsd/sys/_sx.h+4-1| ... | ... | @@ -31,12 +31,15 @@ |
| 31 | 31 | #ifndef	_SYS__SX_H_ |
| 32 | 32 | #define	_SYS__SX_H_ |
| 33 | 33 | |
| 34 | #include <sys/_types.h> | |
| 35 | #include <sys/_lock.h> | |
| 36 | ||
| 34 | 37 | /* |
| 35 | 38 | * Shared/exclusive lock main structure definition. |
| 36 | 39 | */ |
| 37 | 40 | struct sx { |
| 38 | 41 | 	struct lock_object	lock_object; |
| 39 | 	volatile uintptr_t	sx_lock; | |
| 42 | 	volatile __uintptr_t	sx_lock; | |
| 40 | 43 | }; |
| 41 | 44 | |
| 42 | 45 | #endif	/* !_SYS__SX_H_ */ |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/sys/_termios.h-2| ... | ... | @@ -27,8 +27,6 @@ |
| 27 | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | * | |
| 31 | *	@(#)termios.h	8.3 (Berkeley) 3/28/94 | |
| 32 | 30 | */ |
| 33 | 31 | |
| 34 | 32 | #ifndef _SYS__TERMIOS_H_ |
lib/libc/include/generic-freebsd/sys/_timespec.h-3| ... | ... | @@ -27,9 +27,6 @@ |
| 27 | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | * | |
| 31 | *	@(#)time.h	8.5 (Berkeley) 5/4/95 | |
| 32 | * from: FreeBSD: src/sys/sys/time.h,v 1.43 2000/03/20 14:09:05 phk Exp | |
| 33 | 30 | */ |
| 34 | 31 | |
| 35 | 32 | #ifndef _SYS__TIMESPEC_H_ |
lib/libc/include/generic-freebsd/sys/_tls_variant_i.h+11-1| ... | ... | @@ -37,8 +37,18 @@ |
| 37 | 37 | |
| 38 | 38 | struct pthread; |
| 39 | 39 | |
| 40 | struct dtv_slot { | |
| 41 | 	char			*dtvs_tls; | |
| 42 | }; | |
| 43 | ||
| 44 | struct dtv { | |
| 45 | 	uintptr_t		dtv_gen; | |
| 46 | 	uintptr_t		dtv_size; | |
| 47 | 	struct dtv_slot		dtv_slots[]; | |
| 48 | }; | |
| 49 | ||
| 40 | 50 | struct tcb { |
| 41 | 	uintptr_t		*tcb_dtv;	/* required by rtld */ | |
| 51 | 	struct dtv		*tcb_dtv;	/* required by rtld */ | |
| 42 | 52 | 	struct pthread		*tcb_thread; |
| 43 | 53 | }; |
| 44 | 54 |
lib/libc/include/generic-freebsd/sys/_types.h+13-4| ... | ... | @@ -29,8 +29,6 @@ |
| 29 | 29 | #ifndef _SYS__TYPES_H_ |
| 30 | 30 | #define _SYS__TYPES_H_ |
| 31 | 31 | |
| 32 | #include <sys/cdefs.h> | |
| 33 | ||
| 34 | 32 | /* |
| 35 | 33 | * Basic types upon which most other types are built. |
| 36 | 34 | * |
| ... | ... | @@ -181,12 +179,23 @@ typedef	__uint_least32_t __char32_t; |
| 181 | 179 | #endif |
| 182 | 180 | |
| 183 | 181 | typedef struct { |
| 184 | 	long long __max_align1 __aligned(_Alignof(long long)); | |
| 182 | 	long long __max_align1 | |
| 183 | 	 __attribute__((__aligned__(__alignof__(long long)))); | |
| 185 | 184 | #ifndef _STANDALONE |
| 186 | 	long double __max_align2 __aligned(_Alignof(long double)); | |
| 185 | 	long double __max_align2 | |
| 186 | 	 __attribute__((__aligned__(__alignof__(long long)))); | |
| 187 | 187 | #endif |
| 188 | 188 | } __max_align_t; |
| 189 | 189 | |
| 190 | /* Types for sys/acl.h */ | |
| 191 | typedef __uint32_t	__acl_tag_t; | |
| 192 | typedef __uint32_t	__acl_perm_t; | |
| 193 | typedef __uint16_t	__acl_entry_type_t; | |
| 194 | typedef __uint16_t	__acl_flag_t; | |
| 195 | typedef __uint32_t	__acl_type_t; | |
| 196 | typedef __uint32_t	*__acl_permset_t; | |
| 197 | typedef __uint16_t	*__acl_flagset_t; | |
| 198 | ||
| 190 | 199 | typedef	__uint64_t	__dev_t;	/* device number */ |
| 191 | 200 | |
| 192 | 201 | typedef	__uint32_t	__fixpt_t;	/* fixed point number */ |
lib/libc/include/generic-freebsd/sys/_uexterror.h created+29| ... | ... | @@ -0,0 +1,29 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-2-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 2025 The FreeBSD Foundation | |
| 5 | * All rights reserved. | |
| 6 | * | |
| 7 | * This software were developed by Konstantin Belousov <kib@FreeBSD.org> | |
| 8 | * under sponsorship from the FreeBSD Foundation. | |
| 9 | */ | |
| 10 | ||
| 11 | #ifndef _SYS__UEXTERROR_H_ | |
| 12 | #define	_SYS__UEXTERROR_H_ | |
| 13 | ||
| 14 | #include <sys/_types.h> | |
| 15 | ||
| 16 | struct uexterror { | |
| 17 | 	__uint32_t ver; | |
| 18 | 	__uint32_t error; | |
| 19 | 	__uint32_t cat; | |
| 20 | 	__uint32_t src_line; | |
| 21 | 	__uint32_t flags; | |
| 22 | 	__uint32_t rsrv0; | |
| 23 | 	__uint64_t p1; | |
| 24 | 	__uint64_t p2; | |
| 25 | 	__uint64_t rsrv1[4]; | |
| 26 | 	char msg[128]; | |
| 27 | }; | |
| 28 | ||
| 29 | #endif | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/sys/_uio.h-2| ... | ... | @@ -27,8 +27,6 @@ |
| 27 | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | * | |
| 31 | *	@(#)uio.h	8.5 (Berkeley) 2/22/94 | |
| 32 | 30 | */ |
| 33 | 31 | |
| 34 | 32 | #ifndef _SYS__UIO_H_ |
lib/libc/include/generic-freebsd/sys/_visible.h created+223| ... | ... | @@ -0,0 +1,223 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-3-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 1991, 1993 | |
| 5 | *	The Regents of the University of California. All rights reserved. | |
| 6 | * | |
| 7 | * This code is derived from software contributed to Berkeley by | |
| 8 | * Berkeley Software Design, Inc. | |
| 9 | * | |
| 10 | * Redistribution and use in source and binary forms, with or without | |
| 11 | * modification, are permitted provided that the following conditions | |
| 12 | * are met: | |
| 13 | * 1. Redistributions of source code must retain the above copyright | |
| 14 | * notice, this list of conditions and the following disclaimer. | |
| 15 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 16 | * notice, this list of conditions and the following disclaimer in the | |
| 17 | * documentation and/or other materials provided with the distribution. | |
| 18 | * 3. Neither the name of the University nor the names of its contributors | |
| 19 | * may be used to endorse or promote products derived from this software | |
| 20 | * without specific prior written permission. | |
| 21 | * | |
| 22 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | |
| 23 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 24 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
| 25 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
| 26 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
| 27 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
| 28 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
| 29 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
| 30 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
| 31 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
| 32 | * SUCH DAMAGE. | |
| 33 | */ | |
| 34 | ||
| 35 | #ifndef	_SYS__VISIBLE_H_ | |
| 36 | #define	_SYS__VISIBLE_H_ | |
| 37 | ||
| 38 | /*- | |
| 39 | * The following definitions are an extension of the behavior originally | |
| 40 | * implemented in <sys/_posix.h>, but with a different level of granularity. | |
| 41 | * POSIX.1 requires that the macros we test be defined before any standard | |
| 42 | * header file is included. | |
| 43 | * | |
| 44 | * Here's a quick run-down of the versions (and some informal names) | |
| 45 | * defined(_POSIX_SOURCE)		1003.1-1988 | |
| 46 | *					encoded as 198808 below | |
| 47 | * _POSIX_C_SOURCE == 1		1003.1-1990 | |
| 48 | *					encoded as 199009 below | |
| 49 | * _POSIX_C_SOURCE == 2		1003.2-1992 C Language Binding Option | |
| 50 | *					encoded as 199209 below | |
| 51 | * _POSIX_C_SOURCE == 199309		1003.1b-1993 | |
| 52 | *					(1003.1 Issue 4, Single Unix Spec v1, Unix 93) | |
| 53 | * _POSIX_C_SOURCE == 199506		1003.1c-1995, 1003.1i-1995, | |
| 54 | *					and the omnibus ISO/IEC 9945-1: 1996 | |
| 55 | *					(1003.1 Issue 5, Single	Unix Spec v2, Unix 95) | |
| 56 | * _POSIX_C_SOURCE == 200112		1003.1-2001 (1003.1 Issue 6, Unix 03) | |
| 57 | *					with _XOPEN_SOURCE=600 | |
| 58 | * _POSIX_C_SOURCE == 200809		1003.1-2008 (1003.1 Issue 7) | |
| 59 | *					IEEE Std 1003.1-2017 (Rev of 1003.1-2008) is | |
| 60 | *					1003.1-2008 with two TCs applied and | |
| 61 | *					_XOPEN_SOURCE=700 | |
| 62 | * _POSIX_C_SOURCE == 202405		1003.1-2004 (1003.1 Issue 8), IEEE Std 1003.1-2024 | |
| 63 | * 					with _XOPEN_SOURCE=800 | |
| 64 | * | |
| 65 | * In addition, the X/Open Portability Guide, which is now the Single UNIX | |
| 66 | * Specification, defines a feature-test macro which indicates the version of | |
| 67 | * that specification, and which subsumes _POSIX_C_SOURCE. | |
| 68 | * | |
| 69 | * Our macros begin with two underscores to avoid namespace screwage. | |
| 70 | */ | |
| 71 | ||
| 72 | /* Deal with IEEE Std. 1003.1-1990, in which _POSIX_C_SOURCE == 1. */ | |
| 73 | #if defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE == 1 | |
| 74 | #undef _POSIX_C_SOURCE		/* Probably illegal, but beyond caring now. */ | |
| 75 | #define	_POSIX_C_SOURCE		199009 | |
| 76 | #endif | |
| 77 | ||
| 78 | /* Deal with IEEE Std. 1003.2-1992, in which _POSIX_C_SOURCE == 2. */ | |
| 79 | #if defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE == 2 | |
| 80 | #undef _POSIX_C_SOURCE | |
| 81 | #define	_POSIX_C_SOURCE		199209 | |
| 82 | #endif | |
| 83 | ||
| 84 | /* | |
| 85 | * Deal with various X/Open Portability Guides and Single UNIX Spec. We use the | |
| 86 | * '- 0' construct so software that defines _XOPEN_SOURCE to nothing doesn't | |
| 87 | * cause errors. X/Open CAE Specification, August 1994, System Interfaces and | |
| 88 | * Headers, Issue 4, Version 2 section 2.2 states an empty definition means the | |
| 89 | * same thing as _POSIX_C_SOURCE == 2. This broadly mirrors "System V Interface | |
| 90 | * Definition, Fourth Edition", but earlier editions suggest some ambiguity. | |
| 91 | * However, FreeBSD has histoically implemented this as a NOP, so we just | |
| 92 | * document what it should be for now to not break ports gratuitously. | |
| 93 | */ | |
| 94 | #ifdef _XOPEN_SOURCE | |
| 95 | #if _XOPEN_SOURCE - 0 >= 800 | |
| 96 | #define	__XSI_VISIBLE		800 | |
| 97 | #undef _POSIX_C_SOURCE | |
| 98 | #define	_POSIX_C_SOURCE		202405 | |
| 99 | #elif _XOPEN_SOURCE - 0 >= 700 | |
| 100 | #define	__XSI_VISIBLE		700 | |
| 101 | #undef _POSIX_C_SOURCE | |
| 102 | #define	_POSIX_C_SOURCE		200809 | |
| 103 | #elif _XOPEN_SOURCE - 0 >= 600 | |
| 104 | #define	__XSI_VISIBLE		600 | |
| 105 | #undef _POSIX_C_SOURCE | |
| 106 | #define	_POSIX_C_SOURCE		200112 | |
| 107 | #elif _XOPEN_SOURCE - 0 >= 500 | |
| 108 | #define	__XSI_VISIBLE		500 | |
| 109 | #undef _POSIX_C_SOURCE | |
| 110 | #define	_POSIX_C_SOURCE		199506 | |
| 111 | #else | |
| 112 | /* #define	_POSIX_C_SOURCE		199209 */ | |
| 113 | #endif | |
| 114 | #endif | |
| 115 | ||
| 116 | /* | |
| 117 | * Deal with all versions of POSIX. The ordering relative to the tests above is | |
| 118 | * important. | |
| 119 | */ | |
| 120 | #if defined(_POSIX_SOURCE) && !defined(_POSIX_C_SOURCE) | |
| 121 | #define	_POSIX_C_SOURCE		198808 | |
| 122 | #endif | |
| 123 | #ifdef _POSIX_C_SOURCE | |
| 124 | #if _POSIX_C_SOURCE >= 202405 | |
| 125 | #define	__POSIX_VISIBLE		202405 | |
| 126 | #define	__ISO_C_VISIBLE		2017 | |
| 127 | #elif _POSIX_C_SOURCE >= 200809 | |
| 128 | #define	__POSIX_VISIBLE		200809 | |
| 129 | #define	__ISO_C_VISIBLE		1999 | |
| 130 | #elif _POSIX_C_SOURCE >= 200112 | |
| 131 | #define	__POSIX_VISIBLE		200112 | |
| 132 | #define	__ISO_C_VISIBLE		1999 | |
| 133 | #elif _POSIX_C_SOURCE >= 199506 | |
| 134 | #define	__POSIX_VISIBLE		199506 | |
| 135 | #define	__ISO_C_VISIBLE		1990 | |
| 136 | #elif _POSIX_C_SOURCE >= 199309 | |
| 137 | #define	__POSIX_VISIBLE		199309 | |
| 138 | #define	__ISO_C_VISIBLE		1990 | |
| 139 | #elif _POSIX_C_SOURCE >= 199209 | |
| 140 | #define	__POSIX_VISIBLE		199209 | |
| 141 | #define	__ISO_C_VISIBLE		1990 | |
| 142 | #elif _POSIX_C_SOURCE >= 199009 | |
| 143 | #define	__POSIX_VISIBLE		199009 | |
| 144 | #define	__ISO_C_VISIBLE		1990 | |
| 145 | #else | |
| 146 | #define	__POSIX_VISIBLE		198808 | |
| 147 | #define	__ISO_C_VISIBLE		0 | |
| 148 | #endif /* _POSIX_C_SOURCE */ | |
| 149 | ||
| 150 | /* | |
| 151 | * When we've explicitly asked for a newer C version, make the C variable | |
| 152 | * visible by default. Also honor the glibc _ISOC{11,23}_SOURCE macros | |
| 153 | * extensions. Both glibc and OpenBSD do this, even when a more strict | |
| 154 | * _POSIX_C_SOURCE has been requested, and it makes good sense (especially for | |
| 155 | * pre POSIX 2024, since C11 is much nicer than the old C99 base). Continue the | |
| 156 | * practice with C23, though don't do older standards. Also, GLIBC doesn't have | |
| 157 | * a _ISOC17_SOURCE, so it's not implemented here. glibc has earlier ISOCxx defines, | |
| 158 | * but we don't implement those as they are not relevant enough. | |
| 159 | */ | |
| 160 | #if _ISOC23_SOURCE || (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 202311L) | |
| 161 | #undef __ISO_C_VISIBLE | |
| 162 | #define __ISO_C_VISIBLE		2023 | |
| 163 | #elif _ISOC11_SOURCE || (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) | |
| 164 | #undef __ISO_C_VISIBLE | |
| 165 | #define __ISO_C_VISIBLE		2011 | |
| 166 | #endif | |
| 167 | #else /* _POSIX_C_SOURCE */ | |
| 168 | /*- | |
| 169 | * Deal with _ANSI_SOURCE: | |
| 170 | * If it is defined, and no other compilation environment is explicitly | |
| 171 | * requested, then define our internal feature-test macros to zero. This | |
| 172 | * makes no difference to the preprocessor (undefined symbols in preprocessing | |
| 173 | * expressions are defined to have value zero), but makes it more convenient for | |
| 174 | * a test program to print out the values. | |
| 175 | * | |
| 176 | * If a program mistakenly defines _ANSI_SOURCE and some other macro such as | |
| 177 | * _POSIX_C_SOURCE, we will assume that it wants the broader compilation | |
| 178 | * environment (and in fact we will never get here). | |
| 179 | */ | |
| 180 | #if defined(_ANSI_SOURCE)	/* Hide almost everything. */ | |
| 181 | #define	__POSIX_VISIBLE		0 | |
| 182 | #define	__XSI_VISIBLE		0 | |
| 183 | #define	__BSD_VISIBLE		0 | |
| 184 | #define	__ISO_C_VISIBLE		1990 | |
| 185 | #define	__EXT1_VISIBLE		0 | |
| 186 | #elif defined(_C99_SOURCE)	/* Localism to specify strict C99 env. */ | |
| 187 | #define	__POSIX_VISIBLE		0 | |
| 188 | #define	__XSI_VISIBLE		0 | |
| 189 | #define	__BSD_VISIBLE		0 | |
| 190 | #define	__ISO_C_VISIBLE		1999 | |
| 191 | #define	__EXT1_VISIBLE		0 | |
| 192 | #elif defined(_C11_SOURCE)	/* Localism to specify strict C11 env. */ | |
| 193 | #define	__POSIX_VISIBLE		0 | |
| 194 | #define	__XSI_VISIBLE		0 | |
| 195 | #define	__BSD_VISIBLE		0 | |
| 196 | #define	__ISO_C_VISIBLE		2011 | |
| 197 | #define	__EXT1_VISIBLE		0 | |
| 198 | #elif defined(_C23_SOURCE)	/* Localism to specify strict C23 env. */ | |
| 199 | #define	__POSIX_VISIBLE		0 | |
| 200 | #define	__XSI_VISIBLE		0 | |
| 201 | #define	__BSD_VISIBLE		0 | |
| 202 | #define	__ISO_C_VISIBLE		2023 | |
| 203 | #define	__EXT1_VISIBLE		0 | |
| 204 | #else				/* Default environment: show everything. */ | |
| 205 | #define	__POSIX_VISIBLE		202405 | |
| 206 | #define	__XSI_VISIBLE		800 | |
| 207 | #define	__BSD_VISIBLE		1 | |
| 208 | #define	__ISO_C_VISIBLE		2023 | |
| 209 | #define	__EXT1_VISIBLE		1 | |
| 210 | #endif | |
| 211 | #endif /* _POSIX_C_SOURCE */ | |
| 212 | ||
| 213 | /* User override __EXT1_VISIBLE */ | |
| 214 | #if defined(__STDC_WANT_LIB_EXT1__) | |
| 215 | #undef	__EXT1_VISIBLE | |
| 216 | #if __STDC_WANT_LIB_EXT1__ | |
| 217 | #define	__EXT1_VISIBLE		1 | |
| 218 | #else | |
| 219 | #define	__EXT1_VISIBLE		0 | |
| 220 | #endif | |
| 221 | #endif /* __STDC_WANT_LIB_EXT1__ */ | |
| 222 | ||
| 223 | #endif /* !_SYS__VISIBLE_H_ */ | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/sys/_winsize.h-2| ... | ... | @@ -27,8 +27,6 @@ |
| 27 | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | * | |
| 31 | *	@(#)ttycom.h	8.1 (Berkeley) 3/28/94 | |
| 32 | 30 | */ |
| 33 | 31 | |
| 34 | 32 | #ifndef _SYS__WINSIZE_H_ |
lib/libc/include/generic-freebsd/sys/acct.h-2| ... | ... | @@ -32,8 +32,6 @@ |
| 32 | 32 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 33 | 33 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 34 | 34 | * SUCH DAMAGE. |
| 35 | * | |
| 36 | *	@(#)acct.h	8.4 (Berkeley) 1/9/95 | |
| 37 | 35 | */ |
| 38 | 36 | |
| 39 | 37 | #ifndef _SYS_ACCT_H_ |
lib/libc/include/generic-freebsd/sys/acl.h+12-10| ... | ... | @@ -36,21 +36,23 @@ |
| 36 | 36 | #ifndef _SYS_ACL_H_ |
| 37 | 37 | #define	_SYS_ACL_H_ |
| 38 | 38 | |
| 39 | #include <sys/param.h> | |
| 40 | #include <sys/queue.h> | |
| 41 | #include <vm/uma.h> | |
| 39 | #include <sys/types.h> | |
| 40 | #include <sys/_null.h> | |
| 41 | #ifdef _KERNEL | |
| 42 | #include <sys/malloc.h> | |
| 43 | #endif | |
| 42 | 44 | |
| 43 | 45 | /* |
| 44 | 46 | * POSIX.1e and NFSv4 ACL types and related constants. |
| 45 | 47 | */ |
| 46 | 48 | |
| 47 | typedef uint32_t	acl_tag_t; | |
| 48 | typedef uint32_t	acl_perm_t; | |
| 49 | typedef uint16_t	acl_entry_type_t; | |
| 50 | typedef uint16_t	acl_flag_t; | |
| 51 | typedef int		acl_type_t; | |
| 52 | typedef int		*acl_permset_t; | |
| 53 | typedef uint16_t	*acl_flagset_t; | |
| 49 | typedef __acl_tag_t		acl_tag_t; | |
| 50 | typedef __acl_perm_t		acl_perm_t; | |
| 51 | typedef __acl_entry_type_t	acl_entry_type_t; | |
| 52 | typedef __acl_flag_t		acl_flag_t; | |
| 53 | typedef __acl_type_t		acl_type_t; | |
| 54 | typedef __acl_permset_t		acl_permset_t; | |
| 55 | typedef __acl_flagset_t		acl_flagset_t; | |
| 54 | 56 | |
| 55 | 57 | /* |
| 56 | 58 | * With 254 entries, "struct acl_t_struct" is exactly one 4kB page big. |
lib/libc/include/generic-freebsd/sys/aio.h+1-1| ... | ... | @@ -97,7 +97,7 @@ |
| 97 | 97 | struct __aiocb_private { |
| 98 | 98 | 	long	status; |
| 99 | 99 | 	long	error; |
| 100 | 	void	*kernelinfo; | |
| 100 | 	void	*spare; | |
| 101 | 101 | }; |
| 102 | 102 | |
| 103 | 103 | /* |
lib/libc/include/generic-freebsd/sys/asan.h+4| ... | ... | @@ -53,14 +53,18 @@ |
| 53 | 53 | #define	KASAN_KSTACK_FREED	0xFE |
| 54 | 54 | #define	KASAN_EXEC_ARGS_FREED	0xFF |
| 55 | 55 | |
| 56 | struct thread; | |
| 57 | ||
| 56 | 58 | void kasan_init(void); |
| 57 | 59 | void kasan_init_early(vm_offset_t, size_t); |
| 58 | 60 | void kasan_shadow_map(vm_offset_t, size_t); |
| 59 | 61 | void kasan_mark(const void *, size_t, size_t, uint8_t); |
| 62 | void kasan_thread_alloc(struct thread *); | |
| 60 | 63 | #else /* KASAN */ |
| 61 | 64 | #define kasan_init() |
| 62 | 65 | #define kasan_shadow_map(a, s) |
| 63 | 66 | #define kasan_mark(p, s, l, c) |
| 67 | #define kasan_thread_alloc(t) | |
| 64 | 68 | #endif /* !KASAN */ |
| 65 | 69 | |
| 66 | 70 | #endif /* !_SYS_ASAN_H_ */ |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/sys/atomic_common.h+11-11| ... | ... | @@ -36,18 +36,18 @@ |
| 36 | 36 | |
| 37 | 37 | #include <sys/types.h> |
| 38 | 38 | |
| 39 | #define	__atomic_load_bool_relaxed(p)	(*(volatile _Bool *)(p)) | |
| 39 | #define	__atomic_load_bool_relaxed(p)	(*(const volatile _Bool *)(p)) | |
| 40 | 40 | #define	__atomic_store_bool_relaxed(p, v)	\ |
| 41 | 41 | (*(volatile _Bool *)(p) = (_Bool)(v)) |
| 42 | 42 | |
| 43 | #define	__atomic_load_char_relaxed(p)	(*(volatile u_char *)(p)) | |
| 44 | #define	__atomic_load_short_relaxed(p)	(*(volatile u_short *)(p)) | |
| 45 | #define	__atomic_load_int_relaxed(p)	(*(volatile u_int *)(p)) | |
| 46 | #define	__atomic_load_long_relaxed(p)	(*(volatile u_long *)(p)) | |
| 47 | #define	__atomic_load_8_relaxed(p)	(*(volatile uint8_t *)(p)) | |
| 48 | #define	__atomic_load_16_relaxed(p)	(*(volatile uint16_t *)(p)) | |
| 49 | #define	__atomic_load_32_relaxed(p)	(*(volatile uint32_t *)(p)) | |
| 50 | #define	__atomic_load_64_relaxed(p)	(*(volatile uint64_t *)(p)) | |
| 43 | #define	__atomic_load_char_relaxed(p)	(*(const volatile u_char *)(p)) | |
| 44 | #define	__atomic_load_short_relaxed(p)	(*(const volatile u_short *)(p)) | |
| 45 | #define	__atomic_load_int_relaxed(p)	(*(const volatile u_int *)(p)) | |
| 46 | #define	__atomic_load_long_relaxed(p)	(*(const volatile u_long *)(p)) | |
| 47 | #define	__atomic_load_8_relaxed(p)	(*(const volatile uint8_t *)(p)) | |
| 48 | #define	__atomic_load_16_relaxed(p)	(*(const volatile uint16_t *)(p)) | |
| 49 | #define	__atomic_load_32_relaxed(p)	(*(const volatile uint32_t *)(p)) | |
| 50 | #define	__atomic_load_64_relaxed(p)	(*(const volatile uint64_t *)(p)) | |
| 51 | 51 | |
| 52 | 52 | #define	__atomic_store_char_relaxed(p, v)	\ |
| 53 | 53 | (*(volatile u_char *)(p) = (u_char)(v)) |
| ... | ... | @@ -124,7 +124,7 @@ |
| 124 | 124 | 	__atomic_store_generic(p, v, int64_t, uint64_t, 64) |
| 125 | 125 | #endif |
| 126 | 126 | |
| 127 | #define	atomic_load_ptr(p)	(*(volatile __typeof(*p) *)(p)) | |
| 127 | #define	atomic_load_ptr(p)	(*(const volatile __typeof(*p) *)(p)) | |
| 128 | 128 | #define	atomic_store_ptr(p, v)	(*(volatile __typeof(*p) *)(p) = (v)) |
| 129 | 129 | |
| 130 | 130 | /* |
| ... | ... | @@ -133,7 +133,7 @@ |
| 133 | 133 | * openly resorting to the stronger acquire fence, to be sorted out. |
| 134 | 134 | */ |
| 135 | 135 | #define	atomic_load_consume_ptr(p)	\ |
| 136 | ((__typeof(*p)) atomic_load_acq_ptr((uintptr_t *)p)) | |
| 136 | ((__typeof(*p)) atomic_load_acq_ptr((const volatile uintptr_t *)p)) | |
| 137 | 137 | |
| 138 | 138 | #define	atomic_interrupt_fence()	__compiler_membar() |
| 139 | 139 |
lib/libc/include/generic-freebsd/sys/atomic_san.h+4-5| ... | ... | @@ -65,10 +65,10 @@ |
| 65 | 65 | 	type sp##_atomic_readandclear_##name(volatile type *) |
| 66 | 66 | |
| 67 | 67 | #define	ATOMIC_SAN_LOAD(sp, name, type)					\ |
| 68 | 	type sp##_atomic_load_##name(volatile type *) | |
| 68 | 	type sp##_atomic_load_##name(const volatile type *) | |
| 69 | 69 | |
| 70 | 70 | #define	ATOMIC_SAN_LOAD_ACQ(sp, name, type)				\ |
| 71 | 	type sp##_atomic_load_acq_##name(volatile type *) | |
| 71 | 	type sp##_atomic_load_acq_##name(const volatile type *) | |
| 72 | 72 | |
| 73 | 73 | #define	ATOMIC_SAN_STORE(sp, name, type)				\ |
| 74 | 74 | 	void sp##_atomic_store_##name(volatile type *, type) |
| ... | ... | @@ -266,11 +266,10 @@ ATOMIC_SAN_THREAD_FENCE(SAN_INTERCEPTOR_PREFIX); |
| 266 | 266 | #define	atomic_fcmpset_rel_ptr		ATOMIC_SAN(fcmpset_rel_ptr) |
| 267 | 267 | #define	atomic_fetchadd_ptr		ATOMIC_SAN(fetchadd_ptr) |
| 268 | 268 | #define	atomic_load_ptr(x)						\ |
| 269 | 	((__typeof(*x))ATOMIC_SAN(load_ptr)(				\ | |
| 270 | 	 __DECONST(volatile uintptr_t *, (x)))) | |
| 269 | 	((__typeof(*x))ATOMIC_SAN(load_ptr)((const volatile uintptr_t *)(x))) | |
| 271 | 270 | #define	atomic_load_acq_ptr		ATOMIC_SAN(load_acq_ptr) |
| 272 | 271 | #define	atomic_load_consume_ptr(x)					\ |
| 273 | 	((__typeof(*x))atomic_load_acq_ptr((volatile uintptr_t *)(x))) | |
| 272 | 	((__typeof(*x))atomic_load_acq_ptr((const volatile uintptr_t *)(x))) | |
| 274 | 273 | #define	atomic_readandclear_ptr		ATOMIC_SAN(readandclear_ptr) |
| 275 | 274 | #define	atomic_set_ptr			ATOMIC_SAN(set_ptr) |
| 276 | 275 | #define	atomic_set_acq_ptr		ATOMIC_SAN(set_acq_ptr) |
lib/libc/include/generic-freebsd/sys/bio.h-4| ... | ... | @@ -32,8 +32,6 @@ |
| 32 | 32 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 33 | 33 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 34 | 34 | * SUCH DAMAGE. |
| 35 | * | |
| 36 | *	@(#)buf.h	8.9 (Berkeley) 3/30/95 | |
| 37 | 35 | */ |
| 38 | 36 | |
| 39 | 37 | #ifndef _SYS_BIO_H_ |
| ... | ... | @@ -77,7 +75,6 @@ |
| 77 | 75 | #ifdef _KERNEL |
| 78 | 76 | struct disk; |
| 79 | 77 | struct bio; |
| 80 | struct vm_map; | |
| 81 | 78 | |
| 82 | 79 | typedef void bio_task_t(void *); |
| 83 | 80 | |
| ... | ... | @@ -146,7 +143,6 @@ struct bio_queue_head { |
| 146 | 143 | 	int batched; |
| 147 | 144 | }; |
| 148 | 145 | |
| 149 | extern struct vm_map *bio_transient_map; | |
| 150 | 146 | extern int bio_transient_maxcnt; |
| 151 | 147 | |
| 152 | 148 | void biodone(struct bio *bp); |
lib/libc/include/generic-freebsd/sys/bitcount.h-2| ... | ... | @@ -32,8 +32,6 @@ |
| 32 | 32 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 33 | 33 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 34 | 34 | * SUCH DAMAGE. |
| 35 | * | |
| 36 | *	@(#)types.h	8.6 (Berkeley) 2/19/95 | |
| 37 | 35 | */ |
| 38 | 36 | |
| 39 | 37 | #ifndef _SYS_BITCOUNT_H_ |
lib/libc/include/generic-freebsd/sys/buf.h+11-6| ... | ... | @@ -32,8 +32,6 @@ |
| 32 | 32 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 33 | 33 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 34 | 34 | * SUCH DAMAGE. |
| 35 | * | |
| 36 | *	@(#)buf.h	8.9 (Berkeley) 3/30/95 | |
| 37 | 35 | */ |
| 38 | 36 | |
| 39 | 37 | #ifndef _SYS_BUF_H_ |
| ... | ... | @@ -298,7 +296,7 @@ struct buf { |
| 298 | 296 | * Initialize a lock. |
| 299 | 297 | */ |
| 300 | 298 | #define BUF_LOCKINIT(bp, wmesg)						\ |
| 301 | 	lockinit(&(bp)->b_lock, PRIBIO + 4, wmesg, 0, LK_NEW) | |
| 299 | 	lockinit(&(bp)->b_lock, PVFS, wmesg, 0, LK_NEW) | |
| 302 | 300 | /* |
| 303 | 301 | * |
| 304 | 302 | * Get a lock sleeping non-interruptably until it becomes available. |
| ... | ... | @@ -313,7 +311,7 @@ struct buf { |
| 313 | 311 | */ |
| 314 | 312 | #define	BUF_TIMELOCK(bp, locktype, interlock, wmesg, catch, timo)	\ |
| 315 | 313 | 	_lockmgr_args_rw(&(bp)->b_lock, (locktype) | LK_TIMELOCK,	\ |
| 316 | 	 (interlock), (wmesg), (PRIBIO + 4) | (catch), (timo),	\ | |
| 314 | 	 (interlock), (wmesg), PVFS | (catch), (timo),	\ | |
| 317 | 315 | 	 LOCK_FILE, LOCK_LINE) |
| 318 | 316 | |
| 319 | 317 | /* |
| ... | ... | @@ -343,6 +341,13 @@ struct buf { |
| 343 | 341 | */ |
| 344 | 342 | #define	BUF_ISLOCKED(bp)						\ |
| 345 | 343 | 	lockstatus(&(bp)->b_lock) |
| 344 | ||
| 345 | /* | |
| 346 | * Check if a buffer lock is currently held by LK_KERNPROC. | |
| 347 | */ | |
| 348 | #define	BUF_DISOWNED(bp)						\ | |
| 349 | 	lockmgr_disowned(&(bp)->b_lock) | |
| 350 | ||
| 346 | 351 | /* |
| 347 | 352 | * Free a buffer lock. |
| 348 | 353 | */ |
| ... | ... | @@ -514,7 +519,6 @@ extern int	nbuf;			/* The number of buffer headers */ |
| 514 | 519 | extern u_long	maxswzone;		/* Max KVA for swap structures */ |
| 515 | 520 | extern u_long	maxbcache;		/* Max KVA for buffer cache */ |
| 516 | 521 | extern int	maxbcachebuf;		/* Max buffer cache block size */ |
| 517 | extern long	runningbufspace; | |
| 518 | 522 | extern long	hibufspace; |
| 519 | 523 | extern int	dirtybufthresh; |
| 520 | 524 | extern int	bdwriteskip; |
| ... | ... | @@ -531,6 +535,7 @@ buf_mapped(struct buf *bp) |
| 531 | 535 | 	return (bp->b_data != unmapped_buf); |
| 532 | 536 | } |
| 533 | 537 | |
| 538 | long	runningbufclaim(struct buf *, int); | |
| 534 | 539 | void	runningbufwakeup(struct buf *); |
| 535 | 540 | void	waitrunningbufspace(void); |
| 536 | 541 | caddr_t	kern_vfs_bio_buffer_alloc(caddr_t v, long physmem_est); |
| ... | ... | @@ -598,7 +603,7 @@ void	vfs_unbusy_pages(struct buf *); |
| 598 | 603 | int	vmapbuf(struct buf *, void *, size_t, int); |
| 599 | 604 | void	vunmapbuf(struct buf *); |
| 600 | 605 | void	brelvp(struct buf *); |
| 601 | void	bgetvp(struct vnode *, struct buf *); | |
| 606 | int	bgetvp(struct vnode *, struct buf *) __result_use_check; | |
| 602 | 607 | void	pbgetbo(struct bufobj *bo, struct buf *bp); |
| 603 | 608 | void	pbgetvp(struct vnode *, struct buf *); |
| 604 | 609 | void	pbrelbo(struct buf *); |
lib/libc/include/generic-freebsd/sys/buf_ring.h+35-29| ... | ... | @@ -51,13 +51,13 @@ |
| 51 | 51 | * |
| 52 | 52 | */ |
| 53 | 53 | struct buf_ring { |
| 54 | 	volatile uint32_t	br_prod_head; | |
| 55 | 	volatile uint32_t	br_prod_tail;	 | |
| 54 | 	uint32_t		br_prod_head; | |
| 55 | 	uint32_t		br_prod_tail; | |
| 56 | 56 | 	int 	br_prod_size; |
| 57 | 57 | 	int 	br_prod_mask; |
| 58 | 58 | 	uint64_t		br_drops; |
| 59 | 	volatile uint32_t	br_cons_head __aligned(CACHE_LINE_SIZE); | |
| 60 | 	volatile uint32_t	br_cons_tail; | |
| 59 | 	uint32_t		br_cons_head __aligned(CACHE_LINE_SIZE); | |
| 60 | 	uint32_t		br_cons_tail; | |
| 61 | 61 | 	int		 	br_cons_size; |
| 62 | 62 | 	int 	br_cons_mask; |
| 63 | 63 | #if defined(DEBUG_BUFRING) && defined(_KERNEL) |
| ... | ... | @@ -83,10 +83,12 @@ buf_ring_enqueue(struct buf_ring *br, void *buf) |
| 83 | 83 | 	 * via drbr_peek(), and then re-added via drbr_putback() and |
| 84 | 84 | 	 * trigger a spurious panic. |
| 85 | 85 | 	 */ |
| 86 | 	for (uint32_t i = br->br_cons_head; i != br->br_prod_head; i++) | |
| 86 | 	for (uint32_t i = atomic_load_32(&br->br_cons_head); | |
| 87 | 	 i != atomic_load_32(&br->br_prod_head); i++) | |
| 87 | 88 | 		if (br->br_ring[i & mask] == buf) |
| 88 | 89 | 			panic("buf=%p already enqueue at %d prod=%d cons=%d", |
| 89 | 			 buf, i, br->br_prod_tail, br->br_cons_tail); | |
| 90 | 			 buf, i, atomic_load_32(&br->br_prod_tail), | |
| 91 | 			 atomic_load_32(&br->br_cons_tail)); | |
| 90 | 92 | #endif	 |
| 91 | 93 | 	critical_enter(); |
| 92 | 94 | 	do { |
| ... | ... | @@ -105,16 +107,15 @@ buf_ring_enqueue(struct buf_ring *br, void *buf) |
| 105 | 107 | 		cons_tail = atomic_load_acq_32(&br->br_cons_tail); |
| 106 | 108 | |
| 107 | 109 | 		if ((int32_t)(cons_tail + br->br_prod_size - prod_next) < 1) { |
| 108 | 			rmb(); | |
| 109 | 			if (prod_head == br->br_prod_head && | |
| 110 | 			 cons_tail == br->br_cons_tail) { | |
| 110 | 			if (prod_head == atomic_load_32(&br->br_prod_head) && | |
| 111 | 			 cons_tail == atomic_load_32(&br->br_cons_tail)) { | |
| 111 | 112 | 				br->br_drops++; |
| 112 | 113 | 				critical_exit(); |
| 113 | 114 | 				return (ENOBUFS); |
| 114 | 115 | 			} |
| 115 | 116 | 			continue; |
| 116 | 117 | 		} |
| 117 | 	} while (!atomic_cmpset_acq_32(&br->br_prod_head, prod_head, prod_next)); | |
| 118 | 	} while (!atomic_cmpset_32(&br->br_prod_head, prod_head, prod_next)); | |
| 118 | 119 | 	prod_idx = prod_head & mask; |
| 119 | 120 | #ifdef DEBUG_BUFRING |
| 120 | 121 | 	if (br->br_ring[prod_idx] != NULL) |
| ... | ... | @@ -127,7 +128,7 @@ buf_ring_enqueue(struct buf_ring *br, void *buf) |
| 127 | 128 | 	 * that preceded us, we need to wait for them |
| 128 | 129 | 	 * to complete |
| 129 | 130 | 	 */ |
| 130 | 	while (br->br_prod_tail != prod_head) | |
| 131 | 	while (atomic_load_32(&br->br_prod_tail) != prod_head) | |
| 131 | 132 | 		cpu_spinwait(); |
| 132 | 133 | 	atomic_store_rel_32(&br->br_prod_tail, prod_next); |
| 133 | 134 | 	critical_exit(); |
| ... | ... | @@ -161,7 +162,7 @@ buf_ring_dequeue_mc(struct buf_ring *br) |
| 161 | 162 | 			critical_exit(); |
| 162 | 163 | 			return (NULL); |
| 163 | 164 | 		} |
| 164 | 	} while (!atomic_cmpset_acq_32(&br->br_cons_head, cons_head, cons_next)); | |
| 165 | 	} while (!atomic_cmpset_32(&br->br_cons_head, cons_head, cons_next)); | |
| 165 | 166 | 	cons_idx = cons_head & mask; |
| 166 | 167 | |
| 167 | 168 | 	buf = br->br_ring[cons_idx]; |
| ... | ... | @@ -173,7 +174,7 @@ buf_ring_dequeue_mc(struct buf_ring *br) |
| 173 | 174 | 	 * that preceded us, we need to wait for them |
| 174 | 175 | 	 * to complete |
| 175 | 176 | 	 */ |
| 176 | 	while (br->br_cons_tail != cons_head) | |
| 177 | 	while (atomic_load_32(&br->br_cons_tail) != cons_head) | |
| 177 | 178 | 		cpu_spinwait(); |
| 178 | 179 | |
| 179 | 180 | 	atomic_store_rel_32(&br->br_cons_tail, cons_next); |
| ... | ... | @@ -195,7 +196,7 @@ buf_ring_dequeue_sc(struct buf_ring *br) |
| 195 | 196 | 	void *buf; |
| 196 | 197 | |
| 197 | 198 | 	mask = br->br_cons_mask; |
| 198 | 	cons_head = br->br_cons_head; | |
| 199 | 	cons_head = atomic_load_32(&br->br_cons_head); | |
| 199 | 200 | 	prod_tail = atomic_load_acq_32(&br->br_prod_tail); |
| 200 | 201 | |
| 201 | 202 | 	cons_next = cons_head + 1; |
| ... | ... | @@ -204,7 +205,7 @@ buf_ring_dequeue_sc(struct buf_ring *br) |
| 204 | 205 | 		return (NULL); |
| 205 | 206 | |
| 206 | 207 | 	cons_idx = cons_head & mask; |
| 207 | 	br->br_cons_head = cons_next; | |
| 208 | 	atomic_store_32(&br->br_cons_head, cons_next); | |
| 208 | 209 | 	buf = br->br_ring[cons_idx]; |
| 209 | 210 | |
| 210 | 211 | #ifdef DEBUG_BUFRING |
| ... | ... | @@ -213,9 +214,9 @@ buf_ring_dequeue_sc(struct buf_ring *br) |
| 213 | 214 | 	if (!mtx_owned(br->br_lock)) |
| 214 | 215 | 		panic("lock not held on single consumer dequeue"); |
| 215 | 216 | #endif |
| 216 | 	if (br->br_cons_tail != cons_head) | |
| 217 | 	if (atomic_load_32(&br->br_cons_tail) != cons_head) | |
| 217 | 218 | 		panic("inconsistent list cons_tail=%d cons_head=%d", |
| 218 | 		 br->br_cons_tail, cons_head); | |
| 219 | 		 atomic_load_32(&br->br_cons_tail), cons_head); | |
| 219 | 220 | #endif |
| 220 | 221 | 	atomic_store_rel_32(&br->br_cons_tail, cons_next); |
| 221 | 222 | 	return (buf); |
| ... | ... | @@ -235,13 +236,13 @@ buf_ring_advance_sc(struct buf_ring *br) |
| 235 | 236 | |
| 236 | 237 | 	mask = br->br_cons_mask; |
| 237 | 238 | #endif |
| 238 | 	cons_head = br->br_cons_head; | |
| 239 | 	prod_tail = br->br_prod_tail; | |
| 239 | 	cons_head = atomic_load_32(&br->br_cons_head); | |
| 240 | 	prod_tail = atomic_load_32(&br->br_prod_tail); | |
| 240 | 241 | |
| 241 | 242 | 	cons_next = cons_head + 1; |
| 242 | 243 | 	if (cons_head == prod_tail) |
| 243 | 244 | 		return; |
| 244 | 	br->br_cons_head = cons_next; | |
| 245 | 	atomic_store_32(&br->br_cons_head, cons_next); | |
| 245 | 246 | #ifdef DEBUG_BUFRING |
| 246 | 247 | 	br->br_ring[cons_head & mask] = NULL; |
| 247 | 248 | #endif |
| ... | ... | @@ -267,12 +268,13 @@ buf_ring_advance_sc(struct buf_ring *br) |
| 267 | 268 | static __inline void |
| 268 | 269 | buf_ring_putback_sc(struct buf_ring *br, void *new) |
| 269 | 270 | { |
| 270 | 	uint32_t mask; | |
| 271 | 	uint32_t cons_idx, mask; | |
| 271 | 272 | |
| 272 | 273 | 	mask = br->br_cons_mask; |
| 273 | 	KASSERT((br->br_cons_head & mask) != (br->br_prod_tail & mask), | |
| 274 | 	cons_idx = atomic_load_32(&br->br_cons_head) & mask; | |
| 275 | 	KASSERT(cons_idx != (atomic_load_32(&br->br_prod_tail) & mask), | |
| 274 | 276 | 		("Buf-Ring has none in putback")) ; |
| 275 | 	br->br_ring[br->br_cons_head & mask] = new; | |
| 277 | 	br->br_ring[cons_idx] = new; | |
| 276 | 278 | } |
| 277 | 279 | |
| 278 | 280 | /* |
| ... | ... | @@ -291,7 +293,7 @@ buf_ring_peek(struct buf_ring *br) |
| 291 | 293 | #endif	 |
| 292 | 294 | 	mask = br->br_cons_mask; |
| 293 | 295 | 	prod_tail = atomic_load_acq_32(&br->br_prod_tail); |
| 294 | 	cons_head = br->br_cons_head; | |
| 296 | 	cons_head = atomic_load_32(&br->br_cons_head); | |
| 295 | 297 | |
| 296 | 298 | 	if (cons_head == prod_tail) |
| 297 | 299 | 		return (NULL); |
| ... | ... | @@ -312,7 +314,7 @@ buf_ring_peek_clear_sc(struct buf_ring *br) |
| 312 | 314 | |
| 313 | 315 | 	mask = br->br_cons_mask; |
| 314 | 316 | 	prod_tail = atomic_load_acq_32(&br->br_prod_tail); |
| 315 | 	cons_head = br->br_cons_head; | |
| 317 | 	cons_head = atomic_load_32(&br->br_cons_head); | |
| 316 | 318 | |
| 317 | 319 | 	if (cons_head == prod_tail) |
| 318 | 320 | 		return (NULL); |
| ... | ... | @@ -332,22 +334,26 @@ static __inline int |
| 332 | 334 | buf_ring_full(struct buf_ring *br) |
| 333 | 335 | { |
| 334 | 336 | |
| 335 | 	return (br->br_prod_head == br->br_cons_tail + br->br_cons_size - 1); | |
| 337 | 	return (atomic_load_32(&br->br_prod_head) == | |
| 338 | 	 atomic_load_32(&br->br_cons_tail) + br->br_cons_size - 1); | |
| 336 | 339 | } |
| 337 | 340 | |
| 338 | 341 | static __inline int |
| 339 | 342 | buf_ring_empty(struct buf_ring *br) |
| 340 | 343 | { |
| 341 | 344 | |
| 342 | 	return (br->br_cons_head == br->br_prod_tail); | |
| 345 | 	return (atomic_load_32(&br->br_cons_head) == | |
| 346 | 	 atomic_load_32(&br->br_prod_tail)); | |
| 343 | 347 | } |
| 344 | 348 | |
| 345 | 349 | static __inline int |
| 346 | 350 | buf_ring_count(struct buf_ring *br) |
| 347 | 351 | { |
| 352 | 	uint32_t cons_tail, prod_tail; | |
| 348 | 353 | |
| 349 | 	return ((br->br_prod_size + br->br_prod_tail - br->br_cons_tail) | |
| 350 | 	 & br->br_prod_mask); | |
| 354 | 	cons_tail = atomic_load_32(&br->br_cons_tail); | |
| 355 | 	prod_tail = atomic_load_32(&br->br_prod_tail); | |
| 356 | 	return ((br->br_prod_size + prod_tail - cons_tail) & br->br_prod_mask); | |
| 351 | 357 | } |
| 352 | 358 | |
| 353 | 359 | #ifdef _KERNEL |
lib/libc/include/generic-freebsd/sys/bufobj.h+2-1| ... | ... | @@ -33,7 +33,7 @@ |
| 33 | 33 | * cache. |
| 34 | 34 | * |
| 35 | 35 | * This used to be vnodes, but we need non-vnode code to be able |
| 36 | * to use the buffer cache as well, specifically geom classes like gbde, | |
| 36 | * to use the buffer cache as well, specifically geom classes like | |
| 37 | 37 | * raid3 and raid5. |
| 38 | 38 | * |
| 39 | 39 | * All vnodes will contain a bufobj initially, but down the road we may |
| ... | ... | @@ -116,6 +116,7 @@ struct bufobj { |
| 116 | 116 | #define	BO_WWAIT	(1 << 1)	/* Wait for output to complete */ |
| 117 | 117 | #define	BO_DEAD		(1 << 2)	/* Dead; only with INVARIANTS */ |
| 118 | 118 | #define	BO_NOBUFS	(1 << 3)	/* No bufs allowed */ |
| 119 | #define	BO_NONSTERILE	(1 << 4)	/* Ever called reassignbuf() */ | |
| 119 | 120 | |
| 120 | 121 | #define	BO_LOCKPTR(bo)		(&(bo)->bo_lock) |
| 121 | 122 | #define	BO_LOCK(bo)		rw_wlock(BO_LOCKPTR((bo))) |
lib/libc/include/generic-freebsd/sys/bus.h+84-57| ... | ... | @@ -159,6 +159,7 @@ struct devreq { |
| 159 | 159 | /* Flags for DEV_RESET */ |
| 160 | 160 | #define	DEVF_RESET_DETACH	0x0000001	/* Detach drivers vs suspend |
| 161 | 161 | 						 device */ |
| 162 | #define DEVICE_UNIT_ANY		(-1) | |
| 162 | 163 | |
| 163 | 164 | #ifdef _KERNEL |
| 164 | 165 | |
| ... | ... | @@ -276,6 +277,7 @@ enum intr_type { |
| 276 | 277 | 	INTR_EXCL = 256,		/* exclusive interrupt */ |
| 277 | 278 | 	INTR_MPSAFE = 512,		/* this interrupt is SMP safe */ |
| 278 | 279 | 	INTR_ENTROPY = 1024,		/* this interrupt provides entropy */ |
| 280 | 	INTR_SLEEPABLE = 2048,		/* this interrupt handler can sleep */ | |
| 279 | 281 | 	INTR_MD1 = 4096,		/* flag reserved for MD use */ |
| 280 | 282 | 	INTR_MD2 = 8192,		/* flag reserved for MD use */ |
| 281 | 283 | 	INTR_MD3 = 16384,		/* flag reserved for MD use */ |
| ... | ... | @@ -305,18 +307,6 @@ enum cpu_sets { |
| 305 | 307 | 	INTR_CPUS |
| 306 | 308 | }; |
| 307 | 309 | |
| 308 | typedef int (*devop_t)(void); | |
| 309 | ||
| 310 | /** | |
| 311 | * @brief This structure is deprecated. | |
| 312 | * | |
| 313 | * Use the kobj(9) macro DEFINE_CLASS to | |
| 314 | * declare classes which implement device drivers. | |
| 315 | */ | |
| 316 | struct driver { | |
| 317 | 	KOBJ_CLASS_FIELDS; | |
| 318 | }; | |
| 319 | ||
| 320 | 310 | struct resource; |
| 321 | 311 | |
| 322 | 312 | /** |
| ... | ... | @@ -396,7 +386,7 @@ struct resource * |
| 396 | 386 | 			 rman_res_t count, u_int flags); |
| 397 | 387 | int	resource_list_release(struct resource_list *rl, |
| 398 | 388 | 			 device_t bus, device_t child, |
| 399 | 			 int type, int rid, struct resource *res); | |
| 389 | 			 struct resource *res); | |
| 400 | 390 | int	resource_list_release_active(struct resource_list *rl, |
| 401 | 391 | 				 device_t bus, device_t child, |
| 402 | 392 | 				 int type); |
| ... | ... | @@ -427,12 +417,12 @@ void	root_bus_configure(void); |
| 427 | 417 | |
| 428 | 418 | struct _cpuset; |
| 429 | 419 | |
| 430 | int	bus_generic_activate_resource(device_t dev, device_t child, int type, | |
| 431 | 				 int rid, struct resource *r); | |
| 420 | int	bus_generic_activate_resource(device_t dev, device_t child, | |
| 421 | 				 struct resource *r); | |
| 432 | 422 | device_t |
| 433 | 423 | 	bus_generic_add_child(device_t dev, u_int order, const char *name, |
| 434 | 424 | 			 int unit); |
| 435 | int	bus_generic_adjust_resource(device_t bus, device_t child, int type, | |
| 425 | int	bus_generic_adjust_resource(device_t bus, device_t child, | |
| 436 | 426 | 				 struct resource *r, rman_res_t start, |
| 437 | 427 | 				 rman_res_t end); |
| 438 | 428 | struct resource * |
| ... | ... | @@ -441,7 +431,8 @@ struct resource * |
| 441 | 431 | 				 rman_res_t count, u_int flags); |
| 442 | 432 | int	bus_generic_translate_resource(device_t dev, int type, rman_res_t start, |
| 443 | 433 | 			 rman_res_t *newstart); |
| 444 | int	bus_generic_attach(device_t dev); | |
| 434 | int	bus_generic_attach(device_t dev) | |
| 435 | 	__deprecated1("Use bus_attach_children instead"); | |
| 445 | 436 | int	bus_generic_bind_intr(device_t dev, device_t child, |
| 446 | 437 | 			 struct resource *irq, int cpu); |
| 447 | 438 | int	bus_generic_child_location(device_t dev, device_t child, struct sbuf *sb); |
| ... | ... | @@ -452,8 +443,8 @@ int	bus_generic_config_intr(device_t, int, enum intr_trigger, |
| 452 | 443 | int	bus_generic_describe_intr(device_t dev, device_t child, |
| 453 | 444 | 				 struct resource *irq, void *cookie, |
| 454 | 445 | 				 const char *descr); |
| 455 | int	bus_generic_deactivate_resource(device_t dev, device_t child, int type, | |
| 456 | 					int rid, struct resource *r); | |
| 446 | int	bus_generic_deactivate_resource(device_t dev, device_t child, | |
| 447 | 					struct resource *r); | |
| 457 | 448 | int	bus_generic_detach(device_t dev); |
| 458 | 449 | void	bus_generic_driver_added(device_t dev, driver_t *driver); |
| 459 | 450 | int	bus_generic_get_cpus(device_t dev, device_t child, enum cpu_sets op, |
| ... | ... | @@ -466,9 +457,7 @@ int	bus_generic_get_domain(device_t dev, device_t child, int *domain); |
| 466 | 457 | ssize_t	bus_generic_get_property(device_t dev, device_t child, |
| 467 | 458 | 				 const char *propname, void *propvalue, |
| 468 | 459 | 				 size_t size, device_property_type_t type); |
| 469 | struct resource_list * | |
| 470 | 	bus_generic_get_resource_list(device_t, device_t); | |
| 471 | int	bus_generic_map_resource(device_t dev, device_t child, int type, | |
| 460 | int	bus_generic_map_resource(device_t dev, device_t child, | |
| 472 | 461 | 				 struct resource *r, |
| 473 | 462 | 				 struct resource_map_request *args, |
| 474 | 463 | 				 struct resource_map *map); |
| ... | ... | @@ -477,11 +466,12 @@ int	bus_print_child_header(device_t dev, device_t child); |
| 477 | 466 | int	bus_print_child_domain(device_t dev, device_t child); |
| 478 | 467 | int	bus_print_child_footer(device_t dev, device_t child); |
| 479 | 468 | int	bus_generic_print_child(device_t dev, device_t child); |
| 480 | int	bus_generic_probe(device_t dev); | |
| 469 | int	bus_generic_probe(device_t dev) | |
| 470 | 	__deprecated1("Use bus_identify_children instead"); | |
| 481 | 471 | int	bus_generic_read_ivar(device_t dev, device_t child, int which, |
| 482 | 472 | 			 uintptr_t *result); |
| 483 | 473 | int	bus_generic_release_resource(device_t bus, device_t child, |
| 484 | 				 int type, int rid, struct resource *r); | |
| 474 | 				 struct resource *r); | |
| 485 | 475 | int	bus_generic_resume(device_t dev); |
| 486 | 476 | int	bus_generic_resume_child(device_t dev, device_t child); |
| 487 | 477 | int	bus_generic_setup_intr(device_t dev, device_t child, |
| ... | ... | @@ -497,24 +487,20 @@ int	bus_generic_rl_get_resource (device_t, device_t, int, int, rman_res_t *, |
| 497 | 487 | 				 rman_res_t *); |
| 498 | 488 | int	bus_generic_rl_set_resource (device_t, device_t, int, int, rman_res_t, |
| 499 | 489 | 				 rman_res_t); |
| 500 | int	bus_generic_rl_release_resource (device_t, device_t, int, int, | |
| 501 | 					 struct resource *); | |
| 490 | int	bus_generic_rl_release_resource (device_t, device_t, struct resource *); | |
| 502 | 491 | struct resource * |
| 503 | 492 | 	bus_generic_rman_alloc_resource(device_t dev, device_t child, int type, |
| 504 | 493 | 					int *rid, rman_res_t start, |
| 505 | 494 | 					rman_res_t end, rman_res_t count, |
| 506 | 495 | 					u_int flags); |
| 507 | int	bus_generic_rman_adjust_resource(device_t dev, device_t child, int type, | |
| 496 | int	bus_generic_rman_adjust_resource(device_t dev, device_t child, | |
| 508 | 497 | 					 struct resource *r, rman_res_t start, |
| 509 | 498 | 					 rman_res_t end); |
| 510 | 499 | int	bus_generic_rman_release_resource(device_t dev, device_t child, |
| 511 | 					 int type, int rid, | |
| 512 | 500 | 					 struct resource *r); |
| 513 | 501 | int	bus_generic_rman_activate_resource(device_t dev, device_t child, |
| 514 | 					 int type, int rid, | |
| 515 | 502 | 					 struct resource *r); |
| 516 | 503 | int	bus_generic_rman_deactivate_resource(device_t dev, device_t child, |
| 517 | 					 int type, int rid, | |
| 518 | 504 | 					 struct resource *r); |
| 519 | 505 | |
| 520 | 506 | int	bus_generic_shutdown(device_t dev); |
| ... | ... | @@ -526,7 +512,7 @@ int	bus_generic_suspend_intr(device_t dev, device_t child, |
| 526 | 512 | 				 struct resource *irq); |
| 527 | 513 | int	bus_generic_resume_intr(device_t dev, device_t child, |
| 528 | 514 | 				 struct resource *irq); |
| 529 | int	bus_generic_unmap_resource(device_t dev, device_t child, int type, | |
| 515 | int	bus_generic_unmap_resource(device_t dev, device_t child, | |
| 530 | 516 | 				 struct resource *r, |
| 531 | 517 | 				 struct resource_map *map); |
| 532 | 518 | int	bus_generic_write_ivar(device_t dev, device_t child, int which, |
| ... | ... | @@ -554,29 +540,26 @@ int	bus_alloc_resources(device_t dev, struct resource_spec *rs, |
| 554 | 540 | void	bus_release_resources(device_t dev, const struct resource_spec *rs, |
| 555 | 541 | 			 struct resource **res); |
| 556 | 542 | |
| 557 | int	bus_adjust_resource(device_t child, int type, struct resource *r, | |
| 543 | int	bus_adjust_resource(device_t child, struct resource *r, | |
| 558 | 544 | 			 rman_res_t start, rman_res_t end); |
| 559 | 545 | int	bus_translate_resource(device_t child, int type, rman_res_t start, |
| 560 | 546 | 			 rman_res_t *newstart); |
| 561 | 547 | struct	resource *bus_alloc_resource(device_t dev, int type, int *rid, |
| 562 | 548 | 				 rman_res_t start, rman_res_t end, |
| 563 | 549 | 				 rman_res_t count, u_int flags); |
| 564 | int	bus_activate_resource(device_t dev, int type, int rid, | |
| 565 | 			 struct resource *r); | |
| 566 | int	bus_deactivate_resource(device_t dev, int type, int rid, | |
| 567 | 				struct resource *r); | |
| 568 | int	bus_map_resource(device_t dev, int type, struct resource *r, | |
| 550 | int	bus_activate_resource(device_t dev, struct resource *r); | |
| 551 | int	bus_deactivate_resource(device_t dev, struct resource *r); | |
| 552 | int	bus_map_resource(device_t dev, struct resource *r, | |
| 569 | 553 | 			 struct resource_map_request *args, |
| 570 | 554 | 			 struct resource_map *map); |
| 571 | int	bus_unmap_resource(device_t dev, int type, struct resource *r, | |
| 555 | int	bus_unmap_resource(device_t dev, struct resource *r, | |
| 572 | 556 | 			 struct resource_map *map); |
| 573 | 557 | int	bus_get_cpus(device_t dev, enum cpu_sets op, size_t setsize, |
| 574 | 558 | 		 struct _cpuset *cpuset); |
| 575 | 559 | bus_dma_tag_t bus_get_dma_tag(device_t dev); |
| 576 | 560 | bus_space_tag_t bus_get_bus_tag(device_t dev); |
| 577 | 561 | int	bus_get_domain(device_t dev, int *domain); |
| 578 | int	bus_release_resource(device_t dev, int type, int rid, | |
| 579 | 			 struct resource *r); | |
| 562 | int	bus_release_resource(device_t dev, struct resource *r); | |
| 580 | 563 | int	bus_free_resource(device_t dev, int type, struct resource *r); |
| 581 | 564 | int	bus_setup_intr(device_t dev, struct resource *r, int flags, |
| 582 | 565 | 		 driver_filter_t filter, driver_intr_t handler, |
| ... | ... | @@ -597,8 +580,12 @@ void	bus_delete_resource(device_t dev, int type, int rid); |
| 597 | 580 | int	bus_child_present(device_t child); |
| 598 | 581 | int	bus_child_pnpinfo(device_t child, struct sbuf *sb); |
| 599 | 582 | int	bus_child_location(device_t child, struct sbuf *sb); |
| 583 | ||
| 584 | void	bus_attach_children(device_t dev); | |
| 585 | void	bus_delayed_attach_children(device_t bus); | |
| 586 | int	bus_detach_children(device_t dev); | |
| 600 | 587 | void	bus_enumerate_hinted_children(device_t bus); |
| 601 | int	bus_delayed_attach_children(device_t bus); | |
| 588 | void	bus_identify_children(device_t dev); | |
| 602 | 589 | |
| 603 | 590 | static __inline struct resource * |
| 604 | 591 | bus_alloc_resource_any(device_t dev, int type, int *rid, u_int flags) |
| ... | ... | @@ -613,6 +600,47 @@ bus_alloc_resource_anywhere(device_t dev, int type, int *rid, |
| 613 | 600 | 	return (bus_alloc_resource(dev, type, rid, 0, ~0, count, flags)); |
| 614 | 601 | } |
| 615 | 602 | |
| 603 | /* Compat shims for simpler bus resource API. */ | |
| 604 | int	bus_adjust_resource_old(device_t child, int type, struct resource *r, | |
| 605 | rman_res_t start, rman_res_t end); | |
| 606 | int	bus_activate_resource_old(device_t dev, int type, int rid, | |
| 607 | 				 struct resource *r); | |
| 608 | int	bus_deactivate_resource_old(device_t dev, int type, int rid, | |
| 609 | 				 struct resource *r); | |
| 610 | int	bus_map_resource_old(device_t dev, int type, struct resource *r, | |
| 611 | 			 struct resource_map_request *args, | |
| 612 | 			 struct resource_map *map); | |
| 613 | int	bus_unmap_resource_old(device_t dev, int type, struct resource *r, | |
| 614 | 			 struct resource_map *map); | |
| 615 | int	bus_release_resource_old(device_t dev, int type, int rid, | |
| 616 | 				 struct resource *r); | |
| 617 | ||
| 618 | #define	_BUS_API_MACRO(_1, _2, _3, _4, _5, NAME, ...)	NAME | |
| 619 | ||
| 620 | #define	bus_adjust_resource(...)					\ | |
| 621 | 	_BUS_API_MACRO(__VA_ARGS__, bus_adjust_resource_old,		\ | |
| 622 | 	 bus_adjust_resource)(__VA_ARGS__) | |
| 623 | ||
| 624 | #define	bus_activate_resource(...)					\ | |
| 625 | 	_BUS_API_MACRO(__VA_ARGS__, INVALID, bus_activate_resource_old,	\ | |
| 626 | 	 INVALID, bus_activate_resource)(__VA_ARGS__) | |
| 627 | ||
| 628 | #define	bus_deactivate_resource(...)					\ | |
| 629 | 	_BUS_API_MACRO(__VA_ARGS__, INVALID, bus_deactivate_resource_old, \ | |
| 630 | 	 INVALID, bus_deactivate_resource)(__VA_ARGS__) | |
| 631 | ||
| 632 | #define	bus_map_resource(...)						\ | |
| 633 | 	_BUS_API_MACRO(__VA_ARGS__, bus_map_resource_old,		\ | |
| 634 | 	 bus_map_resource)(__VA_ARGS__) | |
| 635 | ||
| 636 | #define	bus_unmap_resource(...)						\ | |
| 637 | 	_BUS_API_MACRO(__VA_ARGS__, INVALID, bus_unmap_resource_old,	\ | |
| 638 | 	 bus_unmap_resource)(__VA_ARGS__) | |
| 639 | ||
| 640 | #define	bus_release_resource(...)					\ | |
| 641 | 	_BUS_API_MACRO(__VA_ARGS__, INVALID, bus_release_resource_old,	\ | |
| 642 | 	 INVALID, bus_release_resource)(__VA_ARGS__) | |
| 643 | ||
| 616 | 644 | /* |
| 617 | 645 | * Access functions for device. |
| 618 | 646 | */ |
| ... | ... | @@ -783,9 +811,7 @@ void	bus_data_generation_update(void); |
| 783 | 811 | #define BUS_LOCATOR_UEFI	"UEFI" |
| 784 | 812 | #define BUS_LOCATOR_OFW		"OFW" |
| 785 | 813 | |
| 786 | extern int bus_current_pass; | |
| 787 | ||
| 788 | void	bus_set_pass(int pass); | |
| 814 | int	bus_get_pass(void); | |
| 789 | 815 | |
| 790 | 816 | /** |
| 791 | 817 | * Routines to lock / unlock the newbus lock. |
| ... | ... | @@ -824,24 +850,25 @@ struct driver_module_data { |
| 824 | 850 | 	int		dmd_pass; |
| 825 | 851 | }; |
| 826 | 852 | |
| 827 | #define	EARLY_DRIVER_MODULE_ORDERED(name, busname, driver, evh, arg,	 \ | |
| 853 | #define	EARLY_DRIVER_MODULE_ORDERED(_name, busname, driver, evh, arg,	\ | |
| 828 | 854 | order, pass)							\ |
| 829 | 855 | 									\ |
| 830 | static struct driver_module_data name##_##busname##_driver_mod = {	\ | |
| 831 | 	evh, arg,							\ | |
| 832 | 	#busname,							\ | |
| 833 | 	(kobj_class_t) &driver,						\ | |
| 834 | 	NULL,								\ | |
| 835 | 	pass								\ | |
| 856 | static struct driver_module_data _name##_##busname##_driver_mod = {	\ | |
| 857 | 	.dmd_chainevh = evh,						\ | |
| 858 | 	.dmd_chainarg = arg,						\ | |
| 859 | 	.dmd_busname = #busname,					\ | |
| 860 | 	.dmd_driver = (kobj_class_t)&driver,				\ | |
| 861 | 	.dmd_devclass = NULL,						\ | |
| 862 | 	.dmd_pass = pass,						\ | |
| 836 | 863 | };									\ |
| 837 | 864 | 									\ |
| 838 | static moduledata_t name##_##busname##_mod = {				\ | |
| 839 | 	#busname "/" #name,						\ | |
| 840 | 	driver_module_handler,						\ | |
| 841 | 	&name##_##busname##_driver_mod					\ | |
| 865 | static moduledata_t _name##_##busname##_mod = {				\ | |
| 866 | 	.name =	 #busname "/" #_name ,					\ | |
| 867 | 	.evhand = driver_module_handler,				\ | |
| 868 | 	.priv =	 &_name##_##busname##_driver_mod,			\ | |
| 842 | 869 | };									\ |
| 843 | DECLARE_MODULE(name##_##busname, name##_##busname##_mod,		\ | |
| 844 | 	 SI_SUB_DRIVERS, order) | |
| 870 | DECLARE_MODULE(_name##_##busname, _name##_##busname##_mod,		\ | |
| 871 | SI_SUB_DRIVERS, order) | |
| 845 | 872 | |
| 846 | 873 | #define	EARLY_DRIVER_MODULE(name, busname, driver, evh, arg, pass)	\ |
| 847 | 874 | 	EARLY_DRIVER_MODULE_ORDERED(name, busname, driver, evh, arg,	\ |
lib/libc/include/generic-freebsd/sys/bus_dma.h+2-5| ... | ... | @@ -161,11 +161,8 @@ void _busdma_dflt_lock(void *arg, bus_dma_lock_op_t op); |
| 161 | 161 | *	boundary:	Boundary that segments cannot cross. |
| 162 | 162 | *	lowaddr:	Low restricted address that cannot appear in a mapping. |
| 163 | 163 | *	highaddr:	High restricted address that cannot appear in a mapping. |
| 164 | *	filtfunc:	An optional function to further test if an address | |
| 165 | *			within the range of lowaddr and highaddr cannot appear | |
| 166 | *			in a mapping. | |
| 167 | *	filtfuncarg:	An argument that will be passed to filtfunc in addition | |
| 168 | *			to the address to test. | |
| 164 | *	filtfunc:	(deprecated, must be NULL) | |
| 165 | *	filtfuncarg:	(deprecated, must be NULL) | |
| 169 | 166 | *	maxsize:	Maximum mapping size supported by this tag. |
| 170 | 167 | *	nsegments:	Number of discontinuities allowed in maps. |
| 171 | 168 | *	maxsegsz:	Maximum size of a segment in the map. |
lib/libc/include/generic-freebsd/sys/callout.h+7-14| ... | ... | @@ -32,8 +32,6 @@ |
| 32 | 32 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 33 | 33 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 34 | 34 | * SUCH DAMAGE. |
| 35 | * | |
| 36 | *	@(#)callout.h	8.2 (Berkeley) 1/21/94 | |
| 37 | 35 | */ |
| 38 | 36 | |
| 39 | 37 | #ifndef _SYS_CALLOUT_H_ |
| ... | ... | @@ -41,7 +39,7 @@ |
| 41 | 39 | |
| 42 | 40 | #include <sys/_callout.h> |
| 43 | 41 | |
| 44 | #define	CALLOUT_LOCAL_ALLOC	0x0001 /* was allocated from callfree */ | |
| 42 | #define	CALLOUT_TRYLOCK		0x0001 /* try semantic in softclock_call_cc */ | |
| 45 | 43 | #define	CALLOUT_ACTIVE		0x0002 /* callout is currently active */ |
| 46 | 44 | #define	CALLOUT_PENDING		0x0004 /* callout is waiting for timeout */ |
| 47 | 45 | #define	CALLOUT_MPSAFE		0x0008 /* deprecated */ |
| ... | ... | @@ -83,18 +81,15 @@ |
| 83 | 81 | */ |
| 84 | 82 | #define	callout_active(c)	((c)->c_flags & CALLOUT_ACTIVE) |
| 85 | 83 | #define	callout_deactivate(c)	((c)->c_flags &= ~CALLOUT_ACTIVE) |
| 86 | #define	callout_drain(c)	_callout_stop_safe(c, CS_DRAIN, NULL) | |
| 84 | #define	callout_drain(c)	_callout_stop_safe(c, CS_DRAIN) | |
| 87 | 85 | void	callout_init(struct callout *, int); |
| 88 | 86 | void	_callout_init_lock(struct callout *, struct lock_object *, int); |
| 89 | 87 | #define	callout_init_mtx(c, mtx, flags)					\ |
| 90 | 	_callout_init_lock((c), ((mtx) != NULL) ? &(mtx)->lock_object :	\ | |
| 91 | 	 NULL, (flags)) | |
| 88 | 	_callout_init_lock((c), &(mtx)->lock_object, (flags)) | |
| 92 | 89 | #define	callout_init_rm(c, rm, flags)					\ |
| 93 | 	_callout_init_lock((c), ((rm) != NULL) ? &(rm)->lock_object : 	\ | |
| 94 | 	 NULL, (flags)) | |
| 90 | 	_callout_init_lock((c), &(rm)->lock_object, (flags)) | |
| 95 | 91 | #define	callout_init_rw(c, rw, flags)					\ |
| 96 | 	_callout_init_lock((c), ((rw) != NULL) ? &(rw)->lock_object :	\ | |
| 97 | 	 NULL, (flags)) | |
| 92 | 	_callout_init_lock((c), &(rw)->lock_object, (flags)) | |
| 98 | 93 | #define	callout_pending(c)	((c)->c_iflags & CALLOUT_PENDING) |
| 99 | 94 | int	callout_reset_sbt_on(struct callout *, sbintime_t, sbintime_t, |
| 100 | 95 | 	 void (*)(void *), void *, int, int); |
| ... | ... | @@ -121,11 +116,9 @@ int	callout_schedule(struct callout *, int); |
| 121 | 116 | int	callout_schedule_on(struct callout *, int, int); |
| 122 | 117 | #define	callout_schedule_curcpu(c, on_tick)				\ |
| 123 | 118 | callout_schedule_on((c), (on_tick), PCPU_GET(cpuid)) |
| 124 | #define	callout_stop(c)		_callout_stop_safe(c, 0, NULL) | |
| 125 | int	_callout_stop_safe(struct callout *, int, void (*)(void *)); | |
| 119 | #define	callout_stop(c)		_callout_stop_safe(c, 0) | |
| 120 | int	_callout_stop_safe(struct callout *, int); | |
| 126 | 121 | void	callout_process(sbintime_t now); |
| 127 | #define callout_async_drain(c, d)					\ | |
| 128 | _callout_stop_safe(c, 0, d) | |
| 129 | 122 | void callout_when(sbintime_t sbt, sbintime_t precision, int flags, |
| 130 | 123 | sbintime_t *sbt_res, sbintime_t *prec_res); |
| 131 | 124 | #endif |
lib/libc/include/generic-freebsd/sys/caprights.h+48-45| ... | ... | @@ -58,51 +58,54 @@ typedef	struct cap_rights	cap_rights_t; |
| 58 | 58 | #endif |
| 59 | 59 | |
| 60 | 60 | #ifdef _KERNEL |
| 61 | extern cap_rights_t cap_accept_rights; | |
| 62 | extern cap_rights_t cap_bind_rights; | |
| 63 | extern cap_rights_t cap_connect_rights; | |
| 64 | extern cap_rights_t cap_event_rights; | |
| 65 | extern cap_rights_t cap_fchdir_rights; | |
| 66 | extern cap_rights_t cap_fchflags_rights; | |
| 67 | extern cap_rights_t cap_fchmod_rights; | |
| 68 | extern cap_rights_t cap_fchown_rights; | |
| 69 | extern cap_rights_t cap_fcntl_rights; | |
| 70 | extern cap_rights_t cap_fexecve_rights; | |
| 71 | extern cap_rights_t cap_flock_rights; | |
| 72 | extern cap_rights_t cap_fpathconf_rights; | |
| 73 | extern cap_rights_t cap_fstat_rights; | |
| 74 | extern cap_rights_t cap_fstatfs_rights; | |
| 75 | extern cap_rights_t cap_fsync_rights; | |
| 76 | extern cap_rights_t cap_ftruncate_rights; | |
| 77 | extern cap_rights_t cap_futimes_rights; | |
| 78 | extern cap_rights_t cap_getpeername_rights; | |
| 79 | extern cap_rights_t cap_getsockopt_rights; | |
| 80 | extern cap_rights_t cap_getsockname_rights; | |
| 81 | extern cap_rights_t cap_ioctl_rights; | |
| 82 | extern cap_rights_t cap_linkat_source_rights; | |
| 83 | extern cap_rights_t cap_linkat_target_rights; | |
| 84 | extern cap_rights_t cap_listen_rights; | |
| 85 | extern cap_rights_t cap_mkdirat_rights; | |
| 86 | extern cap_rights_t cap_mkfifoat_rights; | |
| 87 | extern cap_rights_t cap_mknodat_rights; | |
| 88 | extern cap_rights_t cap_mmap_rights; | |
| 89 | extern cap_rights_t cap_no_rights; | |
| 90 | extern cap_rights_t cap_pdgetpid_rights; | |
| 91 | extern cap_rights_t cap_pdkill_rights; | |
| 92 | extern cap_rights_t cap_pread_rights; | |
| 93 | extern cap_rights_t cap_pwrite_rights; | |
| 94 | extern cap_rights_t cap_read_rights; | |
| 95 | extern cap_rights_t cap_recv_rights; | |
| 96 | extern cap_rights_t cap_renameat_source_rights; | |
| 97 | extern cap_rights_t cap_renameat_target_rights; | |
| 98 | extern cap_rights_t cap_seek_rights; | |
| 99 | extern cap_rights_t cap_send_rights; | |
| 100 | extern cap_rights_t cap_send_connect_rights; | |
| 101 | extern cap_rights_t cap_setsockopt_rights; | |
| 102 | extern cap_rights_t cap_shutdown_rights; | |
| 103 | extern cap_rights_t cap_symlinkat_rights; | |
| 104 | extern cap_rights_t cap_unlinkat_rights; | |
| 105 | extern cap_rights_t cap_write_rights; | |
| 61 | extern const cap_rights_t cap_accept_rights; | |
| 62 | extern const cap_rights_t cap_bind_rights; | |
| 63 | extern const cap_rights_t cap_connect_rights; | |
| 64 | extern const cap_rights_t cap_event_rights; | |
| 65 | extern const cap_rights_t cap_fchdir_rights; | |
| 66 | extern const cap_rights_t cap_fchflags_rights; | |
| 67 | extern const cap_rights_t cap_fchmod_rights; | |
| 68 | extern const cap_rights_t cap_fchown_rights; | |
| 69 | extern const cap_rights_t cap_fchroot_rights; | |
| 70 | extern const cap_rights_t cap_fcntl_rights; | |
| 71 | extern const cap_rights_t cap_fexecve_rights; | |
| 72 | extern const cap_rights_t cap_flock_rights; | |
| 73 | extern const cap_rights_t cap_fpathconf_rights; | |
| 74 | extern const cap_rights_t cap_fstat_rights; | |
| 75 | extern const cap_rights_t cap_fstatfs_rights; | |
| 76 | extern const cap_rights_t cap_fsync_rights; | |
| 77 | extern const cap_rights_t cap_ftruncate_rights; | |
| 78 | extern const cap_rights_t cap_futimes_rights; | |
| 79 | extern const cap_rights_t cap_getpeername_rights; | |
| 80 | extern const cap_rights_t cap_getsockopt_rights; | |
| 81 | extern const cap_rights_t cap_getsockname_rights; | |
| 82 | extern const cap_rights_t cap_inotify_add_rights; | |
| 83 | extern const cap_rights_t cap_inotify_rm_rights; | |
| 84 | extern const cap_rights_t cap_ioctl_rights; | |
| 85 | extern const cap_rights_t cap_linkat_source_rights; | |
| 86 | extern const cap_rights_t cap_linkat_target_rights; | |
| 87 | extern const cap_rights_t cap_listen_rights; | |
| 88 | extern const cap_rights_t cap_mkdirat_rights; | |
| 89 | extern const cap_rights_t cap_mkfifoat_rights; | |
| 90 | extern const cap_rights_t cap_mknodat_rights; | |
| 91 | extern const cap_rights_t cap_mmap_rights; | |
| 92 | extern const cap_rights_t cap_no_rights; | |
| 93 | extern const cap_rights_t cap_pdgetpid_rights; | |
| 94 | extern const cap_rights_t cap_pdkill_rights; | |
| 95 | extern const cap_rights_t cap_pread_rights; | |
| 96 | extern const cap_rights_t cap_pwrite_rights; | |
| 97 | extern const cap_rights_t cap_read_rights; | |
| 98 | extern const cap_rights_t cap_recv_rights; | |
| 99 | extern const cap_rights_t cap_renameat_source_rights; | |
| 100 | extern const cap_rights_t cap_renameat_target_rights; | |
| 101 | extern const cap_rights_t cap_seek_rights; | |
| 102 | extern const cap_rights_t cap_send_rights; | |
| 103 | extern const cap_rights_t cap_send_connect_rights; | |
| 104 | extern const cap_rights_t cap_setsockopt_rights; | |
| 105 | extern const cap_rights_t cap_shutdown_rights; | |
| 106 | extern const cap_rights_t cap_symlinkat_rights; | |
| 107 | extern const cap_rights_t cap_unlinkat_rights; | |
| 108 | extern const cap_rights_t cap_write_rights; | |
| 106 | 109 | #endif |
| 107 | 110 | |
| 108 | 111 | #endif /* !_SYS_CAPRIGHTS_H_ */ |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/sys/capsicum.h+28-6| ... | ... | @@ -39,7 +39,6 @@ |
| 39 | 39 | #ifndef _SYS_CAPSICUM_H_ |
| 40 | 40 | #define	_SYS_CAPSICUM_H_ |
| 41 | 41 | |
| 42 | #include <sys/cdefs.h> | |
| 43 | 42 | #include <sys/param.h> |
| 44 | 43 | |
| 45 | 44 | #include <sys/caprights.h> |
| ... | ... | @@ -202,6 +201,9 @@ |
| 202 | 201 | /* Allows for renameat(2) (target directory descriptor). */ |
| 203 | 202 | #define	CAP_RENAMEAT_TARGET	(CAP_LOOKUP | 0x0000040000000000ULL) |
| 204 | 203 | |
| 204 | /* Allows for fchroot(2). */ | |
| 205 | #define	CAP_FCHROOT		CAPRIGHT(0, 0x0000080000000000ULL) | |
| 206 | ||
| 205 | 207 | #define	CAP_SOCK_CLIENT \ |
| 206 | 208 | 	(CAP_CONNECT | CAP_GETPEERNAME | CAP_GETSOCKNAME | CAP_GETSOCKOPT | \ |
| 207 | 209 | 	 CAP_PEELOFF | CAP_RECV | CAP_SEND | CAP_SETSOCKOPT | CAP_SHUTDOWN) |
| ... | ... | @@ -211,11 +213,9 @@ |
| 211 | 213 | 	 CAP_SETSOCKOPT | CAP_SHUTDOWN) |
| 212 | 214 | |
| 213 | 215 | /* All used bits for index 0. */ |
| 214 | #define	CAP_ALL0		CAPRIGHT(0, 0x000007FFFFFFFFFFULL) | |
| 216 | #define	CAP_ALL0		CAPRIGHT(0, 0x00000FFFFFFFFFFFULL) | |
| 215 | 217 | |
| 216 | 218 | /* Available bits for index 0. */ |
| 217 | #define	CAP_UNUSED0_44		CAPRIGHT(0, 0x0000080000000000ULL) | |
| 218 | /* ... */ | |
| 219 | 219 | #define	CAP_UNUSED0_57		CAPRIGHT(0, 0x0100000000000000ULL) |
| 220 | 220 | |
| 221 | 221 | /* INDEX 1 */ |
| ... | ... | @@ -279,11 +279,15 @@ |
| 279 | 279 | |
| 280 | 280 | #define	CAP_KQUEUE		(CAP_KQUEUE_EVENT | CAP_KQUEUE_CHANGE) |
| 281 | 281 | |
| 282 | /* Allows operations on inotify descriptors. */ | |
| 283 | #define	CAP_INOTIFY_ADD		CAPRIGHT(1, 0x0000000000200000ULL) | |
| 284 | #define	CAP_INOTIFY_RM		CAPRIGHT(1, 0x0000000000400000ULL) | |
| 285 | ||
| 282 | 286 | /* All used bits for index 1. */ |
| 283 | #define	CAP_ALL1		CAPRIGHT(1, 0x00000000001FFFFFULL) | |
| 287 | #define	CAP_ALL1		CAPRIGHT(1, 0x00000000007FFFFFULL) | |
| 284 | 288 | |
| 285 | 289 | /* Available bits for index 1. */ |
| 286 | #define	CAP_UNUSED1_22		CAPRIGHT(1, 0x0000000000200000ULL) | |
| 290 | #define	CAP_UNUSED1_22		CAPRIGHT(1, 0x0000000000800000ULL) | |
| 287 | 291 | /* ... */ |
| 288 | 292 | #define	CAP_UNUSED1_57		CAPRIGHT(1, 0x0100000000000000ULL) |
| 289 | 293 | |
| ... | ... | @@ -371,6 +375,24 @@ _Static_assert(CAP_RIGHTS_VERSION == CAP_RIGHTS_VERSION_00, |
| 371 | 375 | 	_r;								\ |
| 372 | 376 | }) |
| 373 | 377 | |
| 378 | #define	_CAP_RIGHTS_WORD_INITIALIZER(i, r)				\ | |
| 379 | 	(CAPIDXBIT(r) == (i) + 1 ? (r) : 0ULL) | |
| 380 | ||
| 381 | /* | |
| 382 | * Define a set of up to two rights at compile time. | |
| 383 | */ | |
| 384 | #define	CAP_RIGHTS_INITIALIZER2(r1, r2) ((struct cap_rights){		\ | |
| 385 | 	.cr_rights = {							\ | |
| 386 | 		[0] = ((uint64_t)CAP_RIGHTS_VERSION << 62) |		\ | |
| 387 | 		 _CAP_RIGHTS_WORD_INITIALIZER(0, r1) |		\ | |
| 388 | 		 _CAP_RIGHTS_WORD_INITIALIZER(0, r2),		\ | |
| 389 | 		[1] = _CAP_RIGHTS_WORD_INITIALIZER(1, r1) |		\ | |
| 390 | 		 _CAP_RIGHTS_WORD_INITIALIZER(1, r2),		\ | |
| 391 | 	},								\ | |
| 392 | }) | |
| 393 | #define	CAP_RIGHTS_INITIALIZER(r)					\ | |
| 394 | 	CAP_RIGHTS_INITIALIZER2(r, 0ULL) | |
| 395 | ||
| 374 | 396 | /* |
| 375 | 397 | * Allow checking caps which are possibly getting modified at the same time. |
| 376 | 398 | * The caller is expected to determine whether the result is legitimate via |
lib/libc/include/generic-freebsd/sys/cdefs.h+102-387| ... | ... | @@ -30,8 +30,6 @@ |
| 30 | 30 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 31 | 31 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 32 | 32 | * SUCH DAMAGE. |
| 33 | * | |
| 34 | *	@(#)cdefs.h	8.8 (Berkeley) 1/9/95 | |
| 35 | 33 | */ |
| 36 | 34 | |
| 37 | 35 | #ifndef	_SYS_CDEFS_H_ |
| ... | ... | @@ -42,7 +40,10 @@ |
| 42 | 40 | #endif |
| 43 | 41 | |
| 44 | 42 | /* |
| 45 | * Testing against Clang-specific extensions. | |
| 43 | * Provide clang-compatible testing macros. All supported versions of gcc (10+) | |
| 44 | * provide all of these except has_feature and has_extension which are new in | |
| 45 | * gcc 14. Keep the older ifndefs, though, for non-gcc compilers that may lack | |
| 46 | * them like tcc and pcc. | |
| 46 | 47 | */ |
| 47 | 48 | #ifndef	__has_attribute |
| 48 | 49 | #define	__has_attribute(x)	0 |
| ... | ... | @@ -74,61 +75,34 @@ |
| 74 | 75 | * having a compiler-agnostic source tree. |
| 75 | 76 | */ |
| 76 | 77 | |
| 78 | /* | |
| 79 | * Macro to test if we're using a specific version of gcc or later. | |
| 80 | */ | |
| 77 | 81 | #if defined(__GNUC__) |
| 78 | ||
| 79 | #if __GNUC__ >= 3 | |
| 80 | #define	__GNUCLIKE_ASM 3 | |
| 81 | #define	__GNUCLIKE_MATH_BUILTIN_CONSTANTS | |
| 82 | #define	__GNUC_PREREQ__(ma, mi)	\ | |
| 83 | 	(__GNUC__ > (ma) || __GNUC__ == (ma) && __GNUC_MINOR__ >= (mi)) | |
| 82 | 84 | #else |
| 83 | #define	__GNUCLIKE_ASM 2 | |
| 84 | #endif | |
| 85 | #define	__GNUCLIKE___TYPEOF 1 | |
| 86 | #define	__GNUCLIKE___SECTION 1 | |
| 87 | ||
| 88 | #define	__GNUCLIKE_CTOR_SECTION_HANDLING 1 | |
| 89 | ||
| 90 | #define	__GNUCLIKE_BUILTIN_CONSTANT_P 1 | |
| 91 | ||
| 92 | #if (__GNUC_MINOR__ > 95 || __GNUC__ >= 3) | |
| 93 | #define	__GNUCLIKE_BUILTIN_VARARGS 1 | |
| 94 | #define	__GNUCLIKE_BUILTIN_STDARG 1 | |
| 95 | #define	__GNUCLIKE_BUILTIN_VAALIST 1 | |
| 85 | #define	__GNUC_PREREQ__(ma, mi)	0 | |
| 96 | 86 | #endif |
| 97 | 87 | |
| 98 | #define	__GNUC_VA_LIST_COMPATIBILITY 1 | |
| 88 | #if defined(__GNUC__) | |
| 99 | 89 | |
| 100 | 90 | /* |
| 101 | 91 | * Compiler memory barriers, specific to gcc and clang. |
| 102 | 92 | */ |
| 103 | 93 | #define	__compiler_membar()	__asm __volatile(" " : : : "memory") |
| 104 | 94 | |
| 105 | #define	__GNUCLIKE_BUILTIN_NEXT_ARG 1 | |
| 106 | #define	__GNUCLIKE_MATH_BUILTIN_RELOPS | |
| 107 | ||
| 108 | #define	__GNUCLIKE_BUILTIN_MEMCPY 1 | |
| 109 | ||
| 110 | /* XXX: if __GNUC__ >= 2: not tested everywhere originally, where replaced */ | |
| 111 | #define	__CC_SUPPORTS_INLINE 1 | |
| 112 | 95 | #define	__CC_SUPPORTS___INLINE 1 |
| 113 | #define	__CC_SUPPORTS___INLINE__ 1 | |
| 114 | ||
| 115 | #define	__CC_SUPPORTS___FUNC__ 1 | |
| 116 | #define	__CC_SUPPORTS_WARNING 1 | |
| 117 | ||
| 118 | #define	__CC_SUPPORTS_VARADIC_XXX 1 /* see varargs.h */ | |
| 119 | ||
| 120 | #define	__CC_SUPPORTS_DYNAMIC_ARRAY_INIT 1 | |
| 96 | #define	__CC_SUPPORTS_SYMVER 1 | |
| 121 | 97 | |
| 122 | 98 | #endif /* __GNUC__ */ |
| 123 | 99 | |
| 124 | 100 | /* |
| 125 | * Macro to test if we're using a specific version of gcc or later. | |
| 101 | * TinyC pretends to be gcc 9.3. This is generally good enough to support | |
| 102 | * everything FreeBSD... except for the .symver assembler directive. | |
| 126 | 103 | */ |
| 127 | #if defined(__GNUC__) | |
| 128 | #define	__GNUC_PREREQ__(ma, mi)	\ | |
| 129 | 	(__GNUC__ > (ma) || __GNUC__ == (ma) && __GNUC_MINOR__ >= (mi)) | |
| 130 | #else | |
| 131 | #define	__GNUC_PREREQ__(ma, mi)	0 | |
| 104 | #ifdef __TINYC__ | |
| 105 | #undef	__CC_SUPPORTS_SYMVER | |
| 132 | 106 | #endif |
| 133 | 107 | |
| 134 | 108 | /* |
| ... | ... | @@ -150,8 +124,6 @@ |
| 150 | 124 | #define	__STRING(x)	#x		/* stringify without expanding x */ |
| 151 | 125 | #define	__XSTRING(x)	__STRING(x)	/* expand x, then stringify */ |
| 152 | 126 | |
| 153 | #define	__const		const		/* define reserved names to standard */ | |
| 154 | #define	__signed	signed | |
| 155 | 127 | #define	__volatile	volatile |
| 156 | 128 | #if defined(__cplusplus) |
| 157 | 129 | #define	__inline	inline		/* convert to C++ keyword */ |
| ... | ... | @@ -165,76 +137,32 @@ |
| 165 | 137 | #define	__P(protos)	()		/* traditional C preprocessor */ |
| 166 | 138 | #define	__CONCAT(x,y)	x/**/y |
| 167 | 139 | #define	__STRING(x)	"x" |
| 168 | ||
| 169 | 140 | #if !defined(__CC_SUPPORTS___INLINE) |
| 170 | #define	__const				/* delete pseudo-ANSI C keywords */ | |
| 141 | /* Just delete these in a K&R environment */ | |
| 171 | 142 | #define	__inline |
| 172 | #define	__signed | |
| 173 | 143 | #define	__volatile |
| 174 | /* | |
| 175 | * In non-ANSI C environments, new programs will want ANSI-only C keywords | |
| 176 | * deleted from the program and old programs will want them left alone. | |
| 177 | * When using a compiler other than gcc, programs using the ANSI C keywords | |
| 178 | * const, inline etc. as normal identifiers should define -DNO_ANSI_KEYWORDS. | |
| 179 | * When using "gcc -traditional", we assume that this is the intent; if | |
| 180 | * __GNUC__ is defined but __STDC__ is not, we leave the new keywords alone. | |
| 181 | */ | |
| 182 | #ifndef	NO_ANSI_KEYWORDS | |
| 183 | #define	const				/* delete ANSI C keywords */ | |
| 184 | #define	inline | |
| 185 | #define	signed | |
| 186 | #define	volatile | |
| 187 | #endif	/* !NO_ANSI_KEYWORDS */ | |
| 188 | 144 | #endif	/* !__CC_SUPPORTS___INLINE */ |
| 189 | 145 | #endif	/* !(__STDC__ || __cplusplus) */ |
| 190 | 146 | |
| 191 | 147 | /* |
| 192 | * Compiler-dependent macros to help declare dead (non-returning) and | |
| 193 | * pure (no side effects) functions, and unused variables. They are | |
| 194 | * null except for versions of gcc that are known to support the features | |
| 195 | * properly (old versions of gcc-2 supported the dead and pure features | |
| 196 | * in a different (wrong) way). If we do not provide an implementation | |
| 197 | * for a given compiler, let the compile fail if it is told to use | |
| 198 | * a feature that we cannot live without. | |
| 148 | * Compiler-dependent macros to help declare dead (non-returning) and pure (no | |
| 149 | * side effects) functions, and unused variables. These attributes are supported | |
| 150 | * by all current compilers, even pcc. | |
| 199 | 151 | */ |
| 200 | 152 | #define	__weak_symbol	__attribute__((__weak__)) |
| 201 | #if !__GNUC_PREREQ__(2, 5) | |
| 202 | #define	__dead2 | |
| 203 | #define	__pure2 | |
| 204 | #define	__unused | |
| 205 | #endif | |
| 206 | #if __GNUC__ == 2 && __GNUC_MINOR__ >= 5 && __GNUC_MINOR__ < 7 | |
| 207 | #define	__dead2		__attribute__((__noreturn__)) | |
| 208 | #define	__pure2		__attribute__((__const__)) | |
| 209 | #define	__unused | |
| 210 | /* XXX Find out what to do for __packed, __aligned and __section */ | |
| 211 | #endif | |
| 212 | #if __GNUC_PREREQ__(2, 7) | |
| 213 | 153 | #define	__dead2		__attribute__((__noreturn__)) |
| 214 | 154 | #define	__pure2		__attribute__((__const__)) |
| 215 | 155 | #define	__unused	__attribute__((__unused__)) |
| 216 | 156 | #define	__used		__attribute__((__used__)) |
| 157 | #define __deprecated	__attribute__((__deprecated__)) | |
| 158 | #define __deprecated1(msg)	__attribute__((__deprecated__(msg))) | |
| 217 | 159 | #define	__packed	__attribute__((__packed__)) |
| 218 | 160 | #define	__aligned(x)	__attribute__((__aligned__(x))) |
| 219 | 161 | #define	__section(x)	__attribute__((__section__(x))) |
| 220 | #endif | |
| 221 | 162 | #define	__writeonly	__unused |
| 222 | #if __GNUC_PREREQ__(4, 3) || __has_attribute(__alloc_size__) | |
| 223 | 163 | #define	__alloc_size(x)	__attribute__((__alloc_size__(x))) |
| 224 | 164 | #define	__alloc_size2(n, x)	__attribute__((__alloc_size__(n, x))) |
| 225 | #else | |
| 226 | #define	__alloc_size(x) | |
| 227 | #define	__alloc_size2(n, x) | |
| 228 | #endif | |
| 229 | #if __GNUC_PREREQ__(4, 9) || __has_attribute(__alloc_align__) | |
| 230 | 165 | #define	__alloc_align(x)	__attribute__((__alloc_align__(x))) |
| 231 | #else | |
| 232 | #define	__alloc_align(x) | |
| 233 | #endif | |
| 234 | ||
| 235 | #if !__GNUC_PREREQ__(2, 95) | |
| 236 | #define	__alignof(x)	__offsetof(struct { char __a; x __b; }, __b) | |
| 237 | #endif | |
| 238 | 166 | |
| 239 | 167 | /* |
| 240 | 168 | * Keywords added in C11. |
| ... | ... | @@ -258,15 +186,6 @@ |
| 258 | 186 | #define	_Alignof(x)		__alignof(x) |
| 259 | 187 | #endif |
| 260 | 188 | |
| 261 | #if !defined(__cplusplus) && !__has_extension(c_atomic) && \ | |
| 262 | 	!__has_extension(cxx_atomic) && !__GNUC_PREREQ__(4, 7) | |
| 263 | /* | |
| 264 | * No native support for _Atomic(). Place object in structure to prevent | |
| 265 | * most forms of direct non-atomic access. | |
| 266 | */ | |
| 267 | #define	_Atomic(T)		struct { T volatile __val; } | |
| 268 | #endif | |
| 269 | ||
| 270 | 189 | #if defined(__cplusplus) && __cplusplus >= 201103L |
| 271 | 190 | #define	_Noreturn		[[noreturn]] |
| 272 | 191 | #else |
| ... | ... | @@ -281,12 +200,7 @@ |
| 281 | 200 | #endif |
| 282 | 201 | |
| 283 | 202 | #if !__has_extension(c_thread_local) |
| 284 | /* | |
| 285 | * XXX: Some compilers (Clang 3.3, GCC 4.7) falsely announce C++11 mode | |
| 286 | * without actually supporting the thread_local keyword. Don't check for | |
| 287 | * the presence of C++11 when defining _Thread_local. | |
| 288 | */ | |
| 289 | #if /* (defined(__cplusplus) && __cplusplus >= 201103L) || */ \ | |
| 203 | #if (defined(__cplusplus) && __cplusplus >= 201103L) || \ | |
| 290 | 204 | __has_extension(cxx_thread_local) |
| 291 | 205 | #define	_Thread_local		thread_local |
| 292 | 206 | #else |
| ... | ... | @@ -312,10 +226,10 @@ |
| 312 | 226 | __has_extension(c_generic_selections) |
| 313 | 227 | #define	__generic(expr, t, yes, no)					\ |
| 314 | 228 | 	_Generic(expr, t: yes, default: no) |
| 315 | #elif __GNUC_PREREQ__(3, 1) && !defined(__cplusplus) | |
| 229 | #elif !defined(__cplusplus) | |
| 316 | 230 | #define	__generic(expr, t, yes, no)					\ |
| 317 | 	__builtin_choose_expr(						\ | |
| 318 | 	 __builtin_types_compatible_p(__typeof((0, (expr))), t), yes, no) | |
| 231 | 	__builtin_choose_expr(__builtin_types_compatible_p(		\ | |
| 232 | 	 __typeof(((void)0, (expr))), t), yes, no) | |
| 319 | 233 | #endif |
| 320 | 234 | |
| 321 | 235 | /* |
| ... | ... | @@ -326,59 +240,24 @@ |
| 326 | 240 | * void bar(int myArray[__min_size(10)]); |
| 327 | 241 | */ |
| 328 | 242 | #if !defined(__cplusplus) && \ |
| 329 | (defined(__clang__) || __GNUC_PREREQ__(4, 6)) && \ | |
| 330 | 243 | (!defined(__STDC_VERSION__) || (__STDC_VERSION__ >= 199901)) |
| 331 | 244 | #define __min_size(x)	static (x) |
| 332 | 245 | #else |
| 333 | 246 | #define __min_size(x)	(x) |
| 334 | 247 | #endif |
| 335 | 248 | |
| 336 | #if __GNUC_PREREQ__(2, 96) | |
| 337 | 249 | #define	__malloc_like	__attribute__((__malloc__)) |
| 338 | 250 | #define	__pure		__attribute__((__pure__)) |
| 339 | #else | |
| 340 | #define	__malloc_like | |
| 341 | #define	__pure | |
| 342 | #endif | |
| 343 | ||
| 344 | #if __GNUC_PREREQ__(3, 1) | |
| 345 | #define	__always_inline	__attribute__((__always_inline__)) | |
| 346 | #else | |
| 347 | #define	__always_inline | |
| 348 | #endif | |
| 349 | 251 | |
| 350 | #if __GNUC_PREREQ__(3, 1) | |
| 252 | #define	__always_inline	__inline __attribute__((__always_inline__)) | |
| 351 | 253 | #define	__noinline	__attribute__ ((__noinline__)) |
| 352 | #else | |
| 353 | #define	__noinline | |
| 354 | #endif | |
| 355 | ||
| 356 | #if __GNUC_PREREQ__(3, 4) | |
| 357 | 254 | #define	__fastcall	__attribute__((__fastcall__)) |
| 358 | 255 | #define	__result_use_check	__attribute__((__warn_unused_result__)) |
| 359 | #else | |
| 360 | #define	__fastcall | |
| 361 | #define	__result_use_check | |
| 362 | #endif | |
| 363 | ||
| 364 | #if __GNUC_PREREQ__(4, 1) | |
| 365 | 256 | #define	__returns_twice	__attribute__((__returns_twice__)) |
| 366 | #else | |
| 367 | #define	__returns_twice | |
| 368 | #endif | |
| 369 | 257 | |
| 370 | #if __GNUC_PREREQ__(4, 6) || __has_builtin(__builtin_unreachable) | |
| 371 | 258 | #define	__unreachable()	__builtin_unreachable() |
| 372 | #else | |
| 373 | #define	__unreachable()	((void)0) | |
| 374 | #endif | |
| 375 | 259 | |
| 376 | /* XXX: should use `#if __STDC_VERSION__ < 199901'. */ | |
| 377 | #if !__GNUC_PREREQ__(2, 7) | |
| 378 | #define	__func__	NULL | |
| 379 | #endif | |
| 380 | ||
| 381 | #if (defined(__GNUC__) && __GNUC__ >= 2) && !defined(__STRICT_ANSI__) || __STDC_VERSION__ >= 199901 | |
| 260 | #if !defined(__STRICT_ANSI__) || __STDC_VERSION__ >= 199901 | |
| 382 | 261 | #define	__LONG_LONG_SUPPORTED |
| 383 | 262 | #endif |
| 384 | 263 | |
| ... | ... | @@ -393,6 +272,55 @@ |
| 393 | 272 | #endif |
| 394 | 273 | #endif |
| 395 | 274 | |
| 275 | /* | |
| 276 | * noexcept keyword added in C++11. | |
| 277 | */ | |
| 278 | #if defined(__cplusplus) && __cplusplus >= 201103L | |
| 279 | #define __noexcept noexcept | |
| 280 | #define __noexcept_if(__c) noexcept(__c) | |
| 281 | #else | |
| 282 | #define __noexcept | |
| 283 | #define __noexcept_if(__c) | |
| 284 | #endif | |
| 285 | ||
| 286 | /* | |
| 287 | * nodiscard attribute added in C++17 and C23, but supported by both LLVM and | |
| 288 | * GCC in earlier language versions, so we use __has_c{,pp}_attribute to test | |
| 289 | * for it. | |
| 290 | * | |
| 291 | * __nodiscard may be used on a function: | |
| 292 | * 	__nodiscard int f(); | |
| 293 | * | |
| 294 | * or on a struct, union or enum: | |
| 295 | * 	struct __nodiscard S{}; | |
| 296 | * 	struct S f(); | |
| 297 | * | |
| 298 | * or in C++, on an object constructor. | |
| 299 | */ | |
| 300 | ||
| 301 | #if defined(__cplusplus) && defined(__has_cpp_attribute) | |
| 302 | #if __has_cpp_attribute(nodiscard) | |
| 303 | #define	__nodiscard	[[nodiscard]] | |
| 304 | #endif | |
| 305 | #elif defined(__STDC_VERSION__) && defined(__has_c_attribute) | |
| 306 | #if __has_c_attribute(__nodiscard__) | |
| 307 | #define	__nodiscard	[[__nodiscard__]] | |
| 308 | #endif | |
| 309 | #endif | |
| 310 | ||
| 311 | #ifndef __nodiscard | |
| 312 | /* | |
| 313 | * LLVM 16 and earlier don't support [[nodiscard]] in C, but they do support | |
| 314 | * __warn_unused_result__ with the same semantics, so fall back to that. | |
| 315 | * We can't do this for GCC because the semantics are different. | |
| 316 | */ | |
| 317 | #ifdef __clang__ | |
| 318 | #define	__nodiscard	__attribute__((__warn_unused_result__)) | |
| 319 | #else | |
| 320 | #define	__nodiscard | |
| 321 | #endif | |
| 322 | #endif | |
| 323 | ||
| 396 | 324 | /* |
| 397 | 325 | * We use `__restrict' as a way to define the `restrict' type qualifier |
| 398 | 326 | * without disturbing older software that is unaware of C99 keywords. |
| ... | ... | @@ -401,73 +329,27 @@ |
| 401 | 329 | */ |
| 402 | 330 | #if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901 |
| 403 | 331 | #define	__restrict	restrict |
| 404 | #elif !__GNUC_PREREQ__(2, 95) | |
| 405 | #define	__restrict | |
| 406 | 332 | #endif |
| 407 | 333 | |
| 408 | 334 | /* |
| 409 | * GNU C version 2.96 adds explicit branch prediction so that | |
| 410 | * the CPU back-end can hint the processor and also so that | |
| 411 | * code blocks can be reordered such that the predicted path | |
| 412 | * sees a more linear flow, thus improving cache behavior, etc. | |
| 413 | * | |
| 414 | * The following two macros provide us with a way to utilize this | |
| 415 | * compiler feature. Use __predict_true() if you expect the expression | |
| 416 | * to evaluate to true, and __predict_false() if you expect the | |
| 417 | * expression to evaluate to false. | |
| 418 | * | |
| 419 | * A few notes about usage: | |
| 420 | * | |
| 421 | *	* Generally, __predict_false() error condition checks (unless | |
| 422 | *	 you have some _strong_ reason to do otherwise, in which case | |
| 423 | *	 document it), and/or __predict_true() `no-error' condition | |
| 424 | *	 checks, assuming you want to optimize for the no-error case. | |
| 425 | * | |
| 426 | *	* Other than that, if you don't know the likelihood of a test | |
| 427 | *	 succeeding from empirical or other `hard' evidence, don't | |
| 428 | *	 make predictions. | |
| 429 | * | |
| 430 | *	* These are meant to be used in places that are run `a lot'. | |
| 431 | *	 It is wasteful to make predictions in code that is run | |
| 432 | *	 seldomly (e.g. at subsystem initialization time) as the | |
| 433 | *	 basic block reordering that this affects can often generate | |
| 434 | *	 larger code. | |
| 335 | * All modern compilers have explicit branch prediction so that the CPU back-end | |
| 336 | * can hint to the processor and also so that code blocks can be reordered such | |
| 337 | * that the predicted path sees a more linear flow, thus improving cache | |
| 338 | * behavior, etc. Use sparingly, except in performance critical code where | |
| 339 | * they make things measurably faster. | |
| 435 | 340 | */ |
| 436 | #if __GNUC_PREREQ__(2, 96) | |
| 437 | 341 | #define	__predict_true(exp) __builtin_expect((exp), 1) |
| 438 | 342 | #define	__predict_false(exp) __builtin_expect((exp), 0) |
| 439 | #else | |
| 440 | #define	__predict_true(exp) (exp) | |
| 441 | #define	__predict_false(exp) (exp) | |
| 442 | #endif | |
| 443 | 343 | |
| 444 | #if __GNUC_PREREQ__(4, 0) | |
| 445 | 344 | #define	__null_sentinel	__attribute__((__sentinel__)) |
| 446 | 345 | #define	__exported	__attribute__((__visibility__("default"))) |
| 447 | 346 | #define	__hidden	__attribute__((__visibility__("hidden"))) |
| 448 | #else | |
| 449 | #define	__null_sentinel | |
| 450 | #define	__exported | |
| 451 | #define	__hidden | |
| 452 | #endif | |
| 453 | 347 | |
| 454 | 348 | /* |
| 455 | 349 | * We define this here since <stddef.h>, <sys/queue.h>, and <sys/types.h> |
| 456 | 350 | * require it. |
| 457 | 351 | */ |
| 458 | #if __GNUC_PREREQ__(4, 1) | |
| 459 | 352 | #define	__offsetof(type, field)	 __builtin_offsetof(type, field) |
| 460 | #else | |
| 461 | #ifndef __cplusplus | |
| 462 | #define	__offsetof(type, field) \ | |
| 463 | 	((__size_t)(__uintptr_t)((const volatile void *)&((type *)0)->field)) | |
| 464 | #else | |
| 465 | #define	__offsetof(type, field)					\ | |
| 466 | (__offsetof__ (reinterpret_cast <__size_t>			\ | |
| 467 | (&reinterpret_cast <const volatile char &>	\ | |
| 468 | (static_cast<type *> (0)->field)))) | |
| 469 | #endif | |
| 470 | #endif | |
| 471 | 353 | #define	__rangeof(type, start, end) \ |
| 472 | 354 | 	(__offsetof(type, end) - __offsetof(type, start)) |
| 473 | 355 | |
| ... | ... | @@ -477,29 +359,15 @@ |
| 477 | 359 | * assign pointer x to a local variable, to check that its type is |
| 478 | 360 | * compatible with member m. |
| 479 | 361 | */ |
| 480 | #if __GNUC_PREREQ__(3, 1) | |
| 481 | 362 | #define	__containerof(x, s, m) ({					\ |
| 482 | 363 | 	const volatile __typeof(((s *)0)->m) *__x = (x);		\ |
| 483 | 364 | 	__DEQUALIFY(s *, (const volatile char *)__x - __offsetof(s, m));\ |
| 484 | 365 | }) |
| 485 | #else | |
| 486 | #define	__containerof(x, s, m)						\ | |
| 487 | 	__DEQUALIFY(s *, (const volatile char *)(x) - __offsetof(s, m)) | |
| 488 | #endif | |
| 489 | 366 | |
| 490 | 367 | /* |
| 491 | 368 | * Compiler-dependent macros to declare that functions take printf-like |
| 492 | * or scanf-like arguments. They are null except for versions of gcc | |
| 493 | * that are known to support the features properly (old versions of gcc-2 | |
| 494 | * didn't permit keeping the keywords out of the application namespace). | |
| 369 | * or scanf-like arguments. | |
| 495 | 370 | */ |
| 496 | #if !__GNUC_PREREQ__(2, 7) | |
| 497 | #define	__printflike(fmtarg, firstvararg) | |
| 498 | #define	__scanflike(fmtarg, firstvararg) | |
| 499 | #define	__format_arg(fmtarg) | |
| 500 | #define	__strfmonlike(fmtarg, firstvararg) | |
| 501 | #define	__strftimelike(fmtarg, firstvararg) | |
| 502 | #else | |
| 503 | 371 | #define	__printflike(fmtarg, firstvararg) \ |
| 504 | 372 | 	 __attribute__((__format__ (__printf__, fmtarg, firstvararg))) |
| 505 | 373 | #define	__scanflike(fmtarg, firstvararg) \ |
| ... | ... | @@ -509,18 +377,23 @@ |
| 509 | 377 | 	 __attribute__((__format__ (__strfmon__, fmtarg, firstvararg))) |
| 510 | 378 | #define	__strftimelike(fmtarg, firstvararg) \ |
| 511 | 379 | 	 __attribute__((__format__ (__strftime__, fmtarg, firstvararg))) |
| 512 | #endif | |
| 513 | 380 | |
| 514 | /* Compiler-dependent macros that rely on FreeBSD-specific extensions. */ | |
| 515 | #if defined(__FreeBSD_cc_version) && __FreeBSD_cc_version >= 300001 && \ | |
| 516 | defined(__GNUC__) | |
| 381 | /* | |
| 382 | * Like __printflike, but allows fmtarg to be NULL. FreeBSD invented 'printf0' | |
| 383 | * for this because older versions of gcc issued warnings for NULL first args. | |
| 384 | * Clang has always had printf and printf0 as aliases. gcc 11.0 now follows | |
| 385 | * clang. So now this is an alias for __printflike, or nothing. In the future | |
| 386 | * _Nullable or _Nonnull will replace this. | |
| 387 | * XXX Except that doesn't work, so for now revert to printf0 for clang and | |
| 388 | * the FreeBSD gcc until I can work this out. | |
| 389 | */ | |
| 390 | #if defined(__clang__) || (defined(__GNUC__) && defined (__FreeBSD_cc_version)) | |
| 517 | 391 | #define	__printf0like(fmtarg, firstvararg) \ |
| 518 | 392 | 	 __attribute__((__format__ (__printf0__, fmtarg, firstvararg))) |
| 519 | 393 | #else |
| 520 | 394 | #define	__printf0like(fmtarg, firstvararg) |
| 521 | 395 | #endif |
| 522 | 396 | |
| 523 | #if defined(__GNUC__) | |
| 524 | 397 | #define	__strong_reference(sym,aliassym)	\ |
| 525 | 398 | 	extern __typeof (sym) aliassym __attribute__ ((__alias__ (#sym))) |
| 526 | 399 | #ifdef __STDC__ |
| ... | ... | @@ -531,10 +404,12 @@ |
| 531 | 404 | 	__asm__(".section .gnu.warning." #sym);	\ |
| 532 | 405 | 	__asm__(".asciz \"" msg "\"");	\ |
| 533 | 406 | 	__asm__(".previous") |
| 407 | #ifdef	__CC_SUPPORTS_SYMVER | |
| 534 | 408 | #define	__sym_compat(sym,impl,verid)	\ |
| 535 | 409 | 	__asm__(".symver " #impl ", " #sym "@" #verid) |
| 536 | 410 | #define	__sym_default(sym,impl,verid)	\ |
| 537 | 411 | 	__asm__(".symver " #impl ", " #sym "@@@" #verid) |
| 412 | #endif | |
| 538 | 413 | #else |
| 539 | 414 | #define	__weak_reference(sym,alias)	\ |
| 540 | 415 | 	__asm__(".weak alias");		\ |
| ... | ... | @@ -543,27 +418,18 @@ |
| 543 | 418 | 	__asm__(".section .gnu.warning.sym"); \ |
| 544 | 419 | 	__asm__(".asciz \"msg\"");	\ |
| 545 | 420 | 	__asm__(".previous") |
| 421 | #ifdef	__CC_SUPPORTS_SYMVER | |
| 546 | 422 | #define	__sym_compat(sym,impl,verid)	\ |
| 547 | 423 | 	__asm__(".symver impl, sym@verid") |
| 548 | 424 | #define	__sym_default(impl,sym,verid)	\ |
| 549 | 425 | 	__asm__(".symver impl, sym@@@verid") |
| 426 | #endif | |
| 550 | 427 | #endif	/* __STDC__ */ |
| 551 | #endif	/* __GNUC__ */ | |
| 552 | 428 | |
| 553 | 429 | #define	__GLOBL(sym)	__asm__(".globl " __XSTRING(sym)) |
| 554 | 430 | #define	__WEAK(sym)	__asm__(".weak " __XSTRING(sym)) |
| 555 | 431 | |
| 556 | #if defined(__GNUC__) | |
| 557 | 432 | #define	__IDSTRING(name,string)	__asm__(".ident\t\"" string "\"") |
| 558 | #else | |
| 559 | /* | |
| 560 | * The following definition might not work well if used in header files, | |
| 561 | * but it should be better than nothing. If you want a "do nothing" | |
| 562 | * version, then it should generate some harmless declaration, such as: | |
| 563 | * #define	__IDSTRING(name,string)	struct __hack | |
| 564 | */ | |
| 565 | #define	__IDSTRING(name,string)	static const char name[] __unused = string | |
| 566 | #endif | |
| 567 | 433 | |
| 568 | 434 | /* |
| 569 | 435 | * Embed the rcs id of a source file in the resulting library. Note that in |
| ... | ... | @@ -622,164 +488,13 @@ |
| 622 | 488 | #define	__DEQUALIFY(type, var)	((type)(__uintptr_t)(const volatile void *)(var)) |
| 623 | 489 | #endif |
| 624 | 490 | |
| 625 | /*- | |
| 626 | * The following definitions are an extension of the behavior originally | |
| 627 | * implemented in <sys/_posix.h>, but with a different level of granularity. | |
| 628 | * POSIX.1 requires that the macros we test be defined before any standard | |
| 629 | * header file is included. | |
| 630 | * | |
| 631 | * Here's a quick run-down of the versions (and some informal names) | |
| 632 | * defined(_POSIX_SOURCE)		1003.1-1988 | |
| 633 | *					encoded as 198808 below | |
| 634 | * _POSIX_C_SOURCE == 1		1003.1-1990 | |
| 635 | *					encoded as 199009 below | |
| 636 | * _POSIX_C_SOURCE == 2		1003.2-1992 C Language Binding Option | |
| 637 | *					encoded as 199209 below | |
| 638 | * _POSIX_C_SOURCE == 199309		1003.1b-1993 | |
| 639 | *					(1003.1 Issue 4, Single Unix Spec v1, Unix 93) | |
| 640 | * _POSIX_C_SOURCE == 199506		1003.1c-1995, 1003.1i-1995, | |
| 641 | *					and the omnibus ISO/IEC 9945-1: 1996 | |
| 642 | *					(1003.1 Issue 5, Single	Unix Spec v2, Unix 95) | |
| 643 | * _POSIX_C_SOURCE == 200112		1003.1-2001 (1003.1 Issue 6, Unix 03) | |
| 644 | * _POSIX_C_SOURCE == 200809		1003.1-2008 (1003.1 Issue 7) | |
| 645 | *					IEEE Std 1003.1-2017 (Rev of 1003.1-2008) is | |
| 646 | *					1003.1-2008 with two TCs applied with | |
| 647 | *					_POSIX_C_SOURCE=200809 and _XOPEN_SOURCE=700 | |
| 648 | * | |
| 649 | * In addition, the X/Open Portability Guide, which is now the Single UNIX | |
| 650 | * Specification, defines a feature-test macro which indicates the version of | |
| 651 | * that specification, and which subsumes _POSIX_C_SOURCE. | |
| 652 | * | |
| 653 | * Our macros begin with two underscores to avoid namespace screwage. | |
| 654 | */ | |
| 655 | ||
| 656 | /* Deal with IEEE Std. 1003.1-1990, in which _POSIX_C_SOURCE == 1. */ | |
| 657 | #if defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE == 1 | |
| 658 | #undef _POSIX_C_SOURCE		/* Probably illegal, but beyond caring now. */ | |
| 659 | #define	_POSIX_C_SOURCE		199009 | |
| 660 | #endif | |
| 661 | ||
| 662 | /* Deal with IEEE Std. 1003.2-1992, in which _POSIX_C_SOURCE == 2. */ | |
| 663 | #if defined(_POSIX_C_SOURCE) && _POSIX_C_SOURCE == 2 | |
| 664 | #undef _POSIX_C_SOURCE | |
| 665 | #define	_POSIX_C_SOURCE		199209 | |
| 666 | #endif | |
| 667 | ||
| 668 | /* Deal with various X/Open Portability Guides and Single UNIX Spec. */ | |
| 669 | #ifdef _XOPEN_SOURCE | |
| 670 | #if _XOPEN_SOURCE - 0 >= 700 | |
| 671 | #define	__XSI_VISIBLE		700 | |
| 672 | #undef _POSIX_C_SOURCE | |
| 673 | #define	_POSIX_C_SOURCE		200809 | |
| 674 | #elif _XOPEN_SOURCE - 0 >= 600 | |
| 675 | #define	__XSI_VISIBLE		600 | |
| 676 | #undef _POSIX_C_SOURCE | |
| 677 | #define	_POSIX_C_SOURCE		200112 | |
| 678 | #elif _XOPEN_SOURCE - 0 >= 500 | |
| 679 | #define	__XSI_VISIBLE		500 | |
| 680 | #undef _POSIX_C_SOURCE | |
| 681 | #define	_POSIX_C_SOURCE		199506 | |
| 682 | #endif | |
| 491 | #if !defined(_STANDALONE) && !defined(_KERNEL) | |
| 492 | #define	__RENAME(x)	__asm(__STRING(x)) | |
| 493 | #else /* _STANDALONE || _KERNEL */ | |
| 494 | #define	__RENAME(x)	no renaming in kernel/standalone environment | |
| 683 | 495 | #endif |
| 684 | 496 | |
| 685 | /* | |
| 686 | * Deal with all versions of POSIX. The ordering relative to the tests above is | |
| 687 | * important. | |
| 688 | */ | |
| 689 | #if defined(_POSIX_SOURCE) && !defined(_POSIX_C_SOURCE) | |
| 690 | #define	_POSIX_C_SOURCE		198808 | |
| 691 | #endif | |
| 692 | #ifdef _POSIX_C_SOURCE | |
| 693 | #if _POSIX_C_SOURCE >= 200809 | |
| 694 | #define	__POSIX_VISIBLE		200809 | |
| 695 | #define	__ISO_C_VISIBLE		1999 | |
| 696 | #elif _POSIX_C_SOURCE >= 200112 | |
| 697 | #define	__POSIX_VISIBLE		200112 | |
| 698 | #define	__ISO_C_VISIBLE		1999 | |
| 699 | #elif _POSIX_C_SOURCE >= 199506 | |
| 700 | #define	__POSIX_VISIBLE		199506 | |
| 701 | #define	__ISO_C_VISIBLE		1990 | |
| 702 | #elif _POSIX_C_SOURCE >= 199309 | |
| 703 | #define	__POSIX_VISIBLE		199309 | |
| 704 | #define	__ISO_C_VISIBLE		1990 | |
| 705 | #elif _POSIX_C_SOURCE >= 199209 | |
| 706 | #define	__POSIX_VISIBLE		199209 | |
| 707 | #define	__ISO_C_VISIBLE		1990 | |
| 708 | #elif _POSIX_C_SOURCE >= 199009 | |
| 709 | #define	__POSIX_VISIBLE		199009 | |
| 710 | #define	__ISO_C_VISIBLE		1990 | |
| 711 | #else | |
| 712 | #define	__POSIX_VISIBLE		198808 | |
| 713 | #define	__ISO_C_VISIBLE		0 | |
| 714 | #endif /* _POSIX_C_SOURCE */ | |
| 715 | /* | |
| 716 | * Both glibc and OpenBSD enable c11 features when _ISOC11_SOURCE is defined, or | |
| 717 | * when compiling with -stdc=c11. A strict reading of the standard would suggest | |
| 718 | * doing it only for the former. However, a strict reading also requires C99 | |
| 719 | * mode only, so building with C11 is already undefined. Follow glibc's and | |
| 720 | * OpenBSD's lead for this non-standard configuration for maximum compatibility. | |
| 721 | */ | |
| 722 | #if _ISOC11_SOURCE || (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) | |
| 723 | #undef __ISO_C_VISIBLE | |
| 724 | #define __ISO_C_VISIBLE		2011 | |
| 725 | #endif | |
| 726 | #else | |
| 727 | /*- | |
| 728 | * Deal with _ANSI_SOURCE: | |
| 729 | * If it is defined, and no other compilation environment is explicitly | |
| 730 | * requested, then define our internal feature-test macros to zero. This | |
| 731 | * makes no difference to the preprocessor (undefined symbols in preprocessing | |
| 732 | * expressions are defined to have value zero), but makes it more convenient for | |
| 733 | * a test program to print out the values. | |
| 734 | * | |
| 735 | * If a program mistakenly defines _ANSI_SOURCE and some other macro such as | |
| 736 | * _POSIX_C_SOURCE, we will assume that it wants the broader compilation | |
| 737 | * environment (and in fact we will never get here). | |
| 738 | */ | |
| 739 | #if defined(_ANSI_SOURCE)	/* Hide almost everything. */ | |
| 740 | #define	__POSIX_VISIBLE		0 | |
| 741 | #define	__XSI_VISIBLE		0 | |
| 742 | #define	__BSD_VISIBLE		0 | |
| 743 | #define	__ISO_C_VISIBLE		1990 | |
| 744 | #define	__EXT1_VISIBLE		0 | |
| 745 | #elif defined(_C99_SOURCE)	/* Localism to specify strict C99 env. */ | |
| 746 | #define	__POSIX_VISIBLE		0 | |
| 747 | #define	__XSI_VISIBLE		0 | |
| 748 | #define	__BSD_VISIBLE		0 | |
| 749 | #define	__ISO_C_VISIBLE		1999 | |
| 750 | #define	__EXT1_VISIBLE		0 | |
| 751 | #elif defined(_C11_SOURCE)	/* Localism to specify strict C11 env. */ | |
| 752 | #define	__POSIX_VISIBLE		0 | |
| 753 | #define	__XSI_VISIBLE		0 | |
| 754 | #define	__BSD_VISIBLE		0 | |
| 755 | #define	__ISO_C_VISIBLE		2011 | |
| 756 | #define	__EXT1_VISIBLE		0 | |
| 757 | #else				/* Default environment: show everything. */ | |
| 758 | #define	__POSIX_VISIBLE		200809 | |
| 759 | #define	__XSI_VISIBLE		700 | |
| 760 | #define	__BSD_VISIBLE		1 | |
| 761 | #define	__ISO_C_VISIBLE		2011 | |
| 762 | #define	__EXT1_VISIBLE		1 | |
| 763 | #endif | |
| 764 | #endif | |
| 765 | ||
| 766 | /* User override __EXT1_VISIBLE */ | |
| 767 | #if defined(__STDC_WANT_LIB_EXT1__) | |
| 768 | #undef	__EXT1_VISIBLE | |
| 769 | #if __STDC_WANT_LIB_EXT1__ | |
| 770 | #define	__EXT1_VISIBLE		1 | |
| 771 | #else | |
| 772 | #define	__EXT1_VISIBLE		0 | |
| 773 | #endif | |
| 774 | #endif /* __STDC_WANT_LIB_EXT1__ */ | |
| 775 | ||
| 776 | /* | |
| 777 | * Old versions of GCC use non-standard ARM arch symbols; acle-compat.h | |
| 778 | * translates them to __ARM_ARCH and the modern feature symbols defined by ARM. | |
| 779 | */ | |
| 780 | #if defined(__arm__) && !defined(__ARM_ARCH) | |
| 781 | #include <machine/acle-compat.h> | |
| 782 | #endif | |
| 497 | #include <sys/_visible.h> | |
| 783 | 498 | |
| 784 | 499 | /* |
| 785 | 500 | * Nullability qualifiers: currently only supported by Clang. |
lib/libc/include/generic-freebsd/sys/cnv.h+1-7| ... | ... | @@ -30,6 +30,7 @@ |
| 30 | 30 | #define	_CNV_H_ |
| 31 | 31 | |
| 32 | 32 | #include <sys/cdefs.h> |
| 33 | #include <sys/_nv.h> | |
| 33 | 34 | |
| 34 | 35 | #ifndef _KERNEL |
| 35 | 36 | #include <stdarg.h> |
| ... | ... | @@ -39,13 +40,6 @@ |
| 39 | 40 | #include <sys/nv_namespace.h> |
| 40 | 41 | #endif |
| 41 | 42 | |
| 42 | #ifndef	_NVLIST_T_DECLARED | |
| 43 | #define	_NVLIST_T_DECLARED | |
| 44 | struct nvlist; | |
| 45 | ||
| 46 | typedef struct nvlist nvlist_t; | |
| 47 | #endif | |
| 48 | ||
| 49 | 43 | __BEGIN_DECLS |
| 50 | 44 | |
| 51 | 45 | /* |
lib/libc/include/generic-freebsd/sys/compressor.h+1| ... | ... | @@ -42,6 +42,7 @@ struct compressor; |
| 42 | 42 | bool		compressor_avail(int format); |
| 43 | 43 | struct compressor *compressor_init(compressor_cb_t cb, int format, |
| 44 | 44 | 		 size_t maxiosize, int level, void *arg); |
| 45 | int		compressor_format(const struct compressor *stream); | |
| 45 | 46 | void		compressor_reset(struct compressor *stream); |
| 46 | 47 | int		compressor_write(struct compressor *stream, void *data, |
| 47 | 48 | 		 size_t len); |
lib/libc/include/generic-freebsd/sys/conf.h+4-2| ... | ... | @@ -34,8 +34,6 @@ |
| 34 | 34 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 35 | 35 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 36 | 36 | * SUCH DAMAGE. |
| 37 | * | |
| 38 | *	@(#)conf.h	8.5 (Berkeley) 1/9/95 | |
| 39 | 37 | */ |
| 40 | 38 | |
| 41 | 39 | #ifndef _SYS_CONF_H_ |
| ... | ... | @@ -46,6 +44,7 @@ |
| 46 | 44 | #else |
| 47 | 45 | #include <sys/queue.h> |
| 48 | 46 | #endif |
| 47 | #include <sys/_timespec.h> | |
| 49 | 48 | |
| 50 | 49 | struct snapdata; |
| 51 | 50 | struct devfs_dirent; |
| ... | ... | @@ -160,6 +159,7 @@ typedef int dumper_hdr_t(struct dumperinfo *di, struct kerneldumpheader *kdh); |
| 160 | 159 | #define		GID_RT_PRIO	47 |
| 161 | 160 | #define		GID_ID_PRIO	48 |
| 162 | 161 | #define		GID_DIALER	68 |
| 162 | #define		GID_U2F		116 | |
| 163 | 163 | #define		GID_NOGROUP	65533 |
| 164 | 164 | #define		GID_NOBODY	65534 |
| 165 | 165 | |
| ... | ... | @@ -278,6 +278,7 @@ void	destroy_dev(struct cdev *_dev); |
| 278 | 278 | int	destroy_dev_sched(struct cdev *dev); |
| 279 | 279 | int	destroy_dev_sched_cb(struct cdev *dev, void (*cb)(void *), void *arg); |
| 280 | 280 | void	destroy_dev_drain(struct cdevsw *csw); |
| 281 | void	dev_copyname(struct cdev *dev, char *path, size_t len); | |
| 281 | 282 | struct cdevsw *dev_refthread(struct cdev *_dev, int *_ref); |
| 282 | 283 | struct cdevsw *devvn_refthread(struct vnode *vp, struct cdev **devp, int *_ref); |
| 283 | 284 | void	dev_relthread(struct cdev *_dev, int _ref); |
| ... | ... | @@ -360,6 +361,7 @@ struct dumperinfo { |
| 360 | 361 | }; |
| 361 | 362 | |
| 362 | 363 | extern int dumping;		/* system is dumping */ |
| 364 | extern bool dumped_core;	/* system successfully dumped kernel core */ | |
| 363 | 365 | |
| 364 | 366 | /* |
| 365 | 367 | * Save registers for later extraction from a kernel dump. |
lib/libc/include/generic-freebsd/sys/cons.h+2-2| ... | ... | @@ -32,8 +32,6 @@ |
| 32 | 32 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 33 | 33 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 34 | 34 | * SUCH DAMAGE. |
| 35 | * | |
| 36 | *	from: @(#)cons.h	7.2 (Berkeley) 5/9/91 | |
| 37 | 35 | */ |
| 38 | 36 | |
| 39 | 37 | #ifndef _MACHINE_CONS_H_ |
| ... | ... | @@ -96,6 +94,8 @@ struct consdev { |
| 96 | 94 | |
| 97 | 95 | #ifdef _KERNEL |
| 98 | 96 | |
| 97 | extern	int cn_mute; | |
| 98 | ||
| 99 | 99 | extern	struct msgbuf consmsgbuf; /* Message buffer for constty. */ |
| 100 | 100 | extern	struct tty *constty;	/* Temporary virtual console. */ |
| 101 | 101 |
lib/libc/include/generic-freebsd/sys/copyright.h+2-2| ... | ... | @@ -1,7 +1,7 @@ |
| 1 | 1 | /*- |
| 2 | 2 | * SPDX-License-Identifier: BSD-2-Clause |
| 3 | 3 | * |
| 4 | * Copyright (C) 1992-2023 The FreeBSD Project. All rights reserved. | |
| 4 | * Copyright (C) 1992-2025 The FreeBSD Project. All rights reserved. | |
| 5 | 5 | * |
| 6 | 6 | * Redistribution and use in source and binary forms, with or without |
| 7 | 7 | * modification, are permitted provided that the following conditions |
| ... | ... | @@ -35,7 +35,7 @@ |
| 35 | 35 | |
| 36 | 36 | /* FreeBSD */ |
| 37 | 37 | #define COPYRIGHT_FreeBSD \ |
| 38 | 	"Copyright (c) 1992-2023 The FreeBSD Project.\n" | |
| 38 | 	"Copyright (c) 1992-2025 The FreeBSD Project.\n" | |
| 39 | 39 | |
| 40 | 40 | /* Foundation */ |
| 41 | 41 | #define	TRADEMARK_Foundation \ |
lib/libc/include/generic-freebsd/sys/counter.h+4-9| ... | ... | @@ -60,17 +60,12 @@ uint64_t	counter_u64_fetch(counter_u64_t); |
| 60 | 60 | 		counter_u64_zero((a)[_i]);			\ |
| 61 | 61 | } while (0) |
| 62 | 62 | |
| 63 | /* | |
| 64 | * counter(9) based rate checking. | |
| 65 | */ | |
| 66 | struct counter_rate { | |
| 67 | 	counter_u64_t	cr_rate;	/* Events since last second */ | |
| 68 | 	volatile int	cr_lock;	/* Lock to clean the struct */ | |
| 69 | 	int		cr_ticks;	/* Ticks on last clean */ | |
| 70 | 	int		cr_over;	/* Over limit since cr_ticks? */ | |
| 71 | }; | |
| 63 | struct counter_rate; | |
| 72 | 64 | |
| 65 | struct counter_rate *counter_rate_alloc(int flags, int period); | |
| 66 | void counter_rate_free(struct counter_rate *); | |
| 73 | 67 | int64_t	counter_ratecheck(struct counter_rate *, int64_t); |
| 68 | uint64_t counter_rate_get(struct counter_rate *); | |
| 74 | 69 | |
| 75 | 70 | #define	COUNTER_U64_SYSINIT(c)					\ |
| 76 | 71 | 	SYSINIT(c##_counter_sysinit, SI_SUB_COUNTER,		\ |
lib/libc/include/generic-freebsd/sys/cpuset.h+2| ... | ... | @@ -61,8 +61,10 @@ |
| 61 | 61 | #define	CPU_ANDNOT(d, s1, s2)		__BIT_ANDNOT2(CPU_SETSIZE, d, s1, s2) |
| 62 | 62 | #define	CPU_XOR(d, s1, s2)		__BIT_XOR2(CPU_SETSIZE, d, s1, s2) |
| 63 | 63 | #define	CPU_CLR_ATOMIC(n, p)		__BIT_CLR_ATOMIC(CPU_SETSIZE, n, p) |
| 64 | #define	CPU_TEST_CLR_ATOMIC(n, p)	__BIT_TEST_CLR_ATOMIC(CPU_SETSIZE, n, p) | |
| 64 | 65 | #define	CPU_SET_ATOMIC(n, p)		__BIT_SET_ATOMIC(CPU_SETSIZE, n, p) |
| 65 | 66 | #define	CPU_SET_ATOMIC_ACQ(n, p)	__BIT_SET_ATOMIC_ACQ(CPU_SETSIZE, n, p) |
| 67 | #define	CPU_TEST_SET_ATOMIC(n, p)	__BIT_TEST_SET_ATOMIC(CPU_SETSIZE, n, p) | |
| 66 | 68 | #define	CPU_AND_ATOMIC(n, p)		__BIT_AND_ATOMIC(CPU_SETSIZE, n, p) |
| 67 | 69 | #define	CPU_OR_ATOMIC(d, s)		__BIT_OR_ATOMIC(CPU_SETSIZE, d, s) |
| 68 | 70 | #define	CPU_COPY_STORE_REL(f, t)	__BIT_COPY_STORE_REL(CPU_SETSIZE, f, t) |
lib/libc/include/generic-freebsd/sys/devicestat.h+1| ... | ... | @@ -125,6 +125,7 @@ typedef enum { |
| 125 | 125 | 	DEVSTAT_TYPE_IF_SCSI	= 0x010, |
| 126 | 126 | 	DEVSTAT_TYPE_IF_IDE	= 0x020, |
| 127 | 127 | 	DEVSTAT_TYPE_IF_OTHER	= 0x030, |
| 128 | 	DEVSTAT_TYPE_IF_NVME	= 0x040, | |
| 128 | 129 | 	DEVSTAT_TYPE_IF_MASK	= 0x0f0, |
| 129 | 130 | 	DEVSTAT_TYPE_PASS	= 0x100 |
| 130 | 131 | } devstat_type_flags; |
lib/libc/include/generic-freebsd/sys/devmap.h+5-18| ... | ... | @@ -33,6 +33,7 @@ |
| 33 | 33 | #error "no user-serviceable parts inside" |
| 34 | 34 | #endif |
| 35 | 35 | |
| 36 | #ifdef __HAVE_STATIC_DEVMAP | |
| 36 | 37 | /* |
| 37 | 38 | * This structure is used by MD code to describe static mappings of devices |
| 38 | 39 | * which are established as part of bringing up the MMU early in the boot. |
| ... | ... | @@ -71,27 +72,13 @@ void devmap_register_table(const struct devmap_entry * _table); |
| 71 | 72 | * Establish mappings for all the entries in the table. This is called |
| 72 | 73 | * automatically from the common platform-specific init function in |
| 73 | 74 | * <ARCH>/machdep.c, and also from the custom platform-specific init routines |
| 74 | * in older code. If the table pointer is NULL, this will use the table | |
| 75 | * installed previously by devmap_register_table(). | |
| 75 | * in older code. This function only has an effect when a table was installed | |
| 76 | * previously by devmap_register_table(). | |
| 76 | 77 | */ |
| 77 | void devmap_bootstrap(vm_offset_t _l1pt, | |
| 78 | const struct devmap_entry *_table); | |
| 79 | ||
| 80 | /* | |
| 81 | * Translate between virtual and physical addresses within a region that is | |
| 82 | * static-mapped by the devmap code. If the given address range isn't | |
| 83 | * static-mapped, then ptov returns NULL and vtop returns DEVMAP_PADDR_NOTFOUND. | |
| 84 | * The latter implies that you can't vtop just the last byte of physical address | |
| 85 | * space. This is not as limiting as it might sound, because even if a device | |
| 86 | * occupies the end of the physical address space, you're only prevented from | |
| 87 | * doing vtop for that single byte. If you vtop a size bigger than 1 it works. | |
| 88 | */ | |
| 89 | #define	DEVMAP_PADDR_NOTFOUND	((vm_paddr_t)(-1)) | |
| 90 | ||
| 91 | void * devmap_ptov(vm_paddr_t _pa, vm_size_t _sz); | |
| 92 | vm_paddr_t devmap_vtop(void * _va, vm_size_t _sz); | |
| 78 | void devmap_bootstrap(void); | |
| 93 | 79 | |
| 94 | 80 | /* Print the static mapping table; used for bootverbose output. */ |
| 95 | 81 | void devmap_print_table(void); |
| 82 | #endif | |
| 96 | 83 | |
| 97 | 84 | #endif /* !_SYS_DEVMAP_H_ */ |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/sys/dirent.h-2| ... | ... | @@ -27,8 +27,6 @@ |
| 27 | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | * | |
| 31 | *	@(#)dirent.h	8.3 (Berkeley) 8/10/94 | |
| 32 | 30 | */ |
| 33 | 31 | |
| 34 | 32 | #ifndef	_SYS_DIRENT_H_ |
lib/libc/include/generic-freebsd/sys/disk.h+1-1| ... | ... | @@ -78,7 +78,7 @@ void disk_err(struct bio *bp, const char *what, int blkdone, int nl); |
| 78 | 78 | 	 * only if they point at exactly the same physical storage, this is |
| 79 | 79 | 	 * the case for multipathing for example, |
| 80 | 80 | 	 * - GEOM classes that consumes single providers and provide single |
| 81 | 	 * providers, like geli, gbde, should just attach class name to the | |
| 81 | 	 * providers, like geli, should just attach class name to the | |
| 82 | 82 | 	 * ident of the underlying provider, |
| 83 | 83 | 	 * - ident is an ASCII string (is printable), |
| 84 | 84 | 	 * - ident is optional and applications can't relay on its presence. |
lib/libc/include/generic-freebsd/sys/disk/bsd.h-2| ... | ... | @@ -25,8 +25,6 @@ |
| 25 | 25 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 26 | 26 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 27 | 27 | * SUCH DAMAGE. |
| 28 | * | |
| 29 | *	@(#)disklabel.h	8.2 (Berkeley) 7/10/94 | |
| 30 | 28 | */ |
| 31 | 29 | |
| 32 | 30 | #ifndef _SYS_DISK_BSD_H_ |
lib/libc/include/generic-freebsd/sys/disk/gpt.h+3| ... | ... | @@ -259,6 +259,9 @@ CTASSERT(sizeof(struct gpt_ent) == 128); |
| 259 | 259 | #define GPT_ENT_TYPE_HIFIVE_BBL		\ |
| 260 | 260 | 	{0x2e54b353,0x1271,0x4842,0x80,0x6f,{0xe4,0x36,0xd6,0xaf,0x69,0x85}} |
| 261 | 261 | |
| 262 | #define GPT_ENT_TYPE_U_BOOT_ENV		\ | |
| 263 | 	{0x3de21764,0x95bd,0x54bd,0xa5,0xc3,{0x4a,0xbe,0x78,0x6f,0x38,0xa8}} | |
| 264 | ||
| 262 | 265 | /* |
| 263 | 266 | * Boot partition used by GRUB 2. |
| 264 | 267 | */ |
lib/libc/include/generic-freebsd/sys/disk/mbr.h-2| ... | ... | @@ -25,8 +25,6 @@ |
| 25 | 25 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 26 | 26 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 27 | 27 | * SUCH DAMAGE. |
| 28 | * | |
| 29 | *	@(#)disklabel.h	8.2 (Berkeley) 7/10/94 | |
| 30 | 28 | */ |
| 31 | 29 | |
| 32 | 30 | #ifndef _SYS_DISK_MBR_H_ |
lib/libc/include/generic-freebsd/sys/disklabel.h-2| ... | ... | @@ -27,8 +27,6 @@ |
| 27 | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | * | |
| 31 | *	@(#)disklabel.h	8.2 (Berkeley) 7/10/94 | |
| 32 | 30 | */ |
| 33 | 31 | |
| 34 | 32 | #ifndef _SYS_DISKLABEL_H_ |
lib/libc/include/generic-freebsd/sys/diskmbr.h-2| ... | ... | @@ -27,8 +27,6 @@ |
| 27 | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | * | |
| 31 | *	@(#)disklabel.h	8.2 (Berkeley) 7/10/94 | |
| 32 | 30 | */ |
| 33 | 31 | |
| 34 | 32 | #ifndef _SYS_DISKMBR_H_ |
lib/libc/include/generic-freebsd/sys/dkstat.h-2| ... | ... | @@ -32,8 +32,6 @@ |
| 32 | 32 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 33 | 33 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 34 | 34 | * SUCH DAMAGE. |
| 35 | * | |
| 36 | *	@(#)dkstat.h	8.2 (Berkeley) 1/21/94 | |
| 37 | 35 | */ |
| 38 | 36 | |
| 39 | 37 | #ifndef _SYS_DKSTAT_H_ |
lib/libc/include/generic-freebsd/sys/dnv.h+1-7| ... | ... | @@ -32,6 +32,7 @@ |
| 32 | 32 | #define	_DNV_H_ |
| 33 | 33 | |
| 34 | 34 | #include <sys/cdefs.h> |
| 35 | #include <sys/_nv.h> | |
| 35 | 36 | |
| 36 | 37 | #ifndef _KERNEL |
| 37 | 38 | #include <stdarg.h> |
| ... | ... | @@ -41,13 +42,6 @@ |
| 41 | 42 | #include <sys/nv_namespace.h> |
| 42 | 43 | #endif |
| 43 | 44 | |
| 44 | #ifndef	_NVLIST_T_DECLARED | |
| 45 | #define	_NVLIST_T_DECLARED | |
| 46 | struct nvlist; | |
| 47 | ||
| 48 | typedef struct nvlist nvlist_t; | |
| 49 | #endif | |
| 50 | ||
| 51 | 45 | __BEGIN_DECLS |
| 52 | 46 | |
| 53 | 47 | /* |
lib/libc/include/generic-freebsd/sys/domain.h-6| ... | ... | @@ -27,8 +27,6 @@ |
| 27 | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | * | |
| 31 | *	@(#)domain.h	8.1 (Berkeley) 6/2/93 | |
| 32 | 30 | */ |
| 33 | 31 | |
| 34 | 32 | #ifndef _SYS_DOMAIN_H_ |
| ... | ... | @@ -54,10 +52,6 @@ struct domain { |
| 54 | 52 | 	char	*dom_name; |
| 55 | 53 | 	int	dom_flags; |
| 56 | 54 | 	int	(*dom_probe)(void);	/* check for support (optional) */ |
| 57 | 	int	(*dom_externalize)	/* externalize access rights */ | |
| 58 | 		(struct mbuf *, struct mbuf **, int); | |
| 59 | 	void	(*dom_dispose)		/* dispose of internalized rights */ | |
| 60 | 		(struct socket *); | |
| 61 | 55 | 	struct rib_head *(*dom_rtattach)	/* initialize routing table */ |
| 62 | 56 | 		(uint32_t); |
| 63 | 57 | 	void	(*dom_rtdetach)		/* clean up routing table */ |
lib/libc/include/generic-freebsd/sys/domainset.h+14| ... | ... | @@ -113,6 +113,20 @@ void domainset_zero(void); |
| 113 | 113 | * returned value will not match the key pointer. |
| 114 | 114 | */ |
| 115 | 115 | struct domainset *domainset_create(const struct domainset *); |
| 116 | ||
| 117 | /* | |
| 118 | * Remove empty domains from a given domainset. | |
| 119 | * Returns 'false' if the domainset consists entirely of empty domains. | |
| 120 | */ | |
| 121 | bool domainset_empty_vm(struct domainset *domain); | |
| 122 | ||
| 123 | /* | |
| 124 | * Validate and populate a domainset structure according to the specified | |
| 125 | * policy and mask. | |
| 126 | */ | |
| 127 | int domainset_populate(struct domainset *domain, const domainset_t *mask, int policy, | |
| 128 | size_t mask_size); | |
| 129 | ||
| 116 | 130 | #ifdef _SYS_SYSCTL_H_ |
| 117 | 131 | int sysctl_handle_domainset(SYSCTL_HANDLER_ARGS); |
| 118 | 132 | #endif |
lib/libc/include/generic-freebsd/sys/efi.h+52-22| ... | ... | @@ -35,15 +35,17 @@ |
| 35 | 35 | #define	EFI_PAGE_MASK		(EFI_PAGE_SIZE - 1) |
| 36 | 36 | |
| 37 | 37 | #define	EFI_TABLE_SMBIOS				\ |
| 38 | 	{0xeb9d2d31,0x2d88,0x11d3,0x9a,0x16,{0x00,0x90,0x27,0x3f,0xc1,0x4d}} | |
| 38 | 	{0xeb9d2d31,0x2d88,0x11d3,{0x9a,0x16,0x00,0x90,0x27,0x3f,0xc1,0x4d}} | |
| 39 | 39 | #define	EFI_TABLE_SMBIOS3				\ |
| 40 | 	{0xf2fd1544,0x9794,0x4a2c,0x99,0x2e,{0xe5,0xbb,0xcf,0x20,0xe3,0x94}} | |
| 40 | 	{0xf2fd1544,0x9794,0x4a2c,{0x99,0x2e,0xe5,0xbb,0xcf,0x20,0xe3,0x94}} | |
| 41 | 41 | #define	EFI_TABLE_ESRT					\ |
| 42 | 	{0xb122a263,0x3661,0x4f68,0x99,0x29,{0x78,0xf8,0xb0,0xd6,0x21,0x80}} | |
| 42 | 	{0xb122a263,0x3661,0x4f68,{0x99,0x29,0x78,0xf8,0xb0,0xd6,0x21,0x80}} | |
| 43 | 43 | #define	EFI_PROPERTIES_TABLE			\ |
| 44 | 	{0x880aaca3,0x4adc,0x4a04,0x90,0x79,{0xb7,0x47,0x34,0x08,0x25,0xe5}} | |
| 44 | 	{0x880aaca3,0x4adc,0x4a04,{0x90,0x79,0xb7,0x47,0x34,0x08,0x25,0xe5}} | |
| 45 | #define	EFI_MEMORY_ATTRIBUTES_TABLE		\ | |
| 46 | 	{0xdcfa911d,0x26eb,0x469f,{0xa2,0x20,0x38,0xb7,0xdc,0x46,0x12,0x20}} | |
| 45 | 47 | #define LINUX_EFI_MEMRESERVE_TABLE			\ |
| 46 | 	{0x888eb0c6,0x8ede,0x4ff5,0xa8,0xf0,{0x9a,0xee,0x5c,0xb9,0x77,0xc2}} | |
| 48 | 	{0x888eb0c6,0x8ede,0x4ff5,{0xa8,0xf0,0x9a,0xee,0x5c,0xb9,0x77,0xc2}} | |
| 47 | 49 | |
| 48 | 50 | enum efi_reset { |
| 49 | 51 | 	EFI_RESET_COLD = 0, |
| ... | ... | @@ -54,8 +56,20 @@ enum efi_reset { |
| 54 | 56 | typedef uint16_t	efi_char; |
| 55 | 57 | typedef unsigned long efi_status; |
| 56 | 58 | |
| 59 | /* | |
| 60 | * This type-puns to a struct uuid, but all the EDK2 headers use this variation, | |
| 61 | * and we use it in the loader to specify GUIDs. We define it here so that we | |
| 62 | * can use EDK2 definitions both places. | |
| 63 | */ | |
| 64 | typedef struct efi_guid { | |
| 65 | 	uint32_t Data1; | |
| 66 | 	uint16_t Data2; | |
| 67 | 	uint16_t Data3; | |
| 68 | 	uint8_t Data4[8]; | |
| 69 | } efi_guid_t;	/* Type puns with GUID and EFI_GUID */ | |
| 70 | ||
| 57 | 71 | struct efi_cfgtbl { |
| 58 | 	struct uuid	ct_uuid; | |
| 72 | 	efi_guid_t	ct_guid; | |
| 59 | 73 | 	void		*ct_data; |
| 60 | 74 | }; |
| 61 | 75 | |
| ... | ... | @@ -139,7 +153,7 @@ struct efi_esrt_table { |
| 139 | 153 | }; |
| 140 | 154 | |
| 141 | 155 | struct efi_esrt_entry_v1 { |
| 142 | 	struct uuid	fw_class; | |
| 156 | 	efi_guid_t	fw_class; | |
| 143 | 157 | 	uint32_t 	fw_type; |
| 144 | 158 | 	uint32_t	fw_version; |
| 145 | 159 | 	uint32_t	lowest_supported_fw_version; |
| ... | ... | @@ -154,6 +168,22 @@ struct efi_prop_table { |
| 154 | 168 | 	uint64_t	memory_protection_attribute; |
| 155 | 169 | }; |
| 156 | 170 | |
| 171 | struct efi_memory_descriptor { | |
| 172 | 	uint32_t	type; | |
| 173 | 	caddr_t		phy_addr; | |
| 174 | 	caddr_t		virt_addr; | |
| 175 | 	uint64_t	pages; | |
| 176 | 	uint64_t	attrs; | |
| 177 | }; | |
| 178 | ||
| 179 | struct efi_memory_attribute_table { | |
| 180 | 	uint32_t	version; | |
| 181 | 	uint32_t	num_ents; | |
| 182 | 	uint32_t	descriptor_size; | |
| 183 | 	uint32_t	flags; | |
| 184 | 	struct efi_memory_descriptor tables[]; | |
| 185 | }; | |
| 186 | ||
| 157 | 187 | #ifdef _KERNEL |
| 158 | 188 | |
| 159 | 189 | #ifdef EFIABI_ATTR |
| ... | ... | @@ -169,11 +199,11 @@ struct efi_rt { |
| 169 | 199 | 	efi_status	(*rt_setvirtual)(u_long, u_long, uint32_t, |
| 170 | 200 | 	 struct efi_md *) EFIABI_ATTR; |
| 171 | 201 | 	efi_status	(*rt_cvtptr)(u_long, void **) EFIABI_ATTR; |
| 172 | 	efi_status	(*rt_getvar)(efi_char *, struct uuid *, uint32_t *, | |
| 202 | 	efi_status	(*rt_getvar)(efi_char *, efi_guid_t *, uint32_t *, | |
| 173 | 203 | 	 u_long *, void *) EFIABI_ATTR; |
| 174 | 	efi_status	(*rt_scanvar)(u_long *, efi_char *, struct uuid *) | |
| 204 | 	efi_status	(*rt_scanvar)(u_long *, efi_char *, efi_guid_t *) | |
| 175 | 205 | 	 EFIABI_ATTR; |
| 176 | 	efi_status	(*rt_setvar)(efi_char *, struct uuid *, uint32_t, | |
| 206 | 	efi_status	(*rt_setvar)(efi_char *, efi_guid_t *, uint32_t, | |
| 177 | 207 | 	 u_long, void *) EFIABI_ATTR; |
| 178 | 208 | 	efi_status	(*rt_gethicnt)(uint32_t *) EFIABI_ATTR; |
| 179 | 209 | 	efi_status	(*rt_reset)(enum efi_reset, efi_status, u_long, |
| ... | ... | @@ -246,8 +276,8 @@ struct efi_ops { |
| 246 | 276 | 	 * access them. |
| 247 | 277 | 	 */ |
| 248 | 278 | 	int	(*rt_ok)(void); |
| 249 | 	int 	(*get_table)(struct uuid *, void **); | |
| 250 | 	int 	(*copy_table)(struct uuid *, void **, size_t, size_t *); | |
| 279 | 	int 	(*get_table)(efi_guid_t *, void **); | |
| 280 | 	int 	(*copy_table)(efi_guid_t *, void **, size_t, size_t *); | |
| 251 | 281 | 	int 	(*get_time)(struct efi_tm *); |
| 252 | 282 | 	int 	(*get_time_capabilities)(struct efi_tmcap *); |
| 253 | 283 | 	int	(*reset_system)(enum efi_reset); |
| ... | ... | @@ -255,10 +285,10 @@ struct efi_ops { |
| 255 | 285 | 	int 	(*get_waketime)(uint8_t *enabled, uint8_t *pending, |
| 256 | 286 | 	 struct efi_tm *tm); |
| 257 | 287 | 	int 	(*set_waketime)(uint8_t enable, struct efi_tm *tm); |
| 258 | 	int 	(*var_get)(uint16_t *, struct uuid *, uint32_t *, size_t *, | |
| 288 | 	int 	(*var_get)(uint16_t *, efi_guid_t *, uint32_t *, size_t *, | |
| 259 | 289 | void *); |
| 260 | 	int 	(*var_nextname)(size_t *, uint16_t *, struct uuid *); | |
| 261 | 	int 	(*var_set)(uint16_t *, struct uuid *, uint32_t, size_t, void *); | |
| 290 | 	int 	(*var_nextname)(size_t *, uint16_t *, efi_guid_t *); | |
| 291 | 	int 	(*var_set)(uint16_t *, efi_guid_t *, uint32_t, size_t, void *); | |
| 262 | 292 | }; |
| 263 | 293 | extern const struct efi_ops *active_efi_ops; |
| 264 | 294 | |
| ... | ... | @@ -271,21 +301,21 @@ static inline int efi_rt_ok(void) |
| 271 | 301 | 	return (active_efi_ops->rt_ok()); |
| 272 | 302 | } |
| 273 | 303 | |
| 274 | static inline int efi_get_table(struct uuid *uuid, void **ptr) | |
| 304 | static inline int efi_get_table(efi_guid_t *guid, void **ptr) | |
| 275 | 305 | { |
| 276 | 306 | |
| 277 | 307 | if (active_efi_ops->get_table == NULL) |
| 278 | 308 | 		return (ENXIO); |
| 279 | 	return (active_efi_ops->get_table(uuid, ptr)); | |
| 309 | 	return (active_efi_ops->get_table(guid, ptr)); | |
| 280 | 310 | } |
| 281 | 311 | |
| 282 | static inline int efi_copy_table(struct uuid *uuid, void **buf, | |
| 312 | static inline int efi_copy_table(efi_guid_t *guid, void **buf, | |
| 283 | 313 | size_t buf_len, size_t *table_len) |
| 284 | 314 | { |
| 285 | 315 | |
| 286 | 316 | 	if (active_efi_ops->copy_table == NULL) |
| 287 | 317 | 		return (ENXIO); |
| 288 | 	return (active_efi_ops->copy_table(uuid, buf, buf_len, table_len)); | |
| 318 | 	return (active_efi_ops->copy_table(guid, buf, buf_len, table_len)); | |
| 289 | 319 | } |
| 290 | 320 | |
| 291 | 321 | static inline int efi_get_time(struct efi_tm *tm) |
| ... | ... | @@ -335,7 +365,7 @@ static inline int efi_set_waketime(uint8_t enable, struct efi_tm *tm) |
| 335 | 365 | 	return (active_efi_ops->set_waketime(enable, tm)); |
| 336 | 366 | } |
| 337 | 367 | |
| 338 | static inline int efi_var_get(uint16_t *name, struct uuid *vendor, | |
| 368 | static inline int efi_var_get(uint16_t *name, efi_guid_t *vendor, | |
| 339 | 369 | uint32_t *attrib, size_t *datasize, void *data) |
| 340 | 370 | { |
| 341 | 371 | |
| ... | ... | @@ -345,7 +375,7 @@ static inline int efi_var_get(uint16_t *name, struct uuid *vendor, |
| 345 | 375 | } |
| 346 | 376 | |
| 347 | 377 | static inline int efi_var_nextname(size_t *namesize, uint16_t *name, |
| 348 | struct uuid *vendor) | |
| 378 | efi_guid_t *vendor) | |
| 349 | 379 | { |
| 350 | 380 | |
| 351 | 381 | 	if (active_efi_ops->var_nextname == NULL) |
| ... | ... | @@ -353,7 +383,7 @@ static inline int efi_var_nextname(size_t *namesize, uint16_t *name, |
| 353 | 383 | 	return (active_efi_ops->var_nextname(namesize, name, vendor)); |
| 354 | 384 | } |
| 355 | 385 | |
| 356 | static inline int efi_var_set(uint16_t *name, struct uuid *vendor, | |
| 386 | static inline int efi_var_set(uint16_t *name, efi_guid_t *vendor, | |
| 357 | 387 | uint32_t attrib, size_t datasize, void *data) |
| 358 | 388 | { |
| 359 | 389 |
lib/libc/include/generic-freebsd/sys/efi_map.h created+24| ... | ... | @@ -0,0 +1,24 @@ |
| 1 | /* | |
| 2 | * Copyright (c) 2014 The FreeBSD Foundation | |
| 3 | * Copyright (c) 2018 Andrew Turner | |
| 4 | * | |
| 5 | * SPDX-License-Identifier: BSD-2-Clause | |
| 6 | */ | |
| 7 | #ifndef _SYS_EFI_MAP_H_ | |
| 8 | #define _SYS_EFI_MAP_H_ | |
| 9 | ||
| 10 | #include <sys/efi.h> | |
| 11 | #include <machine/metadata.h> | |
| 12 | ||
| 13 | struct efi_map_header; | |
| 14 | ||
| 15 | typedef void (*efi_map_entry_cb)(struct efi_md *, void *argp); | |
| 16 | ||
| 17 | void efi_map_foreach_entry(struct efi_map_header *efihdr, efi_map_entry_cb cb, | |
| 18 | void *argp); | |
| 19 | ||
| 20 | void efi_map_add_entries(struct efi_map_header *efihdr); | |
| 21 | void efi_map_exclude_entries(struct efi_map_header *efihdr); | |
| 22 | void efi_map_print_entries(struct efi_map_header *efihdr); | |
| 23 | ||
| 24 | #endif /* !_SYS_EFI_MAP_H_ */ | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/sys/efiio.h+52-11| ... | ... | @@ -30,38 +30,79 @@ |
| 30 | 30 | #include <sys/uuid.h> |
| 31 | 31 | #include <sys/efi.h> |
| 32 | 32 | |
| 33 | struct efi_get_table_ioc | |
| 33 | /* | |
| 34 | * The EFI world chose not to use the typical uuid_t defines for its global | |
| 35 | * universal identifiers. But the textual representation is the same, and we can | |
| 36 | * use the uuid_* routines to parse and print them. However, all EFI interfaces | |
| 37 | * for this need to be efi_guid_t so we can share code with EDK2, so the *_ioc | |
| 38 | * structures in this file are converted to _ioctl structure to transition to | |
| 39 | * this new requirement. This library is little used outside of FreeBSD and they | |
| 40 | * will be dropped in 16. | |
| 41 | */ | |
| 42 | _Static_assert(sizeof(struct uuid) == sizeof(efi_guid_t), | |
| 43 | "uuid_t and efi_guid_t are same bytes, but different elements"); | |
| 44 | #if __FreeBSD_version < 1600000 && !defined(_KERNEL) | |
| 45 | #define _WANT_EFI_IOC | |
| 46 | #endif | |
| 47 | ||
| 48 | struct efi_get_table_ioctl | |
| 34 | 49 | { |
| 35 | 50 | 	void *buf;		/* Pointer to userspace buffer */ |
| 36 | 	struct uuid uuid;	/* UUID to look up */ | |
| 51 | 	efi_guid_t guid;	/* GUID to look up */ | |
| 37 | 52 | 	size_t table_len;	/* Table size */ |
| 38 | 53 | 	size_t buf_len;		/* Size of the buffer */ |
| 39 | 54 | }; |
| 40 | 55 | |
| 41 | struct efi_var_ioc | |
| 56 | struct efi_var_ioctl | |
| 42 | 57 | { |
| 43 | 58 | 	efi_char *name;		/* User pointer to name, in wide chars */ |
| 44 | 59 | 	size_t namesize;	/* Number of wide characters in name */ |
| 45 | 	struct uuid vendor;	/* Vendor's UUID for variable */ | |
| 60 | 	efi_guid_t vendor;	/* Vendor's GUID for variable */ | |
| 46 | 61 | 	uint32_t attrib;	/* Attributes */ |
| 47 | 62 | 	void *data;		/* User pointer to the data */ |
| 48 | 63 | 	size_t datasize;	/* Number of *bytes* in the data */ |
| 49 | 64 | }; |
| 50 | 65 | |
| 51 | struct efi_waketime_ioc | |
| 66 | struct efi_waketime_ioctl | |
| 52 | 67 | { |
| 53 | 68 | 	struct efi_tm	waketime; |
| 54 | 69 | 	uint8_t		enabled; |
| 55 | 70 | 	uint8_t		pending; |
| 56 | 71 | }; |
| 57 | 72 | |
| 58 | #define EFIIOC_GET_TABLE	_IOWR('E', 1, struct efi_get_table_ioc) | |
| 73 | #define EFIIOC_GET_TABLE	_IOWR('E', 1, struct efi_get_table_ioctl) | |
| 59 | 74 | #define EFIIOC_GET_TIME		_IOR('E', 2, struct efi_tm) |
| 60 | 75 | #define EFIIOC_SET_TIME		_IOW('E', 3, struct efi_tm) |
| 61 | #define EFIIOC_VAR_GET		_IOWR('E', 4, struct efi_var_ioc) | |
| 62 | #define EFIIOC_VAR_NEXT		_IOWR('E', 5, struct efi_var_ioc) | |
| 63 | #define EFIIOC_VAR_SET		_IOWR('E', 6, struct efi_var_ioc) | |
| 64 | #define EFIIOC_GET_WAKETIME	_IOR('E', 7, struct efi_waketime_ioc) | |
| 65 | #define EFIIOC_SET_WAKETIME	_IOW('E', 8, struct efi_waketime_ioc) | |
| 76 | #define EFIIOC_VAR_GET		_IOWR('E', 4, struct efi_var_ioctl) | |
| 77 | #define EFIIOC_VAR_NEXT		_IOWR('E', 5, struct efi_var_ioctl) | |
| 78 | #define EFIIOC_VAR_SET		_IOWR('E', 6, struct efi_var_ioctl) | |
| 79 | #define EFIIOC_GET_WAKETIME	_IOR('E', 7, struct efi_waketime_ioctl) | |
| 80 | #define EFIIOC_SET_WAKETIME	_IOW('E', 8, struct efi_waketime_ioctl) | |
| 81 | ||
| 82 | #ifdef _WANT_EFI_IOC | |
| 83 | struct efi_get_table_ioc | |
| 84 | { | |
| 85 | 	void *buf;		/* Pointer to userspace buffer */ | |
| 86 | 	struct uuid uuid;	/* GUID to look up */ | |
| 87 | 	size_t table_len;	/* Table size */ | |
| 88 | 	size_t buf_len;		/* Size of the buffer */ | |
| 89 | }; | |
| 90 | ||
| 91 | struct efi_var_ioc | |
| 92 | { | |
| 93 | 	efi_char *name;		/* User pointer to name, in wide chars */ | |
| 94 | 	size_t namesize;	/* Number of wide characters in name */ | |
| 95 | 	struct uuid vendor;	/* Vendor's GUID for variable */ | |
| 96 | 	uint32_t attrib;	/* Attributes */ | |
| 97 | 	void *data;		/* User pointer to the data */ | |
| 98 | 	size_t datasize;	/* Number of *bytes* in the data */ | |
| 99 | }; | |
| 100 | ||
| 101 | _Static_assert(sizeof(struct efi_get_table_ioc) == sizeof(struct efi_get_table_ioctl), | |
| 102 | "Old and new struct table defines must be the same size"); | |
| 103 | _Static_assert(sizeof(struct efi_var_ioc) == sizeof(struct efi_var_ioctl), | |
| 104 | "Old and new struct var defines must be the same size"); | |
| 105 | #define efi_waketime_ioc efi_waketime_ioctl | |
| 106 | #endif | |
| 66 | 107 | |
| 67 | 108 | #endif /* _SYS_EFIIO_H_ */ |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/sys/elf_common.h+205-17| ... | ... | @@ -306,6 +306,7 @@ typedef struct { |
| 306 | 306 | 				 and MPRC of Peking University */ |
| 307 | 307 | #define	EM_AARCH64	183	/* AArch64 (64-bit ARM) */ |
| 308 | 308 | #define	EM_RISCV	243	/* RISC-V */ |
| 309 | #define	EM_LOONGARCH	258	/* Loongson LoongArch */ | |
| 309 | 310 | |
| 310 | 311 | /* Non-standard or deprecated. */ |
| 311 | 312 | #define	EM_486		6	/* Intel i486. */ |
| ... | ... | @@ -382,6 +383,25 @@ typedef struct { |
| 382 | 383 | #define	EF_RISCV_RVE		0x00000008 |
| 383 | 384 | #define	EF_RISCV_TSO		0x00000010 |
| 384 | 385 | |
| 386 | /* | |
| 387 | * Loongson LoongArch Specific e_flags | |
| 388 | * | |
| 389 | * Definitions from LoongArch ELF psABI v2.01. | |
| 390 | * Reference: https://github.com/loongson/LoongArch-Documentation | |
| 391 | * (commit hash 296de4def055c871809068e0816325a4ac04eb12) | |
| 392 | */ | |
| 393 | ||
| 394 | /* LoongArch Base ABI Modifiers */ | |
| 395 | #define	EF_LOONGARCH_ABI_SOFT_FLOAT	0x00000001 | |
| 396 | #define	EF_LOONGARCH_ABI_SINGLE_FLOAT	0x00000002 | |
| 397 | #define	EF_LOONGARCH_ABI_DOUBLE_FLOAT	0x00000003 | |
| 398 | #define	EF_LOONGARCH_ABI_MODIFIER_MASK	0x00000007 | |
| 399 | ||
| 400 | /* LoongArch Object file ABI versions */ | |
| 401 | #define	EF_LOONGARCH_OBJABI_V0		0x00000000 | |
| 402 | #define	EF_LOONGARCH_OBJABI_V1		0x00000040 | |
| 403 | #define	EF_LOONGARCH_OBJABI_MASK	0x000000C0 | |
| 404 | ||
| 385 | 405 | #define	EF_SPARC_EXT_MASK	0x00ffff00 |
| 386 | 406 | #define	EF_SPARC_32PLUS		0x00000100 |
| 387 | 407 | #define	EF_SPARC_SUN_US1	0x00000200 |
| ... | ... | @@ -450,12 +470,12 @@ typedef struct { |
| 450 | 470 | #define	SHT_HIOS		0x6fffffff	/* Last of OS specific semantics */ |
| 451 | 471 | #define	SHT_LOPROC		0x70000000	/* reserved range for processor */ |
| 452 | 472 | #define	SHT_X86_64_UNWIND	0x70000001	/* unwind information */ |
| 453 | #define	SHT_AMD64_UNWIND	SHT_X86_64_UNWIND | |
| 473 | #define	SHT_AMD64_UNWIND	SHT_X86_64_UNWIND | |
| 454 | 474 | |
| 455 | 475 | #define	SHT_ARM_EXIDX		0x70000001	/* Exception index table. */ |
| 456 | #define	SHT_ARM_PREEMPTMAP	0x70000002	/* BPABI DLL dynamic linking | |
| 476 | #define	SHT_ARM_PREEMPTMAP	0x70000002	/* BPABI DLL dynamic linking | |
| 457 | 477 | 						 pre-emption map. */ |
| 458 | #define	SHT_ARM_ATTRIBUTES	0x70000003	/* Object file compatibility | |
| 478 | #define	SHT_ARM_ATTRIBUTES	0x70000003	/* Object file compatibility | |
| 459 | 479 | 						 attributes. */ |
| 460 | 480 | #define	SHT_ARM_DEBUGOVERLAY	0x70000004	/* See DBGOVL for details. */ |
| 461 | 481 | #define	SHT_ARM_OVERLAYSECTION	0x70000005	/* See DBGOVL for details. */ |
| ... | ... | @@ -534,8 +554,8 @@ typedef struct { |
| 534 | 554 | #define	PT_GNU_EH_FRAME	0x6474e550 |
| 535 | 555 | #define	PT_GNU_STACK	0x6474e551 |
| 536 | 556 | #define	PT_GNU_RELRO	0x6474e552 |
| 537 | #define	PT_DUMP_DELTA	0x6fb5d000	/* va->pa map for kernel dumps | |
| 538 | 					 (currently arm). */ | |
| 557 | #define	PT_DUMP_DELTA	0x6fb5d000	/* va->pa map for arm and amd64 kernel | |
| 558 | 					 dumps */ | |
| 539 | 559 | #define	PT_LOSUNW	0x6ffffffa |
| 540 | 560 | #define	PT_SUNWBSS	0x6ffffffa	/* Sun Specific segment */ |
| 541 | 561 | #define	PT_SUNWSTACK	0x6ffffffb	/* describes the stack segment */ |
| ... | ... | @@ -770,7 +790,8 @@ typedef struct { |
| 770 | 790 | #define	DF_1_GLOBAL	0x00000002	/* Set the RTLD_GLOBAL for object */ |
| 771 | 791 | #define	DF_1_NODELETE	0x00000008	/* Set the RTLD_NODELETE for object */ |
| 772 | 792 | #define	DF_1_LOADFLTR	0x00000010	/* Immediate loading of filtees */ |
| 773 | #define	DF_1_NOOPEN 0x00000040	/* Do not allow loading on dlopen() */ | |
| 793 | #define	DF_1_INITFIRST	0x00000020	/* Initialize DSO first at runtime */ | |
| 794 | #define	DF_1_NOOPEN	0x00000040	/* Do not allow loading on dlopen() */ | |
| 774 | 795 | #define	DF_1_ORIGIN	0x00000080	/* Process $ORIGIN */ |
| 775 | 796 | #define	DF_1_INTERPOSE	0x00000400	/* Interpose all objects but main */ |
| 776 | 797 | #define	DF_1_NODEFLIB	0x00000800	/* Do not search default paths */ |
| ... | ... | @@ -804,6 +825,7 @@ typedef struct { |
| 804 | 825 | #define	NT_FREEBSD_FCTL_WXNEEDED	0x00000008 |
| 805 | 826 | #define	NT_FREEBSD_FCTL_LA48		0x00000010 |
| 806 | 827 | /* was ASG_DISABLE, do not reuse	0x00000020 */ |
| 828 | #define	NT_FREEBSD_FCTL_LA57		0x00000040 | |
| 807 | 829 | |
| 808 | 830 | /* Values for n_type. Used in core files. */ |
| 809 | 831 | #define	NT_PRSTATUS	1	/* Process status. */ |
| ... | ... | @@ -820,6 +842,7 @@ typedef struct { |
| 820 | 842 | #define	NT_PROCSTAT_PSSTRINGS	15	/* Procstat ps_strings data. */ |
| 821 | 843 | #define	NT_PROCSTAT_AUXV	16	/* Procstat auxv data. */ |
| 822 | 844 | #define	NT_PTLWPINFO		17	/* Thread ptrace miscellaneous info. */ |
| 845 | #define	NT_PROCSTAT_KQUEUES	18	/* Procstat kqueues events. */ | |
| 823 | 846 | #define	NT_PPC_VMX	0x100	/* PowerPC Altivec/VMX registers */ |
| 824 | 847 | #define	NT_PPC_VSX	0x102	/* PowerPC VSX registers */ |
| 825 | 848 | #define	NT_X86_SEGBASES	0x200	/* x86 FS/GS base addresses. */ |
| ... | ... | @@ -885,7 +908,7 @@ typedef struct { |
| 885 | 908 | #define	STV_ELIMINATE	0x6 |
| 886 | 909 | |
| 887 | 910 | /* Architecture specific data - st_other */ |
| 888 | #define	STO_AARCH64_VARIANT_PCS 0x80 | |
| 911 | #define	STO_AARCH64_VARIANT_PCS	0x80 | |
| 889 | 912 | |
| 890 | 913 | /* Special symbol table indexes. */ |
| 891 | 914 | #define	STN_UNDEF	0	/* Undefined symbol index. */ |
| ... | ... | @@ -991,8 +1014,11 @@ typedef struct { |
| 991 | 1014 | #define	AT_KPRELOAD	34	/* Base of vdso, preloaded by rtld */ |
| 992 | 1015 | #define	AT_USRSTACKBASE	35	/* Top of user stack */ |
| 993 | 1016 | #define	AT_USRSTACKLIM	36	/* Grow limit of user stack */ |
| 1017 | #define	AT_CHERI_STATS	37	/* Reserved */ | |
| 1018 | #define	AT_HWCAP3	38	/* CPU feature flags 3. */ | |
| 1019 | #define	AT_HWCAP4	39	/* CPU feature flags 4. */ | |
| 994 | 1020 | |
| 995 | #define	AT_COUNT	37	/* Count of defined aux entry types. */ | |
| 1021 | #define	AT_COUNT	40	/* Count of defined aux entry types. */ | |
| 996 | 1022 | |
| 997 | 1023 | /* |
| 998 | 1024 | * Relocation types. |
| ... | ... | @@ -1058,11 +1084,11 @@ typedef struct { |
| 1058 | 1084 | #define	R_AARCH64_COPY		1024	/* Copy data from shared object */ |
| 1059 | 1085 | #define	R_AARCH64_GLOB_DAT	1025	/* Set GOT entry to data address */ |
| 1060 | 1086 | #define	R_AARCH64_JUMP_SLOT	1026	/* Set GOT entry to code address */ |
| 1061 | #define	R_AARCH64_RELATIVE 	1027	/* Add load address of shared object */ | |
| 1087 | #define	R_AARCH64_RELATIVE	1027	/* Add load address of shared object */ | |
| 1062 | 1088 | #define	R_AARCH64_TLS_DTPREL64	1028 |
| 1063 | 1089 | #define	R_AARCH64_TLS_DTPMOD64	1029 |
| 1064 | #define	R_AARCH64_TLS_TPREL64 	1030 | |
| 1065 | #define	R_AARCH64_TLSDESC 	1031	/* Identify the TLS descriptor */ | |
| 1090 | #define	R_AARCH64_TLS_TPREL64	1030 | |
| 1091 | #define	R_AARCH64_TLSDESC	1031	/* Identify the TLS descriptor */ | |
| 1066 | 1092 | #define	R_AARCH64_IRELATIVE	1032 |
| 1067 | 1093 | |
| 1068 | 1094 | #define	R_ARM_NONE		0	/* No relocation. */ |
| ... | ... | @@ -1205,8 +1231,8 @@ typedef struct { |
| 1205 | 1231 | #define	R_MIPS_GOT_HI16	22	/* GOT HI 16 bit */ |
| 1206 | 1232 | #define	R_MIPS_GOT_LO16	23	/* GOT LO 16 bit */ |
| 1207 | 1233 | #define	R_MIPS_SUB	24 |
| 1208 | #define	R_MIPS_CALLHI16 30	/* upper 16 bit GOT entry for function */ | |
| 1209 | #define	R_MIPS_CALLLO16 31	/* lower 16 bit GOT entry for function */ | |
| 1234 | #define	R_MIPS_CALLHI16	30	/* upper 16 bit GOT entry for function */ | |
| 1235 | #define	R_MIPS_CALLLO16	31	/* lower 16 bit GOT entry for function */ | |
| 1210 | 1236 | #define	R_MIPS_JALR	37 |
| 1211 | 1237 | #define	R_MIPS_TLS_GD	42 |
| 1212 | 1238 | #define	R_MIPS_COPY	126 |
| ... | ... | @@ -1326,7 +1352,6 @@ typedef struct { |
| 1326 | 1352 | * RISC-V relocation types. |
| 1327 | 1353 | */ |
| 1328 | 1354 | |
| 1329 | /* Relocation types used by the dynamic linker. */ | |
| 1330 | 1355 | #define	R_RISCV_NONE		0 |
| 1331 | 1356 | #define	R_RISCV_32		1 |
| 1332 | 1357 | #define	R_RISCV_64		2 |
| ... | ... | @@ -1339,8 +1364,7 @@ typedef struct { |
| 1339 | 1364 | #define	R_RISCV_TLS_DTPREL64	9 |
| 1340 | 1365 | #define	R_RISCV_TLS_TPREL32	10 |
| 1341 | 1366 | #define	R_RISCV_TLS_TPREL64	11 |
| 1342 | ||
| 1343 | /* Relocation types not used by the dynamic linker. */ | |
| 1367 | #define	R_RISCV_TLSDESC		12 | |
| 1344 | 1368 | #define	R_RISCV_BRANCH		16 |
| 1345 | 1369 | #define	R_RISCV_JAL		17 |
| 1346 | 1370 | #define	R_RISCV_CALL		18 |
| ... | ... | @@ -1366,10 +1390,10 @@ typedef struct { |
| 1366 | 1390 | #define	R_RISCV_SUB16		38 |
| 1367 | 1391 | #define	R_RISCV_SUB32		39 |
| 1368 | 1392 | #define	R_RISCV_SUB64		40 |
| 1393 | #define	R_RISCV_GOT32_PCREL	41 | |
| 1369 | 1394 | #define	R_RISCV_ALIGN		43 |
| 1370 | 1395 | #define	R_RISCV_RVC_BRANCH	44 |
| 1371 | 1396 | #define	R_RISCV_RVC_JUMP	45 |
| 1372 | #define	R_RISCV_RVC_LUI		46 | |
| 1373 | 1397 | #define	R_RISCV_RELAX		51 |
| 1374 | 1398 | #define	R_RISCV_SUB6		52 |
| 1375 | 1399 | #define	R_RISCV_SET6		53 |
| ... | ... | @@ -1378,6 +1402,170 @@ typedef struct { |
| 1378 | 1402 | #define	R_RISCV_SET32		56 |
| 1379 | 1403 | #define	R_RISCV_32_PCREL	57 |
| 1380 | 1404 | #define	R_RISCV_IRELATIVE	58 |
| 1405 | #define	R_RISCV_PLT32		59 | |
| 1406 | #define	R_RISCV_SET_ULEB128	60 | |
| 1407 | #define	R_RISCV_SUB_ULEB128	61 | |
| 1408 | #define	R_RISCV_TLSDESC_HI20	62 | |
| 1409 | #define	R_RISCV_TLSDESC_LOAD_LO12 63 | |
| 1410 | #define	R_RISCV_TLSDESC_ADD_LO12 64 | |
| 1411 | #define	R_RISCV_TLSDESC_CALL	65 | |
| 1412 | #define	R_RISCV_VENDOR		191 | |
| 1413 | ||
| 1414 | /* | |
| 1415 | * Loongson LoongArch relocation types. | |
| 1416 | * | |
| 1417 | * LoongArch ELF psABI: https://github.com/loongson/LoongArch-Documentation | |
| 1418 | * (commit hash 9b3bd9f4a497115913c22f1a2a47863798fbc02a) | |
| 1419 | */ | |
| 1420 | ||
| 1421 | /* Relocation types used by the dynamic linker */ | |
| 1422 | #define	R_LARCH_NONE				0 | |
| 1423 | #define	R_LARCH_32				1 | |
| 1424 | #define	R_LARCH_64				2 | |
| 1425 | #define	R_LARCH_RELATIVE			3 | |
| 1426 | #define	R_LARCH_COPY				4 | |
| 1427 | #define	R_LARCH_JUMP_SLOT			5 | |
| 1428 | #define	R_LARCH_TLS_DTPMOD32			6 | |
| 1429 | #define	R_LARCH_TLS_DTPMOD64			7 | |
| 1430 | #define	R_LARCH_TLS_DTPREL32			8 | |
| 1431 | #define	R_LARCH_TLS_DTPREL64			9 | |
| 1432 | #define	R_LARCH_TLS_TPREL32			10 | |
| 1433 | #define	R_LARCH_TLS_TPREL64			11 | |
| 1434 | #define	R_LARCH_IRELATIVE			12 | |
| 1435 | #define	R_LARCH_MARK_LA				20 | |
| 1436 | #define	R_LARCH_MARK_PCREL			21 | |
| 1437 | #define	R_LARCH_SOP_PUSH_PCREL			22 | |
| 1438 | #define	R_LARCH_SOP_PUSH_ABSOLUTE		23 | |
| 1439 | #define	R_LARCH_SOP_PUSH_DUP			24 | |
| 1440 | #define	R_LARCH_SOP_PUSH_GPREL			25 | |
| 1441 | #define	R_LARCH_SOP_PUSH_TLS_TPREL		26 | |
| 1442 | #define	R_LARCH_SOP_PUSH_TLS_GOT		27 | |
| 1443 | #define	R_LARCH_SOP_PUSH_TLS_GD			28 | |
| 1444 | #define	R_LARCH_SOP_PUSH_PLT_PCREL		29 | |
| 1445 | #define	R_LARCH_SOP_ASSERT			30 | |
| 1446 | #define	R_LARCH_SOP_NOT				31 | |
| 1447 | #define	R_LARCH_SOP_SUB				32 | |
| 1448 | #define	R_LARCH_SOP_SL				33 | |
| 1449 | #define	R_LARCH_SOP_SR				34 | |
| 1450 | #define	R_LARCH_SOP_ADD				35 | |
| 1451 | #define	R_LARCH_SOP_AND				36 | |
| 1452 | #define	R_LARCH_SOP_IF_ELSE			37 | |
| 1453 | #define	R_LARCH_SOP_POP_32_S_10_5		38 | |
| 1454 | #define	R_LARCH_SOP_POP_32_U_10_12		39 | |
| 1455 | #define	R_LARCH_SOP_POP_32_S_10_12		40 | |
| 1456 | #define	R_LARCH_SOP_POP_32_S_10_16		41 | |
| 1457 | #define	R_LARCH_SOP_POP_32_S_10_16_S2		42 | |
| 1458 | #define	R_LARCH_SOP_POP_32_S_5_20		43 | |
| 1459 | #define	R_LARCH_SOP_POP_32_S_0_5_10_16_S2	44 | |
| 1460 | #define	R_LARCH_SOP_POP_32_S_0_10_10_16_S2	45 | |
| 1461 | #define	R_LARCH_SOP_POP_32_U			46 | |
| 1462 | #define	R_LARCH_ADD8				47 | |
| 1463 | #define	R_LARCH_ADD16				48 | |
| 1464 | #define	R_LARCH_ADD24				49 | |
| 1465 | #define	R_LARCH_ADD32				50 | |
| 1466 | #define	R_LARCH_ADD64				51 | |
| 1467 | #define	R_LARCH_SUB8				52 | |
| 1468 | #define	R_LARCH_SUB16				53 | |
| 1469 | #define	R_LARCH_SUB24				54 | |
| 1470 | #define	R_LARCH_SUB32				55 | |
| 1471 | #define	R_LARCH_SUB64				56 | |
| 1472 | #define	R_LARCH_GNU_VTINHERIT			57 | |
| 1473 | #define	R_LARCH_GNU_VTENTRY			58 | |
| 1474 | ||
| 1475 | /* | |
| 1476 | * Relocs whose processing do not require a stack machine. | |
| 1477 | * | |
| 1478 | * Spec addition: https://github.com/loongson/LoongArch-Documentation/pull/57 | |
| 1479 | */ | |
| 1480 | #define	R_LARCH_B16				64 | |
| 1481 | #define	R_LARCH_B21				65 | |
| 1482 | #define	R_LARCH_B26				66 | |
| 1483 | #define	R_LARCH_ABS_HI20			67 | |
| 1484 | #define	R_LARCH_ABS_LO12			68 | |
| 1485 | #define	R_LARCH_ABS64_LO20			69 | |
| 1486 | #define	R_LARCH_ABS64_HI12			70 | |
| 1487 | #define	R_LARCH_PCALA_HI20			71 | |
| 1488 | #define	R_LARCH_PCALA_LO12			72 | |
| 1489 | #define	R_LARCH_PCALA64_LO20			73 | |
| 1490 | #define	R_LARCH_PCALA64_HI12			74 | |
| 1491 | #define	R_LARCH_GOT_PC_HI20			75 | |
| 1492 | #define	R_LARCH_GOT_PC_LO12			76 | |
| 1493 | #define	R_LARCH_GOT64_PC_LO20			77 | |
| 1494 | #define	R_LARCH_GOT64_PC_HI12			78 | |
| 1495 | #define	R_LARCH_GOT_HI20			79 | |
| 1496 | #define	R_LARCH_GOT_LO12			80 | |
| 1497 | #define	R_LARCH_GOT64_LO20			81 | |
| 1498 | #define	R_LARCH_GOT64_HI12			82 | |
| 1499 | #define	R_LARCH_TLS_LE_HI20			83 | |
| 1500 | #define	R_LARCH_TLS_LE_LO12			84 | |
| 1501 | #define	R_LARCH_TLS_LE64_LO20			85 | |
| 1502 | #define	R_LARCH_TLS_LE64_HI12			86 | |
| 1503 | #define	R_LARCH_TLS_IE_PC_HI20			87 | |
| 1504 | #define	R_LARCH_TLS_IE_PC_LO12			88 | |
| 1505 | #define	R_LARCH_TLS_IE64_PC_LO20		89 | |
| 1506 | #define	R_LARCH_TLS_IE64_PC_HI12		90 | |
| 1507 | #define	R_LARCH_TLS_IE_HI20			91 | |
| 1508 | #define	R_LARCH_TLS_IE_LO12			92 | |
| 1509 | #define	R_LARCH_TLS_IE64_LO20			93 | |
| 1510 | #define	R_LARCH_TLS_IE64_HI12			94 | |
| 1511 | #define	R_LARCH_TLS_LD_PC_HI20			95 | |
| 1512 | #define	R_LARCH_TLS_LD_HI20			96 | |
| 1513 | #define	R_LARCH_TLS_GD_PC_HI20			97 | |
| 1514 | #define	R_LARCH_TLS_GD_HI20			98 | |
| 1515 | #define	R_LARCH_32_PCREL			99 | |
| 1516 | #define	R_LARCH_RELAX				100 | |
| 1517 | ||
| 1518 | /* | |
| 1519 | * Relocs added in ELF for the LoongArch™ Architecture v20230519, part of the | |
| 1520 | * v2.10 LoongArch ABI specs. | |
| 1521 | * | |
| 1522 | * Spec addition: https://github.com/loongson/la-abi-specs/pull/1 | |
| 1523 | * | |
| 1524 | * Note that the 101 and 104 relocation numbers are defined as R_LARCH_DELETE | |
| 1525 | * and R_LARCH_CFA respectively in psABI 2.10. But they are marked as reserved | |
| 1526 | * in psABI v2.20 because they were proved not necessary to be exposed outside | |
| 1527 | * of the linker. | |
| 1528 | */ | |
| 1529 | #define	R_LARCH_ALIGN				102 | |
| 1530 | #define	R_LARCH_PCREL20_S2			103 | |
| 1531 | #define	R_LARCH_ADD6				105 | |
| 1532 | #define	R_LARCH_SUB6				106 | |
| 1533 | #define	R_LARCH_ADD_ULEB128			107 | |
| 1534 | #define	R_LARCH_SUB_ULEB128			108 | |
| 1535 | #define	R_LARCH_64_PCREL			109 | |
| 1536 | ||
| 1537 | /* | |
| 1538 | * Relocs added in ELF for the LoongArch™ Architecture v20231102, part of the | |
| 1539 | * v2.20 LoongArch ABI specs. | |
| 1540 | * | |
| 1541 | * Spec addition: https://github.com/loongson/la-abi-specs/pull/4 | |
| 1542 | */ | |
| 1543 | #define	R_LARCH_CALL36				110 | |
| 1544 | ||
| 1545 | /* | |
| 1546 | * Relocs added in ELF for the LoongArch™ Architecture v20231219, part of the | |
| 1547 | * v2.30 LoongArch ABI specs. | |
| 1548 | * | |
| 1549 | * Spec addition: https://github.com/loongson/la-abi-specs/pull/5 | |
| 1550 | */ | |
| 1551 | #define	R_LARCH_TLS_DESC32			13 | |
| 1552 | #define	R_LARCH_TLS_DESC64			14 | |
| 1553 | #define	R_LARCH_TLS_DESC_PC_HI20		111 | |
| 1554 | #define	R_LARCH_TLS_DESC_PC_LO12		112 | |
| 1555 | #define	R_LARCH_TLS_DESC64_PC_LO20		113 | |
| 1556 | #define	R_LARCH_TLS_DESC64_PC_HI12		114 | |
| 1557 | #define	R_LARCH_TLS_DESC_HI20			115 | |
| 1558 | #define	R_LARCH_TLS_DESC_LO12			116 | |
| 1559 | #define	R_LARCH_TLS_DESC64_LO20			117 | |
| 1560 | #define	R_LARCH_TLS_DESC64_HI12			118 | |
| 1561 | #define	R_LARCH_TLS_DESC_LD			119 | |
| 1562 | #define	R_LARCH_TLS_DESC_CALL			120 | |
| 1563 | #define	R_LARCH_TLS_LE_HI20_R			121 | |
| 1564 | #define	R_LARCH_TLS_LE_ADD_R			122 | |
| 1565 | #define	R_LARCH_TLS_LE_LO12_R			123 | |
| 1566 | #define	R_LARCH_TLS_LD_PCREL20_S2		124 | |
| 1567 | #define	R_LARCH_TLS_GD_PCREL20_S2		125 | |
| 1568 | #define	R_LARCH_TLS_DESC_PCREL20_S2		126 | |
| 1381 | 1569 | |
| 1382 | 1570 | #define	R_SPARC_NONE		0 |
| 1383 | 1571 | #define	R_SPARC_8		1 |
lib/libc/include/generic-freebsd/sys/endian.h+3-1| ... | ... | @@ -56,7 +56,9 @@ typedef	__uint64_t	uint64_t; |
| 56 | 56 | /* |
| 57 | 57 | * Note: While tempting to try to avoid namespace pollution from this file, |
| 58 | 58 | * several software packages assume these marcos are defined, even when it |
| 59 | * defines _POSIX_C_SOURCE to request an unpolluted namespace. | |
| 59 | * defines _POSIX_C_SOURCE to request an unpolluted namespace. <sys/endian.h> | |
| 60 | * is not defined by any version of POSIX.1, so we don't have to be | |
| 61 | * careful. No POSIX.1 defined header file includes <sys/endian.h> on FreeBSD. | |
| 60 | 62 | */ |
| 61 | 63 | |
| 62 | 64 | /* |
lib/libc/include/generic-freebsd/sys/errno.h-2| ... | ... | @@ -32,8 +32,6 @@ |
| 32 | 32 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 33 | 33 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 34 | 34 | * SUCH DAMAGE. |
| 35 | * | |
| 36 | *	@(#)errno.h	8.5 (Berkeley) 1/21/94 | |
| 37 | 35 | */ |
| 38 | 36 | |
| 39 | 37 | #ifndef _SYS_ERRNO_H_ |
lib/libc/include/generic-freebsd/sys/event.h+19-3| ... | ... | @@ -45,7 +45,9 @@ |
| 45 | 45 | #define EVFILT_USER		(-11)	/* User events */ |
| 46 | 46 | #define EVFILT_SENDFILE		(-12)	/* attached to sendfile requests */ |
| 47 | 47 | #define EVFILT_EMPTY		(-13)	/* empty send socket buf */ |
| 48 | #define EVFILT_SYSCOUNT		13 | |
| 48 | #define EVFILT_JAIL		(-14)	/* attached to struct prison */ | |
| 49 | #define EVFILT_JAILDESC		(-15)	/* attached to jail descriptors */ | |
| 50 | #define EVFILT_SYSCOUNT		15 | |
| 49 | 51 | |
| 50 | 52 | #if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L |
| 51 | 53 | #define	EV_SET(kevp_, a, b, c, d, e, f) do {	\ |
| ... | ... | @@ -101,7 +103,7 @@ struct freebsd11_kevent { |
| 101 | 103 | }; |
| 102 | 104 | #endif |
| 103 | 105 | |
| 104 | #if defined(_WANT_KEVENT32) || (defined(_KERNEL) && defined(__LP64__)) | |
| 106 | #if defined(_WANT_KEVENT32) || defined(_KERNEL) | |
| 105 | 107 | struct kevent32 { |
| 106 | 108 | 	__uint32_t	ident;		/* identifier for this event */ |
| 107 | 109 | 	short		filter;		/* filter for event */ |
| ... | ... | @@ -205,10 +207,18 @@ struct freebsd11_kevent32 { |
| 205 | 207 | #define	NOTE_PDATAMASK	0x000fffff		/* mask for pid */ |
| 206 | 208 | |
| 207 | 209 | /* additional flags for EVFILT_PROC */ |
| 208 | #define	NOTE_TRACK	0x00000001		/* follow across forks */ | |
| 210 | #define	NOTE_TRACK	0x00000001		/* follow across fork/create */ | |
| 209 | 211 | #define	NOTE_TRACKERR	0x00000002		/* could not track child */ |
| 210 | 212 | #define	NOTE_CHILD	0x00000004		/* am a child process */ |
| 211 | 213 | |
| 214 | /* data/hint flags for EVFILT_JAIL and EVFILT_JAILDESC */ | |
| 215 | #define	NOTE_JAIL_CHILD		0x80000000	/* child jail was created */ | |
| 216 | #define	NOTE_JAIL_SET		0x40000000	/* jail was modified */ | |
| 217 | #define	NOTE_JAIL_ATTACH	0x20000000	/* jail was attached to */ | |
| 218 | #define	NOTE_JAIL_REMOVE	0x10000000	/* jail was removed */ | |
| 219 | #define NOTE_JAIL_MULTI		0x08000000	/* multiple child or attach */ | |
| 220 | #define	NOTE_JAIL_CTRLMASK	0xf0000000	/* mask for hint bits */ | |
| 221 | ||
| 212 | 222 | /* additional flags for EVFILT_TIMER */ |
| 213 | 223 | #define NOTE_SECONDS		0x00000001	/* data is seconds */ |
| 214 | 224 | #define NOTE_MSECONDS		0x00000002	/* data is milliseconds */ |
| ... | ... | @@ -262,12 +272,17 @@ struct knlist { |
| 262 | 272 | #define EVENT_REGISTER	1 |
| 263 | 273 | #define EVENT_PROCESS	2 |
| 264 | 274 | |
| 275 | struct kinfo_knote; | |
| 276 | struct proc; | |
| 277 | ||
| 265 | 278 | struct filterops { |
| 266 | 279 | 	int	f_isfd;		/* true if ident == filedescriptor */ |
| 267 | 280 | 	int	(*f_attach)(struct knote *kn); |
| 268 | 281 | 	void	(*f_detach)(struct knote *kn); |
| 269 | 282 | 	int	(*f_event)(struct knote *kn, long hint); |
| 270 | 283 | 	void	(*f_touch)(struct knote *kn, struct kevent *kev, u_long type); |
| 284 | 	int	(*f_userdump)(struct proc *p, struct knote *kn, | |
| 285 | 		 struct kinfo_knote *kin); | |
| 271 | 286 | }; |
| 272 | 287 | |
| 273 | 288 | /* |
| ... | ... | @@ -304,6 +319,7 @@ struct knote { |
| 304 | 319 | 		struct		proc *p_proc;	/* proc pointer */ |
| 305 | 320 | 		struct		kaiocb *p_aio;	/* AIO job pointer */ |
| 306 | 321 | 		struct		aioliojob *p_lio;	/* LIO job pointer */ |
| 322 | 		struct		prison *p_prison;	/* prison pointer */ | |
| 307 | 323 | 		void		*p_v;		/* generic other pointer */ |
| 308 | 324 | 	} kn_ptr; |
| 309 | 325 | 	const struct		filterops *kn_fop; |
lib/libc/include/generic-freebsd/sys/eventhandler.h+5| ... | ... | @@ -326,4 +326,9 @@ struct ifaddr; |
| 326 | 326 | typedef void (*rt_addrmsg_fn)(void *, struct ifaddr *, int); |
| 327 | 327 | EVENTHANDLER_DECLARE(rt_addrmsg, rt_addrmsg_fn); |
| 328 | 328 | |
| 329 | /* Kernel environment variable change event */ | |
| 330 | typedef void (*env_change_fn)(void *, const char *); | |
| 331 | EVENTHANDLER_DECLARE(setenv, env_change_fn); | |
| 332 | EVENTHANDLER_DECLARE(unsetenv, env_change_fn); | |
| 333 | ||
| 329 | 334 | #endif /* _SYS_EVENTHANDLER_H_ */ |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/sys/exec.h-22| ... | ... | @@ -32,8 +32,6 @@ |
| 32 | 32 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 33 | 33 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 34 | 34 | * SUCH DAMAGE. |
| 35 | * | |
| 36 | *	@(#)exec.h	8.3 (Berkeley) 1/21/94 | |
| 37 | 35 | */ |
| 38 | 36 | |
| 39 | 37 | #ifndef _SYS_EXEC_H_ |
| ... | ... | @@ -59,16 +57,6 @@ struct ps_strings { |
| 59 | 57 | 	unsigned int ps_nenvstr; /* the number of environment strings */ |
| 60 | 58 | }; |
| 61 | 59 | |
| 62 | /* Coredump output parameters. */ | |
| 63 | struct coredump_params { | |
| 64 | 	off_t		offset; | |
| 65 | 	struct ucred	*active_cred; | |
| 66 | 	struct ucred	*file_cred; | |
| 67 | 	struct thread	*td; | |
| 68 | 	struct vnode	*vp; | |
| 69 | 	struct compressor *comp; | |
| 70 | }; | |
| 71 | ||
| 72 | 60 | struct image_params; |
| 73 | 61 | |
| 74 | 62 | struct execsw { |
| ... | ... | @@ -107,16 +95,6 @@ int exec_unregister(const struct execsw *); |
| 107 | 95 | |
| 108 | 96 | enum uio_seg; |
| 109 | 97 | |
| 110 | #define CORE_BUF_SIZE (16 * 1024) | |
| 111 | ||
| 112 | int core_write(struct coredump_params *, const void *, size_t, off_t, | |
| 113 | enum uio_seg, size_t *); | |
| 114 | int core_output(char *, size_t, off_t, struct coredump_params *, void *); | |
| 115 | int sbuf_drain_core_output(void *, const char *, int); | |
| 116 | ||
| 117 | extern int coredump_pack_fileinfo; | |
| 118 | extern int coredump_pack_vmmapinfo; | |
| 119 | ||
| 120 | 98 | /* |
| 121 | 99 | * note: name##_mod cannot be const storage because the |
| 122 | 100 | * linker_file_sysinit() function modifies _file in the |
lib/libc/include/generic-freebsd/sys/exterr_cat.h created+25| ... | ... | @@ -0,0 +1,25 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-2-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 2025 The FreeBSD Foundation | |
| 5 | * All rights reserved. | |
| 6 | * | |
| 7 | * This software were developed by Konstantin Belousov <kib@FreeBSD.org> | |
| 8 | * under sponsorship from the FreeBSD Foundation. | |
| 9 | */ | |
| 10 | ||
| 11 | #ifndef _SYS_EXTERR_CAT_H_ | |
| 12 | #define	_SYS_EXTERR_CAT_H_ | |
| 13 | ||
| 14 | #define	EXTERR_CAT_MMAP		1 | |
| 15 | #define	EXTERR_CAT_FILEDESC	2 | |
| 16 | #define	EXTERR_KTRACE		3	/* To allow inclusion of this | |
| 17 | 					 file into kern_ktrace.c */ | |
| 18 | #define	EXTERR_CAT_FUSE		4 | |
| 19 | #define	EXTERR_CAT_INOTIFY	5 | |
| 20 | #define	EXTERR_CAT_GENIO	6 | |
| 21 | #define	EXTERR_CAT_BRIDGE	7 | |
| 22 | #define	EXTERR_CAT_SWAP		8 | |
| 23 | #define	EXTERR_CAT_VFSSYSCALL	9 | |
| 24 | ||
| 25 | #endif | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/sys/exterrvar.h created+67| ... | ... | @@ -0,0 +1,67 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-2-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 2025 The FreeBSD Foundation | |
| 5 | * All rights reserved. | |
| 6 | * | |
| 7 | * This software were developed by Konstantin Belousov <kib@FreeBSD.org> | |
| 8 | * under sponsorship from the FreeBSD Foundation. | |
| 9 | */ | |
| 10 | ||
| 11 | #ifndef _SYS_EXTERRVAR_H_ | |
| 12 | #define	_SYS_EXTERRVAR_H_ | |
| 13 | ||
| 14 | #include <sys/_exterr.h> | |
| 15 | #include <sys/_uexterror.h> | |
| 16 | #include <sys/exterr_cat.h> | |
| 17 | ||
| 18 | #define	UEXTERROR_MAXLEN	256 | |
| 19 | ||
| 20 | #define	UEXTERROR_VER		0x10010002 | |
| 21 | ||
| 22 | #define	EXTERRCTL_ENABLE	1 | |
| 23 | #define	EXTERRCTL_DISABLE	2 | |
| 24 | #define	EXTERRCTL_UD		3 | |
| 25 | ||
| 26 | #define	EXTERRCTLF_FORCE	0x00000001 | |
| 27 | ||
| 28 | #ifdef _KERNEL | |
| 29 | ||
| 30 | #ifndef EXTERR_CATEGORY | |
| 31 | #error "Specify error category before including sys/exterrvar.h" | |
| 32 | #endif | |
| 33 | ||
| 34 | #ifdef	EXTERR_STRINGS | |
| 35 | #define	SET_ERROR_MSG(mmsg)	(mmsg) | |
| 36 | #else | |
| 37 | #define	SET_ERROR_MSG(mmsg)	NULL | |
| 38 | #endif | |
| 39 | ||
| 40 | #define	_SET_ERROR2(eerror, mmsg, pp1, pp2)				\ | |
| 41 | 	exterr_set(eerror, EXTERR_CATEGORY, SET_ERROR_MSG(mmsg),	\ | |
| 42 | 	 (uintptr_t)(pp1), (uintptr_t)(pp2), __LINE__) | |
| 43 | #define	_SET_ERROR0(eerror, mmsg)	_SET_ERROR2(eerror, mmsg, 0, 0) | |
| 44 | #define	_SET_ERROR1(eerror, mmsg, pp1)	_SET_ERROR2(eerror, mmsg, pp1, 0) | |
| 45 | ||
| 46 | #define	_EXTERROR_MACRO(eerror, mmsg, _1, _2, NAME, ...)		\ | |
| 47 | 	NAME | |
| 48 | #define	EXTERROR(...)							\ | |
| 49 | 	_EXTERROR_MACRO(__VA_ARGS__, _SET_ERROR2, _SET_ERROR1,		\ | |
| 50 | 	 _SET_ERROR0)(__VA_ARGS__) | |
| 51 | ||
| 52 | int exterr_set(int eerror, int category, const char *mmsg, uintptr_t pp1, | |
| 53 | uintptr_t pp2, int line); | |
| 54 | int exterr_to_ue(struct thread *td, struct uexterror *ue); | |
| 55 | void ktrexterr(struct thread *td); | |
| 56 | ||
| 57 | #else	/* _KERNEL */ | |
| 58 | ||
| 59 | #include <sys/types.h> | |
| 60 | ||
| 61 | __BEGIN_DECLS | |
| 62 | int exterrctl(u_int op, u_int flags, void *ptr); | |
| 63 | __END_DECLS | |
| 64 | ||
| 65 | #endif	/* _KERNEL */ | |
| 66 | ||
| 67 | #endif | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/sys/fbio.h-2| ... | ... | @@ -31,8 +31,6 @@ |
| 31 | 31 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 32 | 32 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 33 | 33 | * SUCH DAMAGE. |
| 34 | * | |
| 35 | *	@(#)fbio.h	8.2 (Berkeley) 10/30/93 | |
| 36 | 34 | */ |
| 37 | 35 | |
| 38 | 36 | #ifndef _SYS_FBIO_H_ |
lib/libc/include/generic-freebsd/sys/fcntl.h+31-2| ... | ... | @@ -32,8 +32,6 @@ |
| 32 | 32 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 33 | 33 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 34 | 34 | * SUCH DAMAGE. |
| 35 | * | |
| 36 | *	@(#)fcntl.h	8.3 (Berkeley) 1/21/94 | |
| 37 | 35 | */ |
| 38 | 36 | |
| 39 | 37 | #ifndef _SYS_FCNTL_H_ |
| ... | ... | @@ -142,8 +140,24 @@ typedef	__pid_t		pid_t; |
| 142 | 140 | #define	O_DSYNC		0x01000000	/* POSIX data sync */ |
| 143 | 141 | #if __BSD_VISIBLE |
| 144 | 142 | #define	O_EMPTY_PATH	0x02000000 |
| 143 | #define	O_NAMEDATTR	0x04000000	/* NFSv4 named attributes */ | |
| 144 | #define	O_XATTR		O_NAMEDATTR	/* Solaris compatibility */ | |
| 145 | #endif | |
| 146 | ||
| 147 | #if __POSIX_VISIBLE >= 202405 | |
| 148 | #define	O_CLOFORK	0x08000000 | |
| 145 | 149 | #endif |
| 146 | 150 | |
| 151 | /* | |
| 152 | * !!! DANGER !!! | |
| 153 | * | |
| 154 | * There are very few bits left for O_* flags. Every bit we consume for | |
| 155 | * local features is one bit we can't use for future source compatibility | |
| 156 | * with other operating systems. | |
| 157 | * | |
| 158 | * All additions should be coordinated with srcmgr@. | |
| 159 | */ | |
| 160 | ||
| 147 | 161 | /* |
| 148 | 162 | * XXX missing O_RSYNC. |
| 149 | 163 | */ |
| ... | ... | @@ -270,6 +284,16 @@ typedef	__pid_t		pid_t; |
| 270 | 284 | #define	F_GET_SEALS	20 |
| 271 | 285 | #define	F_ISUNIONSTACK	21		/* Kludge for libc, don't use it. */ |
| 272 | 286 | #define	F_KINFO		22		/* Return kinfo_file for this fd */ |
| 287 | #endif	/* __BSD_VISIBLE */ | |
| 288 | ||
| 289 | #if __POSIX_VISIBLE >= 202405 | |
| 290 | #define	F_DUPFD_CLOFORK	23		/* Like F_DUPFD, but FD_CLOFORK is set */ | |
| 291 | #endif | |
| 292 | ||
| 293 | #if __BSD_VISIBLE | |
| 294 | #define F_DUP3FD	24		/* Used with dup3() */ | |
| 295 | ||
| 296 | #define F_DUP3FD_SHIFT	16		/* Shift used for F_DUP3FD */ | |
| 273 | 297 | |
| 274 | 298 | /* Seals (F_ADD_SEALS, F_GET_SEALS). */ |
| 275 | 299 | #define	F_SEAL_SEAL	0x0001		/* Prevent adding sealings */ |
| ... | ... | @@ -280,6 +304,11 @@ typedef	__pid_t		pid_t; |
| 280 | 304 | |
| 281 | 305 | /* file descriptor flags (F_GETFD, F_SETFD) */ |
| 282 | 306 | #define	FD_CLOEXEC	1		/* close-on-exec flag */ |
| 307 | #define	FD_RESOLVE_BENEATH 2		/* all lookups relative to fd have | |
| 308 | 					 O_RESOLVE_BENEATH semantics */ | |
| 309 | #if __POSIX_VISIBLE >= 202405 | |
| 310 | #define	FD_CLOFORK	4		/* close-on-fork flag */ | |
| 311 | #endif | |
| 283 | 312 | |
| 284 | 313 | /* record locking flags (F_GETLK, F_SETLK, F_SETLKW) */ |
| 285 | 314 | #define	F_RDLCK		1		/* shared or read lock */ |
lib/libc/include/generic-freebsd/sys/file.h+34-26| ... | ... | @@ -27,8 +27,6 @@ |
| 27 | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | * | |
| 31 | *	@(#)file.h	8.3 (Berkeley) 1/9/95 | |
| 32 | 30 | */ |
| 33 | 31 | |
| 34 | 32 | #ifndef _SYS_FILE_H_ |
| ... | ... | @@ -39,13 +37,16 @@ |
| 39 | 37 | #include <sys/fcntl.h> |
| 40 | 38 | #include <sys/unistd.h> |
| 41 | 39 | #else |
| 42 | #include <sys/queue.h> | |
| 43 | #include <sys/refcount.h> | |
| 40 | #include <sys/errno.h> | |
| 44 | 41 | #include <sys/_lock.h> |
| 45 | 42 | #include <sys/_mutex.h> |
| 43 | #include <sys/_null.h> | |
| 44 | #include <sys/queue.h> | |
| 45 | #include <sys/refcount.h> | |
| 46 | 46 | #include <vm/vm.h> |
| 47 | 47 | |
| 48 | 48 | struct filedesc; |
| 49 | struct proc; | |
| 49 | 50 | struct stat; |
| 50 | 51 | struct thread; |
| 51 | 52 | struct uio; |
| ... | ... | @@ -70,6 +71,8 @@ struct nameidata; |
| 70 | 71 | #define	DTYPE_PROCDESC	12	/* process descriptor */ |
| 71 | 72 | #define	DTYPE_EVENTFD	13	/* eventfd */ |
| 72 | 73 | #define	DTYPE_TIMERFD	14	/* timerfd */ |
| 74 | #define	DTYPE_INOTIFY	15	/* inotify descriptor */ | |
| 75 | #define	DTYPE_JAILDESC	16	/* jail descriptor */ | |
| 73 | 76 | |
| 74 | 77 | #ifdef _KERNEL |
| 75 | 78 | |
| ... | ... | @@ -85,6 +88,8 @@ struct ucred; |
| 85 | 88 | #define	FOF_NEXTOFF_W	0x08	/* Also update f_nextoff[UIO_WRITE] */ |
| 86 | 89 | #define	FOF_NOUPDATE	0x10	/* Do not update f_offset */ |
| 87 | 90 | off_t foffset_lock(struct file *fp, int flags); |
| 91 | void foffset_lock_pair(struct file *fp1, off_t *off1p, struct file *fp2, | |
| 92 | off_t *off2p, int flags); | |
| 88 | 93 | void foffset_lock_uio(struct file *fp, struct uio *uio, int flags); |
| 89 | 94 | void foffset_unlock(struct file *fp, off_t val, int flags); |
| 90 | 95 | void foffset_unlock_uio(struct file *fp, struct uio *uio, int flags); |
| ... | ... | @@ -156,7 +161,7 @@ struct fileops { |
| 156 | 161 | 	fo_fallocate_t	*fo_fallocate; |
| 157 | 162 | 	fo_fspacectl_t	*fo_fspacectl; |
| 158 | 163 | 	fo_cmp_t	*fo_cmp; |
| 159 | 	fo_spare_t	*fo_spares[7];	/* Spare slots */ | |
| 164 | 	fo_spare_t	*fo_spares[8];	/* Spare slots */ | |
| 160 | 165 | 	fo_flags_t	fo_flags;	/* DFLAG_* below */ |
| 161 | 166 | }; |
| 162 | 167 | |
| ... | ... | @@ -188,11 +193,11 @@ struct file { |
| 188 | 193 | 	volatile u_int	f_flag;		/* see fcntl.h */ |
| 189 | 194 | 	volatile u_int 	f_count;	/* reference count */ |
| 190 | 195 | 	void		*f_data;	/* file descriptor specific data */ |
| 191 | 	struct fileops	*f_ops;		/* File operations */ | |
| 196 | 	const struct fileops *f_ops;	/* File operations */ | |
| 192 | 197 | 	struct vnode 	*f_vnode;	/* NULL or applicable vnode */ |
| 193 | 198 | 	struct ucred	*f_cred;	/* associated credentials. */ |
| 194 | 199 | 	short		f_type;		/* descriptor type */ |
| 195 | 	short		f_vnread_flags; /* (f) Sleep lock for f_offset */ | |
| 200 | 	short		f_vflags;	/* (f) Sleep lock flags for members */ | |
| 196 | 201 | 	/* |
| 197 | 202 | 	 * DTYPE_VNODE specific fields. |
| 198 | 203 | 	 */ |
| ... | ... | @@ -215,8 +220,8 @@ struct file { |
| 215 | 220 | #define	f_cdevpriv	f_vnun.fvn_cdevpriv |
| 216 | 221 | #define	f_advice	f_vnun.fvn_advice |
| 217 | 222 | |
| 218 | #define	FOFFSET_LOCKED 0x1 | |
| 219 | #define	FOFFSET_LOCK_WAITING 0x2 | |
| 223 | #define	FILE_V_FOFFSET_LOCKED		0x0001 | |
| 224 | #define	FILE_V_FOFFSET_LOCK_WAITING	0x0002 | |
| 220 | 225 | #endif /* __BSD_VISIBLE */ |
| 221 | 226 | |
| 222 | 227 | #endif /* _KERNEL || _WANT_FILE */ |
| ... | ... | @@ -248,24 +253,27 @@ struct xfile { |
| 248 | 253 | |
| 249 | 254 | #ifdef _KERNEL |
| 250 | 255 | |
| 251 | extern struct fileops vnops; | |
| 252 | extern struct fileops badfileops; | |
| 253 | extern struct fileops path_fileops; | |
| 254 | extern struct fileops socketops; | |
| 256 | extern const struct fileops vnops; | |
| 257 | extern const struct fileops badfileops; | |
| 258 | extern const struct fileops path_fileops; | |
| 259 | extern const struct fileops socketops; | |
| 255 | 260 | extern int maxfiles;		/* kernel limit on number of open files */ |
| 256 | 261 | extern int maxfilesperproc;	/* per process limit on number of open files */ |
| 257 | 262 | |
| 258 | int fget(struct thread *td, int fd, cap_rights_t *rightsp, struct file **fpp); | |
| 259 | int fget_mmap(struct thread *td, int fd, cap_rights_t *rightsp, | |
| 263 | int fget(struct thread *td, int fd, const cap_rights_t *rightsp, | |
| 264 | struct file **fpp); | |
| 265 | int fget_mmap(struct thread *td, int fd, const cap_rights_t *rightsp, | |
| 260 | 266 | vm_prot_t *maxprotp, struct file **fpp); |
| 261 | int fget_read(struct thread *td, int fd, cap_rights_t *rightsp, | |
| 267 | int fget_read(struct thread *td, int fd, const cap_rights_t *rightsp, | |
| 262 | 268 | struct file **fpp); |
| 263 | int fget_write(struct thread *td, int fd, cap_rights_t *rightsp, | |
| 269 | int fget_write(struct thread *td, int fd, const cap_rights_t *rightsp, | |
| 264 | 270 | struct file **fpp); |
| 265 | int fget_fcntl(struct thread *td, int fd, cap_rights_t *rightsp, | |
| 271 | int fget_fcntl(struct thread *td, int fd, const cap_rights_t *rightsp, | |
| 266 | 272 | int needfcntl, struct file **fpp); |
| 267 | 273 | int _fdrop(struct file *fp, struct thread *td); |
| 268 | 274 | int fget_remote(struct thread *td, struct proc *p, int fd, struct file **fpp); |
| 275 | int fget_remote_foreach(struct thread *td, struct proc *p, | |
| 276 | int (*fn)(struct proc *, int, struct file *, void *), void *arg); | |
| 269 | 277 | |
| 270 | 278 | fo_rdwr_t	invfo_rdwr; |
| 271 | 279 | fo_truncate_t	invfo_truncate; |
| ... | ... | @@ -283,19 +291,19 @@ fo_kqfilter_t	vn_kqfilter_opath; |
| 283 | 291 | int vn_fill_kinfo_vnode(struct vnode *vp, struct kinfo_file *kif); |
| 284 | 292 | int file_kcmp_generic(struct file *fp1, struct file *fp2, struct thread *td); |
| 285 | 293 | |
| 286 | void finit(struct file *, u_int, short, void *, struct fileops *); | |
| 287 | void finit_vnode(struct file *, u_int, void *, struct fileops *); | |
| 288 | int fgetvp(struct thread *td, int fd, cap_rights_t *rightsp, | |
| 294 | void finit(struct file *, u_int, short, void *, const struct fileops *); | |
| 295 | void finit_vnode(struct file *, u_int, void *, const struct fileops *); | |
| 296 | int fgetvp(struct thread *td, int fd, const cap_rights_t *rightsp, | |
| 289 | 297 | struct vnode **vpp); |
| 290 | int fgetvp_exec(struct thread *td, int fd, cap_rights_t *rightsp, | |
| 298 | int fgetvp_exec(struct thread *td, int fd, const cap_rights_t *rightsp, | |
| 291 | 299 | struct vnode **vpp); |
| 292 | int fgetvp_rights(struct thread *td, int fd, cap_rights_t *needrightsp, | |
| 300 | int fgetvp_rights(struct thread *td, int fd, const cap_rights_t *needrightsp, | |
| 293 | 301 | struct filecaps *havecaps, struct vnode **vpp); |
| 294 | int fgetvp_read(struct thread *td, int fd, cap_rights_t *rightsp, | |
| 302 | int fgetvp_read(struct thread *td, int fd, const cap_rights_t *rightsp, | |
| 295 | 303 | struct vnode **vpp); |
| 296 | int fgetvp_write(struct thread *td, int fd, cap_rights_t *rightsp, | |
| 304 | int fgetvp_write(struct thread *td, int fd, const cap_rights_t *rightsp, | |
| 297 | 305 | struct vnode **vpp); |
| 298 | int fgetvp_lookup_smr(struct nameidata *ndp, struct vnode **vpp, bool *fsearch); | |
| 306 | int fgetvp_lookup_smr(struct nameidata *ndp, struct vnode **vpp, int *flagsp); | |
| 299 | 307 | int fgetvp_lookup(struct nameidata *ndp, struct vnode **vpp); |
| 300 | 308 | |
| 301 | 309 | static __inline __result_use_check bool |
lib/libc/include/generic-freebsd/sys/filedesc.h+17-12| ... | ... | @@ -27,8 +27,6 @@ |
| 27 | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | * | |
| 31 | *	@(#)filedesc.h	8.1 (Berkeley) 6/2/93 | |
| 32 | 30 | */ |
| 33 | 31 | |
| 34 | 32 | #ifndef _SYS_FILEDESC_H_ |
| ... | ... | @@ -150,6 +148,8 @@ struct filedesc_to_leader { |
| 150 | 148 | * Per-process open flags. |
| 151 | 149 | */ |
| 152 | 150 | #define	UF_EXCLOSE	0x01		/* auto-close on exec */ |
| 151 | #define	UF_RESOLVE_BENEATH 0x02		/* lookups must be beneath this dir */ | |
| 152 | #define	UF_FOCLOSE	0x04		/* auto-close on fork */ | |
| 153 | 153 | |
| 154 | 154 | #ifdef _KERNEL |
| 155 | 155 | |
| ... | ... | @@ -222,6 +222,7 @@ enum { |
| 222 | 222 | |
| 223 | 223 | /* Flags for kern_dup(). */ |
| 224 | 224 | #define	FDDUP_FLAG_CLOEXEC	0x1	/* Atomically set UF_EXCLOSE. */ |
| 225 | #define	FDDUP_FLAG_CLOFORK	0x2	/* Atomically set UF_FOCLOSE. */ | |
| 225 | 226 | |
| 226 | 227 | /* For backward compatibility. */ |
| 227 | 228 | #define	falloc(td, resultfp, resultfd, flags) \ |
| ... | ... | @@ -277,22 +278,26 @@ struct filedesc_to_leader * |
| 277 | 278 | struct filedesc_to_leader * |
| 278 | 279 | 	filedesc_to_leader_share(struct filedesc_to_leader *fdtol, |
| 279 | 280 | 	 struct filedesc *fdp); |
| 280 | int	getvnode(struct thread *td, int fd, cap_rights_t *rightsp, | |
| 281 | 	 struct file **fpp); | |
| 282 | int	getvnode_path(struct thread *td, int fd, cap_rights_t *rightsp, | |
| 281 | int	getvnode(struct thread *td, int fd, const cap_rights_t *rightsp, | |
| 283 | 282 | 	 struct file **fpp); |
| 283 | int	getvnode_path(struct thread *td, int fd, const cap_rights_t *rightsp, | |
| 284 | 	 uint8_t *flagsp, struct file **fpp); | |
| 284 | 285 | void	mountcheckdirs(struct vnode *olddp, struct vnode *newdp); |
| 285 | 286 | |
| 286 | int	fget_cap_noref(struct filedesc *fdp, int fd, cap_rights_t *needrightsp, | |
| 287 | 	 struct file **fpp, struct filecaps *havecapsp); | |
| 288 | int	fget_cap(struct thread *td, int fd, cap_rights_t *needrightsp, | |
| 289 | 	 struct file **fpp, struct filecaps *havecapsp); | |
| 287 | int	fget_cap_noref(struct filedesc *fdp, int fd, | |
| 288 | 	 const cap_rights_t *needrightsp, struct file **fpp, | |
| 289 | 	 struct filecaps *havecapsp); | |
| 290 | int	fget_cap(struct thread *td, int fd, const cap_rights_t *needrightsp, | |
| 291 | 	 uint8_t *flagsp, struct file **fpp, struct filecaps *havecapsp); | |
| 290 | 292 | /* Return a referenced file from an unlocked descriptor. */ |
| 291 | int	fget_unlocked(struct thread *td, int fd, cap_rights_t *needrightsp, | |
| 293 | int	fget_unlocked(struct thread *td, int fd, | |
| 294 | 	 const cap_rights_t *needrightsp, struct file **fpp); | |
| 295 | int	fget_unlocked_flags(struct thread *td, int fd, | |
| 296 | 	 const cap_rights_t *needrightsp, uint8_t *flagsp, | |
| 292 | 297 | 	 struct file **fpp); |
| 293 | 298 | /* Return a file pointer without a ref. FILEDESC_IS_ONLY_USER must be true. */ |
| 294 | int	fget_only_user(struct filedesc *fdp, int fd, cap_rights_t *needrightsp, | |
| 295 | 	 struct file **fpp); | |
| 299 | int	fget_only_user(struct filedesc *fdp, int fd, | |
| 300 | 	 const cap_rights_t *needrightsp, struct file **fpp); | |
| 296 | 301 | #define	fput_only_user(fdp, fp)	({					\ |
| 297 | 302 | 	MPASS(FILEDESC_IS_ONLY_USER(fdp));				\ |
| 298 | 303 | 	MPASS(refcount_load(&fp->f_count) > 0);				\ |
lib/libc/include/generic-freebsd/sys/filio.h-2| ... | ... | @@ -32,8 +32,6 @@ |
| 32 | 32 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 33 | 33 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 34 | 34 | * SUCH DAMAGE. |
| 35 | * | |
| 36 | *	@(#)filio.h	8.1 (Berkeley) 3/28/94 | |
| 37 | 35 | */ |
| 38 | 36 | |
| 39 | 37 | #ifndef	_SYS_FILIO_H_ |
lib/libc/include/generic-freebsd/sys/gmon.h-2| ... | ... | @@ -27,8 +27,6 @@ |
| 27 | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | * | |
| 31 | *	@(#)gmon.h	8.2 (Berkeley) 1/4/94 | |
| 32 | 30 | */ |
| 33 | 31 | |
| 34 | 32 | #ifndef _SYS_GMON_H_ |
lib/libc/include/generic-freebsd/sys/hwt.h created+129| ... | ... | @@ -0,0 +1,129 @@ |
| 1 | /*- | |
| 2 | * Copyright (c) 2023-2025 Ruslan Bukin <br@bsdpad.com> | |
| 3 | * | |
| 4 | * This work was supported by Innovate UK project 105694, "Digital Security | |
| 5 | * by Design (DSbD) Technology Platform Prototype". | |
| 6 | * | |
| 7 | * Redistribution and use in source and binary forms, with or without | |
| 8 | * modification, are permitted provided that the following conditions | |
| 9 | * are met: | |
| 10 | * 1. Redistributions of source code must retain the above copyright | |
| 11 | * notice, this list of conditions and the following disclaimer. | |
| 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 13 | * notice, this list of conditions and the following disclaimer in the | |
| 14 | * documentation and/or other materials provided with the distribution. | |
| 15 | * | |
| 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |
| 17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
| 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | |
| 20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
| 21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
| 22 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
| 23 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
| 24 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
| 25 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
| 26 | * SUCH DAMAGE. | |
| 27 | */ | |
| 28 | ||
| 29 | /* User-visible header. */ | |
| 30 | ||
| 31 | #include <sys/param.h> | |
| 32 | #include <sys/cpuset.h> | |
| 33 | #include <sys/types.h> | |
| 34 | #include <sys/hwt_record.h> | |
| 35 | ||
| 36 | #ifndef _SYS_HWT_H_ | |
| 37 | #define _SYS_HWT_H_ | |
| 38 | ||
| 39 | #define	HWT_MAGIC		0x42 | |
| 40 | #define	HWT_IOC_ALLOC		_IOW(HWT_MAGIC, 0x00, struct hwt_alloc) | |
| 41 | #define	HWT_IOC_START		_IOW(HWT_MAGIC, 0x01, struct hwt_start) | |
| 42 | #define	HWT_IOC_STOP		_IOW(HWT_MAGIC, 0x02, struct hwt_stop) | |
| 43 | #define	HWT_IOC_RECORD_GET	_IOW(HWT_MAGIC, 0x03, struct hwt_record_get) | |
| 44 | #define	HWT_IOC_BUFPTR_GET	_IOW(HWT_MAGIC, 0x04, struct hwt_bufptr_get) | |
| 45 | #define	HWT_IOC_SET_CONFIG	_IOW(HWT_MAGIC, 0x05, struct hwt_set_config) | |
| 46 | #define	HWT_IOC_WAKEUP		_IOW(HWT_MAGIC, 0x06, struct hwt_wakeup) | |
| 47 | #define	HWT_IOC_SVC_BUF		_IOW(HWT_MAGIC, 0x07, struct hwt_svc_buf) | |
| 48 | ||
| 49 | #define	HWT_BACKEND_MAXNAMELEN	256 | |
| 50 | ||
| 51 | #define	HWT_MODE_THREAD		1 | |
| 52 | #define	HWT_MODE_CPU		2 | |
| 53 | ||
| 54 | struct hwt_alloc { | |
| 55 | 	size_t		bufsize; | |
| 56 | 	int		mode; | |
| 57 | 	pid_t		pid;		/* thread mode */ | |
| 58 | 	cpuset_t	*cpu_map;	/* cpu mode only */ | |
| 59 | 	size_t		cpusetsize; | |
| 60 | 	const char	*backend_name; | |
| 61 | 	int		*ident; | |
| 62 | 	int		kqueue_fd; | |
| 63 | } __aligned(16); | |
| 64 | ||
| 65 | struct hwt_start { | |
| 66 | 	int		reserved; | |
| 67 | } __aligned(16); | |
| 68 | ||
| 69 | struct hwt_stop { | |
| 70 | 	int		reserved; | |
| 71 | } __aligned(16); | |
| 72 | ||
| 73 | struct hwt_wakeup { | |
| 74 | 	int		reserved; | |
| 75 | } __aligned(16); | |
| 76 | ||
| 77 | struct hwt_record_user_entry { | |
| 78 | 	enum hwt_record_type	record_type; | |
| 79 | 	union { | |
| 80 | 		/* | |
| 81 | 		 * Used for MMAP, EXECUTABLE, INTERP, | |
| 82 | 		 * and KERNEL records. | |
| 83 | 		 */ | |
| 84 | 		struct { | |
| 85 | 			char fullpath[MAXPATHLEN]; | |
| 86 | 			uintptr_t addr; | |
| 87 | 			uintptr_t baseaddr; | |
| 88 | 		}; | |
| 89 | 		/* Used for BUFFER records. */ | |
| 90 | 		struct { | |
| 91 | 			int buf_id; | |
| 92 | 			int curpage; | |
| 93 | 			vm_offset_t offset; | |
| 94 | 		}; | |
| 95 | 		/* Used for THREAD_* records. */ | |
| 96 | 		int thread_id; | |
| 97 | 	}; | |
| 98 | } __aligned(16); | |
| 99 | ||
| 100 | struct hwt_record_get { | |
| 101 | 	struct hwt_record_user_entry	*records; | |
| 102 | 	int				*nentries; | |
| 103 | 	int wait; | |
| 104 | } __aligned(16); | |
| 105 | ||
| 106 | struct hwt_bufptr_get { | |
| 107 | 	int		*ident; | |
| 108 | 	vm_offset_t	*offset; | |
| 109 | 	uint64_t	*data; | |
| 110 | } __aligned(16); | |
| 111 | ||
| 112 | struct hwt_set_config { | |
| 113 | 	/* Configuration of ctx. */ | |
| 114 | 	int			pause_on_mmap; | |
| 115 | ||
| 116 | 	/* The following passed to backend as is. */ | |
| 117 | 	void			*config; | |
| 118 | 	size_t			config_size; | |
| 119 | 	int			config_version; | |
| 120 | } __aligned(16); | |
| 121 | ||
| 122 | struct hwt_svc_buf { | |
| 123 | 	/* The following passed to backend as is. */ | |
| 124 | 	void			*data; | |
| 125 | 	size_t			data_size; | |
| 126 | 	int			data_version; | |
| 127 | } __aligned(16); | |
| 128 | ||
| 129 | #endif /* !_SYS_HWT_H_ */ | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/sys/hwt_record.h created+70| ... | ... | @@ -0,0 +1,70 @@ |
| 1 | /*- | |
| 2 | * Copyright (c) 2023-2025 Ruslan Bukin <br@bsdpad.com> | |
| 3 | * | |
| 4 | * This work was supported by Innovate UK project 105694, "Digital Security | |
| 5 | * by Design (DSbD) Technology Platform Prototype". | |
| 6 | * | |
| 7 | * Redistribution and use in source and binary forms, with or without | |
| 8 | * modification, are permitted provided that the following conditions | |
| 9 | * are met: | |
| 10 | * 1. Redistributions of source code must retain the above copyright | |
| 11 | * notice, this list of conditions and the following disclaimer. | |
| 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 13 | * notice, this list of conditions and the following disclaimer in the | |
| 14 | * documentation and/or other materials provided with the distribution. | |
| 15 | * | |
| 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |
| 17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
| 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | |
| 20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
| 21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
| 22 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
| 23 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
| 24 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
| 25 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
| 26 | * SUCH DAMAGE. | |
| 27 | */ | |
| 28 | ||
| 29 | /* User-visible header. */ | |
| 30 | ||
| 31 | #ifndef _SYS_HWT_RECORD_H_ | |
| 32 | #define _SYS_HWT_RECORD_H_ | |
| 33 | ||
| 34 | enum hwt_record_type { | |
| 35 | 	HWT_RECORD_MMAP, | |
| 36 | 	HWT_RECORD_MUNMAP, | |
| 37 | 	HWT_RECORD_EXECUTABLE, | |
| 38 | 	HWT_RECORD_KERNEL, | |
| 39 | 	HWT_RECORD_THREAD_CREATE, | |
| 40 | 	HWT_RECORD_THREAD_SET_NAME, | |
| 41 | 	HWT_RECORD_BUFFER | |
| 42 | }; | |
| 43 | ||
| 44 | #ifdef _KERNEL | |
| 45 | struct hwt_record_entry { | |
| 46 | 	TAILQ_ENTRY(hwt_record_entry)	next; | |
| 47 | 	enum hwt_record_type record_type; | |
| 48 | 	union { | |
| 49 | 		/* | |
| 50 | 		 * Used for MMAP, EXECUTABLE, INTERP, | |
| 51 | 		 * and KERNEL records. | |
| 52 | 		 */ | |
| 53 | 		struct { | |
| 54 | 			char *fullpath; | |
| 55 | 			uintptr_t addr; | |
| 56 | 			uintptr_t baseaddr; | |
| 57 | 		}; | |
| 58 | 		/* Used for BUFFER records. */ | |
| 59 | 		struct { | |
| 60 | 			int buf_id; | |
| 61 | 			int curpage; | |
| 62 | 			vm_offset_t offset; | |
| 63 | 		}; | |
| 64 | 		/* Used for THREAD_* records. */ | |
| 65 | 		int thread_id; | |
| 66 | 	}; | |
| 67 | }; | |
| 68 | #endif | |
| 69 | ||
| 70 | #endif /* !_SYS_HWT_RECORD_H_ */ | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/sys/imgact.h+1-2| ... | ... | @@ -119,8 +119,7 @@ int	exec_map_stack(struct image_params *); |
| 119 | 119 | int	exec_new_vmspace(struct image_params *, struct sysentvec *); |
| 120 | 120 | void	exec_setregs(struct thread *, struct image_params *, uintptr_t); |
| 121 | 121 | int	exec_shell_imgact(struct image_params *); |
| 122 | int	exec_copyin_args(struct image_args *, const char *, enum uio_seg, | |
| 123 | 	char **, char **); | |
| 122 | int	exec_copyin_args(struct image_args *, const char *, char **, char **); | |
| 124 | 123 | int	pre_execve(struct thread *td, struct vmspace **oldvmspace); |
| 125 | 124 | void	post_execve(struct thread *td, int error, struct vmspace *oldvmspace); |
| 126 | 125 | #endif |
lib/libc/include/generic-freebsd/sys/imgact_aout.h-2| ... | ... | @@ -27,8 +27,6 @@ |
| 27 | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | * | |
| 31 | *	from: @(#)exec.h	8.1 (Berkeley) 6/11/93 | |
| 32 | 30 | */ |
| 33 | 31 | |
| 34 | 32 | #ifndef	_IMGACT_AOUT_H_ |
lib/libc/include/generic-freebsd/sys/imgact_elf.h+7-6| ... | ... | @@ -45,6 +45,7 @@ |
| 45 | 45 | {(pos)->a_type = (id); (pos)->a_un.a_ptr = (ptr); (pos)++;} |
| 46 | 46 | #endif |
| 47 | 47 | |
| 48 | struct coredump_writer; | |
| 48 | 49 | struct image_params; |
| 49 | 50 | struct thread; |
| 50 | 51 | struct vnode; |
| ... | ... | @@ -86,8 +87,8 @@ typedef struct { |
| 86 | 87 | 	const char *interp_newpath; |
| 87 | 88 | 	int flags; |
| 88 | 89 | 	Elf_Brandnote *brand_note; |
| 89 | 	bool		(*header_supported)(struct image_params *, | |
| 90 | 	 int32_t *, uint32_t *); | |
| 90 | 	bool		(*header_supported)(const struct image_params *, | |
| 91 | 	 const int32_t *, const uint32_t *); | |
| 91 | 92 | 		/* High 8 bits of flags is private to the ABI */ |
| 92 | 93 | #define	BI_CAN_EXEC_DYN		0x0001 |
| 93 | 94 | #define	BI_BRAND_NOTE		0x0002	/* May have note.ABI-tag section. */ |
| ... | ... | @@ -114,7 +115,7 @@ bool	__elfN(brand_inuse)(Elf_Brandinfo *entry); |
| 114 | 115 | int	__elfN(insert_brand_entry)(Elf_Brandinfo *entry); |
| 115 | 116 | int	__elfN(remove_brand_entry)(Elf_Brandinfo *entry); |
| 116 | 117 | int	__elfN(freebsd_fixup)(uintptr_t *, struct image_params *); |
| 117 | int	__elfN(coredump)(struct thread *, struct vnode *, off_t, int); | |
| 118 | int	__elfN(coredump)(struct thread *, struct coredump_writer *, off_t, int); | |
| 118 | 119 | size_t	__elfN(populate_note)(int, void *, void *, size_t, void **); |
| 119 | 120 | int	__elfN(freebsd_copyout_auxargs)(struct image_params *, uintptr_t); |
| 120 | 121 | void	__elfN(puthdr)(struct thread *, void *, size_t, int, size_t, int); |
| ... | ... | @@ -123,9 +124,9 @@ void	__elfN(prepare_notes)(struct thread *, struct note_info_list *, |
| 123 | 124 | void	__elfN(size_segments)(struct thread *, struct sseg_closure *, int); |
| 124 | 125 | size_t	__elfN(register_note)(struct thread *, struct note_info_list *, |
| 125 | 126 | 	 int, outfunc_t, void *); |
| 126 | bool	__elfN(parse_notes)(struct image_params *, Elf_Note *, const char *, | |
| 127 | 	 const Elf_Phdr *, bool (*)(const Elf_Note *, void *, bool *), | |
| 128 | 	 void *); | |
| 127 | bool	__elfN(parse_notes)(const struct image_params *, const Elf_Note *, | |
| 128 | 	 const char *, const Elf_Phdr *, | |
| 129 | 	 bool (*)(const Elf_Note *, void *, bool *), void *); | |
| 129 | 130 | |
| 130 | 131 | /* Machine specific function to dump per-thread information. */ |
| 131 | 132 | void	__elfN(dump_thread)(struct thread *, void *, size_t *); |
lib/libc/include/generic-freebsd/sys/inotify.h created+158| ... | ... | @@ -0,0 +1,158 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-2-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 2025 Klara, Inc. | |
| 5 | */ | |
| 6 | ||
| 7 | #ifndef _INOTIFY_H_ | |
| 8 | #define _INOTIFY_H_ | |
| 9 | ||
| 10 | #include <sys/_types.h> | |
| 11 | ||
| 12 | /* Flags for inotify_init1(). */ | |
| 13 | #define	IN_NONBLOCK	0x00000004	/* O_NONBLOCK */ | |
| 14 | #define	IN_CLOEXEC	0x00100000	/* O_CLOEXEC */ | |
| 15 | ||
| 16 | struct inotify_event { | |
| 17 | 	int		wd; | |
| 18 | 	__uint32_t	mask; | |
| 19 | 	__uint32_t	cookie; | |
| 20 | 	__uint32_t	len; | |
| 21 | 	char		name[0]; | |
| 22 | }; | |
| 23 | ||
| 24 | /* Events, set in the mask field. */ | |
| 25 | #define	IN_ACCESS		0x00000001 | |
| 26 | #define	IN_MODIFY		0x00000002 | |
| 27 | #define	IN_ATTRIB		0x00000004 | |
| 28 | #define	IN_CLOSE_WRITE		0x00000008 | |
| 29 | #define	IN_CLOSE_NOWRITE	0x00000010 | |
| 30 | #define	IN_CLOSE		(IN_CLOSE_WRITE | IN_CLOSE_NOWRITE) | |
| 31 | #define	IN_OPEN			0x00000020 | |
| 32 | #define	IN_MOVED_FROM		0x00000040 | |
| 33 | #define	IN_MOVED_TO		0x00000080 | |
| 34 | #define	IN_MOVE			(IN_MOVED_FROM | IN_MOVED_TO) | |
| 35 | #define	IN_CREATE		0x00000100 | |
| 36 | #define	IN_DELETE		0x00000200 | |
| 37 | #define	IN_DELETE_SELF		0x00000400 | |
| 38 | #define	IN_MOVE_SELF		0x00000800 | |
| 39 | #define	IN_ALL_EVENTS		0x00000fff | |
| 40 | ||
| 41 | /* Events report only for entries in a watched dir, not the dir itself. */ | |
| 42 | #define	_IN_DIR_EVENTS		(IN_CLOSE_WRITE | IN_DELETE | IN_MODIFY | \ | |
| 43 | 				 IN_MOVED_FROM | IN_MOVED_TO) | |
| 44 | ||
| 45 | #ifdef _KERNEL | |
| 46 | /* | |
| 47 | * An unlink that's done as part of a rename only records IN_DELETE if the | |
| 48 | * unlinked vnode itself is watched, and not when the containing directory is | |
| 49 | * watched. | |
| 50 | */ | |
| 51 | #define	_IN_MOVE_DELETE		0x40000000 | |
| 52 | /* | |
| 53 | * Inode link count changes only trigger IN_ATTRIB events if the inode itself is | |
| 54 | * watched, and not when the containing directory is watched. | |
| 55 | */ | |
| 56 | #define	_IN_ATTRIB_LINKCOUNT	0x80000000 | |
| 57 | #endif | |
| 58 | ||
| 59 | /* Flags, set in the mask field. */ | |
| 60 | #define	IN_ONLYDIR		0x01000000 | |
| 61 | #define	IN_DONT_FOLLOW		0x02000000 | |
| 62 | #define	IN_EXCL_UNLINK		0x04000000 | |
| 63 | #define	IN_MASK_CREATE		0x10000000 | |
| 64 | #define	IN_MASK_ADD		0x20000000 | |
| 65 | #define	IN_ONESHOT		0x80000000 | |
| 66 | #define	_IN_ALL_FLAGS		(IN_ONLYDIR | IN_DONT_FOLLOW |		\ | |
| 67 | 				 IN_EXCL_UNLINK | IN_MASK_CREATE |	\ | |
| 68 | 				 IN_MASK_ADD | IN_ONESHOT) | |
| 69 | ||
| 70 | /* Flags returned by the kernel. */ | |
| 71 | #define	IN_UNMOUNT		0x00002000 | |
| 72 | #define	IN_Q_OVERFLOW		0x00004000 | |
| 73 | #define	IN_IGNORED		0x00008000 | |
| 74 | #define	IN_ISDIR		0x40000000 | |
| 75 | #define	_IN_ALL_RETFLAGS	(IN_Q_OVERFLOW | IN_UNMOUNT | IN_IGNORED | \ | |
| 76 | 				 IN_ISDIR) | |
| 77 | ||
| 78 | #define	_IN_ALIGN		_Alignof(struct inotify_event) | |
| 79 | #define	_IN_NAMESIZE(namelen)	\ | |
| 80 | 	((namelen) == 0 ? 0 : __align_up((namelen) + 1, _IN_ALIGN)) | |
| 81 | ||
| 82 | #ifdef _KERNEL | |
| 83 | struct componentname; | |
| 84 | struct file; | |
| 85 | struct inotify_softc; | |
| 86 | struct thread; | |
| 87 | struct vnode; | |
| 88 | ||
| 89 | int	inotify_create_file(struct thread *, struct file *, int, int *); | |
| 90 | void	inotify_log(struct vnode *, const char *, size_t, int, __uint32_t); | |
| 91 | ||
| 92 | int	kern_inotify_rm_watch(int, uint32_t, struct thread *); | |
| 93 | int	kern_inotify_add_watch(int, int, const char *, uint32_t, | |
| 94 | 	 struct thread *); | |
| 95 | ||
| 96 | void	vn_inotify(struct vnode *, struct vnode *, struct componentname *, int, | |
| 97 | 	 uint32_t); | |
| 98 | int	vn_inotify_add_watch(struct vnode *, struct inotify_softc *, | |
| 99 | 	 __uint32_t, __uint32_t *, struct thread *); | |
| 100 | void	vn_inotify_revoke(struct vnode *); | |
| 101 | ||
| 102 | /* Log an inotify event. */ | |
| 103 | #define	INOTIFY(vp, ev) do {						\ | |
| 104 | 	if (__predict_false((vn_irflag_read(vp) & (VIRF_INOTIFY |	\ | |
| 105 | 	 VIRF_INOTIFY_PARENT)) != 0))				\ | |
| 106 | 		VOP_INOTIFY((vp), NULL, NULL, (ev), 0);			\ | |
| 107 | } while (0) | |
| 108 | ||
| 109 | /* Log an inotify event using a specific name for the vnode. */ | |
| 110 | #define	INOTIFY_NAME_LOCK(vp, dvp, cnp, ev, lock) do {			\ | |
| 111 | 	if (__predict_false((vn_irflag_read(vp) & VIRF_INOTIFY) != 0 ||	\ | |
| 112 | 	 (vn_irflag_read(dvp) & VIRF_INOTIFY) != 0)) {		\ | |
| 113 | 		if (lock)						\ | |
| 114 | 			vn_lock((vp), LK_SHARED | LK_RETRY);		\ | |
| 115 | 		VOP_INOTIFY((vp), (dvp), (cnp), (ev), 0);		\ | |
| 116 | 		if (lock)						\ | |
| 117 | 			VOP_UNLOCK(vp);					\ | |
| 118 | 	}								\ | |
| 119 | } while (0) | |
| 120 | #define	INOTIFY_NAME(vp, dvp, cnp, ev)					\ | |
| 121 | 	INOTIFY_NAME_LOCK((vp), (dvp), (cnp), (ev), false) | |
| 122 | ||
| 123 | extern __uint32_t inotify_rename_cookie; | |
| 124 | ||
| 125 | #define	INOTIFY_MOVE(vp, fdvp, fcnp, tvp, tdvp, tcnp) do {		\ | |
| 126 | 	if (__predict_false((vn_irflag_read(fdvp) & VIRF_INOTIFY) != 0 || \ | |
| 127 | 	 (vn_irflag_read(tdvp) & VIRF_INOTIFY) != 0 ||		\ | |
| 128 | 	 (vn_irflag_read(vp) & VIRF_INOTIFY) != 0)) {		\ | |
| 129 | 		__uint32_t cookie;					\ | |
| 130 | 									\ | |
| 131 | 		cookie = atomic_fetchadd_32(&inotify_rename_cookie, 1);	\ | |
| 132 | 		VOP_INOTIFY((vp), (fdvp), (fcnp), IN_MOVED_FROM, cookie); \ | |
| 133 | 		VOP_INOTIFY((vp), (tdvp), (tcnp), IN_MOVED_TO, cookie);	\ | |
| 134 | 	}								\ | |
| 135 | 	if ((tvp) != NULL)						\ | |
| 136 | 		INOTIFY_NAME_LOCK((tvp), (tdvp), (tcnp),		\ | |
| 137 | 		 _IN_MOVE_DELETE, true);				\ | |
| 138 | } while (0) | |
| 139 | ||
| 140 | #define	INOTIFY_REVOKE(vp) do {						\ | |
| 141 | 	if (__predict_false((vn_irflag_read(vp) & VIRF_INOTIFY) != 0))	\ | |
| 142 | 		vn_inotify_revoke((vp));				\ | |
| 143 | } while (0) | |
| 144 | ||
| 145 | #else | |
| 146 | #include <sys/cdefs.h> | |
| 147 | ||
| 148 | __BEGIN_DECLS | |
| 149 | int	inotify_init(void); | |
| 150 | int	inotify_init1(int flags); | |
| 151 | int	inotify_add_watch(int fd, const char *pathname, __uint32_t mask); | |
| 152 | int	inotify_add_watch_at(int fd, int dfd, const char *pathname, | |
| 153 | 	 __uint32_t mask); | |
| 154 | int	inotify_rm_watch(int fd, int wd); | |
| 155 | __END_DECLS | |
| 156 | #endif /* !_KERNEL */ | |
| 157 | ||
| 158 | #endif /* !_INOTIFY_H_ */ | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/sys/interrupt.h+4-3| ... | ... | @@ -121,7 +121,7 @@ struct intr_event { |
| 121 | 121 | 	int		ie_count;	/* Loop counter. */ |
| 122 | 122 | 	int		ie_warncnt;	/* Rate-check interrupt storm warns. */ |
| 123 | 123 | 	struct timeval	ie_warntm; |
| 124 | 	int		ie_irq;		/* Physical irq number if !SOFT. */ | |
| 124 | 	u_int		ie_irq;		/* Physical irq number if !SOFT. */ | |
| 125 | 125 | 	int		ie_cpu;		/* CPU this event is bound to. */ |
| 126 | 126 | 	volatile int	ie_phase;	/* Switched to establish a barrier. */ |
| 127 | 127 | 	volatile int	ie_active[2];	/* Filters in ISR context. */ |
| ... | ... | @@ -129,6 +129,7 @@ struct intr_event { |
| 129 | 129 | |
| 130 | 130 | /* Interrupt event flags kept in ie_flags. */ |
| 131 | 131 | #define	IE_SOFT		0x000001	/* Software interrupt. */ |
| 132 | #define	IE_SLEEPABLE	0x000002	/* Sleepable ithread */ | |
| 132 | 133 | #define	IE_ADDING_THREAD 0x000004	/* Currently building an ithread. */ |
| 133 | 134 | |
| 134 | 135 | /* Flags to pass to swi_sched. */ |
| ... | ... | @@ -175,7 +176,7 @@ struct _cpuset; |
| 175 | 176 | int	intr_event_bind_ithread_cpuset(struct intr_event *ie, |
| 176 | 177 | 	 struct _cpuset *mask); |
| 177 | 178 | int	intr_event_create(struct intr_event **event, void *source, |
| 178 | 	 int flags, int irq, void (*pre_ithread)(void *), | |
| 179 | 	 int flags, u_int irq, void (*pre_ithread)(void *), | |
| 179 | 180 | 	 void (*post_ithread)(void *), void (*post_filter)(void *), |
| 180 | 181 | 	 int (*assign_cpu)(void *, int), const char *fmt, ...) |
| 181 | 182 | 	 __printflike(9, 10); |
| ... | ... | @@ -188,7 +189,7 @@ int	intr_event_suspend_handler(void *cookie); |
| 188 | 189 | int	intr_event_resume_handler(void *cookie); |
| 189 | 190 | int	intr_getaffinity(int irq, int mode, void *mask); |
| 190 | 191 | void	*intr_handler_source(void *cookie); |
| 191 | int	intr_setaffinity(int irq, int mode, void *mask); | |
| 192 | int	intr_setaffinity(int irq, int mode, const void *mask); | |
| 192 | 193 | void	_intr_drain(int irq); /* LinuxKPI only. */ |
| 193 | 194 | int	swi_add(struct intr_event **eventp, const char *name, |
| 194 | 195 | 	 driver_intr_t handler, void *arg, int pri, enum intr_type flags, |
lib/libc/include/generic-freebsd/sys/intr.h+11-3| ... | ... | @@ -33,10 +33,12 @@ |
| 33 | 33 | #error Need INTRNG for this file |
| 34 | 34 | #endif |
| 35 | 35 | |
| 36 | #include <sys/systm.h> | |
| 36 | #include <machine/intr.h> | |
| 37 | 37 | |
| 38 | 38 | #define	INTR_IRQ_INVALID	0xFFFFFFFF |
| 39 | 39 | |
| 40 | #ifndef LOCORE | |
| 41 | ||
| 40 | 42 | enum intr_map_data_type { |
| 41 | 43 | 	INTR_MAP_DATA_ACPI = 0, |
| 42 | 44 | 	INTR_MAP_DATA_FDT, |
| ... | ... | @@ -110,12 +112,13 @@ u_int intr_irq_next_cpu(u_int current_cpu, cpuset_t *cpumask); |
| 110 | 112 | |
| 111 | 113 | struct intr_pic *intr_pic_register(device_t, intptr_t); |
| 112 | 114 | int intr_pic_deregister(device_t, intptr_t); |
| 113 | int intr_pic_claim_root(device_t, intptr_t, intr_irq_filter_t *, void *); | |
| 115 | int intr_pic_claim_root(device_t, intptr_t, intr_irq_filter_t *, void *, | |
| 116 | uint32_t); | |
| 114 | 117 | int intr_pic_add_handler(device_t, struct intr_pic *, |
| 115 | 118 | intr_child_irq_filter_t *, void *, uintptr_t, uintptr_t); |
| 116 | 119 | bool intr_is_per_cpu(struct resource *); |
| 117 | 120 | |
| 118 | extern device_t intr_irq_root_dev; | |
| 121 | device_t intr_irq_root_device(uint32_t); | |
| 119 | 122 | |
| 120 | 123 | /* Intr interface for BUS. */ |
| 121 | 124 | |
| ... | ... | @@ -163,4 +166,9 @@ void intr_ipi_send(cpuset_t cpus, u_int ipi); |
| 163 | 166 | void intr_ipi_dispatch(u_int ipi); |
| 164 | 167 | #endif |
| 165 | 168 | |
| 169 | /* Main interrupt handler called from asm on most archs except riscv. */ | |
| 170 | void intr_irq_handler(struct trapframe *tf, uint32_t rootnum); | |
| 171 | ||
| 172 | #endif /* !LOCORE */ | |
| 173 | ||
| 166 | 174 | #endif	/* _SYS_INTR_H */ |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/sys/ioccom.h-2| ... | ... | @@ -27,8 +27,6 @@ |
| 27 | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | * | |
| 31 | *	@(#)ioccom.h	8.3 (Berkeley) 1/9/95 | |
| 32 | 30 | */ |
| 33 | 31 | |
| 34 | 32 | #ifndef	_SYS_IOCCOM_H_ |
lib/libc/include/generic-freebsd/sys/ioctl.h-2| ... | ... | @@ -32,8 +32,6 @@ |
| 32 | 32 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 33 | 33 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 34 | 34 | * SUCH DAMAGE. |
| 35 | * | |
| 36 | *	@(#)ioctl.h	8.6 (Berkeley) 3/28/94 | |
| 37 | 35 | */ |
| 38 | 36 | |
| 39 | 37 | #ifndef	_SYS_IOCTL_H_ |
lib/libc/include/generic-freebsd/sys/ioctl_compat.h-2| ... | ... | @@ -32,8 +32,6 @@ |
| 32 | 32 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 33 | 33 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 34 | 34 | * SUCH DAMAGE. |
| 35 | * | |
| 36 | *	@(#)ioctl_compat.h	8.4 (Berkeley) 1/21/94 | |
| 37 | 35 | */ |
| 38 | 36 | |
| 39 | 37 | #ifndef _SYS_IOCTL_COMPAT_H_ |
lib/libc/include/generic-freebsd/sys/ipc.h-2| ... | ... | @@ -37,8 +37,6 @@ |
| 37 | 37 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 38 | 38 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 39 | 39 | * SUCH DAMAGE. |
| 40 | * | |
| 41 | *	@(#)ipc.h	8.4 (Berkeley) 2/19/95 | |
| 42 | 40 | */ |
| 43 | 41 | |
| 44 | 42 | /* |
lib/libc/include/generic-freebsd/sys/jail.h+61-23| ... | ... | @@ -99,8 +99,12 @@ enum prison_state { |
| 99 | 99 | #define	JAIL_UPDATE	0x02	/* Update parameters of existing jail */ |
| 100 | 100 | #define	JAIL_ATTACH	0x04	/* Attach to jail upon creation */ |
| 101 | 101 | #define	JAIL_DYING	0x08	/* Allow getting a dying jail */ |
| 102 | #define	JAIL_SET_MASK	0x0f | |
| 103 | #define	JAIL_GET_MASK	0x08 | |
| 102 | #define JAIL_USE_DESC	0x10	/* Get/set jail in descriptor */ | |
| 103 | #define JAIL_AT_DESC	0x20	/* Find/add jail under descriptor */ | |
| 104 | #define	JAIL_GET_DESC	0x40	/* Return a new jail descriptor */ | |
| 105 | #define	JAIL_OWN_DESC	0x80	/* Return a new owning jail descriptor */ | |
| 106 | #define	JAIL_SET_MASK	0xff	/* JAIL_DYING is deprecated/ignored here */ | |
| 107 | #define	JAIL_GET_MASK	0xf8 | |
| 104 | 108 | |
| 105 | 109 | #define	JAIL_SYS_DISABLE	0 |
| 106 | 110 | #define	JAIL_SYS_NEW		1 |
| ... | ... | @@ -115,7 +119,9 @@ int jail(struct jail *); |
| 115 | 119 | int jail_set(struct iovec *, unsigned int, int); |
| 116 | 120 | int jail_get(struct iovec *, unsigned int, int); |
| 117 | 121 | int jail_attach(int); |
| 122 | int jail_attach_jd(int); | |
| 118 | 123 | int jail_remove(int); |
| 124 | int jail_remove_jd(int); | |
| 119 | 125 | __END_DECLS |
| 120 | 126 | |
| 121 | 127 | #else /* _KERNEL */ |
| ... | ... | @@ -141,6 +147,11 @@ MALLOC_DECLARE(M_PRISON); |
| 141 | 147 | #define	DEFAULT_HOSTUUID	"00000000-0000-0000-0000-000000000000" |
| 142 | 148 | #define	OSRELEASELEN	32 |
| 143 | 149 | |
| 150 | #define	JAIL_META_PRIVATE	"meta" | |
| 151 | #define	JAIL_META_SHARED	"env" | |
| 152 | ||
| 153 | struct jaildesc; | |
| 154 | struct knlist; | |
| 144 | 155 | struct racct; |
| 145 | 156 | struct prison_racct; |
| 146 | 157 | |
| ... | ... | @@ -186,7 +197,9 @@ struct prison { |
| 186 | 197 | 	struct vnode	*pr_root;			/* (c) vnode to rdir */ |
| 187 | 198 | 	struct prison_ip *pr_addrs[PR_FAMILY_MAX];	/* (p,n) IPs of jail */ |
| 188 | 199 | 	struct prison_racct *pr_prison_racct;		/* (c) racct jail proxy */ |
| 189 | 	void		*pr_sparep[3]; | |
| 200 | 	struct knlist	*pr_klist;			/* (m) attached knotes */ | |
| 201 | 	LIST_HEAD(, jaildesc) pr_descs;			/* (a) attached descriptors */ | |
| 202 | 	void		*pr_sparep; | |
| 190 | 203 | 	int		 pr_childcount;			/* (a) number of child jails */ |
| 191 | 204 | 	int		 pr_childmax;			/* (p) maximum child jails */ |
| 192 | 205 | 	unsigned	 pr_allow;			/* (p) PR_ALLOW_* flags */ |
| ... | ... | @@ -253,13 +266,29 @@ struct prison_racct { |
| 253 | 266 | #define	PR_ALLOW_RESERVED_PORTS		0x00008000 |
| 254 | 267 | #define	PR_ALLOW_KMEM_ACCESS		0x00010000	/* reserved, not used yet */ |
| 255 | 268 | #define	PR_ALLOW_NFSD			0x00020000 |
| 256 | #define	PR_ALLOW_ALL_STATIC		0x000387ff | |
| 269 | #define	PR_ALLOW_EXTATTR		0x00040000 | |
| 270 | #define	PR_ALLOW_ADJTIME		0x00080000 | |
| 271 | #define	PR_ALLOW_SETTIME		0x00100000 | |
| 272 | #define	PR_ALLOW_ROUTING		0x00200000 | |
| 273 | #define	PR_ALLOW_UNPRIV_PARENT_TAMPER	0x00400000 | |
| 274 | #define	PR_ALLOW_SETAUDIT		0x00800000 | |
| 275 | ||
| 276 | /* | |
| 277 | * PR_ALLOW_PRISON0 are the allow flags that we apply by default to prison0, | |
| 278 | * while PR_ALLOW_ALL_STATIC are all of the allow bits that we have allocated at | |
| 279 | * build time. PR_ALLOW_ALL_STATIC should contain any bit above that we expect | |
| 280 | * to be used on the system, while PR_ALLOW_PRISON0 will be some subset of that. | |
| 281 | */ | |
| 282 | #define	PR_ALLOW_ALL_STATIC		0x00ff87ff | |
| 283 | #define	PR_ALLOW_PRISON0		\ | |
| 284 | (PR_ALLOW_ALL_STATIC & ~(PR_ALLOW_UNPRIV_PARENT_TAMPER)) | |
| 257 | 285 | |
| 258 | 286 | /* |
| 259 | 287 | * PR_ALLOW_DIFFERENCES determines which flags are able to be |
| 260 | 288 | * different between the parent and child jail upon creation. |
| 261 | 289 | */ |
| 262 | #define	PR_ALLOW_DIFFERENCES		(PR_ALLOW_UNPRIV_DEBUG) | |
| 290 | #define	PR_ALLOW_DIFFERENCES		\ | |
| 291 | (PR_ALLOW_UNPRIV_DEBUG | PR_ALLOW_UNPRIV_PARENT_TAMPER) | |
| 263 | 292 | |
| 264 | 293 | /* |
| 265 | 294 | * OSD methods |
| ... | ... | @@ -373,37 +402,45 @@ extern struct	sx allprison_lock; |
| 373 | 402 | /* |
| 374 | 403 | * Sysctls to describe jail parameters. |
| 375 | 404 | */ |
| 405 | SYSCTL_DECL(_security_jail); | |
| 376 | 406 | SYSCTL_DECL(_security_jail_param); |
| 377 | 407 | |
| 408 | #define SYSCTL_JAIL_PARAM_DECL(name)					\ | |
| 409 | 	SYSCTL_DECL(_security_jail_param_##name) | |
| 378 | 410 | #define	SYSCTL_JAIL_PARAM(module, param, type, fmt, descr)		\ |
| 379 | SYSCTL_PROC(_security_jail_param ## module, OID_AUTO, param,	\ | |
| 380 | 	(type) | CTLFLAG_MPSAFE, NULL, 0, sysctl_jail_param, fmt, descr) | |
| 411 | 	SYSCTL_PROC(_security_jail_param ## module, OID_AUTO, param,	\ | |
| 412 | 	 (type) | CTLFLAG_MPSAFE, NULL, 0, sysctl_jail_param, fmt, descr) | |
| 381 | 413 | #define	SYSCTL_JAIL_PARAM_STRING(module, param, access, len, descr)	\ |
| 382 | SYSCTL_PROC(_security_jail_param ## module, OID_AUTO, param,	\ | |
| 383 | 	CTLTYPE_STRING | CTLFLAG_MPSAFE | (access), NULL, len,		\ | |
| 384 | 	sysctl_jail_param, "A", descr) | |
| 385 | #define	SYSCTL_JAIL_PARAM_STRUCT(module, param, access, len, fmt, descr)\ | |
| 386 | SYSCTL_PROC(_security_jail_param ## module, OID_AUTO, param,	\ | |
| 387 | 	CTLTYPE_STRUCT | CTLFLAG_MPSAFE | (access), NULL, len,		\ | |
| 388 | 	sysctl_jail_param, fmt, descr) | |
| 414 | 	SYSCTL_PROC(_security_jail_param ## module, OID_AUTO, param,	\ | |
| 415 | 	 CTLTYPE_STRING | CTLFLAG_MPSAFE | (access), NULL, len,	\ | |
| 416 | 	 sysctl_jail_param, "A", descr) | |
| 417 | #define	SYSCTL_JAIL_PARAM_STRUCT(module, param, access, len, fmt, descr) \ | |
| 418 | 	SYSCTL_PROC(_security_jail_param ## module, OID_AUTO, param,	\ | |
| 419 | 	 CTLTYPE_STRUCT | CTLFLAG_MPSAFE | (access), NULL, len,	\ | |
| 420 | 	 sysctl_jail_param, fmt, descr) | |
| 389 | 421 | #define	SYSCTL_JAIL_PARAM_NODE(module, descr)				\ |
| 390 | SYSCTL_NODE(_security_jail_param, OID_AUTO, module, CTLFLAG_MPSAFE,	\ | |
| 391 | 0, descr) | |
| 422 | 	SYSCTL_NODE(_security_jail_param, OID_AUTO, module, CTLFLAG_MPSAFE, \ | |
| 423 | 	 0, descr) | |
| 392 | 424 | #define	SYSCTL_JAIL_PARAM_SUBNODE(parent, module, descr)		\ |
| 393 | SYSCTL_NODE(_security_jail_param_##parent, OID_AUTO, module, 	\ | |
| 394 | CTLFLAG_MPSAFE, 0, descr) | |
| 425 | 	SYSCTL_NODE(_security_jail_param_##parent, OID_AUTO, module,	\ | |
| 426 | 	 CTLFLAG_MPSAFE, 0, descr) | |
| 395 | 427 | #define	SYSCTL_JAIL_PARAM_SYS_NODE(module, access, descr)		\ |
| 396 | SYSCTL_JAIL_PARAM_NODE(module, descr);				\ | |
| 397 | SYSCTL_JAIL_PARAM(_##module, , CTLTYPE_INT | (access), "E,jailsys",	\ | |
| 398 | 	descr) | |
| 428 | 	SYSCTL_JAIL_PARAM_NODE(module, descr);				\ | |
| 429 | 	SYSCTL_JAIL_PARAM(_##module, , CTLTYPE_INT | (access), "E,jailsys", \ | |
| 430 | 	 descr) | |
| 431 | #define	SYSCTL_JAIL_PARAM_SYS_SUBNODE(parent, module, access, descr)	\ | |
| 432 | 	SYSCTL_JAIL_PARAM_SUBNODE(parent, module, descr);		\ | |
| 433 | 	SYSCTL_JAIL_PARAM(_##parent##_##module, , CTLTYPE_INT | (access), \ | |
| 434 | 	 "E,jailsys", descr) | |
| 399 | 435 | |
| 400 | 436 | /* |
| 401 | 437 | * Kernel support functions for jail(). |
| 402 | 438 | */ |
| 403 | struct ucred; | |
| 439 | struct knote; | |
| 404 | 440 | struct mount; |
| 405 | 441 | struct sockaddr; |
| 406 | 442 | struct statfs; |
| 443 | struct ucred; | |
| 407 | 444 | struct vfsconf; |
| 408 | 445 | |
| 409 | 446 | /* |
| ... | ... | @@ -421,7 +458,7 @@ void prison0_init(void); |
| 421 | 458 | bool prison_allow(struct ucred *, unsigned); |
| 422 | 459 | int prison_check(struct ucred *cred1, struct ucred *cred2); |
| 423 | 460 | bool prison_check_nfsd(struct ucred *cred); |
| 424 | bool prison_owns_vnet(struct ucred *); | |
| 461 | bool prison_owns_vnet(struct prison *pr); | |
| 425 | 462 | int prison_canseemount(struct ucred *cred, struct mount *mp); |
| 426 | 463 | void prison_enforce_statfs(struct ucred *cred, struct mount *mp, |
| 427 | 464 | struct statfs *sp); |
| ... | ... | @@ -438,6 +475,7 @@ void prison_proc_free(struct prison *); |
| 438 | 475 | void prison_proc_link(struct prison *, struct proc *); |
| 439 | 476 | void prison_proc_unlink(struct prison *, struct proc *); |
| 440 | 477 | void prison_proc_iterate(struct prison *, void (*)(struct proc *, void *), void *); |
| 478 | void prison_remove(struct prison *); | |
| 441 | 479 | void prison_set_allow(struct ucred *cred, unsigned flag, int enable); |
| 442 | 480 | bool prison_ischild(struct prison *, struct prison *); |
| 443 | 481 | bool prison_isalive(const struct prison *); |
lib/libc/include/generic-freebsd/sys/jaildesc.h created+87| ... | ... | @@ -0,0 +1,87 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-2-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 2025 James Gritton. | |
| 5 | * All rights reserved. | |
| 6 | * | |
| 7 | * This software was developed at the University of Cambridge Computer | |
| 8 | * Laboratory with support from a grant from Google, Inc. | |
| 9 | * | |
| 10 | * Redistribution and use in source and binary forms, with or without | |
| 11 | * modification, are permitted provided that the following conditions | |
| 12 | * are met: | |
| 13 | * 1. Redistributions of source code must retain the above copyright | |
| 14 | * notice, this list of conditions and the following disclaimer. | |
| 15 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 16 | * notice, this list of conditions and the following disclaimer in the | |
| 17 | * documentation and/or other materials provided with the distribution. | |
| 18 | * | |
| 19 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |
| 20 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 21 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
| 22 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | |
| 23 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
| 24 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
| 25 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
| 26 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
| 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
| 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
| 29 | * SUCH DAMAGE. | |
| 30 | */ | |
| 31 | ||
| 32 | #ifndef _SYS_JAILDESC_H_ | |
| 33 | #define	_SYS_JAILDESC_H_ | |
| 34 | ||
| 35 | #ifdef _KERNEL | |
| 36 | ||
| 37 | #include <sys/queue.h> | |
| 38 | #include <sys/selinfo.h> | |
| 39 | #include <sys/_lock.h> | |
| 40 | #include <sys/_mutex.h> | |
| 41 | #include <sys/_types.h> | |
| 42 | ||
| 43 | struct prison; | |
| 44 | ||
| 45 | /*- | |
| 46 | * struct jaildesc describes a jail descriptor, which points to a struct | |
| 47 | * prison. struct prison in turn has a linked list of struct jaildesc. | |
| 48 | * | |
| 49 | * Locking key: | |
| 50 | * (c) set on creation, remains unchanged | |
| 51 | * (d) jd_lock | |
| 52 | * (p) jd_prison->pr_mtx | |
| 53 | */ | |
| 54 | struct jaildesc { | |
| 55 | 	LIST_ENTRY(jaildesc) jd_list;	/* (d,p) this prison's descs */ | |
| 56 | 	struct prison	*jd_prison;	/* (d) the prison */ | |
| 57 | 	struct mtx	 jd_lock; | |
| 58 | 	struct selinfo	 jd_selinfo;	/* (d) event notification */ | |
| 59 | 	unsigned	 jd_flags;	/* (d) JDF_* flags */ | |
| 60 | }; | |
| 61 | ||
| 62 | /* | |
| 63 | * Locking macros for the jaildesc. | |
| 64 | */ | |
| 65 | #define	JAILDESC_LOCK_DESTROY(jd)	mtx_destroy(&(jd)->jd_lock) | |
| 66 | #define	JAILDESC_LOCK_INIT(jd)		mtx_init(&(jd)->jd_lock, "jaildesc", \ | |
| 67 | 					 NULL, MTX_DEF) | |
| 68 | #define	JAILDESC_LOCK(jd)		mtx_lock(&(jd)->jd_lock) | |
| 69 | #define	JAILDESC_UNLOCK(jd)		mtx_unlock(&(jd)->jd_lock) | |
| 70 | ||
| 71 | /* | |
| 72 | * Flags for the jd_flags field | |
| 73 | */ | |
| 74 | #define	JDF_SELECTED	0x00000001	/* issue selwakeup() */ | |
| 75 | #define	JDF_REMOVED	0x00000002	/* jail was removed */ | |
| 76 | #define	JDF_OWNING	0x00000004	/* closing descriptor removes jail */ | |
| 77 | ||
| 78 | int jaildesc_find(struct thread *td, int fd, struct prison **prp, | |
| 79 | struct ucred **ucredp); | |
| 80 | int jaildesc_alloc(struct thread *td, struct file **fpp, int *fdp, int owning); | |
| 81 | void jaildesc_set_prison(struct file *jd, struct prison *pr); | |
| 82 | void jaildesc_prison_cleanup(struct prison *pr); | |
| 83 | void jaildesc_knote(struct prison *pr, long hint); | |
| 84 | ||
| 85 | #endif /* _KERNEL */ | |
| 86 | ||
| 87 | #endif /* !_SYS_JAILDESC_H_ */ | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/sys/kassert.h+27-2| ... | ... | @@ -31,12 +31,37 @@ |
| 31 | 31 | #ifndef _SYS_KASSERT_H_ |
| 32 | 32 | #define	_SYS_KASSERT_H_ |
| 33 | 33 | |
| 34 | #include <sys/_types.h> | |
| 34 | 35 | #include <sys/cdefs.h> |
| 35 | 36 | |
| 36 | 37 | #ifdef _KERNEL |
| 37 | 38 | extern const char *panicstr;	/* panic message */ |
| 38 | extern bool panicked; | |
| 39 | #define	KERNEL_PANICKED()	__predict_false(panicked) | |
| 39 | #define	KERNEL_PANICKED()	__predict_false(panicstr != NULL) | |
| 40 | ||
| 41 | /* | |
| 42 | * Trap accesses going through a pointer. | |
| 43 | * | |
| 44 | * Sample usage: you have a struct with numerous fields and by API contract | |
| 45 | * only some of them get populated, even if the implementation temporary writes | |
| 46 | * to them. You can use DEBUG_POISON_POINTER so that the consumer which should | |
| 47 | * no be looking at the field gets caught. | |
| 48 | * | |
| 49 | * DEBUG_POISON_POINTER(obj->ptr); | |
| 50 | * .... | |
| 51 | * if (obj->ptr->field) // traps | |
| 52 | */ | |
| 53 | #ifdef	INVARIANTS | |
| 54 | ||
| 55 | extern void *poisoned_buf; | |
| 56 | #define DEBUG_POISON_POINTER_VALUE poisoned_buf | |
| 57 | ||
| 58 | #define DEBUG_POISON_POINTER(x) ({				\ | |
| 59 | 	x = (DEBUG_POISON_POINTER_VALUE);			\ | |
| 60 | }) | |
| 61 | ||
| 62 | #else | |
| 63 | #define DEBUG_POISON_POINTER(x) | |
| 64 | #endif | |
| 40 | 65 | |
| 41 | 66 | #ifdef	INVARIANTS		/* The option is always available */ |
| 42 | 67 | #define	VNASSERT(exp, vp, msg) do {					\ |
lib/libc/include/generic-freebsd/sys/kernel.h+66-67| ... | ... | @@ -39,8 +39,6 @@ |
| 39 | 39 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 40 | 40 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 41 | 41 | * SUCH DAMAGE. |
| 42 | * | |
| 43 | *	@(#)kernel.h	8.3 (Berkeley) 1/21/94 | |
| 44 | 42 | */ |
| 45 | 43 | |
| 46 | 44 | #ifndef _SYS_KERNEL_H_ |
| ... | ... | @@ -67,7 +65,16 @@ extern int psratio;			/* ratio: prof / stat */ |
| 67 | 65 | extern int stathz;			/* statistics clock's frequency */ |
| 68 | 66 | extern int profhz;			/* profiling clock's frequency */ |
| 69 | 67 | extern int profprocs;			/* number of process's profiling */ |
| 68 | ||
| 69 | /* | |
| 70 | * The ticks and ticksl symbols overlap, giving a 64-bit tick counter on 64-bit | |
| 71 | * platforms while still maintaining compatibility with the legacy 32-bit | |
| 72 | * counter. Either value can be used, but rollover must be handled; at 1000Hz, | |
| 73 | * ticks (and ticksl on 32-bit platforms) roll over roughly every 25 days. On | |
| 74 | * 64-bit platforms, ticksl will not roll over in the foreseeable future. | |
| 75 | */ | |
| 70 | 76 | extern volatile int ticks; |
| 77 | extern volatile long ticksl; | |
| 71 | 78 | |
| 72 | 79 | #endif /* _KERNEL */ |
| 73 | 80 | |
| ... | ... | @@ -86,16 +93,15 @@ extern volatile int ticks; |
| 86 | 93 | * The SI_SUB_LAST value must have the highest lexical value. |
| 87 | 94 | */ |
| 88 | 95 | enum sysinit_sub_id { |
| 89 | 	SI_SUB_DUMMY		= 0x0000000,	/* not executed; for linker*/ | |
| 90 | 	SI_SUB_DONE		= 0x0000001,	/* processed*/ | |
| 96 | 	SI_SUB_DUMMY		= 0x0000000,	/* not executed; for linker */ | |
| 91 | 97 | 	SI_SUB_TUNABLES		= 0x0700000,	/* establish tunable values */ |
| 92 | 	SI_SUB_COPYRIGHT	= 0x0800001,	/* first use of console*/ | |
| 98 | 	SI_SUB_COPYRIGHT	= 0x0800001,	/* first use of console */ | |
| 93 | 99 | 	SI_SUB_VM		= 0x1000000,	/* virtual memory system init */ |
| 94 | 100 | 	SI_SUB_COUNTER		= 0x1100000,	/* counter(9) is initialized */ |
| 95 | 	SI_SUB_KMEM		= 0x1800000,	/* kernel memory*/ | |
| 101 | 	SI_SUB_KMEM		= 0x1800000,	/* kernel memory */ | |
| 96 | 102 | 	SI_SUB_HYPERVISOR	= 0x1A40000,	/* |
| 97 | 103 | 						 * Hypervisor detection and |
| 98 | 						 * virtualization support | |
| 104 | 						 * virtualization support | |
| 99 | 105 | 						 * setup. |
| 100 | 106 | 						 */ |
| 101 | 107 | 	SI_SUB_WITNESS		= 0x1A80000,	/* witness initialization */ |
| ... | ... | @@ -105,7 +111,7 @@ enum sysinit_sub_id { |
| 105 | 111 | 	SI_SUB_VNET_PRELINK	= 0x1E00000,	/* vnet init before modules */ |
| 106 | 112 | 	SI_SUB_KLD		= 0x2000000,	/* KLD and module setup */ |
| 107 | 113 | 	SI_SUB_KHELP		= 0x2080000,	/* khelp modules */ |
| 108 | 	SI_SUB_CPU		= 0x2100000,	/* CPU resource(s)*/ | |
| 114 | 	SI_SUB_CPU		= 0x2100000,	/* CPU resource(s) */ | |
| 109 | 115 | 	SI_SUB_RACCT		= 0x2110000,	/* resource accounting */ |
| 110 | 116 | 	SI_SUB_KDTRACE		= 0x2140000,	/* Kernel dtrace hooks */ |
| 111 | 117 | 	SI_SUB_RANDOM		= 0x2160000,	/* random number generator */ |
| ... | ... | @@ -113,21 +119,21 @@ enum sysinit_sub_id { |
| 113 | 119 | 	SI_SUB_MAC_POLICY	= 0x21C0000,	/* TrustedBSD MAC policies */ |
| 114 | 120 | 	SI_SUB_MAC_LATE		= 0x21D0000,	/* TrustedBSD MAC subsystem */ |
| 115 | 121 | 	SI_SUB_VNET		= 0x21E0000,	/* vnet 0 */ |
| 116 | 	SI_SUB_INTRINSIC	= 0x2200000,	/* proc 0*/ | |
| 117 | 	SI_SUB_VM_CONF		= 0x2300000,	/* config VM, set limits*/ | |
| 122 | 	SI_SUB_INTRINSIC	= 0x2200000,	/* proc 0 */ | |
| 123 | 	SI_SUB_VM_CONF		= 0x2300000,	/* config VM, set limits */ | |
| 118 | 124 | 	SI_SUB_DDB_SERVICES	= 0x2380000,	/* capture, scripting, etc. */ |
| 119 | 	SI_SUB_RUN_QUEUE	= 0x2400000,	/* set up run queue*/ | |
| 125 | 	SI_SUB_RUN_QUEUE	= 0x2400000,	/* set up run queue */ | |
| 120 | 126 | 	SI_SUB_KTRACE		= 0x2480000,	/* ktrace */ |
| 121 | 127 | 	SI_SUB_OPENSOLARIS	= 0x2490000,	/* OpenSolaris compatibility */ |
| 122 | 128 | 	SI_SUB_AUDIT		= 0x24C0000,	/* audit */ |
| 123 | 	SI_SUB_CREATE_INIT	= 0x2500000,	/* create init process*/ | |
| 129 | 	SI_SUB_CREATE_INIT	= 0x2500000,	/* create init process */ | |
| 124 | 130 | 	SI_SUB_SCHED_IDLE	= 0x2600000,	/* required idle procs */ |
| 125 | 131 | 	SI_SUB_MBUF		= 0x2700000,	/* mbuf subsystem */ |
| 126 | 132 | 	SI_SUB_INTR		= 0x2800000,	/* interrupt threads */ |
| 127 | 133 | 	SI_SUB_TASKQ		= 0x2880000,	/* task queues */ |
| 128 | 134 | 	SI_SUB_EPOCH		= 0x2888000,	/* epoch subsystem */ |
| 129 | 135 | #ifdef EARLY_AP_STARTUP |
| 130 | 	SI_SUB_SMP		= 0x2900000,	/* start the APs*/ | |
| 136 | 	SI_SUB_SMP		= 0x2900000,	/* start the APs */ | |
| 131 | 137 | #endif |
| 132 | 138 | 	SI_SUB_SOFTINTR		= 0x2A00000,	/* start soft interrupt thread */ |
| 133 | 139 | 	SI_SUB_DEVFS		= 0x2F00000,	/* devfs ready for devices */ |
| ... | ... | @@ -138,40 +144,40 @@ enum sysinit_sub_id { |
| 138 | 144 | 	SI_SUB_DTRACE_ANON	= 0x308C000,	/* DTrace anon enabling */ |
| 139 | 145 | 	SI_SUB_DRIVERS		= 0x3100000,	/* Let Drivers initialize */ |
| 140 | 146 | 	SI_SUB_CONFIGURE	= 0x3800000,	/* Configure devices */ |
| 141 | 	SI_SUB_VFS		= 0x4000000,	/* virtual filesystem*/ | |
| 142 | 	SI_SUB_CLOCKS		= 0x4800000,	/* real time and stat clocks*/ | |
| 143 | 	SI_SUB_SYSV_SHM		= 0x6400000,	/* System V shared memory*/ | |
| 144 | 	SI_SUB_SYSV_SEM		= 0x6800000,	/* System V semaphores*/ | |
| 145 | 	SI_SUB_SYSV_MSG		= 0x6C00000,	/* System V message queues*/ | |
| 147 | 	SI_SUB_VFS		= 0x4000000,	/* virtual filesystem */ | |
| 148 | 	SI_SUB_CLOCKS		= 0x4800000,	/* real time and stat clocks */ | |
| 149 | 	SI_SUB_SYSV_SHM		= 0x6400000,	/* System V shared memory */ | |
| 150 | 	SI_SUB_SYSV_SEM		= 0x6800000,	/* System V semaphores */ | |
| 151 | 	SI_SUB_SYSV_MSG		= 0x6C00000,	/* System V message queues */ | |
| 146 | 152 | 	SI_SUB_P1003_1B		= 0x6E00000,	/* P1003.1B realtime */ |
| 147 | 	SI_SUB_PSEUDO		= 0x7000000,	/* pseudo devices*/ | |
| 153 | 	SI_SUB_PSEUDO		= 0x7000000,	/* pseudo devices */ | |
| 148 | 154 | 	SI_SUB_EXEC		= 0x7400000,	/* execve() handlers */ |
| 149 | 155 | 	SI_SUB_PROTO_BEGIN	= 0x8000000,	/* VNET initialization */ |
| 150 | 156 | 	SI_SUB_PROTO_PFIL	= 0x8100000,	/* Initialize pfil before FWs */ |
| 151 | 	SI_SUB_PROTO_IF		= 0x8400000,	/* interfaces*/ | |
| 157 | 	SI_SUB_PROTO_IF		= 0x8400000,	/* interfaces */ | |
| 152 | 158 | 	SI_SUB_PROTO_DOMAININIT	= 0x8600000,	/* domain registration system */ |
| 153 | 159 | 	SI_SUB_PROTO_MC		= 0x8700000,	/* Multicast */ |
| 154 | 	SI_SUB_PROTO_DOMAIN	= 0x8800000,	/* domains (address families?)*/ | |
| 160 | 	SI_SUB_PROTO_DOMAIN	= 0x8800000,	/* domains (address families?) */ | |
| 155 | 161 | 	SI_SUB_PROTO_FIREWALL	= 0x8806000,	/* Firewalls */ |
| 156 | 162 | 	SI_SUB_PROTO_IFATTACHDOMAIN = 0x8808000,/* domain dependent data init */ |
| 157 | 163 | 	SI_SUB_PROTO_END	= 0x8ffffff,	/* VNET helper functions */ |
| 158 | 	SI_SUB_KPROF		= 0x9000000,	/* kernel profiling*/ | |
| 159 | 	SI_SUB_KICK_SCHEDULER	= 0xa000000,	/* start the timeout events*/ | |
| 164 | 	SI_SUB_KPROF		= 0x9000000,	/* kernel profiling */ | |
| 165 | 	SI_SUB_KICK_SCHEDULER	= 0xa000000,	/* start the timeout events */ | |
| 160 | 166 | 	SI_SUB_INT_CONFIG_HOOKS	= 0xa800000,	/* Interrupts enabled config */ |
| 161 | 167 | 	SI_SUB_ROOT_CONF	= 0xb000000,	/* Find root devices */ |
| 162 | 	SI_SUB_INTRINSIC_POST	= 0xd000000,	/* proc 0 cleanup*/ | |
| 168 | 	SI_SUB_INTRINSIC_POST	= 0xd000000,	/* proc 0 cleanup */ | |
| 163 | 169 | 	SI_SUB_SYSCALLS		= 0xd800000,	/* register system calls */ |
| 164 | 170 | 	SI_SUB_VNET_DONE	= 0xdc00000,	/* vnet registration complete */ |
| 165 | 	SI_SUB_KTHREAD_INIT	= 0xe000000,	/* init process*/ | |
| 166 | 	SI_SUB_KTHREAD_PAGE	= 0xe400000,	/* pageout daemon*/ | |
| 167 | 	SI_SUB_KTHREAD_VM	= 0xe800000,	/* vm daemon*/ | |
| 168 | 	SI_SUB_KTHREAD_BUF	= 0xea00000,	/* buffer daemon*/ | |
| 169 | 	SI_SUB_KTHREAD_UPDATE	= 0xec00000,	/* update daemon*/ | |
| 170 | 	SI_SUB_KTHREAD_IDLE	= 0xee00000,	/* idle procs*/ | |
| 171 | 	SI_SUB_KTHREAD_INIT	= 0xe000000,	/* init process */ | |
| 172 | 	SI_SUB_KTHREAD_PAGE	= 0xe400000,	/* pageout daemon */ | |
| 173 | 	SI_SUB_KTHREAD_VM	= 0xe800000,	/* vm daemon */ | |
| 174 | 	SI_SUB_KTHREAD_BUF	= 0xea00000,	/* buffer daemon */ | |
| 175 | 	SI_SUB_KTHREAD_UPDATE	= 0xec00000,	/* update daemon */ | |
| 176 | 	SI_SUB_KTHREAD_IDLE	= 0xee00000,	/* idle procs */ | |
| 171 | 177 | #ifndef EARLY_AP_STARTUP |
| 172 | 	SI_SUB_SMP		= 0xf000000,	/* start the APs*/ | |
| 173 | #endif	 | |
| 174 | 	SI_SUB_RACCTD		= 0xf100000,	/* start racctd*/ | |
| 178 | 	SI_SUB_SMP		= 0xf000000,	/* start the APs */ | |
| 179 | #endif | |
| 180 | 	SI_SUB_RACCTD		= 0xf100000,	/* start racctd */ | |
| 175 | 181 | 	SI_SUB_LAST		= 0xfffffff	/* final initialization */ |
| 176 | 182 | }; |
| 177 | 183 | |
| ... | ... | @@ -179,16 +185,16 @@ enum sysinit_sub_id { |
| 179 | 185 | * Some enumerated orders; "ANY" sorts last. |
| 180 | 186 | */ |
| 181 | 187 | enum sysinit_elem_order { |
| 182 | 	SI_ORDER_FIRST		= 0x0000000,	/* first*/ | |
| 183 | 	SI_ORDER_SECOND		= 0x0000001,	/* second*/ | |
| 184 | 	SI_ORDER_THIRD		= 0x0000002,	/* third*/ | |
| 185 | 	SI_ORDER_FOURTH		= 0x0000003,	/* fourth*/ | |
| 186 | 	SI_ORDER_FIFTH		= 0x0000004,	/* fifth*/ | |
| 187 | 	SI_ORDER_SIXTH		= 0x0000005,	/* sixth*/ | |
| 188 | 	SI_ORDER_SEVENTH	= 0x0000006,	/* seventh*/ | |
| 189 | 	SI_ORDER_EIGHTH		= 0x0000007,	/* eighth*/ | |
| 188 | 	SI_ORDER_FIRST		= 0x0000000,	/* first */ | |
| 189 | 	SI_ORDER_SECOND		= 0x0000001,	/* second */ | |
| 190 | 	SI_ORDER_THIRD		= 0x0000002,	/* third */ | |
| 191 | 	SI_ORDER_FOURTH		= 0x0000003,	/* fourth */ | |
| 192 | 	SI_ORDER_FIFTH		= 0x0000004,	/* fifth */ | |
| 193 | 	SI_ORDER_SIXTH		= 0x0000005,	/* sixth */ | |
| 194 | 	SI_ORDER_SEVENTH	= 0x0000006,	/* seventh */ | |
| 195 | 	SI_ORDER_EIGHTH		= 0x0000007,	/* eighth */ | |
| 190 | 196 | 	SI_ORDER_MIDDLE		= 0x1000000,	/* somewhere in the middle */ |
| 191 | 	SI_ORDER_ANY		= 0xfffffff	/* last*/ | |
| 197 | 	SI_ORDER_ANY		= 0xfffffff	/* last */ | |
| 192 | 198 | }; |
| 193 | 199 | |
| 194 | 200 | /* |
| ... | ... | @@ -218,10 +224,10 @@ typedef void (*sysinit_nfunc_t)(void *); |
| 218 | 224 | typedef void (*sysinit_cfunc_t)(const void *); |
| 219 | 225 | |
| 220 | 226 | struct sysinit { |
| 221 | 	enum sysinit_sub_id	subsystem;	/* subsystem identifier*/ | |
| 222 | 	enum sysinit_elem_order	order;		/* init order within subsystem*/ | |
| 227 | 	enum sysinit_sub_id	subsystem;	/* subsystem identifier */ | |
| 228 | 	enum sysinit_elem_order	order;		/* init order within subsystem */ | |
| 223 | 229 | 	STAILQ_ENTRY(sysinit)	next;		/* singly-linked list */ |
| 224 | 	sysinit_cfunc_t func;			/* function		*/ | |
| 230 | 	sysinit_cfunc_t func;			/* function */ | |
| 225 | 231 | 	const void	*udata;			/* multiplexer/argument */ |
| 226 | 232 | }; |
| 227 | 233 | |
| ... | ... | @@ -240,18 +246,11 @@ struct sysinit { |
| 240 | 246 | #ifdef TSLOG |
| 241 | 247 | struct sysinit_tslog { |
| 242 | 248 | 	sysinit_cfunc_t func; |
| 243 | 	const void * data; | |
| 244 | 	const char * name; | |
| 249 | 	const void *data; | |
| 250 | 	const char *name; | |
| 245 | 251 | }; |
| 246 | static inline void | |
| 247 | sysinit_tslog_shim(const void * data) | |
| 248 | { | |
| 249 | 	const struct sysinit_tslog * x = data; | |
| 250 | ||
| 251 | 	TSRAW(curthread, TS_ENTER, "SYSINIT", x->name); | |
| 252 | 	(x->func)(x->data); | |
| 253 | 	TSRAW(curthread, TS_EXIT, "SYSINIT", x->name); | |
| 254 | } | |
| 252 | void sysinit_tslog_shim(const void *); | |
| 253 | ||
| 255 | 254 | #define	C_SYSINIT(uniquifier, subsystem, order, func, ident)	\ |
| 256 | 255 | 	static struct sysinit_tslog uniquifier ## _sys_init_tslog = {	\ |
| 257 | 256 | 		func,						\ |
| ... | ... | @@ -265,7 +264,7 @@ sysinit_tslog_shim(const void * data) |
| 265 | 264 | 		sysinit_tslog_shim,				\ |
| 266 | 265 | 		&uniquifier ## _sys_init_tslog			\ |
| 267 | 266 | 	};							\ |
| 268 | 	DATA_WSET(sysinit_set,uniquifier ## _sys_init) | |
| 267 | 	DATA_WSET(sysinit_set, uniquifier ## _sys_init) | |
| 269 | 268 | #else |
| 270 | 269 | #define	C_SYSINIT(uniquifier, subsystem, order, func, ident)	\ |
| 271 | 270 | 	static struct sysinit uniquifier ## _sys_init = {	\ |
| ... | ... | @@ -275,7 +274,7 @@ sysinit_tslog_shim(const void * data) |
| 275 | 274 | 		func,						\ |
| 276 | 275 | 		(ident)						\ |
| 277 | 276 | 	};							\ |
| 278 | 	DATA_WSET(sysinit_set,uniquifier ## _sys_init) | |
| 277 | 	DATA_WSET(sysinit_set, uniquifier ## _sys_init) | |
| 279 | 278 | #endif |
| 280 | 279 | |
| 281 | 280 | #define	SYSINIT(uniquifier, subsystem, order, func, ident)	\ |
| ... | ... | @@ -293,7 +292,7 @@ sysinit_tslog_shim(const void * data) |
| 293 | 292 | 		func,						\ |
| 294 | 293 | 		(ident)						\ |
| 295 | 294 | 	};							\ |
| 296 | 	DATA_WSET(sysuninit_set,uniquifier ## _sys_uninit) | |
| 295 | 	DATA_WSET(sysuninit_set, uniquifier ## _sys_uninit) | |
| 297 | 296 | |
| 298 | 297 | #define	SYSUNINIT(uniquifier, subsystem, order, func, ident)	\ |
| 299 | 298 | 	C_SYSUNINIT(uniquifier, subsystem, order,		\ |
| ... | ... | @@ -316,7 +315,7 @@ void	sysinit_add(struct sysinit **set, struct sysinit **set_end); |
| 316 | 315 | * int |
| 317 | 316 | * please avoid using for new tunables! |
| 318 | 317 | */ |
| 319 | extern void tunable_int_init(void *); | |
| 318 | extern void tunable_int_init(const void *); | |
| 320 | 319 | struct tunable_int { |
| 321 | 320 | 	const char *path; |
| 322 | 321 | 	int *var; |
| ... | ... | @@ -335,7 +334,7 @@ struct tunable_int { |
| 335 | 334 | /* |
| 336 | 335 | * long |
| 337 | 336 | */ |
| 338 | extern void tunable_long_init(void *); | |
| 337 | extern void tunable_long_init(const void *); | |
| 339 | 338 | struct tunable_long { |
| 340 | 339 | 	const char *path; |
| 341 | 340 | 	long *var; |
| ... | ... | @@ -354,7 +353,7 @@ struct tunable_long { |
| 354 | 353 | /* |
| 355 | 354 | * unsigned long |
| 356 | 355 | */ |
| 357 | extern void tunable_ulong_init(void *); | |
| 356 | extern void tunable_ulong_init(const void *); | |
| 358 | 357 | struct tunable_ulong { |
| 359 | 358 | 	const char *path; |
| 360 | 359 | 	unsigned long *var; |
| ... | ... | @@ -373,7 +372,7 @@ struct tunable_ulong { |
| 373 | 372 | /* |
| 374 | 373 | * int64_t |
| 375 | 374 | */ |
| 376 | extern void tunable_int64_init(void *); | |
| 375 | extern void tunable_int64_init(const void *); | |
| 377 | 376 | struct tunable_int64 { |
| 378 | 377 | 	const char *path; |
| 379 | 378 | 	int64_t *var; |
| ... | ... | @@ -392,7 +391,7 @@ struct tunable_int64 { |
| 392 | 391 | /* |
| 393 | 392 | * uint64_t |
| 394 | 393 | */ |
| 395 | extern void tunable_uint64_init(void *); | |
| 394 | extern void tunable_uint64_init(const void *); | |
| 396 | 395 | struct tunable_uint64 { |
| 397 | 396 | 	const char *path; |
| 398 | 397 | 	uint64_t *var; |
| ... | ... | @@ -411,7 +410,7 @@ struct tunable_uint64 { |
| 411 | 410 | /* |
| 412 | 411 | * quad |
| 413 | 412 | */ |
| 414 | extern void tunable_quad_init(void *); | |
| 413 | extern void tunable_quad_init(const void *); | |
| 415 | 414 | struct tunable_quad { |
| 416 | 415 | 	const char *path; |
| 417 | 416 | 	quad_t *var; |
| ... | ... | @@ -430,7 +429,7 @@ struct tunable_quad { |
| 430 | 429 | /* |
| 431 | 430 | * bool |
| 432 | 431 | */ |
| 433 | extern void tunable_bool_init(void *); | |
| 432 | extern void tunable_bool_init(const void *); | |
| 434 | 433 | struct tunable_bool { |
| 435 | 434 | 	const char *path; |
| 436 | 435 | 	bool *var; |
| ... | ... | @@ -446,7 +445,7 @@ struct tunable_bool { |
| 446 | 445 | |
| 447 | 446 | #define	TUNABLE_BOOL_FETCH(path, var)	getenv_bool((path), (var)) |
| 448 | 447 | |
| 449 | extern void tunable_str_init(void *); | |
| 448 | extern void tunable_str_init(const void *); | |
| 450 | 449 | struct tunable_str { |
| 451 | 450 | 	const char *path; |
| 452 | 451 | 	char *var; |
lib/libc/include/generic-freebsd/sys/kerneldump.h+1| ... | ... | @@ -161,6 +161,7 @@ void dumpsys_pb_progress(size_t); |
| 161 | 161 | extern int do_minidump; |
| 162 | 162 | |
| 163 | 163 | int livedump_start(int, int, uint8_t); |
| 164 | int livedump_start_vnode(struct vnode *, int, uint8_t); | |
| 164 | 165 | |
| 165 | 166 | /* Live minidump events */ |
| 166 | 167 | typedef void (*livedump_start_fn)(void *arg, int *errorp); |
lib/libc/include/generic-freebsd/sys/ktls.h+42-7| ... | ... | @@ -28,8 +28,11 @@ |
| 28 | 28 | #define	_SYS_KTLS_H_ |
| 29 | 29 | |
| 30 | 30 | #ifdef _KERNEL |
| 31 | #include <sys/_null.h> | |
| 31 | 32 | #include <sys/refcount.h> |
| 32 | 33 | #include <sys/_task.h> |
| 34 | ||
| 35 | #include <machine/param.h> | |
| 33 | 36 | #endif |
| 34 | 37 | |
| 35 | 38 | struct tls_record_layer { |
| ... | ... | @@ -142,6 +145,28 @@ struct tls_get_record { |
| 142 | 145 | 	uint16_t tls_length; |
| 143 | 146 | }; |
| 144 | 147 | |
| 148 | #define	XKTLS_SESSION_IV_BUF_LEN	32 | |
| 149 | struct xktls_session_onedir { | |
| 150 | 	uint64_t gen; | |
| 151 | 	uint64_t rsrv1[8]; | |
| 152 | 	uint32_t rsrv2[8]; | |
| 153 | 	uint8_t iv[XKTLS_SESSION_IV_BUF_LEN]; | |
| 154 | 	int	cipher_algorithm; | |
| 155 | 	int	auth_algorithm; | |
| 156 | 	uint16_t cipher_key_len; | |
| 157 | 	uint16_t iv_len; | |
| 158 | 	uint16_t auth_key_len; | |
| 159 | 	uint16_t max_frame_len; | |
| 160 | 	uint8_t tls_vmajor; | |
| 161 | 	uint8_t tls_vminor; | |
| 162 | 	uint8_t tls_hlen; | |
| 163 | 	uint8_t tls_tlen; | |
| 164 | 	uint8_t tls_bs; | |
| 165 | 	uint8_t flags; | |
| 166 | 	uint16_t drv_st_len; | |
| 167 | 	char ifnet[16];	/* IFNAMSIZ */ | |
| 168 | }; | |
| 169 | ||
| 145 | 170 | #ifdef _KERNEL |
| 146 | 171 | |
| 147 | 172 | struct tls_session_params { |
| ... | ... | @@ -174,6 +199,7 @@ struct m_snd_tag; |
| 174 | 199 | struct mbuf; |
| 175 | 200 | struct sockbuf; |
| 176 | 201 | struct socket; |
| 202 | struct sockopt; | |
| 177 | 203 | |
| 178 | 204 | struct ktls_session { |
| 179 | 205 | 	struct ktls_ocf_session *ocf_session; |
| ... | ... | @@ -202,6 +228,8 @@ struct ktls_session { |
| 202 | 228 | |
| 203 | 229 | 	/* Used to destroy any kTLS session */ |
| 204 | 230 | 	struct task destroy_task; |
| 231 | ||
| 232 | 	uint64_t gen; | |
| 205 | 233 | } __aligned(CACHE_LINE_SIZE); |
| 206 | 234 | |
| 207 | 235 | extern unsigned int ktls_ifnet_max_rexmit_pct; |
| ... | ... | @@ -213,27 +241,29 @@ typedef enum { |
| 213 | 241 | } ktls_mbuf_crypto_st_t; |
| 214 | 242 | |
| 215 | 243 | void ktls_check_rx(struct sockbuf *sb); |
| 216 | ktls_mbuf_crypto_st_t ktls_mbuf_crypto_state(struct mbuf *mb, int offset, int len); | |
| 244 | void ktls_cleanup_tls_enable(struct tls_enable *tls); | |
| 245 | int ktls_copyin_tls_enable(struct sockopt *sopt, struct tls_enable *tls); | |
| 217 | 246 | void ktls_disable_ifnet(void *arg); |
| 218 | 247 | int ktls_enable_rx(struct socket *so, struct tls_enable *en); |
| 219 | 248 | int ktls_enable_tx(struct socket *so, struct tls_enable *en); |
| 249 | void ktls_enqueue(struct mbuf *m, struct socket *so, int page_count); | |
| 250 | void ktls_enqueue_to_free(struct mbuf *m); | |
| 220 | 251 | void ktls_destroy(struct ktls_session *tls); |
| 221 | 252 | void ktls_frame(struct mbuf *m, struct ktls_session *tls, int *enqueue_cnt, |
| 222 | 253 | uint8_t record_type); |
| 223 | bool ktls_permit_empty_frames(struct ktls_session *tls); | |
| 224 | void ktls_seq(struct sockbuf *sb, struct mbuf *m); | |
| 225 | void ktls_enqueue(struct mbuf *m, struct socket *so, int page_count); | |
| 226 | void ktls_enqueue_to_free(struct mbuf *m); | |
| 227 | 254 | int ktls_get_rx_mode(struct socket *so, int *modep); |
| 228 | int ktls_set_tx_mode(struct socket *so, int mode); | |
| 229 | 255 | int ktls_get_tx_mode(struct socket *so, int *modep); |
| 230 | 256 | int ktls_get_rx_sequence(struct inpcb *inp, uint32_t *tcpseq, uint64_t *tlsseq); |
| 231 | 257 | void ktls_input_ifp_mismatch(struct sockbuf *sb, struct ifnet *ifp); |
| 232 | int ktls_output_eagain(struct inpcb *inp, struct ktls_session *tls); | |
| 258 | ktls_mbuf_crypto_st_t ktls_mbuf_crypto_state(struct mbuf *mb, int offset, int len); | |
| 233 | 259 | #ifdef RATELIMIT |
| 234 | 260 | int ktls_modify_txrtlmt(struct ktls_session *tls, uint64_t max_pacing_rate); |
| 235 | 261 | #endif |
| 262 | int ktls_output_eagain(struct inpcb *inp, struct ktls_session *tls); | |
| 236 | 263 | bool ktls_pending_rx_info(struct sockbuf *sb, uint64_t *seqnop, size_t *residp); |
| 264 | bool ktls_permit_empty_frames(struct ktls_session *tls); | |
| 265 | void ktls_seq(struct sockbuf *sb, struct mbuf *m); | |
| 266 | int ktls_set_tx_mode(struct socket *so, int mode); | |
| 237 | 267 | |
| 238 | 268 | static inline struct ktls_session * |
| 239 | 269 | ktls_hold(struct ktls_session *tls) |
| ... | ... | @@ -252,5 +282,10 @@ ktls_free(struct ktls_session *tls) |
| 252 | 282 | 		ktls_destroy(tls); |
| 253 | 283 | } |
| 254 | 284 | |
| 285 | void ktls_session_to_xktls_onedir(const struct ktls_session *ks, | |
| 286 | bool export_keys, struct xktls_session_onedir *xktls_od); | |
| 287 | void ktls_session_copy_keys(const struct ktls_session *ktls, | |
| 288 | uint8_t *data, size_t *sz); | |
| 289 | ||
| 255 | 290 | #endif /* !_KERNEL */ |
| 256 | 291 | #endif /* !_SYS_KTLS_H_ */ |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/sys/ktrace.h+27-5| ... | ... | @@ -27,8 +27,6 @@ |
| 27 | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | * | |
| 31 | *	@(#)ktrace.h	8.1 (Berkeley) 6/2/93 | |
| 32 | 30 | */ |
| 33 | 31 | |
| 34 | 32 | #ifndef _SYS_KTRACE_H_ |
| ... | ... | @@ -38,6 +36,7 @@ |
| 38 | 36 | #include <sys/caprights.h> |
| 39 | 37 | #include <sys/signal.h> |
| 40 | 38 | #include <sys/socket.h> |
| 39 | #include <sys/_uexterror.h> | |
| 41 | 40 | #include <sys/_uio.h> |
| 42 | 41 | |
| 43 | 42 | /* |
| ... | ... | @@ -89,10 +88,9 @@ struct ktr_header { |
| 89 | 88 | * is the public interface. |
| 90 | 89 | */ |
| 91 | 90 | #define	KTRCHECK(td, type)	((td)->td_proc->p_traceflag & (1 << type)) |
| 92 | #define KTRPOINT(td, type) (__predict_false(KTRCHECK((td), (type)))) | |
| 93 | #define	KTRCHECKDRAIN(td)	(!(STAILQ_EMPTY(&(td)->td_proc->p_ktr))) | |
| 91 | #define	KTRPOINT(td, type)	(__predict_false(KTRCHECK((td), (type)))) | |
| 94 | 92 | #define	KTRUSERRET(td) do {						\ |
| 95 | 	if (__predict_false(KTRCHECKDRAIN(td)))				\ | |
| 93 | 	if (__predict_false(!STAILQ_EMPTY_ATOMIC(&(td)->td_proc->p_ktr))) \ | |
| 96 | 94 | 		ktruserret(td);						\ |
| 97 | 95 | } while (0) |
| 98 | 96 | |
| ... | ... | @@ -265,6 +263,24 @@ struct ktr_struct_array { |
| 265 | 263 | 	 */ |
| 266 | 264 | }; |
| 267 | 265 | |
| 266 | /* | |
| 267 | * KTR_ARGS - arguments of execve() | |
| 268 | */ | |
| 269 | #define KTR_ARGS 16 | |
| 270 | ||
| 271 | /* | |
| 272 | * KTR_ENVS - environment variables of execve() | |
| 273 | */ | |
| 274 | #define KTR_ENVS 17 | |
| 275 | ||
| 276 | /* | |
| 277 | * KTR_EXTERR - extended error reported | |
| 278 | */ | |
| 279 | #define	KTR_EXTERR 18 | |
| 280 | struct ktr_exterr { | |
| 281 | 	struct uexterror ue; | |
| 282 | }; | |
| 283 | ||
| 268 | 284 | /* |
| 269 | 285 | * KTR_DROP - If this bit is set in ktr_type, then at least one event |
| 270 | 286 | * between the previous record and this record was dropped. |
| ... | ... | @@ -297,6 +313,9 @@ struct ktr_struct_array { |
| 297 | 313 | #define KTRFAC_FAULT	(1<<KTR_FAULT) |
| 298 | 314 | #define KTRFAC_FAULTEND	(1<<KTR_FAULTEND) |
| 299 | 315 | #define	KTRFAC_STRUCT_ARRAY (1<<KTR_STRUCT_ARRAY) |
| 316 | #define KTRFAC_ARGS (1<<KTR_ARGS) | |
| 317 | #define KTRFAC_ENVS (1<<KTR_ENVS) | |
| 318 | #define	KTRFAC_EXTERR	(1<<KTR_EXTERR) | |
| 300 | 319 | |
| 301 | 320 | /* |
| 302 | 321 | * trace flags (also in p_traceflags) |
| ... | ... | @@ -337,6 +356,7 @@ void	ktrstruct(const char *, const void *, size_t); |
| 337 | 356 | void	ktrstruct_error(const char *, const void *, size_t, int); |
| 338 | 357 | void	ktrstructarray(const char *, enum uio_seg, const void *, int, size_t); |
| 339 | 358 | void	ktrcapfail(enum ktr_cap_violation, const void *); |
| 359 | void	ktrdata(int, const void *, size_t); | |
| 340 | 360 | #define ktrcaprights(s) \ |
| 341 | 361 | 	ktrstruct("caprights", (s), sizeof(cap_rights_t)) |
| 342 | 362 | #define	ktritimerval(s) \ |
| ... | ... | @@ -351,6 +371,8 @@ void	ktrcapfail(enum ktr_cap_violation, const void *); |
| 351 | 371 | 	ktrstruct("cpuset_t", (s), l) |
| 352 | 372 | #define	ktrsplice(s) \ |
| 353 | 373 | 	ktrstruct("splice", (s), sizeof(struct splice)) |
| 374 | #define ktrthrparam(s) \ | |
| 375 | 	ktrstruct("thrparam", (s), sizeof(struct thr_param)) | |
| 354 | 376 | extern u_int ktr_geniosize; |
| 355 | 377 | #ifdef	KTRACE |
| 356 | 378 | extern int ktr_filesize_limit_signal; |
lib/libc/include/generic-freebsd/sys/libkern.h+50-3| ... | ... | @@ -27,18 +27,16 @@ |
| 27 | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | * | |
| 31 | *	@(#)libkern.h	8.1 (Berkeley) 6/10/93 | |
| 32 | 30 | */ |
| 33 | 31 | |
| 34 | 32 | #ifndef _SYS_LIBKERN_H_ |
| 35 | 33 | #define	_SYS_LIBKERN_H_ |
| 36 | 34 | |
| 37 | #include <sys/cdefs.h> | |
| 38 | 35 | #include <sys/types.h> |
| 39 | 36 | #ifdef _KERNEL |
| 40 | 37 | #include <sys/systm.h> |
| 41 | 38 | #endif |
| 39 | #include <sys/kassert.h> | |
| 42 | 40 | |
| 43 | 41 | #ifndef	LIBKERN_INLINE |
| 44 | 42 | #define	LIBKERN_INLINE static __inline |
| ... | ... | @@ -189,6 +187,49 @@ flsll(long long mask) |
| 189 | 187 | 	 8 * sizeof(mask) - __builtin_clzll((unsigned long long)mask)); |
| 190 | 188 | } |
| 191 | 189 | |
| 190 | static __inline __pure2 int | |
| 191 | ilog2_int(int n) | |
| 192 | { | |
| 193 | ||
| 194 | 	KASSERT(n != 0, ("ilog argument must be nonzero")); | |
| 195 | 	return (8 * sizeof(n) - 1 - __builtin_clz((u_int)n)); | |
| 196 | } | |
| 197 | ||
| 198 | static __inline __pure2 int | |
| 199 | ilog2_long(long n) | |
| 200 | { | |
| 201 | ||
| 202 | 	KASSERT(n != 0, ("ilog argument must be nonzero")); | |
| 203 | 	return (8 * sizeof(n) - 1 - __builtin_clzl((u_long)n)); | |
| 204 | } | |
| 205 | ||
| 206 | static __inline __pure2 int | |
| 207 | ilog2_long_long(long long n) | |
| 208 | { | |
| 209 | ||
| 210 | 	KASSERT(n != 0, ("ilog argument must be nonzero")); | |
| 211 | 	return (8 * sizeof(n) - 1 - | |
| 212 | 	 __builtin_clzll((unsigned long long)n)); | |
| 213 | } | |
| 214 | ||
| 215 | #define ilog2_var(n)				\ | |
| 216 | 	_Generic((n),				\ | |
| 217 | 	 default: ilog2_int,			\ | |
| 218 | 	 long: ilog2_long,			\ | |
| 219 | 	 unsigned long: ilog2_long,		\ | |
| 220 | 	 long long: ilog2_long_long,		\ | |
| 221 | 	 unsigned long long: ilog2_long_long	\ | |
| 222 | 	)(n) | |
| 223 | ||
| 224 | #define	ilog2_const(n)				\ | |
| 225 | (8 * (int)sizeof(unsigned long long) - 1 -	\ | |
| 226 | __builtin_clzll(n)) | |
| 227 | ||
| 228 | #define	ilog2(n) (__builtin_constant_p(n) ? ilog2_const(n) : ilog2_var(n)) | |
| 229 | #define	rounddown_pow_of_two(n)	((__typeof(n))1 << ilog2(n)) | |
| 230 | #define order_base_2(n) ilog2(2*(n)-1) | |
| 231 | #define	roundup_pow_of_two(n)	((__typeof(n))1 << order_base_2(n)) | |
| 232 | ||
| 192 | 233 | #define	bitcount64(x)	__bitcount64((uint64_t)(x)) |
| 193 | 234 | #define	bitcount32(x)	__bitcount32((uint32_t)(x)) |
| 194 | 235 | #define	bitcount16(x)	__bitcount16((uint16_t)(x)) |
| ... | ... | @@ -293,4 +334,10 @@ signed_extend32(uint32_t bitmap, int lsb, int width) |
| 293 | 334 | #define	FNM_IGNORECASE	FNM_CASEFOLD |
| 294 | 335 | #define	FNM_FILE_NAME	FNM_PATHNAME |
| 295 | 336 | |
| 337 | #if !defined(_KERNEL) && __has_include(<ssp/ssp.h>) | |
| 338 | #include <ssp/ssp.h>	/* __ssp_real */ | |
| 339 | #else | |
| 340 | #define __ssp_real(fun)		fun | |
| 341 | #endif | |
| 342 | ||
| 296 | 343 | #endif /* !_SYS_LIBKERN_H_ */ |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/sys/link_elf.h+3-1| ... | ... | @@ -93,10 +93,12 @@ struct dl_phdr_info |
| 93 | 93 | __BEGIN_DECLS |
| 94 | 94 | |
| 95 | 95 | typedef int (*__dl_iterate_hdr_callback)(struct dl_phdr_info *, size_t, void *); |
| 96 | extern int dl_iterate_phdr(__dl_iterate_hdr_callback, void *); | |
| 96 | int dl_iterate_phdr(__dl_iterate_hdr_callback, void *); | |
| 97 | 97 | int _rtld_addr_phdr(const void *, struct dl_phdr_info *); |
| 98 | 98 | int _rtld_get_stack_prot(void); |
| 99 | 99 | int _rtld_is_dlopened(void *); |
| 100 | const char *rtld_get_var(const char *name); | |
| 101 | int rtld_set_var(const char *name, const char *val); | |
| 100 | 102 | |
| 101 | 103 | #ifdef __ARM_EABI__ |
| 102 | 104 | void * dl_unwind_find_exidx(const void *, int *); |
lib/libc/include/generic-freebsd/sys/linker.h+25-2| ... | ... | @@ -29,6 +29,8 @@ |
| 29 | 29 | #ifndef _SYS_LINKER_H_ |
| 30 | 30 | #define _SYS_LINKER_H_ |
| 31 | 31 | |
| 32 | #include <sys/param.h> | |
| 33 | ||
| 32 | 34 | #ifdef _KERNEL |
| 33 | 35 | |
| 34 | 36 | #include <machine/elf.h> |
| ... | ... | @@ -130,6 +132,12 @@ typedef int linker_predicate_t(linker_file_t, void *); |
| 130 | 132 | */ |
| 131 | 133 | extern linker_file_t	linker_kernel_file; |
| 132 | 134 | |
| 135 | /* | |
| 136 | * Special symbol which will be replaced by a reference to the linker_file_t | |
| 137 | * of the module it is used in. | |
| 138 | */ | |
| 139 | extern linker_file_t __this_linker_file; | |
| 140 | ||
| 133 | 141 | /* |
| 134 | 142 | * Obtain a reference to a module, loading it if required. |
| 135 | 143 | */ |
| ... | ... | @@ -212,6 +220,14 @@ void linker_kldload_unbusy(int flags); |
| 212 | 220 | |
| 213 | 221 | #endif	/* _KERNEL */ |
| 214 | 222 | |
| 223 | /* | |
| 224 | * ELF file types | |
| 225 | */ | |
| 226 | #define KERNTYPE_MB	"elf multiboot kernel" | |
| 227 | #define KERNTYPE	"elf kernel" | |
| 228 | #define MODTYPE_OBJ	"elf obj module" | |
| 229 | #define MODTYPE		"elf module" | |
| 230 | ||
| 215 | 231 | /* |
| 216 | 232 | * Module information subtypes |
| 217 | 233 | */ |
| ... | ... | @@ -264,7 +280,10 @@ void linker_kldload_unbusy(int flags); |
| 264 | 280 | * Module lookup |
| 265 | 281 | */ |
| 266 | 282 | extern vm_offset_t	preload_addr_relocate; |
| 267 | extern caddr_t		preload_metadata; | |
| 283 | extern caddr_t		preload_metadata, preload_kmdp; | |
| 284 | extern const char	preload_modtype[]; | |
| 285 | extern const char	preload_kerntype[]; | |
| 286 | extern const char	preload_modtype_obj[]; | |
| 268 | 287 | |
| 269 | 288 | extern void *		preload_fetch_addr(caddr_t _mod); |
| 270 | 289 | extern size_t		preload_fetch_size(caddr_t _mod); |
| ... | ... | @@ -272,6 +291,7 @@ extern caddr_t		preload_search_by_name(const char *_name); |
| 272 | 291 | extern caddr_t		preload_search_by_type(const char *_type); |
| 273 | 292 | extern caddr_t		preload_search_next_name(caddr_t _base); |
| 274 | 293 | extern caddr_t		preload_search_info(caddr_t _mod, int _inf); |
| 294 | extern void		preload_initkmdp(bool _fatal); | |
| 275 | 295 | extern void		preload_delete_name(const char *_name); |
| 276 | 296 | extern void		preload_bootstrap_relocate(vm_offset_t _offset); |
| 277 | 297 | extern void		preload_dump(void); |
| ... | ... | @@ -304,7 +324,7 @@ int	elf_reloc_local(linker_file_t _lf, Elf_Addr base, const void *_rel, |
| 304 | 324 | Elf_Addr elf_relocaddr(linker_file_t _lf, Elf_Addr addr); |
| 305 | 325 | const Elf_Sym *elf_get_sym(linker_file_t _lf, Elf_Size _symidx); |
| 306 | 326 | const char *elf_get_symname(linker_file_t _lf, Elf_Size _symidx); |
| 307 | void	link_elf_ireloc(caddr_t kmdp); | |
| 327 | void	link_elf_ireloc(void); | |
| 308 | 328 | |
| 309 | 329 | #if defined(__aarch64__) || defined(__amd64__) |
| 310 | 330 | int	elf_reloc_late(linker_file_t _lf, Elf_Addr base, const void *_rel, |
| ... | ... | @@ -325,6 +345,9 @@ typedef struct linker_ctf { |
| 325 | 345 | } linker_ctf_t; |
| 326 | 346 | |
| 327 | 347 | int	linker_ctf_get(linker_file_t, linker_ctf_t *); |
| 348 | int linker_ctf_lookup_sym_ddb(const char *symname, c_linker_sym_t *sym, | |
| 349 | linker_ctf_t *lc); | |
| 350 | int linker_ctf_lookup_typename_ddb(linker_ctf_t *lc, const char *typename); | |
| 328 | 351 | |
| 329 | 352 | int elf_cpu_load_file(linker_file_t); |
| 330 | 353 | int elf_cpu_unload_file(linker_file_t); |
lib/libc/include/generic-freebsd/sys/lock.h+1| ... | ... | @@ -66,6 +66,7 @@ struct lock_class { |
| 66 | 66 | 	int		(*lc_owner)(const struct lock_object *lock, |
| 67 | 67 | 			 struct thread **owner); |
| 68 | 68 | 	uintptr_t	(*lc_unlock)(struct lock_object *lock); |
| 69 | 	int		(*lc_trylock)(struct lock_object *lock, uintptr_t how); | |
| 69 | 70 | }; |
| 70 | 71 | |
| 71 | 72 | #define	LC_SLEEPLOCK	0x00000001	/* Sleep lock. */ |
lib/libc/include/generic-freebsd/sys/lockf.h-2| ... | ... | @@ -30,8 +30,6 @@ |
| 30 | 30 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 31 | 31 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 32 | 32 | * SUCH DAMAGE. |
| 33 | * | |
| 34 | *	@(#)lockf.h	8.1 (Berkeley) 6/11/93 | |
| 35 | 33 | */ |
| 36 | 34 | |
| 37 | 35 | #ifndef _SYS_LOCKF_H_ |
lib/libc/include/generic-freebsd/sys/lockmgr.h+4| ... | ... | @@ -130,6 +130,10 @@ _lockmgr_args_rw(struct lock *lk, u_int flags, struct rwlock *ilk, |
| 130 | 130 | 	 LOCK_FILE, LOCK_LINE) |
| 131 | 131 | #define	lockmgr_disown(lk)						\ |
| 132 | 132 | 	_lockmgr_disown((lk), LOCK_FILE, LOCK_LINE) |
| 133 | #define	lockmgr_disowned_v(v)						\ | |
| 134 | 	(LK_HOLDER((v)) == LK_KERNPROC) | |
| 135 | #define	lockmgr_disowned(lk)						\ | |
| 136 | 	lockmgr_disowned_v(lockmgr_read_value((lk))) | |
| 133 | 137 | #define	lockmgr_recursed_v(v)						\ |
| 134 | 138 | 	(v & LK_WRITER_RECURSED) |
| 135 | 139 | #define	lockmgr_recursed(lk)						\ |
lib/libc/include/generic-freebsd/sys/mac.h+14| ... | ... | @@ -47,6 +47,13 @@ |
| 47 | 47 | #ifndef _SYS_MAC_H_ |
| 48 | 48 | #define	_SYS_MAC_H_ |
| 49 | 49 | |
| 50 | #include <sys/_types.h> | |
| 51 | ||
| 52 | #ifndef _SIZE_T_DECLARED | |
| 53 | typedef	__size_t	size_t; | |
| 54 | #define	_SIZE_T_DECLARED | |
| 55 | #endif | |
| 56 | ||
| 50 | 57 | #ifndef _POSIX_MAC |
| 51 | 58 | #define	_POSIX_MAC |
| 52 | 59 | #endif |
| ... | ... | @@ -72,6 +79,13 @@ typedef struct mac	*mac_t; |
| 72 | 79 | |
| 73 | 80 | #ifndef _KERNEL |
| 74 | 81 | |
| 82 | #include <sys/cdefs.h> /* For __BEGIN_DECLS and __END_DECLS. */ | |
| 83 | ||
| 84 | #ifndef _PID_T_DECLARED | |
| 85 | typedef	__pid_t		pid_t;		/* process id */ | |
| 86 | #define	_PID_T_DECLARED | |
| 87 | #endif | |
| 88 | ||
| 75 | 89 | /* |
| 76 | 90 | * Location of the userland MAC framework configuration file. mac.conf |
| 77 | 91 | * set defaults for MAC-aware applications. |
lib/libc/include/generic-freebsd/sys/malloc.h+7-4| ... | ... | @@ -29,8 +29,6 @@ |
| 29 | 29 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 30 | 30 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 31 | 31 | * SUCH DAMAGE. |
| 32 | * | |
| 33 | *	@(#)malloc.h	8.5 (Berkeley) 5/3/95 | |
| 34 | 32 | */ |
| 35 | 33 | |
| 36 | 34 | #ifndef _SYS_MALLOC_H_ |
| ... | ... | @@ -62,8 +60,9 @@ |
| 62 | 60 | #define	M_BESTFIT	0x2000		/* only for vmem, low fragmentation */ |
| 63 | 61 | #define	M_EXEC		0x4000		/* allocate executable space */ |
| 64 | 62 | #define	M_NEXTFIT	0x8000		/* only for vmem, follow cursor */ |
| 63 | #define	M_NEVERFREED 	0x10000		/* chunk will never get freed */ | |
| 65 | 64 | |
| 66 | #define	M_VERSION	2020110501 | |
| 65 | #define	M_VERSION	2024073001 | |
| 67 | 66 | |
| 68 | 67 | /* |
| 69 | 68 | * Two malloc type structures are present: malloc_type, which is used by a |
| ... | ... | @@ -159,6 +158,9 @@ struct malloc_type_header { |
| 159 | 158 | |
| 160 | 159 | MALLOC_DECLARE(M_CACHE); |
| 161 | 160 | MALLOC_DECLARE(M_DEVBUF); |
| 161 | MALLOC_DECLARE(M_PARGS); | |
| 162 | MALLOC_DECLARE(M_SESSION); | |
| 163 | MALLOC_DECLARE(M_SUBPROC); | |
| 162 | 164 | MALLOC_DECLARE(M_TEMP); |
| 163 | 165 | |
| 164 | 166 | /* |
| ... | ... | @@ -176,7 +178,8 @@ extern struct mtx malloc_mtx; |
| 176 | 178 | */ |
| 177 | 179 | typedef void malloc_type_list_func_t(struct malloc_type *, void *); |
| 178 | 180 | |
| 179 | void	contigfree(void *addr, unsigned long size, struct malloc_type *type); | |
| 181 | /* contigfree(9) is deprecated. */ | |
| 182 | void	contigfree(void *addr, unsigned long, struct malloc_type *type); | |
| 180 | 183 | void	*contigmalloc(unsigned long size, struct malloc_type *type, int flags, |
| 181 | 184 | 	 vm_paddr_t low, vm_paddr_t high, unsigned long alignment, |
| 182 | 185 | 	 vm_paddr_t boundary) __malloc_like __result_use_check |
lib/libc/include/generic-freebsd/sys/mbuf.h+161-28| ... | ... | @@ -28,8 +28,6 @@ |
| 28 | 28 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 29 | 29 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 30 | 30 | * SUCH DAMAGE. |
| 31 | * | |
| 32 | *	@(#)mbuf.h	8.5 (Berkeley) 2/19/95 | |
| 33 | 31 | */ |
| 34 | 32 | |
| 35 | 33 | #ifndef _SYS_MBUF_H_ |
| ... | ... | @@ -596,6 +594,7 @@ m_epg_pagelen(const struct mbuf *m, int pidx, int pgoff) |
| 596 | 594 | #define	EXT_PACKET	6	/* mbuf+cluster from packet zone */ |
| 597 | 595 | #define	EXT_MBUF	7	/* external mbuf reference */ |
| 598 | 596 | #define	EXT_RXRING	8	/* data in NIC receive ring */ |
| 597 | #define	EXT_CTL		9	/* buffer from a ctl(4) backend */ | |
| 599 | 598 | |
| 600 | 599 | #define	EXT_VENDOR1	224	/* for vendor-internal use */ |
| 601 | 600 | #define	EXT_VENDOR2	225	/* for vendor-internal use */ |
| ... | ... | @@ -642,16 +641,15 @@ m_epg_pagelen(const struct mbuf *m, int pidx, int pgoff) |
| 642 | 641 | |
| 643 | 642 | /* |
| 644 | 643 | * Flags indicating checksum, segmentation and other offload work to be |
| 645 | * done, or already done, by hardware or lower layers. It is split into | |
| 646 | * separate inbound and outbound flags. | |
| 644 | * done, or already done, by hardware or lower layers. | |
| 647 | 645 | * |
| 648 | * Outbound flags that are set by upper protocol layers requesting lower | |
| 646 | * Flags that are set by upper protocol layers requesting lower | |
| 649 | 647 | * layers, or ideally the hardware, to perform these offloading tasks. |
| 650 | * For outbound packets this field and its flags can be directly tested | |
| 651 | * against ifnet if_hwassist. Note that the outbound and the inbound flags do | |
| 652 | * not collide right now but they could be allowed to (as long as the flags are | |
| 653 | * scrubbed appropriately when the direction of an mbuf changes). CSUM_BITS | |
| 654 | * would also have to split into CSUM_BITS_TX and CSUM_BITS_RX. | |
| 648 | * Before passing packets to a network interface this field and its flags can | |
| 649 | * be directly tested against ifnet if_hwassist. Note that the flags | |
| 650 | * CSUM_IP_SCTP, CSUM_IP_TCP, and CSUM_IP_UDP can appear on input processing | |
| 651 | * of SCTP, TCP, and UDP. In such a case the checksum will not be computed or | |
| 652 | * validated by SCTP, TCP, or TCP, since the packet has not been on the wire. | |
| 655 | 653 | * |
| 656 | 654 | * CSUM_INNER_<x> is the same as CSUM_<x> but it applies to the inner frame. |
| 657 | 655 | * The CSUM_ENCAP_<x> bits identify the outer encapsulation. |
| ... | ... | @@ -680,7 +678,7 @@ m_epg_pagelen(const struct mbuf *m, int pidx, int pgoff) |
| 680 | 678 | #define	CSUM_ENCAP_VXLAN	0x00040000	/* VXLAN outer encapsulation */ |
| 681 | 679 | #define	CSUM_ENCAP_RSVD1	0x00080000 |
| 682 | 680 | |
| 683 | /* Inbound checksum support where the checksum was verified by hardware. */ | |
| 681 | /* Flags used to indicate that the checksum was verified by hardware. */ | |
| 684 | 682 | #define	CSUM_INNER_L3_CALC	0x00100000 |
| 685 | 683 | #define	CSUM_INNER_L3_VALID	0x00200000 |
| 686 | 684 | #define	CSUM_INNER_L4_CALC	0x00400000 |
| ... | ... | @@ -809,12 +807,12 @@ void		 mb_dupcl(struct mbuf *, struct mbuf *); |
| 809 | 807 | void		 mb_free_ext(struct mbuf *); |
| 810 | 808 | void		 mb_free_extpg(struct mbuf *); |
| 811 | 809 | void		 mb_free_mext_pgs(struct mbuf *); |
| 812 | struct mbuf	*mb_alloc_ext_pgs(int, m_ext_free_t); | |
| 810 | struct mbuf	*mb_alloc_ext_pgs(int, m_ext_free_t, int); | |
| 813 | 811 | struct mbuf	*mb_alloc_ext_plus_pages(int, int); |
| 814 | 812 | struct mbuf	*mb_mapped_to_unmapped(struct mbuf *, int, int, int, |
| 815 | 813 | 		 struct mbuf **); |
| 816 | 814 | int		 mb_unmapped_compress(struct mbuf *m); |
| 817 | struct mbuf 	*mb_unmapped_to_ext(struct mbuf *m); | |
| 815 | int		 mb_unmapped_to_ext(struct mbuf *m, struct mbuf **mres); | |
| 818 | 816 | void		 mb_free_notready(struct mbuf *m, int count); |
| 819 | 817 | void		 m_adj(struct mbuf *, int); |
| 820 | 818 | void		 m_adj_decap(struct mbuf *, int); |
| ... | ... | @@ -886,9 +884,11 @@ m_gettype(int size) |
| 886 | 884 | 	case MCLBYTES: |
| 887 | 885 | 		type = EXT_CLUSTER; |
| 888 | 886 | 		break; |
| 887 | #if MJUMPAGESIZE != MCLBYTES | |
| 889 | 888 | 	case MJUMPAGESIZE: |
| 890 | 889 | 		type = EXT_JUMBOP; |
| 891 | 890 | 		break; |
| 891 | #endif | |
| 892 | 892 | 	case MJUM9BYTES: |
| 893 | 893 | 		type = EXT_JUMBO9; |
| 894 | 894 | 		break; |
| ... | ... | @@ -934,9 +934,11 @@ m_getzone(int size) |
| 934 | 934 | 	case MCLBYTES: |
| 935 | 935 | 		zone = zone_clust; |
| 936 | 936 | 		break; |
| 937 | #if MJUMPAGESIZE != MCLBYTES | |
| 937 | 938 | 	case MJUMPAGESIZE: |
| 938 | 939 | 		zone = zone_jumbop; |
| 939 | 940 | 		break; |
| 941 | #endif | |
| 940 | 942 | 	case MJUM9BYTES: |
| 941 | 943 | 		zone = zone_jumbo9; |
| 942 | 944 | 		break; |
| ... | ... | @@ -1056,9 +1058,11 @@ m_cljset(struct mbuf *m, void *cl, int type) |
| 1056 | 1058 | 	case EXT_CLUSTER: |
| 1057 | 1059 | 		size = MCLBYTES; |
| 1058 | 1060 | 		break; |
| 1061 | #if MJUMPAGESIZE != MCLBYTES | |
| 1059 | 1062 | 	case EXT_JUMBOP: |
| 1060 | 1063 | 		size = MJUMPAGESIZE; |
| 1061 | 1064 | 		break; |
| 1065 | #endif | |
| 1062 | 1066 | 	case EXT_JUMBO9: |
| 1063 | 1067 | 		size = MJUM9BYTES; |
| 1064 | 1068 | 		break; |
| ... | ... | @@ -1110,7 +1114,7 @@ static inline u_int |
| 1110 | 1114 | m_extrefcnt(struct mbuf *m) |
| 1111 | 1115 | { |
| 1112 | 1116 | |
| 1113 | 	KASSERT(m->m_flags & M_EXT, ("%s: M_EXT missing", __func__)); | |
| 1117 | 	KASSERT(m->m_flags & M_EXT, ("%s: M_EXT missing for %p", __func__, m)); | |
| 1114 | 1118 | |
| 1115 | 1119 | 	return ((m->m_ext.ext_flags & EXT_FLAG_EMBREF) ? m->m_ext.ext_count : |
| 1116 | 1120 | 	 *m->m_ext.ext_cnt); |
| ... | ... | @@ -1142,13 +1146,13 @@ m_extrefcnt(struct mbuf *m) |
| 1142 | 1146 | /* Check if the supplied mbuf has a packet header, or else panic. */ |
| 1143 | 1147 | #define	M_ASSERTPKTHDR(m)						\ |
| 1144 | 1148 | 	KASSERT((m) != NULL && (m)->m_flags & M_PKTHDR,			\ |
| 1145 | 	 ("%s: no mbuf packet header!", __func__)) | |
| 1149 | 	 ("%s: no mbuf %p packet header!", __func__, (m))) | |
| 1146 | 1150 | |
| 1147 | 1151 | /* Check if the supplied mbuf has no send tag, or else panic. */ |
| 1148 | 1152 | #define	M_ASSERT_NO_SND_TAG(m)						\ |
| 1149 | 1153 | 	KASSERT((m) != NULL && (m)->m_flags & M_PKTHDR &&		\ |
| 1150 | 1154 | 	 ((m)->m_pkthdr.csum_flags & CSUM_SND_TAG) == 0,		\ |
| 1151 | 	 ("%s: receive mbuf has send tag!", __func__)) | |
| 1155 | 	 ("%s: receive mbuf %p has send tag!", __func__, (m))) | |
| 1152 | 1156 | |
| 1153 | 1157 | /* Check if mbuf is multipage. */ |
| 1154 | 1158 | #define M_ASSERTEXTPG(m)						\ |
| ... | ... | @@ -1162,7 +1166,7 @@ m_extrefcnt(struct mbuf *m) |
| 1162 | 1166 | */ |
| 1163 | 1167 | #define	M_ASSERTVALID(m)						\ |
| 1164 | 1168 | 	KASSERT((((struct mbuf *)m)->m_flags & 0) == 0,			\ |
| 1165 | 	 ("%s: attempted use of a free mbuf!", __func__)) | |
| 1169 | 	 ("%s: attempted use of a free mbuf %p!", __func__, (m))) | |
| 1166 | 1170 | |
| 1167 | 1171 | /* Check whether any mbuf in the chain is unmapped. */ |
| 1168 | 1172 | #ifdef INVARIANTS |
| ... | ... | @@ -1207,12 +1211,9 @@ m_extrefcnt(struct mbuf *m) |
| 1207 | 1211 | static __inline void |
| 1208 | 1212 | m_align(struct mbuf *m, int len) |
| 1209 | 1213 | { |
| 1210 | #ifdef INVARIANTS | |
| 1211 | 	const char *msg = "%s: not a virgin mbuf"; | |
| 1212 | #endif | |
| 1213 | 1214 | 	int adjust; |
| 1214 | ||
| 1215 | 	KASSERT(m->m_data == M_START(m), (msg, __func__)); | |
| 1215 | 	KASSERT(m->m_data == M_START(m), | |
| 1216 | 	 ("%s: not a virgin mbuf %p", __func__, m)); | |
| 1216 | 1217 | |
| 1217 | 1218 | 	adjust = M_SIZE(m) - len; |
| 1218 | 1219 | 	m->m_data += adjust &~ (sizeof(long)-1); |
| ... | ... | @@ -1387,6 +1388,9 @@ extern bool		mb_use_ext_pgs;	/* Use ext_pgs for sendfile */ |
| 1387 | 1388 | #define	PACKET_TAG_IPSEC_NAT_T_PORTS		29 /* two uint16_t */ |
| 1388 | 1389 | #define	PACKET_TAG_ND_OUTGOING			30 /* ND outgoing */ |
| 1389 | 1390 | #define	PACKET_TAG_PF_REASSEMBLED		31 |
| 1391 | #define	PACKET_TAG_IPSEC_ACCEL_OUT		32 /* IPSEC accel out */ | |
| 1392 | #define	PACKET_TAG_IPSEC_ACCEL_IN		33 /* IPSEC accel in */ | |
| 1393 | #define	PACKET_TAG_OVPN				34 /* if_ovpn */ | |
| 1390 | 1394 | |
| 1391 | 1395 | /* Specific cookies and tags. */ |
| 1392 | 1396 | |
| ... | ... | @@ -1530,14 +1534,16 @@ m_free(struct mbuf *m) |
| 1530 | 1534 | static __inline int |
| 1531 | 1535 | rt_m_getfib(struct mbuf *m) |
| 1532 | 1536 | { |
| 1533 | 	KASSERT(m->m_flags & M_PKTHDR , ("Attempt to get FIB from non header mbuf.")); | |
| 1537 | 	KASSERT(m->m_flags & M_PKTHDR, | |
| 1538 | 	 ("%s: Attempt to get FIB from non header mbuf %p", __func__, m)); | |
| 1534 | 1539 | 	return (m->m_pkthdr.fibnum); |
| 1535 | 1540 | } |
| 1536 | 1541 | |
| 1537 | 1542 | #define M_GETFIB(_m) rt_m_getfib(_m) |
| 1538 | 1543 | |
| 1539 | 1544 | #define M_SETFIB(_m, _fib) do {						\ |
| 1540 | KASSERT((_m)->m_flags & M_PKTHDR, ("Attempt to set FIB on non header mbuf."));	\ | |
| 1545 | KASSERT((_m)->m_flags & M_PKTHDR, \ | |
| 1546 | 	 ("%s: Attempt to set FIB on non header mbuf %p", __func__, (_m))); \ | |
| 1541 | 1547 | 	((_m)->m_pkthdr.fibnum) = (_fib);				\ |
| 1542 | 1548 | } while (0) |
| 1543 | 1549 | |
| ... | ... | @@ -1559,6 +1565,10 @@ uint32_t	m_infiniband_tcpip_hash(const uint32_t, const struct mbuf *, uint32_t); |
| 1559 | 1565 | #define M_PROFILE(m) |
| 1560 | 1566 | #endif |
| 1561 | 1567 | |
| 1568 | /* | |
| 1569 | * Structure describing a packet queue: mbufs linked by m_stailqpkt. | |
| 1570 | * Does accounting of number of packets and has a cap. | |
| 1571 | */ | |
| 1562 | 1572 | struct mbufq { |
| 1563 | 1573 | 	STAILQ_HEAD(, mbuf)	mq_head; |
| 1564 | 1574 | 	int			mq_len; |
| ... | ... | @@ -1676,14 +1686,137 @@ mbufq_concat(struct mbufq *mq_dst, struct mbufq *mq_src) |
| 1676 | 1686 | 	mq_src->mq_len = 0; |
| 1677 | 1687 | } |
| 1678 | 1688 | |
| 1689 | /* | |
| 1690 | * Structure describing a chain of mbufs linked by m_stailq, also tracking | |
| 1691 | * the pointer to the last. Also does accounting of data length and memory | |
| 1692 | * usage. | |
| 1693 | * To be used as an argument to mbuf chain allocation and manipulation KPIs, | |
| 1694 | * and can be allocated on the stack of a caller. Kernel facilities may use | |
| 1695 | * it internally as a most simple implementation of a stream data buffer. | |
| 1696 | */ | |
| 1697 | struct mchain { | |
| 1698 | 	STAILQ_HEAD(, mbuf) mc_q; | |
| 1699 | 	u_int mc_len; | |
| 1700 | 	u_int mc_mlen; | |
| 1701 | }; | |
| 1702 | ||
| 1703 | #define	MCHAIN_INITIALIZER(mc)	\ | |
| 1704 | 	(struct mchain){ .mc_q = STAILQ_HEAD_INITIALIZER((mc)->mc_q) } | |
| 1705 | ||
| 1706 | static inline struct mbuf * | |
| 1707 | mc_first(struct mchain *mc) | |
| 1708 | { | |
| 1709 | 	return (STAILQ_FIRST(&mc->mc_q)); | |
| 1710 | } | |
| 1711 | ||
| 1712 | static inline struct mbuf * | |
| 1713 | mc_last(struct mchain *mc) | |
| 1714 | { | |
| 1715 | 	return (STAILQ_LAST(&mc->mc_q, mbuf, m_stailq)); | |
| 1716 | } | |
| 1717 | ||
| 1718 | static inline bool | |
| 1719 | mc_empty(struct mchain *mc) | |
| 1720 | { | |
| 1721 | 	return (STAILQ_EMPTY(&mc->mc_q)); | |
| 1722 | } | |
| 1723 | ||
| 1724 | /* Account addition of m to mc. */ | |
| 1725 | static inline void | |
| 1726 | mc_inc(struct mchain *mc, struct mbuf *m) | |
| 1727 | { | |
| 1728 | 	mc->mc_len += m->m_len; | |
| 1729 | 	mc->mc_mlen += MSIZE; | |
| 1730 | 	if (m->m_flags & M_EXT) | |
| 1731 | 		mc->mc_mlen += m->m_ext.ext_size; | |
| 1732 | } | |
| 1733 | ||
| 1734 | /* Account removal of m from mc. */ | |
| 1735 | static inline void | |
| 1736 | mc_dec(struct mchain *mc, struct mbuf *m) | |
| 1737 | { | |
| 1738 | 	MPASS(mc->mc_len >= m->m_len); | |
| 1739 | 	mc->mc_len -= m->m_len; | |
| 1740 | 	MPASS(mc->mc_mlen >= MSIZE); | |
| 1741 | 	mc->mc_mlen -= MSIZE; | |
| 1742 | 	if (m->m_flags & M_EXT) { | |
| 1743 | 		MPASS(mc->mc_mlen >= m->m_ext.ext_size); | |
| 1744 | 		mc->mc_mlen -= m->m_ext.ext_size; | |
| 1745 | 	} | |
| 1746 | } | |
| 1747 | ||
| 1748 | /* | |
| 1749 | * Get mchain from a classic mbuf chain linked by m_next. Two hacks here: | |
| 1750 | * we use the fact that m_next is alias to m_stailq, we use internal queue(3) | |
| 1751 | * fields. | |
| 1752 | */ | |
| 1753 | static inline void | |
| 1754 | mc_init_m(struct mchain *mc, struct mbuf *m) | |
| 1755 | { | |
| 1756 | 	struct mbuf *last; | |
| 1757 | ||
| 1758 | 	STAILQ_FIRST(&mc->mc_q) = m; | |
| 1759 | 	mc->mc_len = mc->mc_mlen = 0; | |
| 1760 | 	STAILQ_FOREACH(m, &mc->mc_q, m_stailq) { | |
| 1761 | 		mc_inc(mc, m); | |
| 1762 | 		last = m; | |
| 1763 | 	} | |
| 1764 | 	mc->mc_q.stqh_last = &STAILQ_NEXT(last, m_stailq); | |
| 1765 | } | |
| 1766 | ||
| 1767 | static inline void | |
| 1768 | mc_freem(struct mchain *mc) | |
| 1769 | { | |
| 1770 | 	if (!mc_empty(mc)) | |
| 1771 | 		m_freem(mc_first(mc)); | |
| 1772 | } | |
| 1773 | ||
| 1774 | static inline void | |
| 1775 | mc_prepend(struct mchain *mc, struct mbuf *m) | |
| 1776 | { | |
| 1777 | 	STAILQ_INSERT_HEAD(&mc->mc_q, m, m_stailq); | |
| 1778 | 	mc_inc(mc, m); | |
| 1779 | } | |
| 1780 | ||
| 1781 | static inline void | |
| 1782 | mc_append(struct mchain *mc, struct mbuf *m) | |
| 1783 | { | |
| 1784 | 	STAILQ_INSERT_TAIL(&mc->mc_q, m, m_stailq); | |
| 1785 | 	mc_inc(mc, m); | |
| 1786 | } | |
| 1787 | ||
| 1788 | static inline void | |
| 1789 | mc_concat(struct mchain *head, struct mchain *tail) | |
| 1790 | { | |
| 1791 | 	STAILQ_CONCAT(&head->mc_q, &tail->mc_q); | |
| 1792 | 	head->mc_len += tail->mc_len; | |
| 1793 | 	head->mc_mlen += tail->mc_mlen; | |
| 1794 | 	tail->mc_len = tail->mc_mlen = 0; | |
| 1795 | } | |
| 1796 | ||
| 1797 | /* | |
| 1798 | * Note: STAILQ_REMOVE() is expensive. mc_remove_after() needs to be provided | |
| 1799 | * as long as there consumers that would benefit from it. | |
| 1800 | */ | |
| 1801 | static inline void | |
| 1802 | mc_remove(struct mchain *mc, struct mbuf *m) | |
| 1803 | { | |
| 1804 | 	STAILQ_REMOVE(&mc->mc_q, m, mbuf, m_stailq); | |
| 1805 | 	mc_dec(mc, m); | |
| 1806 | } | |
| 1807 | ||
| 1808 | int mc_get(struct mchain *, u_int, int, short, int); | |
| 1809 | int mc_split(struct mchain *, struct mchain *, u_int, int); | |
| 1810 | int mc_uiotomc(struct mchain *, struct uio *, u_int, u_int, int, int); | |
| 1811 | ||
| 1679 | 1812 | #ifdef _SYS_TIMESPEC_H_ |
| 1680 | 1813 | static inline void |
| 1681 | 1814 | mbuf_tstmp2timespec(struct mbuf *m, struct timespec *ts) |
| 1682 | 1815 | { |
| 1683 | 1816 | |
| 1684 | 	KASSERT((m->m_flags & M_PKTHDR) != 0, ("mbuf %p no M_PKTHDR", m)); | |
| 1817 | 	M_ASSERTPKTHDR(m); | |
| 1685 | 1818 | 	KASSERT((m->m_flags & (M_TSTMP|M_TSTMP_LRO)) != 0, |
| 1686 | 	 ("mbuf %p no M_TSTMP or M_TSTMP_LRO", m)); | |
| 1819 | 	 ("%s: mbuf %p no M_TSTMP or M_TSTMP_LRO", __func__, m)); | |
| 1687 | 1820 | 	ts->tv_sec = m->m_pkthdr.rcv_tstmp / 1000000000; |
| 1688 | 1821 | 	ts->tv_nsec = m->m_pkthdr.rcv_tstmp % 1000000000; |
| 1689 | 1822 | } |
| ... | ... | @@ -1693,9 +1826,9 @@ static inline void |
| 1693 | 1826 | mbuf_tstmp2timeval(struct mbuf *m, struct timeval *tv) |
| 1694 | 1827 | { |
| 1695 | 1828 | |
| 1696 | 	KASSERT((m->m_flags & M_PKTHDR) != 0, ("mbuf %p no M_PKTHDR", m)); | |
| 1829 | 	M_ASSERTPKTHDR(m); | |
| 1697 | 1830 | 	KASSERT((m->m_flags & (M_TSTMP|M_TSTMP_LRO)) != 0, |
| 1698 | 	 ("mbuf %p no M_TSTMP or M_TSTMP_LRO", m)); | |
| 1831 | 	 ("%s: mbuf %p no M_TSTMP or M_TSTMP_LRO", __func__, m)); | |
| 1699 | 1832 | 	tv->tv_sec = m->m_pkthdr.rcv_tstmp / 1000000000; |
| 1700 | 1833 | 	tv->tv_usec = (m->m_pkthdr.rcv_tstmp % 1000000000) / 1000; |
| 1701 | 1834 | } |
lib/libc/include/generic-freebsd/sys/md4.h+44-4| ... | ... | @@ -25,8 +25,8 @@ |
| 25 | 25 | documentation and/or software. |
| 26 | 26 | */ |
| 27 | 27 | |
| 28 | #ifndef _MD4_H_ | |
| 29 | #define _MD4_H_ | |
| 28 | #ifndef _SYS_MD4_H_ | |
| 29 | #define _SYS_MD4_H_ | |
| 30 | 30 | /* MD4 context. */ |
| 31 | 31 | typedef struct MD4Context { |
| 32 | 32 | u_int32_t state[4];	/* state (ABCD) */ |
| ... | ... | @@ -36,6 +36,43 @@ typedef struct MD4Context { |
| 36 | 36 | |
| 37 | 37 | #include <sys/cdefs.h> |
| 38 | 38 | |
| 39 | #ifndef _KERNEL | |
| 40 | ||
| 41 | /* Ensure libmd symbols do not clash with libcrypto */ | |
| 42 | ||
| 43 | #ifndef MD4Init | |
| 44 | #define MD4Init		_libmd_MD4Init | |
| 45 | #endif | |
| 46 | #ifndef MD4Update | |
| 47 | #define MD4Update	_libmd_MD4Update | |
| 48 | #endif | |
| 49 | #ifndef MD4Pad | |
| 50 | #define MD4Pad		_libmd_MD4Pad | |
| 51 | #endif | |
| 52 | #ifndef MD4Final | |
| 53 | #define MD4Final	_libmd_MD4Final | |
| 54 | #endif | |
| 55 | #ifndef MD4End | |
| 56 | #define MD4End		_libmd_MD4End | |
| 57 | #endif | |
| 58 | #ifndef MD4Fd | |
| 59 | #define MD4Fd		_libmd_MD4Fd | |
| 60 | #endif | |
| 61 | #ifndef MD4FdChunk | |
| 62 | #define MD4FdChunk	_libmd_MD4FdChunk | |
| 63 | #endif | |
| 64 | #ifndef MD4File | |
| 65 | #define MD4File		_libmd_MD4File | |
| 66 | #endif | |
| 67 | #ifndef MD4FileChunk | |
| 68 | #define MD4FileChunk	_libmd_MD4FileChunk | |
| 69 | #endif | |
| 70 | #ifndef MD4Data | |
| 71 | #define MD4Data		_libmd_MD4Data | |
| 72 | #endif | |
| 73 | ||
| 74 | #endif | |
| 75 | ||
| 39 | 76 | __BEGIN_DECLS |
| 40 | 77 | void MD4Init(MD4_CTX *); |
| 41 | 78 | void MD4Update(MD4_CTX *, const unsigned char *, unsigned int); |
| ... | ... | @@ -43,9 +80,12 @@ void MD4Pad(MD4_CTX *); |
| 43 | 80 | void MD4Final(unsigned char [__min_size(16)], MD4_CTX *); |
| 44 | 81 | #ifndef _KERNEL |
| 45 | 82 | char * MD4End(MD4_CTX *, char *); |
| 83 | char * MD4Fd(int, char *); | |
| 84 | char * MD4FdChunk(int, char *, off_t, off_t); | |
| 46 | 85 | char * MD4File(const char *, char *); |
| 47 | char * MD4Data(const unsigned char *, unsigned int, char *); | |
| 86 | char * MD4FileChunk(const char *, char *, off_t, off_t); | |
| 87 | char * MD4Data(const void *, unsigned int, char *); | |
| 48 | 88 | #endif |
| 49 | 89 | __END_DECLS |
| 50 | 90 | |
| 51 | #endif /* _MD4_H_ */ | |
| \ No newline at end of file | ||
| 91 | #endif /* _SYS_MD4_H_ */ | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/sys/md5.h+42| ... | ... | @@ -29,6 +29,8 @@ documentation and/or software. |
| 29 | 29 | #ifndef _SYS_MD5_H_ |
| 30 | 30 | #define _SYS_MD5_H_ |
| 31 | 31 | |
| 32 | #include <sys/types.h> | |
| 33 | ||
| 32 | 34 | #define MD5_BLOCK_LENGTH		64 |
| 33 | 35 | #define MD5_DIGEST_LENGTH		16 |
| 34 | 36 | #define MD5_DIGEST_STRING_LENGTH	(MD5_DIGEST_LENGTH * 2 + 1) |
| ... | ... | @@ -40,6 +42,46 @@ typedef struct MD5Context { |
| 40 | 42 | unsigned char buffer[64];	/* input buffer */ |
| 41 | 43 | } MD5_CTX; |
| 42 | 44 | |
| 45 | #ifndef _KERNEL | |
| 46 | ||
| 47 | /* Ensure libmd symbols do not clash with libcrypto */ | |
| 48 | ||
| 49 | #ifndef MD5Init | |
| 50 | #define MD5Init		_libmd_MD5Init | |
| 51 | #endif | |
| 52 | #ifndef MD5Update | |
| 53 | #define MD5Update	_libmd_MD5Update | |
| 54 | #endif | |
| 55 | #ifndef MD5Pad | |
| 56 | #define MD5Pad		_libmd_MD5Pad | |
| 57 | #endif | |
| 58 | #ifndef MD5Final | |
| 59 | #define MD5Final	_libmd_MD5Final | |
| 60 | #endif | |
| 61 | #ifndef MD5Transform | |
| 62 | #define MD5Transform	_libmd_MD5Transform | |
| 63 | #endif | |
| 64 | #ifndef MD5End | |
| 65 | #define MD5End		_libmd_MD5End | |
| 66 | #endif | |
| 67 | #ifndef MD5Fd | |
| 68 | #define MD5Fd		_libmd_MD5Fd | |
| 69 | #endif | |
| 70 | #ifndef MD5FdChunk | |
| 71 | #define MD5FdChunk	_libmd_MD5FdChunk | |
| 72 | #endif | |
| 73 | #ifndef MD5File | |
| 74 | #define MD5File		_libmd_MD5File | |
| 75 | #endif | |
| 76 | #ifndef MD5FileChunk | |
| 77 | #define MD5FileChunk	_libmd_MD5FileChunk | |
| 78 | #endif | |
| 79 | #ifndef MD5Data | |
| 80 | #define MD5Data		_libmd_MD5Data | |
| 81 | #endif | |
| 82 | ||
| 83 | #endif | |
| 84 | ||
| 43 | 85 | #include <sys/cdefs.h> |
| 44 | 86 | |
| 45 | 87 | __BEGIN_DECLS |
lib/libc/include/generic-freebsd/sys/mdioctl.h-4| ... | ... | @@ -34,10 +34,6 @@ |
| 34 | 34 | * SUCH DAMAGE. |
| 35 | 35 | * |
| 36 | 36 | * from: Utah $Hdr: fdioctl.h 1.1 90/07/09$ |
| 37 | * | |
| 38 | *	@(#)vnioctl.h	8.1 (Berkeley) 6/10/93 | |
| 39 | * | |
| 40 | * From: src/sys/sys/vnioctl.h,v 1.4 | |
| 41 | 37 | */ |
| 42 | 38 | |
| 43 | 39 | #ifndef _SYS_MDIOCTL_H_ |
lib/libc/include/generic-freebsd/sys/memdesc.h+36| ... | ... | @@ -163,4 +163,40 @@ void	memdesc_copyback(struct memdesc *mem, int off, int size, |
| 163 | 163 | const void *src); |
| 164 | 164 | void	memdesc_copydata(struct memdesc *mem, int off, int size, void *dst); |
| 165 | 165 | |
| 166 | /* | |
| 167 | * This routine constructs a chain of M_EXT mbufs backed by a data | |
| 168 | * buffer described by a memory descriptor. Some buffers may require | |
| 169 | * multiple mbufs. For memory descriptors using unmapped storage | |
| 170 | * (e.g. memdesc_vmpages), M_EXTPG mbufs are used. | |
| 171 | * | |
| 172 | * Since memory descriptors are not an actual buffer, just a | |
| 173 | * description of the buffer, the caller is required to supply a | |
| 174 | * couple of helper routines to manage allocation of the raw mbufs and | |
| 175 | * associate them with a reference to the underlying buffer. | |
| 176 | * | |
| 177 | * The memdesc_alloc_ext_mbuf_t callback is passed the callback | |
| 178 | * argument as its first argument, the how flag as its second | |
| 179 | * argument, and the pointer and length of a KVA buffer. This | |
| 180 | * callback should allocate an mbuf for the KVA buffer, either by | |
| 181 | * making a copy of the data or using m_extaddref(). | |
| 182 | * | |
| 183 | * The memdesc_alloc_extpg_mbuf_t callback is passed the callback | |
| 184 | * argument as its first argument and the how flag as its second | |
| 185 | * argument. It should return an empty mbuf allocated by | |
| 186 | * mb_alloc_ext_pgs. | |
| 187 | * | |
| 188 | * If either of the callbacks returns NULL, any partially allocated | |
| 189 | * chain is freed and this routine returns NULL. | |
| 190 | * | |
| 191 | * If can_truncate is true, then this function might return a short | |
| 192 | * chain to avoid gratuitously splitting up a page. | |
| 193 | */ | |
| 194 | typedef struct mbuf *memdesc_alloc_ext_mbuf_t(void *, int, void *, size_t); | |
| 195 | typedef struct mbuf *memdesc_alloc_extpg_mbuf_t(void *, int); | |
| 196 | ||
| 197 | struct mbuf *memdesc_alloc_ext_mbufs(struct memdesc *mem, | |
| 198 | memdesc_alloc_ext_mbuf_t *ext_alloc, | |
| 199 | memdesc_alloc_extpg_mbuf_t *extpg_alloc, void *cb_arg, int how, | |
| 200 | size_t offset, size_t len, size_t *actual_len, bool can_truncate); | |
| 201 | ||
| 166 | 202 | #endif /* _SYS_MEMDESC_H_ */ |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/sys/mman.h+18-16| ... | ... | @@ -27,12 +27,10 @@ |
| 27 | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | * | |
| 31 | *	@(#)mman.h	8.2 (Berkeley) 1/9/95 | |
| 32 | 30 | */ |
| 33 | 31 | |
| 34 | 32 | #ifndef _SYS_MMAN_H_ |
| 35 | #define _SYS_MMAN_H_ | |
| 33 | #define	_SYS_MMAN_H_ | |
| 36 | 34 | |
| 37 | 35 | #include <sys/cdefs.h> |
| 38 | 36 | #include <sys/_types.h> |
| ... | ... | @@ -41,10 +39,10 @@ |
| 41 | 39 | /* |
| 42 | 40 | * Inheritance for minherit() |
| 43 | 41 | */ |
| 44 | #define INHERIT_SHARE	0 | |
| 45 | #define INHERIT_COPY	1 | |
| 46 | #define INHERIT_NONE	2 | |
| 47 | #define INHERIT_ZERO	3 | |
| 42 | #define	INHERIT_SHARE	0 | |
| 43 | #define	INHERIT_COPY	1 | |
| 44 | #define	INHERIT_NONE	2 | |
| 45 | #define	INHERIT_ZERO	3 | |
| 48 | 46 | #endif |
| 49 | 47 | |
| 50 | 48 | /* |
| ... | ... | @@ -55,6 +53,8 @@ |
| 55 | 53 | #define	PROT_WRITE	0x02	/* pages can be written */ |
| 56 | 54 | #define	PROT_EXEC	0x04	/* pages can be executed */ |
| 57 | 55 | #if __BSD_VISIBLE |
| 56 | #define	PROT_CHERI0	0x08 | |
| 57 | #define	PROT_CHERI1	0x10 | |
| 58 | 58 | #define	_PROT_ALL	(PROT_READ | PROT_WRITE | PROT_EXEC) |
| 59 | 59 | #define	PROT_EXTRACT(prot)	((prot) & _PROT_ALL) |
| 60 | 60 | |
| ... | ... | @@ -120,9 +120,9 @@ |
| 120 | 120 | * Flags provided to shm_rename |
| 121 | 121 | */ |
| 122 | 122 | /* Don't overwrite dest, if it exists */ |
| 123 | #define SHM_RENAME_NOREPLACE	(1 << 0) | |
| 123 | #define	SHM_RENAME_NOREPLACE	(1 << 0) | |
| 124 | 124 | /* Atomically swap src and dest */ |
| 125 | #define SHM_RENAME_EXCHANGE	(1 << 1) | |
| 125 | #define	SHM_RENAME_EXCHANGE	(1 << 1) | |
| 126 | 126 | |
| 127 | 127 | #endif /* __BSD_VISIBLE */ |
| 128 | 128 | |
| ... | ... | @@ -130,21 +130,21 @@ |
| 130 | 130 | /* |
| 131 | 131 | * Process memory locking |
| 132 | 132 | */ |
| 133 | #define MCL_CURRENT	0x0001	/* Lock only current memory */ | |
| 134 | #define MCL_FUTURE	0x0002	/* Lock all future memory as well */ | |
| 133 | #define	MCL_CURRENT	0x0001	/* Lock only current memory */ | |
| 134 | #define	MCL_FUTURE	0x0002	/* Lock all future memory as well */ | |
| 135 | 135 | #endif |
| 136 | 136 | |
| 137 | 137 | /* |
| 138 | 138 | * Error return from mmap() |
| 139 | 139 | */ |
| 140 | #define MAP_FAILED	((void *)-1) | |
| 140 | #define	MAP_FAILED	((void *)-1) | |
| 141 | 141 | |
| 142 | 142 | /* |
| 143 | 143 | * msync() flags |
| 144 | 144 | */ |
| 145 | 145 | #define	MS_SYNC		0x0000	/* msync synchronously */ |
| 146 | #define MS_ASYNC	0x0001	/* return immediately */ | |
| 147 | #define MS_INVALIDATE	0x0002	/* invalidate all cached data */ | |
| 146 | #define	MS_ASYNC	0x0001	/* return immediately */ | |
| 147 | #define	MS_INVALIDATE	0x0002	/* invalidate all cached data */ | |
| 148 | 148 | |
| 149 | 149 | /* |
| 150 | 150 | * Advice to madvise |
| ... | ... | @@ -177,7 +177,9 @@ |
| 177 | 177 | #define	MINCORE_REFERENCED_OTHER 0x8 /* Page has been referenced */ |
| 178 | 178 | #define	MINCORE_MODIFIED_OTHER	0x10 /* Page has been modified */ |
| 179 | 179 | #define	MINCORE_SUPER		0x60 /* Page is a "super" page */ |
| 180 | #define	MINCORE_PSIND(i)	(((i) << 5) & MINCORE_SUPER) /* Page size */ | |
| 180 | #define	MINCORE_PSIND_SHIFT	5 | |
| 181 | #define	MINCORE_PSIND(i)	(((i) << MINCORE_PSIND_SHIFT) & MINCORE_SUPER) | |
| 182 | 				 /* Page size */ | |
| 181 | 183 | |
| 182 | 184 | /* |
| 183 | 185 | * Anonymous object constant for shm_open(). |
| ... | ... | @@ -312,7 +314,7 @@ bool	shm_largepage(struct shmfd *shmfd); |
| 312 | 314 | void	shm_remove_prison(struct prison *pr); |
| 313 | 315 | int	shm_get_path(struct vm_object *obj, char *path, size_t sz); |
| 314 | 316 | |
| 315 | extern struct fileops shm_ops; | |
| 317 | extern const struct fileops shm_ops; | |
| 316 | 318 | |
| 317 | 319 | #define	MAP_32BIT_MAX_ADDR	((vm_offset_t)1 << 31) |
| 318 | 320 |
lib/libc/include/generic-freebsd/sys/mount.h+12-4| ... | ... | @@ -27,22 +27,24 @@ |
| 27 | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | * | |
| 31 | *	@(#)mount.h	8.21 (Berkeley) 5/20/95 | |
| 32 | 30 | */ |
| 33 | 31 | |
| 34 | 32 | #ifndef _SYS_MOUNT_H_ |
| 35 | 33 | #define _SYS_MOUNT_H_ |
| 36 | 34 | |
| 35 | #include <sys/types.h> | |
| 37 | 36 | #include <sys/ucred.h> |
| 38 | 37 | #include <sys/queue.h> |
| 39 | 38 | #ifdef _KERNEL |
| 40 | #include <sys/types.h> | |
| 41 | 39 | #include <sys/lock.h> |
| 42 | 40 | #include <sys/lockmgr.h> |
| 43 | 41 | #include <sys/tslog.h> |
| 44 | 42 | #include <sys/_mutex.h> |
| 45 | 43 | #include <sys/_sx.h> |
| 44 | #elif defined(_WANT_MOUNT) | |
| 45 | #include <sys/_lock.h> | |
| 46 | #include <sys/_lockmgr.h> | |
| 47 | #include <sys/_mutex.h> | |
| 46 | 48 | #endif |
| 47 | 49 | |
| 48 | 50 | /* |
| ... | ... | @@ -265,6 +267,7 @@ struct mount { |
| 265 | 267 | 	int		mnt_lazyvnodelistsize;	/* (l) # of lazy vnodes */ |
| 266 | 268 | 	int		mnt_upper_pending;	/* (i) # of pending ops on mnt_uppers */ |
| 267 | 269 | 	struct lock	mnt_explock;		/* vfs_export walkers lock */ |
| 270 | 	struct lock	mnt_renamelock;		/* renames and O_RESOLVE_BENEATH */ | |
| 268 | 271 | 	TAILQ_HEAD(, mount_upper_node) mnt_uppers; /* (i) upper mounts over us */ |
| 269 | 272 | 	TAILQ_HEAD(, mount_upper_node) mnt_notify; /* (i) upper mounts for notification */ |
| 270 | 273 | 	STAILQ_ENTRY(mount) mnt_taskqueue_link;	/* (d) our place in deferred unmount list */ |
| ... | ... | @@ -367,6 +370,7 @@ struct mntoptnames { |
| 367 | 370 | 	{ MNT_RELOAD,		"reload" },				\ |
| 368 | 371 | 	{ MNT_FORCE,		"force" },				\ |
| 369 | 372 | 	{ MNT_SNAPSHOT,		"snapshot" },				\ |
| 373 | 	{ MNT_NAMEDATTR,	"named attributes" },			\ | |
| 370 | 374 | 	{ 0, NULL } |
| 371 | 375 | #endif |
| 372 | 376 | |
| ... | ... | @@ -392,6 +396,7 @@ struct mntoptnames { |
| 392 | 396 | #define	MNT_SUJ		0x0000000100000000ULL /* using journaled soft updates */ |
| 393 | 397 | #define	MNT_AUTOMOUNTED	0x0000000200000000ULL /* mounted by automountd(8) */ |
| 394 | 398 | #define	MNT_UNTRUSTED	0x0000000800000000ULL /* filesys metadata untrusted */ |
| 399 | #define	MNT_NAMEDATTR	0x0000020000000000ULL /* named attributes enabled */ | |
| 395 | 400 | |
| 396 | 401 | /* |
| 397 | 402 | * NFS export related mount flags. |
| ... | ... | @@ -431,7 +436,7 @@ struct mntoptnames { |
| 431 | 436 | 			MNT_IGNORE	| MNT_EXPUBLIC	| MNT_NOSYMFOLLOW | \ |
| 432 | 437 | 			MNT_GJOURNAL	| MNT_MULTILABEL | MNT_ACLS	| \ |
| 433 | 438 | 			MNT_NFS4ACLS	| MNT_AUTOMOUNTED | MNT_VERIFIED | \ |
| 434 | 			MNT_UNTRUSTED) | |
| 439 | 			MNT_UNTRUSTED	| MNT_NAMEDATTR) | |
| 435 | 440 | |
| 436 | 441 | /* Mask of flags that can be updated. */ |
| 437 | 442 | #define	MNT_UPDATEMASK (MNT_NOSUID	| MNT_NOEXEC	| \ |
| ... | ... | @@ -687,6 +692,8 @@ struct ovfsconf { |
| 687 | 692 | #define	VFCF_SBDRY	0x01000000	/* Stop at Boundary: defer stop requests |
| 688 | 693 | 					 to kernel->user (AST) transition */ |
| 689 | 694 | #define	VFCF_FILEMOUNT	0x02000000	/* allow mounting files */ |
| 695 | #define	VFCF_FILEREVINC	0x04000000	/* va_filerev is incr. by one */ | |
| 696 | #define	VFCF_FILEREVCT	0x08000000	/* va_filerev is set to ctime */ | |
| 690 | 697 | |
| 691 | 698 | typedef uint32_t fsctlop_t; |
| 692 | 699 | |
| ... | ... | @@ -1000,6 +1007,7 @@ struct mntarg *mount_argsu(struct mntarg *ma, const char *name, const void *val, |
| 1000 | 1007 | void	statfs_scale_blocks(struct statfs *sf, long max_size); |
| 1001 | 1008 | struct vfsconf *vfs_byname(const char *); |
| 1002 | 1009 | struct vfsconf *vfs_byname_kld(const char *, struct thread *td, int *); |
| 1010 | void	vfs_unref_vfsconf(struct vfsconf *vfsp); | |
| 1003 | 1011 | void	vfs_mount_destroy(struct mount *); |
| 1004 | 1012 | void	vfs_event_signal(fsid_t *, u_int32_t, intptr_t); |
| 1005 | 1013 | void	vfs_freeopts(struct vfsoptlist *opts); |
lib/libc/include/generic-freebsd/sys/msg.h-3| ... | ... | @@ -162,9 +162,6 @@ int msgctl(int, int, struct msqid_ds *); |
| 162 | 162 | int msgget(key_t, int); |
| 163 | 163 | ssize_t msgrcv(int, void *, size_t, long, int); |
| 164 | 164 | int msgsnd(int, const void *, size_t, int); |
| 165 | #if __BSD_VISIBLE | |
| 166 | int msgsys(int, ...); | |
| 167 | #endif | |
| 168 | 165 | __END_DECLS |
| 169 | 166 | #endif /* !_KERNEL */ |
| 170 | 167 |
lib/libc/include/generic-freebsd/sys/msgbuf.h-2| ... | ... | @@ -27,8 +27,6 @@ |
| 27 | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | * | |
| 31 | *	@(#)msgbuf.h	8.1 (Berkeley) 6/2/93 | |
| 32 | 30 | */ |
| 33 | 31 | |
| 34 | 32 | #ifndef _SYS_MSGBUF_H_ |
lib/libc/include/generic-freebsd/sys/mtio.h-2| ... | ... | @@ -27,8 +27,6 @@ |
| 27 | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | * | |
| 31 | *	@(#)mtio.h	8.1 (Berkeley) 6/2/93 | |
| 32 | 30 | */ |
| 33 | 31 | |
| 34 | 32 | #ifndef	_SYS_MTIO_H_ |
lib/libc/include/generic-freebsd/sys/mutex.h+1-1| ... | ... | @@ -91,7 +91,7 @@ |
| 91 | 91 | void	_mtx_init(volatile uintptr_t *c, const char *name, const char *type, |
| 92 | 92 | 	 int opts); |
| 93 | 93 | void	_mtx_destroy(volatile uintptr_t *c); |
| 94 | void	mtx_sysinit(void *arg); | |
| 94 | void	mtx_sysinit(const void *arg); | |
| 95 | 95 | int	_mtx_trylock_flags_int(struct mtx *m, int opts LOCK_FILE_LINE_ARG_DEF); |
| 96 | 96 | int	_mtx_trylock_flags_(volatile uintptr_t *c, int opts, const char *file, |
| 97 | 97 | 	 int line); |
lib/libc/include/generic-freebsd/sys/namei.h+26-8| ... | ... | @@ -27,8 +27,6 @@ |
| 27 | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | * | |
| 31 | *	@(#)namei.h	8.5 (Berkeley) 1/9/95 | |
| 32 | 30 | */ |
| 33 | 31 | |
| 34 | 32 | #ifndef _SYS_NAMEI_H_ |
| ... | ... | @@ -40,6 +38,8 @@ |
| 40 | 38 | #include <sys/_seqc.h> |
| 41 | 39 | #include <sys/_uio.h> |
| 42 | 40 | |
| 41 | #include <vm/uma.h> | |
| 42 | ||
| 43 | 43 | enum nameiop { LOOKUP, CREATE, DELETE, RENAME }; |
| 44 | 44 | |
| 45 | 45 | struct componentname { |
| ... | ... | @@ -70,7 +70,7 @@ struct nameidata { |
| 70 | 70 | 	 */ |
| 71 | 71 | 	const	char *ni_dirp;		/* pathname pointer */ |
| 72 | 72 | 	enum	uio_seg ni_segflg;	/* location of pathname */ |
| 73 | 	cap_rights_t *ni_rightsneeded;	/* rights required to look up vnode */ | |
| 73 | 	const cap_rights_t *ni_rightsneeded; /* rights needed to look up vnode */ | |
| 74 | 74 | 	/* |
| 75 | 75 | 	 * Arguments to lookup. |
| 76 | 76 | 	 */ |
| ... | ... | @@ -108,7 +108,12 @@ struct nameidata { |
| 108 | 108 | 	 * through the VOP interface. |
| 109 | 109 | 	 */ |
| 110 | 110 | 	struct componentname ni_cnd; |
| 111 | ||
| 112 | 	/* Serving RBENEATH. */ | |
| 111 | 113 | 	struct nameicap_tracker_head ni_cap_tracker; |
| 114 | 	struct vnode *ni_rbeneath_dpp; | |
| 115 | 	struct mount *ni_nctrack_mnt; | |
| 116 | ||
| 112 | 117 | 	/* |
| 113 | 118 | 	 * Private helper data for UFS, must be at the end. See |
| 114 | 119 | 	 * NDINIT_PREFILL(). |
| ... | ... | @@ -152,6 +157,7 @@ int	cache_fplookup(struct nameidata *ndp, enum cache_fpl_status *status, |
| 152 | 157 | #define	LOCKSHARED	0x0100	/* Shared lock leaf */ |
| 153 | 158 | #define	NOFOLLOW	0x0000	/* do not follow symbolic links (pseudo) */ |
| 154 | 159 | #define	RBENEATH	0x100000000ULL /* No escape, even tmp, from start dir */ |
| 160 | #define	NAMEILOOKUP	0x200000000ULL /* cnp is embedded in nameidata */ | |
| 155 | 161 | #define	MODMASK		0xf000001ffULL	/* mask of operational modifiers */ |
| 156 | 162 | |
| 157 | 163 | /* |
| ... | ... | @@ -159,7 +165,7 @@ int	cache_fplookup(struct nameidata *ndp, enum cache_fpl_status *status, |
| 159 | 165 | */ |
| 160 | 166 | #define	RDONLY		0x00000200 /* lookup with read-only semantics */ |
| 161 | 167 | #define	ISRESTARTED	0x00000400 /* restarted namei */ |
| 162 | /* UNUSED		0x00000800 */ | |
| 168 | #define	IGNOREWHITEOUT	0x00000800 /* ignore whiteouts, e.g. when checking if a dir is empty */ | |
| 163 | 169 | #define	ISWHITEOUT	0x00001000 /* found whiteout */ |
| 164 | 170 | #define	DOWHITEOUT	0x00002000 /* do whiteouts */ |
| 165 | 171 | #define	WILLBEDIR	0x00004000 /* new files will be dirs; allow trailing / */ |
| ... | ... | @@ -172,14 +178,15 @@ int	cache_fplookup(struct nameidata *ndp, enum cache_fpl_status *status, |
| 172 | 178 | #define	OPENREAD	0x00200000 /* open for reading */ |
| 173 | 179 | #define	OPENWRITE	0x00400000 /* open for writing */ |
| 174 | 180 | #define	WANTIOCTLCAPS	0x00800000 /* leave ioctl caps for the caller */ |
| 175 | /* UNUSED		0x01000000 */ | |
| 181 | #define	OPENNAMED	0x01000000 /* opening a named attribute (dir) */ | |
| 176 | 182 | #define	NOEXECCHECK	0x02000000 /* do not perform exec check on dir */ |
| 177 | 183 | #define	MAKEENTRY	0x04000000 /* entry is to be added to name cache */ |
| 178 | 184 | #define	ISSYMLINK	0x08000000 /* symlink needs interpretation */ |
| 179 | 185 | #define	ISLASTCN	0x10000000 /* this is last component of pathname */ |
| 180 | 186 | #define	ISDOTDOT	0x20000000 /* current component name is .. */ |
| 181 | 187 | #define	TRAILINGSLASH	0x40000000 /* path ended in a slash */ |
| 182 | #define	PARAMASK	0x7ffffe00 /* mask of parameter descriptors */ | |
| 188 | #define	CREATENAMED	0x80000000 /* create a named attribute dir */ | |
| 189 | #define	PARAMASK	0xfffffe00 /* mask of parameter descriptors */ | |
| 183 | 190 | |
| 184 | 191 | /* |
| 185 | 192 | * Flags which must not be passed in by callers. |
| ... | ... | @@ -194,6 +201,7 @@ int	cache_fplookup(struct nameidata *ndp, enum cache_fpl_status *status, |
| 194 | 201 | #define	NIRES_ABS	0x00000001 /* Path was absolute */ |
| 195 | 202 | #define	NIRES_STRICTREL	0x00000002 /* Restricted lookup result */ |
| 196 | 203 | #define	NIRES_EMPTYPATH	0x00000004 /* EMPTYPATH used */ |
| 204 | #define	NIRES_BENEATH	0x00000008 /* O_RESOLVE_BENEATH is to be inherited */ | |
| 197 | 205 | |
| 198 | 206 | /* |
| 199 | 207 | * Flags in ni_lcf, valid for the duration of the namei call. |
| ... | ... | @@ -232,6 +240,10 @@ int	cache_fplookup(struct nameidata *ndp, enum cache_fpl_status *status, |
| 232 | 240 | 		panic("namei data not inited");					\ |
| 233 | 241 | 	if (((arg)->ni_debugflags & NAMEI_DBG_HADSTARTDIR) != 0)		\ |
| 234 | 242 | 		panic("NDREINIT on namei data with NAMEI_DBG_HADSTARTDIR");	\ |
| 243 | 	if ((arg)->ni_nctrack_mnt != NULL)			\ | |
| 244 | 		panic("NDREINIT on namei data with leaked ni_nctrack_mnt");	\ | |
| 245 | 	if (!TAILQ_EMPTY(&(arg)->ni_cap_tracker))				\ | |
| 246 | 		panic("NDREINIT on namei data with leaked ni_cap_tracker");	\ | |
| 235 | 247 | 	(arg)->ni_debugflags = NAMEI_DBG_INITED;				\ |
| 236 | 248 | } |
| 237 | 249 | #else |
| ... | ... | @@ -243,12 +255,12 @@ int	cache_fplookup(struct nameidata *ndp, enum cache_fpl_status *status, |
| 243 | 255 | #define NDINIT_ALL(ndp, op, flags, segflg, namep, dirfd, startdir, rightsp)	\ |
| 244 | 256 | do {										\ |
| 245 | 257 | 	struct nameidata *_ndp = (ndp);						\ |
| 246 | 	cap_rights_t *_rightsp = (rightsp);					\ | |
| 258 | 	const cap_rights_t *_rightsp = (rightsp);					\ | |
| 247 | 259 | 	MPASS(_rightsp != NULL);						\ |
| 248 | 260 | 	NDINIT_PREFILL(_ndp);							\ |
| 249 | 261 | 	NDINIT_DBG(_ndp);							\ |
| 250 | 262 | 	_ndp->ni_cnd.cn_nameiop = op;						\ |
| 251 | 	_ndp->ni_cnd.cn_flags = flags;						\ | |
| 263 | 	_ndp->ni_cnd.cn_flags = (flags) | NAMEILOOKUP;				\ | |
| 252 | 264 | 	_ndp->ni_segflg = segflg;						\ |
| 253 | 265 | 	_ndp->ni_dirp = namep;							\ |
| 254 | 266 | 	_ndp->ni_dirfd = dirfd;							\ |
| ... | ... | @@ -256,6 +268,9 @@ do {										\ |
| 256 | 268 | 	_ndp->ni_resflags = 0;							\ |
| 257 | 269 | 	filecaps_init(&_ndp->ni_filecaps);					\ |
| 258 | 270 | 	_ndp->ni_rightsneeded = _rightsp;					\ |
| 271 | 	_ndp->ni_rbeneath_dpp = NULL;						\ | |
| 272 | 	_ndp->ni_nctrack_mnt = NULL;						\ | |
| 273 | 	TAILQ_INIT(&_ndp->ni_cap_tracker);					\ | |
| 259 | 274 | } while (0) |
| 260 | 275 | |
| 261 | 276 | #define NDREINIT(ndp)	do {							\ |
| ... | ... | @@ -264,6 +279,7 @@ do {										\ |
| 264 | 279 | 	filecaps_free(&_ndp->ni_filecaps);					\ |
| 265 | 280 | 	_ndp->ni_resflags = 0;							\ |
| 266 | 281 | 	_ndp->ni_startdir = NULL;						\ |
| 282 | 	_ndp->ni_cnd.cn_flags &= ~NAMEI_INTERNAL_FLAGS;				\ | |
| 267 | 283 | } while (0) |
| 268 | 284 | |
| 269 | 285 | #define	NDPREINIT(ndp) do {							\ |
| ... | ... | @@ -285,6 +301,8 @@ do {										\ |
| 285 | 301 | |
| 286 | 302 | int	namei(struct nameidata *ndp); |
| 287 | 303 | int	vfs_lookup(struct nameidata *ndp); |
| 304 | bool	vfs_lookup_isroot(struct nameidata *ndp, struct vnode *dvp); | |
| 305 | struct nameidata *vfs_lookup_nameidata(struct componentname *cnp); | |
| 288 | 306 | int	vfs_relookup(struct vnode *dvp, struct vnode **vpp, |
| 289 | 307 | 	 struct componentname *cnp, bool refstart); |
| 290 | 308 |
lib/libc/include/generic-freebsd/sys/nlist_aout.h-2| ... | ... | @@ -32,8 +32,6 @@ |
| 32 | 32 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 33 | 33 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 34 | 34 | * SUCH DAMAGE. |
| 35 | * | |
| 36 | *	@(#)nlist.h	8.2 (Berkeley) 1/21/94 | |
| 37 | 35 | */ |
| 38 | 36 | |
| 39 | 37 | #ifndef _SYS_NLIST_AOUT_H_ |
lib/libc/include/generic-freebsd/sys/nv.h+1-7| ... | ... | @@ -34,6 +34,7 @@ |
| 34 | 34 | #define	_NV_H_ |
| 35 | 35 | |
| 36 | 36 | #include <sys/cdefs.h> |
| 37 | #include <sys/_nv.h> | |
| 37 | 38 | |
| 38 | 39 | #ifndef _KERNEL |
| 39 | 40 | #include <stdarg.h> |
| ... | ... | @@ -43,13 +44,6 @@ |
| 43 | 44 | #include <sys/nv_namespace.h> |
| 44 | 45 | #endif |
| 45 | 46 | |
| 46 | #ifndef	_NVLIST_T_DECLARED | |
| 47 | #define	_NVLIST_T_DECLARED | |
| 48 | struct nvlist; | |
| 49 | ||
| 50 | typedef struct nvlist nvlist_t; | |
| 51 | #endif | |
| 52 | ||
| 53 | 47 | #define	NV_NAME_MAX	2048 |
| 54 | 48 | |
| 55 | 49 | #define	NV_TYPE_NONE			0 |
lib/libc/include/generic-freebsd/sys/nvpair.h+3| ... | ... | @@ -1,3 +1,4 @@ |
| 1 | // SPDX-License-Identifier: CDDL-1.0 | |
| 1 | 2 | /* |
| 2 | 3 | * CDDL HEADER START |
| 3 | 4 | * |
| ... | ... | @@ -266,6 +267,8 @@ _SYS_NVPAIR_H int nvlist_lookup_double(const nvlist_t *, const char *, |
| 266 | 267 | double *); |
| 267 | 268 | #endif |
| 268 | 269 | |
| 270 | _SYS_NVPAIR_H int nvlist_snprintf(char *, size_t, nvlist_t *, int); | |
| 271 | ||
| 269 | 272 | _SYS_NVPAIR_H int nvlist_lookup_nvpair(nvlist_t *, const char *, nvpair_t **); |
| 270 | 273 | _SYS_NVPAIR_H int nvlist_lookup_nvpair_embedded_index(nvlist_t *, const char *, |
| 271 | 274 | nvpair_t **, int *, const char **); |
lib/libc/include/generic-freebsd/sys/osd.h+6-1| ... | ... | @@ -55,7 +55,7 @@ typedef void (*osd_destructor_t)(void *value); |
| 55 | 55 | typedef int (*osd_method_t)(void *obj, void *data); |
| 56 | 56 | |
| 57 | 57 | int osd_register(u_int type, osd_destructor_t destructor, |
| 58 | osd_method_t *methods); | |
| 58 | const osd_method_t *methods); | |
| 59 | 59 | void osd_deregister(u_int type, u_int slot); |
| 60 | 60 | |
| 61 | 61 | int osd_set(u_int type, struct osd *osd, u_int slot, void *value); |
| ... | ... | @@ -64,6 +64,7 @@ int osd_set_reserved(u_int type, struct osd *osd, u_int slot, void **rsv, |
| 64 | 64 | void *value); |
| 65 | 65 | void osd_free_reserved(void **rsv); |
| 66 | 66 | void *osd_get(u_int type, struct osd *osd, u_int slot); |
| 67 | void *osd_get_unlocked(u_int type, struct osd *osd, u_int slot); | |
| 67 | 68 | void osd_del(u_int type, struct osd *osd, u_int slot); |
| 68 | 69 | int osd_call(u_int type, u_int method, void *obj, void *data); |
| 69 | 70 | |
| ... | ... | @@ -79,6 +80,8 @@ void osd_exit(u_int type, struct osd *osd); |
| 79 | 80 | 	osd_set_reserved(OSD_THREAD, &(td)->td_osd, (slot), (rsv), (value)) |
| 80 | 81 | #define	osd_thread_get(td, slot)					\ |
| 81 | 82 | 	osd_get(OSD_THREAD, &(td)->td_osd, (slot)) |
| 83 | #define	osd_thread_get_unlocked(td, slot)				\ | |
| 84 | 	osd_get_unlocked(OSD_THREAD, &(td)->td_osd, (slot)) | |
| 82 | 85 | #define	osd_thread_del(td, slot)	do {				\ |
| 83 | 86 | 	KASSERT((td) == curthread, ("Not curthread."));			\ |
| 84 | 87 | 	osd_del(OSD_THREAD, &(td)->td_osd, (slot));			\ |
| ... | ... | @@ -98,6 +101,8 @@ void osd_exit(u_int type, struct osd *osd); |
| 98 | 101 | 	osd_set_reserved(OSD_JAIL, &(pr)->pr_osd, (slot), (rsv), (value)) |
| 99 | 102 | #define	osd_jail_get(pr, slot)						\ |
| 100 | 103 | 	osd_get(OSD_JAIL, &(pr)->pr_osd, (slot)) |
| 104 | #define	osd_jail_get_unlocked(pr, slot)					\ | |
| 105 | 	osd_get_unlocked(OSD_JAIL, &(pr)->pr_osd, (slot)) | |
| 101 | 106 | #define	osd_jail_del(pr, slot)						\ |
| 102 | 107 | 	osd_del(OSD_JAIL, &(pr)->pr_osd, (slot)) |
| 103 | 108 | #define	osd_jail_call(pr, method, data)					\ |
lib/libc/include/generic-freebsd/sys/param.h+18-26| ... | ... | @@ -32,14 +32,13 @@ |
| 32 | 32 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 33 | 33 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 34 | 34 | * SUCH DAMAGE. |
| 35 | * | |
| 36 | *	@(#)param.h	8.3 (Berkeley) 4/4/95 | |
| 37 | 35 | */ |
| 38 | 36 | |
| 39 | 37 | #ifndef _SYS_PARAM_H_ |
| 40 | 38 | #define _SYS_PARAM_H_ |
| 41 | 39 | |
| 42 | 40 | #include <sys/_null.h> |
| 41 | #include <sys/_param.h> | |
| 43 | 42 | |
| 44 | 43 | #define	BSD	199506		/* System version (year & month). */ |
| 45 | 44 | #define BSD4_3	1 |
| ... | ... | @@ -107,6 +106,8 @@ |
| 107 | 106 | #define	P_OSREL_POWERPC_NEW_AUX_ARGS	1300070 |
| 108 | 107 | #define	P_OSREL_TIDPID			1400079 |
| 109 | 108 | #define	P_OSREL_ARM64_SPSR		1400084 |
| 109 | #define	P_OSREL_TLSBASE			1500044 | |
| 110 | #define	P_OSREL_EXTERRCTL		1500045 | |
| 110 | 111 | |
| 111 | 112 | #define	P_OSREL_MAJOR(x)		((x) / 100000) |
| 112 | 113 | #endif |
| ... | ... | @@ -151,17 +152,16 @@ |
| 151 | 152 | #endif |
| 152 | 153 | #endif |
| 153 | 154 | |
| 154 | #ifndef _KERNEL | |
| 155 | #ifndef LOCORE | |
| 155 | #if !defined(_KERNEL) && !defined(_STANDALONE) && !defined(LOCORE) | |
| 156 | 156 | /* Signals. */ |
| 157 | 157 | #include <sys/signal.h> |
| 158 | 158 | #endif |
| 159 | #endif | |
| 160 | 159 | |
| 161 | 160 | /* Machine type dependent parameters. */ |
| 162 | 161 | #include <machine/param.h> |
| 163 | 162 | #ifndef _KERNEL |
| 164 | 163 | #include <sys/limits.h> |
| 164 | #include <sys/_maxphys.h> | |
| 165 | 165 | #endif |
| 166 | 166 | |
| 167 | 167 | #ifndef DEV_BSHIFT |
| ... | ... | @@ -175,13 +175,6 @@ |
| 175 | 175 | #ifndef DFLTPHYS |
| 176 | 176 | #define DFLTPHYS	(64 * 1024)	/* default max raw I/O transfer size */ |
| 177 | 177 | #endif |
| 178 | #ifndef MAXPHYS				/* max raw I/O transfer size */ | |
| 179 | #ifdef __ILP32__ | |
| 180 | #define MAXPHYS		(128 * 1024) | |
| 181 | #else | |
| 182 | #define MAXPHYS		(1024 * 1024) | |
| 183 | #endif | |
| 184 | #endif | |
| 185 | 178 | #ifndef MAXDUMPPGS |
| 186 | 179 | #define MAXDUMPPGS	(DFLTPHYS/PAGE_SIZE) |
| 187 | 180 | #endif |
| ... | ... | @@ -209,6 +202,17 @@ |
| 209 | 202 | #define	MJUM9BYTES	(9 * 1024)	/* jumbo cluster 9k */ |
| 210 | 203 | #define	MJUM16BYTES	(16 * 1024)	/* jumbo cluster 16k */ |
| 211 | 204 | |
| 205 | /* | |
| 206 | * Mach derived conversion macros | |
| 207 | */ | |
| 208 | #define	round_page(x)	roundup2(x, PAGE_SIZE) | |
| 209 | #define	trunc_page(x)	rounddown2(x, PAGE_SIZE) | |
| 210 | ||
| 211 | #define	atop(x)		((x) >> PAGE_SHIFT) | |
| 212 | #define	ptoa(x)		((x) << PAGE_SHIFT) | |
| 213 | ||
| 214 | #define	pgtok(x)	((x) * (PAGE_SIZE / 1024)) | |
| 215 | ||
| 212 | 216 | /* |
| 213 | 217 | * Some macros for units conversion |
| 214 | 218 | */ |
| ... | ... | @@ -249,9 +253,6 @@ |
| 249 | 253 | |
| 250 | 254 | #define	NZERO	0		/* default "nice" */ |
| 251 | 255 | |
| 252 | #define	NBBY	8		/* number of bits in a byte */ | |
| 253 | #define	NBPW	sizeof(int)	/* number of bytes per word (integer) */ | |
| 254 | ||
| 255 | 256 | #define	CMASK	022		/* default file mask: S_IWGRP|S_IWOTH */ |
| 256 | 257 | |
| 257 | 258 | #define	NODEV	(dev_t)(-1)	/* non-existent device */ |
| ... | ... | @@ -315,16 +316,7 @@ |
| 315 | 316 | #define	isclr(a,i)							\ |
| 316 | 317 | 	((((const unsigned char *)(a))[(i)/NBBY] & (1<<((i)%NBBY))) == 0) |
| 317 | 318 | |
| 318 | /* Macros for counting and rounding. */ | |
| 319 | #ifndef howmany | |
| 320 | #define	howmany(x, y)	(((x)+((y)-1))/(y)) | |
| 321 | #endif | |
| 322 | #define	nitems(x)	(sizeof((x)) / sizeof((x)[0])) | |
| 323 | #define	rounddown(x, y)	(((x)/(y))*(y)) | |
| 324 | #define	rounddown2(x, y) __align_down(x, y) /* if y is power of two */ | |
| 325 | #define	roundup(x, y)	((((x)+((y)-1))/(y))*(y)) /* to any y */ | |
| 326 | #define	roundup2(x, y)	__align_up(x, y) /* if y is powers of two */ | |
| 327 | #define powerof2(x)	((((x)-1)&(x))==0) | |
| 319 | /* Macros for counting and rounding provided by <sys/_param.h>. */ | |
| 328 | 320 | |
| 329 | 321 | /* Macros for min/max. */ |
| 330 | 322 | #define	MIN(a,b) (((a)<(b))?(a):(b)) |
| ... | ... | @@ -387,4 +379,4 @@ __END_DECLS |
| 387 | 379 | */ |
| 388 | 380 | #define __PAST_END(array, offset) (((__typeof__(*(array)) *)(array))[offset]) |
| 389 | 381 | |
| 390 | #endif	/* _SYS_PARAM_H_ */ | |
| 382 | #endif	/* _SYS_PARAM_H_ */ | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/sys/pciio.h+6-3| ... | ... | @@ -66,10 +66,10 @@ struct pci_conf { |
| 66 | 66 | 	struct pcisel	pc_sel;		/* domain+bus+slot+function */ |
| 67 | 67 | 	u_int8_t	pc_hdr;		/* PCI header type */ |
| 68 | 68 | 	u_int16_t	pc_subvendor;	/* card vendor ID */ |
| 69 | 	u_int16_t	pc_subdevice;	/* card device ID, assigned by | |
| 69 | 	u_int16_t	pc_subdevice;	/* card device ID, assigned by | |
| 70 | 70 | 					 card vendor */ |
| 71 | 71 | 	u_int16_t	pc_vendor;	/* chip vendor ID */ |
| 72 | 	u_int16_t	pc_device;	/* chip device ID, assigned by | |
| 72 | 	u_int16_t	pc_device;	/* chip device ID, assigned by | |
| 73 | 73 | 					 chip vendor */ |
| 74 | 74 | 	u_int8_t	pc_class;	/* chip PCI class */ |
| 75 | 75 | 	u_int8_t	pc_subclass;	/* chip PCI subclass */ |
| ... | ... | @@ -77,6 +77,9 @@ struct pci_conf { |
| 77 | 77 | 	u_int8_t	pc_revid;	/* chip revision ID */ |
| 78 | 78 | 	char		pd_name[PCI_MAXNAMELEN + 1]; /* device name */ |
| 79 | 79 | 	u_long		pd_unit;	/* device unit number */ |
| 80 | 	int		pd_numa_domain;	/* device NUMA domain */ | |
| 81 | 	size_t		pc_reported_len;/* length of PCI data reported */ | |
| 82 | 	char		pc_spare[64];	/* space for future fields */ | |
| 80 | 83 | }; |
| 81 | 84 | |
| 82 | 85 | struct pci_match_conf { |
| ... | ... | @@ -165,7 +168,6 @@ struct pci_bar_ioreq { |
| 165 | 168 | #define	PCIIO_BAR_MMAP_RW	0x04 |
| 166 | 169 | #define	PCIIO_BAR_MMAP_ACTIVATE	0x08 |
| 167 | 170 | |
| 168 | #define	PCIOCGETCONF	_IOWR('p', 5, struct pci_conf_io) | |
| 169 | 171 | #define	PCIOCREAD	_IOWR('p', 2, struct pci_io) |
| 170 | 172 | #define	PCIOCWRITE	_IOWR('p', 3, struct pci_io) |
| 171 | 173 | #define	PCIOCATTACHED	_IOWR('p', 4, struct pci_io) |
| ... | ... | @@ -173,5 +175,6 @@ struct pci_bar_ioreq { |
| 173 | 175 | #define	PCIOCLISTVPD	_IOWR('p', 7, struct pci_list_vpd_io) |
| 174 | 176 | #define	PCIOCBARMMAP	_IOWR('p', 8, struct pci_bar_mmap) |
| 175 | 177 | #define	PCIOCBARIO	_IOWR('p', 9, struct pci_bar_ioreq) |
| 178 | #define	PCIOCGETCONF	_IOWR('p', 10, struct pci_conf_io) | |
| 176 | 179 | |
| 177 | 180 | #endif /* !_SYS_PCIIO_H_ */ |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/sys/pctrie.h+293-20| ... | ... | @@ -34,8 +34,45 @@ |
| 34 | 34 | #include <sys/_pctrie.h> |
| 35 | 35 | #include <sys/_smr.h> |
| 36 | 36 | |
| 37 | struct pctrie_iter { | |
| 38 | 	struct pctrie *ptree; | |
| 39 | 	struct pctrie_node *node; | |
| 40 | 	uint64_t index; | |
| 41 | 	uint64_t limit; | |
| 42 | }; | |
| 43 | ||
| 44 | static __inline void | |
| 45 | pctrie_iter_reset(struct pctrie_iter *it) | |
| 46 | { | |
| 47 | 	it->node = NULL; | |
| 48 | } | |
| 49 | ||
| 50 | static __inline bool | |
| 51 | pctrie_iter_is_reset(struct pctrie_iter *it) | |
| 52 | { | |
| 53 | 	return (it->node == NULL); | |
| 54 | } | |
| 55 | ||
| 56 | static __inline void | |
| 57 | pctrie_iter_init(struct pctrie_iter *it, struct pctrie *ptree) | |
| 58 | { | |
| 59 | 	it->ptree = ptree; | |
| 60 | 	it->node = NULL; | |
| 61 | 	it->limit = 0; | |
| 62 | } | |
| 63 | ||
| 64 | static __inline void | |
| 65 | pctrie_iter_limit_init(struct pctrie_iter *it, struct pctrie *ptree, | |
| 66 | uint64_t limit) | |
| 67 | { | |
| 68 | 	pctrie_iter_init(it, ptree); | |
| 69 | 	it->limit = limit; | |
| 70 | } | |
| 71 | ||
| 37 | 72 | #ifdef _KERNEL |
| 38 | 73 | |
| 74 | typedef void (*pctrie_cb_t)(void *ptr, void *arg); | |
| 75 | ||
| 39 | 76 | #define	PCTRIE_DEFINE_SMR(name, type, field, allocfn, freefn, smr)	\ |
| 40 | 77 | PCTRIE_DEFINE(name, type, field, allocfn, freefn)			\ |
| 41 | 78 | 									\ |
| ... | ... | @@ -46,6 +83,19 @@ name##_PCTRIE_LOOKUP_UNLOCKED(struct pctrie *ptree, uint64_t key)	\ |
| 46 | 83 | 	return name##_PCTRIE_VAL2PTR(pctrie_lookup_unlocked(ptree,	\ |
| 47 | 84 | 	 key, (smr)));						\ |
| 48 | 85 | }									\ |
| 86 | 									\ | |
| 87 | static __inline __unused int						\ | |
| 88 | name##_PCTRIE_LOOKUP_RANGE_UNLOCKED(struct pctrie *ptree, uint64_t key,	\ | |
| 89 | struct type *value[], int count) 					\ | |
| 90 | {									\ | |
| 91 | 	uint64_t **data = (uint64_t **)value;				\ | |
| 92 | 									\ | |
| 93 | 	count = pctrie_lookup_range_unlocked(ptree, key, data, count,	\ | |
| 94 | 	 (smr));							\ | |
| 95 | 	for (int i = 0; i < count; i++)					\ | |
| 96 | 		value[i] = name##_PCTRIE_NZVAL2PTR(data[i]);		\ | |
| 97 | 	return (count);							\ | |
| 98 | }									\ | |
| 49 | 99 | |
| 50 | 100 | #define	PCTRIE_DEFINE(name, type, field, allocfn, freefn)		\ |
| 51 | 101 | 									\ |
| ... | ... | @@ -57,13 +107,18 @@ CTASSERT(sizeof(((struct type *)0)->field) == sizeof(uint64_t));	\ |
| 57 | 107 | CTASSERT((__offsetof(struct type, field) & (sizeof(uint32_t) - 1)) == 0); \ |
| 58 | 108 | 									\ |
| 59 | 109 | static __inline struct type *						\ |
| 60 | name##_PCTRIE_VAL2PTR(uint64_t *val)					\ | |
| 110 | name##_PCTRIE_NZVAL2PTR(uint64_t *val)					\ | |
| 61 | 111 | {									\ |
| 112 | 	return (struct type *)						\ | |
| 113 | 	 ((uintptr_t)val - __offsetof(struct type, field));		\ | |
| 114 | }									\ | |
| 62 | 115 | 									\ |
| 116 | static __inline struct type *						\ | |
| 117 | name##_PCTRIE_VAL2PTR(uint64_t *val)					\ | |
| 118 | {									\ | |
| 63 | 119 | 	if (val == NULL)						\ |
| 64 | 120 | 		return (NULL);						\ |
| 65 | 	return (struct type *)						\ | |
| 66 | 	 ((uintptr_t)val - __offsetof(struct type, field));		\ | |
| 121 | 	return (name##_PCTRIE_NZVAL2PTR(val));				\ | |
| 67 | 122 | }									\ |
| 68 | 123 | 									\ |
| 69 | 124 | static __inline uint64_t *						\ |
| ... | ... | @@ -73,23 +128,87 @@ name##_PCTRIE_PTR2VAL(struct type *ptr)					\ |
| 73 | 128 | 	return &ptr->field;						\ |
| 74 | 129 | }									\ |
| 75 | 130 | 									\ |
| 76 | static __inline int							\ | |
| 131 | static __inline __unused int						\ | |
| 132 | name##_PCTRIE_INSERT_BASE(struct pctrie *ptree, uint64_t *val,		\ | |
| 133 | struct pctrie_node **parent, void *parentp,				\ | |
| 134 | uint64_t *found, struct type **found_out)				\ | |
| 135 | {									\ | |
| 136 | 	struct pctrie_node *child;					\ | |
| 137 | 									\ | |
| 138 | 	if (__predict_false(found != NULL)) {				\ | |
| 139 | 		*found_out = name##_PCTRIE_VAL2PTR(found);		\ | |
| 140 | 		return (EEXIST);					\ | |
| 141 | 	}								\ | |
| 142 | 	if (parentp != NULL) {						\ | |
| 143 | 		child = allocfn(ptree);					\ | |
| 144 | 		if (__predict_false(child == NULL)) {			\ | |
| 145 | 			if (found_out != NULL)				\ | |
| 146 | 				*found_out = NULL;			\ | |
| 147 | 			return (ENOMEM);				\ | |
| 148 | 		}							\ | |
| 149 | 		pctrie_insert_node(val, *parent, parentp, child);	\ | |
| 150 | 		*parent = child;					\ | |
| 151 | 	}								\ | |
| 152 | 	return (0);							\ | |
| 153 | }									\ | |
| 154 | 									\ | |
| 155 | static __inline __unused int						\ | |
| 77 | 156 | name##_PCTRIE_INSERT(struct pctrie *ptree, struct type *ptr)		\ |
| 78 | 157 | {									\ |
| 158 | 	void *parentp;							\ | |
| 79 | 159 | 	struct pctrie_node *parent;					\ |
| 160 | 	uint64_t *val = name##_PCTRIE_PTR2VAL(ptr);			\ | |
| 161 | 									\ | |
| 162 | 	parentp = pctrie_insert_lookup_strict(ptree, val, &parent);	\ | |
| 163 | 	return (name##_PCTRIE_INSERT_BASE(ptree, val, &parent, parentp,	\ | |
| 164 | 	 NULL, NULL));						\ | |
| 165 | }									\ | |
| 166 | 									\ | |
| 167 | static __inline __unused int						\ | |
| 168 | name##_PCTRIE_FIND_OR_INSERT(struct pctrie *ptree, struct type *ptr,	\ | |
| 169 | struct type **found_out_opt)					\ | |
| 170 | {									\ | |
| 80 | 171 | 	void *parentp;							\ |
| 172 | 	struct pctrie_node *parent;					\ | |
| 81 | 173 | 	uint64_t *val = name##_PCTRIE_PTR2VAL(ptr);			\ |
| 174 | 	uint64_t *found;						\ | |
| 82 | 175 | 									\ |
| 83 | 	parentp = pctrie_insert_lookup(ptree, val);			\ | |
| 84 | 	if (parentp == NULL)						\ | |
| 85 | 		return (0);						\ | |
| 86 | 	parent = allocfn(ptree);					\ | |
| 87 | 	if (parent == NULL)						\ | |
| 88 | 		return (ENOMEM);					\ | |
| 89 | 	pctrie_insert_node(parentp, parent, val);			\ | |
| 176 | 	parentp = pctrie_insert_lookup(ptree, val, &parent, &found);	\ | |
| 177 | 	return (name##_PCTRIE_INSERT_BASE(ptree, val, &parent, parentp,	\ | |
| 178 | 	 found, found_out_opt));					\ | |
| 179 | }									\ | |
| 180 | 									\ | |
| 181 | static __inline __unused int						\ | |
| 182 | name##_PCTRIE_INSERT_LOOKUP_LE(struct pctrie *ptree, struct type *ptr,	\ | |
| 183 | struct type **found_out)						\ | |
| 184 | {									\ | |
| 185 | 	struct pctrie_node *parent;					\ | |
| 186 | 	void *parentp;							\ | |
| 187 | 	uint64_t *val = name##_PCTRIE_PTR2VAL(ptr);			\ | |
| 188 | 	uint64_t *found;						\ | |
| 189 | 	int retval;							\ | |
| 190 | 									\ | |
| 191 | 	parentp = pctrie_insert_lookup(ptree, val, &parent, &found);	\ | |
| 192 | 	retval = name##_PCTRIE_INSERT_BASE(ptree, val, &parent, parentp, \ | |
| 193 | 	 found, found_out);						\ | |
| 194 | 	if (retval != 0)						\ | |
| 195 | 		return (retval);					\ | |
| 196 | 	found = pctrie_subtree_lookup_lt(ptree, parent, *val);		\ | |
| 197 | 	*found_out = name##_PCTRIE_VAL2PTR(found);			\ | |
| 90 | 198 | 	return (0);							\ |
| 91 | 199 | }									\ |
| 92 | 200 | 									\ |
| 201 | static __inline __unused int						\ | |
| 202 | name##_PCTRIE_ITER_INSERT(struct pctrie_iter *it, struct type *ptr)	\ | |
| 203 | {									\ | |
| 204 | 	void *parentp;							\ | |
| 205 | 	uint64_t *val = name##_PCTRIE_PTR2VAL(ptr);			\ | |
| 206 | 									\ | |
| 207 | 	parentp = pctrie_iter_insert_lookup(it, val);			\ | |
| 208 | 	return (name##_PCTRIE_INSERT_BASE(it->ptree, val, &it->node,	\ | |
| 209 | 	 parentp, NULL, NULL));					\ | |
| 210 | }									\ | |
| 211 | 									\ | |
| 93 | 212 | static __inline __unused struct type *					\ |
| 94 | 213 | name##_PCTRIE_LOOKUP(struct pctrie *ptree, uint64_t key)		\ |
| 95 | 214 | {									\ |
| ... | ... | @@ -97,6 +216,30 @@ name##_PCTRIE_LOOKUP(struct pctrie *ptree, uint64_t key)		\ |
| 97 | 216 | 	return name##_PCTRIE_VAL2PTR(pctrie_lookup(ptree, key));	\ |
| 98 | 217 | }									\ |
| 99 | 218 | 									\ |
| 219 | static __inline __unused int						\ | |
| 220 | name##_PCTRIE_LOOKUP_RANGE(struct pctrie *ptree, uint64_t key,		\ | |
| 221 | struct type *value[], int count) 					\ | |
| 222 | {									\ | |
| 223 | 	uint64_t **data = (uint64_t **)value;				\ | |
| 224 | 									\ | |
| 225 | 	count = pctrie_lookup_range(ptree, key, data, count);		\ | |
| 226 | 	for (int i = 0; i < count; i++)					\ | |
| 227 | 		value[i] = name##_PCTRIE_NZVAL2PTR(data[i]);		\ | |
| 228 | 	return (count);							\ | |
| 229 | }									\ | |
| 230 | 									\ | |
| 231 | static __inline __unused int						\ | |
| 232 | name##_PCTRIE_ITER_LOOKUP_RANGE(struct pctrie_iter *it, uint64_t key,	\ | |
| 233 | struct type *value[], int count) 					\ | |
| 234 | {									\ | |
| 235 | 	uint64_t **data = (uint64_t **)value;				\ | |
| 236 | 									\ | |
| 237 | 	count = pctrie_iter_lookup_range(it, key, data, count);		\ | |
| 238 | 	for (int i = 0; i < count; i++)					\ | |
| 239 | 		value[i] = name##_PCTRIE_NZVAL2PTR(data[i]);		\ | |
| 240 | 	return (count);							\ | |
| 241 | }									\ | |
| 242 | 									\ | |
| 100 | 243 | static __inline __unused struct type *					\ |
| 101 | 244 | name##_PCTRIE_LOOKUP_LE(struct pctrie *ptree, uint64_t key)		\ |
| 102 | 245 | {									\ |
| ... | ... | @@ -122,6 +265,108 @@ name##_PCTRIE_RECLAIM(struct pctrie *ptree)				\ |
| 122 | 265 | 		freefn(ptree, freenode);				\ |
| 123 | 266 | }									\ |
| 124 | 267 | 									\ |
| 268 | /*									\ | |
| 269 | * While reclaiming all internal trie nodes, invoke callback(leaf, arg)	\ | |
| 270 | * on every leaf in the trie, in order.					\ | |
| 271 | */									\ | |
| 272 | static __inline __unused void						\ | |
| 273 | name##_PCTRIE_RECLAIM_CALLBACK(struct pctrie *ptree,			\ | |
| 274 | void (*typed_cb)(struct type *, void *), void *arg)			\ | |
| 275 | {									\ | |
| 276 | 	struct pctrie_node *freenode, *node;				\ | |
| 277 | 	pctrie_cb_t callback = (pctrie_cb_t)typed_cb;			\ | |
| 278 | 									\ | |
| 279 | 	for (freenode = pctrie_reclaim_begin_cb(&node, ptree,		\ | |
| 280 | 	 callback, __offsetof(struct type, field), arg);		\ | |
| 281 | 	 freenode != NULL;						\ | |
| 282 | 	 freenode = pctrie_reclaim_resume_cb(&node,			\ | |
| 283 | 	 callback, __offsetof(struct type, field), arg))		\ | |
| 284 | 		freefn(ptree, freenode);				\ | |
| 285 | }									\ | |
| 286 | 									\ | |
| 287 | static __inline __unused struct type *					\ | |
| 288 | name##_PCTRIE_ITER_LOOKUP(struct pctrie_iter *it, uint64_t index)	\ | |
| 289 | {									\ | |
| 290 | 	return name##_PCTRIE_VAL2PTR(pctrie_iter_lookup(it, index));	\ | |
| 291 | }									\ | |
| 292 | 									\ | |
| 293 | static __inline __unused struct type *					\ | |
| 294 | name##_PCTRIE_ITER_STRIDE(struct pctrie_iter *it, int stride)		\ | |
| 295 | {									\ | |
| 296 | 	return name##_PCTRIE_VAL2PTR(pctrie_iter_stride(it, stride));	\ | |
| 297 | }									\ | |
| 298 | 									\ | |
| 299 | static __inline __unused struct type *					\ | |
| 300 | name##_PCTRIE_ITER_NEXT(struct pctrie_iter *it)				\ | |
| 301 | {									\ | |
| 302 | 	return name##_PCTRIE_VAL2PTR(pctrie_iter_next(it));		\ | |
| 303 | }									\ | |
| 304 | 									\ | |
| 305 | static __inline __unused struct type *					\ | |
| 306 | name##_PCTRIE_ITER_PREV(struct pctrie_iter *it)				\ | |
| 307 | {									\ | |
| 308 | 	return name##_PCTRIE_VAL2PTR(pctrie_iter_prev(it));		\ | |
| 309 | }									\ | |
| 310 | 									\ | |
| 311 | static __inline __unused struct type *					\ | |
| 312 | name##_PCTRIE_ITER_VALUE(struct pctrie_iter *it)			\ | |
| 313 | {									\ | |
| 314 | 	return name##_PCTRIE_VAL2PTR(pctrie_iter_value(it));		\ | |
| 315 | }									\ | |
| 316 | 									\ | |
| 317 | static __inline __unused struct type *					\ | |
| 318 | name##_PCTRIE_ITER_LOOKUP_GE(struct pctrie_iter *it, uint64_t index)	\ | |
| 319 | {									\ | |
| 320 | 	return name##_PCTRIE_VAL2PTR(pctrie_iter_lookup_ge(it, index));	\ | |
| 321 | }									\ | |
| 322 | 									\ | |
| 323 | static __inline __unused struct type *					\ | |
| 324 | name##_PCTRIE_ITER_JUMP_GE(struct pctrie_iter *it, int64_t jump)	\ | |
| 325 | {									\ | |
| 326 | 	return name##_PCTRIE_VAL2PTR(pctrie_iter_jump_ge(it, jump));	\ | |
| 327 | }									\ | |
| 328 | 									\ | |
| 329 | static __inline __unused struct type *					\ | |
| 330 | name##_PCTRIE_ITER_STEP_GE(struct pctrie_iter *it)			\ | |
| 331 | {									\ | |
| 332 | 	return name##_PCTRIE_VAL2PTR(pctrie_iter_jump_ge(it, 1));	\ | |
| 333 | }									\ | |
| 334 | 									\ | |
| 335 | static __inline __unused struct type *					\ | |
| 336 | name##_PCTRIE_ITER_LOOKUP_LE(struct pctrie_iter *it, uint64_t index)	\ | |
| 337 | {									\ | |
| 338 | 	return name##_PCTRIE_VAL2PTR(pctrie_iter_lookup_le(it, index));	\ | |
| 339 | }									\ | |
| 340 | 									\ | |
| 341 | static __inline __unused struct type *					\ | |
| 342 | name##_PCTRIE_ITER_JUMP_LE(struct pctrie_iter *it, int64_t jump)	\ | |
| 343 | {									\ | |
| 344 | 	return name##_PCTRIE_VAL2PTR(pctrie_iter_jump_le(it, jump));	\ | |
| 345 | }									\ | |
| 346 | 									\ | |
| 347 | static __inline __unused struct type *					\ | |
| 348 | name##_PCTRIE_ITER_STEP_LE(struct pctrie_iter *it)			\ | |
| 349 | {									\ | |
| 350 | 	return name##_PCTRIE_VAL2PTR(pctrie_iter_jump_le(it, 1));	\ | |
| 351 | }									\ | |
| 352 | 									\ | |
| 353 | static __inline __unused void						\ | |
| 354 | name##_PCTRIE_REMOVE_BASE(struct pctrie *ptree,				\ | |
| 355 | struct pctrie_node *freenode)					\ | |
| 356 | {									\ | |
| 357 | 	if (freenode != NULL)						\ | |
| 358 | 		freefn(ptree, freenode);				\ | |
| 359 | }									\ | |
| 360 | 									\ | |
| 361 | static __inline __unused void						\ | |
| 362 | name##_PCTRIE_ITER_REMOVE(struct pctrie_iter *it)			\ | |
| 363 | {									\ | |
| 364 | 	struct pctrie_node *freenode;					\ | |
| 365 | 									\ | |
| 366 | 	pctrie_iter_remove(it, &freenode);				\ | |
| 367 | 	name##_PCTRIE_REMOVE_BASE(it->ptree, freenode);			\ | |
| 368 | }									\ | |
| 369 | 									\ | |
| 125 | 370 | static __inline __unused struct type *					\ |
| 126 | 371 | name##_PCTRIE_REPLACE(struct pctrie *ptree, struct type *ptr)		\ |
| 127 | 372 | {									\ |
| ... | ... | @@ -139,8 +384,7 @@ name##_PCTRIE_REMOVE(struct pctrie *ptree, uint64_t key)		\ |
| 139 | 384 | 	val = pctrie_remove_lookup(ptree, key, &freenode);		\ |
| 140 | 385 | 	if (val == NULL)						\ |
| 141 | 386 | 		panic("%s: key not found", __func__);			\ |
| 142 | 	if (freenode != NULL)						\ | |
| 143 | 		freefn(ptree, freenode);				\ | |
| 387 | 	name##_PCTRIE_REMOVE_BASE(ptree, freenode);			\ | |
| 144 | 388 | }									\ |
| 145 | 389 | 									\ |
| 146 | 390 | static __inline __unused struct type *					\ |
| ... | ... | @@ -150,24 +394,53 @@ name##_PCTRIE_REMOVE_LOOKUP(struct pctrie *ptree, uint64_t key)		\ |
| 150 | 394 | 	struct pctrie_node *freenode;					\ |
| 151 | 395 | 									\ |
| 152 | 396 | 	val = pctrie_remove_lookup(ptree, key, &freenode);		\ |
| 153 | 	if (freenode != NULL)						\ | |
| 154 | 		freefn(ptree, freenode);				\ | |
| 397 | 	name##_PCTRIE_REMOVE_BASE(ptree, freenode);			\ | |
| 155 | 398 | 	return name##_PCTRIE_VAL2PTR(val);				\ |
| 156 | 399 | } |
| 157 | 400 | |
| 158 | void		*pctrie_insert_lookup(struct pctrie *ptree, uint64_t *val); | |
| 159 | void		pctrie_insert_node(void *parentp, | |
| 160 | 		 struct pctrie_node *parent, uint64_t *val); | |
| 401 | struct pctrie_iter; | |
| 402 | void		*pctrie_insert_lookup(struct pctrie *ptree, uint64_t *val, | |
| 403 | 		 struct pctrie_node **parent_out, uint64_t **found_out); | |
| 404 | void		*pctrie_insert_lookup_strict(struct pctrie *ptree, uint64_t *val, | |
| 405 | 		 struct pctrie_node **parent_out); | |
| 406 | void		pctrie_insert_node(uint64_t *val, struct pctrie_node *parent, | |
| 407 | 		 void *parentp, struct pctrie_node *child); | |
| 161 | 408 | uint64_t	*pctrie_lookup(struct pctrie *ptree, uint64_t key); |
| 162 | uint64_t	*pctrie_lookup_ge(struct pctrie *ptree, uint64_t key); | |
| 163 | uint64_t	*pctrie_lookup_le(struct pctrie *ptree, uint64_t key); | |
| 164 | 409 | uint64_t	*pctrie_lookup_unlocked(struct pctrie *ptree, uint64_t key, |
| 165 | 410 | 		 smr_t smr); |
| 411 | int		pctrie_lookup_range(struct pctrie *ptree, | |
| 412 | 		 uint64_t index, uint64_t *value[], int count); | |
| 413 | int		pctrie_lookup_range_unlocked(struct pctrie *ptree, | |
| 414 | 		 uint64_t index, uint64_t *value[], int count, smr_t smr); | |
| 415 | int		pctrie_iter_lookup_range(struct pctrie_iter *it, uint64_t index, | |
| 416 | 		 uint64_t *value[], int count); | |
| 417 | uint64_t	*pctrie_iter_lookup(struct pctrie_iter *it, uint64_t index); | |
| 418 | uint64_t	*pctrie_iter_stride(struct pctrie_iter *it, int stride); | |
| 419 | uint64_t	*pctrie_iter_next(struct pctrie_iter *it); | |
| 420 | uint64_t	*pctrie_iter_prev(struct pctrie_iter *it); | |
| 421 | void		*pctrie_iter_insert_lookup(struct pctrie_iter *it, | |
| 422 | 		 uint64_t *val); | |
| 423 | uint64_t	*pctrie_lookup_ge(struct pctrie *ptree, uint64_t key); | |
| 424 | uint64_t	*pctrie_iter_lookup_ge(struct pctrie_iter *it, uint64_t index); | |
| 425 | uint64_t	*pctrie_iter_jump_ge(struct pctrie_iter *it, int64_t jump); | |
| 426 | uint64_t	*pctrie_lookup_le(struct pctrie *ptree, uint64_t key); | |
| 427 | uint64_t	*pctrie_subtree_lookup_lt(struct pctrie *ptree, | |
| 428 | 		 struct pctrie_node *node, uint64_t key); | |
| 429 | uint64_t	*pctrie_iter_lookup_le(struct pctrie_iter *it, uint64_t index); | |
| 430 | uint64_t	*pctrie_iter_jump_le(struct pctrie_iter *it, int64_t jump); | |
| 166 | 431 | struct pctrie_node *pctrie_reclaim_begin(struct pctrie_node **pnode, |
| 167 | 432 | 		 struct pctrie *ptree); |
| 168 | 433 | struct pctrie_node *pctrie_reclaim_resume(struct pctrie_node **pnode); |
| 434 | struct pctrie_node *pctrie_reclaim_begin_cb(struct pctrie_node **pnode, | |
| 435 | 		 struct pctrie *ptree, | |
| 436 | 		 pctrie_cb_t callback, int keyoff, void *arg); | |
| 437 | struct pctrie_node *pctrie_reclaim_resume_cb(struct pctrie_node **pnode, | |
| 438 | 		 pctrie_cb_t callback, int keyoff, void *arg); | |
| 169 | 439 | uint64_t	*pctrie_remove_lookup(struct pctrie *ptree, uint64_t index, |
| 170 | 440 | 		 struct pctrie_node **killnode); |
| 441 | void		pctrie_iter_remove(struct pctrie_iter *it, | |
| 442 | 		 struct pctrie_node **freenode); | |
| 443 | uint64_t	*pctrie_iter_value(struct pctrie_iter *it); | |
| 171 | 444 | uint64_t	*pctrie_replace(struct pctrie *ptree, uint64_t *newval); |
| 172 | 445 | size_t		pctrie_node_size(void); |
| 173 | 446 | int		pctrie_zone_init(void *mem, int size, int flags); |
lib/libc/include/generic-freebsd/sys/pipe.h+1-1| ... | ... | @@ -52,7 +52,7 @@ |
| 52 | 52 | * See sys_pipe.c for info on what these limits mean. |
| 53 | 53 | */ |
| 54 | 54 | extern long	maxpipekva; |
| 55 | extern struct	fileops pipeops; | |
| 55 | extern const struct fileops pipeops; | |
| 56 | 56 | #endif |
| 57 | 57 | |
| 58 | 58 | /* |
lib/libc/include/generic-freebsd/sys/pmc.h+1-3| ... | ... | @@ -81,7 +81,6 @@ extern char pmc_cpuid[PMC_CPUID_LEN]; |
| 81 | 81 | * Please keep the pmc(3) manual page in sync with this list. |
| 82 | 82 | */ |
| 83 | 83 | #define	__PMC_CPUS()								\ |
| 84 | __PMC_CPU(AMD_K7,			0x00,	"AMD K7")			\ | |
| 85 | 84 | __PMC_CPU(AMD_K8,			0x01,	"AMD K8")			\ |
| 86 | 85 | __PMC_CPU(INTEL_CORE,		0x87,	"Intel Core Solo/Duo")		\ |
| 87 | 86 | __PMC_CPU(INTEL_CORE2,		0x88,	"Intel Core2")			\ |
| ... | ... | @@ -130,7 +129,7 @@ enum pmc_cputype { |
| 130 | 129 | 	__PMC_CPUS() |
| 131 | 130 | }; |
| 132 | 131 | |
| 133 | #define	PMC_CPU_FIRST	PMC_CPU_AMD_K7 | |
| 132 | #define	PMC_CPU_FIRST	PMC_CPU_AMD_K8 | |
| 134 | 133 | #define	PMC_CPU_LAST	PMC_CPU_ARMV8_CORTEX_A76 |
| 135 | 134 | |
| 136 | 135 | /* |
| ... | ... | @@ -138,7 +137,6 @@ enum pmc_cputype { |
| 138 | 137 | */ |
| 139 | 138 | #define	__PMC_CLASSES()								\ |
| 140 | 139 | __PMC_CLASS(TSC,		0x00,	"CPU Timestamp counter")		\ |
| 141 | __PMC_CLASS(K7,		0x01,	"AMD K7 performance counters")		\ | |
| 142 | 140 | __PMC_CLASS(K8,		0x02,	"AMD K8 performance counters")		\ |
| 143 | 141 | __PMC_CLASS(IAF,		0x06,	"Intel Core2/Atom, fixed function")	\ |
| 144 | 142 | __PMC_CLASS(IAP,		0x07,	"Intel Core...Atom, programmable")	\ |
lib/libc/include/generic-freebsd/sys/poll.h+6-2| ... | ... | @@ -96,7 +96,7 @@ struct pollfd { |
| 96 | 96 | |
| 97 | 97 | #ifndef _KERNEL |
| 98 | 98 | |
| 99 | #if __BSD_VISIBLE | |
| 99 | #if __POSIX_VISIBLE >= 202405 | |
| 100 | 100 | #include <sys/_types.h> |
| 101 | 101 | |
| 102 | 102 | #include <sys/_sigset.h> |
| ... | ... | @@ -109,9 +109,13 @@ typedef	__sigset_t	sigset_t; |
| 109 | 109 | |
| 110 | 110 | #endif |
| 111 | 111 | |
| 112 | #if defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE > 0 | |
| 113 | #include <ssp/poll.h> | |
| 114 | #endif | |
| 115 | ||
| 112 | 116 | __BEGIN_DECLS |
| 113 | 117 | int	poll(struct pollfd _pfd[], nfds_t _nfds, int _timeout); |
| 114 | #if __BSD_VISIBLE | |
| 118 | #if __POSIX_VISIBLE >= 202405 | |
| 115 | 119 | int	ppoll(struct pollfd _pfd[], nfds_t _nfds, |
| 116 | 120 | 	 const struct timespec *__restrict _timeout, |
| 117 | 121 | 	 const sigset_t *__restrict _newsigmask); |
lib/libc/include/generic-freebsd/sys/priority.h+29-23| ... | ... | @@ -64,17 +64,23 @@ |
| 64 | 64 | */ |
| 65 | 65 | |
| 66 | 66 | /* |
| 67 | * Priorities range from 0 to 255, but differences of less then 4 (RQ_PPQ) | |
| 68 | * are insignificant. Ranges are as follows: | |
| 67 | * Priorities range from 0 to 255. Ranges are as follows: | |
| 69 | 68 | * |
| 70 | * Interrupt threads:		0 - 15 | |
| 71 | * Realtime user threads:	16 - 47 | |
| 72 | * Top half kernel threads:	48 - 87 | |
| 73 | * Time sharing user threads:	88 - 223 | |
| 69 | * Interrupt threads:		0 - 7 | |
| 70 | * Realtime user threads:	8 - 39 | |
| 71 | * Top half kernel threads:	40 - 55 | |
| 72 | * Time sharing user threads:	56 - 223 | |
| 74 | 73 | * Idle user threads:		224 - 255 |
| 75 | 74 | * |
| 76 | * XXX If/When the specific interrupt thread and top half thread ranges | |
| 77 | * disappear, a larger range can be used for user processes. | |
| 75 | * Priority levels of rtprio(2)'s RTP_PRIO_FIFO and RTP_PRIO_REALTIME and | |
| 76 | * POSIX's SCHED_FIFO and SCHED_RR are directly mapped to the internal realtime | |
| 77 | * range mentioned above by a simple translation. This range's length | |
| 78 | * consequently cannot be changed without impacts on the scheduling priority | |
| 79 | * code, and in any case must never be smaller than 32 for POSIX compliance and | |
| 80 | * rtprio(2) backwards compatibility. Similarly, priority levels of rtprio(2)'s | |
| 81 | * RTP_PRIO_IDLE are directly mapped to the internal idle range above (and, | |
| 82 | * soon, those of the to-be-introduced SCHED_IDLE policy as well), so changing | |
| 83 | * that range is subject to the same caveats and restrictions. | |
| 78 | 84 | */ |
| 79 | 85 | |
| 80 | 86 | #define	PRI_MIN			(0)		/* Highest priority. */ |
| ... | ... | @@ -88,34 +94,34 @@ |
| 88 | 94 | * decay to lower priorities if they run for full time slices. |
| 89 | 95 | */ |
| 90 | 96 | #define	PI_REALTIME		(PRI_MIN_ITHD + 0) |
| 91 | #define	PI_INTR			(PRI_MIN_ITHD + 4) | |
| 97 | #define	PI_INTR			(PRI_MIN_ITHD + 1) | |
| 92 | 98 | #define	PI_AV			PI_INTR |
| 93 | 99 | #define	PI_NET			PI_INTR |
| 94 | 100 | #define	PI_DISK			PI_INTR |
| 95 | 101 | #define	PI_TTY			PI_INTR |
| 96 | 102 | #define	PI_DULL			PI_INTR |
| 97 | #define	PI_SOFT			(PRI_MIN_ITHD + 8) | |
| 103 | #define	PI_SOFT			(PRI_MIN_ITHD + 2) | |
| 98 | 104 | #define	PI_SOFTCLOCK		PI_SOFT |
| 99 | 105 | #define	PI_SWI(x)		PI_SOFT |
| 100 | 106 | |
| 101 | #define	PRI_MIN_REALTIME	(16) | |
| 107 | #define	PRI_MIN_REALTIME	(8) | |
| 102 | 108 | #define	PRI_MAX_REALTIME	(PRI_MIN_KERN - 1) |
| 103 | 109 | |
| 104 | #define	PRI_MIN_KERN		(48) | |
| 110 | #define	PRI_MIN_KERN		(40) | |
| 105 | 111 | #define	PRI_MAX_KERN		(PRI_MIN_TIMESHARE - 1) |
| 106 | 112 | |
| 107 | 113 | #define	PSWP			(PRI_MIN_KERN + 0) |
| 108 | #define	PVM			(PRI_MIN_KERN + 4) | |
| 109 | #define	PINOD			(PRI_MIN_KERN + 8) | |
| 110 | #define	PRIBIO			(PRI_MIN_KERN + 12) | |
| 111 | #define	PVFS			(PRI_MIN_KERN + 16) | |
| 112 | #define	PZERO			(PRI_MIN_KERN + 20) | |
| 113 | #define	PSOCK			(PRI_MIN_KERN + 24) | |
| 114 | #define	PWAIT			(PRI_MIN_KERN + 28) | |
| 115 | #define	PLOCK			(PRI_MIN_KERN + 32) | |
| 116 | #define	PPAUSE			(PRI_MIN_KERN + 36) | |
| 117 | ||
| 118 | #define	PRI_MIN_TIMESHARE	(88) | |
| 114 | #define	PVM			(PRI_MIN_KERN + 1) | |
| 115 | #define	PINOD			(PRI_MIN_KERN + 2) | |
| 116 | #define	PRIBIO			(PRI_MIN_KERN + 3) | |
| 117 | #define	PVFS			(PRI_MIN_KERN + 4) | |
| 118 | #define	PZERO			(PRI_MIN_KERN + 5) | |
| 119 | #define	PSOCK			(PRI_MIN_KERN + 6) | |
| 120 | #define	PWAIT			(PRI_MIN_KERN + 7) | |
| 121 | #define	PLOCK			(PRI_MIN_KERN + 8) | |
| 122 | #define	PPAUSE			(PRI_MIN_KERN + 9) | |
| 123 | ||
| 124 | #define	PRI_MIN_TIMESHARE	(56) | |
| 119 | 125 | #define	PRI_MAX_TIMESHARE	(PRI_MIN_IDLE - 1) |
| 120 | 126 | |
| 121 | 127 | #define	PUSER			(PRI_MIN_TIMESHARE) |
lib/libc/include/generic-freebsd/sys/priv.h+8-1| ... | ... | @@ -105,7 +105,8 @@ |
| 105 | 105 | #define	PRIV_CRED_SETRESGID	58	/* setresgid. */ |
| 106 | 106 | #define	PRIV_SEEOTHERGIDS	59	/* Exempt bsd.seeothergids. */ |
| 107 | 107 | #define	PRIV_SEEOTHERUIDS	60	/* Exempt bsd.seeotheruids. */ |
| 108 | #define	PRIV_SEEJAILPROC 61 /* Exempt from bsd.see_jail_proc. */ | |
| 108 | #define	PRIV_SEEJAILPROC	61	/* Exempt from bsd.see_jail_proc. */ | |
| 109 | #define	PRIV_CRED_SETCRED	62	/* setcred. */ | |
| 109 | 110 | |
| 110 | 111 | /* |
| 111 | 112 | * Debugging privileges. |
| ... | ... | @@ -114,6 +115,7 @@ |
| 114 | 115 | #define	PRIV_DEBUG_SUGID	81	/* Exempt debugging setuid proc. */ |
| 115 | 116 | #define	PRIV_DEBUG_UNPRIV	82	/* Exempt unprivileged debug limit. */ |
| 116 | 117 | #define	PRIV_DEBUG_DENIED	83	/* Exempt P2_NOTRACE. */ |
| 118 | #define	PRIV_DEBUG_DIFFJAIL	84	/* Exempt debugging other jails. */ | |
| 117 | 119 | |
| 118 | 120 | /* |
| 119 | 121 | * Dtrace privileges. |
| ... | ... | @@ -192,6 +194,7 @@ |
| 192 | 194 | #define	PRIV_SCHED_CPUSET	206	/* Can manipulate cpusets. */ |
| 193 | 195 | #define	PRIV_SCHED_CPUSET_INTR	207	/* Can adjust IRQ to CPU binding. */ |
| 194 | 196 | #define	PRIV_SCHED_IDPRIO	208	/* Can set idle time scheduling. */ |
| 197 | #define	PRIV_SCHED_DIFFJAIL	209	/* Exempt scheduling other jails. */ | |
| 195 | 198 | |
| 196 | 199 | /* |
| 197 | 200 | * POSIX semaphore privileges. |
| ... | ... | @@ -203,6 +206,7 @@ |
| 203 | 206 | */ |
| 204 | 207 | #define	PRIV_SIGNAL_DIFFCRED	230	/* Exempt signalling other users. */ |
| 205 | 208 | #define	PRIV_SIGNAL_SUGID	231	/* Non-conserv signal setuid proc. */ |
| 209 | #define	PRIV_SIGNAL_DIFFJAIL	232	/* Exempt signalling other jails. */ | |
| 206 | 210 | |
| 207 | 211 | /* |
| 208 | 212 | * Sysctl privileges. |
| ... | ... | @@ -210,6 +214,7 @@ |
| 210 | 214 | #define	PRIV_SYSCTL_DEBUG	240	/* Can invoke sysctl.debug. */ |
| 211 | 215 | #define	PRIV_SYSCTL_WRITE	241	/* Can write sysctls. */ |
| 212 | 216 | #define	PRIV_SYSCTL_WRITEJAIL	242	/* Can write sysctls, jail permitted. */ |
| 217 | #define	PRIV_SYSCTL_MEMLOCK	243	/* Large requests are not serialized. */ | |
| 213 | 218 | |
| 214 | 219 | /* |
| 215 | 220 | * TTY privileges. |
| ... | ... | @@ -404,6 +409,7 @@ |
| 404 | 409 | #define	PRIV_NETINET_SETHDROPTS	505	/* Set certain IPv4/6 header options. */ |
| 405 | 410 | #define	PRIV_NETINET_BINDANY	506	/* Allow bind to any address. */ |
| 406 | 411 | #define	PRIV_NETINET_HASHKEY	507	/* Get and set hash keys for IPv4/6. */ |
| 412 | #define	PRIV_NETINET_KTLSKEYS	508	/* Read ktls session keys. */ | |
| 407 | 413 | |
| 408 | 414 | /* |
| 409 | 415 | * Placeholders for IPX/SPX privileges, not supported any more. |
| ... | ... | @@ -515,6 +521,7 @@ |
| 515 | 521 | */ |
| 516 | 522 | #define	PRIV_KMEM_READ		680	/* Open mem/kmem for reading. */ |
| 517 | 523 | #define	PRIV_KMEM_WRITE		681	/* Open mem/kmem for writing. */ |
| 524 | #define	PRIV_PROC_MEM_WRITE	682	/* Writes via proc_rwmem */ | |
| 518 | 525 | |
| 519 | 526 | /* |
| 520 | 527 | * Kernel debugger privileges. |
lib/libc/include/generic-freebsd/sys/proc.h+52-63| ... | ... | @@ -32,8 +32,6 @@ |
| 32 | 32 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 33 | 33 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 34 | 34 | * SUCH DAMAGE. |
| 35 | * | |
| 36 | *	@(#)proc.h	8.15 (Berkeley) 5/19/95 | |
| 37 | 35 | */ |
| 38 | 36 | |
| 39 | 37 | #ifndef _SYS_PROC_H_ |
| ... | ... | @@ -44,6 +42,7 @@ |
| 44 | 42 | #ifdef _KERNEL |
| 45 | 43 | #include <sys/_eventhandler.h> |
| 46 | 44 | #endif |
| 45 | #include <sys/_exterr.h> | |
| 47 | 46 | #include <sys/condvar.h> |
| 48 | 47 | #ifndef _KERNEL |
| 49 | 48 | #include <sys/filedesc.h> |
| ... | ... | @@ -55,7 +54,6 @@ |
| 55 | 54 | #include <sys/osd.h> |
| 56 | 55 | #include <sys/priority.h> |
| 57 | 56 | #include <sys/rtprio.h>			/* XXX. */ |
| 58 | #include <sys/runq.h> | |
| 59 | 57 | #include <sys/resource.h> |
| 60 | 58 | #include <sys/sigio.h> |
| 61 | 59 | #include <sys/signal.h> |
| ... | ... | @@ -249,7 +247,7 @@ struct thread { |
| 249 | 247 | 	struct seltd	*td_sel;	/* Select queue/channel. */ |
| 250 | 248 | 	struct sleepqueue *td_sleepqueue; /* (k) Associated sleep queue. */ |
| 251 | 249 | 	struct turnstile *td_turnstile;	/* (k) Associated turnstile. */ |
| 252 | 	struct rl_q_entry *td_rlqe;	/* (k) Associated range lock entry. */ | |
| 250 | 	void		*td_pad1;	/* Available */ | |
| 253 | 251 | 	struct umtx_q *td_umtxq;	/* (c?) Link for when we're blocked. */ |
| 254 | 252 | 	lwpid_t		td_tid;		/* (b) Thread ID. */ |
| 255 | 253 | 	sigqueue_t	td_sigqueue;	/* (c) Sigs arrived, not delivered. */ |
| ... | ... | @@ -272,11 +270,12 @@ struct thread { |
| 272 | 270 | 	const char	*td_wmesg;	/* (t) Reason for sleep. */ |
| 273 | 271 | 	volatile u_char td_owepreempt; /* (k*) Preempt on last critical_exit */ |
| 274 | 272 | 	u_char		td_tsqueue;	/* (t) Turnstile queue blocked on. */ |
| 275 | 	u_char		td_stopsched;	/* (k) Scheduler stopped. */ | |
| 273 | 	u_char		_td_pad0[2];	/* Available. */ | |
| 276 | 274 | 	int		td_locks;	/* (k) Debug: count of non-spin locks */ |
| 277 | 275 | 	int		td_rw_rlocks;	/* (k) Count of rwlock read locks. */ |
| 278 | 276 | 	int		td_sx_slocks;	/* (k) Count of sx shared locks. */ |
| 279 | 277 | 	int		td_lk_slocks;	/* (k) Count of lockmgr shared locks. */ |
| 278 | 	struct lock_object *td_wantedlock; /* (k) Lock we are contending on */ | |
| 280 | 279 | 	struct turnstile *td_blocked;	/* (t) Lock thread is blocked on. */ |
| 281 | 280 | 	const char	*td_lockname;	/* (t) Name of lock blocked on. */ |
| 282 | 281 | 	LIST_HEAD(, turnstile) td_contested;	/* (q) Contested locks. */ |
| ... | ... | @@ -314,8 +313,8 @@ struct thread { |
| 314 | 313 | 	struct osd	td_osd;		/* (k) Object specific data. */ |
| 315 | 314 | 	struct vm_map_entry *td_map_def_user; /* (k) Deferred entries. */ |
| 316 | 315 | 	pid_t		td_dbg_forked;	/* (c) Child pid for debugger. */ |
| 317 | 	struct vnode	*td_vp_reserved;/* (k) Preallocated vnode. */ | |
| 318 | 316 | 	u_int		td_no_sleeping;	/* (k) Sleeping disabled count. */ |
| 317 | 	struct vnode	*td_vp_reserved;/* (k) Preallocated vnode. */ | |
| 319 | 318 | 	void		*td_su;		/* (k) FFS SU private */ |
| 320 | 319 | 	sbintime_t	td_sleeptimo;	/* (t) Sleep timeout. */ |
| 321 | 320 | 	int		td_rtcgen;	/* (s) rtc_generation of abs. sleep */ |
| ... | ... | @@ -323,6 +322,7 @@ struct thread { |
| 323 | 322 | 	size_t		td_vslock_sz;	/* (k) amount of vslock-ed space */ |
| 324 | 323 | 	struct kcov_info *td_kcov_info;	/* (*) Kernel code coverage data */ |
| 325 | 324 | 	long		td_ucredref;	/* (k) references on td_realucred */ |
| 325 | 	struct kexterr	td_kexterr; | |
| 326 | 326 | #define	td_endzero td_sigmask |
| 327 | 327 | |
| 328 | 328 | /* Copied during fork1(), thread_create(), or kthread_add(). */ |
| ... | ... | @@ -342,6 +342,7 @@ struct thread { |
| 342 | 342 | 	void		*td_sigblock_ptr; /* (k) uptr for fast sigblock. */ |
| 343 | 343 | 	uint32_t	td_sigblock_val; /* (k) fast sigblock value read at |
| 344 | 344 | 					 td_sigblock_ptr on kern entry */ |
| 345 | 	void		*td_exterr_ptr; | |
| 345 | 346 | #define	td_endcopy td_pcb |
| 346 | 347 | |
| 347 | 348 | /* |
| ... | ... | @@ -367,7 +368,8 @@ struct thread { |
| 367 | 368 | 	struct callout	td_slpcallout;	/* (h) Callout for sleep. */ |
| 368 | 369 | 	struct trapframe *td_frame;	/* (k) */ |
| 369 | 370 | 	vm_offset_t	td_kstack;	/* (a) Kernel VA of kstack. */ |
| 370 | 	int		td_kstack_pages; /* (a) Size of the kstack. */ | |
| 371 | 	u_short td_kstack_pages;	/* (a) Size of the kstack. */ | |
| 372 | 	u_short td_kstack_domain;		/* (a) Domain backing kstack KVA. */ | |
| 371 | 373 | 	volatile u_int	td_critnest;	/* (k*) Critical section nest level. */ |
| 372 | 374 | 	struct mdthread td_md;		/* (k) Any machine-dependent fields. */ |
| 373 | 375 | 	struct kaudit_record	*td_ar;	/* (k) Active audit record, if any. */ |
| ... | ... | @@ -430,7 +432,7 @@ do {									\ |
| 430 | 432 | |
| 431 | 433 | #define	TD_LOCKS_INC(td)	((td)->td_locks++) |
| 432 | 434 | #define	TD_LOCKS_DEC(td) do {						\ |
| 433 | 	KASSERT(SCHEDULER_STOPPED_TD(td) || (td)->td_locks > 0,		\ | |
| 435 | 	KASSERT(SCHEDULER_STOPPED() || (td)->td_locks > 0,		\ | |
| 434 | 436 | 	 ("Thread %p owns no locks", (td)));				\ |
| 435 | 437 | 	(td)->td_locks--;						\ |
| 436 | 438 | } while (0) |
| ... | ... | @@ -452,7 +454,7 @@ do {									\ |
| 452 | 454 | #define	TDF_SINTR	0x00000008 /* Sleep is interruptible. */ |
| 453 | 455 | #define	TDF_TIMEOUT	0x00000010 /* Timing out during sleep. */ |
| 454 | 456 | #define	TDF_IDLETD	0x00000020 /* This is a per-CPU idle thread. */ |
| 455 | #define	TDF_CANSWAP	0x00000040 /* Thread can be swapped. */ | |
| 457 | #define	TDF_UNUSED11	0x00000040 /* Available */ | |
| 456 | 458 | #define	TDF_SIGWAIT	0x00000080 /* Ignore ignored signals */ |
| 457 | 459 | #define	TDF_KTH_SUSP	0x00000100 /* kthread is suspended */ |
| 458 | 460 | #define	TDF_ALLPROCSUSP	0x00000200 /* suspended by SINGLE_ALLPROC */ |
| ... | ... | @@ -468,7 +470,7 @@ do {									\ |
| 468 | 470 | #define	TDF_SERESTART	0x00080000 /* ERESTART on stop attempts. */ |
| 469 | 471 | #define	TDF_THRWAKEUP	0x00100000 /* Libthr thread must not suspend itself. */ |
| 470 | 472 | #define	TDF_SEINTR	0x00200000 /* EINTR on stop attempts. */ |
| 471 | #define	TDF_SWAPINREQ	0x00400000 /* Swapin request due to wakeup. */ | |
| 473 | #define	TDF_UNUSED12	0x00400000 /* Available */ | |
| 472 | 474 | #define	TDF_UNUSED6	0x00800000 /* Available */ |
| 473 | 475 | #define	TDF_SCHED0	0x01000000 /* Reserved for scheduler private use */ |
| 474 | 476 | #define	TDF_SCHED1	0x02000000 /* Reserved for scheduler private use */ |
| ... | ... | @@ -493,13 +495,14 @@ enum { |
| 493 | 495 | 	TDA_KQUEUE, |
| 494 | 496 | 	TDA_RACCT, |
| 495 | 497 | 	TDA_MOD1,		/* For third party use, before signals are */ |
| 496 | 	TAD_MOD2,		/* processed .. */ | |
| 498 | 	TDA_MOD2,		/* processed .. */ | |
| 499 | 	TDA_PSELECT,		/* For discarding temporary signal mask */ | |
| 497 | 500 | 	TDA_SIG, |
| 498 | 501 | 	TDA_KTRACE, |
| 499 | 502 | 	TDA_SUSPEND, |
| 500 | 503 | 	TDA_SIGSUSPEND, |
| 501 | 504 | 	TDA_MOD3,		/* .. and after */ |
| 502 | 	TAD_MOD4, | |
| 505 | 	TDA_MOD4, | |
| 503 | 506 | 	TDA_MAX, |
| 504 | 507 | }; |
| 505 | 508 | #define	TDAI(tda)		(1U << (tda)) |
| ... | ... | @@ -560,13 +563,16 @@ enum { |
| 560 | 563 | #define	TDP_RESETSPUR	0x04000000 /* Reset spurious page fault history. */ |
| 561 | 564 | #define	TDP_NERRNO	0x08000000 /* Last errno is already in td_errno */ |
| 562 | 565 | #define	TDP_UIOHELD	0x10000000 /* Current uio has pages held in td_ma */ |
| 563 | #define	TDP_INTCPCALLOUT 0x20000000 /* used by netinet/tcp_timer.c */ | |
| 566 | #define	TDP_EFIRT	0x20000000 /* In firmware (EFI RT) call */ | |
| 564 | 567 | #define	TDP_EXECVMSPC	0x40000000 /* Execve destroyed old vmspace */ |
| 565 | 568 | #define	TDP_SIGFASTPENDING 0x80000000 /* Pending signal due to sigfastblock */ |
| 566 | 569 | |
| 567 | 570 | #define	TDP2_SBPAGES	0x00000001 /* Owns sbusy on some pages */ |
| 568 | 571 | #define	TDP2_COMPAT32RB	0x00000002 /* compat32 ABI for robust lists */ |
| 569 | 572 | #define	TDP2_ACCT	0x00000004 /* Doing accounting */ |
| 573 | #define	TDP2_SAN_QUIET	0x00000008 /* Disable warnings from K(A|M)SAN */ | |
| 574 | #define	TDP2_EXTERR	0x00000010 /* Kernel reported ext error */ | |
| 575 | #define	TDP2_UEXTERR	0x00000020 /* User set ext error reporting ptr */ | |
| 570 | 576 | |
| 571 | 577 | /* |
| 572 | 578 | * Reasons that the current thread can not be run yet. |
| ... | ... | @@ -574,14 +580,12 @@ enum { |
| 574 | 580 | */ |
| 575 | 581 | #define	TDI_SUSPENDED	0x0001	/* On suspension queue. */ |
| 576 | 582 | #define	TDI_SLEEPING	0x0002	/* Actually asleep! (tricky). */ |
| 577 | #define	TDI_SWAPPED	0x0004	/* Stack not in mem. Bad juju if run. */ | |
| 578 | 583 | #define	TDI_LOCK	0x0008	/* Stopped on a lock. */ |
| 579 | 584 | #define	TDI_IWAIT	0x0010	/* Awaiting interrupt. */ |
| 580 | 585 | |
| 581 | 586 | #define	TD_IS_SLEEPING(td)	((td)->td_inhibitors & TDI_SLEEPING) |
| 582 | 587 | #define	TD_ON_SLEEPQ(td)	((td)->td_wchan != NULL) |
| 583 | 588 | #define	TD_IS_SUSPENDED(td)	((td)->td_inhibitors & TDI_SUSPENDED) |
| 584 | #define	TD_IS_SWAPPED(td)	((td)->td_inhibitors & TDI_SWAPPED) | |
| 585 | 589 | #define	TD_ON_LOCK(td)		((td)->td_inhibitors & TDI_LOCK) |
| 586 | 590 | #define	TD_AWAITING_INTR(td)	((td)->td_inhibitors & TDI_IWAIT) |
| 587 | 591 | #ifdef _KERNEL |
| ... | ... | @@ -602,7 +606,6 @@ enum { |
| 602 | 606 | #define	KTDSTATE(td)							\ |
| 603 | 607 | 	(((td)->td_inhibitors & TDI_SLEEPING) != 0 ? "sleep" :		\ |
| 604 | 608 | 	((td)->td_inhibitors & TDI_SUSPENDED) != 0 ? "suspended" :	\ |
| 605 | 	((td)->td_inhibitors & TDI_SWAPPED) != 0 ? "swapped" :		\ | |
| 606 | 609 | 	((td)->td_inhibitors & TDI_LOCK) != 0 ? "blocked" :		\ |
| 607 | 610 | 	((td)->td_inhibitors & TDI_IWAIT) != 0 ? "iwait" : "yielding") |
| 608 | 611 | |
| ... | ... | @@ -618,14 +621,12 @@ enum { |
| 618 | 621 | } while (0) |
| 619 | 622 | |
| 620 | 623 | #define	TD_SET_SLEEPING(td)	TD_SET_INHIB((td), TDI_SLEEPING) |
| 621 | #define	TD_SET_SWAPPED(td)	TD_SET_INHIB((td), TDI_SWAPPED) | |
| 622 | 624 | #define	TD_SET_LOCK(td)		TD_SET_INHIB((td), TDI_LOCK) |
| 623 | 625 | #define	TD_SET_SUSPENDED(td)	TD_SET_INHIB((td), TDI_SUSPENDED) |
| 624 | 626 | #define	TD_SET_IWAIT(td)	TD_SET_INHIB((td), TDI_IWAIT) |
| 625 | 627 | #define	TD_SET_EXITING(td)	TD_SET_INHIB((td), TDI_EXITING) |
| 626 | 628 | |
| 627 | 629 | #define	TD_CLR_SLEEPING(td)	TD_CLR_INHIB((td), TDI_SLEEPING) |
| 628 | #define	TD_CLR_SWAPPED(td)	TD_CLR_INHIB((td), TDI_SWAPPED) | |
| 629 | 630 | #define	TD_CLR_LOCK(td)		TD_CLR_INHIB((td), TDI_LOCK) |
| 630 | 631 | #define	TD_CLR_SUSPENDED(td)	TD_CLR_INHIB((td), TDI_SUSPENDED) |
| 631 | 632 | #define	TD_CLR_IWAIT(td)	TD_CLR_INHIB((td), TDI_IWAIT) |
| ... | ... | @@ -704,7 +705,7 @@ struct proc { |
| 704 | 705 | 	struct vnode	*p_textvp;	/* (b) Vnode of executable. */ |
| 705 | 706 | 	struct vnode	*p_textdvp;	/* (b) Dir containing textvp. */ |
| 706 | 707 | 	char		*p_binname;	/* (b) Binary hardlink name. */ |
| 707 | 	u_int		p_lock;		/* (c) Proclock (prevent swap) count. */ | |
| 708 | 	u_int		p_lock;		/* (c) Prevent exit. */ | |
| 708 | 709 | 	struct sigiolst	p_sigiolst;	/* (c) List of sigio sources. */ |
| 709 | 710 | 	int		p_sigparent;	/* (c) Signal to parent on exit. */ |
| 710 | 711 | 	int		p_sig;		/* (n) For core dump/debugger XXX. */ |
| ... | ... | @@ -714,7 +715,7 @@ struct proc { |
| 714 | 715 | 	int		p_suspcount;	/* (j) Num threads in suspended mode. */ |
| 715 | 716 | 	struct thread	*p_xthread;	/* (c) Trap thread */ |
| 716 | 717 | 	int		p_boundary_count;/* (j) Num threads at user boundary */ |
| 717 | 	int		p_pendingcnt;	/* how many signals are pending */ | |
| 718 | 	int		p_pendingcnt;	/* (c) how many signals are pending */ | |
| 718 | 719 | 	struct itimers	*p_itimers;	/* (c) POSIX interval timers. */ |
| 719 | 720 | 	struct procdesc	*p_procdesc;	/* (e) Process descriptor, if any. */ |
| 720 | 721 | 	u_int		p_treeflag;	/* (e) P_TREE flags */ |
| ... | ... | @@ -762,7 +763,6 @@ struct proc { |
| 762 | 763 | 	LIST_HEAD(, mqueue_notifier)	p_mqnotifier; /* (c) mqueue notifiers.*/ |
| 763 | 764 | 	struct kdtrace_proc	*p_dtrace; /* (*) DTrace-specific data. */ |
| 764 | 765 | 	struct cv	p_pwait;	/* (*) wait cv for exit/exec. */ |
| 765 | 	uint64_t	p_prev_runtime;	/* (c) Resource usage accounting. */ | |
| 766 | 766 | 	struct racct	*p_racct;	/* (b) Resource accounting. */ |
| 767 | 767 | 	int		p_throttled;	/* (c) Flag for racct pcpu throttling */ |
| 768 | 768 | 	/* |
| ... | ... | @@ -806,7 +806,7 @@ struct proc { |
| 806 | 806 | 					 lock. */ |
| 807 | 807 | #define	P_CONTROLT	0x00000002	/* Has a controlling terminal. */ |
| 808 | 808 | #define	P_KPROC		0x00000004	/* Kernel process. */ |
| 809 | #define	P_UNUSED3	0x00000008	/* --available-- */ | |
| 809 | #define	P_IDLEPROC	0x00000008	/* Container for system idle threads. */ | |
| 810 | 810 | #define	P_PPWAIT	0x00000010	/* Parent is waiting for child to |
| 811 | 811 | 					 exec/exit. */ |
| 812 | 812 | #define	P_PROFIL	0x00000020	/* Has started profiling. */ |
| ... | ... | @@ -816,8 +816,7 @@ struct proc { |
| 816 | 816 | 					 shortcuts) */ |
| 817 | 817 | #define	P_SUGID		0x00000100	/* Had set id privileges since last |
| 818 | 818 | 					 exec. */ |
| 819 | #define	P_SYSTEM	0x00000200	/* System proc: no sigs, stats or | |
| 820 | 					 swapping. */ | |
| 819 | #define	P_SYSTEM	0x00000200	/* System proc: no sigs or stats. */ | |
| 821 | 820 | #define	P_SINGLE_EXIT	0x00000400	/* Threads suspending should exit, |
| 822 | 821 | 					 not wait. */ |
| 823 | 822 | #define	P_TRACED	0x00000800	/* Debugged process being traced. */ |
| ... | ... | @@ -841,9 +840,9 @@ struct proc { |
| 841 | 840 | #define	P_TOTAL_STOP	0x02000000	/* Stopped in stop_all_proc. */ |
| 842 | 841 | #define	P_INEXEC	0x04000000	/* Process is in execve(). */ |
| 843 | 842 | #define	P_STATCHILD	0x08000000	/* Child process stopped or exited. */ |
| 844 | #define	P_INMEM		0x10000000	/* Loaded into memory. */ | |
| 845 | #define	P_SWAPPINGOUT	0x20000000	/* Process is being swapped out. */ | |
| 846 | #define	P_SWAPPINGIN	0x40000000	/* Process is being swapped in. */ | |
| 843 | #define	P_INMEM		0x10000000	/* Loaded into memory, always set. */ | |
| 844 | #define	P_UNUSED1	0x20000000	/* --available-- */ | |
| 845 | #define	P_UNUSED2	0x40000000	/* --available-- */ | |
| 847 | 846 | #define	P_PPTRACE	0x80000000	/* PT_TRACEME by vforked child. */ |
| 848 | 847 | |
| 849 | 848 | #define	P_STOPPED	(P_STOPPED_SIG|P_STOPPED_SINGLE|P_STOPPED_TRACE) |
| ... | ... | @@ -874,7 +873,7 @@ struct proc { |
| 874 | 873 | 						 MAP_STACK */ |
| 875 | 874 | #define	P2_STKGAP_DISABLE_EXEC	0x00001000	/* Stack gap disabled |
| 876 | 875 | 						 after exec */ |
| 877 | #define	P2_ITSTOPPED		0x00002000 | |
| 876 | #define	P2_ITSTOPPED		0x00002000	/* itimers stopped */ | |
| 878 | 877 | #define	P2_PTRACEREQ		0x00004000	/* Active ptrace req */ |
| 879 | 878 | #define	P2_NO_NEW_PRIVS		0x00008000	/* Ignore setuid */ |
| 880 | 879 | #define	P2_WXORX_DISABLE	0x00010000	/* WX mappings enabled */ |
| ... | ... | @@ -882,7 +881,7 @@ struct proc { |
| 882 | 881 | #define	P2_WEXIT		0x00040000	/* exit just started, no |
| 883 | 882 | 						 external thread_single() is |
| 884 | 883 | 						 permitted */ |
| 885 | #define	P2_REAPKILLED		0x00080000 | |
| 884 | #define	P2_REAPKILLED		0x00080000	/* REAP_KILL pass touched me */ | |
| 886 | 885 | #define	P2_MEMBAR_PRIVE		0x00100000	/* membar private expedited |
| 887 | 886 | 						 registered */ |
| 888 | 887 | #define	P2_MEMBAR_PRIVE_SYNCORE	0x00200000	/* membar private expedited |
| ... | ... | @@ -890,6 +889,11 @@ struct proc { |
| 890 | 889 | #define	P2_MEMBAR_GLOBE		0x00400000	/* membar global expedited |
| 891 | 890 | 						 registered */ |
| 892 | 891 | |
| 892 | #define	P2_LOGSIGEXIT_ENABLE	0x00800000	/* Disable logging on sigexit */ | |
| 893 | #define	P2_LOGSIGEXIT_CTL	0x01000000	/* Override kern.logsigexit */ | |
| 894 | ||
| 895 | #define	P2_HWT			0x02000000	/* Process is using HWT. */ | |
| 896 | ||
| 893 | 897 | /* Flags protected by proctree_lock, kept in p_treeflags. */ |
| 894 | 898 | #define	P_TREE_ORPHANED		0x00000001	/* Reparented, on orphan list */ |
| 895 | 899 | #define	P_TREE_FIRST_ORPHAN	0x00000002	/* First element of orphan |
| ... | ... | @@ -938,12 +942,6 @@ struct proc { |
| 938 | 942 | #define	SINGLE_BOUNDARY	2 |
| 939 | 943 | #define	SINGLE_ALLPROC	3 |
| 940 | 944 | |
| 941 | #ifdef MALLOC_DECLARE | |
| 942 | MALLOC_DECLARE(M_PARGS); | |
| 943 | MALLOC_DECLARE(M_SESSION); | |
| 944 | MALLOC_DECLARE(M_SUBPROC); | |
| 945 | #endif | |
| 946 | ||
| 947 | 945 | #define	FOREACH_PROC_IN_SYSTEM(p)					\ |
| 948 | 946 | 	LIST_FOREACH((p), &allproc, p_list) |
| 949 | 947 | #define	FOREACH_THREAD_IN_PROC(p, td)					\ |
| ... | ... | @@ -956,7 +954,7 @@ MALLOC_DECLARE(M_SUBPROC); |
| 956 | 954 | * in a pid_t, as it is used to represent "no process group". |
| 957 | 955 | */ |
| 958 | 956 | #define	PID_MAX		99999 |
| 959 | #define	NO_PID		100000 | |
| 957 | #define	NO_PID		(PID_MAX + 1) | |
| 960 | 958 | #define	THREAD0_TID	NO_PID |
| 961 | 959 | extern pid_t pid_max; |
| 962 | 960 | |
| ... | ... | @@ -992,18 +990,12 @@ extern pid_t pid_max; |
| 992 | 990 | #define	SESS_LOCK_ASSERT(s, type)	mtx_assert(&(s)->s_mtx, (type)) |
| 993 | 991 | |
| 994 | 992 | /* |
| 995 | * Non-zero p_lock ensures that: | |
| 996 | * - exit1() is not performed until p_lock reaches zero; | |
| 997 | * - the process' threads stack are not swapped out if they are currently | |
| 998 | * not (P_INMEM). | |
| 993 | * A non-zero p_lock prevents the process from exiting; it will sleep in exit1() | |
| 994 | * until the count reaches zero. | |
| 999 | 995 | * |
| 1000 | 996 | * PHOLD() asserts that the process (except the current process) is |
| 1001 | * not exiting, increments p_lock and swaps threads stacks into memory, | |
| 1002 | * if needed. | |
| 997 | * not exiting and increments p_lock. | |
| 1003 | 998 | * _PHOLD() is same as PHOLD(), it takes the process locked. |
| 1004 | * _PHOLD_LITE() also takes the process locked, but comparing with | |
| 1005 | * _PHOLD(), it only guarantees that exit1() is not executed, | |
| 1006 | * faultin() is not called. | |
| 1007 | 999 | */ |
| 1008 | 1000 | #define	PHOLD(p) do {							\ |
| 1009 | 1001 | 	PROC_LOCK(p);							\ |
| ... | ... | @@ -1015,14 +1007,6 @@ extern pid_t pid_max; |
| 1015 | 1007 | 	KASSERT(!((p)->p_flag & P_WEXIT) || (p) == curproc,		\ |
| 1016 | 1008 | 	 ("PHOLD of exiting process %p", p));			\ |
| 1017 | 1009 | 	(p)->p_lock++;							\ |
| 1018 | 	if (((p)->p_flag & P_INMEM) == 0)				\ | |
| 1019 | 		faultin((p));						\ | |
| 1020 | } while (0) | |
| 1021 | #define	_PHOLD_LITE(p) do {						\ | |
| 1022 | 	PROC_LOCK_ASSERT((p), MA_OWNED);				\ | |
| 1023 | 	KASSERT(!((p)->p_flag & P_WEXIT) || (p) == curproc,		\ | |
| 1024 | 	 ("PHOLD of exiting process %p", p));			\ | |
| 1025 | 	(p)->p_lock++;							\ | |
| 1026 | 1010 | } while (0) |
| 1027 | 1011 | #define	PROC_ASSERT_HELD(p) do {					\ |
| 1028 | 1012 | 	KASSERT((p)->p_lock > 0, ("process %p not held", p));		\ |
| ... | ... | @@ -1058,9 +1042,6 @@ extern pid_t pid_max; |
| 1058 | 1042 | 	_p->p_cowgen - _td->td_cowgen;					\ |
| 1059 | 1043 | }) |
| 1060 | 1044 | |
| 1061 | /* Check whether a thread is safe to be swapped out. */ | |
| 1062 | #define	thread_safetoswapout(td)	((td)->td_flags & TDF_CANSWAP) | |
| 1063 | ||
| 1064 | 1045 | /* Control whether or not it is safe for curthread to sleep. */ |
| 1065 | 1046 | #define	THREAD_NO_SLEEPING()		do {				\ |
| 1066 | 1047 | 	curthread->td_no_sleeping++;					\ |
| ... | ... | @@ -1074,6 +1055,16 @@ extern pid_t pid_max; |
| 1074 | 1055 | |
| 1075 | 1056 | #define	THREAD_CAN_SLEEP()		((curthread)->td_no_sleeping == 0) |
| 1076 | 1057 | |
| 1058 | #define	THREAD_CONTENDS_ON_LOCK(lo)		do {			\ | |
| 1059 | 	MPASS(curthread->td_wantedlock == NULL);			\ | |
| 1060 | 	curthread->td_wantedlock = lo;					\ | |
| 1061 | } while (0) | |
| 1062 | ||
| 1063 | #define	THREAD_CONTENTION_DONE(lo)		do {			\ | |
| 1064 | 	MPASS(curthread->td_wantedlock == lo);				\ | |
| 1065 | 	curthread->td_wantedlock = NULL;				\ | |
| 1066 | } while (0) | |
| 1067 | ||
| 1077 | 1068 | #define	PIDHASH(pid)	(&pidhashtbl[(pid) & pidhash]) |
| 1078 | 1069 | #define	PIDHASHLOCK(pid) (&pidhashtbl_lock[((pid) & pidhashlock)]) |
| 1079 | 1070 | extern LIST_HEAD(pidhashhead, proc) *pidhashtbl; |
| ... | ... | @@ -1170,7 +1161,6 @@ int	cr_cansignal(struct ucred *cred, struct proc *proc, int signum); |
| 1170 | 1161 | int	enterpgrp(struct proc *p, pid_t pgid, struct pgrp *pgrp, |
| 1171 | 1162 | 	 struct session *sess); |
| 1172 | 1163 | int	enterthispgrp(struct proc *p, struct pgrp *pgrp); |
| 1173 | void	faultin(struct proc *p); | |
| 1174 | 1164 | int	fork1(struct thread *, struct fork_req *); |
| 1175 | 1165 | void	fork_exit(void (*)(void *, struct trapframe *), void *, |
| 1176 | 1166 | 	 struct trapframe *); |
| ... | ... | @@ -1181,7 +1171,6 @@ void	kqtimer_proc_continue(struct proc *p); |
| 1181 | 1171 | void	kern_proc_vmmap_resident(struct vm_map *map, struct vm_map_entry *entry, |
| 1182 | 1172 | 	 int *resident_count, bool *super); |
| 1183 | 1173 | void	kern_yield(int); |
| 1184 | void 	kick_proc0(void); | |
| 1185 | 1174 | void	killjobc(void); |
| 1186 | 1175 | int	leavepgrp(struct proc *p); |
| 1187 | 1176 | int	maybe_preempt(struct thread *td); |
| ... | ... | @@ -1195,6 +1184,7 @@ int	p_canwait(struct thread *td, struct proc *p); |
| 1195 | 1184 | struct	pargs *pargs_alloc(int len); |
| 1196 | 1185 | void	pargs_drop(struct pargs *pa); |
| 1197 | 1186 | void	pargs_hold(struct pargs *pa); |
| 1187 | int	pgrp_calc_jobc(struct pgrp *pgrp); | |
| 1198 | 1188 | void	proc_add_orphan(struct proc *child, struct proc *parent); |
| 1199 | 1189 | int	proc_get_binpath(struct proc *p, char *binname, char **fullpath, |
| 1200 | 1190 | 	 char **freepath); |
| ... | ... | @@ -1220,7 +1210,7 @@ int	securelevel_ge(struct ucred *cr, int level); |
| 1220 | 1210 | int	securelevel_gt(struct ucred *cr, int level); |
| 1221 | 1211 | void	sess_hold(struct session *); |
| 1222 | 1212 | void	sess_release(struct session *); |
| 1223 | int	setrunnable(struct thread *, int); | |
| 1213 | void	setrunnable(struct thread *, int); | |
| 1224 | 1214 | void	setsugid(struct proc *p); |
| 1225 | 1215 | bool	should_yield(void); |
| 1226 | 1216 | int	sigonstack(size_t sp); |
| ... | ... | @@ -1235,6 +1225,7 @@ extern	void (*cpu_idle_hook)(sbintime_t);	/* Hook to machdep CPU idler. */ |
| 1235 | 1225 | void	cpu_switch(struct thread *, struct thread *, struct mtx *); |
| 1236 | 1226 | void	cpu_sync_core(void); |
| 1237 | 1227 | void	cpu_throw(struct thread *, struct thread *) __dead2; |
| 1228 | void	cpu_update_pcb(struct thread *); | |
| 1238 | 1229 | bool	curproc_sigkilled(void); |
| 1239 | 1230 | void	userret(struct thread *, struct trapframe *); |
| 1240 | 1231 | |
| ... | ... | @@ -1250,15 +1241,12 @@ int	cpu_procctl(struct thread *td, int idtype, id_t id, int com, |
| 1250 | 1241 | void	cpu_set_syscall_retval(struct thread *, int); |
| 1251 | 1242 | int	cpu_set_upcall(struct thread *, void (*)(void *), void *, |
| 1252 | 1243 | 	 stack_t *); |
| 1253 | int	cpu_set_user_tls(struct thread *, void *tls_base); | |
| 1244 | int	cpu_set_user_tls(struct thread *, void *tls_base, int flags); | |
| 1254 | 1245 | void	cpu_thread_alloc(struct thread *); |
| 1255 | 1246 | void	cpu_thread_clean(struct thread *); |
| 1256 | 1247 | void	cpu_thread_exit(struct thread *); |
| 1257 | 1248 | void	cpu_thread_free(struct thread *); |
| 1258 | void	cpu_thread_swapin(struct thread *); | |
| 1259 | void	cpu_thread_swapout(struct thread *); | |
| 1260 | 1249 | struct	thread *thread_alloc(int pages); |
| 1261 | int	thread_alloc_stack(struct thread *, int pages); | |
| 1262 | 1250 | int	thread_check_susp(struct thread *td, bool sleep); |
| 1263 | 1251 | void	thread_cow_get_proc(struct thread *newtd, struct proc *p); |
| 1264 | 1252 | void	thread_cow_get(struct thread *newtd, struct thread *td); |
| ... | ... | @@ -1271,6 +1259,7 @@ void	thread_exit(void) __dead2; |
| 1271 | 1259 | void	thread_free(struct thread *td); |
| 1272 | 1260 | void	thread_link(struct thread *td, struct proc *p); |
| 1273 | 1261 | void	thread_reap_barrier(void); |
| 1262 | int	thread_recycle(struct thread *, int pages); | |
| 1274 | 1263 | int	thread_single(struct proc *p, int how); |
| 1275 | 1264 | void	thread_single_end(struct proc *p, int how); |
| 1276 | 1265 | void	thread_stash(struct thread *td); |
lib/libc/include/generic-freebsd/sys/procctl.h+6| ... | ... | @@ -65,6 +65,8 @@ |
| 65 | 65 | #define	PROC_NO_NEW_PRIVS_STATUS 20	/* query suid/sgid disabled status */ |
| 66 | 66 | #define	PROC_WXMAP_CTL		21	/* control W^X */ |
| 67 | 67 | #define	PROC_WXMAP_STATUS	22	/* query W^X */ |
| 68 | #define	PROC_LOGSIGEXIT_CTL	23	/* en/dis logging on sigexit */ | |
| 69 | #define	PROC_LOGSIGEXIT_STATUS	24	/* query logging on sigexit */ | |
| 68 | 70 | |
| 69 | 71 | /* Operations for PROC_SPROTECT (passed in integer arg). */ |
| 70 | 72 | #define	PPROT_OP(x)	((x) & 0xf) |
| ... | ... | @@ -153,6 +155,10 @@ struct procctl_reaper_kill { |
| 153 | 155 | #define	PROC_WX_MAPPINGS_DISALLOW_EXEC	0x0002 |
| 154 | 156 | #define	PROC_WXORX_ENFORCE		0x80000000 |
| 155 | 157 | |
| 158 | #define	PROC_LOGSIGEXIT_CTL_NOFORCE		1 | |
| 159 | #define	PROC_LOGSIGEXIT_CTL_FORCE_ENABLE	2 | |
| 160 | #define	PROC_LOGSIGEXIT_CTL_FORCE_DISABLE	3 | |
| 161 | ||
| 156 | 162 | #ifndef _KERNEL |
| 157 | 163 | __BEGIN_DECLS |
| 158 | 164 | int	procctl(idtype_t, id_t, int, void *); |
lib/libc/include/generic-freebsd/sys/procdesc.h+5-2| ... | ... | @@ -94,8 +94,10 @@ struct procdesc { |
| 94 | 94 | * In-kernel interfaces to process descriptors. |
| 95 | 95 | */ |
| 96 | 96 | int	 procdesc_exit(struct proc *); |
| 97 | int	 procdesc_find(struct thread *, int fd, cap_rights_t *, struct proc **); | |
| 98 | int	 kern_pdgetpid(struct thread *, int fd, cap_rights_t *, pid_t *pidp); | |
| 97 | int	 procdesc_find(struct thread *, int fd, const cap_rights_t *, | |
| 98 | 	 struct proc **); | |
| 99 | int	 kern_pdgetpid(struct thread *, int fd, const cap_rights_t *, | |
| 100 | 	 pid_t *pidp); | |
| 99 | 101 | void	 procdesc_new(struct proc *, int); |
| 100 | 102 | void	 procdesc_finit(struct procdesc *, struct file *); |
| 101 | 103 | pid_t	 procdesc_pid(struct file *); |
| ... | ... | @@ -106,6 +108,7 @@ int	 procdesc_falloc(struct thread *, struct file **, int *, int, |
| 106 | 108 | |
| 107 | 109 | #else /* !_KERNEL */ |
| 108 | 110 | |
| 111 | #include <sys/cdefs.h> | |
| 109 | 112 | #include <sys/_types.h> |
| 110 | 113 | |
| 111 | 114 | #ifndef _PID_T_DECLARED |
lib/libc/include/generic-freebsd/sys/protosw.h+26-52| ... | ... | @@ -27,24 +27,11 @@ |
| 27 | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | * | |
| 31 | *	@(#)protosw.h	8.1 (Berkeley) 6/2/93 | |
| 32 | 30 | */ |
| 33 | 31 | |
| 34 | 32 | #ifndef _SYS_PROTOSW_H_ |
| 35 | 33 | #define _SYS_PROTOSW_H_ |
| 36 | ||
| 37 | #include <sys/queue.h> | |
| 38 | ||
| 39 | /* Forward declare these structures referenced from prototypes below. */ | |
| 40 | struct kaiocb; | |
| 41 | struct mbuf; | |
| 42 | struct thread; | |
| 43 | struct sockaddr; | |
| 44 | struct socket; | |
| 45 | struct sockopt; | |
| 46 | ||
| 47 | /*#ifdef _KERNEL*/ | |
| 34 | #if defined(_KERNEL) || defined(_WANT_PROTOSW) | |
| 48 | 35 | /* |
| 49 | 36 | * Protocol switch table. |
| 50 | 37 | * |
| ... | ... | @@ -54,16 +41,24 @@ struct sockopt; |
| 54 | 41 | * In retrospect, it would be a lot nicer to use an interface |
| 55 | 42 | * similar to the vnode VOP interface. |
| 56 | 43 | */ |
| 44 | struct socket; | |
| 45 | struct sockopt; | |
| 46 | struct thread; | |
| 47 | struct sockaddr; | |
| 57 | 48 | struct ifnet; |
| 49 | struct mbuf; | |
| 58 | 50 | struct stat; |
| 59 | 51 | struct ucred; |
| 60 | 52 | struct uio; |
| 53 | struct kaiocb; | |
| 54 | struct knote; | |
| 55 | enum shutdown_how; | |
| 61 | 56 | |
| 62 | 57 | /* USE THESE FOR YOUR PROTOTYPES ! */ |
| 63 | 58 | typedef int	pr_ctloutput_t(struct socket *, struct sockopt *); |
| 64 | 59 | typedef int	pr_setsbopt_t(struct socket *, struct sockopt *); |
| 65 | 60 | typedef void	pr_abort_t(struct socket *); |
| 66 | typedef int	pr_accept_t(struct socket *, struct sockaddr **); | |
| 61 | typedef int	pr_accept_t(struct socket *, struct sockaddr *); | |
| 67 | 62 | typedef int	pr_attach_t(struct socket *, int, struct thread *); |
| 68 | 63 | typedef int	pr_bind_t(struct socket *, struct sockaddr *, struct thread *); |
| 69 | 64 | typedef int	pr_connect_t(struct socket *, struct sockaddr *, |
| ... | ... | @@ -74,7 +69,7 @@ typedef int	pr_control_t(struct socket *, unsigned long, void *, |
| 74 | 69 | typedef void	pr_detach_t(struct socket *); |
| 75 | 70 | typedef int	pr_disconnect_t(struct socket *); |
| 76 | 71 | typedef int	pr_listen_t(struct socket *, int, struct thread *); |
| 77 | typedef int	pr_peeraddr_t(struct socket *, struct sockaddr **); | |
| 72 | typedef int	pr_peeraddr_t(struct socket *, struct sockaddr *); | |
| 78 | 73 | typedef int	pr_rcvd_t(struct socket *, int); |
| 79 | 74 | typedef int	pr_rcvoob_t(struct socket *, struct mbuf *, int); |
| 80 | 75 | typedef enum { |
| ... | ... | @@ -86,17 +81,17 @@ typedef enum { |
| 86 | 81 | } pr_send_flags_t; |
| 87 | 82 | typedef int	pr_send_t(struct socket *, int, struct mbuf *, |
| 88 | 83 | 		 struct sockaddr *, struct mbuf *, struct thread *); |
| 84 | typedef	int	pr_sendfile_wait_t(struct socket *, off_t, int *); | |
| 89 | 85 | typedef int	pr_ready_t(struct socket *, struct mbuf *, int); |
| 90 | 86 | typedef int	pr_sense_t(struct socket *, struct stat *); |
| 91 | typedef int	pr_shutdown_t(struct socket *); | |
| 92 | typedef int	pr_flush_t(struct socket *, int); | |
| 93 | typedef int	pr_sockaddr_t(struct socket *, struct sockaddr **); | |
| 87 | typedef int	pr_shutdown_t(struct socket *, enum shutdown_how); | |
| 88 | typedef int	pr_sockaddr_t(struct socket *, struct sockaddr *); | |
| 94 | 89 | typedef int	pr_sosend_t(struct socket *, struct sockaddr *, struct uio *, |
| 95 | 90 | 		 struct mbuf *, struct mbuf *, int, struct thread *); |
| 96 | 91 | typedef int	pr_soreceive_t(struct socket *, struct sockaddr **, |
| 97 | 92 | 		 struct uio *, struct mbuf **, struct mbuf **, int *); |
| 98 | typedef int	pr_sopoll_t(struct socket *, int, struct ucred *, | |
| 99 | 		 struct thread *); | |
| 93 | typedef int	pr_sopoll_t(struct socket *, int, struct thread *); | |
| 94 | typedef int	pr_kqfilter_t(struct socket *, struct knote *); | |
| 100 | 95 | typedef void	pr_sosetlabel_t(struct socket *); |
| 101 | 96 | typedef void	pr_close_t(struct socket *); |
| 102 | 97 | typedef int	pr_bindat_t(int, struct socket *, struct sockaddr *, |
| ... | ... | @@ -104,6 +99,8 @@ typedef int	pr_bindat_t(int, struct socket *, struct sockaddr *, |
| 104 | 99 | typedef int	pr_connectat_t(int, struct socket *, struct sockaddr *, |
| 105 | 100 | 		 struct thread *); |
| 106 | 101 | typedef int	pr_aio_queue_t(struct socket *, struct kaiocb *); |
| 102 | typedef int	pr_chmod_t(struct socket *, __mode_t, struct ucred *, | |
| 103 | 		 struct thread *); | |
| 107 | 104 | |
| 108 | 105 | struct protosw { |
| 109 | 106 | 	short	pr_type;		/* socket type used for */ |
| ... | ... | @@ -113,9 +110,9 @@ struct protosw { |
| 113 | 110 | 	struct	domain	*pr_domain;	/* domain protocol a member of */ |
| 114 | 111 | |
| 115 | 112 | 	pr_soreceive_t	*pr_soreceive;	/* recv(2) */ |
| 116 | 	pr_rcvd_t	*pr_rcvd;	/* soreceive_generic() if PR_WANTRCVD */ | |
| 117 | 113 | 	pr_sosend_t	*pr_sosend;	/* send(2) */ |
| 118 | 114 | 	pr_send_t	*pr_send;	/* send(2) via sosend_generic() */ |
| 115 | 	pr_sendfile_wait_t *pr_sendfile_wait;	/* sendfile helper */ | |
| 119 | 116 | 	pr_ready_t	*pr_ready;	/* sendfile/ktls readyness */ |
| 120 | 117 | 	pr_sopoll_t	*pr_sopoll;	/* poll(2) */ |
| 121 | 118 | /* Cache line #2 */ |
| ... | ... | @@ -125,7 +122,7 @@ struct protosw { |
| 125 | 122 | 	pr_disconnect_t	*pr_disconnect;	/* sodisconnect() */ |
| 126 | 123 | 	pr_close_t	*pr_close;	/* close(2) */ |
| 127 | 124 | 	pr_shutdown_t	*pr_shutdown;	/* shutdown(2) */ |
| 128 | 	pr_abort_t	*pr_abort;	/* abrupt tear down: soabort() */ | |
| 125 | 	pr_rcvd_t	*pr_rcvd;	/* soreceive_generic() if PR_WANTRCVD */ | |
| 129 | 126 | 	pr_aio_queue_t	*pr_aio_queue;	/* aio(9) */ |
| 130 | 127 | /* Cache line #3 */ |
| 131 | 128 | 	pr_bind_t	*pr_bind;	/* bind(2) */ |
| ... | ... | @@ -137,15 +134,18 @@ struct protosw { |
| 137 | 134 | 	pr_control_t	*pr_control;	/* ioctl(2) */ |
| 138 | 135 | 	pr_rcvoob_t	*pr_rcvoob;	/* soreceive_rcvoob() */ |
| 139 | 136 | /* Cache line #4 */ |
| 137 | 	pr_abort_t	*pr_abort;	/* abrupt tear down: soabort() */ | |
| 140 | 138 | 	pr_ctloutput_t	*pr_ctloutput;	/* control output (from above) */ |
| 141 | 139 | 	pr_peeraddr_t	*pr_peeraddr;	/* getpeername(2) */ |
| 142 | 140 | 	pr_sockaddr_t	*pr_sockaddr;	/* getsockname(2) */ |
| 143 | 141 | 	pr_sense_t	*pr_sense;	/* stat(2) */ |
| 144 | 	pr_flush_t	*pr_flush;	/* XXXGL: merge with pr_shutdown_t! */ | |
| 145 | 142 | 	pr_sosetlabel_t	*pr_sosetlabel;	/* MAC, XXXGL: remove */ |
| 146 | 143 | 	pr_setsbopt_t	*pr_setsbopt;	/* Socket buffer ioctls */ |
| 144 | 	pr_chmod_t	*pr_chmod;	/* fchmod(2) */ | |
| 145 | 	pr_kqfilter_t	*pr_kqfilter;	/* kevent(2) */ | |
| 147 | 146 | }; |
| 148 | /*#endif*/ | |
| 147 | #endif	/* defined(_KERNEL) || defined(_WANT_PROTOSW) */ | |
| 148 | #ifdef _KERNEL | |
| 149 | 149 | |
| 150 | 150 | /* |
| 151 | 151 | * Values for pr_flags. |
| ... | ... | @@ -162,37 +162,12 @@ struct protosw { |
| 162 | 162 | #define	PR_ADDR		0x02		/* addresses given with messages */ |
| 163 | 163 | #define	PR_CONNREQUIRED	0x04		/* connection required by protocol */ |
| 164 | 164 | #define	PR_WANTRCVD	0x08		/* want PRU_RCVD calls */ |
| 165 | #define	PR_RIGHTS	0x10		/* passes capabilities */ | |
| 165 | /* was	PR_RIGHTS	0x10		 passes capabilities */ | |
| 166 | 166 | #define PR_IMPLOPCL	0x20		/* implied open/close */ |
| 167 | 167 | /* was	PR_LASTHDR	0x40		 enforce ipsec policy; last header */ |
| 168 | 168 | #define	PR_CAPATTACH	0x80		/* socket can attach in cap mode */ |
| 169 | 169 | #define	PR_SOCKBUF	0x100		/* private implementation of buffers */ |
| 170 | 170 | |
| 171 | /* | |
| 172 | * The arguments to ctloutput are: | |
| 173 | *	(*protosw[].pr_ctloutput)(req, so, level, optname, optval, p); | |
| 174 | * req is one of the actions listed below, so is a (struct socket *), | |
| 175 | * level is an indication of which protocol layer the option is intended. | |
| 176 | * optname is a protocol dependent socket option request, | |
| 177 | * optval is a pointer to a mbuf-chain pointer, for value-return results. | |
| 178 | * The protocol is responsible for disposal of the mbuf chain *optval | |
| 179 | * if supplied, | |
| 180 | * the caller is responsible for any space held by *optval, when returned. | |
| 181 | * A non-zero return from ctloutput gives an | |
| 182 | * UNIX error number which should be passed to higher level software. | |
| 183 | */ | |
| 184 | #define	PRCO_GETOPT	0 | |
| 185 | #define	PRCO_SETOPT	1 | |
| 186 | ||
| 187 | #define	PRCO_NCMDS	2 | |
| 188 | ||
| 189 | #ifdef PRCOREQUESTS | |
| 190 | char	*prcorequests[] = { | |
| 191 | 	"GETOPT", "SETOPT", | |
| 192 | }; | |
| 193 | #endif | |
| 194 | ||
| 195 | #ifdef _KERNEL | |
| 196 | 171 | struct domain *pffinddomain(int family); |
| 197 | 172 | struct protosw *pffindproto(int family, int type, int proto); |
| 198 | 173 | int protosw_register(struct domain *, struct protosw *); |
| ... | ... | @@ -202,5 +177,4 @@ int protosw_unregister(struct protosw *); |
| 202 | 177 | extern struct domain inetdomain; |
| 203 | 178 | extern struct domain inet6domain; |
| 204 | 179 | #endif |
| 205 | ||
| 206 | 180 | #endif |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/sys/ptrace.h+9-3| ... | ... | @@ -27,8 +27,6 @@ |
| 27 | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | * | |
| 31 | *	@(#)ptrace.h	8.2 (Berkeley) 1/4/94 | |
| 32 | 30 | */ |
| 33 | 31 | |
| 34 | 32 | #ifndef	_SYS_PTRACE_H_ |
| ... | ... | @@ -89,8 +87,16 @@ |
| 89 | 87 | #define	PT_SC_REMOTE	44	/* Execute a syscall */ |
| 90 | 88 | |
| 91 | 89 | #define PT_FIRSTMACH 64	/* for machine-specific requests */ |
| 90 | #define	PT_LASTMACH 127 | |
| 92 | 91 | #include <machine/ptrace.h>	/* machine-specific requests, if any */ |
| 93 | 92 | |
| 93 | #ifdef _KERNEL | |
| 94 | /* Space for ptrace commands not exposed directly to userspace. */ | |
| 95 | #define	PTINTERNAL_FIRST	128 | |
| 96 | #define	PTINTERNAL_LAST		191 | |
| 97 | #define	PTLINUX_GET_SC_ARGS	(PTINTERNAL_FIRST + 0) | |
| 98 | #endif | |
| 99 | ||
| 94 | 100 | /* Events used with PT_GET_EVENT_MASK and PT_SET_EVENT_MASK */ |
| 95 | 101 | #define	PTRACE_EXEC	0x0001 |
| 96 | 102 | #define	PTRACE_SCE	0x0002 |
| ... | ... | @@ -152,7 +158,7 @@ struct ptrace_lwpinfo32 { |
| 152 | 158 | 	int	pl_flags;	/* LWP flags. */ |
| 153 | 159 | 	sigset_t	pl_sigmask;	/* LWP signal mask */ |
| 154 | 160 | 	sigset_t	pl_siglist;	/* LWP pending signal */ |
| 155 | 	struct siginfo32 pl_siginfo;	/* siginfo for signal */ | |
| 161 | 	struct __siginfo32 pl_siginfo;	/* siginfo for signal */ | |
| 156 | 162 | 	char		pl_tdname[MAXCOMLEN + 1]; /* LWP name. */ |
| 157 | 163 | 	pid_t		pl_child_pid;	/* New child pid */ |
| 158 | 164 | 	u_int		pl_syscall_code; |
lib/libc/include/generic-freebsd/sys/qmath.h+12-9| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /*- |
| 2 | * Copyright (c) 2018 Netflix, Inc. | |
| 2 | * Copyright (c) 2018-2024 Netflix, Inc. | |
| 3 | 3 | * All rights reserved. |
| 4 | 4 | * |
| 5 | 5 | * Redistribution and use in source and binary forms, with or without |
| ... | ... | @@ -378,15 +378,18 @@ typedef	u64q_t		umaxq_t; |
| 378 | 378 | #define	Q_QMINQ(a, b)	(Q_LT(a, b) ? (a) : (b)) |
| 379 | 379 | |
| 380 | 380 | /* |
| 381 | * Test if 'a' can be represented by 'b' with full accuracy (T) or not (F). | |
| 382 | * The type casting has to be done to a's type so that any truncation caused by | |
| 383 | * the casts will not affect the logic. | |
| 381 | * Test if 'a' can be represented by 'b' with full accuracy (0) or not | |
| 382 | * (EOVERFLOW). If 'b' has fewer integer and/or fractional bits than 'a', | |
| 383 | * the integer and fractional values stored in 'a' must fit in the available | |
| 384 | * number of integer and fractional bits in 'b'. | |
| 384 | 385 | */ |
| 385 | #define	Q_QCANREPQ(a, b) \ | |
| 386 | ((((Q_LTZ(a) && Q_SIGNED(b)) || !Q_LTZ(a)) && \ | |
| 387 | Q_GIABSVAL(a) <= Q_TC(a, Q_IMAXVAL(b)) && \ | |
| 388 | Q_GFABSVAL(a) <= Q_TC(a, Q_FMAXVAL(b))) ? \ | |
| 389 | 0 : EOVERFLOW) | |
| 386 | #define	Q_QCANREPQ(a, b) (( \ | |
| 387 | (!Q_LTZ(a) || Q_SIGNED(b)) \ | |
| 388 | && ( Q_NIBITS(a) <= Q_NIBITS(b) \ | |
| 389 | || 0 == (Q_GIABSVAL(a) & (~Q_TC(a, 0) << Q_NIBITS(b)))) \ | |
| 390 | && ( Q_NFBITS(a) <= Q_NFBITS(b) \ | |
| 391 | || 0 == (Q_GFABSVAL(a) & ~(~Q_TC(a, 0) << (Q_NFBITS(a) - Q_NFBITS(b))))) \ | |
| 392 | ) ? 0 : EOVERFLOW) | |
| 390 | 393 | |
| 391 | 394 | /* Test if raw integer value 'i' can be represented by 'q' (T) or not (F). */ |
| 392 | 395 | #define	Q_QCANREPI(q, i) \ |
lib/libc/include/generic-freebsd/sys/queue.h+393-218| ... | ... | @@ -27,12 +27,10 @@ |
| 27 | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | * | |
| 31 | *	@(#)queue.h	8.5 (Berkeley) 8/20/94 | |
| 32 | 30 | */ |
| 33 | 31 | |
| 34 | 32 | #ifndef _SYS_QUEUE_H_ |
| 35 | #define	_SYS_QUEUE_H_ | |
| 33 | #define _SYS_QUEUE_H_ | |
| 36 | 34 | |
| 37 | 35 | #include <sys/cdefs.h> |
| 38 | 36 | |
| ... | ... | @@ -113,15 +111,15 @@ |
| 113 | 111 | * _REMOVE_HEAD			+	+	+	+ |
| 114 | 112 | * _REMOVE			s	+	s	+ |
| 115 | 113 | * _REPLACE			-	+	-	+ |
| 114 | * _SPLIT_AFTER			+	+	+	+ | |
| 116 | 115 | * _SWAP			+	+	+	+ |
| 117 | 116 | * |
| 118 | 117 | */ |
| 119 | 118 | #ifdef QUEUE_MACRO_DEBUG |
| 120 | #warn Use QUEUE_MACRO_DEBUG_TRACE and/or QUEUE_MACRO_DEBUG_TRASH | |
| 121 | #define	QUEUE_MACRO_DEBUG_TRACE | |
| 122 | #define	QUEUE_MACRO_DEBUG_TRASH | |
| 119 | #warn Use QUEUE_MACRO_DEBUG_xxx instead (TRACE, TRASH and/or ASSERTIONS) | |
| 120 | #define QUEUE_MACRO_DEBUG_TRACE | |
| 121 | #define QUEUE_MACRO_DEBUG_TRASH | |
| 123 | 122 | #endif |
| 124 | ||
| 125 | 123 | #ifdef QUEUE_MACRO_DEBUG_TRACE |
| 126 | 124 | /* Store the last 2 places the queue element or head was altered */ |
| 127 | 125 | struct qm_trace { |
| ... | ... | @@ -131,17 +129,17 @@ struct qm_trace { |
| 131 | 129 | 	const char	*prevfile; |
| 132 | 130 | }; |
| 133 | 131 | |
| 134 | #define	TRACEBUF	struct qm_trace trace; | |
| 135 | #define	TRACEBUF_INITIALIZER	{ __LINE__, 0, __FILE__, NULL } , | |
| 132 | #define TRACEBUF	struct qm_trace trace; | |
| 133 | #define TRACEBUF_INITIALIZER	{ __LINE__, 0, __FILE__, NULL } , | |
| 136 | 134 | |
| 137 | #define	QMD_TRACE_HEAD(head) do {					\ | |
| 135 | #define QMD_TRACE_HEAD(head) do {					\ | |
| 138 | 136 | 	(head)->trace.prevline = (head)->trace.lastline;		\ |
| 139 | 137 | 	(head)->trace.prevfile = (head)->trace.lastfile;		\ |
| 140 | 138 | 	(head)->trace.lastline = __LINE__;				\ |
| 141 | 139 | 	(head)->trace.lastfile = __FILE__;				\ |
| 142 | 140 | } while (0) |
| 143 | 141 | |
| 144 | #define	QMD_TRACE_ELEM(elem) do {					\ | |
| 142 | #define QMD_TRACE_ELEM(elem) do {					\ | |
| 145 | 143 | 	(elem)->trace.prevline = (elem)->trace.lastline;		\ |
| 146 | 144 | 	(elem)->trace.prevfile = (elem)->trace.lastfile;		\ |
| 147 | 145 | 	(elem)->trace.lastline = __LINE__;				\ |
| ... | ... | @@ -149,53 +147,110 @@ struct qm_trace { |
| 149 | 147 | } while (0) |
| 150 | 148 | |
| 151 | 149 | #else	/* !QUEUE_MACRO_DEBUG_TRACE */ |
| 152 | #define	QMD_TRACE_ELEM(elem) | |
| 153 | #define	QMD_TRACE_HEAD(head) | |
| 154 | #define	TRACEBUF | |
| 155 | #define	TRACEBUF_INITIALIZER | |
| 150 | #define QMD_TRACE_ELEM(elem) | |
| 151 | #define QMD_TRACE_HEAD(head) | |
| 152 | #define TRACEBUF | |
| 153 | #define TRACEBUF_INITIALIZER | |
| 156 | 154 | #endif	/* QUEUE_MACRO_DEBUG_TRACE */ |
| 157 | 155 | |
| 158 | 156 | #ifdef QUEUE_MACRO_DEBUG_TRASH |
| 159 | #define	QMD_SAVELINK(name, link)	void **name = (void *)&(link) | |
| 160 | #define	TRASHIT(x)		do {(x) = (void *)-1;} while (0) | |
| 161 | #define	QMD_IS_TRASHED(x)	((x) == (void *)(intptr_t)-1) | |
| 157 | #define QMD_SAVELINK(name, link)	void **name = (void *)&(link) | |
| 158 | #define TRASHIT(x)		do {(x) = (void *)-1;} while (0) | |
| 159 | #define QMD_IS_TRASHED(x)	((x) == (void *)(intptr_t)-1) | |
| 162 | 160 | #else	/* !QUEUE_MACRO_DEBUG_TRASH */ |
| 163 | #define	QMD_SAVELINK(name, link) | |
| 164 | #define	TRASHIT(x) | |
| 165 | #define	QMD_IS_TRASHED(x)	0 | |
| 161 | #define QMD_SAVELINK(name, link) | |
| 162 | #define TRASHIT(x) | |
| 163 | #define QMD_IS_TRASHED(x)	0 | |
| 166 | 164 | #endif	/* QUEUE_MACRO_DEBUG_TRASH */ |
| 167 | 165 | |
| 166 | #if defined(QUEUE_MACRO_DEBUG_ASSERTIONS) &&				\ | |
| 167 | defined(QUEUE_MACRO_NO_DEBUG_ASSERTIONS) | |
| 168 | #error Both QUEUE_MACRO_DEBUG_ASSERTIONS and QUEUE_MACRO_NO_DEBUG_ASSERTIONS defined | |
| 169 | #endif | |
| 170 | ||
| 171 | /* | |
| 172 | * Automatically define QUEUE_MACRO_DEBUG_ASSERTIONS when compiling the kernel | |
| 173 | * with INVARIANTS, if not already defined and not prevented by presence of | |
| 174 | * QUEUE_MACRO_NO_DEBUG_ASSERTIONS. | |
| 175 | */ | |
| 176 | #if !defined(QUEUE_MACRO_DEBUG_ASSERTIONS) &&				\ | |
| 177 | !defined(QUEUE_MACRO_NO_DEBUG_ASSERTIONS) &&			\ | |
| 178 | (defined(_KERNEL) && defined(INVARIANTS)) | |
| 179 | #define QUEUE_MACRO_DEBUG_ASSERTIONS | |
| 180 | #endif | |
| 181 | ||
| 182 | /* | |
| 183 | * If queue assertions are enabled, provide default definitions for QMD_PANIC() | |
| 184 | * and QMD_ASSERT() if undefined. | |
| 185 | */ | |
| 186 | #ifdef QUEUE_MACRO_DEBUG_ASSERTIONS | |
| 187 | #ifndef QMD_PANIC | |
| 188 | #if defined(_KERNEL) || defined(_STANDALONE) | |
| 189 | /* | |
| 190 | * On _STANDALONE, either <stand.h> or the headers using <sys/queue.h> provide | |
| 191 | * a declaration or macro for panic(). | |
| 192 | */ | |
| 193 | #ifdef _KERNEL | |
| 194 | #include <sys/kassert.h> | |
| 195 | #endif | |
| 196 | #define QMD_PANIC(fmt, ...) do {					\ | |
| 197 | 	panic(fmt, ##__VA_ARGS__);					\ | |
| 198 | } while (0) | |
| 199 | #else /* !(_KERNEL || _STANDALONE) */ | |
| 200 | #include <stdio.h> | |
| 201 | #include <stdlib.h> | |
| 202 | #define QMD_PANIC(fmt, ...) do {					\ | |
| 203 | 	fprintf(stderr, fmt "\n", ##__VA_ARGS__);			\ | |
| 204 | 	abort();							\ | |
| 205 | } while (0) | |
| 206 | #endif /* _KERNEL || _STANDALONE */ | |
| 207 | #endif /* !QMD_PANIC */ | |
| 208 | ||
| 209 | #ifndef QMD_ASSERT | |
| 210 | #define QMD_ASSERT(expression, fmt, ...) do {				\ | |
| 211 | 	if (__predict_false(!(expression)))				\ | |
| 212 | 		QMD_PANIC("%s:%u: %s: " fmt,				\ | |
| 213 | 		 __FILE__, __LINE__, __func__, ##__VA_ARGS__);	\ | |
| 214 | } while (0) | |
| 215 | #endif /* !QMD_ASSERT */ | |
| 216 | #else /* !QUEUE_MACRO_DEBUG_ASSERTIONS */ | |
| 217 | #undef QMD_ASSERT | |
| 218 | #define QMD_ASSERT(test, fmt, ...) do {} while (0) | |
| 219 | #endif /* QUEUE_MACRO_DEBUG_ASSERTIONS */ | |
| 220 | ||
| 221 | ||
| 168 | 222 | #ifdef __cplusplus |
| 169 | 223 | /* |
| 170 | 224 | * In C++ there can be structure lists and class lists: |
| 171 | 225 | */ |
| 172 | #define	QUEUE_TYPEOF(type) type | |
| 226 | #define QUEUE_TYPEOF(type) type | |
| 173 | 227 | #else |
| 174 | #define	QUEUE_TYPEOF(type) struct type | |
| 228 | #define QUEUE_TYPEOF(type) struct type | |
| 175 | 229 | #endif |
| 176 | 230 | |
| 177 | 231 | /* |
| 178 | 232 | * Singly-linked List declarations. |
| 179 | 233 | */ |
| 180 | #define	SLIST_HEAD(name, type)						\ | |
| 234 | ||
| 235 | #define SLIST_HEAD(name, type)						\ | |
| 181 | 236 | struct name {								\ |
| 182 | 237 | 	struct type *slh_first;	/* first element */			\ |
| 183 | 238 | } |
| 184 | 239 | |
| 185 | #define	SLIST_CLASS_HEAD(name, type)					\ | |
| 240 | #define SLIST_CLASS_HEAD(name, type)					\ | |
| 186 | 241 | struct name {								\ |
| 187 | 242 | 	class type *slh_first;	/* first element */			\ |
| 188 | 243 | } |
| 189 | 244 | |
| 190 | #define	SLIST_HEAD_INITIALIZER(head)					\ | |
| 245 | #define SLIST_HEAD_INITIALIZER(head)					\ | |
| 191 | 246 | 	{ NULL } |
| 192 | 247 | |
| 193 | #define	SLIST_ENTRY(type)						\ | |
| 248 | #define SLIST_ENTRY(type)						\ | |
| 194 | 249 | struct {								\ |
| 195 | 250 | 	struct type *sle_next;	/* next element */			\ |
| 196 | 251 | } |
| 197 | 252 | |
| 198 | #define	SLIST_CLASS_ENTRY(type)						\ | |
| 253 | #define SLIST_CLASS_ENTRY(type)						\ | |
| 199 | 254 | struct {								\ |
| 200 | 255 | 	class type *sle_next;		/* next element */		\ |
| 201 | 256 | } |
| ... | ... | @@ -203,137 +258,151 @@ struct {								\ |
| 203 | 258 | /* |
| 204 | 259 | * Singly-linked List functions. |
| 205 | 260 | */ |
| 206 | #if (defined(_KERNEL) && defined(INVARIANTS)) | |
| 207 | #define	QMD_SLIST_CHECK_PREVPTR(prevp, elm) do {			\ | |
| 208 | 	if (*(prevp) != (elm))						\ | |
| 209 | 		panic("Bad prevptr *(%p) == %p != %p",			\ | |
| 210 | 		 (prevp), *(prevp), (elm));				\ | |
| 211 | } while (0) | |
| 212 | #else | |
| 213 | #define	QMD_SLIST_CHECK_PREVPTR(prevp, elm) | |
| 214 | #endif | |
| 261 | ||
| 262 | #define QMD_SLIST_CHECK_PREVPTR(prevp, elm)				\ | |
| 263 | 	QMD_ASSERT(*(prevp) == (elm),					\ | |
| 264 | 	 "Bad prevptr *(%p) == %p != %p",				\ | |
| 265 | 	 (prevp), *(prevp), (elm)) | |
| 266 | ||
| 267 | #define SLIST_ASSERT_EMPTY(head)					\ | |
| 268 | 	QMD_ASSERT(SLIST_EMPTY((head)),					\ | |
| 269 | 	 "slist %p is not empty", (head)) | |
| 270 | ||
| 271 | #define SLIST_ASSERT_NONEMPTY(head)					\ | |
| 272 | 	QMD_ASSERT(!SLIST_EMPTY((head)),				\ | |
| 273 | 	 "slist %p is empty", (head)) | |
| 215 | 274 | |
| 216 | 275 | #define SLIST_CONCAT(head1, head2, type, field) do {			\ |
| 217 | 	QUEUE_TYPEOF(type) *curelm = SLIST_FIRST(head1);		\ | |
| 218 | 	if (curelm == NULL) {						\ | |
| 276 | 	QUEUE_TYPEOF(type) *_Curelm = SLIST_FIRST(head1);		\ | |
| 277 | 	if (_Curelm == NULL) {						\ | |
| 219 | 278 | 		if ((SLIST_FIRST(head1) = SLIST_FIRST(head2)) != NULL)	\ |
| 220 | 279 | 			SLIST_INIT(head2);				\ |
| 221 | 280 | 	} else if (SLIST_FIRST(head2) != NULL) {			\ |
| 222 | 		while (SLIST_NEXT(curelm, field) != NULL)		\ | |
| 223 | 			curelm = SLIST_NEXT(curelm, field);		\ | |
| 224 | 		SLIST_NEXT(curelm, field) = SLIST_FIRST(head2);		\ | |
| 281 | 		while (SLIST_NEXT(_Curelm, field) != NULL)		\ | |
| 282 | 			_Curelm = SLIST_NEXT(_Curelm, field);		\ | |
| 283 | 		SLIST_NEXT(_Curelm, field) = SLIST_FIRST(head2);	\ | |
| 225 | 284 | 		SLIST_INIT(head2);					\ |
| 226 | 285 | 	}								\ |
| 227 | 286 | } while (0) |
| 228 | 287 | |
| 229 | #define	SLIST_EMPTY(head)	((head)->slh_first == NULL) | |
| 288 | #define SLIST_EMPTY(head)	((head)->slh_first == NULL) | |
| 230 | 289 | |
| 231 | #define	SLIST_FIRST(head)	((head)->slh_first) | |
| 290 | #define SLIST_EMPTY_ATOMIC(head)					\ | |
| 291 | 	(atomic_load_ptr(&(head)->slh_first) == NULL) | |
| 232 | 292 | |
| 233 | #define	SLIST_FOREACH(var, head, field)					\ | |
| 293 | #define SLIST_FIRST(head)	((head)->slh_first) | |
| 294 | ||
| 295 | #define SLIST_FOREACH(var, head, field)					\ | |
| 234 | 296 | 	for ((var) = SLIST_FIRST((head));				\ |
| 235 | 297 | 	 (var);							\ |
| 236 | 298 | 	 (var) = SLIST_NEXT((var), field)) |
| 237 | 299 | |
| 238 | #define	SLIST_FOREACH_FROM(var, head, field)				\ | |
| 300 | #define SLIST_FOREACH_FROM(var, head, field)				\ | |
| 239 | 301 | 	for ((var) = ((var) ? (var) : SLIST_FIRST((head)));		\ |
| 240 | 302 | 	 (var);							\ |
| 241 | 303 | 	 (var) = SLIST_NEXT((var), field)) |
| 242 | 304 | |
| 243 | #define	SLIST_FOREACH_SAFE(var, head, field, tvar)			\ | |
| 305 | #define SLIST_FOREACH_SAFE(var, head, field, tvar)			\ | |
| 244 | 306 | 	for ((var) = SLIST_FIRST((head));				\ |
| 245 | 307 | 	 (var) && ((tvar) = SLIST_NEXT((var), field), 1);		\ |
| 246 | 308 | 	 (var) = (tvar)) |
| 247 | 309 | |
| 248 | #define	SLIST_FOREACH_FROM_SAFE(var, head, field, tvar)			\ | |
| 310 | #define SLIST_FOREACH_FROM_SAFE(var, head, field, tvar)			\ | |
| 249 | 311 | 	for ((var) = ((var) ? (var) : SLIST_FIRST((head)));		\ |
| 250 | 312 | 	 (var) && ((tvar) = SLIST_NEXT((var), field), 1);		\ |
| 251 | 313 | 	 (var) = (tvar)) |
| 252 | 314 | |
| 253 | #define	SLIST_FOREACH_PREVPTR(var, varp, head, field)			\ | |
| 315 | #define SLIST_FOREACH_PREVPTR(var, varp, head, field)			\ | |
| 254 | 316 | 	for ((varp) = &SLIST_FIRST((head));				\ |
| 255 | 317 | 	 ((var) = *(varp)) != NULL;					\ |
| 256 | 318 | 	 (varp) = &SLIST_NEXT((var), field)) |
| 257 | 319 | |
| 258 | #define	SLIST_INIT(head) do {						\ | |
| 320 | #define SLIST_INIT(head) do {						\ | |
| 259 | 321 | 	SLIST_FIRST((head)) = NULL;					\ |
| 260 | 322 | } while (0) |
| 261 | 323 | |
| 262 | #define	SLIST_INSERT_AFTER(slistelm, elm, field) do {			\ | |
| 324 | #define SLIST_INSERT_AFTER(slistelm, elm, field) do {			\ | |
| 263 | 325 | 	SLIST_NEXT((elm), field) = SLIST_NEXT((slistelm), field);	\ |
| 264 | 326 | 	SLIST_NEXT((slistelm), field) = (elm);				\ |
| 265 | 327 | } while (0) |
| 266 | 328 | |
| 267 | #define	SLIST_INSERT_HEAD(head, elm, field) do {			\ | |
| 329 | #define SLIST_INSERT_HEAD(head, elm, field) do {			\ | |
| 268 | 330 | 	SLIST_NEXT((elm), field) = SLIST_FIRST((head));			\ |
| 269 | 331 | 	SLIST_FIRST((head)) = (elm);					\ |
| 270 | 332 | } while (0) |
| 271 | 333 | |
| 272 | #define	SLIST_NEXT(elm, field)	((elm)->field.sle_next) | |
| 334 | #define SLIST_NEXT(elm, field)	((elm)->field.sle_next) | |
| 273 | 335 | |
| 274 | #define	SLIST_REMOVE(head, elm, type, field) do {			\ | |
| 336 | #define SLIST_REMOVE(head, elm, type, field) do {			\ | |
| 275 | 337 | 	if (SLIST_FIRST((head)) == (elm)) {				\ |
| 276 | 338 | 		SLIST_REMOVE_HEAD((head), field);			\ |
| 277 | 339 | 	}								\ |
| 278 | 340 | 	else {								\ |
| 279 | 		QUEUE_TYPEOF(type) *curelm = SLIST_FIRST(head);		\ | |
| 280 | 		while (SLIST_NEXT(curelm, field) != (elm))		\ | |
| 281 | 			curelm = SLIST_NEXT(curelm, field);		\ | |
| 282 | 		SLIST_REMOVE_AFTER(curelm, field);			\ | |
| 341 | 		QUEUE_TYPEOF(type) *_Curelm = SLIST_FIRST(head);		\ | |
| 342 | 		while (SLIST_NEXT(_Curelm, field) != (elm))		\ | |
| 343 | 			_Curelm = SLIST_NEXT(_Curelm, field);		\ | |
| 344 | 		SLIST_REMOVE_AFTER(_Curelm, field);			\ | |
| 283 | 345 | 	}								\ |
| 284 | 346 | } while (0) |
| 285 | 347 | |
| 286 | 348 | #define SLIST_REMOVE_AFTER(elm, field) do {				\ |
| 287 | 	QMD_SAVELINK(oldnext, SLIST_NEXT(elm, field)->field.sle_next);	\ | |
| 349 | 	QMD_SAVELINK(_Oldnext, SLIST_NEXT(elm, field)->field.sle_next);	\ | |
| 288 | 350 | 	SLIST_NEXT(elm, field) =					\ |
| 289 | 351 | 	 SLIST_NEXT(SLIST_NEXT(elm, field), field);			\ |
| 290 | 	TRASHIT(*oldnext);						\ | |
| 352 | 	TRASHIT(*_Oldnext);						\ | |
| 291 | 353 | } while (0) |
| 292 | 354 | |
| 293 | #define	SLIST_REMOVE_HEAD(head, field) do {				\ | |
| 294 | 	QMD_SAVELINK(oldnext, SLIST_FIRST(head)->field.sle_next);	\ | |
| 355 | #define SLIST_REMOVE_HEAD(head, field) do {				\ | |
| 356 | 	QMD_SAVELINK(_Oldnext, SLIST_FIRST(head)->field.sle_next);	\ | |
| 295 | 357 | 	SLIST_FIRST((head)) = SLIST_NEXT(SLIST_FIRST((head)), field);	\ |
| 296 | 	TRASHIT(*oldnext);						\ | |
| 358 | 	TRASHIT(*_Oldnext);						\ | |
| 297 | 359 | } while (0) |
| 298 | 360 | |
| 299 | #define	SLIST_REMOVE_PREVPTR(prevp, elm, field) do {			\ | |
| 361 | #define SLIST_REMOVE_PREVPTR(prevp, elm, field) do {			\ | |
| 300 | 362 | 	QMD_SLIST_CHECK_PREVPTR(prevp, elm);				\ |
| 301 | 363 | 	*(prevp) = SLIST_NEXT(elm, field);				\ |
| 302 | 364 | 	TRASHIT((elm)->field.sle_next);					\ |
| 303 | 365 | } while (0) |
| 304 | 366 | |
| 367 | #define SLIST_SPLIT_AFTER(head, elm, rest, field) do {			\ | |
| 368 | 	SLIST_ASSERT_NONEMPTY((head));					\ | |
| 369 | 	SLIST_FIRST((rest)) = SLIST_NEXT((elm), field);			\ | |
| 370 | 	SLIST_NEXT((elm), field) = NULL;				\ | |
| 371 | } while (0) | |
| 372 | ||
| 305 | 373 | #define SLIST_SWAP(head1, head2, type) do {				\ |
| 306 | 	QUEUE_TYPEOF(type) *swap_first = SLIST_FIRST(head1);		\ | |
| 374 | 	QUEUE_TYPEOF(type) *_Swap_first = SLIST_FIRST(head1);		\ | |
| 307 | 375 | 	SLIST_FIRST(head1) = SLIST_FIRST(head2);			\ |
| 308 | 	SLIST_FIRST(head2) = swap_first;				\ | |
| 376 | 	SLIST_FIRST(head2) = _Swap_first;				\ | |
| 309 | 377 | } while (0) |
| 310 | 378 | |
| 311 | #define	SLIST_END(head)		NULL | |
| 379 | #define SLIST_END(head)		NULL | |
| 312 | 380 | |
| 313 | 381 | /* |
| 314 | 382 | * Singly-linked Tail queue declarations. |
| 315 | 383 | */ |
| 316 | #define	STAILQ_HEAD(name, type)						\ | |
| 384 | ||
| 385 | #define STAILQ_HEAD(name, type)						\ | |
| 317 | 386 | struct name {								\ |
| 318 | 387 | 	struct type *stqh_first;/* first element */			\ |
| 319 | 388 | 	struct type **stqh_last;/* addr of last next element */		\ |
| 320 | 389 | } |
| 321 | 390 | |
| 322 | #define	STAILQ_CLASS_HEAD(name, type)					\ | |
| 391 | #define STAILQ_CLASS_HEAD(name, type)					\ | |
| 323 | 392 | struct name {								\ |
| 324 | 393 | 	class type *stqh_first;	/* first element */			\ |
| 325 | 394 | 	class type **stqh_last;	/* addr of last next element */		\ |
| 326 | 395 | } |
| 327 | 396 | |
| 328 | #define	STAILQ_HEAD_INITIALIZER(head)					\ | |
| 397 | #define STAILQ_HEAD_INITIALIZER(head)					\ | |
| 329 | 398 | 	{ NULL, &(head).stqh_first } |
| 330 | 399 | |
| 331 | #define	STAILQ_ENTRY(type)						\ | |
| 400 | #define STAILQ_ENTRY(type)						\ | |
| 332 | 401 | struct {								\ |
| 333 | 402 | 	struct type *stqe_next;	/* next element */			\ |
| 334 | 403 | } |
| 335 | 404 | |
| 336 | #define	STAILQ_CLASS_ENTRY(type)					\ | |
| 405 | #define STAILQ_CLASS_ENTRY(type)					\ | |
| 337 | 406 | struct {								\ |
| 338 | 407 | 	class type *stqe_next;	/* next element */			\ |
| 339 | 408 | } |
| ... | ... | @@ -341,7 +410,38 @@ struct {								\ |
| 341 | 410 | /* |
| 342 | 411 | * Singly-linked Tail queue functions. |
| 343 | 412 | */ |
| 344 | #define	STAILQ_CONCAT(head1, head2) do {				\ | |
| 413 | ||
| 414 | /* | |
| 415 | * QMD_STAILQ_CHECK_EMPTY(STAILQ_HEAD *head) | |
| 416 | * | |
| 417 | * Validates that the stailq head's pointer to the last element's next pointer | |
| 418 | * actually points to the head's first element pointer field. | |
| 419 | */ | |
| 420 | #define QMD_STAILQ_CHECK_EMPTY(head)					\ | |
| 421 | 	QMD_ASSERT((head)->stqh_last == &(head)->stqh_first,		\ | |
| 422 | 	 "Empty stailq %p->stqh_last is %p, "			\ | |
| 423 | 	 "not head's first field address",				\ | |
| 424 | 	 (head), (head)->stqh_last) | |
| 425 | ||
| 426 | /* | |
| 427 | * QMD_STAILQ_CHECK_TAIL(STAILQ_HEAD *head) | |
| 428 | * | |
| 429 | * Validates that the stailq's last element's next pointer is NULL. | |
| 430 | */ | |
| 431 | #define QMD_STAILQ_CHECK_TAIL(head)					\ | |
| 432 | 	QMD_ASSERT(*(head)->stqh_last == NULL,				\ | |
| 433 | 	 "Stailq %p last element's next pointer is "			\ | |
| 434 | 	 "%p, not NULL", (head), *(head)->stqh_last) | |
| 435 | ||
| 436 | #define STAILQ_ASSERT_EMPTY(head)					\ | |
| 437 | 	QMD_ASSERT(STAILQ_EMPTY((head)),				\ | |
| 438 | 	 "stailq %p is not empty", (head)) | |
| 439 | ||
| 440 | #define STAILQ_ASSERT_NONEMPTY(head)					\ | |
| 441 | 	QMD_ASSERT(!STAILQ_EMPTY((head)),				\ | |
| 442 | 	 "stailq %p is empty", (head)) | |
| 443 | ||
| 444 | #define STAILQ_CONCAT(head1, head2) do {				\ | |
| 345 | 445 | 	if (!STAILQ_EMPTY((head2))) {					\ |
| 346 | 446 | 		*(head1)->stqh_last = (head2)->stqh_first;		\ |
| 347 | 447 | 		(head1)->stqh_last = (head2)->stqh_last;		\ |
| ... | ... | @@ -349,72 +449,80 @@ struct {								\ |
| 349 | 449 | 	}								\ |
| 350 | 450 | } while (0) |
| 351 | 451 | |
| 352 | #define	STAILQ_EMPTY(head)	((head)->stqh_first == NULL) | |
| 452 | #define STAILQ_EMPTY(head)	({					\ | |
| 453 | 	if (STAILQ_FIRST(head) == NULL)					\ | |
| 454 | 		QMD_STAILQ_CHECK_EMPTY(head);				\ | |
| 455 | 	STAILQ_FIRST(head) == NULL;					\ | |
| 456 | }) | |
| 457 | ||
| 458 | #define STAILQ_EMPTY_ATOMIC(head)					\ | |
| 459 | 	(atomic_load_ptr(&(head)->stqh_first) == NULL) | |
| 353 | 460 | |
| 354 | #define	STAILQ_FIRST(head)	((head)->stqh_first) | |
| 461 | #define STAILQ_FIRST(head)	((head)->stqh_first) | |
| 355 | 462 | |
| 356 | #define	STAILQ_FOREACH(var, head, field)				\ | |
| 463 | #define STAILQ_FOREACH(var, head, field)				\ | |
| 357 | 464 | 	for((var) = STAILQ_FIRST((head));				\ |
| 358 | 465 | 	 (var);							\ |
| 359 | 466 | 	 (var) = STAILQ_NEXT((var), field)) |
| 360 | 467 | |
| 361 | #define	STAILQ_FOREACH_FROM(var, head, field)				\ | |
| 468 | #define STAILQ_FOREACH_FROM(var, head, field)				\ | |
| 362 | 469 | 	for ((var) = ((var) ? (var) : STAILQ_FIRST((head)));		\ |
| 363 | 470 | 	 (var);							\ |
| 364 | 471 | 	 (var) = STAILQ_NEXT((var), field)) |
| 365 | 472 | |
| 366 | #define	STAILQ_FOREACH_SAFE(var, head, field, tvar)			\ | |
| 473 | #define STAILQ_FOREACH_SAFE(var, head, field, tvar)			\ | |
| 367 | 474 | 	for ((var) = STAILQ_FIRST((head));				\ |
| 368 | 475 | 	 (var) && ((tvar) = STAILQ_NEXT((var), field), 1);		\ |
| 369 | 476 | 	 (var) = (tvar)) |
| 370 | 477 | |
| 371 | #define	STAILQ_FOREACH_FROM_SAFE(var, head, field, tvar)		\ | |
| 478 | #define STAILQ_FOREACH_FROM_SAFE(var, head, field, tvar)		\ | |
| 372 | 479 | 	for ((var) = ((var) ? (var) : STAILQ_FIRST((head)));		\ |
| 373 | 480 | 	 (var) && ((tvar) = STAILQ_NEXT((var), field), 1);		\ |
| 374 | 481 | 	 (var) = (tvar)) |
| 375 | 482 | |
| 376 | #define	STAILQ_INIT(head) do {						\ | |
| 483 | #define STAILQ_INIT(head) do {						\ | |
| 377 | 484 | 	STAILQ_FIRST((head)) = NULL;					\ |
| 378 | 485 | 	(head)->stqh_last = &STAILQ_FIRST((head));			\ |
| 379 | 486 | } while (0) |
| 380 | 487 | |
| 381 | #define	STAILQ_INSERT_AFTER(head, tqelm, elm, field) do {		\ | |
| 488 | #define STAILQ_INSERT_AFTER(head, tqelm, elm, field) do {		\ | |
| 382 | 489 | 	if ((STAILQ_NEXT((elm), field) = STAILQ_NEXT((tqelm), field)) == NULL)\ |
| 383 | 490 | 		(head)->stqh_last = &STAILQ_NEXT((elm), field);		\ |
| 384 | 491 | 	STAILQ_NEXT((tqelm), field) = (elm);				\ |
| 385 | 492 | } while (0) |
| 386 | 493 | |
| 387 | #define	STAILQ_INSERT_HEAD(head, elm, field) do {			\ | |
| 494 | #define STAILQ_INSERT_HEAD(head, elm, field) do {			\ | |
| 388 | 495 | 	if ((STAILQ_NEXT((elm), field) = STAILQ_FIRST((head))) == NULL)	\ |
| 389 | 496 | 		(head)->stqh_last = &STAILQ_NEXT((elm), field);		\ |
| 390 | 497 | 	STAILQ_FIRST((head)) = (elm);					\ |
| 391 | 498 | } while (0) |
| 392 | 499 | |
| 393 | #define	STAILQ_INSERT_TAIL(head, elm, field) do {			\ | |
| 500 | #define STAILQ_INSERT_TAIL(head, elm, field) do {			\ | |
| 501 | 	QMD_STAILQ_CHECK_TAIL(head);					\ | |
| 394 | 502 | 	STAILQ_NEXT((elm), field) = NULL;				\ |
| 395 | 503 | 	*(head)->stqh_last = (elm);					\ |
| 396 | 504 | 	(head)->stqh_last = &STAILQ_NEXT((elm), field);			\ |
| 397 | 505 | } while (0) |
| 398 | 506 | |
| 399 | #define	STAILQ_LAST(head, type, field)					\ | |
| 507 | #define STAILQ_LAST(head, type, field)					\ | |
| 400 | 508 | 	(STAILQ_EMPTY((head)) ? NULL :					\ |
| 401 | 509 | 	 __containerof((head)->stqh_last,				\ |
| 402 | 510 | 	 QUEUE_TYPEOF(type), field.stqe_next)) |
| 403 | 511 | |
| 404 | #define	STAILQ_NEXT(elm, field)	((elm)->field.stqe_next) | |
| 512 | #define STAILQ_NEXT(elm, field)	((elm)->field.stqe_next) | |
| 405 | 513 | |
| 406 | #define	STAILQ_REMOVE(head, elm, type, field) do {			\ | |
| 407 | 	QMD_SAVELINK(oldnext, (elm)->field.stqe_next);			\ | |
| 514 | #define STAILQ_REMOVE(head, elm, type, field) do {			\ | |
| 515 | 	QMD_SAVELINK(_Oldnext, (elm)->field.stqe_next);			\ | |
| 408 | 516 | 	if (STAILQ_FIRST((head)) == (elm)) {				\ |
| 409 | 517 | 		STAILQ_REMOVE_HEAD((head), field);			\ |
| 410 | 518 | 	}								\ |
| 411 | 519 | 	else {								\ |
| 412 | 		QUEUE_TYPEOF(type) *curelm = STAILQ_FIRST(head);	\ | |
| 413 | 		while (STAILQ_NEXT(curelm, field) != (elm))		\ | |
| 414 | 			curelm = STAILQ_NEXT(curelm, field);		\ | |
| 415 | 		STAILQ_REMOVE_AFTER(head, curelm, field);		\ | |
| 520 | 		QUEUE_TYPEOF(type) *_Curelm = STAILQ_FIRST(head);	\ | |
| 521 | 		while (STAILQ_NEXT(_Curelm, field) != (elm))		\ | |
| 522 | 			_Curelm = STAILQ_NEXT(_Curelm, field);		\ | |
| 523 | 		STAILQ_REMOVE_AFTER(head, _Curelm, field);		\ | |
| 416 | 524 | 	}								\ |
| 417 | 	TRASHIT(*oldnext);						\ | |
| 525 | 	TRASHIT(*_Oldnext);						\ | |
| 418 | 526 | } while (0) |
| 419 | 527 | |
| 420 | 528 | #define STAILQ_REMOVE_AFTER(head, elm, field) do {			\ |
| ... | ... | @@ -423,51 +531,81 @@ struct {								\ |
| 423 | 531 | 		(head)->stqh_last = &STAILQ_NEXT((elm), field);		\ |
| 424 | 532 | } while (0) |
| 425 | 533 | |
| 426 | #define	STAILQ_REMOVE_HEAD(head, field) do {				\ | |
| 534 | #define STAILQ_REMOVE_HEAD(head, field) do {				\ | |
| 427 | 535 | 	if ((STAILQ_FIRST((head)) =					\ |
| 428 | 536 | 	 STAILQ_NEXT(STAILQ_FIRST((head)), field)) == NULL)		\ |
| 429 | 537 | 		(head)->stqh_last = &STAILQ_FIRST((head));		\ |
| 430 | 538 | } while (0) |
| 431 | 539 | |
| 540 | #define STAILQ_SPLIT_AFTER(head, elm, rest, field) do {			\ | |
| 541 | 	STAILQ_ASSERT_NONEMPTY((head));					\ | |
| 542 | 	QMD_STAILQ_CHECK_TAIL((head));					\ | |
| 543 | 	if (STAILQ_NEXT((elm), field) == NULL)				\ | |
| 544 | 		/* 'elm' is the last element in 'head'. */		\ | |
| 545 | 		STAILQ_INIT((rest));					\ | |
| 546 | 	else {								\ | |
| 547 | 		STAILQ_FIRST((rest)) = STAILQ_NEXT((elm), field);	\ | |
| 548 | 		(rest)->stqh_last = (head)->stqh_last;			\ | |
| 549 | 		STAILQ_NEXT((elm), field) = NULL;			\ | |
| 550 | 		(head)->stqh_last = &STAILQ_NEXT((elm), field);		\ | |
| 551 | 	}								\ | |
| 552 | } while (0) | |
| 553 | ||
| 432 | 554 | #define STAILQ_SWAP(head1, head2, type) do {				\ |
| 433 | 	QUEUE_TYPEOF(type) *swap_first = STAILQ_FIRST(head1);		\ | |
| 434 | 	QUEUE_TYPEOF(type) **swap_last = (head1)->stqh_last;		\ | |
| 555 | 	QUEUE_TYPEOF(type) *_Swap_first = STAILQ_FIRST(head1);		\ | |
| 556 | 	QUEUE_TYPEOF(type) **_Swap_last = (head1)->stqh_last;		\ | |
| 435 | 557 | 	STAILQ_FIRST(head1) = STAILQ_FIRST(head2);			\ |
| 436 | 558 | 	(head1)->stqh_last = (head2)->stqh_last;			\ |
| 437 | 	STAILQ_FIRST(head2) = swap_first;				\ | |
| 438 | 	(head2)->stqh_last = swap_last;					\ | |
| 439 | 	if (STAILQ_EMPTY(head1))					\ | |
| 559 | 	STAILQ_FIRST(head2) = _Swap_first;				\ | |
| 560 | 	(head2)->stqh_last = _Swap_last;					\ | |
| 561 | 	if (STAILQ_FIRST(head1) == NULL)				\ | |
| 440 | 562 | 		(head1)->stqh_last = &STAILQ_FIRST(head1);		\ |
| 441 | 	if (STAILQ_EMPTY(head2))					\ | |
| 563 | 	if (STAILQ_FIRST(head2) == NULL)				\ | |
| 442 | 564 | 		(head2)->stqh_last = &STAILQ_FIRST(head2);		\ |
| 443 | 565 | } while (0) |
| 444 | 566 | |
| 445 | #define	STAILQ_END(head)	NULL | |
| 567 | #define	STAILQ_REVERSE(head, type, field) do {				\ | |
| 568 | 	if (STAILQ_EMPTY(head))						\ | |
| 569 | 		break;							\ | |
| 570 | 	QUEUE_TYPEOF(type) *_Var, *_Varp, *_Varn;			\ | |
| 571 | 	for (_Var = STAILQ_FIRST(head), _Varp = NULL;			\ | |
| 572 | 	 _Var != NULL;) {						\ | |
| 573 | 		_Varn = STAILQ_NEXT(_Var, field);			\ | |
| 574 | 		STAILQ_NEXT(_Var, field) = _Varp;			\ | |
| 575 | 		_Varp = _Var;						\ | |
| 576 | 		_Var = _Varn;						\ | |
| 577 | 	}								\ | |
| 578 | 	(head)->stqh_last = &STAILQ_NEXT(STAILQ_FIRST(head), field);	\ | |
| 579 | 	(head)->stqh_first = _Varp;					\ | |
| 580 | } while (0) | |
| 581 | ||
| 582 | #define STAILQ_END(head)	NULL | |
| 446 | 583 | |
| 447 | 584 | |
| 448 | 585 | /* |
| 449 | 586 | * List declarations. |
| 450 | 587 | */ |
| 451 | #define	LIST_HEAD(name, type)						\ | |
| 588 | ||
| 589 | #define LIST_HEAD(name, type)						\ | |
| 452 | 590 | struct name {								\ |
| 453 | 591 | 	struct type *lh_first;	/* first element */			\ |
| 454 | 592 | } |
| 455 | 593 | |
| 456 | #define	LIST_CLASS_HEAD(name, type)					\ | |
| 594 | #define LIST_CLASS_HEAD(name, type)					\ | |
| 457 | 595 | struct name {								\ |
| 458 | 596 | 	class type *lh_first;	/* first element */			\ |
| 459 | 597 | } |
| 460 | 598 | |
| 461 | #define	LIST_HEAD_INITIALIZER(head)					\ | |
| 599 | #define LIST_HEAD_INITIALIZER(head)					\ | |
| 462 | 600 | 	{ NULL } |
| 463 | 601 | |
| 464 | #define	LIST_ENTRY(type)						\ | |
| 602 | #define LIST_ENTRY(type)						\ | |
| 465 | 603 | struct {								\ |
| 466 | 604 | 	struct type *le_next;	/* next element */			\ |
| 467 | 605 | 	struct type **le_prev;	/* address of previous next element */	\ |
| 468 | 606 | } |
| 469 | 607 | |
| 470 | #define	LIST_CLASS_ENTRY(type)						\ | |
| 608 | #define LIST_CLASS_ENTRY(type)						\ | |
| 471 | 609 | struct {								\ |
| 472 | 610 | 	class type *le_next;	/* next element */			\ |
| 473 | 611 | 	class type **le_prev;	/* address of previous next element */	\ |
| ... | ... | @@ -477,19 +615,18 @@ struct {								\ |
| 477 | 615 | * List functions. |
| 478 | 616 | */ |
| 479 | 617 | |
| 480 | #if (defined(_KERNEL) && defined(INVARIANTS)) | |
| 481 | 618 | /* |
| 482 | 619 | * QMD_LIST_CHECK_HEAD(LIST_HEAD *head, LIST_ENTRY NAME) |
| 483 | 620 | * |
| 484 | 621 | * If the list is non-empty, validates that the first element of the list |
| 485 | 622 | * points back at 'head.' |
| 486 | 623 | */ |
| 487 | #define	QMD_LIST_CHECK_HEAD(head, field) do {				\ | |
| 488 | 	if (LIST_FIRST((head)) != NULL &&				\ | |
| 489 | 	 LIST_FIRST((head))->field.le_prev !=			\ | |
| 490 | 	 &LIST_FIRST((head)))					\ | |
| 491 | 		panic("Bad list head %p first->prev != head", (head));	\ | |
| 492 | } while (0) | |
| 624 | #define QMD_LIST_CHECK_HEAD(head, field)				\ | |
| 625 | 	QMD_ASSERT(LIST_FIRST((head)) == NULL ||			\ | |
| 626 | 	 LIST_FIRST((head))->field.le_prev ==			\ | |
| 627 | 	 &LIST_FIRST((head)),					\ | |
| 628 | 	 "Bad list head %p first->prev != head",			\ | |
| 629 | 	 (head)) | |
| 493 | 630 | |
| 494 | 631 | /* |
| 495 | 632 | * QMD_LIST_CHECK_NEXT(TYPE *elm, LIST_ENTRY NAME) |
| ... | ... | @@ -497,74 +634,78 @@ struct {								\ |
| 497 | 634 | * If an element follows 'elm' in the list, validates that the next element |
| 498 | 635 | * points back at 'elm.' |
| 499 | 636 | */ |
| 500 | #define	QMD_LIST_CHECK_NEXT(elm, field) do {				\ | |
| 501 | 	if (LIST_NEXT((elm), field) != NULL &&				\ | |
| 502 | 	 LIST_NEXT((elm), field)->field.le_prev !=			\ | |
| 503 | 	 &((elm)->field.le_next))					\ | |
| 504 | 		panic("Bad link elm %p next->prev != elm", (elm));	\ | |
| 505 | } while (0) | |
| 637 | #define QMD_LIST_CHECK_NEXT(elm, field)					\ | |
| 638 | 	QMD_ASSERT(LIST_NEXT((elm), field) == NULL ||			\ | |
| 639 | 	 LIST_NEXT((elm), field)->field.le_prev ==			\ | |
| 640 | 	 &((elm)->field.le_next),					\ | |
| 641 | 	 "Bad link elm %p next->prev != elm", (elm)) | |
| 506 | 642 | |
| 507 | 643 | /* |
| 508 | 644 | * QMD_LIST_CHECK_PREV(TYPE *elm, LIST_ENTRY NAME) |
| 509 | 645 | * |
| 510 | 646 | * Validates that the previous element (or head of the list) points to 'elm.' |
| 511 | 647 | */ |
| 512 | #define	QMD_LIST_CHECK_PREV(elm, field) do {				\ | |
| 513 | 	if (*(elm)->field.le_prev != (elm))				\ | |
| 514 | 		panic("Bad link elm %p prev->next != elm", (elm));	\ | |
| 515 | } while (0) | |
| 516 | #else | |
| 517 | #define	QMD_LIST_CHECK_HEAD(head, field) | |
| 518 | #define	QMD_LIST_CHECK_NEXT(elm, field) | |
| 519 | #define	QMD_LIST_CHECK_PREV(elm, field) | |
| 520 | #endif /* (_KERNEL && INVARIANTS) */ | |
| 648 | #define QMD_LIST_CHECK_PREV(elm, field)					\ | |
| 649 | 	QMD_ASSERT(*(elm)->field.le_prev == (elm),			\ | |
| 650 | 	 "Bad link elm %p prev->next != elm", (elm)) | |
| 651 | ||
| 652 | #define LIST_ASSERT_EMPTY(head)						\ | |
| 653 | 	QMD_ASSERT(LIST_EMPTY((head)),					\ | |
| 654 | 	 "list %p is not empty", (head)) | |
| 655 | ||
| 656 | #define LIST_ASSERT_NONEMPTY(head)					\ | |
| 657 | 	QMD_ASSERT(!LIST_EMPTY((head)),					\ | |
| 658 | 	 "list %p is empty", (head)) | |
| 521 | 659 | |
| 522 | 660 | #define LIST_CONCAT(head1, head2, type, field) do {			\ |
| 523 | 	QUEUE_TYPEOF(type) *curelm = LIST_FIRST(head1);			\ | |
| 524 | 	if (curelm == NULL) {						\ | |
| 661 | 	QUEUE_TYPEOF(type) *_Curelm = LIST_FIRST(head1);			\ | |
| 662 | 	if (_Curelm == NULL) {						\ | |
| 525 | 663 | 		if ((LIST_FIRST(head1) = LIST_FIRST(head2)) != NULL) {	\ |
| 526 | 664 | 			LIST_FIRST(head2)->field.le_prev =		\ |
| 527 | 665 | 			 &LIST_FIRST((head1));			\ |
| 528 | 666 | 			LIST_INIT(head2);				\ |
| 529 | 667 | 		}							\ |
| 530 | 668 | 	} else if (LIST_FIRST(head2) != NULL) {				\ |
| 531 | 		while (LIST_NEXT(curelm, field) != NULL)		\ | |
| 532 | 			curelm = LIST_NEXT(curelm, field);		\ | |
| 533 | 		LIST_NEXT(curelm, field) = LIST_FIRST(head2);		\ | |
| 534 | 		LIST_FIRST(head2)->field.le_prev = &LIST_NEXT(curelm, field);\ | |
| 669 | 		while (LIST_NEXT(_Curelm, field) != NULL)		\ | |
| 670 | 			_Curelm = LIST_NEXT(_Curelm, field);		\ | |
| 671 | 		LIST_NEXT(_Curelm, field) = LIST_FIRST(head2);		\ | |
| 672 | 		LIST_FIRST(head2)->field.le_prev = &LIST_NEXT(_Curelm, field);\ | |
| 535 | 673 | 		LIST_INIT(head2);					\ |
| 536 | 674 | 	}								\ |
| 537 | 675 | } while (0) |
| 538 | 676 | |
| 539 | #define	LIST_EMPTY(head)	((head)->lh_first == NULL) | |
| 677 | #define LIST_EMPTY(head)	((head)->lh_first == NULL) | |
| 678 | ||
| 679 | #define LIST_EMPTY_ATOMIC(head)						\ | |
| 680 | 	(atomic_load_ptr(&(head)->lh_first) == NULL) | |
| 540 | 681 | |
| 541 | #define	LIST_FIRST(head)	((head)->lh_first) | |
| 682 | #define LIST_FIRST(head)	((head)->lh_first) | |
| 542 | 683 | |
| 543 | #define	LIST_FOREACH(var, head, field)					\ | |
| 684 | #define LIST_FOREACH(var, head, field)					\ | |
| 544 | 685 | 	for ((var) = LIST_FIRST((head));				\ |
| 545 | 686 | 	 (var);							\ |
| 546 | 687 | 	 (var) = LIST_NEXT((var), field)) |
| 547 | 688 | |
| 548 | #define	LIST_FOREACH_FROM(var, head, field)				\ | |
| 689 | #define LIST_FOREACH_FROM(var, head, field)				\ | |
| 549 | 690 | 	for ((var) = ((var) ? (var) : LIST_FIRST((head)));		\ |
| 550 | 691 | 	 (var);							\ |
| 551 | 692 | 	 (var) = LIST_NEXT((var), field)) |
| 552 | 693 | |
| 553 | #define	LIST_FOREACH_SAFE(var, head, field, tvar)			\ | |
| 694 | #define LIST_FOREACH_SAFE(var, head, field, tvar)			\ | |
| 554 | 695 | 	for ((var) = LIST_FIRST((head));				\ |
| 555 | 696 | 	 (var) && ((tvar) = LIST_NEXT((var), field), 1);		\ |
| 556 | 697 | 	 (var) = (tvar)) |
| 557 | 698 | |
| 558 | #define	LIST_FOREACH_FROM_SAFE(var, head, field, tvar)			\ | |
| 699 | #define LIST_FOREACH_FROM_SAFE(var, head, field, tvar)			\ | |
| 559 | 700 | 	for ((var) = ((var) ? (var) : LIST_FIRST((head)));		\ |
| 560 | 701 | 	 (var) && ((tvar) = LIST_NEXT((var), field), 1);		\ |
| 561 | 702 | 	 (var) = (tvar)) |
| 562 | 703 | |
| 563 | #define	LIST_INIT(head) do {						\ | |
| 704 | #define LIST_INIT(head) do {						\ | |
| 564 | 705 | 	LIST_FIRST((head)) = NULL;					\ |
| 565 | 706 | } while (0) |
| 566 | 707 | |
| 567 | #define	LIST_INSERT_AFTER(listelm, elm, field) do {			\ | |
| 708 | #define LIST_INSERT_AFTER(listelm, elm, field) do {			\ | |
| 568 | 709 | 	QMD_LIST_CHECK_NEXT(listelm, field);				\ |
| 569 | 710 | 	if ((LIST_NEXT((elm), field) = LIST_NEXT((listelm), field)) != NULL)\ |
| 570 | 711 | 		LIST_NEXT((listelm), field)->field.le_prev =		\ |
| ... | ... | @@ -573,7 +714,7 @@ struct {								\ |
| 573 | 714 | 	(elm)->field.le_prev = &LIST_NEXT((listelm), field);		\ |
| 574 | 715 | } while (0) |
| 575 | 716 | |
| 576 | #define	LIST_INSERT_BEFORE(listelm, elm, field) do {			\ | |
| 717 | #define LIST_INSERT_BEFORE(listelm, elm, field) do {			\ | |
| 577 | 718 | 	QMD_LIST_CHECK_PREV(listelm, field);				\ |
| 578 | 719 | 	(elm)->field.le_prev = (listelm)->field.le_prev;		\ |
| 579 | 720 | 	LIST_NEXT((elm), field) = (listelm);				\ |
| ... | ... | @@ -581,7 +722,7 @@ struct {								\ |
| 581 | 722 | 	(listelm)->field.le_prev = &LIST_NEXT((elm), field);		\ |
| 582 | 723 | } while (0) |
| 583 | 724 | |
| 584 | #define	LIST_INSERT_HEAD(head, elm, field) do {				\ | |
| 725 | #define LIST_INSERT_HEAD(head, elm, field) do {				\ | |
| 585 | 726 | 	QMD_LIST_CHECK_HEAD((head), field);				\ |
| 586 | 727 | 	if ((LIST_NEXT((elm), field) = LIST_FIRST((head))) != NULL)	\ |
| 587 | 728 | 		LIST_FIRST((head))->field.le_prev = &LIST_NEXT((elm), field);\ |
| ... | ... | @@ -589,9 +730,9 @@ struct {								\ |
| 589 | 730 | 	(elm)->field.le_prev = &LIST_FIRST((head));			\ |
| 590 | 731 | } while (0) |
| 591 | 732 | |
| 592 | #define	LIST_NEXT(elm, field)	((elm)->field.le_next) | |
| 733 | #define LIST_NEXT(elm, field)	((elm)->field.le_next) | |
| 593 | 734 | |
| 594 | #define	LIST_PREV(elm, head, type, field)				\ | |
| 735 | #define LIST_PREV(elm, head, type, field)				\ | |
| 595 | 736 | 	((elm)->field.le_prev == &LIST_FIRST((head)) ? NULL :		\ |
| 596 | 737 | 	 __containerof((elm)->field.le_prev,				\ |
| 597 | 738 | 	 QUEUE_TYPEOF(type), field.le_next)) |
| ... | ... | @@ -599,22 +740,22 @@ struct {								\ |
| 599 | 740 | #define LIST_REMOVE_HEAD(head, field)					\ |
| 600 | 741 | 	LIST_REMOVE(LIST_FIRST(head), field) |
| 601 | 742 | |
| 602 | #define	LIST_REMOVE(elm, field) do {					\ | |
| 603 | 	QMD_SAVELINK(oldnext, (elm)->field.le_next);			\ | |
| 604 | 	QMD_SAVELINK(oldprev, (elm)->field.le_prev);			\ | |
| 743 | #define LIST_REMOVE(elm, field) do {					\ | |
| 744 | 	QMD_SAVELINK(_Oldnext, (elm)->field.le_next);			\ | |
| 745 | 	QMD_SAVELINK(_Oldprev, (elm)->field.le_prev);			\ | |
| 605 | 746 | 	QMD_LIST_CHECK_NEXT(elm, field);				\ |
| 606 | 747 | 	QMD_LIST_CHECK_PREV(elm, field);				\ |
| 607 | 748 | 	if (LIST_NEXT((elm), field) != NULL)				\ |
| 608 | 749 | 		LIST_NEXT((elm), field)->field.le_prev =		\ |
| 609 | 750 | 		 (elm)->field.le_prev;				\ |
| 610 | 751 | 	*(elm)->field.le_prev = LIST_NEXT((elm), field);		\ |
| 611 | 	TRASHIT(*oldnext);						\ | |
| 612 | 	TRASHIT(*oldprev);						\ | |
| 752 | 	TRASHIT(*_Oldnext);						\ | |
| 753 | 	TRASHIT(*_Oldprev);						\ | |
| 613 | 754 | } while (0) |
| 614 | 755 | |
| 615 | 756 | #define LIST_REPLACE(elm, elm2, field) do {				\ |
| 616 | 	QMD_SAVELINK(oldnext, (elm)->field.le_next);			\ | |
| 617 | 	QMD_SAVELINK(oldprev, (elm)->field.le_prev);			\ | |
| 757 | 	QMD_SAVELINK(_Oldnext, (elm)->field.le_next);			\ | |
| 758 | 	QMD_SAVELINK(_Oldprev, (elm)->field.le_prev);			\ | |
| 618 | 759 | 	QMD_LIST_CHECK_NEXT(elm, field);				\ |
| 619 | 760 | 	QMD_LIST_CHECK_PREV(elm, field);				\ |
| 620 | 761 | 	LIST_NEXT((elm2), field) = LIST_NEXT((elm), field);		\ |
| ... | ... | @@ -623,8 +764,21 @@ struct {								\ |
| 623 | 764 | 		 &(elm2)->field.le_next;				\ |
| 624 | 765 | 	(elm2)->field.le_prev = (elm)->field.le_prev;			\ |
| 625 | 766 | 	*(elm2)->field.le_prev = (elm2);				\ |
| 626 | 	TRASHIT(*oldnext);						\ | |
| 627 | 	TRASHIT(*oldprev);						\ | |
| 767 | 	TRASHIT(*_Oldnext);						\ | |
| 768 | 	TRASHIT(*_Oldprev);						\ | |
| 769 | } while (0) | |
| 770 | ||
| 771 | #define LIST_SPLIT_AFTER(head, elm, rest, field) do {			\ | |
| 772 | 	LIST_ASSERT_NONEMPTY((head));					\ | |
| 773 | 	if (LIST_NEXT((elm), field) == NULL)				\ | |
| 774 | 		/* 'elm' is the last element in 'head'. */		\ | |
| 775 | 		LIST_INIT((rest));					\ | |
| 776 | 	else {								\ | |
| 777 | 		LIST_FIRST((rest)) = LIST_NEXT((elm), field);		\ | |
| 778 | 		LIST_NEXT((elm), field)->field.le_prev =		\ | |
| 779 | 		 &LIST_FIRST((rest));				\ | |
| 780 | 		LIST_NEXT((elm), field) = NULL;				\ | |
| 781 | 	}								\ | |
| 628 | 782 | } while (0) |
| 629 | 783 | |
| 630 | 784 | #define LIST_SWAP(head1, head2, type, field) do {			\ |
| ... | ... | @@ -637,36 +791,37 @@ struct {								\ |
| 637 | 791 | 		swap_tmp->field.le_prev = &LIST_FIRST((head2));		\ |
| 638 | 792 | } while (0) |
| 639 | 793 | |
| 640 | #define	LIST_END(head)	NULL | |
| 794 | #define LIST_END(head)	NULL | |
| 641 | 795 | |
| 642 | 796 | /* |
| 643 | 797 | * Tail queue declarations. |
| 644 | 798 | */ |
| 645 | #define	TAILQ_HEAD(name, type)						\ | |
| 799 | ||
| 800 | #define TAILQ_HEAD(name, type)						\ | |
| 646 | 801 | struct name {								\ |
| 647 | 802 | 	struct type *tqh_first;	/* first element */			\ |
| 648 | 803 | 	struct type **tqh_last;	/* addr of last next element */		\ |
| 649 | 804 | 	TRACEBUF							\ |
| 650 | 805 | } |
| 651 | 806 | |
| 652 | #define	TAILQ_CLASS_HEAD(name, type)					\ | |
| 807 | #define TAILQ_CLASS_HEAD(name, type)					\ | |
| 653 | 808 | struct name {								\ |
| 654 | 809 | 	class type *tqh_first;	/* first element */			\ |
| 655 | 810 | 	class type **tqh_last;	/* addr of last next element */		\ |
| 656 | 811 | 	TRACEBUF							\ |
| 657 | 812 | } |
| 658 | 813 | |
| 659 | #define	TAILQ_HEAD_INITIALIZER(head)					\ | |
| 814 | #define TAILQ_HEAD_INITIALIZER(head)					\ | |
| 660 | 815 | 	{ NULL, &(head).tqh_first, TRACEBUF_INITIALIZER } |
| 661 | 816 | |
| 662 | #define	TAILQ_ENTRY(type)						\ | |
| 817 | #define TAILQ_ENTRY(type)						\ | |
| 663 | 818 | struct {								\ |
| 664 | 819 | 	struct type *tqe_next;	/* next element */			\ |
| 665 | 820 | 	struct type **tqe_prev;	/* address of previous next element */	\ |
| 666 | 821 | 	TRACEBUF							\ |
| 667 | 822 | } |
| 668 | 823 | |
| 669 | #define	TAILQ_CLASS_ENTRY(type)						\ | |
| 824 | #define TAILQ_CLASS_ENTRY(type)						\ | |
| 670 | 825 | struct {								\ |
| 671 | 826 | 	class type *tqe_next;	/* next element */			\ |
| 672 | 827 | 	class type **tqe_prev;	/* address of previous next element */	\ |
| ... | ... | @@ -676,29 +831,29 @@ struct {								\ |
| 676 | 831 | /* |
| 677 | 832 | * Tail queue functions. |
| 678 | 833 | */ |
| 679 | #if (defined(_KERNEL) && defined(INVARIANTS)) | |
| 834 | ||
| 680 | 835 | /* |
| 681 | 836 | * QMD_TAILQ_CHECK_HEAD(TAILQ_HEAD *head, TAILQ_ENTRY NAME) |
| 682 | 837 | * |
| 683 | 838 | * If the tailq is non-empty, validates that the first element of the tailq |
| 684 | 839 | * points back at 'head.' |
| 685 | 840 | */ |
| 686 | #define	QMD_TAILQ_CHECK_HEAD(head, field) do {				\ | |
| 687 | 	if (!TAILQ_EMPTY(head) &&					\ | |
| 688 | 	 TAILQ_FIRST((head))->field.tqe_prev !=			\ | |
| 689 | 	 &TAILQ_FIRST((head)))					\ | |
| 690 | 		panic("Bad tailq head %p first->prev != head", (head));	\ | |
| 691 | } while (0) | |
| 841 | #define QMD_TAILQ_CHECK_HEAD(head, field)				\ | |
| 842 | 	QMD_ASSERT(TAILQ_EMPTY(head) ||					\ | |
| 843 | 	 TAILQ_FIRST((head))->field.tqe_prev ==			\ | |
| 844 | 	 &TAILQ_FIRST((head)),					\ | |
| 845 | 	 "Bad tailq head %p first->prev != head",			\ | |
| 846 | 	 (head)) | |
| 692 | 847 | |
| 693 | 848 | /* |
| 694 | 849 | * QMD_TAILQ_CHECK_TAIL(TAILQ_HEAD *head, TAILQ_ENTRY NAME) |
| 695 | 850 | * |
| 696 | 851 | * Validates that the tail of the tailq is a pointer to pointer to NULL. |
| 697 | 852 | */ |
| 698 | #define	QMD_TAILQ_CHECK_TAIL(head, field) do {				\ | |
| 699 | 	if (*(head)->tqh_last != NULL)					\ | |
| 700 | 		panic("Bad tailq NEXT(%p->tqh_last) != NULL", (head));	\ | |
| 701 | } while (0) | |
| 853 | #define QMD_TAILQ_CHECK_TAIL(head, field)				\ | |
| 854 | 	QMD_ASSERT(*(head)->tqh_last == NULL,				\ | |
| 855 | 	 "Bad tailq NEXT(%p->tqh_last) != NULL",			\ | |
| 856 | 	 (head)) | |
| 702 | 857 | |
| 703 | 858 | /* |
| 704 | 859 | * QMD_TAILQ_CHECK_NEXT(TYPE *elm, TAILQ_ENTRY NAME) |
| ... | ... | @@ -706,30 +861,30 @@ struct {								\ |
| 706 | 861 | * If an element follows 'elm' in the tailq, validates that the next element |
| 707 | 862 | * points back at 'elm.' |
| 708 | 863 | */ |
| 709 | #define	QMD_TAILQ_CHECK_NEXT(elm, field) do {				\ | |
| 710 | 	if (TAILQ_NEXT((elm), field) != NULL &&				\ | |
| 711 | 	 TAILQ_NEXT((elm), field)->field.tqe_prev !=			\ | |
| 712 | 	 &((elm)->field.tqe_next))					\ | |
| 713 | 		panic("Bad link elm %p next->prev != elm", (elm));	\ | |
| 714 | } while (0) | |
| 864 | #define QMD_TAILQ_CHECK_NEXT(elm, field)				\ | |
| 865 | 	QMD_ASSERT(TAILQ_NEXT((elm), field) == NULL ||			\ | |
| 866 | 	 TAILQ_NEXT((elm), field)->field.tqe_prev ==			\ | |
| 867 | 	 &((elm)->field.tqe_next),					\ | |
| 868 | 	 "Bad link elm %p next->prev != elm", (elm)) | |
| 715 | 869 | |
| 716 | 870 | /* |
| 717 | 871 | * QMD_TAILQ_CHECK_PREV(TYPE *elm, TAILQ_ENTRY NAME) |
| 718 | 872 | * |
| 719 | 873 | * Validates that the previous element (or head of the tailq) points to 'elm.' |
| 720 | 874 | */ |
| 721 | #define	QMD_TAILQ_CHECK_PREV(elm, field) do {				\ | |
| 722 | 	if (*(elm)->field.tqe_prev != (elm))				\ | |
| 723 | 		panic("Bad link elm %p prev->next != elm", (elm));	\ | |
| 724 | } while (0) | |
| 725 | #else | |
| 726 | #define	QMD_TAILQ_CHECK_HEAD(head, field) | |
| 727 | #define	QMD_TAILQ_CHECK_TAIL(head, headname) | |
| 728 | #define	QMD_TAILQ_CHECK_NEXT(elm, field) | |
| 729 | #define	QMD_TAILQ_CHECK_PREV(elm, field) | |
| 730 | #endif /* (_KERNEL && INVARIANTS) */ | |
| 875 | #define QMD_TAILQ_CHECK_PREV(elm, field)				\ | |
| 876 | 	QMD_ASSERT(*(elm)->field.tqe_prev == (elm),			\ | |
| 877 | 	 "Bad link elm %p prev->next != elm", (elm)) | |
| 731 | 878 | |
| 732 | #define	TAILQ_CONCAT(head1, head2, field) do {				\ | |
| 879 | #define TAILQ_ASSERT_EMPTY(head)					\ | |
| 880 | 	QMD_ASSERT(TAILQ_EMPTY((head)),					\ | |
| 881 | 	 "tailq %p is not empty", (head)) | |
| 882 | ||
| 883 | #define TAILQ_ASSERT_NONEMPTY(head)					\ | |
| 884 | 	QMD_ASSERT(!TAILQ_EMPTY((head)),				\ | |
| 885 | 	 "tailq %p is empty", (head)) | |
| 886 | ||
| 887 | #define TAILQ_CONCAT(head1, head2, field) do {				\ | |
| 733 | 888 | 	if (!TAILQ_EMPTY(head2)) {					\ |
| 734 | 889 | 		*(head1)->tqh_last = (head2)->tqh_first;		\ |
| 735 | 890 | 		(head2)->tqh_first->field.tqe_prev = (head1)->tqh_last;	\ |
| ... | ... | @@ -740,57 +895,60 @@ struct {								\ |
| 740 | 895 | 	}								\ |
| 741 | 896 | } while (0) |
| 742 | 897 | |
| 743 | #define	TAILQ_EMPTY(head)	((head)->tqh_first == NULL) | |
| 898 | #define TAILQ_EMPTY(head)	((head)->tqh_first == NULL) | |
| 899 | ||
| 900 | #define TAILQ_EMPTY_ATOMIC(head)					\ | |
| 901 | 	(atomic_load_ptr(&(head)->tqh_first) == NULL) | |
| 744 | 902 | |
| 745 | #define	TAILQ_FIRST(head)	((head)->tqh_first) | |
| 903 | #define TAILQ_FIRST(head)	((head)->tqh_first) | |
| 746 | 904 | |
| 747 | #define	TAILQ_FOREACH(var, head, field)					\ | |
| 905 | #define TAILQ_FOREACH(var, head, field)					\ | |
| 748 | 906 | 	for ((var) = TAILQ_FIRST((head));				\ |
| 749 | 907 | 	 (var);							\ |
| 750 | 908 | 	 (var) = TAILQ_NEXT((var), field)) |
| 751 | 909 | |
| 752 | #define	TAILQ_FOREACH_FROM(var, head, field)				\ | |
| 910 | #define TAILQ_FOREACH_FROM(var, head, field)				\ | |
| 753 | 911 | 	for ((var) = ((var) ? (var) : TAILQ_FIRST((head)));		\ |
| 754 | 912 | 	 (var);							\ |
| 755 | 913 | 	 (var) = TAILQ_NEXT((var), field)) |
| 756 | 914 | |
| 757 | #define	TAILQ_FOREACH_SAFE(var, head, field, tvar)			\ | |
| 915 | #define TAILQ_FOREACH_SAFE(var, head, field, tvar)			\ | |
| 758 | 916 | 	for ((var) = TAILQ_FIRST((head));				\ |
| 759 | 917 | 	 (var) && ((tvar) = TAILQ_NEXT((var), field), 1);		\ |
| 760 | 918 | 	 (var) = (tvar)) |
| 761 | 919 | |
| 762 | #define	TAILQ_FOREACH_FROM_SAFE(var, head, field, tvar)			\ | |
| 920 | #define TAILQ_FOREACH_FROM_SAFE(var, head, field, tvar)			\ | |
| 763 | 921 | 	for ((var) = ((var) ? (var) : TAILQ_FIRST((head)));		\ |
| 764 | 922 | 	 (var) && ((tvar) = TAILQ_NEXT((var), field), 1);		\ |
| 765 | 923 | 	 (var) = (tvar)) |
| 766 | 924 | |
| 767 | #define	TAILQ_FOREACH_REVERSE(var, head, headname, field)		\ | |
| 925 | #define TAILQ_FOREACH_REVERSE(var, head, headname, field)		\ | |
| 768 | 926 | 	for ((var) = TAILQ_LAST((head), headname);			\ |
| 769 | 927 | 	 (var);							\ |
| 770 | 928 | 	 (var) = TAILQ_PREV((var), headname, field)) |
| 771 | 929 | |
| 772 | #define	TAILQ_FOREACH_REVERSE_FROM(var, head, headname, field)		\ | |
| 930 | #define TAILQ_FOREACH_REVERSE_FROM(var, head, headname, field)		\ | |
| 773 | 931 | 	for ((var) = ((var) ? (var) : TAILQ_LAST((head), headname));	\ |
| 774 | 932 | 	 (var);							\ |
| 775 | 933 | 	 (var) = TAILQ_PREV((var), headname, field)) |
| 776 | 934 | |
| 777 | #define	TAILQ_FOREACH_REVERSE_SAFE(var, head, headname, field, tvar)	\ | |
| 935 | #define TAILQ_FOREACH_REVERSE_SAFE(var, head, headname, field, tvar)	\ | |
| 778 | 936 | 	for ((var) = TAILQ_LAST((head), headname);			\ |
| 779 | 937 | 	 (var) && ((tvar) = TAILQ_PREV((var), headname, field), 1);	\ |
| 780 | 938 | 	 (var) = (tvar)) |
| 781 | 939 | |
| 782 | #define	TAILQ_FOREACH_REVERSE_FROM_SAFE(var, head, headname, field, tvar)\ | |
| 940 | #define TAILQ_FOREACH_REVERSE_FROM_SAFE(var, head, headname, field, tvar)\ | |
| 783 | 941 | 	for ((var) = ((var) ? (var) : TAILQ_LAST((head), headname));	\ |
| 784 | 942 | 	 (var) && ((tvar) = TAILQ_PREV((var), headname, field), 1);	\ |
| 785 | 943 | 	 (var) = (tvar)) |
| 786 | 944 | |
| 787 | #define	TAILQ_INIT(head) do {						\ | |
| 945 | #define TAILQ_INIT(head) do {						\ | |
| 788 | 946 | 	TAILQ_FIRST((head)) = NULL;					\ |
| 789 | 947 | 	(head)->tqh_last = &TAILQ_FIRST((head));			\ |
| 790 | 948 | 	QMD_TRACE_HEAD(head);						\ |
| 791 | 949 | } while (0) |
| 792 | 950 | |
| 793 | #define	TAILQ_INSERT_AFTER(head, listelm, elm, field) do {		\ | |
| 951 | #define TAILQ_INSERT_AFTER(head, listelm, elm, field) do {		\ | |
| 794 | 952 | 	QMD_TAILQ_CHECK_NEXT(listelm, field);				\ |
| 795 | 953 | 	if ((TAILQ_NEXT((elm), field) = TAILQ_NEXT((listelm), field)) != NULL)\ |
| 796 | 954 | 		TAILQ_NEXT((elm), field)->field.tqe_prev =		\ |
| ... | ... | @@ -805,7 +963,7 @@ struct {								\ |
| 805 | 963 | 	QMD_TRACE_ELEM(&(listelm)->field);				\ |
| 806 | 964 | } while (0) |
| 807 | 965 | |
| 808 | #define	TAILQ_INSERT_BEFORE(listelm, elm, field) do {			\ | |
| 966 | #define TAILQ_INSERT_BEFORE(listelm, elm, field) do {			\ | |
| 809 | 967 | 	QMD_TAILQ_CHECK_PREV(listelm, field);				\ |
| 810 | 968 | 	(elm)->field.tqe_prev = (listelm)->field.tqe_prev;		\ |
| 811 | 969 | 	TAILQ_NEXT((elm), field) = (listelm);				\ |
| ... | ... | @@ -815,7 +973,7 @@ struct {								\ |
| 815 | 973 | 	QMD_TRACE_ELEM(&(listelm)->field);				\ |
| 816 | 974 | } while (0) |
| 817 | 975 | |
| 818 | #define	TAILQ_INSERT_HEAD(head, elm, field) do {			\ | |
| 976 | #define TAILQ_INSERT_HEAD(head, elm, field) do {			\ | |
| 819 | 977 | 	QMD_TAILQ_CHECK_HEAD(head, field);				\ |
| 820 | 978 | 	if ((TAILQ_NEXT((elm), field) = TAILQ_FIRST((head))) != NULL)	\ |
| 821 | 979 | 		TAILQ_FIRST((head))->field.tqe_prev =			\ |
| ... | ... | @@ -828,7 +986,7 @@ struct {								\ |
| 828 | 986 | 	QMD_TRACE_ELEM(&(elm)->field);					\ |
| 829 | 987 | } while (0) |
| 830 | 988 | |
| 831 | #define	TAILQ_INSERT_TAIL(head, elm, field) do {			\ | |
| 989 | #define TAILQ_INSERT_TAIL(head, elm, field) do {			\ | |
| 832 | 990 | 	QMD_TAILQ_CHECK_TAIL(head, field);				\ |
| 833 | 991 | 	TAILQ_NEXT((elm), field) = NULL;				\ |
| 834 | 992 | 	(elm)->field.tqe_prev = (head)->tqh_last;			\ |
| ... | ... | @@ -838,7 +996,7 @@ struct {								\ |
| 838 | 996 | 	QMD_TRACE_ELEM(&(elm)->field);					\ |
| 839 | 997 | } while (0) |
| 840 | 998 | |
| 841 | #define	TAILQ_LAST(head, headname)					\ | |
| 999 | #define TAILQ_LAST(head, headname)					\ | |
| 842 | 1000 | 	(*(((struct headname *)((head)->tqh_last))->tqh_last)) |
| 843 | 1001 | |
| 844 | 1002 | /* |
| ... | ... | @@ -848,24 +1006,24 @@ struct {								\ |
| 848 | 1006 | * the previous element. FAST is very useful for instances when |
| 849 | 1007 | * you may want to prefetch the last data element. |
| 850 | 1008 | */ |
| 851 | #define	TAILQ_LAST_FAST(head, type, field)				\ | |
| 1009 | #define TAILQ_LAST_FAST(head, type, field)				\ | |
| 852 | 1010 | (TAILQ_EMPTY(head) ? NULL : __containerof((head)->tqh_last, QUEUE_TYPEOF(type), field.tqe_next)) |
| 853 | 1011 | |
| 854 | #define	TAILQ_NEXT(elm, field) ((elm)->field.tqe_next) | |
| 1012 | #define TAILQ_NEXT(elm, field) ((elm)->field.tqe_next) | |
| 855 | 1013 | |
| 856 | #define	TAILQ_PREV(elm, headname, field)				\ | |
| 1014 | #define TAILQ_PREV(elm, headname, field)				\ | |
| 857 | 1015 | 	(*(((struct headname *)((elm)->field.tqe_prev))->tqh_last)) |
| 858 | 1016 | |
| 859 | #define	TAILQ_PREV_FAST(elm, head, type, field)				\ | |
| 1017 | #define TAILQ_PREV_FAST(elm, head, type, field)				\ | |
| 860 | 1018 | ((elm)->field.tqe_prev == &(head)->tqh_first ? NULL :		\ |
| 861 | 1019 | __containerof((elm)->field.tqe_prev, QUEUE_TYPEOF(type), field.tqe_next)) |
| 862 | 1020 | |
| 863 | 1021 | #define TAILQ_REMOVE_HEAD(head, field)					\ |
| 864 | 1022 | 	TAILQ_REMOVE(head, TAILQ_FIRST(head), field) |
| 865 | 1023 | |
| 866 | #define	TAILQ_REMOVE(head, elm, field) do {				\ | |
| 867 | 	QMD_SAVELINK(oldnext, (elm)->field.tqe_next);			\ | |
| 868 | 	QMD_SAVELINK(oldprev, (elm)->field.tqe_prev);			\ | |
| 1024 | #define TAILQ_REMOVE(head, elm, field) do {				\ | |
| 1025 | 	QMD_SAVELINK(_Oldnext, (elm)->field.tqe_next);			\ | |
| 1026 | 	QMD_SAVELINK(_Oldprev, (elm)->field.tqe_prev);			\ | |
| 869 | 1027 | 	QMD_TAILQ_CHECK_NEXT(elm, field);				\ |
| 870 | 1028 | 	QMD_TAILQ_CHECK_PREV(elm, field);				\ |
| 871 | 1029 | 	if ((TAILQ_NEXT((elm), field)) != NULL)				\ |
| ... | ... | @@ -876,14 +1034,14 @@ struct {								\ |
| 876 | 1034 | 		QMD_TRACE_HEAD(head);					\ |
| 877 | 1035 | 	}								\ |
| 878 | 1036 | 	*(elm)->field.tqe_prev = TAILQ_NEXT((elm), field);		\ |
| 879 | 	TRASHIT(*oldnext);						\ | |
| 880 | 	TRASHIT(*oldprev);						\ | |
| 1037 | 	TRASHIT(*_Oldnext);						\ | |
| 1038 | 	TRASHIT(*_Oldprev);						\ | |
| 881 | 1039 | 	QMD_TRACE_ELEM(&(elm)->field);					\ |
| 882 | 1040 | } while (0) |
| 883 | 1041 | |
| 884 | 1042 | #define TAILQ_REPLACE(head, elm, elm2, field) do {			\ |
| 885 | 	QMD_SAVELINK(oldnext, (elm)->field.tqe_next);			\ | |
| 886 | 	QMD_SAVELINK(oldprev, (elm)->field.tqe_prev);			\ | |
| 1043 | 	QMD_SAVELINK(_Oldnext, (elm)->field.tqe_next);			\ | |
| 1044 | 	QMD_SAVELINK(_Oldprev, (elm)->field.tqe_prev);			\ | |
| 887 | 1045 | 	QMD_TAILQ_CHECK_NEXT(elm, field);				\ |
| 888 | 1046 | 	QMD_TAILQ_CHECK_PREV(elm, field);				\ |
| 889 | 1047 | 	TAILQ_NEXT((elm2), field) = TAILQ_NEXT((elm), field);		\ |
| ... | ... | @@ -894,11 +1052,28 @@ struct {								\ |
| 894 | 1052 | (head)->tqh_last = &(elm2)->field.tqe_next;		\ |
| 895 | 1053 | (elm2)->field.tqe_prev = (elm)->field.tqe_prev;			\ |
| 896 | 1054 | *(elm2)->field.tqe_prev = (elm2);				\ |
| 897 | 	TRASHIT(*oldnext);						\ | |
| 898 | 	TRASHIT(*oldprev);						\ | |
| 1055 | 	TRASHIT(*_Oldnext);						\ | |
| 1056 | 	TRASHIT(*_Oldprev);						\ | |
| 899 | 1057 | 	QMD_TRACE_ELEM(&(elm)->field);					\ |
| 900 | 1058 | } while (0) |
| 901 | 1059 | |
| 1060 | #define TAILQ_SPLIT_AFTER(head, elm, rest, field) do {			\ | |
| 1061 | 	TAILQ_ASSERT_NONEMPTY((head));					\ | |
| 1062 | 	QMD_TAILQ_CHECK_TAIL((head), field);				\ | |
| 1063 | 	if (TAILQ_NEXT((elm), field) == NULL)				\ | |
| 1064 | 		/* 'elm' is the last element in 'head'. */		\ | |
| 1065 | 		TAILQ_INIT((rest));					\ | |
| 1066 | 	else {								\ | |
| 1067 | 		TAILQ_FIRST((rest)) = TAILQ_NEXT((elm), field);		\ | |
| 1068 | 		(rest)->tqh_last = (head)->tqh_last;			\ | |
| 1069 | 		TAILQ_NEXT((elm), field)->field.tqe_prev =		\ | |
| 1070 | 		 &TAILQ_FIRST((rest));				\ | |
| 1071 | 									\ | |
| 1072 | 		TAILQ_NEXT((elm), field) = NULL;			\ | |
| 1073 | 		(head)->tqh_last = &TAILQ_NEXT((elm), field);		\ | |
| 1074 | 	}								\ | |
| 1075 | } while (0) | |
| 1076 | ||
| 902 | 1077 | #define TAILQ_SWAP(head1, head2, type, field) do {			\ |
| 903 | 1078 | 	QUEUE_TYPEOF(type) *swap_first = (head1)->tqh_first;		\ |
| 904 | 1079 | 	QUEUE_TYPEOF(type) **swap_last = (head1)->tqh_last;		\ |
| ... | ... | @@ -916,6 +1091,6 @@ struct {								\ |
| 916 | 1091 | 		(head2)->tqh_last = &(head2)->tqh_first;		\ |
| 917 | 1092 | } while (0) |
| 918 | 1093 | |
| 919 | #define	TAILQ_END(head)		NULL | |
| 1094 | #define TAILQ_END(head)		NULL | |
| 920 | 1095 | |
| 921 | 1096 | #endif /* !_SYS_QUEUE_H_ */ |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/sys/racct.h+5-2| ... | ... | @@ -35,7 +35,6 @@ |
| 35 | 35 | #ifndef _RACCT_H_ |
| 36 | 36 | #define	_RACCT_H_ |
| 37 | 37 | |
| 38 | #include <sys/cdefs.h> | |
| 39 | 38 | #include <sys/types.h> |
| 40 | 39 | #include <sys/queue.h> |
| 41 | 40 | #include <sys/stdint.h> |
| ... | ... | @@ -142,13 +141,17 @@ extern bool racct_enable; |
| 142 | 141 | |
| 143 | 142 | /* |
| 144 | 143 | * The 'racct' structure defines resource consumption for a particular |
| 145 | * subject, such as process or jail. | |
| 144 | * subject, such as process or jail. It also contains the total | |
| 145 | * cpu time and real time of the subject, recorded at the most recent | |
| 146 | * time that RACCT_PCPU was updated. | |
| 146 | 147 | * |
| 147 | 148 | * This structure must be filled with zeroes initially. |
| 148 | 149 | */ |
| 149 | 150 | struct racct { |
| 150 | 151 | 	int64_t				r_resources[RACCT_MAX + 1]; |
| 151 | 152 | 	LIST_HEAD(, rctl_rule_link)	r_rule_links; |
| 153 | 	uint64_t			r_runtime; | |
| 154 | 	struct timeval			r_time; | |
| 152 | 155 | }; |
| 153 | 156 | |
| 154 | 157 | SYSCTL_DECL(_kern_racct); |
lib/libc/include/generic-freebsd/sys/random.h+14-9| ... | ... | @@ -85,24 +85,26 @@ enum random_entropy_source { |
| 85 | 85 | 	RANDOM_FS_ATIME, |
| 86 | 86 | 	RANDOM_UMA,	/* Special!! UMA/SLAB Allocator */ |
| 87 | 87 | 	RANDOM_CALLOUT, |
| 88 | 	RANDOM_ENVIRONMENTAL_END = RANDOM_CALLOUT, | |
| 88 | 	RANDOM_RANDOMDEV, | |
| 89 | 	RANDOM_ENVIRONMENTAL_END = RANDOM_RANDOMDEV, | |
| 89 | 90 | 	/* Fast hardware random-number sources from here on. */ |
| 90 | 91 | 	RANDOM_PURE_START, |
| 91 | 	RANDOM_PURE_OCTEON = RANDOM_PURE_START, | |
| 92 | 	RANDOM_PURE_SAFE, | |
| 93 | 	RANDOM_PURE_GLXSB, | |
| 94 | 	RANDOM_PURE_HIFN, | |
| 92 | 	RANDOM_PURE_TPM = RANDOM_PURE_START, | |
| 95 | 93 | 	RANDOM_PURE_RDRAND, |
| 94 | 	RANDOM_PURE_RDSEED, | |
| 96 | 95 | 	RANDOM_PURE_NEHEMIAH, |
| 97 | 96 | 	RANDOM_PURE_RNDTEST, |
| 98 | 97 | 	RANDOM_PURE_VIRTIO, |
| 99 | 98 | 	RANDOM_PURE_BROADCOM, |
| 100 | 99 | 	RANDOM_PURE_CCP, |
| 101 | 100 | 	RANDOM_PURE_DARN, |
| 102 | 	RANDOM_PURE_TPM, | |
| 103 | 101 | 	RANDOM_PURE_VMGENID, |
| 104 | 102 | 	RANDOM_PURE_QUALCOMM, |
| 105 | 103 | 	RANDOM_PURE_ARMV8, |
| 104 | 	RANDOM_PURE_ARM_TRNG, | |
| 105 | 	RANDOM_PURE_SAFE, | |
| 106 | 	RANDOM_PURE_GLXSB, | |
| 107 | 	RANDOM_PURE_HIFN, | |
| 106 | 108 | 	ENTROPYSOURCE |
| 107 | 109 | }; |
| 108 | 110 | _Static_assert(ENTROPYSOURCE <= 32, |
| ... | ... | @@ -140,9 +142,6 @@ random_harvest_direct(const void *entropy, u_int size, enum random_entropy_sourc |
| 140 | 142 | 		random_harvest_direct_(entropy, size, origin); |
| 141 | 143 | } |
| 142 | 144 | |
| 143 | void random_harvest_register_source(enum random_entropy_source); | |
| 144 | void random_harvest_deregister_source(enum random_entropy_source); | |
| 145 | ||
| 146 | 145 | #if defined(RANDOM_ENABLE_UMA) |
| 147 | 146 | #define random_harvest_fast_uma(a, b, c)	random_harvest_fast(a, b, c) |
| 148 | 147 | #else /* !defined(RANDOM_ENABLE_UMA) */ |
| ... | ... | @@ -155,6 +154,12 @@ void random_harvest_deregister_source(enum random_entropy_source); |
| 155 | 154 | #define random_harvest_queue_ether(a, b)	do {} while (0) |
| 156 | 155 | #endif /* defined(RANDOM_ENABLE_ETHER) */ |
| 157 | 156 | |
| 157 | #else /* !_KERNEL */ | |
| 158 | ||
| 159 | #if defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE > 0 | |
| 160 | #include <ssp/random.h> | |
| 161 | #endif | |
| 162 | ||
| 158 | 163 | #endif /* _KERNEL */ |
| 159 | 164 | |
| 160 | 165 | #define GRND_NONBLOCK	0x1 |
lib/libc/include/generic-freebsd/sys/rangelock.h+16-30| ... | ... | @@ -29,12 +29,14 @@ |
| 29 | 29 | #ifndef	_SYS_RANGELOCK_H |
| 30 | 30 | #define	_SYS_RANGELOCK_H |
| 31 | 31 | |
| 32 | #include <sys/queue.h> | |
| 32 | #include <sys/types.h> | |
| 33 | #ifndef _KERNEL | |
| 34 | #include <stdbool.h> | |
| 35 | #endif | |
| 33 | 36 | |
| 34 | 37 | #define	RL_LOCK_READ		0x0001 |
| 35 | 38 | #define	RL_LOCK_WRITE		0x0002 |
| 36 | 39 | #define	RL_LOCK_TYPE_MASK	0x0003 |
| 37 | #define	RL_LOCK_GRANTED		0x0004 | |
| 38 | 40 | |
| 39 | 41 | struct rl_q_entry; |
| 40 | 42 | |
| ... | ... | @@ -44,42 +46,26 @@ struct rl_q_entry; |
| 44 | 46 | * all existing lock owners are compatible with the request. Two lock |
| 45 | 47 | * owners are compatible if their ranges do not overlap, or both |
| 46 | 48 | * owners are for read. |
| 47 | * | |
| 48 | * Access to the structure itself is synchronized with the externally | |
| 49 | * supplied mutex. | |
| 50 | * | |
| 51 | * rl_waiters is the queue containing in order (a) granted write lock | |
| 52 | * requests, (b) granted read lock requests, and (c) in order of arrival, | |
| 53 | * lock requests which cannot be granted yet. | |
| 54 | * | |
| 55 | * rl_currdep is the first lock request that cannot be granted now due | |
| 56 | * to the preceding requests conflicting with it (i.e., it points to | |
| 57 | * position (c) in the list above). | |
| 58 | 49 | */ |
| 59 | 50 | struct rangelock { |
| 60 | 	TAILQ_HEAD(, rl_q_entry) rl_waiters; | |
| 61 | 	struct rl_q_entry	*rl_currdep; | |
| 51 | 	uintptr_t head; | |
| 52 | 	bool sleepers; | |
| 62 | 53 | }; |
| 63 | 54 | |
| 64 | 55 | #ifdef _KERNEL |
| 65 | 56 | |
| 66 | struct mtx; | |
| 67 | ||
| 68 | 57 | void	 rangelock_init(struct rangelock *lock); |
| 69 | 58 | void	 rangelock_destroy(struct rangelock *lock); |
| 70 | void	 rangelock_unlock(struct rangelock *lock, void *cookie, | |
| 71 | 	 struct mtx *ilk); | |
| 72 | void	*rangelock_unlock_range(struct rangelock *lock, void *cookie, | |
| 73 | 	 off_t start, off_t end, struct mtx *ilk); | |
| 74 | void	*rangelock_rlock(struct rangelock *lock, off_t start, off_t end, | |
| 75 | 	 struct mtx *ilk); | |
| 76 | void	*rangelock_tryrlock(struct rangelock *lock, off_t start, off_t end, | |
| 77 | 	 struct mtx *ilk); | |
| 78 | void	*rangelock_wlock(struct rangelock *lock, off_t start, off_t end, | |
| 79 | 	 struct mtx *ilk); | |
| 80 | void	*rangelock_trywlock(struct rangelock *lock, off_t start, off_t end, | |
| 81 | 	 struct mtx *ilk); | |
| 82 | void	 rlqentry_free(struct rl_q_entry *rlqe); | |
| 59 | void	 rangelock_unlock(struct rangelock *lock, void *cookie); | |
| 60 | void	*rangelock_rlock(struct rangelock *lock, vm_ooffset_t start, | |
| 61 | vm_ooffset_t end); | |
| 62 | void	*rangelock_tryrlock(struct rangelock *lock, vm_ooffset_t start, | |
| 63 | vm_ooffset_t end); | |
| 64 | void	*rangelock_wlock(struct rangelock *lock, vm_ooffset_t start, | |
| 65 | vm_ooffset_t end); | |
| 66 | void	*rangelock_trywlock(struct rangelock *lock, vm_ooffset_t start, | |
| 67 | vm_ooffset_t end); | |
| 68 | void	rangelock_may_recurse(struct rangelock *lock); | |
| 83 | 69 | #if defined(INVARIANTS) || defined(INVARIANT_SUPPORT) |
| 84 | 70 | void	_rangelock_cookie_assert(void *cookie, int what, const char *file, |
| 85 | 71 | int line); |
lib/libc/include/generic-freebsd/sys/rangeset.h+12-3| ... | ... | @@ -69,10 +69,19 @@ int	rangeset_remove_pred(struct rangeset *rs, uint64_t start, |
| 69 | 69 | 	 uint64_t end, rs_pred_t pred); |
| 70 | 70 | |
| 71 | 71 | /* |
| 72 | * Really returns the pointer to the data with struct rs_el embedded | |
| 73 | * at the beginning. | |
| 72 | * Finds the range that contains place, if any. | |
| 74 | 73 | */ |
| 75 | void	*rangeset_lookup(struct rangeset *rs, uint64_t place); | |
| 74 | void	*rangeset_containing(struct rangeset *rs, uint64_t place); | |
| 75 | ||
| 76 | /* | |
| 77 | * Report whether no range begins between start and end. | |
| 78 | */ | |
| 79 | bool	rangeset_empty(struct rangeset *rs, uint64_t start, uint64_t end); | |
| 80 | ||
| 81 | /* | |
| 82 | * Finds the range that begins at place, if any. | |
| 83 | */ | |
| 84 | void	*rangeset_beginning(struct rangeset *rs, uint64_t place); | |
| 76 | 85 | |
| 77 | 86 | /* |
| 78 | 87 | * Copies src_rs entries into dst_rs. dst_rs must be empty. |
lib/libc/include/generic-freebsd/sys/reboot.h+1-2| ... | ... | @@ -27,8 +27,6 @@ |
| 27 | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | * | |
| 31 | *	@(#)reboot.h	8.3 (Berkeley) 12/13/94 | |
| 32 | 30 | */ |
| 33 | 31 | |
| 34 | 32 | #ifndef _SYS_REBOOT_H_ |
| ... | ... | @@ -62,6 +60,7 @@ |
| 62 | 60 | #define	RB_PAUSE	0x100000 /* pause after each output line during probe */ |
| 63 | 61 | #define	RB_REROOT	0x200000 /* unmount the rootfs and mount it again */ |
| 64 | 62 | #define	RB_POWERCYCLE	0x400000 /* Power cycle if possible */ |
| 63 | #define	RB_MUTEMSGS	0x800000 /* start up with console muted after banner */ | |
| 65 | 64 | #define	RB_PROBE	0x10000000	/* Probe multiple consoles */ |
| 66 | 65 | #define	RB_MULTIPLE	0x20000000	/* use multiple consoles */ |
| 67 | 66 |
lib/libc/include/generic-freebsd/sys/refcount.h+6-7| ... | ... | @@ -28,15 +28,14 @@ |
| 28 | 28 | #ifndef __SYS_REFCOUNT_H__ |
| 29 | 29 | #define __SYS_REFCOUNT_H__ |
| 30 | 30 | |
| 31 | #include <machine/atomic.h> | |
| 32 | ||
| 33 | #if defined(_KERNEL) || defined(_STANDALONE) | |
| 34 | #include <sys/systm.h> | |
| 35 | #else | |
| 31 | #include <sys/types.h> | |
| 32 | #include <sys/kassert.h> | |
| 33 | #if !defined(_KERNEL) && !defined(_STANDALONE) | |
| 36 | 34 | #include <stdbool.h> |
| 37 | #define	KASSERT(exp, msg)	/* */ | |
| 38 | 35 | #endif |
| 39 | 36 | |
| 37 | #include <machine/atomic.h> | |
| 38 | ||
| 40 | 39 | #define	REFCOUNT_SATURATED(val)		(((val) & (1U << 31)) != 0) |
| 41 | 40 | #define	REFCOUNT_SATURATION_VALUE	(3U << 30) |
| 42 | 41 | |
| ... | ... | @@ -65,7 +64,7 @@ refcount_init(volatile u_int *count, u_int value) |
| 65 | 64 | } |
| 66 | 65 | |
| 67 | 66 | static __inline u_int |
| 68 | refcount_load(volatile u_int *count) | |
| 67 | refcount_load(volatile const u_int *count) | |
| 69 | 68 | { |
| 70 | 69 | 	return (atomic_load_int(count)); |
| 71 | 70 | } |
lib/libc/include/generic-freebsd/sys/resource.h-2| ... | ... | @@ -27,8 +27,6 @@ |
| 27 | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | * | |
| 31 | *	@(#)resource.h	8.4 (Berkeley) 1/9/95 | |
| 32 | 30 | */ |
| 33 | 31 | |
| 34 | 32 | #ifndef _SYS_RESOURCE_H_ |
lib/libc/include/generic-freebsd/sys/resourcevar.h+4-2| ... | ... | @@ -27,8 +27,6 @@ |
| 27 | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | * | |
| 31 | *	@(#)resourcevar.h	8.4 (Berkeley) 1/9/95 | |
| 32 | 30 | */ |
| 33 | 31 | |
| 34 | 32 | #ifndef	_SYS_RESOURCEVAR_H_ |
| ... | ... | @@ -124,6 +122,8 @@ struct uidinfo { |
| 124 | 122 | 	long	ui_kqcnt;		/* (b) number of kqueues */ |
| 125 | 123 | 	long	ui_umtxcnt;		/* (b) number of shared umtxs */ |
| 126 | 124 | 	long	ui_pipecnt;		/* (b) consumption of pipe buffers */ |
| 125 | 	long	ui_inotifycnt;		/* (b) number of inotify descriptors */ | |
| 126 | 	long	ui_inotifywatchcnt;	/* (b) number of inotify watches */ | |
| 127 | 127 | 	uid_t	ui_uid;			/* (a) uid */ |
| 128 | 128 | 	u_int	ui_ref;			/* (b) reference count */ |
| 129 | 129 | #ifdef	RACCT |
| ... | ... | @@ -146,6 +146,8 @@ int	 chgsbsize(struct uidinfo *uip, u_int *hiwat, u_int to, |
| 146 | 146 | int	 chgptscnt(struct uidinfo *uip, int diff, rlim_t maxval); |
| 147 | 147 | int	 chgumtxcnt(struct uidinfo *uip, int diff, rlim_t maxval); |
| 148 | 148 | int	 chgpipecnt(struct uidinfo *uip, int diff, rlim_t max); |
| 149 | int	 chginotifycnt(struct uidinfo *uip, int diff, rlim_t maxval); | |
| 150 | int	 chginotifywatchcnt(struct uidinfo *uip, int diff, rlim_t maxval); | |
| 149 | 151 | int	 kern_proc_setrlimit(struct thread *td, struct proc *p, u_int which, |
| 150 | 152 | 	 struct rlimit *limp); |
| 151 | 153 | struct plimit |
lib/libc/include/generic-freebsd/sys/rman.h+14-17| ... | ... | @@ -124,17 +124,18 @@ TAILQ_HEAD(rman_head, rman); |
| 124 | 124 | int	rman_activate_resource(struct resource *r); |
| 125 | 125 | int	rman_adjust_resource(struct resource *r, rman_res_t start, rman_res_t end); |
| 126 | 126 | int	rman_first_free_region(struct rman *rm, rman_res_t *start, rman_res_t *end); |
| 127 | bus_space_handle_t rman_get_bushandle(struct resource *); | |
| 128 | bus_space_tag_t rman_get_bustag(struct resource *); | |
| 129 | rman_res_t	rman_get_end(struct resource *); | |
| 130 | device_t rman_get_device(struct resource *); | |
| 131 | u_int	rman_get_flags(struct resource *); | |
| 132 | void *rman_get_irq_cookie(struct resource *); | |
| 133 | void	rman_get_mapping(struct resource *, struct resource_map *); | |
| 134 | int	rman_get_rid(struct resource *); | |
| 135 | rman_res_t	rman_get_size(struct resource *); | |
| 136 | rman_res_t	rman_get_start(struct resource *); | |
| 137 | void *rman_get_virtual(struct resource *); | |
| 127 | bus_space_handle_t rman_get_bushandle(const struct resource *); | |
| 128 | bus_space_tag_t rman_get_bustag(const struct resource *); | |
| 129 | rman_res_t	rman_get_end(const struct resource *); | |
| 130 | device_t rman_get_device(const struct resource *); | |
| 131 | u_int	rman_get_flags(const struct resource *); | |
| 132 | void *rman_get_irq_cookie(const struct resource *); | |
| 133 | void	rman_get_mapping(const struct resource *, struct resource_map *); | |
| 134 | int	rman_get_rid(const struct resource *); | |
| 135 | rman_res_t	rman_get_size(const struct resource *); | |
| 136 | rman_res_t	rman_get_start(const struct resource *); | |
| 137 | int	rman_get_type(const struct resource *); | |
| 138 | void *rman_get_virtual(const struct resource *); | |
| 138 | 139 | int	rman_deactivate_resource(struct resource *r); |
| 139 | 140 | int	rman_fini(struct rman *rm); |
| 140 | 141 | int	rman_init(struct rman *rm); |
| ... | ... | @@ -142,22 +143,18 @@ int	rman_init_from_resource(struct rman *rm, struct resource *r); |
| 142 | 143 | int	rman_last_free_region(struct rman *rm, rman_res_t *start, rman_res_t *end); |
| 143 | 144 | uint32_t rman_make_alignment_flags(uint32_t size); |
| 144 | 145 | int	rman_manage_region(struct rman *rm, rman_res_t start, rman_res_t end); |
| 145 | int	rman_is_region_manager(struct resource *r, struct rman *rm); | |
| 146 | int	rman_is_region_manager(const struct resource *r, const struct rman *rm); | |
| 146 | 147 | int	rman_release_resource(struct resource *r); |
| 147 | 148 | struct resource *rman_reserve_resource(struct rman *rm, rman_res_t start, |
| 148 | 149 | 					rman_res_t end, rman_res_t count, |
| 149 | 150 | 					u_int flags, device_t dev); |
| 150 | struct resource *rman_reserve_resource_bound(struct rman *rm, rman_res_t start, | |
| 151 | 					rman_res_t end, rman_res_t count, rman_res_t bound, | |
| 152 | 					u_int flags, device_t dev); | |
| 153 | 151 | void	rman_set_bushandle(struct resource *_r, bus_space_handle_t _h); |
| 154 | 152 | void	rman_set_bustag(struct resource *_r, bus_space_tag_t _t); |
| 155 | 153 | void	rman_set_device(struct resource *_r, device_t _dev); |
| 156 | void	rman_set_end(struct resource *_r, rman_res_t _end); | |
| 157 | 154 | void	rman_set_irq_cookie(struct resource *_r, void *_c); |
| 158 | 155 | void	rman_set_mapping(struct resource *, struct resource_map *); |
| 159 | 156 | void	rman_set_rid(struct resource *_r, int _rid); |
| 160 | void	rman_set_start(struct resource *_r, rman_res_t _start); | |
| 157 | void	rman_set_type(struct resource *_r, int _type); | |
| 161 | 158 | void	rman_set_virtual(struct resource *_r, void *_v); |
| 162 | 159 | |
| 163 | 160 | extern	struct rman_head rman_head; |
lib/libc/include/generic-freebsd/sys/rmlock.h+1-1| ... | ... | @@ -52,7 +52,7 @@ void	rm_init(struct rmlock *rm, const char *name); |
| 52 | 52 | void	rm_init_flags(struct rmlock *rm, const char *name, int opts); |
| 53 | 53 | void	rm_destroy(struct rmlock *rm); |
| 54 | 54 | int	rm_wowned(const struct rmlock *rm); |
| 55 | void	rm_sysinit(void *arg); | |
| 55 | void	rm_sysinit(const void *arg); | |
| 56 | 56 | |
| 57 | 57 | void	_rm_wlock_debug(struct rmlock *rm, const char *file, int line); |
| 58 | 58 | void	_rm_wunlock_debug(struct rmlock *rm, const char *file, int line); |
lib/libc/include/generic-freebsd/sys/runq.h+66-17| ... | ... | @@ -3,6 +3,11 @@ |
| 3 | 3 | * |
| 4 | 4 | * Copyright (c) 2001 Jake Burkholder <jake@FreeBSD.org> |
| 5 | 5 | * All rights reserved. |
| 6 | * Copyright (c) 2024 The FreeBSD Foundation | |
| 7 | * | |
| 8 | * Portions of this software were developed by Olivier Certner | |
| 9 | * <olce.freebsd@certner.fr> at Kumacom SARL under sponsorship from the FreeBSD | |
| 10 | * Foundation. | |
| 6 | 11 | * |
| 7 | 12 | * Redistribution and use in source and binary forms, with or without |
| 8 | 13 | * modification, are permitted provided that the following conditions |
| ... | ... | @@ -29,7 +34,14 @@ |
| 29 | 34 | #ifndef	_RUNQ_H_ |
| 30 | 35 | #define	_RUNQ_H_ |
| 31 | 36 | |
| 32 | #include <machine/runq.h> | |
| 37 | #ifndef _KERNEL | |
| 38 | #error "no user-serviceable parts inside" | |
| 39 | #endif | |
| 40 | ||
| 41 | #include <sys/types.h>		/* For bool. */ | |
| 42 | #include <sys/_param.h> | |
| 43 | #include <sys/libkern.h> | |
| 44 | #include <sys/queue.h> | |
| 33 | 45 | |
| 34 | 46 | struct thread; |
| 35 | 47 | |
| ... | ... | @@ -37,20 +49,46 @@ struct thread; |
| 37 | 49 | * Run queue parameters. |
| 38 | 50 | */ |
| 39 | 51 | |
| 40 | #define	RQ_NQS		(64)		/* Number of run queues. */ | |
| 41 | #define	RQ_PPQ		(4)		/* Priorities per queue. */ | |
| 52 | #define	RQ_MAX_PRIO	(255)	/* Maximum priority (minimum is 0). */ | |
| 53 | #define	RQ_PPQ		(1)	/* Priorities per queue. */ | |
| 54 | ||
| 55 | /* | |
| 56 | * Deduced from the above parameters and machine ones. | |
| 57 | */ | |
| 58 | #define	RQ_NQS	(howmany(RQ_MAX_PRIO + 1, RQ_PPQ)) /* Number of run queues. */ | |
| 59 | #define	RQ_PRI_TO_QUEUE_IDX(pri) ((pri) / RQ_PPQ) /* Priority to queue index. */ | |
| 60 | ||
| 61 | typedef unsigned long	rqsw_t;		/* runq's status words type. */ | |
| 62 | #define	RQSW_BPW	(sizeof(rqsw_t) * NBBY) /* Bits per runq word. */ | |
| 63 | #define RQSW_PRI	"%#lx"		/* printf() directive. */ | |
| 64 | ||
| 65 | /* Number of status words to cover RQ_NQS queues. */ | |
| 66 | #define	RQSW_NB			(howmany(RQ_NQS, RQSW_BPW)) | |
| 67 | #define	RQSW_IDX(idx)		((idx) / RQSW_BPW) | |
| 68 | #define	RQSW_BIT_IDX(idx)	((idx) % RQSW_BPW) | |
| 69 | #define	RQSW_BIT(idx)		(1ul << RQSW_BIT_IDX(idx)) | |
| 70 | #define	RQSW_BSF(word)		__extension__ ({			\ | |
| 71 | 	int _res = ffsl((long)(word)); /* Assumes two-complement. */	\ | |
| 72 | 	MPASS(_res > 0);						\ | |
| 73 | 	_res - 1;							\ | |
| 74 | }) | |
| 75 | #define	RQSW_TO_QUEUE_IDX(word_idx, bit_idx)				\ | |
| 76 | 	(((word_idx) * RQSW_BPW) + (bit_idx)) | |
| 77 | #define	RQSW_FIRST_QUEUE_IDX(word_idx, word)				\ | |
| 78 | 	RQSW_TO_QUEUE_IDX(word_idx, RQSW_BSF(word)) | |
| 79 | ||
| 42 | 80 | |
| 43 | 81 | /* |
| 44 | * Head of run queues. | |
| 82 | * The queue for a given index as a list of threads. | |
| 45 | 83 | */ |
| 46 | TAILQ_HEAD(rqhead, thread); | |
| 84 | TAILQ_HEAD(rq_queue, thread); | |
| 47 | 85 | |
| 48 | 86 | /* |
| 49 | 87 | * Bit array which maintains the status of a run queue. When a queue is |
| 50 | 88 | * non-empty the bit corresponding to the queue number will be set. |
| 51 | 89 | */ |
| 52 | struct rqbits { | |
| 53 | 	rqb_word_t rqb_bits[RQB_LEN]; | |
| 90 | struct rq_status { | |
| 91 | 	rqsw_t rq_sw[RQSW_NB]; | |
| 54 | 92 | }; |
| 55 | 93 | |
| 56 | 94 | /* |
| ... | ... | @@ -58,18 +96,29 @@ struct rqbits { |
| 58 | 96 | * are placed, and a structure to maintain the status of each queue. |
| 59 | 97 | */ |
| 60 | 98 | struct runq { |
| 61 | 	struct	rqbits rq_status; | |
| 62 | 	struct	rqhead rq_queues[RQ_NQS]; | |
| 99 | 	struct rq_status	rq_status; | |
| 100 | 	struct rq_queue		rq_queues[RQ_NQS]; | |
| 63 | 101 | }; |
| 64 | 102 | |
| 65 | void	runq_add(struct runq *, struct thread *, int); | |
| 66 | void	runq_add_pri(struct runq *, struct thread *, u_char, int); | |
| 67 | int	runq_check(struct runq *); | |
| 68 | struct	thread *runq_choose(struct runq *); | |
| 69 | struct	thread *runq_choose_from(struct runq *, u_char); | |
| 70 | struct	thread *runq_choose_fuzz(struct runq *, int); | |
| 71 | 103 | void	runq_init(struct runq *); |
| 72 | void	runq_remove(struct runq *, struct thread *); | |
| 73 | void	runq_remove_idx(struct runq *, struct thread *, u_char *); | |
| 104 | bool	runq_is_queue_empty(struct runq *, int _idx); | |
| 105 | void	runq_add(struct runq *, struct thread *, int _flags); | |
| 106 | void	runq_add_idx(struct runq *, struct thread *, int _idx, int _flags); | |
| 107 | bool	runq_remove(struct runq *, struct thread *); | |
| 108 | ||
| 109 | /* | |
| 110 | * Implementation helpers for common and scheduler-specific runq_choose*() | |
| 111 | * functions. | |
| 112 | */ | |
| 113 | typedef bool	 runq_pred_t(int _idx, struct rq_queue *, void *_data); | |
| 114 | int		 runq_findq(struct runq *const rq, const int lvl_min, | |
| 115 | 		 const int lvl_max, | |
| 116 | 		 runq_pred_t *const pred, void *const pred_data); | |
| 117 | struct thread	*runq_first_thread_range(struct runq *const rq, | |
| 118 | 		 const int lvl_min, const int lvl_max); | |
| 119 | ||
| 120 | bool		 runq_not_empty(struct runq *); | |
| 121 | struct thread	*runq_choose(struct runq *); | |
| 122 | struct thread	*runq_choose_fuzz(struct runq *, int _fuzz); | |
| 74 | 123 | |
| 75 | 124 | #endif |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/sys/rwlock.h+1-1| ... | ... | @@ -128,7 +128,7 @@ |
| 128 | 128 | */ |
| 129 | 129 | void	_rw_init_flags(volatile uintptr_t *c, const char *name, int opts); |
| 130 | 130 | void	_rw_destroy(volatile uintptr_t *c); |
| 131 | void	rw_sysinit(void *arg); | |
| 131 | void	rw_sysinit(const void *arg); | |
| 132 | 132 | int	_rw_wowned(const volatile uintptr_t *c); |
| 133 | 133 | void	_rw_wlock_cookie(volatile uintptr_t *c, const char *file, int line); |
| 134 | 134 | int	__rw_try_wlock_int(struct rwlock *rw LOCK_FILE_LINE_ARG_DEF); |
lib/libc/include/generic-freebsd/sys/sched.h+11-2| ... | ... | @@ -63,6 +63,15 @@ |
| 63 | 63 | #define	_SCHED_H_ |
| 64 | 64 | |
| 65 | 65 | #ifdef _KERNEL |
| 66 | ||
| 67 | #include <sys/types.h> | |
| 68 | #ifdef SCHED_STATS | |
| 69 | #include <sys/pcpu.h> | |
| 70 | #endif | |
| 71 | ||
| 72 | struct proc; | |
| 73 | struct thread; | |
| 74 | ||
| 66 | 75 | /* |
| 67 | 76 | * General scheduling info. |
| 68 | 77 | * |
| ... | ... | @@ -74,7 +83,7 @@ |
| 74 | 83 | */ |
| 75 | 84 | int	sched_load(void); |
| 76 | 85 | int	sched_rr_interval(void); |
| 77 | int	sched_runnable(void); | |
| 86 | bool	sched_runnable(void); | |
| 78 | 87 | |
| 79 | 88 | /* |
| 80 | 89 | * Proc related scheduling hooks. |
| ... | ... | @@ -214,7 +223,7 @@ SYSINIT(name, SI_SUB_LAST, SI_ORDER_MIDDLE, name ## _add_proc, NULL); |
| 214 | 223 | SCHED_STAT_DEFINE_VAR(name, &DPCPU_NAME(name), descr) |
| 215 | 224 | /* |
| 216 | 225 | * Sched stats are always incremented in critical sections so no atomic |
| 217 | * is necesssary to increment them. | |
| 226 | * is necessary to increment them. | |
| 218 | 227 | */ |
| 219 | 228 | #define SCHED_STAT_INC(var) DPCPU_GET(var)++; |
| 220 | 229 | #else |
lib/libc/include/generic-freebsd/sys/sdt.h+94-75| ... | ... | @@ -77,8 +77,8 @@ |
| 77 | 77 | |
| 78 | 78 | #else /* _KERNEL */ |
| 79 | 79 | |
| 80 | #include <sys/cdefs.h> | |
| 81 | 80 | #include <sys/linker_set.h> |
| 81 | #include <machine/sdt_machdep.h> | |
| 82 | 82 | |
| 83 | 83 | extern volatile bool sdt_probes_enabled; |
| 84 | 84 | |
| ... | ... | @@ -102,8 +102,6 @@ extern volatile bool sdt_probes_enabled; |
| 102 | 102 | #define	SDT_PROBE_DEFINE5(prov, mod, func, name, arg0, arg1, arg2, arg3, arg4) |
| 103 | 103 | #define	SDT_PROBE_DEFINE6(prov, mod, func, name, arg0, arg1, arg2, \ |
| 104 | 104 | arg3, arg4, arg5) |
| 105 | #define	SDT_PROBE_DEFINE7(prov, mod, func, name, arg0, arg1, arg2, \ | |
| 106 | arg3, arg4, arg5, arg6) | |
| 107 | 105 | |
| 108 | 106 | #define	SDT_PROBE0(prov, mod, func, name) |
| 109 | 107 | #define	SDT_PROBE1(prov, mod, func, name, arg0) |
| ... | ... | @@ -112,8 +110,9 @@ extern volatile bool sdt_probes_enabled; |
| 112 | 110 | #define	SDT_PROBE4(prov, mod, func, name, arg0, arg1, arg2, arg3) |
| 113 | 111 | #define	SDT_PROBE5(prov, mod, func, name, arg0, arg1, arg2, arg3, arg4) |
| 114 | 112 | #define	SDT_PROBE6(prov, mod, func, name, arg0, arg1, arg2, arg3, arg4, arg5) |
| 115 | #define	SDT_PROBE7(prov, mod, func, name, arg0, arg1, arg2, arg3, arg4, arg5, \ | |
| 116 | arg6) | |
| 113 | ||
| 114 | #define	MIB_SDT_PROBE1(...) | |
| 115 | #define	MIB_SDT_PROBE2(...) | |
| 117 | 116 | |
| 118 | 117 | #define	SDT_PROBE_DEFINE0_XLATE(prov, mod, func, name) |
| 119 | 118 | #define	SDT_PROBE_DEFINE1_XLATE(prov, mod, func, name, arg0, xarg0) |
| ... | ... | @@ -127,9 +126,6 @@ extern volatile bool sdt_probes_enabled; |
| 127 | 126 | arg1, xarg1, arg2, xarg2, arg3, xarg3, arg4, xarg4) |
| 128 | 127 | #define	SDT_PROBE_DEFINE6_XLATE(prov, mod, func, name, arg0, xarg0, \ |
| 129 | 128 | arg1, xarg1, arg2, xarg2, arg3, xarg3, arg4, xarg4, arg5, xarg5) |
| 130 | #define	SDT_PROBE_DEFINE7_XLATE(prov, mod, func, name, arg0, xarg0, \ | |
| 131 | arg1, xarg1, arg2, xarg2, arg3, xarg3, arg4, xarg4, arg5, xarg5, arg6, \ | |
| 132 | xarg6) | |
| 133 | 129 | |
| 134 | 130 | #define	DTRACE_PROBE(name) |
| 135 | 131 | #define	DTRACE_PROBE1(name, type0, arg0) |
| ... | ... | @@ -141,6 +137,18 @@ extern volatile bool sdt_probes_enabled; |
| 141 | 137 | |
| 142 | 138 | #else |
| 143 | 139 | |
| 140 | void sdt_probe(uint32_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t, | |
| 141 | uintptr_t); | |
| 142 | void sdt_probe6(uint32_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t, | |
| 143 | uintptr_t, uintptr_t); | |
| 144 | ||
| 145 | #define	_SDT_TRACEPOINT_SET		sdt_tracepoint_set | |
| 146 | #define	_SDT_TRACEPOINT_SECTION		"set_sdt_tracepoint_set" | |
| 147 | ||
| 148 | bool sdt_tracepoint_valid(uintptr_t patchpoint, uintptr_t target); | |
| 149 | void sdt_tracepoint_patch(uintptr_t patchpoint, uintptr_t target); | |
| 150 | void sdt_tracepoint_restore(uintptr_t patchpoint); | |
| 151 | ||
| 144 | 152 | #define __sdt_used |
| 145 | 153 | |
| 146 | 154 | SET_DECLARE(sdt_providers_set, struct sdt_provider); |
| ... | ... | @@ -153,39 +161,81 @@ SET_DECLARE(sdt_argtypes_set, struct sdt_argtype); |
| 153 | 161 | 	sdt_provider_##prov |
| 154 | 162 | |
| 155 | 163 | #define SDT_PROVIDER_DEFINE(_prov)					\ |
| 156 | 	struct sdt_provider _SDT_PROVIDER_NAME(_prov)[1] = {		\ | |
| 157 | 		[0] = { .name = #_prov },				\ | |
| 164 | 	struct sdt_provider _SDT_PROVIDER_NAME(_prov) = {		\ | |
| 165 | 		.name = #_prov,						\ | |
| 158 | 166 | 	};								\ |
| 159 | 167 | 	DATA_SET(sdt_providers_set, _SDT_PROVIDER_NAME(_prov)) |
| 160 | 168 | |
| 161 | 169 | #define SDT_PROVIDER_DECLARE(prov)					\ |
| 162 | 	extern struct sdt_provider _SDT_PROVIDER_NAME(prov)[1] | |
| 170 | 	extern struct sdt_provider _SDT_PROVIDER_NAME(prov) | |
| 163 | 171 | |
| 164 | 172 | #define SDT_PROBE_DEFINE(_prov, _mod, _func, _name)			\ |
| 165 | 	struct sdt_probe _SDT_PROBE_NAME(_prov, _mod, _func, _name)[1] = { \ | |
| 166 | 		[0] = {							\ | |
| 167 | 		 .version = sizeof(struct sdt_probe),		\ | |
| 168 | 		 .prov = _SDT_PROVIDER_NAME(_prov),			\ | |
| 169 | 		 .mod = #_mod,					\ | |
| 170 | 		 .func = #_func,					\ | |
| 171 | 		 .name = #_name,					\ | |
| 172 | 		},							\ | |
| 173 | 	struct sdt_probe _SDT_PROBE_NAME(_prov, _mod, _func, _name) = {	\ | |
| 174 | 		.version = sizeof(struct sdt_probe),			\ | |
| 175 | 		.prov = &_SDT_PROVIDER_NAME(_prov),			\ | |
| 176 | 		.mod = #_mod,						\ | |
| 177 | 		.func = #_func,						\ | |
| 178 | 		.name = #_name,						\ | |
| 173 | 179 | 	};								\ |
| 174 | 180 | 	DATA_SET(sdt_probes_set, _SDT_PROBE_NAME(_prov, _mod, _func, _name)) |
| 175 | 181 | |
| 176 | 182 | #define SDT_PROBE_DECLARE(prov, mod, func, name)			\ |
| 177 | 	extern struct sdt_probe _SDT_PROBE_NAME(prov, mod, func, name)[1] | |
| 183 | 	extern struct sdt_probe _SDT_PROBE_NAME(prov, mod, func, name) | |
| 178 | 184 | |
| 179 | 185 | #define	SDT_PROBES_ENABLED()	__predict_false(sdt_probes_enabled) |
| 180 | 186 | |
| 181 | #define SDT_PROBE(prov, mod, func, name, arg0, arg1, arg2, arg3, arg4)	do {	\ | |
| 182 | 	if (SDT_PROBES_ENABLED()) {						\ | |
| 183 | 		if (__predict_false(_SDT_PROBE_NAME(prov, mod, func, name)->id)) \ | |
| 184 | 		(*sdt_probe_func)(_SDT_PROBE_NAME(prov, mod, func, name)->id,	\ | |
| 185 | 		 (uintptr_t) arg0, (uintptr_t) arg1, (uintptr_t) arg2,	\ | |
| 186 | 		 (uintptr_t) arg3, (uintptr_t) arg4);			\ | |
| 187 | 	} \ | |
| 187 | #ifdef _ILP32 | |
| 188 | #define	_SDT_ASM_WORD			".long" | |
| 189 | #else | |
| 190 | #define	_SDT_ASM_WORD			".quad" | |
| 191 | #endif | |
| 192 | ||
| 193 | #ifndef _SDT_ASM_PROBE_CONSTRAINT | |
| 194 | #define	_SDT_ASM_PROBE_CONSTRAINT	"i" | |
| 195 | #endif | |
| 196 | #ifndef	_SDT_ASM_PROBE_OPERAND | |
| 197 | #define	_SDT_ASM_PROBE_OPERAND		"c" | |
| 198 | #endif | |
| 199 | ||
| 200 | /* | |
| 201 | * The asm below generates records corresponding to the structure's layout, so | |
| 202 | * the two must be kept in sync. | |
| 203 | */ | |
| 204 | struct sdt_tracepoint { | |
| 205 | 	struct sdt_probe *probe; | |
| 206 | 	uintptr_t	patchpoint; | |
| 207 | 	uintptr_t	target; | |
| 208 | 	STAILQ_ENTRY(sdt_tracepoint) tracepoint_entry; | |
| 209 | }; | |
| 210 | ||
| 211 | #define __SDT_PROBE(prov, mod, func, name, uniq, f, ...) do {		\ | |
| 212 | 	__WEAK(__CONCAT(__start_set_, _SDT_TRACEPOINT_SET));		\ | |
| 213 | 	__WEAK(__CONCAT(__stop_set_, _SDT_TRACEPOINT_SET));		\ | |
| 214 | 	asm goto(							\ | |
| 215 | 	 "0:\n"							\ | |
| 216 | 	 _SDT_ASM_PATCH_INSTR "\n"					\ | |
| 217 | 	 ".pushsection " _SDT_TRACEPOINT_SECTION ", \"aw\"\n"	\ | |
| 218 | 	 _SDT_ASM_WORD " %" _SDT_ASM_PROBE_OPERAND "0\n"		\ | |
| 219 | 	 _SDT_ASM_WORD " 0b\n"					\ | |
| 220 | 	 _SDT_ASM_WORD " %l1\n"					\ | |
| 221 | 	 _SDT_ASM_WORD " 0\n"					\ | |
| 222 | 	 ".popsection\n"						\ | |
| 223 | 	 :								\ | |
| 224 | 	 : _SDT_ASM_PROBE_CONSTRAINT (&_SDT_PROBE_NAME(prov, mod,	\ | |
| 225 | 	 func, name))						\ | |
| 226 | 	 :								\ | |
| 227 | 	 : __sdt_probe##uniq);					\ | |
| 228 | 	if (0) {							\ | |
| 229 | __sdt_probe##uniq:;							\ | |
| 230 | 		f(_SDT_PROBE_NAME(prov, mod, func, name).id, __VA_ARGS__); \ | |
| 231 | 	}								\ | |
| 188 | 232 | } while (0) |
| 233 | #define _SDT_PROBE(prov, mod, func, name, uniq, f, ...)			\ | |
| 234 | 	__SDT_PROBE(prov, mod, func, name, uniq, f, __VA_ARGS__) | |
| 235 | #define SDT_PROBE(prov, mod, func, name, arg0, arg1, arg2, arg3, arg4)	\ | |
| 236 | 	_SDT_PROBE(prov, mod, func, name, __COUNTER__, sdt_probe,	\ | |
| 237 | 	 (uintptr_t)arg0, (uintptr_t)arg1, (uintptr_t)arg2,		\ | |
| 238 | 	 (uintptr_t)arg3, (uintptr_t)arg4) | |
| 189 | 239 | |
| 190 | 240 | #define SDT_PROBE_ARGTYPE(_prov, _mod, _func, _name, _num, _type, _xtype) \ |
| 191 | 241 | 	static struct sdt_argtype					\ |
| ... | ... | @@ -194,7 +244,7 @@ SET_DECLARE(sdt_argtypes_set, struct sdt_argtype); |
| 194 | 244 | 		 .ndx = _num,					\ |
| 195 | 245 | 		 .type = _type,					\ |
| 196 | 246 | 		 .xtype = _xtype,					\ |
| 197 | 		 .probe = _SDT_PROBE_NAME(_prov, _mod, _func, _name), \ | |
| 247 | 		 .probe = &_SDT_PROBE_NAME(_prov, _mod, _func, _name), \ | |
| 198 | 248 | 		},							\ |
| 199 | 249 | 	};								\ |
| 200 | 250 | 	DATA_SET(sdt_argtypes_set,					\ |
| ... | ... | @@ -243,17 +293,6 @@ SET_DECLARE(sdt_argtypes_set, struct sdt_argtype); |
| 243 | 293 | 	SDT_PROBE_ARGTYPE(prov, mod, func, name, 4, arg4, NULL);	\ |
| 244 | 294 | 	SDT_PROBE_ARGTYPE(prov, mod, func, name, 5, arg5, NULL) |
| 245 | 295 | |
| 246 | #define	SDT_PROBE_DEFINE7(prov, mod, func, name, arg0, arg1, arg2, arg3,\ | |
| 247 | arg4, arg5, arg6) \ | |
| 248 | 	SDT_PROBE_DEFINE(prov, mod, func, name);			\ | |
| 249 | 	SDT_PROBE_ARGTYPE(prov, mod, func, name, 0, arg0, NULL);	\ | |
| 250 | 	SDT_PROBE_ARGTYPE(prov, mod, func, name, 1, arg1, NULL);	\ | |
| 251 | 	SDT_PROBE_ARGTYPE(prov, mod, func, name, 2, arg2, NULL);	\ | |
| 252 | 	SDT_PROBE_ARGTYPE(prov, mod, func, name, 3, arg3, NULL);	\ | |
| 253 | 	SDT_PROBE_ARGTYPE(prov, mod, func, name, 4, arg4, NULL);	\ | |
| 254 | 	SDT_PROBE_ARGTYPE(prov, mod, func, name, 5, arg5, NULL);	\ | |
| 255 | 	SDT_PROBE_ARGTYPE(prov, mod, func, name, 6, arg6, NULL) | |
| 256 | ||
| 257 | 296 | #define	SDT_PROBE_DEFINE0_XLATE(prov, mod, func, name)		\ |
| 258 | 297 | 	SDT_PROBE_DEFINE(prov, mod, func, name) |
| 259 | 298 | |
| ... | ... | @@ -301,18 +340,6 @@ SET_DECLARE(sdt_argtypes_set, struct sdt_argtype); |
| 301 | 340 | 	SDT_PROBE_ARGTYPE(prov, mod, func, name, 4, arg4, xarg4);	\ |
| 302 | 341 | 	SDT_PROBE_ARGTYPE(prov, mod, func, name, 5, arg5, xarg5) |
| 303 | 342 | |
| 304 | #define	SDT_PROBE_DEFINE7_XLATE(prov, mod, func, name, arg0, xarg0, \ | |
| 305 | arg1, xarg1, arg2, xarg2, arg3, xarg3, arg4, xarg4, arg5, xarg5, arg6, \ | |
| 306 | xarg6)								\ | |
| 307 | 	SDT_PROBE_DEFINE(prov, mod, func, name);			\ | |
| 308 | 	SDT_PROBE_ARGTYPE(prov, mod, func, name, 0, arg0, xarg0);	\ | |
| 309 | 	SDT_PROBE_ARGTYPE(prov, mod, func, name, 1, arg1, xarg1);	\ | |
| 310 | 	SDT_PROBE_ARGTYPE(prov, mod, func, name, 2, arg2, xarg2);	\ | |
| 311 | 	SDT_PROBE_ARGTYPE(prov, mod, func, name, 3, arg3, xarg3);	\ | |
| 312 | 	SDT_PROBE_ARGTYPE(prov, mod, func, name, 4, arg4, xarg4);	\ | |
| 313 | 	SDT_PROBE_ARGTYPE(prov, mod, func, name, 5, arg5, xarg5);	\ | |
| 314 | 	SDT_PROBE_ARGTYPE(prov, mod, func, name, 6, arg6, xarg6) | |
| 315 | ||
| 316 | 343 | #define	SDT_PROBE0(prov, mod, func, name)				\ |
| 317 | 344 | 	SDT_PROBE(prov, mod, func, name, 0, 0, 0, 0, 0) |
| 318 | 345 | #define	SDT_PROBE1(prov, mod, func, name, arg0)				\ |
| ... | ... | @@ -325,27 +352,18 @@ SET_DECLARE(sdt_argtypes_set, struct sdt_argtype); |
| 325 | 352 | 	SDT_PROBE(prov, mod, func, name, arg0, arg1, arg2, arg3, 0) |
| 326 | 353 | #define	SDT_PROBE5(prov, mod, func, name, arg0, arg1, arg2, arg3, arg4) \ |
| 327 | 354 | 	SDT_PROBE(prov, mod, func, name, arg0, arg1, arg2, arg3, arg4) |
| 328 | #define	SDT_PROBE6(prov, mod, func, name, arg0, arg1, arg2, arg3, arg4, arg5) \ | |
| 329 | 	do {								 \ | |
| 330 | 		if (_SDT_PROBE_NAME(prov, mod, func, name)->id)		 \ | |
| 331 | 			(*(void (*)(uint32_t, uintptr_t, uintptr_t, uintptr_t, \ | |
| 332 | 			 uintptr_t, uintptr_t, uintptr_t))sdt_probe_func)( \ | |
| 333 | 			 _SDT_PROBE_NAME(prov, mod, func, name)->id, \ | |
| 334 | 			 (uintptr_t)arg0, (uintptr_t)arg1, (uintptr_t)arg2, \ | |
| 335 | 			 (uintptr_t)arg3, (uintptr_t)arg4, (uintptr_t)arg5);\ | |
| 336 | 	} while (0) | |
| 337 | #define	SDT_PROBE7(prov, mod, func, name, arg0, arg1, arg2, arg3, arg4, arg5, \ | |
| 338 | arg6)								 \ | |
| 339 | 	do {								 \ | |
| 340 | 		if (_SDT_PROBE_NAME(prov, mod, func, name)->id)		 \ | |
| 341 | 			(*(void (*)(uint32_t, uintptr_t, uintptr_t, uintptr_t, \ | |
| 342 | 			 uintptr_t, uintptr_t, uintptr_t, uintptr_t)) \ | |
| 343 | 			 sdt_probe_func)(				 \ | |
| 344 | 			 _SDT_PROBE_NAME(prov, mod, func, name)->id, \ | |
| 345 | 			 (uintptr_t)arg0, (uintptr_t)arg1, (uintptr_t)arg2, \ | |
| 346 | 			 (uintptr_t)arg3, (uintptr_t)arg4, (uintptr_t)arg5, \ | |
| 347 | 			 (uintptr_t)arg6);				 \ | |
| 348 | 	} while (0) | |
| 355 | #define	SDT_PROBE6(prov, mod, func, name, arg0, arg1, arg2, arg3, arg4, arg5) \ | |
| 356 | 	_SDT_PROBE(prov, mod, func, name, __COUNTER__, sdt_probe6,	\ | |
| 357 | 	 (uintptr_t)arg0, (uintptr_t)arg1, (uintptr_t)arg2,		\ | |
| 358 | 	 (uintptr_t)arg3, (uintptr_t)arg4, (uintptr_t)arg5) | |
| 359 | ||
| 360 | #ifdef KDTRACE_MIB_SDT | |
| 361 | #define	MIB_SDT_PROBE1(...)	SDT_PROBE1(mib, __VA_ARGS__) | |
| 362 | #define	MIB_SDT_PROBE2(...)	SDT_PROBE2(mib, __VA_ARGS__) | |
| 363 | #else | |
| 364 | #define	MIB_SDT_PROBE1(...) | |
| 365 | #define	MIB_SDT_PROBE2(...) | |
| 366 | #endif | |
| 349 | 367 | |
| 350 | 368 | #define	DTRACE_PROBE_IMPL_START(name, arg0, arg1, arg2, arg3, arg4)	do { \ |
| 351 | 369 | 	static SDT_PROBE_DEFINE(sdt, , , name);				 \ |
| ... | ... | @@ -399,12 +417,12 @@ SET_DECLARE(sdt_argtypes_set, struct sdt_argtype); |
| 399 | 417 | * way to avoid having to rely on CDDL code. |
| 400 | 418 | */ |
| 401 | 419 | typedef	void (*sdt_probe_func_t)(uint32_t, uintptr_t arg0, uintptr_t arg1, |
| 402 | uintptr_t arg2, uintptr_t arg3, uintptr_t arg4); | |
| 420 | uintptr_t arg2, uintptr_t arg3, uintptr_t arg4, uintptr_t arg5); | |
| 403 | 421 | |
| 404 | 422 | /* |
| 405 | 423 | * The 'sdt' provider will set it to dtrace_probe when it loads. |
| 406 | 424 | */ |
| 407 | extern sdt_probe_func_t	sdt_probe_func; | |
| 425 | extern sdt_probe_func_t		sdt_probe_func; | |
| 408 | 426 | |
| 409 | 427 | struct sdt_probe; |
| 410 | 428 | struct sdt_provider; |
| ... | ... | @@ -425,6 +443,7 @@ struct sdt_probe { |
| 425 | 443 | 	TAILQ_ENTRY(sdt_probe) |
| 426 | 444 | 			probe_entry;	/* SDT probe list entry. */ |
| 427 | 445 | 	TAILQ_HEAD(, sdt_argtype) argtype_list; |
| 446 | 	STAILQ_HEAD(, sdt_tracepoint) tracepoint_list; | |
| 428 | 447 | 	const char	*mod; |
| 429 | 448 | 	const char	*func; |
| 430 | 449 | 	const char	*name; |
| ... | ... | @@ -442,7 +461,7 @@ struct sdt_provider { |
| 442 | 461 | }; |
| 443 | 462 | |
| 444 | 463 | void sdt_probe_stub(uint32_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t, |
| 445 | uintptr_t); | |
| 464 | uintptr_t, uintptr_t); | |
| 446 | 465 | |
| 447 | 466 | SDT_PROVIDER_DECLARE(sdt); |
| 448 | 467 |
lib/libc/include/generic-freebsd/sys/select.h+29-3| ... | ... | @@ -49,6 +49,12 @@ typedef	__fd_mask	fd_mask; |
| 49 | 49 | typedef	__sigset_t	sigset_t; |
| 50 | 50 | #endif |
| 51 | 51 | |
| 52 | #if !defined(_KERNEL) && defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE > 0 | |
| 53 | #include <ssp/ssp.h> | |
| 54 | #else | |
| 55 | #define	__SSP_FORTIFY_LEVEL	0 | |
| 56 | #endif | |
| 57 | ||
| 52 | 58 | /* |
| 53 | 59 | * Select uses bit masks of file descriptors in longs. These macros |
| 54 | 60 | * manipulate such bit fields (the filesystem macros use chars). |
| ... | ... | @@ -75,13 +81,33 @@ typedef	struct fd_set { |
| 75 | 81 | #define	fds_bits	__fds_bits |
| 76 | 82 | #endif |
| 77 | 83 | |
| 84 | #define	__fdset_idx_(p, n)	((n) / _NFDBITS) | |
| 85 | #if __SSP_FORTIFY_LEVEL == 0 | |
| 86 | #define	__fdset_idx(p, n)	__fdset_idx_(p, n) | |
| 87 | #else | |
| 88 | __ssp_inline unsigned long | |
| 89 | __fdset_idx(const fd_set *p, unsigned long idx) | |
| 90 | { | |
| 91 | 	__size_t psz = __ssp_bos0(p); | |
| 92 | 	unsigned long sidx = __fdset_idx_(p, idx); | |
| 93 | ||
| 94 | 	if (idx >= FD_SETSIZE) | |
| 95 | 		__chk_fail(); | |
| 96 | 	if (psz / sizeof(__fd_mask) < (sidx + 1)) | |
| 97 | 		__chk_fail(); | |
| 98 | ||
| 99 | 	return (sidx); | |
| 100 | } | |
| 101 | #endif | |
| 102 | ||
| 78 | 103 | #define	__fdset_mask(n)	((__fd_mask)1 << ((n) % _NFDBITS)) |
| 79 | #define	FD_CLR(n, p)	((p)->__fds_bits[(n)/_NFDBITS] &= ~__fdset_mask(n)) | |
| 104 | #define	FD_CLR(n, p)	((p)->__fds_bits[__fdset_idx(p, n)] &= ~__fdset_mask(n)) | |
| 80 | 105 | #if __BSD_VISIBLE |
| 81 | 106 | #define	FD_COPY(f, t)	(void)(*(t) = *(f)) |
| 82 | 107 | #endif |
| 83 | #define	FD_ISSET(n, p)	(((p)->__fds_bits[(n)/_NFDBITS] & __fdset_mask(n)) != 0) | |
| 84 | #define	FD_SET(n, p)	((p)->__fds_bits[(n)/_NFDBITS] |= __fdset_mask(n)) | |
| 108 | #define	FD_ISSET(n, p)	\ | |
| 109 | (((p)->__fds_bits[__fdset_idx(p, n)] & __fdset_mask(n)) != 0) | |
| 110 | #define	FD_SET(n, p)	((p)->__fds_bits[__fdset_idx(p, n)] |= __fdset_mask(n)) | |
| 85 | 111 | #define	FD_ZERO(p) do {					\ |
| 86 | 112 | 	fd_set *_p;					\ |
| 87 | 113 | 	__size_t _n;					\ |
lib/libc/include/generic-freebsd/sys/selinfo.h-2| ... | ... | @@ -27,8 +27,6 @@ |
| 27 | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | * | |
| 31 | *	@(#)select.h	8.2 (Berkeley) 1/4/94 | |
| 32 | 30 | */ |
| 33 | 31 | |
| 34 | 32 | #ifndef _SYS_SELINFO_H_ |
lib/libc/include/generic-freebsd/sys/sem.h-3| ... | ... | @@ -148,9 +148,6 @@ int	kern_get_sema(struct thread *td, struct semid_kernel **res, |
| 148 | 148 | #else /* !_KERNEL */ |
| 149 | 149 | |
| 150 | 150 | __BEGIN_DECLS |
| 151 | #if __BSD_VISIBLE | |
| 152 | int semsys(int, ...); | |
| 153 | #endif | |
| 154 | 151 | int semctl(int, int, int, ...); |
| 155 | 152 | int semget(key_t, int, int); |
| 156 | 153 | int semop(int, struct sembuf *, size_t); |
lib/libc/include/generic-freebsd/sys/seqc.h+2-2| ... | ... | @@ -78,14 +78,14 @@ static __inline seqc_t |
| 78 | 78 | seqc_read_any(const seqc_t *seqcp) |
| 79 | 79 | { |
| 80 | 80 | |
| 81 | 	return (atomic_load_acq_int(__DECONST(seqc_t *, seqcp))); | |
| 81 | 	return (atomic_load_acq_int(seqcp)); | |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | static __inline seqc_t |
| 85 | 85 | seqc_read_notmodify(const seqc_t *seqcp) |
| 86 | 86 | { |
| 87 | 87 | |
| 88 | 	return (atomic_load_acq_int(__DECONST(seqc_t *, seqcp)) & ~SEQC_MOD); | |
| 88 | 	return (atomic_load_acq_int(seqcp) & ~SEQC_MOD); | |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | static __inline seqc_t |
lib/libc/include/generic-freebsd/sys/sglist.h+1| ... | ... | @@ -55,6 +55,7 @@ struct sglist { |
| 55 | 55 | |
| 56 | 56 | struct bio; |
| 57 | 57 | struct mbuf; |
| 58 | struct thread; | |
| 58 | 59 | struct uio; |
| 59 | 60 | |
| 60 | 61 | static __inline void |
lib/libc/include/generic-freebsd/sys/shm.h+1-4| ... | ... | @@ -51,7 +51,7 @@ |
| 51 | 51 | |
| 52 | 52 | #define SHM_RDONLY 010000 /* Attach read-only (else read-write) */ |
| 53 | 53 | #define SHM_RND 020000 /* Round attach address to SHMLBA */ |
| 54 | #define	SHM_REMAP 030000 /* Unmap before mapping */ | |
| 54 | #define	SHM_REMAP 040000 /* Unmap before mapping */ | |
| 55 | 55 | #define SHMLBA PAGE_SIZE /* Segment low boundary address multiple */ |
| 56 | 56 | |
| 57 | 57 | /* "official" access mode definitions; somewhat braindead since you have |
| ... | ... | @@ -173,9 +173,6 @@ typedef __size_t size_t; |
| 173 | 173 | #endif |
| 174 | 174 | |
| 175 | 175 | __BEGIN_DECLS |
| 176 | #if __BSD_VISIBLE | |
| 177 | int shmsys(int, ...); | |
| 178 | #endif | |
| 179 | 176 | void *shmat(int, const void *, int); |
| 180 | 177 | int shmget(key_t, size_t, int); |
| 181 | 178 | int shmctl(int, int, struct shmid_ds *); |
lib/libc/include/generic-freebsd/sys/sigio.h-2| ... | ... | @@ -27,8 +27,6 @@ |
| 27 | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | * | |
| 31 | *	@(#)filedesc.h	8.1 (Berkeley) 6/2/93 | |
| 32 | 30 | */ |
| 33 | 31 | |
| 34 | 32 | #ifndef _SYS_SIGIO_H_ |
lib/libc/include/generic-freebsd/sys/signal.h+3-27| ... | ... | @@ -32,8 +32,6 @@ |
| 32 | 32 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 33 | 33 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 34 | 34 | * SUCH DAMAGE. |
| 35 | * | |
| 36 | *	@(#)signal.h	8.4 (Berkeley) 5/4/95 | |
| 37 | 35 | */ |
| 38 | 36 | |
| 39 | 37 | #ifndef _SYS_SIGNAL_H_ |
| ... | ... | @@ -42,6 +40,7 @@ |
| 42 | 40 | #include <sys/cdefs.h> |
| 43 | 41 | #include <sys/_types.h> |
| 44 | 42 | #include <sys/_sigset.h> |
| 43 | #include <sys/_sigaltstack.h> | |
| 45 | 44 | #include <sys/_sigval.h> |
| 46 | 45 | |
| 47 | 46 | #include <machine/_limits.h>	/* __MINSIGSTKSZ */ |
| ... | ... | @@ -255,7 +254,7 @@ typedef	struct __siginfo { |
| 255 | 254 | #define si_syscall	_reason._capsicum._syscall |
| 256 | 255 | |
| 257 | 256 | #if defined(_WANT_LWPINFO32) || (defined(_KERNEL) && defined(__LP64__)) |
| 258 | struct siginfo32 { | |
| 257 | struct __siginfo32 { | |
| 259 | 258 | 	int	si_signo;		/* signal number */ |
| 260 | 259 | 	int	si_errno;		/* errno association */ |
| 261 | 260 | 	int	si_code;		/* signal code */ |
| ... | ... | @@ -373,7 +372,7 @@ struct sigaction { |
| 373 | 372 | #define	SA_NOCLDSTOP	0x0008	/* do not generate SIGCHLD on child stop */ |
| 374 | 373 | #endif /* __POSIX_VISIBLE || __XSI_VISIBLE */ |
| 375 | 374 | |
| 376 | #if __XSI_VISIBLE | |
| 375 | #if __XSI_VISIBLE || __POSIX_VISIBLE >= 200809 | |
| 377 | 376 | #define	SA_ONSTACK	0x0001	/* take signal on signal stack */ |
| 378 | 377 | #define	SA_RESTART	0x0002	/* restart system call on signal return */ |
| 379 | 378 | #define	SA_RESETHAND	0x0004	/* reset to SIG_DFL when taking signal */ |
| ... | ... | @@ -408,29 +407,6 @@ typedef	__sighandler_t	*sig_t;	/* type of pointer to a signal function */ |
| 408 | 407 | typedef	void __siginfohandler_t(int, struct __siginfo *, void *); |
| 409 | 408 | #endif |
| 410 | 409 | |
| 411 | #if __XSI_VISIBLE | |
| 412 | #if __BSD_VISIBLE | |
| 413 | #define	__stack_t sigaltstack | |
| 414 | #endif | |
| 415 | typedef	struct __stack_t stack_t; | |
| 416 | ||
| 417 | #define	SS_ONSTACK	0x0001	/* take signal on alternate stack */ | |
| 418 | #define	SS_DISABLE	0x0004	/* disable taking signals on alternate stack */ | |
| 419 | #define	MINSIGSTKSZ	__MINSIGSTKSZ		/* minimum stack size */ | |
| 420 | #define	SIGSTKSZ	(MINSIGSTKSZ + 32768)	/* recommended stack size */ | |
| 421 | #endif | |
| 422 | ||
| 423 | /* | |
| 424 | * Structure used in sigaltstack call. Its definition is always | |
| 425 | * needed for __ucontext. If __BSD_VISIBLE is defined, the structure | |
| 426 | * tag is actually sigaltstack. | |
| 427 | */ | |
| 428 | struct __stack_t { | |
| 429 | 	void	*ss_sp;			/* signal stack base */ | |
| 430 | 	__size_t ss_size;		/* signal stack length */ | |
| 431 | 	int	ss_flags;		/* SS_DISABLE and/or SS_ONSTACK */ | |
| 432 | }; | |
| 433 | ||
| 434 | 410 | #if __BSD_VISIBLE |
| 435 | 411 | /* |
| 436 | 412 | * 4.3 compatibility: |
lib/libc/include/generic-freebsd/sys/signalvar.h+2-2| ... | ... | @@ -27,8 +27,6 @@ |
| 27 | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | * | |
| 31 | *	@(#)signalvar.h	8.6 (Berkeley) 2/19/95 | |
| 32 | 30 | */ |
| 33 | 31 | |
| 34 | 32 | #ifndef _SYS_SIGNALVAR_H_ |
| ... | ... | @@ -272,6 +270,7 @@ int __sys_sigfastblock(int cmd, void *ptr); |
| 272 | 270 | |
| 273 | 271 | #ifdef _KERNEL |
| 274 | 272 | extern bool sigfastblock_fetch_always; |
| 273 | extern bool pt_attach_transparent; | |
| 275 | 274 | |
| 276 | 275 | /* Return nonzero if process p has an unmasked pending signal. */ |
| 277 | 276 | #define	SIGPENDING(td)							\ |
| ... | ... | @@ -404,6 +403,7 @@ int	sigev_findtd(struct proc *p, struct sigevent *sigev, struct thread **); |
| 404 | 403 | void	sigfastblock_clear(struct thread *td); |
| 405 | 404 | void	sigfastblock_fetch(struct thread *td); |
| 406 | 405 | int	sig_intr(void); |
| 406 | bool	sig_do_core(int); | |
| 407 | 407 | void	siginit(struct proc *p); |
| 408 | 408 | void	signotify(struct thread *td); |
| 409 | 409 | void	sigqueue_delete(struct sigqueue *queue, int sig); |
lib/libc/include/generic-freebsd/sys/sleepqueue.h+4-4| ... | ... | @@ -86,21 +86,21 @@ struct thread; |
| 86 | 86 | #define	SLEEPQ_DROP		0x400		/* Return without lock held. */ |
| 87 | 87 | |
| 88 | 88 | void	init_sleepqueues(void); |
| 89 | int	sleepq_abort(struct thread *td, int intrval); | |
| 89 | void	sleepq_abort(struct thread *td, int intrval); | |
| 90 | 90 | void	sleepq_add(const void *wchan, struct lock_object *lock, |
| 91 | 91 | 	 const char *wmesg, int flags, int queue); |
| 92 | 92 | struct sleepqueue *sleepq_alloc(void); |
| 93 | int	sleepq_broadcast(const void *wchan, int flags, int pri, int queue); | |
| 93 | void	sleepq_broadcast(const void *wchan, int flags, int pri, int queue); | |
| 94 | 94 | void	sleepq_chains_remove_matching(bool (*matches)(struct thread *)); |
| 95 | 95 | void	sleepq_free(struct sleepqueue *sq); |
| 96 | 96 | void	sleepq_lock(const void *wchan); |
| 97 | 97 | struct sleepqueue *sleepq_lookup(const void *wchan); |
| 98 | 98 | void	sleepq_release(const void *wchan); |
| 99 | 99 | void	sleepq_remove(struct thread *td, const void *wchan); |
| 100 | int	sleepq_remove_matching(struct sleepqueue *sq, int queue, | |
| 100 | void	sleepq_remove_matching(struct sleepqueue *sq, int queue, | |
| 101 | 101 | 	 bool (*matches)(struct thread *), int pri); |
| 102 | 102 | void	sleepq_remove_nested(struct thread *td); |
| 103 | int	sleepq_signal(const void *wchan, int flags, int pri, int queue); | |
| 103 | void	sleepq_signal(const void *wchan, int flags, int pri, int queue); | |
| 104 | 104 | void	sleepq_set_timeout_sbt(const void *wchan, sbintime_t sbt, |
| 105 | 105 | 	 sbintime_t pr, int flags); |
| 106 | 106 | #define	sleepq_set_timeout(wchan, timo)					\ |
lib/libc/include/generic-freebsd/sys/smr_types.h+4-2| ... | ... | @@ -60,7 +60,8 @@ struct {								\ |
| 60 | 60 | */ |
| 61 | 61 | #define	smr_entered_load(p, smr) ({					\ |
| 62 | 62 | 	SMR_ASSERT(SMR_ENTERED((smr)), "smr_entered_load");		\ |
| 63 | 	(__typeof((p)->__ptr))atomic_load_acq_ptr((uintptr_t *)&(p)->__ptr); \ | |
| 63 | 	(__typeof((p)->__ptr))atomic_load_acq_ptr(			\ | |
| 64 | 	 (const uintptr_t *)&(p)->__ptr);				\ | |
| 64 | 65 | }) |
| 65 | 66 | |
| 66 | 67 | /* |
| ... | ... | @@ -70,7 +71,8 @@ struct {								\ |
| 70 | 71 | */ |
| 71 | 72 | #define	smr_serialized_load(p, ex) ({					\ |
| 72 | 73 | 	SMR_ASSERT(ex, "smr_serialized_load");				\ |
| 73 | 	(__typeof((p)->__ptr))atomic_load_ptr(&(p)->__ptr);		\ | |
| 74 | 	(__typeof((p)->__ptr))atomic_load_ptr(				\ | |
| 75 | 	 (const uintptr_t *)&(p)->__ptr);				\ | |
| 74 | 76 | }) |
| 75 | 77 | |
| 76 | 78 | /* |
lib/libc/include/generic-freebsd/sys/sndstat.h+2| ... | ... | @@ -94,12 +94,14 @@ struct sndstioc_nv_arg { |
| 94 | 94 | #define SNDST_DSPS_SOUND4_CHAN_LEFTVOL		"left_volume" |
| 95 | 95 | #define SNDST_DSPS_SOUND4_CHAN_RIGHTVOL		"right_volume" |
| 96 | 96 | #define SNDST_DSPS_SOUND4_CHAN_HWBUF_FORMAT	"hwbuf_format" |
| 97 | #define SNDST_DSPS_SOUND4_CHAN_HWBUF_RATE	"hwbuf_rate" | |
| 97 | 98 | #define SNDST_DSPS_SOUND4_CHAN_HWBUF_SIZE	"hwbuf_size" |
| 98 | 99 | #define SNDST_DSPS_SOUND4_CHAN_HWBUF_BLKSZ	"hwbuf_blksz" |
| 99 | 100 | #define SNDST_DSPS_SOUND4_CHAN_HWBUF_BLKCNT	"hwbuf_blkcnt" |
| 100 | 101 | #define SNDST_DSPS_SOUND4_CHAN_HWBUF_FREE	"hwbuf_free" |
| 101 | 102 | #define SNDST_DSPS_SOUND4_CHAN_HWBUF_READY	"hwbuf_ready" |
| 102 | 103 | #define SNDST_DSPS_SOUND4_CHAN_SWBUF_FORMAT	"swbuf_format" |
| 104 | #define SNDST_DSPS_SOUND4_CHAN_SWBUF_RATE	"swbuf_rate" | |
| 103 | 105 | #define SNDST_DSPS_SOUND4_CHAN_SWBUF_SIZE	"swbuf_size" |
| 104 | 106 | #define SNDST_DSPS_SOUND4_CHAN_SWBUF_BLKSZ	"swbuf_blksz" |
| 105 | 107 | #define SNDST_DSPS_SOUND4_CHAN_SWBUF_BLKCNT	"swbuf_blkcnt" |
lib/libc/include/generic-freebsd/sys/sockbuf.h+21-10| ... | ... | @@ -27,8 +27,6 @@ |
| 27 | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | * | |
| 31 | *	@(#)socketvar.h	8.3 (Berkeley) 2/19/95 | |
| 32 | 30 | */ |
| 33 | 31 | #ifndef _SYS_SOCKBUF_H_ |
| 34 | 32 | #define _SYS_SOCKBUF_H_ |
| ... | ... | @@ -42,13 +40,13 @@ |
| 42 | 40 | #define	SB_SEL		0x08		/* someone is selecting */ |
| 43 | 41 | #define	SB_ASYNC	0x10		/* ASYNC I/O, need signals */ |
| 44 | 42 | #define	SB_UPCALL	0x20		/* someone wants an upcall */ |
| 45 | #define	SB_NOINTR	0x40		/* operations not interruptible */ | |
| 43 | #define	SB_AUTOLOWAT	0x40		/* sendfile(2) may autotune sb_lowat */ | |
| 46 | 44 | #define	SB_AIO		0x80		/* AIO operations queued */ |
| 47 | 45 | #define	SB_KNOTE	0x100		/* kernel note attached */ |
| 48 | 46 | #define	SB_NOCOALESCE	0x200		/* don't coalesce new data into existing mbufs */ |
| 49 | 47 | #define	SB_IN_TOE	0x400		/* socket buffer is in the middle of an operation */ |
| 50 | 48 | #define	SB_AUTOSIZE	0x800		/* automatically size socket buffer */ |
| 51 | #define	SB_STOP		0x1000		/* backpressure indicator */ | |
| 49 | /* was	SB_STOP		0x1000		*/ | |
| 52 | 50 | #define	SB_AIO_RUNNING	0x2000		/* AIO operation running */ |
| 53 | 51 | #define	SB_SPLICED	0x4000		/* socket buffer is spliced; |
| 54 | 52 | 					 previously used for SB_TLS_IFNET */ |
| ... | ... | @@ -64,7 +62,7 @@ |
| 64 | 62 | #include <sys/_sx.h> |
| 65 | 63 | #include <sys/_task.h> |
| 66 | 64 | |
| 67 | #define	SB_MAX		(2*1024*1024)	/* default for max chars in sockbuf */ | |
| 65 | #define	SB_MAX		(8*1024*1024)	/* default for max chars in sockbuf */ | |
| 68 | 66 | |
| 69 | 67 | struct ktls_session; |
| 70 | 68 | struct mbuf; |
| ... | ... | @@ -134,6 +132,18 @@ struct sockbuf { |
| 134 | 132 | 			/* TLS state, locked by sockbuf and sock I/O mutexes. */ |
| 135 | 133 | 			struct	ktls_session *sb_tls_info; |
| 136 | 134 | 		}; |
| 135 | 		/* | |
| 136 | 		 * PF_UNIX/SOCK_STREAM and PF_UNIX/SOCK_SEQPACKET | |
| 137 | 		 * A simple stream buffer with not ready data pointer. | |
| 138 | 		 */ | |
| 139 | 		struct { | |
| 140 | 			STAILQ_HEAD(, mbuf)	uxst_mbq; | |
| 141 | 			struct mbuf		*uxst_fnrdy; | |
| 142 | 			struct socket		*uxst_peer; | |
| 143 | 			u_int			uxst_flags; | |
| 144 | #define	UXST_PEER_AIO	0x1 | |
| 145 | #define	UXST_PEER_SEL	0x2 | |
| 146 | 		}; | |
| 137 | 147 | 		/* |
| 138 | 148 | 		 * PF_UNIX/SOCK_DGRAM |
| 139 | 149 | 		 * |
| ... | ... | @@ -167,6 +177,12 @@ struct sockbuf { |
| 167 | 177 | 			u_int uxdg_ctl; |
| 168 | 178 | 			u_int uxdg_mbcnt; |
| 169 | 179 | 		}; |
| 180 | 		/* | |
| 181 | 		 * Netlink socket. | |
| 182 | 		 */ | |
| 183 | 		struct { | |
| 184 | 			TAILQ_HEAD(, nl_buf)	nl_queue; | |
| 185 | 		}; | |
| 170 | 186 | 	}; |
| 171 | 187 | }; |
| 172 | 188 | |
| ... | ... | @@ -194,8 +210,6 @@ typedef enum { SO_RCV, SO_SND } sb_which; |
| 194 | 210 | * Socket buffer private mbuf(9) flags. |
| 195 | 211 | */ |
| 196 | 212 | #define	M_NOTREADY	M_PROTO1	/* m_data not populated yet */ |
| 197 | #define	M_BLOCKED	M_PROTO2	/* M_NOTREADY in front of m */ | |
| 198 | #define	M_NOTAVAIL	(M_NOTREADY | M_BLOCKED) | |
| 199 | 213 | |
| 200 | 214 | void	sbappend(struct sockbuf *sb, struct mbuf *m, int flags); |
| 201 | 215 | void	sbappend_locked(struct sockbuf *sb, struct mbuf *m, int flags); |
| ... | ... | @@ -287,9 +301,6 @@ sbspace(struct sockbuf *sb) |
| 287 | 301 | 	SOCKBUF_LOCK_ASSERT(sb); |
| 288 | 302 | #endif |
| 289 | 303 | |
| 290 | 	if (sb->sb_flags & SB_STOP) | |
| 291 | 		return(0); | |
| 292 | ||
| 293 | 304 | 	bleft = sb->sb_hiwat - sb->sb_ccc; |
| 294 | 305 | 	mleft = sb->sb_mbmax - sb->sb_mbcnt; |
| 295 | 306 |
lib/libc/include/generic-freebsd/sys/socket.h+23-40| ... | ... | @@ -27,8 +27,6 @@ |
| 27 | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | * | |
| 31 | *	@(#)socket.h	8.4 (Berkeley) 2/21/94 | |
| 32 | 30 | */ |
| 33 | 31 | |
| 34 | 32 | #ifndef _SYS_SOCKET_H_ |
| ... | ... | @@ -113,10 +111,11 @@ typedef	__uintptr_t	uintptr_t; |
| 113 | 111 | */ |
| 114 | 112 | #define	SOCK_CLOEXEC	0x10000000 |
| 115 | 113 | #define	SOCK_NONBLOCK	0x20000000 |
| 114 | #define	SOCK_CLOFORK	0x40000000 | |
| 116 | 115 | #ifdef _KERNEL |
| 117 | 116 | /* |
| 118 | 117 | * Flags for accept1(), kern_accept4() and solisten_dequeue, in addition |
| 119 | * to SOCK_CLOEXEC and SOCK_NONBLOCK. | |
| 118 | * to SOCK_CLOEXEC, SOCK_CLOFORK and SOCK_NONBLOCK. | |
| 120 | 119 | */ |
| 121 | 120 | #define ACCEPT4_INHERIT 0x1 |
| 122 | 121 | #define ACCEPT4_COMPAT 0x2 |
| ... | ... | @@ -166,17 +165,18 @@ typedef	__uintptr_t	uintptr_t; |
| 166 | 165 | #define	SO_LISTENQLIMIT	0x1011		/* socket's backlog limit */ |
| 167 | 166 | #define	SO_LISTENQLEN	0x1012		/* socket's complete queue length */ |
| 168 | 167 | #define	SO_LISTENINCQLEN	0x1013	/* socket's incomplete queue length */ |
| 169 | #define	SO_SETFIB	0x1014		/* use this FIB to route */ | |
| 168 | #define	SO_FIB		0x1014		/* get or set socket FIB */ | |
| 169 | #define	SO_SETFIB	SO_FIB		/* backward compat alias */ | |
| 170 | 170 | #define	SO_USER_COOKIE	0x1015		/* user cookie (dummynet etc.) */ |
| 171 | 171 | #define	SO_PROTOCOL	0x1016		/* get socket protocol (Linux name) */ |
| 172 | 172 | #define	SO_PROTOTYPE	SO_PROTOCOL	/* alias for SO_PROTOCOL (SunOS name) */ |
| 173 | 173 | #define	SO_TS_CLOCK	0x1017		/* clock type used for SO_TIMESTAMP */ |
| 174 | 174 | #define	SO_MAX_PACING_RATE	0x1018	/* socket's max TX pacing rate (Linux name) */ |
| 175 | 175 | #define	SO_DOMAIN	0x1019		/* get socket domain */ |
| 176 | #define	SO_SPLICE	0x1023		/* splice data to other socket */ | |
| 176 | 177 | #endif |
| 177 | 178 | |
| 178 | 179 | #if __BSD_VISIBLE |
| 179 | #define	SO_SPLICE	0x1023		/* splice data to other socket */ | |
| 180 | 180 | #define	SO_TS_REALTIME_MICRO	0	/* microsecond resolution, realtime */ |
| 181 | 181 | #define	SO_TS_BINTIME		1	/* sub-nanosecond resolution, realtime */ |
| 182 | 182 | #define	SO_TS_REALTIME		2	/* nanosecond resolution, realtime */ |
| ... | ... | @@ -270,7 +270,8 @@ struct accept_filter_arg { |
| 270 | 270 | #define	AF_INET6_SDP	42		/* OFED Socket Direct Protocol ipv6 */ |
| 271 | 271 | #define	AF_HYPERV	43		/* HyperV sockets */ |
| 272 | 272 | #define	AF_DIVERT	44		/* divert(4) */ |
| 273 | #define	AF_MAX		44 | |
| 273 | #define	AF_IPFWLOG	46 | |
| 274 | #define	AF_MAX		46 | |
| 274 | 275 | /* |
| 275 | 276 | * When allocating a new AF_ constant, please only allocate |
| 276 | 277 | * even numbered constants for FreeBSD until 134 as odd numbered AF_ |
| ... | ... | @@ -396,6 +397,7 @@ struct sockproto { |
| 396 | 397 | #define	PF_INET_SDP	AF_INET_SDP |
| 397 | 398 | #define	PF_INET6_SDP	AF_INET6_SDP |
| 398 | 399 | #define	PF_DIVERT	AF_DIVERT |
| 400 | #define	PF_IPFWLOG	AF_IPFWLOG | |
| 399 | 401 | |
| 400 | 402 | #define	PF_MAX		AF_MAX |
| 401 | 403 | |
| ... | ... | @@ -477,6 +479,9 @@ struct msghdr { |
| 477 | 479 | #define	MSG_MORETOCOME	 0x00100000	/* additional data pending */ |
| 478 | 480 | #define	MSG_TLSAPPDATA	 0x00200000	/* do not soreceive() alert rec. (TLS) */ |
| 479 | 481 | #endif |
| 482 | #if __BSD_VISIBLE | |
| 483 | #define	MSG_CMSG_CLOFORK 0x00400000	/* make received fds close-on-fork */ | |
| 484 | #endif | |
| 480 | 485 | |
| 481 | 486 | /* |
| 482 | 487 | * Header for ancillary data objects in msg_control buffer. |
| ... | ... | @@ -631,17 +636,14 @@ struct omsghdr { |
| 631 | 636 | /* |
| 632 | 637 | * howto arguments for shutdown(2), specified by Posix.1g. |
| 633 | 638 | */ |
| 634 | #define	SHUT_RD		0		/* shut down the reading side */ | |
| 635 | #define	SHUT_WR		1		/* shut down the writing side */ | |
| 636 | #define	SHUT_RDWR	2		/* shut down both sides */ | |
| 637 | ||
| 638 | #if __BSD_VISIBLE | |
| 639 | /* for SCTP */ | |
| 640 | /* we cheat and use the SHUT_XX defines for these */ | |
| 641 | #define PRU_FLUSH_RD SHUT_RD | |
| 642 | #define PRU_FLUSH_WR SHUT_WR | |
| 643 | #define PRU_FLUSH_RDWR SHUT_RDWR | |
| 644 | #endif | |
| 639 | enum shutdown_how { | |
| 640 | 	SHUT_RD = 0,		/* shut down the reading side */ | |
| 641 | #define	SHUT_RD		SHUT_RD | |
| 642 | 	SHUT_WR,		/* shut down the writing side */ | |
| 643 | #define	SHUT_WR		SHUT_WR | |
| 644 | 	SHUT_RDWR		/* shut down both sides */ | |
| 645 | #define	SHUT_RDWR	SHUT_RDWR | |
| 646 | }; | |
| 645 | 647 | |
| 646 | 648 | #if __BSD_VISIBLE |
| 647 | 649 | /* |
| ... | ... | @@ -689,6 +691,10 @@ struct splice { |
| 689 | 691 | |
| 690 | 692 | #ifndef	_KERNEL |
| 691 | 693 | |
| 694 | #if defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE > 0 | |
| 695 | #include <ssp/socket.h> | |
| 696 | #endif | |
| 697 | ||
| 692 | 698 | #include <sys/cdefs.h> |
| 693 | 699 | |
| 694 | 700 | __BEGIN_DECLS |
| ... | ... | @@ -733,33 +739,10 @@ __END_DECLS |
| 733 | 739 | #ifdef _KERNEL |
| 734 | 740 | struct socket; |
| 735 | 741 | |
| 736 | struct inpcb *so_sotoinpcb(struct socket *so); | |
| 737 | struct sockbuf *so_sockbuf_snd(struct socket *); | |
| 738 | struct sockbuf *so_sockbuf_rcv(struct socket *); | |
| 739 | ||
| 740 | int so_state_get(const struct socket *); | |
| 741 | void so_state_set(struct socket *, int); | |
| 742 | ||
| 743 | 742 | int so_options_get(const struct socket *); |
| 744 | 743 | void so_options_set(struct socket *, int); |
| 745 | 744 | |
| 746 | 745 | int so_error_get(const struct socket *); |
| 747 | 746 | void so_error_set(struct socket *, int); |
| 748 | ||
| 749 | int so_linger_get(const struct socket *); | |
| 750 | void so_linger_set(struct socket *, int); | |
| 751 | ||
| 752 | struct protosw *so_protosw_get(const struct socket *); | |
| 753 | void so_protosw_set(struct socket *, struct protosw *); | |
| 754 | ||
| 755 | void so_sorwakeup_locked(struct socket *so); | |
| 756 | void so_sowwakeup_locked(struct socket *so); | |
| 757 | ||
| 758 | void so_sorwakeup(struct socket *so); | |
| 759 | void so_sowwakeup(struct socket *so); | |
| 760 | ||
| 761 | void so_lock(struct socket *so); | |
| 762 | void so_unlock(struct socket *so); | |
| 763 | ||
| 764 | 747 | #endif /* _KERNEL */ |
| 765 | 748 | #endif /* !_SYS_SOCKET_H_ */ |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/sys/socketvar.h+22-17| ... | ... | @@ -27,8 +27,6 @@ |
| 27 | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | * | |
| 31 | *	@(#)socketvar.h	8.3 (Berkeley) 2/19/95 | |
| 32 | 30 | */ |
| 33 | 31 | |
| 34 | 32 | #ifndef _SYS_SOCKETVAR_H_ |
| ... | ... | @@ -82,6 +80,7 @@ struct so_splice { |
| 82 | 80 | 	struct mtx mtx; |
| 83 | 81 | 	unsigned int wq_index; |
| 84 | 82 | 	enum so_splice_state { |
| 83 | 		SPLICE_INIT,	/* embryonic state, don't queue work yet */ | |
| 85 | 84 | 		SPLICE_IDLE,	/* waiting for work to arrive */ |
| 86 | 85 | 		SPLICE_QUEUED,	/* a wakeup has queued some work */ |
| 87 | 86 | 		SPLICE_RUNNING,	/* currently transferring data */ |
| ... | ... | @@ -239,7 +238,7 @@ struct socket { |
| 239 | 238 | #define	SS_ISDISCONNECTING	0x0008	/* in process of disconnecting */ |
| 240 | 239 | #define	SS_NBIO			0x0100	/* non-blocking ops */ |
| 241 | 240 | #define	SS_ASYNC		0x0200	/* async i/o notify */ |
| 242 | #define	SS_ISCONFIRMING		0x0400	/* deciding to accept connection req */ | |
| 241 | /* was	SS_ISCONFIRMING		0x0400	*/ | |
| 243 | 242 | #define	SS_ISDISCONNECTED	0x2000	/* socket disconnected from peer */ |
| 244 | 243 | |
| 245 | 244 | #ifdef _KERNEL |
| ... | ... | @@ -343,16 +342,14 @@ soeventmtx(struct socket *so, const sb_which which) |
| 343 | 342 | 	soiolock((so), &(so)->so_snd_sx, (flags)) |
| 344 | 343 | #define	SOCK_IO_SEND_UNLOCK(so)						\ |
| 345 | 344 | 	soiounlock(&(so)->so_snd_sx) |
| 346 | #define	SOCK_IO_SEND_OWNED(so)	sx_xlocked(&(so)->so_snd_sx) | |
| 347 | 345 | #define	SOCK_IO_SEND_ASSERT_LOCKED(so)					\ |
| 348 | 	sx_assert(&(so)->so_snd_sx, SA_XLOCKED) | |
| 346 | 	sx_assert(&(so)->so_snd_sx, SA_LOCKED) | |
| 349 | 347 | #define	SOCK_IO_RECV_LOCK(so, flags)					\ |
| 350 | 348 | 	soiolock((so), &(so)->so_rcv_sx, (flags)) |
| 351 | 349 | #define	SOCK_IO_RECV_UNLOCK(so)						\ |
| 352 | 350 | 	soiounlock(&(so)->so_rcv_sx) |
| 353 | #define	SOCK_IO_RECV_OWNED(so)	sx_xlocked(&(so)->so_rcv_sx) | |
| 354 | 351 | #define	SOCK_IO_RECV_ASSERT_LOCKED(so)					\ |
| 355 | 	sx_assert(&(so)->so_rcv_sx, SA_XLOCKED) | |
| 352 | 	sx_assert(&(so)->so_rcv_sx, SA_LOCKED) | |
| 356 | 353 | |
| 357 | 354 | /* do we have to send all at once on a socket? */ |
| 358 | 355 | #define	sosendallatonce(so) \ |
| ... | ... | @@ -459,7 +456,8 @@ MALLOC_DECLARE(M_SONAME); |
| 459 | 456 | #define HHOOK_FILT_SOREAD		4 |
| 460 | 457 | #define HHOOK_FILT_SOWRITE		5 |
| 461 | 458 | #define HHOOK_SOCKET_CLOSE		6 |
| 462 | #define HHOOK_SOCKET_LAST		HHOOK_SOCKET_CLOSE | |
| 459 | #define HHOOK_SOCKET_NEWCONN		7 | |
| 460 | #define HHOOK_SOCKET_LAST		HHOOK_SOCKET_NEWCONN | |
| 463 | 461 | |
| 464 | 462 | struct socket_hhook_data { |
| 465 | 463 | 	struct socket	*so; |
| ... | ... | @@ -479,6 +477,7 @@ struct mbuf; |
| 479 | 477 | struct sockaddr; |
| 480 | 478 | struct ucred; |
| 481 | 479 | struct uio; |
| 480 | enum shutdown_how; | |
| 482 | 481 | |
| 483 | 482 | /* Return values for socket upcalls. */ |
| 484 | 483 | #define	SU_OK		0 |
| ... | ... | @@ -489,12 +488,14 @@ struct uio; |
| 489 | 488 | */ |
| 490 | 489 | int	getsockaddr(struct sockaddr **namp, const struct sockaddr *uaddr, |
| 491 | 490 | 	 size_t len); |
| 492 | int	getsock_cap(struct thread *td, int fd, cap_rights_t *rightsp, | |
| 491 | int	getsock_cap(struct thread *td, int fd, const cap_rights_t *rightsp, | |
| 493 | 492 | 	 struct file **fpp, struct filecaps *havecaps); |
| 494 | int	getsock(struct thread *td, int fd, cap_rights_t *rightsp, | |
| 493 | int	getsock(struct thread *td, int fd, const cap_rights_t *rightsp, | |
| 495 | 494 | 	 struct file **fpp); |
| 496 | 495 | void	soabort(struct socket *so); |
| 497 | int	soaccept(struct socket *so, struct sockaddr **nam); | |
| 496 | int	soaccept(struct socket *so, struct sockaddr *sa); | |
| 497 | int	sopeeraddr(struct socket *so, struct sockaddr *sa); | |
| 498 | int	sosockaddr(struct socket *so, struct sockaddr *sa); | |
| 498 | 499 | void	soaio_enqueue(struct task *task); |
| 499 | 500 | void	soaio_rcv(void *context, int pending); |
| 500 | 501 | void	soaio_snd(void *context, int pending); |
| ... | ... | @@ -525,10 +526,9 @@ struct socket * |
| 525 | 526 | 	sonewconn(struct socket *head, int connstatus); |
| 526 | 527 | struct socket * |
| 527 | 528 | 	sopeeloff(struct socket *); |
| 528 | int	sopoll(struct socket *so, int events, struct ucred *active_cred, | |
| 529 | 	 struct thread *td); | |
| 530 | int	sopoll_generic(struct socket *so, int events, | |
| 531 | 	 struct ucred *active_cred, struct thread *td); | |
| 529 | int	sopoll_generic(struct socket *so, int events, struct thread *td); | |
| 530 | int	sokqfilter_generic(struct socket *so, struct knote *kn); | |
| 531 | int	soaio_queue_generic(struct socket *so, struct kaiocb *job); | |
| 532 | 532 | int	soreceive(struct socket *so, struct sockaddr **paddr, struct uio *uio, |
| 533 | 533 | 	 struct mbuf **mp0, struct mbuf **controlp, int *flagsp); |
| 534 | 534 | int	soreceive_stream(struct socket *so, struct sockaddr **paddr, |
| ... | ... | @@ -555,7 +555,9 @@ int	sosend_dgram(struct socket *so, struct sockaddr *addr, |
| 555 | 555 | int	sosend_generic(struct socket *so, struct sockaddr *addr, |
| 556 | 556 | 	 struct uio *uio, struct mbuf *top, struct mbuf *control, |
| 557 | 557 | 	 int flags, struct thread *td); |
| 558 | int	soshutdown(struct socket *so, int how); | |
| 558 | int	sendfile_wait_generic(struct socket *so, off_t need, int *space); | |
| 559 | int	sosetfib(struct socket *so, int fibnum); | |
| 560 | int	soshutdown(struct socket *so, enum shutdown_how); | |
| 559 | 561 | void	soupcall_clear(struct socket *, sb_which); |
| 560 | 562 | void	soupcall_set(struct socket *, sb_which, so_upcall_t, void *); |
| 561 | 563 | void	solisten_upcall_set(struct socket *, so_upcall_t, void *); |
| ... | ... | @@ -596,6 +598,8 @@ SYSCTL_DECL(_net_inet_accf); |
| 596 | 598 | int	accept_filt_generic_mod_event(module_t mod, int event, void *data); |
| 597 | 599 | #endif |
| 598 | 600 | |
| 601 | int	pr_listen_notsupp(struct socket *so, int backlog, struct thread *td); | |
| 602 | ||
| 599 | 603 | #endif /* _KERNEL */ |
| 600 | 604 | |
| 601 | 605 | /* |
| ... | ... | @@ -615,7 +619,8 @@ struct xsocket { |
| 615 | 619 | 	uint32_t	so_qlimit; |
| 616 | 620 | 	pid_t		so_pgid; |
| 617 | 621 | 	uid_t		so_uid; |
| 618 | 	int32_t		so_spare32[8]; | |
| 622 | 	int32_t		so_fibnum; | |
| 623 | 	int32_t		so_spare32[7]; | |
| 619 | 624 | 	int16_t		so_type; |
| 620 | 625 | 	int16_t		so_options; |
| 621 | 626 | 	int16_t		so_linger; |
lib/libc/include/generic-freebsd/sys/sockio.h+4-2| ... | ... | @@ -27,8 +27,6 @@ |
| 27 | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | * | |
| 31 | *	@(#)sockio.h	8.1 (Berkeley) 3/28/94 | |
| 32 | 30 | */ |
| 33 | 31 | |
| 34 | 32 | #ifndef _SYS_SOCKIO_H_ |
| ... | ... | @@ -149,4 +147,8 @@ |
| 149 | 147 | #define	SIOCSIFCAPNV	_IOW('i', 155, struct ifreq)	/* set IF features */ |
| 150 | 148 | #define	SIOCGIFCAPNV	_IOWR('i', 156, struct ifreq)	/* get IF features */ |
| 151 | 149 | |
| 150 | #define	SIOCGUMBINFO	_IOWR('i', 157, struct ifreq)	/* get MBIM info */ | |
| 151 | #define	SIOCSUMBPARAM	 _IOW('i', 158, struct ifreq)	/* set MBIM param */ | |
| 152 | #define	SIOCGUMBPARAM	_IOWR('i', 159, struct ifreq)	/* get MBIM param */ | |
| 153 | ||
| 152 | 154 | #endif /* !_SYS_SOCKIO_H_ */ |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/sys/sockopt.h-2| ... | ... | @@ -27,8 +27,6 @@ |
| 27 | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | * | |
| 31 | *	@(#)socketvar.h	8.3 (Berkeley) 2/19/95 | |
| 32 | 30 | */ |
| 33 | 31 | #ifndef _SYS_SOCKOPT_H_ |
| 34 | 32 | #define _SYS_SOCKOPT_H_ |
lib/libc/include/generic-freebsd/sys/soundcard.h+11-2| ... | ... | @@ -184,6 +184,8 @@ struct snd_size { |
| 184 | 184 | #define AFMT_S24_BE	0x00020000	/* Big endian signed 24-bit */ |
| 185 | 185 | #define AFMT_U24_LE	0x00040000	/* Little endian unsigned 24-bit */ |
| 186 | 186 | #define AFMT_U24_BE	0x00080000	/* Big endian unsigned 24-bit */ |
| 187 | #define AFMT_F32_LE	0x10000000	/* Little endian 32-bit floating point */ | |
| 188 | #define AFMT_F32_BE	0x20000000	/* Big endian 32-bit floating point */ | |
| 187 | 189 | |
| 188 | 190 | /* Machine dependent AFMT_* definitions. */ |
| 189 | 191 | #if BYTE_ORDER == LITTLE_ENDIAN |
| ... | ... | @@ -199,6 +201,8 @@ struct snd_size { |
| 199 | 201 | #define AFMT_U16_OE	AFMT_U16_BE |
| 200 | 202 | #define AFMT_U24_OE	AFMT_U24_BE |
| 201 | 203 | #define AFMT_U32_OE	AFMT_U32_BE |
| 204 | #define AFMT_F32_NE	AFMT_F32_LE | |
| 205 | #define AFMT_F32_OE	AFMT_F32_BE | |
| 202 | 206 | #else |
| 203 | 207 | #define AFMT_S16_OE	AFMT_S16_LE |
| 204 | 208 | #define AFMT_S24_OE	AFMT_S24_LE |
| ... | ... | @@ -212,8 +216,12 @@ struct snd_size { |
| 212 | 216 | #define AFMT_U16_NE	AFMT_U16_BE |
| 213 | 217 | #define AFMT_U24_NE	AFMT_U24_BE |
| 214 | 218 | #define AFMT_U32_NE	AFMT_U32_BE |
| 219 | #define AFMT_F32_NE	AFMT_F32_BE | |
| 220 | #define AFMT_F32_OE	AFMT_F32_LE | |
| 215 | 221 | #endif |
| 216 | 222 | |
| 223 | #define AFMT_FLOAT	AFMT_F32_NE	/* compatibility alias */ | |
| 224 | ||
| 217 | 225 | #define AFMT_STEREO	0x10000000	/* can do/want stereo	*/ |
| 218 | 226 | |
| 219 | 227 | /* |
| ... | ... | @@ -1400,8 +1408,9 @@ void seqbuf_dump(void);	/* This function must be provided by programs */ |
| 1400 | 1408 | 	int i, l=(len); if (l>6)l=6;\ |
| 1401 | 1409 | 	_SEQ_NEEDBUF(8);\ |
| 1402 | 1410 | 	_seqbuf[_seqbufptr] = EV_SYSEX;\ |
| 1403 | 	for(i=0;i<l;i++)_seqbuf[_seqbufptr+i+1] = (buf)[i];\ | |
| 1404 | 	for(i=l;i<6;i++)_seqbuf[_seqbufptr+i+1] = 0xff;\ | |
| 1411 | 	_seqbuf[_seqbufptr+1] = (dev);\ | |
| 1412 | 	for(i=0;i<l;i++)_seqbuf[_seqbufptr+i+2] = (buf)[i];\ | |
| 1413 | 	for(i=l;i<6;i++)_seqbuf[_seqbufptr+i+2] = 0xff;\ | |
| 1405 | 1414 | 	_SEQ_ADVBUF(8);} |
| 1406 | 1415 | |
| 1407 | 1416 | #define SEQ_CHN_PRESSURE(dev, chn, pressure) \ |
lib/libc/include/generic-freebsd/sys/specialfd.h+5| ... | ... | @@ -30,6 +30,7 @@ |
| 30 | 30 | |
| 31 | 31 | enum specialfd_type { |
| 32 | 32 | 	SPECIALFD_EVENTFD	 = 1, |
| 33 | 	SPECIALFD_INOTIFY	 = 2, | |
| 33 | 34 | }; |
| 34 | 35 | |
| 35 | 36 | struct specialfd_eventfd { |
| ... | ... | @@ -37,4 +38,8 @@ struct specialfd_eventfd { |
| 37 | 38 | 	int flags; |
| 38 | 39 | }; |
| 39 | 40 | |
| 41 | struct specialfd_inotify { | |
| 42 | 	int flags; | |
| 43 | }; | |
| 44 | ||
| 40 | 45 | #endif /* !_SYS_SPECIALFD_H_ */ |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/sys/stat.h+6-4| ... | ... | @@ -32,8 +32,6 @@ |
| 32 | 32 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 33 | 33 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 34 | 34 | * SUCH DAMAGE. |
| 35 | * | |
| 36 | *	@(#)stat.h	8.12 (Berkeley) 6/16/95 | |
| 37 | 35 | */ |
| 38 | 36 | |
| 39 | 37 | #ifndef _SYS_STAT_H_ |
| ... | ... | @@ -161,7 +159,7 @@ struct stat { |
| 161 | 159 | 	ino_t	 st_ino;		/* inode's number */ |
| 162 | 160 | 	nlink_t	 st_nlink;		/* number of hard links */ |
| 163 | 161 | 	mode_t	 st_mode;		/* inode protection mode */ |
| 164 | 	__int16_t st_padding0; | |
| 162 | 	__int16_t st_bsdflags;		/* misc system flags */ | |
| 165 | 163 | 	uid_t	 st_uid;		/* user ID of the file's owner */ |
| 166 | 164 | 	gid_t	 st_gid;		/* group ID of the file's group */ |
| 167 | 165 | 	__int32_t st_padding1; |
| ... | ... | @@ -187,7 +185,8 @@ struct stat { |
| 187 | 185 | 	blksize_t st_blksize;		/* optimal blocksize for I/O */ |
| 188 | 186 | 	fflags_t st_flags;		/* user defined flags for file */ |
| 189 | 187 | 	__uint64_t st_gen;		/* file generation number */ |
| 190 | 	__uint64_t st_spare[10]; | |
| 188 | 	__uint64_t st_filerev;		/* file revision, incr on changes */ | |
| 189 | 	__uint64_t st_spare[9]; | |
| 191 | 190 | }; |
| 192 | 191 | |
| 193 | 192 | #ifdef _KERNEL |
| ... | ... | @@ -341,6 +340,9 @@ struct nstat { |
| 341 | 340 | #define	SF_NOUNLINK	0x00100000	/* file may not be removed or renamed */ |
| 342 | 341 | #define	SF_SNAPSHOT	0x00200000	/* snapshot inode */ |
| 343 | 342 | |
| 343 | /* st_bsdflags */ | |
| 344 | #define	SFBSD_NAMEDATTR	0x0001		/* file is named attribute or dir */ | |
| 345 | ||
| 344 | 346 | #ifdef _KERNEL |
| 345 | 347 | /* |
| 346 | 348 | * Shorthand abbreviations of above. |
lib/libc/include/generic-freebsd/sys/stdarg.h created+6| ... | ... | @@ -0,0 +1,6 @@ |
| 1 | #ifndef __SYS_STDARG_H__ | |
| 2 | #define	__SYS_STDARG_H__ | |
| 3 | ||
| 4 | #include <sys/_stdarg.h> | |
| 5 | ||
| 6 | #endif	/* __SYS_STDARG_H__ */ | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/sys/stdatomic.h+2-1| ... | ... | @@ -33,7 +33,8 @@ |
| 33 | 33 | #include <sys/cdefs.h> |
| 34 | 34 | #include <sys/_types.h> |
| 35 | 35 | |
| 36 | #if __has_extension(c_atomic) || __has_extension(cxx_atomic) | |
| 36 | #if (__has_extension(c_atomic) || __has_extension(cxx_atomic)) && \ | |
| 37 | defined(__clang__) | |
| 37 | 38 | #define	__CLANG_ATOMICS |
| 38 | 39 | #elif __GNUC_PREREQ__(4, 7) |
| 39 | 40 | #define	__GNUC_ATOMICS |
lib/libc/include/generic-freebsd/sys/sx.h+7-7| ... | ... | @@ -99,7 +99,7 @@ |
| 99 | 99 | * Function prototipes. Routines that start with an underscore are not part |
| 100 | 100 | * of the public interface and are wrappered with a macro. |
| 101 | 101 | */ |
| 102 | void	sx_sysinit(void *arg); | |
| 102 | void	sx_sysinit(const void *arg); | |
| 103 | 103 | #define	sx_init(sx, desc)	sx_init_flags((sx), (desc), 0) |
| 104 | 104 | void	sx_init_flags(struct sx *sx, const char *description, int opts); |
| 105 | 105 | void	sx_destroy(struct sx *sx); |
| ... | ... | @@ -301,12 +301,12 @@ __sx_xunlock(struct sx *sx, struct thread *td, const char *file, int line) |
| 301 | 301 | |
| 302 | 302 | #ifdef _STANDALONE |
| 303 | 303 | /* since we have no threads in the boot loader, trivially implement no-op version */ |
| 304 | #define sx_xlock(s) (1) | |
| 305 | #define sx_try_xlock(s) (1) | |
| 306 | #define sx_xunlock(s) (1) | |
| 307 | #define SX_DUPOK 0 | |
| 308 | #define SX_NEW 0 | |
| 309 | #define SX_NOWITNESS 0 | |
| 304 | #define	sx_xlock(s)	do {} while (0) | |
| 305 | #define	sx_try_xlock(s)	(1) | |
| 306 | #define	sx_xunlock(s)	do {} while (0) | |
| 307 | #define	SX_DUPOK	0 | |
| 308 | #define	SX_NEW		0 | |
| 309 | #define	SX_NOWITNESS	0 | |
| 310 | 310 | |
| 311 | 311 | static __inline void |
| 312 | 312 | sx_init_flags(struct sx *sx, const char *description, int opts) |
lib/libc/include/generic-freebsd/sys/syscall.h+18-7| ... | ... | @@ -4,8 +4,10 @@ |
| 4 | 4 | * DO NOT EDIT-- this file is automatically @generated. |
| 5 | 5 | */ |
| 6 | 6 | |
| 7 | #define 	SYS_exit	SYS__exit | |
| 8 | ||
| 7 | 9 | #define	SYS_syscall	0 |
| 8 | #define	SYS_exit	1 | |
| 10 | #define	SYS__exit	1 | |
| 9 | 11 | #define	SYS_fork	2 |
| 10 | 12 | #define	SYS_read	3 |
| 11 | 13 | #define	SYS_write	4 |
| ... | ... | @@ -73,8 +75,8 @@ |
| 73 | 75 | #define	SYS_vfork	66 |
| 74 | 76 | 				/* 67 is obsolete vread */ |
| 75 | 77 | 				/* 68 is obsolete vwrite */ |
| 76 | #define	SYS_sbrk	69 | |
| 77 | #define	SYS_sstk	70 | |
| 78 | 				/* 69 is obsolete sbrk */ | |
| 79 | 				/* 70 is obsolete sstk */ | |
| 78 | 80 | 				/* 71 is old mmap */ |
| 79 | 81 | #define	SYS_freebsd11_vadvise	72 |
| 80 | 82 | #define	SYS_munmap	73 |
| ... | ... | @@ -83,8 +85,8 @@ |
| 83 | 85 | 				/* 76 is obsolete vhangup */ |
| 84 | 86 | 				/* 77 is obsolete vlimit */ |
| 85 | 87 | #define	SYS_mincore	78 |
| 86 | #define	SYS_getgroups	79 | |
| 87 | #define	SYS_setgroups	80 | |
| 88 | #define	SYS_freebsd14_getgroups	79 | |
| 89 | #define	SYS_freebsd14_setgroups	80 | |
| 88 | 90 | #define	SYS_getpgrp	81 |
| 89 | 91 | #define	SYS_setpgid	82 |
| 90 | 92 | #define	SYS_setitimer	83 |
| ... | ... | @@ -442,7 +444,7 @@ |
| 442 | 444 | #define	SYS_symlinkat	502 |
| 443 | 445 | #define	SYS_unlinkat	503 |
| 444 | 446 | #define	SYS_posix_openpt	504 |
| 445 | #define	SYS_gssd_syscall	505 | |
| 447 | 				/* 505 is obsolete kgssapi */ | |
| 446 | 448 | #define	SYS_jail_get	506 |
| 447 | 449 | #define	SYS_jail_set	507 |
| 448 | 450 | #define	SYS_jail_remove	508 |
| ... | ... | @@ -526,4 +528,13 @@ |
| 526 | 528 | #define	SYS_timerfd_settime	587 |
| 527 | 529 | #define	SYS_kcmp	588 |
| 528 | 530 | #define	SYS_getrlimitusage	589 |
| 529 | #define	SYS_MAXSYSCALL	590 | |
| \ No newline at end of file | ||
| 531 | #define	SYS_fchroot	590 | |
| 532 | #define	SYS_setcred	591 | |
| 533 | #define	SYS_exterrctl	592 | |
| 534 | #define	SYS_inotify_add_watch_at	593 | |
| 535 | #define	SYS_inotify_rm_watch	594 | |
| 536 | #define	SYS_getgroups	595 | |
| 537 | #define	SYS_setgroups	596 | |
| 538 | #define	SYS_jail_attach_jd	597 | |
| 539 | #define	SYS_jail_remove_jd	598 | |
| 540 | #define	SYS_MAXSYSCALL	599 | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/sys/syscallsubr.h+28-15| ... | ... | @@ -28,13 +28,14 @@ |
| 28 | 28 | #ifndef _SYS_SYSCALLSUBR_H_ |
| 29 | 29 | #define _SYS_SYSCALLSUBR_H_ |
| 30 | 30 | |
| 31 | #include <sys/signal.h> | |
| 32 | #include <sys/socket.h> | |
| 33 | #include <sys/mac.h> | |
| 34 | #include <sys/mount.h> | |
| 31 | #include <sys/types.h> | |
| 35 | 32 | #include <sys/_cpuset.h> |
| 36 | 33 | #include <sys/_domainset.h> |
| 37 | 34 | #include <sys/_uio.h> |
| 35 | #include <sys/mac.h> | |
| 36 | #include <sys/mount.h> | |
| 37 | #include <sys/signal.h> | |
| 38 | #include <sys/socket.h> | |
| 38 | 39 | |
| 39 | 40 | struct __wrusage; |
| 40 | 41 | struct cpuset_copy_cb; |
| ... | ... | @@ -49,6 +50,7 @@ struct kevent_copyops; |
| 49 | 50 | struct kld_file_stat; |
| 50 | 51 | struct ksiginfo; |
| 51 | 52 | struct mbuf; |
| 53 | struct mq_attr; | |
| 52 | 54 | struct msghdr; |
| 53 | 55 | struct msqid_ds; |
| 54 | 56 | struct pollfd; |
| ... | ... | @@ -58,6 +60,7 @@ struct rusage; |
| 58 | 60 | struct sched_param; |
| 59 | 61 | struct sembuf; |
| 60 | 62 | union semun; |
| 63 | struct shmfd; | |
| 61 | 64 | struct sockaddr; |
| 62 | 65 | struct spacectl_range; |
| 63 | 66 | struct stat; |
| ... | ... | @@ -84,10 +87,10 @@ int	kern___getcwd(struct thread *td, char *buf, enum uio_seg bufseg, |
| 84 | 87 | 	 size_t buflen, size_t path_max); |
| 85 | 88 | int	kern_abort2(struct thread *td, const char *why, int nargs, |
| 86 | 89 | 	 void **uargs); |
| 87 | int	kern_accept(struct thread *td, int s, struct sockaddr **name, | |
| 88 | 	 socklen_t *namelen, struct file **fp); | |
| 89 | int	kern_accept4(struct thread *td, int s, struct sockaddr **name, | |
| 90 | 	 socklen_t *namelen, int flags, struct file **fp); | |
| 90 | int	kern_accept(struct thread *td, int s, struct sockaddr *sa, | |
| 91 | 	 struct file **fp); | |
| 92 | int	kern_accept4(struct thread *td, int s, struct sockaddr *sa, | |
| 93 | 	 int flags, struct file **fp); | |
| 91 | 94 | int	kern_accessat(struct thread *td, int fd, const char *path, |
| 92 | 95 | 	 enum uio_seg pathseg, int flags, int mode); |
| 93 | 96 | int	kern_adjtime(struct thread *td, struct timeval *delta, |
| ... | ... | @@ -164,7 +167,7 @@ int	kern_fchmodat(struct thread *td, int fd, const char *path, |
| 164 | 167 | int	kern_fchownat(struct thread *td, int fd, const char *path, |
| 165 | 168 | 	 enum uio_seg pathseg, int uid, int gid, int flag); |
| 166 | 169 | int	kern_fcntl(struct thread *td, int fd, int cmd, intptr_t arg); |
| 167 | int	kern_fcntl_freebsd(struct thread *td, int fd, int cmd, long arg); | |
| 170 | int	kern_fcntl_freebsd(struct thread *td, int fd, int cmd, intptr_t arg); | |
| 168 | 171 | int	kern_fhopen(struct thread *td, const struct fhandle *u_fhp, int flags); |
| 169 | 172 | int	kern_fhstat(struct thread *td, fhandle_t fh, struct stat *buf); |
| 170 | 173 | int	kern_fhstatfs(struct thread *td, fhandle_t fh, struct statfs *buf); |
| ... | ... | @@ -187,13 +190,11 @@ int	kern_getfsstat(struct thread *td, struct statfs **buf, size_t bufsize, |
| 187 | 190 | 	 size_t *countp, enum uio_seg bufseg, int mode); |
| 188 | 191 | int	kern_getitimer(struct thread *, u_int, struct itimerval *); |
| 189 | 192 | int	kern_getppid(struct thread *); |
| 190 | int	kern_getpeername(struct thread *td, int fd, struct sockaddr **sa, | |
| 191 | 	 socklen_t *alen); | |
| 193 | int	kern_getpeername(struct thread *td, int fd, struct sockaddr *sa); | |
| 192 | 194 | int	kern_getpriority(struct thread *td, int which, int who); |
| 193 | 195 | int	kern_getrusage(struct thread *td, int who, struct rusage *rup); |
| 194 | 196 | int	kern_getsid(struct thread *td, pid_t pid); |
| 195 | int	kern_getsockname(struct thread *td, int fd, struct sockaddr **sa, | |
| 196 | 	 socklen_t *alen); | |
| 197 | int	kern_getsockname(struct thread *td, int fd, struct sockaddr *sa); | |
| 197 | 198 | int	kern_getsockopt(struct thread *td, int s, int level, int name, |
| 198 | 199 | 	 void *optval, enum uio_seg valseg, socklen_t *valsize); |
| 199 | 200 | int	kern_ioctl(struct thread *td, int fd, u_long com, caddr_t data); |
| ... | ... | @@ -214,6 +215,15 @@ int	kern_kqueue(struct thread *td, int flags, struct filecaps *fcaps); |
| 214 | 215 | int	kern_kldload(struct thread *td, const char *file, int *fileid); |
| 215 | 216 | int	kern_kldstat(struct thread *td, int fileid, struct kld_file_stat *stat); |
| 216 | 217 | int	kern_kldunload(struct thread *td, int fileid, int flags); |
| 218 | int	kern_kmq_notify(struct thread *, int, struct sigevent *); | |
| 219 | int	kern_kmq_open(struct thread *, const char *, int, mode_t, | |
| 220 | 		const struct mq_attr *); | |
| 221 | int	kern_kmq_setattr(struct thread *, int, const struct mq_attr *, | |
| 222 | 		struct mq_attr *); | |
| 223 | int	kern_kmq_timedreceive(struct thread *, int, char *, | |
| 224 | 		size_t, unsigned int *, const struct timespec *); | |
| 225 | int	kern_kmq_timedsend(struct thread *td, int, const char *, | |
| 226 | 		size_t, unsigned int, const struct timespec *); | |
| 217 | 227 | int	kern_linkat(struct thread *td, int fd1, int fd2, const char *path1, |
| 218 | 228 | 	 const char *path2, enum uio_seg segflg, int flag); |
| 219 | 229 | int	kern_listen(struct thread *td, int s, int backlog); |
| ... | ... | @@ -248,6 +258,7 @@ int	kern_munlock(struct thread *td, uintptr_t addr, size_t size); |
| 248 | 258 | int	kern_munmap(struct thread *td, uintptr_t addr, size_t size); |
| 249 | 259 | int kern_nanosleep(struct thread *td, struct timespec *rqt, |
| 250 | 260 | 	 struct timespec *rmt); |
| 261 | int	kern_nosys(struct thread *td, int dummy); | |
| 251 | 262 | int	kern_ntp_adjtime(struct thread *td, struct timex *ntv, int *retvalp); |
| 252 | 263 | int	kern_ogetdirentries(struct thread *td, struct ogetdirentries_args *uap, |
| 253 | 264 | 	 long *ploff); |
| ... | ... | @@ -312,7 +323,9 @@ int	kern_select(struct thread *td, int nd, fd_set *fd_in, fd_set *fd_ou, |
| 312 | 323 | 	 fd_set *fd_ex, struct timeval *tvp, int abi_nfdbits); |
| 313 | 324 | int	kern_sendit(struct thread *td, int s, struct msghdr *mp, int flags, |
| 314 | 325 | 	 struct mbuf *control, enum uio_seg segflg); |
| 315 | int	kern_setgroups(struct thread *td, u_int ngrp, gid_t *groups); | |
| 326 | int	kern_setcred(struct thread *const td, const u_int flags, | |
| 327 | 	 struct setcred *const wcred, gid_t *preallocated_groups); | |
| 328 | int	kern_setgroups(struct thread *td, int *ngrpp, gid_t *groups); | |
| 316 | 329 | int	kern_setitimer(struct thread *, u_int, struct itimerval *, |
| 317 | 330 | 	 struct itimerval *); |
| 318 | 331 | int	kern_setpriority(struct thread *td, int which, int who, int prio); |
| ... | ... | @@ -325,7 +338,7 @@ int	kern_shm_open(struct thread *td, const char *userpath, int flags, |
| 325 | 338 | 	 mode_t mode, struct filecaps *fcaps); |
| 326 | 339 | int	kern_shm_open2(struct thread *td, const char *path, int flags, |
| 327 | 340 | 	 mode_t mode, int shmflags, struct filecaps *fcaps, |
| 328 | 	 const char *name); | |
| 341 | 	 const char *name, struct shmfd *shmfd); | |
| 329 | 342 | int	kern_shmat(struct thread *td, int shmid, const void *shmaddr, |
| 330 | 343 | 	 int shmflg); |
| 331 | 344 | int	kern_shmctl(struct thread *td, int shmid, int cmd, void *buf, |
lib/libc/include/generic-freebsd/sys/sysctl.h+26-6| ... | ... | @@ -30,14 +30,13 @@ |
| 30 | 30 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 31 | 31 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 32 | 32 | * SUCH DAMAGE. |
| 33 | * | |
| 34 | *	@(#)sysctl.h	8.1 (Berkeley) 6/2/93 | |
| 35 | 33 | */ |
| 36 | 34 | |
| 37 | 35 | #ifndef _SYS_SYSCTL_H_ |
| 38 | 36 | #define	_SYS_SYSCTL_H_ |
| 39 | 37 | |
| 40 | 38 | #ifdef _KERNEL |
| 39 | #include <sys/cdefs.h> | |
| 41 | 40 | #include <sys/queue.h> |
| 42 | 41 | #include <sys/tree.h> |
| 43 | 42 | #endif |
| ... | ... | @@ -866,7 +865,7 @@ TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_entry); |
| 866 | 865 | /* OID expressing a sbintime_t as microseconds */ |
| 867 | 866 | #define	SYSCTL_SBINTIME_USEC(parent, nbr, name, access, ptr, descr)	\ |
| 868 | 867 | 	SYSCTL_OID(parent, nbr, name,					\ |
| 869 | 	 CTLTYPE_INT | CTLFLAG_MPSAFE | CTLFLAG_RD | (access),	\ | |
| 868 | 	 CTLTYPE_S64 | CTLFLAG_MPSAFE | CTLFLAG_RD | (access),	\ | |
| 870 | 869 | 	 (ptr), 0, sysctl_usec_to_sbintime, "Q", descr);		\ |
| 871 | 870 | 	CTASSERT(((access) & CTLTYPE) == 0 ||				\ |
| 872 | 871 | 	 ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_S64) |
| ... | ... | @@ -876,7 +875,7 @@ TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_entry); |
| 876 | 875 | 	CTASSERT(((access) & CTLTYPE) == 0 ||				\ |
| 877 | 876 | 	 ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_S64);		\ |
| 878 | 877 | 	sysctl_add_oid(ctx, parent, nbr, name,				\ |
| 879 | 	 CTLTYPE_INT | CTLFLAG_MPSAFE | CTLFLAG_RD | (access),	\ | |
| 878 | 	 CTLTYPE_S64 | CTLFLAG_MPSAFE | CTLFLAG_RD | (access),	\ | |
| 880 | 879 | 	 __ptr, 0, sysctl_usec_to_sbintime, "Q", __DESCR(descr),	\ |
| 881 | 880 | 	 NULL);							\ |
| 882 | 881 | }) |
| ... | ... | @@ -884,7 +883,7 @@ TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_entry); |
| 884 | 883 | /* OID expressing a sbintime_t as milliseconds */ |
| 885 | 884 | #define	SYSCTL_SBINTIME_MSEC(parent, nbr, name, access, ptr, descr)	\ |
| 886 | 885 | 	SYSCTL_OID(parent, nbr, name,					\ |
| 887 | 	 CTLTYPE_INT | CTLFLAG_MPSAFE | CTLFLAG_RD | (access),	\ | |
| 886 | 	 CTLTYPE_S64 | CTLFLAG_MPSAFE | CTLFLAG_RD | (access),	\ | |
| 888 | 887 | 	 (ptr), 0, sysctl_msec_to_sbintime, "Q", descr);		\ |
| 889 | 888 | 	CTASSERT(((access) & CTLTYPE) == 0 ||				\ |
| 890 | 889 | 	 ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_S64) |
| ... | ... | @@ -894,7 +893,7 @@ TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_entry); |
| 894 | 893 | 	CTASSERT(((access) & CTLTYPE) == 0 ||				\ |
| 895 | 894 | 	 ((access) & SYSCTL_CT_ASSERT_MASK) == CTLTYPE_S64);		\ |
| 896 | 895 | 	sysctl_add_oid(ctx, parent, nbr, name,				\ |
| 897 | 	 CTLTYPE_INT | CTLFLAG_MPSAFE | CTLFLAG_RD | (access),	\ | |
| 896 | 	 CTLTYPE_S64 | CTLFLAG_MPSAFE | CTLFLAG_RD | (access),	\ | |
| 898 | 897 | 	 __ptr, 0, sysctl_msec_to_sbintime, "Q", __DESCR(descr),	\ |
| 899 | 898 | 	 NULL);							\ |
| 900 | 899 | }) |
| ... | ... | @@ -934,6 +933,26 @@ TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_entry); |
| 934 | 933 | 	 CTLFLAG_RD | CTLFLAG_CAPRD | CTLTYPE_INT | CTLFLAG_MPSAFE,	\ |
| 935 | 934 | 	 NULL, 1, sysctl_handle_int, "I", desc, "feature"); |
| 936 | 935 | |
| 936 | /* | |
| 937 | * Adding new leaves to the 'debug.sizeof' MIB tree for ad-hoc reasons is | |
| 938 | * discouraged, and in particular for reporting to developers the size of some | |
| 939 | * kernel structures, which can be obtained by the following alternative means: | |
| 940 | * 1. In GDB, load a full kernel image and use 'print(sizeof(struct XXX))'. | |
| 941 | * Alternatively, use 'ptype/o struct XXX' to additionally get the offsets | |
| 942 | * and size of all structure's fields. | |
| 943 | * 2. If the structure is allocated from UMA, then 'vmstat -z' reports its size | |
| 944 | * (the mapping between structure types and zones is usually | |
| 945 | * straightforward). | |
| 946 | */ | |
| 947 | /* Generates a read-only sysctl reporting the size of an object/structure. */ | |
| 948 | #define SYSCTL_SIZEOF(name, expr)					\ | |
| 949 | 	SYSCTL_INT(_debug_sizeof, OID_AUTO, name, CTLFLAG_RD,		\ | |
| 950 | 	 SYSCTL_NULL_INT_PTR, sizeof(expr),				\ | |
| 951 | 	 "sizeof(" __STRING(expr) ")"); | |
| 952 | /* Same, specialized for structures. */ | |
| 953 | #define SYSCTL_SIZEOF_STRUCT(struct_name)				\ | |
| 954 | 	SYSCTL_SIZEOF(struct_name, struct struct_name) | |
| 955 | ||
| 937 | 956 | #endif /* _KERNEL */ |
| 938 | 957 | |
| 939 | 958 | /* |
| ... | ... | @@ -1043,6 +1062,7 @@ TAILQ_HEAD(sysctl_ctx_list, sysctl_ctx_entry); |
| 1043 | 1062 | #define	KERN_PROC_SIGFASTBLK	44	/* address of fastsigblk magic word */ |
| 1044 | 1063 | #define	KERN_PROC_VM_LAYOUT	45	/* virtual address space layout info */ |
| 1045 | 1064 | #define	KERN_PROC_RLIMIT_USAGE	46	/* array of rlim_t */ |
| 1065 | #define	KERN_PROC_KQUEUE	47	/* array of struct kinfo_knote */ | |
| 1046 | 1066 | |
| 1047 | 1067 | /* |
| 1048 | 1068 | * KERN_IPC identifiers |
lib/libc/include/generic-freebsd/sys/sysent.h+15-7| ... | ... | @@ -79,11 +79,10 @@ struct sysent {			/* system call table */ |
| 79 | 79 | */ |
| 80 | 80 | #define	SYF_CAPENABLED	0x00000001 |
| 81 | 81 | |
| 82 | #define	SY_THR_FLAGMASK	0x7 | |
| 83 | #define	SY_THR_STATIC	0x1 | |
| 84 | #define	SY_THR_DRAINING	0x2 | |
| 85 | #define	SY_THR_ABSENT	0x4 | |
| 86 | #define	SY_THR_INCR	0x8 | |
| 82 | #define	SY_THR_STATIC	0x01 | |
| 83 | #define	SY_THR_DRAINING	0x02 | |
| 84 | #define	SY_THR_ABSENT	0x04 | |
| 85 | #define	SY_THR_INCR	0x08 | |
| 87 | 86 | |
| 88 | 87 | #ifdef KLD_MODULE |
| 89 | 88 | #define	SY_THR_STATIC_KLD	0 |
| ... | ... | @@ -91,6 +90,7 @@ struct sysent {			/* system call table */ |
| 91 | 90 | #define	SY_THR_STATIC_KLD	SY_THR_STATIC |
| 92 | 91 | #endif |
| 93 | 92 | |
| 93 | struct coredump_writer; | |
| 94 | 94 | struct image_params; |
| 95 | 95 | struct proc; |
| 96 | 96 | struct __sigset; |
| ... | ... | @@ -109,7 +109,8 @@ struct sysentvec { |
| 109 | 109 | 	int 		*sv_szsigcode;	/* size of sigtramp code */ |
| 110 | 110 | 	int		sv_sigcodeoff; |
| 111 | 111 | 	char		*sv_name;	/* name of binary type */ |
| 112 | 	int		(*sv_coredump)(struct thread *, struct vnode *, off_t, int); | |
| 112 | 	int		(*sv_coredump)(struct thread *, struct coredump_writer *, | |
| 113 | 			 off_t, int); | |
| 113 | 114 | 					/* function to dump core, or NULL */ |
| 114 | 115 | 	int		sv_elf_core_osabi; |
| 115 | 116 | 	const char	*sv_elf_core_abi_vendor; |
| ... | ... | @@ -145,10 +146,13 @@ struct sysentvec { |
| 145 | 146 | 	int		(*sv_trap)(struct thread *); |
| 146 | 147 | 	u_long		*sv_hwcap;	/* Value passed in AT_HWCAP. */ |
| 147 | 148 | 	u_long		*sv_hwcap2;	/* Value passed in AT_HWCAP2. */ |
| 149 | 	u_long		*sv_hwcap3;	/* Value passed in AT_HWCAP3. */ | |
| 150 | 	u_long		*sv_hwcap4;	/* Value passed in AT_HWCAP4. */ | |
| 148 | 151 | 	const char	*(*sv_machine_arch)(struct proc *); |
| 149 | 152 | 	vm_offset_t	sv_fxrng_gen_offset; |
| 150 | 153 | 	void		(*sv_onexec_old)(struct thread *td); |
| 151 | 154 | 	int		(*sv_onexec)(struct proc *, struct image_params *); |
| 155 | 	void		(*sv_protect)(struct image_params *, int); | |
| 152 | 156 | 	void		(*sv_onexit)(struct proc *); |
| 153 | 157 | 	void		(*sv_ontdexit)(struct thread *td); |
| 154 | 158 | 	int		(*sv_setid_allowed)(struct thread *td, |
| ... | ... | @@ -161,7 +165,7 @@ struct sysentvec { |
| 161 | 165 | |
| 162 | 166 | #define	SV_ILP32	0x000100	/* 32-bit executable. */ |
| 163 | 167 | #define	SV_LP64		0x000200	/* 64-bit executable. */ |
| 164 | #define	SV_IA32		0x004000	/* Intel 32-bit executable. */ | |
| 168 | #define	SV_RESERVED0	0x004000	/* Formerly SV_IA32 */ | |
| 165 | 169 | #define	SV_AOUT		0x008000	/* a.out executable. */ |
| 166 | 170 | #define	SV_SHP		0x010000	/* Shared page. */ |
| 167 | 171 | #define	SV_SIGSYS	0x020000	/* SIGSYS for non-existing syscall */ |
| ... | ... | @@ -187,6 +191,10 @@ struct sysentvec { |
| 187 | 191 | #define	SVC_NOCOMPRESS	0x00000002	/* disable compression. */ |
| 188 | 192 | #define	SVC_ALL		0x00000004	/* dump everything */ |
| 189 | 193 | |
| 194 | /* sv_protect flags */ | |
| 195 | #define	SVP_IMAGE	0x00000001 | |
| 196 | #define	SVP_INTERP	0x00000002 | |
| 197 | ||
| 190 | 198 | #ifdef _KERNEL |
| 191 | 199 | extern struct sysentvec aout_sysvec; |
| 192 | 200 | extern struct sysent sysent[]; |
lib/libc/include/generic-freebsd/sys/syslimits.h-2| ... | ... | @@ -27,8 +27,6 @@ |
| 27 | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | * | |
| 31 | *	@(#)syslimits.h	8.1 (Berkeley) 6/2/93 | |
| 32 | 30 | */ |
| 33 | 31 | |
| 34 | 32 | #ifndef _SYS_SYSLIMITS_H_ |
lib/libc/include/generic-freebsd/sys/syslog.h-2| ... | ... | @@ -27,8 +27,6 @@ |
| 27 | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | * | |
| 31 | *	@(#)syslog.h	8.1 (Berkeley) 6/2/93 | |
| 32 | 30 | */ |
| 33 | 31 | |
| 34 | 32 | #ifndef _SYS_SYSLOG_H_ |
lib/libc/include/generic-freebsd/sys/sysproto.h+99-54| ... | ... | @@ -7,8 +7,8 @@ |
| 7 | 7 | #ifndef _SYS_SYSPROTO_H_ |
| 8 | 8 | #define	_SYS_SYSPROTO_H_ |
| 9 | 9 | |
| 10 | #include <sys/types.h> | |
| 10 | 11 | #include <sys/signal.h> |
| 11 | #include <sys/acl.h> | |
| 12 | 12 | #include <sys/cpuset.h> |
| 13 | 13 | #include <sys/domainset.h> |
| 14 | 14 | #include <sys/_ffcounter.h> |
| ... | ... | @@ -33,7 +33,7 @@ struct thread; |
| 33 | 33 | #define	PADR_(t)	0 |
| 34 | 34 | #endif |
| 35 | 35 | |
| 36 | struct exit_args { | |
| 36 | struct _exit_args { | |
| 37 | 37 | 	char rval_l_[PADL_(int)]; int rval; char rval_r_[PADR_(int)]; |
| 38 | 38 | }; |
| 39 | 39 | struct fork_args { |
| ... | ... | @@ -254,12 +254,6 @@ struct msync_args { |
| 254 | 254 | struct vfork_args { |
| 255 | 255 | 	syscallarg_t dummy; |
| 256 | 256 | }; |
| 257 | struct sbrk_args { | |
| 258 | 	char incr_l_[PADL_(int)]; int incr; char incr_r_[PADR_(int)]; | |
| 259 | }; | |
| 260 | struct sstk_args { | |
| 261 | 	char incr_l_[PADL_(int)]; int incr; char incr_r_[PADR_(int)]; | |
| 262 | }; | |
| 263 | 257 | struct munmap_args { |
| 264 | 258 | 	char addr_l_[PADL_(void *)]; void * addr; char addr_r_[PADR_(void *)]; |
| 265 | 259 | 	char len_l_[PADL_(size_t)]; size_t len; char len_r_[PADR_(size_t)]; |
| ... | ... | @@ -279,14 +273,6 @@ struct mincore_args { |
| 279 | 273 | 	char len_l_[PADL_(size_t)]; size_t len; char len_r_[PADR_(size_t)]; |
| 280 | 274 | 	char vec_l_[PADL_(char *)]; char * vec; char vec_r_[PADR_(char *)]; |
| 281 | 275 | }; |
| 282 | struct getgroups_args { | |
| 283 | 	char gidsetsize_l_[PADL_(int)]; int gidsetsize; char gidsetsize_r_[PADR_(int)]; | |
| 284 | 	char gidset_l_[PADL_(gid_t *)]; gid_t * gidset; char gidset_r_[PADR_(gid_t *)]; | |
| 285 | }; | |
| 286 | struct setgroups_args { | |
| 287 | 	char gidsetsize_l_[PADL_(int)]; int gidsetsize; char gidsetsize_r_[PADR_(int)]; | |
| 288 | 	char gidset_l_[PADL_(const gid_t *)]; const gid_t * gidset; char gidset_r_[PADR_(const gid_t *)]; | |
| 289 | }; | |
| 290 | 276 | struct getpgrp_args { |
| 291 | 277 | 	syscallarg_t dummy; |
| 292 | 278 | }; |
| ... | ... | @@ -319,7 +305,7 @@ struct dup2_args { |
| 319 | 305 | struct fcntl_args { |
| 320 | 306 | 	char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)]; |
| 321 | 307 | 	char cmd_l_[PADL_(int)]; int cmd; char cmd_r_[PADR_(int)]; |
| 322 | 	char arg_l_[PADL_(long)]; long arg; char arg_r_[PADR_(long)]; | |
| 308 | 	char arg_l_[PADL_(intptr_t)]; intptr_t arg; char arg_r_[PADR_(intptr_t)]; | |
| 323 | 309 | }; |
| 324 | 310 | struct select_args { |
| 325 | 311 | 	char nd_l_[PADL_(int)]; int nd; char nd_r_[PADR_(int)]; |
| ... | ... | @@ -383,12 +369,12 @@ struct getsockopt_args { |
| 383 | 369 | }; |
| 384 | 370 | struct readv_args { |
| 385 | 371 | 	char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)]; |
| 386 | 	char iovp_l_[PADL_(struct iovec *)]; struct iovec * iovp; char iovp_r_[PADR_(struct iovec *)]; | |
| 372 | 	char iovp_l_[PADL_(const struct iovec *)]; const struct iovec * iovp; char iovp_r_[PADR_(const struct iovec *)]; | |
| 387 | 373 | 	char iovcnt_l_[PADL_(u_int)]; u_int iovcnt; char iovcnt_r_[PADR_(u_int)]; |
| 388 | 374 | }; |
| 389 | 375 | struct writev_args { |
| 390 | 376 | 	char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)]; |
| 391 | 	char iovp_l_[PADL_(struct iovec *)]; struct iovec * iovp; char iovp_r_[PADR_(struct iovec *)]; | |
| 377 | 	char iovp_l_[PADL_(const struct iovec *)]; const struct iovec * iovp; char iovp_r_[PADR_(const struct iovec *)]; | |
| 392 | 378 | 	char iovcnt_l_[PADL_(u_int)]; u_int iovcnt; char iovcnt_r_[PADR_(u_int)]; |
| 393 | 379 | }; |
| 394 | 380 | struct settimeofday_args { |
| ... | ... | @@ -552,7 +538,7 @@ struct setrlimit_args { |
| 552 | 538 | 	char rlp_l_[PADL_(struct rlimit *)]; struct rlimit * rlp; char rlp_r_[PADR_(struct rlimit *)]; |
| 553 | 539 | }; |
| 554 | 540 | struct __sysctl_args { |
| 555 | 	char name_l_[PADL_(int *)]; int * name; char name_r_[PADR_(int *)]; | |
| 541 | 	char name_l_[PADL_(const int *)]; const int * name; char name_r_[PADR_(const int *)]; | |
| 556 | 542 | 	char namelen_l_[PADL_(u_int)]; u_int namelen; char namelen_r_[PADR_(u_int)]; |
| 557 | 543 | 	char old_l_[PADL_(void *)]; void * old; char old_r_[PADR_(void *)]; |
| 558 | 544 | 	char oldlenp_l_[PADL_(size_t *)]; size_t * oldlenp; char oldlenp_r_[PADR_(size_t *)]; |
| ... | ... | @@ -783,7 +769,7 @@ struct aio_return_args { |
| 783 | 769 | 	char aiocbp_l_[PADL_(struct aiocb *)]; struct aiocb * aiocbp; char aiocbp_r_[PADR_(struct aiocb *)]; |
| 784 | 770 | }; |
| 785 | 771 | struct aio_suspend_args { |
| 786 | 	char aiocbp_l_[PADL_(struct aiocb * const *)]; struct aiocb * const * aiocbp; char aiocbp_r_[PADR_(struct aiocb * const *)]; | |
| 772 | 	char aiocbp_l_[PADL_(const struct aiocb * const *)]; const struct aiocb * const * aiocbp; char aiocbp_r_[PADR_(const struct aiocb * const *)]; | |
| 787 | 773 | 	char nent_l_[PADL_(int)]; int nent; char nent_r_[PADR_(int)]; |
| 788 | 774 | 	char timeout_l_[PADL_(const struct timespec *)]; const struct timespec * timeout; char timeout_r_[PADR_(const struct timespec *)]; |
| 789 | 775 | }; |
| ... | ... | @@ -868,49 +854,49 @@ struct sigpending_args { |
| 868 | 854 | }; |
| 869 | 855 | struct sigtimedwait_args { |
| 870 | 856 | 	char set_l_[PADL_(const sigset_t *)]; const sigset_t * set; char set_r_[PADR_(const sigset_t *)]; |
| 871 | 	char info_l_[PADL_(struct siginfo *)]; struct siginfo * info; char info_r_[PADR_(struct siginfo *)]; | |
| 857 | 	char info_l_[PADL_(struct __siginfo *)]; struct __siginfo * info; char info_r_[PADR_(struct __siginfo *)]; | |
| 872 | 858 | 	char timeout_l_[PADL_(const struct timespec *)]; const struct timespec * timeout; char timeout_r_[PADR_(const struct timespec *)]; |
| 873 | 859 | }; |
| 874 | 860 | struct sigwaitinfo_args { |
| 875 | 861 | 	char set_l_[PADL_(const sigset_t *)]; const sigset_t * set; char set_r_[PADR_(const sigset_t *)]; |
| 876 | 	char info_l_[PADL_(struct siginfo *)]; struct siginfo * info; char info_r_[PADR_(struct siginfo *)]; | |
| 862 | 	char info_l_[PADL_(struct __siginfo *)]; struct __siginfo * info; char info_r_[PADR_(struct __siginfo *)]; | |
| 877 | 863 | }; |
| 878 | 864 | struct __acl_get_file_args { |
| 879 | 865 | 	char path_l_[PADL_(const char *)]; const char * path; char path_r_[PADR_(const char *)]; |
| 880 | 	char type_l_[PADL_(acl_type_t)]; acl_type_t type; char type_r_[PADR_(acl_type_t)]; | |
| 866 | 	char type_l_[PADL_(__acl_type_t)]; __acl_type_t type; char type_r_[PADR_(__acl_type_t)]; | |
| 881 | 867 | 	char aclp_l_[PADL_(struct acl *)]; struct acl * aclp; char aclp_r_[PADR_(struct acl *)]; |
| 882 | 868 | }; |
| 883 | 869 | struct __acl_set_file_args { |
| 884 | 870 | 	char path_l_[PADL_(const char *)]; const char * path; char path_r_[PADR_(const char *)]; |
| 885 | 	char type_l_[PADL_(acl_type_t)]; acl_type_t type; char type_r_[PADR_(acl_type_t)]; | |
| 871 | 	char type_l_[PADL_(__acl_type_t)]; __acl_type_t type; char type_r_[PADR_(__acl_type_t)]; | |
| 886 | 872 | 	char aclp_l_[PADL_(struct acl *)]; struct acl * aclp; char aclp_r_[PADR_(struct acl *)]; |
| 887 | 873 | }; |
| 888 | 874 | struct __acl_get_fd_args { |
| 889 | 875 | 	char filedes_l_[PADL_(int)]; int filedes; char filedes_r_[PADR_(int)]; |
| 890 | 	char type_l_[PADL_(acl_type_t)]; acl_type_t type; char type_r_[PADR_(acl_type_t)]; | |
| 876 | 	char type_l_[PADL_(__acl_type_t)]; __acl_type_t type; char type_r_[PADR_(__acl_type_t)]; | |
| 891 | 877 | 	char aclp_l_[PADL_(struct acl *)]; struct acl * aclp; char aclp_r_[PADR_(struct acl *)]; |
| 892 | 878 | }; |
| 893 | 879 | struct __acl_set_fd_args { |
| 894 | 880 | 	char filedes_l_[PADL_(int)]; int filedes; char filedes_r_[PADR_(int)]; |
| 895 | 	char type_l_[PADL_(acl_type_t)]; acl_type_t type; char type_r_[PADR_(acl_type_t)]; | |
| 881 | 	char type_l_[PADL_(__acl_type_t)]; __acl_type_t type; char type_r_[PADR_(__acl_type_t)]; | |
| 896 | 882 | 	char aclp_l_[PADL_(struct acl *)]; struct acl * aclp; char aclp_r_[PADR_(struct acl *)]; |
| 897 | 883 | }; |
| 898 | 884 | struct __acl_delete_file_args { |
| 899 | 885 | 	char path_l_[PADL_(const char *)]; const char * path; char path_r_[PADR_(const char *)]; |
| 900 | 	char type_l_[PADL_(acl_type_t)]; acl_type_t type; char type_r_[PADR_(acl_type_t)]; | |
| 886 | 	char type_l_[PADL_(__acl_type_t)]; __acl_type_t type; char type_r_[PADR_(__acl_type_t)]; | |
| 901 | 887 | }; |
| 902 | 888 | struct __acl_delete_fd_args { |
| 903 | 889 | 	char filedes_l_[PADL_(int)]; int filedes; char filedes_r_[PADR_(int)]; |
| 904 | 	char type_l_[PADL_(acl_type_t)]; acl_type_t type; char type_r_[PADR_(acl_type_t)]; | |
| 890 | 	char type_l_[PADL_(__acl_type_t)]; __acl_type_t type; char type_r_[PADR_(__acl_type_t)]; | |
| 905 | 891 | }; |
| 906 | 892 | struct __acl_aclcheck_file_args { |
| 907 | 893 | 	char path_l_[PADL_(const char *)]; const char * path; char path_r_[PADR_(const char *)]; |
| 908 | 	char type_l_[PADL_(acl_type_t)]; acl_type_t type; char type_r_[PADR_(acl_type_t)]; | |
| 894 | 	char type_l_[PADL_(__acl_type_t)]; __acl_type_t type; char type_r_[PADR_(__acl_type_t)]; | |
| 909 | 895 | 	char aclp_l_[PADL_(struct acl *)]; struct acl * aclp; char aclp_r_[PADR_(struct acl *)]; |
| 910 | 896 | }; |
| 911 | 897 | struct __acl_aclcheck_fd_args { |
| 912 | 898 | 	char filedes_l_[PADL_(int)]; int filedes; char filedes_r_[PADR_(int)]; |
| 913 | 	char type_l_[PADL_(acl_type_t)]; acl_type_t type; char type_r_[PADR_(acl_type_t)]; | |
| 899 | 	char type_l_[PADL_(__acl_type_t)]; __acl_type_t type; char type_r_[PADR_(__acl_type_t)]; | |
| 914 | 900 | 	char aclp_l_[PADL_(struct acl *)]; struct acl * aclp; char aclp_r_[PADR_(struct acl *)]; |
| 915 | 901 | }; |
| 916 | 902 | struct extattrctl_args { |
| ... | ... | @@ -1136,21 +1122,21 @@ struct swapcontext_args { |
| 1136 | 1122 | }; |
| 1137 | 1123 | struct __acl_get_link_args { |
| 1138 | 1124 | 	char path_l_[PADL_(const char *)]; const char * path; char path_r_[PADR_(const char *)]; |
| 1139 | 	char type_l_[PADL_(acl_type_t)]; acl_type_t type; char type_r_[PADR_(acl_type_t)]; | |
| 1125 | 	char type_l_[PADL_(__acl_type_t)]; __acl_type_t type; char type_r_[PADR_(__acl_type_t)]; | |
| 1140 | 1126 | 	char aclp_l_[PADL_(struct acl *)]; struct acl * aclp; char aclp_r_[PADR_(struct acl *)]; |
| 1141 | 1127 | }; |
| 1142 | 1128 | struct __acl_set_link_args { |
| 1143 | 1129 | 	char path_l_[PADL_(const char *)]; const char * path; char path_r_[PADR_(const char *)]; |
| 1144 | 	char type_l_[PADL_(acl_type_t)]; acl_type_t type; char type_r_[PADR_(acl_type_t)]; | |
| 1130 | 	char type_l_[PADL_(__acl_type_t)]; __acl_type_t type; char type_r_[PADR_(__acl_type_t)]; | |
| 1145 | 1131 | 	char aclp_l_[PADL_(struct acl *)]; struct acl * aclp; char aclp_r_[PADR_(struct acl *)]; |
| 1146 | 1132 | }; |
| 1147 | 1133 | struct __acl_delete_link_args { |
| 1148 | 1134 | 	char path_l_[PADL_(const char *)]; const char * path; char path_r_[PADR_(const char *)]; |
| 1149 | 	char type_l_[PADL_(acl_type_t)]; acl_type_t type; char type_r_[PADR_(acl_type_t)]; | |
| 1135 | 	char type_l_[PADL_(__acl_type_t)]; __acl_type_t type; char type_r_[PADR_(__acl_type_t)]; | |
| 1150 | 1136 | }; |
| 1151 | 1137 | struct __acl_aclcheck_link_args { |
| 1152 | 1138 | 	char path_l_[PADL_(const char *)]; const char * path; char path_r_[PADR_(const char *)]; |
| 1153 | 	char type_l_[PADL_(acl_type_t)]; acl_type_t type; char type_r_[PADR_(acl_type_t)]; | |
| 1139 | 	char type_l_[PADL_(__acl_type_t)]; __acl_type_t type; char type_r_[PADR_(__acl_type_t)]; | |
| 1154 | 1140 | 	char aclp_l_[PADL_(struct acl *)]; struct acl * aclp; char aclp_r_[PADR_(struct acl *)]; |
| 1155 | 1141 | }; |
| 1156 | 1142 | struct sigwait_args { |
| ... | ... | @@ -1482,9 +1468,6 @@ struct unlinkat_args { |
| 1482 | 1468 | struct posix_openpt_args { |
| 1483 | 1469 | 	char flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)]; |
| 1484 | 1470 | }; |
| 1485 | struct gssd_syscall_args { | |
| 1486 | 	char path_l_[PADL_(const char *)]; const char * path; char path_r_[PADR_(const char *)]; | |
| 1487 | }; | |
| 1488 | 1471 | struct jail_get_args { |
| 1489 | 1472 | 	char iovp_l_[PADL_(struct iovec *)]; struct iovec * iovp; char iovp_r_[PADR_(struct iovec *)]; |
| 1490 | 1473 | 	char iovcnt_l_[PADL_(unsigned int)]; unsigned int iovcnt; char iovcnt_r_[PADR_(unsigned int)]; |
| ... | ... | @@ -1603,7 +1586,7 @@ struct wait6_args { |
| 1603 | 1586 | 	char status_l_[PADL_(int *)]; int * status; char status_r_[PADR_(int *)]; |
| 1604 | 1587 | 	char options_l_[PADL_(int)]; int options; char options_r_[PADR_(int)]; |
| 1605 | 1588 | 	char wrusage_l_[PADL_(struct __wrusage *)]; struct __wrusage * wrusage; char wrusage_r_[PADR_(struct __wrusage *)]; |
| 1606 | 	char info_l_[PADL_(struct siginfo *)]; struct siginfo * info; char info_r_[PADR_(struct siginfo *)]; | |
| 1589 | 	char info_l_[PADL_(struct __siginfo *)]; struct __siginfo * info; char info_r_[PADR_(struct __siginfo *)]; | |
| 1607 | 1590 | }; |
| 1608 | 1591 | struct cap_rights_limit_args { |
| 1609 | 1592 | 	char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)]; |
| ... | ... | @@ -1811,7 +1794,7 @@ struct shm_rename_args { |
| 1811 | 1794 | }; |
| 1812 | 1795 | struct sigfastblock_args { |
| 1813 | 1796 | 	char cmd_l_[PADL_(int)]; int cmd; char cmd_r_[PADR_(int)]; |
| 1814 | 	char ptr_l_[PADL_(uint32_t *)]; uint32_t * ptr; char ptr_r_[PADR_(uint32_t *)]; | |
| 1797 | 	char ptr_l_[PADL_(void *)]; void * ptr; char ptr_r_[PADR_(void *)]; | |
| 1815 | 1798 | }; |
| 1816 | 1799 | struct __realpathat_args { |
| 1817 | 1800 | 	char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)]; |
| ... | ... | @@ -1826,8 +1809,7 @@ struct close_range_args { |
| 1826 | 1809 | 	char flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)]; |
| 1827 | 1810 | }; |
| 1828 | 1811 | struct rpctls_syscall_args { |
| 1829 | 	char op_l_[PADL_(int)]; int op; char op_r_[PADR_(int)]; | |
| 1830 | 	char path_l_[PADL_(const char *)]; const char * path; char path_r_[PADR_(const char *)]; | |
| 1812 | 	char socookie_l_[PADL_(uint64_t)]; uint64_t socookie; char socookie_r_[PADR_(uint64_t)]; | |
| 1831 | 1813 | }; |
| 1832 | 1814 | struct __specialfd_args { |
| 1833 | 1815 | 	char type_l_[PADL_(int)]; int type; char type_r_[PADR_(int)]; |
| ... | ... | @@ -1888,7 +1870,44 @@ struct getrlimitusage_args { |
| 1888 | 1870 | 	char flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)]; |
| 1889 | 1871 | 	char res_l_[PADL_(rlim_t *)]; rlim_t * res; char res_r_[PADR_(rlim_t *)]; |
| 1890 | 1872 | }; |
| 1891 | int	sys_exit(struct thread *, struct exit_args *); | |
| 1873 | struct fchroot_args { | |
| 1874 | 	char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)]; | |
| 1875 | }; | |
| 1876 | struct setcred_args { | |
| 1877 | 	char flags_l_[PADL_(u_int)]; u_int flags; char flags_r_[PADR_(u_int)]; | |
| 1878 | 	char wcred_l_[PADL_(const struct setcred *)]; const struct setcred * wcred; char wcred_r_[PADR_(const struct setcred *)]; | |
| 1879 | 	char size_l_[PADL_(size_t)]; size_t size; char size_r_[PADR_(size_t)]; | |
| 1880 | }; | |
| 1881 | struct exterrctl_args { | |
| 1882 | 	char op_l_[PADL_(u_int)]; u_int op; char op_r_[PADR_(u_int)]; | |
| 1883 | 	char flags_l_[PADL_(u_int)]; u_int flags; char flags_r_[PADR_(u_int)]; | |
| 1884 | 	char ptr_l_[PADL_(void *)]; void * ptr; char ptr_r_[PADR_(void *)]; | |
| 1885 | }; | |
| 1886 | struct inotify_add_watch_at_args { | |
| 1887 | 	char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)]; | |
| 1888 | 	char dfd_l_[PADL_(int)]; int dfd; char dfd_r_[PADR_(int)]; | |
| 1889 | 	char path_l_[PADL_(const char *)]; const char * path; char path_r_[PADR_(const char *)]; | |
| 1890 | 	char mask_l_[PADL_(uint32_t)]; uint32_t mask; char mask_r_[PADR_(uint32_t)]; | |
| 1891 | }; | |
| 1892 | struct inotify_rm_watch_args { | |
| 1893 | 	char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)]; | |
| 1894 | 	char wd_l_[PADL_(int)]; int wd; char wd_r_[PADR_(int)]; | |
| 1895 | }; | |
| 1896 | struct getgroups_args { | |
| 1897 | 	char gidsetsize_l_[PADL_(int)]; int gidsetsize; char gidsetsize_r_[PADR_(int)]; | |
| 1898 | 	char gidset_l_[PADL_(gid_t *)]; gid_t * gidset; char gidset_r_[PADR_(gid_t *)]; | |
| 1899 | }; | |
| 1900 | struct setgroups_args { | |
| 1901 | 	char gidsetsize_l_[PADL_(int)]; int gidsetsize; char gidsetsize_r_[PADR_(int)]; | |
| 1902 | 	char gidset_l_[PADL_(const gid_t *)]; const gid_t * gidset; char gidset_r_[PADR_(const gid_t *)]; | |
| 1903 | }; | |
| 1904 | struct jail_attach_jd_args { | |
| 1905 | 	char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)]; | |
| 1906 | }; | |
| 1907 | struct jail_remove_jd_args { | |
| 1908 | 	char fd_l_[PADL_(int)]; int fd; char fd_r_[PADR_(int)]; | |
| 1909 | }; | |
| 1910 | int	sys__exit(struct thread *, struct _exit_args *); | |
| 1892 | 1911 | int	sys_fork(struct thread *, struct fork_args *); |
| 1893 | 1912 | int	sys_read(struct thread *, struct read_args *); |
| 1894 | 1913 | int	sys_write(struct thread *, struct write_args *); |
| ... | ... | @@ -1940,14 +1959,10 @@ int	sys_umask(struct thread *, struct umask_args *); |
| 1940 | 1959 | int	sys_chroot(struct thread *, struct chroot_args *); |
| 1941 | 1960 | int	sys_msync(struct thread *, struct msync_args *); |
| 1942 | 1961 | int	sys_vfork(struct thread *, struct vfork_args *); |
| 1943 | int	sys_sbrk(struct thread *, struct sbrk_args *); | |
| 1944 | int	sys_sstk(struct thread *, struct sstk_args *); | |
| 1945 | 1962 | int	sys_munmap(struct thread *, struct munmap_args *); |
| 1946 | 1963 | int	sys_mprotect(struct thread *, struct mprotect_args *); |
| 1947 | 1964 | int	sys_madvise(struct thread *, struct madvise_args *); |
| 1948 | 1965 | int	sys_mincore(struct thread *, struct mincore_args *); |
| 1949 | int	sys_getgroups(struct thread *, struct getgroups_args *); | |
| 1950 | int	sys_setgroups(struct thread *, struct setgroups_args *); | |
| 1951 | 1966 | int	sys_getpgrp(struct thread *, struct getpgrp_args *); |
| 1952 | 1967 | int	sys_setpgid(struct thread *, struct setpgid_args *); |
| 1953 | 1968 | int	sys_setitimer(struct thread *, struct setitimer_args *); |
| ... | ... | @@ -2210,7 +2225,6 @@ int	sys_renameat(struct thread *, struct renameat_args *); |
| 2210 | 2225 | int	sys_symlinkat(struct thread *, struct symlinkat_args *); |
| 2211 | 2226 | int	sys_unlinkat(struct thread *, struct unlinkat_args *); |
| 2212 | 2227 | int	sys_posix_openpt(struct thread *, struct posix_openpt_args *); |
| 2213 | int	sys_gssd_syscall(struct thread *, struct gssd_syscall_args *); | |
| 2214 | 2228 | int	sys_jail_get(struct thread *, struct jail_get_args *); |
| 2215 | 2229 | int	sys_jail_set(struct thread *, struct jail_set_args *); |
| 2216 | 2230 | int	sys_jail_remove(struct thread *, struct jail_remove_args *); |
| ... | ... | @@ -2290,6 +2304,15 @@ int	sys_timerfd_gettime(struct thread *, struct timerfd_gettime_args *); |
| 2290 | 2304 | int	sys_timerfd_settime(struct thread *, struct timerfd_settime_args *); |
| 2291 | 2305 | int	sys_kcmp(struct thread *, struct kcmp_args *); |
| 2292 | 2306 | int	sys_getrlimitusage(struct thread *, struct getrlimitusage_args *); |
| 2307 | int	sys_fchroot(struct thread *, struct fchroot_args *); | |
| 2308 | int	sys_setcred(struct thread *, struct setcred_args *); | |
| 2309 | int	sys_exterrctl(struct thread *, struct exterrctl_args *); | |
| 2310 | int	sys_inotify_add_watch_at(struct thread *, struct inotify_add_watch_at_args *); | |
| 2311 | int	sys_inotify_rm_watch(struct thread *, struct inotify_rm_watch_args *); | |
| 2312 | int	sys_getgroups(struct thread *, struct getgroups_args *); | |
| 2313 | int	sys_setgroups(struct thread *, struct setgroups_args *); | |
| 2314 | int	sys_jail_attach_jd(struct thread *, struct jail_attach_jd_args *); | |
| 2315 | int	sys_jail_remove_jd(struct thread *, struct jail_remove_jd_args *); | |
| 2293 | 2316 | |
| 2294 | 2317 | #ifdef COMPAT_43 |
| 2295 | 2318 | |
| ... | ... | @@ -2781,7 +2804,23 @@ int	freebsd13_swapoff(struct thread *, struct freebsd13_swapoff_args *); |
| 2781 | 2804 | |
| 2782 | 2805 | #endif /* COMPAT_FREEBSD13 */ |
| 2783 | 2806 | |
| 2784 | #define	SYS_AUE_exit	AUE_EXIT | |
| 2807 | ||
| 2808 | #ifdef COMPAT_FREEBSD14 | |
| 2809 | ||
| 2810 | struct freebsd14_getgroups_args { | |
| 2811 | 	char gidsetsize_l_[PADL_(int)]; int gidsetsize; char gidsetsize_r_[PADR_(int)]; | |
| 2812 | 	char gidset_l_[PADL_(gid_t *)]; gid_t * gidset; char gidset_r_[PADR_(gid_t *)]; | |
| 2813 | }; | |
| 2814 | struct freebsd14_setgroups_args { | |
| 2815 | 	char gidsetsize_l_[PADL_(int)]; int gidsetsize; char gidsetsize_r_[PADR_(int)]; | |
| 2816 | 	char gidset_l_[PADL_(const gid_t *)]; const gid_t * gidset; char gidset_r_[PADR_(const gid_t *)]; | |
| 2817 | }; | |
| 2818 | int	freebsd14_getgroups(struct thread *, struct freebsd14_getgroups_args *); | |
| 2819 | int	freebsd14_setgroups(struct thread *, struct freebsd14_setgroups_args *); | |
| 2820 | ||
| 2821 | #endif /* COMPAT_FREEBSD14 */ | |
| 2822 | ||
| 2823 | #define	SYS_AUE__exit	AUE_EXIT | |
| 2785 | 2824 | #define	SYS_AUE_fork	AUE_FORK |
| 2786 | 2825 | #define	SYS_AUE_read	AUE_READ |
| 2787 | 2826 | #define	SYS_AUE_write	AUE_WRITE |
| ... | ... | @@ -2846,16 +2885,14 @@ int	freebsd13_swapoff(struct thread *, struct freebsd13_swapoff_args *); |
| 2846 | 2885 | #define	SYS_AUE_ogetpagesize	AUE_NULL |
| 2847 | 2886 | #define	SYS_AUE_msync	AUE_MSYNC |
| 2848 | 2887 | #define	SYS_AUE_vfork	AUE_VFORK |
| 2849 | #define	SYS_AUE_sbrk	AUE_SBRK | |
| 2850 | #define	SYS_AUE_sstk	AUE_SSTK | |
| 2851 | 2888 | #define	SYS_AUE_ommap	AUE_MMAP |
| 2852 | 2889 | #define	SYS_AUE_freebsd11_vadvise	AUE_O_VADVISE |
| 2853 | 2890 | #define	SYS_AUE_munmap	AUE_MUNMAP |
| 2854 | 2891 | #define	SYS_AUE_mprotect	AUE_MPROTECT |
| 2855 | 2892 | #define	SYS_AUE_madvise	AUE_MADVISE |
| 2856 | 2893 | #define	SYS_AUE_mincore	AUE_MINCORE |
| 2857 | #define	SYS_AUE_getgroups	AUE_GETGROUPS | |
| 2858 | #define	SYS_AUE_setgroups	AUE_SETGROUPS | |
| 2894 | #define	SYS_AUE_freebsd14_getgroups	AUE_GETGROUPS | |
| 2895 | #define	SYS_AUE_freebsd14_setgroups	AUE_SETGROUPS | |
| 2859 | 2896 | #define	SYS_AUE_getpgrp	AUE_GETPGRP |
| 2860 | 2897 | #define	SYS_AUE_setpgid	AUE_SETPGRP |
| 2861 | 2898 | #define	SYS_AUE_setitimer	AUE_SETITIMER |
| ... | ... | @@ -3185,7 +3222,6 @@ int	freebsd13_swapoff(struct thread *, struct freebsd13_swapoff_args *); |
| 3185 | 3222 | #define	SYS_AUE_symlinkat	AUE_SYMLINKAT |
| 3186 | 3223 | #define	SYS_AUE_unlinkat	AUE_UNLINKAT |
| 3187 | 3224 | #define	SYS_AUE_posix_openpt	AUE_POSIX_OPENPT |
| 3188 | #define	SYS_AUE_gssd_syscall	AUE_NULL | |
| 3189 | 3225 | #define	SYS_AUE_jail_get	AUE_JAIL_GET |
| 3190 | 3226 | #define	SYS_AUE_jail_set	AUE_JAIL_SET |
| 3191 | 3227 | #define	SYS_AUE_jail_remove	AUE_JAIL_REMOVE |
| ... | ... | @@ -3266,6 +3302,15 @@ int	freebsd13_swapoff(struct thread *, struct freebsd13_swapoff_args *); |
| 3266 | 3302 | #define	SYS_AUE_timerfd_settime	AUE_TIMERFD |
| 3267 | 3303 | #define	SYS_AUE_kcmp	AUE_NULL |
| 3268 | 3304 | #define	SYS_AUE_getrlimitusage	AUE_NULL |
| 3305 | #define	SYS_AUE_fchroot	AUE_NULL | |
| 3306 | #define	SYS_AUE_setcred	AUE_SETCRED | |
| 3307 | #define	SYS_AUE_exterrctl	AUE_NULL | |
| 3308 | #define	SYS_AUE_inotify_add_watch_at	AUE_INOTIFY | |
| 3309 | #define	SYS_AUE_inotify_rm_watch	AUE_INOTIFY | |
| 3310 | #define	SYS_AUE_getgroups	AUE_GETGROUPS | |
| 3311 | #define	SYS_AUE_setgroups	AUE_SETGROUPS | |
| 3312 | #define	SYS_AUE_jail_attach_jd	AUE_JAIL_ATTACH | |
| 3313 | #define	SYS_AUE_jail_remove_jd	AUE_JAIL_REMOVE | |
| 3269 | 3314 | |
| 3270 | 3315 | #undef PAD_ |
| 3271 | 3316 | #undef PADL_ |
lib/libc/include/generic-freebsd/sys/systm.h+54-32| ... | ... | @@ -32,8 +32,6 @@ |
| 32 | 32 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 33 | 33 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 34 | 34 | * SUCH DAMAGE. |
| 35 | * | |
| 36 | *	@(#)systm.h	8.7 (Berkeley) 3/29/95 | |
| 37 | 35 | */ |
| 38 | 36 | |
| 39 | 37 | #ifndef _SYS_SYSTM_H_ |
| ... | ... | @@ -81,7 +79,7 @@ extern u_long maxphys;		/* max raw I/O transfer size */ |
| 81 | 79 | */ |
| 82 | 80 | enum VM_GUEST { VM_GUEST_NO = 0, VM_GUEST_VM, VM_GUEST_XEN, VM_GUEST_HV, |
| 83 | 81 | 		VM_GUEST_VMWARE, VM_GUEST_KVM, VM_GUEST_BHYVE, VM_GUEST_VBOX, |
| 84 | 		VM_GUEST_PARALLELS, VM_GUEST_NVMM, VM_LAST }; | |
| 82 | 		VM_GUEST_PARALLELS, VM_GUEST_NVMM, VM_GUEST_LAST }; | |
| 85 | 83 | |
| 86 | 84 | #endif /* KERNEL */ |
| 87 | 85 | |
| ... | ... | @@ -101,17 +99,15 @@ struct ucred; |
| 101 | 99 | #include <sys/pcpu.h>		/* curthread */ |
| 102 | 100 | #include <sys/kpilite.h> |
| 103 | 101 | |
| 102 | extern bool scheduler_stopped; | |
| 103 | ||
| 104 | 104 | /* |
| 105 | 105 | * If we have already panic'd and this is the thread that called |
| 106 | 106 | * panic(), then don't block on any mutexes but silently succeed. |
| 107 | 107 | * Otherwise, the kernel will deadlock since the scheduler isn't |
| 108 | 108 | * going to run the thread that holds any lock we need. |
| 109 | 109 | */ |
| 110 | #define	SCHEDULER_STOPPED_TD(td) ({					\ | |
| 111 | 	MPASS((td) == curthread);					\ | |
| 112 | 	__predict_false((td)->td_stopsched);				\ | |
| 113 | }) | |
| 114 | #define	SCHEDULER_STOPPED() SCHEDULER_STOPPED_TD(curthread) | |
| 110 | #define	SCHEDULER_STOPPED()	__predict_false(scheduler_stopped) | |
| 115 | 111 | |
| 116 | 112 | extern const int osreldate; |
| 117 | 113 | |
| ... | ... | @@ -212,6 +208,16 @@ critical_exit(void) |
| 212 | 208 | #ifdef EARLY_PRINTF |
| 213 | 209 | typedef void early_putc_t(int ch); |
| 214 | 210 | extern early_putc_t *early_putc; |
| 211 | #define	CHECK_EARLY_PRINTF(x)	\ | |
| 212 | __CONCAT(early_printf_, EARLY_PRINTF) == __CONCAT(early_printf_, x) | |
| 213 | #define	early_printf_1		1 | |
| 214 | #define	early_printf_mvebu	2 | |
| 215 | #define	early_printf_ns8250	3 | |
| 216 | #define	early_printf_pl011	4 | |
| 217 | #define	early_printf_snps	5 | |
| 218 | #define	early_printf_sbi	6 | |
| 219 | #else | |
| 220 | #define	CHECK_EARLY_PRINTF(x)	0 | |
| 215 | 221 | #endif |
| 216 | 222 | int	kvprintf(char const *, void (*)(int, void*), void *, int, |
| 217 | 223 | 	 __va_list) __printflike(1, 0); |
| ... | ... | @@ -296,17 +302,18 @@ void	*memmove_early(void * _Nonnull dest, const void * _Nonnull src, size_t n); |
| 296 | 302 | 	((__r >= __len) ? ENAMETOOLONG : 0);			\ |
| 297 | 303 | }) |
| 298 | 304 | |
| 299 | int	copyinstr(const void * __restrict udaddr, | |
| 300 | 	 void * _Nonnull __restrict kaddr, size_t len, | |
| 301 | 	 size_t * __restrict lencopied); | |
| 302 | int	copyin(const void * __restrict udaddr, | |
| 303 | 	 void * _Nonnull __restrict kaddr, size_t len); | |
| 304 | int	copyin_nofault(const void * __restrict udaddr, | |
| 305 | 	 void * _Nonnull __restrict kaddr, size_t len); | |
| 306 | int	copyout(const void * _Nonnull __restrict kaddr, | |
| 307 | 	 void * __restrict udaddr, size_t len); | |
| 308 | int	copyout_nofault(const void * _Nonnull __restrict kaddr, | |
| 309 | 	 void * __restrict udaddr, size_t len); | |
| 305 | int __result_use_check copyinstr(const void * __restrict udaddr, | |
| 306 | void * _Nonnull __restrict kaddr, size_t len, | |
| 307 | size_t * __restrict lencopied); | |
| 308 | int __result_use_check copyin(const void * __restrict udaddr, | |
| 309 | void * _Nonnull __restrict kaddr, size_t len); | |
| 310 | int __result_use_check copyin_nofault(const void * __restrict udaddr, | |
| 311 | void * _Nonnull __restrict kaddr, size_t len); | |
| 312 | __nodiscard int copyout(const void * _Nonnull __restrict kaddr, | |
| 313 | void * __restrict udaddr, size_t len); | |
| 314 | __nodiscard int copyout_nofault( | |
| 315 | const void * _Nonnull __restrict kaddr, void * __restrict udaddr, | |
| 316 | size_t len); | |
| 310 | 317 | |
| 311 | 318 | #ifdef SAN_NEEDS_INTERCEPTORS |
| 312 | 319 | int	SAN_INTERCEPTOR(copyin)(const void *, void *, size_t); |
| ... | ... | @@ -324,14 +331,14 @@ long	fuword(volatile const void *base); |
| 324 | 331 | int	fuword16(volatile const void *base); |
| 325 | 332 | int32_t	fuword32(volatile const void *base); |
| 326 | 333 | int64_t	fuword64(volatile const void *base); |
| 327 | int	fueword(volatile const void *base, long *val); | |
| 328 | int	fueword32(volatile const void *base, int32_t *val); | |
| 329 | int	fueword64(volatile const void *base, int64_t *val); | |
| 330 | int	subyte(volatile void *base, int byte); | |
| 331 | int	suword(volatile void *base, long word); | |
| 332 | int	suword16(volatile void *base, int word); | |
| 333 | int	suword32(volatile void *base, int32_t word); | |
| 334 | int	suword64(volatile void *base, int64_t word); | |
| 334 | int __result_use_check fueword(volatile const void *base, long *val); | |
| 335 | int __result_use_check fueword32(volatile const void *base, int32_t *val); | |
| 336 | int __result_use_check fueword64(volatile const void *base, int64_t *val); | |
| 337 | __nodiscard int subyte(volatile void *base, int byte); | |
| 338 | __nodiscard int suword(volatile void *base, long word); | |
| 339 | __nodiscard int suword16(volatile void *base, int word); | |
| 340 | __nodiscard int suword32(volatile void *base, int32_t word); | |
| 341 | __nodiscard int suword64(volatile void *base, int64_t word); | |
| 335 | 342 | uint32_t casuword32(volatile uint32_t *base, uint32_t oldval, uint32_t newval); |
| 336 | 343 | u_long	casuword(volatile u_long *p, u_long oldval, u_long newval); |
| 337 | 344 | int	casueword32(volatile uint32_t *base, uint32_t oldval, uint32_t *oldvalp, |
| ... | ... | @@ -559,17 +566,32 @@ void counted_warning(unsigned *counter, const char *msg); |
| 559 | 566 | /* |
| 560 | 567 | * APIs to manage deprecation and obsolescence. |
| 561 | 568 | */ |
| 562 | void _gone_in(int major, const char *msg); | |
| 563 | void _gone_in_dev(device_t dev, int major, const char *msg); | |
| 569 | void _gone_in(int major, const char *msg, ...) __printflike(2, 3); | |
| 570 | void _gone_in_dev(device_t dev, int major, const char *msg, ...) | |
| 571 | __printflike(3, 4); | |
| 564 | 572 | #ifdef NO_OBSOLETE_CODE |
| 565 | 573 | #define __gone_ok(m, msg)					 \ |
| 566 | 574 | 	_Static_assert(m < P_OSREL_MAJOR(__FreeBSD_version)),	 \ |
| 567 | 	 "Obsolete code: " msg); | |
| 575 | 	 "Obsolete code: " msg) | |
| 568 | 576 | #else |
| 569 | 577 | #define	__gone_ok(m, msg) |
| 570 | 578 | #endif |
| 571 | #define gone_in(major, msg)		__gone_ok(major, msg) _gone_in(major, msg) | |
| 572 | #define gone_in_dev(dev, major, msg)	__gone_ok(major, msg) _gone_in_dev(dev, major, msg) | |
| 579 | #define gone_in(major, msg, ...)	do {				\ | |
| 580 | 	static bool __read_mostly __gone_in_ ## __LINE__ = true;	\ | |
| 581 | 	__gone_ok(major, msg);						\ | |
| 582 | 	if (__predict_false(__gone_in_ ## __LINE__)) {			\ | |
| 583 | 		__gone_in_ ## __LINE__ = false;				\ | |
| 584 | 		_gone_in(major, msg __VA_OPT__(,) __VA_ARGS__);		\ | |
| 585 | 	}								\ | |
| 586 | } while (0) | |
| 587 | #define gone_in_dev(dev, major, msg, ...)	do {			\ | |
| 588 | 	static bool __read_mostly __gone_in_ ## __LINE__ = true;	\ | |
| 589 | 	__gone_ok(major, msg);						\ | |
| 590 | 	if (__predict_false(__gone_in_ ## __LINE__)) {			\ | |
| 591 | 		__gone_in_ ## __LINE__ = false;				\ | |
| 592 | 		_gone_in_dev(dev, major, msg __VA_OPT__(,) __VA_ARGS__);\ | |
| 593 | 	}								\ | |
| 594 | } while (0) | |
| 573 | 595 | |
| 574 | 596 | #ifdef INVARIANTS |
| 575 | 597 | #define	__diagused |
lib/libc/include/generic-freebsd/sys/taskqueue.h+6| ... | ... | @@ -215,4 +215,10 @@ struct taskqueue *taskqueue_create_fast(const char *name, int mflags, |
| 215 | 215 | 				 taskqueue_enqueue_fn enqueue, |
| 216 | 216 | 				 void *context); |
| 217 | 217 | |
| 218 | /* | |
| 219 | * This queue is used to process asynchronous device events such as | |
| 220 | * hot plug insertion and removal of devices. | |
| 221 | */ | |
| 222 | TASKQUEUE_DECLARE(bus); | |
| 223 | ||
| 218 | 224 | #endif /* !_SYS_TASKQUEUE_H_ */ |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/sys/thr.h+1| ... | ... | @@ -43,6 +43,7 @@ typedef __size_t	size_t; |
| 43 | 43 | #define	THR_SUSPENDED		0x0001 |
| 44 | 44 | /* Create the system scope thread. */ |
| 45 | 45 | #define	THR_SYSTEM_SCOPE	0x0002 |
| 46 | #define	THR_C_RUNTIME		0x0004 | |
| 46 | 47 | |
| 47 | 48 | struct thr_param { |
| 48 | 49 | void	(*start_func)(void *);	/* thread entry function. */ |
lib/libc/include/generic-freebsd/sys/time.h+2-2| ... | ... | @@ -27,8 +27,6 @@ |
| 27 | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | * | |
| 31 | *	@(#)time.h	8.5 (Berkeley) 5/4/95 | |
| 32 | 30 | */ |
| 33 | 31 | |
| 34 | 32 | #ifndef _SYS_TIME_H_ |
| ... | ... | @@ -613,7 +611,9 @@ int	tvtohz(struct timeval *tv); |
| 613 | 611 | #include <time.h> |
| 614 | 612 | |
| 615 | 613 | #include <sys/cdefs.h> |
| 614 | #ifndef _STANDALONE | |
| 616 | 615 | #include <sys/select.h> |
| 616 | #endif | |
| 617 | 617 | |
| 618 | 618 | __BEGIN_DECLS |
| 619 | 619 | int	setitimer(int, const struct itimerval *, struct itimerval *); |
lib/libc/include/generic-freebsd/sys/timeb.h-2| ... | ... | @@ -32,8 +32,6 @@ |
| 32 | 32 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 33 | 33 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 34 | 34 | * SUCH DAMAGE. |
| 35 | * | |
| 36 | *	@(#)timeb.h	8.2 (Berkeley) 1/21/94 | |
| 37 | 35 | */ |
| 38 | 36 | |
| 39 | 37 | #ifndef _SYS_TIMEB_H_ |
lib/libc/include/generic-freebsd/sys/timeffc.h+3-1| ... | ... | @@ -89,7 +89,7 @@ extern int sysclock_active; |
| 89 | 89 | *			of the kernel tick timer (1/hz [s]). |
| 90 | 90 | * FFCLOCK_LERP:	Linear interpolation of ffclock time to guarantee |
| 91 | 91 | *			monotonic time. |
| 92 | * FFCLOCK_LEAPSEC:	Include leap seconds. | |
| 92 | * {FB|FF}CLOCK_LEAPSEC: Include leap seconds. | |
| 93 | 93 | * {FB|FF}CLOCK_UPTIME:	Time stamp should be relative to system boot, not epoch. |
| 94 | 94 | */ |
| 95 | 95 | #define	FFCLOCK_FAST		0x00000001 |
| ... | ... | @@ -100,6 +100,7 @@ extern int sysclock_active; |
| 100 | 100 | |
| 101 | 101 | #define	FBCLOCK_FAST		0x00010000 /* Currently unused. */ |
| 102 | 102 | #define	FBCLOCK_UPTIME		0x00020000 |
| 103 | #define	FBCLOCK_LEAPSEC		0x00040000 | |
| 103 | 104 | #define	FBCLOCK_MASK		0xffff0000 |
| 104 | 105 | |
| 105 | 106 | /* |
| ... | ... | @@ -111,6 +112,7 @@ struct fbclock_info { |
| 111 | 112 | 	struct bintime		error; |
| 112 | 113 | 	struct bintime		tick_time; |
| 113 | 114 | 	uint64_t		th_scale; |
| 115 | 	long			th_tai_offset; | |
| 114 | 116 | 	int			status; |
| 115 | 117 | }; |
| 116 | 118 |
lib/libc/include/generic-freebsd/sys/times.h-2| ... | ... | @@ -32,8 +32,6 @@ |
| 32 | 32 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 33 | 33 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 34 | 34 | * SUCH DAMAGE. |
| 35 | * | |
| 36 | *	@(#)times.h	8.4 (Berkeley) 1/21/94 | |
| 37 | 35 | */ |
| 38 | 36 | |
| 39 | 37 | #ifndef	_SYS_TIMES_H_ |
lib/libc/include/generic-freebsd/sys/timespec.h-3| ... | ... | @@ -27,9 +27,6 @@ |
| 27 | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | * | |
| 31 | *	@(#)time.h	8.5 (Berkeley) 5/4/95 | |
| 32 | * from: FreeBSD: src/sys/sys/time.h,v 1.43 2000/03/20 14:09:05 phk Exp | |
| 33 | 30 | */ |
| 34 | 31 | |
| 35 | 32 | #ifndef _SYS_TIMESPEC_H_ |
lib/libc/include/generic-freebsd/sys/timetc.h+2-2| ... | ... | @@ -49,7 +49,7 @@ struct timecounter { |
| 49 | 49 | 		 * This function is optional. It will be called whenever the |
| 50 | 50 | 		 * timecounter is rewound, and is intended to check for PPS |
| 51 | 51 | 		 * events. Normal hardware does not need it but timecounters |
| 52 | 		 * which latch PPS in hardware (like sys/pci/xrpu.c) do. | |
| 52 | 		 * which latch PPS in hardware do. | |
| 53 | 53 | 		 */ |
| 54 | 54 | 	u_int 			tc_counter_mask; |
| 55 | 55 | 		/* This mask should mask off any unimplemented bits. */ |
| ... | ... | @@ -87,7 +87,7 @@ extern int tc_min_ticktock_freq; /* |
| 87 | 87 | u_int64_t tc_getfrequency(void); |
| 88 | 88 | void	tc_init(struct timecounter *tc); |
| 89 | 89 | void	tc_setclock(struct timespec *ts); |
| 90 | void	tc_ticktock(int cnt); | |
| 90 | void	tc_ticktock(long cnt); | |
| 91 | 91 | void	cpu_tick_calibration(void); |
| 92 | 92 | |
| 93 | 93 | #ifdef SYSCTL_DECL |
lib/libc/include/generic-freebsd/sys/timex.h+1-1| ... | ... | @@ -154,7 +154,7 @@ struct timex { |
| 154 | 154 | #ifdef __FreeBSD__ |
| 155 | 155 | |
| 156 | 156 | #ifdef _KERNEL |
| 157 | void	ntp_update_second(int64_t *adjustment, time_t *newsec); | |
| 157 | void	ntp_update_second(int64_t *adjustment, time_t *newsec, long *tai_off); | |
| 158 | 158 | #else /* !_KERNEL */ |
| 159 | 159 | #include <sys/cdefs.h> |
| 160 | 160 |
lib/libc/include/generic-freebsd/sys/ttycom.h+2-4| ... | ... | @@ -32,8 +32,6 @@ |
| 32 | 32 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 33 | 33 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 34 | 34 | * SUCH DAMAGE. |
| 35 | * | |
| 36 | *	@(#)ttycom.h	8.1 (Berkeley) 3/28/94 | |
| 37 | 35 | */ |
| 38 | 36 | |
| 39 | 37 | #ifndef	_SYS_TTYCOM_H_ |
| ... | ... | @@ -71,8 +69,8 @@ |
| 71 | 69 | 						/* 89-91 conflicts: tun and tap */ |
| 72 | 70 | #define	TIOCTIMESTAMP	_IOR('t', 89, struct timeval)	/* enable/get timestamp |
| 73 | 71 | 						 * of last input event */ |
| 74 | #define	TIOCMGDTRWAIT	_IOR('t', 90, int)	/* modem: get wait on close */ | |
| 75 | #define	TIOCMSDTRWAIT	_IOW('t', 91, int)	/* modem: set wait on close */ | |
| 72 | /*	TIOCMGDTRWAIT	_IOR('t', 90, int)	 * was modem: get wait on close */ | |
| 73 | /*	TIOCMSDTRWAIT	_IOW('t', 91, int)	 * was modem: set wait on close */ | |
| 76 | 74 | 						/* 92-93 tun and tap */ |
| 77 | 75 | 						/* 94-97 conflicts: tun and tap */ |
| 78 | 76 | #define	TIOCDRAIN	 _IO('t', 94)		/* wait till output drained */ |
lib/libc/include/generic-freebsd/sys/ttydefaults.h-2| ... | ... | @@ -32,8 +32,6 @@ |
| 32 | 32 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 33 | 33 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 34 | 34 | * SUCH DAMAGE. |
| 35 | * | |
| 36 | *	@(#)ttydefaults.h	8.4 (Berkeley) 1/21/94 | |
| 37 | 35 | */ |
| 38 | 36 | |
| 39 | 37 | /* |
lib/libc/include/generic-freebsd/sys/types.h+4-2| ... | ... | @@ -32,8 +32,6 @@ |
| 32 | 32 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 33 | 33 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 34 | 34 | * SUCH DAMAGE. |
| 35 | * | |
| 36 | *	@(#)types.h	8.6 (Berkeley) 2/19/95 | |
| 37 | 35 | */ |
| 38 | 36 | |
| 39 | 37 | #ifndef _SYS_TYPES_H_ |
| ... | ... | @@ -299,9 +297,11 @@ typedef	struct vm_page	*vm_page_t; |
| 299 | 297 | #if	defined(_KERNEL) || defined(_STANDALONE) |
| 300 | 298 | #if !defined(__bool_true_false_are_defined) && !defined(__cplusplus) |
| 301 | 299 | #define	__bool_true_false_are_defined	1 |
| 300 | #if __STDC_VERSION__ < 202311L | |
| 302 | 301 | #define	false	0 |
| 303 | 302 | #define	true	1 |
| 304 | 303 | typedef	_Bool	bool; |
| 304 | #endif /* __STDC_VERSION__ < 202311L */ | |
| 305 | 305 | #endif /* !__bool_true_false_are_defined && !__cplusplus */ |
| 306 | 306 | #endif /* KERNEL || _STANDALONE */ |
| 307 | 307 | |
| ... | ... | @@ -313,7 +313,9 @@ typedef	_Bool	bool; |
| 313 | 313 | |
| 314 | 314 | #if __BSD_VISIBLE |
| 315 | 315 | |
| 316 | #ifndef _STANDALONE | |
| 316 | 317 | #include <sys/select.h> |
| 318 | #endif | |
| 317 | 319 | |
| 318 | 320 | /* |
| 319 | 321 | * The major and minor numbers are encoded in dev_t as MMMmmmMm (where |
lib/libc/include/generic-freebsd/sys/ucoredump.h created+99| ... | ... | @@ -0,0 +1,99 @@ |
| 1 | /* | |
| 2 | * | |
| 3 | * Copyright (c) 2015 Mark Johnston <markj@FreeBSD.org> | |
| 4 | * Copyright (c) 2025 Kyle Evans <kevans@FreeBSD.org> | |
| 5 | * | |
| 6 | * SPDX-License-Identifier: BSD-2-Clause | |
| 7 | * | |
| 8 | */ | |
| 9 | ||
| 10 | #ifndef _SYS_UCOREDUMP_H_ | |
| 11 | #define _SYS_UCOREDUMP_H_ | |
| 12 | ||
| 13 | #ifdef _KERNEL | |
| 14 | ||
| 15 | #include <sys/_uio.h> | |
| 16 | #include <sys/blockcount.h> | |
| 17 | #include <sys/queue.h> | |
| 18 | ||
| 19 | /* Coredump output parameters. */ | |
| 20 | struct coredump_params; | |
| 21 | struct coredump_writer; | |
| 22 | struct thread; | |
| 23 | struct ucred; | |
| 24 | ||
| 25 | typedef int coredump_init_fn(const struct coredump_writer *, | |
| 26 | const struct coredump_params *); | |
| 27 | typedef int coredump_write_fn(const struct coredump_writer *, const void *, size_t, | |
| 28 | off_t, enum uio_seg, struct ucred *, size_t *, struct thread *); | |
| 29 | typedef int coredump_extend_fn(const struct coredump_writer *, off_t, | |
| 30 | struct ucred *); | |
| 31 | ||
| 32 | struct coredump_vnode_ctx { | |
| 33 | 	struct vnode	*vp; | |
| 34 | 	struct ucred	*fcred; | |
| 35 | }; | |
| 36 | ||
| 37 | coredump_write_fn core_vn_write; | |
| 38 | coredump_extend_fn core_vn_extend; | |
| 39 | ||
| 40 | struct coredump_writer { | |
| 41 | 	void			*ctx; | |
| 42 | 	coredump_init_fn	*init_fn; | |
| 43 | 	coredump_write_fn	*write_fn; | |
| 44 | 	coredump_extend_fn	*extend_fn; | |
| 45 | }; | |
| 46 | ||
| 47 | struct coredump_params { | |
| 48 | 	off_t		offset; | |
| 49 | 	struct ucred	*active_cred; | |
| 50 | 	struct thread	*td; | |
| 51 | 	const struct coredump_writer	*cdw; | |
| 52 | 	struct compressor *comp; | |
| 53 | }; | |
| 54 | ||
| 55 | #define CORE_BUF_SIZE (16 * 1024) | |
| 56 | ||
| 57 | int core_write(struct coredump_params *, const void *, size_t, off_t, | |
| 58 | enum uio_seg, size_t *); | |
| 59 | int core_output(char *, size_t, off_t, struct coredump_params *, void *); | |
| 60 | int sbuf_drain_core_output(void *, const char *, int); | |
| 61 | ||
| 62 | extern int coredump_pack_fileinfo; | |
| 63 | extern int coredump_pack_vmmapinfo; | |
| 64 | ||
| 65 | extern int compress_user_cores; | |
| 66 | extern int compress_user_cores_level; | |
| 67 | ||
| 68 | typedef int coredumper_probe_fn(struct thread *); | |
| 69 | ||
| 70 | /* | |
| 71 | * Some arbitrary values for coredumper probes to return. The highest priority | |
| 72 | * we can find wins. It's somewhat expected that a coredumper may want to bid | |
| 73 | * differently based on the process in question. Note that probe functions will | |
| 74 | * be called with the proc lock held, so they must not sleep. | |
| 75 | */ | |
| 76 | #define	COREDUMPER_NOMATCH		(-1)	/* Decline to touch it */ | |
| 77 | #define	COREDUMPER_GENERIC		(0)	/* I handle coredumps */ | |
| 78 | #define	COREDUMPER_SPECIAL		(50)	/* Special handler */ | |
| 79 | #define	COREDUMPER_HIGH_PRIORITY	(100)	/* High-priority handler */ | |
| 80 | ||
| 81 | /* | |
| 82 | * The handle functions will be called with the proc lock held, and should | |
| 83 | * return with the proc lock dropped. | |
| 84 | */ | |
| 85 | typedef int coredumper_handle_fn(struct thread *, off_t); | |
| 86 | ||
| 87 | struct coredumper { | |
| 88 | 	SLIST_ENTRY(coredumper)	 cd_entry; | |
| 89 | 	const char		*cd_name; | |
| 90 | 	coredumper_probe_fn	*cd_probe; | |
| 91 | 	coredumper_handle_fn	*cd_handle; | |
| 92 | 	blockcount_t		 cd_refcount; | |
| 93 | }; | |
| 94 | ||
| 95 | void coredumper_register(struct coredumper *); | |
| 96 | void coredumper_unregister(struct coredumper *); | |
| 97 | ||
| 98 | #endif	/* _KERNEL */ | |
| 99 | #endif	/* _SYS_UCOREDUMP_H_ */ | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/sys/ucred.h+136-25| ... | ... | @@ -27,22 +27,36 @@ |
| 27 | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | * | |
| 31 | *	@(#)ucred.h	8.4 (Berkeley) 1/9/95 | |
| 32 | 30 | */ |
| 33 | 31 | |
| 34 | 32 | #ifndef _SYS_UCRED_H_ |
| 35 | 33 | #define	_SYS_UCRED_H_ |
| 36 | 34 | |
| 35 | #include <sys/types.h> | |
| 37 | 36 | #if defined(_KERNEL) || defined(_WANT_UCRED) |
| 38 | 37 | #include <sys/_lock.h> |
| 39 | 38 | #include <sys/_mutex.h> |
| 40 | 39 | #endif |
| 41 | 40 | #include <bsm/audit.h> |
| 42 | 41 | |
| 43 | struct loginclass; | |
| 42 | #if defined(_KERNEL) || defined(_WANT_UCRED) | |
| 43 | /* | |
| 44 | * Flags for cr_flags. | |
| 45 | */ | |
| 46 | #define	CRED_FLAG_CAPMODE	0x00000001	/* In capability mode. */ | |
| 47 | #define	CRED_FLAG_GROUPSET	0x00000002	/* Groups have been set. */ | |
| 44 | 48 | |
| 45 | #define	XU_NGROUPS	16 | |
| 49 | /* | |
| 50 | * Number of groups inlined in 'struct ucred'. It must stay reasonably low as | |
| 51 | * it is also used by some functions to allocate an array of this size on the | |
| 52 | * stack. | |
| 53 | */ | |
| 54 | #define	CRED_SMALLGROUPS_NB	16 | |
| 55 | ||
| 56 | struct label; | |
| 57 | struct loginclass; | |
| 58 | struct prison; | |
| 59 | struct uidinfo; | |
| 46 | 60 | |
| 47 | 61 | /* |
| 48 | 62 | * Credentials. |
| ... | ... | @@ -57,39 +71,37 @@ struct loginclass; |
| 57 | 71 | * |
| 58 | 72 | * See "Credential management" comment in kern_prot.c for more information. |
| 59 | 73 | */ |
| 60 | #if defined(_KERNEL) || defined(_WANT_UCRED) | |
| 61 | 74 | struct ucred { |
| 62 | 75 | 	struct mtx cr_mtx; |
| 63 | 76 | 	long	cr_ref;			/* (c) reference count */ |
| 64 | 77 | 	u_int	cr_users;		/* (c) proc + thread using this cred */ |
| 65 | 78 | 	u_int	cr_flags;		/* credential flags */ |
| 66 | 79 | 	struct auditinfo_addr	cr_audit;	/* Audit properties. */ |
| 80 | 	int	cr_ngroups;		/* number of supplementary groups */ | |
| 67 | 81 | #define	cr_startcopy cr_uid |
| 68 | 82 | 	uid_t	cr_uid;			/* effective user id */ |
| 69 | 83 | 	uid_t	cr_ruid;		/* real user id */ |
| 70 | 84 | 	uid_t	cr_svuid;		/* saved user id */ |
| 71 | 	int	cr_ngroups;		/* number of groups */ | |
| 85 | 	gid_t	cr_gid;			/* effective group id */ | |
| 72 | 86 | 	gid_t	cr_rgid;		/* real group id */ |
| 73 | 87 | 	gid_t	cr_svgid;		/* saved group id */ |
| 74 | 88 | 	struct uidinfo	*cr_uidinfo;	/* per euid resource consumption */ |
| 75 | 89 | 	struct uidinfo	*cr_ruidinfo;	/* per ruid resource consumption */ |
| 76 | 90 | 	struct prison	*cr_prison;	/* jail(2) */ |
| 77 | 91 | 	struct loginclass	*cr_loginclass; /* login class */ |
| 78 | 	void 		*cr_pspare2[2];	/* general use 2 */ | |
| 92 | 	void		*cr_pspare2[2];	/* general use 2 */ | |
| 79 | 93 | #define	cr_endcopy	cr_label |
| 80 | 94 | 	struct label	*cr_label;	/* MAC label */ |
| 81 | 95 | 	gid_t	*cr_groups;		/* groups */ |
| 82 | 96 | 	int	cr_agroups;		/* Available groups */ |
| 83 | 	gid_t cr_smallgroups[XU_NGROUPS];	/* storage for small groups */ | |
| 97 | 	/* storage for small groups */ | |
| 98 | 	gid_t cr_smallgroups[CRED_SMALLGROUPS_NB]; | |
| 84 | 99 | }; |
| 85 | 100 | #define	NOCRED	((struct ucred *)0)	/* no credential available */ |
| 86 | 101 | #define	FSCRED	((struct ucred *)-1)	/* filesystem credential */ |
| 87 | 102 | #endif /* _KERNEL || _WANT_UCRED */ |
| 88 | 103 | |
| 89 | /* | |
| 90 | * Flags for cr_flags. | |
| 91 | */ | |
| 92 | #define	CRED_FLAG_CAPMODE	0x00000001	/* In capability mode. */ | |
| 104 | #define	XU_NGROUPS	16 | |
| 93 | 105 | |
| 94 | 106 | /* |
| 95 | 107 | * This is the external representation of struct ucred. |
| ... | ... | @@ -97,8 +109,26 @@ struct ucred { |
| 97 | 109 | struct xucred { |
| 98 | 110 | 	u_int	cr_version;		/* structure layout version */ |
| 99 | 111 | 	uid_t	cr_uid;			/* effective user id */ |
| 100 | 	short	cr_ngroups;		/* number of groups */ | |
| 101 | 	gid_t	cr_groups[XU_NGROUPS];	/* groups */ | |
| 112 | 	short	cr_ngroups;		/* number of groups (incl. cr_gid). */ | |
| 113 | 	union { | |
| 114 | 		/* | |
| 115 | 		 * The effective GID has been the first element of cr_groups[] | |
| 116 | 		 * for historical reasons. It should be accessed using the | |
| 117 | 		 * 'cr_gid' identifier. Supplementary groups should be accessed | |
| 118 | 		 * using cr_sgroups[]. Note that 'cr_ngroups' currently | |
| 119 | 		 * includes the effective GID. | |
| 120 | 		 * | |
| 121 | 		 * XXXOC: On the next API change (requires versioning), please | |
| 122 | 		 * replace this union with a true unaliased field 'cr_gid' and | |
| 123 | 		 * make sure that cr_groups[]/'cr_ngroups' only account for | |
| 124 | 		 * supplementary groups. | |
| 125 | 		 */ | |
| 126 | 		struct { | |
| 127 | 			gid_t	cr_gid;		/* effective group id */ | |
| 128 | 			gid_t	cr_sgroups[XU_NGROUPS - 1]; | |
| 129 | 		}; | |
| 130 | 		gid_t	cr_groups[XU_NGROUPS];	/* groups */ | |
| 131 | 	}; | |
| 102 | 132 | 	union { |
| 103 | 133 | 		void	*_cr_unused1;	/* compatibility with old ucred */ |
| 104 | 134 | 		pid_t	cr_pid; |
| ... | ... | @@ -106,17 +136,77 @@ struct xucred { |
| 106 | 136 | }; |
| 107 | 137 | #define	XUCRED_VERSION	0 |
| 108 | 138 | |
| 109 | /* This can be used for both ucred and xucred structures. */ | |
| 110 | #define	cr_gid cr_groups[0] | |
| 139 | struct mac; | |
| 140 | /* | |
| 141 | * Structure to pass as an argument to the setcred() system call. | |
| 142 | */ | |
| 143 | struct setcred { | |
| 144 | 	uid_t	 sc_uid;		/* effective user id */ | |
| 145 | 	uid_t	 sc_ruid;		/* real user id */ | |
| 146 | 	uid_t	 sc_svuid;		/* saved user id */ | |
| 147 | 	gid_t	 sc_gid;		/* effective group id */ | |
| 148 | 	gid_t	 sc_rgid;		/* real group id */ | |
| 149 | 	gid_t	 sc_svgid;		/* saved group id */ | |
| 150 | 	u_int	 sc_pad;		/* see 32-bit compat structure */ | |
| 151 | 	u_int	 sc_supp_groups_nb;	/* number of supplementary groups */ | |
| 152 | 	gid_t	*sc_supp_groups;	/* supplementary groups */ | |
| 153 | 	struct mac *sc_label;		/* MAC label */ | |
| 154 | }; | |
| 155 | /* | |
| 156 | * Initializer for 'struct setcred' variables. | |
| 157 | */ | |
| 158 | #define	SETCRED_INITIALIZER	{ -1, -1, -1, -1, -1, -1, 0, 0, NULL, NULL } | |
| 159 | ||
| 160 | /* | |
| 161 | * Flags to setcred(). | |
| 162 | */ | |
| 163 | #define	SETCREDF_UID		(1u << 0) | |
| 164 | #define	SETCREDF_RUID		(1u << 1) | |
| 165 | #define	SETCREDF_SVUID		(1u << 2) | |
| 166 | #define	SETCREDF_GID		(1u << 3) | |
| 167 | #define	SETCREDF_RGID		(1u << 4) | |
| 168 | #define	SETCREDF_SVGID		(1u << 5) | |
| 169 | #define	SETCREDF_SUPP_GROUPS	(1u << 6) | |
| 170 | #define	SETCREDF_MAC_LABEL	(1u << 7) | |
| 111 | 171 | |
| 112 | 172 | #ifdef _KERNEL |
| 113 | struct proc; | |
| 173 | /* | |
| 174 | * Masks of the currently valid flags to setcred(). | |
| 175 | * | |
| 176 | * Please consider reserving some of the high bits in the 'flags' argument for | |
| 177 | * versioning when almost all of them are in use. | |
| 178 | */ | |
| 179 | #define	SETCREDF_MASK	(SETCREDF_UID | SETCREDF_RUID | SETCREDF_SVUID | \ | |
| 180 | SETCREDF_GID | SETCREDF_RGID | SETCREDF_SVGID | SETCREDF_SUPP_GROUPS | \ | |
| 181 | SETCREDF_MAC_LABEL) | |
| 182 | ||
| 183 | struct setcred32 { | |
| 184 | #define	setcred32_copy_start	sc_uid | |
| 185 | 	uid_t	 sc_uid; | |
| 186 | 	uid_t	 sc_ruid; | |
| 187 | 	uid_t	 sc_svuid; | |
| 188 | 	gid_t	 sc_gid; | |
| 189 | 	gid_t	 sc_rgid; | |
| 190 | 	gid_t	 sc_svgid; | |
| 191 | 	u_int	 sc_pad; | |
| 192 | 	u_int	 sc_supp_groups_nb; | |
| 193 | #define	setcred32_copy_end	sc_supp_groups | |
| 194 | 	uint32_t sc_supp_groups;	/* gid_t [*] */ | |
| 195 | 	uint32_t sc_label;		/* struct mac32 [*] */ | |
| 196 | }; | |
| 197 | ||
| 114 | 198 | struct thread; |
| 115 | 199 | |
| 200 | /* Common native and 32-bit compatibility entry point. */ | |
| 201 | int user_setcred(struct thread *td, const u_int flags, | |
| 202 | const void *const uwcred, const size_t size, bool is_32bit); | |
| 203 | ||
| 204 | struct proc; | |
| 205 | ||
| 116 | 206 | struct credbatch { |
| 117 | 207 | 	struct ucred *cred; |
| 118 | 	int users; | |
| 119 | 	int ref; | |
| 208 | 	u_int users; | |
| 209 | 	long ref; | |
| 120 | 210 | }; |
| 121 | 211 | |
| 122 | 212 | static inline void |
| ... | ... | @@ -146,9 +236,9 @@ void	crcopy(struct ucred *dest, struct ucred *src); |
| 146 | 236 | struct ucred	*crcopysafe(struct proc *p, struct ucred *cr); |
| 147 | 237 | struct ucred	*crdup(struct ucred *cr); |
| 148 | 238 | void	crextend(struct ucred *cr, int n); |
| 149 | void	proc_set_cred_init(struct proc *p, struct ucred *cr); | |
| 150 | void	proc_set_cred(struct proc *p, struct ucred *cr); | |
| 151 | void	proc_unset_cred(struct proc *p); | |
| 239 | void	proc_set_cred(struct proc *p, struct ucred *newcred); | |
| 240 | bool	proc_set_cred_enforce_proc_lim(struct proc *p, struct ucred *newcred); | |
| 241 | void	proc_unset_cred(struct proc *p, bool decrement_proc_count); | |
| 152 | 242 | void	crfree(struct ucred *cr); |
| 153 | 243 | struct ucred	*crcowsync(void); |
| 154 | 244 | struct ucred	*crget(void); |
| ... | ... | @@ -157,9 +247,30 @@ struct ucred	*crcowget(struct ucred *cr); |
| 157 | 247 | void	crcowfree(struct thread *td); |
| 158 | 248 | void	cru2x(struct ucred *cr, struct xucred *xcr); |
| 159 | 249 | void	cru2xt(struct thread *td, struct xucred *xcr); |
| 160 | void	crsetgroups(struct ucred *cr, int n, gid_t *groups); | |
| 161 | bool	groupmember(gid_t gid, struct ucred *cred); | |
| 162 | bool	realgroupmember(gid_t gid, struct ucred *cred); | |
| 250 | void	crsetgroups(struct ucred *cr, int ngrp, const gid_t *groups); | |
| 251 | void	crsetgroups_and_egid(struct ucred *cr, int ngrp, const gid_t *groups, | |
| 252 | 	 const gid_t default_egid); | |
| 253 | bool	cr_xids_subset(struct ucred *active_cred, struct ucred *obj_cred); | |
| 254 | ||
| 255 | /* | |
| 256 | * Returns whether gid designates a primary group in cred. | |
| 257 | */ | |
| 258 | static inline bool | |
| 259 | group_is_primary(const gid_t gid, const struct ucred *const cred) | |
| 260 | { | |
| 261 | 	return (gid == cred->cr_groups[0] || gid == cred->cr_rgid || | |
| 262 | 	 gid == cred->cr_svgid); | |
| 263 | } | |
| 264 | bool	group_is_supplementary(const gid_t gid, const struct ucred *const cred); | |
| 265 | bool	groupmember(gid_t gid, const struct ucred *cred); | |
| 266 | bool	realgroupmember(gid_t gid, const struct ucred *cred); | |
| 267 | ||
| 268 | #else /* !_KERNEL */ | |
| 269 | ||
| 270 | __BEGIN_DECLS | |
| 271 | int	setcred(u_int flags, const struct setcred *wcred, size_t size); | |
| 272 | __END_DECLS | |
| 273 | ||
| 163 | 274 | #endif /* _KERNEL */ |
| 164 | 275 | |
| 165 | 276 | #endif /* !_SYS_UCRED_H_ */ |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/sys/uio.h+6-2| ... | ... | @@ -27,8 +27,6 @@ |
| 27 | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | * | |
| 31 | *	@(#)uio.h	8.5 (Berkeley) 2/22/94 | |
| 32 | 30 | */ |
| 33 | 31 | |
| 34 | 32 | #ifndef _SYS_UIO_H_ |
| ... | ... | @@ -86,12 +84,14 @@ int	copyiniov(const struct iovec *iovp, u_int iovcnt, struct iovec **iov, |
| 86 | 84 | int	copyinuio(const struct iovec *iovp, u_int iovcnt, struct uio **uiop); |
| 87 | 85 | int	copyout_map(struct thread *td, vm_offset_t *addr, size_t sz); |
| 88 | 86 | int	copyout_unmap(struct thread *td, vm_offset_t addr, size_t sz); |
| 87 | void	exterr_copyout(struct thread *td); | |
| 89 | 88 | int	physcopyin(void *src, vm_paddr_t dst, size_t len); |
| 90 | 89 | int	physcopyout(vm_paddr_t src, void *dst, size_t len); |
| 91 | 90 | int	physcopyin_vlist(struct bus_dma_segment *src, off_t offset, |
| 92 | 91 | 	 vm_paddr_t dst, size_t len); |
| 93 | 92 | int	physcopyout_vlist(vm_paddr_t src, struct bus_dma_segment *dst, |
| 94 | 93 | 	 off_t offset, size_t len); |
| 94 | void	uioadvance(struct uio *, size_t); | |
| 95 | 95 | int	uiomove(void *cp, int n, struct uio *uio); |
| 96 | 96 | int	uiomove_frombuf(void *buf, int buflen, struct uio *uio); |
| 97 | 97 | int	uiomove_fromphys(struct vm_page *ma[], vm_offset_t offset, int n, |
| ... | ... | @@ -101,6 +101,10 @@ int	uiomove_object(struct vm_object *obj, off_t obj_size, struct uio *uio); |
| 101 | 101 | |
| 102 | 102 | #else /* !_KERNEL */ |
| 103 | 103 | |
| 104 | #if defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE > 0 | |
| 105 | #include <ssp/uio.h> | |
| 106 | #endif | |
| 107 | ||
| 104 | 108 | __BEGIN_DECLS |
| 105 | 109 | ssize_t	readv(int, const struct iovec *, int); |
| 106 | 110 | ssize_t	writev(int, const struct iovec *, int); |
lib/libc/include/generic-freebsd/sys/umtx.h+1| ... | ... | @@ -135,6 +135,7 @@ struct umtx_robust_lists_params { |
| 135 | 135 | __BEGIN_DECLS |
| 136 | 136 | |
| 137 | 137 | int _umtx_op(void *obj, int op, u_long val, void *uaddr, void *uaddr2); |
| 138 | int _umtx_op_err(void *obj, int op, u_long val, void *uaddr, void *uaddr2); | |
| 138 | 139 | |
| 139 | 140 | __END_DECLS |
| 140 | 141 |
lib/libc/include/generic-freebsd/sys/umtxvar.h+1| ... | ... | @@ -206,6 +206,7 @@ int umtx_key_get(const void *, int, int, struct umtx_key *); |
| 206 | 206 | void umtx_key_release(struct umtx_key *); |
| 207 | 207 | struct umtx_q *umtxq_alloc(void); |
| 208 | 208 | void umtxq_busy(struct umtx_key *); |
| 209 | void umtxq_busy_unlocked(struct umtx_key *); | |
| 209 | 210 | int umtxq_count(struct umtx_key *); |
| 210 | 211 | void umtxq_free(struct umtx_q *); |
| 211 | 212 | struct umtxq_chain *umtxq_getchain(struct umtx_key *); |
lib/libc/include/generic-freebsd/sys/un.h-3| ... | ... | @@ -27,8 +27,6 @@ |
| 27 | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | * | |
| 31 | *	@(#)un.h	8.3 (Berkeley) 2/19/95 | |
| 32 | 30 | */ |
| 33 | 31 | |
| 34 | 32 | #ifndef _SYS_UN_H_ |
| ... | ... | @@ -67,7 +65,6 @@ struct sockaddr_un { |
| 67 | 65 | #define	LOCAL_PEERCRED		1	/* retrieve peer credentials */ |
| 68 | 66 | #define	LOCAL_CREDS		2	/* pass credentials to receiver */ |
| 69 | 67 | #define	LOCAL_CREDS_PERSISTENT	3	/* pass credentials to receiver */ |
| 70 | #define	LOCAL_CONNWAIT		4	/* connects block until accepted */ | |
| 71 | 68 | |
| 72 | 69 | /* Start of reserved space for third-party socket options. */ |
| 73 | 70 | #define	LOCAL_VENDOR		SO_VENDOR |
lib/libc/include/generic-freebsd/sys/unistd.h+17-3| ... | ... | @@ -27,8 +27,6 @@ |
| 27 | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | * | |
| 31 | *	@(#)unistd.h	8.2 (Berkeley) 1/7/94 | |
| 32 | 30 | */ |
| 33 | 31 | |
| 34 | 32 | #ifndef _SYS_UNISTD_H_ |
| ... | ... | @@ -95,7 +93,7 @@ |
| 95 | 93 | #endif |
| 96 | 94 | |
| 97 | 95 | /* Define the POSIX.1 version we target for compliance. */ |
| 98 | #define	_POSIX_VERSION		200112L | |
| 96 | #define	_POSIX_VERSION		200809L | |
| 99 | 97 | |
| 100 | 98 | /* access function */ |
| 101 | 99 | #define	F_OK		0	/* test for existence of file */ |
| ... | ... | @@ -156,6 +154,12 @@ |
| 156 | 154 | #define	_PC_MAC_PRESENT		63 |
| 157 | 155 | #define	_PC_ACL_NFS4		64 |
| 158 | 156 | #define	_PC_DEALLOC_PRESENT	65 |
| 157 | #define	_PC_NAMEDATTR_ENABLED	66 | |
| 158 | #define	_PC_HAS_NAMEDATTR	67 | |
| 159 | #define	_PC_XATTR_ENABLED	_PC_NAMEDATTR_ENABLED	/* Solaris Compatible */ | |
| 160 | #define	_PC_XATTR_EXISTS	_PC_HAS_NAMEDATTR	/* Solaris Compatible */ | |
| 161 | #define	_PC_HAS_HIDDENSYSTEM	68 | |
| 162 | #define	_PC_CLONE_BLKSIZE	69 | |
| 159 | 163 | #endif |
| 160 | 164 | |
| 161 | 165 | /* From OpenSolaris, used by SEEK_DATA/SEEK_HOLE. */ |
| ... | ... | @@ -210,6 +214,16 @@ |
| 210 | 214 | * close_range() options. |
| 211 | 215 | */ |
| 212 | 216 | #define	CLOSE_RANGE_CLOEXEC	(1<<2) |
| 217 | #define	CLOSE_RANGE_CLOFORK	(1<<3) | |
| 218 | ||
| 219 | /* | |
| 220 | * copy_file_range flags visible to user space. | |
| 221 | * High order 8 bits reserved for kernel flags. | |
| 222 | * Allocate from bit 23 down, to try and avoid conflicts with | |
| 223 | * future Linux flags. | |
| 224 | */ | |
| 225 | #define	COPY_FILE_RANGE_CLONE		0x00800000	/* Require cloning. */ | |
| 226 | #define	COPY_FILE_RANGE_USERFLAGS	(COPY_FILE_RANGE_CLONE) | |
| 213 | 227 | |
| 214 | 228 | #endif /* __BSD_VISIBLE */ |
| 215 | 229 |
lib/libc/include/generic-freebsd/sys/unpcb.h+1-4| ... | ... | @@ -27,8 +27,6 @@ |
| 27 | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | * | |
| 31 | *	@(#)unpcb.h	8.1 (Berkeley) 6/2/93 | |
| 32 | 30 | */ |
| 33 | 31 | |
| 34 | 32 | #ifndef _SYS_UNPCB_H_ |
| ... | ... | @@ -95,6 +93,7 @@ struct unpcb { |
| 95 | 93 | 	u_int	unp_msgcount;		/* (g) references from message queue */ |
| 96 | 94 | 	u_int	unp_gcrefs;		/* (g) garbage collector refcount */ |
| 97 | 95 | 	ino_t	unp_ino;		/* (g) fake inode number */ |
| 96 | 	mode_t unp_mode;		/* (g) initial pre-bind() mode */ | |
| 98 | 97 | 	LIST_ENTRY(unpcb) unp_dead;	/* (g) link in dead list */ |
| 99 | 98 | } __aligned(CACHE_LINE_SIZE); |
| 100 | 99 | |
| ... | ... | @@ -109,8 +108,6 @@ struct unpcb { |
| 109 | 108 | #define	UNP_HAVEPC			0x001 |
| 110 | 109 | #define	UNP_WANTCRED_ALWAYS		0x002	/* credentials wanted always */ |
| 111 | 110 | #define	UNP_WANTCRED_ONESHOT		0x004	/* credentials wanted once */ |
| 112 | #define	UNP_CONNWAIT			0x008	/* connect blocks until accepted */ | |
| 113 | ||
| 114 | 111 | #define	UNP_WANTCRED_MASK	(UNP_WANTCRED_ONESHOT | UNP_WANTCRED_ALWAYS) |
| 115 | 112 | |
| 116 | 113 | /* |
lib/libc/include/generic-freebsd/sys/user.h+48-7| ... | ... | @@ -29,8 +29,6 @@ |
| 29 | 29 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 30 | 30 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 31 | 31 | * SUCH DAMAGE. |
| 32 | * | |
| 33 | *	@(#)user.h	8.2 (Berkeley) 9/23/93 | |
| 34 | 32 | */ |
| 35 | 33 | |
| 36 | 34 | #ifndef _SYS_USER_H_ |
| ... | ... | @@ -40,6 +38,7 @@ |
| 40 | 38 | #ifndef _KERNEL |
| 41 | 39 | /* stuff that *used* to be included by user.h, or is now needed */ |
| 42 | 40 | #include <sys/errno.h> |
| 41 | #include <sys/event.h> | |
| 43 | 42 | #include <sys/time.h> |
| 44 | 43 | #include <sys/resource.h> |
| 45 | 44 | #include <sys/ucred.h> |
| ... | ... | @@ -87,7 +86,7 @@ |
| 87 | 86 | */ |
| 88 | 87 | #define	KI_NSPARE_INT	2 |
| 89 | 88 | #define	KI_NSPARE_LONG	12 |
| 90 | #define	KI_NSPARE_PTR	5 | |
| 89 | #define	KI_NSPARE_PTR	4 | |
| 91 | 90 | |
| 92 | 91 | #ifndef _KERNEL |
| 93 | 92 | #ifndef KINFO_PROC_SIZE |
| ... | ... | @@ -213,6 +212,7 @@ struct kinfo_proc { |
| 213 | 212 | 	 * That way the spare room from both arrays will remain contiguous. |
| 214 | 213 | 	 */ |
| 215 | 214 | 	struct	pwddesc *ki_pd;	/* pointer to process paths info */ |
| 215 | 	void	*ki_uerrmsg;		/* address of the ext err msg place */ | |
| 216 | 216 | 	void	*ki_spareptrs[KI_NSPARE_PTR];	/* spare room for growth */ |
| 217 | 217 | 	long	ki_sparelongs[KI_NSPARE_LONG];	/* spare room for growth */ |
| 218 | 218 | 	long	ki_sflag;		/* PS_* flags */ |
| ... | ... | @@ -227,7 +227,7 @@ void fill_kinfo_proc(struct proc *, struct kinfo_proc *); |
| 227 | 227 | * Legacy PS_ flag. This moved to p_flag but is maintained for |
| 228 | 228 | * compatibility. |
| 229 | 229 | */ |
| 230 | #define	PS_INMEM	0x00001		/* Loaded into memory. */ | |
| 230 | #define	PS_INMEM	0x00001		/* Loaded into memory, always true. */ | |
| 231 | 231 | |
| 232 | 232 | /* ki_sessflag values */ |
| 233 | 233 | #define	KI_CTTY		0x00000001	/* controlling tty vnode active */ |
| ... | ... | @@ -265,6 +265,8 @@ struct user { |
| 265 | 265 | #define	KF_TYPE_DEV	12 |
| 266 | 266 | #define	KF_TYPE_EVENTFD	13 |
| 267 | 267 | #define	KF_TYPE_TIMERFD	14 |
| 268 | #define	KF_TYPE_INOTIFY	15 | |
| 269 | #define	KF_TYPE_JAILDESC	16 | |
| 268 | 270 | #define	KF_TYPE_UNKNOWN	255 |
| 269 | 271 | |
| 270 | 272 | #define	KF_VTYPE_VNON	0 |
| ... | ... | @@ -373,7 +375,7 @@ struct kinfo_file { |
| 373 | 375 | 				struct sockaddr_storage	kf_sa_peer; |
| 374 | 376 | 				/* Address of so_pcb. */ |
| 375 | 377 | 				uint64_t	kf_sock_pcb; |
| 376 | 				/* Address of inp_ppcb. */ | |
| 378 | 				/* Obsolete! May be reused as a spare. */ | |
| 377 | 379 | 				uint64_t	kf_sock_inpcb; |
| 378 | 380 | 				/* Address of unp_conn. */ |
| 379 | 381 | 				uint64_t	kf_sock_unpconn; |
| ... | ... | @@ -451,11 +453,18 @@ struct kinfo_file { |
| 451 | 453 | 				uint32_t	kf_timerfd_flags; |
| 452 | 454 | 				uint64_t	kf_timerfd_addr; |
| 453 | 455 | 			} kf_timerfd; |
| 456 | 			struct { | |
| 457 | 				int32_t		kf_jid; | |
| 458 | 			} kf_jail; | |
| 454 | 459 | 			struct { |
| 455 | 460 | 				uint64_t	kf_kqueue_addr; |
| 456 | 461 | 				int32_t		kf_kqueue_count; |
| 457 | 462 | 				int32_t		kf_kqueue_state; |
| 458 | 463 | 			} kf_kqueue; |
| 464 | 			struct { | |
| 465 | 				uint64_t	kf_inotify_npending; | |
| 466 | 				uint64_t	kf_inotify_nbpending; | |
| 467 | 			} kf_inotify; | |
| 459 | 468 | 		} kf_un; |
| 460 | 469 | 	}; |
| 461 | 470 | 	uint16_t	kf_status;		/* Status flags. */ |
| ... | ... | @@ -608,7 +617,8 @@ struct kinfo_vmobject { |
| 608 | 617 | 	} kvo_type_spec;			/* Type-specific union */ |
| 609 | 618 | 	uint64_t kvo_me;			/* Uniq handle for anon obj */ |
| 610 | 619 | 	uint64_t kvo_laundry;			/* Number of laundry pages. */ |
| 611 | 	uint64_t _kvo_qspare[5]; | |
| 620 | 	uint64_t kvo_wired;			/* Number of wired pages. */ | |
| 621 | 	uint64_t _kvo_qspare[4]; | |
| 612 | 622 | 	uint32_t kvo_swapped;			/* Number of swapped pages */ |
| 613 | 623 | 	uint32_t kvo_flags; |
| 614 | 624 | 	uint32_t _kvo_ispare[6]; |
| ... | ... | @@ -625,7 +635,7 @@ struct kinfo_vmobject { |
| 625 | 635 | #define	KKST_MAXLEN	1024 |
| 626 | 636 | |
| 627 | 637 | #define	KKST_STATE_STACKOK	0		/* Stack is valid. */ |
| 628 | #define	KKST_STATE_SWAPPED	1		/* Stack swapped out. */ | |
| 638 | #define	KKST_STATE_SWAPPED	1		/* Stack swapped out, obsolete. */ | |
| 629 | 639 | #define	KKST_STATE_RUNNING	2		/* Stack ephemeral. */ |
| 630 | 640 | |
| 631 | 641 | #if defined(__amd64__) || defined(__i386__) |
| ... | ... | @@ -667,6 +677,35 @@ struct kinfo_vm_layout { |
| 667 | 677 | 	uintptr_t	kvm_spare[12]; |
| 668 | 678 | }; |
| 669 | 679 | |
| 680 | #define	KNOTE_STATUS_ACTIVE		0x00000001 | |
| 681 | #define	KNOTE_STATUS_QUEUED		0x00000002 | |
| 682 | #define	KNOTE_STATUS_DISABLED		0x00000004 | |
| 683 | #define	KNOTE_STATUS_DETACHED		0x00000008 | |
| 684 | #define	KNOTE_STATUS_KQUEUE		0x00000010 | |
| 685 | ||
| 686 | #define	KNOTE_EXTDATA_NONE		0 | |
| 687 | #define	KNOTE_EXTDATA_VNODE		1 | |
| 688 | #define	KNOTE_EXTDATA_PIPE		2 | |
| 689 | ||
| 690 | struct kinfo_knote { | |
| 691 | 	int		knt_kq_fd; | |
| 692 | 	struct kevent	knt_event; | |
| 693 | 	int		knt_status; | |
| 694 | 	int		knt_extdata; | |
| 695 | 	uint64_t	knt_spare0[4]; | |
| 696 | 	union { | |
| 697 | 		struct { | |
| 698 | 			int		knt_vnode_type; | |
| 699 | 			uint64_t	knt_vnode_fsid; | |
| 700 | 			uint64_t	knt_vnode_fileid; | |
| 701 | 			char		knt_vnode_fullpath[PATH_MAX]; | |
| 702 | 		} knt_vnode; | |
| 703 | 		struct { | |
| 704 | 			ino_t		knt_pipe_ino; | |
| 705 | 		} knt_pipe; | |
| 706 | 	}; | |
| 707 | }; | |
| 708 | ||
| 670 | 709 | #ifdef _KERNEL |
| 671 | 710 | /* Flags for kern_proc_out function. */ |
| 672 | 711 | #define KERN_PROC_NOTHREADS	0x1 |
| ... | ... | @@ -694,6 +733,8 @@ int	kern_proc_cwd_out(struct proc *p, struct sbuf *sb, ssize_t maxlen); |
| 694 | 733 | int	kern_proc_out(struct proc *p, struct sbuf *sb, int flags); |
| 695 | 734 | int	kern_proc_vmmap_out(struct proc *p, struct sbuf *sb, ssize_t maxlen, |
| 696 | 735 | 	int flags); |
| 736 | int	kern_proc_kqueues_out(struct proc *p, struct sbuf *s, size_t maxlen, | |
| 737 | 	bool compat32); | |
| 697 | 738 | |
| 698 | 739 | int	vntype_to_kinfo(int vtype); |
| 699 | 740 | void	pack_kinfo(struct kinfo_file *kif); |
lib/libc/include/generic-freebsd/sys/utsname.h-2| ... | ... | @@ -30,8 +30,6 @@ |
| 30 | 30 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 31 | 31 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 32 | 32 | * SUCH DAMAGE. |
| 33 | * | |
| 34 | *	@(#)utsname.h	8.1 (Berkeley) 1/4/94 | |
| 35 | 33 | */ |
| 36 | 34 | |
| 37 | 35 | #ifndef	_SYS_UTSNAME_H |
lib/libc/include/generic-freebsd/sys/vmmeter.h+8-2| ... | ... | @@ -27,8 +27,6 @@ |
| 27 | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | * | |
| 31 | *	@(#)vmmeter.h	8.2 (Berkeley) 7/10/94 | |
| 32 | 30 | */ |
| 33 | 31 | |
| 34 | 32 | #ifndef _SYS_VMMETER_H_ |
| ... | ... | @@ -122,6 +120,7 @@ struct vmmeter { |
| 122 | 120 | 	counter_u64_t v_rforkpages;	/* (p) pages affected by rfork() */ |
| 123 | 121 | 	counter_u64_t v_kthreadpages;	/* (p) ... and by kernel fork() */ |
| 124 | 122 | 	counter_u64_t v_wire_count;	/* (p) pages wired down */ |
| 123 | 	counter_u64_t v_nofree_count;	/* (p) permanently allocated pages */ | |
| 125 | 124 | #define	VM_METER_NCOUNTERS	\ |
| 126 | 125 | 	(offsetof(struct vmmeter, v_page_size) / sizeof(counter_u64_t)) |
| 127 | 126 | 	/* |
| ... | ... | @@ -176,6 +175,13 @@ vm_wire_count(void) |
| 176 | 175 | 	return (VM_CNT_FETCH(v_wire_count)); |
| 177 | 176 | } |
| 178 | 177 | |
| 178 | static inline u_int | |
| 179 | vm_nofree_count(void) | |
| 180 | { | |
| 181 | ||
| 182 | 	return (VM_CNT_FETCH(v_nofree_count)); | |
| 183 | } | |
| 184 | ||
| 179 | 185 | /* |
| 180 | 186 | * Return TRUE if we are under our severe low-free-pages threshold |
| 181 | 187 | * |
lib/libc/include/generic-freebsd/sys/vnode.h+83-25| ... | ... | @@ -27,8 +27,6 @@ |
| 27 | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | * | |
| 31 | *	@(#)vnode.h	8.7 (Berkeley) 2/4/94 | |
| 32 | 30 | */ |
| 33 | 31 | |
| 34 | 32 | #ifndef _SYS_VNODE_H_ |
| ... | ... | @@ -69,6 +67,11 @@ __enum_uint8_decl(vtype) { |
| 69 | 67 | 	VLASTTYPE = VMARKER, |
| 70 | 68 | }; |
| 71 | 69 | |
| 70 | /* | |
| 71 | * We frequently need to test is something is a device node. | |
| 72 | */ | |
| 73 | #define VTYPE_ISDEV(vtype)	((vtype) == VCHR || (vtype) == VBLK) | |
| 74 | ||
| 72 | 75 | __enum_uint8_decl(vstate) { |
| 73 | 76 | 	VSTATE_UNINITIALIZED, |
| 74 | 77 | 	VSTATE_CONSTRUCTED, |
| ... | ... | @@ -88,11 +91,13 @@ enum vgetstate { |
| 88 | 91 | * it from v_data. If non-null, this area is freed in getnewvnode(). |
| 89 | 92 | */ |
| 90 | 93 | |
| 91 | struct namecache; | |
| 92 | 94 | struct cache_fpl; |
| 95 | struct inotify_watch; | |
| 96 | struct namecache; | |
| 93 | 97 | |
| 94 | 98 | struct vpollinfo { |
| 95 | 99 | 	struct	mtx vpi_lock;		/* lock to protect below */ |
| 100 | 	TAILQ_HEAD(, inotify_watch) vpi_inotify; /* list of inotify watchers */ | |
| 96 | 101 | 	struct	selinfo vpi_selinfo;	/* identity of poller(s) */ |
| 97 | 102 | 	short	vpi_events;		/* what they are looking for */ |
| 98 | 103 | 	short	vpi_revents;		/* what has happened */ |
| ... | ... | @@ -134,7 +139,7 @@ struct vnode { |
| 134 | 139 | 	seqc_t	v_seqc;				/* i modification count */ |
| 135 | 140 | 	uint32_t v_nchash;			/* u namecache hash */ |
| 136 | 141 | 	u_int	v_hash; |
| 137 | 	struct	vop_vector *v_op;		/* u vnode operations vector */ | |
| 142 | 	const struct vop_vector *v_op;		/* u vnode operations vector */ | |
| 138 | 143 | 	void	*v_data;			/* u private data for fs */ |
| 139 | 144 | |
| 140 | 145 | 	/* |
| ... | ... | @@ -199,6 +204,8 @@ struct vnode { |
| 199 | 204 | 	int	v_seqc_users;			/* i modifications pending */ |
| 200 | 205 | }; |
| 201 | 206 | |
| 207 | #define VN_ISDEV(vp)		VTYPE_ISDEV((vp)->v_type) | |
| 208 | ||
| 202 | 209 | #ifndef DEBUG_LOCKS |
| 203 | 210 | #ifdef _LP64 |
| 204 | 211 | /* |
| ... | ... | @@ -248,6 +255,11 @@ _Static_assert(sizeof(struct vnode) <= 448, "vnode size crosses 448 bytes"); |
| 248 | 255 | #define	VIRF_MOUNTPOINT	0x0004	/* This vnode is mounted on */ |
| 249 | 256 | #define	VIRF_TEXT_REF	0x0008	/* Executable mappings ref the vnode */ |
| 250 | 257 | #define	VIRF_CROSSMP	0x0010	/* Cross-mp vnode, no locking */ |
| 258 | #define	VIRF_NAMEDDIR	0x0020	/* Named attribute directory */ | |
| 259 | #define	VIRF_NAMEDATTR	0x0040	/* Named attribute */ | |
| 260 | #define	VIRF_INOTIFY	0x0080	/* This vnode is being watched */ | |
| 261 | #define	VIRF_INOTIFY_PARENT 0x0100 /* A parent of this vnode may be being | |
| 262 | 				 watched */ | |
| 251 | 263 | |
| 252 | 264 | #define	VI_UNUSED0	0x0001	/* unused */ |
| 253 | 265 | #define	VI_MOUNT	0x0002	/* Mount in progress */ |
| ... | ... | @@ -283,7 +295,7 @@ _Static_assert(sizeof(struct vnode) <= 448, "vnode size crosses 448 bytes"); |
| 283 | 295 | struct vattr { |
| 284 | 296 | 	__enum_uint8(vtype)	va_type;	/* vnode type (for create) */ |
| 285 | 297 | 	u_short		va_mode;	/* files access mode and type */ |
| 286 | 	u_short		va_padding0; | |
| 298 | 	uint16_t	va_bsdflags;	/* same as st_bsdflags from stat(2) */ | |
| 287 | 299 | 	uid_t		va_uid;		/* owner user id */ |
| 288 | 300 | 	gid_t		va_gid;		/* owner group id */ |
| 289 | 301 | 	nlink_t		va_nlink;	/* number of references to file */ |
| ... | ... | @@ -304,6 +316,8 @@ struct vattr { |
| 304 | 316 | 	long		va_spare;	/* remain quad aligned */ |
| 305 | 317 | }; |
| 306 | 318 | |
| 319 | #define VATTR_ISDEV(vap)	VTYPE_ISDEV((vap)->va_type) | |
| 320 | ||
| 307 | 321 | /* |
| 308 | 322 | * Flags for va_vaflags. |
| 309 | 323 | */ |
| ... | ... | @@ -533,7 +547,7 @@ extern struct vnodeop_desc *vnodeop_descs[]; |
| 533 | 547 | #define	VOPARG_OFFSETTO(s_type, s_offset, struct_p) \ |
| 534 | 548 | ((s_type)(((char*)(struct_p)) + (s_offset))) |
| 535 | 549 | |
| 536 | #ifdef DEBUG_VFS_LOCKS | |
| 550 | #ifdef INVARIANTS | |
| 537 | 551 | /* |
| 538 | 552 | * Support code to aid in debugging VFS locking problems. Not totally |
| 539 | 553 | * reliable since if the thread sleeps between changing the lock |
| ... | ... | @@ -567,7 +581,7 @@ void	assert_vop_unlocked(struct vnode *vp, const char *str); |
| 567 | 581 | 	VNPASS(!seqc_in_modify(_vp->v_seqc), _vp);		\ |
| 568 | 582 | } while (0) |
| 569 | 583 | |
| 570 | #else /* !DEBUG_VFS_LOCKS */ | |
| 584 | #else /* !INVARIANTS */ | |
| 571 | 585 | |
| 572 | 586 | #define	ASSERT_VI_LOCKED(vp, str)	((void)0) |
| 573 | 587 | #define	ASSERT_VI_UNLOCKED(vp, str)	((void)0) |
| ... | ... | @@ -578,7 +592,7 @@ void	assert_vop_unlocked(struct vnode *vp, const char *str); |
| 578 | 592 | #define ASSERT_VOP_IN_SEQC(vp)		((void)0) |
| 579 | 593 | #define ASSERT_VOP_NOT_IN_SEQC(vp)	((void)0) |
| 580 | 594 | |
| 581 | #endif /* DEBUG_VFS_LOCKS */ | |
| 595 | #endif /* INVARIANTS */ | |
| 582 | 596 | |
| 583 | 597 | /* |
| 584 | 598 | * This call works for vnodes in the kernel. |
| ... | ... | @@ -667,6 +681,7 @@ char	*cache_symlink_alloc(size_t size, int flags); |
| 667 | 681 | void	cache_symlink_free(char *string, size_t size); |
| 668 | 682 | int	cache_symlink_resolve(struct cache_fpl *fpl, const char *string, |
| 669 | 683 | 	 size_t len); |
| 684 | void	cache_vop_inotify(struct vnode *vp, int event, uint32_t cookie); | |
| 670 | 685 | void	cache_vop_rename(struct vnode *fdvp, struct vnode *fvp, struct vnode *tdvp, |
| 671 | 686 | struct vnode *tvp, struct componentname *fcnp, struct componentname *tcnp); |
| 672 | 687 | void	cache_vop_rmdir(struct vnode *dvp, struct vnode *vp); |
| ... | ... | @@ -708,6 +723,7 @@ int	speedup_syncer(void); |
| 708 | 723 | int	vn_vptocnp(struct vnode **vp, char *buf, size_t *buflen); |
| 709 | 724 | int	vn_getcwd(char *buf, char **retbuf, size_t *buflen); |
| 710 | 725 | int	vn_fullpath(struct vnode *vp, char **retbuf, char **freebuf); |
| 726 | int	vn_fullpath_jail(struct vnode *vp, char **retbuf, char **freebuf); | |
| 711 | 727 | int	vn_fullpath_global(struct vnode *vp, char **retbuf, char **freebuf); |
| 712 | 728 | int	vn_fullpath_hardlink(struct vnode *vp, struct vnode *dvp, |
| 713 | 729 | 	 const char *hdrl_name, size_t hrdl_name_length, char **retbuf, |
| ... | ... | @@ -836,18 +852,15 @@ void	vn_seqc_write_end(struct vnode *vp); |
| 836 | 852 | #define	vn_seqc_consistent(vp, seq)	seqc_consistent(&(vp)->v_seqc, seq) |
| 837 | 853 | |
| 838 | 854 | #define	vn_rangelock_unlock(vp, cookie)					\ |
| 839 | 	rangelock_unlock(&(vp)->v_rl, (cookie), VI_MTX(vp)) | |
| 840 | #define	vn_rangelock_unlock_range(vp, cookie, start, end)		\ | |
| 841 | 	rangelock_unlock_range(&(vp)->v_rl, (cookie), (start), (end), 	\ | |
| 842 | 	 VI_MTX(vp)) | |
| 855 | 	rangelock_unlock(&(vp)->v_rl, (cookie)) | |
| 843 | 856 | #define	vn_rangelock_rlock(vp, start, end)				\ |
| 844 | 	rangelock_rlock(&(vp)->v_rl, (start), (end), VI_MTX(vp)) | |
| 857 | 	rangelock_rlock(&(vp)->v_rl, (start), (end)) | |
| 845 | 858 | #define	vn_rangelock_tryrlock(vp, start, end)				\ |
| 846 | 	rangelock_tryrlock(&(vp)->v_rl, (start), (end), VI_MTX(vp)) | |
| 859 | 	rangelock_tryrlock(&(vp)->v_rl, (start), (end)) | |
| 847 | 860 | #define	vn_rangelock_wlock(vp, start, end)				\ |
| 848 | 	rangelock_wlock(&(vp)->v_rl, (start), (end), VI_MTX(vp)) | |
| 861 | 	rangelock_wlock(&(vp)->v_rl, (start), (end)) | |
| 849 | 862 | #define	vn_rangelock_trywlock(vp, start, end)				\ |
| 850 | 	rangelock_trywlock(&(vp)->v_rl, (start), (end), VI_MTX(vp)) | |
| 863 | 	rangelock_trywlock(&(vp)->v_rl, (start), (end)) | |
| 851 | 864 | |
| 852 | 865 | #define	vn_irflag_read(vp)	atomic_load_short(&(vp)->v_irflag) |
| 853 | 866 | void	vn_irflag_set_locked(struct vnode *vp, short toset); |
| ... | ... | @@ -872,8 +885,10 @@ int	vop_stdfsync(struct vop_fsync_args *); |
| 872 | 885 | int	vop_stdgetwritemount(struct vop_getwritemount_args *); |
| 873 | 886 | int	vop_stdgetpages(struct vop_getpages_args *); |
| 874 | 887 | int	vop_stdinactive(struct vop_inactive_args *); |
| 875 | int	vop_stdioctl(struct vop_ioctl_args *); | |
| 876 | 888 | int	vop_stdneed_inactive(struct vop_need_inactive_args *); |
| 889 | int	vop_stdinotify(struct vop_inotify_args *); | |
| 890 | int	vop_stdinotify_add_watch(struct vop_inotify_add_watch_args *); | |
| 891 | int	vop_stdioctl(struct vop_ioctl_args *); | |
| 877 | 892 | int	vop_stdkqfilter(struct vop_kqfilter_args *); |
| 878 | 893 | int	vop_stdlock(struct vop_lock1_args *); |
| 879 | 894 | int	vop_stdunlock(struct vop_unlock_args *); |
| ... | ... | @@ -913,9 +928,12 @@ int	dead_read(struct vop_read_args *ap); |
| 913 | 928 | int	dead_write(struct vop_write_args *ap); |
| 914 | 929 | |
| 915 | 930 | /* These are called from within the actual VOPS. */ |
| 931 | void	vop_allocate_post(void *a, int rc); | |
| 932 | void	vop_copy_file_range_post(void *ap, int rc); | |
| 916 | 933 | void	vop_close_post(void *a, int rc); |
| 917 | 934 | void	vop_create_pre(void *a); |
| 918 | 935 | void	vop_create_post(void *a, int rc); |
| 936 | void	vop_deallocate_post(void *a, int rc); | |
| 919 | 937 | void	vop_whiteout_pre(void *a); |
| 920 | 938 | void	vop_whiteout_post(void *a, int rc); |
| 921 | 939 | void	vop_deleteextattr_pre(void *a); |
| ... | ... | @@ -931,7 +949,6 @@ void	vop_mknod_post(void *a, int rc); |
| 931 | 949 | void	vop_open_post(void *a, int rc); |
| 932 | 950 | void	vop_read_post(void *a, int rc); |
| 933 | 951 | void	vop_read_pgcache_post(void *ap, int rc); |
| 934 | void	vop_readdir_post(void *a, int rc); | |
| 935 | 952 | void	vop_reclaim_post(void *a, int rc); |
| 936 | 953 | void	vop_remove_pre(void *a); |
| 937 | 954 | void	vop_remove_post(void *a, int rc); |
| ... | ... | @@ -949,7 +966,7 @@ void	vop_symlink_pre(void *a); |
| 949 | 966 | void	vop_symlink_post(void *a, int rc); |
| 950 | 967 | int	vop_sigdefer(struct vop_vector *vop, struct vop_generic_args *a); |
| 951 | 968 | |
| 952 | #ifdef DEBUG_VFS_LOCKS | |
| 969 | #ifdef INVARIANTS | |
| 953 | 970 | void	vop_fdatasync_debugpre(void *a); |
| 954 | 971 | void	vop_fdatasync_debugpost(void *a, int rc); |
| 955 | 972 | void	vop_fplookup_vexec_debugpre(void *a); |
| ... | ... | @@ -991,9 +1008,10 @@ void	vop_rename_fail(struct vop_rename_args *ap); |
| 991 | 1008 | 	AUDIT_ARG_VNODE1(ap->a_vp);						\ |
| 992 | 1009 | 	_error = mac_vnode_check_stat(_ap->a_active_cred, _ap->a_file_cred, _ap->a_vp);\ |
| 993 | 1010 | 	if (__predict_true(_error == 0)) {					\ |
| 994 | 		ap->a_sb->st_padding0 = 0;					\ | |
| 995 | 1011 | 		ap->a_sb->st_padding1 = 0;					\ |
| 996 | 1012 | 		bzero(_ap->a_sb->st_spare, sizeof(_ap->a_sb->st_spare));	\ |
| 1013 | 		ap->a_sb->st_filerev = 0;					\ | |
| 1014 | 		ap->a_sb->st_bsdflags = 0;					\ | |
| 997 | 1015 | 	}									\ |
| 998 | 1016 | 	_error;									\ |
| 999 | 1017 | }) |
| ... | ... | @@ -1006,7 +1024,36 @@ void	vop_rename_fail(struct vop_rename_args *ap); |
| 1006 | 1024 | 	_error;									\ |
| 1007 | 1025 | }) |
| 1008 | 1026 | |
| 1009 | #define	VOP_WRITE_PRE(ap)						\ | |
| 1027 | #ifdef INVARIANTS | |
| 1028 | #define	vop_readdir_pre_assert(ap)					\ | |
| 1029 | 	ssize_t nresid, oresid;						\ | |
| 1030 | 									\ | |
| 1031 | 	oresid = (ap)->a_uio->uio_resid; | |
| 1032 | ||
| 1033 | #define	vop_readdir_post_assert(ap, ret)				\ | |
| 1034 | 	nresid = (ap)->a_uio->uio_resid;				\ | |
| 1035 | 	if ((ret) == 0 && (ap)->a_eofflag != NULL) {			\ | |
| 1036 | 		VNASSERT(oresid == 0 || nresid != oresid ||		\ | |
| 1037 | 		 *(ap)->a_eofflag == 1,				\ | |
| 1038 | 		 (ap)->a_vp, ("VOP_READDIR: eofflag not set"));	\ | |
| 1039 | 	} | |
| 1040 | #else | |
| 1041 | #define	vop_readdir_pre_assert(ap) | |
| 1042 | #define	vop_readdir_post_assert(ap, ret) | |
| 1043 | #endif | |
| 1044 | ||
| 1045 | #define	vop_readdir_pre(ap) do {					\ | |
| 1046 | 	vop_readdir_pre_assert(ap) | |
| 1047 | ||
| 1048 | #define vop_readdir_post(ap, ret)					\ | |
| 1049 | 	vop_readdir_post_assert(ap, ret);				\ | |
| 1050 | 	if ((ret) == 0) {						\ | |
| 1051 | 		VFS_KNOTE_LOCKED((ap)->a_vp, NOTE_READ);		\ | |
| 1052 | 		INOTIFY((ap)->a_vp, IN_ACCESS);				\ | |
| 1053 | 	}								\ | |
| 1054 | } while (0) | |
| 1055 | ||
| 1056 | #define	vop_write_pre(ap)						\ | |
| 1010 | 1057 | 	struct vattr va;						\ |
| 1011 | 1058 | 	int error;							\ |
| 1012 | 1059 | 	off_t osize, ooffset, noffset;					\ |
| ... | ... | @@ -1020,11 +1067,14 @@ void	vop_rename_fail(struct vop_rename_args *ap); |
| 1020 | 1067 | 		osize = (off_t)va.va_size;				\ |
| 1021 | 1068 | 	} |
| 1022 | 1069 | |
| 1023 | #define VOP_WRITE_POST(ap, ret)						\ | |
| 1070 | #define vop_write_post(ap, ret)						\ | |
| 1024 | 1071 | 	noffset = (ap)->a_uio->uio_offset;				\ |
| 1025 | 	if (noffset > ooffset && !VN_KNLIST_EMPTY((ap)->a_vp)) {	\ | |
| 1026 | 		VFS_KNOTE_LOCKED((ap)->a_vp, NOTE_WRITE			\ | |
| 1027 | 		 | (noffset > osize ? NOTE_EXTEND : 0));		\ | |
| 1072 | 	if (noffset > ooffset) {					\ | |
| 1073 | 		if (!VN_KNLIST_EMPTY((ap)->a_vp)) {			\ | |
| 1074 | 			VFS_KNOTE_LOCKED((ap)->a_vp, NOTE_WRITE |	\ | |
| 1075 | 			 (noffset > osize ? NOTE_EXTEND : 0));	\ | |
| 1076 | 		}							\ | |
| 1077 | 		INOTIFY((ap)->a_vp, IN_MODIFY);				\ | |
| 1028 | 1078 | 	} |
| 1029 | 1079 | |
| 1030 | 1080 | #define VOP_LOCK(vp, flags) VOP_LOCK1(vp, flags, __FILE__, __LINE__) |
| ... | ... | @@ -1084,7 +1134,14 @@ vrefcnt(struct vnode *vp) |
| 1084 | 1134 | 	vref(vp);							\ |
| 1085 | 1135 | } while (0) |
| 1086 | 1136 | |
| 1137 | /* | |
| 1138 | * The caller doesn't know the file size and vnode_create_vobject() should | |
| 1139 | * determine the size on its own. | |
| 1140 | */ | |
| 1141 | #define	VNODE_NO_SIZE	((off_t)-1) | |
| 1142 | ||
| 1087 | 1143 | int vnode_create_vobject(struct vnode *vp, off_t size, struct thread *td); |
| 1144 | int vnode_create_disk_vobject(struct vnode *vp, off_t size, struct thread *td); | |
| 1088 | 1145 | void vnode_destroy_vobject(struct vnode *vp); |
| 1089 | 1146 | |
| 1090 | 1147 | extern struct vop_vector fifo_specops; |
| ... | ... | @@ -1190,6 +1247,7 @@ vn_get_state(struct vnode *vp) |
| 1190 | 1247 | #define vfs_smr_exit()	smr_exit(VFS_SMR()) |
| 1191 | 1248 | #define vfs_smr_synchronize()	smr_synchronize(VFS_SMR()) |
| 1192 | 1249 | #define vfs_smr_entered_load(ptr)	smr_entered_load((ptr), VFS_SMR()) |
| 1250 | #define VFS_SMR_ENTERED()		SMR_ENTERED(VFS_SMR()) | |
| 1193 | 1251 | #define VFS_SMR_ASSERT_ENTERED()	SMR_ASSERT_ENTERED(VFS_SMR()) |
| 1194 | 1252 | #define VFS_SMR_ASSERT_NOT_ENTERED()	SMR_ASSERT_NOT_ENTERED(VFS_SMR()) |
| 1195 | 1253 | #define VFS_SMR_ZONE_SET(zone)	uma_zone_set_smr((zone), VFS_SMR()) |
lib/libc/include/generic-freebsd/sys/wait.h-2| ... | ... | @@ -27,8 +27,6 @@ |
| 27 | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | * | |
| 31 | *	@(#)wait.h	8.2 (Berkeley) 7/10/94 | |
| 32 | 30 | */ |
| 33 | 31 | |
| 34 | 32 | #ifndef _SYS_WAIT_H_ |
lib/libc/include/generic-freebsd/sys/watchdog.h+19-6| ... | ... | @@ -32,15 +32,16 @@ |
| 32 | 32 | #define	_SYS_WATCHDOG_H |
| 33 | 33 | |
| 34 | 34 | #include <sys/ioccom.h> |
| 35 | #include <sys/_types.h> | |
| 35 | 36 | |
| 36 | 37 | #define	_PATH_WATCHDOG	"fido" |
| 37 | 38 | |
| 38 | #define WDIOCPATPAT	_IOW('W', 42, u_int)	/* pat the watchdog */ | |
| 39 | #define WDIOC_SETTIMEOUT _IOW('W', 43, int)	/* set/reset the timer */ | |
| 40 | #define WDIOC_GETTIMEOUT _IOR('W', 44, int)	/* get total timeout */ | |
| 41 | #define WDIOC_GETTIMELEFT _IOR('W', 45, int)	/* get time left */ | |
| 42 | #define WDIOC_GETPRETIMEOUT _IOR('W', 46, int)	/* get the pre-timeout */ | |
| 43 | #define WDIOC_SETPRETIMEOUT _IOW('W', 47, int)	/* set the pre-timeout */ | |
| 39 | #define WDIOC_PATPAT	 _IOW('W', 52, sbintime_t)	/* pat the watchdog */ | |
| 40 | #define WDIOC_SETTIMEOUT _IOW('W', 53, sbintime_t)	/* set/reset the timer */ | |
| 41 | #define WDIOC_GETTIMEOUT _IOR('W', 54, sbintime_t)	/* get total timeout */ | |
| 42 | #define WDIOC_GETTIMELEFT _IOR('W', 55, sbintime_t)	/* get time left */ | |
| 43 | #define WDIOC_GETPRETIMEOUT _IOR('W', 56, sbintime_t)	/* get the pre-timeout */ | |
| 44 | #define WDIOC_SETPRETIMEOUT _IOW('W', 57, sbintime_t)	/* set the pre-timeout */ | |
| 44 | 45 | /* set the action when a pre-timeout occurs see: WD_SOFT_* */ |
| 45 | 46 | #define WDIOC_SETPRETIMEOUTACT _IOW('W', 48, int) |
| 46 | 47 | |
| ... | ... | @@ -48,6 +49,8 @@ |
| 48 | 49 | #define WDIOC_SETSOFT	_IOW('W', 49, int) |
| 49 | 50 | #define WDIOC_SETSOFTTIMEOUTACT	_IOW('W', 50, int) |
| 50 | 51 | |
| 52 | #define	WDIOC_CONTROL		_IOW('W', 51, int)	/* configure watchdog */ | |
| 53 | ||
| 51 | 54 | #define WD_ACTIVE	0x8000000 |
| 52 | 55 | 	/* |
| 53 | 56 | 	 * Watchdog reset, timeout set to value in WD_INTERVAL field. |
| ... | ... | @@ -93,6 +96,11 @@ |
| 93 | 96 | #define WD_TO_64SEC	36 |
| 94 | 97 | #define WD_TO_128SEC	37 |
| 95 | 98 | |
| 99 | /* Control options for WDIOC_CONTROL */ | |
| 100 | #define	WD_CTRL_DISABLE	0x00000000 | |
| 101 | #define	WD_CTRL_ENABLE	0x00000001 | |
| 102 | #define	WD_CTRL_RESET	0x00000002 | |
| 103 | ||
| 96 | 104 | /* action on pre-timeout trigger */ |
| 97 | 105 | #define	WD_SOFT_PANIC	0x01	/* panic */ |
| 98 | 106 | #define	WD_SOFT_DDB	0x02	/* enter debugger */ |
| ... | ... | @@ -105,11 +113,16 @@ |
| 105 | 113 | #include <sys/_eventhandler.h> |
| 106 | 114 | |
| 107 | 115 | typedef void (*watchdog_fn)(void *, u_int, int *); |
| 116 | typedef void (*watchdog_sbt_fn)(void *, sbintime_t, sbintime_t *, int *); | |
| 108 | 117 | |
| 109 | 118 | EVENTHANDLER_DECLARE(watchdog_list, watchdog_fn); |
| 119 | EVENTHANDLER_DECLARE(watchdog_sbt_list, watchdog_sbt_fn); | |
| 110 | 120 | |
| 111 | 121 | u_int	wdog_kern_last_timeout(void); |
| 112 | 122 | int	wdog_kern_pat(u_int utim); |
| 123 | sbintime_t	wdog_kern_last_timeout_sbt(void); | |
| 124 | int		wdog_kern_pat_sbt(sbintime_t utim); | |
| 125 | int		wdog_control(int ctrl); | |
| 113 | 126 | |
| 114 | 127 | /* |
| 115 | 128 | * The following function pointer is used to attach a software watchdog |
lib/libc/include/generic-freebsd/sysexits.h-2| ... | ... | @@ -27,8 +27,6 @@ |
| 27 | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | * | |
| 31 | *	@(#)sysexits.h	8.1 (Berkeley) 6/2/93 | |
| 32 | 30 | */ |
| 33 | 31 | |
| 34 | 32 | #ifndef	_SYSEXITS_H_ |
lib/libc/include/generic-freebsd/syslog.h-2| ... | ... | @@ -27,8 +27,6 @@ |
| 27 | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | * | |
| 31 | *	@(#)syslog.h	8.1 (Berkeley) 6/2/93 | |
| 32 | 30 | */ |
| 33 | 31 | |
| 34 | 32 | #ifndef _SYS_SYSLOG_H_ |
lib/libc/include/generic-freebsd/tar.h-2| ... | ... | @@ -30,8 +30,6 @@ |
| 30 | 30 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 31 | 31 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 32 | 32 | * SUCH DAMAGE. |
| 33 | * | |
| 34 | *	@(#)tar.h	8.2 (Berkeley) 1/4/94 | |
| 35 | 33 | */ |
| 36 | 34 | |
| 37 | 35 | #ifndef _TAR_H |
lib/libc/include/generic-freebsd/teken/teken.h deleted-220| ... | ... | @@ -1,220 +0,0 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-2-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 2008-2009 Ed Schouten <ed@FreeBSD.org> | |
| 5 | * All rights reserved. | |
| 6 | * | |
| 7 | * Redistribution and use in source and binary forms, with or without | |
| 8 | * modification, are permitted provided that the following conditions | |
| 9 | * are met: | |
| 10 | * 1. Redistributions of source code must retain the above copyright | |
| 11 | * notice, this list of conditions and the following disclaimer. | |
| 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 13 | * notice, this list of conditions and the following disclaimer in the | |
| 14 | * documentation and/or other materials provided with the distribution. | |
| 15 | * | |
| 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |
| 17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
| 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | |
| 20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
| 21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
| 22 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
| 23 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
| 24 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
| 25 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
| 26 | * SUCH DAMAGE. | |
| 27 | */ | |
| 28 | ||
| 29 | #ifndef _TEKEN_H_ | |
| 30 | #define	_TEKEN_H_ | |
| 31 | ||
| 32 | #include <sys/types.h> | |
| 33 | ||
| 34 | /* | |
| 35 | * libteken: terminal emulation library. | |
| 36 | * | |
| 37 | * This library converts an UTF-8 stream of bytes to terminal drawing | |
| 38 | * commands. | |
| 39 | */ | |
| 40 | ||
| 41 | typedef uint32_t teken_char_t; | |
| 42 | typedef unsigned short teken_unit_t; | |
| 43 | typedef unsigned char teken_format_t; | |
| 44 | #define	TF_BOLD		0x01	/* Bold character. */ | |
| 45 | #define	TF_UNDERLINE	0x02	/* Underline character. */ | |
| 46 | #define	TF_BLINK	0x04	/* Blinking character. */ | |
| 47 | #define	TF_REVERSE	0x08	/* Reverse rendered character. */ | |
| 48 | #define	TF_CJK_RIGHT	0x10	/* Right-hand side of CJK character. */ | |
| 49 | #define	TF_IMAGE	0x20	/* This character space has image. */ | |
| 50 | typedef unsigned char teken_color_t; | |
| 51 | #define	TC_BLACK	0 | |
| 52 | #define	TC_RED		1 | |
| 53 | #define	TC_GREEN	2 | |
| 54 | #define	TC_YELLOW	3 | |
| 55 | #define	TC_BLUE		4 | |
| 56 | #define	TC_MAGENTA	5 | |
| 57 | #define	TC_CYAN		6 | |
| 58 | #define	TC_WHITE	7 | |
| 59 | #define	TC_NCOLORS	8 | |
| 60 | #define	TC_LIGHT	8	/* ORed with the others. */ | |
| 61 | ||
| 62 | typedef struct { | |
| 63 | 	teken_unit_t	tp_row; | |
| 64 | 	teken_unit_t	tp_col; | |
| 65 | } teken_pos_t; | |
| 66 | typedef struct { | |
| 67 | 	teken_pos_t	tr_begin; | |
| 68 | 	teken_pos_t	tr_end; | |
| 69 | } teken_rect_t; | |
| 70 | typedef struct { | |
| 71 | 	teken_format_t	ta_format; | |
| 72 | 	teken_color_t	ta_fgcolor; | |
| 73 | 	teken_color_t	ta_bgcolor; | |
| 74 | } teken_attr_t; | |
| 75 | typedef struct { | |
| 76 | 	teken_unit_t	ts_begin; | |
| 77 | 	teken_unit_t	ts_end; | |
| 78 | } teken_span_t; | |
| 79 | ||
| 80 | typedef struct __teken teken_t; | |
| 81 | ||
| 82 | typedef void teken_state_t(teken_t *, teken_char_t); | |
| 83 | ||
| 84 | /* | |
| 85 | * Drawing routines supplied by the user. | |
| 86 | */ | |
| 87 | ||
| 88 | typedef void tf_bell_t(void *); | |
| 89 | typedef void tf_cursor_t(void *, const teken_pos_t *); | |
| 90 | typedef void tf_putchar_t(void *, const teken_pos_t *, teken_char_t, | |
| 91 | const teken_attr_t *); | |
| 92 | typedef void tf_fill_t(void *, const teken_rect_t *, teken_char_t, | |
| 93 | const teken_attr_t *); | |
| 94 | typedef void tf_copy_t(void *, const teken_rect_t *, const teken_pos_t *); | |
| 95 | typedef void tf_pre_input_t(void *); | |
| 96 | typedef void tf_post_input_t(void *); | |
| 97 | typedef void tf_param_t(void *, int, unsigned int); | |
| 98 | #define	TP_SHOWCURSOR	0 | |
| 99 | #define	TP_KEYPADAPP	1 | |
| 100 | #define	TP_AUTOREPEAT	2 | |
| 101 | #define	TP_SWITCHVT	3 | |
| 102 | #define	TP_132COLS	4 | |
| 103 | #define	TP_SETBELLPD	5 | |
| 104 | #define	TP_SETBELLPD_PITCH(pd)		((pd) >> 16) | |
| 105 | #define	TP_SETBELLPD_DURATION(pd)	((pd) & 0xffff) | |
| 106 | #define	TP_MOUSE	6 | |
| 107 | #define	TP_SETBORDER	7 | |
| 108 | #define	TP_SETLOCALCURSOR	8 | |
| 109 | #define	TP_SETGLOBALCURSOR	9 | |
| 110 | typedef void tf_respond_t(void *, const void *, size_t); | |
| 111 | ||
| 112 | typedef struct { | |
| 113 | 	tf_bell_t	*tf_bell; | |
| 114 | 	tf_cursor_t	*tf_cursor; | |
| 115 | 	tf_putchar_t	*tf_putchar; | |
| 116 | 	tf_fill_t	*tf_fill; | |
| 117 | 	tf_copy_t	*tf_copy; | |
| 118 | 	tf_pre_input_t	*tf_pre_input; | |
| 119 | 	tf_post_input_t	*tf_post_input; | |
| 120 | 	tf_param_t	*tf_param; | |
| 121 | 	tf_respond_t	*tf_respond; | |
| 122 | } teken_funcs_t; | |
| 123 | ||
| 124 | typedef teken_char_t teken_scs_t(const teken_t *, teken_char_t); | |
| 125 | ||
| 126 | /* | |
| 127 | * Terminal state. | |
| 128 | */ | |
| 129 | ||
| 130 | struct __teken { | |
| 131 | 	const teken_funcs_t *t_funcs; | |
| 132 | 	void		*t_softc; | |
| 133 | ||
| 134 | 	teken_state_t	*t_nextstate; | |
| 135 | 	unsigned int	 t_stateflags; | |
| 136 | ||
| 137 | #define T_NUMSIZE	8 | |
| 138 | 	unsigned int	 t_nums[T_NUMSIZE]; | |
| 139 | 	unsigned int	 t_curnum; | |
| 140 | ||
| 141 | 	teken_pos_t	 t_cursor; | |
| 142 | 	teken_attr_t	 t_curattr; | |
| 143 | 	teken_pos_t	 t_saved_cursor; | |
| 144 | 	teken_attr_t	 t_saved_curattr; | |
| 145 | ||
| 146 | 	teken_attr_t	 t_defattr; | |
| 147 | 	teken_pos_t	 t_winsize; | |
| 148 | ||
| 149 | 	/* For DECSTBM. */ | |
| 150 | 	teken_span_t	 t_scrollreg; | |
| 151 | 	/* For DECOM. */ | |
| 152 | 	teken_span_t	 t_originreg; | |
| 153 | ||
| 154 | #define	T_NUMCOL	160 | |
| 155 | 	unsigned int	 t_tabstops[T_NUMCOL / (sizeof(unsigned int) * 8)]; | |
| 156 | ||
| 157 | 	unsigned int	 t_utf8_left; | |
| 158 | 	teken_char_t	 t_utf8_partial; | |
| 159 | 	teken_char_t	 t_last; | |
| 160 | ||
| 161 | 	unsigned int	 t_curscs; | |
| 162 | 	teken_scs_t	*t_saved_curscs; | |
| 163 | 	teken_scs_t	*t_scs[2]; | |
| 164 | }; | |
| 165 | ||
| 166 | /* Initialize teken structure. */ | |
| 167 | void	teken_init(teken_t *, const teken_funcs_t *, void *); | |
| 168 | ||
| 169 | /* Deliver character input. */ | |
| 170 | void	teken_input(teken_t *, const void *, size_t); | |
| 171 | ||
| 172 | /* Get/set teken attributes. */ | |
| 173 | const teken_pos_t *teken_get_cursor(const teken_t *); | |
| 174 | const teken_attr_t *teken_get_curattr(const teken_t *); | |
| 175 | const teken_attr_t *teken_get_defattr(const teken_t *); | |
| 176 | void	teken_get_defattr_cons25(const teken_t *, int *, int *); | |
| 177 | const teken_pos_t *teken_get_winsize(const teken_t *); | |
| 178 | void	teken_set_cursor(teken_t *, const teken_pos_t *); | |
| 179 | void	teken_set_curattr(teken_t *, const teken_attr_t *); | |
| 180 | void	teken_set_defattr(teken_t *, const teken_attr_t *); | |
| 181 | void	teken_set_winsize(teken_t *, const teken_pos_t *); | |
| 182 | void	teken_set_winsize_noreset(teken_t *, const teken_pos_t *); | |
| 183 | ||
| 184 | /* Key input escape sequences. */ | |
| 185 | #define	TKEY_UP		0x00 | |
| 186 | #define	TKEY_DOWN	0x01 | |
| 187 | #define	TKEY_LEFT	0x02 | |
| 188 | #define	TKEY_RIGHT	0x03 | |
| 189 | ||
| 190 | #define	TKEY_HOME	0x04 | |
| 191 | #define	TKEY_END	0x05 | |
| 192 | #define	TKEY_INSERT	0x06 | |
| 193 | #define	TKEY_DELETE	0x07 | |
| 194 | #define	TKEY_PAGE_UP	0x08 | |
| 195 | #define	TKEY_PAGE_DOWN	0x09 | |
| 196 | ||
| 197 | #define	TKEY_F1		0x0a | |
| 198 | #define	TKEY_F2		0x0b | |
| 199 | #define	TKEY_F3		0x0c | |
| 200 | #define	TKEY_F4		0x0d | |
| 201 | #define	TKEY_F5		0x0e | |
| 202 | #define	TKEY_F6		0x0f | |
| 203 | #define	TKEY_F7		0x10 | |
| 204 | #define	TKEY_F8		0x11 | |
| 205 | #define	TKEY_F9		0x12 | |
| 206 | #define	TKEY_F10	0x13 | |
| 207 | #define	TKEY_F11	0x14 | |
| 208 | #define	TKEY_F12	0x15 | |
| 209 | const char *teken_get_sequence(const teken_t *, unsigned int); | |
| 210 | ||
| 211 | /* Legacy features. */ | |
| 212 | void	teken_set_8bit(teken_t *); | |
| 213 | void	teken_set_cons25(teken_t *); | |
| 214 | void	teken_set_cons25keys(teken_t *); | |
| 215 | ||
| 216 | /* Color conversion. */ | |
| 217 | teken_color_t teken_256to16(teken_color_t); | |
| 218 | teken_color_t teken_256to8(teken_color_t); | |
| 219 | ||
| 220 | #endif /* !_TEKEN_H_ */ | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/termios.h-2| ... | ... | @@ -27,8 +27,6 @@ |
| 27 | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | * | |
| 31 | *	@(#)termios.h	8.3 (Berkeley) 3/28/94 | |
| 32 | 30 | */ |
| 33 | 31 | |
| 34 | 32 | #ifndef _TERMIOS_H_ |
lib/libc/include/generic-freebsd/time.h+6-3| ... | ... | @@ -32,8 +32,6 @@ |
| 32 | 32 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 33 | 33 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 34 | 34 | * SUCH DAMAGE. |
| 35 | * | |
| 36 | *	@(#)time.h	8.3 (Berkeley) 1/21/94 | |
| 37 | 35 | */ |
| 38 | 36 | |
| 39 | 37 | /* |
| ... | ... | @@ -157,6 +155,8 @@ int clock_nanosleep(clockid_t, int, const struct timespec *, struct timespec *); |
| 157 | 155 | #if __POSIX_VISIBLE >= 199506 |
| 158 | 156 | char *asctime_r(const struct tm *, char *); |
| 159 | 157 | char *ctime_r(const time_t *, char *); |
| 158 | #endif | |
| 159 | #if __POSIX_VISIBLE >= 199506 || __ISO_C_VISIBLE >= 2023 | |
| 160 | 160 | struct tm *gmtime_r(const time_t *, struct tm *); |
| 161 | 161 | struct tm *localtime_r(const time_t *, struct tm *); |
| 162 | 162 | #endif |
| ... | ... | @@ -164,15 +164,18 @@ struct tm *localtime_r(const time_t *, struct tm *); |
| 164 | 164 | #if __XSI_VISIBLE |
| 165 | 165 | char *strptime(const char * __restrict, const char * __restrict, |
| 166 | 166 | struct tm * __restrict); |
| 167 | extern long timezone; | |
| 168 | extern int daylight; | |
| 167 | 169 | #endif |
| 168 | 170 | |
| 169 | 171 | #if __BSD_VISIBLE |
| 170 | char *timezone(int, int);	/* XXX XSI conflict */ | |
| 171 | 172 | time_t timelocal(struct tm * const); |
| 172 | 173 | time_t timegm(struct tm * const); |
| 173 | 174 | int timer_oshandle_np(timer_t timerid); |
| 174 | 175 | time_t time2posix(time_t t); |
| 175 | 176 | time_t posix2time(time_t t); |
| 177 | struct tm *offtime(const time_t *, long); | |
| 178 | struct tm *offtime_r(const time_t *__restrict, long, struct tm *__restrict); | |
| 176 | 179 | #endif /* __BSD_VISIBLE */ |
| 177 | 180 | |
| 178 | 181 | #if __POSIX_VISIBLE >= 200809 || defined(_XLOCALE_H_) |
lib/libc/include/generic-freebsd/timeconv.h-2| ... | ... | @@ -32,8 +32,6 @@ |
| 32 | 32 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 33 | 33 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 34 | 34 | * SUCH DAMAGE. |
| 35 | * | |
| 36 | *	@(#)time.h	8.3 (Berkeley) 1/21/94 | |
| 37 | 35 | */ |
| 38 | 36 | |
| 39 | 37 | /* |
lib/libc/include/generic-freebsd/ttyent.h-2| ... | ... | @@ -27,8 +27,6 @@ |
| 27 | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | * | |
| 31 | *	@(#)ttyent.h	8.1 (Berkeley) 6/2/93 | |
| 32 | 30 | */ |
| 33 | 31 | |
| 34 | 32 | #ifndef	_TTYENT_H_ |
lib/libc/include/generic-freebsd/ufs/ffs/ffs_extern.h+2-3| ... | ... | @@ -27,8 +27,6 @@ |
| 27 | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | * | |
| 31 | *	@(#)ffs_extern.h	8.6 (Berkeley) 3/30/95 | |
| 32 | 30 | */ |
| 33 | 31 | |
| 34 | 32 | #ifndef _UFS_FFS_EXTERN_H |
| ... | ... | @@ -84,7 +82,8 @@ int	ffs_inotovp(struct mount *, ino_t, uint64_t, int, struct vnode **, |
| 84 | 82 | 	 int); |
| 85 | 83 | int	ffs_isblock(struct fs *, uint8_t *, ufs1_daddr_t); |
| 86 | 84 | int	ffs_isfreeblock(struct fs *, uint8_t *, ufs1_daddr_t); |
| 87 | void	ffs_oldfscompat_write(struct fs *, struct ufsmount *); | |
| 85 | void	ffs_oldfscompat_write(struct fs *); | |
| 86 | bool	ffs_oldfscompat_inode_read(struct fs *, union dinodep, time_t); | |
| 88 | 87 | int	ffs_own_mount(const struct mount *mp); |
| 89 | 88 | int	ffs_sbsearch(void *, struct fs **, int, struct malloc_type *, |
| 90 | 89 | 	 int (*)(void *, off_t, void **, int)); |
lib/libc/include/generic-freebsd/ufs/ffs/fs.h+3-4| ... | ... | @@ -27,8 +27,6 @@ |
| 27 | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | * | |
| 31 | *	@(#)fs.h	8.13 (Berkeley) 3/21/95 | |
| 32 | 30 | */ |
| 33 | 31 | |
| 34 | 32 | #ifndef _UFS_FFS_FS_H_ |
| ... | ... | @@ -413,7 +411,8 @@ struct fs { |
| 413 | 411 | 	int64_t	 fs_unrefs;		/* number of unreferenced inodes */ |
| 414 | 412 | 	int64_t fs_providersize;	/* size of underlying GEOM provider */ |
| 415 | 413 | 	int64_t	 fs_metaspace;		/* size of area reserved for metadata */ |
| 416 | 	int64_t	 fs_sparecon64[13];	/* old rotation block list head */ | |
| 414 | 	uint64_t fs_save_maxfilesize;	/* save old UFS1 maxfilesize */ | |
| 415 | 	int64_t	 fs_sparecon64[12];	/* old rotation block list head */ | |
| 417 | 416 | 	int64_t	 fs_sblockactualloc;	/* byte offset of this superblock */ |
| 418 | 417 | 	int64_t	 fs_sblockloc;		/* byte offset of standard superblock */ |
| 419 | 418 | 	struct	csum_total fs_cstotal;	/* (u) cylinder summary information */ |
| ... | ... | @@ -426,7 +425,7 @@ struct fs { |
| 426 | 425 | 	uint32_t fs_snapinum[FSMAXSNAP];/* list of snapshot inode numbers */ |
| 427 | 426 | 	uint32_t fs_avgfilesize;	/* expected average file size */ |
| 428 | 427 | 	uint32_t fs_avgfpdir;		/* expected # of files per directory */ |
| 429 | 	int32_t	 fs_save_cgsize;	/* save real cg size to use fs_bsize */ | |
| 428 | 	uint32_t fs_available_spare;	/* old scratch space */ | |
| 430 | 429 | 	ufs_time_t fs_mtime;		/* Last mount or fsck time. */ |
| 431 | 430 | 	int32_t fs_sujfree;		/* SUJ free list */ |
| 432 | 431 | 	int32_t	 fs_sparecon32[21];	/* reserved for future constants */ |
lib/libc/include/generic-freebsd/ufs/ffs/softdep.h-2| ... | ... | @@ -36,8 +36,6 @@ |
| 36 | 36 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 37 | 37 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 38 | 38 | * SUCH DAMAGE. |
| 39 | * | |
| 40 | *	@(#)softdep.h	9.7 (McKusick) 6/21/00 | |
| 41 | 39 | */ |
| 42 | 40 | |
| 43 | 41 | #include <sys/queue.h> |
lib/libc/include/generic-freebsd/ufs/ufs/dinode.h+20-8| ... | ... | @@ -62,8 +62,6 @@ |
| 62 | 62 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 63 | 63 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 64 | 64 | * SUCH DAMAGE. |
| 65 | * | |
| 66 | *	@(#)dinode.h	8.3 (Berkeley) 1/21/94 | |
| 67 | 65 | */ |
| 68 | 66 | |
| 69 | 67 | #ifndef _UFS_UFS_DINODE_H_ |
| ... | ... | @@ -113,12 +111,13 @@ typedef int64_t ufs_time_t; |
| 113 | 111 | #define	IFWHT		0160000		/* Whiteout. */ |
| 114 | 112 | |
| 115 | 113 | /* |
| 116 | * A dinode contains all the meta-data associated with a UFS2 file. | |
| 117 | * This structure defines the on-disk format of a dinode. Since | |
| 114 | * Each UFS filesystem version defines the on-disk format of its dinode. | |
| 115 | * | |
| 116 | * A UFS2 dinode contains all the meta-data associated with a UFS2 file. | |
| 117 | * This structure defines the on-disk format of a UFS2 dinode. Since | |
| 118 | 118 | * this structure describes an on-disk structure, all its fields |
| 119 | 119 | * are defined by types with precise widths. |
| 120 | 120 | */ |
| 121 | ||
| 122 | 121 | #define	UFS_NXADDR	2		/* External addresses in inode. */ |
| 123 | 122 | #define	UFS_NDADDR	12		/* Direct addresses in inode. */ |
| 124 | 123 | #define	UFS_NIADDR	3		/* Indirect addresses in inode. */ |
| ... | ... | @@ -186,11 +185,11 @@ struct ufs1_dinode { |
| 186 | 185 | 		uint32_t di_dirdepth;	/* 4: IFDIR: depth from root dir */ |
| 187 | 186 | 	}; |
| 188 | 187 | 	uint64_t	di_size;	/* 8: File byte count. */ |
| 189 | 	int32_t		di_atime;	/* 16: Last access time. */ | |
| 188 | 	uint32_t	di_atime;	/* 16: Last access time. */ | |
| 190 | 189 | 	int32_t		di_atimensec;	/* 20: Last access time. */ |
| 191 | 	int32_t		di_mtime;	/* 24: Last modified time. */ | |
| 190 | 	uint32_t	di_mtime;	/* 24: Last modified time. */ | |
| 192 | 191 | 	int32_t		di_mtimensec;	/* 28: Last modified time. */ |
| 193 | 	int32_t		di_ctime;	/* 32: Last inode change time. */ | |
| 192 | 	uint32_t	di_ctime;	/* 32: Last inode change time. */ | |
| 194 | 193 | 	int32_t		di_ctimensec;	/* 36: Last inode change time. */ |
| 195 | 194 | 	union { |
| 196 | 195 | 		struct { |
| ... | ... | @@ -212,4 +211,17 @@ struct ufs1_dinode { |
| 212 | 211 | |
| 213 | 212 | #define	UFS_LINK_MAX	65500	/* leave a few spare for special values */ |
| 214 | 213 | |
| 214 | /* | |
| 215 | * These structures hold or reference an on-disk dinode. | |
| 216 | */ | |
| 217 | union dinode { | |
| 218 | 	struct ufs1_dinode dp1; | |
| 219 | 	struct ufs2_dinode dp2; | |
| 220 | }; | |
| 221 | ||
| 222 | union dinodep { | |
| 223 | 	struct ufs1_dinode *dp1; | |
| 224 | 	struct ufs2_dinode *dp2; | |
| 225 | }; | |
| 226 | ||
| 215 | 227 | #endif /* _UFS_UFS_DINODE_H_ */ |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/ufs/ufs/dir.h-2| ... | ... | @@ -32,8 +32,6 @@ |
| 32 | 32 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 33 | 33 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 34 | 34 | * SUCH DAMAGE. |
| 35 | * | |
| 36 | *	@(#)dir.h	8.2 (Berkeley) 1/21/94 | |
| 37 | 35 | */ |
| 38 | 36 | |
| 39 | 37 | #ifndef _UFS_UFS_DIR_H_ |
lib/libc/include/generic-freebsd/ufs/ufs/inode.h+3-8| ... | ... | @@ -32,8 +32,6 @@ |
| 32 | 32 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 33 | 33 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 34 | 34 | * SUCH DAMAGE. |
| 35 | * | |
| 36 | *	@(#)inode.h	8.9 (Berkeley) 5/14/95 | |
| 37 | 35 | */ |
| 38 | 36 | |
| 39 | 37 | #ifndef _UFS_UFS_INODE_H_ |
| ... | ... | @@ -90,10 +88,7 @@ struct inode { |
| 90 | 88 | 	/* |
| 91 | 89 | 	 * The real copy of the on-disk inode. |
| 92 | 90 | 	 */ |
| 93 | 	union { | |
| 94 | 		struct ufs1_dinode *din1;	/* UFS1 on-disk dinode. */ | |
| 95 | 		struct ufs2_dinode *din2;	/* UFS2 on-disk dinode. */ | |
| 96 | 	} dinode_u; | |
| 91 | 	union dinodep i_dp;	/* On-disk dinode */ | |
| 97 | 92 | |
| 98 | 93 | 	ino_t	 i_number;	/* The identity of the inode. */ |
| 99 | 94 | 	uint32_t i_flag;	/* flags, see below */ |
| ... | ... | @@ -206,8 +201,8 @@ struct inode { |
| 206 | 201 | |
| 207 | 202 | #define	i_dirhash i_un.dirhash |
| 208 | 203 | #define	i_snapblklist i_un.snapblklist |
| 209 | #define	i_din1 dinode_u.din1 | |
| 210 | #define	i_din2 dinode_u.din2 | |
| 204 | #define	i_din1 i_dp.dp1 | |
| 205 | #define	i_din2 i_dp.dp2 | |
| 211 | 206 | |
| 212 | 207 | #define	ITOUMP(ip)	((ip)->i_ump) |
| 213 | 208 | #define	ITODEV(ip)	(ITOUMP(ip)->um_dev) |
lib/libc/include/generic-freebsd/ufs/ufs/quota.h-2| ... | ... | @@ -30,8 +30,6 @@ |
| 30 | 30 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 31 | 31 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 32 | 32 | * SUCH DAMAGE. |
| 33 | * | |
| 34 | *	@(#)quota.h	8.3 (Berkeley) 8/19/94 | |
| 35 | 33 | */ |
| 36 | 34 | |
| 37 | 35 | #ifndef _UFS_UFS_QUOTA_H_ |
lib/libc/include/generic-freebsd/ufs/ufs/ufs_extern.h+5-7| ... | ... | @@ -27,8 +27,6 @@ |
| 27 | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | * | |
| 31 | *	@(#)ufs_extern.h	8.10 (Berkeley) 5/14/95 | |
| 32 | 30 | */ |
| 33 | 31 | |
| 34 | 32 | #ifndef _UFS_UFS_EXTERN_H_ |
| ... | ... | @@ -61,15 +59,15 @@ int	 ufs_bmap_seekdata(struct vnode *, off_t *); |
| 61 | 59 | int	 ufs_checkpath(ino_t, ino_t, struct inode *, struct ucred *, ino_t *); |
| 62 | 60 | void	 ufs_dirbad(struct inode *, doff_t, char *); |
| 63 | 61 | int	 ufs_dirbadentry(struct vnode *, struct direct *, int); |
| 64 | int	 ufs_dirempty(struct inode *, ino_t, struct ucred *); | |
| 62 | int	 ufs_dirempty(struct inode *, ino_t, struct ucred *, int); | |
| 65 | 63 | int	 ufs_extread(struct vop_read_args *); |
| 66 | 64 | int	 ufs_extwrite(struct vop_write_args *); |
| 67 | 65 | void	 ufs_makedirentry(struct inode *, struct componentname *, |
| 68 | 66 | 	 struct direct *); |
| 69 | 67 | int	 ufs_direnter(struct vnode *, struct vnode *, struct direct *, |
| 70 | 68 | 	 struct componentname *, struct buf *); |
| 71 | int	 ufs_dirremove(struct vnode *, struct inode *, int, int); | |
| 72 | int	 ufs_dirrewrite(struct inode *, struct inode *, ino_t, int, int); | |
| 69 | int	 ufs_dirremove(struct vnode *, struct inode *, int, bool); | |
| 70 | int	 ufs_dirrewrite(struct inode *, struct inode *, ino_t, int, u_int); | |
| 73 | 71 | int	 ufs_lookup_ino(struct vnode *, struct vnode **, struct componentname *, |
| 74 | 72 | 	 ino_t *); |
| 75 | 73 | int	 ufs_getlbns(struct vnode *, ufs2_daddr_t, struct indir *, int *); |
| ... | ... | @@ -95,9 +93,9 @@ int	softdep_setup_directory_add(struct buf *, struct inode *, off_t, |
| 95 | 93 | 	 ino_t, struct buf *, int); |
| 96 | 94 | void	softdep_change_directoryentry_offset(struct buf *, struct inode *, |
| 97 | 95 | 	 caddr_t, caddr_t, caddr_t, int); |
| 98 | void	softdep_setup_remove(struct buf *,struct inode *, struct inode *, int); | |
| 96 | void	softdep_setup_remove(struct buf *,struct inode *, struct inode *, bool); | |
| 99 | 97 | void	softdep_setup_directory_change(struct buf *, struct inode *, |
| 100 | 	 struct inode *, ino_t, int); | |
| 98 | 	 struct inode *, ino_t, u_int); | |
| 101 | 99 | void	softdep_change_linkcnt(struct inode *); |
| 102 | 100 | int	softdep_slowdown(struct vnode *); |
| 103 | 101 | void	softdep_setup_create(struct inode *, struct inode *); |
lib/libc/include/generic-freebsd/ufs/ufs/ufsmount.h-4| ... | ... | @@ -27,8 +27,6 @@ |
| 27 | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | * | |
| 31 | *	@(#)ufsmount.h	8.6 (Berkeley) 3/30/95 | |
| 32 | 30 | */ |
| 33 | 31 | |
| 34 | 32 | #ifndef _UFS_UFS_UFSMOUNT_H_ |
| ... | ... | @@ -99,8 +97,6 @@ struct ufsmount { |
| 99 | 97 | 	uint64_t um_maxsymlinklen;		/* (c) max size of short |
| 100 | 98 | 						 symlink */ |
| 101 | 99 | 	struct	mtx um_lock;			/* (c) Protects ufsmount & fs */ |
| 102 | 	struct	sx um_checkpath_lock;		/* (c) Protects ufs_checkpath() | |
| 103 | 						 result */ | |
| 104 | 100 | 	struct	mount_softdeps *um_softdep;	/* (c) softdep mgmt structure */ |
| 105 | 101 | 	struct	vnode *um_quotas[MAXQUOTAS];	/* (q) pointer to quota files */ |
| 106 | 102 | 	struct	ucred *um_cred[MAXQUOTAS];	/* (q) quota file access cred */ |
lib/libc/include/generic-freebsd/unistd.h+10-3| ... | ... | @@ -27,19 +27,20 @@ |
| 27 | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | * | |
| 31 | *	@(#)unistd.h	8.12 (Berkeley) 4/27/95 | |
| 32 | 30 | */ |
| 33 | 31 | |
| 34 | 32 | #ifndef _UNISTD_H_ |
| 35 | 33 | #define	_UNISTD_H_ |
| 36 | 34 | |
| 37 | #include <sys/cdefs.h> | |
| 38 | 35 | #include <sys/types.h>			/* XXX adds too much pollution. */ |
| 39 | 36 | #include <sys/unistd.h> |
| 40 | 37 | #include <sys/_null.h> |
| 41 | 38 | #include <sys/_types.h> |
| 42 | 39 | |
| 40 | #if !defined(_STANDALONE) && defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE > 0 | |
| 41 | #include <ssp/unistd.h> | |
| 42 | #endif | |
| 43 | ||
| 43 | 44 | #ifndef _GID_T_DECLARED |
| 44 | 45 | typedef	__gid_t		gid_t; |
| 45 | 46 | #define	_GID_T_DECLARED |
| ... | ... | @@ -291,6 +292,11 @@ typedef	__useconds_t	useconds_t; |
| 291 | 292 | #define	_SC_NPROCESSORS_CONF	57 |
| 292 | 293 | #define	_SC_NPROCESSORS_ONLN	58 |
| 293 | 294 | #define	_SC_CPUSET_SIZE		122 |
| 295 | #define	_SC_UEXTERR_MAXLEN	123 /* user */ | |
| 296 | #endif | |
| 297 | ||
| 298 | #if __POSIX_VISIBLE >= 202405 | |
| 299 | #define	_SC_NSIG		124 | |
| 294 | 300 | #endif |
| 295 | 301 | |
| 296 | 302 | /* Extensions found in Solaris and Linux. */ |
| ... | ... | @@ -506,6 +512,7 @@ int	 exect(const char *, char * const *, char * const *); |
| 506 | 512 | int	 execvP(const char *, const char *, char * const *); |
| 507 | 513 | int	 execvpe(const char *, char * const *, char * const *); |
| 508 | 514 | int	 feature_present(const char *); |
| 515 | int	 fchroot(int); | |
| 509 | 516 | char	*fflagstostr(u_long); |
| 510 | 517 | int	 getdomainname(char *, int); |
| 511 | 518 | int	 getentropy(void *, size_t); |
lib/libc/include/generic-freebsd/utime.h-2| ... | ... | @@ -27,8 +27,6 @@ |
| 27 | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | * | |
| 31 | *	@(#)utime.h	8.1 (Berkeley) 6/2/93 | |
| 32 | 30 | */ |
| 33 | 31 | |
| 34 | 32 | #ifndef	_UTIME_H_ |
lib/libc/include/generic-freebsd/vm/_vm_radix.h+3-6| ... | ... | @@ -31,16 +31,13 @@ |
| 31 | 31 | #ifndef __VM_RADIX_H_ |
| 32 | 32 | #define __VM_RADIX_H_ |
| 33 | 33 | |
| 34 | /* | |
| 35 | * Radix tree node. | |
| 36 | */ | |
| 37 | struct vm_radix_node; | |
| 34 | #include <sys/_pctrie.h> | |
| 38 | 35 | |
| 39 | 36 | /* |
| 40 | * Radix tree root. | |
| 37 | * Radix tree | |
| 41 | 38 | */ |
| 42 | 39 | struct vm_radix { |
| 43 | 	struct vm_radix_node	*rt_root; | |
| 40 | 	struct pctrie	rt_trie; | |
| 44 | 41 | }; |
| 45 | 42 | |
| 46 | 43 | #endif /* !__VM_RADIX_H_ */ |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/vm/pmap.h+8-10| ... | ... | @@ -31,8 +31,6 @@ |
| 31 | 31 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 32 | 32 | * SUCH DAMAGE. |
| 33 | 33 | * |
| 34 | *	from: @(#)pmap.h	8.1 (Berkeley) 6/11/93 | |
| 35 | * | |
| 36 | 34 | * |
| 37 | 35 | * Copyright (c) 1987, 1990 Carnegie-Mellon University. |
| 38 | 36 | * All rights reserved. |
| ... | ... | @@ -83,8 +81,8 @@ typedef struct pmap_statistics *pmap_statistics_t; |
| 83 | 81 | * Each machine-dependent implementation is required to provide: |
| 84 | 82 | * |
| 85 | 83 | * vm_memattr_t	pmap_page_get_memattr(vm_page_t); |
| 86 | * boolean_t	pmap_page_is_mapped(vm_page_t); | |
| 87 | * boolean_t	pmap_page_is_write_mapped(vm_page_t); | |
| 84 | * bool		pmap_page_is_mapped(vm_page_t); | |
| 85 | * bool		pmap_page_is_write_mapped(vm_page_t); | |
| 88 | 86 | * void		pmap_page_set_memattr(vm_page_t, vm_memattr_t); |
| 89 | 87 | */ |
| 90 | 88 | #include <machine/pmap.h> |
| ... | ... | @@ -138,17 +136,17 @@ void		 pmap_enter_quick(pmap_t pmap, vm_offset_t va, vm_page_t m, |
| 138 | 136 | vm_paddr_t	 pmap_extract(pmap_t pmap, vm_offset_t va); |
| 139 | 137 | vm_page_t	 pmap_extract_and_hold(pmap_t pmap, vm_offset_t va, |
| 140 | 138 | 		 vm_prot_t prot); |
| 141 | void		 pmap_growkernel(vm_offset_t); | |
| 139 | int		 pmap_growkernel(vm_offset_t); | |
| 142 | 140 | void		 pmap_init(void); |
| 143 | boolean_t	 pmap_is_modified(vm_page_t m); | |
| 144 | boolean_t	 pmap_is_prefaultable(pmap_t pmap, vm_offset_t va); | |
| 145 | boolean_t	 pmap_is_referenced(vm_page_t m); | |
| 146 | boolean_t	 pmap_is_valid_memattr(pmap_t, vm_memattr_t); | |
| 141 | bool		 pmap_is_modified(vm_page_t m); | |
| 142 | bool		 pmap_is_prefaultable(pmap_t pmap, vm_offset_t va); | |
| 143 | bool		 pmap_is_referenced(vm_page_t m); | |
| 144 | bool		 pmap_is_valid_memattr(pmap_t, vm_memattr_t); | |
| 147 | 145 | vm_offset_t	 pmap_map(vm_offset_t *, vm_paddr_t, vm_paddr_t, int); |
| 148 | 146 | int		 pmap_mincore(pmap_t pmap, vm_offset_t addr, vm_paddr_t *pap); |
| 149 | 147 | void		 pmap_object_init_pt(pmap_t pmap, vm_offset_t addr, |
| 150 | 148 | 		 vm_object_t object, vm_pindex_t pindex, vm_size_t size); |
| 151 | boolean_t	 pmap_page_exists_quick(pmap_t pmap, vm_page_t m); | |
| 149 | bool		 pmap_page_exists_quick(pmap_t pmap, vm_page_t m); | |
| 152 | 150 | void		 pmap_page_init(vm_page_t m); |
| 153 | 151 | int		 pmap_page_wired_mappings(vm_page_t m); |
| 154 | 152 | int		 pmap_pinit(pmap_t); |
lib/libc/include/generic-freebsd/vm/swap_pager.h+4-3| ... | ... | @@ -32,8 +32,6 @@ |
| 32 | 32 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 33 | 33 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 34 | 34 | * SUCH DAMAGE. |
| 35 | * | |
| 36 | *	from: @(#)swap_pager.h	7.1 (Berkeley) 12/5/90 | |
| 37 | 35 | */ |
| 38 | 36 | |
| 39 | 37 | #ifndef	_VM_SWAP_PAGER_H_ |
| ... | ... | @@ -70,13 +68,16 @@ struct swdevt { |
| 70 | 68 | |
| 71 | 69 | #ifdef _KERNEL |
| 72 | 70 | |
| 71 | extern bool swap_pager_almost_full; | |
| 73 | 72 | extern int swap_pager_avail; |
| 74 | 73 | extern int nsw_cluster_max; |
| 75 | 74 | |
| 76 | 75 | struct xswdev; |
| 77 | 76 | int swap_dev_info(int name, struct xswdev *xs, char *devname, size_t len); |
| 78 | 77 | void swap_pager_copy(vm_object_t, vm_object_t, vm_pindex_t, int); |
| 79 | vm_pindex_t swap_pager_find_least(vm_object_t object, vm_pindex_t pindex); | |
| 78 | bool swap_pager_scan_all_shadowed(vm_object_t object); | |
| 79 | vm_pindex_t swap_pager_seek_data(vm_object_t object, vm_pindex_t pindex); | |
| 80 | vm_pindex_t swap_pager_seek_hole(vm_object_t object, vm_pindex_t pindex); | |
| 80 | 81 | void swap_pager_freespace(vm_object_t object, vm_pindex_t start, |
| 81 | 82 | vm_size_t size, vm_size_t *freed); |
| 82 | 83 | void swap_pager_swap_init(void); |
lib/libc/include/generic-freebsd/vm/uma.h+1| ... | ... | @@ -252,6 +252,7 @@ uma_zone_t uma_zcache_create(const char *name, int size, uma_ctor ctor, |
| 252 | 252 | #define	UMA_ZONE_SECONDARY	0x0200	/* Zone is a Secondary Zone */ |
| 253 | 253 | #define	UMA_ZONE_NOBUCKET	0x0400	/* Do not use buckets. */ |
| 254 | 254 | #define	UMA_ZONE_MAXBUCKET	0x0800	/* Use largest buckets. */ |
| 255 | #define	UMA_ZONE_NOTRIM		0x1000	/* Don't trim this zone */ | |
| 255 | 256 | #define	UMA_ZONE_CACHESPREAD	0x2000	/* |
| 256 | 257 | 					 * Spread memory start locations across |
| 257 | 258 | 					 * all possible cache lines. May |
lib/libc/include/generic-freebsd/vm/vm.h+7-5| ... | ... | @@ -28,10 +28,6 @@ |
| 28 | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | 30 | * |
| 31 | *	@(#)vm.h	8.2 (Berkeley) 12/13/93 | |
| 32 | *	@(#)vm_prot.h	8.1 (Berkeley) 6/11/93 | |
| 33 | *	@(#)vm_inherit.h	8.1 (Berkeley) 6/11/93 | |
| 34 | * | |
| 35 | 31 | * Copyright (c) 1987, 1990 Carnegie-Mellon University. |
| 36 | 32 | * All rights reserved. |
| 37 | 33 | * |
| ... | ... | @@ -80,6 +76,7 @@ typedef u_char vm_prot_t;	/* protection codes */ |
| 80 | 76 | #define	VM_PROT_COPY		((vm_prot_t) 0x08)	/* copy-on-read */ |
| 81 | 77 | #define	VM_PROT_PRIV_FLAG	((vm_prot_t) 0x10) |
| 82 | 78 | #define	VM_PROT_FAULT_LOOKUP	VM_PROT_PRIV_FLAG |
| 79 | #define	VM_PROT_NO_PROMOTE	VM_PROT_PRIV_FLAG | |
| 83 | 80 | #define	VM_PROT_QUICK_NOFAULT	VM_PROT_PRIV_FLAG	/* same to save bits */ |
| 84 | 81 | |
| 85 | 82 | #define	VM_PROT_ALL		(VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE) |
| ... | ... | @@ -158,6 +155,12 @@ struct kva_md_info { |
| 158 | 155 | #define	SWAP_RESERVE_RLIMIT_ON		(1 << 1) |
| 159 | 156 | #define	SWAP_RESERVE_ALLOW_NONWIRED	(1 << 2) |
| 160 | 157 | |
| 158 | #ifdef NUMA | |
| 159 | #define	__numa_used | |
| 160 | #else | |
| 161 | #define	__numa_used	__unused | |
| 162 | #endif | |
| 163 | ||
| 161 | 164 | #ifdef _KERNEL |
| 162 | 165 | struct ucred; |
| 163 | 166 | |
| ... | ... | @@ -167,7 +170,6 @@ bool swap_reserve_by_cred(vm_ooffset_t incr, struct ucred *cred); |
| 167 | 170 | void swap_reserve_force(vm_ooffset_t incr); |
| 168 | 171 | void swap_release(vm_ooffset_t decr); |
| 169 | 172 | void swap_release_by_cred(vm_ooffset_t decr, struct ucred *cred); |
| 170 | void swapper(void); | |
| 171 | 173 | |
| 172 | 174 | extern struct kva_md_info	kmi; |
| 173 | 175 | #define VA_IS_CLEANMAP(va)					\ |
lib/libc/include/generic-freebsd/vm/vm_domainset.h+13-5| ... | ... | @@ -28,25 +28,33 @@ |
| 28 | 28 | #ifndef __VM_DOMAINSET_H__ |
| 29 | 29 | #define __VM_DOMAINSET_H__ |
| 30 | 30 | |
| 31 | struct pctrie_iter; | |
| 32 | ||
| 31 | 33 | struct vm_domainset_iter { |
| 32 | 34 | 	struct domainset	*di_domain; |
| 33 | 35 | 	unsigned int		*di_iter; |
| 36 | 	/* Initialized from 'di_domain', initial value after reset. */ | |
| 37 | 	domainset_t		di_valid_mask; | |
| 38 | 	/* Domains to browse in the current phase. */ | |
| 39 | 	domainset_t		di_remain_mask; | |
| 40 | 	/* Domains skipped in phase 1 because under 'v_free_min'. */ | |
| 41 | 	domainset_t		di_min_mask; | |
| 34 | 42 | 	vm_pindex_t		di_offset; |
| 35 | 43 | 	int			di_flags; |
| 36 | 44 | 	uint16_t		di_policy; |
| 37 | 	domainid_t		di_n; | |
| 38 | 45 | 	bool			di_minskip; |
| 39 | 46 | }; |
| 40 | 47 | |
| 41 | 48 | int	vm_domainset_iter_page(struct vm_domainset_iter *, struct vm_object *, |
| 42 | 	 int *); | |
| 43 | void	vm_domainset_iter_page_init(struct vm_domainset_iter *, | |
| 49 | 	 int *, struct pctrie_iter *); | |
| 50 | int	vm_domainset_iter_page_init(struct vm_domainset_iter *, | |
| 44 | 51 | 	 struct vm_object *, vm_pindex_t, int *, int *); |
| 45 | 52 | int	vm_domainset_iter_policy(struct vm_domainset_iter *, int *); |
| 46 | void	vm_domainset_iter_policy_init(struct vm_domainset_iter *, | |
| 53 | int	vm_domainset_iter_policy_init(struct vm_domainset_iter *, | |
| 47 | 54 | 	 struct domainset *, int *, int *); |
| 48 | void	vm_domainset_iter_policy_ref_init(struct vm_domainset_iter *, | |
| 55 | int	vm_domainset_iter_policy_ref_init(struct vm_domainset_iter *, | |
| 49 | 56 | 	 struct domainset_ref *, int *, int *); |
| 57 | void	vm_domainset_iter_ignore(struct vm_domainset_iter *, int); | |
| 50 | 58 | |
| 51 | 59 | int	vm_wait_doms(const domainset_t *, int mflags); |
| 52 | 60 |
lib/libc/include/generic-freebsd/vm/vm_extern.h+4-6| ... | ... | @@ -27,8 +27,6 @@ |
| 27 | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | * | |
| 31 | *	@(#)vm_extern.h	8.2 (Berkeley) 1/12/94 | |
| 32 | 30 | */ |
| 33 | 31 | |
| 34 | 32 | #ifndef _VM_EXTERN_H_ |
| ... | ... | @@ -85,14 +83,16 @@ void kmem_init(vm_offset_t, vm_offset_t); |
| 85 | 83 | void kmem_init_zero_region(void); |
| 86 | 84 | void kmeminit(void); |
| 87 | 85 | |
| 88 | int kernacc(void *, int, int); | |
| 89 | int useracc(void *, int, int); | |
| 86 | bool kernacc(void *, int, int); | |
| 87 | bool useracc(void *, int, int); | |
| 90 | 88 | int vm_fault(vm_map_t map, vm_offset_t vaddr, vm_prot_t fault_type, |
| 91 | 89 | int fault_flags, vm_page_t *m_hold); |
| 92 | 90 | void vm_fault_copy_entry(vm_map_t, vm_map_t, vm_map_entry_t, vm_map_entry_t, |
| 93 | 91 | vm_ooffset_t *); |
| 94 | 92 | int vm_fault_disable_pagefaults(void); |
| 95 | 93 | void vm_fault_enable_pagefaults(int save); |
| 94 | int vm_fault_hold_pages(vm_map_t map, vm_offset_t addr, vm_size_t len, | |
| 95 | vm_prot_t prot, vm_page_t *ma, int max_count, int *ppages_count); | |
| 96 | 96 | int vm_fault_quick_hold_pages(vm_map_t map, vm_offset_t addr, vm_size_t len, |
| 97 | 97 | vm_prot_t prot, vm_page_t *ma, int max_count); |
| 98 | 98 | int vm_fault_trap(vm_map_t map, vm_offset_t vaddr, vm_prot_t fault_type, |
| ... | ... | @@ -129,8 +129,6 @@ struct sf_buf *vm_imgact_map_page(vm_object_t object, vm_ooffset_t offset); |
| 129 | 129 | void vm_imgact_unmap_page(struct sf_buf *sf); |
| 130 | 130 | void vm_thread_dispose(struct thread *td); |
| 131 | 131 | int vm_thread_new(struct thread *td, int pages); |
| 132 | void vm_thread_stack_back(struct domainset *ds, vm_offset_t kaddr, | |
| 133 | vm_page_t ma[], int npages, int req_class); | |
| 134 | 132 | u_int vm_active_count(void); |
| 135 | 133 | u_int vm_inactive_count(void); |
| 136 | 134 | u_int vm_laundry_count(void); |
lib/libc/include/generic-freebsd/vm/vm_kern.h-5| ... | ... | @@ -31,8 +31,6 @@ |
| 31 | 31 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 32 | 32 | * SUCH DAMAGE. |
| 33 | 33 | * |
| 34 | *	from: @(#)vm_kern.h	8.1 (Berkeley) 6/11/93 | |
| 35 | * | |
| 36 | 34 | * |
| 37 | 35 | * Copyright (c) 1987, 1990 Carnegie-Mellon University. |
| 38 | 36 | * All rights reserved. |
| ... | ... | @@ -71,13 +69,10 @@ extern struct vm_map exec_map_store; |
| 71 | 69 | extern struct vm_map pipe_map_store; |
| 72 | 70 | #define	pipe_map	(&pipe_map_store) |
| 73 | 71 | extern struct vmem *kernel_arena; |
| 74 | extern struct vmem *kmem_arena; | |
| 75 | 72 | extern struct vmem *buffer_arena; |
| 76 | 73 | extern struct vmem *transient_arena; |
| 77 | 74 | extern struct vmem *memguard_arena; |
| 78 | 75 | extern u_long vm_kmem_size; |
| 79 | 76 | extern u_int exec_map_entries; |
| 80 | 77 | extern u_int exec_map_entry_size; |
| 81 | extern vm_object_t kstack_object; | |
| 82 | ||
| 83 | 78 | #endif /* _VM_VM_KERN_H_ */ |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/vm/vm_map.h+37-28| ... | ... | @@ -31,8 +31,6 @@ |
| 31 | 31 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 32 | 32 | * SUCH DAMAGE. |
| 33 | 33 | * |
| 34 | *	@(#)vm_map.h	8.9 (Berkeley) 5/17/95 | |
| 35 | * | |
| 36 | 34 | * |
| 37 | 35 | * Copyright (c) 1987, 1990 Carnegie-Mellon University. |
| 38 | 36 | * All rights reserved. |
| ... | ... | @@ -77,7 +75,6 @@ |
| 77 | 75 | *	vm_map_entry_t		an entry in an address map. |
| 78 | 76 | */ |
| 79 | 77 | |
| 80 | typedef u_char vm_flags_t; | |
| 81 | 78 | typedef u_int vm_eflags_t; |
| 82 | 79 | |
| 83 | 80 | /* |
| ... | ... | @@ -96,9 +93,9 @@ union vm_map_object { |
| 96 | 93 | *	and user-exported inheritance and protection information. |
| 97 | 94 | *	Also included is control information for virtual copy operations. |
| 98 | 95 | * |
| 99 | *	For stack gap map entries (MAP_ENTRY_GUARD | MAP_ENTRY_GROWS_DOWN | |
| 100 | *	or UP), the next_read member is reused as the stack_guard_page | |
| 101 | *	storage, and offset is the stack protection. | |
| 96 | *	For stack gap map entries (MAP_ENTRY_GUARD | MAP_ENTRY_STACK_GAP), | |
| 97 | *	the next_read member is reused as the stack_guard_page storage, and | |
| 98 | *	offset is the stack protection. | |
| 102 | 99 | */ |
| 103 | 100 | struct vm_map_entry { |
| 104 | 101 | 	struct vm_map_entry *left;	/* left child or previous entry */ |
| ... | ... | @@ -141,14 +138,14 @@ struct vm_map_entry { |
| 141 | 138 | 							 a core */ |
| 142 | 139 | #define	MAP_ENTRY_VN_EXEC		0x00000800	/* text vnode mapping */ |
| 143 | 140 | #define	MAP_ENTRY_GROWS_DOWN		0x00001000	/* top-down stacks */ |
| 144 | #define	MAP_ENTRY_GROWS_UP		0x00002000	/* bottom-up stacks */ | |
| 141 | #define	MAP_ENTRY_UNUSED0		0x00002000 | |
| 145 | 142 | |
| 146 | 143 | #define	MAP_ENTRY_WIRE_SKIPPED		0x00004000 |
| 147 | 144 | #define	MAP_ENTRY_WRITECNT		0x00008000	/* tracked writeable |
| 148 | 145 | 							 mapping */ |
| 149 | 146 | #define	MAP_ENTRY_GUARD			0x00010000 |
| 150 | #define	MAP_ENTRY_STACK_GAP_DN		0x00020000 | |
| 151 | #define	MAP_ENTRY_STACK_GAP_UP		0x00040000 | |
| 147 | #define	MAP_ENTRY_STACK_GAP		0x00020000 | |
| 148 | #define	MAP_ENTRY_UNUSED1		0x00040000 | |
| 152 | 149 | #define	MAP_ENTRY_HEADER		0x00080000 |
| 153 | 150 | |
| 154 | 151 | #define	MAP_ENTRY_SPLIT_BOUNDARY_MASK	0x00300000 |
| ... | ... | @@ -205,14 +202,14 @@ vm_map_entry_system_wired_count(vm_map_entry_t entry) |
| 205 | 202 | */ |
| 206 | 203 | struct vm_map { |
| 207 | 204 | 	struct vm_map_entry header;	/* List of entries */ |
| 208 | 	struct sx lock;			/* Lock for map data */ | |
| 209 | 	struct mtx system_mtx; | |
| 205 | 	union { | |
| 206 | 		struct sx lock;			/* Lock for map data */ | |
| 207 | 		struct mtx system_mtx; | |
| 208 | 	}; | |
| 210 | 209 | 	int nentries;			/* Number of entries */ |
| 211 | 210 | 	vm_size_t size;			/* virtual size */ |
| 212 | 211 | 	u_int timestamp;		/* Version number */ |
| 213 | 	u_char needs_wakeup; | |
| 214 | 	u_char system_map;		/* (c) Am I a system map? */ | |
| 215 | 	vm_flags_t flags;		/* flags for this vm_map */ | |
| 212 | 	u_int flags;			/* flags for this vm_map */ | |
| 216 | 213 | 	vm_map_entry_t root;		/* Root of a binary search tree */ |
| 217 | 214 | 	pmap_t pmap;			/* (c) Physical map */ |
| 218 | 215 | 	vm_offset_t anon_loc; |
| ... | ... | @@ -223,16 +220,21 @@ struct vm_map { |
| 223 | 220 | }; |
| 224 | 221 | |
| 225 | 222 | /* |
| 226 | * vm_flags_t values | |
| 223 | * vm_map flags values | |
| 227 | 224 | */ |
| 228 | #define MAP_WIREFUTURE		0x01	/* wire all future pages */ | |
| 229 | #define	MAP_BUSY_WAKEUP		0x02	/* thread(s) waiting on busy state */ | |
| 230 | #define	MAP_IS_SUB_MAP		0x04	/* has parent */ | |
| 231 | #define	MAP_ASLR		0x08	/* enabled ASLR */ | |
| 232 | #define	MAP_ASLR_IGNSTART	0x10	/* ASLR ignores data segment */ | |
| 233 | #define	MAP_REPLENISH		0x20	/* kmapent zone needs to be refilled */ | |
| 234 | #define	MAP_WXORX		0x40	/* enforce W^X */ | |
| 235 | #define	MAP_ASLR_STACK		0x80	/* stack location is randomized */ | |
| 225 | #define	MAP_WIREFUTURE		0x00000001	/* wire all future pages */ | |
| 226 | #define	MAP_BUSY_WAKEUP		0x00000002	/* thread(s) waiting on busy | |
| 227 | 						 state */ | |
| 228 | #define	MAP_IS_SUB_MAP		0x00000004	/* has parent */ | |
| 229 | #define	MAP_ASLR		0x00000008	/* enabled ASLR */ | |
| 230 | #define	MAP_ASLR_IGNSTART	0x00000010	/* ASLR ignores data segment */ | |
| 231 | #define	MAP_REPLENISH		0x00000020	/* kmapent zone needs to be | |
| 232 | 						 refilled */ | |
| 233 | #define	MAP_WXORX		0x00000040	/* enforce W^X */ | |
| 234 | #define	MAP_ASLR_STACK		0x00000080	/* stack location is | |
| 235 | 						 randomized */ | |
| 236 | #define	MAP_NEEDS_WAKEUP	0x40000000 | |
| 237 | #define	MAP_SYSTEM_MAP		0x80000000 | |
| 236 | 238 | |
| 237 | 239 | #ifdef	_KERNEL |
| 238 | 240 | #if defined(KLD_MODULE) && !defined(KLD_TIED) |
| ... | ... | @@ -263,7 +265,7 @@ vm_map_pmap(vm_map_t map) |
| 263 | 265 | } |
| 264 | 266 | |
| 265 | 267 | static __inline void |
| 266 | vm_map_modflags(vm_map_t map, vm_flags_t set, vm_flags_t clear) | |
| 268 | vm_map_modflags(vm_map_t map, u_int set, u_int clear) | |
| 267 | 269 | { |
| 268 | 270 | 	map->flags = (map->flags | set) & ~clear; |
| 269 | 271 | } |
| ... | ... | @@ -278,6 +280,12 @@ vm_map_range_valid(vm_map_t map, vm_offset_t start, vm_offset_t end) |
| 278 | 280 | 	return (true); |
| 279 | 281 | } |
| 280 | 282 | |
| 283 | static inline bool | |
| 284 | vm_map_is_system(vm_map_t map) | |
| 285 | { | |
| 286 | 	return ((map->flags & MAP_SYSTEM_MAP) != 0); | |
| 287 | } | |
| 288 | ||
| 281 | 289 | #endif	/* KLD_MODULE */ |
| 282 | 290 | #endif	/* _KERNEL */ |
| 283 | 291 | |
| ... | ... | @@ -378,12 +386,12 @@ long vmspace_resident_count(struct vmspace *vmspace); |
| 378 | 386 | #define	MAP_PREFAULT_MADVISE	0x00000200 /* from (user) madvise request */ |
| 379 | 387 | #define	MAP_WRITECOUNT		0x00000400 |
| 380 | 388 | #define	MAP_REMAP		0x00000800 |
| 381 | #define	MAP_STACK_GROWS_DOWN	0x00001000 | |
| 382 | #define	MAP_STACK_GROWS_UP	0x00002000 | |
| 389 | #define	MAP_STACK_AREA		0x00001000 | |
| 390 | #define	MAP_COW_UNUSED0		0x00002000 | |
| 383 | 391 | #define	MAP_ACC_CHARGED		0x00004000 |
| 384 | 392 | #define	MAP_ACC_NO_CHARGE	0x00008000 |
| 385 | #define	MAP_CREATE_STACK_GAP_UP	0x00010000 | |
| 386 | #define	MAP_CREATE_STACK_GAP_DN	0x00020000 | |
| 393 | #define	MAP_COW_UNUSED1		0x00010000 | |
| 394 | #define	MAP_CREATE_STACK_GAP	0x00020000 | |
| 387 | 395 | #define	MAP_VN_EXEC		0x00040000 |
| 388 | 396 | #define	MAP_SPLIT_BOUNDARY_MASK	0x00180000 |
| 389 | 397 | #define	MAP_NO_HINT		0x00200000 |
| ... | ... | @@ -486,6 +494,7 @@ int vm_map_fixed(vm_map_t, vm_object_t, vm_ooffset_t, vm_offset_t, vm_size_t, |
| 486 | 494 | vm_offset_t vm_map_findspace(vm_map_t, vm_offset_t, vm_size_t); |
| 487 | 495 | int vm_map_inherit (vm_map_t, vm_offset_t, vm_offset_t, vm_inherit_t); |
| 488 | 496 | void vm_map_init(vm_map_t, pmap_t, vm_offset_t, vm_offset_t); |
| 497 | void vm_map_init_system(vm_map_t, pmap_t, vm_offset_t, vm_offset_t); | |
| 489 | 498 | int vm_map_insert (vm_map_t, vm_object_t, vm_ooffset_t, vm_offset_t, vm_offset_t, vm_prot_t, vm_prot_t, int); |
| 490 | 499 | int vm_map_lookup (vm_map_t *, vm_offset_t, vm_prot_t, vm_map_entry_t *, vm_object_t *, |
| 491 | 500 | vm_pindex_t *, vm_prot_t *, boolean_t *); |
lib/libc/include/generic-freebsd/vm/vm_object.h+2-4| ... | ... | @@ -31,8 +31,6 @@ |
| 31 | 31 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 32 | 32 | * SUCH DAMAGE. |
| 33 | 33 | * |
| 34 | *	from: @(#)vm_object.h	8.3 (Berkeley) 1/12/94 | |
| 35 | * | |
| 36 | 34 | * |
| 37 | 35 | * Copyright (c) 1987, 1990 Carnegie-Mellon University. |
| 38 | 36 | * All rights reserved. |
| ... | ... | @@ -100,7 +98,6 @@ struct vm_object { |
| 100 | 98 | 	TAILQ_ENTRY(vm_object) object_list; /* list of all objects */ |
| 101 | 99 | 	LIST_HEAD(, vm_object) shadow_head; /* objects that this is a shadow for */ |
| 102 | 100 | 	LIST_ENTRY(vm_object) shadow_list; /* chain of shadow objects */ |
| 103 | 	struct pglist memq;		/* list of resident pages */ | |
| 104 | 101 | 	struct vm_radix rtree;		/* root of the resident page radix trie*/ |
| 105 | 102 | 	vm_pindex_t size;		/* Object size */ |
| 106 | 103 | 	struct domainset_ref domain;	/* NUMA policy. */ |
| ... | ... | @@ -206,7 +203,6 @@ struct vm_object { |
| 206 | 203 | #define	OBJ_PAGERPRIV2	0x00008000	/* Pager private */ |
| 207 | 204 | #define	OBJ_SYSVSHM	0x00010000	/* SysV SHM */ |
| 208 | 205 | #define	OBJ_POSIXSHM	0x00020000	/* Posix SHM */ |
| 209 | #define	OBJ_CDEVH	0x00040000	/* OBJT_DEVICE handle is cdev */ | |
| 210 | 206 | |
| 211 | 207 | /* |
| 212 | 208 | * Helpers to perform conversion between vm_object page indexes and offsets. |
| ... | ... | @@ -379,6 +375,8 @@ void vm_object_page_noreuse(vm_object_t object, vm_pindex_t start, |
| 379 | 375 | void vm_object_page_remove(vm_object_t object, vm_pindex_t start, |
| 380 | 376 | vm_pindex_t end, int options); |
| 381 | 377 | boolean_t vm_object_populate(vm_object_t, vm_pindex_t, vm_pindex_t); |
| 378 | void vm_object_prepare_buf_pages(vm_object_t object, vm_page_t *ma_dst, | |
| 379 | int count, int *rbehind, int *rahead, vm_page_t *ma_src); | |
| 382 | 380 | void vm_object_print(long addr, boolean_t have_addr, long count, char *modif); |
| 383 | 381 | void vm_object_reference (vm_object_t); |
| 384 | 382 | void vm_object_reference_locked(vm_object_t); |
lib/libc/include/generic-freebsd/vm/vm_page.h+67-112| ... | ... | @@ -31,8 +31,6 @@ |
| 31 | 31 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 32 | 32 | * SUCH DAMAGE. |
| 33 | 33 | * |
| 34 | *	from: @(#)vm_page.h	8.2 (Berkeley) 12/13/93 | |
| 35 | * | |
| 36 | 34 | * |
| 37 | 35 | * Copyright (c) 1987, 1990 Carnegie-Mellon University. |
| 38 | 36 | * All rights reserved. |
| ... | ... | @@ -80,10 +78,6 @@ |
| 80 | 78 | *		A radix tree used to quickly |
| 81 | 79 | *		perform object/offset lookups |
| 82 | 80 | * |
| 83 | *		A list of all pages for a given object, | |
| 84 | *		so they can be quickly deactivated at | |
| 85 | *		time of deallocation. | |
| 86 | * | |
| 87 | 81 | *		An ordered list of pages due for pageout. |
| 88 | 82 | * |
| 89 | 83 | *	In addition, the structure contains the object |
| ... | ... | @@ -235,7 +229,6 @@ struct vm_page { |
| 235 | 229 | 			void *zone; |
| 236 | 230 | 		} uma; |
| 237 | 231 | 	} plinks; |
| 238 | 	TAILQ_ENTRY(vm_page) listq;	/* pages in same object (O) */ | |
| 239 | 232 | 	vm_object_t object;		/* which object am I in (O) */ |
| 240 | 233 | 	vm_pindex_t pindex;		/* offset into object (O,P) */ |
| 241 | 234 | 	vm_paddr_t phys_addr;		/* physical address of page (C) */ |
| ... | ... | @@ -343,50 +336,6 @@ SLIST_HEAD(spglist, vm_page); |
| 343 | 336 | extern vm_page_t bogus_page; |
| 344 | 337 | #endif	/* _KERNEL */ |
| 345 | 338 | |
| 346 | extern struct mtx_padalign pa_lock[]; | |
| 347 | ||
| 348 | #if defined(__arm__) | |
| 349 | #define	PDRSHIFT	PDR_SHIFT | |
| 350 | #elif !defined(PDRSHIFT) | |
| 351 | #define PDRSHIFT	21 | |
| 352 | #endif | |
| 353 | ||
| 354 | #define	pa_index(pa)	((pa) >> PDRSHIFT) | |
| 355 | #define	PA_LOCKPTR(pa)	((struct mtx *)(&pa_lock[pa_index(pa) % PA_LOCK_COUNT])) | |
| 356 | #define	PA_LOCKOBJPTR(pa)	((struct lock_object *)PA_LOCKPTR((pa))) | |
| 357 | #define	PA_LOCK(pa)	mtx_lock(PA_LOCKPTR(pa)) | |
| 358 | #define	PA_TRYLOCK(pa)	mtx_trylock(PA_LOCKPTR(pa)) | |
| 359 | #define	PA_UNLOCK(pa)	mtx_unlock(PA_LOCKPTR(pa)) | |
| 360 | #define	PA_UNLOCK_COND(pa) 			\ | |
| 361 | 	do {		 			\ | |
| 362 | 		if ((pa) != 0) {		\ | |
| 363 | 			PA_UNLOCK((pa));	\ | |
| 364 | 			(pa) = 0;		\ | |
| 365 | 		}				\ | |
| 366 | 	} while (0) | |
| 367 | ||
| 368 | #define	PA_LOCK_ASSERT(pa, a)	mtx_assert(PA_LOCKPTR(pa), (a)) | |
| 369 | ||
| 370 | #if defined(KLD_MODULE) && !defined(KLD_TIED) | |
| 371 | #define	vm_page_lock(m)		vm_page_lock_KBI((m), LOCK_FILE, LOCK_LINE) | |
| 372 | #define	vm_page_unlock(m)	vm_page_unlock_KBI((m), LOCK_FILE, LOCK_LINE) | |
| 373 | #define	vm_page_trylock(m)	vm_page_trylock_KBI((m), LOCK_FILE, LOCK_LINE) | |
| 374 | #else	/* !KLD_MODULE */ | |
| 375 | #define	vm_page_lockptr(m)	(PA_LOCKPTR(VM_PAGE_TO_PHYS((m)))) | |
| 376 | #define	vm_page_lock(m)		mtx_lock(vm_page_lockptr((m))) | |
| 377 | #define	vm_page_unlock(m)	mtx_unlock(vm_page_lockptr((m))) | |
| 378 | #define	vm_page_trylock(m)	mtx_trylock(vm_page_lockptr((m))) | |
| 379 | #endif | |
| 380 | #if defined(INVARIANTS) | |
| 381 | #define	vm_page_assert_locked(m)		\ | |
| 382 | vm_page_assert_locked_KBI((m), __FILE__, __LINE__) | |
| 383 | #define	vm_page_lock_assert(m, a)		\ | |
| 384 | vm_page_lock_assert_KBI((m), (a), __FILE__, __LINE__) | |
| 385 | #else | |
| 386 | #define	vm_page_assert_locked(m) | |
| 387 | #define	vm_page_lock_assert(m, a) | |
| 388 | #endif | |
| 389 | ||
| 390 | 339 | /* |
| 391 | 340 | * The vm_page's aflags are updated using atomic operations. To set or clear |
| 392 | 341 | * these flags, the functions vm_page_aflag_set() and vm_page_aflag_clear() |
| ... | ... | @@ -459,6 +408,7 @@ extern struct mtx_padalign pa_lock[]; |
| 459 | 408 | #define	PG_ZERO		0x04		/* page is zeroed */ |
| 460 | 409 | #define	PG_MARKER	0x08		/* special queue marker page */ |
| 461 | 410 | #define	PG_NODUMP	0x10		/* don't include this page in a dump */ |
| 411 | #define	PG_NOFREE	0x20		/* page should never be freed. */ | |
| 462 | 412 | |
| 463 | 413 | /* |
| 464 | 414 | * Misc constants. |
| ... | ... | @@ -472,6 +422,7 @@ extern struct mtx_padalign pa_lock[]; |
| 472 | 422 | |
| 473 | 423 | #include <sys/kassert.h> |
| 474 | 424 | #include <machine/atomic.h> |
| 425 | struct pctrie_iter; | |
| 475 | 426 | |
| 476 | 427 | /* |
| 477 | 428 | * Each pageable resident page falls into one of five lists: |
| ... | ... | @@ -511,13 +462,15 @@ extern long first_page;			/* first physical page number */ |
| 511 | 462 | vm_page_t PHYS_TO_VM_PAGE(vm_paddr_t pa); |
| 512 | 463 | |
| 513 | 464 | /* |
| 514 | * Page allocation parameters for vm_page for the functions | |
| 515 | * vm_page_alloc(), vm_page_grab(), vm_page_alloc_contig() and | |
| 516 | * vm_page_alloc_freelist(). Some functions support only a subset | |
| 517 | * of the flags, and ignore others, see the flags legend. | |
| 465 | * vm_page allocation arguments for the functions vm_page_alloc(), | |
| 466 | * vm_page_alloc_contig(), vm_page_alloc_noobj(), vm_page_grab(), and | |
| 467 | * vm_page_grab_pages(). Each function supports only a subset of the flags. | |
| 468 | * See the flags legend. | |
| 518 | 469 | * |
| 519 | * The meaning of VM_ALLOC_ZERO differs slightly between the vm_page_alloc*() | |
| 520 | * and the vm_page_grab*() functions. See these functions for details. | |
| 470 | * The meaning of VM_ALLOC_ZERO varies: vm_page_alloc_noobj(), vm_page_grab(), | |
| 471 | * and vm_page_grab_pages() guarantee that the returned pages are zeroed; in | |
| 472 | * contrast vm_page_alloc() and vm_page_alloc_contig() do not, leaving it to | |
| 473 | * the caller to test the page's flags for PG_ZERO. | |
| 521 | 474 | * |
| 522 | 475 | * Bits 0 - 1 define class. |
| 523 | 476 | * Bits 2 - 15 dedicated for flags. |
| ... | ... | @@ -525,7 +478,7 @@ vm_page_t PHYS_TO_VM_PAGE(vm_paddr_t pa); |
| 525 | 478 | * (a) - vm_page_alloc() supports the flag. |
| 526 | 479 | * (c) - vm_page_alloc_contig() supports the flag. |
| 527 | 480 | * (g) - vm_page_grab() supports the flag. |
| 528 | * (n) - vm_page_alloc_noobj() and vm_page_alloc_freelist() support the flag. | |
| 481 | * (n) - vm_page_alloc_noobj() supports the flag. | |
| 529 | 482 | * (p) - vm_page_grab_pages() supports the flag. |
| 530 | 483 | * Bits above 15 define the count of additional pages that the caller |
| 531 | 484 | * intends to allocate. |
| ... | ... | @@ -534,26 +487,26 @@ vm_page_t PHYS_TO_VM_PAGE(vm_paddr_t pa); |
| 534 | 487 | #define VM_ALLOC_INTERRUPT	1 |
| 535 | 488 | #define VM_ALLOC_SYSTEM		2 |
| 536 | 489 | #define	VM_ALLOC_CLASS_MASK	3 |
| 537 | #define	VM_ALLOC_WAITOK		0x0008	/* (acn) Sleep and retry */ | |
| 538 | #define	VM_ALLOC_WAITFAIL	0x0010	/* (acn) Sleep and return error */ | |
| 490 | #define	VM_ALLOC_WAITOK		0x0008	/* (gnp) Sleep and retry */ | |
| 491 | #define	VM_ALLOC_WAITFAIL	0x0010	/* (acgnp) Sleep and return error */ | |
| 539 | 492 | #define	VM_ALLOC_WIRED		0x0020	/* (acgnp) Allocate a wired page */ |
| 540 | 493 | #define	VM_ALLOC_ZERO		0x0040	/* (acgnp) Allocate a zeroed page */ |
| 541 | 494 | #define	VM_ALLOC_NORECLAIM	0x0080	/* (c) Do not reclaim after failure */ |
| 542 | #define	VM_ALLOC_AVAIL0		0x0100 | |
| 495 | #define	VM_ALLOC_NOFREE		0x0100	/* (agnp) Page will never be freed */ | |
| 543 | 496 | #define	VM_ALLOC_NOBUSY		0x0200	/* (acgp) Do not excl busy the page */ |
| 544 | #define	VM_ALLOC_NOCREAT	0x0400	/* (gp) Don't create a page */ | |
| 497 | #define	VM_ALLOC_NOCREAT	0x0400	/* (gp) Do not allocate a page */ | |
| 545 | 498 | #define	VM_ALLOC_AVAIL1		0x0800 |
| 546 | #define	VM_ALLOC_IGN_SBUSY	0x1000	/* (gp) Ignore shared busy flag */ | |
| 547 | #define	VM_ALLOC_NODUMP		0x2000	/* (ag) don't include in dump */ | |
| 499 | #define	VM_ALLOC_IGN_SBUSY	0x1000	/* (gp) Ignore shared busy state */ | |
| 500 | #define	VM_ALLOC_NODUMP		0x2000	/* (acgnp) Do not include in dump */ | |
| 548 | 501 | #define	VM_ALLOC_SBUSY		0x4000	/* (acgp) Shared busy the page */ |
| 549 | 502 | #define	VM_ALLOC_NOWAIT		0x8000	/* (acgnp) Do not sleep */ |
| 550 | 503 | #define	VM_ALLOC_COUNT_MAX	0xffff |
| 551 | 504 | #define	VM_ALLOC_COUNT_SHIFT	16 |
| 552 | 505 | #define	VM_ALLOC_COUNT_MASK	(VM_ALLOC_COUNT(VM_ALLOC_COUNT_MAX)) |
| 553 | #define	VM_ALLOC_COUNT(count)	({				\ | |
| 554 | 	KASSERT((count) <= VM_ALLOC_COUNT_MAX,			\ | |
| 555 | 	 ("%s: invalid VM_ALLOC_COUNT value", __func__));	\ | |
| 556 | 	(count) << VM_ALLOC_COUNT_SHIFT;			\ | |
| 506 | #define	VM_ALLOC_COUNT(count)	({ 	/* (acgn) Additional pages */	\ | |
| 507 | 	KASSERT((count) <= VM_ALLOC_COUNT_MAX,				\ | |
| 508 | 	 ("%s: invalid VM_ALLOC_COUNT value", __func__));		\ | |
| 509 | 	(count) << VM_ALLOC_COUNT_SHIFT;				\ | |
| 557 | 510 | }) |
| 558 | 511 | |
| 559 | 512 | #ifdef M_NOWAIT |
| ... | ... | @@ -577,6 +530,8 @@ malloc2vm_flags(int malloc_flags) |
| 577 | 530 | 		pflags |= VM_ALLOC_WAITOK; |
| 578 | 531 | 	if ((malloc_flags & M_NORECLAIM)) |
| 579 | 532 | 		pflags |= VM_ALLOC_NORECLAIM; |
| 533 | 	if ((malloc_flags & M_NEVERFREED)) | |
| 534 | 		pflags |= VM_ALLOC_NOFREE; | |
| 580 | 535 | 	return (pflags); |
| 581 | 536 | } |
| 582 | 537 | #endif |
| ... | ... | @@ -593,22 +548,9 @@ malloc2vm_flags(int malloc_flags) |
| 593 | 548 | #define	PS_ALL_VALID	0x2 |
| 594 | 549 | #define	PS_NONE_BUSY	0x4 |
| 595 | 550 | |
| 596 | bool vm_page_busy_acquire(vm_page_t m, int allocflags); | |
| 597 | void vm_page_busy_downgrade(vm_page_t m); | |
| 598 | int vm_page_busy_tryupgrade(vm_page_t m); | |
| 599 | bool vm_page_busy_sleep(vm_page_t m, const char *msg, int allocflags); | |
| 600 | void vm_page_busy_sleep_unlocked(vm_object_t obj, vm_page_t m, | |
| 601 | vm_pindex_t pindex, const char *wmesg, int allocflags); | |
| 602 | void vm_page_free(vm_page_t m); | |
| 603 | void vm_page_free_zero(vm_page_t m); | |
| 604 | ||
| 605 | 551 | void vm_page_activate (vm_page_t); |
| 606 | 552 | void vm_page_advise(vm_page_t m, int advice); |
| 607 | 553 | vm_page_t vm_page_alloc(vm_object_t, vm_pindex_t, int); |
| 608 | vm_page_t vm_page_alloc_domain(vm_object_t, vm_pindex_t, int, int); | |
| 609 | vm_page_t vm_page_alloc_after(vm_object_t, vm_pindex_t, int, vm_page_t); | |
| 610 | vm_page_t vm_page_alloc_domain_after(vm_object_t, vm_pindex_t, int, int, | |
| 611 | vm_page_t); | |
| 612 | 554 | vm_page_t vm_page_alloc_contig(vm_object_t object, vm_pindex_t pindex, int req, |
| 613 | 555 | u_long npages, vm_paddr_t low, vm_paddr_t high, u_long alignment, |
| 614 | 556 | vm_paddr_t boundary, vm_memattr_t memattr); |
| ... | ... | @@ -616,8 +558,10 @@ vm_page_t vm_page_alloc_contig_domain(vm_object_t object, |
| 616 | 558 | vm_pindex_t pindex, int domain, int req, u_long npages, vm_paddr_t low, |
| 617 | 559 | vm_paddr_t high, u_long alignment, vm_paddr_t boundary, |
| 618 | 560 | vm_memattr_t memattr); |
| 619 | vm_page_t vm_page_alloc_freelist(int, int); | |
| 620 | vm_page_t vm_page_alloc_freelist_domain(int, int, int); | |
| 561 | vm_page_t vm_page_alloc_domain_iter(vm_object_t object, vm_pindex_t pindex, | |
| 562 | int domain, int req, struct pctrie_iter *pages); | |
| 563 | vm_page_t vm_page_alloc_iter(vm_object_t object, vm_pindex_t pindex, int req, | |
| 564 | struct pctrie_iter *pages); | |
| 621 | 565 | vm_page_t vm_page_alloc_noobj(int); |
| 622 | 566 | vm_page_t vm_page_alloc_noobj_domain(int, int); |
| 623 | 567 | vm_page_t vm_page_alloc_noobj_contig(int req, u_long npages, vm_paddr_t low, |
| ... | ... | @@ -628,7 +572,26 @@ vm_page_t vm_page_alloc_noobj_contig_domain(int domain, int req, u_long npages, |
| 628 | 572 | vm_memattr_t memattr); |
| 629 | 573 | void vm_page_bits_set(vm_page_t m, vm_page_bits_t *bits, vm_page_bits_t set); |
| 630 | 574 | bool vm_page_blacklist_add(vm_paddr_t pa, bool verbose); |
| 575 | bool vm_page_busy_acquire(vm_page_t m, int allocflags); | |
| 576 | void vm_page_busy_downgrade(vm_page_t m); | |
| 577 | int vm_page_busy_tryupgrade(vm_page_t m); | |
| 578 | bool vm_page_busy_sleep(vm_page_t m, const char *msg, int allocflags); | |
| 579 | void vm_page_busy_sleep_unlocked(vm_object_t obj, vm_page_t m, | |
| 580 | vm_pindex_t pindex, const char *wmesg, int allocflags); | |
| 581 | void vm_page_deactivate(vm_page_t m); | |
| 582 | void vm_page_deactivate_noreuse(vm_page_t m); | |
| 583 | void vm_page_dequeue(vm_page_t m); | |
| 584 | void vm_page_dequeue_deferred(vm_page_t m); | |
| 585 | void vm_page_free(vm_page_t m); | |
| 586 | void vm_page_free_invalid(vm_page_t m); | |
| 587 | int vm_page_free_pages_toq(struct spglist *free, bool update_wire_count); | |
| 588 | void vm_page_free_zero(vm_page_t m); | |
| 589 | vm_page_t vm_page_getfake(vm_paddr_t paddr, vm_memattr_t memattr); | |
| 590 | int vm_page_grab_zero_partial(vm_object_t object, vm_pindex_t pindex, int base, | |
| 591 | int end); | |
| 631 | 592 | vm_page_t vm_page_grab(vm_object_t, vm_pindex_t, int); |
| 593 | vm_page_t vm_page_grab_iter(vm_object_t object, vm_pindex_t pindex, | |
| 594 | int allocflags, struct pctrie_iter *pages); | |
| 632 | 595 | vm_page_t vm_page_grab_unlocked(vm_object_t, vm_pindex_t, int); |
| 633 | 596 | int vm_page_grab_pages(vm_object_t object, vm_pindex_t pindex, int allocflags, |
| 634 | 597 | vm_page_t *ma, int count); |
| ... | ... | @@ -636,37 +599,38 @@ int vm_page_grab_pages_unlocked(vm_object_t object, vm_pindex_t pindex, |
| 636 | 599 | int allocflags, vm_page_t *ma, int count); |
| 637 | 600 | int vm_page_grab_valid(vm_page_t *mp, vm_object_t object, vm_pindex_t pindex, |
| 638 | 601 | int allocflags); |
| 602 | int vm_page_grab_valid_iter(vm_page_t *mp, vm_object_t object, | |
| 603 | vm_pindex_t pindex, int allocflags, struct pctrie_iter *pages); | |
| 639 | 604 | int vm_page_grab_valid_unlocked(vm_page_t *mp, vm_object_t object, |
| 640 | 605 | vm_pindex_t pindex, int allocflags); |
| 641 | void vm_page_deactivate(vm_page_t); | |
| 642 | void vm_page_deactivate_noreuse(vm_page_t); | |
| 643 | void vm_page_dequeue(vm_page_t m); | |
| 644 | void vm_page_dequeue_deferred(vm_page_t m); | |
| 645 | vm_page_t vm_page_find_least(vm_object_t, vm_pindex_t); | |
| 646 | void vm_page_free_invalid(vm_page_t); | |
| 647 | vm_page_t vm_page_getfake(vm_paddr_t paddr, vm_memattr_t memattr); | |
| 648 | 606 | void vm_page_initfake(vm_page_t m, vm_paddr_t paddr, vm_memattr_t memattr); |
| 649 | 607 | void vm_page_init_marker(vm_page_t marker, int queue, uint16_t aflags); |
| 650 | void vm_page_init_page(vm_page_t m, vm_paddr_t pa, int segind); | |
| 608 | void vm_page_init_page(vm_page_t m, vm_paddr_t pa, int segind, int pool); | |
| 651 | 609 | int vm_page_insert (vm_page_t, vm_object_t, vm_pindex_t); |
| 652 | 610 | void vm_page_invalid(vm_page_t m); |
| 611 | void vm_page_iter_free(struct pctrie_iter *pages, vm_page_t m); | |
| 612 | void vm_page_iter_init(struct pctrie_iter *, vm_object_t); | |
| 613 | int vm_page_iter_insert(vm_page_t m, vm_object_t, vm_pindex_t, | |
| 614 | struct pctrie_iter *); | |
| 615 | void vm_page_iter_limit_init(struct pctrie_iter *, vm_object_t, vm_pindex_t); | |
| 616 | bool vm_page_iter_remove(struct pctrie_iter *pages, vm_page_t m); | |
| 617 | bool vm_page_iter_rename(struct pctrie_iter *old_pages, vm_page_t m, | |
| 618 | vm_object_t new_object, vm_pindex_t new_pindex); | |
| 653 | 619 | void vm_page_launder(vm_page_t m); |
| 654 | 620 | vm_page_t vm_page_lookup(vm_object_t, vm_pindex_t); |
| 655 | 621 | vm_page_t vm_page_lookup_unlocked(vm_object_t, vm_pindex_t); |
| 656 | vm_page_t vm_page_next(vm_page_t m); | |
| 657 | 622 | void vm_page_pqbatch_drain(void); |
| 658 | 623 | void vm_page_pqbatch_submit(vm_page_t m, uint8_t queue); |
| 659 | 624 | bool vm_page_pqstate_commit(vm_page_t m, vm_page_astate_t *old, |
| 660 | 625 | vm_page_astate_t new); |
| 661 | vm_page_t vm_page_prev(vm_page_t m); | |
| 662 | bool vm_page_ps_test(vm_page_t m, int flags, vm_page_t skip_m); | |
| 626 | bool vm_page_ps_test(vm_page_t m, int psind, int flags, vm_page_t skip_m); | |
| 663 | 627 | void vm_page_putfake(vm_page_t m); |
| 664 | 628 | void vm_page_readahead_finish(vm_page_t m); |
| 665 | bool vm_page_reclaim_contig(int req, u_long npages, vm_paddr_t low, | |
| 629 | int vm_page_reclaim_contig(int req, u_long npages, vm_paddr_t low, | |
| 666 | 630 | vm_paddr_t high, u_long alignment, vm_paddr_t boundary); |
| 667 | bool vm_page_reclaim_contig_domain(int domain, int req, u_long npages, | |
| 631 | int vm_page_reclaim_contig_domain(int domain, int req, u_long npages, | |
| 668 | 632 | vm_paddr_t low, vm_paddr_t high, u_long alignment, vm_paddr_t boundary); |
| 669 | bool vm_page_reclaim_contig_domain_ext(int domain, int req, u_long npages, | |
| 633 | int vm_page_reclaim_contig_domain_ext(int domain, int req, u_long npages, | |
| 670 | 634 | vm_paddr_t low, vm_paddr_t high, u_long alignment, vm_paddr_t boundary, |
| 671 | 635 | int desired_runs); |
| 672 | 636 | void vm_page_reference(vm_page_t m); |
| ... | ... | @@ -677,7 +641,6 @@ void vm_page_release_locked(vm_page_t m, int flags); |
| 677 | 641 | vm_page_t vm_page_relookup(vm_object_t, vm_pindex_t); |
| 678 | 642 | bool vm_page_remove(vm_page_t); |
| 679 | 643 | bool vm_page_remove_xbusy(vm_page_t); |
| 680 | int vm_page_rename(vm_page_t, vm_object_t, vm_pindex_t); | |
| 681 | 644 | void vm_page_replace(vm_page_t mnew, vm_object_t object, |
| 682 | 645 | vm_pindex_t pindex, vm_page_t mold); |
| 683 | 646 | int vm_page_sbusied(vm_page_t m); |
| ... | ... | @@ -706,16 +669,8 @@ int vm_page_is_valid(vm_page_t, int, int); |
| 706 | 669 | void vm_page_test_dirty(vm_page_t); |
| 707 | 670 | vm_page_bits_t vm_page_bits(int base, int size); |
| 708 | 671 | void vm_page_zero_invalid(vm_page_t m, boolean_t setvalid); |
| 709 | int vm_page_free_pages_toq(struct spglist *free, bool update_wire_count); | |
| 710 | 672 | |
| 711 | 673 | void vm_page_dirty_KBI(vm_page_t m); |
| 712 | void vm_page_lock_KBI(vm_page_t m, const char *file, int line); | |
| 713 | void vm_page_unlock_KBI(vm_page_t m, const char *file, int line); | |
| 714 | int vm_page_trylock_KBI(vm_page_t m, const char *file, int line); | |
| 715 | #if defined(INVARIANTS) || defined(INVARIANT_SUPPORT) | |
| 716 | void vm_page_assert_locked_KBI(vm_page_t m, const char *file, int line); | |
| 717 | void vm_page_lock_assert_KBI(vm_page_t m, int a, const char *file, int line); | |
| 718 | #endif | |
| 719 | 674 | |
| 720 | 675 | #define	vm_page_busy_fetch(m)	atomic_load_int(&(m)->busy_lock) |
| 721 | 676 | |
| ... | ... | @@ -732,9 +687,9 @@ void vm_page_lock_assert_KBI(vm_page_t m, int a, const char *file, int line); |
| 732 | 687 | #define	vm_page_assert_unbusied(m)					\ |
| 733 | 688 | 	KASSERT((vm_page_busy_fetch(m) & ~VPB_BIT_WAITERS) !=		\ |
| 734 | 689 | 	 VPB_CURTHREAD_EXCLUSIVE,					\ |
| 735 | 	 ("vm_page_assert_xbusied: page %p busy_lock %#x owned"	\ | |
| 736 | " by me @ %s:%d",						\ | |
| 737 | 	 (m), (m)->busy_lock, __FILE__, __LINE__));			\ | |
| 690 | 	 ("vm_page_assert_unbusied: page %p busy_lock %#x owned"	\ | |
| 691 | 	 " by me (%p) @ %s:%d",					\ | |
| 692 | 	 (m), (m)->busy_lock, curthread, __FILE__, __LINE__));	\ | |
| 738 | 693 | |
| 739 | 694 | #define	vm_page_assert_xbusied_unchecked(m) do {			\ |
| 740 | 695 | 	KASSERT(vm_page_xbusied(m),					\ |
| ... | ... | @@ -746,8 +701,8 @@ void vm_page_lock_assert_KBI(vm_page_t m, int a, const char *file, int line); |
| 746 | 701 | 	KASSERT((vm_page_busy_fetch(m) & ~VPB_BIT_WAITERS) ==		\ |
| 747 | 702 | 	 VPB_CURTHREAD_EXCLUSIVE,					\ |
| 748 | 703 | 	 ("vm_page_assert_xbusied: page %p busy_lock %#x not owned"	\ |
| 749 | " by me @ %s:%d",						\ | |
| 750 | 	 (m), (m)->busy_lock, __FILE__, __LINE__));			\ | |
| 704 | 	 " by me (%p) @ %s:%d",					\ | |
| 705 | 	 (m), (m)->busy_lock, curthread, __FILE__, __LINE__));	\ | |
| 751 | 706 | } while (0) |
| 752 | 707 | |
| 753 | 708 | #define	vm_page_busied(m)						\ |
| ... | ... | @@ -1018,7 +973,7 @@ vm_page_none_valid(vm_page_t m) |
| 1018 | 973 | } |
| 1019 | 974 | |
| 1020 | 975 | static inline int |
| 1021 | vm_page_domain(vm_page_t m) | |
| 976 | vm_page_domain(vm_page_t m __numa_used) | |
| 1022 | 977 | { |
| 1023 | 978 | #ifdef NUMA |
| 1024 | 979 | 	int domn, segind; |
lib/libc/include/generic-freebsd/vm/vm_pageout.h+1-6| ... | ... | @@ -31,8 +31,6 @@ |
| 31 | 31 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 32 | 32 | * SUCH DAMAGE. |
| 33 | 33 | * |
| 34 | *	from: @(#)vm_pageout.h	8.2 (Berkeley) 1/12/94 | |
| 35 | * | |
| 36 | 34 | * |
| 37 | 35 | * Copyright (c) 1987, 1990 Carnegie-Mellon University. |
| 38 | 36 | * All rights reserved. |
| ... | ... | @@ -102,11 +100,8 @@ void vm_wait_domain(int domain); |
| 102 | 100 | void vm_wait_min(void); |
| 103 | 101 | void vm_wait_severe(void); |
| 104 | 102 | |
| 105 | int vm_pageout_flush(vm_page_t *, int, int, int, int *, boolean_t *); | |
| 103 | int vm_pageout_flush(vm_page_t *mc, int count, int flags, bool *eio); | |
| 106 | 104 | void vm_pageout_oom(int shortage); |
| 107 | 105 | |
| 108 | void vm_swapout_run(void); | |
| 109 | void vm_swapout_run_idle(void); | |
| 110 | ||
| 111 | 106 | #endif /* _KERNEL */ |
| 112 | 107 | #endif	/* _VM_VM_PAGEOUT_H_ */ |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/vm/vm_pagequeue.h+14-7| ... | ... | @@ -31,8 +31,6 @@ |
| 31 | 31 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 32 | 32 | * SUCH DAMAGE. |
| 33 | 33 | * |
| 34 | *	from: @(#)vm_page.h	8.2 (Berkeley) 12/13/93 | |
| 35 | * | |
| 36 | 34 | * |
| 37 | 35 | * Copyright (c) 1987, 1990 Carnegie-Mellon University. |
| 38 | 36 | * All rights reserved. |
| ... | ... | @@ -245,23 +243,26 @@ struct vm_domain { |
| 245 | 243 | 	} vmd_pgcache[VM_NFREEPOOL]; |
| 246 | 244 | 	struct vmem *vmd_kernel_arena;	/* (c) per-domain kva R/W arena. */ |
| 247 | 245 | 	struct vmem *vmd_kernel_rwx_arena; /* (c) per-domain kva R/W/X arena. */ |
| 246 | 	struct vmem *vmd_kernel_nofree_arena; /* (c) per-domain kva NOFREE arena. */ | |
| 248 | 247 | 	u_int vmd_domain;		/* (c) Domain number. */ |
| 249 | 248 | 	u_int vmd_page_count;		/* (c) Total page count. */ |
| 250 | 249 | 	long vmd_segs;			/* (c) bitmask of the segments */ |
| 250 | 	struct pglist vmd_nofreeq;	/* (f) NOFREE page bump allocator. */ | |
| 251 | 251 | 	u_int __aligned(CACHE_LINE_SIZE) vmd_free_count; /* (a,f) free page count */ |
| 252 | 252 | 	u_int vmd_pageout_deficit;	/* (a) Estimated number of pages deficit */ |
| 253 | 253 | 	uint8_t vmd_pad[CACHE_LINE_SIZE - (sizeof(u_int) * 2)]; |
| 254 | 254 | |
| 255 | 255 | 	/* Paging control variables, used within single threaded page daemon. */ |
| 256 | 256 | 	struct pidctrl vmd_pid;		/* Pageout controller. */ |
| 257 | 	boolean_t vmd_oom; | |
| 258 | 	u_int vmd_inactive_threads; | |
| 257 | 	bool vmd_oom;			/* An OOM kill was requested. */ | |
| 258 | 	bool vmd_helper_threads_enabled;/* Use multiple threads to scan. */ | |
| 259 | 	u_int vmd_inactive_threads;	/* Number of extra helper threads. */ | |
| 259 | 260 | 	u_int vmd_inactive_shortage;		/* Per-thread shortage. */ |
| 260 | 261 | 	blockcount_t vmd_inactive_running;	/* Number of inactive threads. */ |
| 261 | 262 | 	blockcount_t vmd_inactive_starting;	/* Number of threads started. */ |
| 262 | 	volatile u_int vmd_addl_shortage;	/* Shortage accumulator. */ | |
| 263 | 	volatile u_int vmd_inactive_freed;	/* Successful inactive frees. */ | |
| 264 | 	volatile u_int vmd_inactive_us;		/* Microseconds for above. */ | |
| 263 | 	u_int vmd_addl_shortage;	/* (a) Shortage accumulator. */ | |
| 264 | 	u_int vmd_inactive_freed;	/* (a) Successful inactive frees. */ | |
| 265 | 	u_int vmd_inactive_us;		/* (a) Microseconds for above. */ | |
| 265 | 266 | 	u_int vmd_inactive_pps;		/* Exponential decay frees/second. */ |
| 266 | 267 | 	int vmd_oom_seq; |
| 267 | 268 | 	int vmd_last_active_scan; |
| ... | ... | @@ -356,6 +357,12 @@ vm_batchqueue_init(struct vm_batchqueue *bq) |
| 356 | 357 | 	bq->bq_cnt = 0; |
| 357 | 358 | } |
| 358 | 359 | |
| 360 | static inline bool | |
| 361 | vm_batchqueue_empty(const struct vm_batchqueue *bq) | |
| 362 | { | |
| 363 | 	return (bq->bq_cnt == 0); | |
| 364 | } | |
| 365 | ||
| 359 | 366 | static inline int |
| 360 | 367 | vm_batchqueue_insert(struct vm_batchqueue *bq, vm_page_t m) |
| 361 | 368 | { |
lib/libc/include/generic-freebsd/vm/vm_pager.h+4-2| ... | ... | @@ -32,8 +32,6 @@ |
| 32 | 32 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 33 | 33 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 34 | 34 | * SUCH DAMAGE. |
| 35 | * | |
| 36 | *	@(#)vm_pager.h	8.4 (Berkeley) 1/12/94 | |
| 37 | 35 | */ |
| 38 | 36 | |
| 39 | 37 | /* |
| ... | ... | @@ -295,6 +293,7 @@ struct cdev_pager_ops { |
| 295 | 293 | 	int (*cdev_pg_ctor)(void *handle, vm_ooffset_t size, vm_prot_t prot, |
| 296 | 294 | 	 vm_ooffset_t foff, struct ucred *cred, u_short *color); |
| 297 | 295 | 	void (*cdev_pg_dtor)(void *handle); |
| 296 | 	void (*cdev_pg_path)(void *handle, char *path, size_t len); | |
| 298 | 297 | }; |
| 299 | 298 | |
| 300 | 299 | vm_object_t cdev_pager_allocate(void *handle, enum obj_type tp, |
| ... | ... | @@ -302,6 +301,9 @@ vm_object_t cdev_pager_allocate(void *handle, enum obj_type tp, |
| 302 | 301 | vm_ooffset_t foff, struct ucred *cred); |
| 303 | 302 | vm_object_t cdev_pager_lookup(void *handle); |
| 304 | 303 | void cdev_pager_free_page(vm_object_t object, vm_page_t m); |
| 304 | void cdev_mgtdev_pager_free_page(struct pctrie_iter *pages, vm_page_t m); | |
| 305 | void cdev_mgtdev_pager_free_pages(vm_object_t object); | |
| 306 | void cdev_pager_get_path(vm_object_t object, char *path, size_t sz); | |
| 305 | 307 | |
| 306 | 308 | struct phys_pager_ops { |
| 307 | 309 | 	int (*phys_pg_getpages)(vm_object_t vm_obj, vm_page_t *m, int count, |
lib/libc/include/generic-freebsd/vm/vm_param.h-10| ... | ... | @@ -31,8 +31,6 @@ |
| 31 | 31 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 32 | 32 | * SUCH DAMAGE. |
| 33 | 33 | * |
| 34 | *	from: @(#)vm_param.h	8.1 (Berkeley) 6/11/93 | |
| 35 | * | |
| 36 | 34 | * |
| 37 | 35 | * Copyright (c) 1987, 1990 Carnegie-Mellon University. |
| 38 | 36 | * All rights reserved. |
| ... | ... | @@ -114,14 +112,6 @@ struct xswdev { |
| 114 | 112 | #define	KERN_OUT_OF_BOUNDS	9 |
| 115 | 113 | #define	KERN_RESTART		10 |
| 116 | 114 | |
| 117 | #ifndef PA_LOCK_COUNT | |
| 118 | #ifdef SMP | |
| 119 | #define	PA_LOCK_COUNT	32 | |
| 120 | #else | |
| 121 | #define PA_LOCK_COUNT	1 | |
| 122 | #endif	/* !SMP */ | |
| 123 | #endif	/* !PA_LOCK_COUNT */ | |
| 124 | ||
| 125 | 115 | #ifndef KSTACK_MAX_PAGES |
| 126 | 116 | #define KSTACK_MAX_PAGES 32 |
| 127 | 117 | #endif |
lib/libc/include/generic-freebsd/vm/vm_phys.h+6-7| ... | ... | @@ -61,25 +61,24 @@ extern int *mem_locality; |
| 61 | 61 | void vm_phys_add_seg(vm_paddr_t start, vm_paddr_t end); |
| 62 | 62 | vm_page_t vm_phys_alloc_contig(int domain, u_long npages, vm_paddr_t low, |
| 63 | 63 | vm_paddr_t high, u_long alignment, vm_paddr_t boundary); |
| 64 | vm_page_t vm_phys_alloc_freelist_pages(int domain, int freelist, int pool, | |
| 65 | int order); | |
| 66 | 64 | int vm_phys_alloc_npages(int domain, int pool, int npages, vm_page_t ma[]); |
| 67 | 65 | vm_page_t vm_phys_alloc_pages(int domain, int pool, int order); |
| 68 | 66 | int vm_phys_domain_match(int prefer, vm_paddr_t low, vm_paddr_t high); |
| 69 | void vm_phys_enqueue_contig(vm_page_t m, u_long npages); | |
| 67 | void vm_phys_enqueue_contig(vm_page_t m, int pool, u_long npages); | |
| 70 | 68 | int vm_phys_fictitious_reg_range(vm_paddr_t start, vm_paddr_t end, |
| 71 | 69 | vm_memattr_t memattr); |
| 72 | 70 | void vm_phys_fictitious_unreg_range(vm_paddr_t start, vm_paddr_t end); |
| 73 | 71 | vm_page_t vm_phys_fictitious_to_vm_page(vm_paddr_t pa); |
| 74 | 72 | int vm_phys_find_range(vm_page_t bounds[], int segind, int domain, |
| 75 | 73 | u_long npages, vm_paddr_t low, vm_paddr_t high); |
| 76 | void vm_phys_free_contig(vm_page_t m, u_long npages); | |
| 77 | void vm_phys_free_pages(vm_page_t m, int order); | |
| 74 | void vm_phys_free_contig(vm_page_t m, int pool, u_long npages); | |
| 75 | void vm_phys_free_pages(vm_page_t m, int pool, int order); | |
| 78 | 76 | void vm_phys_init(void); |
| 79 | 77 | vm_page_t vm_phys_paddr_to_vm_page(vm_paddr_t pa); |
| 78 | vm_page_t vm_phys_seg_paddr_to_vm_page(struct vm_phys_seg *seg, vm_paddr_t pa); | |
| 80 | 79 | void vm_phys_register_domains(int ndomains, struct mem_affinity *affinity, |
| 81 | 80 | int *locality); |
| 82 | bool vm_phys_unfree_page(vm_page_t m); | |
| 81 | bool vm_phys_unfree_page(vm_paddr_t pa); | |
| 83 | 82 | int vm_phys_mem_affinity(int f, int t); |
| 84 | 83 | void vm_phys_early_add_seg(vm_paddr_t start, vm_paddr_t end); |
| 85 | 84 | vm_paddr_t vm_phys_early_alloc(int domain, size_t alloc_size); |
| ... | ... | @@ -89,7 +88,7 @@ vm_paddr_t vm_phys_avail_size(int i); |
| 89 | 88 | bool vm_phys_is_dumpable(vm_paddr_t pa); |
| 90 | 89 | |
| 91 | 90 | static inline int |
| 92 | vm_phys_domain(vm_paddr_t pa) | |
| 91 | vm_phys_domain(vm_paddr_t pa __numa_used) | |
| 93 | 92 | { |
| 94 | 93 | #ifdef NUMA |
| 95 | 94 | 	int i; |
lib/libc/include/generic-freebsd/vm/vm_radix.h+309-18| ... | ... | @@ -34,36 +34,327 @@ |
| 34 | 34 | #include <vm/_vm_radix.h> |
| 35 | 35 | |
| 36 | 36 | #ifdef _KERNEL |
| 37 | #include <sys/pctrie.h> | |
| 38 | #include <vm/vm_page.h> | |
| 39 | #include <vm/vm.h> | |
| 37 | 40 | |
| 38 | int		vm_radix_insert(struct vm_radix *rtree, vm_page_t page); | |
| 39 | 41 | void		vm_radix_wait(void); |
| 40 | vm_page_t	vm_radix_lookup(struct vm_radix *rtree, vm_pindex_t index); | |
| 41 | vm_page_t	vm_radix_lookup_ge(struct vm_radix *rtree, vm_pindex_t index); | |
| 42 | vm_page_t	vm_radix_lookup_le(struct vm_radix *rtree, vm_pindex_t index); | |
| 43 | vm_page_t	vm_radix_lookup_unlocked(struct vm_radix *rtree, vm_pindex_t index); | |
| 44 | void		vm_radix_reclaim_allnodes(struct vm_radix *rtree); | |
| 45 | vm_page_t	vm_radix_remove(struct vm_radix *rtree, vm_pindex_t index); | |
| 46 | vm_page_t	vm_radix_replace(struct vm_radix *rtree, vm_page_t newpage); | |
| 47 | 42 | void		vm_radix_zinit(void); |
| 48 | ||
| 49 | /* | |
| 50 | * Each search path in the trie terminates at a leaf, which is a pointer to a | |
| 51 | * page marked with a set 1-bit. A leaf may be associated with a null pointer | |
| 52 | * to indicate no page there. | |
| 53 | */ | |
| 54 | #define	VM_RADIX_ISLEAF	0x1 | |
| 55 | #define VM_RADIX_NULL (struct vm_radix_node *)VM_RADIX_ISLEAF | |
| 43 | void		*vm_radix_node_alloc(struct pctrie *ptree); | |
| 44 | void		vm_radix_node_free(struct pctrie *ptree, void *node); | |
| 45 | extern smr_t	vm_radix_smr; | |
| 56 | 46 | |
| 57 | 47 | static __inline void |
| 58 | 48 | vm_radix_init(struct vm_radix *rtree) |
| 59 | 49 | { |
| 60 | 	rtree->rt_root = VM_RADIX_NULL; | |
| 50 | 	pctrie_init(&rtree->rt_trie); | |
| 61 | 51 | } |
| 62 | 52 | |
| 63 | 53 | static __inline bool |
| 64 | 54 | vm_radix_is_empty(struct vm_radix *rtree) |
| 65 | 55 | { |
| 66 | 	return (rtree->rt_root == VM_RADIX_NULL); | |
| 56 | 	return (pctrie_is_empty(&rtree->rt_trie)); | |
| 57 | } | |
| 58 | ||
| 59 | PCTRIE_DEFINE_SMR(VM_RADIX, vm_page, pindex, vm_radix_node_alloc, | |
| 60 | vm_radix_node_free, vm_radix_smr); | |
| 61 | ||
| 62 | /* | |
| 63 | * Inserts the key-value pair into the trie, starting search from root. | |
| 64 | * Panics if the key already exists. | |
| 65 | */ | |
| 66 | static __inline int | |
| 67 | vm_radix_insert(struct vm_radix *rtree, vm_page_t page) | |
| 68 | { | |
| 69 | 	return (VM_RADIX_PCTRIE_INSERT(&rtree->rt_trie, page)); | |
| 70 | } | |
| 71 | ||
| 72 | /* | |
| 73 | * Inserts the key-value pair into the trie, starting search from iterator. | |
| 74 | * Panics if the key already exists. | |
| 75 | */ | |
| 76 | static __inline int | |
| 77 | vm_radix_iter_insert(struct pctrie_iter *pages, vm_page_t page) | |
| 78 | { | |
| 79 | 	return (VM_RADIX_PCTRIE_ITER_INSERT(pages, page)); | |
| 80 | } | |
| 81 | ||
| 82 | /* | |
| 83 | * Returns the value stored at the index assuming there is an external lock. | |
| 84 | * | |
| 85 | * If the index is not present, NULL is returned. | |
| 86 | */ | |
| 87 | static __inline vm_page_t | |
| 88 | vm_radix_lookup(struct vm_radix *rtree, vm_pindex_t index) | |
| 89 | { | |
| 90 | 	return (VM_RADIX_PCTRIE_LOOKUP(&rtree->rt_trie, index)); | |
| 91 | } | |
| 92 | ||
| 93 | /* | |
| 94 | * Returns the value stored at the index without requiring an external lock. | |
| 95 | * | |
| 96 | * If the index is not present, NULL is returned. | |
| 97 | */ | |
| 98 | static __inline vm_page_t | |
| 99 | vm_radix_lookup_unlocked(struct vm_radix *rtree, vm_pindex_t index) | |
| 100 | { | |
| 101 | 	return (VM_RADIX_PCTRIE_LOOKUP_UNLOCKED(&rtree->rt_trie, index)); | |
| 102 | } | |
| 103 | ||
| 104 | /* | |
| 105 | * Returns the number of contiguous, non-NULL pages read into the ma[] | |
| 106 | * array, without requiring an external lock. | |
| 107 | */ | |
| 108 | static __inline int | |
| 109 | vm_radix_lookup_range_unlocked(struct vm_radix *rtree, vm_pindex_t index, | |
| 110 | vm_page_t ma[], int count) | |
| 111 | { | |
| 112 | 	return (VM_RADIX_PCTRIE_LOOKUP_RANGE_UNLOCKED(&rtree->rt_trie, index, | |
| 113 | 	 ma, count)); | |
| 114 | } | |
| 115 | ||
| 116 | /* | |
| 117 | * Returns the number of contiguous, non-NULL pages read into the ma[] | |
| 118 | * array, without requiring an external lock. | |
| 119 | */ | |
| 120 | static __inline int | |
| 121 | vm_radix_iter_lookup_range(struct pctrie_iter *pages, vm_pindex_t index, | |
| 122 | vm_page_t ma[], int count) | |
| 123 | { | |
| 124 | 	return (VM_RADIX_PCTRIE_ITER_LOOKUP_RANGE(pages, index, ma, count)); | |
| 125 | } | |
| 126 | ||
| 127 | /* | |
| 128 | * Initialize an iterator for vm_radix. | |
| 129 | */ | |
| 130 | static __inline void | |
| 131 | vm_radix_iter_init(struct pctrie_iter *pages, struct vm_radix *rtree) | |
| 132 | { | |
| 133 | 	pctrie_iter_init(pages, &rtree->rt_trie); | |
| 134 | } | |
| 135 | ||
| 136 | /* | |
| 137 | * Initialize an iterator for vm_radix. | |
| 138 | */ | |
| 139 | static __inline void | |
| 140 | vm_radix_iter_limit_init(struct pctrie_iter *pages, struct vm_radix *rtree, | |
| 141 | vm_pindex_t limit) | |
| 142 | { | |
| 143 | 	pctrie_iter_limit_init(pages, &rtree->rt_trie, limit); | |
| 144 | } | |
| 145 | ||
| 146 | /* | |
| 147 | * Returns the value stored at the index. | |
| 148 | * Requires that access be externally synchronized by a lock. | |
| 149 | * | |
| 150 | * If the index is not present, NULL is returned. | |
| 151 | */ | |
| 152 | static __inline vm_page_t | |
| 153 | vm_radix_iter_lookup(struct pctrie_iter *pages, vm_pindex_t index) | |
| 154 | { | |
| 155 | 	return (VM_RADIX_PCTRIE_ITER_LOOKUP(pages, index)); | |
| 156 | } | |
| 157 | ||
| 158 | /* | |
| 159 | * Returns the value stored 'stride' steps beyond the current position. | |
| 160 | * Requires that access be externally synchronized by a lock. | |
| 161 | * | |
| 162 | * If the index is not present, NULL is returned. | |
| 163 | */ | |
| 164 | static __inline vm_page_t | |
| 165 | vm_radix_iter_stride(struct pctrie_iter *pages, int stride) | |
| 166 | { | |
| 167 | 	return (VM_RADIX_PCTRIE_ITER_STRIDE(pages, stride)); | |
| 168 | } | |
| 169 | ||
| 170 | /* | |
| 171 | * Returns the page with the least pindex that is greater than or equal to the | |
| 172 | * specified pindex, or NULL if there are no such pages. | |
| 173 | * | |
| 174 | * Requires that access be externally synchronized by a lock. | |
| 175 | */ | |
| 176 | static __inline vm_page_t | |
| 177 | vm_radix_lookup_ge(struct vm_radix *rtree, vm_pindex_t index) | |
| 178 | { | |
| 179 | 	return (VM_RADIX_PCTRIE_LOOKUP_GE(&rtree->rt_trie, index)); | |
| 180 | } | |
| 181 | ||
| 182 | /* | |
| 183 | * Returns the page with the greatest pindex that is less than or equal to the | |
| 184 | * specified pindex, or NULL if there are no such pages. | |
| 185 | * | |
| 186 | * Requires that access be externally synchronized by a lock. | |
| 187 | */ | |
| 188 | static __inline vm_page_t | |
| 189 | vm_radix_lookup_le(struct vm_radix *rtree, vm_pindex_t index) | |
| 190 | { | |
| 191 | 	return (VM_RADIX_PCTRIE_LOOKUP_LE(&rtree->rt_trie, index)); | |
| 192 | } | |
| 193 | ||
| 194 | /* | |
| 195 | * Remove the specified index from the trie, and return the value stored at | |
| 196 | * that index. If the index is not present, return NULL. | |
| 197 | */ | |
| 198 | static __inline vm_page_t | |
| 199 | vm_radix_remove(struct vm_radix *rtree, vm_pindex_t index) | |
| 200 | { | |
| 201 | 	return (VM_RADIX_PCTRIE_REMOVE_LOOKUP(&rtree->rt_trie, index)); | |
| 202 | } | |
| 203 | ||
| 204 | /* | |
| 205 | * Remove the current page from the trie. | |
| 206 | */ | |
| 207 | static __inline void | |
| 208 | vm_radix_iter_remove(struct pctrie_iter *pages) | |
| 209 | { | |
| 210 | 	VM_RADIX_PCTRIE_ITER_REMOVE(pages); | |
| 211 | } | |
| 212 | ||
| 213 | /* | |
| 214 | * Reclaim all the interior nodes of the trie, and invoke the callback | |
| 215 | * on all the pages, in order. | |
| 216 | */ | |
| 217 | static __inline void | |
| 218 | vm_radix_reclaim_callback(struct vm_radix *rtree, | |
| 219 | void (*page_cb)(vm_page_t, void *), void *arg) | |
| 220 | { | |
| 221 | 	VM_RADIX_PCTRIE_RECLAIM_CALLBACK(&rtree->rt_trie, page_cb, arg); | |
| 222 | } | |
| 223 | ||
| 224 | /* | |
| 225 | * Initialize an iterator pointing to the page with the least pindex that is | |
| 226 | * greater than or equal to the specified pindex, or NULL if there are no such | |
| 227 | * pages. Return the page. | |
| 228 | * | |
| 229 | * Requires that access be externally synchronized by a lock. | |
| 230 | */ | |
| 231 | static __inline vm_page_t | |
| 232 | vm_radix_iter_lookup_ge(struct pctrie_iter *pages, vm_pindex_t index) | |
| 233 | { | |
| 234 | 	return (VM_RADIX_PCTRIE_ITER_LOOKUP_GE(pages, index)); | |
| 235 | } | |
| 236 | ||
| 237 | /* | |
| 238 | * Update the iterator to point to the page with the least pindex that is 'jump' | |
| 239 | * or more greater than or equal to the current pindex, or NULL if there are no | |
| 240 | * such pages. Return the page. | |
| 241 | * | |
| 242 | * Requires that access be externally synchronized by a lock. | |
| 243 | */ | |
| 244 | static __inline vm_page_t | |
| 245 | vm_radix_iter_jump(struct pctrie_iter *pages, vm_pindex_t jump) | |
| 246 | { | |
| 247 | 	return (VM_RADIX_PCTRIE_ITER_JUMP_GE(pages, jump)); | |
| 248 | } | |
| 249 | ||
| 250 | /* | |
| 251 | * Update the iterator to point to the page with the least pindex that is one or | |
| 252 | * more greater than the current pindex, or NULL if there are no such pages. | |
| 253 | * Return the page. | |
| 254 | * | |
| 255 | * Requires that access be externally synchronized by a lock. | |
| 256 | */ | |
| 257 | static __inline vm_page_t | |
| 258 | vm_radix_iter_step(struct pctrie_iter *pages) | |
| 259 | { | |
| 260 | 	return (VM_RADIX_PCTRIE_ITER_STEP_GE(pages)); | |
| 261 | } | |
| 262 | ||
| 263 | /* | |
| 264 | * Iterate over each non-NULL page from page 'start' to the end of the object. | |
| 265 | */ | |
| 266 | #define VM_RADIX_FOREACH_FROM(m, pages, start)				\ | |
| 267 | 	for (m = vm_radix_iter_lookup_ge(pages, start); m != NULL;	\ | |
| 268 | 	 m = vm_radix_iter_step(pages)) | |
| 269 | ||
| 270 | /* | |
| 271 | * Iterate over each non-NULL page from the beginning to the end of the object. | |
| 272 | */ | |
| 273 | #define VM_RADIX_FOREACH(m, pages) VM_RADIX_FOREACH_FROM(m, pages, 0) | |
| 274 | ||
| 275 | /* | |
| 276 | * Initialize an iterator pointing to the page with the greatest pindex that is | |
| 277 | * less than or equal to the specified pindex, or NULL if there are no such | |
| 278 | * pages. Return the page. | |
| 279 | * | |
| 280 | * Requires that access be externally synchronized by a lock. | |
| 281 | */ | |
| 282 | static __inline vm_page_t | |
| 283 | vm_radix_iter_lookup_le(struct pctrie_iter *pages, vm_pindex_t index) | |
| 284 | { | |
| 285 | 	return (VM_RADIX_PCTRIE_ITER_LOOKUP_LE(pages, index)); | |
| 286 | } | |
| 287 | ||
| 288 | /* | |
| 289 | * Initialize an iterator pointing to the page with the greatest pindex that is | |
| 290 | * less than to the specified pindex, or NULL if there are no such | |
| 291 | * pages. Return the page. | |
| 292 | * | |
| 293 | * Requires that access be externally synchronized by a lock. | |
| 294 | */ | |
| 295 | static __inline vm_page_t | |
| 296 | vm_radix_iter_lookup_lt(struct pctrie_iter *pages, vm_pindex_t index) | |
| 297 | { | |
| 298 | 	return (index == 0 ? NULL : vm_radix_iter_lookup_le(pages, index - 1)); | |
| 299 | } | |
| 300 | ||
| 301 | /* | |
| 302 | * Update the iterator to point to the page with the pindex that is one greater | |
| 303 | * than the current pindex, or NULL if there is no such page. Return the page. | |
| 304 | * | |
| 305 | * Requires that access be externally synchronized by a lock. | |
| 306 | */ | |
| 307 | static __inline vm_page_t | |
| 308 | vm_radix_iter_next(struct pctrie_iter *pages) | |
| 309 | { | |
| 310 | 	return (VM_RADIX_PCTRIE_ITER_NEXT(pages)); | |
| 311 | } | |
| 312 | ||
| 313 | /* | |
| 314 | * Iterate over consecutive non-NULL pages from position 'start' to first NULL | |
| 315 | * page. | |
| 316 | */ | |
| 317 | #define VM_RADIX_FORALL_FROM(m, pages, start)				\ | |
| 318 | 	for (m = vm_radix_iter_lookup(pages, start); m != NULL;		\ | |
| 319 | 	 m = vm_radix_iter_next(pages)) | |
| 320 | ||
| 321 | /* | |
| 322 | * Iterate over consecutive non-NULL pages from the beginning to first NULL | |
| 323 | * page. | |
| 324 | */ | |
| 325 | #define VM_RADIX_FORALL(m, pages) VM_RADIX_FORALL_FROM(m, pages, 0) | |
| 326 | ||
| 327 | /* | |
| 328 | * Update the iterator to point to the page with the pindex that is one less | |
| 329 | * than the current pindex, or NULL if there is no such page. Return the page. | |
| 330 | * | |
| 331 | * Requires that access be externally synchronized by a lock. | |
| 332 | */ | |
| 333 | static __inline vm_page_t | |
| 334 | vm_radix_iter_prev(struct pctrie_iter *pages) | |
| 335 | { | |
| 336 | 	return (VM_RADIX_PCTRIE_ITER_PREV(pages)); | |
| 337 | } | |
| 338 | ||
| 339 | /* | |
| 340 | * Return the current page. | |
| 341 | * | |
| 342 | * Requires that access be externally synchronized by a lock. | |
| 343 | */ | |
| 344 | static __inline vm_page_t | |
| 345 | vm_radix_iter_page(struct pctrie_iter *pages) | |
| 346 | { | |
| 347 | 	return (VM_RADIX_PCTRIE_ITER_VALUE(pages)); | |
| 348 | } | |
| 349 | ||
| 350 | /* | |
| 351 | * Replace an existing page in the trie with another one. | |
| 352 | * Panics if there is not an old page in the trie at the new page's index. | |
| 353 | */ | |
| 354 | static __inline vm_page_t | |
| 355 | vm_radix_replace(struct vm_radix *rtree, vm_page_t newpage) | |
| 356 | { | |
| 357 | 	return (VM_RADIX_PCTRIE_REPLACE(&rtree->rt_trie, newpage)); | |
| 67 | 358 | } |
| 68 | 359 | |
| 69 | 360 | #endif /* _KERNEL */ |
lib/libc/include/generic-freebsd/vm/vm_reserv.h+5-4| ... | ... | @@ -46,15 +46,16 @@ |
| 46 | 46 | * The following functions are only to be used by the virtual memory system. |
| 47 | 47 | */ |
| 48 | 48 | vm_page_t	vm_reserv_alloc_contig(vm_object_t object, vm_pindex_t pindex, |
| 49 | 		 int domain, int req, vm_page_t mpred, u_long npages, | |
| 50 | 		 vm_paddr_t low, vm_paddr_t high, u_long alignment, | |
| 51 | 		 vm_paddr_t boundary); | |
| 49 | 		 int domain, int req, u_long npages, vm_paddr_t low, | |
| 50 | 		 vm_paddr_t high, u_long alignment, vm_paddr_t boundary, | |
| 51 | 		 struct pctrie_iter *pages); | |
| 52 | 52 | vm_page_t	vm_reserv_alloc_page(vm_object_t object, vm_pindex_t pindex, |
| 53 | 		 int domain, int req, vm_page_t mpred); | |
| 53 | 		 int domain, int req, struct pctrie_iter *pages); | |
| 54 | 54 | void		vm_reserv_break_all(vm_object_t object); |
| 55 | 55 | boolean_t	vm_reserv_free_page(vm_page_t m); |
| 56 | 56 | void		vm_reserv_init(void); |
| 57 | 57 | bool		vm_reserv_is_page_free(vm_page_t m); |
| 58 | bool		vm_reserv_is_populated(vm_page_t m, int npages); | |
| 58 | 59 | int		vm_reserv_level(vm_page_t m); |
| 59 | 60 | int		vm_reserv_level_iffullpop(vm_page_t m); |
| 60 | 61 | vm_page_t	vm_reserv_reclaim_contig(int domain, u_long npages, |
lib/libc/include/generic-freebsd/vm/vnode_pager.h-2| ... | ... | @@ -32,8 +32,6 @@ |
| 32 | 32 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 33 | 33 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 34 | 34 | * SUCH DAMAGE. |
| 35 | * | |
| 36 | *	@(#)vnode_pager.h	8.1 (Berkeley) 6/11/93 | |
| 37 | 35 | */ |
| 38 | 36 | |
| 39 | 37 | #ifndef	_VNODE_PAGER_ |
lib/libc/include/generic-freebsd/wchar.h+9-2| ... | ... | @@ -78,7 +78,7 @@ typedef	__size_t	size_t; |
| 78 | 78 | |
| 79 | 79 | #if __POSIX_VISIBLE >= 200809 || __XSI_VISIBLE |
| 80 | 80 | #ifndef _VA_LIST_DECLARED |
| 81 | typedef	__va_list	va_list; | |
| 81 | typedef	__builtin_va_list	va_list; | |
| 82 | 82 | #define	_VA_LIST_DECLARED |
| 83 | 83 | #endif |
| 84 | 84 | #endif |
| ... | ... | @@ -108,6 +108,14 @@ typedef struct __sFILE FILE; |
| 108 | 108 | #endif |
| 109 | 109 | struct tm; |
| 110 | 110 | |
| 111 | __BEGIN_DECLS | |
| 112 | size_t	wcslen(const wchar_t *) __pure; | |
| 113 | __END_DECLS | |
| 114 | ||
| 115 | #if !defined(_STANDALONE) && defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE > 0 | |
| 116 | #include <ssp/wchar.h> | |
| 117 | #endif | |
| 118 | ||
| 111 | 119 | __BEGIN_DECLS |
| 112 | 120 | wint_t	btowc(int); |
| 113 | 121 | wint_t	fgetwc(FILE *); |
| ... | ... | @@ -146,7 +154,6 @@ wchar_t	*wcscpy(wchar_t * __restrict, const wchar_t * __restrict); |
| 146 | 154 | size_t	wcscspn(const wchar_t *, const wchar_t *) __pure; |
| 147 | 155 | size_t	wcsftime(wchar_t * __restrict, size_t, const wchar_t * __restrict, |
| 148 | 156 | 	 const struct tm * __restrict); |
| 149 | size_t	wcslen(const wchar_t *) __pure; | |
| 150 | 157 | wchar_t	*wcsncat(wchar_t * __restrict, const wchar_t * __restrict, |
| 151 | 158 | 	 size_t); |
| 152 | 159 | int	wcsncmp(const wchar_t *, const wchar_t *, size_t) __pure; |
lib/libc/include/generic-freebsd/x86/_align.h-2| ... | ... | @@ -35,8 +35,6 @@ |
| 35 | 35 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 36 | 36 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 37 | 37 | * SUCH DAMAGE. |
| 38 | * | |
| 39 | *	from: @(#)param.h	5.8 (Berkeley) 6/28/91 | |
| 40 | 38 | */ |
| 41 | 39 | |
| 42 | 40 | #ifndef _X86_INCLUDE__ALIGN_H_ |
lib/libc/include/generic-freebsd/x86/_limits.h-2| ... | ... | @@ -27,8 +27,6 @@ |
| 27 | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | * | |
| 31 | *	@(#)limits.h	8.3 (Berkeley) 1/4/94 | |
| 32 | 30 | */ |
| 33 | 31 | |
| 34 | 32 | #ifndef	_MACHINE__LIMITS_H_ |
lib/libc/include/generic-freebsd/x86/_types.h-3| ... | ... | @@ -32,9 +32,6 @@ |
| 32 | 32 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 33 | 33 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 34 | 34 | * SUCH DAMAGE. |
| 35 | * | |
| 36 | *	From: @(#)ansi.h	8.2 (Berkeley) 1/4/94 | |
| 37 | *	From: @(#)types.h	8.3 (Berkeley) 1/5/94 | |
| 38 | 35 | */ |
| 39 | 36 | |
| 40 | 37 | #ifndef _MACHINE__TYPES_H_ |
lib/libc/include/generic-freebsd/x86/acpica_machdep.h+2| ... | ... | @@ -84,6 +84,8 @@ void	madt_parse_interrupt_values(void *entry, |
| 84 | 84 | extern int madt_found_sci_override; |
| 85 | 85 | extern int (*apei_nmi)(void); |
| 86 | 86 | |
| 87 | void	acpi_set_root(vm_paddr_t addr); | |
| 88 | ||
| 87 | 89 | #endif /* _KERNEL */ |
| 88 | 90 | |
| 89 | 91 | #endif /* __ACPICA_MACHDEP_H__ */ |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/x86/apicreg.h+2| ... | ... | @@ -296,6 +296,8 @@ typedef struct IOAPIC ioapic_t; |
| 296 | 296 | /* constants relating to APIC ID registers */ |
| 297 | 297 | #define APIC_ID_MASK		0xff000000 |
| 298 | 298 | #define	APIC_ID_SHIFT		24 |
| 299 | #define APIC_EXT_ID_MASK	0x00fe0000 | |
| 300 | #define	APIC_EXT_ID_SHIFT	17 | |
| 299 | 301 | #define	APIC_ID_CLUSTER		0xf0 |
| 300 | 302 | #define	APIC_ID_CLUSTER_ID	0x0f |
| 301 | 303 | #define	APIC_MAX_CLUSTER	0xe |
lib/libc/include/generic-freebsd/x86/apicvar.h+16-14| ... | ... | @@ -196,19 +196,21 @@ extern int *apic_cpuids; |
| 196 | 196 | /* Allow to replace the lapic_ipi_vectored implementation. */ |
| 197 | 197 | extern void (*ipi_vectored)(u_int, int); |
| 198 | 198 | |
| 199 | typedef struct ioapic *ioapic_drv_t; | |
| 200 | ||
| 199 | 201 | void	apic_register_enumerator(struct apic_enumerator *enumerator); |
| 200 | void	*ioapic_create(vm_paddr_t addr, int32_t apic_id, int intbase); | |
| 201 | int	ioapic_disable_pin(void *cookie, u_int pin); | |
| 202 | int	ioapic_get_vector(void *cookie, u_int pin); | |
| 203 | void	ioapic_register(void *cookie); | |
| 204 | int	ioapic_remap_vector(void *cookie, u_int pin, int vector); | |
| 205 | int	ioapic_set_bus(void *cookie, u_int pin, int bus_type); | |
| 206 | int	ioapic_set_extint(void *cookie, u_int pin); | |
| 207 | int	ioapic_set_nmi(void *cookie, u_int pin); | |
| 208 | int	ioapic_set_polarity(void *cookie, u_int pin, enum intr_polarity pol); | |
| 209 | int	ioapic_set_triggermode(void *cookie, u_int pin, | |
| 202 | ioapic_drv_t	ioapic_create(vm_paddr_t addr, int32_t apic_id, int intbase); | |
| 203 | int	ioapic_disable_pin(ioapic_drv_t cookie, u_int pin); | |
| 204 | int	ioapic_get_vector(ioapic_drv_t cookie, u_int pin); | |
| 205 | void	ioapic_register(ioapic_drv_t cookie); | |
| 206 | int	ioapic_remap_vector(ioapic_drv_t cookie, u_int pin, int vector); | |
| 207 | int	ioapic_set_bus(ioapic_drv_t cookie, u_int pin, int bus_type); | |
| 208 | int	ioapic_set_extint(ioapic_drv_t cookie, u_int pin); | |
| 209 | int	ioapic_set_nmi(ioapic_drv_t cookie, u_int pin); | |
| 210 | int	ioapic_set_polarity(ioapic_drv_t cookie, u_int pin, enum intr_polarity pol); | |
| 211 | int	ioapic_set_triggermode(ioapic_drv_t cookie, u_int pin, | |
| 210 | 212 | 	 enum intr_trigger trigger); |
| 211 | int	ioapic_set_smi(void *cookie, u_int pin); | |
| 213 | int	ioapic_set_smi(ioapic_drv_t cookie, u_int pin); | |
| 212 | 214 | |
| 213 | 215 | void	lapic_create(u_int apic_id, int boot_cpu); |
| 214 | 216 | void	lapic_init(vm_paddr_t addr); |
| ... | ... | @@ -229,9 +231,9 @@ void	apic_enable_vector(u_int apic_id, u_int vector); |
| 229 | 231 | void	apic_disable_vector(u_int apic_id, u_int vector); |
| 230 | 232 | void	apic_free_vector(u_int apic_id, u_int vector, u_int irq); |
| 231 | 233 | void	lapic_calibrate_timer(void); |
| 232 | int	lapic_enable_pmc(void); | |
| 233 | void	lapic_disable_pmc(void); | |
| 234 | void	lapic_reenable_pmc(void); | |
| 234 | int	lapic_enable_pcint(void); | |
| 235 | void	lapic_disable_pcint(void); | |
| 236 | void	lapic_reenable_pcint(void); | |
| 235 | 237 | void	lapic_enable_cmc(void); |
| 236 | 238 | int	lapic_enable_mca_elvt(void); |
| 237 | 239 | void	lapic_ipi_raw(register_t icrlo, u_int dest); |
lib/libc/include/generic-freebsd/x86/bus.h+1-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /*- |
| 2 | * SPDX-License-Identifier: BSD-3-Clause AND BSD-2-ClauseE | |
| 2 | * SPDX-License-Identifier: BSD-3-Clause AND BSD-2-Clause | |
| 3 | 3 | * |
| 4 | 4 | * Copyright (c) KATO Takenori, 1999. |
| 5 | 5 | * |
lib/libc/include/generic-freebsd/x86/bus_dma.h+1-1| ... | ... | @@ -88,7 +88,7 @@ bus_dmamem_alloc(bus_dma_tag_t dmat, void** vaddr, int flags, |
| 88 | 88 | |
| 89 | 89 | /* |
| 90 | 90 | * Free a piece of memory and it's allociated dmamap, that was allocated |
| 91 | * via bus_dmamem_alloc. Make the same choice for free/contigfree. | |
| 91 | * via bus_dmamem_alloc. | |
| 92 | 92 | */ |
| 93 | 93 | static inline void |
| 94 | 94 | bus_dmamem_free(bus_dma_tag_t dmat, void *vaddr, bus_dmamap_t map) |
lib/libc/include/generic-freebsd/x86/busdma_impl.h+3-10| ... | ... | @@ -33,28 +33,23 @@ |
| 33 | 33 | |
| 34 | 34 | struct bus_dma_tag_common { |
| 35 | 35 | 	struct bus_dma_impl *impl; |
| 36 | 	struct bus_dma_tag_common *parent; | |
| 37 | 36 | 	bus_size_t	 alignment; |
| 38 | 37 | 	bus_addr_t	 boundary; |
| 39 | 38 | 	bus_addr_t	 lowaddr; |
| 40 | 39 | 	bus_addr_t	 highaddr; |
| 41 | 	bus_dma_filter_t *filter; | |
| 42 | 	void		 *filterarg; | |
| 43 | 40 | 	bus_size_t	 maxsize; |
| 44 | 41 | 	u_int		 nsegments; |
| 45 | 42 | 	bus_size_t	 maxsegsz; |
| 46 | 43 | 	int		 flags; |
| 47 | 44 | 	bus_dma_lock_t	 *lockfunc; |
| 48 | 45 | 	void		 *lockfuncarg; |
| 49 | 	int		 ref_count; | |
| 50 | 46 | 	int		 domain; |
| 51 | 47 | }; |
| 52 | 48 | |
| 53 | 49 | struct bus_dma_impl { |
| 54 | 50 | 	int (*tag_create)(bus_dma_tag_t parent, |
| 55 | 51 | 	 bus_size_t alignment, bus_addr_t boundary, bus_addr_t lowaddr, |
| 56 | 	 bus_addr_t highaddr, bus_dma_filter_t *filter, | |
| 57 | 	 void *filterarg, bus_size_t maxsize, int nsegments, | |
| 52 | 	 bus_addr_t highaddr, bus_size_t maxsize, int nsegments, | |
| 58 | 53 | 	 bus_size_t maxsegsz, int flags, bus_dma_lock_t *lockfunc, |
| 59 | 54 | 	 void *lockfuncarg, bus_dma_tag_t *dmat); |
| 60 | 55 | 	int (*tag_destroy)(bus_dma_tag_t dmat); |
| ... | ... | @@ -87,13 +82,11 @@ struct bus_dma_impl { |
| 87 | 82 | #endif |
| 88 | 83 | }; |
| 89 | 84 | |
| 90 | int bus_dma_run_filter(struct bus_dma_tag_common *dmat, vm_paddr_t paddr); | |
| 91 | 85 | int common_bus_dma_tag_create(struct bus_dma_tag_common *parent, |
| 92 | 86 | bus_size_t alignment, |
| 93 | 87 | bus_addr_t boundary, bus_addr_t lowaddr, bus_addr_t highaddr, |
| 94 | bus_dma_filter_t *filter, void *filterarg, bus_size_t maxsize, | |
| 95 | int nsegments, bus_size_t maxsegsz, int flags, bus_dma_lock_t *lockfunc, | |
| 96 | void *lockfuncarg, size_t sz, void **dmat); | |
| 88 | bus_size_t maxsize, int nsegments, bus_size_t maxsegsz, int flags, | |
| 89 | bus_dma_lock_t *lockfunc, void *lockfuncarg, size_t sz, void **dmat); | |
| 97 | 90 | |
| 98 | 91 | extern struct bus_dma_impl bus_dma_bounce_impl; |
| 99 | 92 |
lib/libc/include/generic-freebsd/x86/dump.h+8| ... | ... | @@ -38,7 +38,11 @@ |
| 38 | 38 | |
| 39 | 39 | /* 20 phys_avail entry pairs correspond to 10 pa's */ |
| 40 | 40 | #define	DUMPSYS_MD_PA_NPAIRS	10 |
| 41 | #ifdef __amd64__ | |
| 42 | #define	DUMPSYS_NUM_AUX_HDRS	1 | |
| 43 | #else | |
| 41 | 44 | #define	DUMPSYS_NUM_AUX_HDRS	0 |
| 45 | #endif | |
| 42 | 46 | |
| 43 | 47 | /* How often to check the dump progress bar? */ |
| 44 | 48 | #define	DUMPSYS_PB_CHECK_BITS	24	/* Every 16MB */ |
| ... | ... | @@ -71,12 +75,16 @@ dumpsys_unmap_chunk(vm_paddr_t pa, size_t s, void *va) |
| 71 | 75 | 	dumpsys_gen_unmap_chunk(pa, s, va); |
| 72 | 76 | } |
| 73 | 77 | |
| 78 | #ifdef __amd64__ | |
| 79 | int dumpsys_write_aux_headers(struct dumperinfo *di); | |
| 80 | #else | |
| 74 | 81 | static inline int |
| 75 | 82 | dumpsys_write_aux_headers(struct dumperinfo *di) |
| 76 | 83 | { |
| 77 | 84 | |
| 78 | 85 | 	return (dumpsys_gen_write_aux_headers(di)); |
| 79 | 86 | } |
| 87 | #endif | |
| 80 | 88 | |
| 81 | 89 | static inline int |
| 82 | 90 | dumpsys(struct dumperinfo *di) |
lib/libc/include/generic-freebsd/x86/endian.h-2| ... | ... | @@ -27,8 +27,6 @@ |
| 27 | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | * | |
| 31 | *	@(#)endian.h	7.8 (Berkeley) 4/3/91 | |
| 32 | 30 | */ |
| 33 | 31 | |
| 34 | 32 | #ifndef _MACHINE_ENDIAN_H_ |
lib/libc/include/generic-freebsd/x86/float.h-2| ... | ... | @@ -27,8 +27,6 @@ |
| 27 | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | * | |
| 31 | *	from: @(#)float.h	7.1 (Berkeley) 5/8/90 | |
| 32 | 30 | */ |
| 33 | 31 | |
| 34 | 32 | #ifndef _MACHINE_FLOAT_H_ |
lib/libc/include/generic-freebsd/x86/fpu.h+7-2| ... | ... | @@ -28,8 +28,6 @@ |
| 28 | 28 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 29 | 29 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 30 | 30 | * SUCH DAMAGE. |
| 31 | * | |
| 32 | *	from: @(#)npx.h	5.3 (Berkeley) 1/18/91 | |
| 33 | 31 | */ |
| 34 | 32 | |
| 35 | 33 | /* |
| ... | ... | @@ -220,6 +218,13 @@ struct savefpu_ymm { |
| 220 | 218 | */ |
| 221 | 219 | #define	fpu_enable()	clts() |
| 222 | 220 | #define	fpu_disable()	load_cr0(rcr0() | CR0_TS) |
| 221 | ||
| 222 | bool	xsave_extfeature_supported(uint64_t feature, bool supervisor); | |
| 223 | bool	xsave_extension_supported(uint64_t extension); | |
| 224 | size_t	xsave_area_hdr_offset(void); | |
| 225 | size_t	xsave_area_offset(uint64_t xstate_bv, uint64_t feature, bool compact, | |
| 226 | bool supervisor); | |
| 227 | size_t	xsave_area_size(uint64_t xstate_bv, bool compact, bool supervisor); | |
| 223 | 228 | #endif |
| 224 | 229 | |
| 225 | 230 | #endif /* !_X86_FPU_H_ */ |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/x86/frame.h+1-2| ... | ... | @@ -31,8 +31,6 @@ |
| 31 | 31 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 32 | 32 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 33 | 33 | * SUCH DAMAGE. |
| 34 | * | |
| 35 | *	from: @(#)frame.h	5.2 (Berkeley) 1/18/91 | |
| 36 | 34 | */ |
| 37 | 35 | |
| 38 | 36 | #ifndef _MACHINE_FRAME_H_ |
| ... | ... | @@ -154,6 +152,7 @@ struct trapframe { |
| 154 | 152 | #define	TF_HASSEGS	0x1 |
| 155 | 153 | #define	TF_HASBASES	0x2 |
| 156 | 154 | #define	TF_HASFPXSTATE	0x4 |
| 155 | #define	TF_RESERV0	0x8 /* no tlsbase in the trapframe */ | |
| 157 | 156 | #endif /* __amd64__ */ |
| 158 | 157 | |
| 159 | 158 | #endif /* _MACHINE_FRAME_H_ */ |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/x86/init.h+2-2| ... | ... | @@ -35,10 +35,10 @@ |
| 35 | 35 | * hypervisor environment. |
| 36 | 36 | */ |
| 37 | 37 | struct init_ops { |
| 38 | 	caddr_t	(*parse_preload_data)(u_int64_t); | |
| 38 | 	void	(*parse_preload_data)(u_int64_t); | |
| 39 | 39 | 	void	(*early_clock_source_init)(void); |
| 40 | 40 | 	void	(*early_delay)(int); |
| 41 | 	void	(*parse_memmap)(caddr_t, vm_paddr_t *, int *); | |
| 41 | 	void	(*parse_memmap)(vm_paddr_t *, int *); | |
| 42 | 42 | }; |
| 43 | 43 | |
| 44 | 44 | extern struct init_ops init_ops; |
lib/libc/include/generic-freebsd/x86/intr_machdep.h+5-8| ... | ... | @@ -62,8 +62,6 @@ extern u_int num_msi_irqs; |
| 62 | 62 | */ |
| 63 | 63 | #define	MSI_INTEL_ADDR_BASE		0xfee00000 |
| 64 | 64 | |
| 65 | #ifndef LOCORE | |
| 66 | ||
| 67 | 65 | typedef void inthand_t(void); |
| 68 | 66 | |
| 69 | 67 | #define	IDTVEC(name)	__CONCAT(X,name) |
| ... | ... | @@ -138,12 +136,12 @@ void	elcr_write_trigger(u_int irq, enum intr_trigger trigger); |
| 138 | 136 | #ifdef SMP |
| 139 | 137 | void	intr_add_cpu(u_int cpu); |
| 140 | 138 | #endif |
| 141 | int	intr_add_handler(const char *name, int vector, driver_filter_t filter, | |
| 142 | driver_intr_t handler, void *arg, enum intr_type flags, void **cookiep, | |
| 143 | int domain); | |
| 144 | int	intr_config_intr(int vector, enum intr_trigger trig, | |
| 139 | int	intr_add_handler(struct intsrc *isrc, const char *name, | |
| 140 | driver_filter_t filter, driver_intr_t handler, void *arg, | |
| 141 | enum intr_type flags, void **cookiep, int domain); | |
| 142 | int	intr_config_intr(struct intsrc *isrc, enum intr_trigger trig, | |
| 145 | 143 | enum intr_polarity pol); |
| 146 | int	intr_describe(u_int vector, void *ih, const char *descr); | |
| 144 | int	intr_describe(struct intsrc *isrc, void *ih, const char *descr); | |
| 147 | 145 | void	intr_execute_handlers(struct intsrc *isrc, struct trapframe *frame); |
| 148 | 146 | u_int	intr_next_cpu(int domain); |
| 149 | 147 | struct intsrc *intr_lookup_source(int vector); |
| ... | ... | @@ -165,6 +163,5 @@ int	msix_release(int irq); |
| 165 | 163 | void	xen_intr_alloc_irqs(void); |
| 166 | 164 | #endif |
| 167 | 165 | |
| 168 | #endif	/* !LOCORE */ | |
| 169 | 166 | #endif	/* _KERNEL */ |
| 170 | 167 | #endif	/* !__X86_INTR_MACHDEP_H__ */ |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/x86/legacyvar.h+7-3| ... | ... | @@ -58,10 +58,14 @@ int	legacy_pcib_write_ivar(device_t dev, device_t child, int which, |
| 58 | 58 | struct resource *legacy_pcib_alloc_resource(device_t dev, device_t child, |
| 59 | 59 | int type, int *rid, rman_res_t start, rman_res_t end, rman_res_t count, |
| 60 | 60 | u_int flags); |
| 61 | int	legacy_pcib_adjust_resource(device_t dev, device_t child, int type, | |
| 61 | int	legacy_pcib_adjust_resource(device_t dev, device_t child, | |
| 62 | 62 | struct resource *r, rman_res_t start, rman_res_t end); |
| 63 | int	legacy_pcib_release_resource(device_t dev, device_t child, int type, | |
| 64 | int rid, struct resource *r); | |
| 63 | int	legacy_pcib_release_resource(device_t dev, device_t child, | |
| 64 | struct resource *r); | |
| 65 | int	legacy_pcib_activate_resource(device_t dev, device_t child, | |
| 66 | struct resource *r); | |
| 67 | int	legacy_pcib_deactivate_resource(device_t dev, device_t child, | |
| 68 | struct resource *r); | |
| 65 | 69 | int	legacy_pcib_alloc_msi(device_t pcib, device_t dev, int count, |
| 66 | 70 | int maxcount, int *irqs); |
| 67 | 71 | int	legacy_pcib_alloc_msix(device_t pcib, device_t dev, int *irq); |
lib/libc/include/generic-freebsd/x86/mca.h+25| ... | ... | @@ -44,6 +44,31 @@ struct mca_record { |
| 44 | 44 | 	int		mr_cpu; |
| 45 | 45 | }; |
| 46 | 46 | |
| 47 | enum mca_stat_types { | |
| 48 | 	MCA_T_NONE = 0, | |
| 49 | 	MCA_T_UNCLASSIFIED, | |
| 50 | 	MCA_T_UCODE_ROM_PARITY, | |
| 51 | 	MCA_T_EXTERNAL, | |
| 52 | 	MCA_T_FRC, | |
| 53 | 	MCA_T_INTERNAL_PARITY, | |
| 54 | 	MCA_T_SMM_HANDLER, | |
| 55 | 	MCA_T_INTERNAL_TIMER, | |
| 56 | 	MCA_T_GENERIC_IO, | |
| 57 | 	MCA_T_INTERNAL, | |
| 58 | 	MCA_T_MEMORY, | |
| 59 | 	MCA_T_TLB, | |
| 60 | 	MCA_T_MEMCONTROLLER_GEN, | |
| 61 | 	MCA_T_MEMCONTROLLER_RD, | |
| 62 | 	MCA_T_MEMCONTROLLER_WR, | |
| 63 | 	MCA_T_MEMCONTROLLER_AC, | |
| 64 | 	MCA_T_MEMCONTROLLER_MS, | |
| 65 | 	MCA_T_MEMCONTROLLER_OTHER, | |
| 66 | 	MCA_T_CACHE, | |
| 67 | 	MCA_T_BUS, | |
| 68 | 	MCA_T_UNKNOWN, | |
| 69 | 	MCA_T_COUNT /* Must stay last */ | |
| 70 | }; | |
| 71 | ||
| 47 | 72 | #ifdef _KERNEL |
| 48 | 73 | |
| 49 | 74 | void	cmc_intr(void); |
lib/libc/include/generic-freebsd/x86/metadata.h+9-3| ... | ... | @@ -34,11 +34,17 @@ |
| 34 | 34 | #define	MODINFOMD_EFI_FB	0x1005 |
| 35 | 35 | #define	MODINFOMD_MODULEP	0x1006 |
| 36 | 36 | #define	MODINFOMD_VBE_FB	0x1007 |
| 37 | #define	MODINFOMD_EFI_ARCH	0x1008 | |
| 37 | 38 | |
| 39 | /* | |
| 40 | * This is not the same as the UEFI standard EFI_MEMORY_ATTRIBUTES_TABLE, though | |
| 41 | * memory_size / descritpr_size entries of EFI_MEMORY_DESCRIPTORS follow this table | |
| 42 | * starting at a 16-byte alignment. | |
| 43 | */ | |
| 38 | 44 | struct efi_map_header { |
| 39 | 	uint64_t	memory_size; | |
| 40 | 	uint64_t	descriptor_size; | |
| 41 | 	uint32_t	descriptor_version; | |
| 45 | 	uint64_t	memory_size;		/* Numnber of bytes that follow */ | |
| 46 | 	uint64_t	descriptor_size;	/* Size of each EFI_MEMORY_DESCRIPTOR */ | |
| 47 | 	uint32_t	descriptor_version;	/* Currently '1' */ | |
| 42 | 48 | }; |
| 43 | 49 | |
| 44 | 50 | struct efi_fb { |
lib/libc/include/generic-freebsd/x86/mptable.h-4| ... | ... | @@ -188,16 +188,12 @@ typedef struct CBASMENTRY { |
| 188 | 188 | |
| 189 | 189 | #ifdef _KERNEL |
| 190 | 190 | struct mptable_hostb_softc { |
| 191 | #ifdef NEW_PCIB | |
| 192 | 191 | 	struct pcib_host_resources sc_host_res; |
| 193 | 192 | 	int		sc_decodes_vga_io; |
| 194 | 193 | 	int		sc_decodes_isa_io; |
| 195 | #endif | |
| 196 | 194 | }; |
| 197 | 195 | |
| 198 | #ifdef NEW_PCIB | |
| 199 | 196 | void	mptable_pci_host_res_init(device_t pcib); |
| 200 | #endif | |
| 201 | 197 | int	mptable_pci_probe_table(int bus); |
| 202 | 198 | int	mptable_pci_route_interrupt(device_t pcib, device_t dev, int pin); |
| 203 | 199 | #endif |
lib/libc/include/generic-freebsd/x86/pci_cfgreg.h+2-5| ... | ... | @@ -58,15 +58,12 @@ extern int cfgmech; |
| 58 | 58 | rman_res_t	hostb_alloc_start(int type, rman_res_t start, rman_res_t end, rman_res_t count); |
| 59 | 59 | int		pcie_cfgregopen(uint64_t base, uint16_t domain, uint8_t minbus, uint8_t maxbus); |
| 60 | 60 | int		pci_cfgregopen(void); |
| 61 | u_int32_t	pci_cfgregread_domain(int domain, int bus, int slot, int func, int reg, int bytes); | |
| 62 | void		pci_cfgregwrite_domain(int domain, int bus, int slot, int func, int reg, u_int32_t data, int bytes); | |
| 61 | u_int32_t	pci_cfgregread(int domain, int bus, int slot, int func, int reg, int bytes); | |
| 62 | void		pci_cfgregwrite(int domain, int bus, int slot, int func, int reg, u_int32_t data, int bytes); | |
| 63 | 63 | #ifdef __HAVE_PIR |
| 64 | 64 | void		pci_pir_open(void); |
| 65 | 65 | int		pci_pir_probe(int bus, int require_parse); |
| 66 | 66 | int		pci_pir_route_interrupt(int bus, int device, int func, int pin); |
| 67 | 67 | #endif |
| 68 | 68 | |
| 69 | #define	pci_cfgregread		pci_cfgregread_domain | |
| 70 | #define	pci_cfgregwrite		pci_cfgregwrite_domain | |
| 71 | ||
| 72 | 69 | #endif /* !__X86_PCI_CFGREG_H__ */ |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/x86/psl.h-2| ... | ... | @@ -30,8 +30,6 @@ |
| 30 | 30 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 31 | 31 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 32 | 32 | * SUCH DAMAGE. |
| 33 | * | |
| 34 | *	from: @(#)psl.h	5.2 (Berkeley) 1/18/91 | |
| 35 | 33 | */ |
| 36 | 34 | |
| 37 | 35 | #ifndef _MACHINE_PSL_H_ |
lib/libc/include/generic-freebsd/x86/ptrace.h+2-2| ... | ... | @@ -27,8 +27,6 @@ |
| 27 | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | * | |
| 31 | *	@(#)ptrace.h	8.1 (Berkeley) 6/11/93 | |
| 32 | 30 | */ |
| 33 | 31 | |
| 34 | 32 | #ifndef _MACHINE_PTRACE_H_ |
| ... | ... | @@ -56,6 +54,8 @@ |
| 56 | 54 | #define	PT_SETFSBASE	(PT_FIRSTMACH + 8) |
| 57 | 55 | #define	PT_GETGSBASE	(PT_FIRSTMACH + 9) |
| 58 | 56 | #define	PT_SETGSBASE	(PT_FIRSTMACH + 10) |
| 57 | #define	PT_GETTLSBASE	(PT_FIRSTMACH + 11) | |
| 58 | #define	PT_SETTLSBASE	(PT_FIRSTMACH + 12) | |
| 59 | 59 | |
| 60 | 60 | /* Argument structure for PT_GETXSTATE_INFO. */ |
| 61 | 61 | struct ptrace_xstate_info { |
lib/libc/include/generic-freebsd/x86/reg.h-2| ... | ... | @@ -31,8 +31,6 @@ |
| 31 | 31 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 32 | 32 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 33 | 33 | * SUCH DAMAGE. |
| 34 | * | |
| 35 | *	from: @(#)reg.h	5.5 (Berkeley) 1/18/91 | |
| 36 | 34 | */ |
| 37 | 35 | |
| 38 | 36 | #ifndef _MACHINE_REG_H_ |
lib/libc/include/generic-freebsd/x86/segments.h-2| ... | ... | @@ -31,8 +31,6 @@ |
| 31 | 31 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 32 | 32 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 33 | 33 | * SUCH DAMAGE. |
| 34 | * | |
| 35 | *	from: @(#)segments.h	7.1 (Berkeley) 5/9/91 | |
| 36 | 34 | */ |
| 37 | 35 | |
| 38 | 36 | #ifndef _X86_SEGMENTS_H_ |
lib/libc/include/generic-freebsd/x86/signal.h-2| ... | ... | @@ -28,8 +28,6 @@ |
| 28 | 28 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 29 | 29 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 30 | 30 | * SUCH DAMAGE. |
| 31 | * | |
| 32 | *	@(#)signal.h	8.1 (Berkeley) 6/11/93 | |
| 33 | 31 | */ |
| 34 | 32 | |
| 35 | 33 | #ifndef _X86_SIGNAL_H |
lib/libc/include/generic-freebsd/x86/specialreg.h+20-5| ... | ... | @@ -27,8 +27,6 @@ |
| 27 | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | * | |
| 31 | *	from: @(#)specialreg.h	7.1 (Berkeley) 5/9/91 | |
| 32 | 30 | */ |
| 33 | 31 | |
| 34 | 32 | #ifndef _MACHINE_SPECIALREG_H_ |
| ... | ... | @@ -125,6 +123,7 @@ |
| 125 | 123 | #define	XFEATURE_ENABLED_OPMASK		0x00000020 |
| 126 | 124 | #define	XFEATURE_ENABLED_ZMM_HI256	0x00000040 |
| 127 | 125 | #define	XFEATURE_ENABLED_HI16_ZMM	0x00000080 |
| 126 | #define	XFEATURE_ENABLED_PT		0x00000100 | |
| 128 | 127 | #define	XFEATURE_ENABLED_PKRU		0x00000200 |
| 129 | 128 | #define	XFEATURE_ENABLED_TILECONFIG	0x00020000 |
| 130 | 129 | #define	XFEATURE_ENABLED_TILEDATA	0x00040000 |
| ... | ... | @@ -215,6 +214,7 @@ |
| 215 | 214 | #define	CPUPT_MTC		(1 << 3)	/* MTC Supported */ |
| 216 | 215 | #define	CPUPT_PRW		(1 << 4)	/* PTWRITE Supported */ |
| 217 | 216 | #define	CPUPT_PWR		(1 << 5)	/* Power Event Trace Supported */ |
| 217 | #define	CPUPT_DIS_TNT		(1 << 8)	/* TNT disable supported */ | |
| 218 | 218 | |
| 219 | 219 | /* Leaf 0 ecx. */ |
| 220 | 220 | #define	CPUPT_TOPA		(1 << 0)	/* ToPA Output Supported */ |
| ... | ... | @@ -388,6 +388,14 @@ |
| 388 | 388 | #define	CPUID_EXTSTATE_XINUSE	0x00000004 |
| 389 | 389 | #define	CPUID_EXTSTATE_XSAVES	0x00000008 |
| 390 | 390 | |
| 391 | /* | |
| 392 | * CPUID instruction 0xd Processor Extended State Enumeration | |
| 393 | * Sub-leaf > 1 ecx info | |
| 394 | */ | |
| 395 | #define	CPUID_EXTSTATE_SUPERVISOR	0x00000001 | |
| 396 | #define	CPUID_EXTSTATE_ALIGNED		0x00000002 | |
| 397 | #define	CPUID_EXTSTATE_XFD_SUPPORTED	0x00000004 | |
| 398 | ||
| 391 | 399 | /* |
| 392 | 400 | * AMD extended function 8000_0007h ebx info |
| 393 | 401 | */ |
| ... | ... | @@ -648,6 +656,12 @@ |
| 648 | 656 | #define	MSR_PAT			0x277 |
| 649 | 657 | #define	MSR_MC0_CTL2		0x280 |
| 650 | 658 | #define	MSR_MTRRdefType		0x2ff |
| 659 | #define	MSR_IA_GLOBAL_STATUS 0x38E | |
| 660 | #define	MSR_IA_GLOBAL_CTRL 0x38F | |
| 661 | #define	MSR_IA_GLOBAL_OVF_CTRL 0x390 | |
| 662 | #define	MSR_IA_GLOBAL_STATUS_RESET	0x390 | |
| 663 | #define	MSR_IA_GLOBAL_STATUS_SET	0x391 | |
| 664 | #define	 GLOBAL_STATUS_FLAG_TRACETOPAPMI	(1ULL << 55) | |
| 651 | 665 | #define	MSR_MC0_CTL		0x400 |
| 652 | 666 | #define	MSR_MC0_STATUS		0x401 |
| 653 | 667 | #define	MSR_MC0_ADDR		0x402 |
| ... | ... | @@ -775,6 +789,7 @@ |
| 775 | 789 | #define	 RTIT_CTL_ADDR2_CFG_M	(0xfULL << RTIT_CTL_ADDR2_CFG_S) |
| 776 | 790 | #define	 RTIT_CTL_ADDR3_CFG_S	44 |
| 777 | 791 | #define	 RTIT_CTL_ADDR3_CFG_M	(0xfULL << RTIT_CTL_ADDR3_CFG_S) |
| 792 | #define	RTIT_CTL_DIS_TNT	(1ULL << 55) | |
| 778 | 793 | #define	MSR_IA32_RTIT_STATUS		0x571	/* Tracing Status Register (R/W) */ |
| 779 | 794 | #define	 RTIT_STATUS_FILTEREN	(1 << 0) |
| 780 | 795 | #define	 RTIT_STATUS_CONTEXTEN	(1 << 1) |
| ... | ... | @@ -991,7 +1006,7 @@ |
| 991 | 1006 | |
| 992 | 1007 | #define	CCR4			0xe8 |
| 993 | 1008 | #define	CCR4_IOMASK		0x07 |
| 994 | #define	CCR4_MEM		0x08	/* Enables momory bypassing */ | |
| 1009 | #define	CCR4_MEM		0x08	/* Enables memory bypassing */ | |
| 995 | 1010 | #define	CCR4_DTE		0x10	/* Enables directory table entry cache */ |
| 996 | 1011 | #define	CCR4_FASTFPE	0x20	/* Fast FPU exception */ |
| 997 | 1012 | #define	CCR4_CPUID		0x80	/* Enables CPUID instruction */ |
| ... | ... | @@ -1011,7 +1026,7 @@ |
| 1011 | 1026 | #define	PCR0_RSTK		0x01	/* Enables return stack */ |
| 1012 | 1027 | #define	PCR0_BTB		0x02	/* Enables branch target buffer */ |
| 1013 | 1028 | #define	PCR0_LOOP		0x04	/* Enables loop */ |
| 1014 | #define	PCR0_AIS		0x08	/* Enables all instrcutions stalled to | |
| 1029 | #define	PCR0_AIS		0x08	/* Enables all instructions stalled to | |
| 1015 | 1030 | 								 serialize pipe. */ |
| 1016 | 1031 | #define	PCR0_MLR		0x10	/* Enables reordering of misaligned loads */ |
| 1017 | 1032 | #define	PCR0_BTBRT		0x40	/* Enables BTB test register. */ |
| ... | ... | @@ -1165,7 +1180,7 @@ |
| 1165 | 1180 | |
| 1166 | 1181 | /* |
| 1167 | 1182 | * The region control registers specify the attributes associated with |
| 1168 | * the ARRx addres regions. | |
| 1183 | * the ARRx address regions. | |
| 1169 | 1184 | */ |
| 1170 | 1185 | #define	RCR0	0xdc |
| 1171 | 1186 | #define	RCR1	0xdd |
lib/libc/include/generic-freebsd/x86/sysarch.h+4| ... | ... | @@ -61,6 +61,9 @@ |
| 61 | 61 | #define	AMD64_GET_XFPUSTATE	132 |
| 62 | 62 | #define	AMD64_SET_PKRU		133 |
| 63 | 63 | #define	AMD64_CLEAR_PKRU	134 |
| 64 | #define	AMD64_GET_TLSBASE	135 | |
| 65 | #define	AMD64_SET_TLSBASE	136 | |
| 66 | #define	AMD64_DISABLE_TLSBASE	137 | |
| 64 | 67 | |
| 65 | 68 | /* Flags for AMD64_SET_PKRU */ |
| 66 | 69 | #define	AMD64_PKRU_EXCL		0x0001 |
| ... | ... | @@ -140,6 +143,7 @@ int amd64_get_fsbase(void **); |
| 140 | 143 | int amd64_get_gsbase(void **); |
| 141 | 144 | int amd64_set_fsbase(void *); |
| 142 | 145 | int amd64_set_gsbase(void *); |
| 146 | int amd64_set_tlsbase(void *); | |
| 143 | 147 | int x86_pkru_get_perm(unsigned int keyidx, int *access, int *modify); |
| 144 | 148 | int x86_pkru_set_perm(unsigned int keyidx, int access, int modify); |
| 145 | 149 | int x86_pkru_protect_range(void *addr, unsigned long len, unsigned int keyidx, |
lib/libc/include/generic-freebsd/x86/tls.h+12-2| ... | ... | @@ -36,13 +36,23 @@ |
| 36 | 36 | |
| 37 | 37 | struct pthread; |
| 38 | 38 | |
| 39 | struct dtv_slot { | |
| 40 | 	char			*dtvs_tls; | |
| 41 | }; | |
| 42 | ||
| 43 | struct dtv { | |
| 44 | 	uintptr_t		dtv_gen; | |
| 45 | 	uintptr_t		dtv_size; | |
| 46 | 	struct dtv_slot		dtv_slots[]; | |
| 47 | }; | |
| 48 | ||
| 39 | 49 | /* |
| 40 | 50 | * Variant II tcb, first two members are required by rtld, |
| 41 | 51 | * %fs (amd64) / %gs (i386) points to the structure. |
| 42 | 52 | */ |
| 43 | 53 | struct tcb { |
| 44 | 54 | 	struct tcb		*tcb_self;	/* required by rtld */ |
| 45 | 	uintptr_t		*tcb_dtv;	/* required by rtld */ | |
| 55 | 	struct dtv		*tcb_dtv;	/* required by rtld */ | |
| 46 | 56 | 	struct pthread		*tcb_thread; |
| 47 | 57 | }; |
| 48 | 58 | |
| ... | ... | @@ -59,7 +69,7 @@ static __inline void |
| 59 | 69 | _tcb_set(struct tcb *tcb) |
| 60 | 70 | { |
| 61 | 71 | #ifdef __amd64__ |
| 62 | 	amd64_set_fsbase(tcb); | |
| 72 | 	amd64_set_tlsbase(tcb); | |
| 63 | 73 | #else |
| 64 | 74 | 	i386_set_gsbase(tcb); |
| 65 | 75 | #endif |
lib/libc/include/generic-freebsd/x86/trap.h-2| ... | ... | @@ -30,8 +30,6 @@ |
| 30 | 30 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 31 | 31 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 32 | 32 | * SUCH DAMAGE. |
| 33 | * | |
| 34 | *	from: @(#)trap.h	5.4 (Berkeley) 5/9/91 | |
| 35 | 33 | */ |
| 36 | 34 | |
| 37 | 35 | #ifndef _MACHINE_TRAP_H_ |
lib/libc/include/generic-freebsd/x86/ucode.h+14-1| ... | ... | @@ -31,6 +31,12 @@ |
| 31 | 31 | #ifndef _MACHINE_UCODE_H_ |
| 32 | 32 | #define	_MACHINE_UCODE_H_ |
| 33 | 33 | |
| 34 | #ifdef _KERNEL | |
| 35 | #include <sys/types.h> | |
| 36 | #else | |
| 37 | #include <stdbool.h> | |
| 38 | #endif | |
| 39 | ||
| 34 | 40 | struct ucode_intel_header { |
| 35 | 41 | 	uint32_t	header_version; |
| 36 | 42 | 	int32_t		update_revision; |
| ... | ... | @@ -56,7 +62,14 @@ struct ucode_intel_extsig_table { |
| 56 | 62 | 	} entries[0]; |
| 57 | 63 | }; |
| 58 | 64 | |
| 59 | int	ucode_intel_load(void *data, bool unsafe, | |
| 65 | typedef enum { SAFE, UNSAFE, EARLY } ucode_load_how; | |
| 66 | ||
| 67 | const void *ucode_amd_find(const char *path, uint32_t signature, | |
| 68 | 	 uint32_t *revision, const uint8_t *fw_data, size_t fw_size, | |
| 69 | 	 size_t *selected_sizep); | |
| 70 | int	ucode_intel_load(const void *data, ucode_load_how unsafe, | |
| 71 | 	 uint64_t *nrevp, uint64_t *orevp); | |
| 72 | int	ucode_amd_load(const void *data, ucode_load_how how, | |
| 60 | 73 | 	 uint64_t *nrevp, uint64_t *orevp); |
| 61 | 74 | size_t	ucode_load_bsp(uintptr_t free); |
| 62 | 75 | void	ucode_load_ap(int cpu); |
lib/libc/include/generic-freebsd/x86/ucontext.h+6-2| ... | ... | @@ -99,7 +99,9 @@ typedef struct __mcontext { |
| 99 | 99 | #define	_MC_HASSEGS	0x1 |
| 100 | 100 | #define	_MC_HASBASES	0x2 |
| 101 | 101 | #define	_MC_HASFPXSTATE	0x4 |
| 102 | #define	_MC_FLAG_MASK	(_MC_HASSEGS | _MC_HASBASES | _MC_HASFPXSTATE) | |
| 102 | #define	_MC_HASTLSBASE	0x8 | |
| 103 | #define	_MC_FLAG_MASK	(_MC_HASSEGS | _MC_HASBASES | _MC_HASFPXSTATE | \ | |
| 104 | _MC_HASTLSBASE) | |
| 103 | 105 | |
| 104 | 106 | typedef struct __mcontext { |
| 105 | 107 | 	/* |
| ... | ... | @@ -158,7 +160,9 @@ typedef struct __mcontext { |
| 158 | 160 | 	__register_t	mc_xfpustate; |
| 159 | 161 | 	__register_t	mc_xfpustate_len; |
| 160 | 162 | |
| 161 | 	long	mc_spare[4]; | |
| 163 | 	__register_t	mc_tlsbase; | |
| 164 | ||
| 165 | 	long	mc_spare[3]; | |
| 162 | 166 | } mcontext_t; |
| 163 | 167 | #endif /* __amd64__ */ |
| 164 | 168 |
lib/libc/include/generic-freebsd/x86/vmware.h+6-2| ... | ... | @@ -31,19 +31,23 @@ |
| 31 | 31 | #define	VMW_HVPORT		0x5658 |
| 32 | 32 | |
| 33 | 33 | #define	VMW_HVCMD_GETVERSION	10 |
| 34 | #define	VMW_HVCMD_GUESTRPC	30 | |
| 34 | 35 | #define	VMW_HVCMD_GETHZ		45 |
| 35 | 36 | #define	VMW_HVCMD_GETVCPU_INFO	68 |
| 36 | 37 | |
| 38 | #define	VMW_HVCMD_DEFAULT_PARAM	UINT_MAX | |
| 39 | ||
| 37 | 40 | #define	VMW_VCPUINFO_LEGACY_X2APIC	(1 << 3) |
| 38 | 41 | #define	VMW_VCPUINFO_VCPU_RESERVED	(1 << 31) |
| 39 | 42 | |
| 40 | 43 | static __inline void |
| 41 | vmware_hvcall(u_int cmd, u_int *p) | |
| 44 | vmware_hvcall(int chan, u_int cmd, u_int param, u_int *p) | |
| 42 | 45 | { |
| 43 | 46 | |
| 44 | 47 | 	__asm __volatile("inl %w3, %0" |
| 45 | 48 | 	: "=a" (p[0]), "=b" (p[1]), "=c" (p[2]), "=d" (p[3]) |
| 46 | 	: "0" (VMW_HVMAGIC), "1" (UINT_MAX), "2" (cmd), "3" (VMW_HVPORT) | |
| 49 | 	: "0" (VMW_HVMAGIC), "1" (param), "2" (cmd), | |
| 50 | 	 "3" (VMW_HVPORT | (chan << 16)) | |
| 47 | 51 | 	: "memory"); |
| 48 | 52 | } |
| 49 | 53 |
lib/libc/include/generic-freebsd/x86/vmware_guestrpc.h created+37| ... | ... | @@ -0,0 +1,37 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-2-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 2015-2024, Juniper Networks, Inc. | |
| 5 | * | |
| 6 | * Redistribution and use in source and binary forms, with or without | |
| 7 | * modification, are permitted provided that the following conditions | |
| 8 | * are met: | |
| 9 | * 1. Redistributions of source code must retain the above copyright | |
| 10 | * notice, this list of conditions and the following disclaimer. | |
| 11 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 12 | * notice, this list of conditions and the following disclaimer in the | |
| 13 | * documentation and/or other materials provided with the distribution. | |
| 14 | * | |
| 15 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |
| 16 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 17 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
| 18 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | |
| 19 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
| 20 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
| 21 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
| 22 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
| 23 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
| 24 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
| 25 | * SUCH DAMAGE. | |
| 26 | */ | |
| 27 | ||
| 28 | #ifndef _X86_VMWARE_GUESTRPC_H_ | |
| 29 | #define _X86_VMWARE_GUESTRPC_H_ | |
| 30 | ||
| 31 | struct sbuf; | |
| 32 | ||
| 33 | int	vmware_guestrpc_cmd(struct sbuf *sbufp); | |
| 34 | int	vmware_guestrpc_set_guestinfo(const char *keyword, const char *val); | |
| 35 | int	vmware_guestrpc_get_guestinfo(const char *keyword, struct sbuf *sbufp); | |
| 36 | ||
| 37 | #endif /* _X86_VMWARE_GUESTRPC_H_ */ | |
| \ No newline at end of file |
lib/libc/include/generic-freebsd/x86/x86_ieeefp.h-2| ... | ... | @@ -32,8 +32,6 @@ |
| 32 | 32 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 33 | 33 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 34 | 34 | * SUCH DAMAGE. |
| 35 | * | |
| 36 | * 	from: @(#) ieeefp.h 	1.0 (Berkeley) 9/23/93 | |
| 37 | 35 | */ |
| 38 | 36 | |
| 39 | 37 | #ifndef _X86_X86_IEEEFP_H_ |
lib/libc/include/generic-freebsd/x86/x86_var.h+5-1| ... | ... | @@ -50,6 +50,7 @@ extern	u_int	cpu_clflush_line_size; |
| 50 | 50 | extern	u_int	cpu_stdext_feature; |
| 51 | 51 | extern	u_int	cpu_stdext_feature2; |
| 52 | 52 | extern	u_int	cpu_stdext_feature3; |
| 53 | extern	u_int	cpu_stdext_feature4; | |
| 53 | 54 | extern	uint64_t cpu_ia32_arch_caps; |
| 54 | 55 | extern	u_int	cpu_high; |
| 55 | 56 | extern	u_int	cpu_id; |
| ... | ... | @@ -62,6 +63,7 @@ extern	char	cpu_vendor[]; |
| 62 | 63 | extern	char	cpu_model[]; |
| 63 | 64 | extern	u_int	cpu_vendor_id; |
| 64 | 65 | extern	u_int	cpu_mon_mwait_flags; |
| 66 | extern	u_int	cpu_mon_mwait_edx; | |
| 65 | 67 | extern	u_int	cpu_mon_min_size; |
| 66 | 68 | extern	u_int	cpu_mon_max_size; |
| 67 | 69 | extern	u_int	cpu_maxphyaddr; |
| ... | ... | @@ -147,7 +149,9 @@ void	zenbleed_sanitize_enable(void); |
| 147 | 149 | void	zenbleed_check_and_apply(bool all_cpus); |
| 148 | 150 | void	nmi_call_kdb(u_int cpu, u_int type, struct trapframe *frame); |
| 149 | 151 | void	nmi_call_kdb_smp(u_int type, struct trapframe *frame); |
| 150 | void	nmi_handle_intr(u_int type, struct trapframe *frame); | |
| 152 | void	nmi_register_handler(int (*handler)(struct trapframe *)); | |
| 153 | void	nmi_remove_handler(int (*handler)(struct trapframe *)); | |
| 154 | void	nmi_handle_intr(struct trapframe *frame); | |
| 151 | 155 | void	pagecopy(void *from, void *to); |
| 152 | 156 | void	printcpuinfo(void); |
| 153 | 157 | int	pti_get_default(void); |
lib/libc/include/powerpc-freebsd-eabihf/machine/sigframe.h deleted-39| ... | ... | @@ -1,39 +0,0 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-3-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 1999 Marcel Moolenaar | |
| 5 | * All rights reserved. | |
| 6 | * | |
| 7 | * Redistribution and use in source and binary forms, with or without | |
| 8 | * modification, are permitted provided that the following conditions | |
| 9 | * are met: | |
| 10 | * 1. Redistributions of source code must retain the above copyright | |
| 11 | * notice, this list of conditions and the following disclaimer | |
| 12 | * in this position and unchanged. | |
| 13 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 14 | * notice, this list of conditions and the following disclaimer in the | |
| 15 | * documentation and/or other materials provided with the distribution. | |
| 16 | * 3. The name of the author may not be used to endorse or promote products | |
| 17 | * derived from this software without specific prior written permission. | |
| 18 | * | |
| 19 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | |
| 20 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |
| 21 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | |
| 22 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | |
| 23 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | |
| 24 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
| 25 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
| 26 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
| 27 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | |
| 28 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 29 | */ | |
| 30 | ||
| 31 | #ifndef _MACHINE_SIGFRAME_H_ | |
| 32 | #define _MACHINE_SIGFRAME_H_ 1 | |
| 33 | ||
| 34 | struct sigframe { | |
| 35 | 	ucontext_t	sf_uc; | |
| 36 | 	siginfo_t	sf_si; | |
| 37 | }; | |
| 38 | ||
| 39 | #endif /* _MACHINE_SIGFRAME_H_ */ | |
| \ No newline at end of file |
lib/libc/include/powerpc64-freebsd-none/dev/powermac_nvram/powermac_nvramvar.h created+82| ... | ... | @@ -0,0 +1,82 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-2-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 2006 Maxim Sobolev <sobomax@FreeBSD.org> | |
| 5 | * All rights reserved. | |
| 6 | * | |
| 7 | * Redistribution and use in source and binary forms, with or without | |
| 8 | * modification, are permitted provided that the following conditions | |
| 9 | * are met: | |
| 10 | * 1. Redistributions of source code must retain the above copyright | |
| 11 | * notice, this list of conditions and the following disclaimer. | |
| 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 13 | * notice, this list of conditions and the following disclaimer in the | |
| 14 | * documentation and/or other materials provided with the distribution. | |
| 15 | * | |
| 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | |
| 17 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | |
| 18 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |
| 19 | * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, | |
| 20 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | |
| 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | |
| 22 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
| 23 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | |
| 24 | * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN | |
| 25 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
| 26 | * POSSIBILITY OF SUCH DAMAGE. | |
| 27 | */ | |
| 28 | ||
| 29 | #ifndef	_POWERPC_POWERMAC_POWERMAC_NVRAMVAR_H_ | |
| 30 | #define	_POWERPC_POWERMAC_POWERMAC_NVRAMVAR_H_ | |
| 31 | ||
| 32 | #define	NVRAM_SIZE		0x2000 | |
| 33 | ||
| 34 | #define	CORE99_SIGNATURE	0x5a | |
| 35 | ||
| 36 | #define SM_FLASH_CMD_ERASE_CONFIRM	0xd0 | |
| 37 | #define SM_FLASH_CMD_ERASE_SETUP	0x20 | |
| 38 | #define SM_FLASH_CMD_RESET		0xff | |
| 39 | #define SM_FLASH_CMD_WRITE_SETUP	0x40 | |
| 40 | #define SM_FLASH_CMD_CLEAR_STATUS	0x50 | |
| 41 | #define SM_FLASH_CMD_READ_STATUS	0x70 | |
| 42 | ||
| 43 | #define SM_FLASH_STATUS_DONE	0x80 | |
| 44 | #define SM_FLASH_STATUS_ERR	0x38 | |
| 45 | ||
| 46 | #ifdef _KERNEL | |
| 47 | ||
| 48 | struct powermac_nvram_softc { | |
| 49 | 	device_t		sc_dev; | |
| 50 | 	struct sx		sc_lock; | |
| 51 | 	phandle_t		sc_node; | |
| 52 | 	void *			sc_bank; | |
| 53 | 	void *			sc_bank0; | |
| 54 | 	void *			sc_bank1; | |
| 55 | 	uint8_t			sc_data[NVRAM_SIZE]; | |
| 56 | ||
| 57 | 	struct cdev *		sc_cdev; | |
| 58 | 	int			sc_type; | |
| 59 | #define FLASH_TYPE_SM	0 | |
| 60 | #define FLASH_TYPE_AMD	1 | |
| 61 | 	int			sc_isopen; | |
| 62 | 	int			sc_rpos; | |
| 63 | 	int			sc_wpos; | |
| 64 | }; | |
| 65 | ||
| 66 | #endif /* _KERNEL */ | |
| 67 | ||
| 68 | struct chrp_header { | |
| 69 | 	uint8_t			signature; | |
| 70 | 	uint8_t			chrp_checksum; | |
| 71 | 	uint16_t		length; | |
| 72 | 	char			name[12]; | |
| 73 | }; | |
| 74 | ||
| 75 | struct core99_header { | |
| 76 | 	struct chrp_header	chrp_header; | |
| 77 | 	uint32_t		adler_checksum; | |
| 78 | 	uint32_t		generation; | |
| 79 | 	uint32_t		reserved[2]; | |
| 80 | }; | |
| 81 | ||
| 82 | #endif /* _POWERPC_POWERMAC_POWERMAC_NVRAMVAR_H_ */ | |
| \ No newline at end of file |
lib/libc/include/powerpc64-freebsd-none/fenv.h created+305| ... | ... | @@ -0,0 +1,305 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-2-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 2004-2005 David Schultz <das@FreeBSD.ORG> | |
| 5 | * All rights reserved. | |
| 6 | * | |
| 7 | * Redistribution and use in source and binary forms, with or without | |
| 8 | * modification, are permitted provided that the following conditions | |
| 9 | * are met: | |
| 10 | * 1. Redistributions of source code must retain the above copyright | |
| 11 | * notice, this list of conditions and the following disclaimer. | |
| 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 13 | * notice, this list of conditions and the following disclaimer in the | |
| 14 | * documentation and/or other materials provided with the distribution. | |
| 15 | * | |
| 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |
| 17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
| 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | |
| 20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
| 21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
| 22 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
| 23 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
| 24 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
| 25 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
| 26 | * SUCH DAMAGE. | |
| 27 | */ | |
| 28 | ||
| 29 | #ifndef	_FENV_H_ | |
| 30 | #define	_FENV_H_ | |
| 31 | ||
| 32 | #include <sys/_types.h> | |
| 33 | #include <machine/endian.h> | |
| 34 | ||
| 35 | #ifndef	__fenv_static | |
| 36 | #define	__fenv_static	static | |
| 37 | #endif | |
| 38 | ||
| 39 | typedef	__uint32_t	fenv_t; | |
| 40 | typedef	__uint32_t	fexcept_t; | |
| 41 | ||
| 42 | /* Exception flags */ | |
| 43 | #ifdef __SPE__ | |
| 44 | #define FE_OVERFLOW	0x00000100 | |
| 45 | #define FE_UNDERFLOW	0x00000200 | |
| 46 | #define FE_DIVBYZERO	0x00000400 | |
| 47 | #define FE_INVALID	0x00000800 | |
| 48 | #define FE_INEXACT	0x00001000 | |
| 49 | ||
| 50 | #define	FE_ALL_INVALID	FE_INVALID | |
| 51 | ||
| 52 | #define	_FPUSW_SHIFT	6 | |
| 53 | #else | |
| 54 | #define	FE_INEXACT	0x02000000 | |
| 55 | #define	FE_DIVBYZERO	0x04000000 | |
| 56 | #define	FE_UNDERFLOW	0x08000000 | |
| 57 | #define	FE_OVERFLOW	0x10000000 | |
| 58 | #define	FE_INVALID	0x20000000	/* all types of invalid FP ops */ | |
| 59 | ||
| 60 | /* | |
| 61 | * The PowerPC architecture has extra invalid flags that indicate the | |
| 62 | * specific type of invalid operation occurred. These flags may be | |
| 63 | * tested, set, and cleared---but not masked---separately. All of | |
| 64 | * these bits are cleared when FE_INVALID is cleared, but only | |
| 65 | * FE_VXSOFT is set when FE_INVALID is explicitly set in software. | |
| 66 | */ | |
| 67 | #define	FE_VXCVI	0x00000100	/* invalid integer convert */ | |
| 68 | #define	FE_VXSQRT	0x00000200	/* square root of a negative */ | |
| 69 | #define	FE_VXSOFT	0x00000400	/* software-requested exception */ | |
| 70 | #define	FE_VXVC		0x00080000	/* ordered comparison involving NaN */ | |
| 71 | #define	FE_VXIMZ	0x00100000	/* inf * 0 */ | |
| 72 | #define	FE_VXZDZ	0x00200000	/* 0 / 0 */ | |
| 73 | #define	FE_VXIDI	0x00400000	/* inf / inf */ | |
| 74 | #define	FE_VXISI	0x00800000	/* inf - inf */ | |
| 75 | #define	FE_VXSNAN	0x01000000	/* operation on a signalling NaN */ | |
| 76 | #define	FE_ALL_INVALID	(FE_VXCVI | FE_VXSQRT | FE_VXSOFT | FE_VXVC | \ | |
| 77 | 			 FE_VXIMZ | FE_VXZDZ | FE_VXIDI | FE_VXISI | \ | |
| 78 | 			 FE_VXSNAN | FE_INVALID) | |
| 79 | ||
| 80 | #define	_FPUSW_SHIFT	22 | |
| 81 | #endif | |
| 82 | #define	FE_ALL_EXCEPT	(FE_DIVBYZERO | FE_INEXACT | \ | |
| 83 | 			 FE_ALL_INVALID | FE_OVERFLOW | FE_UNDERFLOW) | |
| 84 | ||
| 85 | /* Rounding modes */ | |
| 86 | #define	FE_TONEAREST	0x0000 | |
| 87 | #define	FE_TOWARDZERO	0x0001 | |
| 88 | #define	FE_UPWARD	0x0002 | |
| 89 | #define	FE_DOWNWARD	0x0003 | |
| 90 | #define	_ROUND_MASK	(FE_TONEAREST | FE_DOWNWARD | \ | |
| 91 | 			 FE_UPWARD | FE_TOWARDZERO) | |
| 92 | ||
| 93 | __BEGIN_DECLS | |
| 94 | ||
| 95 | /* Default floating-point environment */ | |
| 96 | extern const fenv_t	__fe_dfl_env; | |
| 97 | #define	FE_DFL_ENV	(&__fe_dfl_env) | |
| 98 | ||
| 99 | /* We need to be able to map status flag positions to mask flag positions */ | |
| 100 | #define	_ENABLE_MASK	((FE_DIVBYZERO | FE_INEXACT | FE_INVALID | \ | |
| 101 | 			 FE_OVERFLOW | FE_UNDERFLOW) >> _FPUSW_SHIFT) | |
| 102 | ||
| 103 | #ifndef _SOFT_FLOAT | |
| 104 | #ifdef __SPE__ | |
| 105 | #define	__mffs(__env) \ | |
| 106 | 	__asm __volatile("mfspr %0, 512" : "=r" ((__env)->__bits.__reg)) | |
| 107 | #define	__mtfsf(__env) \ | |
| 108 | 	__asm __volatile("mtspr 512,%0;isync" :: "r" ((__env).__bits.__reg)) | |
| 109 | #else | |
| 110 | #define	__mffs(__env) \ | |
| 111 | 	__asm __volatile("mffs %0" : "=f" ((__env)->__d)) | |
| 112 | #define	__mtfsf(__env) \ | |
| 113 | 	__asm __volatile("mtfsf 255,%0" :: "f" ((__env).__d)) | |
| 114 | #endif | |
| 115 | #else | |
| 116 | #define	__mffs(__env) | |
| 117 | #define	__mtfsf(__env) | |
| 118 | #endif | |
| 119 | ||
| 120 | union __fpscr { | |
| 121 | 	double __d; | |
| 122 | 	struct { | |
| 123 | #if _BYTE_ORDER == _LITTLE_ENDIAN | |
| 124 | 		fenv_t __reg; | |
| 125 | 		__uint32_t __junk; | |
| 126 | #else | |
| 127 | 		__uint32_t __junk; | |
| 128 | 		fenv_t __reg; | |
| 129 | #endif | |
| 130 | 	} __bits; | |
| 131 | }; | |
| 132 | ||
| 133 | __fenv_static inline int | |
| 134 | feclearexcept(int __excepts) | |
| 135 | { | |
| 136 | 	union __fpscr __r; | |
| 137 | ||
| 138 | 	if (__excepts & FE_INVALID) | |
| 139 | 		__excepts |= FE_ALL_INVALID; | |
| 140 | 	__mffs(&__r); | |
| 141 | 	__r.__bits.__reg &= ~__excepts; | |
| 142 | 	__mtfsf(__r); | |
| 143 | 	return (0); | |
| 144 | } | |
| 145 | ||
| 146 | __fenv_static inline int | |
| 147 | fegetexceptflag(fexcept_t *__flagp, int __excepts) | |
| 148 | { | |
| 149 | 	union __fpscr __r; | |
| 150 | ||
| 151 | 	__mffs(&__r); | |
| 152 | 	*__flagp = __r.__bits.__reg & __excepts; | |
| 153 | 	return (0); | |
| 154 | } | |
| 155 | ||
| 156 | __fenv_static inline int | |
| 157 | fesetexceptflag(const fexcept_t *__flagp, int __excepts) | |
| 158 | { | |
| 159 | 	union __fpscr __r; | |
| 160 | ||
| 161 | 	if (__excepts & FE_INVALID) | |
| 162 | 		__excepts |= FE_ALL_INVALID; | |
| 163 | 	__mffs(&__r); | |
| 164 | 	__r.__bits.__reg &= ~__excepts; | |
| 165 | 	__r.__bits.__reg |= *__flagp & __excepts; | |
| 166 | 	__mtfsf(__r); | |
| 167 | 	return (0); | |
| 168 | } | |
| 169 | ||
| 170 | #ifdef __SPE__ | |
| 171 | extern int	feraiseexcept(int __excepts); | |
| 172 | #else | |
| 173 | __fenv_static inline int | |
| 174 | feraiseexcept(int __excepts) | |
| 175 | { | |
| 176 | 	union __fpscr __r; | |
| 177 | ||
| 178 | 	if (__excepts & FE_INVALID) | |
| 179 | 		__excepts |= FE_VXSOFT; | |
| 180 | 	__mffs(&__r); | |
| 181 | 	__r.__bits.__reg |= __excepts; | |
| 182 | 	__mtfsf(__r); | |
| 183 | 	return (0); | |
| 184 | } | |
| 185 | #endif | |
| 186 | ||
| 187 | __fenv_static inline int | |
| 188 | fetestexcept(int __excepts) | |
| 189 | { | |
| 190 | 	union __fpscr __r; | |
| 191 | ||
| 192 | 	__mffs(&__r); | |
| 193 | 	return (__r.__bits.__reg & __excepts); | |
| 194 | } | |
| 195 | ||
| 196 | __fenv_static inline int | |
| 197 | fegetround(void) | |
| 198 | { | |
| 199 | 	union __fpscr __r; | |
| 200 | ||
| 201 | 	__mffs(&__r); | |
| 202 | 	return (__r.__bits.__reg & _ROUND_MASK); | |
| 203 | } | |
| 204 | ||
| 205 | __fenv_static inline int | |
| 206 | fesetround(int __round) | |
| 207 | { | |
| 208 | 	union __fpscr __r; | |
| 209 | ||
| 210 | 	if (__round & ~_ROUND_MASK) | |
| 211 | 		return (-1); | |
| 212 | 	__mffs(&__r); | |
| 213 | 	__r.__bits.__reg &= ~_ROUND_MASK; | |
| 214 | 	__r.__bits.__reg |= __round; | |
| 215 | 	__mtfsf(__r); | |
| 216 | 	return (0); | |
| 217 | } | |
| 218 | ||
| 219 | __fenv_static inline int | |
| 220 | fegetenv(fenv_t *__envp) | |
| 221 | { | |
| 222 | 	union __fpscr __r; | |
| 223 | ||
| 224 | 	__mffs(&__r); | |
| 225 | 	*__envp = __r.__bits.__reg; | |
| 226 | 	return (0); | |
| 227 | } | |
| 228 | ||
| 229 | __fenv_static inline int | |
| 230 | feholdexcept(fenv_t *__envp) | |
| 231 | { | |
| 232 | 	union __fpscr __r; | |
| 233 | ||
| 234 | 	__mffs(&__r); | |
| 235 | 	*__envp = __r.__bits.__reg; | |
| 236 | 	__r.__bits.__reg &= ~(FE_ALL_EXCEPT | _ENABLE_MASK); | |
| 237 | 	__mtfsf(__r); | |
| 238 | 	return (0); | |
| 239 | } | |
| 240 | ||
| 241 | __fenv_static inline int | |
| 242 | fesetenv(const fenv_t *__envp) | |
| 243 | { | |
| 244 | 	union __fpscr __r; | |
| 245 | ||
| 246 | 	__r.__bits.__reg = *__envp; | |
| 247 | 	__mtfsf(__r); | |
| 248 | 	return (0); | |
| 249 | } | |
| 250 | ||
| 251 | __fenv_static inline int | |
| 252 | feupdateenv(const fenv_t *__envp) | |
| 253 | { | |
| 254 | 	union __fpscr __r; | |
| 255 | ||
| 256 | 	__mffs(&__r); | |
| 257 | 	__r.__bits.__reg &= FE_ALL_EXCEPT; | |
| 258 | 	__r.__bits.__reg |= *__envp; | |
| 259 | 	__mtfsf(__r); | |
| 260 | 	return (0); | |
| 261 | } | |
| 262 | ||
| 263 | #if __BSD_VISIBLE | |
| 264 | ||
| 265 | __fenv_static inline int | |
| 266 | feenableexcept(int __mask) | |
| 267 | { | |
| 268 | 	union __fpscr __r; | |
| 269 | 	fenv_t __oldmask; | |
| 270 | ||
| 271 | 	__mffs(&__r); | |
| 272 | 	__oldmask = __r.__bits.__reg; | |
| 273 | 	__r.__bits.__reg |= (__mask & FE_ALL_EXCEPT) >> _FPUSW_SHIFT; | |
| 274 | 	__mtfsf(__r); | |
| 275 | 	return ((__oldmask & _ENABLE_MASK) << _FPUSW_SHIFT); | |
| 276 | } | |
| 277 | ||
| 278 | __fenv_static inline int | |
| 279 | fedisableexcept(int __mask) | |
| 280 | { | |
| 281 | 	union __fpscr __r; | |
| 282 | 	fenv_t __oldmask; | |
| 283 | ||
| 284 | 	__mffs(&__r); | |
| 285 | 	__oldmask = __r.__bits.__reg; | |
| 286 | 	__r.__bits.__reg &= ~((__mask & FE_ALL_EXCEPT) >> _FPUSW_SHIFT); | |
| 287 | 	__mtfsf(__r); | |
| 288 | 	return ((__oldmask & _ENABLE_MASK) << _FPUSW_SHIFT); | |
| 289 | } | |
| 290 | ||
| 291 | /* We currently provide no external definition of fegetexcept(). */ | |
| 292 | static inline int | |
| 293 | fegetexcept(void) | |
| 294 | { | |
| 295 | 	union __fpscr __r; | |
| 296 | ||
| 297 | 	__mffs(&__r); | |
| 298 | 	return ((__r.__bits.__reg & _ENABLE_MASK) << _FPUSW_SHIFT); | |
| 299 | } | |
| 300 | ||
| 301 | #endif /* __BSD_VISIBLE */ | |
| 302 | ||
| 303 | __END_DECLS | |
| 304 | ||
| 305 | #endif	/* !_FENV_H_ */ | |
| \ No newline at end of file |
lib/libc/include/powerpc64-freebsd-none/float.h created+98| ... | ... | @@ -0,0 +1,98 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-3-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 1989 Regents of the University of California. | |
| 5 | * All rights reserved. | |
| 6 | * | |
| 7 | * Redistribution and use in source and binary forms, with or without | |
| 8 | * modification, are permitted provided that the following conditions | |
| 9 | * are met: | |
| 10 | * 1. Redistributions of source code must retain the above copyright | |
| 11 | * notice, this list of conditions and the following disclaimer. | |
| 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 13 | * notice, this list of conditions and the following disclaimer in the | |
| 14 | * documentation and/or other materials provided with the distribution. | |
| 15 | * 3. Neither the name of the University nor the names of its contributors | |
| 16 | * may be used to endorse or promote products derived from this software | |
| 17 | * without specific prior written permission. | |
| 18 | * | |
| 19 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | |
| 20 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 21 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
| 22 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
| 23 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
| 24 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
| 25 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
| 26 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
| 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
| 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
| 29 | * SUCH DAMAGE. | |
| 30 | *	from: FreeBSD: src/sys/i386/include/float.h,v 1.8 1999/08/28 00:44:11 | |
| 31 | */ | |
| 32 | ||
| 33 | #ifndef _MACHINE_FLOAT_H_ | |
| 34 | #define _MACHINE_FLOAT_H_ 1 | |
| 35 | ||
| 36 | #include <sys/cdefs.h> | |
| 37 | ||
| 38 | #ifndef _SOFT_FLOAT | |
| 39 | __BEGIN_DECLS | |
| 40 | extern int __flt_rounds(void); | |
| 41 | __END_DECLS | |
| 42 | #define FLT_ROUNDS	__flt_rounds() | |
| 43 | #else | |
| 44 | #define FLT_ROUNDS	(-1) | |
| 45 | #endif | |
| 46 | ||
| 47 | #define FLT_RADIX	2		/* b */ | |
| 48 | #if __ISO_C_VISIBLE >= 1999 | |
| 49 | #define	FLT_EVAL_METHOD	0 | |
| 50 | #define	DECIMAL_DIG	17		/* max precision in decimal digits */ | |
| 51 | #endif | |
| 52 | ||
| 53 | #define FLT_MANT_DIG	24		/* p */ | |
| 54 | #define FLT_EPSILON	1.19209290E-07F	/* b**(1-p) */ | |
| 55 | #define FLT_DIG		6		/* floor((p-1)*log10(b))+(b == 10) */ | |
| 56 | #define FLT_MIN_EXP	(-125)		/* emin */ | |
| 57 | #define FLT_MIN		1.17549435E-38F	/* b**(emin-1) */ | |
| 58 | #define FLT_MIN_10_EXP	(-37)		/* ceil(log10(b**(emin-1))) */ | |
| 59 | #define FLT_MAX_EXP	128		/* emax */ | |
| 60 | #define FLT_MAX		3.40282347E+38F	/* (1-b**(-p))*b**emax */ | |
| 61 | #define FLT_MAX_10_EXP	38		/* floor(log10((1-b**(-p))*b**emax)) */ | |
| 62 | #if __ISO_C_VISIBLE >= 2011 | |
| 63 | #define	FLT_TRUE_MIN	1.40129846E-45F	/* b**(emin-p) */ | |
| 64 | #define	FLT_DECIMAL_DIG	9		/* ceil(1+p*log10(b)) */ | |
| 65 | #define	FLT_HAS_SUBNORM	1 | |
| 66 | #endif /* __ISO_C_VISIBLE >= 2011 */ | |
| 67 | ||
| 68 | #define DBL_MANT_DIG	53 | |
| 69 | #define DBL_EPSILON	2.2204460492503131E-16 | |
| 70 | #define DBL_DIG		15 | |
| 71 | #define DBL_MIN_EXP	(-1021) | |
| 72 | #define DBL_MIN		2.2250738585072014E-308 | |
| 73 | #define DBL_MIN_10_EXP	(-307) | |
| 74 | #define DBL_MAX_EXP	1024 | |
| 75 | #define DBL_MAX		1.7976931348623157E+308 | |
| 76 | #define DBL_MAX_10_EXP	308 | |
| 77 | #if __ISO_C_VISIBLE >= 2011 | |
| 78 | #define	DBL_TRUE_MIN	4.9406564584124654E-324 | |
| 79 | #define	DBL_DECIMAL_DIG	17 | |
| 80 | #define	DBL_HAS_SUBNORM	1 | |
| 81 | #endif /* __ISO_C_VISIBLE >= 2011 */ | |
| 82 | ||
| 83 | #define LDBL_MANT_DIG	DBL_MANT_DIG | |
| 84 | #define LDBL_EPSILON	((long double)DBL_EPSILON) | |
| 85 | #define LDBL_DIG	DBL_DIG | |
| 86 | #define LDBL_MIN_EXP	DBL_MIN_EXP | |
| 87 | #define LDBL_MIN	((long double)DBL_MIN) | |
| 88 | #define LDBL_MIN_10_EXP	DBL_MIN_10_EXP | |
| 89 | #define LDBL_MAX_EXP	DBL_MAX_EXP | |
| 90 | #define LDBL_MAX	((long double)DBL_MAX) | |
| 91 | #define LDBL_MAX_10_EXP	DBL_MAX_10_EXP | |
| 92 | #if __ISO_C_VISIBLE >= 2011 | |
| 93 | #define	LDBL_TRUE_MIN	((long double)DBL_TRUE_MIN) | |
| 94 | #define	LDBL_DECIMAL_DIG DBL_DECIMAL_DIG | |
| 95 | #define	LDBL_HAS_SUBNORM DBL_HAS_SUBNORM | |
| 96 | #endif /* __ISO_C_VISIBLE >= 2011 */ | |
| 97 | ||
| 98 | #endif /* _MACHINE_FLOAT_H_ */ | |
| \ No newline at end of file |
lib/libc/include/powerpc64-freebsd-none/floatingpoint.h created+37| ... | ... | @@ -0,0 +1,37 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-3-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 2004 Suleiman Souhlal <refugee@segfaulted.com> | |
| 5 | * All rights reserved. | |
| 6 | * | |
| 7 | * Redistribution and use in source and binary forms, with or without | |
| 8 | * modification, are permitted provided that the following conditions | |
| 9 | * are met: | |
| 10 | * 1. Redistributions of source code must retain the above copyright | |
| 11 | * notice, this list of conditions and the following disclaimer. | |
| 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 13 | * notice, this list of conditions and the following disclaimer in the | |
| 14 | * documentation and/or other materials provided with the distribution. | |
| 15 | * 3. Neither the name of the author nor the names of any co-contributors | |
| 16 | * may be used to endorse or promote products derived from this software | |
| 17 | * without specific prior written permission. | |
| 18 | * | |
| 19 | * THIS SOFTWARE IS PROVIDED BY DAVID O'BRIEN AND CONTRIBUTORS ``AS IS'' AND | |
| 20 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 21 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
| 22 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
| 23 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
| 24 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
| 25 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
| 26 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
| 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
| 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
| 29 | * SUCH DAMAGE. | |
| 30 | */ | |
| 31 | ||
| 32 | #ifndef _FLOATINGPOINT_H_ | |
| 33 | #define _FLOATINGPOINT_H_ | |
| 34 | ||
| 35 | #include <machine/ieeefp.h> | |
| 36 | ||
| 37 | #endif /* !_FLOATINGPOINT_H_ */ | |
| \ No newline at end of file |
lib/libc/include/powerpc64-freebsd-none/machine/_align.h created+51| ... | ... | @@ -0,0 +1,51 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-4-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 2001 David E. O'Brien | |
| 5 | * Copyright (c) 1990 The Regents of the University of California. | |
| 6 | * All rights reserved. | |
| 7 | * | |
| 8 | * This code is derived from software contributed to Berkeley by | |
| 9 | * William Jolitz. | |
| 10 | * | |
| 11 | * Redistribution and use in source and binary forms, with or without | |
| 12 | * modification, are permitted provided that the following conditions | |
| 13 | * are met: | |
| 14 | * 1. Redistributions of source code must retain the above copyright | |
| 15 | * notice, this list of conditions and the following disclaimer. | |
| 16 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 17 | * notice, this list of conditions and the following disclaimer in the | |
| 18 | * documentation and/or other materials provided with the distribution. | |
| 19 | * 3. All advertising materials mentioning features or use of this software | |
| 20 | * must display the following acknowledgement: | |
| 21 | *	This product includes software developed by the University of | |
| 22 | *	California, Berkeley and its contributors. | |
| 23 | * 4. Neither the name of the University nor the names of its contributors | |
| 24 | * may be used to endorse or promote products derived from this software | |
| 25 | * without specific prior written permission. | |
| 26 | * | |
| 27 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | |
| 28 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 29 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
| 30 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
| 31 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
| 32 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
| 33 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
| 34 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
| 35 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
| 36 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
| 37 | * SUCH DAMAGE. | |
| 38 | */ | |
| 39 | ||
| 40 | #ifndef _POWERPC_INCLUDE__ALIGN_H_ | |
| 41 | #define	_POWERPC_INCLUDE__ALIGN_H_ | |
| 42 | ||
| 43 | /* | |
| 44 | * Round p (pointer or byte index) up to a correctly-aligned value | |
| 45 | * for all data types (int, long, ...). The result is unsigned int | |
| 46 | * and must be cast to any desired pointer type. | |
| 47 | */ | |
| 48 | #define	_ALIGNBYTES	(sizeof(register_t) - 1) | |
| 49 | #define	_ALIGN(p)	(((uintptr_t)(p) + _ALIGNBYTES) & ~_ALIGNBYTES) | |
| 50 | ||
| 51 | #endif /* !_POWERPC_INCLUDE__ALIGN_H_ */ | |
| \ No newline at end of file |
lib/libc/include/powerpc64-freebsd-none/machine/_bus.h created+30| ... | ... | @@ -0,0 +1,30 @@ |
| 1 | /*- | |
| 2 | * Copyright (c) 2005 The FreeBSD Foundation. | |
| 3 | * | |
| 4 | * SPDX-License-Identifier: BSD-2-Clause | |
| 5 | * | |
| 6 | * Derived in part from NetBSD's bus.h files by (alphabetically): | |
| 7 | *	Christopher G. Demetriou | |
| 8 | *	Charles M. Hannum | |
| 9 | *	Jason Thorpe | |
| 10 | *	The NetBSD Foundation. | |
| 11 | */ | |
| 12 | ||
| 13 | #ifndef POWERPC_INCLUDE__BUS_H | |
| 14 | #define POWERPC_INCLUDE__BUS_H | |
| 15 | ||
| 16 | #include <vm/vm_param.h> | |
| 17 | ||
| 18 | /* | |
| 19 | * Bus address and size types | |
| 20 | */ | |
| 21 | typedef vm_paddr_t bus_addr_t; | |
| 22 | typedef vm_size_t bus_size_t; | |
| 23 | ||
| 24 | /* | |
| 25 | * Access methods for bus resources and address space. | |
| 26 | */ | |
| 27 | typedef struct bus_space *bus_space_tag_t; | |
| 28 | typedef vm_offset_t bus_space_handle_t; | |
| 29 | ||
| 30 | #endif /* POWERPC_INCLUDE__BUS_H */ | |
| \ No newline at end of file |
lib/libc/include/powerpc64-freebsd-none/machine/_inttypes.h created+222| ... | ... | @@ -0,0 +1,222 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-2-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 2001 The NetBSD Foundation, Inc. | |
| 5 | * All rights reserved. | |
| 6 | * | |
| 7 | * This code is derived from software contributed to The NetBSD Foundation | |
| 8 | * by Klaus Klein. | |
| 9 | * | |
| 10 | * Redistribution and use in source and binary forms, with or without | |
| 11 | * modification, are permitted provided that the following conditions | |
| 12 | * are met: | |
| 13 | * 1. Redistributions of source code must retain the above copyright | |
| 14 | * notice, this list of conditions and the following disclaimer. | |
| 15 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 16 | * notice, this list of conditions and the following disclaimer in the | |
| 17 | * documentation and/or other materials provided with the distribution. | |
| 18 | * | |
| 19 | * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS | |
| 20 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | |
| 21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
| 22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | |
| 23 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
| 24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
| 25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
| 26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
| 27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
| 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
| 29 | * POSSIBILITY OF SUCH DAMAGE. | |
| 30 | * | |
| 31 | *	From: $NetBSD: int_fmtio.h,v 1.2 2001/04/26 16:25:21 kleink Exp $ | |
| 32 | */ | |
| 33 | ||
| 34 | #ifndef _MACHINE_INTTYPES_H_ | |
| 35 | #define	_MACHINE_INTTYPES_H_ | |
| 36 | ||
| 37 | /* | |
| 38 | * Macros for format specifiers. | |
| 39 | */ | |
| 40 | ||
| 41 | #ifdef __LP64__ | |
| 42 | #define	__PRI64		"l" | |
| 43 | #define	__PRIptr	"l" | |
| 44 | #else | |
| 45 | #define	__PRI64		"ll" | |
| 46 | #define	__PRIptr | |
| 47 | #endif | |
| 48 | ||
| 49 | /* fprintf(3) macros for signed integers. */ | |
| 50 | ||
| 51 | #define	PRId8		"d"		/* int8_t */ | |
| 52 | #define	PRId16		"d"		/* int16_t */ | |
| 53 | #define	PRId32		"d"		/* int32_t */ | |
| 54 | #define	PRId64		__PRI64"d"	/* int64_t */ | |
| 55 | #define	PRIdLEAST8	"d"		/* int_least8_t */ | |
| 56 | #define	PRIdLEAST16	"d"		/* int_least16_t */ | |
| 57 | #define	PRIdLEAST32	"d"		/* int_least32_t */ | |
| 58 | #define	PRIdLEAST64	__PRI64"d"	/* int_least64_t */ | |
| 59 | #define	PRIdFAST8	"d"		/* int_fast8_t */ | |
| 60 | #define	PRIdFAST16	"d"		/* int_fast16_t */ | |
| 61 | #define	PRIdFAST32	"d"		/* int_fast32_t */ | |
| 62 | #define	PRIdFAST64	__PRI64"d"	/* int_fast64_t */ | |
| 63 | #define	PRIdMAX		"jd"		/* intmax_t */ | |
| 64 | #define	PRIdPTR		__PRIptr"d"	/* intptr_t */ | |
| 65 | ||
| 66 | #define	PRIi8		"i"		/* int8_t */ | |
| 67 | #define	PRIi16		"i"		/* int16_t */ | |
| 68 | #define	PRIi32		"i"		/* int32_t */ | |
| 69 | #define	PRIi64		__PRI64"i"	/* int64_t */ | |
| 70 | #define	PRIiLEAST8	"i"		/* int_least8_t */ | |
| 71 | #define	PRIiLEAST16	"i"		/* int_least16_t */ | |
| 72 | #define	PRIiLEAST32	"i"		/* int_least32_t */ | |
| 73 | #define	PRIiLEAST64	__PRI64"i"	/* int_least64_t */ | |
| 74 | #define	PRIiFAST8	"i"		/* int_fast8_t */ | |
| 75 | #define	PRIiFAST16	"i"		/* int_fast16_t */ | |
| 76 | #define	PRIiFAST32	"i"		/* int_fast32_t */ | |
| 77 | #define	PRIiFAST64	__PRI64"i"	/* int_fast64_t */ | |
| 78 | #define	PRIiMAX		"ji"		/* intmax_t */ | |
| 79 | #define	PRIiPTR		__PRIptr"i"	/* intptr_t */ | |
| 80 | ||
| 81 | /* fprintf(3) macros for unsigned integers. */ | |
| 82 | ||
| 83 | #define	PRIo8		"o"		/* uint8_t */ | |
| 84 | #define	PRIo16		"o"		/* uint16_t */ | |
| 85 | #define	PRIo32		"o"		/* uint32_t */ | |
| 86 | #define	PRIo64		__PRI64"o"	/* uint64_t */ | |
| 87 | #define	PRIoLEAST8	"o"		/* uint_least8_t */ | |
| 88 | #define	PRIoLEAST16	"o"		/* uint_least16_t */ | |
| 89 | #define	PRIoLEAST32	"o"		/* uint_least32_t */ | |
| 90 | #define	PRIoLEAST64	__PRI64"o"	/* uint_least64_t */ | |
| 91 | #define	PRIoFAST8	"o"		/* uint_fast8_t */ | |
| 92 | #define	PRIoFAST16	"o"		/* uint_fast16_t */ | |
| 93 | #define	PRIoFAST32	"o"		/* uint_fast32_t */ | |
| 94 | #define	PRIoFAST64	__PRI64"o"	/* uint_fast64_t */ | |
| 95 | #define	PRIoMAX		"jo"		/* uintmax_t */ | |
| 96 | #define	PRIoPTR		__PRIptr"o"	/* uintptr_t */ | |
| 97 | ||
| 98 | #define	PRIu8		"u"		/* uint8_t */ | |
| 99 | #define	PRIu16		"u"		/* uint16_t */ | |
| 100 | #define	PRIu32		"u"		/* uint32_t */ | |
| 101 | #define	PRIu64		__PRI64"u"	/* uint64_t */ | |
| 102 | #define	PRIuLEAST8	"u"		/* uint_least8_t */ | |
| 103 | #define	PRIuLEAST16	"u"		/* uint_least16_t */ | |
| 104 | #define	PRIuLEAST32	"u"		/* uint_least32_t */ | |
| 105 | #define	PRIuLEAST64	__PRI64"u"	/* uint_least64_t */ | |
| 106 | #define	PRIuFAST8	"u"		/* uint_fast8_t */ | |
| 107 | #define	PRIuFAST16	"u"		/* uint_fast16_t */ | |
| 108 | #define	PRIuFAST32	"u"		/* uint_fast32_t */ | |
| 109 | #define	PRIuFAST64	__PRI64"u"	/* uint_fast64_t */ | |
| 110 | #define	PRIuMAX		"ju"		/* uintmax_t */ | |
| 111 | #define	PRIuPTR		__PRIptr"u"	/* uintptr_t */ | |
| 112 | ||
| 113 | #define	PRIx8		"x"		/* uint8_t */ | |
| 114 | #define	PRIx16		"x"		/* uint16_t */ | |
| 115 | #define	PRIx32		"x"		/* uint32_t */ | |
| 116 | #define	PRIx64		__PRI64"x"	/* uint64_t */ | |
| 117 | #define	PRIxLEAST8	"x"		/* uint_least8_t */ | |
| 118 | #define	PRIxLEAST16	"x"		/* uint_least16_t */ | |
| 119 | #define	PRIxLEAST32	"x"		/* uint_least32_t */ | |
| 120 | #define	PRIxLEAST64	__PRI64"x"	/* uint_least64_t */ | |
| 121 | #define	PRIxFAST8	"x"		/* uint_fast8_t */ | |
| 122 | #define	PRIxFAST16	"x"		/* uint_fast16_t */ | |
| 123 | #define	PRIxFAST32	"x"		/* uint_fast32_t */ | |
| 124 | #define	PRIxFAST64	__PRI64"x"	/* uint_fast64_t */ | |
| 125 | #define	PRIxMAX		"jx"		/* uintmax_t */ | |
| 126 | #define	PRIxPTR		__PRIptr"x"	/* uintptr_t */ | |
| 127 | ||
| 128 | #define	PRIX8		"X"		/* uint8_t */ | |
| 129 | #define	PRIX16		"X"		/* uint16_t */ | |
| 130 | #define	PRIX32		"X"		/* uint32_t */ | |
| 131 | #define	PRIX64		__PRI64"X"	/* uint64_t */ | |
| 132 | #define	PRIXLEAST8	"X"		/* uint_least8_t */ | |
| 133 | #define	PRIXLEAST16	"X"		/* uint_least16_t */ | |
| 134 | #define	PRIXLEAST32	"X"		/* uint_least32_t */ | |
| 135 | #define	PRIXLEAST64	__PRI64"X"	/* uint_least64_t */ | |
| 136 | #define	PRIXFAST8	"X"		/* uint_fast8_t */ | |
| 137 | #define	PRIXFAST16	"X"		/* uint_fast16_t */ | |
| 138 | #define	PRIXFAST32	"X"		/* uint_fast32_t */ | |
| 139 | #define	PRIXFAST64	__PRI64"X"	/* uint_fast64_t */ | |
| 140 | #define	PRIXMAX		"jX"		/* uintmax_t */ | |
| 141 | #define	PRIXPTR		__PRIptr"X"	/* uintptr_t */ | |
| 142 | ||
| 143 | /* fscanf(3) macros for signed integers. */ | |
| 144 | ||
| 145 | #define	SCNd8		"hhd"		/* int8_t */ | |
| 146 | #define	SCNd16		"hd"		/* int16_t */ | |
| 147 | #define	SCNd32		"d"		/* int32_t */ | |
| 148 | #define	SCNd64		__PRI64"d"	/* int64_t */ | |
| 149 | #define	SCNdLEAST8	"hhd"		/* int_least8_t */ | |
| 150 | #define	SCNdLEAST16	"hd"		/* int_least16_t */ | |
| 151 | #define	SCNdLEAST32	"d"		/* int_least32_t */ | |
| 152 | #define	SCNdLEAST64	__PRI64"d"	/* int_least64_t */ | |
| 153 | #define	SCNdFAST8	"d"		/* int_fast8_t */ | |
| 154 | #define	SCNdFAST16	"d"		/* int_fast16_t */ | |
| 155 | #define	SCNdFAST32	"d"		/* int_fast32_t */ | |
| 156 | #define	SCNdFAST64	__PRI64"d"	/* int_fast64_t */ | |
| 157 | #define	SCNdMAX		"jd"		/* intmax_t */ | |
| 158 | #define	SCNdPTR		__PRIptr"d"	/* intptr_t */ | |
| 159 | ||
| 160 | #define	SCNi8		"hhi"		/* int8_t */ | |
| 161 | #define	SCNi16		"hi"		/* int16_t */ | |
| 162 | #define	SCNi32		"i"		/* int32_t */ | |
| 163 | #define	SCNi64		__PRI64"i"	/* int64_t */ | |
| 164 | #define	SCNiLEAST8	"hhi"		/* int_least8_t */ | |
| 165 | #define	SCNiLEAST16	"hi"		/* int_least16_t */ | |
| 166 | #define	SCNiLEAST32	"i"		/* int_least32_t */ | |
| 167 | #define	SCNiLEAST64	__PRI64"i"	/* int_least64_t */ | |
| 168 | #define	SCNiFAST8	"i"		/* int_fast8_t */ | |
| 169 | #define	SCNiFAST16	"i"		/* int_fast16_t */ | |
| 170 | #define	SCNiFAST32	"i"		/* int_fast32_t */ | |
| 171 | #define	SCNiFAST64	__PRI64"i"	/* int_fast64_t */ | |
| 172 | #define	SCNiMAX		"ji"		/* intmax_t */ | |
| 173 | #define	SCNiPTR		__PRIptr"i"	/* intptr_t */ | |
| 174 | ||
| 175 | /* fscanf(3) macros for unsigned integers. */ | |
| 176 | ||
| 177 | #define	SCNo8		"hho"		/* uint8_t */ | |
| 178 | #define	SCNo16		"ho"		/* uint16_t */ | |
| 179 | #define	SCNo32		"o"		/* uint32_t */ | |
| 180 | #define	SCNo64		__PRI64"o"	/* uint64_t */ | |
| 181 | #define	SCNoLEAST8	"hho"		/* uint_least8_t */ | |
| 182 | #define	SCNoLEAST16	"ho"		/* uint_least16_t */ | |
| 183 | #define	SCNoLEAST32	"o"		/* uint_least32_t */ | |
| 184 | #define	SCNoLEAST64	__PRI64"o"	/* uint_least64_t */ | |
| 185 | #define	SCNoFAST8	"o"		/* uint_fast8_t */ | |
| 186 | #define	SCNoFAST16	"o"		/* uint_fast16_t */ | |
| 187 | #define	SCNoFAST32	"o"		/* uint_fast32_t */ | |
| 188 | #define	SCNoFAST64	__PRI64"o"	/* uint_fast64_t */ | |
| 189 | #define	SCNoMAX		"jo"		/* uintmax_t */ | |
| 190 | #define	SCNoPTR		__PRIptr"o"	/* uintptr_t */ | |
| 191 | ||
| 192 | #define	SCNu8		"hhu"		/* uint8_t */ | |
| 193 | #define	SCNu16		"hu"		/* uint16_t */ | |
| 194 | #define	SCNu32		"u"		/* uint32_t */ | |
| 195 | #define	SCNu64		__PRI64"u"	/* uint64_t */ | |
| 196 | #define	SCNuLEAST8	"hhu"		/* uint_least8_t */ | |
| 197 | #define	SCNuLEAST16	"hu"		/* uint_least16_t */ | |
| 198 | #define	SCNuLEAST32	"u"		/* uint_least32_t */ | |
| 199 | #define	SCNuLEAST64	__PRI64"u"	/* uint_least64_t */ | |
| 200 | #define	SCNuFAST8	"u"		/* uint_fast8_t */ | |
| 201 | #define	SCNuFAST16	"u"		/* uint_fast16_t */ | |
| 202 | #define	SCNuFAST32	"u"		/* uint_fast32_t */ | |
| 203 | #define	SCNuFAST64	__PRI64"u"	/* uint_fast64_t */ | |
| 204 | #define	SCNuMAX		"ju"		/* uintmax_t */ | |
| 205 | #define	SCNuPTR		__PRIptr"u"	/* uintptr_t */ | |
| 206 | ||
| 207 | #define	SCNx8		"hhx"		/* uint8_t */ | |
| 208 | #define	SCNx16		"hx"		/* uint16_t */ | |
| 209 | #define	SCNx32		"x"		/* uint32_t */ | |
| 210 | #define	SCNx64		__PRI64"x"	/* uint64_t */ | |
| 211 | #define	SCNxLEAST8	"hhx"		/* uint_least8_t */ | |
| 212 | #define	SCNxLEAST16	"hx"		/* uint_least16_t */ | |
| 213 | #define	SCNxLEAST32	"x"		/* uint_least32_t */ | |
| 214 | #define	SCNxLEAST64	__PRI64"x"	/* uint_least64_t */ | |
| 215 | #define	SCNxFAST8	"x"		/* uint_fast8_t */ | |
| 216 | #define	SCNxFAST16	"x"		/* uint_fast16_t */ | |
| 217 | #define	SCNxFAST32	"x"		/* uint_fast32_t */ | |
| 218 | #define	SCNxFAST64	__PRI64"x"	/* uint_fast64_t */ | |
| 219 | #define	SCNxMAX		"jx"		/* uintmax_t */ | |
| 220 | #define	SCNxPTR		__PRIptr"x"	/* uintptr_t */ | |
| 221 | ||
| 222 | #endif /* !_MACHINE_INTTYPES_H_ */ | |
| \ No newline at end of file |
lib/libc/include/powerpc64-freebsd-none/machine/_limits.h created+96| ... | ... | @@ -0,0 +1,96 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-3-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 1988, 1993 | |
| 5 | *	The Regents of the University of California. All rights reserved. | |
| 6 | * | |
| 7 | * Redistribution and use in source and binary forms, with or without | |
| 8 | * modification, are permitted provided that the following conditions | |
| 9 | * are met: | |
| 10 | * 1. Redistributions of source code must retain the above copyright | |
| 11 | * notice, this list of conditions and the following disclaimer. | |
| 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 13 | * notice, this list of conditions and the following disclaimer in the | |
| 14 | * documentation and/or other materials provided with the distribution. | |
| 15 | * 3. Neither the name of the University nor the names of its contributors | |
| 16 | * may be used to endorse or promote products derived from this software | |
| 17 | * without specific prior written permission. | |
| 18 | * | |
| 19 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | |
| 20 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 21 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
| 22 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
| 23 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
| 24 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
| 25 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
| 26 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
| 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
| 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
| 29 | * SUCH DAMAGE. | |
| 30 | */ | |
| 31 | ||
| 32 | #ifndef _MACHINE__LIMITS_H_ | |
| 33 | #define	_MACHINE__LIMITS_H_ | |
| 34 | ||
| 35 | /* | |
| 36 | * According to ANSI (section 2.2.4.2), the values below must be usable by | |
| 37 | * #if preprocessing directives. Additionally, the expression must have the | |
| 38 | * same type as would an expression that is an object of the corresponding | |
| 39 | * type converted according to the integral promotions. The subtraction for | |
| 40 | * INT_MIN, etc., is so the value is not unsigned; e.g., 0x80000000 is an | |
| 41 | * unsigned int for 32-bit two's complement ANSI compilers (section 3.1.3.2). | |
| 42 | */ | |
| 43 | ||
| 44 | #define	__CHAR_BIT	8		/* number of bits in a char */ | |
| 45 | ||
| 46 | #define	__SCHAR_MAX	0x7f		/* max value for a signed char */ | |
| 47 | #define	__SCHAR_MIN	(-0x7f - 1)	/* min value for a signed char */ | |
| 48 | ||
| 49 | #define	__UCHAR_MAX	0xff		/* max value for an unsigned char */ | |
| 50 | ||
| 51 | #define	__USHRT_MAX	0xffff		/* max value for an unsigned short */ | |
| 52 | #define	__SHRT_MAX	0x7fff		/* max value for a short */ | |
| 53 | #define	__SHRT_MIN	(-0x7fff - 1)	/* min value for a short */ | |
| 54 | ||
| 55 | #define	__UINT_MAX	0xffffffff	/* max value for an unsigned int */ | |
| 56 | #define	__INT_MAX	0x7fffffff	/* max value for an int */ | |
| 57 | #define	__INT_MIN	(-0x7fffffff - 1)	/* min value for an int */ | |
| 58 | ||
| 59 | #ifdef __LP64__ | |
| 60 | #define	__ULONG_MAX	0xffffffffffffffff | |
| 61 | #define	__LONG_MAX	0x7fffffffffffffff | |
| 62 | #define	__LONG_MIN	(-0x7fffffffffffffff - 1) | |
| 63 | #define	__LONG_BIT	64 | |
| 64 | #else | |
| 65 | #define	__ULONG_MAX	0xffffffffUL	/* max value for an unsigned long */ | |
| 66 | #define	__LONG_MAX	0x7fffffffL	/* max value for a long */ | |
| 67 | #define	__LONG_MIN	(-0x7fffffffL - 1)	/* min value for a long */ | |
| 68 | #define	__LONG_BIT	32 | |
| 69 | #endif | |
| 70 | ||
| 71 | #define	__ULLONG_MAX	0xffffffffffffffffULL | |
| 72 | #define	__LLONG_MAX	0x7fffffffffffffffLL	/* max value for a long long */ | |
| 73 | #define	__LLONG_MIN	(-0x7fffffffffffffffLL - 1) /* min for a long long */ | |
| 74 | ||
| 75 | #ifdef __LP64__ | |
| 76 | #define	__SSIZE_MAX	__LONG_MAX	/* max value for a ssize_t */ | |
| 77 | #define	__SIZE_T_MAX	__ULONG_MAX	/* max value for a size_t */ | |
| 78 | #else | |
| 79 | #define	__SSIZE_MAX	__INT_MAX	/* max value for a ssize_t */ | |
| 80 | #define	__SIZE_T_MAX	__UINT_MAX	/* max value for a size_t */ | |
| 81 | #endif | |
| 82 | ||
| 83 | #define	__OFF_MAX	__LLONG_MAX	/* max value for an off_t */ | |
| 84 | #define	__OFF_MIN	__LLONG_MIN	/* min value for an off_t */ | |
| 85 | ||
| 86 | /* Quads and long longs are the same size. Ensure they stay in sync. */ | |
| 87 | #define	__UQUAD_MAX	__ULLONG_MAX	/* max value for a uquad_t */ | |
| 88 | #define	__QUAD_MAX	__LLONG_MAX	/* max value for a quad_t */ | |
| 89 | #define	__QUAD_MIN	__LLONG_MIN	/* min value for a quad_t */ | |
| 90 | ||
| 91 | #define	__WORD_BIT	32 | |
| 92 | ||
| 93 | /* Minimum signal stack size. */ | |
| 94 | #define	__MINSIGSTKSZ	(512 * 4) | |
| 95 | ||
| 96 | #endif /* !_MACHINE__LIMITS_H_ */ | |
| \ No newline at end of file |
lib/libc/include/powerpc64-freebsd-none/machine/_stdint.h created+200| ... | ... | @@ -0,0 +1,200 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-4-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 2001, 2002 Mike Barcroft <mike@FreeBSD.org> | |
| 5 | * Copyright (c) 2001 The NetBSD Foundation, Inc. | |
| 6 | * All rights reserved. | |
| 7 | * | |
| 8 | * This code is derived from software contributed to The NetBSD Foundation | |
| 9 | * by Klaus Klein. | |
| 10 | * | |
| 11 | * Redistribution and use in source and binary forms, with or without | |
| 12 | * modification, are permitted provided that the following conditions | |
| 13 | * are met: | |
| 14 | * 1. Redistributions of source code must retain the above copyright | |
| 15 | * notice, this list of conditions and the following disclaimer. | |
| 16 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 17 | * notice, this list of conditions and the following disclaimer in the | |
| 18 | * documentation and/or other materials provided with the distribution. | |
| 19 | * 3. All advertising materials mentioning features or use of this software | |
| 20 | * must display the following acknowledgement: | |
| 21 | * This product includes software developed by the NetBSD | |
| 22 | * Foundation, Inc. and its contributors. | |
| 23 | * 4. Neither the name of The NetBSD Foundation nor the names of its | |
| 24 | * contributors may be used to endorse or promote products derived | |
| 25 | * from this software without specific prior written permission. | |
| 26 | * | |
| 27 | * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS | |
| 28 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | |
| 29 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
| 30 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | |
| 31 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
| 32 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
| 33 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
| 34 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
| 35 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
| 36 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
| 37 | * POSSIBILITY OF SUCH DAMAGE. | |
| 38 | */ | |
| 39 | ||
| 40 | #ifndef _MACHINE__STDINT_H_ | |
| 41 | #define	_MACHINE__STDINT_H_ | |
| 42 | ||
| 43 | #if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) | |
| 44 | ||
| 45 | #define	INT8_C(c)		(c) | |
| 46 | #define	INT16_C(c)		(c) | |
| 47 | #define	INT32_C(c)		(c) | |
| 48 | ||
| 49 | #define	UINT8_C(c)		(c) | |
| 50 | #define	UINT16_C(c)		(c) | |
| 51 | #define	UINT32_C(c)		(c ## U) | |
| 52 | ||
| 53 | #ifdef __LP64__ | |
| 54 | #define	INT64_C(c)		(c ## L) | |
| 55 | #define	UINT64_C(c)		(c ## UL) | |
| 56 | #else | |
| 57 | #define	INT64_C(c)		(c ## LL) | |
| 58 | #define	UINT64_C(c)		(c ## ULL) | |
| 59 | #endif | |
| 60 | ||
| 61 | #define	INTMAX_C(c)		INT64_C(c) | |
| 62 | #define	UINTMAX_C(c)		UINT64_C(c) | |
| 63 | ||
| 64 | #endif /* !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) */ | |
| 65 | ||
| 66 | #if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) | |
| 67 | ||
| 68 | #ifndef __INT64_C | |
| 69 | #ifdef __LP64__ | |
| 70 | #define	__INT64_C(c)		(c ## L) | |
| 71 | #define	__UINT64_C(c)		(c ## UL) | |
| 72 | #else | |
| 73 | #define	__INT64_C(c)		(c ## LL) | |
| 74 | #define	__UINT64_C(c)		(c ## ULL) | |
| 75 | #endif | |
| 76 | #endif | |
| 77 | ||
| 78 | /* | |
| 79 | * ISO/IEC 9899:1999 | |
| 80 | * 7.18.2.1 Limits of exact-width integer types | |
| 81 | */ | |
| 82 | /* Minimum values of exact-width signed integer types. */ | |
| 83 | #define	INT8_MIN	(-0x7f-1) | |
| 84 | #define	INT16_MIN	(-0x7fff-1) | |
| 85 | #define	INT32_MIN	(-0x7fffffff-1) | |
| 86 | #define	INT64_MIN	(-__INT64_C(0x7fffffffffffffff)-1) | |
| 87 | ||
| 88 | /* Maximum values of exact-width signed integer types. */ | |
| 89 | #define	INT8_MAX	0x7f | |
| 90 | #define	INT16_MAX	0x7fff | |
| 91 | #define	INT32_MAX	0x7fffffff | |
| 92 | #define	INT64_MAX	__INT64_C(0x7fffffffffffffff) | |
| 93 | ||
| 94 | /* Maximum values of exact-width unsigned integer types. */ | |
| 95 | #define	UINT8_MAX	0xff | |
| 96 | #define	UINT16_MAX	0xffff | |
| 97 | #define	UINT32_MAX	0xffffffff | |
| 98 | #define	UINT64_MAX	__UINT64_C(0xffffffffffffffff) | |
| 99 | ||
| 100 | /* | |
| 101 | * ISO/IEC 9899:1999 | |
| 102 | * 7.18.2.2 Limits of minimum-width integer types | |
| 103 | */ | |
| 104 | /* Minimum values of minimum-width signed integer types. */ | |
| 105 | #define	INT_LEAST8_MIN	INT8_MIN | |
| 106 | #define	INT_LEAST16_MIN	INT16_MIN | |
| 107 | #define	INT_LEAST32_MIN	INT32_MIN | |
| 108 | #define	INT_LEAST64_MIN	INT64_MIN | |
| 109 | ||
| 110 | /* Maximum values of minimum-width signed integer types. */ | |
| 111 | #define	INT_LEAST8_MAX	INT8_MAX | |
| 112 | #define	INT_LEAST16_MAX	INT16_MAX | |
| 113 | #define	INT_LEAST32_MAX	INT32_MAX | |
| 114 | #define	INT_LEAST64_MAX	INT64_MAX | |
| 115 | ||
| 116 | /* Maximum values of minimum-width unsigned integer types. */ | |
| 117 | #define	UINT_LEAST8_MAX	 UINT8_MAX | |
| 118 | #define	UINT_LEAST16_MAX UINT16_MAX | |
| 119 | #define	UINT_LEAST32_MAX UINT32_MAX | |
| 120 | #define	UINT_LEAST64_MAX UINT64_MAX | |
| 121 | ||
| 122 | /* | |
| 123 | * ISO/IEC 9899:1999 | |
| 124 | * 7.18.2.3 Limits of fastest minimum-width integer types | |
| 125 | */ | |
| 126 | /* Minimum values of fastest minimum-width signed integer types. */ | |
| 127 | #define	INT_FAST8_MIN	INT32_MIN | |
| 128 | #define	INT_FAST16_MIN	INT32_MIN | |
| 129 | #define	INT_FAST32_MIN	INT32_MIN | |
| 130 | #define	INT_FAST64_MIN	INT64_MIN | |
| 131 | ||
| 132 | /* Maximum values of fastest minimum-width signed integer types. */ | |
| 133 | #define	INT_FAST8_MAX	INT32_MAX | |
| 134 | #define	INT_FAST16_MAX	INT32_MAX | |
| 135 | #define	INT_FAST32_MAX	INT32_MAX | |
| 136 | #define	INT_FAST64_MAX	INT64_MAX | |
| 137 | ||
| 138 | /* Maximum values of fastest minimum-width unsigned integer types. */ | |
| 139 | #define	UINT_FAST8_MAX	UINT32_MAX | |
| 140 | #define	UINT_FAST16_MAX	UINT32_MAX | |
| 141 | #define	UINT_FAST32_MAX	UINT32_MAX | |
| 142 | #define	UINT_FAST64_MAX	UINT64_MAX | |
| 143 | ||
| 144 | /* | |
| 145 | * ISO/IEC 9899:1999 | |
| 146 | * 7.18.2.4 Limits of integer types capable of holding object pointers | |
| 147 | */ | |
| 148 | #ifdef __LP64__ | |
| 149 | #define	INTPTR_MIN	INT64_MIN | |
| 150 | #define	INTPTR_MAX	INT64_MAX | |
| 151 | #define	UINTPTR_MAX	UINT64_MAX | |
| 152 | #else | |
| 153 | #define	INTPTR_MIN	INT32_MIN | |
| 154 | #define	INTPTR_MAX	INT32_MAX | |
| 155 | #define	UINTPTR_MAX	UINT32_MAX | |
| 156 | #endif | |
| 157 | ||
| 158 | /* | |
| 159 | * ISO/IEC 9899:1999 | |
| 160 | * 7.18.2.5 Limits of greatest-width integer types | |
| 161 | */ | |
| 162 | #define	INTMAX_MIN	INT64_MIN | |
| 163 | #define	INTMAX_MAX	INT64_MAX | |
| 164 | #define	UINTMAX_MAX	UINT64_MAX | |
| 165 | ||
| 166 | /* | |
| 167 | * ISO/IEC 9899:1999 | |
| 168 | * 7.18.3 Limits of other integer types | |
| 169 | */ | |
| 170 | #ifdef __LP64__ | |
| 171 | /* Limits of ptrdiff_t. */ | |
| 172 | #define	PTRDIFF_MIN	INT64_MIN	 | |
| 173 | #define	PTRDIFF_MAX	INT64_MAX | |
| 174 | ||
| 175 | /* Limits of sig_atomic_t. */ | |
| 176 | #define	SIG_ATOMIC_MIN	INT64_MIN | |
| 177 | #define	SIG_ATOMIC_MAX	INT64_MAX | |
| 178 | ||
| 179 | /* Limit of size_t. */ | |
| 180 | #define	SIZE_MAX	UINT64_MAX | |
| 181 | #else | |
| 182 | /* Limits of ptrdiff_t. */ | |
| 183 | #define	PTRDIFF_MIN	INT32_MIN	 | |
| 184 | #define	PTRDIFF_MAX	INT32_MAX | |
| 185 | ||
| 186 | /* Limits of sig_atomic_t. */ | |
| 187 | #define	SIG_ATOMIC_MIN	INT32_MIN | |
| 188 | #define	SIG_ATOMIC_MAX	INT32_MAX | |
| 189 | ||
| 190 | /* Limit of size_t. */ | |
| 191 | #define	SIZE_MAX	UINT32_MAX | |
| 192 | #endif | |
| 193 | ||
| 194 | /* Limits of wint_t. */ | |
| 195 | #define	WINT_MIN	INT32_MIN | |
| 196 | #define	WINT_MAX	INT32_MAX | |
| 197 | ||
| 198 | #endif /* !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) */ | |
| 199 | ||
| 200 | #endif /* !_MACHINE__STDINT_H_ */ | |
| \ No newline at end of file |
lib/libc/include/powerpc64-freebsd-none/machine/_types.h created+89| ... | ... | @@ -0,0 +1,89 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-4-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 2002 Mike Barcroft <mike@FreeBSD.org> | |
| 5 | * Copyright (c) 1990, 1993 | |
| 6 | *	The Regents of the University of California. All rights reserved. | |
| 7 | * | |
| 8 | * Redistribution and use in source and binary forms, with or without | |
| 9 | * modification, are permitted provided that the following conditions | |
| 10 | * are met: | |
| 11 | * 1. Redistributions of source code must retain the above copyright | |
| 12 | * notice, this list of conditions and the following disclaimer. | |
| 13 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 14 | * notice, this list of conditions and the following disclaimer in the | |
| 15 | * documentation and/or other materials provided with the distribution. | |
| 16 | * 3. All advertising materials mentioning features or use of this software | |
| 17 | * must display the following acknowledgement: | |
| 18 | *	This product includes software developed by the University of | |
| 19 | *	California, Berkeley and its contributors. | |
| 20 | * 4. Neither the name of the University nor the names of its contributors | |
| 21 | * may be used to endorse or promote products derived from this software | |
| 22 | * without specific prior written permission. | |
| 23 | * | |
| 24 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | |
| 25 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
| 27 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
| 28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
| 29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
| 30 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
| 31 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
| 32 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
| 33 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
| 34 | * SUCH DAMAGE. | |
| 35 | */ | |
| 36 | ||
| 37 | #ifndef _MACHINE__TYPES_H_ | |
| 38 | #define	_MACHINE__TYPES_H_ | |
| 39 | ||
| 40 | #ifndef _SYS__TYPES_H_ | |
| 41 | #error do not include this header, use sys/_types.h | |
| 42 | #endif | |
| 43 | ||
| 44 | /* | |
| 45 | * Standard type definitions. | |
| 46 | */ | |
| 47 | typedef	__uint32_t	__clock_t;		/* clock()... */ | |
| 48 | #ifndef _STANDALONE | |
| 49 | typedef	double		__double_t; | |
| 50 | typedef	float		__float_t; | |
| 51 | #endif | |
| 52 | #ifdef __LP64__ | |
| 53 | typedef	__int64_t	__critical_t; | |
| 54 | #else | |
| 55 | typedef	__int32_t	__critical_t; | |
| 56 | #endif | |
| 57 | typedef	__int32_t	__int_fast8_t; | |
| 58 | typedef	__int32_t	__int_fast16_t; | |
| 59 | typedef	__int32_t	__int_fast32_t; | |
| 60 | typedef	__int64_t	__int_fast64_t; | |
| 61 | #ifdef __LP64__ | |
| 62 | typedef	__int64_t	__register_t; | |
| 63 | typedef	__int64_t	__segsz_t;		/* segment size (in pages) */ | |
| 64 | #else | |
| 65 | typedef	__int32_t	__register_t; | |
| 66 | typedef	__int32_t	__segsz_t;		/* segment size (in pages) */ | |
| 67 | #endif | |
| 68 | typedef	__int64_t	__time_t;		/* time()... */ | |
| 69 | typedef	__uint32_t	__uint_fast8_t; | |
| 70 | typedef	__uint32_t	__uint_fast16_t; | |
| 71 | typedef	__uint32_t	__uint_fast32_t; | |
| 72 | typedef	__uint64_t	__uint_fast64_t; | |
| 73 | #ifdef __LP64__ | |
| 74 | typedef	__uint64_t	__u_register_t; | |
| 75 | typedef	__uint64_t	__vm_paddr_t; | |
| 76 | #else | |
| 77 | typedef	__uint32_t	__u_register_t; | |
| 78 | #ifdef BOOKE | |
| 79 | typedef	__uint64_t	__vm_paddr_t; | |
| 80 | #else | |
| 81 | typedef	__uint32_t	__vm_paddr_t; | |
| 82 | #endif | |
| 83 | #endif | |
| 84 | typedef	int		___wchar_t; | |
| 85 | ||
| 86 | #define	__WCHAR_MIN	__INT_MIN	/* min value for a wchar_t */ | |
| 87 | #define	__WCHAR_MAX	__INT_MAX	/* max value for a wchar_t */ | |
| 88 | ||
| 89 | #endif /* !_MACHINE__TYPES_H_ */ | |
| \ No newline at end of file |
lib/libc/include/powerpc64-freebsd-none/machine/altivec.h created+41| ... | ... | @@ -0,0 +1,41 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-2-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 2008 Nathan Whitehorn | |
| 5 | * All rights reserved | |
| 6 | * | |
| 7 | * Redistribution and use in source and binary forms, with or without | |
| 8 | * modification, are permitted provided that the following conditions | |
| 9 | * are met: | |
| 10 | * 1. Redistributions of source code must retain the above copyright | |
| 11 | * notice, this list of conditions and the following disclaimer. | |
| 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 13 | * notice, this list of conditions and the following disclaimer in the | |
| 14 | * documentation and/or other materials provided with the distribution. | |
| 15 | * | |
| 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |
| 17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
| 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | |
| 20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
| 21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
| 22 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
| 23 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
| 24 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
| 25 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
| 26 | * SUCH DAMAGE. | |
| 27 | */ | |
| 28 | ||
| 29 | #ifndef	_MACHINE_ALTIVEC_H_ | |
| 30 | #define	_MACHINE_ALTIVEC_H_ | |
| 31 | ||
| 32 | #define ALTIVEC_VSCR_NJ		0x00010000	/* Enable non-Java mode */ | |
| 33 | #define ALTIVEC_VSCR_SAT	0x00000001	/* Saturation status bit */ | |
| 34 | ||
| 35 | void enable_vec(struct thread *); | |
| 36 | void save_vec(struct thread *); | |
| 37 | void save_vec_nodrop(struct thread *); | |
| 38 | void enable_vec_kern(void); | |
| 39 | void disable_vec(struct thread *td); | |
| 40 | ||
| 41 | #endif	/* _MACHINE_ALTIVEC_H_ */ | |
| \ No newline at end of file |
lib/libc/include/powerpc64-freebsd-none/machine/asm.h created+267| ... | ... | @@ -0,0 +1,267 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-4-Clause | |
| 3 | * | |
| 4 | * Copyright (C) 1995, 1996 Wolfgang Solfrank. | |
| 5 | * Copyright (C) 1995, 1996 TooLs GmbH. | |
| 6 | * All rights reserved. | |
| 7 | * | |
| 8 | * Redistribution and use in source and binary forms, with or without | |
| 9 | * modification, are permitted provided that the following conditions | |
| 10 | * are met: | |
| 11 | * 1. Redistributions of source code must retain the above copyright | |
| 12 | * notice, this list of conditions and the following disclaimer. | |
| 13 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 14 | * notice, this list of conditions and the following disclaimer in the | |
| 15 | * documentation and/or other materials provided with the distribution. | |
| 16 | * 3. All advertising materials mentioning features or use of this software | |
| 17 | * must display the following acknowledgement: | |
| 18 | *	This product includes software developed by TooLs GmbH. | |
| 19 | * 4. The name of TooLs GmbH may not be used to endorse or promote products | |
| 20 | * derived from this software without specific prior written permission. | |
| 21 | * | |
| 22 | * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR | |
| 23 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |
| 24 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | |
| 25 | * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
| 26 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | |
| 27 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; | |
| 28 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | |
| 29 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | |
| 30 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | |
| 31 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 32 | * | |
| 33 | *	$NetBSD: asm.h,v 1.6.18.1 2000/07/25 08:37:14 kleink Exp $ | |
| 34 | */ | |
| 35 | ||
| 36 | #ifndef _MACHINE_ASM_H_ | |
| 37 | #define	_MACHINE_ASM_H_ | |
| 38 | ||
| 39 | #include <sys/cdefs.h> | |
| 40 | ||
| 41 | #if defined(PIC) && !defined(__powerpc64__) | |
| 42 | #define	PIC_PROLOGUE	XXX | |
| 43 | #define	PIC_EPILOGUE	XXX | |
| 44 | #define	PIC_PLT(x)	x@plt | |
| 45 | #ifdef	__STDC__ | |
| 46 | #define	PIC_GOT(x)	XXX | |
| 47 | #else	/* not __STDC__ */ | |
| 48 | #define	PIC_GOT(x)	XXX | |
| 49 | #endif	/* __STDC__ */ | |
| 50 | #else | |
| 51 | #define	PIC_PROLOGUE | |
| 52 | #define	PIC_EPILOGUE | |
| 53 | #define	PIC_PLT(x)	x | |
| 54 | #define PIC_GOT(x)	x | |
| 55 | #endif | |
| 56 | ||
| 57 | #define	CNAME(csym)		csym | |
| 58 | #define	ASMNAME(asmsym)		asmsym | |
| 59 | #ifdef __powerpc64__ | |
| 60 | #define	HIDENAME(asmsym)	__CONCAT(_,asmsym) | |
| 61 | #else | |
| 62 | #define	HIDENAME(asmsym)	__CONCAT(.,asmsym) | |
| 63 | #endif | |
| 64 | ||
| 65 | #if !defined(_CALL_ELF) || _CALL_ELF == 1 | |
| 66 | #ifdef _KERNEL | |
| 67 | /* ELFv1 kernel uses global dot symbols */ | |
| 68 | #define	DOT_LABEL(name)		__CONCAT(.,name) | |
| 69 | #define	TYPE_ENTRY(name)	.size	name,24; \ | |
| 70 | 				.type	DOT_LABEL(name),@function; \ | |
| 71 | 				.globl	DOT_LABEL(name); | |
| 72 | #define	END_SIZE(name)		.size	DOT_LABEL(name),.-DOT_LABEL(name); | |
| 73 | #else /* !_KERNEL */ | |
| 74 | /* ELFv1 user code uses local function entry points */ | |
| 75 | #define	DOT_LABEL(name)		__CONCAT(.L.,name) | |
| 76 | #define	TYPE_ENTRY(name)	.type	name,@function; | |
| 77 | #define	END_SIZE(name)		.size	name,.-DOT_LABEL(name); | |
| 78 | #endif /* _KERNEL */ | |
| 79 | #else | |
| 80 | /* ELFv2 doesn't have any of this complication */ | |
| 81 | #define	DOT_LABEL(name)		name | |
| 82 | #define	TYPE_ENTRY(name)	.type	name,@function; | |
| 83 | #define	END_SIZE(name)		.size	name,.-DOT_LABEL(name); | |
| 84 | #endif | |
| 85 | ||
| 86 | #define	_GLOBAL(name) \ | |
| 87 | 	.data; \ | |
| 88 | 	.p2align 2; \ | |
| 89 | 	.globl	name; \ | |
| 90 | 	name: | |
| 91 | ||
| 92 | #ifdef __powerpc64__ | |
| 93 | #define TOC_NAME_FOR_REF(name)	__CONCAT(.L,name) | |
| 94 | #define	TOC_REF(name)	TOC_NAME_FOR_REF(name)@toc | |
| 95 | #define TOC_ENTRY(name) \ | |
| 96 | 	.section ".toc","aw"; \ | |
| 97 | 	TOC_NAME_FOR_REF(name): \ | |
| 98 | .tc name[TC],name | |
| 99 | #endif | |
| 100 | ||
| 101 | #ifdef __powerpc64__ | |
| 102 | ||
| 103 | #if !defined(_CALL_ELF) || _CALL_ELF == 1 | |
| 104 | #define	_ENTRY(name) \ | |
| 105 | 	.section ".text"; \ | |
| 106 | 	.p2align 2; \ | |
| 107 | 	.globl	name; \ | |
| 108 | 	.section ".opd","aw"; \ | |
| 109 | 	.p2align 3; \ | |
| 110 | name: \ | |
| 111 | 	.quad	DOT_LABEL(name),.TOC.@tocbase,0; \ | |
| 112 | 	.previous; \ | |
| 113 | 	.p2align 4; \ | |
| 114 | 	TYPE_ENTRY(name) \ | |
| 115 | DOT_LABEL(name): \ | |
| 116 | 	.cfi_startproc | |
| 117 | #define	_NAKED_ENTRY(name)	_ENTRY(name) | |
| 118 | #else | |
| 119 | #define	_ENTRY(name) \ | |
| 120 | 	.text; \ | |
| 121 | 	.p2align 4; \ | |
| 122 | 	.globl	name; \ | |
| 123 | 	.type	name,@function; \ | |
| 124 | name: \ | |
| 125 | 	.cfi_startproc; \ | |
| 126 | 	addis	%r2, %r12, (.TOC.-name)@ha; \ | |
| 127 | 	addi	%r2, %r2, (.TOC.-name)@l; \ | |
| 128 | 	.localentry name, .-name; | |
| 129 | ||
| 130 | /* "Naked" function entry. No TOC prologue for ELFv2. */ | |
| 131 | #define	_NAKED_ENTRY(name) \ | |
| 132 | 	.text; \ | |
| 133 | 	.p2align 4; \ | |
| 134 | 	.globl	name; \ | |
| 135 | 	.type	name,@function; \ | |
| 136 | name: \ | |
| 137 | 	.cfi_startproc; \ | |
| 138 | 	.localentry name, .-name; | |
| 139 | #endif | |
| 140 | ||
| 141 | #define	_END(name) \ | |
| 142 | 	.cfi_endproc; \ | |
| 143 | 	.long	0; \ | |
| 144 | 	.byte	0,0,0,0,0,0,0,0; \ | |
| 145 | 	END_SIZE(name) | |
| 146 | ||
| 147 | #define	LOAD_ADDR(reg, var) \ | |
| 148 | 	lis	reg, var@highest; \ | |
| 149 | 	ori	reg, reg, var@higher; \ | |
| 150 | 	rldicr	reg, reg, 32, 31; \ | |
| 151 | 	oris	reg, reg, var@h; \ | |
| 152 | 	ori	reg, reg, var@l; | |
| 153 | #else /* !__powerpc64__ */ | |
| 154 | #define	_ENTRY(name) \ | |
| 155 | 	.text; \ | |
| 156 | 	.p2align 4; \ | |
| 157 | 	.globl	name; \ | |
| 158 | 	.type	name,@function; \ | |
| 159 | name: \ | |
| 160 | 	.cfi_startproc | |
| 161 | #define	_END(name) \ | |
| 162 | 	.cfi_endproc; \ | |
| 163 | 	.size	name, . - name | |
| 164 | ||
| 165 | #define _NAKED_ENTRY(name)	_ENTRY(name) | |
| 166 | ||
| 167 | #define	LOAD_ADDR(reg, var) \ | |
| 168 | 	lis	reg, var@ha; \ | |
| 169 | 	ori	reg, reg, var@l; | |
| 170 | #endif /* __powerpc64__ */ | |
| 171 | ||
| 172 | #if defined(PROF) || (defined(_KERNEL) && defined(GPROF)) | |
| 173 | # ifdef __powerpc64__ | |
| 174 | # define	_PROF_PROLOGUE	mflr 0;					\ | |
| 175 | 				std 3,48(1);				\ | |
| 176 | 				std 4,56(1);				\ | |
| 177 | 				std 5,64(1);				\ | |
| 178 | 				std 0,16(1);				\ | |
| 179 | 				stdu 1,-112(1);				\ | |
| 180 | 				bl _mcount;				\ | |
| 181 | 				nop;					\ | |
| 182 | 				ld 0,112+16(1);				\ | |
| 183 | 				ld 3,112+48(1);				\ | |
| 184 | 				ld 4,112+56(1);				\ | |
| 185 | 				ld 5,112+64(1);				\ | |
| 186 | 				mtlr 0;					\ | |
| 187 | 				addi 1,1,112 | |
| 188 | # else | |
| 189 | # define	_PROF_PROLOGUE	mflr 0; stw 0,4(1); bl _mcount | |
| 190 | # endif | |
| 191 | #else | |
| 192 | # define	_PROF_PROLOGUE | |
| 193 | #endif | |
| 194 | ||
| 195 | #define	ASEND(y)	_END(ASMNAME(y)) | |
| 196 | #define	ASENTRY(y)	_ENTRY(ASMNAME(y)); _PROF_PROLOGUE | |
| 197 | #define	END(y)		_END(CNAME(y)) | |
| 198 | #define	ENTRY(y)	_ENTRY(CNAME(y)); _PROF_PROLOGUE | |
| 199 | #define	GLOBAL(y)	_GLOBAL(CNAME(y)) | |
| 200 | ||
| 201 | #define	ASENTRY_NOPROF(y)	_ENTRY(ASMNAME(y)) | |
| 202 | #define	ENTRY_NOPROF(y)		_ENTRY(CNAME(y)) | |
| 203 | ||
| 204 | /* Load NIA without affecting branch prediction */ | |
| 205 | #define	LOAD_LR_NIA	bcl	20, 31, .+4 | |
| 206 | ||
| 207 | /* | |
| 208 | * Magic sequence to return to native endian. | |
| 209 | * Overwrites r0 and r11. | |
| 210 | * | |
| 211 | * The encoding of the instruction "tdi 0, %r0, 0x48" in opposite endian | |
| 212 | * happens to be "b . + 8". This is useful because we can write a sequence | |
| 213 | * of instructions that can execute in either endian. | |
| 214 | * | |
| 215 | * Use a sequence of handcoded instructions that switches contexts to the | |
| 216 | * instruction following the sequence, but with the correct PSL_LE bit. | |
| 217 | * | |
| 218 | * The same sequence works for both BE and LE because the xori will flip | |
| 219 | * the bit to the other state, and the code only runs when running in the | |
| 220 | * wrong endian. | |
| 221 | * | |
| 222 | * This sequence is NMI-reentrant. | |
| 223 | * | |
| 224 | * Do not change the length of this sequence without looking at the users, | |
| 225 | * this is used in size-constrained places like the reset vector! | |
| 226 | */ | |
| 227 | #define	RETURN_TO_NATIVE_ENDIAN						 \ | |
| 228 | 	tdi	0, %r0, 0x48;	/* Endian swapped: b . + 8		*/\ | |
| 229 | 	b	1f;		/* Will fall through to here if correct */\ | |
| 230 | 	.long	0xa600607d;	/* mfmsr %r11				*/\ | |
| 231 | 	.long	0x00000038;	/* li %r0, 0				*/\ | |
| 232 | 	.long	0x6401617d;	/* mtmsrd %r0, 1 (L=1 EE,RI bits only)	*/\ | |
| 233 | 	.long	0x01006b69;	/* xori %r11, %r11, 0x1 (PSL_LE)	*/\ | |
| 234 | 	.long	0xa602087c;	/* mflr %r0				*/\ | |
| 235 | 	.long	0x05009f42;	/* LOAD_LR_NIA				*/\ | |
| 236 | 	.long	0xa6037b7d;	/* 0: mtsrr1 %r11			*/\ | |
| 237 | 	.long	0xa602687d;	/* mflr	%r11				*/\ | |
| 238 | 	.long	0x18006b39;	/* addi	%r11, %r11, (1f - 0b)		*/\ | |
| 239 | 	.long	0xa6037a7d;	/* mtsrr0 %r11				*/\ | |
| 240 | 	.long	0xa603087c;	/* mtlr %r0				*/\ | |
| 241 | 	.long	0x2400004c;	/* rfid					*/\ | |
| 242 | 1:	/* RETURN_TO_NATIVE_ENDIAN */ | |
| 243 | ||
| 244 | #define	ASMSTR		.asciz | |
| 245 | ||
| 246 | #define	RCSID(x)	.text; .asciz x | |
| 247 | ||
| 248 | #undef __FBSDID | |
| 249 | #if !defined(lint) && !defined(STRIP_FBSDID) | |
| 250 | #define __FBSDID(s)	.ident s | |
| 251 | #else | |
| 252 | #define __FBSDID(s)	/* nothing */ | |
| 253 | #endif /* not lint and not STRIP_FBSDID */ | |
| 254 | ||
| 255 | #define	WEAK_REFERENCE(sym, alias)				\ | |
| 256 | 	.weak alias;						\ | |
| 257 | 	.equ alias,sym | |
| 258 | ||
| 259 | #ifdef __STDC__ | |
| 260 | #define	WARN_REFERENCES(_sym,_msg)				\ | |
| 261 | 	.section .gnu.warning. ## _sym ; .ascii _msg ; .text | |
| 262 | #else | |
| 263 | #define	WARN_REFERENCES(_sym,_msg)				\ | |
| 264 | 	.section .gnu.warning./**/_sym ; .ascii _msg ; .text | |
| 265 | #endif /* __STDC__ */ | |
| 266 | ||
| 267 | #endif /* !_MACHINE_ASM_H_ */ | |
| \ No newline at end of file |
lib/libc/include/powerpc64-freebsd-none/machine/atomic.h created+1183| ... | ... | @@ -0,0 +1,1183 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-2-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 2008 Marcel Moolenaar | |
| 5 | * Copyright (c) 2001 Benno Rice | |
| 6 | * Copyright (c) 2001 David E. O'Brien | |
| 7 | * Copyright (c) 1998 Doug Rabson | |
| 8 | * All rights reserved. | |
| 9 | * | |
| 10 | * Redistribution and use in source and binary forms, with or without | |
| 11 | * modification, are permitted provided that the following conditions | |
| 12 | * are met: | |
| 13 | * 1. Redistributions of source code must retain the above copyright | |
| 14 | * notice, this list of conditions and the following disclaimer. | |
| 15 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 16 | * notice, this list of conditions and the following disclaimer in the | |
| 17 | * documentation and/or other materials provided with the distribution. | |
| 18 | * | |
| 19 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |
| 20 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 21 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
| 22 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | |
| 23 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
| 24 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
| 25 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
| 26 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
| 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
| 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
| 29 | * SUCH DAMAGE. | |
| 30 | */ | |
| 31 | ||
| 32 | #ifndef _MACHINE_ATOMIC_H_ | |
| 33 | #define	_MACHINE_ATOMIC_H_ | |
| 34 | ||
| 35 | #include <sys/atomic_common.h> | |
| 36 | ||
| 37 | #ifndef __powerpc64__ | |
| 38 | #include <sys/_atomic64e.h> | |
| 39 | #endif | |
| 40 | ||
| 41 | /* | |
| 42 | * The __ATOMIC_REL/ACQ() macros provide memory barriers only in conjunction | |
| 43 | * with the atomic lXarx/stXcx. sequences below. They are not exposed outside | |
| 44 | * of this file. See also Appendix B.2 of Book II of the architecture manual. | |
| 45 | * | |
| 46 | * Note that not all Book-E processors accept the light-weight sync variant. | |
| 47 | * In particular, early models of E500 cores are known to wedge. Bank on all | |
| 48 | * 64-bit capable CPUs to accept lwsync properly and pressimize 32-bit CPUs | |
| 49 | * to use the heavier-weight sync. | |
| 50 | */ | |
| 51 | ||
| 52 | #ifdef __powerpc64__ | |
| 53 | #define mb()		__asm __volatile("sync" : : : "memory") | |
| 54 | #define rmb()		__asm __volatile("lwsync" : : : "memory") | |
| 55 | #define wmb()		__asm __volatile("lwsync" : : : "memory") | |
| 56 | #define __ATOMIC_REL()	__asm __volatile("lwsync" : : : "memory") | |
| 57 | #define __ATOMIC_ACQ()	__asm __volatile("isync" : : : "memory") | |
| 58 | #else | |
| 59 | #define mb()		__asm __volatile("sync" : : : "memory") | |
| 60 | #define rmb()		__asm __volatile("sync" : : : "memory") | |
| 61 | #define wmb()		__asm __volatile("sync" : : : "memory") | |
| 62 | #define __ATOMIC_REL()	__asm __volatile("sync" : : : "memory") | |
| 63 | #define __ATOMIC_ACQ()	__asm __volatile("isync" : : : "memory") | |
| 64 | #endif | |
| 65 | ||
| 66 | static __inline void | |
| 67 | powerpc_lwsync(void) | |
| 68 | { | |
| 69 | ||
| 70 | #ifdef __powerpc64__ | |
| 71 | 	__asm __volatile("lwsync" : : : "memory"); | |
| 72 | #else | |
| 73 | 	__asm __volatile("sync" : : : "memory"); | |
| 74 | #endif | |
| 75 | } | |
| 76 | ||
| 77 | /* | |
| 78 | * atomic_add(p, v) | |
| 79 | * { *p += v; } | |
| 80 | */ | |
| 81 | ||
| 82 | #define __atomic_add_int(p, v, t)				\ | |
| 83 | __asm __volatile(						\ | |
| 84 | 	"1:	lwarx	%0, 0, %2\n"				\ | |
| 85 | 	"	add	%0, %3, %0\n"				\ | |
| 86 | 	"	stwcx.	%0, 0, %2\n"				\ | |
| 87 | 	"	bne-	1b\n"					\ | |
| 88 | 	: "=&r" (t), "=m" (*p)					\ | |
| 89 | 	: "r" (p), "r" (v), "m" (*p)				\ | |
| 90 | 	: "cr0", "memory")					\ | |
| 91 | /* __atomic_add_int */ | |
| 92 | ||
| 93 | #ifdef __powerpc64__ | |
| 94 | #define __atomic_add_long(p, v, t)				\ | |
| 95 | __asm __volatile(						\ | |
| 96 | 	"1:	ldarx	%0, 0, %2\n"				\ | |
| 97 | 	"	add	%0, %3, %0\n"				\ | |
| 98 | 	"	stdcx.	%0, 0, %2\n"				\ | |
| 99 | 	"	bne-	1b\n"					\ | |
| 100 | 	: "=&r" (t), "=m" (*p)					\ | |
| 101 | 	: "r" (p), "r" (v), "m" (*p)				\ | |
| 102 | 	: "cr0", "memory")					\ | |
| 103 | /* __atomic_add_long */ | |
| 104 | #else | |
| 105 | #define	__atomic_add_long(p, v, t)				\ | |
| 106 | __asm __volatile(						\ | |
| 107 | 	"1:	lwarx	%0, 0, %2\n"				\ | |
| 108 | 	"	add	%0, %3, %0\n"				\ | |
| 109 | 	"	stwcx.	%0, 0, %2\n"				\ | |
| 110 | 	"	bne-	1b\n"					\ | |
| 111 | 	: "=&r" (t), "=m" (*p)					\ | |
| 112 | 	: "r" (p), "r" (v), "m" (*p)				\ | |
| 113 | 	: "cr0", "memory")					\ | |
| 114 | /* __atomic_add_long */ | |
| 115 | #endif | |
| 116 | ||
| 117 | #define	_ATOMIC_ADD(type)					\ | |
| 118 | static __inline void					\ | |
| 119 | atomic_add_##type(volatile u_##type *p, u_##type v) {	\ | |
| 120 | 	u_##type t;						\ | |
| 121 | 	__atomic_add_##type(p, v, t);				\ | |
| 122 | }								\ | |
| 123 | 								\ | |
| 124 | static __inline void					\ | |
| 125 | atomic_add_acq_##type(volatile u_##type *p, u_##type v) {	\ | |
| 126 | 	u_##type t;						\ | |
| 127 | 	__atomic_add_##type(p, v, t);				\ | |
| 128 | 	__ATOMIC_ACQ();						\ | |
| 129 | }								\ | |
| 130 | 								\ | |
| 131 | static __inline void					\ | |
| 132 | atomic_add_rel_##type(volatile u_##type *p, u_##type v) {	\ | |
| 133 | 	u_##type t;						\ | |
| 134 | 	__ATOMIC_REL();						\ | |
| 135 | 	__atomic_add_##type(p, v, t);				\ | |
| 136 | }								\ | |
| 137 | /* _ATOMIC_ADD */ | |
| 138 | ||
| 139 | _ATOMIC_ADD(int) | |
| 140 | _ATOMIC_ADD(long) | |
| 141 | ||
| 142 | #define	atomic_add_32		atomic_add_int | |
| 143 | #define	atomic_add_acq_32	atomic_add_acq_int | |
| 144 | #define	atomic_add_rel_32	atomic_add_rel_int | |
| 145 | ||
| 146 | #ifdef __powerpc64__ | |
| 147 | #define	atomic_add_64		atomic_add_long | |
| 148 | #define	atomic_add_acq_64	atomic_add_acq_long | |
| 149 | #define	atomic_add_rel_64	atomic_add_rel_long | |
| 150 | ||
| 151 | #define	atomic_add_ptr		atomic_add_long | |
| 152 | #define	atomic_add_acq_ptr	atomic_add_acq_long | |
| 153 | #define	atomic_add_rel_ptr	atomic_add_rel_long | |
| 154 | #else | |
| 155 | #define	atomic_add_ptr		atomic_add_int | |
| 156 | #define	atomic_add_acq_ptr	atomic_add_acq_int | |
| 157 | #define	atomic_add_rel_ptr	atomic_add_rel_int | |
| 158 | #endif | |
| 159 | #undef _ATOMIC_ADD | |
| 160 | #undef __atomic_add_long | |
| 161 | #undef __atomic_add_int | |
| 162 | ||
| 163 | /* | |
| 164 | * atomic_clear(p, v) | |
| 165 | * { *p &= ~v; } | |
| 166 | */ | |
| 167 | ||
| 168 | #define __atomic_clear_int(p, v, t)				\ | |
| 169 | __asm __volatile(						\ | |
| 170 | 	"1:	lwarx	%0, 0, %2\n"				\ | |
| 171 | 	"	andc	%0, %0, %3\n"				\ | |
| 172 | 	"	stwcx.	%0, 0, %2\n"				\ | |
| 173 | 	"	bne-	1b\n"					\ | |
| 174 | 	: "=&r" (t), "=m" (*p)					\ | |
| 175 | 	: "r" (p), "r" (v), "m" (*p)				\ | |
| 176 | 	: "cr0", "memory")					\ | |
| 177 | /* __atomic_clear_int */ | |
| 178 | ||
| 179 | #ifdef __powerpc64__ | |
| 180 | #define __atomic_clear_long(p, v, t)				\ | |
| 181 | __asm __volatile(						\ | |
| 182 | 	"1:	ldarx	%0, 0, %2\n"				\ | |
| 183 | 	"	andc	%0, %0, %3\n"				\ | |
| 184 | 	"	stdcx.	%0, 0, %2\n"				\ | |
| 185 | 	"	bne-	1b\n"					\ | |
| 186 | 	: "=&r" (t), "=m" (*p)					\ | |
| 187 | 	: "r" (p), "r" (v), "m" (*p)				\ | |
| 188 | 	: "cr0", "memory")					\ | |
| 189 | /* __atomic_clear_long */ | |
| 190 | #else | |
| 191 | #define	__atomic_clear_long(p, v, t)				\ | |
| 192 | __asm __volatile(						\ | |
| 193 | 	"1:	lwarx	%0, 0, %2\n"				\ | |
| 194 | 	"	andc	%0, %0, %3\n"				\ | |
| 195 | 	"	stwcx.	%0, 0, %2\n"				\ | |
| 196 | 	"	bne-	1b\n"					\ | |
| 197 | 	: "=&r" (t), "=m" (*p)					\ | |
| 198 | 	: "r" (p), "r" (v), "m" (*p)				\ | |
| 199 | 	: "cr0", "memory")					\ | |
| 200 | /* __atomic_clear_long */ | |
| 201 | #endif | |
| 202 | ||
| 203 | #define	_ATOMIC_CLEAR(type)					\ | |
| 204 | static __inline void					\ | |
| 205 | atomic_clear_##type(volatile u_##type *p, u_##type v) {	\ | |
| 206 | 	u_##type t;						\ | |
| 207 | 	__atomic_clear_##type(p, v, t);				\ | |
| 208 | }								\ | |
| 209 | 								\ | |
| 210 | static __inline void					\ | |
| 211 | atomic_clear_acq_##type(volatile u_##type *p, u_##type v) {	\ | |
| 212 | 	u_##type t;						\ | |
| 213 | 	__atomic_clear_##type(p, v, t);				\ | |
| 214 | 	__ATOMIC_ACQ();						\ | |
| 215 | }								\ | |
| 216 | 								\ | |
| 217 | static __inline void					\ | |
| 218 | atomic_clear_rel_##type(volatile u_##type *p, u_##type v) {	\ | |
| 219 | 	u_##type t;						\ | |
| 220 | 	__ATOMIC_REL();						\ | |
| 221 | 	__atomic_clear_##type(p, v, t);				\ | |
| 222 | }								\ | |
| 223 | /* _ATOMIC_CLEAR */ | |
| 224 | ||
| 225 | _ATOMIC_CLEAR(int) | |
| 226 | _ATOMIC_CLEAR(long) | |
| 227 | ||
| 228 | #define	atomic_clear_32		atomic_clear_int | |
| 229 | #define	atomic_clear_acq_32	atomic_clear_acq_int | |
| 230 | #define	atomic_clear_rel_32	atomic_clear_rel_int | |
| 231 | ||
| 232 | #ifdef __powerpc64__ | |
| 233 | #define	atomic_clear_64		atomic_clear_long | |
| 234 | #define	atomic_clear_acq_64	atomic_clear_acq_long | |
| 235 | #define	atomic_clear_rel_64	atomic_clear_rel_long | |
| 236 | ||
| 237 | #define	atomic_clear_ptr	atomic_clear_long | |
| 238 | #define	atomic_clear_acq_ptr	atomic_clear_acq_long | |
| 239 | #define	atomic_clear_rel_ptr	atomic_clear_rel_long | |
| 240 | #else | |
| 241 | #define	atomic_clear_ptr	atomic_clear_int | |
| 242 | #define	atomic_clear_acq_ptr	atomic_clear_acq_int | |
| 243 | #define	atomic_clear_rel_ptr	atomic_clear_rel_int | |
| 244 | #endif | |
| 245 | #undef _ATOMIC_CLEAR | |
| 246 | #undef __atomic_clear_long | |
| 247 | #undef __atomic_clear_int | |
| 248 | ||
| 249 | /* | |
| 250 | * atomic_cmpset(p, o, n) | |
| 251 | */ | |
| 252 | /* TODO -- see below */ | |
| 253 | ||
| 254 | /* | |
| 255 | * atomic_load_acq(p) | |
| 256 | */ | |
| 257 | /* TODO -- see below */ | |
| 258 | ||
| 259 | /* | |
| 260 | * atomic_readandclear(p) | |
| 261 | */ | |
| 262 | /* TODO -- see below */ | |
| 263 | ||
| 264 | /* | |
| 265 | * atomic_set(p, v) | |
| 266 | * { *p |= v; } | |
| 267 | */ | |
| 268 | ||
| 269 | #define __atomic_set_int(p, v, t)				\ | |
| 270 | __asm __volatile(						\ | |
| 271 | 	"1:	lwarx	%0, 0, %2\n"				\ | |
| 272 | 	"	or	%0, %3, %0\n"				\ | |
| 273 | 	"	stwcx.	%0, 0, %2\n"				\ | |
| 274 | 	"	bne-	1b\n"					\ | |
| 275 | 	: "=&r" (t), "=m" (*p)					\ | |
| 276 | 	: "r" (p), "r" (v), "m" (*p)				\ | |
| 277 | 	: "cr0", "memory")					\ | |
| 278 | /* __atomic_set_int */ | |
| 279 | ||
| 280 | #ifdef __powerpc64__ | |
| 281 | #define __atomic_set_long(p, v, t)				\ | |
| 282 | __asm __volatile(						\ | |
| 283 | 	"1:	ldarx	%0, 0, %2\n"				\ | |
| 284 | 	"	or	%0, %3, %0\n"				\ | |
| 285 | 	"	stdcx.	%0, 0, %2\n"				\ | |
| 286 | 	"	bne-	1b\n"					\ | |
| 287 | 	: "=&r" (t), "=m" (*p)					\ | |
| 288 | 	: "r" (p), "r" (v), "m" (*p)				\ | |
| 289 | 	: "cr0", "memory")					\ | |
| 290 | /* __atomic_set_long */ | |
| 291 | #else | |
| 292 | #define	__atomic_set_long(p, v, t)				\ | |
| 293 | __asm __volatile(						\ | |
| 294 | 	"1:	lwarx	%0, 0, %2\n"				\ | |
| 295 | 	"	or	%0, %3, %0\n"				\ | |
| 296 | 	"	stwcx.	%0, 0, %2\n"				\ | |
| 297 | 	"	bne-	1b\n"					\ | |
| 298 | 	: "=&r" (t), "=m" (*p)					\ | |
| 299 | 	: "r" (p), "r" (v), "m" (*p)				\ | |
| 300 | 	: "cr0", "memory")					\ | |
| 301 | /* __atomic_set_long */ | |
| 302 | #endif | |
| 303 | ||
| 304 | #define	_ATOMIC_SET(type)					\ | |
| 305 | static __inline void					\ | |
| 306 | atomic_set_##type(volatile u_##type *p, u_##type v) {	\ | |
| 307 | 	u_##type t;						\ | |
| 308 | 	__atomic_set_##type(p, v, t);				\ | |
| 309 | }								\ | |
| 310 | 								\ | |
| 311 | static __inline void					\ | |
| 312 | atomic_set_acq_##type(volatile u_##type *p, u_##type v) {	\ | |
| 313 | 	u_##type t;						\ | |
| 314 | 	__atomic_set_##type(p, v, t);				\ | |
| 315 | 	__ATOMIC_ACQ();						\ | |
| 316 | }								\ | |
| 317 | 								\ | |
| 318 | static __inline void					\ | |
| 319 | atomic_set_rel_##type(volatile u_##type *p, u_##type v) {	\ | |
| 320 | 	u_##type t;						\ | |
| 321 | 	__ATOMIC_REL();						\ | |
| 322 | 	__atomic_set_##type(p, v, t);				\ | |
| 323 | }								\ | |
| 324 | /* _ATOMIC_SET */ | |
| 325 | ||
| 326 | _ATOMIC_SET(int) | |
| 327 | _ATOMIC_SET(long) | |
| 328 | ||
| 329 | #define	atomic_set_32		atomic_set_int | |
| 330 | #define	atomic_set_acq_32	atomic_set_acq_int | |
| 331 | #define	atomic_set_rel_32	atomic_set_rel_int | |
| 332 | ||
| 333 | #ifdef __powerpc64__ | |
| 334 | #define	atomic_set_64		atomic_set_long | |
| 335 | #define	atomic_set_acq_64	atomic_set_acq_long | |
| 336 | #define	atomic_set_rel_64	atomic_set_rel_long | |
| 337 | ||
| 338 | #define	atomic_set_ptr		atomic_set_long | |
| 339 | #define	atomic_set_acq_ptr	atomic_set_acq_long | |
| 340 | #define	atomic_set_rel_ptr	atomic_set_rel_long | |
| 341 | #else | |
| 342 | #define	atomic_set_ptr		atomic_set_int | |
| 343 | #define	atomic_set_acq_ptr	atomic_set_acq_int | |
| 344 | #define	atomic_set_rel_ptr	atomic_set_rel_int | |
| 345 | #endif | |
| 346 | #undef _ATOMIC_SET | |
| 347 | #undef __atomic_set_long | |
| 348 | #undef __atomic_set_int | |
| 349 | ||
| 350 | /* | |
| 351 | * atomic_subtract(p, v) | |
| 352 | * { *p -= v; } | |
| 353 | */ | |
| 354 | ||
| 355 | #define __atomic_subtract_int(p, v, t)				\ | |
| 356 | __asm __volatile(						\ | |
| 357 | 	"1:	lwarx	%0, 0, %2\n"				\ | |
| 358 | 	"	subf	%0, %3, %0\n"				\ | |
| 359 | 	"	stwcx.	%0, 0, %2\n"				\ | |
| 360 | 	"	bne-	1b\n"					\ | |
| 361 | 	: "=&r" (t), "=m" (*p)					\ | |
| 362 | 	: "r" (p), "r" (v), "m" (*p)				\ | |
| 363 | 	: "cr0", "memory")					\ | |
| 364 | /* __atomic_subtract_int */ | |
| 365 | ||
| 366 | #ifdef __powerpc64__ | |
| 367 | #define __atomic_subtract_long(p, v, t)				\ | |
| 368 | __asm __volatile(						\ | |
| 369 | 	"1:	ldarx	%0, 0, %2\n"				\ | |
| 370 | 	"	subf	%0, %3, %0\n"				\ | |
| 371 | 	"	stdcx.	%0, 0, %2\n"				\ | |
| 372 | 	"	bne-	1b\n"					\ | |
| 373 | 	: "=&r" (t), "=m" (*p)					\ | |
| 374 | 	: "r" (p), "r" (v), "m" (*p)				\ | |
| 375 | 	: "cr0", "memory")					\ | |
| 376 | /* __atomic_subtract_long */ | |
| 377 | #else | |
| 378 | #define	__atomic_subtract_long(p, v, t)				\ | |
| 379 | __asm __volatile(						\ | |
| 380 | 	"1:	lwarx	%0, 0, %2\n"				\ | |
| 381 | 	"	subf	%0, %3, %0\n"				\ | |
| 382 | 	"	stwcx.	%0, 0, %2\n"				\ | |
| 383 | 	"	bne-	1b\n"					\ | |
| 384 | 	: "=&r" (t), "=m" (*p)					\ | |
| 385 | 	: "r" (p), "r" (v), "m" (*p)				\ | |
| 386 | 	: "cr0", "memory")					\ | |
| 387 | /* __atomic_subtract_long */ | |
| 388 | #endif | |
| 389 | ||
| 390 | #define	_ATOMIC_SUBTRACT(type)						\ | |
| 391 | static __inline void						\ | |
| 392 | atomic_subtract_##type(volatile u_##type *p, u_##type v) {		\ | |
| 393 | 	u_##type t;							\ | |
| 394 | 	__atomic_subtract_##type(p, v, t);				\ | |
| 395 | }									\ | |
| 396 | 									\ | |
| 397 | static __inline void						\ | |
| 398 | atomic_subtract_acq_##type(volatile u_##type *p, u_##type v) {	\ | |
| 399 | 	u_##type t;							\ | |
| 400 | 	__atomic_subtract_##type(p, v, t);				\ | |
| 401 | 	__ATOMIC_ACQ();							\ | |
| 402 | }									\ | |
| 403 | 									\ | |
| 404 | static __inline void						\ | |
| 405 | atomic_subtract_rel_##type(volatile u_##type *p, u_##type v) {	\ | |
| 406 | 	u_##type t;							\ | |
| 407 | 	__ATOMIC_REL();							\ | |
| 408 | 	__atomic_subtract_##type(p, v, t);				\ | |
| 409 | }									\ | |
| 410 | /* _ATOMIC_SUBTRACT */ | |
| 411 | ||
| 412 | _ATOMIC_SUBTRACT(int) | |
| 413 | _ATOMIC_SUBTRACT(long) | |
| 414 | ||
| 415 | #define	atomic_subtract_32	atomic_subtract_int | |
| 416 | #define	atomic_subtract_acq_32	atomic_subtract_acq_int | |
| 417 | #define	atomic_subtract_rel_32	atomic_subtract_rel_int | |
| 418 | ||
| 419 | #ifdef __powerpc64__ | |
| 420 | #define	atomic_subtract_64	atomic_subtract_long | |
| 421 | #define	atomic_subtract_acq_64	atomic_subract_acq_long | |
| 422 | #define	atomic_subtract_rel_64	atomic_subtract_rel_long | |
| 423 | ||
| 424 | #define	atomic_subtract_ptr	atomic_subtract_long | |
| 425 | #define	atomic_subtract_acq_ptr	atomic_subtract_acq_long | |
| 426 | #define	atomic_subtract_rel_ptr	atomic_subtract_rel_long | |
| 427 | #else | |
| 428 | #define	atomic_subtract_ptr	atomic_subtract_int | |
| 429 | #define	atomic_subtract_acq_ptr	atomic_subtract_acq_int | |
| 430 | #define	atomic_subtract_rel_ptr	atomic_subtract_rel_int | |
| 431 | #endif | |
| 432 | #undef _ATOMIC_SUBTRACT | |
| 433 | #undef __atomic_subtract_long | |
| 434 | #undef __atomic_subtract_int | |
| 435 | ||
| 436 | /* | |
| 437 | * atomic_store_rel(p, v) | |
| 438 | */ | |
| 439 | /* TODO -- see below */ | |
| 440 | ||
| 441 | /* | |
| 442 | * Old/original implementations that still need revisiting. | |
| 443 | */ | |
| 444 | ||
| 445 | static __inline u_int | |
| 446 | atomic_readandclear_int(volatile u_int *addr) | |
| 447 | { | |
| 448 | 	u_int result,temp; | |
| 449 | ||
| 450 | 	__asm __volatile ( | |
| 451 | 		"\tsync\n"			/* drain writes */ | |
| 452 | 		"1:\tlwarx %0, 0, %3\n\t"	/* load old value */ | |
| 453 | 		"li %1, 0\n\t"			/* load new value */ | |
| 454 | 		"stwcx. %1, 0, %3\n\t" 	/* attempt to store */ | |
| 455 | 		"bne- 1b\n\t"			/* spin if failed */ | |
| 456 | 		: "=&r"(result), "=&r"(temp), "=m" (*addr) | |
| 457 | 		: "r" (addr), "m" (*addr) | |
| 458 | 		: "cr0", "memory"); | |
| 459 | ||
| 460 | 	return (result); | |
| 461 | } | |
| 462 | ||
| 463 | #ifdef __powerpc64__ | |
| 464 | static __inline u_long | |
| 465 | atomic_readandclear_long(volatile u_long *addr) | |
| 466 | { | |
| 467 | 	u_long result,temp; | |
| 468 | ||
| 469 | 	__asm __volatile ( | |
| 470 | 		"\tsync\n"			/* drain writes */ | |
| 471 | 		"1:\tldarx %0, 0, %3\n\t"	/* load old value */ | |
| 472 | 		"li %1, 0\n\t"			/* load new value */ | |
| 473 | 		"stdcx. %1, 0, %3\n\t" 	/* attempt to store */ | |
| 474 | 		"bne- 1b\n\t"			/* spin if failed */ | |
| 475 | 		: "=&r"(result), "=&r"(temp), "=m" (*addr) | |
| 476 | 		: "r" (addr), "m" (*addr) | |
| 477 | 		: "cr0", "memory"); | |
| 478 | ||
| 479 | 	return (result); | |
| 480 | } | |
| 481 | #endif | |
| 482 | ||
| 483 | #define	atomic_readandclear_32		atomic_readandclear_int | |
| 484 | ||
| 485 | #ifdef __powerpc64__ | |
| 486 | #define	atomic_readandclear_64		atomic_readandclear_long | |
| 487 | ||
| 488 | #define	atomic_readandclear_ptr		atomic_readandclear_long | |
| 489 | #else | |
| 490 | static __inline u_long | |
| 491 | atomic_readandclear_long(volatile u_long *addr) | |
| 492 | { | |
| 493 | ||
| 494 | 	return ((u_long)atomic_readandclear_int((volatile u_int *)addr)); | |
| 495 | } | |
| 496 | ||
| 497 | #define	atomic_readandclear_ptr		atomic_readandclear_int | |
| 498 | #endif | |
| 499 | ||
| 500 | /* | |
| 501 | * We assume that a = b will do atomic loads and stores. | |
| 502 | */ | |
| 503 | #define	ATOMIC_STORE_LOAD(TYPE)					\ | |
| 504 | static __inline u_##TYPE					\ | |
| 505 | atomic_load_acq_##TYPE(const volatile u_##TYPE *p)		\ | |
| 506 | {								\ | |
| 507 | 	u_##TYPE v;						\ | |
| 508 | 								\ | |
| 509 | 	v = *p;							\ | |
| 510 | 	powerpc_lwsync();					\ | |
| 511 | 	return (v);						\ | |
| 512 | }								\ | |
| 513 | 								\ | |
| 514 | static __inline void						\ | |
| 515 | atomic_store_rel_##TYPE(volatile u_##TYPE *p, u_##TYPE v)	\ | |
| 516 | {								\ | |
| 517 | 								\ | |
| 518 | 	powerpc_lwsync();					\ | |
| 519 | 	*p = v;							\ | |
| 520 | } | |
| 521 | ||
| 522 | ATOMIC_STORE_LOAD(int) | |
| 523 | ||
| 524 | #define	atomic_load_acq_32	atomic_load_acq_int | |
| 525 | #define	atomic_store_rel_32	atomic_store_rel_int | |
| 526 | ||
| 527 | #ifdef __powerpc64__ | |
| 528 | ATOMIC_STORE_LOAD(long) | |
| 529 | ||
| 530 | #define	atomic_load_acq_64	atomic_load_acq_long | |
| 531 | #define	atomic_store_rel_64	atomic_store_rel_long | |
| 532 | ||
| 533 | #define	atomic_load_acq_ptr	atomic_load_acq_long | |
| 534 | #define	atomic_store_rel_ptr	atomic_store_rel_long | |
| 535 | #else | |
| 536 | static __inline u_long | |
| 537 | atomic_load_acq_long(const volatile u_long *addr) | |
| 538 | { | |
| 539 | ||
| 540 | 	return ((u_long)atomic_load_acq_int((const volatile u_int *)addr)); | |
| 541 | } | |
| 542 | ||
| 543 | static __inline void | |
| 544 | atomic_store_rel_long(volatile u_long *addr, u_long val) | |
| 545 | { | |
| 546 | ||
| 547 | 	atomic_store_rel_int((volatile u_int *)addr, (u_int)val); | |
| 548 | } | |
| 549 | ||
| 550 | #define	atomic_load_acq_ptr	atomic_load_acq_int | |
| 551 | #define	atomic_store_rel_ptr	atomic_store_rel_int | |
| 552 | #endif | |
| 553 | #undef ATOMIC_STORE_LOAD | |
| 554 | ||
| 555 | /* | |
| 556 | * Atomically compare the value stored at *p with cmpval and if the | |
| 557 | * two values are equal, update the value of *p with newval. Returns | |
| 558 | * zero if the compare failed, nonzero otherwise. | |
| 559 | */ | |
| 560 | #ifdef ISA_206_ATOMICS | |
| 561 | static __inline int | |
| 562 | atomic_cmpset_char(volatile u_char *p, u_char cmpval, u_char newval) | |
| 563 | { | |
| 564 | 	int	ret; | |
| 565 | ||
| 566 | 	__asm __volatile ( | |
| 567 | 		"1:\tlbarx %0, 0, %2\n\t"	/* load old value */ | |
| 568 | 		"cmplw %3, %0\n\t"		/* compare */ | |
| 569 | 		"bne- 2f\n\t"			/* exit if not equal */ | |
| 570 | 		"stbcx. %4, 0, %2\n\t" 	/* attempt to store */ | |
| 571 | 		"bne- 1b\n\t"			/* spin if failed */ | |
| 572 | 		"li %0, 1\n\t"			/* success - retval = 1 */ | |
| 573 | 		"b 3f\n\t"			/* we've succeeded */ | |
| 574 | 		"2:\n\t" | |
| 575 | 		"stbcx. %0, 0, %2\n\t" 	/* clear reservation (74xx) */ | |
| 576 | 		"li %0, 0\n\t"			/* failure - retval = 0 */ | |
| 577 | 		"3:\n\t" | |
| 578 | 		: "=&r" (ret), "=m" (*p) | |
| 579 | 		: "r" (p), "r" (cmpval), "r" (newval), "m" (*p) | |
| 580 | 		: "cr0", "memory"); | |
| 581 | ||
| 582 | 	return (ret); | |
| 583 | } | |
| 584 | ||
| 585 | static __inline int | |
| 586 | atomic_cmpset_short(volatile u_short *p, u_short cmpval, u_short newval) | |
| 587 | { | |
| 588 | 	int	ret; | |
| 589 | ||
| 590 | 	__asm __volatile ( | |
| 591 | 		"1:\tlharx %0, 0, %2\n\t"	/* load old value */ | |
| 592 | 		"cmplw %3, %0\n\t"		/* compare */ | |
| 593 | 		"bne- 2f\n\t"			/* exit if not equal */ | |
| 594 | 		"sthcx. %4, 0, %2\n\t" 	/* attempt to store */ | |
| 595 | 		"bne- 1b\n\t"			/* spin if failed */ | |
| 596 | 		"li %0, 1\n\t"			/* success - retval = 1 */ | |
| 597 | 		"b 3f\n\t"			/* we've succeeded */ | |
| 598 | 		"2:\n\t" | |
| 599 | 		"sthcx. %0, 0, %2\n\t" 	/* clear reservation (74xx) */ | |
| 600 | 		"li %0, 0\n\t"			/* failure - retval = 0 */ | |
| 601 | 		"3:\n\t" | |
| 602 | 		: "=&r" (ret), "=m" (*p) | |
| 603 | 		: "r" (p), "r" (cmpval), "r" (newval), "m" (*p) | |
| 604 | 		: "cr0", "memory"); | |
| 605 | ||
| 606 | 	return (ret); | |
| 607 | } | |
| 608 | #else | |
| 609 | static __inline int | |
| 610 | atomic_cmpset_masked(uint32_t *p, uint32_t cmpval, uint32_t newval, | |
| 611 | uint32_t mask) | |
| 612 | { | |
| 613 | 	int		ret; | |
| 614 | 	uint32_t	tmp; | |
| 615 | ||
| 616 | 	__asm __volatile ( | |
| 617 | 		"1:\tlwarx %2, 0, %3\n\t"	/* load old value */ | |
| 618 | 		"and %0, %2, %7\n\t" | |
| 619 | 		"cmplw %4, %0\n\t"		/* compare */ | |
| 620 | 		"bne- 2f\n\t"			/* exit if not equal */ | |
| 621 | 		"andc %2, %2, %7\n\t" | |
| 622 | 		"or %2, %2, %5\n\t" | |
| 623 | 		"stwcx. %2, 0, %3\n\t" 	/* attempt to store */ | |
| 624 | 		"bne- 1b\n\t"			/* spin if failed */ | |
| 625 | 		"li %0, 1\n\t"			/* success - retval = 1 */ | |
| 626 | 		"b 3f\n\t"			/* we've succeeded */ | |
| 627 | 		"2:\n\t" | |
| 628 | 		"stwcx. %2, 0, %3\n\t" 	/* clear reservation (74xx) */ | |
| 629 | 		"li %0, 0\n\t"			/* failure - retval = 0 */ | |
| 630 | 		"3:\n\t" | |
| 631 | 		: "=&r" (ret), "=m" (*p), "+&r" (tmp) | |
| 632 | 		: "r" (p), "r" (cmpval), "r" (newval), "m" (*p), | |
| 633 | 		 "r" (mask) | |
| 634 | 		: "cr0", "memory"); | |
| 635 | ||
| 636 | 	return (ret); | |
| 637 | } | |
| 638 | ||
| 639 | #define	_atomic_cmpset_masked_word(a,o,v,m) atomic_cmpset_masked(a, o, v, m) | |
| 640 | #endif | |
| 641 | ||
| 642 | static __inline int | |
| 643 | atomic_cmpset_int(volatile u_int* p, u_int cmpval, u_int newval) | |
| 644 | { | |
| 645 | 	int	ret; | |
| 646 | ||
| 647 | 	__asm __volatile ( | |
| 648 | 		"1:\tlwarx %0, 0, %2\n\t"	/* load old value */ | |
| 649 | 		"cmplw %3, %0\n\t"		/* compare */ | |
| 650 | 		"bne- 2f\n\t"			/* exit if not equal */ | |
| 651 | 		"stwcx. %4, 0, %2\n\t" 	/* attempt to store */ | |
| 652 | 		"bne- 1b\n\t"			/* spin if failed */ | |
| 653 | 		"li %0, 1\n\t"			/* success - retval = 1 */ | |
| 654 | 		"b 3f\n\t"			/* we've succeeded */ | |
| 655 | 		"2:\n\t" | |
| 656 | 		"stwcx. %0, 0, %2\n\t" 	/* clear reservation (74xx) */ | |
| 657 | 		"li %0, 0\n\t"			/* failure - retval = 0 */ | |
| 658 | 		"3:\n\t" | |
| 659 | 		: "=&r" (ret), "=m" (*p) | |
| 660 | 		: "r" (p), "r" (cmpval), "r" (newval), "m" (*p) | |
| 661 | 		: "cr0", "memory"); | |
| 662 | ||
| 663 | 	return (ret); | |
| 664 | } | |
| 665 | static __inline int | |
| 666 | atomic_cmpset_long(volatile u_long* p, u_long cmpval, u_long newval) | |
| 667 | { | |
| 668 | 	int ret; | |
| 669 | ||
| 670 | 	__asm __volatile ( | |
| 671 | 	 #ifdef __powerpc64__ | |
| 672 | 		"1:\tldarx %0, 0, %2\n\t"	/* load old value */ | |
| 673 | 		"cmpld %3, %0\n\t"		/* compare */ | |
| 674 | 		"bne- 2f\n\t"			/* exit if not equal */ | |
| 675 | 		"stdcx. %4, 0, %2\n\t"		/* attempt to store */ | |
| 676 | 	 #else | |
| 677 | 		"1:\tlwarx %0, 0, %2\n\t"	/* load old value */ | |
| 678 | 		"cmplw %3, %0\n\t"		/* compare */ | |
| 679 | 		"bne- 2f\n\t"			/* exit if not equal */ | |
| 680 | 		"stwcx. %4, 0, %2\n\t"		/* attempt to store */ | |
| 681 | 	 #endif | |
| 682 | 		"bne- 1b\n\t"			/* spin if failed */ | |
| 683 | 		"li %0, 1\n\t"			/* success - retval = 1 */ | |
| 684 | 		"b 3f\n\t"			/* we've succeeded */ | |
| 685 | 		"2:\n\t" | |
| 686 | 	 #ifdef __powerpc64__ | |
| 687 | 		"stdcx. %0, 0, %2\n\t"		/* clear reservation (74xx) */ | |
| 688 | 	 #else | |
| 689 | 		"stwcx. %0, 0, %2\n\t"		/* clear reservation (74xx) */ | |
| 690 | 	 #endif | |
| 691 | 		"li %0, 0\n\t"			/* failure - retval = 0 */ | |
| 692 | 		"3:\n\t" | |
| 693 | 		: "=&r" (ret), "=m" (*p) | |
| 694 | 		: "r" (p), "r" (cmpval), "r" (newval), "m" (*p) | |
| 695 | 		: "cr0", "memory"); | |
| 696 | ||
| 697 | 	return (ret); | |
| 698 | } | |
| 699 | ||
| 700 | #define	ATOMIC_CMPSET_ACQ_REL(type) \ | |
| 701 | static __inline int \ | |
| 702 | atomic_cmpset_acq_##type(volatile u_##type *p, \ | |
| 703 | 	 u_##type cmpval, u_##type newval)\ | |
| 704 | {\ | |
| 705 | 	u_##type retval; \ | |
| 706 | 	retval = atomic_cmpset_##type(p, cmpval, newval);\ | |
| 707 | 	__ATOMIC_ACQ();\ | |
| 708 | 	return (retval);\ | |
| 709 | }\ | |
| 710 | static __inline int \ | |
| 711 | atomic_cmpset_rel_##type(volatile u_##type *p, \ | |
| 712 | 	 u_##type cmpval, u_##type newval)\ | |
| 713 | {\ | |
| 714 | 	__ATOMIC_REL();\ | |
| 715 | 	return (atomic_cmpset_##type(p, cmpval, newval));\ | |
| 716 | }\ | |
| 717 | struct hack | |
| 718 | ||
| 719 | ATOMIC_CMPSET_ACQ_REL(int); | |
| 720 | ATOMIC_CMPSET_ACQ_REL(long); | |
| 721 | ||
| 722 | #ifdef ISA_206_ATOMICS | |
| 723 | #define	atomic_cmpset_8		atomic_cmpset_char | |
| 724 | #endif | |
| 725 | #define	atomic_cmpset_acq_8	atomic_cmpset_acq_char | |
| 726 | #define	atomic_cmpset_rel_8	atomic_cmpset_rel_char | |
| 727 | ||
| 728 | #ifdef ISA_206_ATOMICS | |
| 729 | #define	atomic_cmpset_16	atomic_cmpset_short | |
| 730 | #endif | |
| 731 | #define	atomic_cmpset_acq_16	atomic_cmpset_acq_short | |
| 732 | #define	atomic_cmpset_rel_16	atomic_cmpset_rel_short | |
| 733 | ||
| 734 | #define	atomic_cmpset_32	atomic_cmpset_int | |
| 735 | #define	atomic_cmpset_acq_32	atomic_cmpset_acq_int | |
| 736 | #define	atomic_cmpset_rel_32	atomic_cmpset_rel_int | |
| 737 | ||
| 738 | #ifdef __powerpc64__ | |
| 739 | #define	atomic_cmpset_64	atomic_cmpset_long | |
| 740 | #define	atomic_cmpset_acq_64	atomic_cmpset_acq_long | |
| 741 | #define	atomic_cmpset_rel_64	atomic_cmpset_rel_long | |
| 742 | ||
| 743 | #define	atomic_cmpset_ptr	atomic_cmpset_long | |
| 744 | #define	atomic_cmpset_acq_ptr	atomic_cmpset_acq_long | |
| 745 | #define	atomic_cmpset_rel_ptr	atomic_cmpset_rel_long | |
| 746 | #else | |
| 747 | #define	atomic_cmpset_ptr	atomic_cmpset_int | |
| 748 | #define	atomic_cmpset_acq_ptr	atomic_cmpset_acq_int | |
| 749 | #define	atomic_cmpset_rel_ptr	atomic_cmpset_rel_int | |
| 750 | #endif | |
| 751 | ||
| 752 | /* | |
| 753 | * Atomically compare the value stored at *p with *cmpval and if the | |
| 754 | * two values are equal, update the value of *p with newval. Returns | |
| 755 | * zero if the compare failed and sets *cmpval to the read value from *p, | |
| 756 | * nonzero otherwise. | |
| 757 | */ | |
| 758 | #ifdef ISA_206_ATOMICS | |
| 759 | static __inline int | |
| 760 | atomic_fcmpset_char(volatile u_char *p, u_char *cmpval, u_char newval) | |
| 761 | { | |
| 762 | 	int	ret; | |
| 763 | ||
| 764 | 	__asm __volatile ( | |
| 765 | 		"lbarx %0, 0, %3\n\t"		/* load old value */ | |
| 766 | 		"cmplw %4, %0\n\t"		/* compare */ | |
| 767 | 		"bne- 1f\n\t"			/* exit if not equal */ | |
| 768 | 		"stbcx. %5, 0, %3\n\t" 	/* attempt to store */ | |
| 769 | 		"bne- 1f\n\t"			/* exit if failed */ | |
| 770 | 		"li %0, 1\n\t"			/* success - retval = 1 */ | |
| 771 | 		"b 2f\n\t"			/* we've succeeded */ | |
| 772 | 		"1:\n\t" | |
| 773 | 		"stbcx. %0, 0, %3\n\t" 	/* clear reservation (74xx) */ | |
| 774 | 		"stbx %0, 0, %7\n\t" | |
| 775 | 		"li %0, 0\n\t"			/* failure - retval = 0 */ | |
| 776 | 		"2:\n\t" | |
| 777 | 		: "=&r" (ret), "=m" (*p), "=m" (*cmpval) | |
| 778 | 		: "r" (p), "r" (*cmpval), "r" (newval), "m" (*p), "r"(cmpval) | |
| 779 | 		: "cr0", "memory"); | |
| 780 | ||
| 781 | 	return (ret); | |
| 782 | } | |
| 783 | ||
| 784 | static __inline int | |
| 785 | atomic_fcmpset_short(volatile u_short *p, u_short *cmpval, u_short newval) | |
| 786 | { | |
| 787 | 	int	ret; | |
| 788 | ||
| 789 | 	__asm __volatile ( | |
| 790 | 		"lharx %0, 0, %3\n\t"		/* load old value */ | |
| 791 | 		"cmplw %4, %0\n\t"		/* compare */ | |
| 792 | 		"bne- 1f\n\t"			/* exit if not equal */ | |
| 793 | 		"sthcx. %5, 0, %3\n\t" 	/* attempt to store */ | |
| 794 | 		"bne- 1f\n\t"			/* exit if failed */ | |
| 795 | 		"li %0, 1\n\t"			/* success - retval = 1 */ | |
| 796 | 		"b 2f\n\t"			/* we've succeeded */ | |
| 797 | 		"1:\n\t" | |
| 798 | 		"sthcx. %0, 0, %3\n\t" 	/* clear reservation (74xx) */ | |
| 799 | 		"sthx %0, 0, %7\n\t" | |
| 800 | 		"li %0, 0\n\t"			/* failure - retval = 0 */ | |
| 801 | 		"2:\n\t" | |
| 802 | 		: "=&r" (ret), "=m" (*p), "=m" (*cmpval) | |
| 803 | 		: "r" (p), "r" (*cmpval), "r" (newval), "m" (*p), "r"(cmpval) | |
| 804 | 		: "cr0", "memory"); | |
| 805 | ||
| 806 | 	return (ret); | |
| 807 | } | |
| 808 | #endif	/* ISA_206_ATOMICS */ | |
| 809 | ||
| 810 | static __inline int | |
| 811 | atomic_fcmpset_int(volatile u_int *p, u_int *cmpval, u_int newval) | |
| 812 | { | |
| 813 | 	int	ret; | |
| 814 | ||
| 815 | 	__asm __volatile ( | |
| 816 | 		"lwarx %0, 0, %3\n\t"		/* load old value */ | |
| 817 | 		"cmplw %4, %0\n\t"		/* compare */ | |
| 818 | 		"bne- 1f\n\t"			/* exit if not equal */ | |
| 819 | 		"stwcx. %5, 0, %3\n\t" 	/* attempt to store */ | |
| 820 | 		"bne- 1f\n\t"			/* exit if failed */ | |
| 821 | 		"li %0, 1\n\t"			/* success - retval = 1 */ | |
| 822 | 		"b 2f\n\t"			/* we've succeeded */ | |
| 823 | 		"1:\n\t" | |
| 824 | 		"stwcx. %0, 0, %3\n\t" 	/* clear reservation (74xx) */ | |
| 825 | 		"stwx %0, 0, %7\n\t" | |
| 826 | 		"li %0, 0\n\t"			/* failure - retval = 0 */ | |
| 827 | 		"2:\n\t" | |
| 828 | 		: "=&r" (ret), "=m" (*p), "=m" (*cmpval) | |
| 829 | 		: "r" (p), "r" (*cmpval), "r" (newval), "m" (*p), "r"(cmpval) | |
| 830 | 		: "cr0", "memory"); | |
| 831 | ||
| 832 | 	return (ret); | |
| 833 | } | |
| 834 | static __inline int | |
| 835 | atomic_fcmpset_long(volatile u_long *p, u_long *cmpval, u_long newval) | |
| 836 | { | |
| 837 | 	int ret; | |
| 838 | ||
| 839 | 	__asm __volatile ( | |
| 840 | 	 #ifdef __powerpc64__ | |
| 841 | 		"ldarx %0, 0, %3\n\t"		/* load old value */ | |
| 842 | 		"cmpld %4, %0\n\t"		/* compare */ | |
| 843 | 		"bne- 1f\n\t"			/* exit if not equal */ | |
| 844 | 		"stdcx. %5, 0, %3\n\t"		/* attempt to store */ | |
| 845 | 	 #else | |
| 846 | 		"lwarx %0, 0, %3\n\t"		/* load old value */ | |
| 847 | 		"cmplw %4, %0\n\t"		/* compare */ | |
| 848 | 		"bne- 1f\n\t"			/* exit if not equal */ | |
| 849 | 		"stwcx. %5, 0, %3\n\t"		/* attempt to store */ | |
| 850 | 	 #endif | |
| 851 | 		"bne- 1f\n\t"			/* exit if failed */ | |
| 852 | 		"li %0, 1\n\t"			/* success - retval = 1 */ | |
| 853 | 		"b 2f\n\t"			/* we've succeeded */ | |
| 854 | 		"1:\n\t" | |
| 855 | 	 #ifdef __powerpc64__ | |
| 856 | 		"stdcx. %0, 0, %3\n\t"		/* clear reservation (74xx) */ | |
| 857 | 		"stdx %0, 0, %7\n\t" | |
| 858 | 	 #else | |
| 859 | 		"stwcx. %0, 0, %3\n\t"		/* clear reservation (74xx) */ | |
| 860 | 		"stwx %0, 0, %7\n\t" | |
| 861 | 	 #endif | |
| 862 | 		"li %0, 0\n\t"			/* failure - retval = 0 */ | |
| 863 | 		"2:\n\t" | |
| 864 | 		: "=&r" (ret), "=m" (*p), "=m" (*cmpval) | |
| 865 | 		: "r" (p), "r" (*cmpval), "r" (newval), "m" (*p), "r"(cmpval) | |
| 866 | 		: "cr0", "memory"); | |
| 867 | ||
| 868 | 	return (ret); | |
| 869 | } | |
| 870 | ||
| 871 | #define	ATOMIC_FCMPSET_ACQ_REL(type) \ | |
| 872 | static __inline int \ | |
| 873 | atomic_fcmpset_acq_##type(volatile u_##type *p, \ | |
| 874 | 	 u_##type *cmpval, u_##type newval)\ | |
| 875 | {\ | |
| 876 | 	u_##type retval; \ | |
| 877 | 	retval = atomic_fcmpset_##type(p, cmpval, newval);\ | |
| 878 | 	__ATOMIC_ACQ();\ | |
| 879 | 	return (retval);\ | |
| 880 | }\ | |
| 881 | static __inline int \ | |
| 882 | atomic_fcmpset_rel_##type(volatile u_##type *p, \ | |
| 883 | 	 u_##type *cmpval, u_##type newval)\ | |
| 884 | {\ | |
| 885 | 	__ATOMIC_REL();\ | |
| 886 | 	return (atomic_fcmpset_##type(p, cmpval, newval));\ | |
| 887 | }\ | |
| 888 | struct hack | |
| 889 | ||
| 890 | ATOMIC_FCMPSET_ACQ_REL(int); | |
| 891 | ATOMIC_FCMPSET_ACQ_REL(long); | |
| 892 | ||
| 893 | #ifdef ISA_206_ATOMICS | |
| 894 | #define	atomic_fcmpset_8	atomic_fcmpset_char | |
| 895 | #endif | |
| 896 | #define	atomic_fcmpset_acq_8	atomic_fcmpset_acq_char | |
| 897 | #define	atomic_fcmpset_rel_8	atomic_fcmpset_rel_char | |
| 898 | ||
| 899 | #ifdef ISA_206_ATOMICS | |
| 900 | #define	atomic_fcmpset_16	atomic_fcmpset_short | |
| 901 | #endif | |
| 902 | #define	atomic_fcmpset_acq_16	atomic_fcmpset_acq_short | |
| 903 | #define	atomic_fcmpset_rel_16	atomic_fcmpset_rel_short | |
| 904 | ||
| 905 | #define	atomic_fcmpset_32	atomic_fcmpset_int | |
| 906 | #define	atomic_fcmpset_acq_32	atomic_fcmpset_acq_int | |
| 907 | #define	atomic_fcmpset_rel_32	atomic_fcmpset_rel_int | |
| 908 | ||
| 909 | #ifdef __powerpc64__ | |
| 910 | #define	atomic_fcmpset_64	atomic_fcmpset_long | |
| 911 | #define	atomic_fcmpset_acq_64	atomic_fcmpset_acq_long | |
| 912 | #define	atomic_fcmpset_rel_64	atomic_fcmpset_rel_long | |
| 913 | ||
| 914 | #define	atomic_fcmpset_ptr	atomic_fcmpset_long | |
| 915 | #define	atomic_fcmpset_acq_ptr	atomic_fcmpset_acq_long | |
| 916 | #define	atomic_fcmpset_rel_ptr	atomic_fcmpset_rel_long | |
| 917 | #else | |
| 918 | #define	atomic_fcmpset_ptr	atomic_fcmpset_int | |
| 919 | #define	atomic_fcmpset_acq_ptr	atomic_fcmpset_acq_int | |
| 920 | #define	atomic_fcmpset_rel_ptr	atomic_fcmpset_rel_int | |
| 921 | #endif | |
| 922 | ||
| 923 | static __inline u_int | |
| 924 | atomic_fetchadd_int(volatile u_int *p, u_int v) | |
| 925 | { | |
| 926 | 	u_int value; | |
| 927 | ||
| 928 | 	do { | |
| 929 | 		value = *p; | |
| 930 | 	} while (!atomic_cmpset_int(p, value, value + v)); | |
| 931 | 	return (value); | |
| 932 | } | |
| 933 | ||
| 934 | static __inline u_long | |
| 935 | atomic_fetchadd_long(volatile u_long *p, u_long v) | |
| 936 | { | |
| 937 | 	u_long value; | |
| 938 | ||
| 939 | 	do { | |
| 940 | 		value = *p; | |
| 941 | 	} while (!atomic_cmpset_long(p, value, value + v)); | |
| 942 | 	return (value); | |
| 943 | } | |
| 944 | ||
| 945 | static __inline u_int | |
| 946 | atomic_swap_32(volatile u_int *p, u_int v) | |
| 947 | { | |
| 948 | 	u_int prev; | |
| 949 | ||
| 950 | 	__asm __volatile( | |
| 951 | 	"1:	lwarx	%0,0,%2\n" | |
| 952 | 	"	stwcx.	%3,0,%2\n" | |
| 953 | 	"	bne-	1b\n" | |
| 954 | 	: "=&r" (prev), "+m" (*(volatile u_int *)p) | |
| 955 | 	: "r" (p), "r" (v) | |
| 956 | 	: "cr0", "memory"); | |
| 957 | ||
| 958 | 	return (prev); | |
| 959 | } | |
| 960 | ||
| 961 | #ifdef __powerpc64__ | |
| 962 | static __inline u_long | |
| 963 | atomic_swap_64(volatile u_long *p, u_long v) | |
| 964 | { | |
| 965 | 	u_long prev; | |
| 966 | ||
| 967 | 	__asm __volatile( | |
| 968 | 	"1:	ldarx	%0,0,%2\n" | |
| 969 | 	"	stdcx.	%3,0,%2\n" | |
| 970 | 	"	bne-	1b\n" | |
| 971 | 	: "=&r" (prev), "+m" (*(volatile u_long *)p) | |
| 972 | 	: "r" (p), "r" (v) | |
| 973 | 	: "cr0", "memory"); | |
| 974 | ||
| 975 | 	return (prev); | |
| 976 | } | |
| 977 | #endif | |
| 978 | ||
| 979 | #define	atomic_fetchadd_32	atomic_fetchadd_int | |
| 980 | #define	atomic_swap_int		atomic_swap_32 | |
| 981 | ||
| 982 | #ifdef __powerpc64__ | |
| 983 | #define	atomic_fetchadd_64	atomic_fetchadd_long | |
| 984 | #define	atomic_swap_long	atomic_swap_64 | |
| 985 | #define	atomic_swap_ptr		atomic_swap_64 | |
| 986 | #else | |
| 987 | #define	atomic_swap_long(p,v)	atomic_swap_32((volatile u_int *)(p), v) | |
| 988 | #define	atomic_swap_ptr(p,v)	atomic_swap_32((volatile u_int *)(p), v) | |
| 989 | #endif | |
| 990 | ||
| 991 | static __inline int | |
| 992 | atomic_testandset_int(volatile u_int *p, u_int v) | |
| 993 | { | |
| 994 | 	u_int m = (1u << (v & 0x1f)); | |
| 995 | 	u_int res; | |
| 996 | 	u_int tmp; | |
| 997 | ||
| 998 | 	__asm __volatile( | |
| 999 | 	"1:	lwarx	%0,0,%3\n" | |
| 1000 | 	"	and	%1,%0,%4\n" | |
| 1001 | 	"	or	%0,%0,%4\n" | |
| 1002 | 	"	stwcx.	%0,0,%3\n" | |
| 1003 | 	"	bne-	1b\n" | |
| 1004 | 	: "=&r"(tmp), "=&r"(res), "+m"(*p) | |
| 1005 | 	: "r"(p), "r"(m) | |
| 1006 | 	: "cr0", "memory"); | |
| 1007 | ||
| 1008 | 	return (res != 0); | |
| 1009 | } | |
| 1010 | ||
| 1011 | static __inline int | |
| 1012 | atomic_testandclear_int(volatile u_int *p, u_int v) | |
| 1013 | { | |
| 1014 | 	u_int m = (1u << (v & 0x1f)); | |
| 1015 | 	u_int res; | |
| 1016 | 	u_int tmp; | |
| 1017 | ||
| 1018 | 	__asm __volatile( | |
| 1019 | 	"1:	lwarx	%0,0,%3\n" | |
| 1020 | 	"	and	%1,%0,%4\n" | |
| 1021 | 	"	andc	%0,%0,%4\n" | |
| 1022 | 	"	stwcx.	%0,0,%3\n" | |
| 1023 | 	"	bne-	1b\n" | |
| 1024 | 	: "=&r"(tmp), "=&r"(res), "+m"(*p) | |
| 1025 | 	: "r"(p), "r"(m) | |
| 1026 | 	: "cr0", "memory"); | |
| 1027 | ||
| 1028 | 	return (res != 0); | |
| 1029 | } | |
| 1030 | ||
| 1031 | #ifdef __powerpc64__ | |
| 1032 | static __inline int | |
| 1033 | atomic_testandset_long(volatile u_long *p, u_int v) | |
| 1034 | { | |
| 1035 | 	u_long m = (1ul << (v & 0x3f)); | |
| 1036 | 	u_long res; | |
| 1037 | 	u_long tmp; | |
| 1038 | ||
| 1039 | 	__asm __volatile( | |
| 1040 | 	"1:	ldarx	%0,0,%3\n" | |
| 1041 | 	"	and	%1,%0,%4\n" | |
| 1042 | 	"	or	%0,%0,%4\n" | |
| 1043 | 	"	stdcx.	%0,0,%3\n" | |
| 1044 | 	"	bne-	1b\n" | |
| 1045 | 	: "=&r"(tmp), "=&r"(res), "+m"(*(volatile u_long *)p) | |
| 1046 | 	: "r"(p), "r"(m) | |
| 1047 | 	: "cr0", "memory"); | |
| 1048 | ||
| 1049 | 	return (res != 0); | |
| 1050 | } | |
| 1051 | ||
| 1052 | static __inline int | |
| 1053 | atomic_testandclear_long(volatile u_long *p, u_int v) | |
| 1054 | { | |
| 1055 | 	u_long m = (1ul << (v & 0x3f)); | |
| 1056 | 	u_long res; | |
| 1057 | 	u_long tmp; | |
| 1058 | ||
| 1059 | 	__asm __volatile( | |
| 1060 | 	"1:	ldarx	%0,0,%3\n" | |
| 1061 | 	"	and	%1,%0,%4\n" | |
| 1062 | 	"	andc	%0,%0,%4\n" | |
| 1063 | 	"	stdcx.	%0,0,%3\n" | |
| 1064 | 	"	bne-	1b\n" | |
| 1065 | 	: "=&r"(tmp), "=&r"(res), "+m"(*p) | |
| 1066 | 	: "r"(p), "r"(m) | |
| 1067 | 	: "cr0", "memory"); | |
| 1068 | ||
| 1069 | 	return (res != 0); | |
| 1070 | } | |
| 1071 | #else | |
| 1072 | static __inline int | |
| 1073 | atomic_testandset_long(volatile u_long *p, u_int v) | |
| 1074 | { | |
| 1075 | 	return (atomic_testandset_int((volatile u_int *)p, v)); | |
| 1076 | } | |
| 1077 | ||
| 1078 | static __inline int | |
| 1079 | atomic_testandclear_long(volatile u_long *p, u_int v) | |
| 1080 | { | |
| 1081 | 	return (atomic_testandclear_int((volatile u_int *)p, v)); | |
| 1082 | } | |
| 1083 | #endif | |
| 1084 | ||
| 1085 | #define	atomic_testandclear_32	atomic_testandclear_int | |
| 1086 | #define	atomic_testandset_32	atomic_testandset_int | |
| 1087 | ||
| 1088 | static __inline int | |
| 1089 | atomic_testandset_acq_long(volatile u_long *p, u_int v) | |
| 1090 | { | |
| 1091 | 	u_int a = atomic_testandset_long(p, v); | |
| 1092 | 	__ATOMIC_ACQ(); | |
| 1093 | 	return (a); | |
| 1094 | } | |
| 1095 | ||
| 1096 | #ifdef __powerpc64__ | |
| 1097 | #define	atomic_testandclear_ptr		atomic_testandclear_long | |
| 1098 | #define	atomic_testandset_ptr		atomic_testandset_long | |
| 1099 | #else | |
| 1100 | #define	atomic_testandclear_ptr(p,v)					\ | |
| 1101 | 	atomic_testandclear_32((volatile u_int *)(p), v) | |
| 1102 | #define	atomic_testandset_ptr(p,v)					\ | |
| 1103 | 	atomic_testandset_32((volatile u_int *)(p), v) | |
| 1104 | #endif | |
| 1105 | ||
| 1106 | static __inline void | |
| 1107 | atomic_thread_fence_acq(void) | |
| 1108 | { | |
| 1109 | ||
| 1110 | 	powerpc_lwsync(); | |
| 1111 | } | |
| 1112 | ||
| 1113 | static __inline void | |
| 1114 | atomic_thread_fence_rel(void) | |
| 1115 | { | |
| 1116 | ||
| 1117 | 	powerpc_lwsync(); | |
| 1118 | } | |
| 1119 | ||
| 1120 | static __inline void | |
| 1121 | atomic_thread_fence_acq_rel(void) | |
| 1122 | { | |
| 1123 | ||
| 1124 | 	powerpc_lwsync(); | |
| 1125 | } | |
| 1126 | ||
| 1127 | static __inline void | |
| 1128 | atomic_thread_fence_seq_cst(void) | |
| 1129 | { | |
| 1130 | ||
| 1131 | 	__asm __volatile("sync" : : : "memory"); | |
| 1132 | } | |
| 1133 | ||
| 1134 | #ifndef ISA_206_ATOMICS | |
| 1135 | #include <sys/_atomic_subword.h> | |
| 1136 | #define	atomic_cmpset_char	atomic_cmpset_8 | |
| 1137 | #define	atomic_cmpset_short	atomic_cmpset_16 | |
| 1138 | #define	atomic_fcmpset_char	atomic_fcmpset_8 | |
| 1139 | #define	atomic_fcmpset_short	atomic_fcmpset_16 | |
| 1140 | #define	atomic_set_short	atomic_set_16 | |
| 1141 | #define	atomic_clear_short	atomic_clear_16 | |
| 1142 | #else | |
| 1143 | ||
| 1144 | static __inline void | |
| 1145 | atomic_set_short(volatile u_short *p, u_short bit) | |
| 1146 | { | |
| 1147 | 	u_short v; | |
| 1148 | ||
| 1149 | 	v = atomic_load_short(p); | |
| 1150 | 	for (;;) { | |
| 1151 | 		if (atomic_fcmpset_16(p, &v, v | bit)) | |
| 1152 | 			break; | |
| 1153 | 	} | |
| 1154 | } | |
| 1155 | ||
| 1156 | static __inline void | |
| 1157 | atomic_clear_short(volatile u_short *p, u_short bit) | |
| 1158 | { | |
| 1159 | 	u_short v; | |
| 1160 | ||
| 1161 | 	v = atomic_load_short(p); | |
| 1162 | 	for (;;) { | |
| 1163 | 		if (atomic_fcmpset_16(p, &v, v & ~bit)) | |
| 1164 | 			break; | |
| 1165 | 	} | |
| 1166 | } | |
| 1167 | ||
| 1168 | #define	atomic_set_16		atomic_set_short | |
| 1169 | #define	atomic_clear_16		atomic_clear_short | |
| 1170 | ||
| 1171 | #endif	/* ISA_206_ATOMICS */ | |
| 1172 | ||
| 1173 | /* These need sys/_atomic_subword.h on non-ISA-2.06-atomic platforms. */ | |
| 1174 | ATOMIC_CMPSET_ACQ_REL(char); | |
| 1175 | ATOMIC_CMPSET_ACQ_REL(short); | |
| 1176 | ||
| 1177 | ATOMIC_FCMPSET_ACQ_REL(char); | |
| 1178 | ATOMIC_FCMPSET_ACQ_REL(short); | |
| 1179 | ||
| 1180 | #undef __ATOMIC_REL | |
| 1181 | #undef __ATOMIC_ACQ | |
| 1182 | ||
| 1183 | #endif /* ! _MACHINE_ATOMIC_H_ */ | |
| \ No newline at end of file |
lib/libc/include/powerpc64-freebsd-none/machine/bat.h created+167| ... | ... | @@ -0,0 +1,167 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-2-Clause AND BSD-4-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 1999 The NetBSD Foundation, Inc. | |
| 5 | * All rights reserved. | |
| 6 | * | |
| 7 | * This code is derived from software contributed to The NetBSD Foundation | |
| 8 | * by Jason R. Thorpe. | |
| 9 | * | |
| 10 | * Redistribution and use in source and binary forms, with or without | |
| 11 | * modification, are permitted provided that the following conditions | |
| 12 | * are met: | |
| 13 | * 1. Redistributions of source code must retain the above copyright | |
| 14 | * notice, this list of conditions and the following disclaimer. | |
| 15 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 16 | * notice, this list of conditions and the following disclaimer in the | |
| 17 | * documentation and/or other materials provided with the distribution. | |
| 18 | * | |
| 19 | * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS | |
| 20 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | |
| 21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
| 22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | |
| 23 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
| 24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
| 25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
| 26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
| 27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
| 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
| 29 | * POSSIBILITY OF SUCH DAMAGE. | |
| 30 | */ | |
| 31 | ||
| 32 | /*- | |
| 33 | * Copyright (C) 1995, 1996 Wolfgang Solfrank. | |
| 34 | * Copyright (C) 1995, 1996 TooLs GmbH. | |
| 35 | * All rights reserved. | |
| 36 | * | |
| 37 | * Redistribution and use in source and binary forms, with or without | |
| 38 | * modification, are permitted provided that the following conditions | |
| 39 | * are met: | |
| 40 | * 1. Redistributions of source code must retain the above copyright | |
| 41 | * notice, this list of conditions and the following disclaimer. | |
| 42 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 43 | * notice, this list of conditions and the following disclaimer in the | |
| 44 | * documentation and/or other materials provided with the distribution. | |
| 45 | * 3. All advertising materials mentioning features or use of this software | |
| 46 | * must display the following acknowledgement: | |
| 47 | *	This product includes software developed by TooLs GmbH. | |
| 48 | * 4. The name of TooLs GmbH may not be used to endorse or promote products | |
| 49 | * derived from this software without specific prior written permission. | |
| 50 | * | |
| 51 | * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR | |
| 52 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |
| 53 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | |
| 54 | * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
| 55 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | |
| 56 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; | |
| 57 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | |
| 58 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | |
| 59 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | |
| 60 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 61 | * | |
| 62 | *	$NetBSD: bat.h,v 1.2 1999/12/18 01:36:06 thorpej Exp $ | |
| 63 | */ | |
| 64 | ||
| 65 | #ifndef	_MACHINE_BAT_H_ | |
| 66 | #define	_MACHINE_BAT_H_ | |
| 67 | ||
| 68 | #ifndef LOCORE | |
| 69 | struct bat { | |
| 70 | 	u_int32_t batu; | |
| 71 | 	u_int32_t batl; | |
| 72 | }; | |
| 73 | #endif | |
| 74 | ||
| 75 | /* Lower BAT bits (all but PowerPC 601): */ | |
| 76 | #define	BAT_PBS		0xfffe0000	/* physical block start */ | |
| 77 | #define	BAT_W		0x00000040	/* 1 = write-through, 0 = write-back */ | |
| 78 | #define	BAT_I		0x00000020	/* cache inhibit */ | |
| 79 | #define	BAT_M		0x00000010	/* memory coherency enable */ | |
| 80 | #define	BAT_G		0x00000008	/* guarded region */ | |
| 81 | ||
| 82 | #define	BAT_PP_NONE	0x00000000	/* no access permission */ | |
| 83 | #define	BAT_PP_RO_S	0x00000001	/* read-only (soft) */ | |
| 84 | #define	BAT_PP_RW	0x00000002	/* read/write */ | |
| 85 | #define	BAT_PP_RO	0x00000003	/* read-only */ | |
| 86 | ||
| 87 | /* Upper BAT bits (all but PowerPC 601): */ | |
| 88 | #define	BAT_EBS		0xfffe0000	/* effective block start */ | |
| 89 | #define	BAT_BL		0x00001ffc	/* block length */ | |
| 90 | #define	BAT_Vs		0x00000002	/* valid in supervisor mode */ | |
| 91 | #define	BAT_Vu		0x00000001	/* valid in user mode */ | |
| 92 | ||
| 93 | #define	BAT_V		(BAT_Vs|BAT_Vu) | |
| 94 | ||
| 95 | /* Block Length encoding (all but PowerPC 601): */ | |
| 96 | #define	BAT_BL_128K	0x00000000 | |
| 97 | #define	BAT_BL_256K	0x00000004 | |
| 98 | #define	BAT_BL_512K	0x0000000c | |
| 99 | #define	BAT_BL_1M	0x0000001c | |
| 100 | #define	BAT_BL_2M	0x0000003c | |
| 101 | #define	BAT_BL_4M	0x0000007c | |
| 102 | #define	BAT_BL_8M	0x000000fc | |
| 103 | #define	BAT_BL_16M	0x000001fc | |
| 104 | #define	BAT_BL_32M	0x000003fc | |
| 105 | #define	BAT_BL_64M	0x000007fc | |
| 106 | #define	BAT_BL_128M	0x00000ffc | |
| 107 | #define	BAT_BL_256M	0x00001ffc | |
| 108 | ||
| 109 | #define	BATU(va, len, v)						\ | |
| 110 | 	(((va) & BAT_EBS) | ((len) & BAT_BL) | ((v) & BAT_V)) | |
| 111 | ||
| 112 | #define	BATL(pa, wimg, pp)						\ | |
| 113 | 	(((pa) & BAT_PBS) | (wimg) | (pp)) | |
| 114 | ||
| 115 | /* Lower BAT bits (PowerPC 601): */ | |
| 116 | #define	BAT601_PBN	0xfffe0000	/* physical block number */ | |
| 117 | #define	BAT601_V	0x00000040	/* valid */ | |
| 118 | #define	BAT601_BSM	0x0000003f	/* block size mask */ | |
| 119 | ||
| 120 | /* Upper BAT bits (PowerPC 601): */ | |
| 121 | #define	BAT601_BLPI	0xfffe0000	/* block logical page index */ | |
| 122 | #define	BAT601_W	0x00000040	/* 1 = write-through, 0 = write-back */ | |
| 123 | #define	BAT601_I	0x00000020	/* cache inhibit */ | |
| 124 | #define	BAT601_M	0x00000010	/* memory coherency enable */ | |
| 125 | #define	BAT601_Ks	0x00000008	/* key-supervisor */ | |
| 126 | #define	BAT601_Ku	0x00000004	/* key-user */ | |
| 127 | ||
| 128 | /* | |
| 129 | * Permission bits on the PowerPC 601 are modified by the appropriate | |
| 130 | * Key bit: | |
| 131 | * | |
| 132 | *	Key	PP	Access | |
| 133 | *	0	NONE	read/write | |
| 134 | *	0	RO_S	read/write | |
| 135 | *	0	RW	read/write | |
| 136 | *	0	RO	read-only | |
| 137 | * | |
| 138 | *	1	NONE	none | |
| 139 | *	1	RO_S	read-only | |
| 140 | *	1	RW	read/write | |
| 141 | *	1	RO	read-only | |
| 142 | */ | |
| 143 | #define	BAT601_PP_NONE	0x00000000	/* no access permission */ | |
| 144 | #define	BAT601_PP_RO_S	0x00000001	/* read-only (soft) */ | |
| 145 | #define	BAT601_PP_RW	0x00000002	/* read/write */ | |
| 146 | #define	BAT601_PP_RO	0x00000003	/* read-only */ | |
| 147 | ||
| 148 | /* Block Size Mask encoding (PowerPC 601): */ | |
| 149 | #define	BAT601_BSM_128K	0x00000000 | |
| 150 | #define	BAT601_BSM_256K	0x00000001 | |
| 151 | #define	BAT601_BSM_512K	0x00000003 | |
| 152 | #define	BAT601_BSM_1M	0x00000007 | |
| 153 | #define	BAT601_BSM_2M	0x0000000f | |
| 154 | #define	BAT601_BSM_4M	0x0000001f | |
| 155 | #define	BAT601_BSM_8M	0x0000003f | |
| 156 | ||
| 157 | #define	BATU601(va, wim, key, pp)					\ | |
| 158 | 	(((va) & BAT601_BLPI) | (wim) | (key) | (pp)) | |
| 159 | ||
| 160 | #define	BATL601(pa, size, v)						\ | |
| 161 | 	(((pa) & BAT601_PBN) | (v) | (size)) | |
| 162 | ||
| 163 | #if defined(_KERNEL) && !defined(LOCORE) | |
| 164 | extern struct bat battable[16]; | |
| 165 | #endif | |
| 166 | ||
| 167 | #endif	/* _MACHINE_BAT_H_ */ | |
| \ No newline at end of file |
lib/libc/include/powerpc64-freebsd-none/machine/bus.h created+493| ... | ... | @@ -0,0 +1,493 @@ |
| 1 | /*	$NetBSD: bus.h,v 1.11 2003/07/28 17:35:54 thorpej Exp $	*/ | |
| 2 | ||
| 3 | /*- | |
| 4 | * SPDX-License-Identifier: BSD-2-Clause AND BSD-4-Clause | |
| 5 | * | |
| 6 | * Copyright (c) 1996, 1997, 1998, 2001 The NetBSD Foundation, Inc. | |
| 7 | * All rights reserved. | |
| 8 | * | |
| 9 | * This code is derived from software contributed to The NetBSD Foundation | |
| 10 | * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility, | |
| 11 | * NASA Ames Research Center. | |
| 12 | * | |
| 13 | * Redistribution and use in source and binary forms, with or without | |
| 14 | * modification, are permitted provided that the following conditions | |
| 15 | * are met: | |
| 16 | * 1. Redistributions of source code must retain the above copyright | |
| 17 | * notice, this list of conditions and the following disclaimer. | |
| 18 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 19 | * notice, this list of conditions and the following disclaimer in the | |
| 20 | * documentation and/or other materials provided with the distribution. | |
| 21 | * | |
| 22 | * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS | |
| 23 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | |
| 24 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
| 25 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | |
| 26 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
| 27 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
| 28 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
| 29 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
| 30 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
| 31 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
| 32 | * POSSIBILITY OF SUCH DAMAGE. | |
| 33 | */ | |
| 34 | ||
| 35 | /*- | |
| 36 | * Copyright (c) 1996 Charles M. Hannum. All rights reserved. | |
| 37 | * Copyright (c) 1996 Christopher G. Demetriou. All rights reserved. | |
| 38 | * | |
| 39 | * Redistribution and use in source and binary forms, with or without | |
| 40 | * modification, are permitted provided that the following conditions | |
| 41 | * are met: | |
| 42 | * 1. Redistributions of source code must retain the above copyright | |
| 43 | * notice, this list of conditions and the following disclaimer. | |
| 44 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 45 | * notice, this list of conditions and the following disclaimer in the | |
| 46 | * documentation and/or other materials provided with the distribution. | |
| 47 | * 3. All advertising materials mentioning features or use of this software | |
| 48 | * must display the following acknowledgement: | |
| 49 | * This product includes software developed by Christopher G. Demetriou | |
| 50 | *	for the NetBSD Project. | |
| 51 | * 4. The name of the author may not be used to endorse or promote products | |
| 52 | * derived from this software without specific prior written permission | |
| 53 | * | |
| 54 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | |
| 55 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |
| 56 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | |
| 57 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | |
| 58 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | |
| 59 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
| 60 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
| 61 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
| 62 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | |
| 63 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 64 | */ | |
| 65 | ||
| 66 | #ifndef _MACHINE_BUS_H_ | |
| 67 | #define _MACHINE_BUS_H_ | |
| 68 | ||
| 69 | #include <machine/_bus.h> | |
| 70 | ||
| 71 | #define BUS_SPACE_ALIGNED_POINTER(p, t) ALIGNED_POINTER(p, t) | |
| 72 | ||
| 73 | #define BUS_SPACE_MAXADDR_24BIT	0xFFFFFFUL | |
| 74 | #define BUS_SPACE_MAXADDR_32BIT 0xFFFFFFFFUL | |
| 75 | #define BUS_SPACE_MAXSIZE_24BIT	0xFFFFFFUL | |
| 76 | #define BUS_SPACE_MAXSIZE_32BIT	0xFFFFFFFFUL | |
| 77 | ||
| 78 | #ifdef __powerpc64__ | |
| 79 | #define BUS_SPACE_MAXADDR 	0xFFFFFFFFFFFFFFFFUL | |
| 80 | #define BUS_SPACE_MAXSIZE 	0xFFFFFFFFFFFFFFFFUL | |
| 81 | #else | |
| 82 | #ifdef BOOKE | |
| 83 | #define BUS_SPACE_MAXADDR 	0xFFFFFFFFFULL | |
| 84 | #define BUS_SPACE_MAXSIZE 	0xFFFFFFFFUL | |
| 85 | #else | |
| 86 | #define BUS_SPACE_MAXADDR 	0xFFFFFFFFUL | |
| 87 | #define BUS_SPACE_MAXSIZE 	0xFFFFFFFFUL | |
| 88 | #endif | |
| 89 | #endif | |
| 90 | ||
| 91 | #define	BUS_SPACE_MAP_CACHEABLE		0x01 | |
| 92 | #define	BUS_SPACE_MAP_LINEAR		0x02 | |
| 93 | #define	BUS_SPACE_MAP_PREFETCHABLE 	0x04 | |
| 94 | ||
| 95 | #define	BUS_SPACE_UNRESTRICTED	(~0) | |
| 96 | ||
| 97 | #define	BUS_SPACE_BARRIER_READ	0x01 | |
| 98 | #define	BUS_SPACE_BARRIER_WRITE	0x02 | |
| 99 | ||
| 100 | struct bus_space_access; | |
| 101 | ||
| 102 | struct bus_space { | |
| 103 | 	/* mapping/unmapping */ | |
| 104 | 	int	(*bs_map)(bus_addr_t, bus_size_t, int, | |
| 105 | 	 bus_space_handle_t *); | |
| 106 | 	void	(*bs_unmap)(bus_space_handle_t, bus_size_t); | |
| 107 | 	int	(*bs_subregion)(bus_space_handle_t, bus_size_t, | |
| 108 | 	 bus_size_t, bus_space_handle_t *); | |
| 109 | ||
| 110 | 	/* allocation/deallocation */ | |
| 111 | 	int	(*bs_alloc)(bus_addr_t, bus_addr_t, bus_size_t, | |
| 112 | 	 bus_size_t, bus_size_t, int, bus_addr_t *, bus_space_handle_t *); | |
| 113 | 	void	(*bs_free)(bus_space_handle_t, bus_size_t); | |
| 114 | ||
| 115 | 	void	(*bs_barrier)(bus_space_handle_t, bus_size_t, | |
| 116 | 	 bus_size_t, int); | |
| 117 | ||
| 118 | 	/* Read single. */ | |
| 119 | 	uint8_t (*bs_r_1)(bus_space_handle_t, bus_size_t); | |
| 120 | 	uint16_t (*bs_r_2)(bus_space_handle_t, bus_size_t); | |
| 121 | 	uint32_t (*bs_r_4)(bus_space_handle_t, bus_size_t); | |
| 122 | 	uint64_t (*bs_r_8)(bus_space_handle_t, bus_size_t); | |
| 123 | ||
| 124 | 	uint16_t (*bs_r_s_2)(bus_space_handle_t, bus_size_t); | |
| 125 | 	uint32_t (*bs_r_s_4)(bus_space_handle_t, bus_size_t); | |
| 126 | 	uint64_t (*bs_r_s_8)(bus_space_handle_t, bus_size_t); | |
| 127 | ||
| 128 | 	/* read multiple */ | |
| 129 | 	void	(*bs_rm_1)(bus_space_handle_t, bus_size_t, uint8_t *, | |
| 130 | 	 bus_size_t); | |
| 131 | 	void	(*bs_rm_2)(bus_space_handle_t, bus_size_t, uint16_t *, | |
| 132 | 	 bus_size_t); | |
| 133 | 	void	(*bs_rm_4)(bus_space_handle_t, bus_size_t, uint32_t *, | |
| 134 | 	 bus_size_t); | |
| 135 | 	void	(*bs_rm_8)(bus_space_handle_t, bus_size_t, uint64_t *, | |
| 136 | 	 bus_size_t); | |
| 137 | ||
| 138 | 	void	(*bs_rm_s_2)(bus_space_handle_t, bus_size_t, uint16_t *, | |
| 139 | 	 bus_size_t); | |
| 140 | 	void	(*bs_rm_s_4)(bus_space_handle_t, bus_size_t, uint32_t *, | |
| 141 | 	 bus_size_t); | |
| 142 | 	void	(*bs_rm_s_8)(bus_space_handle_t, bus_size_t, uint64_t *, | |
| 143 | 	 bus_size_t); | |
| 144 | ||
| 145 | 	/* read region */ | |
| 146 | 	void	(*bs_rr_1)(bus_space_handle_t, bus_size_t, uint8_t *, | |
| 147 | 	 bus_size_t); | |
| 148 | 	void	(*bs_rr_2)(bus_space_handle_t, bus_size_t, uint16_t *, | |
| 149 | 	 bus_size_t); | |
| 150 | 	void	(*bs_rr_4)(bus_space_handle_t, bus_size_t, uint32_t *, | |
| 151 | 	 bus_size_t); | |
| 152 | 	void	(*bs_rr_8)(bus_space_handle_t, bus_size_t, uint64_t *, | |
| 153 | 	 bus_size_t); | |
| 154 | ||
| 155 | 	void	(*bs_rr_s_2)(bus_space_handle_t, bus_size_t, uint16_t *, | |
| 156 | 	 bus_size_t); | |
| 157 | 	void	(*bs_rr_s_4)(bus_space_handle_t, bus_size_t, uint32_t *, | |
| 158 | 	 bus_size_t); | |
| 159 | 	void	(*bs_rr_s_8)(bus_space_handle_t, bus_size_t, uint64_t *, | |
| 160 | 	 bus_size_t); | |
| 161 | ||
| 162 | 	/* write */ | |
| 163 | 	void	(*bs_w_1)(bus_space_handle_t, bus_size_t, uint8_t); | |
| 164 | 	void	(*bs_w_2)(bus_space_handle_t, bus_size_t, uint16_t); | |
| 165 | 	void	(*bs_w_4)(bus_space_handle_t, bus_size_t, uint32_t); | |
| 166 | 	void	(*bs_w_8)(bus_space_handle_t, bus_size_t, uint64_t); | |
| 167 | ||
| 168 | 	void	(*bs_w_s_2)(bus_space_handle_t, bus_size_t, uint16_t); | |
| 169 | 	void	(*bs_w_s_4)(bus_space_handle_t, bus_size_t, uint32_t); | |
| 170 | 	void	(*bs_w_s_8)(bus_space_handle_t, bus_size_t, uint64_t); | |
| 171 | ||
| 172 | 	/* write multiple */ | |
| 173 | 	void	(*bs_wm_1)(bus_space_handle_t, bus_size_t, | |
| 174 | 	 const uint8_t *, bus_size_t); | |
| 175 | 	void	(*bs_wm_2)(bus_space_handle_t, bus_size_t, | |
| 176 | 	 const uint16_t *, bus_size_t); | |
| 177 | 	void	(*bs_wm_4)(bus_space_handle_t, bus_size_t, | |
| 178 | 	 const uint32_t *, bus_size_t); | |
| 179 | 	void	(*bs_wm_8)(bus_space_handle_t, bus_size_t, | |
| 180 | 	 const uint64_t *, bus_size_t); | |
| 181 | ||
| 182 | 	void	(*bs_wm_s_2)(bus_space_handle_t, bus_size_t, | |
| 183 | 	 const uint16_t *, bus_size_t); | |
| 184 | 	void	(*bs_wm_s_4)(bus_space_handle_t, bus_size_t, | |
| 185 | 	 const uint32_t *, bus_size_t); | |
| 186 | 	void	(*bs_wm_s_8)(bus_space_handle_t, bus_size_t, | |
| 187 | 	 const uint64_t *, bus_size_t); | |
| 188 | ||
| 189 | 	/* write region */ | |
| 190 | 	void	(*bs_wr_1)(bus_space_handle_t, bus_size_t, | |
| 191 | 	 const uint8_t *, bus_size_t); | |
| 192 | 	void	(*bs_wr_2)(bus_space_handle_t, bus_size_t, | |
| 193 | 	 const uint16_t *, bus_size_t); | |
| 194 | 	void	(*bs_wr_4)(bus_space_handle_t, bus_size_t, | |
| 195 | 	 const uint32_t *, bus_size_t); | |
| 196 | 	void	(*bs_wr_8)(bus_space_handle_t, bus_size_t, | |
| 197 | 	 const uint64_t *, bus_size_t); | |
| 198 | ||
| 199 | 	void	(*bs_wr_s_2)(bus_space_handle_t, bus_size_t, | |
| 200 | 	 const uint16_t *, bus_size_t); | |
| 201 | 	void	(*bs_wr_s_4)(bus_space_handle_t, bus_size_t, | |
| 202 | 	 const uint32_t *, bus_size_t); | |
| 203 | 	void	(*bs_wr_s_8)(bus_space_handle_t, bus_size_t, | |
| 204 | 	 const uint64_t *, bus_size_t); | |
| 205 | ||
| 206 | 	/* set multiple */ | |
| 207 | 	void	(*bs_sm_1)(bus_space_handle_t, bus_size_t, uint8_t, | |
| 208 | 	 bus_size_t); | |
| 209 | 	void	(*bs_sm_2)(bus_space_handle_t, bus_size_t, uint16_t, | |
| 210 | 	 bus_size_t); | |
| 211 | 	void	(*bs_sm_4)(bus_space_handle_t, bus_size_t, uint32_t, | |
| 212 | 	 bus_size_t); | |
| 213 | 	void	(*bs_sm_8)(bus_space_handle_t, bus_size_t, uint64_t, | |
| 214 | 	 bus_size_t); | |
| 215 | ||
| 216 | 	void	(*bs_sm_s_2)(bus_space_handle_t, bus_size_t, uint16_t, | |
| 217 | 	 bus_size_t); | |
| 218 | 	void	(*bs_sm_s_4)(bus_space_handle_t, bus_size_t, uint32_t, | |
| 219 | 	 bus_size_t); | |
| 220 | 	void	(*bs_sm_s_8)(bus_space_handle_t, bus_size_t, uint64_t, | |
| 221 | 	 bus_size_t); | |
| 222 | ||
| 223 | 	/* set region */ | |
| 224 | 	void	(*bs_sr_1)(bus_space_handle_t, bus_size_t, uint8_t, | |
| 225 | 	 bus_size_t); | |
| 226 | 	void	(*bs_sr_2)(bus_space_handle_t, bus_size_t, uint16_t, | |
| 227 | 	 bus_size_t); | |
| 228 | 	void	(*bs_sr_4)(bus_space_handle_t, bus_size_t, uint32_t, | |
| 229 | 	 bus_size_t); | |
| 230 | 	void	(*bs_sr_8)(bus_space_handle_t, bus_size_t, uint64_t, | |
| 231 | 	 bus_size_t); | |
| 232 | ||
| 233 | 	void	(*bs_sr_s_2)(bus_space_handle_t, bus_size_t, uint16_t, | |
| 234 | 	 bus_size_t); | |
| 235 | 	void	(*bs_sr_s_4)(bus_space_handle_t, bus_size_t, uint32_t, | |
| 236 | 	 bus_size_t); | |
| 237 | 	void	(*bs_sr_s_8)(bus_space_handle_t, bus_size_t, uint64_t, | |
| 238 | 	 bus_size_t); | |
| 239 | ||
| 240 | 	/* copy region */ | |
| 241 | 	void	(*bs_cr_1)(bus_space_handle_t, bus_size_t, | |
| 242 | 	 bus_space_handle_t, bus_size_t, bus_size_t); | |
| 243 | 	void	(*bs_cr_2)(bus_space_handle_t, bus_size_t, | |
| 244 | 	 bus_space_handle_t, bus_size_t, bus_size_t); | |
| 245 | 	void	(*bs_cr_4)(bus_space_handle_t, bus_size_t, | |
| 246 | 	 bus_space_handle_t, bus_size_t, bus_size_t); | |
| 247 | 	void	(*bs_cr_8)(bus_space_handle_t, bus_size_t, | |
| 248 | 	 bus_space_handle_t, bus_size_t, bus_size_t); | |
| 249 | ||
| 250 | 	void	(*bs_cr_s_2)(bus_space_handle_t, bus_size_t, | |
| 251 | 	 bus_space_handle_t, bus_size_t, bus_size_t); | |
| 252 | 	void	(*bs_cr_s_4)(bus_space_handle_t, bus_size_t, | |
| 253 | 	 bus_space_handle_t, bus_size_t, bus_size_t); | |
| 254 | 	void	(*bs_cr_s_8)(bus_space_handle_t, bus_size_t, | |
| 255 | 	 bus_space_handle_t, bus_size_t, bus_size_t); | |
| 256 | }; | |
| 257 | ||
| 258 | extern struct bus_space bs_be_tag; | |
| 259 | extern struct bus_space bs_le_tag; | |
| 260 | ||
| 261 | #define	__bs_c(a,b)		__CONCAT(a,b) | |
| 262 | #define	__bs_opname(op,size)	__bs_c(__bs_c(__bs_c(bs_,op),_),size) | |
| 263 | ||
| 264 | #define	__bs_rs(sz, t, h, o)						\ | |
| 265 | 	(*(t)->__bs_opname(r,sz))(h, o) | |
| 266 | #define	__bs_ws(sz, t, h, o, v)				\ | |
| 267 | 	(*(t)->__bs_opname(w,sz))(h, o, v) | |
| 268 | #define	__bs_nonsingle(type, sz, t, h, o, a, c)				\ | |
| 269 | 	(*(t)->__bs_opname(type,sz))(h, o, a, c) | |
| 270 | #define	__bs_set(type, sz, t, h, o, v, c)				\ | |
| 271 | 	(*(t)->__bs_opname(type,sz))(h, o, v, c) | |
| 272 | #define	__bs_copy(sz, t, h1, o1, h2, o2, cnt)				\ | |
| 273 | 	(*(t)->__bs_opname(c,sz))(h1, o1, h2, o2, cnt) | |
| 274 | ||
| 275 | /* | |
| 276 | * Mapping and unmapping operations. | |
| 277 | */ | |
| 278 | #define bus_space_map(t, a, s, c, hp) (*(t)->bs_map)(a, s, c, hp) | |
| 279 | #define bus_space_unmap(t, h, s)	(*(t)->bs_unmap)(h, s) | |
| 280 | #define	bus_space_subregion(t, h, o, s, hp)	(*(t)->bs_subregion)(h, o, s, hp) | |
| 281 | ||
| 282 | /* | |
| 283 | * Allocation and deallocation operations. | |
| 284 | */ | |
| 285 | #define	bus_space_alloc(t, rs, re, s, a, b, c, ap, hp)	\ | |
| 286 | 	(*(t)->bs_alloc)(rs, re, s, a, b, c, ap, hp) | |
| 287 | #define	bus_space_free(t, h, s)				\ | |
| 288 | 	(*(t)->bs_free)(h, s) | |
| 289 | ||
| 290 | /* | |
| 291 | * Bus barrier operations. | |
| 292 | */ | |
| 293 | #define	bus_space_barrier(t, h, o, l, f)	(*(t)->bs_barrier)(h, o, l, f) | |
| 294 | ||
| 295 | /* | |
| 296 | * Bus read (single) operations. | |
| 297 | */ | |
| 298 | #define	bus_space_read_1(t, h, o)	__bs_rs(1,t,h,o) | |
| 299 | #define	bus_space_read_2(t, h, o)	__bs_rs(2,t,h,o) | |
| 300 | #define	bus_space_read_4(t, h, o)	__bs_rs(4,t,h,o) | |
| 301 | #define	bus_space_read_8(t, h, o)	__bs_rs(8,t,h,o) | |
| 302 | ||
| 303 | #define bus_space_read_stream_1 bus_space_read_1 | |
| 304 | #define	bus_space_read_stream_2(t, h, o)	__bs_rs(s_2,t,h,o) | |
| 305 | #define	bus_space_read_stream_4(t, h, o)	__bs_rs(s_4,t,h,o) | |
| 306 | #define	bus_space_read_stream_8(t, h, o)	__bs_rs(s_8,t,h,o) | |
| 307 | ||
| 308 | /* | |
| 309 | * Bus read multiple operations. | |
| 310 | */ | |
| 311 | #define	bus_space_read_multi_1(t, h, o, a, c)				\ | |
| 312 | 	__bs_nonsingle(rm,1,(t),(h),(o),(a),(c)) | |
| 313 | #define	bus_space_read_multi_2(t, h, o, a, c)				\ | |
| 314 | 	__bs_nonsingle(rm,2,(t),(h),(o),(a),(c)) | |
| 315 | #define	bus_space_read_multi_4(t, h, o, a, c)				\ | |
| 316 | 	__bs_nonsingle(rm,4,(t),(h),(o),(a),(c)) | |
| 317 | #define	bus_space_read_multi_8(t, h, o, a, c)				\ | |
| 318 | 	__bs_nonsingle(rm,8,(t),(h),(o),(a),(c)) | |
| 319 | ||
| 320 | #define bus_space_read_multi_stream_1 bus_space_read_multi_1 | |
| 321 | #define	bus_space_read_multi_stream_2(t, h, o, a, c)			\ | |
| 322 | 	__bs_nonsingle(rm,s_2,(t),(h),(o),(a),(c)) | |
| 323 | #define	bus_space_read_multi_stream_4(t, h, o, a, c)			\ | |
| 324 | 	__bs_nonsingle(rm,s_4,(t),(h),(o),(a),(c)) | |
| 325 | #define	bus_space_read_multi_stream_8(t, h, o, a, c)			\ | |
| 326 | 	__bs_nonsingle(rm,s_8,(t),(h),(o),(a),(c)) | |
| 327 | ||
| 328 | /* | |
| 329 | * Bus read region operations. | |
| 330 | */ | |
| 331 | #define	bus_space_read_region_1(t, h, o, a, c)				\ | |
| 332 | 	__bs_nonsingle(rr,1,(t),(h),(o),(a),(c)) | |
| 333 | #define	bus_space_read_region_2(t, h, o, a, c)				\ | |
| 334 | 	__bs_nonsingle(rr,2,(t),(h),(o),(a),(c)) | |
| 335 | #define	bus_space_read_region_4(t, h, o, a, c)				\ | |
| 336 | 	__bs_nonsingle(rr,4,(t),(h),(o),(a),(c)) | |
| 337 | #define	bus_space_read_region_8(t, h, o, a, c)				\ | |
| 338 | 	__bs_nonsingle(rr,8,(t),(h),(o),(a),(c)) | |
| 339 | ||
| 340 | #define bus_space_read_region_stream_1 bus_space_read_region_1 | |
| 341 | #define	bus_space_read_region_stream_2(t, h, o, a, c)			\ | |
| 342 | 	__bs_nonsingle(rr,s_2,(t),(h),(o),(a),(c)) | |
| 343 | #define	bus_space_read_region_stream_4(t, h, o, a, c)			\ | |
| 344 | 	__bs_nonsingle(rr,s_4,(t),(h),(o),(a),(c)) | |
| 345 | #define	bus_space_read_region_stream_8(t, h, o, a, c)			\ | |
| 346 | 	__bs_nonsingle(rr,s_8,(t),(h),(o),(a),(c)) | |
| 347 | ||
| 348 | /* | |
| 349 | * Bus write (single) operations. | |
| 350 | */ | |
| 351 | #define	bus_space_write_1(t, h, o, v)	__bs_ws(1,(t),(h),(o),(v)) | |
| 352 | #define	bus_space_write_2(t, h, o, v)	__bs_ws(2,(t),(h),(o),(v)) | |
| 353 | #define	bus_space_write_4(t, h, o, v)	__bs_ws(4,(t),(h),(o),(v)) | |
| 354 | #define	bus_space_write_8(t, h, o, v)	__bs_ws(8,(t),(h),(o),(v)) | |
| 355 | ||
| 356 | #define bus_space_write_stream_1 bus_space_write_1 | |
| 357 | #define	bus_space_write_stream_2(t, h, o, v)	__bs_ws(s_2,(t),(h),(o),(v)) | |
| 358 | #define	bus_space_write_stream_4(t, h, o, v)	__bs_ws(s_4,(t),(h),(o),(v)) | |
| 359 | #define	bus_space_write_stream_8(t, h, o, v)	__bs_ws(s_8,(t),(h),(o),(v)) | |
| 360 | ||
| 361 | /* | |
| 362 | * Bus write multiple operations. | |
| 363 | */ | |
| 364 | #define	bus_space_write_multi_1(t, h, o, a, c)				\ | |
| 365 | 	__bs_nonsingle(wm,1,(t),(h),(o),(a),(c)) | |
| 366 | #define	bus_space_write_multi_2(t, h, o, a, c)				\ | |
| 367 | 	__bs_nonsingle(wm,2,(t),(h),(o),(a),(c)) | |
| 368 | #define	bus_space_write_multi_4(t, h, o, a, c)				\ | |
| 369 | 	__bs_nonsingle(wm,4,(t),(h),(o),(a),(c)) | |
| 370 | #define	bus_space_write_multi_8(t, h, o, a, c)				\ | |
| 371 | 	__bs_nonsingle(wm,8,(t),(h),(o),(a),(c)) | |
| 372 | ||
| 373 | #define bus_space_write_multi_stream_1 bus_space_write_multi_1 | |
| 374 | #define	bus_space_write_multi_stream_2(t, h, o, a, c)			\ | |
| 375 | 	__bs_nonsingle(wm,s_2,(t),(h),(o),(a),(c)) | |
| 376 | #define	bus_space_write_multi_stream_4(t, h, o, a, c)			\ | |
| 377 | 	__bs_nonsingle(wm,s_4,(t),(h),(o),(a),(c)) | |
| 378 | #define	bus_space_write_multi_stream_8(t, h, o, a, c)			\ | |
| 379 | 	__bs_nonsingle(wm,s_8,(t),(h),(o),(a),(c)) | |
| 380 | ||
| 381 | /* | |
| 382 | * Bus write region operations. | |
| 383 | */ | |
| 384 | #define	bus_space_write_region_1(t, h, o, a, c)				\ | |
| 385 | 	__bs_nonsingle(wr,1,(t),(h),(o),(a),(c)) | |
| 386 | #define	bus_space_write_region_2(t, h, o, a, c)				\ | |
| 387 | 	__bs_nonsingle(wr,2,(t),(h),(o),(a),(c)) | |
| 388 | #define	bus_space_write_region_4(t, h, o, a, c)				\ | |
| 389 | 	__bs_nonsingle(wr,4,(t),(h),(o),(a),(c)) | |
| 390 | #define	bus_space_write_region_8(t, h, o, a, c)				\ | |
| 391 | 	__bs_nonsingle(wr,8,(t),(h),(o),(a),(c)) | |
| 392 | ||
| 393 | #define bus_space_write_region_stream_1 bus_space_write_region_1 | |
| 394 | #define	bus_space_write_region_stream_2(t, h, o, a, c)			\ | |
| 395 | 	__bs_nonsingle(wr,s_2,(t),(h),(o),(a),(c)) | |
| 396 | #define	bus_space_write_region_stream_4(t, h, o, a, c)			\ | |
| 397 | 	__bs_nonsingle(wr,s_4,(t),(h),(o),(a),(c)) | |
| 398 | #define	bus_space_write_region_stream_8(t, h, o, a, c)			\ | |
| 399 | 	__bs_nonsingle(wr,s_8,(t),(h),(o),(a),(c)) | |
| 400 | ||
| 401 | /* | |
| 402 | * Set multiple operations. | |
| 403 | */ | |
| 404 | #define	bus_space_set_multi_1(t, h, o, v, c)				\ | |
| 405 | 	__bs_set(sm,1,(t),(h),(o),(v),(c)) | |
| 406 | #define	bus_space_set_multi_2(t, h, o, v, c)				\ | |
| 407 | 	__bs_set(sm,2,(t),(h),(o),(v),(c)) | |
| 408 | #define	bus_space_set_multi_4(t, h, o, v, c)				\ | |
| 409 | 	__bs_set(sm,4,(t),(h),(o),(v),(c)) | |
| 410 | #define	bus_space_set_multi_8(t, h, o, v, c)				\ | |
| 411 | 	__bs_set(sm,8,(t),(h),(o),(v),(c)) | |
| 412 | ||
| 413 | #define bus_space_set_multi_stream_1 bus_space_set_multi_1 | |
| 414 | #define	bus_space_set_multi_stream_2(t, h, o, v, c)			\ | |
| 415 | 	__bs_set(sm,s_2,(t),(h),(o),(v),(c)) | |
| 416 | #define	bus_space_set_multi_stream_4(t, h, o, v, c)			\ | |
| 417 | 	__bs_set(sm,s_4,(t),(h),(o),(v),(c)) | |
| 418 | #define	bus_space_set_multi_stream_8(t, h, o, v, c)			\ | |
| 419 | 	__bs_set(sm,s_8,(t),(h),(o),(v),(c)) | |
| 420 | ||
| 421 | /* | |
| 422 | * Set region operations. | |
| 423 | */ | |
| 424 | #define	bus_space_set_region_1(t, h, o, v, c)				\ | |
| 425 | 	__bs_set(sr,1,(t),(h),(o),(v),(c)) | |
| 426 | #define	bus_space_set_region_2(t, h, o, v, c)				\ | |
| 427 | 	__bs_set(sr,2,(t),(h),(o),(v),(c)) | |
| 428 | #define	bus_space_set_region_4(t, h, o, v, c)				\ | |
| 429 | 	__bs_set(sr,4,(t),(h),(o),(v),(c)) | |
| 430 | #define	bus_space_set_region_8(t, h, o, v, c)				\ | |
| 431 | 	__bs_set(sr,8,(t),(h),(o),(v),(c)) | |
| 432 | ||
| 433 | #define bus_space_set_region_stream_1 bus_space_set_region_1 | |
| 434 | #define	bus_space_set_region_stream_2(t, h, o, v, c)			\ | |
| 435 | 	__bs_set(sr,s_2,(t),(h),(o),(v),(c)) | |
| 436 | #define	bus_space_set_region_stream_4(t, h, o, v, c)			\ | |
| 437 | 	__bs_set(sr,s_4,(t),(h),(o),(v),(c)) | |
| 438 | #define	bus_space_set_region_stream_8(t, h, o, v, c)			\ | |
| 439 | 	__bs_set(sr,s_8,(t),(h),(o),(v),(c)) | |
| 440 | ||
| 441 | #if 0 | |
| 442 | /* | |
| 443 | * Copy operations. | |
| 444 | */ | |
| 445 | #define	bus_space_copy_region_1(t, h1, o1, h2, o2, c)				\ | |
| 446 | 	__bs_copy(1, t, h1, o1, h2, o2, c) | |
| 447 | #define	bus_space_copy_region_2(t, h1, o1, h2, o2, c)				\ | |
| 448 | 	__bs_copy(2, t, h1, o1, h2, o2, c) | |
| 449 | #define	bus_space_copy_region_4(t, h1, o1, h2, o2, c)				\ | |
| 450 | 	__bs_copy(4, t, h1, o1, h2, o2, c) | |
| 451 | #define	bus_space_copy_region_8(t, h1, o1, h2, o2, c)				\ | |
| 452 | 	__bs_copy(8, t, h1, o1, h2, o2, c) | |
| 453 | ||
| 454 | #define bus_space_copy_region_stream_1 bus_space_copy_region_1 | |
| 455 | #define	bus_space_copy_region_stream_2(t, h1, o1, h2, o2, c)			\ | |
| 456 | 	__bs_copy(s_2, t, h1, o1, h2, o2, c) | |
| 457 | #define	bus_space_copy_region_stream_4(t, h1, o1, h2, o2, c)			\ | |
| 458 | 	__bs_copy(s_4, t, h1, o1, h2, o2, c) | |
| 459 | #define	bus_space_copy_region_stream_8(t, h1, o1, h2, o2, c)			\ | |
| 460 | 	__bs_copy(s_8, t, h1, o1, h2, o2, c) | |
| 461 | #endif | |
| 462 | ||
| 463 | #define BUS_PEEK_FUNC(width, type)					\ | |
| 464 | 	static inline int						\ | |
| 465 | 	bus_space_peek_##width(bus_space_tag_t tag,			\ | |
| 466 | 	 bus_space_handle_t hnd, bus_size_t offset, type *value)	\ | |
| 467 | 	{								\ | |
| 468 | 		type tmp;						\ | |
| 469 | 		tmp = bus_space_read_##width(tag, hnd, offset);		\ | |
| 470 | 		*value = (type)tmp;					\ | |
| 471 | 		return (0);						\ | |
| 472 | 	} | |
| 473 | BUS_PEEK_FUNC(1, uint8_t) | |
| 474 | BUS_PEEK_FUNC(2, uint16_t) | |
| 475 | BUS_PEEK_FUNC(4, uint32_t) | |
| 476 | BUS_PEEK_FUNC(8, uint64_t) | |
| 477 | ||
| 478 | #define BUS_POKE_FUNC(width, type)					\ | |
| 479 | 	static inline int						\ | |
| 480 | 	bus_space_poke_##width(bus_space_tag_t tag,			\ | |
| 481 | 	 bus_space_handle_t hnd, bus_size_t offset, type value)	\ | |
| 482 | 	{								\ | |
| 483 | 		bus_space_write_##width(tag, hnd, offset, value);	\ | |
| 484 | 		return (0); 						\ | |
| 485 | 	} | |
| 486 | BUS_POKE_FUNC(1, uint8_t) | |
| 487 | BUS_POKE_FUNC(2, uint16_t) | |
| 488 | BUS_POKE_FUNC(4, uint32_t) | |
| 489 | BUS_POKE_FUNC(8, uint64_t) | |
| 490 | ||
| 491 | #include <machine/bus_dma.h> | |
| 492 | ||
| 493 | #endif /* _MACHINE_BUS_H_ */ | |
| \ No newline at end of file |
lib/libc/include/powerpc64-freebsd-none/machine/bus_dma.h created+37| ... | ... | @@ -0,0 +1,37 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-2-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 2005 Scott Long | |
| 5 | * All rights reserved. | |
| 6 | * | |
| 7 | * Redistribution and use in source and binary forms, with or without | |
| 8 | * modification, are permitted provided that the following conditions | |
| 9 | * are met: | |
| 10 | * 1. Redistributions of source code must retain the above copyright | |
| 11 | * notice, this list of conditions and the following disclaimer. | |
| 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 13 | * notice, this list of conditions and the following disclaimer in the | |
| 14 | * documentation and/or other materials provided with the distribution. | |
| 15 | * | |
| 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |
| 17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
| 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | |
| 20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
| 21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
| 22 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
| 23 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
| 24 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
| 25 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
| 26 | * SUCH DAMAGE. | |
| 27 | */ | |
| 28 | ||
| 29 | #ifndef _POWERPC_BUS_DMA_H_ | |
| 30 | #define _POWERPC_BUS_DMA_H_ | |
| 31 | ||
| 32 | #include <sys/bus_dma.h> | |
| 33 | #include <sys/bus_dma_internal.h> | |
| 34 | ||
| 35 | int bus_dma_tag_set_iommu(bus_dma_tag_t, device_t iommu, void *cookie); | |
| 36 | ||
| 37 | #endif /* _POWERPC_BUS_DMA_H_ */ | |
| \ No newline at end of file |
lib/libc/include/powerpc64-freebsd-none/machine/clock.h created+18| ... | ... | @@ -0,0 +1,18 @@ |
| 1 | /*- | |
| 2 | * Kernel interface to machine-dependent clock driver. | |
| 3 | * Garrett Wollman, September 1994. | |
| 4 | * This file is in the public domain. | |
| 5 | */ | |
| 6 | ||
| 7 | #ifndef _MACHINE_CLOCK_H_ | |
| 8 | #define	_MACHINE_CLOCK_H_ | |
| 9 | ||
| 10 | #ifdef _KERNEL | |
| 11 | ||
| 12 | struct trapframe; | |
| 13 | ||
| 14 | void	decr_intr(struct trapframe *); | |
| 15 | ||
| 16 | #endif | |
| 17 | ||
| 18 | #endif /* !_MACHINE_CLOCK_H_ */ | |
| \ No newline at end of file |
lib/libc/include/powerpc64-freebsd-none/machine/counter.h created+164| ... | ... | @@ -0,0 +1,164 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-2-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 2012, 2013 Konstantin Belousov <kib@FreeBSD.org> | |
| 5 | * All rights reserved. | |
| 6 | * | |
| 7 | * Redistribution and use in source and binary forms, with or without | |
| 8 | * modification, are permitted provided that the following conditions | |
| 9 | * are met: | |
| 10 | * 1. Redistributions of source code must retain the above copyright | |
| 11 | * notice, this list of conditions and the following disclaimer. | |
| 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 13 | * notice, this list of conditions and the following disclaimer in the | |
| 14 | * documentation and/or other materials provided with the distribution. | |
| 15 | * | |
| 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |
| 17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
| 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | |
| 20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
| 21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
| 22 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
| 23 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
| 24 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
| 25 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
| 26 | * SUCH DAMAGE. | |
| 27 | */ | |
| 28 | ||
| 29 | #ifndef __MACHINE_COUNTER_H__ | |
| 30 | #define __MACHINE_COUNTER_H__ | |
| 31 | ||
| 32 | #include <sys/pcpu.h> | |
| 33 | #ifdef INVARIANTS | |
| 34 | #include <sys/proc.h> | |
| 35 | #endif | |
| 36 | ||
| 37 | #define	EARLY_COUNTER	&__pcpu[0].pc_early_dummy_counter | |
| 38 | ||
| 39 | #ifdef __powerpc64__ | |
| 40 | ||
| 41 | #define	counter_enter()	do {} while (0) | |
| 42 | #define	counter_exit()	do {} while (0) | |
| 43 | ||
| 44 | #ifdef IN_SUBR_COUNTER_C | |
| 45 | static inline uint64_t | |
| 46 | counter_u64_read_one(uint64_t *p, int cpu) | |
| 47 | { | |
| 48 | ||
| 49 | 	return (*(uint64_t *)((char *)p + UMA_PCPU_ALLOC_SIZE * cpu)); | |
| 50 | } | |
| 51 | ||
| 52 | static inline uint64_t | |
| 53 | counter_u64_fetch_inline(uint64_t *p) | |
| 54 | { | |
| 55 | 	uint64_t r; | |
| 56 | 	int i; | |
| 57 | ||
| 58 | 	r = 0; | |
| 59 | 	CPU_FOREACH(i) | |
| 60 | 		r += counter_u64_read_one((uint64_t *)p, i); | |
| 61 | ||
| 62 | 	return (r); | |
| 63 | } | |
| 64 | ||
| 65 | static void | |
| 66 | counter_u64_zero_one_cpu(void *arg) | |
| 67 | { | |
| 68 | ||
| 69 | 	*((uint64_t *)((char *)arg + UMA_PCPU_ALLOC_SIZE * | |
| 70 | 	 PCPU_GET(cpuid))) = 0; | |
| 71 | } | |
| 72 | ||
| 73 | static inline void | |
| 74 | counter_u64_zero_inline(counter_u64_t c) | |
| 75 | { | |
| 76 | ||
| 77 | 	smp_rendezvous(smp_no_rendezvous_barrier, counter_u64_zero_one_cpu, | |
| 78 | 	 smp_no_rendezvous_barrier, c); | |
| 79 | } | |
| 80 | #endif | |
| 81 | ||
| 82 | #define	counter_u64_add_protected(c, i)	counter_u64_add(c, i) | |
| 83 | ||
| 84 | static inline void | |
| 85 | counter_u64_add(counter_u64_t c, int64_t inc) | |
| 86 | { | |
| 87 | 	uint64_t ccpu, old; | |
| 88 | ||
| 89 | 	__asm __volatile("\n" | |
| 90 | "1:\n\t" | |
| 91 | 	 "mfsprg	%0, 0\n\t" | |
| 92 | 	 "ldarx	%1, %0, %2\n\t" | |
| 93 | 	 "add	%1, %1, %3\n\t" | |
| 94 | 	 "stdcx.	%1, %0, %2\n\t" | |
| 95 | 	 "bne-	1b" | |
| 96 | 	 : "=&b" (ccpu), "=&r" (old) | |
| 97 | 	 : "r" ((char *)c - (char *)&__pcpu[0]), "r" (inc) | |
| 98 | 	 : "cr0", "memory"); | |
| 99 | } | |
| 100 | ||
| 101 | #else	/* !64bit */ | |
| 102 | ||
| 103 | #include <sys/systm.h> | |
| 104 | ||
| 105 | #define	counter_enter()	critical_enter() | |
| 106 | #define	counter_exit()	critical_exit() | |
| 107 | ||
| 108 | #ifdef IN_SUBR_COUNTER_C | |
| 109 | /* XXXKIB non-atomic 64bit read */ | |
| 110 | static inline uint64_t | |
| 111 | counter_u64_read_one(uint64_t *p, int cpu) | |
| 112 | { | |
| 113 | ||
| 114 | 	return (*(uint64_t *)((char *)p + UMA_PCPU_ALLOC_SIZE * cpu)); | |
| 115 | } | |
| 116 | ||
| 117 | static inline uint64_t | |
| 118 | counter_u64_fetch_inline(uint64_t *p) | |
| 119 | { | |
| 120 | 	uint64_t r; | |
| 121 | 	int i; | |
| 122 | ||
| 123 | 	r = 0; | |
| 124 | 	for (i = 0; i < mp_ncpus; i++) | |
| 125 | 		r += counter_u64_read_one((uint64_t *)p, i); | |
| 126 | ||
| 127 | 	return (r); | |
| 128 | } | |
| 129 | ||
| 130 | /* XXXKIB non-atomic 64bit store, might interrupt increment */ | |
| 131 | static void | |
| 132 | counter_u64_zero_one_cpu(void *arg) | |
| 133 | { | |
| 134 | ||
| 135 | 	*((uint64_t *)((char *)arg + UMA_PCPU_ALLOC_SIZE * | |
| 136 | 	 PCPU_GET(cpuid))) = 0; | |
| 137 | } | |
| 138 | ||
| 139 | static inline void | |
| 140 | counter_u64_zero_inline(counter_u64_t c) | |
| 141 | { | |
| 142 | ||
| 143 | 	smp_rendezvous(smp_no_rendezvous_barrier, counter_u64_zero_one_cpu, | |
| 144 | 	 smp_no_rendezvous_barrier, c); | |
| 145 | } | |
| 146 | #endif | |
| 147 | ||
| 148 | #define	counter_u64_add_protected(c, inc)	do {	\ | |
| 149 | 	CRITICAL_ASSERT(curthread);			\ | |
| 150 | 	*(uint64_t *)zpcpu_get(c) += (inc);		\ | |
| 151 | } while (0) | |
| 152 | ||
| 153 | static inline void | |
| 154 | counter_u64_add(counter_u64_t c, int64_t inc) | |
| 155 | { | |
| 156 | ||
| 157 | 	counter_enter(); | |
| 158 | 	counter_u64_add_protected(c, inc); | |
| 159 | 	counter_exit(); | |
| 160 | } | |
| 161 | ||
| 162 | #endif	/* 64bit */ | |
| 163 | ||
| 164 | #endif	/* ! __MACHINE_COUNTER_H__ */ | |
| \ No newline at end of file |
lib/libc/include/powerpc64-freebsd-none/machine/cpu.h created+157| ... | ... | @@ -0,0 +1,157 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-4-Clause | |
| 3 | * | |
| 4 | * Copyright (C) 1995-1997 Wolfgang Solfrank. | |
| 5 | * Copyright (C) 1995-1997 TooLs GmbH. | |
| 6 | * All rights reserved. | |
| 7 | * | |
| 8 | * Redistribution and use in source and binary forms, with or without | |
| 9 | * modification, are permitted provided that the following conditions | |
| 10 | * are met: | |
| 11 | * 1. Redistributions of source code must retain the above copyright | |
| 12 | * notice, this list of conditions and the following disclaimer. | |
| 13 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 14 | * notice, this list of conditions and the following disclaimer in the | |
| 15 | * documentation and/or other materials provided with the distribution. | |
| 16 | * 3. All advertising materials mentioning features or use of this software | |
| 17 | * must display the following acknowledgement: | |
| 18 | *	This product includes software developed by TooLs GmbH. | |
| 19 | * 4. The name of TooLs GmbH may not be used to endorse or promote products | |
| 20 | * derived from this software without specific prior written permission. | |
| 21 | * | |
| 22 | * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR | |
| 23 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |
| 24 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | |
| 25 | * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
| 26 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | |
| 27 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; | |
| 28 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | |
| 29 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | |
| 30 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | |
| 31 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 32 | * | |
| 33 | *	$NetBSD: cpu.h,v 1.11 2000/05/26 21:19:53 thorpej Exp $ | |
| 34 | */ | |
| 35 | ||
| 36 | #ifndef _MACHINE_CPU_H_ | |
| 37 | #define	_MACHINE_CPU_H_ | |
| 38 | ||
| 39 | #include <machine/frame.h> | |
| 40 | #include <machine/pcb.h> | |
| 41 | #include <machine/psl.h> | |
| 42 | ||
| 43 | /* | |
| 44 | * CPU Feature Attributes | |
| 45 | * | |
| 46 | * These are defined in the PowerPC ELF ABI for the AT_HWCAP vector, | |
| 47 | * and are exported to userland via the machdep.cpu_features | |
| 48 | * sysctl. | |
| 49 | */ | |
| 50 | ||
| 51 | extern u_long cpu_features; | |
| 52 | extern u_long cpu_features2; | |
| 53 | ||
| 54 | #define	PPC_FEATURE_32		0x80000000	/* Always true */ | |
| 55 | #define	PPC_FEATURE_64		0x40000000	/* Defined on a 64-bit CPU */ | |
| 56 | #define	PPC_FEATURE_601_INSTR	0x20000000	/* Defined on a 64-bit CPU */ | |
| 57 | #define	PPC_FEATURE_HAS_ALTIVEC	0x10000000	 | |
| 58 | #define	PPC_FEATURE_HAS_FPU	0x08000000 | |
| 59 | #define	PPC_FEATURE_HAS_MMU	0x04000000 | |
| 60 | #define	PPC_FEATURE_UNIFIED_CACHE 0x01000000 | |
| 61 | #define	PPC_FEATURE_HAS_SPE	0x00800000 | |
| 62 | #define	PPC_FEATURE_HAS_EFP_SINGLE	0x00400000 | |
| 63 | #define	PPC_FEATURE_HAS_EFP_DOUBLE	0x00200000 | |
| 64 | #define	PPC_FEATURE_NO_TB	0x00100000 | |
| 65 | #define	PPC_FEATURE_POWER4	0x00080000 | |
| 66 | #define	PPC_FEATURE_POWER5	0x00040000 | |
| 67 | #define	PPC_FEATURE_POWER5_PLUS	0x00020000 | |
| 68 | #define	PPC_FEATURE_CELL	0x00010000 | |
| 69 | #define	PPC_FEATURE_BOOKE	0x00008000 | |
| 70 | #define	PPC_FEATURE_SMT		0x00004000 | |
| 71 | #define	PPC_FEATURE_ICACHE_SNOOP	0x00002000 | |
| 72 | #define	PPC_FEATURE_ARCH_2_05	0x00001000 | |
| 73 | #define	PPC_FEATURE_HAS_DFP	0x00000400 | |
| 74 | #define	PPC_FEATURE_POWER6_EXT	0x00000200 | |
| 75 | #define	PPC_FEATURE_ARCH_2_06	0x00000100 | |
| 76 | #define	PPC_FEATURE_HAS_VSX	0x00000080 | |
| 77 | #define	PPC_FEATURE_TRUE_LE	0x00000002 | |
| 78 | #define	PPC_FEATURE_PPC_LE	0x00000001 | |
| 79 | ||
| 80 | #define	PPC_FEATURE2_ARCH_2_07	0x80000000 | |
| 81 | #define	PPC_FEATURE2_HTM	0x40000000 | |
| 82 | #define	PPC_FEATURE2_DSCR	0x20000000 | |
| 83 | #define	PPC_FEATURE2_EBB	0x10000000 | |
| 84 | #define	PPC_FEATURE2_ISEL	0x08000000 | |
| 85 | #define	PPC_FEATURE2_TAR	0x04000000 | |
| 86 | #define	PPC_FEATURE2_HAS_VEC_CRYPTO	0x02000000 | |
| 87 | #define	PPC_FEATURE2_HTM_NOSC	0x01000000 | |
| 88 | #define	PPC_FEATURE2_ARCH_3_00	0x00800000 | |
| 89 | #define	PPC_FEATURE2_HAS_IEEE128	0x00400000 | |
| 90 | #define	PPC_FEATURE2_DARN	0x00200000 | |
| 91 | #define	PPC_FEATURE2_SCV	0x00100000 | |
| 92 | #define	PPC_FEATURE2_HTM_NOSUSPEND	0x00080000 | |
| 93 | #define	PPC_FEATURE2_ARCH_3_1	0x00040000 | |
| 94 | #define	PPC_FEATURE2_MMA	0x00020000 | |
| 95 | ||
| 96 | #define	PPC_FEATURE_BITMASK						\ | |
| 97 | 	"\20"								\ | |
| 98 | 	"\040PPC32\037PPC64\036PPC601\035ALTIVEC\034FPU\033MMU\031UNIFIEDCACHE"	\ | |
| 99 | 	"\030SPE\027SPESFP\026DPESFP\025NOTB\024POWER4\023POWER5\022P5PLUS\021CELL"\ | |
| 100 | 	"\020BOOKE\017SMT\016ISNOOP\015ARCH205\013DFP\011ARCH206\010VSX"\ | |
| 101 | 	"\002TRUELE\001PPCLE" | |
| 102 | #define	PPC_FEATURE2_BITMASK						\ | |
| 103 | 	"\20"								\ | |
| 104 | 	"\040ARCH207\037HTM\036DSCR\034ISEL\033TAR\032VCRYPTO\031HTMNOSC" \ | |
| 105 | 	"\030ARCH300\027IEEE128\026DARN\025SCV\024HTMNOSUSP" | |
| 106 | ||
| 107 | #define	TRAPF_USERMODE(frame)	(((frame)->srr1 & PSL_PR) != 0) | |
| 108 | #define	TRAPF_PC(frame)		((frame)->srr0) | |
| 109 | ||
| 110 | /* | |
| 111 | * CTL_MACHDEP definitions. | |
| 112 | */ | |
| 113 | #define	CPU_CACHELINE	1 | |
| 114 | ||
| 115 | static __inline u_int64_t | |
| 116 | get_cyclecount(void) | |
| 117 | { | |
| 118 | 	u_int32_t _upper, _lower; | |
| 119 | 	u_int64_t _time; | |
| 120 | ||
| 121 | 	__asm __volatile( | |
| 122 | 		"mftb %0\n" | |
| 123 | 		"mftbu %1" | |
| 124 | 		: "=r" (_lower), "=r" (_upper)); | |
| 125 | ||
| 126 | 	_time = (u_int64_t)_upper; | |
| 127 | 	_time = (_time << 32) + _lower; | |
| 128 | 	return (_time); | |
| 129 | } | |
| 130 | ||
| 131 | #define	cpu_getstack(td)	((td)->td_frame->fixreg[1]) | |
| 132 | #define	cpu_spinwait()		__asm __volatile("or 27,27,27") /* yield */ | |
| 133 | #define	cpu_lock_delay()	DELAY(1) | |
| 134 | ||
| 135 | extern char btext[]; | |
| 136 | extern char etext[]; | |
| 137 | ||
| 138 | struct thread; | |
| 139 | ||
| 140 | #ifdef __powerpc64__ | |
| 141 | extern void enter_idle_powerx(void); | |
| 142 | extern uint64_t can_wakeup; | |
| 143 | extern register_t lpcr; | |
| 144 | #endif | |
| 145 | ||
| 146 | void	cpu_halt(void); | |
| 147 | void	cpu_reset(void); | |
| 148 | void	flush_disable_caches(void); | |
| 149 | void	fork_trampoline(void); | |
| 150 | int	cpu_machine_check(struct thread *, struct trapframe *, int *); | |
| 151 | ||
| 152 | ||
| 153 | #ifndef __powerpc64__ | |
| 154 | void	mpc745x_sleep(void); | |
| 155 | #endif | |
| 156 | ||
| 157 | #endif	/* _MACHINE_CPU_H_ */ | |
| \ No newline at end of file |
lib/libc/include/powerpc64-freebsd-none/machine/cpufunc.h created+298| ... | ... | @@ -0,0 +1,298 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-2-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 1998 Doug Rabson | |
| 5 | * All rights reserved. | |
| 6 | * | |
| 7 | * Redistribution and use in source and binary forms, with or without | |
| 8 | * modification, are permitted provided that the following conditions | |
| 9 | * are met: | |
| 10 | * 1. Redistributions of source code must retain the above copyright | |
| 11 | * notice, this list of conditions and the following disclaimer. | |
| 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 13 | * notice, this list of conditions and the following disclaimer in the | |
| 14 | * documentation and/or other materials provided with the distribution. | |
| 15 | * | |
| 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |
| 17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
| 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | |
| 20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
| 21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
| 22 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
| 23 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
| 24 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
| 25 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
| 26 | * SUCH DAMAGE. | |
| 27 | */ | |
| 28 | ||
| 29 | #ifndef _MACHINE_CPUFUNC_H_ | |
| 30 | #define	_MACHINE_CPUFUNC_H_ | |
| 31 | ||
| 32 | #ifdef _KERNEL | |
| 33 | ||
| 34 | #include <sys/types.h> | |
| 35 | ||
| 36 | #include <machine/psl.h> | |
| 37 | #include <machine/spr.h> | |
| 38 | ||
| 39 | struct thread; | |
| 40 | ||
| 41 | #ifdef KDB | |
| 42 | void breakpoint(void); | |
| 43 | #else | |
| 44 | static __inline void | |
| 45 | breakpoint(void) | |
| 46 | { | |
| 47 | ||
| 48 | 	return; | |
| 49 | } | |
| 50 | #endif | |
| 51 | ||
| 52 | /* CPU register mangling inlines */ | |
| 53 | ||
| 54 | static __inline void | |
| 55 | mtmsr(register_t value) | |
| 56 | { | |
| 57 | ||
| 58 | 	__asm __volatile ("mtmsr %0; isync" :: "r"(value)); | |
| 59 | } | |
| 60 | ||
| 61 | #ifdef __powerpc64__ | |
| 62 | static __inline void | |
| 63 | mtmsrd(register_t value) | |
| 64 | { | |
| 65 | ||
| 66 | 	__asm __volatile ("mtmsrd %0; isync" :: "r"(value)); | |
| 67 | } | |
| 68 | #endif | |
| 69 | ||
| 70 | static __inline register_t | |
| 71 | mfmsr(void) | |
| 72 | { | |
| 73 | 	register_t value; | |
| 74 | ||
| 75 | 	__asm __volatile ("mfmsr %0" : "=r"(value)); | |
| 76 | ||
| 77 | 	return (value); | |
| 78 | } | |
| 79 | ||
| 80 | #ifndef __powerpc64__ | |
| 81 | static __inline void | |
| 82 | mtsrin(vm_offset_t va, register_t value) | |
| 83 | { | |
| 84 | ||
| 85 | 	__asm __volatile ("mtsrin %0,%1; isync" :: "r"(value), "r"(va)); | |
| 86 | } | |
| 87 | ||
| 88 | static __inline register_t | |
| 89 | mfsrin(vm_offset_t va) | |
| 90 | { | |
| 91 | 	register_t value; | |
| 92 | ||
| 93 | 	__asm __volatile ("mfsrin %0,%1" : "=r"(value) : "r"(va)); | |
| 94 | ||
| 95 | 	return (value); | |
| 96 | } | |
| 97 | #endif | |
| 98 | ||
| 99 | static __inline register_t | |
| 100 | mfctrl(void) | |
| 101 | { | |
| 102 | 	register_t value; | |
| 103 | ||
| 104 | 	__asm __volatile ("mfspr %0,136" : "=r"(value)); | |
| 105 | ||
| 106 | 	return (value); | |
| 107 | } | |
| 108 | ||
| 109 | static __inline void | |
| 110 | mtdec(register_t value) | |
| 111 | { | |
| 112 | ||
| 113 | 	__asm __volatile ("mtdec %0" :: "r"(value)); | |
| 114 | } | |
| 115 | ||
| 116 | static __inline register_t | |
| 117 | mfdec(void) | |
| 118 | { | |
| 119 | 	register_t value; | |
| 120 | ||
| 121 | 	__asm __volatile ("mfdec %0" : "=r"(value)); | |
| 122 | ||
| 123 | 	return (value); | |
| 124 | } | |
| 125 | ||
| 126 | static __inline uint32_t | |
| 127 | mfpvr(void) | |
| 128 | { | |
| 129 | 	uint32_t value; | |
| 130 | ||
| 131 | 	__asm __volatile ("mfpvr %0" : "=r"(value)); | |
| 132 | ||
| 133 | 	return (value); | |
| 134 | } | |
| 135 | ||
| 136 | static __inline u_quad_t | |
| 137 | mftb(void) | |
| 138 | { | |
| 139 | 	u_quad_t tb; | |
| 140 | #ifdef __powerpc64__ | |
| 141 | 	__asm __volatile ("mftb %0" : "=r"(tb)); | |
| 142 | #else | |
| 143 | 	uint32_t *tbup = (uint32_t *)&tb; | |
| 144 | 	uint32_t *tblp = tbup + 1; | |
| 145 | ||
| 146 | 	do { | |
| 147 | 		*tbup = mfspr(TBR_TBU); | |
| 148 | 		*tblp = mfspr(TBR_TBL); | |
| 149 | 	} while (*tbup != mfspr(TBR_TBU)); | |
| 150 | #endif | |
| 151 | ||
| 152 | 	return (tb); | |
| 153 | } | |
| 154 | ||
| 155 | static __inline void | |
| 156 | mttb(u_quad_t time) | |
| 157 | { | |
| 158 | ||
| 159 | 	mtspr(TBR_TBWL, 0); | |
| 160 | 	mtspr(TBR_TBWU, (uint32_t)(time >> 32)); | |
| 161 | 	mtspr(TBR_TBWL, (uint32_t)(time & 0xffffffff)); | |
| 162 | } | |
| 163 | ||
| 164 | static __inline register_t | |
| 165 | mffs(void) | |
| 166 | { | |
| 167 | 	uint64_t value; | |
| 168 | ||
| 169 | 	__asm __volatile ("mffs 0; stfd 0,0(%0)" | |
| 170 | 			:: "b"(&value)); | |
| 171 | ||
| 172 | 	return ((register_t)value); | |
| 173 | } | |
| 174 | ||
| 175 | static __inline void | |
| 176 | mtfsf(uint64_t value) | |
| 177 | { | |
| 178 | ||
| 179 | 	__asm __volatile ("lfd 0,0(%0); mtfsf 0xff,0" | |
| 180 | 			:: "b"(&value)); | |
| 181 | } | |
| 182 | ||
| 183 | static __inline void | |
| 184 | eieio(void) | |
| 185 | { | |
| 186 | ||
| 187 | 	__asm __volatile ("eieio" : : : "memory"); | |
| 188 | } | |
| 189 | ||
| 190 | static __inline void | |
| 191 | isync(void) | |
| 192 | { | |
| 193 | ||
| 194 | 	__asm __volatile ("isync" : : : "memory"); | |
| 195 | } | |
| 196 | ||
| 197 | static __inline void | |
| 198 | powerpc_sync(void) | |
| 199 | { | |
| 200 | ||
| 201 | 	__asm __volatile ("sync" : : : "memory"); | |
| 202 | } | |
| 203 | ||
| 204 | static __inline int | |
| 205 | cntlzd(uint64_t word) | |
| 206 | { | |
| 207 | 	uint64_t result; | |
| 208 | 	/* cntlzd %0, %1 */ | |
| 209 | 	__asm __volatile(".long 0x7c000074 | (%1 << 21) | (%0 << 16)" : | |
| 210 | 	 "=r"(result) : "r"(word)); | |
| 211 | ||
| 212 | 	return (int)result; | |
| 213 | } | |
| 214 | ||
| 215 | static __inline int | |
| 216 | cnttzd(uint64_t word) | |
| 217 | { | |
| 218 | 	uint64_t result; | |
| 219 | 	/* cnttzd %0, %1 */ | |
| 220 | 	__asm __volatile(".long 0x7c000474 | (%1 << 21) | (%0 << 16)" : | |
| 221 | 	 "=r"(result) : "r"(word)); | |
| 222 | ||
| 223 | 	return (int)result; | |
| 224 | } | |
| 225 | ||
| 226 | static __inline void | |
| 227 | ptesync(void) | |
| 228 | { | |
| 229 | 	__asm __volatile("ptesync"); | |
| 230 | } | |
| 231 | ||
| 232 | static __inline register_t | |
| 233 | intr_disable(void) | |
| 234 | { | |
| 235 | 	register_t msr; | |
| 236 | ||
| 237 | 	msr = mfmsr(); | |
| 238 | 	mtmsr(msr & ~PSL_EE); | |
| 239 | 	return (msr); | |
| 240 | } | |
| 241 | ||
| 242 | static __inline void | |
| 243 | intr_restore(register_t msr) | |
| 244 | { | |
| 245 | ||
| 246 | 	mtmsr(msr); | |
| 247 | } | |
| 248 | ||
| 249 | static __inline struct pcpu * | |
| 250 | get_pcpu(void) | |
| 251 | { | |
| 252 | 	struct pcpu *ret; | |
| 253 | ||
| 254 | 	__asm __volatile("mfsprg %0, 0" : "=r"(ret)); | |
| 255 | ||
| 256 | 	return (ret); | |
| 257 | } | |
| 258 | ||
| 259 | /* "NOP" operations to signify priorities to the kernel. */ | |
| 260 | static __inline void | |
| 261 | nop_prio_vlow(void) | |
| 262 | { | |
| 263 | 	__asm __volatile("or 31,31,31"); | |
| 264 | } | |
| 265 | ||
| 266 | static __inline void | |
| 267 | nop_prio_low(void) | |
| 268 | { | |
| 269 | 	__asm __volatile("or 1,1,1"); | |
| 270 | } | |
| 271 | ||
| 272 | static __inline void | |
| 273 | nop_prio_mlow(void) | |
| 274 | { | |
| 275 | 	__asm __volatile("or 6,6,6"); | |
| 276 | } | |
| 277 | ||
| 278 | static __inline void | |
| 279 | nop_prio_medium(void) | |
| 280 | { | |
| 281 | 	__asm __volatile("or 2,2,2"); | |
| 282 | } | |
| 283 | ||
| 284 | static __inline void | |
| 285 | nop_prio_mhigh(void) | |
| 286 | { | |
| 287 | 	__asm __volatile("or 5,5,5"); | |
| 288 | } | |
| 289 | ||
| 290 | static __inline void | |
| 291 | nop_prio_high(void) | |
| 292 | { | |
| 293 | 	__asm __volatile("or 3,3,3"); | |
| 294 | } | |
| 295 | ||
| 296 | #endif /* _KERNEL */ | |
| 297 | ||
| 298 | #endif /* !_MACHINE_CPUFUNC_H_ */ | |
| \ No newline at end of file |
lib/libc/include/powerpc64-freebsd-none/machine/db_machdep.h created+87| ... | ... | @@ -0,0 +1,87 @@ |
| 1 | /*- | |
| 2 | * Mach Operating System | |
| 3 | * Copyright (c) 1992 Carnegie Mellon University | |
| 4 | * All Rights Reserved. | |
| 5 | * | |
| 6 | * Permission to use, copy, modify and distribute this software and its | |
| 7 | * documentation is hereby granted, provided that both the copyright | |
| 8 | * notice and this permission notice appear in all copies of the | |
| 9 | * software, derivative works or modified versions, and any portions | |
| 10 | * thereof, and that both notices appear in supporting documentation. | |
| 11 | * | |
| 12 | * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" | |
| 13 | * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR | |
| 14 | * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. | |
| 15 | * | |
| 16 | * Carnegie Mellon requests users of this software to return to | |
| 17 | * | |
| 18 | * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU | |
| 19 | * School of Computer Science | |
| 20 | * Carnegie Mellon University | |
| 21 | * Pittsburgh PA 15213-3890 | |
| 22 | * | |
| 23 | * any improvements or extensions that they make and grant Carnegie Mellon | |
| 24 | * the rights to redistribute these changes. | |
| 25 | * | |
| 26 | *	$OpenBSD: db_machdep.h,v 1.2 1997/03/21 00:48:48 niklas Exp $ | |
| 27 | *	$NetBSD: db_machdep.h,v 1.4.22.1 2000/08/05 11:10:43 wiz Exp $ | |
| 28 | */ | |
| 29 | ||
| 30 | /* | |
| 31 | * Machine-dependent defines for new kernel debugger. | |
| 32 | */ | |
| 33 | #ifndef _POWERPC_DB_MACHDEP_H_ | |
| 34 | #define	_POWERPC_DB_MACHDEP_H_ | |
| 35 | ||
| 36 | #include <vm/vm_param.h> | |
| 37 | #include <machine/elf.h> | |
| 38 | ||
| 39 | #define	DB_ELF_SYMBOLS | |
| 40 | #define	DB_ELFSIZE	__ELF_WORD_SIZE | |
| 41 | ||
| 42 | typedef	vm_offset_t	db_addr_t;	/* address - unsigned */ | |
| 43 | typedef	intptr_t	db_expr_t;	/* expression - signed */ | |
| 44 | ||
| 45 | #define	PC_REGS(regs)	((db_addr_t)kdb_thrctx->pcb_lr) | |
| 46 | ||
| 47 | #define	BKPT_INST	0x7C810808	/* breakpoint instruction */ | |
| 48 | ||
| 49 | #define	BKPT_SIZE	(4)		/* size of breakpoint inst */ | |
| 50 | #define	BKPT_SET(inst)	(BKPT_INST) | |
| 51 | ||
| 52 | #define db_clear_single_step	kdb_cpu_clear_singlestep | |
| 53 | #define db_set_single_step	kdb_cpu_set_singlestep | |
| 54 | ||
| 55 | #if 0 | |
| 56 | #define	SR_SINGLESTEP	0x400 | |
| 57 | #define	db_clear_single_step(regs)	((regs)->msr &= ~SR_SINGLESTEP) | |
| 58 | #define	db_set_single_step(regs)	((regs)->msr |= SR_SINGLESTEP) | |
| 59 | #endif | |
| 60 | ||
| 61 | #define	T_BREAKPOINT	0xffff | |
| 62 | #define	IS_BREAKPOINT_TRAP(type, code)	((type) == T_BREAKPOINT) | |
| 63 | ||
| 64 | #define T_WATCHPOINT	0xeeee | |
| 65 | #ifdef T_WATCHPOINT | |
| 66 | #define	IS_WATCHPOINT_TRAP(type, code)	((type) == T_WATCHPOINT) | |
| 67 | #else | |
| 68 | #define	IS_WATCHPOINT_TRAP(type, code)	0 | |
| 69 | #endif | |
| 70 | ||
| 71 | #define	M_RTS		0xfc0007fe | |
| 72 | #define	I_RTS		0x4c000020 | |
| 73 | #define	M_BC		0xfc000000 | |
| 74 | #define	I_BC		0x40000000 | |
| 75 | #define	M_B		0xfc000000 | |
| 76 | #define	I_B		0x50000000 | |
| 77 | #define	M_RFI		0xfc0007fe | |
| 78 | #define	I_RFI		0x4c000064 | |
| 79 | ||
| 80 | #define	inst_trap_return(ins)	(((ins)&M_RFI) == I_RFI) | |
| 81 | #define	inst_return(ins)	(((ins)&M_RTS) == I_RTS) | |
| 82 | #define	inst_call(ins)		(((ins)&M_BC ) == I_BC || \ | |
| 83 | 				 ((ins)&M_B ) == I_B ) | |
| 84 | #define	inst_load(ins)		0 | |
| 85 | #define	inst_store(ins)		0 | |
| 86 | ||
| 87 | #endif	/* _POWERPC_DB_MACHDEP_H_ */ | |
| \ No newline at end of file |
lib/libc/include/powerpc64-freebsd-none/machine/dbdma.h created+153| ... | ... | @@ -0,0 +1,153 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-2-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 2008 Nathan Whitehorn | |
| 5 | * All rights reserved | |
| 6 | * | |
| 7 | * Redistribution and use in source and binary forms, with or without | |
| 8 | * modification, are permitted provided that the following conditions | |
| 9 | * are met: | |
| 10 | * 1. Redistributions of source code must retain the above copyright | |
| 11 | * notice, this list of conditions and the following disclaimer. | |
| 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 13 | * notice, this list of conditions and the following disclaimer in the | |
| 14 | * documentation and/or other materials provided with the distribution. | |
| 15 | * | |
| 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |
| 17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
| 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | |
| 20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
| 21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
| 22 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
| 23 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
| 24 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
| 25 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
| 26 | * SUCH DAMAGE. | |
| 27 | */ | |
| 28 | ||
| 29 | #ifndef _MACHINE_DBDMA_H_ | |
| 30 | #define _MACHINE_DBDMA_H_ | |
| 31 | ||
| 32 | #include <sys/param.h> | |
| 33 | #include <machine/bus.h> | |
| 34 | ||
| 35 | /* | |
| 36 | * Apple's DBDMA (Descriptor-based DMA) interface is a common DMA engine | |
| 37 | * used by a variety of custom Apple ASICs. It is described in the CHRP | |
| 38 | * specification and in the book Macintosh Technology in the Common | |
| 39 | * Hardware Reference Platform, copyright 1995 Apple Computer. | |
| 40 | */ | |
| 41 | ||
| 42 | /* DBDMA Command Values */ | |
| 43 | ||
| 44 | enum { | |
| 45 | 	DBDMA_OUTPUT_MORE	= 0, | |
| 46 | 	DBDMA_OUTPUT_LAST	= 1, | |
| 47 | 	DBDMA_INPUT_MORE	= 2, | |
| 48 | 	DBDMA_INPUT_LAST	= 3, | |
| 49 | ||
| 50 | 	DBDMA_STORE_QUAD	= 4, | |
| 51 | 	DBDMA_LOAD_QUAD		= 5, | |
| 52 | 	DBDMA_NOP		= 6, | |
| 53 | 	DBDMA_STOP		= 7 | |
| 54 | }; | |
| 55 | ||
| 56 | /* These codes are for the interrupt, branch, and wait flags */ | |
| 57 | ||
| 58 | enum { | |
| 59 | 	DBDMA_NEVER		= 0, | |
| 60 | 	DBDMA_COND_TRUE		= 1, | |
| 61 | 	DBDMA_COND_FALSE	= 2, | |
| 62 | 	DBDMA_ALWAYS		= 3 | |
| 63 | }; | |
| 64 | ||
| 65 | /* Channel status bits */ | |
| 66 | #define DBDMA_STATUS_RUN (0x01 << 15) | |
| 67 | #define DBDMA_STATUS_PAUSE (0x01 << 14) | |
| 68 | #define DBDMA_STATUS_FLUSH (0x01 << 13) | |
| 69 | #define DBDMA_STATUS_WAKE (0x01 << 12) | |
| 70 | #define DBDMA_STATUS_DEAD (0x01 << 11) | |
| 71 | #define DBDMA_STATUS_ACTIVE (0x01 << 10) | |
| 72 | ||
| 73 | /* Set by hardware if a branch was taken */ | |
| 74 | #define DBDMA_STATUS_BRANCH 8 | |
| 75 | ||
| 76 | struct dbdma_command; | |
| 77 | typedef struct dbdma_command dbdma_command_t; | |
| 78 | struct dbdma_channel; | |
| 79 | typedef struct dbdma_channel dbdma_channel_t; | |
| 80 | ||
| 81 | int dbdma_allocate_channel(struct resource *dbdma_regs, u_int offset, | |
| 82 | bus_dma_tag_t parent_dma, int slots, dbdma_channel_t **chan); | |
| 83 | ||
| 84 | int dbdma_resize_channel(dbdma_channel_t *chan, int newslots); | |
| 85 | int dbdma_free_channel(dbdma_channel_t *chan); | |
| 86 | ||
| 87 | void dbdma_run(dbdma_channel_t *chan); | |
| 88 | void dbdma_stop(dbdma_channel_t *chan); | |
| 89 | void dbdma_reset(dbdma_channel_t *chan); | |
| 90 | void dbdma_set_current_cmd(dbdma_channel_t *chan, int slot); | |
| 91 | ||
| 92 | void dbdma_pause(dbdma_channel_t *chan); | |
| 93 | void dbdma_wake(dbdma_channel_t *chan); | |
| 94 | ||
| 95 | /* | |
| 96 | * DBDMA uses a 16 bit channel control register to describe the current | |
| 97 | * state of DMA on the channel. The high-order bits (8-15) contain information | |
| 98 | * on the run state and are listed in the DBDMA_STATUS_* constants above. These | |
| 99 | * are manipulated with the dbdma_run/stop/reset() routines above. | |
| 100 | * | |
| 101 | * The low order bits (0-7) are device dependent status bits. These can be set | |
| 102 | * and read by both hardware and software. The mask is the set of bits to | |
| 103 | * modify; if mask is 0x03 and value is 0, the lowest order 2 bits will be | |
| 104 | * zeroed. | |
| 105 | */ | |
| 106 | ||
| 107 | uint16_t dbdma_get_chan_status(dbdma_channel_t *chan); | |
| 108 | ||
| 109 | uint8_t dbdma_get_device_status(dbdma_channel_t *chan); | |
| 110 | void dbdma_set_device_status(dbdma_channel_t *chan, uint8_t mask, | |
| 111 | uint8_t value); | |
| 112 | ||
| 113 | /* | |
| 114 | * Each DBDMA command word has the current channel status register and the | |
| 115 | * number of residual bytes (requested - actually transferred) written to it | |
| 116 | * at time of command completion. | |
| 117 | */ | |
| 118 | ||
| 119 | uint16_t dbdma_get_cmd_status(dbdma_channel_t *chan, int slot); | |
| 120 | uint16_t dbdma_get_residuals(dbdma_channel_t *chan, int slot); | |
| 121 | ||
| 122 | void dbdma_clear_cmd_status(dbdma_channel_t *chan, int slot); | |
| 123 | ||
| 124 | /* | |
| 125 | * The interrupt/branch/wait selector let you specify a set of values | |
| 126 | * of the device dependent status bits that will cause intterupt/branch/wait | |
| 127 | * conditions to be taken if the flags for these are set to one of the | |
| 128 | * DBDMA_COND_* values. | |
| 129 | * | |
| 130 | * The condition is considered true if (status & mask) == value. | |
| 131 | */ | |
| 132 | ||
| 133 | void dbdma_set_interrupt_selector(dbdma_channel_t *chan, uint8_t mask, | |
| 134 | uint8_t value); | |
| 135 | void dbdma_set_branch_selector(dbdma_channel_t *chan, uint8_t mask, | |
| 136 | uint8_t value); | |
| 137 | void dbdma_set_wait_selector(dbdma_channel_t *chan, uint8_t mask, | |
| 138 | uint8_t value); | |
| 139 | ||
| 140 | void dbdma_insert_command(dbdma_channel_t *chan, int slot, int command, | |
| 141 | int stream, bus_addr_t data, size_t count, uint8_t interrupt, | |
| 142 | uint8_t branch, uint8_t wait, uint32_t branch_slot); | |
| 143 | ||
| 144 | void dbdma_insert_stop(dbdma_channel_t *chan, int slot); | |
| 145 | void dbdma_insert_nop(dbdma_channel_t *chan, int slot); | |
| 146 | void dbdma_insert_branch(dbdma_channel_t *chan, int slot, int to_slot); | |
| 147 | ||
| 148 | void dbdma_sync_commands(dbdma_channel_t *chan, bus_dmasync_op_t op); | |
| 149 | ||
| 150 | void dbdma_save_state(dbdma_channel_t *chan); | |
| 151 | void dbdma_restore_state(dbdma_channel_t *chan); | |
| 152 | ||
| 153 | #endif /* _MACHINE_DBDMA_H_ */ | |
| \ No newline at end of file |
lib/libc/include/powerpc64-freebsd-none/machine/dump.h created+73| ... | ... | @@ -0,0 +1,73 @@ |
| 1 | /*- | |
| 2 | * Copyright (c) 2014 EMC Corp. | |
| 3 | * Author: Conrad Meyer <conrad.meyer@isilon.com> | |
| 4 | * All rights reserved. | |
| 5 | * | |
| 6 | * Redistribution and use in source and binary forms, with or without | |
| 7 | * modification, are permitted provided that the following conditions | |
| 8 | * are met: | |
| 9 | * 1. Redistributions of source code must retain the above copyright | |
| 10 | * notice, this list of conditions and the following disclaimer. | |
| 11 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 12 | * notice, this list of conditions and the following disclaimer in the | |
| 13 | * documentation and/or other materials provided with the distribution. | |
| 14 | * | |
| 15 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |
| 16 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 17 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
| 18 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | |
| 19 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
| 20 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
| 21 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
| 22 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
| 23 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
| 24 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
| 25 | * SUCH DAMAGE. | |
| 26 | */ | |
| 27 | ||
| 28 | #ifndef _MACHINE_DUMP_H_ | |
| 29 | #define	_MACHINE_DUMP_H_ | |
| 30 | ||
| 31 | #define	KERNELDUMP_ARCH_VERSION	KERNELDUMP_POWERPC_VERSION | |
| 32 | #define	EM_VALUE		ELF_ARCH /* Defined in powerpc/include/elf.h */ | |
| 33 | #define	DUMPSYS_MD_PA_NPAIRS	(PHYS_AVAIL_SZ + 1) | |
| 34 | #define	DUMPSYS_NUM_AUX_HDRS	0 | |
| 35 | ||
| 36 | /* How often to check the dump progress bar? */ | |
| 37 | #define	DUMPSYS_PB_CHECK_BITS	20	/* Every 1MB */ | |
| 38 | ||
| 39 | void dumpsys_pa_init(void); | |
| 40 | void dumpsys_unmap_chunk(vm_paddr_t, size_t, void *); | |
| 41 | size_t dumpsys_scan_pmap(struct bitset *); | |
| 42 | void *dumpsys_dump_pmap_init(unsigned blkpgs); | |
| 43 | void *dumpsys_dump_pmap(void *ctx, void *buf, u_long *nbytes); | |
| 44 | ||
| 45 | static inline struct dump_pa * | |
| 46 | dumpsys_pa_next(struct dump_pa *p) | |
| 47 | { | |
| 48 | ||
| 49 | 	return (dumpsys_gen_pa_next(p)); | |
| 50 | } | |
| 51 | ||
| 52 | static inline void | |
| 53 | dumpsys_wbinv_all(void) | |
| 54 | { | |
| 55 | ||
| 56 | 	dumpsys_gen_wbinv_all(); | |
| 57 | } | |
| 58 | ||
| 59 | static inline int | |
| 60 | dumpsys_write_aux_headers(struct dumperinfo *di) | |
| 61 | { | |
| 62 | ||
| 63 | 	return (dumpsys_gen_write_aux_headers(di)); | |
| 64 | } | |
| 65 | ||
| 66 | static inline int | |
| 67 | dumpsys(struct dumperinfo *di) | |
| 68 | { | |
| 69 | ||
| 70 | 	return (dumpsys_generic(di)); | |
| 71 | } | |
| 72 | ||
| 73 | #endif /* !_MACHINE_DUMP_H_ */ | |
| \ No newline at end of file |
lib/libc/include/powerpc64-freebsd-none/machine/efi.h created+12| ... | ... | @@ -0,0 +1,12 @@ |
| 1 | /*- | |
| 2 | * This file is in the public domain since it's just boilerplate. | |
| 3 | */ | |
| 4 | ||
| 5 | #ifndef __POWERPC_INCLUDE_EFI_H_ | |
| 6 | #define __POWERPC_INCLUDE_EFI_H_ | |
| 7 | ||
| 8 | #define	EFIABI_ATTR | |
| 9 | ||
| 10 | /* Note: we don't actually support this on powerpc */ | |
| 11 | ||
| 12 | #endif /* __POWERPC_INCLUDE_EFI_H_ */ | |
| \ No newline at end of file |
lib/libc/include/powerpc64-freebsd-none/machine/elf.h created+146| ... | ... | @@ -0,0 +1,146 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-2-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 2001 David E. O'Brien | |
| 5 | * Copyright (c) 1996-1997 John D. Polstra. | |
| 6 | * All rights reserved. | |
| 7 | * | |
| 8 | * Redistribution and use in source and binary forms, with or without | |
| 9 | * modification, are permitted provided that the following conditions | |
| 10 | * are met: | |
| 11 | * 1. Redistributions of source code must retain the above copyright | |
| 12 | * notice, this list of conditions and the following disclaimer. | |
| 13 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 14 | * notice, this list of conditions and the following disclaimer in the | |
| 15 | * documentation and/or other materials provided with the distribution. | |
| 16 | * | |
| 17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |
| 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 19 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
| 20 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | |
| 21 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
| 22 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
| 23 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
| 24 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
| 25 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
| 26 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
| 27 | * SUCH DAMAGE. | |
| 28 | */ | |
| 29 | ||
| 30 | #ifndef _MACHINE_ELF_H_ | |
| 31 | #define	_MACHINE_ELF_H_ 1 | |
| 32 | ||
| 33 | /* | |
| 34 | * EABI ELF definitions for the PowerPC architecture. | |
| 35 | * See "PowerPC Embedded Application Binary Interface, 32-Bit Impliementation" | |
| 36 | * [ppc-eabi-1995-01.pdf] for details. | |
| 37 | */ | |
| 38 | ||
| 39 | #ifndef __ELF_WORD_SIZE | |
| 40 | #ifdef __powerpc64__ | |
| 41 | #define	__ELF_WORD_SIZE	64	/* Used by <sys/elf_generic.h> */ | |
| 42 | #else | |
| 43 | #define	__ELF_WORD_SIZE	32	/* Used by <sys/elf_generic.h> */ | |
| 44 | #endif | |
| 45 | #endif | |
| 46 | ||
| 47 | #include <sys/elf32.h>	/* Definitions common to all 32 bit architectures. */ | |
| 48 | #include <sys/elf64.h>	/* Definitions common to all 64 bit architectures. */ | |
| 49 | #include <sys/elf_generic.h> | |
| 50 | ||
| 51 | #if __ELF_WORD_SIZE == 64 | |
| 52 | #define	ELF_ARCH	EM_PPC64 | |
| 53 | #define	ELF_MACHINE_OK(x) ((x) == EM_PPC64) | |
| 54 | #else | |
| 55 | #define	ELF_ARCH	EM_PPC | |
| 56 | #define	ELF_ARCH32	EM_PPC | |
| 57 | #define	ELF_MACHINE_OK(x) ((x) == EM_PPC) | |
| 58 | #endif | |
| 59 | ||
| 60 | /* | |
| 61 | * Auxiliary vector entries for passing information to the interpreter. | |
| 62 | * | |
| 63 | * The PowerPC supplement to the SVR4 ABI specification names this "auxv_t", | |
| 64 | * but POSIX lays claim to all symbols ending with "_t". | |
| 65 | */ | |
| 66 | ||
| 67 | typedef struct {	/* Auxiliary vector entry on initial stack */ | |
| 68 | 	int	a_type;			/* Entry type. */ | |
| 69 | 	union { | |
| 70 | #ifdef __powerpc64__ | |
| 71 | 		int	a_val;		/* Integer value */ | |
| 72 | #else | |
| 73 | 		long	a_val;		/* Integer value. */ | |
| 74 | 		void	*a_ptr;		/* Address. */ | |
| 75 | 		void	(*a_fcn)(void);	/* Function pointer (not used). */ | |
| 76 | #endif | |
| 77 | 	} a_un; | |
| 78 | } Elf32_Auxinfo; | |
| 79 | ||
| 80 | typedef struct {	/* Auxiliary vector entry on initial stack */ | |
| 81 | 	long	a_type;			/* Entry type. */ | |
| 82 | 	union { | |
| 83 | 		long	a_val;		/* Integer value. */ | |
| 84 | 		void	*a_ptr;		/* Address. */ | |
| 85 | 		void	(*a_fcn)(void);	/* Function pointer (not used). */ | |
| 86 | 	} a_un; | |
| 87 | } Elf64_Auxinfo; | |
| 88 | ||
| 89 | __ElfType(Auxinfo); | |
| 90 | ||
| 91 | /* | |
| 92 | * Relocation types. | |
| 93 | */ | |
| 94 | ||
| 95 | #define	R_PPC_COUNT		37	/* Count of defined relocation types. */ | |
| 96 | ||
| 97 | 					/* Count of defined relocation types. */ | |
| 98 | #define	R_PPC_EMB_COUNT		(R_PPC_EMB_RELSDA - R_PPC_EMB_NADDR32 + 1) | |
| 99 | ||
| 100 | /* Define "machine" characteristics */ | |
| 101 | #if BYTE_ORDER == LITTLE_ENDIAN | |
| 102 | #define	ELF_TARG_DATA	ELFDATA2LSB | |
| 103 | #else | |
| 104 | #define	ELF_TARG_DATA	ELFDATA2MSB | |
| 105 | #endif | |
| 106 | #if __ELF_WORD_SIZE == 64 | |
| 107 | #define	ELF_TARG_CLASS	ELFCLASS64 | |
| 108 | #define	ELF_TARG_MACH	EM_PPC64 | |
| 109 | #define	ELF_TARG_VER	1 | |
| 110 | #else | |
| 111 | #define	ELF_TARG_CLASS	ELFCLASS32 | |
| 112 | #define	ELF_TARG_MACH	EM_PPC | |
| 113 | #define	ELF_TARG_VER	1 | |
| 114 | #endif | |
| 115 | ||
| 116 | #define	ET_DYN_LOAD_ADDR 0x01010000 | |
| 117 | ||
| 118 | #define	AT_OLD_NULL		AT_NULL | |
| 119 | #define	AT_OLD_IGNORE		AT_IGNORE | |
| 120 | #define	AT_OLD_EXECFD		AT_EXECFD | |
| 121 | #define	AT_OLD_PHDR		AT_PHDR | |
| 122 | #define	AT_OLD_PHENT		AT_PHENT | |
| 123 | #define	AT_OLD_PHNUM		AT_PHNUM | |
| 124 | #define	AT_OLD_PAGESZ		AT_PAGESZ | |
| 125 | #define	AT_OLD_BASE		AT_BASE | |
| 126 | #define	AT_OLD_FLAGS		AT_FLAGS | |
| 127 | #define	AT_OLD_ENTRY		AT_ENTRY | |
| 128 | #define	AT_OLD_NOTELF		AT_NOTELF | |
| 129 | #define	AT_OLD_UID		AT_UID | |
| 130 | #define	AT_OLD_EUID		AT_EUID | |
| 131 | #define	AT_OLD_EXECPATH		13 | |
| 132 | #define	AT_OLD_CANARY		14 | |
| 133 | #define	AT_OLD_CANARYLEN	15 | |
| 134 | #define	AT_OLD_OSRELDATE	16 | |
| 135 | #define	AT_OLD_NCPUS		17 | |
| 136 | #define	AT_OLD_PAGESIZES	18 | |
| 137 | #define	AT_OLD_PAGESIZESLEN	19 | |
| 138 | #define	AT_OLD_STACKPROT	21 | |
| 139 | #define	AT_OLD_TIMEKEEP		AT_TIMEKEEP | |
| 140 | #define	AT_OLD_EHDRFLAGS	AT_EHDRFLAGS | |
| 141 | #define	AT_OLD_HWCAP		AT_HWCAP | |
| 142 | #define	AT_OLD_HWCAP2		AT_HWCAP2 | |
| 143 | ||
| 144 | #define	AT_OLD_COUNT	27	/* Count of defined aux entry types. */ | |
| 145 | ||
| 146 | #endif /* !_MACHINE_ELF_H_ */ | |
| \ No newline at end of file |
lib/libc/include/powerpc64-freebsd-none/machine/endian.h created+38| ... | ... | @@ -0,0 +1,38 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-3-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 1987, 1991, 1993 | |
| 5 | *	The Regents of the University of California. All rights reserved. | |
| 6 | * | |
| 7 | * Redistribution and use in source and binary forms, with or without | |
| 8 | * modification, are permitted provided that the following conditions | |
| 9 | * are met: | |
| 10 | * 1. Redistributions of source code must retain the above copyright | |
| 11 | * notice, this list of conditions and the following disclaimer. | |
| 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 13 | * notice, this list of conditions and the following disclaimer in the | |
| 14 | * documentation and/or other materials provided with the distribution. | |
| 15 | * 3. Neither the name of the University nor the names of its contributors | |
| 16 | * may be used to endorse or promote products derived from this software | |
| 17 | * without specific prior written permission. | |
| 18 | * | |
| 19 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | |
| 20 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 21 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
| 22 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
| 23 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
| 24 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
| 25 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
| 26 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
| 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
| 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
| 29 | * SUCH DAMAGE. | |
| 30 | */ | |
| 31 | ||
| 32 | #ifndef _MACHINE_ENDIAN_H_ | |
| 33 | #define	_MACHINE_ENDIAN_H_ | |
| 34 | ||
| 35 | #include <sys/_types.h> | |
| 36 | #include <sys/_endian.h> | |
| 37 | ||
| 38 | #endif /* !_MACHINE_ENDIAN_H_ */ | |
| \ No newline at end of file |
lib/libc/include/powerpc64-freebsd-none/machine/exec.h created+37| ... | ... | @@ -0,0 +1,37 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-3-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 2001 David E. O'Brien | |
| 5 | * All rights reserved. | |
| 6 | * | |
| 7 | * Redistribution and use in source and binary forms, with or without | |
| 8 | * modification, are permitted provided that the following conditions | |
| 9 | * are met: | |
| 10 | * 1. Redistributions of source code must retain the above copyright | |
| 11 | * notice, this list of conditions and the following disclaimer. | |
| 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 13 | * notice, this list of conditions and the following disclaimer in the | |
| 14 | * documentation and/or other materials provided with the distribution. | |
| 15 | * 3. Neither the name of the author nor the names of any co-contributors | |
| 16 | * may be used to endorse or promote products derived from this software | |
| 17 | * without specific prior written permission. | |
| 18 | * | |
| 19 | * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND | |
| 20 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 21 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
| 22 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
| 23 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
| 24 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
| 25 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
| 26 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
| 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
| 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
| 29 | * SUCH DAMAGE. | |
| 30 | */ | |
| 31 | ||
| 32 | #ifndef	_MACHINE_EXEC_H_ | |
| 33 | #define	_MACHINE_EXEC_H_ | |
| 34 | ||
| 35 | #define	__LDPGSZ	4096 | |
| 36 | ||
| 37 | #endif /* !_MACHINE_EXEC_H_ */ | |
| \ No newline at end of file |
lib/libc/include/powerpc64-freebsd-none/machine/float.h created+98| ... | ... | @@ -0,0 +1,98 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-3-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 1989 Regents of the University of California. | |
| 5 | * All rights reserved. | |
| 6 | * | |
| 7 | * Redistribution and use in source and binary forms, with or without | |
| 8 | * modification, are permitted provided that the following conditions | |
| 9 | * are met: | |
| 10 | * 1. Redistributions of source code must retain the above copyright | |
| 11 | * notice, this list of conditions and the following disclaimer. | |
| 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 13 | * notice, this list of conditions and the following disclaimer in the | |
| 14 | * documentation and/or other materials provided with the distribution. | |
| 15 | * 3. Neither the name of the University nor the names of its contributors | |
| 16 | * may be used to endorse or promote products derived from this software | |
| 17 | * without specific prior written permission. | |
| 18 | * | |
| 19 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | |
| 20 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 21 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
| 22 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
| 23 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
| 24 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
| 25 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
| 26 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
| 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
| 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
| 29 | * SUCH DAMAGE. | |
| 30 | *	from: FreeBSD: src/sys/i386/include/float.h,v 1.8 1999/08/28 00:44:11 | |
| 31 | */ | |
| 32 | ||
| 33 | #ifndef _MACHINE_FLOAT_H_ | |
| 34 | #define _MACHINE_FLOAT_H_ 1 | |
| 35 | ||
| 36 | #include <sys/cdefs.h> | |
| 37 | ||
| 38 | #ifndef _SOFT_FLOAT | |
| 39 | __BEGIN_DECLS | |
| 40 | extern int __flt_rounds(void); | |
| 41 | __END_DECLS | |
| 42 | #define FLT_ROUNDS	__flt_rounds() | |
| 43 | #else | |
| 44 | #define FLT_ROUNDS	(-1) | |
| 45 | #endif | |
| 46 | ||
| 47 | #define FLT_RADIX	2		/* b */ | |
| 48 | #if __ISO_C_VISIBLE >= 1999 | |
| 49 | #define	FLT_EVAL_METHOD	0 | |
| 50 | #define	DECIMAL_DIG	17		/* max precision in decimal digits */ | |
| 51 | #endif | |
| 52 | ||
| 53 | #define FLT_MANT_DIG	24		/* p */ | |
| 54 | #define FLT_EPSILON	1.19209290E-07F	/* b**(1-p) */ | |
| 55 | #define FLT_DIG		6		/* floor((p-1)*log10(b))+(b == 10) */ | |
| 56 | #define FLT_MIN_EXP	(-125)		/* emin */ | |
| 57 | #define FLT_MIN		1.17549435E-38F	/* b**(emin-1) */ | |
| 58 | #define FLT_MIN_10_EXP	(-37)		/* ceil(log10(b**(emin-1))) */ | |
| 59 | #define FLT_MAX_EXP	128		/* emax */ | |
| 60 | #define FLT_MAX		3.40282347E+38F	/* (1-b**(-p))*b**emax */ | |
| 61 | #define FLT_MAX_10_EXP	38		/* floor(log10((1-b**(-p))*b**emax)) */ | |
| 62 | #if __ISO_C_VISIBLE >= 2011 | |
| 63 | #define	FLT_TRUE_MIN	1.40129846E-45F	/* b**(emin-p) */ | |
| 64 | #define	FLT_DECIMAL_DIG	9		/* ceil(1+p*log10(b)) */ | |
| 65 | #define	FLT_HAS_SUBNORM	1 | |
| 66 | #endif /* __ISO_C_VISIBLE >= 2011 */ | |
| 67 | ||
| 68 | #define DBL_MANT_DIG	53 | |
| 69 | #define DBL_EPSILON	2.2204460492503131E-16 | |
| 70 | #define DBL_DIG		15 | |
| 71 | #define DBL_MIN_EXP	(-1021) | |
| 72 | #define DBL_MIN		2.2250738585072014E-308 | |
| 73 | #define DBL_MIN_10_EXP	(-307) | |
| 74 | #define DBL_MAX_EXP	1024 | |
| 75 | #define DBL_MAX		1.7976931348623157E+308 | |
| 76 | #define DBL_MAX_10_EXP	308 | |
| 77 | #if __ISO_C_VISIBLE >= 2011 | |
| 78 | #define	DBL_TRUE_MIN	4.9406564584124654E-324 | |
| 79 | #define	DBL_DECIMAL_DIG	17 | |
| 80 | #define	DBL_HAS_SUBNORM	1 | |
| 81 | #endif /* __ISO_C_VISIBLE >= 2011 */ | |
| 82 | ||
| 83 | #define LDBL_MANT_DIG	DBL_MANT_DIG | |
| 84 | #define LDBL_EPSILON	((long double)DBL_EPSILON) | |
| 85 | #define LDBL_DIG	DBL_DIG | |
| 86 | #define LDBL_MIN_EXP	DBL_MIN_EXP | |
| 87 | #define LDBL_MIN	((long double)DBL_MIN) | |
| 88 | #define LDBL_MIN_10_EXP	DBL_MIN_10_EXP | |
| 89 | #define LDBL_MAX_EXP	DBL_MAX_EXP | |
| 90 | #define LDBL_MAX	((long double)DBL_MAX) | |
| 91 | #define LDBL_MAX_10_EXP	DBL_MAX_10_EXP | |
| 92 | #if __ISO_C_VISIBLE >= 2011 | |
| 93 | #define	LDBL_TRUE_MIN	((long double)DBL_TRUE_MIN) | |
| 94 | #define	LDBL_DECIMAL_DIG DBL_DECIMAL_DIG | |
| 95 | #define	LDBL_HAS_SUBNORM DBL_HAS_SUBNORM | |
| 96 | #endif /* __ISO_C_VISIBLE >= 2011 */ | |
| 97 | ||
| 98 | #endif /* _MACHINE_FLOAT_H_ */ | |
| \ No newline at end of file |
lib/libc/include/powerpc64-freebsd-none/machine/floatingpoint.h created+37| ... | ... | @@ -0,0 +1,37 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-3-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 2004 Suleiman Souhlal <refugee@segfaulted.com> | |
| 5 | * All rights reserved. | |
| 6 | * | |
| 7 | * Redistribution and use in source and binary forms, with or without | |
| 8 | * modification, are permitted provided that the following conditions | |
| 9 | * are met: | |
| 10 | * 1. Redistributions of source code must retain the above copyright | |
| 11 | * notice, this list of conditions and the following disclaimer. | |
| 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 13 | * notice, this list of conditions and the following disclaimer in the | |
| 14 | * documentation and/or other materials provided with the distribution. | |
| 15 | * 3. Neither the name of the author nor the names of any co-contributors | |
| 16 | * may be used to endorse or promote products derived from this software | |
| 17 | * without specific prior written permission. | |
| 18 | * | |
| 19 | * THIS SOFTWARE IS PROVIDED BY DAVID O'BRIEN AND CONTRIBUTORS ``AS IS'' AND | |
| 20 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 21 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
| 22 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
| 23 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
| 24 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
| 25 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
| 26 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
| 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
| 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
| 29 | * SUCH DAMAGE. | |
| 30 | */ | |
| 31 | ||
| 32 | #ifndef _FLOATINGPOINT_H_ | |
| 33 | #define _FLOATINGPOINT_H_ | |
| 34 | ||
| 35 | #include <machine/ieeefp.h> | |
| 36 | ||
| 37 | #endif /* !_FLOATINGPOINT_H_ */ | |
| \ No newline at end of file |
lib/libc/include/powerpc64-freebsd-none/machine/fpu.h created+102| ... | ... | @@ -0,0 +1,102 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-4-Clause | |
| 3 | * | |
| 4 | * Copyright (C) 1996 Wolfgang Solfrank. | |
| 5 | * Copyright (C) 1996 TooLs GmbH. | |
| 6 | * All rights reserved. | |
| 7 | * | |
| 8 | * Redistribution and use in source and binary forms, with or without | |
| 9 | * modification, are permitted provided that the following conditions | |
| 10 | * are met: | |
| 11 | * 1. Redistributions of source code must retain the above copyright | |
| 12 | * notice, this list of conditions and the following disclaimer. | |
| 13 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 14 | * notice, this list of conditions and the following disclaimer in the | |
| 15 | * documentation and/or other materials provided with the distribution. | |
| 16 | * 3. All advertising materials mentioning features or use of this software | |
| 17 | * must display the following acknowledgement: | |
| 18 | *	This product includes software developed by TooLs GmbH. | |
| 19 | * 4. The name of TooLs GmbH may not be used to endorse or promote products | |
| 20 | * derived from this software without specific prior written permission. | |
| 21 | * | |
| 22 | * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR | |
| 23 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |
| 24 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | |
| 25 | * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
| 26 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | |
| 27 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; | |
| 28 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | |
| 29 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | |
| 30 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | |
| 31 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 32 | * | |
| 33 | *	$NetBSD: fpu.h,v 1.2 1999/12/07 15:14:56 danw Exp $ | |
| 34 | */ | |
| 35 | ||
| 36 | #ifndef	_MACHINE_FPU_H_ | |
| 37 | #define	_MACHINE_FPU_H_ | |
| 38 | ||
| 39 | #define	FPSCR_FX	0x80000000 | |
| 40 | #define	FPSCR_FEX	0x40000000 | |
| 41 | #define	FPSCR_VX	0x20000000 | |
| 42 | #define	FPSCR_OX	0x10000000 | |
| 43 | #define	FPSCR_UX	0x08000000 | |
| 44 | #define	FPSCR_ZX	0x04000000 | |
| 45 | #define	FPSCR_XX	0x02000000 | |
| 46 | #define	FPSCR_VXSNAN	0x01000000 | |
| 47 | #define	FPSCR_VXISI	0x00800000 | |
| 48 | #define	FPSCR_VXIDI	0x00400000 | |
| 49 | #define	FPSCR_VXZDZ	0x00200000 | |
| 50 | #define	FPSCR_VXIMZ	0x00100000 | |
| 51 | #define	FPSCR_VXVC	0x00080000 | |
| 52 | #define	FPSCR_FR	0x00040000 | |
| 53 | #define	FPSCR_FI	0x00020000 | |
| 54 | #define	FPSCR_FPRF	0x0001f000 | |
| 55 | #define	FPSCR_C		0x00010000 | |
| 56 | #define	FPSCR_FPCC	0x0000f000 | |
| 57 | #define	FPSCR_FL	0x00008000 | |
| 58 | #define	FPSCR_FG	0x00004000 | |
| 59 | #define	FPSCR_FE	0x00002000 | |
| 60 | #define	FPSCR_FU	0x00001000 | |
| 61 | #define	FPSCR_VXSOFT	0x00000400 | |
| 62 | #define	FPSCR_VXSQRT	0x00000200 | |
| 63 | #define	FPSCR_VXCVI	0x00000100 | |
| 64 | #define	FPSCR_VE	0x00000080 | |
| 65 | #define	FPSCR_OE	0x00000040 | |
| 66 | #define	FPSCR_UE	0x00000020 | |
| 67 | #define	FPSCR_ZE	0x00000010 | |
| 68 | #define	FPSCR_XE	0x00000008 | |
| 69 | #define	FPSCR_NI	0x00000004 | |
| 70 | #define	FPSCR_RN	0x00000003 | |
| 71 | ||
| 72 | #ifdef _KERNEL | |
| 73 | ||
| 74 | void enable_fpu(struct thread *); | |
| 75 | void save_fpu(struct thread *); | |
| 76 | void save_fpu_nodrop(struct thread *); | |
| 77 | void cleanup_fpscr(void); | |
| 78 | u_int get_fpu_exception(struct thread *); | |
| 79 | void enable_fpu_kern(void); | |
| 80 | void disable_fpu(struct thread *td); | |
| 81 | ||
| 82 | /* | |
| 83 | * Flags for fpu_kern_alloc_ctx(), fpu_kern_enter() and fpu_kern_thread(). | |
| 84 | */ | |
| 85 | #define	FPU_KERN_NORMAL	0x0000 | |
| 86 | #define	FPU_KERN_NOWAIT	0x0001 | |
| 87 | #define	FPU_KERN_KTHR	0x0002 | |
| 88 | #define	FPU_KERN_NOCTX	0x0004 | |
| 89 | ||
| 90 | struct fpu_kern_ctx; | |
| 91 | ||
| 92 | struct fpu_kern_ctx *fpu_kern_alloc_ctx(u_int flags); | |
| 93 | void	fpu_kern_free_ctx(struct fpu_kern_ctx *ctx); | |
| 94 | void	fpu_kern_enter(struct thread *td, struct fpu_kern_ctx *ctx, | |
| 95 | 	 u_int flags); | |
| 96 | int	fpu_kern_leave(struct thread *td, struct fpu_kern_ctx *ctx); | |
| 97 | int	fpu_kern_thread(u_int flags); | |
| 98 | int	is_fpu_kern_thread(u_int flags); | |
| 99 | ||
| 100 | #endif /* _KERNEL */ | |
| 101 | ||
| 102 | #endif	/* _MACHINE_FPU_H_ */ | |
| \ No newline at end of file |
lib/libc/include/powerpc64-freebsd-none/machine/frame.h created+114| ... | ... | @@ -0,0 +1,114 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-4-Clause | |
| 3 | * | |
| 4 | * Copyright (C) 1995, 1996 Wolfgang Solfrank. | |
| 5 | * Copyright (C) 1995, 1996 TooLs GmbH. | |
| 6 | * All rights reserved. | |
| 7 | * | |
| 8 | * Redistribution and use in source and binary forms, with or without | |
| 9 | * modification, are permitted provided that the following conditions | |
| 10 | * are met: | |
| 11 | * 1. Redistributions of source code must retain the above copyright | |
| 12 | * notice, this list of conditions and the following disclaimer. | |
| 13 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 14 | * notice, this list of conditions and the following disclaimer in the | |
| 15 | * documentation and/or other materials provided with the distribution. | |
| 16 | * 3. All advertising materials mentioning features or use of this software | |
| 17 | * must display the following acknowledgement: | |
| 18 | *	This product includes software developed by TooLs GmbH. | |
| 19 | * 4. The name of TooLs GmbH may not be used to endorse or promote products | |
| 20 | * derived from this software without specific prior written permission. | |
| 21 | * | |
| 22 | * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR | |
| 23 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |
| 24 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | |
| 25 | * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
| 26 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | |
| 27 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; | |
| 28 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | |
| 29 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | |
| 30 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | |
| 31 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 32 | * | |
| 33 | *	$NetBSD: frame.h,v 1.2 1999/01/10 10:13:15 tsubai Exp $ | |
| 34 | */ | |
| 35 | ||
| 36 | #ifndef	_MACHINE_FRAME_H_ | |
| 37 | #define	_MACHINE_FRAME_H_ | |
| 38 | ||
| 39 | #include <sys/types.h> | |
| 40 | ||
| 41 | /* | |
| 42 | * We have to save all registers on every trap, because | |
| 43 | *	1. user could attach this process every time | |
| 44 | *	2. we must be able to restore all user registers in case of fork | |
| 45 | * Actually, we do not save the fp registers on trap, since | |
| 46 | * these are not used by the kernel. They are saved only when switching | |
| 47 | * between processes using the FPU. | |
| 48 | * | |
| 49 | * Change ordering to cluster together these register_t's.		XXX | |
| 50 | */ | |
| 51 | struct trapframe { | |
| 52 | 	register_t fixreg[32]; | |
| 53 | 	register_t lr; | |
| 54 | 	register_t cr; | |
| 55 | 	register_t xer; | |
| 56 | 	register_t ctr; | |
| 57 | 	register_t srr0; | |
| 58 | 	register_t srr1; | |
| 59 | 	register_t exc; | |
| 60 | 	register_t dar;	/* DAR/DEAR filled in on DSI traps */ | |
| 61 | 	union { | |
| 62 | 		struct { | |
| 63 | 			/* dsisr only filled on a DSI trap */ | |
| 64 | 			register_t dsisr; | |
| 65 | 		} aim; | |
| 66 | 		struct { | |
| 67 | 			register_t esr; | |
| 68 | 			register_t dbcr0; | |
| 69 | 		} booke; | |
| 70 | 	} cpu; | |
| 71 | }; | |
| 72 | ||
| 73 | /* | |
| 74 | * FRAMELEN is the size of the stack region used by the low-level trap | |
| 75 | * handler. It is the size of its data (trapframe) plus the callframe | |
| 76 | * header (sizeof(struct callframe) - 3 register widths). It must also | |
| 77 | * be 16-byte aligned. | |
| 78 | */ | |
| 79 | #define	FRAMELEN	roundup(sizeof(struct trapframe) + \ | |
| 80 | 			 sizeof(struct callframe) - 3*sizeof(register_t), 16) | |
| 81 | #define	trapframe(td)	((td)->td_frame) | |
| 82 | ||
| 83 | /* | |
| 84 | * Call frame for PowerPC used during fork. | |
| 85 | */ | |
| 86 | #ifdef __powerpc64__ | |
| 87 | struct callframe { | |
| 88 | 	register_t	cf_dummy_fp;	/* dummy frame pointer */ | |
| 89 | 	register_t	cf_cr; | |
| 90 | 	register_t	cf_lr; | |
| 91 | 	register_t	cf_compiler; | |
| 92 | 	register_t	cf_linkeditor; | |
| 93 | 	register_t	cf_toc; | |
| 94 | 	register_t	cf_func; | |
| 95 | 	register_t	cf_arg0; | |
| 96 | 	register_t	cf_arg1; | |
| 97 | 	register_t	_padding;	/* Maintain 16-byte alignment */ | |
| 98 | }; | |
| 99 | #else | |
| 100 | struct callframe { | |
| 101 | 	register_t	cf_dummy_fp;	/* dummy frame pointer */ | |
| 102 | 	register_t	cf_lr;		/* space for link register save */ | |
| 103 | 	register_t	cf_func; | |
| 104 | 	register_t	cf_arg0; | |
| 105 | 	register_t	cf_arg1; | |
| 106 | 	register_t	_padding;	/* Maintain 16-byte alignment */ | |
| 107 | }; | |
| 108 | #endif | |
| 109 | ||
| 110 | /* Definitions for syscalls */ | |
| 111 | #define	FIRSTARG	3				/* first arg in reg 3 */ | |
| 112 | #define	NARGREG		8				/* 8 args in regs */ | |
| 113 | ||
| 114 | #endif	/* _MACHINE_FRAME_H_ */ | |
| \ No newline at end of file |
lib/libc/include/powerpc64-freebsd-none/machine/gdb_machdep.h created+140| ... | ... | @@ -0,0 +1,140 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-2-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 2006 Marcel Moolenaar | |
| 5 | * All rights reserved. | |
| 6 | * | |
| 7 | * Redistribution and use in source and binary forms, with or without | |
| 8 | * modification, are permitted provided that the following conditions | |
| 9 | * are met: | |
| 10 | * | |
| 11 | * 1. Redistributions of source code must retain the above copyright | |
| 12 | * notice, this list of conditions and the following disclaimer. | |
| 13 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 14 | * notice, this list of conditions and the following disclaimer in the | |
| 15 | * documentation and/or other materials provided with the distribution. | |
| 16 | * | |
| 17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | |
| 18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |
| 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | |
| 20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | |
| 21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | |
| 22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
| 23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
| 24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
| 25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | |
| 26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 27 | */ | |
| 28 | ||
| 29 | #ifndef _MACHINE_GDB_MACHDEP_H_ | |
| 30 | #define	_MACHINE_GDB_MACHDEP_H_ | |
| 31 | ||
| 32 | #ifdef BOOKE | |
| 33 | #define	PPC_GDB_NREGS0	1 | |
| 34 | #define	PPC_GDB_NREGS4	(70 + 1) | |
| 35 | #define	PPC_GDB_NREGS8	(1 + 32) | |
| 36 | #define	PPC_GDB_NREGS16	0 | |
| 37 | ||
| 38 | #else | |
| 39 | /* | |
| 40 | * 0 - 32*GPR(4/8) | |
| 41 | * 32 - 32*FPR(8) | |
| 42 | * 64 - PC, PS (4/8) | |
| 43 | * 66 - CR (4) | |
| 44 | * 67 - LR, CTR (4/8) | |
| 45 | * 69 - XER, FPSCR (4) | |
| 46 | * 71 - 32*VR(16) | |
| 47 | * 103 - VSCR, VRSAVE (4) | |
| 48 | */ | |
| 49 | ||
| 50 | #define	PPC_REGNUM_R0	0 | |
| 51 | #define	PPC_REGNUM_R31	(PPC_REGNUM_R0 + 31) | |
| 52 | #define	PPC_REGNUM_FR0	32 | |
| 53 | #define	PPC_REGNUM_FR31	(PPC_REGNUM_FR0 + 31) | |
| 54 | #define	PPC_REGNUM_PC	64 | |
| 55 | #define	PPC_REGNUM_PS	65 | |
| 56 | #define	PPC_REGNUM_CR	66 | |
| 57 | #define	PPC_REGNUM_LR	67 | |
| 58 | #define	PPC_REGNUM_CTR	68 | |
| 59 | #define	PPC_REGNUM_XER	69 | |
| 60 | #define	PPC_REGNUM_FPSCR 70 | |
| 61 | #define	PPC_REGNUM_VR0	71 | |
| 62 | #define	PPC_REGNUM_VR31	(PPC_REGNUM_VR0 + 31) | |
| 63 | ||
| 64 | #define	PPC_GDB_NREGS0	0 | |
| 65 | ||
| 66 | #ifdef __powerpc64__ | |
| 67 | #define	PPC_GDB_NREGS4	5 | |
| 68 | #define	PPC_GDB_NREGS8	(64 + 4) | |
| 69 | #else | |
| 70 | #define	PPC_GDB_NREGS4	(32 + 7 + 2) | |
| 71 | #define	PPC_GDB_NREGS8	32 | |
| 72 | #endif | |
| 73 | ||
| 74 | #define	PPC_GDB_NREGS16	32 | |
| 75 | #endif | |
| 76 | ||
| 77 | #define GDB_NREGS	(PPC_GDB_NREGS0 + PPC_GDB_NREGS4 + \ | |
| 78 | 			 PPC_GDB_NREGS8 + PPC_GDB_NREGS16) | |
| 79 | #define	GDB_REG_PC	64 | |
| 80 | ||
| 81 | #define	GDB_BUFSZ	(PPC_GDB_NREGS4 * 8 +	\ | |
| 82 | 			 PPC_GDB_NREGS8 * 16 +	\ | |
| 83 | 			 PPC_GDB_NREGS16 * 32) | |
| 84 | ||
| 85 | static __inline size_t | |
| 86 | gdb_cpu_regsz(int regnum) | |
| 87 | { | |
| 88 | ||
| 89 | #ifdef BOOKE | |
| 90 | 	if (regnum == 70) | |
| 91 | 		return (0); | |
| 92 | 	if (regnum == 71 || regnum >= 73) | |
| 93 | 		return (8); | |
| 94 | #else | |
| 95 | #ifdef __powerpc64__ | |
| 96 | 	if ((regnum >= PPC_REGNUM_R0 && regnum <= PPC_REGNUM_PS) || | |
| 97 | 	 regnum == PPC_REGNUM_LR || regnum == PPC_REGNUM_CTR) | |
| 98 | 		return (8); | |
| 99 | #else | |
| 100 | 	if (regnum >= PPC_REGNUM_FR0 && regnum <= PPC_REGNUM_FR31) | |
| 101 | 		return (8); | |
| 102 | #endif | |
| 103 | 	if (regnum >= PPC_REGNUM_VR0 && regnum <= PPC_REGNUM_VR31) | |
| 104 | 		return (16); | |
| 105 | #endif | |
| 106 | 	return (4); | |
| 107 | } | |
| 108 | ||
| 109 | static __inline int | |
| 110 | gdb_cpu_query(void) | |
| 111 | { | |
| 112 | ||
| 113 | 	return (0); | |
| 114 | } | |
| 115 | ||
| 116 | static __inline void * | |
| 117 | gdb_begin_write(void) | |
| 118 | { | |
| 119 | ||
| 120 | 	return (NULL); | |
| 121 | } | |
| 122 | ||
| 123 | static __inline void | |
| 124 | gdb_end_write(void *arg __unused) | |
| 125 | { | |
| 126 | ||
| 127 | } | |
| 128 | ||
| 129 | static __inline void | |
| 130 | gdb_cpu_stop_reason(int type __unused, int code __unused) | |
| 131 | { | |
| 132 | ||
| 133 | } | |
| 134 | ||
| 135 | void *gdb_cpu_getreg(int, size_t *); | |
| 136 | void gdb_cpu_setreg(int, void *); | |
| 137 | int gdb_cpu_signal(int, int); | |
| 138 | void gdb_cpu_do_offsets(void); | |
| 139 | ||
| 140 | #endif /* !_MACHINE_GDB_MACHDEP_H_ */ | |
| \ No newline at end of file |
lib/libc/include/powerpc64-freebsd-none/machine/hid.h created+223| ... | ... | @@ -0,0 +1,223 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-3-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 2000 Tsubai Masanari. All rights reserved. | |
| 5 | * | |
| 6 | * Redistribution and use in source and binary forms, with or without | |
| 7 | * modification, are permitted provided that the following conditions | |
| 8 | * are met: | |
| 9 | * 1. Redistributions of source code must retain the above copyright | |
| 10 | * notice, this list of conditions and the following disclaimer. | |
| 11 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 12 | * notice, this list of conditions and the following disclaimer in the | |
| 13 | * documentation and/or other materials provided with the distribution. | |
| 14 | * 3. The name of the author may not be used to endorse or promote products | |
| 15 | * derived from this software without specific prior written permission. | |
| 16 | * | |
| 17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | |
| 18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |
| 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | |
| 20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | |
| 21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | |
| 22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
| 23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
| 24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
| 25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |
| 26 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 27 | * | |
| 28 | * $NetBSD: hid.h,v 1.2 2001/08/22 21:05:25 matt Exp $ | |
| 29 | */ | |
| 30 | ||
| 31 | #ifndef _POWERPC_HID_H_ | |
| 32 | #define _POWERPC_HID_H_ | |
| 33 | ||
| 34 | /* Hardware Implementation Dependent registers for the PowerPC */ | |
| 35 | #define	HID0_RADIX	0x0080000000000000	/* Enable Radix page tables (POWER9) */ | |
| 36 | ||
| 37 | #define HID0_EMCP	0x80000000 /* Enable machine check pin */ | |
| 38 | #define HID0_DBP	0x40000000 /* Disable 60x bus parity generation */ | |
| 39 | #define HID0_EBA	0x20000000 /* Enable 60x bus address parity checking */ | |
| 40 | #define HID0_EBD	0x10000000 /* Enable 60x bus data parity checking */ | |
| 41 | #define HID0_BCLK	0x08000000 /* CLK_OUT clock type selection */ | |
| 42 | #define HID0_EICE	0x04000000 /* Enable ICE output */ | |
| 43 | #define HID0_ECLK	0x02000000 /* CLK_OUT clock type selection */ | |
| 44 | #define HID0_PAR	0x01000000 /* Disable precharge of ARTRY */ | |
| 45 | #define HID0_STEN	0x01000000 /* Software table search enable (7450) */ | |
| 46 | #define HID0_DEEPNAP	0x01000000 /* Enable deep nap mode (970) */ | |
| 47 | #define HID0_HBATEN	0x00800000 /* High BAT enable (74[45][578]) */ | |
| 48 | #define HID0_DOZE	0x00800000 /* Enable doze mode */ | |
| 49 | #define HID0_NAP	0x00400000 /* Enable nap mode */ | |
| 50 | #define HID0_SLEEP	0x00200000 /* Enable sleep mode */ | |
| 51 | #define HID0_DPM	0x00100000 /* Enable Dynamic power management */ | |
| 52 | #define HID0_RISEG	0x00080000 /* Read I-SEG */ | |
| 53 | #define HID0_TG		0x00040000 /* Timebase Granularity (OEA64) */ | |
| 54 | #define HID0_BHTCLR	0x00040000 /* Clear branch history table (7450) */ | |
| 55 | #define HID0_EIEC	0x00040000 /* Enable internal error checking */ | |
| 56 | #define HID0_XAEN	0x00020000 /* Enable eXtended Addressing (7450) */ | |
| 57 | #define HID0_NHR	0x00010000 /* Not hard reset */ | |
| 58 | #define HID0_ICE	0x00008000 /* Enable i-cache */ | |
| 59 | #define HID0_DCE	0x00004000 /* Enable d-cache */ | |
| 60 | #define HID0_ILOCK	0x00002000 /* i-cache lock */ | |
| 61 | #define HID0_DLOCK	0x00001000 /* d-cache lock */ | |
| 62 | #define HID0_ICFI	0x00000800 /* i-cache flush invalidate */ | |
| 63 | #define HID0_DCFI	0x00000400 /* d-cache flush invalidate */ | |
| 64 | #define HID0_SPD	0x00000200 /* Disable speculative cache access */ | |
| 65 | #define HID0_XBSEN	0x00000100 /* Extended BAT block-size enable (7457) */ | |
| 66 | #define HID0_IFEM	0x00000100 /* Enable M-bit for I-fetch */ | |
| 67 | #define HID0_XBSEN	0x00000100 /* Extended BAT block size enable (7455+)*/ | |
| 68 | #define HID0_SGE	0x00000080 /* Enable store gathering */ | |
| 69 | #define HID0_DCFA	0x00000040 /* Data cache flush assist */ | |
| 70 | #define HID0_BTIC	0x00000020 /* Enable BTIC */ | |
| 71 | #define HID0_LRSTK	0x00000010 /* Link register stack enable (7450) */ | |
| 72 | #define HID0_ABE	0x00000008 /* Enable address broadcast */ | |
| 73 | #define HID0_FOLD	0x00000008 /* Branch folding enable (7450) */ | |
| 74 | #define HID0_BHT	0x00000004 /* Enable branch history table */ | |
| 75 | #define HID0_NOPTI	0x00000001 /* No-op the dcbt(st) */ | |
| 76 | ||
| 77 | #define HID0_AIM_TBEN	0x04000000 /* Time base enable (7450) */ | |
| 78 | ||
| 79 | #define HID0_E500_TBEN		0x00004000 /* Time Base and decr. enable */ | |
| 80 | #define HID0_E500_SEL_TBCLK	0x00002000 /* Select Time Base clock */ | |
| 81 | #define HID0_E500_MAS7UPDEN	0x00000080 /* Enable MAS7 update (e500v2) */ | |
| 82 | ||
| 83 | #define HID0_E500MC_L2MMU_MHD	0x40000000 /* L2MMU Multiple Hit Detection */ | |
| 84 | ||
| 85 | #define HID0_BITMASK							\ | |
| 86 | "\20"								\ | |
| 87 | "\040EMCP\037DBP\036EBA\035EBD\034BCLK\033EICE\032ECLK\031PAR"	\ | |
| 88 | "\030DOZE\027NAP\026SLEEP\025DPM\024RISEG\023EIEC\022res\021NHR"	\ | |
| 89 | "\020ICE\017DCE\016ILOCK\015DLOCK\014ICFI\013DCFI\012SPD\011IFEM"	\ | |
| 90 | "\010SGE\007DCFA\006BTIC\005FBIOB\004ABE\003BHT\002NOPDST\001NOPTI" | |
| 91 | ||
| 92 | #define HID0_7450_BITMASK						\ | |
| 93 | "\20"								\ | |
| 94 | "\040EMCP\037b1\036b2\035b3\034b4\033TBEN\032b6\031STEN"		\ | |
| 95 | "\030HBATEN\027NAP\026SLEEP\025DPM\024b12\023BHTCLR\022XAEN\021NHR"	\ | |
| 96 | "\020ICE\017DCE\016ILOCK\015DLOCK\014ICFI\013DCFI\012SPD\011XBSEN"	\ | |
| 97 | "\010SGE\007b25\006BTIC\005LRSTK\004FOLD\003BHT\002NOPDST\001NOPTI" | |
| 98 | ||
| 99 | #define HID0_E500_BITMASK						\ | |
| 100 | "\20"								\ | |
| 101 | "\040EMCP\037b1\036b2\035b3\034b4\033b5\032b6\031b7"		\ | |
| 102 | "\030DOZE\027NAP\026SLEEP\025b11\024b12\023b13\022b14\021b15"	\ | |
| 103 | "\020b16\017TBEN\016SEL_TBCLK\015b19\014b20\013b21\012b22\011b23"	\ | |
| 104 | "\010EN_MAS7_UPDATE\007DCFA\006b26\005b27\004b28\003b29\002b30\001NOPTI" | |
| 105 | ||
| 106 | #define HID0_970_BITMASK						\ | |
| 107 | "\20"								\ | |
| 108 | "\040ONEPPC\037SINGLE\036ISYNCSC\035SERGP\031DEEPNAP\030DOZE"	\ | |
| 109 | "\027NAP\025DPM\023TG\022HANGDETECT\021NHR\020INORDER"		\ | |
| 110 | "\016TBCTRL\015TBEN\012CIABREN\011HDICEEN\001ENATTN"		 | |
| 111 | ||
| 112 | #define HID0_E500MC_BITMASK						\ | |
| 113 | "\20"								\ | |
| 114 | "\040EMCP\037EN_L2MMU_MHD\036b2\035b3\034b4\033b5\032b6\031b7"	\ | |
| 115 | "\030b8\027b9\026b10\025b11\024b12\023b13\022b14\021b15"		\ | |
| 116 | "\020b16\017b17\016b18\015b19\014b20\013b21\012b22\011b23"		\ | |
| 117 | "\010EN_MAS7_UPDATE\007DCFA\006b26\005CIGLSO\004b28\003b29\002b30\001NOPTI" | |
| 118 | ||
| 119 | #define HID0_E5500_BITMASK						\ | |
| 120 | "\20"								\ | |
| 121 | "\040EMCP\037EN_L2MMU_MHD\036b2\035b3\034b4\033b5\032b6\031b7"	\ | |
| 122 | "\030b8\027b9\026b10\025b11\024b12\023b13\022b14\021b15"		\ | |
| 123 | "\020b16\017b17\016b18\015b19\014b20\013b21\012b22\011b23"		\ | |
| 124 | "\010b24\007DCFA\006b26\005CIGLSO\004b28\003b29\002b30\001NOPTI" | |
| 125 | ||
| 126 | /* | |
| 127 | * HID0 bit definitions per cpu model | |
| 128 | * | |
| 129 | * bit	603	604	750	7400	7410	7450	7457	e500 | |
| 130 | * 0	EMCP	EMCP	EMCP	EMCP	EMCP	-	-	EMCP | |
| 131 | * 1	-	ECP	DBP	-	-	-	-	- | |
| 132 | * 2	EBA	EBA	EBA	EBA	EDA	-	-	- | |
| 133 | * 3	EBD	EBD	EBD	EBD	EBD	-	-	- | |
| 134 | * 4	SBCLK	-	BCLK	BCKL	BCLK	-	-	- | |
| 135 | * 5	EICE	-	-	-	-	TBEN	TBEN	- | |
| 136 | * 6	ECLK	-	ECLK	ECLK	ECLK	-	-	- | |
| 137 | * 7	PAR	PAR	PAR	PAR	PAR	STEN	STEN	- | |
| 138 | * 8	DOZE	-	DOZE	DOZE	DOZE	-	HBATEN	DOZE | |
| 139 | * 9	NAP	-	NAP	NAP	NAP	NAP	NAP	NAP | |
| 140 | * 10	SLEEP	-	SLEEP	SLEEP	SLEEP	SLEEP	SLEEP	SLEEP | |
| 141 | * 11	DPM	-	DPM	DPM	DPM	DPM	DPM	- | |
| 142 | * 12	RISEG	-	-	RISEG	-	-	-	- | |
| 143 | * 13	-	-	-	EIEC	EIEC	BHTCLR	BHTCLR	- | |
| 144 | * 14	-	-	-	-	-	XAEN	XAEN	- | |
| 145 | * 15	-	NHR	NHR	NHR	NHR	NHR	NHR	- | |
| 146 | * 16	ICE	ICE	ICE	ICE	ICE	ICE	ICE	- | |
| 147 | * 17	DCE	DCE	DCE	DCE	DCE	DCE	DCE	TBEN | |
| 148 | * 18	ILOCK	ILOCK	ILOCK	ILOCK	ILOCK	ILOCK	ILOCK	SEL_TBCLK | |
| 149 | * 19	DLOCK	DLOCK	DLOCK	DLOCK	DLOCK	DLOCK	DLOCK	- | |
| 150 | * 20	ICFI	ICFI	ICFI	ICFI	ICFI	ICFI	ICFI	- | |
| 151 | * 21	DCFI	DCFI	DCFI	DCFI	DCFI	DCFI	DCFI	- | |
| 152 | * 22	-	-	SPD	SPD	SPG	SPD	SPD	- | |
| 153 | * 23	-	-	IFEM	IFTT	IFTT	-	XBSEN	- | |
| 154 | * 24	-	SIE	SGE	SGE	SGE	SGE	SGE	EN_MAS7_UPDATE | |
| 155 | * 25	-	-	DCFA	DCFA	DCFA	-	-	DCFA | |
| 156 | * 26	-	-	BTIC	BTIC	BTIC	BTIC	BTIC	- | |
| 157 | * 27	FBIOB	-	-	-	-	LRSTK	LRSTK	- | |
| 158 | * 28	-	-	ABE	-	-	FOLD	FOLD	- | |
| 159 | * 29	-	BHT	BHT	BHT	BHT	BHT	BHT	- | |
| 160 | * 30	-	-	-	NOPDST	NOPDST	NOPDST	NOPDST	- | |
| 161 | * 31	NOOPTI	-	NOOPTI	NOPTI	NOPTI	NOPTI	NOPTI	NOPTI | |
| 162 | * | |
| 163 | * bit	e500mc		e5500 | |
| 164 | * 0	EMCP		EMCP | |
| 165 | * 1	EN_L2MMU_MHD	EN_L2MMU_MHD | |
| 166 | * 2	-		- | |
| 167 | * 3	-		- | |
| 168 | * 4	-		- | |
| 169 | * 5	-		- | |
| 170 | * 6	-		- | |
| 171 | * 7	-		- | |
| 172 | * 8	-		- | |
| 173 | * 9	-		- | |
| 174 | * 10	-		- | |
| 175 | * 11	-		- | |
| 176 | * 12	-		- | |
| 177 | * 13	-		- | |
| 178 | * 14	-		- | |
| 179 | * 15	-		- | |
| 180 | * 16	-		- | |
| 181 | * 17	-		- | |
| 182 | * 18	-		- | |
| 183 | * 19	-		- | |
| 184 | * 20	-		- | |
| 185 | * 21	-		- | |
| 186 | * 22	-		- | |
| 187 | * 23	-		- | |
| 188 | * 24	EN_MAS7_UPDATE	- | |
| 189 | * 25	DCFA		DCFA | |
| 190 | * 26	-		- | |
| 191 | * 27	CIGLSO		CIGLSO | |
| 192 | * 28	-		- | |
| 193 | * 29	-		- | |
| 194 | * 30	-		- | |
| 195 | * 31	NOPTI		NOPTI | |
| 196 | * | |
| 197 | * 604: ECP = Enable cache parity checking | |
| 198 | * 604: SIE = Serial instruction execution disable | |
| 199 | * 7450: TBEN = Time Base Enable | |
| 200 | * 7450: STEN = Software table lookup enable | |
| 201 | * 7450: BHTCLR = Branch history clear | |
| 202 | * 7450: XAEN = Extended Addressing Enabled | |
| 203 | * 7450: LRSTK = Link Register Stack Enable | |
| 204 | * 7450: FOLD = Branch folding enable | |
| 205 | * 7457: HBATEN = High BAT Enable | |
| 206 | * 7457: XBSEN = Extended BAT Block Size Enable | |
| 207 | */ | |
| 208 | ||
| 209 | #define HID1_E500_ABE	0x00001000 /* Address broadcast enable */ | |
| 210 | #define HID1_E500_ASTME	0x00002000 /* Address bus streaming mode enable */ | |
| 211 | #define HID1_E500_RFXE	0x00020000 /* Read fault exception enable */ | |
| 212 | ||
| 213 | #define HID0_E500_DEFAULT_SET	(HID0_EMCP | HID0_E500_TBEN | \ | |
| 214 | 				 HID0_E500_MAS7UPDEN) | |
| 215 | #define HID1_E500_DEFAULT_SET	(HID1_E500_ABE | HID1_E500_ASTME) | |
| 216 | #define HID0_E500MC_DEFAULT_SET	(HID0_EMCP | HID0_E500MC_L2MMU_MHD | \ | |
| 217 | 				 HID0_E500_MAS7UPDEN) | |
| 218 | #define HID0_E5500_DEFAULT_SET	(HID0_EMCP | HID0_E500MC_L2MMU_MHD) | |
| 219 | ||
| 220 | #define HID5_970_DCBZ_SIZE_HI	0x00000080UL	/* dcbz does a 32-byte store */ | |
| 221 | #define HID4_970_DISABLE_LG_PG	0x00000004ULL	/* disables large pages */ | |
| 222 | ||
| 223 | #endif /* _POWERPC_HID_H_ */ | |
| \ No newline at end of file |
lib/libc/include/powerpc64-freebsd-none/machine/ieee.h created+141| ... | ... | @@ -0,0 +1,141 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-3-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 1992, 1993 | |
| 5 | *	The Regents of the University of California. All rights reserved. | |
| 6 | * | |
| 7 | * This software was developed by the Computer Systems Engineering group | |
| 8 | * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and | |
| 9 | * contributed to Berkeley. | |
| 10 | * | |
| 11 | * All advertising materials mentioning features or use of this software | |
| 12 | * must display the following acknowledgement: | |
| 13 | *	This product includes software developed by the University of | |
| 14 | *	California, Lawrence Berkeley Laboratory. | |
| 15 | * | |
| 16 | * Redistribution and use in source and binary forms, with or without | |
| 17 | * modification, are permitted provided that the following conditions | |
| 18 | * are met: | |
| 19 | * 1. Redistributions of source code must retain the above copyright | |
| 20 | * notice, this list of conditions and the following disclaimer. | |
| 21 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 22 | * notice, this list of conditions and the following disclaimer in the | |
| 23 | * documentation and/or other materials provided with the distribution. | |
| 24 | * 3. Neither the name of the University nor the names of its contributors | |
| 25 | * may be used to endorse or promote products derived from this software | |
| 26 | * without specific prior written permission. | |
| 27 | * | |
| 28 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | |
| 29 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 30 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
| 31 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
| 32 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
| 33 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
| 34 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
| 35 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
| 36 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
| 37 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
| 38 | * SUCH DAMAGE. | |
| 39 | *	from: NetBSD: ieee.h,v 1.1.1.1 1998/06/20 04:58:51 eeh Exp | |
| 40 | */ | |
| 41 | ||
| 42 | #ifndef _MACHINE_IEEE_H_ | |
| 43 | #define	_MACHINE_IEEE_H_ | |
| 44 | ||
| 45 | /* | |
| 46 | * ieee.h defines the machine-dependent layout of the machine's IEEE | |
| 47 | * floating point. It does *not* define (yet?) any of the rounding | |
| 48 | * mode bits, exceptions, and so forth. | |
| 49 | */ | |
| 50 | ||
| 51 | /* | |
| 52 | * Define the number of bits in each fraction and exponent. | |
| 53 | * | |
| 54 | *		 k	 k+1 | |
| 55 | * Note that 1.0 x 2 == 0.1 x 2 and that denorms are represented | |
| 56 | * | |
| 57 | *					 (-exp_bias+1) | |
| 58 | * as fractions that look like 0.fffff x 2 . This means that | |
| 59 | * | |
| 60 | *			 -126 | |
| 61 | * the number 0.10000 x 2 , for instance, is the same as the normalized | |
| 62 | * | |
| 63 | *		-127			 -128 | |
| 64 | * float 1.0 x 2 . Thus, to represent 2 , we need one leading zero | |
| 65 | * | |
| 66 | *				 -129 | |
| 67 | * in the fraction; to represent 2 , we need two, and so on. This | |
| 68 | * | |
| 69 | *						 (-exp_bias-fracbits+1) | |
| 70 | * implies that the smallest denormalized number is 2 | |
| 71 | * | |
| 72 | * for whichever format we are talking about: for single precision, for | |
| 73 | * | |
| 74 | *						-126		-149 | |
| 75 | * instance, we get .00000000000000000000001 x 2 , or 1.0 x 2 , and | |
| 76 | * | |
| 77 | * -149 == -127 - 23 + 1. | |
| 78 | */ | |
| 79 | #define	SNG_EXPBITS	8 | |
| 80 | #define	SNG_FRACBITS	23 | |
| 81 | ||
| 82 | #define	DBL_EXPBITS	11 | |
| 83 | #define	DBL_FRACBITS	52 | |
| 84 | ||
| 85 | #ifdef notyet | |
| 86 | #define	E80_EXPBITS	15 | |
| 87 | #define	E80_FRACBITS	64 | |
| 88 | #endif | |
| 89 | ||
| 90 | #define	EXT_EXPBITS	15 | |
| 91 | #define	EXT_FRACBITS	112 | |
| 92 | ||
| 93 | struct ieee_single { | |
| 94 | 	u_int	sng_sign:1; | |
| 95 | 	u_int	sng_exp:8; | |
| 96 | 	u_int	sng_frac:23; | |
| 97 | }; | |
| 98 | ||
| 99 | struct ieee_double { | |
| 100 | 	u_int	dbl_sign:1; | |
| 101 | 	u_int	dbl_exp:11; | |
| 102 | 	u_int	dbl_frach:20; | |
| 103 | 	u_int	dbl_fracl; | |
| 104 | }; | |
| 105 | ||
| 106 | struct ieee_ext { | |
| 107 | 	u_int	ext_sign:1; | |
| 108 | 	u_int	ext_exp:15; | |
| 109 | 	u_int	ext_frach:16; | |
| 110 | 	u_int	ext_frachm; | |
| 111 | 	u_int	ext_fraclm; | |
| 112 | 	u_int	ext_fracl; | |
| 113 | }; | |
| 114 | ||
| 115 | /* | |
| 116 | * Floats whose exponent is in [1..INFNAN) (of whatever type) are | |
| 117 | * `normal'. Floats whose exponent is INFNAN are either Inf or NaN. | |
| 118 | * Floats whose exponent is zero are either zero (iff all fraction | |
| 119 | * bits are zero) or subnormal values. | |
| 120 | * | |
| 121 | * A NaN is a `signalling NaN' if its QUIETNAN bit is clear in its | |
| 122 | * high fraction; if the bit is set, it is a `quiet NaN'. | |
| 123 | */ | |
| 124 | #define	SNG_EXP_INFNAN	255 | |
| 125 | #define	DBL_EXP_INFNAN	2047 | |
| 126 | #define	EXT_EXP_INFNAN	32767 | |
| 127 | ||
| 128 | #if 0 | |
| 129 | #define	SNG_QUIETNAN	(1 << 22) | |
| 130 | #define	DBL_QUIETNAN	(1 << 19) | |
| 131 | #define	EXT_QUIETNAN	(1 << 15) | |
| 132 | #endif | |
| 133 | ||
| 134 | /* | |
| 135 | * Exponent biases. | |
| 136 | */ | |
| 137 | #define	SNG_EXP_BIAS	127 | |
| 138 | #define	DBL_EXP_BIAS	1023 | |
| 139 | #define	EXT_EXP_BIAS	16383 | |
| 140 | ||
| 141 | #endif | |
| \ No newline at end of file |
lib/libc/include/powerpc64-freebsd-none/machine/ieeefp.h created+42| ... | ... | @@ -0,0 +1,42 @@ |
| 1 | /* - | |
| 2 | * Written by J.T. Conklin, Apr 6, 1995 | |
| 3 | * Public domain. | |
| 4 | * $NetBSD: ieeefp.h,v 1.2 1999/07/07 01:52:26 danw Exp $ | |
| 5 | */ | |
| 6 | ||
| 7 | #ifndef _MACHINE_IEEEFP_H_ | |
| 8 | #define _MACHINE_IEEEFP_H_ | |
| 9 | ||
| 10 | /* Deprecated historical FPU control interface */ | |
| 11 | ||
| 12 | typedef int fp_except_t; | |
| 13 | #ifdef __SPE__ | |
| 14 | #define FP_X_OFL	0x01	/* overflow exception */ | |
| 15 | #define FP_X_UFL	0x02	/* underflow exception */ | |
| 16 | #define FP_X_DZ		0x04	/* divide-by-zero exception */ | |
| 17 | #define FP_X_INV	0x08	/* invalid operation exception */ | |
| 18 | #define FP_X_IMP	0x10	/* imprecise (loss of precision) */ | |
| 19 | #else | |
| 20 | #define FP_X_IMP	0x01	/* imprecise (loss of precision) */ | |
| 21 | #define FP_X_DZ		0x02	/* divide-by-zero exception */ | |
| 22 | #define FP_X_UFL	0x04	/* underflow exception */ | |
| 23 | #define FP_X_OFL	0x08	/* overflow exception */ | |
| 24 | #define FP_X_INV	0x10	/* invalid operation exception */ | |
| 25 | #endif | |
| 26 | ||
| 27 | typedef enum { | |
| 28 | FP_RN=0,			/* round to nearest representable number */ | |
| 29 | FP_RZ=1,			/* round to zero (truncate) */ | |
| 30 | FP_RP=2,			/* round toward positive infinity */ | |
| 31 | FP_RM=3			/* round toward negative infinity */ | |
| 32 | } fp_rnd_t; | |
| 33 | ||
| 34 | __BEGIN_DECLS | |
| 35 | extern fp_rnd_t fpgetround(void); | |
| 36 | extern fp_rnd_t fpsetround(fp_rnd_t); | |
| 37 | extern fp_except_t fpgetmask(void); | |
| 38 | extern fp_except_t fpsetmask(fp_except_t); | |
| 39 | extern fp_except_t fpgetsticky(void); | |
| 40 | __END_DECLS | |
| 41 | ||
| 42 | #endif /* _MACHINE_IEEEFP_H_ */ | |
| \ No newline at end of file |
lib/libc/include/powerpc64-freebsd-none/machine/ifunc.h created+58| ... | ... | @@ -0,0 +1,58 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-2-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 2019 Brandon Bergren <bdragon@FreeBSD.org> | |
| 5 | * Copyright (c) 2015-2018 The FreeBSD Foundation. All rights reserved. | |
| 6 | * | |
| 7 | * Part of this software was developed by | |
| 8 | * Konstantin Belousov <kib@FreeBSD.org> | |
| 9 | * under sponsorship from the FreeBSD Foundation. | |
| 10 | * | |
| 11 | * Redistribution and use in source and binary forms, with or without | |
| 12 | * modification, are permitted provided that the following conditions | |
| 13 | * are met: | |
| 14 | * 1. Redistributions of source code must retain the above copyright | |
| 15 | * notice, this list of conditions and the following disclaimer. | |
| 16 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 17 | * notice, this list of conditions and the following disclaimer in the | |
| 18 | * documentation and/or other materials provided with the distribution. | |
| 19 | * | |
| 20 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |
| 21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 22 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
| 23 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | |
| 24 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
| 25 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
| 26 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
| 27 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
| 28 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
| 29 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
| 30 | * SUCH DAMAGE. | |
| 31 | */ | |
| 32 | ||
| 33 | #ifndef __POWERPC_IFUNC_H | |
| 34 | #define	__POWERPC_IFUNC_H | |
| 35 | ||
| 36 | #include <sys/types.h> | |
| 37 | ||
| 38 | #define	DEFINE_IFUNC(qual, ret_type, name, args)			\ | |
| 39 | static ret_type (*name##_resolver(void))args __used;		\ | |
| 40 | qual ret_type name args __attribute__((ifunc(#name "_resolver")));	\ | |
| 41 | static ret_type (*name##_resolver(void))args | |
| 42 | ||
| 43 | #define	DEFINE_UIFUNC(qual, ret_type, name, args)			\ | |
| 44 | static ret_type (*name##_resolver(register_t, register_t,		\ | |
| 45 | 	register_t, register_t, register_t, register_t, register_t,	\ | |
| 46 | 	register_t))args __used;					\ | |
| 47 | qual ret_type name args __attribute__((ifunc(#name "_resolver")));	\ | |
| 48 | static ret_type (*name##_resolver(					\ | |
| 49 | 	register_t cpu_features,					\ | |
| 50 | 	register_t cpu_features2,					\ | |
| 51 | 	register_t arg3 __unused,					\ | |
| 52 | 	register_t arg4 __unused,					\ | |
| 53 | 	register_t arg5 __unused,					\ | |
| 54 | 	register_t arg6 __unused,					\ | |
| 55 | 	register_t arg7 __unused,					\ | |
| 56 | 	register_t arg8 __unused))args | |
| 57 | ||
| 58 | #endif | |
| \ No newline at end of file |
lib/libc/include/powerpc64-freebsd-none/machine/intr_machdep.h created+64| ... | ... | @@ -0,0 +1,64 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-2-Clause | |
| 3 | * | |
| 4 | * Copyright (C) 2002 Benno Rice. | |
| 5 | * All rights reserved. | |
| 6 | * | |
| 7 | * Redistribution and use in source and binary forms, with or without | |
| 8 | * modification, are permitted provided that the following conditions | |
| 9 | * are met: | |
| 10 | * 1. Redistributions of source code must retain the above copyright | |
| 11 | * notice, this list of conditions and the following disclaimer. | |
| 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 13 | * notice, this list of conditions and the following disclaimer in the | |
| 14 | * documentation and/or other materials provided with the distribution. | |
| 15 | * | |
| 16 | * THIS SOFTWARE IS PROVIDED BY Benno Rice ``AS IS'' AND ANY EXPRESS OR | |
| 17 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |
| 18 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | |
| 19 | * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
| 20 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | |
| 21 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; | |
| 22 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | |
| 23 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | |
| 24 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | |
| 25 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 26 | */ | |
| 27 | ||
| 28 | #ifndef	_MACHINE_INTR_MACHDEP_H_ | |
| 29 | #define	_MACHINE_INTR_MACHDEP_H_ | |
| 30 | ||
| 31 | #define	INTR_VECTORS	256 | |
| 32 | ||
| 33 | #define	MAX_PICS		32 | |
| 34 | #define	MAP_IRQ(node, pin)	powerpc_get_irq(node, pin) | |
| 35 | ||
| 36 | /* | |
| 37 | * Default base address for MSI messages on PowerPC | |
| 38 | */ | |
| 39 | #define	MSI_INTEL_ADDR_BASE		0xfee00000 | |
| 40 | ||
| 41 | extern device_t root_pic; | |
| 42 | ||
| 43 | struct trapframe; | |
| 44 | ||
| 45 | driver_filter_t powerpc_ipi_handler; | |
| 46 | ||
| 47 | void	intrcnt_add(const char *name, u_long **countp); | |
| 48 | ||
| 49 | u_int	powerpc_register_pic(device_t, uint32_t, u_int, u_int, u_int); | |
| 50 | u_int	powerpc_get_irq(uint32_t, u_int); | |
| 51 | ||
| 52 | void	powerpc_dispatch_intr(u_int, struct trapframe *); | |
| 53 | int	powerpc_enable_intr(void); | |
| 54 | int	powerpc_setup_intr(const char *, u_int, driver_filter_t, driver_intr_t, | |
| 55 | 	 void *, enum intr_type, void **, int); | |
| 56 | int	powerpc_teardown_intr(void *); | |
| 57 | int	powerpc_bind_intr(u_int irq, u_char cpu); | |
| 58 | int	powerpc_config_intr(int, enum intr_trigger, enum intr_polarity); | |
| 59 | int	powerpc_fw_config_intr(int irq, int sense_code); | |
| 60 | ||
| 61 | void	powerpc_intr_mask(u_int irq); | |
| 62 | void	powerpc_intr_unmask(u_int irq); | |
| 63 | ||
| 64 | #endif /* _MACHINE_INTR_MACHDEP_H_ */ | |
| \ No newline at end of file |
lib/libc/include/powerpc64-freebsd-none/machine/kdb.h created+67| ... | ... | @@ -0,0 +1,67 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-2-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 2004 Marcel Moolenaar | |
| 5 | * All rights reserved. | |
| 6 | * | |
| 7 | * Redistribution and use in source and binary forms, with or without | |
| 8 | * modification, are permitted provided that the following conditions | |
| 9 | * are met: | |
| 10 | * | |
| 11 | * 1. Redistributions of source code must retain the above copyright | |
| 12 | * notice, this list of conditions and the following disclaimer. | |
| 13 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 14 | * notice, this list of conditions and the following disclaimer in the | |
| 15 | * documentation and/or other materials provided with the distribution. | |
| 16 | * | |
| 17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | |
| 18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |
| 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | |
| 20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | |
| 21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | |
| 22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
| 23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
| 24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
| 25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | |
| 26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 27 | */ | |
| 28 | ||
| 29 | #ifndef _MACHINE_KDB_H_ | |
| 30 | #define _MACHINE_KDB_H_ | |
| 31 | ||
| 32 | #include <machine/cpufunc.h> | |
| 33 | #include <machine/frame.h> | |
| 34 | #include <machine/md_var.h> | |
| 35 | #include <machine/psl.h> | |
| 36 | #include <machine/spr.h> | |
| 37 | ||
| 38 | void kdb_cpu_clear_singlestep(void); | |
| 39 | void kdb_cpu_set_singlestep(void); | |
| 40 | ||
| 41 | static __inline void | |
| 42 | kdb_cpu_sync_icache(unsigned char *addr, size_t size) | |
| 43 | { | |
| 44 | ||
| 45 | 	__syncicache(addr, size); | |
| 46 | } | |
| 47 | ||
| 48 | static __inline void | |
| 49 | kdb_cpu_trap(int vector, int _) | |
| 50 | { | |
| 51 | } | |
| 52 | ||
| 53 | static __inline int | |
| 54 | kdb_cpu_set_watchpoint(vm_offset_t addr, vm_size_t size, int access) | |
| 55 | { | |
| 56 | ||
| 57 | 	return (ENXIO); | |
| 58 | } | |
| 59 | ||
| 60 | static __inline int | |
| 61 | kdb_cpu_clr_watchpoint(vm_offset_t addr, vm_size_t size) | |
| 62 | { | |
| 63 | ||
| 64 | 	return (0); | |
| 65 | } | |
| 66 | ||
| 67 | #endif /* _MACHINE_KDB_H_ */ | |
| \ No newline at end of file |
lib/libc/include/powerpc64-freebsd-none/machine/machdep.h created+37| ... | ... | @@ -0,0 +1,37 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-2-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 2011-2012 Semihalf | |
| 5 | * All rights reserved. | |
| 6 | * | |
| 7 | * Redistribution and use in source and binary forms, with or without | |
| 8 | * modification, are permitted provided that the following conditions | |
| 9 | * are met: | |
| 10 | * 1. Redistributions of source code must retain the above copyright | |
| 11 | * notice, this list of conditions and the following disclaimer. | |
| 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 13 | * notice, this list of conditions and the following disclaimer in the | |
| 14 | * documentation and/or other materials provided with the distribution. | |
| 15 | * | |
| 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |
| 17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
| 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | |
| 20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
| 21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
| 22 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
| 23 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
| 24 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
| 25 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
| 26 | * SUCH DAMAGE. | |
| 27 | */ | |
| 28 | ||
| 29 | #ifndef _POWERPC_MACHDEP_H_ | |
| 30 | #define _POWERPC_MACHDEP_H_ | |
| 31 | ||
| 32 | void booke_disable_l2_cache(void); | |
| 33 | void booke_enable_l1_cache(void); | |
| 34 | void booke_enable_l2_cache(void); | |
| 35 | void booke_enable_bpred(void); | |
| 36 | ||
| 37 | #endif /* _POWERPC_MACHDEP_H_ */ | |
| \ No newline at end of file |
lib/libc/include/powerpc64-freebsd-none/machine/md_var.h created+71| ... | ... | @@ -0,0 +1,71 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-2-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 1998 Doug Rabson | |
| 5 | * All rights reserved. | |
| 6 | * | |
| 7 | * Redistribution and use in source and binary forms, with or without | |
| 8 | * modification, are permitted provided that the following conditions | |
| 9 | * are met: | |
| 10 | * 1. Redistributions of source code must retain the above copyright | |
| 11 | * notice, this list of conditions and the following disclaimer. | |
| 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 13 | * notice, this list of conditions and the following disclaimer in the | |
| 14 | * documentation and/or other materials provided with the distribution. | |
| 15 | * | |
| 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |
| 17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
| 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | |
| 20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
| 21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
| 22 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
| 23 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
| 24 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
| 25 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
| 26 | * SUCH DAMAGE. | |
| 27 | */ | |
| 28 | ||
| 29 | #ifndef _MACHINE_MD_VAR_H_ | |
| 30 | #define	_MACHINE_MD_VAR_H_ | |
| 31 | ||
| 32 | /* | |
| 33 | * Miscellaneous machine-dependent declarations. | |
| 34 | */ | |
| 35 | ||
| 36 | extern	char	sigcode32[]; | |
| 37 | extern	int	szsigcode32; | |
| 38 | ||
| 39 | #ifdef __powerpc64__ | |
| 40 | extern	char	sigcode64[], sigcode64_elfv2[]; | |
| 41 | extern	int	szsigcode64, szsigcode64_elfv2; | |
| 42 | ||
| 43 | struct	dumperinfo; | |
| 44 | struct	minidumpstate; | |
| 45 | int	cpu_minidumpsys(struct dumperinfo *, const struct minidumpstate *); | |
| 46 | #endif | |
| 47 | ||
| 48 | extern	long	Maxmem; | |
| 49 | ||
| 50 | extern	vm_offset_t	kstack0; | |
| 51 | extern	vm_offset_t	kstack0_phys; | |
| 52 | ||
| 53 | extern	int powerpc_pow_enabled; | |
| 54 | extern	int cacheline_size; | |
| 55 | extern int hw_direct_map; | |
| 56 | ||
| 57 | void	__syncicache(void *, int); | |
| 58 | ||
| 59 | int	mem_valid(vm_offset_t addr, int len); | |
| 60 | ||
| 61 | void	decr_init(void); | |
| 62 | void	decr_ap_init(void); | |
| 63 | void	decr_tc_init(void); | |
| 64 | ||
| 65 | void	cpu_feature_setup(void); | |
| 66 | void	cpu_setup(u_int); | |
| 67 | ||
| 68 | struct	trapframe; | |
| 69 | void	powerpc_interrupt(struct trapframe *); | |
| 70 | ||
| 71 | #endif /* !_MACHINE_MD_VAR_H_ */ | |
| \ No newline at end of file |
lib/libc/include/powerpc64-freebsd-none/machine/metadata.h created+38| ... | ... | @@ -0,0 +1,38 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-2-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 2001 Jake Burkholder. | |
| 5 | * All rights reserved. | |
| 6 | * | |
| 7 | * Redistribution and use in source and binary forms, with or without | |
| 8 | * modification, are permitted provided that the following conditions | |
| 9 | * are met: | |
| 10 | * 1. Redistributions of source code must retain the above copyright | |
| 11 | * notice, this list of conditions and the following disclaimer. | |
| 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 13 | * notice, this list of conditions and the following disclaimer in the | |
| 14 | * documentation and/or other materials provided with the distribution. | |
| 15 | * | |
| 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |
| 17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
| 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | |
| 20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
| 21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
| 22 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
| 23 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
| 24 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
| 25 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
| 26 | * SUCH DAMAGE. | |
| 27 | */ | |
| 28 | ||
| 29 | #ifndef _MACHINE_METADATA_H_ | |
| 30 | #define	_MACHINE_METADATA_H_ | |
| 31 | ||
| 32 | #define	MODINFOMD_ENVP		0x1001 | |
| 33 | #define	MODINFOMD_HOWTO		0x1002 | |
| 34 | #define	MODINFOMD_KERNEND	0x1003 | |
| 35 | #define	MODINFOMD_BOOTINFO	0x1004 | |
| 36 | #define	MODINFOMD_DTBP		0x1005 | |
| 37 | ||
| 38 | #endif /* !_MACHINE_METADATA_H_ */ | |
| \ No newline at end of file |
lib/libc/include/powerpc64-freebsd-none/machine/minidump.h created+52| ... | ... | @@ -0,0 +1,52 @@ |
| 1 | /*- | |
| 2 | * Copyright (c) 2006 Peter Wemm | |
| 3 | * All rights reserved. | |
| 4 | * | |
| 5 | * Redistribution and use in source and binary forms, with or without | |
| 6 | * modification, are permitted provided that the following conditions | |
| 7 | * are met: | |
| 8 | * | |
| 9 | * 1. Redistributions of source code must retain the above copyright | |
| 10 | * notice, this list of conditions and the following disclaimer. | |
| 11 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 12 | * notice, this list of conditions and the following disclaimer in the | |
| 13 | * documentation and/or other materials provided with the distribution. | |
| 14 | * | |
| 15 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | |
| 16 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |
| 17 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | |
| 18 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | |
| 19 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | |
| 20 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
| 21 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
| 22 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
| 23 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | |
| 24 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 25 | * | |
| 26 | * From i386: FreeBSD: 157909 2006-04-21 04:28:43Z peter | |
| 27 | */ | |
| 28 | ||
| 29 | #ifndef	_MACHINE_MINIDUMP_H_ | |
| 30 | #define	_MACHINE_MINIDUMP_H_ 1 | |
| 31 | ||
| 32 | #define	MINIDUMP_MAGIC		"minidump FreeBSD/powerpc64" | |
| 33 | #define	MINIDUMP_VERSION	2 | |
| 34 | ||
| 35 | struct minidumphdr { | |
| 36 | 	char magic[32]; | |
| 37 | 	char mmu_name[32]; | |
| 38 | 	uint32_t version; | |
| 39 | 	uint32_t msgbufsize; | |
| 40 | 	uint32_t bitmapsize; | |
| 41 | 	uint32_t pmapsize; | |
| 42 | 	uint64_t kernbase; | |
| 43 | 	uint64_t kernend; | |
| 44 | 	uint64_t dmapbase; | |
| 45 | 	uint64_t dmapend; | |
| 46 | 	int hw_direct_map; | |
| 47 | 	uint64_t startkernel; | |
| 48 | 	uint64_t endkernel; | |
| 49 | 	uint32_t dumpavailsize; | |
| 50 | }; | |
| 51 | ||
| 52 | #endif /* _MACHINE_MINIDUMP_H_ */ | |
| \ No newline at end of file |
lib/libc/include/powerpc64-freebsd-none/machine/mmuvar.h created+224| ... | ... | @@ -0,0 +1,224 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-2-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 2005 Peter Grehan | |
| 5 | * All rights reserved. | |
| 6 | * | |
| 7 | * Redistribution and use in source and binary forms, with or without | |
| 8 | * modification, are permitted provided that the following conditions | |
| 9 | * are met: | |
| 10 | * 1. Redistributions of source code must retain the above copyright | |
| 11 | * notice, this list of conditions and the following disclaimer. | |
| 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 13 | * notice, this list of conditions and the following disclaimer in the | |
| 14 | * documentation and/or other materials provided with the distribution. | |
| 15 | * | |
| 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |
| 17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
| 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | |
| 20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
| 21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
| 22 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
| 23 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
| 24 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
| 25 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
| 26 | * SUCH DAMAGE. | |
| 27 | */ | |
| 28 | ||
| 29 | #ifndef _MACHINE_MMUVAR_H_ | |
| 30 | #define _MACHINE_MMUVAR_H_ | |
| 31 | ||
| 32 | typedef	void	(*pmap_bootstrap_t)(vm_offset_t, vm_offset_t); | |
| 33 | typedef	void	(*pmap_cpu_bootstrap_t)(int); | |
| 34 | typedef	void	(*pmap_kenter_t)(vm_offset_t, vm_paddr_t pa); | |
| 35 | typedef	void	(*pmap_kenter_attr_t)(vm_offset_t, vm_paddr_t, vm_memattr_t); | |
| 36 | typedef	void	(*pmap_kremove_t)(vm_offset_t); | |
| 37 | typedef	void	*(*pmap_mapdev_t)(vm_paddr_t, vm_size_t); | |
| 38 | typedef	void	*(*pmap_mapdev_attr_t)(vm_paddr_t, vm_size_t, vm_memattr_t); | |
| 39 | typedef	void	(*pmap_unmapdev_t)(void *, vm_size_t); | |
| 40 | typedef	void	(*pmap_page_set_memattr_t)(vm_page_t, vm_memattr_t); | |
| 41 | typedef	int	(*pmap_change_attr_t)(vm_offset_t, vm_size_t, vm_memattr_t); | |
| 42 | typedef	int	(*pmap_map_user_ptr_t)(pmap_t, volatile const void *, | |
| 43 | 		 void **, size_t, size_t *); | |
| 44 | typedef	int	(*pmap_decode_kernel_ptr_t)(vm_offset_t, int *, vm_offset_t *); | |
| 45 | typedef	vm_paddr_t	(*pmap_kextract_t)(vm_offset_t); | |
| 46 | typedef	int	(*pmap_dev_direct_mapped_t)(vm_paddr_t, vm_size_t); | |
| 47 | ||
| 48 | typedef	void	(*pmap_page_array_startup_t)(long); | |
| 49 | typedef	void	(*pmap_advise_t)(pmap_t, vm_offset_t, vm_offset_t, int); | |
| 50 | typedef	void	(*pmap_clear_modify_t)(vm_page_t); | |
| 51 | typedef	void	(*pmap_remove_write_t)(vm_page_t); | |
| 52 | typedef	void	(*pmap_copy_t)(pmap_t, pmap_t, vm_offset_t, vm_size_t, vm_offset_t); | |
| 53 | typedef	void	(*pmap_copy_page_t)(vm_page_t, vm_page_t); | |
| 54 | typedef	void	(*pmap_copy_pages_t)(vm_page_t *, vm_offset_t, | |
| 55 | 		 vm_page_t *, vm_offset_t, int); | |
| 56 | typedef	int	(*pmap_enter_t)(pmap_t, vm_offset_t, vm_page_t, vm_prot_t, | |
| 57 | 		 u_int, int8_t); | |
| 58 | typedef	void	(*pmap_enter_object_t)(pmap_t, vm_offset_t, vm_offset_t, | |
| 59 | 		 vm_page_t, vm_prot_t); | |
| 60 | typedef	void	(*pmap_enter_quick_t)(pmap_t, vm_offset_t, vm_page_t, vm_prot_t); | |
| 61 | typedef	vm_paddr_t	(*pmap_extract_t)(pmap_t, vm_offset_t); | |
| 62 | typedef	vm_page_t	(*pmap_extract_and_hold_t)(pmap_t, vm_offset_t, vm_prot_t); | |
| 63 | typedef	int	(*pmap_growkernel_nopanic_t)(vm_offset_t); | |
| 64 | typedef	void	(*pmap_init_t)(void); | |
| 65 | typedef	bool	(*pmap_is_modified_t)(vm_page_t); | |
| 66 | typedef	bool	(*pmap_is_prefaultable_t)(pmap_t, vm_offset_t); | |
| 67 | typedef	bool	(*pmap_is_referenced_t)(vm_page_t); | |
| 68 | typedef	int	(*pmap_ts_referenced_t)(vm_page_t); | |
| 69 | typedef	vm_offset_t	(*pmap_map_t)(vm_offset_t *, vm_paddr_t, vm_paddr_t, int); | |
| 70 | typedef	void	(*pmap_object_init_pt_t)(pmap_t, vm_offset_t, vm_object_t, | |
| 71 | 		 vm_pindex_t, vm_size_t); | |
| 72 | typedef	bool	(*pmap_page_exists_quick_t)(pmap_t, vm_page_t); | |
| 73 | typedef	bool	(*pmap_page_is_mapped_t)(vm_page_t); | |
| 74 | typedef	void	(*pmap_page_init_t)(vm_page_t); | |
| 75 | typedef	int	(*pmap_page_wired_mappings_t)(vm_page_t); | |
| 76 | typedef	void	(*pmap_pinit0_t)(pmap_t); | |
| 77 | typedef	void	(*pmap_protect_t)(pmap_t, vm_offset_t, vm_offset_t, vm_prot_t); | |
| 78 | typedef	void	(*pmap_qenter_t)(vm_offset_t, vm_page_t *, int); | |
| 79 | typedef	void	(*pmap_qremove_t)(vm_offset_t, int); | |
| 80 | typedef	void	(*pmap_release_t)(pmap_t); | |
| 81 | typedef	void	(*pmap_remove_t)(pmap_t, vm_offset_t, vm_offset_t); | |
| 82 | typedef	void	(*pmap_remove_all_t)(vm_page_t); | |
| 83 | typedef	void	(*pmap_remove_pages_t)(pmap_t); | |
| 84 | typedef	void	(*pmap_unwire_t)(pmap_t, vm_offset_t, vm_offset_t); | |
| 85 | typedef	void	(*pmap_zero_page_t)(vm_page_t); | |
| 86 | typedef	void	(*pmap_zero_page_area_t)(vm_page_t, int, int); | |
| 87 | typedef	int	(*pmap_mincore_t)(pmap_t, vm_offset_t, vm_paddr_t *); | |
| 88 | typedef	void	(*pmap_activate_t)(struct thread	*); | |
| 89 | typedef void	(*pmap_deactivate_t)(struct thread	*); | |
| 90 | typedef	void	(*pmap_align_superpage_t)(vm_object_t, vm_ooffset_t, | |
| 91 | 		 vm_offset_t *, vm_size_t); | |
| 92 | ||
| 93 | typedef	void	(*pmap_sync_icache_t)(pmap_t, vm_offset_t, vm_size_t); | |
| 94 | typedef	void	(*pmap_dumpsys_map_chunk_t)(vm_paddr_t, size_t, void **); | |
| 95 | typedef	void	(*pmap_dumpsys_unmap_chunk_t)(vm_paddr_t, size_t, void *); | |
| 96 | typedef	void	(*pmap_dumpsys_pa_init_t)(void); | |
| 97 | typedef	size_t	(*pmap_dumpsys_scan_pmap_t)(struct bitset *dump_bitset); | |
| 98 | typedef	void	*(*pmap_dumpsys_dump_pmap_init_t)(unsigned); | |
| 99 | typedef	void	*(*pmap_dumpsys_dump_pmap_t)(void *, void *, u_long *); | |
| 100 | typedef	vm_offset_t	(*pmap_quick_enter_page_t)(vm_page_t); | |
| 101 | typedef	void	(*pmap_quick_remove_page_t)(vm_offset_t); | |
| 102 | typedef	bool	(*pmap_ps_enabled_t)(pmap_t); | |
| 103 | typedef	void	(*pmap_tlbie_all_t)(void); | |
| 104 | typedef void	(*pmap_installer_t)(void); | |
| 105 | ||
| 106 | struct pmap_funcs { | |
| 107 | 	pmap_installer_t	install; | |
| 108 | 	pmap_bootstrap_t	bootstrap; | |
| 109 | 	pmap_cpu_bootstrap_t	cpu_bootstrap; | |
| 110 | 	pmap_kenter_t		kenter; | |
| 111 | 	pmap_kenter_attr_t	kenter_attr; | |
| 112 | 	pmap_kremove_t		kremove; | |
| 113 | 	pmap_mapdev_t		mapdev; | |
| 114 | 	pmap_mapdev_attr_t	mapdev_attr; | |
| 115 | 	pmap_unmapdev_t		unmapdev; | |
| 116 | 	pmap_page_set_memattr_t	page_set_memattr; | |
| 117 | 	pmap_change_attr_t	change_attr; | |
| 118 | 	pmap_map_user_ptr_t	map_user_ptr; | |
| 119 | 	pmap_decode_kernel_ptr_t	decode_kernel_ptr; | |
| 120 | 	pmap_kextract_t		kextract; | |
| 121 | 	pmap_dev_direct_mapped_t	dev_direct_mapped; | |
| 122 | 	pmap_advise_t		advise; | |
| 123 | 	pmap_clear_modify_t	clear_modify; | |
| 124 | 	pmap_remove_write_t	remove_write; | |
| 125 | 	pmap_copy_t	copy; | |
| 126 | 	pmap_copy_page_t	copy_page; | |
| 127 | 	pmap_copy_pages_t	copy_pages; | |
| 128 | 	pmap_enter_t	enter; | |
| 129 | 	pmap_enter_object_t	enter_object; | |
| 130 | 	pmap_enter_quick_t	enter_quick; | |
| 131 | 	pmap_extract_t	extract; | |
| 132 | 	pmap_extract_and_hold_t	extract_and_hold; | |
| 133 | 	pmap_growkernel_nopanic_t	growkernel_nopanic; | |
| 134 | 	pmap_init_t	init; | |
| 135 | 	pmap_is_modified_t	is_modified; | |
| 136 | 	pmap_is_prefaultable_t	is_prefaultable; | |
| 137 | 	pmap_is_referenced_t	is_referenced; | |
| 138 | 	pmap_ts_referenced_t	ts_referenced; | |
| 139 | 	pmap_page_is_mapped_t	page_is_mapped; | |
| 140 | 	pmap_ps_enabled_t	ps_enabled; | |
| 141 | 	pmap_map_t	map; | |
| 142 | 	pmap_object_init_pt_t	object_init_pt; | |
| 143 | 	pmap_page_exists_quick_t	page_exists_quick; | |
| 144 | 	pmap_page_init_t	page_init; | |
| 145 | 	pmap_page_wired_mappings_t	page_wired_mappings; | |
| 146 | 	pmap_pinit_t	pinit; | |
| 147 | 	pmap_pinit0_t	pinit0; | |
| 148 | 	pmap_protect_t	protect; | |
| 149 | 	pmap_qenter_t	qenter; | |
| 150 | 	pmap_qremove_t	qremove; | |
| 151 | 	pmap_release_t	release; | |
| 152 | 	pmap_remove_t	remove; | |
| 153 | 	pmap_remove_all_t	remove_all; | |
| 154 | 	pmap_remove_pages_t	remove_pages; | |
| 155 | 	pmap_unwire_t	unwire; | |
| 156 | 	pmap_zero_page_t	zero_page; | |
| 157 | 	pmap_zero_page_area_t	zero_page_area; | |
| 158 | 	pmap_mincore_t	mincore; | |
| 159 | 	pmap_activate_t	activate; | |
| 160 | 	pmap_deactivate_t	deactivate; | |
| 161 | 	pmap_align_superpage_t	align_superpage; | |
| 162 | 	pmap_sync_icache_t	sync_icache; | |
| 163 | 	pmap_quick_enter_page_t	quick_enter_page; | |
| 164 | 	pmap_quick_remove_page_t	quick_remove_page; | |
| 165 | 	pmap_page_array_startup_t	page_array_startup; | |
| 166 | 	pmap_dumpsys_map_chunk_t	dumpsys_map_chunk; | |
| 167 | 	pmap_dumpsys_unmap_chunk_t	dumpsys_unmap_chunk; | |
| 168 | 	pmap_dumpsys_pa_init_t	dumpsys_pa_init; | |
| 169 | 	pmap_dumpsys_scan_pmap_t	dumpsys_scan_pmap; | |
| 170 | 	pmap_dumpsys_dump_pmap_init_t	dumpsys_dump_pmap_init; | |
| 171 | 	pmap_dumpsys_dump_pmap_t	dumpsys_dump_pmap; | |
| 172 | 	pmap_tlbie_all_t	tlbie_all; | |
| 173 | ||
| 174 | }; | |
| 175 | struct mmu_kobj { | |
| 176 | 	const char *name; | |
| 177 | 	const struct mmu_kobj *base; | |
| 178 | 	const struct pmap_funcs *funcs; | |
| 179 | }; | |
| 180 | ||
| 181 | typedef struct mmu_kobj		*mmu_t; | |
| 182 | ||
| 183 | /* The currently installed pmap object. */ | |
| 184 | extern mmu_t	mmu_obj; | |
| 185 | ||
| 186 | /* | |
| 187 | * Resolve a given pmap function. | |
| 188 | * 'func' is the function name less the 'pmap_' * prefix. | |
| 189 | */ | |
| 190 | #define PMAP_RESOLVE_FUNC(func) 		\ | |
| 191 | 	({					\ | |
| 192 | 	 pmap_##func##_t f;			\ | |
| 193 | 	 const struct mmu_kobj	*mmu = mmu_obj;	\ | |
| 194 | 	 do {					\ | |
| 195 | 	 f = mmu->funcs->func;		\ | |
| 196 | 	 if (f != NULL) break;		\ | |
| 197 | 	 mmu = mmu->base;			\ | |
| 198 | 	} while (mmu != NULL);			\ | |
| 199 | 	f;}) | |
| 200 | ||
| 201 | #define MMU_DEF(name, ident, methods)		\ | |
| 202 | 						\ | |
| 203 | const struct mmu_kobj name = {		\ | |
| 204 | 	ident, NULL, &methods			\ | |
| 205 | };						\ | |
| 206 | DATA_SET(mmu_set, name) | |
| 207 | ||
| 208 | #define MMU_DEF_INHERIT(name, ident, methods, base1)	\ | |
| 209 | 						\ | |
| 210 | const struct mmu_kobj name = {			\ | |
| 211 | 	ident, &base1, &methods,		\ | |
| 212 | };						\ | |
| 213 | DATA_SET(mmu_set, name) | |
| 214 | ||
| 215 | /* | |
| 216 | * Known MMU names | |
| 217 | */ | |
| 218 | #define MMU_TYPE_BOOKE	"mmu_booke"	/* Book-E MMU specification */ | |
| 219 | #define MMU_TYPE_OEA	"mmu_oea"	/* 32-bit OEA */ | |
| 220 | #define MMU_TYPE_G5	"mmu_g5"	/* 64-bit bridge (ibm 970) */ | |
| 221 | #define MMU_TYPE_RADIX	"mmu_radix"	/* 64-bit native ISA 3.0 (POWER9) radix */ | |
| 222 | #define MMU_TYPE_8xx	"mmu_8xx"	/* 8xx quicc TLB */ | |
| 223 | ||
| 224 | #endif /* _MACHINE_MMUVAR_H_ */ | |
| \ No newline at end of file |
lib/libc/include/powerpc64-freebsd-none/machine/ofw_machdep.h created+57| ... | ... | @@ -0,0 +1,57 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-2-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 2001 by Thomas Moestl <tmm@FreeBSD.org>. | |
| 5 | * All rights reserved. | |
| 6 | * | |
| 7 | * Redistribution and use in source and binary forms, with or without | |
| 8 | * modification, are permitted provided that the following conditions | |
| 9 | * are met: | |
| 10 | * 1. Redistributions of source code must retain the above copyright | |
| 11 | * notice, this list of conditions and the following disclaimer. | |
| 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 13 | * notice, this list of conditions and the following disclaimer in the | |
| 14 | * documentation and/or other materials provided with the distribution. | |
| 15 | * | |
| 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | |
| 17 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |
| 18 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | |
| 19 | * IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, | |
| 20 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | |
| 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | |
| 22 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | |
| 23 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | |
| 24 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE | |
| 25 | * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 26 | */ | |
| 27 | ||
| 28 | #ifndef _MACHINE_OFW_MACHDEP_H_ | |
| 29 | #define _MACHINE_OFW_MACHDEP_H_ | |
| 30 | ||
| 31 | #include <sys/types.h> | |
| 32 | #include <sys/rman.h> | |
| 33 | #include <sys/bus.h> | |
| 34 | #include <dev/ofw/openfirm.h> | |
| 35 | #include <machine/platform.h> | |
| 36 | ||
| 37 | struct mem_region; | |
| 38 | struct numa_mem_region; | |
| 39 | ||
| 40 | typedef	uint32_t	cell_t; | |
| 41 | ||
| 42 | void OF_getetheraddr(device_t dev, u_char *addr); | |
| 43 | ||
| 44 | void OF_initial_setup(void *fdt_ptr, void *junk, int (*openfirm)(void *)); | |
| 45 | bool OF_bootstrap(void); | |
| 46 | ||
| 47 | void OF_reboot(void); | |
| 48 | ||
| 49 | void ofw_mem_regions(struct mem_region *, int *, struct mem_region *, int *); | |
| 50 | void ofw_numa_mem_regions(struct numa_mem_region *, int *); | |
| 51 | void ofw_quiesce(void); /* Must be called before VM is up! */ | |
| 52 | void ofw_save_trap_vec(char *); | |
| 53 | int ofw_pcibus_get_domain(device_t dev, device_t child, int *domain); | |
| 54 | int ofw_pcibus_get_cpus(device_t dev, device_t child, enum cpu_sets op, | |
| 55 | 		size_t setsize, cpuset_t *cpuset); | |
| 56 | ||
| 57 | #endif /* _MACHINE_OFW_MACHDEP_H_ */ | |
| \ No newline at end of file |
lib/libc/include/powerpc64-freebsd-none/machine/openpicreg.h created+141| ... | ... | @@ -0,0 +1,141 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-3-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 2000 Tsubai Masanari. All rights reserved. | |
| 5 | * | |
| 6 | * Redistribution and use in source and binary forms, with or without | |
| 7 | * modification, are permitted provided that the following conditions | |
| 8 | * are met: | |
| 9 | * 1. Redistributions of source code must retain the above copyright | |
| 10 | * notice, this list of conditions and the following disclaimer. | |
| 11 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 12 | * notice, this list of conditions and the following disclaimer in the | |
| 13 | * documentation and/or other materials provided with the distribution. | |
| 14 | * 3. The name of the author may not be used to endorse or promote products | |
| 15 | * derived from this software without specific prior written permission. | |
| 16 | * | |
| 17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | |
| 18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |
| 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | |
| 20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | |
| 21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | |
| 22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
| 23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
| 24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
| 25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | |
| 26 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 27 | * | |
| 28 | * from NetBSD: openpicreg.h,v 1.3 2001/08/30 03:08:52 briggs Exp | |
| 29 | */ | |
| 30 | ||
| 31 | /* | |
| 32 | * Size of OpenPIC register space | |
| 33 | */ | |
| 34 | #define	OPENPIC_SIZE			0x40000 | |
| 35 | ||
| 36 | /* | |
| 37 | * Per Processor Registers [private access] (0x00000 - 0x00fff) | |
| 38 | */ | |
| 39 | ||
| 40 | /* IPI dispatch command reg */ | |
| 41 | #define	OPENPIC_IPI_DISPATCH(ipi)	(0x40 + (ipi) * 0x10) | |
| 42 | ||
| 43 | /* current task priority reg */ | |
| 44 | #define	OPENPIC_TPR			0x80 | |
| 45 | #define OPENPIC_TPR_MASK			0x0000000f | |
| 46 | ||
| 47 | #define	OPENPIC_WHOAMI			0x90 | |
| 48 | ||
| 49 | /* interrupt acknowledge reg */ | |
| 50 | #define	OPENPIC_IACK			0xa0 | |
| 51 | ||
| 52 | /* end of interrupt reg */ | |
| 53 | #define	OPENPIC_EOI			0xb0 | |
| 54 | ||
| 55 | /* | |
| 56 | * Global registers (0x01000-0x0ffff) | |
| 57 | */ | |
| 58 | ||
| 59 | /* feature reporting reg 0 */ | |
| 60 | #define OPENPIC_FEATURE			0x1000 | |
| 61 | #define	 OPENPIC_FEATURE_VERSION_MASK		0x000000ff | |
| 62 | #define	 OPENPIC_FEATURE_LAST_CPU_MASK		0x00001f00 | |
| 63 | #define	 OPENPIC_FEATURE_LAST_CPU_SHIFT		8 | |
| 64 | #define	 OPENPIC_FEATURE_LAST_IRQ_MASK		0x07ff0000 | |
| 65 | #define	 OPENPIC_FEATURE_LAST_IRQ_SHIFT		16 | |
| 66 | ||
| 67 | /* global config reg 0 */ | |
| 68 | #define OPENPIC_CONFIG			0x1020 | |
| 69 | #define OPENPIC_CONFIG_RESET			0x80000000 | |
| 70 | #define OPENPIC_CONFIG_8259_PASSTHRU_DISABLE	0x20000000 | |
| 71 | ||
| 72 | /* interrupt configuration mode (direct or serial) */ | |
| 73 | #define OPENPIC_ICR			0x1030 | |
| 74 | #define OPENPIC_ICR_SERIAL_MODE		(1 << 27) | |
| 75 | #define OPENPIC_ICR_SERIAL_RATIO_MASK		(0x7 << 28) | |
| 76 | #define OPENPIC_ICR_SERIAL_RATIO_SHIFT		28 | |
| 77 | ||
| 78 | /* vendor ID */ | |
| 79 | #define OPENPIC_VENDOR_ID		0x1080 | |
| 80 | ||
| 81 | /* processor initialization reg */ | |
| 82 | #define OPENPIC_PROC_INIT		0x1090 | |
| 83 | ||
| 84 | /* IPI vector/priority reg */ | |
| 85 | #define OPENPIC_IPI_VECTOR(ipi)		(0x10a0 + (ipi) * 0x10) | |
| 86 | ||
| 87 | /* spurious intr. vector */ | |
| 88 | #define OPENPIC_SPURIOUS_VECTOR		0x10e0 | |
| 89 | ||
| 90 | /* Timer registers */ | |
| 91 | #define	OPENPIC_TIMERS			4 | |
| 92 | #define	OPENPIC_TFREQ			0x10f0 | |
| 93 | #define	OPENPIC_TCNT(t)			(0x1100 + (t) * 0x40) | |
| 94 | #define	OPENPIC_TBASE(t)		(0x1110 + (t) * 0x40) | |
| 95 | #define	OPENPIC_TVEC(t)			(0x1120 + (t) * 0x40) | |
| 96 | #define	OPENPIC_TDST(t)			(0x1130 + (t) * 0x40) | |
| 97 | ||
| 98 | /* | |
| 99 | * Interrupt Source Configuration Registers (0x10000 - 0x1ffff) | |
| 100 | */ | |
| 101 | ||
| 102 | /* interrupt vector/priority reg */ | |
| 103 | #define OPENPIC_SRC_VECTOR_COUNT	64 | |
| 104 | #ifndef OPENPIC_SRC_VECTOR | |
| 105 | #define OPENPIC_SRC_VECTOR(irq)		(0x10000 + (irq) * 0x20) | |
| 106 | #endif | |
| 107 | #define OPENPIC_SENSE_LEVEL			0x00400000 | |
| 108 | #define OPENPIC_SENSE_EDGE			0x00000000 | |
| 109 | #define OPENPIC_POLARITY_POSITIVE		0x00800000 | |
| 110 | #define OPENPIC_POLARITY_NEGATIVE		0x00000000 | |
| 111 | #define OPENPIC_IMASK				0x80000000 | |
| 112 | #define OPENPIC_ACTIVITY			0x40000000 | |
| 113 | #define OPENPIC_PRIORITY_MASK			0x000f0000 | |
| 114 | #define OPENPIC_PRIORITY_SHIFT			16 | |
| 115 | #define OPENPIC_VECTOR_MASK			0x000000ff | |
| 116 | ||
| 117 | /* interrupt destination cpu */ | |
| 118 | #ifndef OPENPIC_IDEST | |
| 119 | #define OPENPIC_IDEST(irq)		(0x10010 + (irq) * 0x20) | |
| 120 | #endif | |
| 121 | ||
| 122 | /* | |
| 123 | * Per Processor Registers [global access] (0x20000 - 0x3ffff) | |
| 124 | */ | |
| 125 | ||
| 126 | #define	OPENPIC_PCPU_BASE(cpu)		(0x20000 + (cpu) * 0x1000) | |
| 127 | ||
| 128 | #define	OPENPIC_PCPU_IPI_DISPATCH(cpu, ipi)	\ | |
| 129 | 	(OPENPIC_PCPU_BASE(cpu) + OPENPIC_IPI_DISPATCH(ipi)) | |
| 130 | ||
| 131 | #define	OPENPIC_PCPU_TPR(cpu)		\ | |
| 132 | 	(OPENPIC_PCPU_BASE(cpu) + OPENPIC_TPR) | |
| 133 | ||
| 134 | #define	OPENPIC_PCPU_WHOAMI(cpu)		\ | |
| 135 | 	(OPENPIC_PCPU_BASE(cpu) + OPENPIC_WHOAMI) | |
| 136 | ||
| 137 | #define OPENPIC_PCPU_IACK(cpu)			\ | |
| 138 | 	(OPENPIC_PCPU_BASE(cpu) + OPENPIC_IACK) | |
| 139 | ||
| 140 | #define OPENPIC_PCPU_EOI(cpu)			\ | |
| 141 | 	(OPENPIC_PCPU_BASE(cpu) + OPENPIC_EOI) | |
| \ No newline at end of file |
lib/libc/include/powerpc64-freebsd-none/machine/openpicvar.h created+90| ... | ... | @@ -0,0 +1,90 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-2-Clause | |
| 3 | * | |
| 4 | * Copyright (C) 2002 Benno Rice. | |
| 5 | * All rights reserved. | |
| 6 | * | |
| 7 | * Redistribution and use in source and binary forms, with or without | |
| 8 | * modification, are permitted provided that the following conditions | |
| 9 | * are met: | |
| 10 | * 1. Redistributions of source code must retain the above copyright | |
| 11 | * notice, this list of conditions and the following disclaimer. | |
| 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 13 | * notice, this list of conditions and the following disclaimer in the | |
| 14 | * documentation and/or other materials provided with the distribution. | |
| 15 | * | |
| 16 | * THIS SOFTWARE IS PROVIDED BY Benno Rice ``AS IS'' AND ANY EXPRESS OR | |
| 17 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |
| 18 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | |
| 19 | * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
| 20 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | |
| 21 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; | |
| 22 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | |
| 23 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | |
| 24 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | |
| 25 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 26 | */ | |
| 27 | ||
| 28 | #ifndef	_POWERPC_OPENPICVAR_H_ | |
| 29 | #define	_POWERPC_OPENPICVAR_H_ | |
| 30 | ||
| 31 | #define OPENPIC_DEVSTR	"OpenPIC Interrupt Controller" | |
| 32 | ||
| 33 | #define OPENPIC_IRQMAX	256	/* h/w allows more */ | |
| 34 | ||
| 35 | #define	OPENPIC_QUIRK_SINGLE_BIND	1	/* Bind interrupts to only 1 CPU */ | |
| 36 | #define	OPENPIC_QUIRK_HIDDEN_IRQS	2	/* May have IRQs beyond FRR[NIRQ] */ | |
| 37 | ||
| 38 | /* Names match the macros in openpicreg.h. */ | |
| 39 | struct openpic_timer { | |
| 40 | 	uint32_t	tcnt; | |
| 41 | 	uint32_t	tbase; | |
| 42 | 	uint32_t	tvec; | |
| 43 | 	uint32_t	tdst; | |
| 44 | }; | |
| 45 | ||
| 46 | struct openpic_softc { | |
| 47 | 	device_t	sc_dev; | |
| 48 | 	struct resource	*sc_memr; | |
| 49 | 	struct resource	*sc_intr; | |
| 50 | 	bus_space_tag_t sc_bt; | |
| 51 | 	bus_space_handle_t sc_bh; | |
| 52 | 	char		*sc_version; | |
| 53 | 	int		sc_rid; | |
| 54 | 	int		sc_irq; | |
| 55 | 	void		*sc_icookie; | |
| 56 | 	u_int		sc_ncpu; | |
| 57 | 	u_int		sc_nirq; | |
| 58 | 	int		sc_psim; | |
| 59 | 	u_int		sc_quirks; | |
| 60 | ||
| 61 | 	/* Saved states. */ | |
| 62 | 	uint32_t		sc_saved_config; | |
| 63 | 	uint32_t		sc_saved_ipis[4]; | |
| 64 | 	uint32_t		sc_saved_prios[4]; | |
| 65 | 	struct openpic_timer	sc_saved_timers[OPENPIC_TIMERS]; | |
| 66 | 	uint32_t		sc_saved_vectors[OPENPIC_SRC_VECTOR_COUNT]; | |
| 67 | ||
| 68 | }; | |
| 69 | ||
| 70 | /* | |
| 71 | * Bus-independent attach i/f | |
| 72 | */ | |
| 73 | int	openpic_common_attach(device_t, uint32_t); | |
| 74 | ||
| 75 | /* | |
| 76 | * PIC interface. | |
| 77 | */ | |
| 78 | void	openpic_bind(device_t dev, u_int irq, cpuset_t cpumask, void **); | |
| 79 | void	openpic_config(device_t, u_int, enum intr_trigger, enum intr_polarity); | |
| 80 | void	openpic_dispatch(device_t, struct trapframe *); | |
| 81 | void	openpic_enable(device_t, u_int, u_int, void **); | |
| 82 | void	openpic_eoi(device_t, u_int, void *); | |
| 83 | void	openpic_ipi(device_t, u_int); | |
| 84 | void	openpic_mask(device_t, u_int, void *); | |
| 85 | void	openpic_unmask(device_t, u_int, void *); | |
| 86 | ||
| 87 | int	openpic_suspend(device_t dev); | |
| 88 | int	openpic_resume(device_t dev); | |
| 89 | ||
| 90 | #endif /* _POWERPC_OPENPICVAR_H_ */ | |
| \ No newline at end of file |
lib/libc/include/powerpc64-freebsd-none/machine/param.h created+150| ... | ... | @@ -0,0 +1,150 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-4-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 2001 David E. O'Brien | |
| 5 | * Copyright (c) 1990 The Regents of the University of California. | |
| 6 | * All rights reserved. | |
| 7 | * | |
| 8 | * This code is derived from software contributed to Berkeley by | |
| 9 | * William Jolitz. | |
| 10 | * | |
| 11 | * Redistribution and use in source and binary forms, with or without | |
| 12 | * modification, are permitted provided that the following conditions | |
| 13 | * are met: | |
| 14 | * 1. Redistributions of source code must retain the above copyright | |
| 15 | * notice, this list of conditions and the following disclaimer. | |
| 16 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 17 | * notice, this list of conditions and the following disclaimer in the | |
| 18 | * documentation and/or other materials provided with the distribution. | |
| 19 | * 3. All advertising materials mentioning features or use of this software | |
| 20 | * must display the following acknowledgement: | |
| 21 | *	This product includes software developed by the University of | |
| 22 | *	California, Berkeley and its contributors. | |
| 23 | * 4. Neither the name of the University nor the names of its contributors | |
| 24 | * may be used to endorse or promote products derived from this software | |
| 25 | * without specific prior written permission. | |
| 26 | * | |
| 27 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | |
| 28 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 29 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
| 30 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
| 31 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
| 32 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
| 33 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
| 34 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
| 35 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
| 36 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
| 37 | * SUCH DAMAGE. | |
| 38 | */ | |
| 39 | ||
| 40 | #ifndef _POWERPC_INCLUDE_PARAM_H_ | |
| 41 | #define	_POWERPC_INCLUDE_PARAM_H_ | |
| 42 | ||
| 43 | /* | |
| 44 | * Machine dependent constants for PowerPC | |
| 45 | */ | |
| 46 | ||
| 47 | #include <machine/_align.h> | |
| 48 | ||
| 49 | #ifndef MACHINE | |
| 50 | #define	MACHINE		"powerpc" | |
| 51 | #endif | |
| 52 | #ifndef MACHINE_ARCH | |
| 53 | #ifdef __powerpc64__ | |
| 54 | #if defined(__LITTLE_ENDIAN__) | |
| 55 | #define	MACHINE_ARCH	"powerpc64le" | |
| 56 | #else | |
| 57 | #define	MACHINE_ARCH	"powerpc64" | |
| 58 | #endif | |
| 59 | #else | |
| 60 | #ifdef	__SPE__ | |
| 61 | #define	MACHINE_ARCH	"powerpcspe" | |
| 62 | #else | |
| 63 | #define	MACHINE_ARCH	"powerpc" | |
| 64 | #endif | |
| 65 | #endif | |
| 66 | #endif | |
| 67 | #define	MID_MACHINE	MID_POWERPC | |
| 68 | #ifdef __powerpc64__ | |
| 69 | #ifndef	MACHINE_ARCH32 | |
| 70 | #define	MACHINE_ARCH32	"powerpc" | |
| 71 | #endif | |
| 72 | #endif | |
| 73 | ||
| 74 | #ifdef SMP | |
| 75 | #ifndef MAXCPU | |
| 76 | #define	MAXCPU		256 | |
| 77 | #endif | |
| 78 | #else | |
| 79 | #define	MAXCPU		1 | |
| 80 | #endif | |
| 81 | ||
| 82 | #ifndef MAXMEMDOM | |
| 83 | #define	MAXMEMDOM	8 | |
| 84 | #endif | |
| 85 | ||
| 86 | #define	ALIGNBYTES	_ALIGNBYTES | |
| 87 | #define	ALIGN(p)	_ALIGN(p) | |
| 88 | /* | |
| 89 | * ALIGNED_POINTER is a boolean macro that checks whether an address | |
| 90 | * is valid to fetch data elements of type t from on this architecture. | |
| 91 | * This does not reflect the optimal alignment, just the possibility | |
| 92 | * (within reasonable limits). | |
| 93 | */ | |
| 94 | #define	ALIGNED_POINTER(p, t)	((((uintptr_t)(p)) & (sizeof (t) - 1)) == 0) | |
| 95 | ||
| 96 | /* | |
| 97 | * CACHE_LINE_SIZE is the compile-time maximum cache line size for an | |
| 98 | * architecture. It should be used with appropriate caution. | |
| 99 | */ | |
| 100 | #define	CACHE_LINE_SHIFT	7 | |
| 101 | #define	CACHE_LINE_SIZE		(1 << CACHE_LINE_SHIFT) | |
| 102 | ||
| 103 | #define	PAGE_SHIFT	12 | |
| 104 | #define	PAGE_SIZE	(1 << PAGE_SHIFT)	/* Page size */ | |
| 105 | #define	PAGE_MASK	(PAGE_SIZE - 1) | |
| 106 | #define	NPTEPG		(PAGE_SIZE/(sizeof (pt_entry_t))) | |
| 107 | #define	NPDEPG		(PAGE_SIZE/(sizeof (pt_entry_t))) | |
| 108 | ||
| 109 | #define L1_PAGE_SIZE_SHIFT 39 | |
| 110 | #define L1_PAGE_SIZE (1UL<<L1_PAGE_SIZE_SHIFT) | |
| 111 | #define L1_PAGE_MASK (L1_PAGE_SIZE-1) | |
| 112 | ||
| 113 | #define L2_PAGE_SIZE_SHIFT 30 | |
| 114 | #define L2_PAGE_SIZE (1UL<<L2_PAGE_SIZE_SHIFT) | |
| 115 | #define L2_PAGE_MASK (L2_PAGE_SIZE-1) | |
| 116 | ||
| 117 | #define L3_PAGE_SIZE_SHIFT 21 | |
| 118 | #define L3_PAGE_SIZE (1UL<<L3_PAGE_SIZE_SHIFT) | |
| 119 | #define L3_PAGE_MASK (L3_PAGE_SIZE-1) | |
| 120 | ||
| 121 | #define	MAXPAGESIZES	3	/* maximum number of supported page sizes */ | |
| 122 | ||
| 123 | #define	RELOCATABLE_KERNEL	1		/* kernel may relocate during startup */ | |
| 124 | ||
| 125 | #ifndef KSTACK_PAGES | |
| 126 | #ifdef __powerpc64__ | |
| 127 | #define	KSTACK_PAGES		12		/* includes pcb */ | |
| 128 | #else | |
| 129 | #define	KSTACK_PAGES		4		/* includes pcb */ | |
| 130 | #endif | |
| 131 | #endif | |
| 132 | #define	KSTACK_GUARD_PAGES	1	/* pages of kstack guard; 0 disables */ | |
| 133 | #define	USPACE		(kstack_pages * PAGE_SIZE)	/* total size of pcb */ | |
| 134 | ||
| 135 | #define	COPYFAULT		0x1 | |
| 136 | #define	FUSUFAULT		0x2 | |
| 137 | ||
| 138 | /* | |
| 139 | * Mach derived conversion macros | |
| 140 | */ | |
| 141 | #define	trunc_2mpage(x)		((unsigned long)(x) & ~L3_PAGE_MASK) | |
| 142 | #define	round_2mpage(x)		((((unsigned long)(x)) + L3_PAGE_MASK) & ~L3_PAGE_MASK) | |
| 143 | #define	trunc_1gpage(x)		((unsigned long)(x) & ~L2_PAGE_MASK) | |
| 144 | ||
| 145 | #define	powerpc_btop(x)		((x) >> PAGE_SHIFT) | |
| 146 | #define	powerpc_ptob(x)		((x) << PAGE_SHIFT) | |
| 147 | ||
| 148 | #define btoc(x)			((vm_offset_t)(((x)+PAGE_MASK)>>PAGE_SHIFT)) | |
| 149 | ||
| 150 | #endif /* !_POWERPC_INCLUDE_PARAM_H_ */ | |
| \ No newline at end of file |
lib/libc/include/powerpc64-freebsd-none/machine/pcb.h created+129| ... | ... | @@ -0,0 +1,129 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-4-Clause | |
| 3 | * | |
| 4 | * Copyright (C) 1995, 1996 Wolfgang Solfrank. | |
| 5 | * Copyright (C) 1995, 1996 TooLs GmbH. | |
| 6 | * All rights reserved. | |
| 7 | * | |
| 8 | * Redistribution and use in source and binary forms, with or without | |
| 9 | * modification, are permitted provided that the following conditions | |
| 10 | * are met: | |
| 11 | * 1. Redistributions of source code must retain the above copyright | |
| 12 | * notice, this list of conditions and the following disclaimer. | |
| 13 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 14 | * notice, this list of conditions and the following disclaimer in the | |
| 15 | * documentation and/or other materials provided with the distribution. | |
| 16 | * 3. All advertising materials mentioning features or use of this software | |
| 17 | * must display the following acknowledgement: | |
| 18 | *	This product includes software developed by TooLs GmbH. | |
| 19 | * 4. The name of TooLs GmbH may not be used to endorse or promote products | |
| 20 | * derived from this software without specific prior written permission. | |
| 21 | * | |
| 22 | * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR | |
| 23 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |
| 24 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | |
| 25 | * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
| 26 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | |
| 27 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; | |
| 28 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | |
| 29 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | |
| 30 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | |
| 31 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 32 | * | |
| 33 | *	$NetBSD: pcb.h,v 1.4 2000/06/04 11:57:17 tsubai Exp $ | |
| 34 | */ | |
| 35 | ||
| 36 | #ifndef _MACHINE_PCB_H_ | |
| 37 | #define	_MACHINE_PCB_H_ | |
| 38 | ||
| 39 | #include <sys/endian.h> | |
| 40 | ||
| 41 | #include <machine/setjmp.h> | |
| 42 | ||
| 43 | #ifndef _STANDALONE | |
| 44 | struct pcb { | |
| 45 | 	register_t	pcb_context[20];	/* non-volatile r12-r31 */ | |
| 46 | 	register_t	pcb_cr;			/* Condition register */ | |
| 47 | 	register_t	pcb_sp;			/* stack pointer */ | |
| 48 | 	register_t	pcb_toc;		/* toc pointer */ | |
| 49 | 	register_t	pcb_lr;			/* link register */ | |
| 50 | 	register_t	pcb_dscr;		/* dscr value */ | |
| 51 | 	register_t	pcb_fscr; | |
| 52 | 	register_t	pcb_tar; | |
| 53 | 	struct		pmap *pcb_pm;		/* pmap of our vmspace */ | |
| 54 | 	jmp_buf		*pcb_onfault;		/* For use during | |
| 55 | 						 copyin/copyout */ | |
| 56 | 	int		pcb_flags; | |
| 57 | #define	PCB_FPU		0x1	/* Process uses FPU */ | |
| 58 | #define	PCB_FPREGS	0x2	/* Process had FPU registers initialized */ | |
| 59 | #define	PCB_VEC		0x4	/* Process uses Altivec */ | |
| 60 | #define	PCB_VSX		0x8	/* Process had VSX initialized */ | |
| 61 | #define	PCB_CDSCR	0x10	/* Process had Custom DSCR initialized */ | |
| 62 | #define	PCB_HTM		0x20	/* Process had HTM initialized */ | |
| 63 | #define	PCB_CFSCR	0x40	/* Process had FSCR updated */ | |
| 64 | #define	PCB_KERN_FPU 0x80	/* Kernel is using FPU/Vector unit */ | |
| 65 | #define	PCB_KERN_FPU_NOSAVE 0x100 /* FPU/Vec state not saved for kernel use */ | |
| 66 | #define	PCB_VECREGS 0x200	/* Process had Altivec registers initialized */ | |
| 67 | 	struct fpu { | |
| 68 | 		union { | |
| 69 | 			uint32_t vsr[4]; | |
| 70 | 			double fpr; | |
| 71 | 		} fpr[32]; | |
| 72 | 		double	fpscr;	/* FPSCR stored as double for easier access */ | |
| 73 | 	} pcb_fpu;		/* Floating point processor */ | |
| 74 | 	unsigned int	pcb_fpcpu;		/* which CPU had our FPU | |
| 75 | 							stuff. */ | |
| 76 | 	struct vec { | |
| 77 | 		uint32_t vr[32][4]; | |
| 78 | 		uint32_t spare[2]; | |
| 79 | 		uint32_t vrsave; | |
| 80 | 		uint32_t vscr;	/* aligned at vector element 3 */ | |
| 81 | 	} pcb_vec __aligned(16);	/* Vector processor */ | |
| 82 | 	unsigned int	pcb_veccpu;		/* which CPU had our vector | |
| 83 | 							stuff. */ | |
| 84 | 	struct htm { | |
| 85 | 		uint64_t tfhar; | |
| 86 | 		uint64_t texasr; | |
| 87 | 		uint64_t tfiar; | |
| 88 | 	} pcb_htm; | |
| 89 | ||
| 90 | 	struct ebb { | |
| 91 | 		uint64_t ebbhr; | |
| 92 | 		uint64_t ebbrr; | |
| 93 | 		uint64_t bescr; | |
| 94 | 	} pcb_ebb; | |
| 95 | ||
| 96 | 	struct lmon { | |
| 97 | 		uint64_t lmrr; | |
| 98 | 		uint64_t lmser; | |
| 99 | 	} pcb_lm; | |
| 100 | ||
| 101 | 	union { | |
| 102 | 		struct { | |
| 103 | 			vm_offset_t	usr_segm;	/* Base address */ | |
| 104 | 			register_t	usr_vsid;	/* USER_SR segment */ | |
| 105 | 		} aim; | |
| 106 | 		struct { | |
| 107 | 			register_t	dbcr0; | |
| 108 | 		} booke; | |
| 109 | 	} pcb_cpu; | |
| 110 | 	vm_offset_t pcb_lastill;	/* Last illegal instruction */ | |
| 111 | }; | |
| 112 | #endif | |
| 113 | ||
| 114 | #ifdef	_KERNEL | |
| 115 | ||
| 116 | struct trapframe; | |
| 117 | ||
| 118 | #ifndef curpcb | |
| 119 | extern struct pcb *curpcb; | |
| 120 | #endif | |
| 121 | ||
| 122 | extern struct pmap *curpm; | |
| 123 | extern struct proc *fpuproc; | |
| 124 | ||
| 125 | void	makectx(struct trapframe *, struct pcb *); | |
| 126 | void	savectx(struct pcb *) __returns_twice; | |
| 127 | ||
| 128 | #endif | |
| 129 | #endif	/* _MACHINE_PCB_H_ */ | |
| \ No newline at end of file |
lib/libc/include/powerpc64-freebsd-none/machine/pcpu.h created+174| ... | ... | @@ -0,0 +1,174 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-2-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 1999 Luoqi Chen <luoqi@freebsd.org> | |
| 5 | * Copyright (c) Peter Wemm <peter@netplex.com.au> | |
| 6 | * All rights reserved. | |
| 7 | * | |
| 8 | * Redistribution and use in source and binary forms, with or without | |
| 9 | * modification, are permitted provided that the following conditions | |
| 10 | * are met: | |
| 11 | * 1. Redistributions of source code must retain the above copyright | |
| 12 | * notice, this list of conditions and the following disclaimer. | |
| 13 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 14 | * notice, this list of conditions and the following disclaimer in the | |
| 15 | * documentation and/or other materials provided with the distribution. | |
| 16 | * | |
| 17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |
| 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 19 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
| 20 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | |
| 21 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
| 22 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
| 23 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
| 24 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
| 25 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
| 26 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
| 27 | * SUCH DAMAGE. | |
| 28 | */ | |
| 29 | ||
| 30 | #ifndef	_MACHINE_PCPU_H_ | |
| 31 | #define	_MACHINE_PCPU_H_ | |
| 32 | ||
| 33 | #include <machine/cpufunc.h> | |
| 34 | #include <machine/slb.h> | |
| 35 | #include <machine/tlb.h> | |
| 36 | ||
| 37 | struct pmap; | |
| 38 | struct pvo_entry; | |
| 39 | #define	CPUSAVE_LEN	9 | |
| 40 | ||
| 41 | #define	PCPU_MD_COMMON_FIELDS						\ | |
| 42 | 	int		pc_inside_intr;					\ | |
| 43 | 	struct pmap	*pc_curpmap;		/* current pmap */	\ | |
| 44 | 	struct thread	*pc_fputhread;		/* current fpu user */ \ | |
| 45 | 	struct thread	*pc_vecthread;		/* current vec user */ \ | |
| 46 | 	struct thread	*pc_htmthread;		/* current htm user */ \ | |
| 47 | 	uintptr_t	pc_hwref;					\ | |
| 48 | 	int		pc_bsp;						\ | |
| 49 | 	volatile int	pc_awake;					\ | |
| 50 | 	uint32_t	pc_ipimask;					\ | |
| 51 | 	uint32_t	pc_flags;		/* cpu feature flags */ \ | |
| 52 | 	register_t	pc_tempsave[CPUSAVE_LEN];			\ | |
| 53 | 	register_t	pc_disisave[CPUSAVE_LEN];			\ | |
| 54 | 	register_t	pc_dbsave[CPUSAVE_LEN];				\ | |
| 55 | 	void		*pc_restore;					\ | |
| 56 | 	vm_offset_t	pc_qmap_addr; | |
| 57 | ||
| 58 | #define PCPU_MD_AIM32_FIELDS						\ | |
| 59 | 	struct pvo_entry *qmap_pvo;					\ | |
| 60 | 	struct mtx	qmap_lock;					\ | |
| 61 | 	char		__pad[128]; | |
| 62 | ||
| 63 | #define PCPU_MD_AIM64_FIELDS						\ | |
| 64 | 	struct slb	slb[64];					\ | |
| 65 | 	struct slb	**userslb;					\ | |
| 66 | 	register_t	slbsave[18];					\ | |
| 67 | 	uint8_t		slbstack[1024];				\ | |
| 68 | 	struct pvo_entry *qmap_pvo;					\ | |
| 69 | 	struct mtx	qmap_lock;					\ | |
| 70 | 	uint64_t	opal_hmi_flags;					\ | |
| 71 | 	char		__pad[1337]; | |
| 72 | ||
| 73 | #ifdef __powerpc64__ | |
| 74 | #define PCPU_MD_AIM_FIELDS	PCPU_MD_AIM64_FIELDS | |
| 75 | #else | |
| 76 | #define PCPU_MD_AIM_FIELDS	PCPU_MD_AIM32_FIELDS | |
| 77 | #endif | |
| 78 | ||
| 79 | /* CPU feature flags, can be used for cached flow control. */ | |
| 80 | #define	PC_FLAG_NOSRS		0x80000000 | |
| 81 | ||
| 82 | #define	BOOKE_CRITSAVE_LEN	(CPUSAVE_LEN + 2) | |
| 83 | #define	BOOKE_TLB_MAXNEST	4 | |
| 84 | #define	BOOKE_TLB_SAVELEN	16 | |
| 85 | #define	BOOKE_TLBSAVE_LEN	(BOOKE_TLB_SAVELEN * BOOKE_TLB_MAXNEST) | |
| 86 | ||
| 87 | #ifdef __powerpc64__ | |
| 88 | #define	BOOKE_PCPU_PAD	901 | |
| 89 | #else | |
| 90 | #define	BOOKE_PCPU_PAD	365 | |
| 91 | #endif | |
| 92 | #define PCPU_MD_BOOKE_FIELDS						\ | |
| 93 | 	register_t	critsave[BOOKE_CRITSAVE_LEN];		\ | |
| 94 | 	register_t	mchksave[CPUSAVE_LEN];			\ | |
| 95 | 	register_t	tlbsave[BOOKE_TLBSAVE_LEN];		\ | |
| 96 | 	register_t	tlb_level;				\ | |
| 97 | 	uintptr_t	*tlb_lock;				\ | |
| 98 | 	int		tid_next;					\ | |
| 99 | 	char		__pad[BOOKE_PCPU_PAD]; | |
| 100 | ||
| 101 | /* Definitions for register offsets within the exception tmp save areas */ | |
| 102 | #define	CPUSAVE_R27	0		/* where r27 gets saved */ | |
| 103 | #define	CPUSAVE_R28	1		/* where r28 gets saved */ | |
| 104 | #define	CPUSAVE_R29	2		/* where r29 gets saved */ | |
| 105 | #define	CPUSAVE_R30	3		/* where r30 gets saved */ | |
| 106 | #define	CPUSAVE_R31	4		/* where r31 gets saved */ | |
| 107 | #define	CPUSAVE_AIM_DAR		5	/* where SPR_DAR gets saved */ | |
| 108 | #define	CPUSAVE_AIM_DSISR	6	/* where SPR_DSISR gets saved */ | |
| 109 | #define	CPUSAVE_BOOKE_DEAR	5	/* where SPR_DEAR gets saved */ | |
| 110 | #define	CPUSAVE_BOOKE_ESR	6	/* where SPR_ESR gets saved */ | |
| 111 | #define	CPUSAVE_SRR0	7		/* where SRR0 gets saved */ | |
| 112 | #define	CPUSAVE_SRR1	8		/* where SRR1 gets saved */ | |
| 113 | #define	BOOKE_CRITSAVE_SRR0	9	/* where real SRR0 gets saved (critical) */ | |
| 114 | #define	BOOKE_CRITSAVE_SRR1	10	/* where real SRR0 gets saved (critical) */ | |
| 115 | ||
| 116 | /* Book-E TLBSAVE is more elaborate */ | |
| 117 | #define TLBSAVE_BOOKE_LR	0 | |
| 118 | #define TLBSAVE_BOOKE_CR	1 | |
| 119 | #define TLBSAVE_BOOKE_SRR0	2 | |
| 120 | #define TLBSAVE_BOOKE_SRR1	3 | |
| 121 | #define TLBSAVE_BOOKE_R20	4 | |
| 122 | #define TLBSAVE_BOOKE_R21	5 | |
| 123 | #define TLBSAVE_BOOKE_R22	6 | |
| 124 | #define TLBSAVE_BOOKE_R23	7 | |
| 125 | #define TLBSAVE_BOOKE_R24	8 | |
| 126 | #define TLBSAVE_BOOKE_R25	9 | |
| 127 | #define TLBSAVE_BOOKE_R26	10 | |
| 128 | #define TLBSAVE_BOOKE_R27	11 | |
| 129 | #define TLBSAVE_BOOKE_R28	12 | |
| 130 | #define TLBSAVE_BOOKE_R29	13 | |
| 131 | #define TLBSAVE_BOOKE_R30	14 | |
| 132 | #define TLBSAVE_BOOKE_R31	15 | |
| 133 | ||
| 134 | #define	PCPU_MD_FIELDS		\ | |
| 135 | 	PCPU_MD_COMMON_FIELDS	\ | |
| 136 | 	union {			\ | |
| 137 | 	 struct {		\ | |
| 138 | 		PCPU_MD_AIM_FIELDS	\ | |
| 139 | 	 } pc_aim;		\ | |
| 140 | 	 struct {		\ | |
| 141 | 		PCPU_MD_BOOKE_FIELDS	\ | |
| 142 | 	 } pc_booke;		\ | |
| 143 | 	} | |
| 144 | ||
| 145 | #ifdef _KERNEL | |
| 146 | ||
| 147 | #define pcpup	(get_pcpu()) | |
| 148 | ||
| 149 | static __inline __pure2 struct thread * | |
| 150 | __curthread(void) | |
| 151 | { | |
| 152 | 	struct thread *td; | |
| 153 | #ifdef __powerpc64__ | |
| 154 | 	__asm __volatile("mr %0,13" : "=r"(td)); | |
| 155 | #else | |
| 156 | 	__asm __volatile("mr %0,2" : "=r"(td)); | |
| 157 | #endif | |
| 158 | 	return (td); | |
| 159 | } | |
| 160 | #define curthread (__curthread()) | |
| 161 | ||
| 162 | #define	PCPU_GET(member)	(pcpup->pc_ ## member) | |
| 163 | ||
| 164 | /* | |
| 165 | * XXX The implementation of this operation should be made atomic | |
| 166 | * with respect to preemption. | |
| 167 | */ | |
| 168 | #define	PCPU_ADD(member, value)	(pcpup->pc_ ## member += (value)) | |
| 169 | #define	PCPU_PTR(member)	(&pcpup->pc_ ## member) | |
| 170 | #define	PCPU_SET(member,value)	(pcpup->pc_ ## member = (value)) | |
| 171 | ||
| 172 | #endif	/* _KERNEL */ | |
| 173 | ||
| 174 | #endif	/* !_MACHINE_PCPU_H_ */ | |
| \ No newline at end of file |
lib/libc/include/powerpc64-freebsd-none/machine/pio.h created+304| ... | ... | @@ -0,0 +1,304 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-4-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 1997 Per Fogelstrom, Opsycon AB and RTMX Inc, USA. | |
| 5 | * | |
| 6 | * Redistribution and use in source and binary forms, with or without | |
| 7 | * modification, are permitted provided that the following conditions | |
| 8 | * are met: | |
| 9 | * 1. Redistributions of source code must retain the above copyright | |
| 10 | * notice, this list of conditions and the following disclaimer. | |
| 11 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 12 | * notice, this list of conditions and the following disclaimer in the | |
| 13 | * documentation and/or other materials provided with the distribution. | |
| 14 | * 3. All advertising materials mentioning features or use of this software | |
| 15 | * must display the following acknowledgement: | |
| 16 | *	This product includes software developed under OpenBSD by | |
| 17 | *	Per Fogelstrom Opsycon AB for RTMX Inc, North Carolina, USA. | |
| 18 | * 4. The name of the author may not be used to endorse or promote products | |
| 19 | * derived from this software without specific prior written permission. | |
| 20 | * | |
| 21 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS | |
| 22 | * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | |
| 23 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
| 24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY | |
| 25 | * 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 | *	$NetBSD: pio.h,v 1.1 1998/05/15 10:15:54 tsubai Exp $ | |
| 34 | *	$OpenBSD: pio.h,v 1.1 1997/10/13 10:53:47 pefo Exp $ | |
| 35 | */ | |
| 36 | ||
| 37 | #ifndef _MACHINE_PIO_H_ | |
| 38 | #define	_MACHINE_PIO_H_ | |
| 39 | /* | |
| 40 | * I/O macros. | |
| 41 | */ | |
| 42 | ||
| 43 | /* | |
| 44 | * Use sync so that bus space operations cannot sneak out the bottom of | |
| 45 | * mutex-protected sections (mutex release does not guarantee completion of | |
| 46 | * accesses to caching-inhibited memory on some systems) | |
| 47 | */ | |
| 48 | #define powerpc_iomb() __asm __volatile("sync" : : : "memory") | |
| 49 | ||
| 50 | static __inline void | |
| 51 | __outb(volatile u_int8_t *a, u_int8_t v) | |
| 52 | { | |
| 53 | 	*a = v; | |
| 54 | 	powerpc_iomb(); | |
| 55 | } | |
| 56 | ||
| 57 | static __inline void | |
| 58 | __outw(volatile u_int16_t *a, u_int16_t v) | |
| 59 | { | |
| 60 | 	*a = v; | |
| 61 | 	powerpc_iomb(); | |
| 62 | } | |
| 63 | ||
| 64 | static __inline void | |
| 65 | __outl(volatile u_int32_t *a, u_int32_t v) | |
| 66 | { | |
| 67 | 	*a = v; | |
| 68 | 	powerpc_iomb(); | |
| 69 | } | |
| 70 | ||
| 71 | static __inline void | |
| 72 | __outll(volatile u_int64_t *a, u_int64_t v) | |
| 73 | { | |
| 74 | 	*a = v; | |
| 75 | 	powerpc_iomb(); | |
| 76 | } | |
| 77 | ||
| 78 | static __inline void | |
| 79 | __outwrb(volatile u_int16_t *a, u_int16_t v) | |
| 80 | { | |
| 81 | 	__asm__ volatile("sthbrx %0, 0, %1" :: "r"(v), "r"(a)); | |
| 82 | 	powerpc_iomb(); | |
| 83 | } | |
| 84 | ||
| 85 | static __inline void | |
| 86 | __outlrb(volatile u_int32_t *a, u_int32_t v) | |
| 87 | { | |
| 88 | 	__asm__ volatile("stwbrx %0, 0, %1" :: "r"(v), "r"(a)); | |
| 89 | 	powerpc_iomb(); | |
| 90 | } | |
| 91 | ||
| 92 | static __inline u_int8_t | |
| 93 | __inb(volatile u_int8_t *a) | |
| 94 | { | |
| 95 | 	u_int8_t _v_; | |
| 96 | ||
| 97 | 	_v_ = *a; | |
| 98 | 	powerpc_iomb(); | |
| 99 | 	return _v_; | |
| 100 | } | |
| 101 | ||
| 102 | static __inline u_int16_t | |
| 103 | __inw(volatile u_int16_t *a) | |
| 104 | { | |
| 105 | 	u_int16_t _v_; | |
| 106 | ||
| 107 | 	_v_ = *a; | |
| 108 | 	powerpc_iomb(); | |
| 109 | 	return _v_; | |
| 110 | } | |
| 111 | ||
| 112 | static __inline u_int32_t | |
| 113 | __inl(volatile u_int32_t *a) | |
| 114 | { | |
| 115 | 	u_int32_t _v_; | |
| 116 | ||
| 117 | 	_v_ = *a; | |
| 118 | 	powerpc_iomb(); | |
| 119 | 	return _v_; | |
| 120 | } | |
| 121 | ||
| 122 | static __inline u_int64_t | |
| 123 | __inll(volatile u_int64_t *a) | |
| 124 | { | |
| 125 | 	u_int64_t _v_; | |
| 126 | ||
| 127 | 	_v_ = *a; | |
| 128 | 	powerpc_iomb(); | |
| 129 | 	return _v_; | |
| 130 | } | |
| 131 | ||
| 132 | static __inline u_int16_t | |
| 133 | __inwrb(volatile u_int16_t *a) | |
| 134 | { | |
| 135 | 	u_int16_t _v_; | |
| 136 | ||
| 137 | 	__asm__ volatile("lhbrx %0, 0, %1" : "=r"(_v_) : "r"(a)); | |
| 138 | 	powerpc_iomb(); | |
| 139 | 	return _v_; | |
| 140 | } | |
| 141 | ||
| 142 | static __inline u_int32_t | |
| 143 | __inlrb(volatile u_int32_t *a) | |
| 144 | { | |
| 145 | 	u_int32_t _v_; | |
| 146 | ||
| 147 | 	__asm__ volatile("lwbrx %0, 0, %1" : "=r"(_v_) : "r"(a)); | |
| 148 | 	powerpc_iomb(); | |
| 149 | 	return _v_; | |
| 150 | } | |
| 151 | ||
| 152 | #define	outb(a,v)	(__outb((volatile u_int8_t *)(a), v)) | |
| 153 | #define	out8(a,v)	outb(a,v) | |
| 154 | #define	outw(a,v)	(__outw((volatile u_int16_t *)(a), v)) | |
| 155 | #define	out16(a,v)	outw(a,v) | |
| 156 | #define	outl(a,v)	(__outl((volatile u_int32_t *)(a), v)) | |
| 157 | #define	out32(a,v)	outl(a,v) | |
| 158 | #define	outll(a,v)	(__outll((volatile u_int64_t *)(a), v)) | |
| 159 | #define	out64(a,v)	outll(a,v) | |
| 160 | #define	inb(a)		(__inb((volatile u_int8_t *)(a))) | |
| 161 | #define	in8(a)		inb(a) | |
| 162 | #define	inw(a)		(__inw((volatile u_int16_t *)(a))) | |
| 163 | #define	in16(a)		inw(a) | |
| 164 | #define	inl(a)		(__inl((volatile u_int32_t *)(a))) | |
| 165 | #define	in32(a)		inl(a) | |
| 166 | #define	inll(a)		(__inll((volatile u_int64_t *)(a))) | |
| 167 | #define	in64(a)		inll(a) | |
| 168 | ||
| 169 | #define	out8rb(a,v)	outb(a,v) | |
| 170 | #define	outwrb(a,v)	(__outwrb((volatile u_int16_t *)(a), v)) | |
| 171 | #define	out16rb(a,v)	outwrb(a,v) | |
| 172 | #define	outlrb(a,v)	(__outlrb((volatile u_int32_t *)(a), v)) | |
| 173 | #define	out32rb(a,v)	outlrb(a,v) | |
| 174 | #define	in8rb(a)	inb(a) | |
| 175 | #define	inwrb(a)	(__inwrb((volatile u_int16_t *)(a))) | |
| 176 | #define	in16rb(a)	inwrb(a) | |
| 177 | #define	inlrb(a)	(__inlrb((volatile u_int32_t *)(a))) | |
| 178 | #define	in32rb(a)	inlrb(a) | |
| 179 | ||
| 180 | static __inline void | |
| 181 | __outsb(volatile u_int8_t *a, const u_int8_t *s, size_t c) | |
| 182 | { | |
| 183 | 	while (c--) | |
| 184 | 		*a = *s++; | |
| 185 | 	powerpc_iomb(); | |
| 186 | } | |
| 187 | ||
| 188 | static __inline void | |
| 189 | __outsw(volatile u_int16_t *a, const u_int16_t *s, size_t c) | |
| 190 | { | |
| 191 | 	while (c--) | |
| 192 | 		*a = *s++; | |
| 193 | 	powerpc_iomb(); | |
| 194 | } | |
| 195 | ||
| 196 | static __inline void | |
| 197 | __outsl(volatile u_int32_t *a, const u_int32_t *s, size_t c) | |
| 198 | { | |
| 199 | 	while (c--) | |
| 200 | 		*a = *s++; | |
| 201 | 	powerpc_iomb(); | |
| 202 | } | |
| 203 | ||
| 204 | static __inline void | |
| 205 | __outsll(volatile u_int64_t *a, const u_int64_t *s, size_t c) | |
| 206 | { | |
| 207 | 	while (c--) | |
| 208 | 		*a = *s++; | |
| 209 | 	powerpc_iomb(); | |
| 210 | } | |
| 211 | ||
| 212 | static __inline void | |
| 213 | __outswrb(volatile u_int16_t *a, const u_int16_t *s, size_t c) | |
| 214 | { | |
| 215 | 	while (c--) | |
| 216 | 		__asm__ volatile("sthbrx %0, 0, %1" :: "r"(*s++), "r"(a)); | |
| 217 | 	powerpc_iomb(); | |
| 218 | } | |
| 219 | ||
| 220 | static __inline void | |
| 221 | __outslrb(volatile u_int32_t *a, const u_int32_t *s, size_t c) | |
| 222 | { | |
| 223 | 	while (c--) | |
| 224 | 		__asm__ volatile("stwbrx %0, 0, %1" :: "r"(*s++), "r"(a)); | |
| 225 | 	powerpc_iomb(); | |
| 226 | } | |
| 227 | ||
| 228 | static __inline void | |
| 229 | __insb(volatile u_int8_t *a, u_int8_t *d, size_t c) | |
| 230 | { | |
| 231 | 	while (c--) | |
| 232 | 		*d++ = *a; | |
| 233 | 	powerpc_iomb(); | |
| 234 | } | |
| 235 | ||
| 236 | static __inline void | |
| 237 | __insw(volatile u_int16_t *a, u_int16_t *d, size_t c) | |
| 238 | { | |
| 239 | 	while (c--) | |
| 240 | 		*d++ = *a; | |
| 241 | 	powerpc_iomb(); | |
| 242 | } | |
| 243 | ||
| 244 | static __inline void | |
| 245 | __insl(volatile u_int32_t *a, u_int32_t *d, size_t c) | |
| 246 | { | |
| 247 | 	while (c--) | |
| 248 | 		*d++ = *a; | |
| 249 | 	powerpc_iomb(); | |
| 250 | } | |
| 251 | ||
| 252 | static __inline void | |
| 253 | __insll(volatile u_int64_t *a, u_int64_t *d, size_t c) | |
| 254 | { | |
| 255 | 	while (c--) | |
| 256 | 		*d++ = *a; | |
| 257 | 	powerpc_iomb(); | |
| 258 | } | |
| 259 | ||
| 260 | static __inline void | |
| 261 | __inswrb(volatile u_int16_t *a, u_int16_t *d, size_t c) | |
| 262 | { | |
| 263 | 	while (c--) | |
| 264 | 		__asm__ volatile("lhbrx %0, 0, %1" : "=r"(*d++) : "r"(a)); | |
| 265 | 	powerpc_iomb(); | |
| 266 | } | |
| 267 | ||
| 268 | static __inline void | |
| 269 | __inslrb(volatile u_int32_t *a, u_int32_t *d, size_t c) | |
| 270 | { | |
| 271 | 	while (c--) | |
| 272 | 		__asm__ volatile("lwbrx %0, 0, %1" : "=r"(*d++) : "r"(a)); | |
| 273 | 	powerpc_iomb(); | |
| 274 | } | |
| 275 | ||
| 276 | #define	outsb(a,s,c)	(__outsb((volatile u_int8_t *)(a), s, c)) | |
| 277 | #define	outs8(a,s,c)	outsb(a,s,c) | |
| 278 | #define	outsw(a,s,c)	(__outsw((volatile u_int16_t *)(a), s, c)) | |
| 279 | #define	outs16(a,s,c)	outsw(a,s,c) | |
| 280 | #define	outsl(a,s,c)	(__outsl((volatile u_int32_t *)(a), s, c)) | |
| 281 | #define	outs32(a,s,c)	outsl(a,s,c) | |
| 282 | #define	outsll(a,s,c)	(__outsll((volatile u_int64_t *)(a), s, c)) | |
| 283 | #define	outs64(a,s,c)	outsll(a,s,c) | |
| 284 | #define	insb(a,d,c)	(__insb((volatile u_int8_t *)(a), d, c)) | |
| 285 | #define	ins8(a,d,c)	insb(a,d,c) | |
| 286 | #define	insw(a,d,c)	(__insw((volatile u_int16_t *)(a), d, c)) | |
| 287 | #define	ins16(a,d,c)	insw(a,d,c) | |
| 288 | #define	insl(a,d,c)	(__insl((volatile u_int32_t *)(a), d, c)) | |
| 289 | #define	ins32(a,d,c)	insl(a,d,c) | |
| 290 | #define	insll(a,d,c)	(__insll((volatile u_int64_t *)(a), d, c)) | |
| 291 | #define	ins64(a,d,c)	insll(a,d,c) | |
| 292 | ||
| 293 | #define	outs8rb(a,s,c)	outsb(a,s,c) | |
| 294 | #define	outswrb(a,s,c)	(__outswrb((volatile u_int16_t *)(a), s, c)) | |
| 295 | #define	outs16rb(a,s,c)	outswrb(a,s,c) | |
| 296 | #define	outslrb(a,s,c)	(__outslrb((volatile u_int32_t *)(a), s, c)) | |
| 297 | #define	outs32rb(a,s,c)	outslrb(a,s,c) | |
| 298 | #define	ins8rb(a,d,c)	insb(a,d,c) | |
| 299 | #define	inswrb(a,d,c)	(__inswrb((volatile u_int16_t *)(a), d, c)) | |
| 300 | #define	ins16rb(a,d,c)	inswrb(a,d,c) | |
| 301 | #define	inslrb(a,d,c)	(__inslrb((volatile u_int32_t *)(a), d, c)) | |
| 302 | #define	ins32rb(a,d,c)	inslrb(a,d,c) | |
| 303 | ||
| 304 | #endif /*_MACHINE_PIO_H_*/ | |
| \ No newline at end of file |
lib/libc/include/powerpc64-freebsd-none/machine/platform.h created+76| ... | ... | @@ -0,0 +1,76 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-4-Clause | |
| 3 | * | |
| 4 | * Copyright (C) 1996 Wolfgang Solfrank. | |
| 5 | * Copyright (C) 1996 TooLs GmbH. | |
| 6 | * All rights reserved. | |
| 7 | * | |
| 8 | * Redistribution and use in source and binary forms, with or without | |
| 9 | * modification, are permitted provided that the following conditions | |
| 10 | * are met: | |
| 11 | * 1. Redistributions of source code must retain the above copyright | |
| 12 | * notice, this list of conditions and the following disclaimer. | |
| 13 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 14 | * notice, this list of conditions and the following disclaimer in the | |
| 15 | * documentation and/or other materials provided with the distribution. | |
| 16 | * 3. All advertising materials mentioning features or use of this software | |
| 17 | * must display the following acknowledgement: | |
| 18 | *	This product includes software developed by TooLs GmbH. | |
| 19 | * 4. The name of TooLs GmbH may not be used to endorse or promote products | |
| 20 | * derived from this software without specific prior written permission. | |
| 21 | * | |
| 22 | * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR | |
| 23 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |
| 24 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | |
| 25 | * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
| 26 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | |
| 27 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; | |
| 28 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | |
| 29 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | |
| 30 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | |
| 31 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 32 | * | |
| 33 | *	$NetBSD: powerpc.h,v 1.3 2000/06/01 00:49:59 matt Exp $ | |
| 34 | */ | |
| 35 | ||
| 36 | #ifndef	_MACHINE_PLATFORM_H_ | |
| 37 | #define	_MACHINE_PLATFORM_H_ | |
| 38 | ||
| 39 | #include <machine/ofw_machdep.h> | |
| 40 | #include <machine/smp.h> | |
| 41 | #include <machine/pcpu.h> | |
| 42 | ||
| 43 | struct mem_region { | |
| 44 | 	uint64_t	mr_start; | |
| 45 | 	uint64_t	mr_size; | |
| 46 | }; | |
| 47 | ||
| 48 | struct numa_mem_region { | |
| 49 | 	uint64_t	mr_start; | |
| 50 | 	uint64_t	mr_size; | |
| 51 | 	uint64_t	mr_domain; | |
| 52 | }; | |
| 53 | ||
| 54 | /* Documentation for these functions is in platform_if.m */ | |
| 55 | ||
| 56 | void	mem_regions(struct mem_region **, int *, struct mem_region **, int *); | |
| 57 | void	numa_mem_regions(struct numa_mem_region **, int *); | |
| 58 | vm_offset_t platform_real_maxaddr(void); | |
| 59 | ||
| 60 | u_long	platform_timebase_freq(struct cpuref *); | |
| 61 | ||
| 62 | int	platform_smp_first_cpu(struct cpuref *); | |
| 63 | int	platform_smp_next_cpu(struct cpuref *); | |
| 64 | int	platform_smp_get_bsp(struct cpuref *); | |
| 65 | int	platform_smp_start_cpu(struct pcpu *); | |
| 66 | void	platform_smp_timebase_sync(u_long tb, int ap); | |
| 67 | void	platform_smp_ap_init(void); | |
| 68 | void	platform_smp_probe_threads(void); | |
| 69 | int	platform_node_numa_domain(phandle_t); | |
| 70 | ||
| 71 | const char *installed_platform(void); | |
| 72 | void platform_probe_and_attach(void); | |
| 73 | ||
| 74 | void platform_sleep(void); | |
| 75 | ||
| 76 | #endif	/* _MACHINE_PLATFORM_H_ */ | |
| \ No newline at end of file |
lib/libc/include/powerpc64-freebsd-none/machine/platformvar.h created+89| ... | ... | @@ -0,0 +1,89 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-2-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 2005 Peter Grehan | |
| 5 | * All rights reserved. | |
| 6 | * | |
| 7 | * Redistribution and use in source and binary forms, with or without | |
| 8 | * modification, are permitted provided that the following conditions | |
| 9 | * are met: | |
| 10 | * 1. Redistributions of source code must retain the above copyright | |
| 11 | * notice, this list of conditions and the following disclaimer. | |
| 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 13 | * notice, this list of conditions and the following disclaimer in the | |
| 14 | * documentation and/or other materials provided with the distribution. | |
| 15 | * | |
| 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |
| 17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
| 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | |
| 20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
| 21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
| 22 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
| 23 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
| 24 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
| 25 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
| 26 | * SUCH DAMAGE. | |
| 27 | */ | |
| 28 | ||
| 29 | #ifndef _MACHINE_PLATFORMVAR_H_ | |
| 30 | #define _MACHINE_PLATFORMVAR_H_ | |
| 31 | ||
| 32 | /* | |
| 33 | * A PowerPC platform implementation is declared with a kernel object and | |
| 34 | * an associated method table, similar to a device driver. | |
| 35 | * | |
| 36 | * e.g. | |
| 37 | * | |
| 38 | * static platform_method_t chrp_methods[] = { | |
| 39 | *	PLATFORMMETHOD(platform_probe,		chrp_probe), | |
| 40 | *	PLATFORMMETHOD(platform_mem_regions,	ofw_mem_regions), | |
| 41 | * ... | |
| 42 | *	PLATFORMMETHOD(platform_smp_first_cpu,	chrp_smp_first_cpu), | |
| 43 | *	{ 0, 0 } | |
| 44 | * }; | |
| 45 | * | |
| 46 | * static platform_def_t chrp_platform = { | |
| 47 | * 	"chrp", | |
| 48 | *	chrp_methods, | |
| 49 | *	sizeof(chrp_platform_softc),	// or 0 if no softc | |
| 50 | * }; | |
| 51 | * | |
| 52 | * PLATFORM_DEF(chrp_platform); | |
| 53 | */ | |
| 54 | ||
| 55 | #include <sys/kobj.h> | |
| 56 | ||
| 57 | struct platform_kobj { | |
| 58 | 	/* | |
| 59 | 	 * A platform instance is a kernel object | |
| 60 | 	 */ | |
| 61 | 	KOBJ_FIELDS; | |
| 62 | ||
| 63 | 	/* | |
| 64 | 	 * Utility elements that an instance may use | |
| 65 | 	 */ | |
| 66 | 	struct mtx	platform_mtx;	/* available for instance use */ | |
| 67 | 	void		*platform_iptr;	/* instance data pointer */ | |
| 68 | ||
| 69 | 	/* | |
| 70 | 	 * Opaque data that can be overlaid with an instance-private | |
| 71 | 	 * structure. Platform code can test that this is large enough at | |
| 72 | 	 * compile time with a sizeof() test againt it's softc. There | |
| 73 | 	 * is also a run-time test when the platform kernel object is | |
| 74 | 	 * registered. | |
| 75 | 	 */ | |
| 76 | #define PLATFORM_OPAQUESZ	64 | |
| 77 | 	u_int		platform_opaque[PLATFORM_OPAQUESZ]; | |
| 78 | }; | |
| 79 | ||
| 80 | typedef struct platform_kobj	*platform_t; | |
| 81 | typedef struct kobj_class	platform_def_t; | |
| 82 | #define platform_method_t	kobj_method_t | |
| 83 | ||
| 84 | #define PLATFORMMETHOD		KOBJMETHOD | |
| 85 | #define	PLATFORMMETHOD_END	KOBJMETHOD_END | |
| 86 | ||
| 87 | #define PLATFORM_DEF(name)	DATA_SET(platform_set, name) | |
| 88 | ||
| 89 | #endif /* _MACHINE_PLATFORMVAR_H_ */ | |
| \ No newline at end of file |
lib/libc/include/powerpc64-freebsd-none/machine/pmap.h created+361| ... | ... | @@ -0,0 +1,361 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-3-Clause AND BSD-4-Clause | |
| 3 | * | |
| 4 | * Copyright (C) 2006 Semihalf, Marian Balakowicz <m8@semihalf.com> | |
| 5 | * All rights reserved. | |
| 6 | * | |
| 7 | * Adapted for Freescale's e500 core CPUs. | |
| 8 | * | |
| 9 | * Redistribution and use in source and binary forms, with or without | |
| 10 | * modification, are permitted provided that the following conditions | |
| 11 | * are met: | |
| 12 | * 1. Redistributions of source code must retain the above copyright | |
| 13 | * notice, this list of conditions and the following disclaimer. | |
| 14 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 15 | * notice, this list of conditions and the following disclaimer in the | |
| 16 | * documentation and/or other materials provided with the distribution. | |
| 17 | * 3. The name of the author may not be used to endorse or promote products | |
| 18 | * derived from this software without specific prior written permission. | |
| 19 | * | |
| 20 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | |
| 21 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |
| 22 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN | |
| 23 | * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
| 24 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED | |
| 25 | * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | |
| 26 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF | |
| 27 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | |
| 28 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | |
| 29 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 30 | */ | |
| 31 | /*- | |
| 32 | * Copyright (C) 1995, 1996 Wolfgang Solfrank. | |
| 33 | * Copyright (C) 1995, 1996 TooLs GmbH. | |
| 34 | * All rights reserved. | |
| 35 | * | |
| 36 | * Redistribution and use in source and binary forms, with or without | |
| 37 | * modification, are permitted provided that the following conditions | |
| 38 | * are met: | |
| 39 | * 1. Redistributions of source code must retain the above copyright | |
| 40 | * notice, this list of conditions and the following disclaimer. | |
| 41 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 42 | * notice, this list of conditions and the following disclaimer in the | |
| 43 | * documentation and/or other materials provided with the distribution. | |
| 44 | * 3. All advertising materials mentioning features or use of this software | |
| 45 | * must display the following acknowledgement: | |
| 46 | *	This product includes software developed by TooLs GmbH. | |
| 47 | * 4. The name of TooLs GmbH may not be used to endorse or promote products | |
| 48 | * derived from this software without specific prior written permission. | |
| 49 | * | |
| 50 | * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR | |
| 51 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |
| 52 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | |
| 53 | * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
| 54 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | |
| 55 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; | |
| 56 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | |
| 57 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | |
| 58 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | |
| 59 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 60 | * | |
| 61 | *	from: $NetBSD: pmap.h,v 1.17 2000/03/30 16:18:24 jdolecek Exp $ | |
| 62 | */ | |
| 63 | ||
| 64 | #ifndef	_MACHINE_PMAP_H_ | |
| 65 | #define	_MACHINE_PMAP_H_ | |
| 66 | ||
| 67 | #include <sys/queue.h> | |
| 68 | #include <sys/tree.h> | |
| 69 | #include <sys/_cpuset.h> | |
| 70 | #include <sys/_lock.h> | |
| 71 | #include <sys/_mutex.h> | |
| 72 | #include <machine/sr.h> | |
| 73 | #include <machine/pte.h> | |
| 74 | #include <machine/slb.h> | |
| 75 | #include <machine/tlb.h> | |
| 76 | #include <machine/vmparam.h> | |
| 77 | #ifdef __powerpc64__ | |
| 78 | #include <vm/_vm_radix.h> | |
| 79 | #endif | |
| 80 | ||
| 81 | /* | |
| 82 | * The radix page table structure is described by levels 1-4. | |
| 83 | * See Fig 33. on p. 1002 of Power ISA v3.0B | |
| 84 | * | |
| 85 | * Page directories and tables must be size aligned. | |
| 86 | */ | |
| 87 | ||
| 88 | /* Root page directory - 64k -- each entry covers 512GB */ | |
| 89 | typedef uint64_t pml1_entry_t; | |
| 90 | /* l2 page directory - 4k -- each entry covers 1GB */ | |
| 91 | typedef uint64_t pml2_entry_t; | |
| 92 | /* l3 page directory - 4k -- each entry covers 2MB */ | |
| 93 | typedef uint64_t pml3_entry_t; | |
| 94 | /* l4 page directory - 256B/4k -- each entry covers 64k/4k */ | |
| 95 | typedef uint64_t pml4_entry_t; | |
| 96 | ||
| 97 | typedef uint64_t pt_entry_t; | |
| 98 | ||
| 99 | struct pmap; | |
| 100 | typedef struct pmap *pmap_t; | |
| 101 | ||
| 102 | #define	PMAP_ENTER_QUICK_LOCKED	0x10000000 | |
| 103 | ||
| 104 | #if !defined(NPMAPS) | |
| 105 | #define	NPMAPS		32768 | |
| 106 | #endif /* !defined(NPMAPS) */ | |
| 107 | ||
| 108 | struct	slbtnode; | |
| 109 | ||
| 110 | struct pvo_entry { | |
| 111 | 	LIST_ENTRY(pvo_entry) pvo_vlink;	/* Link to common virt page */ | |
| 112 | #ifndef __powerpc64__ | |
| 113 | 	LIST_ENTRY(pvo_entry) pvo_olink;	/* Link to overflow entry */ | |
| 114 | #endif | |
| 115 | 	union { | |
| 116 | 		RB_ENTRY(pvo_entry) pvo_plink;	/* Link to pmap entries */ | |
| 117 | 		SLIST_ENTRY(pvo_entry) pvo_dlink; /* Link to delete enty */ | |
| 118 | 	}; | |
| 119 | 	struct { | |
| 120 | #ifndef __powerpc64__ | |
| 121 | 		/* 32-bit fields */ | |
| 122 | 		pte_t	 pte; | |
| 123 | #endif | |
| 124 | 		/* 64-bit fields */ | |
| 125 | 		uintptr_t slot; | |
| 126 | 		vm_paddr_t pa; | |
| 127 | 		vm_prot_t prot; | |
| 128 | 	} pvo_pte; | |
| 129 | 	pmap_t		pvo_pmap;		/* Owning pmap */ | |
| 130 | 	vm_offset_t	pvo_vaddr;		/* VA of entry */ | |
| 131 | 	uint64_t	pvo_vpn;		/* Virtual page number */ | |
| 132 | }; | |
| 133 | LIST_HEAD(pvo_head, pvo_entry); | |
| 134 | SLIST_HEAD(pvo_dlist, pvo_entry); | |
| 135 | RB_HEAD(pvo_tree, pvo_entry); | |
| 136 | int pvo_vaddr_compare(struct pvo_entry *, struct pvo_entry *); | |
| 137 | RB_PROTOTYPE(pvo_tree, pvo_entry, pvo_plink, pvo_vaddr_compare); | |
| 138 | ||
| 139 | /* Used by 32-bit PMAP */ | |
| 140 | #define	PVO_PTEGIDX_MASK	0x007UL		/* which PTEG slot */ | |
| 141 | #define	PVO_PTEGIDX_VALID	0x008UL		/* slot is valid */ | |
| 142 | /* Used by 64-bit PMAP */ | |
| 143 | #define	PVO_HID			0x008UL		/* PVO entry in alternate hash*/ | |
| 144 | /* Used by both */ | |
| 145 | #define	PVO_WIRED		0x010UL		/* PVO entry is wired */ | |
| 146 | #define	PVO_MANAGED		0x020UL		/* PVO entry is managed */ | |
| 147 | #define	PVO_BOOTSTRAP		0x080UL		/* PVO entry allocated during | |
| 148 | 						 bootstrap */ | |
| 149 | #define	PVO_DEAD		0x100UL		/* waiting to be deleted */ | |
| 150 | #define	PVO_LARGE		0x200UL		/* large page */ | |
| 151 | #define	PVO_VADDR(pvo)		((pvo)->pvo_vaddr & ~ADDR_POFF) | |
| 152 | #define	PVO_PTEGIDX_GET(pvo)	((pvo)->pvo_vaddr & PVO_PTEGIDX_MASK) | |
| 153 | #define	PVO_PTEGIDX_ISSET(pvo)	((pvo)->pvo_vaddr & PVO_PTEGIDX_VALID) | |
| 154 | #define	PVO_PTEGIDX_CLR(pvo)	\ | |
| 155 | 	((void)((pvo)->pvo_vaddr &= ~(PVO_PTEGIDX_VALID|PVO_PTEGIDX_MASK))) | |
| 156 | #define	PVO_PTEGIDX_SET(pvo, i)	\ | |
| 157 | 	((void)((pvo)->pvo_vaddr |= (i)|PVO_PTEGIDX_VALID)) | |
| 158 | #define	PVO_VSID(pvo)		((pvo)->pvo_vpn >> 16) | |
| 159 | ||
| 160 | struct	pmap { | |
| 161 | 	struct		pmap_statistics	pm_stats; | |
| 162 | 	struct	mtx	pm_mtx; | |
| 163 | 	cpuset_t	pm_active; | |
| 164 | 	union { | |
| 165 | 		struct { | |
| 166 | 		 #ifdef __powerpc64__ | |
| 167 | 			struct slbtnode	*pm_slb_tree_root; | |
| 168 | 			struct slb	**pm_slb; | |
| 169 | 			int		pm_slb_len; | |
| 170 | 		 #else | |
| 171 | 			register_t	pm_sr[16]; | |
| 172 | 		 #endif | |
| 173 | ||
| 174 | 			struct pmap	*pmap_phys; | |
| 175 | 			struct pvo_tree pmap_pvo; | |
| 176 | 		}; | |
| 177 | #ifdef __powerpc64__ | |
| 178 | 		/* Radix support */ | |
| 179 | 		struct { | |
| 180 | 			pml1_entry_t	*pm_pml1;	/* KVA of root page directory */ | |
| 181 | 			struct vm_radix	 pm_radix;	/* spare page table pages */ | |
| 182 | 			TAILQ_HEAD(,pv_chunk)	pm_pvchunk;	/* list of mappings in pmap */ | |
| 183 | 			uint64_t	pm_pid; /* PIDR value */ | |
| 184 | 			int pm_flags; | |
| 185 | 		}; | |
| 186 | #endif | |
| 187 | 		struct { | |
| 188 | 			/* TID to identify this pmap entries in TLB */ | |
| 189 | 			tlbtid_t	pm_tid[MAXCPU]; | |
| 190 | ||
| 191 | #ifdef __powerpc64__ | |
| 192 | 			/* | |
| 193 | 			 * Page table directory, | |
| 194 | 			 * array of pointers to page directories. | |
| 195 | 			 */ | |
| 196 | 			pte_t ****pm_root; | |
| 197 | #else | |
| 198 | 			/* | |
| 199 | 			 * Page table directory, | |
| 200 | 			 * array of pointers to page tables. | |
| 201 | 			 */ | |
| 202 | 			pte_t		**pm_pdir; | |
| 203 | ||
| 204 | 			/* List of allocated ptbl bufs (ptbl kva regions). */ | |
| 205 | 			TAILQ_HEAD(, ptbl_buf)	pm_ptbl_list; | |
| 206 | #endif | |
| 207 | 		}; | |
| 208 | 	} __aligned(CACHE_LINE_SIZE); | |
| 209 | }; | |
| 210 | ||
| 211 | /* | |
| 212 | * pv_entries are allocated in chunks per-process. This avoids the | |
| 213 | * need to track per-pmap assignments. | |
| 214 | */ | |
| 215 | #define	_NPCPV	126 | |
| 216 | #define	_NPCM	howmany(_NPCPV, 64) | |
| 217 | ||
| 218 | #define	PV_CHUNK_HEADER							\ | |
| 219 | 	pmap_t			pc_pmap;				\ | |
| 220 | 	TAILQ_ENTRY(pv_chunk)	pc_list;				\ | |
| 221 | 	uint64_t		pc_map[_NPCM];	/* bitmap; 1 = free */	\ | |
| 222 | 	TAILQ_ENTRY(pv_chunk)	pc_lru; | |
| 223 | ||
| 224 | struct pv_entry { | |
| 225 | 	pmap_t pv_pmap; | |
| 226 | 	vm_offset_t pv_va; | |
| 227 | 	TAILQ_ENTRY(pv_entry) pv_link; | |
| 228 | }; | |
| 229 | typedef struct pv_entry *pv_entry_t; | |
| 230 | ||
| 231 | struct pv_chunk_header { | |
| 232 | 	PV_CHUNK_HEADER | |
| 233 | }; | |
| 234 | struct pv_chunk { | |
| 235 | 	PV_CHUNK_HEADER | |
| 236 | 	uint64_t	reserved; | |
| 237 | 	struct pv_entry		pc_pventry[_NPCPV]; | |
| 238 | }; | |
| 239 | ||
| 240 | struct	md_page { | |
| 241 | 	union { | |
| 242 | 		struct { | |
| 243 | 			volatile int32_t mdpg_attrs; | |
| 244 | 			vm_memattr_t	 mdpg_cache_attrs; | |
| 245 | 			struct	pvo_head mdpg_pvoh; | |
| 246 | 			int		pv_gen; /* (p) */ | |
| 247 | 		}; | |
| 248 | 		struct { | |
| 249 | 			int			pv_tracked; | |
| 250 | 		}; | |
| 251 | 	}; | |
| 252 | 	TAILQ_HEAD(, pv_entry)	pv_list; /* (p) */ | |
| 253 | }; | |
| 254 | ||
| 255 | #ifdef AIM | |
| 256 | #define	pmap_page_get_memattr(m)	((m)->md.mdpg_cache_attrs) | |
| 257 | #else | |
| 258 | #define	pmap_page_get_memattr(m)	VM_MEMATTR_DEFAULT | |
| 259 | #endif /* AIM */ | |
| 260 | ||
| 261 | /* | |
| 262 | * Return the VSID corresponding to a given virtual address. | |
| 263 | * If no VSID is currently defined, it will allocate one, and add | |
| 264 | * it to a free slot if available. | |
| 265 | * | |
| 266 | * NB: The PMAP MUST be locked already. | |
| 267 | */ | |
| 268 | uint64_t va_to_vsid(pmap_t pm, vm_offset_t va); | |
| 269 | ||
| 270 | /* Lock-free, non-allocating lookup routines */ | |
| 271 | uint64_t kernel_va_to_slbv(vm_offset_t va); | |
| 272 | struct slb *user_va_to_slb_entry(pmap_t pm, vm_offset_t va); | |
| 273 | ||
| 274 | uint64_t allocate_user_vsid(pmap_t pm, uint64_t esid, int large); | |
| 275 | void	free_vsid(pmap_t pm, uint64_t esid, int large); | |
| 276 | void	slb_insert_user(pmap_t pm, struct slb *slb); | |
| 277 | void	slb_insert_kernel(uint64_t slbe, uint64_t slbv); | |
| 278 | ||
| 279 | struct slbtnode *slb_alloc_tree(void); | |
| 280 | void slb_free_tree(pmap_t pm); | |
| 281 | struct slb **slb_alloc_user_cache(void); | |
| 282 | void	slb_free_user_cache(struct slb **); | |
| 283 | ||
| 284 | extern	struct pmap kernel_pmap_store; | |
| 285 | #define	kernel_pmap	(&kernel_pmap_store) | |
| 286 | ||
| 287 | #ifdef _KERNEL | |
| 288 | ||
| 289 | #define	PMAP_LOCK(pmap)		mtx_lock(&(pmap)->pm_mtx) | |
| 290 | #define	PMAP_LOCK_ASSERT(pmap, type) \ | |
| 291 | 				mtx_assert(&(pmap)->pm_mtx, (type)) | |
| 292 | #define	PMAP_LOCK_DESTROY(pmap)	mtx_destroy(&(pmap)->pm_mtx) | |
| 293 | #define	PMAP_LOCK_INIT(pmap)	mtx_init(&(pmap)->pm_mtx, \ | |
| 294 | 				 (pmap == kernel_pmap) ? "kernelpmap" : \ | |
| 295 | 				 "pmap", NULL, MTX_DEF | MTX_DUPOK) | |
| 296 | #define	PMAP_LOCKED(pmap)	mtx_owned(&(pmap)->pm_mtx) | |
| 297 | #define	PMAP_MTX(pmap)		(&(pmap)->pm_mtx) | |
| 298 | #define	PMAP_TRYLOCK(pmap)	mtx_trylock(&(pmap)->pm_mtx) | |
| 299 | #define	PMAP_UNLOCK(pmap)	mtx_unlock(&(pmap)->pm_mtx) | |
| 300 | ||
| 301 | #define	pmap_page_is_write_mapped(m)	(((m)->a.flags & PGA_WRITEABLE) != 0) | |
| 302 | ||
| 303 | #define	pmap_vm_page_alloc_check(m) | |
| 304 | ||
| 305 | void		pmap_bootstrap(vm_offset_t, vm_offset_t); | |
| 306 | void		pmap_kenter(vm_offset_t va, vm_paddr_t pa); | |
| 307 | void		pmap_kenter_attr(vm_offset_t va, vm_paddr_t pa, vm_memattr_t); | |
| 308 | void		pmap_kremove(vm_offset_t); | |
| 309 | void		*pmap_mapdev(vm_paddr_t, vm_size_t); | |
| 310 | void		*pmap_mapdev_attr(vm_paddr_t, vm_size_t, vm_memattr_t); | |
| 311 | void		pmap_unmapdev(void *, vm_size_t); | |
| 312 | void		pmap_page_set_memattr(vm_page_t, vm_memattr_t); | |
| 313 | int		pmap_change_attr(vm_offset_t, vm_size_t, vm_memattr_t); | |
| 314 | int		pmap_map_user_ptr(pmap_t pm, volatile const void *uaddr, | |
| 315 | 		 void **kaddr, size_t ulen, size_t *klen); | |
| 316 | int		pmap_decode_kernel_ptr(vm_offset_t addr, int *is_user, | |
| 317 | 		 vm_offset_t *decoded_addr); | |
| 318 | void		pmap_deactivate(struct thread *); | |
| 319 | vm_paddr_t	pmap_kextract(vm_offset_t); | |
| 320 | int		pmap_dev_direct_mapped(vm_paddr_t, vm_size_t); | |
| 321 | bool		pmap_mmu_install(char *name, int prio); | |
| 322 | void		pmap_mmu_init(void); | |
| 323 | const char	*pmap_mmu_name(void); | |
| 324 | bool		pmap_ps_enabled(pmap_t pmap); | |
| 325 | int		pmap_nofault(pmap_t pmap, vm_offset_t va, vm_prot_t flags); | |
| 326 | bool		pmap_page_is_mapped(vm_page_t m); | |
| 327 | #define	pmap_map_delete(pmap, sva, eva)	pmap_remove(pmap, sva, eva) | |
| 328 | ||
| 329 | void		pmap_page_array_startup(long count); | |
| 330 | ||
| 331 | #define	vtophys(va)	pmap_kextract((vm_offset_t)(va)) | |
| 332 | ||
| 333 | extern	vm_offset_t virtual_avail; | |
| 334 | extern	vm_offset_t virtual_end; | |
| 335 | extern	caddr_t crashdumpmap; | |
| 336 | ||
| 337 | extern	vm_offset_t msgbuf_phys; | |
| 338 | ||
| 339 | extern	int pmap_bootstrapped; | |
| 340 | extern	int radix_mmu; | |
| 341 | extern	int superpages_enabled; | |
| 342 | ||
| 343 | #ifdef AIM | |
| 344 | void pmap_early_io_map_init(void); | |
| 345 | #endif | |
| 346 | vm_offset_t pmap_early_io_map(vm_paddr_t pa, vm_size_t size); | |
| 347 | void pmap_early_io_unmap(vm_offset_t va, vm_size_t size); | |
| 348 | void pmap_track_page(pmap_t pmap, vm_offset_t va); | |
| 349 | void pmap_page_print_mappings(vm_page_t m); | |
| 350 | void pmap_tlbie_all(void); | |
| 351 | ||
| 352 | static inline int | |
| 353 | pmap_vmspace_copy(pmap_t dst_pmap __unused, pmap_t src_pmap __unused) | |
| 354 | { | |
| 355 | ||
| 356 | 	return (0); | |
| 357 | } | |
| 358 | ||
| 359 | #endif | |
| 360 | ||
| 361 | #endif /* !_MACHINE_PMAP_H_ */ | |
| \ No newline at end of file |
lib/libc/include/powerpc64-freebsd-none/machine/pmc_mdep.h created+95| ... | ... | @@ -0,0 +1,95 @@ |
| 1 | /*- | |
| 2 | * This file is in the public domain. | |
| 3 | */ | |
| 4 | ||
| 5 | #ifndef _MACHINE_PMC_MDEP_H_ | |
| 6 | #define	_MACHINE_PMC_MDEP_H_ | |
| 7 | ||
| 8 | #define PMC_MDEP_CLASS_INDEX_POWERPC	1 | |
| 9 | ||
| 10 | union pmc_md_op_pmcallocate { | |
| 11 | 	uint32_t		pm_event; | |
| 12 | 	uint64_t		__pad[4]; | |
| 13 | }; | |
| 14 | ||
| 15 | /* Logging */ | |
| 16 | #ifdef __powerpc64__ | |
| 17 | #define	PMCLOG_READADDR		PMCLOG_READ64 | |
| 18 | #define	PMCLOG_EMITADDR		PMCLOG_EMIT64 | |
| 19 | #else | |
| 20 | #define	PMCLOG_READADDR		PMCLOG_READ32 | |
| 21 | #define	PMCLOG_EMITADDR		PMCLOG_EMIT32 | |
| 22 | #endif | |
| 23 | ||
| 24 | #define	mtpmr(reg, val)							\ | |
| 25 | 	__asm __volatile("mtpmr %0,%1" : : "K"(reg), "r"(val)) | |
| 26 | #define	mfpmr(reg)							\ | |
| 27 | 	( { register_t val;						\ | |
| 28 | 	 __asm __volatile("mfpmr %0,%1" : "=r"(val) : "K"(reg));	\ | |
| 29 | 	 val; } ) | |
| 30 | ||
| 31 | #define	PMR_PMC0	16 | |
| 32 | #define	PMR_PMC1	17 | |
| 33 | #define	PMR_PMC2	18 | |
| 34 | #define	PMR_PMC3	19 | |
| 35 | #define	PMR_PMLCa0	144 | |
| 36 | #define	 PMLCax_FC	 0x80000000 | |
| 37 | #define	 PMLCax_FCS	 0x40000000 | |
| 38 | #define	 PMLCax_FCU	 0x20000000 | |
| 39 | #define	 PMLCax_FCM1	 0x10000000 | |
| 40 | #define	 PMLCax_FCM0	 0x08000000 | |
| 41 | #define	 PMLCax_CE	 0x04000000 | |
| 42 | #define	 PMLCax_EVENT(x) ((x) << 16) | |
| 43 | #define	 PMLCax_FCGS1	 0x00000002 | |
| 44 | #define	 PMLCax_FCGS0	 0x00000001 | |
| 45 | #define	PMR_PMLCa1	145 | |
| 46 | #define	PMR_PMLCa2	146 | |
| 47 | #define	PMR_PMLCa3	147 | |
| 48 | #define	PMR_PMLCb0	272 | |
| 49 | #define	 PMLCbx_TRIGONCTL(x)	 ((x) << 28) | |
| 50 | #define	 PMLCbx_TRIGOFFCTL(x)	 ((x) << 24) | |
| 51 | #define	 PMLCbx_PMCC		 0x00800000 | |
| 52 | #define	 PMLCbx_PMP(x)		 ((x) << 13) | |
| 53 | #define	 PMLCbx_TREHMUL(x)	 ((x) << 8) | |
| 54 | #define	 PMLCbx_TRESHOLD(x)	 ((x) << 0) | |
| 55 | #define	PMR_PMLCb1	273 | |
| 56 | #define	PMR_PMLCb2	274 | |
| 57 | #define	PMR_PMLCb3	275 | |
| 58 | #define	PMR_PMGC0	400 | |
| 59 | #define	 PMGC_FAC	 0x80000000 | |
| 60 | #define	 PMGC_PMIE	 0x40000000 | |
| 61 | #define	 PMGC_FCECE	 0x20000000 | |
| 62 | #define	 PMGC_TBSEL(x)	 ((x) << 11) | |
| 63 | #define	 PMGC_TBEE	 0x00000100 | |
| 64 | #define	PMR_UPMC0	0 | |
| 65 | #define	PMR_UPMC1	1 | |
| 66 | #define	PMR_UPMC2	2 | |
| 67 | #define	PMR_UPMC3	3 | |
| 68 | #define	PMR_UPMLCa0	128 | |
| 69 | #define	PMR_UPMLCa1	129 | |
| 70 | #define	PMR_UPMLCa2	130 | |
| 71 | #define	PMR_UPMLCa3	131 | |
| 72 | #define	PMR_UPMLCb0	256 | |
| 73 | #define	PMR_UPMLCb1	257 | |
| 74 | #define	PMR_UPMLCb2	258 | |
| 75 | #define	PMR_UPMLCb3	259 | |
| 76 | #define	PMR_UPMGC0	384 | |
| 77 | ||
| 78 | #if	_KERNEL | |
| 79 | ||
| 80 | struct pmc_md_powerpc_pmc { | |
| 81 | 	uint64_t	pm_powerpc_overflowcnt; | |
| 82 | 	uint32_t	pm_powerpc_evsel; | |
| 83 | }; | |
| 84 | ||
| 85 | union pmc_md_pmc { | |
| 86 | 	struct pmc_md_powerpc_pmc	pm_powerpc; | |
| 87 | }; | |
| 88 | ||
| 89 | #define	PMC_TRAPFRAME_TO_PC(TF)	((TF)->srr0) | |
| 90 | #define	PMC_TRAPFRAME_TO_FP(TF)	((TF)->fixreg[1]) | |
| 91 | #define	PMC_TRAPFRAME_TO_SP(TF)	(0) | |
| 92 | ||
| 93 | #endif | |
| 94 | ||
| 95 | #endif /* !_MACHINE_PMC_MDEP_H_ */ | |
| \ No newline at end of file |
lib/libc/include/powerpc64-freebsd-none/machine/proc.h created+61| ... | ... | @@ -0,0 +1,61 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-4-Clause | |
| 3 | * | |
| 4 | * Copyright (C) 1995, 1996 Wolfgang Solfrank. | |
| 5 | * Copyright (C) 1995, 1996 TooLs GmbH. | |
| 6 | * All rights reserved. | |
| 7 | * | |
| 8 | * Redistribution and use in source and binary forms, with or without | |
| 9 | * modification, are permitted provided that the following conditions | |
| 10 | * are met: | |
| 11 | * 1. Redistributions of source code must retain the above copyright | |
| 12 | * notice, this list of conditions and the following disclaimer. | |
| 13 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 14 | * notice, this list of conditions and the following disclaimer in the | |
| 15 | * documentation and/or other materials provided with the distribution. | |
| 16 | * 3. All advertising materials mentioning features or use of this software | |
| 17 | * must display the following acknowledgement: | |
| 18 | *	This product includes software developed by TooLs GmbH. | |
| 19 | * 4. The name of TooLs GmbH may not be used to endorse or promote products | |
| 20 | * derived from this software without specific prior written permission. | |
| 21 | * | |
| 22 | * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR | |
| 23 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |
| 24 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | |
| 25 | * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
| 26 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | |
| 27 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; | |
| 28 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | |
| 29 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | |
| 30 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | |
| 31 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 32 | * | |
| 33 | *	$NetBSD: proc.h,v 1.2 1997/04/16 22:57:48 thorpej Exp $ | |
| 34 | */ | |
| 35 | ||
| 36 | #ifndef _MACHINE_PROC_H_ | |
| 37 | #define	_MACHINE_PROC_H_ | |
| 38 | ||
| 39 | /* | |
| 40 | * Machine-dependent part of the proc structure | |
| 41 | */ | |
| 42 | struct mdthread { | |
| 43 | 	int	md_spinlock_count;	/* (k) */ | |
| 44 | 	register_t md_saved_msr;	/* (k) */ | |
| 45 | }; | |
| 46 | ||
| 47 | struct mdproc { | |
| 48 | 	/* | |
| 49 | 	 * Avoid empty structs because they are undefined behavior. | |
| 50 | 	 */ | |
| 51 | 	long	md_spare; | |
| 52 | }; | |
| 53 | ||
| 54 | #ifdef __powerpc64__ | |
| 55 | #define	KINFO_PROC_SIZE 1088 | |
| 56 | #define	KINFO_PROC32_SIZE 816 | |
| 57 | #else | |
| 58 | #define	KINFO_PROC_SIZE 816 | |
| 59 | #endif | |
| 60 | ||
| 61 | #endif /* !_MACHINE_PROC_H_ */ | |
| \ No newline at end of file |
lib/libc/include/powerpc64-freebsd-none/machine/profile.h created+234| ... | ... | @@ -0,0 +1,234 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: MIT-CMU | |
| 3 | * | |
| 4 | * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University. | |
| 5 | * All rights reserved. | |
| 6 | * | |
| 7 | * Author: Chris G. Demetriou | |
| 8 | * | |
| 9 | * Permission to use, copy, modify and distribute this software and | |
| 10 | * its documentation is hereby granted, provided that both the copyright | |
| 11 | * notice and this permission notice appear in all copies of the | |
| 12 | * software, derivative works or modified versions, and any portions | |
| 13 | * thereof, and that both notices appear in supporting documentation. | |
| 14 | * | |
| 15 | * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" | |
| 16 | * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND | |
| 17 | * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. | |
| 18 | * | |
| 19 | * Carnegie Mellon requests users of this software to return to | |
| 20 | * | |
| 21 | * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU | |
| 22 | * School of Computer Science | |
| 23 | * Carnegie Mellon University | |
| 24 | * Pittsburgh PA 15213-3890 | |
| 25 | * | |
| 26 | * any improvements or extensions that they make and grant Carnegie the | |
| 27 | * rights to redistribute these changes. | |
| 28 | * | |
| 29 | *	from: NetBSD: profile.h,v 1.9 1997/04/06 08:47:37 cgd Exp | |
| 30 | *	from: FreeBSD: src/sys/alpha/include/profile.h,v 1.4 1999/12/29 | |
| 31 | */ | |
| 32 | ||
| 33 | #ifndef _MACHINE_PROFILE_H_ | |
| 34 | #define	_MACHINE_PROFILE_H_ | |
| 35 | ||
| 36 | #define	_MCOUNT_DECL	void __mcount | |
| 37 | ||
| 38 | #define	FUNCTION_ALIGNMENT	4 | |
| 39 | ||
| 40 | typedef __ptrdiff_t	fptrdiff_t; | |
| 41 | ||
| 42 | /* | |
| 43 | * The mcount trampoline macro, expanded in libc/gmon/mcount.c | |
| 44 | * | |
| 45 | * For PowerPC SVR4 ABI profiling, the compiler will insert | |
| 46 | * a data declaration and code sequence at the start of a routine of the form | |
| 47 | * | |
| 48 | * .function_mc: 	.data | |
| 49 | *			.align	2 | |
| 50 | *			.long	0 | |
| 51 | *			.text | |
| 52 | * | |
| 53 | * function:		mflr	%r0 | |
| 54 | *			addis	%r11,%r0, .function_mc@ha | |
| 55 | *			stw	%r0,4(%r1) | |
| 56 | *			addi	%r0,%r11, .function_mc@l | |
| 57 | *			bl	_mcount | |
| 58 | * | |
| 59 | * The link register is saved in the LR save word in the caller's | |
| 60 | * stack frame, r0 is set up to point to the allocated longword, | |
| 61 | * and control is transferred to _mcount. | |
| 62 | * | |
| 63 | * On return from _mcount, the routine should function as it would | |
| 64 | * with no profiling so _mcount must restore register state to that upon | |
| 65 | * entry. Any routine called by the _mcount trampoline will save | |
| 66 | * callee-save registers, so _mcount must make sure it saves volatile | |
| 67 | * registers that may have state after it returns i.e. parameter registers. | |
| 68 | * | |
| 69 | * The FreeBSD libc mcount routine ignores the r0 longword pointer, but | |
| 70 | * instead requires as parameters the current PC and called PC. The current | |
| 71 | * PC is obtained from the link register, as a result of "bl _mcount" in | |
| 72 | * the stub, while the caller's PC is obtained from the LR save word. | |
| 73 | * | |
| 74 | * On return from libc mcount, the return is done indirectly with the | |
| 75 | * ctr register rather than the link register, to allow the link register | |
| 76 | * to be restored to what it was on entry to the profiled routine. | |
| 77 | */ | |
| 78 | ||
| 79 | #if defined(__powerpc64__) | |
| 80 | ||
| 81 | #if !defined(_CALL_ELF) || _CALL_ELF == 1 | |
| 82 | #define MCOUNT_PREAMBLE \ | |
| 83 | 	"	.align	2			\n" \ | |
| 84 | 	"	.globl	_mcount			\n" \ | |
| 85 | 	"	.section \".opd\",\"aw\"	\n" \ | |
| 86 | 	"	.align	3			\n" \ | |
| 87 | 	"_mcount:				\n" \ | |
| 88 | 	"	.quad .L._mcount,.TOC.@tocbase,0\n" \ | |
| 89 | 	"	.previous			\n" \ | |
| 90 | 	"	.size _mcount,24		\n" \ | |
| 91 | 	"	.type	_mcount,@function	\n" \ | |
| 92 | 	"	.align	4			\n" \ | |
| 93 | 	".L._mcount:				\n" | |
| 94 | #else | |
| 95 | #define MCOUNT_PREAMBLE \ | |
| 96 | 	"	.globl	_mcount			\n" \ | |
| 97 | 	"	.type	_mcount,@function	\n" \ | |
| 98 | 	"	.align	4			\n" \ | |
| 99 | 	"_mcount:				\n" | |
| 100 | #endif | |
| 101 | ||
| 102 | #define	MCOUNT					\ | |
| 103 | __asm(	MCOUNT_PREAMBLE \ | |
| 104 | 	"	stdu	%r1,-(288+128)(%r1)	\n" \ | |
| 105 | 	"	std	%r3,48(%r1)		\n" \ | |
| 106 | 	"	std	%r4,56(%r1)		\n" \ | |
| 107 | 	"	std	%r5,64(%r1)		\n" \ | |
| 108 | 	"	std	%r6,72(%r1)		\n" \ | |
| 109 | 	"	std	%r7,80(%r1)		\n" \ | |
| 110 | 	"	std	%r8,88(%r1)		\n" \ | |
| 111 | 	"	std	%r9,96(%r1)		\n" \ | |
| 112 | 	"	std	%r10,104(%r1)		\n" \ | |
| 113 | 	"	mflr	%r4			\n" \ | |
| 114 | 	"	std	%r4,112(%r1)		\n" \ | |
| 115 | 	"	ld	%r3,0(%r1)		\n" \ | |
| 116 | 	"	ld	%r3,0(%r3)		\n" \ | |
| 117 | 	"	ld	%r3,16(%r3)		\n" \ | |
| 118 | 	"	bl	__mcount		\n" \ | |
| 119 | 	"	nop				\n" \ | |
| 120 | 	"	ld	%r4,112(%r1)		\n" \ | |
| 121 | 	"	mtlr	%r4			\n" \ | |
| 122 | 	"	ld	%r3,48(%r1)		\n" \ | |
| 123 | 	"	ld	%r4,56(%r1)		\n" \ | |
| 124 | 	"	ld	%r5,64(%r1)		\n" \ | |
| 125 | 	"	ld	%r6,72(%r1)		\n" \ | |
| 126 | 	"	ld	%r7,80(%r1)		\n" \ | |
| 127 | 	"	ld	%r8,88(%r1)		\n" \ | |
| 128 | 	"	ld	%r9,96(%r1)		\n" \ | |
| 129 | 	"	ld	%r10,104(%r1)		\n" \ | |
| 130 | 	"	addi	%r1,%r1,(288+128)	\n" \ | |
| 131 | 	"	blr				\n"); | |
| 132 | #else | |
| 133 | ||
| 134 | #ifdef PIC | |
| 135 | #define _PLT "@plt" | |
| 136 | #else | |
| 137 | #define _PLT | |
| 138 | #endif | |
| 139 | ||
| 140 | #define	MCOUNT					\ | |
| 141 | __asm(	"	.globl	_mcount			\n" \ | |
| 142 | 	"	.type	_mcount,@function	\n" \ | |
| 143 | 	"	.align	4			\n" \ | |
| 144 | 	"_mcount:				\n" \ | |
| 145 | 	"	stwu	%r1,-64(%r1)		\n" \ | |
| 146 | 	"	stw	%r3,16(%r1)		\n" \ | |
| 147 | 	"	stw	%r4,20(%r1)		\n" \ | |
| 148 | 	"	stw	%r5,24(%r1)		\n" \ | |
| 149 | 	"	stw	%r6,28(%r1)		\n" \ | |
| 150 | 	"	stw	%r7,32(%r1)		\n" \ | |
| 151 | 	"	stw	%r8,36(%r1)		\n" \ | |
| 152 | 	"	stw	%r9,40(%r1)		\n" \ | |
| 153 | 	"	stw	%r10,44(%r1)		\n" \ | |
| 154 | 	"	mflr	%r4			\n" \ | |
| 155 | 	"	stw	%r4,48(%r1)		\n" \ | |
| 156 | 	"	lwz	%r3,68(%r1)		\n" \ | |
| 157 | 	"	bl	__mcount" _PLT "	\n" \ | |
| 158 | 	"	lwz	%r3,68(%r1)		\n" \ | |
| 159 | 	"	mtlr	%r3			\n" \ | |
| 160 | 	"	lwz	%r4,48(%r1)		\n" \ | |
| 161 | 	"	mtctr	%r4			\n" \ | |
| 162 | 	"	lwz	%r3,16(%r1)		\n" \ | |
| 163 | 	"	lwz	%r4,20(%r1)		\n" \ | |
| 164 | 	"	lwz	%r5,24(%r1)		\n" \ | |
| 165 | 	"	lwz	%r6,28(%r1)		\n" \ | |
| 166 | 	"	lwz	%r7,32(%r1)		\n" \ | |
| 167 | 	"	lwz	%r8,36(%r1)		\n" \ | |
| 168 | 	"	lwz	%r9,40(%r1)		\n" \ | |
| 169 | 	"	lwz	%r10,44(%r1)		\n" \ | |
| 170 | 	"	addi	%r1,%r1,64		\n" \ | |
| 171 | 	"	bctr				\n" \ | |
| 172 | 	"_mcount_end:				\n" \ | |
| 173 | 	"	.size	_mcount,_mcount_end-_mcount"); | |
| 174 | #endif | |
| 175 | ||
| 176 | #ifdef _KERNEL | |
| 177 | #define	MCOUNT_ENTER(s)		s = intr_disable() | |
| 178 | #define	MCOUNT_EXIT(s)		intr_restore(s) | |
| 179 | #define	MCOUNT_DECL(s)		register_t s; | |
| 180 | ||
| 181 | #ifndef COMPILING_LINT | |
| 182 | #ifdef AIM | |
| 183 | #include <machine/trap.h> | |
| 184 | #define	__PROFILE_VECTOR_BASE	EXC_RST | |
| 185 | #define	__PROFILE_VECTOR_TOP	(EXC_LAST + 0x100) | |
| 186 | #endif	/* AIM */ | |
| 187 | #if defined(BOOKE) | |
| 188 | extern char interrupt_vector_base[]; | |
| 189 | extern char interrupt_vector_top[]; | |
| 190 | #define	__PROFILE_VECTOR_BASE	(uintfptr_t)interrupt_vector_base | |
| 191 | #define	__PROFILE_VECTOR_TOP	(uintfptr_t)interrupt_vector_top | |
| 192 | #endif	/* BOOKE_E500 */ | |
| 193 | ||
| 194 | #endif	/* !COMPILING_LINT */ | |
| 195 | ||
| 196 | #ifndef __PROFILE_VECTOR_BASE | |
| 197 | #define	__PROFILE_VECTOR_BASE	0 | |
| 198 | #endif | |
| 199 | #ifndef __PROFILE_VECTOR_TOP | |
| 200 | #define	__PROFILE_VECTOR_TOP	1 | |
| 201 | #endif | |
| 202 | ||
| 203 | static __inline void | |
| 204 | powerpc_profile_interrupt(void) | |
| 205 | { | |
| 206 | } | |
| 207 | ||
| 208 | static __inline void | |
| 209 | powerpc_profile_userspace(void) | |
| 210 | { | |
| 211 | } | |
| 212 | ||
| 213 | #define	MCOUNT_FROMPC_USER(pc)				\ | |
| 214 | 	((pc < (uintfptr_t)VM_MAXUSER_ADDRESS) ?	\ | |
| 215 | 	 (uintfptr_t)powerpc_profile_userspace : pc) | |
| 216 | ||
| 217 | #define	MCOUNT_FROMPC_INTR(pc)				\ | |
| 218 | 	((pc >= __PROFILE_VECTOR_BASE &&		\ | |
| 219 | 	 pc < __PROFILE_VECTOR_TOP) ?			\ | |
| 220 | 	 (uintfptr_t)powerpc_profile_interrupt : ~0U) | |
| 221 | ||
| 222 | void __mcount(uintfptr_t frompc, uintfptr_t selfpc); | |
| 223 | ||
| 224 | #else	/* !_KERNEL */ | |
| 225 | ||
| 226 | #ifdef __powerpc64__ | |
| 227 | typedef u_long	uintfptr_t; | |
| 228 | #else | |
| 229 | typedef u_int	uintfptr_t; | |
| 230 | #endif | |
| 231 | ||
| 232 | #endif	/* _KERNEL */ | |
| 233 | ||
| 234 | #endif /* !_MACHINE_PROFILE_H_ */ | |
| \ No newline at end of file |
lib/libc/include/powerpc64-freebsd-none/machine/psl.h created+101| ... | ... | @@ -0,0 +1,101 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-4-Clause | |
| 3 | * | |
| 4 | * Copyright (C) 1995, 1996 Wolfgang Solfrank. | |
| 5 | * Copyright (C) 1995, 1996 TooLs GmbH. | |
| 6 | * All rights reserved. | |
| 7 | * | |
| 8 | * Redistribution and use in source and binary forms, with or without | |
| 9 | * modification, are permitted provided that the following conditions | |
| 10 | * are met: | |
| 11 | * 1. Redistributions of source code must retain the above copyright | |
| 12 | * notice, this list of conditions and the following disclaimer. | |
| 13 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 14 | * notice, this list of conditions and the following disclaimer in the | |
| 15 | * documentation and/or other materials provided with the distribution. | |
| 16 | * 3. All advertising materials mentioning features or use of this software | |
| 17 | * must display the following acknowledgement: | |
| 18 | *	This product includes software developed by TooLs GmbH. | |
| 19 | * 4. The name of TooLs GmbH may not be used to endorse or promote products | |
| 20 | * derived from this software without specific prior written permission. | |
| 21 | * | |
| 22 | * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR | |
| 23 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |
| 24 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | |
| 25 | * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
| 26 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | |
| 27 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; | |
| 28 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | |
| 29 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | |
| 30 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | |
| 31 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 32 | * | |
| 33 | *	$NetBSD: psl.h,v 1.5 2000/11/19 19:52:37 matt Exp $ | |
| 34 | */ | |
| 35 | ||
| 36 | #ifndef	_MACHINE_PSL_H_ | |
| 37 | #define	_MACHINE_PSL_H_ | |
| 38 | ||
| 39 | /* | |
| 40 | * Machine State Register (MSR) - All cores | |
| 41 | */ | |
| 42 | #define	PSL_VEC		0x02000000UL	/* AltiVec/SPE vector unit available */ | |
| 43 | #define	PSL_VSX		0x00800000UL	/* Vector-Scalar unit available */ | |
| 44 | #define	PSL_EE		0x00008000UL	/* external interrupt enable */ | |
| 45 | #define	PSL_PR		0x00004000UL	/* privilege mode (1 == user) */ | |
| 46 | #define	PSL_FP		0x00002000UL	/* floating point enable */ | |
| 47 | #define	PSL_ME		0x00001000UL	/* machine check enable */ | |
| 48 | #define	PSL_FE0		0x00000800UL	/* floating point interrupt mode 0 */ | |
| 49 | #define	PSL_FE1		0x00000100UL	/* floating point interrupt mode 1 */ | |
| 50 | #define	PSL_PMM		0x00000004UL	/* performance monitor mark */ | |
| 51 | #define	PSL_RI		0x00000002UL	/* recoverable interrupt */ | |
| 52 | ||
| 53 | /* Machine State Register - Book-E cores */ | |
| 54 | #ifdef __powerpc64__ | |
| 55 | #define	PSL_CM		0x80000000UL	/* Computation Mode (64-bit) */ | |
| 56 | #endif | |
| 57 | ||
| 58 | #define PSL_GS		0x10000000UL	/* Guest state */ | |
| 59 | #define PSL_UCLE	0x04000000UL	/* User mode cache lock enable */ | |
| 60 | #define PSL_WE		0x00040000UL	/* Wait state enable */ | |
| 61 | #define PSL_CE		0x00020000UL	/* Critical interrupt enable */ | |
| 62 | #define PSL_UBLE	0x00000400UL	/* BTB lock enable - e500 only */ | |
| 63 | #define PSL_DWE		0x00000400UL	/* Debug Wait Enable - 440 only*/ | |
| 64 | #define PSL_DE		0x00000200UL	/* Debug interrupt enable */ | |
| 65 | #define PSL_IS		0x00000020UL	/* Instruction address space */ | |
| 66 | #define PSL_DS		0x00000010UL	/* Data address space */ | |
| 67 | ||
| 68 | /* Machine State Register (MSR) - AIM cores */ | |
| 69 | #ifdef __powerpc64__ | |
| 70 | #define PSL_SF		0x8000000000000000UL	/* 64-bit addressing */ | |
| 71 | #define PSL_HV		0x1000000000000000UL	/* hyper-privileged mode */ | |
| 72 | #endif | |
| 73 | ||
| 74 | #define	PSL_POW		0x00040000UL	/* power management */ | |
| 75 | #define	PSL_ILE		0x00010000UL	/* interrupt endian mode (1 == le) */ | |
| 76 | #define	PSL_SE		0x00000400UL	/* single-step trace enable */ | |
| 77 | #define	PSL_BE		0x00000200UL	/* branch trace enable */ | |
| 78 | #define	PSL_IP		0x00000040UL	/* interrupt prefix - 601 only */ | |
| 79 | #define	PSL_IR		0x00000020UL	/* instruction address relocation */ | |
| 80 | #define	PSL_DR		0x00000010UL	/* data address relocation */ | |
| 81 | #define	PSL_LE		0x00000001UL	/* endian mode (1 == le) */ | |
| 82 | ||
| 83 | /* | |
| 84 | * Floating-point exception modes: | |
| 85 | */ | |
| 86 | #define	PSL_FE_DIS	0		/* none */ | |
| 87 | #define	PSL_FE_NONREC	PSL_FE1		/* imprecise non-recoverable */ | |
| 88 | #define	PSL_FE_REC	PSL_FE0		/* imprecise recoverable */ | |
| 89 | #define	PSL_FE_PREC	(PSL_FE0 | PSL_FE1) /* precise */ | |
| 90 | #define	PSL_FE_DFLT	PSL_FE_PREC	/* default == precise */ | |
| 91 | ||
| 92 | #ifndef LOCORE | |
| 93 | extern register_t psl_kernset;		/* Default MSR values for kernel */ | |
| 94 | extern register_t psl_userset;		/* Default MSR values for userland */ | |
| 95 | #ifdef __powerpc64__ | |
| 96 | extern register_t psl_userset32;	/* Default user MSR values for 32-bit */ | |
| 97 | #endif | |
| 98 | extern register_t psl_userstatic;	/* Bits of SRR1 userland may not set */ | |
| 99 | #endif | |
| 100 | ||
| 101 | #endif	/* _MACHINE_PSL_H_ */ | |
| \ No newline at end of file |
lib/libc/include/powerpc64-freebsd-none/machine/pte.h created+432| ... | ... | @@ -0,0 +1,432 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-4-Clause | |
| 3 | * | |
| 4 | * Copyright (C) 1995, 1996 Wolfgang Solfrank. | |
| 5 | * Copyright (C) 1995, 1996 TooLs GmbH. | |
| 6 | * All rights reserved. | |
| 7 | * | |
| 8 | * Redistribution and use in source and binary forms, with or without | |
| 9 | * modification, are permitted provided that the following conditions | |
| 10 | * are met: | |
| 11 | * 1. Redistributions of source code must retain the above copyright | |
| 12 | * notice, this list of conditions and the following disclaimer. | |
| 13 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 14 | * notice, this list of conditions and the following disclaimer in the | |
| 15 | * documentation and/or other materials provided with the distribution. | |
| 16 | * 3. All advertising materials mentioning features or use of this software | |
| 17 | * must display the following acknowledgement: | |
| 18 | *	This product includes software developed by TooLs GmbH. | |
| 19 | * 4. The name of TooLs GmbH may not be used to endorse or promote products | |
| 20 | * derived from this software without specific prior written permission. | |
| 21 | * | |
| 22 | * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR | |
| 23 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |
| 24 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | |
| 25 | * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
| 26 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | |
| 27 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; | |
| 28 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | |
| 29 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | |
| 30 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | |
| 31 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 32 | * | |
| 33 | *	$NetBSD: pte.h,v 1.2 1998/08/31 14:43:40 tsubai Exp $ | |
| 34 | */ | |
| 35 | ||
| 36 | #ifndef	_MACHINE_PTE_H_ | |
| 37 | #define	_MACHINE_PTE_H_ | |
| 38 | ||
| 39 | #if defined(AIM) | |
| 40 | ||
| 41 | /* | |
| 42 | * Page Table Entries | |
| 43 | */ | |
| 44 | #ifndef	LOCORE | |
| 45 | ||
| 46 | /* 32-bit PTE */ | |
| 47 | struct pte { | |
| 48 | 	u_int32_t pte_hi; | |
| 49 | 	u_int32_t pte_lo; | |
| 50 | }; | |
| 51 | ||
| 52 | struct pteg { | |
| 53 | 	struct	pte pt[8]; | |
| 54 | }; | |
| 55 | ||
| 56 | /* 64-bit (long) PTE */ | |
| 57 | struct lpte { | |
| 58 | 	u_int64_t pte_hi; | |
| 59 | 	u_int64_t pte_lo; | |
| 60 | }; | |
| 61 | ||
| 62 | struct lpteg { | |
| 63 | 	struct lpte pt[8]; | |
| 64 | }; | |
| 65 | ||
| 66 | /* Partition table entry */ | |
| 67 | struct pate { | |
| 68 | 	u_int64_t pagetab; | |
| 69 | 	u_int64_t proctab; | |
| 70 | }; | |
| 71 | ||
| 72 | /* Process table entry */ | |
| 73 | struct prte { | |
| 74 | 	u_int64_t proctab0; | |
| 75 | 	u_int64_t proctab1; | |
| 76 | }; | |
| 77 | ||
| 78 | typedef	struct pte pte_t; | |
| 79 | typedef	struct lpte lpte_t; | |
| 80 | #endif	/* LOCORE */ | |
| 81 | ||
| 82 | /* 32-bit PTE definitions */ | |
| 83 | ||
| 84 | /* High word: */ | |
| 85 | #define	PTE_VALID	0x80000000 | |
| 86 | #define	PTE_VSID_SHFT	7 | |
| 87 | #define	PTE_HID		0x00000040 | |
| 88 | #define	PTE_API		0x0000003f | |
| 89 | /* Low word: */ | |
| 90 | #define	PTE_RPGN	0xfffff000 | |
| 91 | #define	PTE_REF		0x00000100 | |
| 92 | #define	PTE_CHG		0x00000080 | |
| 93 | #define	PTE_WIMG	0x00000078 | |
| 94 | #define	PTE_W		0x00000040 | |
| 95 | #define	PTE_I		0x00000020 | |
| 96 | #define	PTE_M		0x00000010 | |
| 97 | #define	PTE_G		0x00000008 | |
| 98 | #define	PTE_PP		0x00000003 | |
| 99 | #define	PTE_SO		0x00000000	/* Super. Only (U: XX, S: RW) */ | |
| 100 | #define PTE_SW		0x00000001	/* Super. Write-Only (U: RO, S: RW) */ | |
| 101 | #define	PTE_BW		0x00000002	/* Supervisor (U: RW, S: RW) */ | |
| 102 | #define	PTE_BR		0x00000003	/* Both Read Only (U: RO, S: RO) */ | |
| 103 | #define	PTE_RW		PTE_BW | |
| 104 | #define	PTE_RO		PTE_BR | |
| 105 | ||
| 106 | #define	PTE_EXEC	0x00000200	/* pseudo bit in attrs; page is exec */ | |
| 107 | ||
| 108 | /* 64-bit PTE definitions */ | |
| 109 | ||
| 110 | /* High quadword: */ | |
| 111 | #define LPTE_VSID_SHIFT		12 | |
| 112 | #define LPTE_AVPN_MASK		0xFFFFFFFFFFFFFF80ULL | |
| 113 | #define LPTE_AVA_MASK		0x3FFFFFFFFFFFFF80ULL | |
| 114 | #define LPTE_API		0x0000000000000F80ULL | |
| 115 | #define LPTE_SWBITS		0x0000000000000078ULL | |
| 116 | #define LPTE_WIRED		0x0000000000000010ULL | |
| 117 | #define LPTE_LOCKED		0x0000000000000008ULL | |
| 118 | #define LPTE_BIG		0x0000000000000004ULL	/* 4kb/16Mb page */ | |
| 119 | #define LPTE_HID		0x0000000000000002ULL | |
| 120 | #define LPTE_VALID		0x0000000000000001ULL | |
| 121 | ||
| 122 | /* Low quadword: */ | |
| 123 | #define	LP_4K_16M	0x38	/* 4KB base, 16MB actual page size */ | |
| 124 | ||
| 125 | #define EXTEND_PTE(x)	UINT64_C(x)	/* make constants 64-bit */ | |
| 126 | #define	LPTE_RPGN	0xfffffffffffff000ULL | |
| 127 | #define	LPTE_LP_MASK	0x00000000000ff000ULL | |
| 128 | #define	LPTE_LP_SHIFT	12 | |
| 129 | #define	LPTE_LP_4K_16M	((unsigned long long)(LP_4K_16M) << LPTE_LP_SHIFT) | |
| 130 | #define	LPTE_REF	EXTEND_PTE( PTE_REF ) | |
| 131 | #define	LPTE_CHG	EXTEND_PTE( PTE_CHG ) | |
| 132 | #define	LPTE_WIMG	EXTEND_PTE( PTE_WIMG ) | |
| 133 | #define	LPTE_W		EXTEND_PTE( PTE_W ) | |
| 134 | #define	LPTE_I		EXTEND_PTE( PTE_I ) | |
| 135 | #define	LPTE_M		EXTEND_PTE( PTE_M ) | |
| 136 | #define	LPTE_G		EXTEND_PTE( PTE_G ) | |
| 137 | #define	LPTE_NOEXEC	0x0000000000000004ULL | |
| 138 | #define	LPTE_PP		EXTEND_PTE( PTE_PP ) | |
| 139 | ||
| 140 | #define	LPTE_SO		EXTEND_PTE( PTE_SO )	/* Super. Only */ | |
| 141 | #define	LPTE_SW		EXTEND_PTE( PTE_SW )	/* Super. Write-Only */ | |
| 142 | #define	LPTE_BW		EXTEND_PTE( PTE_BW )	/* Supervisor */ | |
| 143 | #define	LPTE_BR		EXTEND_PTE( PTE_BR )	/* Both Read Only */ | |
| 144 | #define	LPTE_RW		LPTE_BW | |
| 145 | #define	LPTE_RO		LPTE_BR | |
| 146 | ||
| 147 | /* HPT superpage definitions */ | |
| 148 | #define	HPT_SP_SHIFT		(VM_LEVEL_0_ORDER + PAGE_SHIFT) | |
| 149 | #define	HPT_SP_SIZE		(1 << HPT_SP_SHIFT) | |
| 150 | #define	HPT_SP_MASK		(HPT_SP_SIZE - 1) | |
| 151 | #define	HPT_SP_PAGES		(1 << VM_LEVEL_0_ORDER) | |
| 152 | ||
| 153 | /* POWER ISA 3.0 Radix Table Definitions */ | |
| 154 | #define	RPTE_VALID		0x8000000000000000ULL | |
| 155 | #define	RPTE_LEAF		0x4000000000000000ULL /* is a PTE: always 1 */ | |
| 156 | #define	RPTE_SW0		0x2000000000000000ULL | |
| 157 | #define	RPTE_RPN_MASK		0x00FFFFFFFFFFF000ULL | |
| 158 | #define	RPTE_RPN_SHIFT		12 | |
| 159 | #define	RPTE_SW1		0x0000000000000800ULL | |
| 160 | #define	RPTE_SW2		0x0000000000000400ULL | |
| 161 | #define	RPTE_SW3		0x0000000000000200ULL | |
| 162 | #define	RPTE_R			0x0000000000000100ULL | |
| 163 | #define	RPTE_C			0x0000000000000080ULL | |
| 164 | ||
| 165 | #define	RPTE_MANAGED		RPTE_SW1 | |
| 166 | #define	RPTE_WIRED		RPTE_SW2 | |
| 167 | #define	RPTE_PROMOTED		RPTE_SW3 | |
| 168 | ||
| 169 | #define	RPTE_ATTR_MASK		0x0000000000000030ULL | |
| 170 | #define	RPTE_ATTR_MEM		0x0000000000000000ULL /* PTE M */ | |
| 171 | #define	RPTE_ATTR_SAO		0x0000000000000010ULL /* PTE WIM */ | |
| 172 | #define	RPTE_ATTR_GUARDEDIO	0x0000000000000020ULL /* PTE IMG */ | |
| 173 | #define	RPTE_ATTR_UNGUARDEDIO	0x0000000000000030ULL /* PTE IM */ | |
| 174 | ||
| 175 | #define	RPTE_EAA_MASK		0x000000000000000FULL | |
| 176 | #define	RPTE_EAA_P		0x0000000000000008ULL /* Supervisor only */ | |
| 177 | #define	RPTE_EAA_R		0x0000000000000004ULL /* Read allowed */ | |
| 178 | #define	RPTE_EAA_W		0x0000000000000002ULL /* Write (+read) */ | |
| 179 | #define	RPTE_EAA_X		0x0000000000000001ULL /* Execute allowed */ | |
| 180 | ||
| 181 | #define	RPDE_VALID		RPTE_VALID | |
| 182 | #define	RPDE_LEAF		RPTE_LEAF /* is a PTE: always 0 */ | |
| 183 | #define	RPDE_NLB_MASK		0x00FFFFFFFFFFFF00ULL | |
| 184 | #define	RPDE_NLB_SHIFT		8 | |
| 185 | #define	RPDE_NLS_MASK		0x000000000000001FULL | |
| 186 | ||
| 187 | #define	PG_FRAME		(0x000ffffffffff000ul) | |
| 188 | #define	PG_PS_FRAME		(0x000fffffffe00000ul) | |
| 189 | /* | |
| 190 | * Extract bits from address | |
| 191 | */ | |
| 192 | #define	ADDR_SR_SHFT	28 | |
| 193 | #define	ADDR_PIDX	0x0ffff000UL | |
| 194 | #define	ADDR_PIDX_SHFT	12 | |
| 195 | #define	ADDR_API_SHFT	22 | |
| 196 | #define	ADDR_API_SHFT64	16 | |
| 197 | #define	ADDR_POFF	0x00000fffUL | |
| 198 | ||
| 199 | /* | |
| 200 | * Bits in DSISR: | |
| 201 | */ | |
| 202 | #define	DSISR_DIRECT	0x80000000 | |
| 203 | #define	DSISR_NOTFOUND	0x40000000 | |
| 204 | #define	DSISR_PROTECT	0x08000000 | |
| 205 | #define	DSISR_INVRX	0x04000000 | |
| 206 | #define	DSISR_STORE	0x02000000 | |
| 207 | #define	DSISR_DABR	0x00400000 | |
| 208 | #define	DSISR_SEGMENT	0x00200000 | |
| 209 | #define	DSISR_EAR	0x00100000 | |
| 210 | ||
| 211 | /* | |
| 212 | * Bits in SRR1 on ISI: | |
| 213 | */ | |
| 214 | #define	ISSRR1_NOTFOUND	0x40000000 | |
| 215 | #define	ISSRR1_DIRECT	0x10000000 | |
| 216 | #define	ISSRR1_PROTECT	0x08000000 | |
| 217 | #define	ISSRR1_SEGMENT	0x00200000 | |
| 218 | ||
| 219 | #else /* BOOKE */ | |
| 220 | ||
| 221 | #include <machine/tlb.h> | |
| 222 | ||
| 223 | /* | |
| 224 | * Flags for pte_remove() routine. | |
| 225 | */ | |
| 226 | #define PTBL_HOLD	0x00000001	/* do not unhold ptbl pages */ | |
| 227 | #define PTBL_UNHOLD	0x00000002	/* unhold and attempt to free ptbl pages */ | |
| 228 | ||
| 229 | #define PTBL_HOLD_FLAG(pmap)	(((pmap) == kernel_pmap) ? PTBL_HOLD : PTBL_UNHOLD) | |
| 230 | ||
| 231 | /* | |
| 232 | * Page Table Entry definitions and macros. | |
| 233 | * | |
| 234 | * RPN need only be 32-bit because Book-E has 36-bit addresses, and the smallest | |
| 235 | * page size is 4k (12-bit mask), so RPN can really fit into 24 bits. | |
| 236 | */ | |
| 237 | #ifndef	LOCORE | |
| 238 | typedef uint64_t pte_t; | |
| 239 | #endif | |
| 240 | ||
| 241 | /* RPN mask, TLB0 4K pages */ | |
| 242 | #define PTE_PA_MASK	PAGE_MASK | |
| 243 | ||
| 244 | #if defined(BOOKE_E500) | |
| 245 | ||
| 246 | /* PTE bits assigned to MAS2, MAS3 flags */ | |
| 247 | #define	PTE_MAS2_SHIFT	19 | |
| 248 | #define PTE_W		(MAS2_W << PTE_MAS2_SHIFT) | |
| 249 | #define PTE_I		(MAS2_I << PTE_MAS2_SHIFT) | |
| 250 | #define PTE_M		(MAS2_M << PTE_MAS2_SHIFT) | |
| 251 | #define PTE_G		(MAS2_G << PTE_MAS2_SHIFT) | |
| 252 | #define PTE_MAS2_MASK	(MAS2_G | MAS2_M | MAS2_I | MAS2_W) | |
| 253 | ||
| 254 | #define PTE_MAS3_SHIFT	2 | |
| 255 | #define PTE_UX		(MAS3_UX << PTE_MAS3_SHIFT) | |
| 256 | #define PTE_SX		(MAS3_SX << PTE_MAS3_SHIFT) | |
| 257 | #define PTE_UW		(MAS3_UW << PTE_MAS3_SHIFT) | |
| 258 | #define PTE_SW		(MAS3_SW << PTE_MAS3_SHIFT) | |
| 259 | #define PTE_UR		(MAS3_UR << PTE_MAS3_SHIFT) | |
| 260 | #define PTE_SR		(MAS3_SR << PTE_MAS3_SHIFT) | |
| 261 | #define PTE_MAS3_MASK	((MAS3_UX | MAS3_SX | MAS3_UW	\ | |
| 262 | 			| MAS3_SW | MAS3_UR | MAS3_SR) << PTE_MAS3_SHIFT) | |
| 263 | ||
| 264 | #define	PTE_PS_SHIFT	8 | |
| 265 | #define	PTE_PS_4KB	(2 << PTE_PS_SHIFT) | |
| 266 | ||
| 267 | #endif | |
| 268 | ||
| 269 | /* Other PTE flags */ | |
| 270 | #define PTE_VALID	0x00000001	/* Valid */ | |
| 271 | #define PTE_MODIFIED	0x00001000	/* Modified */ | |
| 272 | #define PTE_WIRED	0x00002000	/* Wired */ | |
| 273 | #define PTE_MANAGED	0x00000002	/* Managed */ | |
| 274 | #define PTE_REFERENCED	0x00040000	/* Referenced */ | |
| 275 | ||
| 276 | /* | |
| 277 | * Page Table Entry definitions and macros. | |
| 278 | * | |
| 279 | * We use the hardware page table entry format: | |
| 280 | * | |
| 281 | * 63 24 23 19 18 17 14 13 12 11 8 7 6 5 4 3 2 1 0 | |
| 282 | * --------------------------------------------------------------- | |
| 283 | * ARPN(12:51) WIMGE R U0:U3 SW0 C PSIZE UX SX UW SW UR SR SW1 V | |
| 284 | * --------------------------------------------------------------- | |
| 285 | */ | |
| 286 | ||
| 287 | /* PTE fields. */ | |
| 288 | #define PTE_TSIZE_SHIFT		(63-54) | |
| 289 | #define PTE_TSIZE_MASK		0x7 | |
| 290 | #define PTE_TSIZE_SHIFT_DIRECT	(63-55) | |
| 291 | #define PTE_TSIZE_MASK_DIRECT	0xf | |
| 292 | #define PTE_PS_DIRECT(ps)	(ps<<PTE_TSIZE_SHIFT_DIRECT)	/* Direct Entry Page Size */ | |
| 293 | #define PTE_PS(ps)		(ps<<PTE_TSIZE_SHIFT)	/* Page Size */ | |
| 294 | ||
| 295 | /* Macro argument must of pte_t type. */ | |
| 296 | #define PTE_TSIZE(pte)		(int)((*pte >> PTE_TSIZE_SHIFT) & PTE_TSIZE_MASK) | |
| 297 | #define PTE_TSIZE_DIRECT(pte)	(int)((*pte >> PTE_TSIZE_SHIFT_DIRECT) & PTE_TSIZE_MASK_DIRECT) | |
| 298 | ||
| 299 | /* Macro argument must of pte_t type. */ | |
| 300 | #define	PTE_ARPN_SHIFT		12 | |
| 301 | #define	PTE_FLAGS_MASK		0x00ffffff | |
| 302 | #define PTE_RPN_FROM_PA(pa)	(((pa) & ~PAGE_MASK) << PTE_ARPN_SHIFT) | |
| 303 | #define PTE_PA(pte)		((vm_paddr_t)(*pte >> PTE_ARPN_SHIFT) & ~PAGE_MASK) | |
| 304 | #define PTE_ISVALID(pte)	((*pte) & PTE_VALID) | |
| 305 | #define PTE_ISWIRED(pte)	((*pte) & PTE_WIRED) | |
| 306 | #define PTE_ISMANAGED(pte)	((*pte) & PTE_MANAGED) | |
| 307 | #define PTE_ISMODIFIED(pte)	((*pte) & PTE_MODIFIED) | |
| 308 | #define PTE_ISREFERENCED(pte)	((*pte) & PTE_REFERENCED) | |
| 309 | ||
| 310 | #endif /* BOOKE */ | |
| 311 | ||
| 312 | /* Book-E page table format, broken out for the generic pmap.h. */ | |
| 313 | #ifdef __powerpc64__ | |
| 314 | ||
| 315 | #include <machine/tlb.h> | |
| 316 | ||
| 317 | /* | |
| 318 | * The virtual address is: | |
| 319 | * | |
| 320 | * 4K page size | |
| 321 | * +-----+-----------+-------+-------------+-------------+----------------+ | |
| 322 | * | - | pg_root |pdir_l1| dir# | pte# | off in 4K page | | |
| 323 | * +-----+-----------+-------+-------------+-------------+----------------+ | |
| 324 | * 63 52 51 39 38 30 29 ^ 21 20 ^ 12 11 0 | |
| 325 | * | | | |
| 326 | * index in 1 page of pointers | |
| 327 | * | |
| 328 | * 1st level - Root page table | |
| 329 | * | |
| 330 | * pp2d consists of PG_ROOT_NENTRIES entries, each being a pointer to | |
| 331 | * second level entity, i.e. the page table directory (pdir). | |
| 332 | */ | |
| 333 | #define PG_ROOT_H		51 | |
| 334 | #define PG_ROOT_L		39 | |
| 335 | #define PG_ROOT_SIZE		(1UL << PG_ROOT_L)	/* va range mapped by pp2d */ | |
| 336 | #define PG_ROOT_SHIFT		PG_ROOT_L | |
| 337 | #define PG_ROOT_NUM		(PG_ROOT_H - PG_ROOT_L + 1) | |
| 338 | #define PG_ROOT_MASK		((1 << PG_ROOT_NUM) - 1) | |
| 339 | #define PG_ROOT_IDX(va)		((va >> PG_ROOT_SHIFT) & PG_ROOT_MASK) | |
| 340 | #define PG_ROOT_NENTRIES	(1 << PG_ROOT_NUM) | |
| 341 | #define PG_ROOT_ENTRY_SHIFT	3	/* log2 (sizeof(struct pte_entry **)) */ | |
| 342 | ||
| 343 | /* | |
| 344 | * 2nd level - page directory directory (pdir l1) | |
| 345 | * | |
| 346 | * pdir consists of PDIR_NENTRIES entries, each being a pointer to | |
| 347 | * second level entity, i.e. the actual page table (ptbl). | |
| 348 | */ | |
| 349 | #define PDIR_L1_H		(PG_ROOT_L-1) | |
| 350 | #define PDIR_L1_L		30 | |
| 351 | #define PDIR_L1_NUM		(PDIR_L1_H-PDIR_L1_L+1) | |
| 352 | #define PDIR_L1_SIZE		(1 << PDIR_L1_L)	/* va range mapped by pdir */ | |
| 353 | #define PDIR_L1_MASK		((1<<PDIR_L1_NUM)-1) | |
| 354 | #define PDIR_L1_SHIFT		PDIR_L1_L | |
| 355 | #define PDIR_L1_NENTRIES	(1<<PDIR_L1_NUM) | |
| 356 | #define PDIR_L1_IDX(va)		(((va) >> PDIR_L1_SHIFT) & PDIR_L1_MASK) | |
| 357 | #define PDIR_L1_ENTRY_SHIFT	3	/* log2 (sizeof(struct pte_entry *)) */ | |
| 358 | #define PDIR_L1_PAGES		((PDIR_L1_NENTRIES * (1<<PDIR_L1_ENTRY_SHIFT)) / PAGE_SIZE) | |
| 359 | ||
| 360 | /* | |
| 361 | * 3rd level - page table directory (pdir) | |
| 362 | * | |
| 363 | * pdir consists of PDIR_NENTRIES entries, each being a pointer to | |
| 364 | * second level entity, i.e. the actual page table (ptbl). | |
| 365 | */ | |
| 366 | #define PDIR_H			(PDIR_L1_L-1) | |
| 367 | #define PDIR_L			21 | |
| 368 | #define PDIR_NUM		(PDIR_H-PDIR_L+1) | |
| 369 | #define PDIR_SIZE		(1 << PDIR_L)	/* va range mapped by pdir */ | |
| 370 | #define PDIR_MASK		((1<<PDIR_NUM)-1) | |
| 371 | #define PDIR_SHIFT		PDIR_L | |
| 372 | #define PDIR_NENTRIES		(1<<PDIR_NUM) | |
| 373 | #define PDIR_IDX(va)		(((va) >> PDIR_SHIFT) & PDIR_MASK) | |
| 374 | #define PDIR_ENTRY_SHIFT	3	/* log2 (sizeof(struct pte_entry *)) */ | |
| 375 | #define PDIR_PAGES		((PDIR_NENTRIES * (1<<PDIR_ENTRY_SHIFT)) / PAGE_SIZE) | |
| 376 | ||
| 377 | /* | |
| 378 | * 4th level - page table (ptbl) | |
| 379 | * | |
| 380 | * Page table covers PTBL_NENTRIES page table entries. Page | |
| 381 | * table entry (pte) is 64 bit wide and defines mapping | |
| 382 | * for a single page. | |
| 383 | */ | |
| 384 | #define PTBL_H			(PDIR_L-1) | |
| 385 | #define PTBL_L			PAGE_SHIFT | |
| 386 | #define PTBL_NUM		(PTBL_H-PTBL_L+1) | |
| 387 | #define PTBL_MASK		((1<<PTBL_NUM)-1) | |
| 388 | #define PTBL_SHIFT		PTBL_L | |
| 389 | #define PTBL_SIZE		PAGE_SIZE	/* va range mapped by ptbl entry */ | |
| 390 | #define PTBL_NENTRIES		(1<<PTBL_NUM) | |
| 391 | #define PTBL_IDX(va)		((va >> PTBL_SHIFT) & PTBL_MASK) | |
| 392 | #define PTBL_ENTRY_SHIFT	 3	/* log2 (sizeof (struct pte_entry)) */ | |
| 393 | #define PTBL_PAGES		((PTBL_NENTRIES * (1<<PTBL_ENTRY_SHIFT)) / PAGE_SIZE) | |
| 394 | ||
| 395 | #else | |
| 396 | /* | |
| 397 | * 1st level - page table directory (pdir) | |
| 398 | * | |
| 399 | * pdir consists of 1024 entries, each being a pointer to | |
| 400 | * second level entity, i.e. the actual page table (ptbl). | |
| 401 | */ | |
| 402 | #define PDIR_SHIFT	22 | |
| 403 | #define PDIR_SIZE	(1 << PDIR_SHIFT)	/* va range mapped by pdir */ | |
| 404 | #define PDIR_MASK	(~(PDIR_SIZE - 1)) | |
| 405 | #define PDIR_NENTRIES	1024			/* number of page tables in pdir */ | |
| 406 | ||
| 407 | /* Returns pdir entry number for given va */ | |
| 408 | #define PDIR_IDX(va)	((va) >> PDIR_SHIFT) | |
| 409 | ||
| 410 | #define PDIR_ENTRY_SHIFT 2	/* entry size is 2^2 = 4 bytes */ | |
| 411 | ||
| 412 | /* | |
| 413 | * 2nd level - page table (ptbl) | |
| 414 | * | |
| 415 | * Page table covers 1024 page table entries. Page | |
| 416 | * table entry (pte) is 32 bit wide and defines mapping | |
| 417 | * for a single page. | |
| 418 | */ | |
| 419 | #define PTBL_SHIFT	PAGE_SHIFT | |
| 420 | #define PTBL_SIZE	PAGE_SIZE		/* va range mapped by ptbl entry */ | |
| 421 | #define PTBL_MASK	((PDIR_SIZE - 1) & ~((1 << PAGE_SHIFT) - 1)) | |
| 422 | #define PTBL_NENTRIES	1024			/* number of pages mapped by ptbl */ | |
| 423 | ||
| 424 | /* Returns ptbl entry number for given va */ | |
| 425 | #define PTBL_IDX(va)	(((va) & PTBL_MASK) >> PTBL_SHIFT) | |
| 426 | ||
| 427 | /* Size of ptbl in pages, 1024 entries, each sizeof(struct pte_entry). */ | |
| 428 | #define PTBL_PAGES	2 | |
| 429 | #define PTBL_ENTRY_SHIFT 3	/* entry size is 2^3 = 8 bytes */ | |
| 430 | ||
| 431 | #endif | |
| 432 | #endif /* _MACHINE_PTE_H_ */ | |
| \ No newline at end of file |
lib/libc/include/powerpc64-freebsd-none/machine/ptrace.h created+42| ... | ... | @@ -0,0 +1,42 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-3-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 2014 Justin Hibbits | |
| 5 | * All rights reserved. | |
| 6 | * | |
| 7 | * Redistribution and use in source and binary forms, with or without | |
| 8 | * modification, are permitted provided that the following conditions | |
| 9 | * are met: | |
| 10 | * 1. Redistributions of source code must retain the above copyright | |
| 11 | * notice, this list of conditions and the following disclaimer. | |
| 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 13 | * notice, this list of conditions and the following disclaimer in the | |
| 14 | * documentation and/or other materials provided with the distribution. | |
| 15 | * 3. Neither the name of the University nor the names of its contributors | |
| 16 | * may be used to endorse or promote products derived from this software | |
| 17 | * without specific prior written permission. | |
| 18 | * | |
| 19 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | |
| 20 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 21 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
| 22 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
| 23 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
| 24 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
| 25 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
| 26 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
| 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
| 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
| 29 | * SUCH DAMAGE. | |
| 30 | */ | |
| 31 | ||
| 32 | #ifndef _MACHINE_PTRACE_H_ | |
| 33 | #define _MACHINE_PTRACE_H_ | |
| 34 | ||
| 35 | #define	__HAVE_PTRACE_MACHDEP | |
| 36 | ||
| 37 | #define PT_GETVRREGS	(PT_FIRSTMACH + 0) | |
| 38 | #define PT_SETVRREGS	(PT_FIRSTMACH + 1) | |
| 39 | #define PT_GETVSRREGS	(PT_FIRSTMACH + 2) | |
| 40 | #define PT_SETVSRREGS	(PT_FIRSTMACH + 3) | |
| 41 | ||
| 42 | #endif | |
| \ No newline at end of file |
lib/libc/include/powerpc64-freebsd-none/machine/reg.h created+87| ... | ... | @@ -0,0 +1,87 @@ |
| 1 | /* $NetBSD: reg.h,v 1.4 2000/06/04 09:30:44 tsubai Exp $	*/ | |
| 2 | ||
| 3 | #ifndef _POWERPC_REG_H_ | |
| 4 | #define	_POWERPC_REG_H_ | |
| 5 | ||
| 6 | #include <sys/_types.h> | |
| 7 | ||
| 8 | /* Must match struct trapframe */ | |
| 9 | struct reg { | |
| 10 | 	__register_t fixreg[32]; | |
| 11 | 	__register_t lr; | |
| 12 | 	__register_t cr; | |
| 13 | 	__register_t xer; | |
| 14 | 	__register_t ctr; | |
| 15 | 	__register_t pc; | |
| 16 | }; | |
| 17 | ||
| 18 | struct fpreg { | |
| 19 | 	double fpreg[32]; | |
| 20 | 	double fpscr; | |
| 21 | }; | |
| 22 | ||
| 23 | /* Must match pcb.pcb_vec */ | |
| 24 | struct vmxreg { | |
| 25 | 	__uint32_t vr[32][4]; | |
| 26 | 	__uint32_t pad[2]; | |
| 27 | 	__uint32_t vrsave; | |
| 28 | 	__uint32_t vscr; | |
| 29 | }; | |
| 30 | ||
| 31 | struct dbreg { | |
| 32 | 	unsigned int	junk; | |
| 33 | }; | |
| 34 | ||
| 35 | #ifdef __LP64__ | |
| 36 | /* Must match struct trapframe */ | |
| 37 | struct reg32 { | |
| 38 | 	__int32_t fixreg[32]; | |
| 39 | 	__int32_t lr; | |
| 40 | 	__int32_t cr; | |
| 41 | 	__int32_t xer; | |
| 42 | 	__int32_t ctr; | |
| 43 | 	__int32_t pc; | |
| 44 | }; | |
| 45 | ||
| 46 | struct fpreg32 { | |
| 47 | 	struct fpreg data; | |
| 48 | }; | |
| 49 | ||
| 50 | struct vmxreg32 { | |
| 51 | 	struct vmxreg data; | |
| 52 | }; | |
| 53 | ||
| 54 | struct dbreg32 { | |
| 55 | 	struct dbreg data; | |
| 56 | }; | |
| 57 | ||
| 58 | #define __HAVE_REG32 | |
| 59 | #endif | |
| 60 | ||
| 61 | #ifdef _KERNEL | |
| 62 | /* | |
| 63 | * XXX these interfaces are MI, so they should be declared in a MI place. | |
| 64 | */ | |
| 65 | int	fill_regs(struct thread *, struct reg *); | |
| 66 | int	set_regs(struct thread *, struct reg *); | |
| 67 | int	fill_fpregs(struct thread *, struct fpreg *); | |
| 68 | int	set_fpregs(struct thread *, struct fpreg *); | |
| 69 | int	fill_dbregs(struct thread *, struct dbreg *); | |
| 70 | int	set_dbregs(struct thread *, struct dbreg *); | |
| 71 | ||
| 72 | #ifdef COMPAT_FREEBSD32 | |
| 73 | struct image_params; | |
| 74 | ||
| 75 | int	fill_regs32(struct thread *, struct reg32 *); | |
| 76 | int	set_regs32(struct thread *, struct reg32 *); | |
| 77 | void	ppc32_setregs(struct thread *, struct image_params *, uintptr_t); | |
| 78 | ||
| 79 | #define	fill_fpregs32(td, reg)	fill_fpregs(td,(struct fpreg *)reg) | |
| 80 | #define	set_fpregs32(td, reg)	set_fpregs(td,(struct fpreg *)reg) | |
| 81 | #define	fill_dbregs32(td, reg)	fill_dbregs(td,(struct dbreg *)reg) | |
| 82 | #define	set_dbregs32(td, reg)	set_dbregs(td,(struct dbreg *)reg) | |
| 83 | #endif | |
| 84 | ||
| 85 | #endif | |
| 86 | ||
| 87 | #endif /* _POWERPC_REG_H_ */ | |
| \ No newline at end of file |
lib/libc/include/powerpc64-freebsd-none/machine/reloc.h created+30| ... | ... | @@ -0,0 +1,30 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-3-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 1998 John Birrell <jb@cimlogic.com.au>. | |
| 5 | * All rights reserved. | |
| 6 | * | |
| 7 | * Redistribution and use in source and binary forms, with or without | |
| 8 | * modification, are permitted provided that the following conditions | |
| 9 | * are met: | |
| 10 | * 1. Redistributions of source code must retain the above copyright | |
| 11 | * notice, this list of conditions and the following disclaimer. | |
| 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 13 | * notice, this list of conditions and the following disclaimer in the | |
| 14 | * documentation and/or other materials provided with the distribution. | |
| 15 | * 3. Neither the name of the author nor the names of any co-contributors | |
| 16 | * may be used to endorse or promote products derived from this software | |
| 17 | * without specific prior written permission. | |
| 18 | * | |
| 19 | * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND | |
| 20 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 21 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
| 22 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
| 23 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
| 24 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
| 25 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
| 26 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
| 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
| 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
| 29 | * SUCH DAMAGE. | |
| 30 | */ | |
| \ No newline at end of file |
lib/libc/include/powerpc64-freebsd-none/machine/resource.h created+51| ... | ... | @@ -0,0 +1,51 @@ |
| 1 | /*- | |
| 2 | * Copyright 1998 Massachusetts Institute of Technology | |
| 3 | * | |
| 4 | * Permission to use, copy, modify, and distribute this software and | |
| 5 | * its documentation for any purpose and without fee is hereby | |
| 6 | * granted, provided that both the above copyright notice and this | |
| 7 | * permission notice appear in all copies, that both the above | |
| 8 | * copyright notice and this permission notice appear in all | |
| 9 | * supporting documentation, and that the name of M.I.T. not be used | |
| 10 | * in advertising or publicity pertaining to distribution of the | |
| 11 | * software without specific, written prior permission. M.I.T. makes | |
| 12 | * no representations about the suitability of this software for any | |
| 13 | * purpose. It is provided "as is" without express or implied | |
| 14 | * warranty. | |
| 15 | * | |
| 16 | * THIS SOFTWARE IS PROVIDED BY M.I.T. ``AS IS''. M.I.T. DISCLAIMS | |
| 17 | * ALL EXPRESS OR IMPLIED WARRANTIES WITH REGARD TO THIS SOFTWARE, | |
| 18 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | |
| 19 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT | |
| 20 | * SHALL M.I.T. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
| 21 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | |
| 22 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF | |
| 23 | * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | |
| 24 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | |
| 25 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT | |
| 26 | * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
| 27 | * SUCH DAMAGE. | |
| 28 | */ | |
| 29 | ||
| 30 | #ifndef _MACHINE_RESOURCE_H_ | |
| 31 | #define	_MACHINE_RESOURCE_H_	1 | |
| 32 | ||
| 33 | /* | |
| 34 | * Definitions of resource types for Intel Architecture machines | |
| 35 | * with support for legacy ISA devices and drivers. | |
| 36 | */ | |
| 37 | ||
| 38 | #define	SYS_RES_IRQ	1	/* interrupt lines */ | |
| 39 | #define	SYS_RES_DRQ	2	/* isa dma lines */ | |
| 40 | #define	SYS_RES_MEMORY	3	/* i/o memory */ | |
| 41 | #define	SYS_RES_IOPORT	4	/* i/o ports */ | |
| 42 | #define	PCI_RES_BUS	5	/* PCI bus numbers */ | |
| 43 | ||
| 44 | /* | |
| 45 | * A powerpc-specific resource flag to request little-endian bus tags | |
| 46 | * for a resource. | |
| 47 | */ | |
| 48 | ||
| 49 | #define	RF_LITTLEENDIAN		RF_SPARE1 | |
| 50 | ||
| 51 | #endif /* !_MACHINE_RESOURCE_H_ */ | |
| \ No newline at end of file |
lib/libc/include/powerpc64-freebsd-none/machine/rtas.h created+59| ... | ... | @@ -0,0 +1,59 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-2-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 2011 Nathan Whitehorn | |
| 5 | * All rights reserved. | |
| 6 | * | |
| 7 | * Redistribution and use in source and binary forms, with or without | |
| 8 | * modification, are permitted provided that the following conditions | |
| 9 | * are met: | |
| 10 | * 1. Redistributions of source code must retain the above copyright | |
| 11 | * notice, this list of conditions and the following disclaimer. | |
| 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 13 | * notice, this list of conditions and the following disclaimer in the | |
| 14 | * documentation and/or other materials provided with the distribution. | |
| 15 | * | |
| 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |
| 17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
| 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | |
| 20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
| 21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
| 22 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
| 23 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
| 24 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
| 25 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
| 26 | * SUCH DAMAGE. | |
| 27 | */ | |
| 28 | ||
| 29 | #ifndef _MACHINE_RTAS_H_ | |
| 30 | #define _MACHINE_RTAS_H_ | |
| 31 | ||
| 32 | #include <sys/types.h> | |
| 33 | #include <dev/ofw/openfirm.h> | |
| 34 | ||
| 35 | /* | |
| 36 | * RTAS functions are defined by 32-bit integer tokens. These vary from | |
| 37 | * system to system, and can be looked up from their standardized names | |
| 38 | * using rtas_token_lookup(). If RTAS is not available, rtas_token_lookup() | |
| 39 | * and rtas_call_method() return -1; this can be checked in advance using | |
| 40 | * rtas_exists(). Otherwise, rtas_call_method() returns one of the RTAS | |
| 41 | * status codes from the bottom of this file. | |
| 42 | */ | |
| 43 | ||
| 44 | int rtas_exists(void); | |
| 45 | int rtas_call_method(cell_t token, int nargs, int nreturns, ...); | |
| 46 | cell_t rtas_token_lookup(const char *method); | |
| 47 | ||
| 48 | /* RTAS Status Codes: see CHRP or PAPR specification */ | |
| 49 | #define	RTAS_OK				0 | |
| 50 | #define	RTAS_HW_ERROR			-1 | |
| 51 | #define	RTAS_BUSY			-2 | |
| 52 | #define	RTAS_PARAM_ERROR		-3 | |
| 53 | #define	RTAS_STATE_CHANGE		-7 | |
| 54 | #define	RTAS_VENDOR_BEGIN		9000 | |
| 55 | #define	RTAS_EXTENDED_DELAY		9900 | |
| 56 | #define	RTAS_ISOLATION_ERROR		-9000 | |
| 57 | #define	RTAS_VENDOR_ERROR_BEGIN		-9004 | |
| 58 | ||
| 59 | #endif /* _MACHINE_RTAS_H_ */ | |
| \ No newline at end of file |
lib/libc/include/powerpc64-freebsd-none/machine/sdt_machdep.h created+12| ... | ... | @@ -0,0 +1,12 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-2-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 2024 Mark Johnston <markj@FreeBSD.org> | |
| 5 | */ | |
| 6 | ||
| 7 | #ifndef _SYS_SDT_MACHDEP_H_ | |
| 8 | #define	_SYS_SDT_MACHDEP_H_ | |
| 9 | ||
| 10 | #define	_SDT_ASM_PATCH_INSTR	"nop" | |
| 11 | ||
| 12 | #endif | |
| \ No newline at end of file |
lib/libc/include/powerpc64-freebsd-none/machine/setjmp.h created+27| ... | ... | @@ -0,0 +1,27 @@ |
| 1 | /*- | |
| 2 | *	$NetBSD: setjmp.h,v 1.3 1998/09/16 23:51:27 thorpej Exp $ | |
| 3 | */ | |
| 4 | ||
| 5 | #ifndef _MACHINE_SETJMP_H_ | |
| 6 | #define	_MACHINE_SETJMP_H_ | |
| 7 | ||
| 8 | #include <sys/cdefs.h> | |
| 9 | ||
| 10 | #ifdef _KERNEL | |
| 11 | #define	_JBLEN	25	/* Kernel doesn't save FP and Altivec regs */ | |
| 12 | #else | |
| 13 | #define	_JBLEN	100 | |
| 14 | #endif | |
| 15 | ||
| 16 | /* | |
| 17 | * jmp_buf and sigjmp_buf are encapsulated in different structs to force | |
| 18 | * compile-time diagnostics for mismatches. The structs are the same | |
| 19 | * internally to avoid some run-time errors for mismatches. | |
| 20 | */ | |
| 21 | #if __BSD_VISIBLE || __POSIX_VISIBLE || __XSI_VISIBLE | |
| 22 | typedef	struct _sigjmp_buf { long _sjb[_JBLEN + 1]; } sigjmp_buf[1]; | |
| 23 | #endif | |
| 24 | ||
| 25 | typedef	struct _jmp_buf { long _jb[_JBLEN + 1]; } jmp_buf[1]; | |
| 26 | ||
| 27 | #endif /* !_MACHINE_SETJMP_H_ */ | |
| \ No newline at end of file |
lib/libc/include/powerpc64-freebsd-none/machine/signal.h created+54| ... | ... | @@ -0,0 +1,54 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-4-Clause | |
| 3 | * | |
| 4 | * Copyright (C) 1995, 1996 Wolfgang Solfrank. | |
| 5 | * Copyright (C) 1995, 1996 TooLs GmbH. | |
| 6 | * All rights reserved. | |
| 7 | * | |
| 8 | * Redistribution and use in source and binary forms, with or without | |
| 9 | * modification, are permitted provided that the following conditions | |
| 10 | * are met: | |
| 11 | * 1. Redistributions of source code must retain the above copyright | |
| 12 | * notice, this list of conditions and the following disclaimer. | |
| 13 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 14 | * notice, this list of conditions and the following disclaimer in the | |
| 15 | * documentation and/or other materials provided with the distribution. | |
| 16 | * 3. All advertising materials mentioning features or use of this software | |
| 17 | * must display the following acknowledgement: | |
| 18 | *	This product includes software developed by TooLs GmbH. | |
| 19 | * 4. The name of TooLs GmbH may not be used to endorse or promote products | |
| 20 | * derived from this software without specific prior written permission. | |
| 21 | * | |
| 22 | * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR | |
| 23 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |
| 24 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | |
| 25 | * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
| 26 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | |
| 27 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; | |
| 28 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | |
| 29 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | |
| 30 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | |
| 31 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 32 | * | |
| 33 | *	$NetBSD: signal.h,v 1.4 1998/09/14 02:48:34 thorpej Exp $ | |
| 34 | */ | |
| 35 | ||
| 36 | #ifndef	_MACHINE_SIGNAL_H_ | |
| 37 | #define	_MACHINE_SIGNAL_H_ | |
| 38 | ||
| 39 | #include <sys/cdefs.h> | |
| 40 | ||
| 41 | typedef int sig_atomic_t; | |
| 42 | ||
| 43 | #if __BSD_VISIBLE | |
| 44 | #include <machine/frame.h> | |
| 45 | ||
| 46 | struct sigcontext { | |
| 47 | 	int sc_onstack;			/* saved onstack flag */ | |
| 48 | 	int __sc_mask13;		/* saved signal mask (old style) */ | |
| 49 | 	struct trapframe sc_frame;	/* saved registers */ | |
| 50 | 	struct __sigset sc_mask;	/* saved signal mask (new style) */ | |
| 51 | }; | |
| 52 | #endif | |
| 53 | ||
| 54 | #endif	/* !_MACHINE_SIGNAL_H_ */ | |
| \ No newline at end of file |
lib/libc/include/powerpc64-freebsd-none/machine/slb.h created+92| ... | ... | @@ -0,0 +1,92 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-2-Clause | |
| 3 | * | |
| 4 | * Copyright (C) 2009 Nathan Whitehorn | |
| 5 | * All rights reserved. | |
| 6 | * | |
| 7 | * Redistribution and use in source and binary forms, with or without | |
| 8 | * modification, are permitted provided that the following conditions | |
| 9 | * are met: | |
| 10 | * 1. Redistributions of source code must retain the above copyright | |
| 11 | * notice, this list of conditions and the following disclaimer. | |
| 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 13 | * notice, this list of conditions and the following disclaimer in the | |
| 14 | * documentation and/or other materials provided with the distribution. | |
| 15 | * | |
| 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | |
| 17 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |
| 18 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | |
| 19 | * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
| 20 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | |
| 21 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; | |
| 22 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | |
| 23 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | |
| 24 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | |
| 25 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 26 | */ | |
| 27 | ||
| 28 | #ifndef _MACHINE_SLB_H_ | |
| 29 | #define	_MACHINE_SLB_H_ | |
| 30 | ||
| 31 | /* | |
| 32 | * Bit definitions for segment lookaside buffer entries. | |
| 33 | * | |
| 34 | * PowerPC Microprocessor Family: The Programming Environments for 64-bit | |
| 35 | * Microprocessors, section 7.4.2.1 | |
| 36 | * | |
| 37 | * Note that these bitmasks are relative to the values for one of the two | |
| 38 | * values for slbmte, slbmfee, and slbmfev, not the internal SLB | |
| 39 | * representation. | |
| 40 | */ | |
| 41 | ||
| 42 | #define	SLBV_KS		0x0000000000000800UL /* Supervisor-state prot key */ | |
| 43 | #define	SLBV_KP		0x0000000000000400UL /* User-state prot key */ | |
| 44 | #define	SLBV_N		0x0000000000000200UL /* No-execute protection */ | |
| 45 | #define	SLBV_L		0x0000000000000100UL /* Large page selector */ | |
| 46 | #define	SLBV_CLASS	0x0000000000000080UL /* Class selector */ | |
| 47 | #define	SLBV_VSID_MASK	0xfffffffffffff000UL /* Virtual segment ID mask */ | |
| 48 | #define	SLBV_VSID_SHIFT	12 | |
| 49 | ||
| 50 | /* | |
| 51 | * Make a predictable 1:1 map from ESIDs to VSIDs for the kernel. Hash table | |
| 52 | * coverage is increased by swizzling the ESID and multiplying by a prime | |
| 53 | * number (0x13bb). | |
| 54 | */ | |
| 55 | #define	KERNEL_VSID_BIT	0x0000001000000000UL /* Bit set in all kernel VSIDs */ | |
| 56 | #define KERNEL_VSID(esid) ((((((uint64_t)esid << 8) | ((uint64_t)esid >> 28)) \ | |
| 57 | 				* 0x13bbUL) & (KERNEL_VSID_BIT - 1)) | \ | |
| 58 | 				KERNEL_VSID_BIT) | |
| 59 | ||
| 60 | #define	SLBE_VALID	0x0000000008000000UL /* SLB entry valid */ | |
| 61 | #define	SLBE_INDEX_MASK	0x0000000000000fffUL /* SLB index mask*/ | |
| 62 | #define	SLBE_ESID_MASK	0xfffffffff0000000UL /* Effective segment ID mask */ | |
| 63 | #define	SLBE_ESID_SHIFT	28 | |
| 64 | ||
| 65 | /* | |
| 66 | * SLB page sizes encoding, as present in property ibm,segment-page-sizes | |
| 67 | * of CPU device tree node. | |
| 68 | * | |
| 69 | * See LoPAPR: CPU Node Properties, section C.6.1.4. | |
| 70 | */ | |
| 71 | #define	SLB_PGSZ_4K_4K	0 | |
| 72 | ||
| 73 | /* Virtual real-mode VSID in LPARs */ | |
| 74 | #define VSID_VRMA	0x1ffffff | |
| 75 | ||
| 76 | /* | |
| 77 | * User segment for copyin/out | |
| 78 | */ | |
| 79 | #define USER_SLB_SLOT 0 | |
| 80 | #define USER_SLB_SLBE (((USER_ADDR >> ADDR_SR_SHFT) << SLBE_ESID_SHIFT) | \ | |
| 81 | 			SLBE_VALID | USER_SLB_SLOT) | |
| 82 | ||
| 83 | struct slb { | |
| 84 | 	uint64_t	slbv; | |
| 85 | 	uint64_t	slbe; | |
| 86 | }; | |
| 87 | ||
| 88 | struct pmap; | |
| 89 | void	handle_kernel_slb_spill(int, register_t, register_t); | |
| 90 | int	handle_user_slb_spill(struct pmap *pm, vm_offset_t addr); | |
| 91 | ||
| 92 | #endif /* !_MACHINE_SLB_H_ */ | |
| \ No newline at end of file |
lib/libc/include/powerpc64-freebsd-none/machine/smp.h created+64| ... | ... | @@ -0,0 +1,64 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-2-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 2008 Marcel Moolenaar | |
| 5 | * All rights reserved. | |
| 6 | * | |
| 7 | * Redistribution and use in source and binary forms, with or without | |
| 8 | * modification, are permitted provided that the following conditions | |
| 9 | * are met: | |
| 10 | * | |
| 11 | * 1. Redistributions of source code must retain the above copyright | |
| 12 | * notice, this list of conditions and the following disclaimer. | |
| 13 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 14 | * notice, this list of conditions and the following disclaimer in the | |
| 15 | * documentation and/or other materials provided with the distribution. | |
| 16 | * | |
| 17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | |
| 18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |
| 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | |
| 20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | |
| 21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | |
| 22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
| 23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
| 24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
| 25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | |
| 26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 27 | */ | |
| 28 | ||
| 29 | #ifndef _MACHINE_SMP_H_ | |
| 30 | #define _MACHINE_SMP_H_ | |
| 31 | ||
| 32 | #ifdef _KERNEL | |
| 33 | ||
| 34 | #define	IPI_AST			0 | |
| 35 | #define	IPI_PREEMPT		1 | |
| 36 | #define	IPI_RENDEZVOUS		2 | |
| 37 | #define	IPI_STOP		3 | |
| 38 | #define	IPI_STOP_HARD		3 | |
| 39 | #define	IPI_HARDCLOCK		4 | |
| 40 | ||
| 41 | #ifndef LOCORE | |
| 42 | ||
| 43 | #include <machine/pcb.h> | |
| 44 | #include <sys/_cpuset.h> | |
| 45 | ||
| 46 | void	ipi_all_but_self(int ipi); | |
| 47 | void	ipi_cpu(int cpu, u_int ipi); | |
| 48 | void	ipi_selected(cpuset_t cpus, int ipi); | |
| 49 | ||
| 50 | struct cpuref { | |
| 51 | 	uintptr_t	cr_hwref; | |
| 52 | 	u_int		cr_cpuid; | |
| 53 | 	u_int		cr_domain; | |
| 54 | }; | |
| 55 | ||
| 56 | void	pmap_cpu_bootstrap(int); | |
| 57 | void	cpudep_ap_early_bootstrap(void); | |
| 58 | uintptr_t cpudep_ap_bootstrap(void); | |
| 59 | void	cpudep_ap_setup(void); | |
| 60 | void	machdep_ap_bootstrap(void); | |
| 61 | ||
| 62 | #endif /* !LOCORE */ | |
| 63 | #endif /* _KERNEL */ | |
| 64 | #endif /* !_MACHINE_SMP_H */ | |
| \ No newline at end of file |
lib/libc/include/powerpc64-freebsd-none/machine/spr.h created+868| ... | ... | @@ -0,0 +1,868 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-2-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 2001 The NetBSD Foundation, Inc. | |
| 5 | * All rights reserved. | |
| 6 | * | |
| 7 | * Redistribution and use in source and binary forms, with or without | |
| 8 | * modification, are permitted provided that the following conditions | |
| 9 | * are met: | |
| 10 | * 1. Redistributions of source code must retain the above copyright | |
| 11 | * notice, this list of conditions and the following disclaimer. | |
| 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 13 | * notice, this list of conditions and the following disclaimer in the | |
| 14 | * documentation and/or other materials provided with the distribution. | |
| 15 | * | |
| 16 | * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS | |
| 17 | * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | |
| 18 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
| 19 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | |
| 20 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
| 21 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
| 22 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
| 23 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
| 24 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
| 25 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
| 26 | * POSSIBILITY OF SUCH DAMAGE. | |
| 27 | * | |
| 28 | * $NetBSD: spr.h,v 1.25 2002/08/14 15:38:40 matt Exp $ | |
| 29 | */ | |
| 30 | #ifndef _POWERPC_SPR_H_ | |
| 31 | #define	_POWERPC_SPR_H_ | |
| 32 | ||
| 33 | #ifndef _LOCORE | |
| 34 | #define	mtspr(reg, val)							\ | |
| 35 | 	__asm __volatile("mtspr %0,%1" : : "K"(reg), "r"(val)) | |
| 36 | #define	mfspr(reg)							\ | |
| 37 | 	( { register_t val;						\ | |
| 38 | 	 __asm __volatile("mfspr %0,%1" : "=r"(val) : "K"(reg));	\ | |
| 39 | 	 val; } ) | |
| 40 | ||
| 41 | #ifndef __powerpc64__ | |
| 42 | ||
| 43 | /* The following routines allow manipulation of the full 64-bit width | |
| 44 | * of SPRs on 64 bit CPUs in bridge mode */ | |
| 45 | ||
| 46 | #define mtspr64(reg,valhi,vallo,scratch)				\ | |
| 47 | 	__asm __volatile("						\ | |
| 48 | 		mfmsr %0; 						\ | |
| 49 | 		insrdi %0,%5,1,0; 					\ | |
| 50 | 		mtmsrd %0; 						\ | |
| 51 | 		isync; 							\ | |
| 52 | 									\ | |
| 53 | 		sld %1,%1,%4;						\ | |
| 54 | 		or %1,%1,%2;						\ | |
| 55 | 		mtspr %3,%1;						\ | |
| 56 | 		srd %1,%1,%4;						\ | |
| 57 | 									\ | |
| 58 | 		clrldi %0,%0,1; 					\ | |
| 59 | 		mtmsrd %0; 						\ | |
| 60 | 		isync;"							\ | |
| 61 | 	: "=r"(scratch), "=r"(valhi) : "r"(vallo), "K"(reg), "r"(32), "r"(1)) | |
| 62 | ||
| 63 | #define mfspr64upper(reg,scratch)					\ | |
| 64 | 	( { register_t val;						\ | |
| 65 | 	 __asm __volatile("						\ | |
| 66 | 		mfmsr %0; 						\ | |
| 67 | 		insrdi %0,%4,1,0; 					\ | |
| 68 | 		mtmsrd %0; 						\ | |
| 69 | 		isync; 							\ | |
| 70 | 									\ | |
| 71 | 		mfspr %1,%2;						\ | |
| 72 | 		srd %1,%1,%3;						\ | |
| 73 | 									\ | |
| 74 | 		clrldi %0,%0,1; 					\ | |
| 75 | 		mtmsrd %0; 						\ | |
| 76 | 		isync;" 						\ | |
| 77 | 	 : "=r"(scratch), "=r"(val) : "K"(reg), "r"(32), "r"(1));	\ | |
| 78 | 	 val; } ) | |
| 79 | ||
| 80 | #endif | |
| 81 | ||
| 82 | #endif /* _LOCORE */ | |
| 83 | ||
| 84 | /* | |
| 85 | * Special Purpose Register declarations. | |
| 86 | * | |
| 87 | * The first column in the comments indicates which PowerPC | |
| 88 | * architectures the SPR is valid on - 4 for 4xx series, | |
| 89 | * 6 for 6xx/7xx series and 8 for 8xx and 8xxx series. | |
| 90 | */ | |
| 91 | ||
| 92 | #define	SPR_MQ			0x000	/* .6. 601 MQ register */ | |
| 93 | #define	SPR_XER			0x001	/* 468 Fixed Point Exception Register */ | |
| 94 | #define	SPR_DSCR		0x003	/* .6. Data Stream Control Register (Unprivileged) */ | |
| 95 | #define	SPR_RTCU_R		0x004	/* .6. 601 RTC Upper - Read */ | |
| 96 | #define	SPR_RTCL_R		0x005	/* .6. 601 RTC Lower - Read */ | |
| 97 | #define	SPR_LR			0x008	/* 468 Link Register */ | |
| 98 | #define	SPR_CTR			0x009	/* 468 Count Register */ | |
| 99 | #define	SPR_DSCRP		0x011 /* Data Stream Control Register (Privileged) */ | |
| 100 | #define	SPR_DSISR		0x012	/* .68 DSI exception source */ | |
| 101 | #define	 DSISR_DIRECT		 0x80000000 /* Direct-store error exception */ | |
| 102 | #define	 DSISR_NOTFOUND	 0x40000000 /* Translation not found */ | |
| 103 | #define	 DSISR_PROTECT		 0x08000000 /* Memory access not permitted */ | |
| 104 | #define	 DSISR_INVRX		 0x04000000 /* Reserve-indexed insn direct-store access */ | |
| 105 | #define	 DSISR_STORE		 0x02000000 /* Store operation */ | |
| 106 | #define	 DSISR_DABR		 0x00400000 /* DABR match */ | |
| 107 | #define	 DSISR_SEGMENT		 0x00200000 /* XXX; not in 6xx PEM */ | |
| 108 | #define	 DSISR_EAR		 0x00100000 /* eciwx/ecowx && EAR[E] == 0 */ | |
| 109 | #define	 DSISR_MC_UE_DEFERRED	 0x00008000 /* UE deferred error */ | |
| 110 | #define	 DSISR_MC_UE_TABLEWALK	 0x00004000 /* UE deferred error during tablewalk */ | |
| 111 | #define	 DSISR_MC_DERAT_MULTIHIT	 0x00000800 /* D-ERAT multi-hit */ | |
| 112 | #define	 DSISR_MC_TLB_MULTIHIT	 0x00000400 /* TLB multi-hit */ | |
| 113 | #define	 DSISR_MC_TLBIE_ERR	 0x00000200 /* TLBIE or TLBIEL programming error */ | |
| 114 | #define	 DSISR_MC_SLB_PARITY	 0x00000100 /* SLB parity error */ | |
| 115 | #define	 DSISR_MC_SLB_MULTIHIT	 0x00000080 /* SLB Multi-hit detected (D-side) */ | |
| 116 | #define	 DSISR_MC_BAD_REAL_LD	 0x00000040 /* Bad real address for load. */ | |
| 117 | #define	 DSISR_MC_BAD_ADDR	 0x00000020 /* Bad address for load or store tablewalk */ | |
| 118 | #define	SPR_DAR			0x013	/* .68 Data Address Register */ | |
| 119 | #define	SPR_RTCU_W		0x014	/* .6. 601 RTC Upper - Write */ | |
| 120 | #define	SPR_RTCL_W		0x015	/* .6. 601 RTC Lower - Write */ | |
| 121 | #define	SPR_DEC			0x016	/* .68 DECrementer register */ | |
| 122 | #define	SPR_SDR1		0x019	/* .68 Page table base address register */ | |
| 123 | #define	SPR_SRR0		0x01a	/* 468 Save/Restore Register 0 */ | |
| 124 | #define	SPR_SRR1		0x01b	/* 468 Save/Restore Register 1 */ | |
| 125 | #define	 SRR1_ISI_PFAULT	 0x40000000 /* ISI page not found */ | |
| 126 | #define	 SRR1_ISI_NOEXECUTE	 0x10000000 /* Memory marked no-execute */ | |
| 127 | #define	 SRR1_ISI_PP		 0x08000000 /* PP bits forbid access */ | |
| 128 | #define	 SRR1_MCHK_DATA	 0x00200000 /* Machine check data in DSISR */ | |
| 129 | #define	 SRR1_MCHK_IFETCH_M	 0x081c0000 /* Machine check instr fetch mask */ | |
| 130 | #define	 SRR1_MCHK_IFETCH_SLBMH 0x000c0000 /* SLB multihit */ | |
| 131 | #define	SPR_CFAR		0x01c	/* Come From Address Register */ | |
| 132 | #define	SPR_AMR			0x01d	/* Authority Mask Register */ | |
| 133 | ||
| 134 | #define	SPR_PID			0x030	/* 4.. Process ID */ | |
| 135 | ||
| 136 | #define	SPR_DECAR		0x036	/* ..8 Decrementer auto reload */ | |
| 137 | #define	SPR_IAMR		0x03d	/* Instr. Authority Mask Reg */ | |
| 138 | ||
| 139 | #define	SPR_EIE			0x050	/* ..8 Exception Interrupt ??? */ | |
| 140 | #define	SPR_EID			0x051	/* ..8 Exception Interrupt ??? */ | |
| 141 | #define	SPR_NRI			0x052	/* ..8 Exception Interrupt ??? */ | |
| 142 | #define	SPR_FSCR		0x099	/* Facility Status and Control Register */ | |
| 143 | #define	 FSCR_IC_MASK		 0xFF00000000000000ULL	/* FSCR[0:7] is Interrupt Cause */ | |
| 144 | #define	 FSCR_IC_FP		 0x0000000000000000ULL	/* FP unavailable */ | |
| 145 | #define	 FSCR_IC_VSX		 0x0100000000000000ULL	/* VSX unavailable */ | |
| 146 | #define	 FSCR_IC_DSCR		 0x0200000000000000ULL	/* Access to the DSCR at SPRs 3 or 17 */ | |
| 147 | #define	 FSCR_IC_PM		 0x0300000000000000ULL	/* Read or write access of a Performance Monitor SPR in group A */ | |
| 148 | #define	 FSCR_IC_BHRB		 0x0400000000000000ULL	/* Execution of a BHRB Instruction */ | |
| 149 | #define	 FSCR_IC_HTM		 0x0500000000000000ULL	/* Access to a Transactional Memory */ | |
| 150 | /* Reserved 0x0600000000000000ULL */ | |
| 151 | #define	 FSCR_IC_EBB		 0x0700000000000000ULL	/* Access to Event-Based Branch */ | |
| 152 | #define	 FSCR_IC_TAR		 0x0800000000000000ULL	/* Access to Target Address Register */ | |
| 153 | #define	 FSCR_IC_STOP		 0x0900000000000000ULL	/* Access to the 'stop' instruction in privileged non-hypervisor state */ | |
| 154 | #define	 FSCR_IC_MSG		 0x0A00000000000000ULL	/* Access to 'msgsndp' or 'msgclrp' instructions */ | |
| 155 | #define	 FSCR_IC_LM		 0x0A00000000000000ULL	/* Access to load monitored facility */ | |
| 156 | #define	 FSCR_IC_SCV		 0x0C00000000000000ULL	/* Execution of a 'scv' instruction */ | |
| 157 | #define	 FSCR_SCV		 0x0000000000001000 /* scv instruction available */ | |
| 158 | #define	 FSCR_LM		 0x0000000000000800 /* Load monitored facilities available */ | |
| 159 | #define	 FSCR_MSGP		 0x0000000000000400 /* msgsndp and SPRs available */ | |
| 160 | #define	 FSCR_TAR		 0x0000000000000100 /* TAR register available */ | |
| 161 | #define	 FSCR_EBB		 0x0000000000000080 /* Event-based branch available */ | |
| 162 | #define	 FSCR_DSCR		 0x0000000000000004 /* DSCR available in PR state */ | |
| 163 | #define	SPR_UAMOR		0x09d	/* User Authority Mask Override Register */ | |
| 164 | #define	SPR_DPDES		0x0b0	/* .6. Directed Privileged Doorbell Exception State Register */ | |
| 165 | #define	SPR_HFSCR		0xbe	/* Hypervisor Facility Status and Control Register */ | |
| 166 | #define	 HFSCR_BHRB		 0x0000000000000010 /* BHRB instructions */ | |
| 167 | #define	 HFSCR_PM		 0x0000000000000008 /* Performance monitor SPRs */ | |
| 168 | #define	 HFSCR_VECVSX		 0x0000000000000002 /* Vector and VSX facilities */ | |
| 169 | #define	 HFSCR_FP		 0x0000000000000001 /* Floating Point facility */ | |
| 170 | #define	SPR_USPRG0		0x100	/* 4.8 User SPR General 0 */ | |
| 171 | #define	SPR_VRSAVE		0x100	/* .6. AltiVec VRSAVE */ | |
| 172 | #define	SPR_SPRG0		0x110	/* 468 SPR General 0 */ | |
| 173 | #define	SPR_SPRG1		0x111	/* 468 SPR General 1 */ | |
| 174 | #define	SPR_SPRG2		0x112	/* 468 SPR General 2 */ | |
| 175 | #define	SPR_SPRG3		0x113	/* 468 SPR General 3 */ | |
| 176 | #define	SPR_SPRG4		0x114	/* 4.8 SPR General 4 */ | |
| 177 | #define	SPR_SPRG5		0x115	/* 4.8 SPR General 5 */ | |
| 178 | #define	SPR_SPRG6		0x116	/* 4.8 SPR General 6 */ | |
| 179 | #define	SPR_SPRG7		0x117	/* 4.8 SPR General 7 */ | |
| 180 | #define	SPR_SCOMC		0x114	/* ... SCOM Address Register (970) */ | |
| 181 | #define	SPR_SCOMD		0x115	/* ... SCOM Data Register (970) */ | |
| 182 | #define	SPR_ASR			0x118	/* ... Address Space Register (PPC64) */ | |
| 183 | #define	SPR_EAR			0x11a	/* .68 External Access Register */ | |
| 184 | #define	SPR_PVR			0x11f	/* 468 Processor Version Register */ | |
| 185 | #define	 MPC601		 0x0001 | |
| 186 | #define	 MPC603		 0x0003 | |
| 187 | #define	 MPC604		 0x0004 | |
| 188 | #define	 MPC602		 0x0005 | |
| 189 | #define	 MPC603e		 0x0006 | |
| 190 | #define	 MPC603ev		 0x0007 | |
| 191 | #define	 MPC750		 0x0008 | |
| 192 | #define	 MPC750CL		 0x7000	/* Nintendo Wii's Broadway */ | |
| 193 | #define	 MPC604ev		 0x0009 | |
| 194 | #define	 MPC7400		 0x000c | |
| 195 | #define	 MPC620		 0x0014 | |
| 196 | #define	 IBM403		 0x0020 | |
| 197 | #define	 IBM401A1		 0x0021 | |
| 198 | #define	 IBM401B2		 0x0022 | |
| 199 | #define	 IBM401C2		 0x0023 | |
| 200 | #define	 IBM401D2		 0x0024 | |
| 201 | #define	 IBM401E2		 0x0025 | |
| 202 | #define	 IBM401F2		 0x0026 | |
| 203 | #define	 IBM401G2		 0x0027 | |
| 204 | #define	 IBMRS64II		 0x0033 | |
| 205 | #define	 IBMRS64III		 0x0034 | |
| 206 | #define	 IBMPOWER4		 0x0035 | |
| 207 | #define	 IBMRS64III_2		 0x0036 | |
| 208 | #define	 IBMRS64IV		 0x0037 | |
| 209 | #define	 IBMPOWER4PLUS		 0x0038 | |
| 210 | #define	 IBM970		 0x0039 | |
| 211 | #define	 IBMPOWER5		 0x003a | |
| 212 | #define	 IBMPOWER5PLUS		 0x003b | |
| 213 | #define	 IBM970FX		 0x003c | |
| 214 | #define	 IBMPOWER6		 0x003e | |
| 215 | #define	 IBMPOWER7		 0x003f | |
| 216 | #define	 IBMPOWER3		 0x0040 | |
| 217 | #define	 IBMPOWER3PLUS		 0x0041 | |
| 218 | #define	 IBM970MP		 0x0044 | |
| 219 | #define	 IBM970GX		 0x0045 | |
| 220 | #define	 IBMPOWERPCA2		 0x0049 | |
| 221 | #define	 IBMPOWER7PLUS		 0x004a | |
| 222 | #define	 IBMPOWER8E		 0x004b | |
| 223 | #define	 IBMPOWER8NVL		 0x004c | |
| 224 | #define	 IBMPOWER8		 0x004d | |
| 225 | #define	 IBMPOWER9		 0x004e | |
| 226 | #define	 MPC860		 0x0050 | |
| 227 | #define	 IBMCELLBE		 0x0070 | |
| 228 | #define	 IBMPOWER10		 0x0080 | |
| 229 | #define	 MPC8240		 0x0081 | |
| 230 | #define	 IBMPOWER11		 0x0082 | |
| 231 | #define	 PA6T			 0x0090 | |
| 232 | #define	 IBM405GP		 0x4011 | |
| 233 | #define	 IBM405L		 0x4161 | |
| 234 | #define	 IBM750FX		 0x7000 | |
| 235 | #define	MPC745X_P(v)	((v & 0xFFF8) == 0x8000) | |
| 236 | #define	 MPC7450		 0x8000 | |
| 237 | #define	 MPC7455		 0x8001 | |
| 238 | #define	 MPC7457		 0x8002 | |
| 239 | #define	 MPC7447A		 0x8003 | |
| 240 | #define	 MPC7448		 0x8004 | |
| 241 | #define	 MPC7410		 0x800c | |
| 242 | #define	 MPC8245		 0x8081 | |
| 243 | #define	 FSL_E500v1		 0x8020 | |
| 244 | #define	 FSL_E500v2		 0x8021 | |
| 245 | #define	 FSL_E500mc		 0x8023 | |
| 246 | #define	 FSL_E5500		 0x8024 | |
| 247 | #define	 FSL_E6500		 0x8040 | |
| 248 | #define	 FSL_E300C1		 0x8083 | |
| 249 | #define	 FSL_E300C2		 0x8084 | |
| 250 | #define	 FSL_E300C3		 0x8085 | |
| 251 | #define	 FSL_E300C4		 0x8086 | |
| 252 | ||
| 253 | #define LPCR_PECE_WAKESET (LPCR_PECE_EXT | LPCR_PECE_DECR | LPCR_PECE_ME) | |
| 254 | ||
| 255 | #define	SPR_DBSR		0x130	/* ..8 Debug Status Register */ | |
| 256 | #define	 DBSR_IDE		 0x80000000 /* Imprecise debug event. */ | |
| 257 | #define	 DBSR_UDE		 0x40000000 /* Unconditional debug event. */ | |
| 258 | #define	 DBSR_MRR		 0x30000000 /* Most recent Reset (mask). */ | |
| 259 | #define	 DBSR_ICMP		 0x08000000 /* Instr. complete debug event. */ | |
| 260 | #define	 DBSR_BRT		 0x04000000 /* Branch taken debug event. */ | |
| 261 | #define	 DBSR_IRPT		 0x02000000 /* Interrupt taken debug event. */ | |
| 262 | #define	 DBSR_TRAP		 0x01000000 /* Trap instr. debug event. */ | |
| 263 | #define	 DBSR_IAC1		 0x00800000 /* Instr. address compare #1. */ | |
| 264 | #define	 DBSR_IAC2		 0x00400000 /* Instr. address compare #2. */ | |
| 265 | #define	 DBSR_IAC3		 0x00200000 /* Instr. address compare #3. */ | |
| 266 | #define	 DBSR_IAC4		 0x00100000 /* Instr. address compare #4. */ | |
| 267 | #define	 DBSR_DAC1R		 0x00080000 /* Data addr. read compare #1. */ | |
| 268 | #define	 DBSR_DAC1W		 0x00040000 /* Data addr. write compare #1. */ | |
| 269 | #define	 DBSR_DAC2R		 0x00020000 /* Data addr. read compare #2. */ | |
| 270 | #define	 DBSR_DAC2W		 0x00010000 /* Data addr. write compare #2. */ | |
| 271 | #define	 DBSR_RET		 0x00008000 /* Return debug event. */ | |
| 272 | #define	SPR_EPCR		0x133 | |
| 273 | #define	 EPCR_EXTGS		 0x80000000 | |
| 274 | #define	 EPCR_DTLBGS		 0x40000000 | |
| 275 | #define	 EPCR_ITLBGS		 0x20000000 | |
| 276 | #define	 EPCR_DSIGS		 0x10000000 | |
| 277 | #define	 EPCR_ISIGS		 0x08000000 | |
| 278 | #define	 EPCR_DUVGS		 0x04000000 | |
| 279 | #define	 EPCR_ICM		 0x02000000 | |
| 280 | #define	 EPCR_GICMGS		 0x01000000 | |
| 281 | #define	 EPCR_DGTMI		 0x00800000 | |
| 282 | #define	 EPCR_DMIUH		 0x00400000 | |
| 283 | #define	 EPCR_PMGS		 0x00200000 | |
| 284 | #define	SPR_DBCR0		0x134	/* ..8 Debug Control Register 0 */ | |
| 285 | #define	SPR_DBCR1		0x135	/* ..8 Debug Control Register 1 */ | |
| 286 | #define	SPR_DBCR2		0x136	/* ..8 Debug Control Register 2 */ | |
| 287 | #define	SPR_IAC1		0x138	/* ..8 Instruction Address Compare 1 */ | |
| 288 | #define	SPR_IAC2		0x139	/* ..8 Instruction Address Compare 2 */ | |
| 289 | #define	SPR_IAC3		0x13a	/* ..8 Instruction Address Compare 3 */ | |
| 290 | #define	SPR_IAC4		0x13b	/* ..8 Instruction Address Compare 4 */ | |
| 291 | ||
| 292 | #define	SPR_HSRR0		0x13a | |
| 293 | #define	SPR_HSRR1		0x13b | |
| 294 | #define	SPR_DAC1		0x13c	/* ..8 Data Address Compare 1 */ | |
| 295 | #define	SPR_DAC2		0x13d	/* ..8 Data Address Compare 2 */ | |
| 296 | #define	SPR_DVC1		0x13e	/* ..8 Data Value Compare 1 */ | |
| 297 | #define	SPR_DVC2		0x13f	/* ..8 Data Value Compare 2 */ | |
| 298 | ||
| 299 | #define	SPR_LPCR		0x13e	/* .6. Logical Partitioning Control */ | |
| 300 | #define	 LPCR_LPES		 0x008	/* Bit 60 */ | |
| 301 | #define	 LPCR_HVICE		 0x002	/* Hypervisor Virtualization Interrupt (Arch 3.0) */ | |
| 302 | #define	 LPCR_ILE		 (1ULL << 25) /* Interrupt Little-Endian (ISA 2.07) */ | |
| 303 | #define	 LPCR_UPRT		 (1ULL << 22) /* Use Process Table (ISA 3) */ | |
| 304 | #define	 LPCR_HR		 (1ULL << 20) /* Host Radix mode */ | |
| 305 | #define	 LPCR_PECE_DRBL (1ULL << 16) /* Directed Privileged Doorbell */ | |
| 306 | #define	 LPCR_PECE_HDRBL (1ULL << 15) /* Directed Hypervisor Doorbell */ | |
| 307 | #define	 LPCR_PECE_EXT (1ULL << 14) /* External exceptions */ | |
| 308 | #define	 LPCR_PECE_DECR (1ULL << 13) /* Decrementer exceptions */ | |
| 309 | #define	 LPCR_PECE_ME (1ULL << 12) /* Machine Check and Hypervisor */ | |
| 310 | /* Maintenance exceptions */ | |
| 311 | #define	SPR_LPID		0x13f	/* .6. Logical Partitioning Control */ | |
| 312 | #define	SPR_HMER		0x150	/* Hypervisor Maintenance Exception Register */ | |
| 313 | #define	SPR_HMEER		0x151	/* Hypervisor Maintenance Exception Enable Register */ | |
| 314 | #define	SPR_AMOR		0x15d	/* Authority Mask Override Register */ | |
| 315 | ||
| 316 | #define	SPR_TIR			0x1be	/* .6. Thread Identification Register */ | |
| 317 | #define	SPR_PTCR		0x1d0	/* Partition Table Control Register */ | |
| 318 | #define	SPR_SPEFSCR		0x200	/* ..8 Signal Processing Engine FSCR. */ | |
| 319 | #define	 SPEFSCR_SOVH		 0x80000000 | |
| 320 | #define	 SPEFSCR_OVH		 0x40000000 | |
| 321 | #define	 SPEFSCR_FGH		 0x20000000 | |
| 322 | #define	 SPEFSCR_FXH		 0x10000000 | |
| 323 | #define	 SPEFSCR_FINVH		 0x08000000 | |
| 324 | #define	 SPEFSCR_FDBZH		 0x04000000 | |
| 325 | #define	 SPEFSCR_FUNFH		 0x02000000 | |
| 326 | #define	 SPEFSCR_FOVFH		 0x01000000 | |
| 327 | #define	 SPEFSCR_FINXS		 0x00200000 | |
| 328 | #define	 SPEFSCR_FINVS		 0x00100000 | |
| 329 | #define	 SPEFSCR_FDBZS		 0x00080000 | |
| 330 | #define	 SPEFSCR_FUNFS		 0x00040000 | |
| 331 | #define	 SPEFSCR_FOVFS		 0x00020000 | |
| 332 | #define	 SPEFSCR_SOV		 0x00008000 | |
| 333 | #define	 SPEFSCR_OV		 0x00004000 | |
| 334 | #define	 SPEFSCR_FG		 0x00002000 | |
| 335 | #define	 SPEFSCR_FX		 0x00001000 | |
| 336 | #define	 SPEFSCR_FINV		 0x00000800 | |
| 337 | #define	 SPEFSCR_FDBZ		 0x00000400 | |
| 338 | #define	 SPEFSCR_FUNF		 0x00000200 | |
| 339 | #define	 SPEFSCR_FOVF		 0x00000100 | |
| 340 | #define	 SPEFSCR_FINXE		 0x00000040 | |
| 341 | #define	 SPEFSCR_FINVE		 0x00000020 | |
| 342 | #define	 SPEFSCR_FDBZE		 0x00000010 | |
| 343 | #define	 SPEFSCR_FUNFE		 0x00000008 | |
| 344 | #define	 SPEFSCR_FOVFE		 0x00000004 | |
| 345 | #define	 SPEFSCR_FRMC_M	 0x00000003 | |
| 346 | #define	 SPEFSCR_DFLT		 (SPEFSCR_FINVE | SPEFSCR_FDBZE | \ | |
| 347 | 				 SPEFSCR_FUNFE | SPEFSCR_FOVFE) | |
| 348 | #define	SPR_IBAT0U		0x210	/* .6. Instruction BAT Reg 0 Upper */ | |
| 349 | #define	SPR_IBAT0L		0x211	/* .6. Instruction BAT Reg 0 Lower */ | |
| 350 | #define	SPR_IBAT1U		0x212	/* .6. Instruction BAT Reg 1 Upper */ | |
| 351 | #define	SPR_IBAT1L		0x213	/* .6. Instruction BAT Reg 1 Lower */ | |
| 352 | #define	SPR_IBAT2U		0x214	/* .6. Instruction BAT Reg 2 Upper */ | |
| 353 | #define	SPR_IBAT2L		0x215	/* .6. Instruction BAT Reg 2 Lower */ | |
| 354 | #define	SPR_IBAT3U		0x216	/* .6. Instruction BAT Reg 3 Upper */ | |
| 355 | #define	SPR_IBAT3L		0x217	/* .6. Instruction BAT Reg 3 Lower */ | |
| 356 | #define	SPR_DBAT0U		0x218	/* .6. Data BAT Reg 0 Upper */ | |
| 357 | #define	SPR_DBAT0L		0x219	/* .6. Data BAT Reg 0 Lower */ | |
| 358 | #define	SPR_DBAT1U		0x21a	/* .6. Data BAT Reg 1 Upper */ | |
| 359 | #define	SPR_DBAT1L		0x21b	/* .6. Data BAT Reg 1 Lower */ | |
| 360 | #define	SPR_DBAT2U		0x21c	/* .6. Data BAT Reg 2 Upper */ | |
| 361 | #define	SPR_DBAT2L		0x21d	/* .6. Data BAT Reg 2 Lower */ | |
| 362 | #define	SPR_DBAT3U		0x21e	/* .6. Data BAT Reg 3 Upper */ | |
| 363 | #define	SPR_DBAT3L		0x21f	/* .6. Data BAT Reg 3 Lower */ | |
| 364 | #define	SPR_IBAT4U		0x230	/* .6. Instruction BAT Reg 4 Upper */ | |
| 365 | #define	SPR_DBCR3		0x231	/* ..8 Debug Control Register 3 */ | |
| 366 | #define	SPR_IBAT4L		0x231	/* .6. Instruction BAT Reg 4 Lower */ | |
| 367 | #define	SPR_IBAT5U		0x232	/* .6. Instruction BAT Reg 5 Upper */ | |
| 368 | #define	SPR_IBAT5L		0x233	/* .6. Instruction BAT Reg 5 Lower */ | |
| 369 | #define	SPR_DBCR4		0x233	/* ..8 Debug Control Register 4 */ | |
| 370 | #define	SPR_IBAT6U		0x234	/* .6. Instruction BAT Reg 6 Upper */ | |
| 371 | #define	SPR_DBCR5		0x234	/* ..8 Debug Control Register 5 */ | |
| 372 | #define	SPR_IBAT6L		0x235	/* .6. Instruction BAT Reg 6 Lower */ | |
| 373 | #define	SPR_IAC5		0x235	/* ..8 Instruction Address Compare 5 */ | |
| 374 | #define	SPR_IBAT7U		0x236	/* .6. Instruction BAT Reg 7 Upper */ | |
| 375 | #define	SPR_IAC6		0x236	/* ..8 Instruction Address Compare 6 */ | |
| 376 | #define	SPR_IBAT7L		0x237	/* .6. Instruction BAT Reg 7 Lower */ | |
| 377 | #define	SPR_IAC7		0x237	/* ..8 Instruction Address Compare 7 */ | |
| 378 | #define	SPR_DBAT4U		0x238	/* .6. Data BAT Reg 4 Upper */ | |
| 379 | #define	SPR_IAC8		0x238	/* ..8 Instruction Address Compare 8 */ | |
| 380 | #define	SPR_DBAT4L		0x239	/* .6. Data BAT Reg 4 Lower */ | |
| 381 | #define	SPR_DBAT5U		0x23a	/* .6. Data BAT Reg 5 Upper */ | |
| 382 | #define	SPR_DBAT5L		0x23b	/* .6. Data BAT Reg 5 Lower */ | |
| 383 | #define	SPR_DBAT6U		0x23c	/* .6. Data BAT Reg 6 Upper */ | |
| 384 | #define	SPR_DBAT6L		0x23d	/* .6. Data BAT Reg 6 Lower */ | |
| 385 | #define	SPR_DBAT7U		0x23e	/* .6. Data BAT Reg 7 Upper */ | |
| 386 | #define	SPR_DBAT7L		0x23f	/* .6. Data BAT Reg 7 Lower */ | |
| 387 | #define	SPR_DBCR6		0x25b	/* ..8 Debug Control Register 6 */ | |
| 388 | #define	SPR_SPRG8		0x25c	/* ..8 SPR General 8 */ | |
| 389 | ||
| 390 | #define	SPR_MMCRA		0x312	/* ... Monitor Mode Control Register A */ | |
| 391 | #define	SPR_PMC1		0x313	/* ... PMC 1 */ | |
| 392 | #define	SPR_PMC2		0x314	/* ... PMC 2 */ | |
| 393 | #define	SPR_PMC3		0x315	/* ... PMC 3 */ | |
| 394 | #define	SPR_PMC4		0x316	/* ... PMC 4 */ | |
| 395 | #define	SPR_PMC5		0x317	/* ... PMC 5 */ | |
| 396 | #define	SPR_PMC6		0x318	/* ... PMC 6 */ | |
| 397 | #define	SPR_PMC7		0x319	/* ... PMC 7 */ | |
| 398 | #define	SPR_PMC8		0x31a	/* ... PMC 8 */ | |
| 399 | ||
| 400 | #define	SPR_MMCR0		0x31b	/* ... Monitor Mode Control Register 0 */ | |
| 401 | #define	 SPR_MMCR0_FC		 0x80000000 /* Freeze counters */ | |
| 402 | #define	 SPR_MMCR0_FCS		 0x40000000 /* Freeze counters in supervisor mode */ | |
| 403 | #define	 SPR_MMCR0_FCP		 0x20000000 /* Freeze counters in user mode */ | |
| 404 | #define	 SPR_MMCR0_FCM1	 0x10000000 /* Freeze counters when mark=1 */ | |
| 405 | #define	 SPR_MMCR0_FCM0	 0x08000000 /* Freeze counters when mark=0 */ | |
| 406 | #define	 SPR_MMCR0_PMXE	 0x04000000 /* Enable PM interrupt */ | |
| 407 | #define	 SPR_MMCR0_PMAE	 0x04000000 /* PM Alert Enable */ | |
| 408 | #define	 SPR_MMCR0_FCECE	 0x02000000 /* Freeze counters after event */ | |
| 409 | #define	 SPR_MMCR0_TBSEL_15	 0x01800000 /* Count bit 15 of TBL */ | |
| 410 | #define	 SPR_MMCR0_TBSEL_19	 0x01000000 /* Count bit 19 of TBL */ | |
| 411 | #define	 SPR_MMCR0_TBSEL_23	 0x00800000 /* Count bit 23 of TBL */ | |
| 412 | #define	 SPR_MMCR0_TBSEL_31	 0x00000000 /* Count bit 31 of TBL */ | |
| 413 | #define	 SPR_MMCR0_TBEE	 0x00400000 /* Time-base event enable */ | |
| 414 | #define	 SPR_MMCR0_THRESHOLD(x) ((x) << 16) /* Threshold value */ | |
| 415 | #define	 SPR_MMCR0_PMC1CE	 0x00008000 /* PMC1 condition enable */ | |
| 416 | #define	 SPR_MMCR0_PMCNCE	 0x00004000 /* PMCn condition enable */ | |
| 417 | #define	 SPR_MMCR0_TRIGGER	 0x00002000 /* Trigger */ | |
| 418 | #define	 SPR_MMCR0_PMAO	 0x00000080 /* PM Alert Occurred */ | |
| 419 | #define	 SPR_MMCR0_FCPC	 0x00001000 /* Freeze Counters in Problem State Cond. */ | |
| 420 | #define	 SPR_MMCR0_FC56	 0x00000010 /* Freeze Counters 5-6 */ | |
| 421 | #define	 SPR_MMCR0_PMC1SEL(x)	 ((x) << 8) /* PMC1 selector (970) */ | |
| 422 | #define	 SPR_MMCR0_PMC2SEL(x)	 ((x) << 1) /* PMC2 selector (970) */ | |
| 423 | #define	 SPR_MMCR0_74XX_PMC1SEL(x)	(((x) & 0x3f) << 6) /* PMC1 selector */ | |
| 424 | #define	 SPR_MMCR0_74XX_PMC2SEL(x)	(((x) & 0x3f) << 0) /* PMC2 selector */ | |
| 425 | ||
| 426 | #define	SPR_MMCR1		0x31e	/* ... Monitor Mode Control Register 1 */ | |
| 427 | #define	 SPR_MMCR1_PMC3SEL(x)	 (((x) & 0x1f) << 27) /* PMC 3 selector */ | |
| 428 | #define	 SPR_MMCR1_PMC4SEL(x)	 (((x) & 0x1f) << 22) /* PMC 4 selector */ | |
| 429 | #define	 SPR_MMCR1_PMC5SEL(x)	 (((x) & 0x1f) << 17) /* PMC 5 selector */ | |
| 430 | #define	 SPR_MMCR1_PMC6SEL(x)	 (((x) & 0x1f) << 12) /* PMC 6 selector */ | |
| 431 | #define	 SPR_MMCR1_74XX_PMC6SEL(x)	(((x) & 0x3f) << 11) /* PMC 6 selector */ | |
| 432 | #define	 SPR_MMCR1_PMC7SEL(x)	 (((x) & 0x1f) << 7) /* PMC 7 selector */ | |
| 433 | #define	 SPR_MMCR1_PMC8SEL(x)	 (((x) & 0x1f) << 2) /* PMC 8 selector */ | |
| 434 | #define	 SPR_MMCR1_P8_PMCSEL_ALL	0xffffffff | |
| 435 | #define	 SPR_MMCR1_P8_PMCNSEL_MASK(n)	(0xffUL << ((3-(n))*8)) | |
| 436 | #define	 SPR_MMCR1_P8_PMCNSEL(n, v)	((unsigned long)(v) << ((3-(n))*8)) | |
| 437 | ||
| 438 | #define	SPR_MMCR2		0x311 | |
| 439 | #define	 SPR_MMCR2_CNBIT(n, bit) ((bit) << (((5 - (n)) * 9) + 10)) | |
| 440 | #define	 SPR_MMCR2_FCNS(n)	 SPR_MMCR2_CNBIT(n, 0x100ULL) | |
| 441 | #define	 SPR_MMCR2_FCNP0(n)	 SPR_MMCR2_CNBIT(n, 0x080ULL) | |
| 442 | #define	 SPR_MMCR2_FCNP1(n)	 SPR_MMCR2_CNBIT(n, 0x040ULL) | |
| 443 | #define	 SPR_MMCR2_FCNM1(n)	 SPR_MMCR2_CNBIT(n, 0x020ULL) | |
| 444 | #define	 SPR_MMCR2_FCNM0(n)	 SPR_MMCR2_CNBIT(n, 0x010ULL) | |
| 445 | #define	 SPR_MMCR2_FCNWAIT(n)	 SPR_MMCR2_CNBIT(n, 0x008ULL) | |
| 446 | #define	 SPR_MMCR2_FCNH(n)	 SPR_MMCR2_CNBIT(n, 0x004ULL) | |
| 447 | /* Freeze Counter N in Hypervisor/Supervisor/Problem states */ | |
| 448 | #define	 SPR_MMCR2_FCNHSP(n)					\ | |
| 449 | 		(SPR_MMCR2_FCNS(n) | SPR_MMCR2_FCNP0(n) |	\ | |
| 450 | 		 SPR_MMCR2_FCNP1(n) | SPR_MMCR2_FCNH(n)) | |
| 451 | ||
| 452 | #define	SPR_M_TWB		0x31c	/* ..8 MMU tablewalk base */ | |
| 453 | #define	 M_TWB_L1TB		0xfffff000 /* level-1 translation base */ | |
| 454 | #define	 M_TWB_L1INDX		0x00000ffc /* level-1 index */ | |
| 455 | #define	SPR_MD_TWC		0x31d	/* ..8 DMMU tablewalk control */ | |
| 456 | #define	SPR_MD_RPN		0x31e	/* ..8 DMMU real (phys) page number */ | |
| 457 | #define	SPR_MD_TW		0x31f	/* ..8 MMU tablewalk scratch */ | |
| 458 | #define	SPR_BESCRS		0x320	/* .6. Branch Event Status and Control Set Register */ | |
| 459 | #define	SPR_BESCRSU		0x321	/* .6. Branch Event Status and Control Set Register (upper 32-bit) */ | |
| 460 | #define	SPR_BESCRR		0x322	/* .6. Branch Event Status and Control Reset Register */ | |
| 461 | #define	SPR_BESCRRU		0x323	/* .6. Branch Event Status and Control Register (upper 32-bit) */ | |
| 462 | #define	SPR_EBBHR		0x324	/* .6. Event-based Branch Handler Register */ | |
| 463 | #define	SPR_EBBRR		0x325	/* .6. Event-based Branch Return Register */ | |
| 464 | #define	SPR_BESCR		0x326	/* .6. Branch Event Status and Control Register */ | |
| 465 | #define	SPR_LMRR		0x32d	/* .6. Load Monitored Region Register */ | |
| 466 | #define	SPR_LMSER		0x32e	/* .6. Load Monitored Section Enable Register */ | |
| 467 | #define	SPR_TAR			0x32f	/* .6. Branch Target Address Register */ | |
| 468 | #define	SPR_MI_CAM		0x330	/* ..8 IMMU CAM entry read */ | |
| 469 | #define	SPR_MI_RAM0		0x331	/* ..8 IMMU RAM entry read reg 0 */ | |
| 470 | #define	SPR_MI_RAM1		0x332	/* ..8 IMMU RAM entry read reg 1 */ | |
| 471 | #define	SPR_MD_CAM		0x338	/* ..8 IMMU CAM entry read */ | |
| 472 | #define	SPR_MD_RAM0		0x339	/* ..8 IMMU RAM entry read reg 0 */ | |
| 473 | #define	SPR_MD_RAM1		0x33a	/* ..8 IMMU RAM entry read reg 1 */ | |
| 474 | #define	SPR_PSSCR		0x357	/* Processor Stop Status and Control Register (ISA 3.0) */ | |
| 475 | #define	 PSSCR_PLS_S		 60 | |
| 476 | #define	 PSSCR_PLS_M		 (0xf << PSSCR_PLS_S) | |
| 477 | #define	 PSSCR_SD		 (1 << 22) | |
| 478 | #define	 PSSCR_ESL		 (1 << 21) | |
| 479 | #define	 PSSCR_EC		 (1 << 20) | |
| 480 | #define	 PSSCR_PSLL_S		 16 | |
| 481 | #define	 PSSCR_PSLL_M		 (0xf << PSSCR_PSLL_S) | |
| 482 | #define	 PSSCR_TR_S		 8 | |
| 483 | #define	 PSSCR_TR_M		 (0x3 << PSSCR_TR_S) | |
| 484 | #define	 PSSCR_MTL_S		 4 | |
| 485 | #define	 PSSCR_MTL_M		 (0xf << PSSCR_MTL_S) | |
| 486 | #define	 PSSCR_RL_S		 0 | |
| 487 | #define	 PSSCR_RL_M		 (0xf << PSSCR_RL_S) | |
| 488 | #define	SPR_PMCR 0x374 /* Processor Management Control Register */ | |
| 489 | #define	SPR_UMMCR2		0x3a0	/* .6. User Monitor Mode Control Register 2 */ | |
| 490 | #define	SPR_UMMCR0		0x3a8	/* .6. User Monitor Mode Control Register 0 */ | |
| 491 | #define	SPR_USIA		0x3ab	/* .6. User Sampled Instruction Address */ | |
| 492 | #define	SPR_UMMCR1		0x3ac	/* .6. User Monitor Mode Control Register 1 */ | |
| 493 | #define	SPR_MMCR2_74XX		0x3b0	/* .6. Monitor Mode Control Register 2 */ | |
| 494 | #define	 SPR_MMCR2_74XX_THRESHMULT_32	 0x80000000 /* Multiply MMCR0 threshold by 32 */ | |
| 495 | #define	 SPR_MMCR2_74XX_THRESHMULT_2	 0x00000000 /* Multiply MMCR0 threshold by 2 */ | |
| 496 | #define	SPR_PMC5_74XX		0x3b1	/* .6. Performance Counter Register 5 */ | |
| 497 | #define	SPR_PMC6_74XX		0x3b2	/* .6. Performance Counter Register 6 */ | |
| 498 | #define	SPR_MMCR0_74XX		0x3b8	/* .6. Monitor Mode Control Register 0 */ | |
| 499 | #define	SPR_PMC1_74XX		0x3b9	/* .6. Performance Counter Register 1 */ | |
| 500 | #define	SPR_PMC2_74XX		0x3ba	/* .6. Performance Counter Register 2 */ | |
| 501 | #define	SPR_SIA			0x3bb	/* .6. Sampled Instruction Address */ | |
| 502 | #define	SPR_MMCR1_74XX		0x3bc	/* .6. Monitor Mode Control Register 2 */ | |
| 503 | ||
| 504 | #define	SPR_PMC3_74XX		0x3bd	/* .6. Performance Counter Register 3 */ | |
| 505 | #define	SPR_PMC4_74XX		0x3be	/* .6. Performance Counter Register 4 */ | |
| 506 | #define	SPR_DMISS		0x3d0	/* .68 Data TLB Miss Address Register */ | |
| 507 | #define	SPR_DCMP		0x3d1	/* .68 Data TLB Compare Register */ | |
| 508 | #define	SPR_HASH1		0x3d2	/* .68 Primary Hash Address Register */ | |
| 509 | #define	SPR_HASH2		0x3d3	/* .68 Secondary Hash Address Register */ | |
| 510 | #define	SPR_IMISS		0x3d4	/* .68 Instruction TLB Miss Address Register */ | |
| 511 | #define	SPR_TLBMISS		0x3d4	/* .6. TLB Miss Address Register */ | |
| 512 | #define	SPR_DEAR		0x03d	/* ..8 Data Exception Address Register */ | |
| 513 | #define	SPR_ICMP		0x3d5	/* .68 Instruction TLB Compare Register */ | |
| 514 | #define	SPR_PTEHI		0x3d5	/* .6. Instruction TLB Compare Register */ | |
| 515 | #define	SPR_RPA			0x3d6	/* .68 Required Physical Address Register */ | |
| 516 | #define	SPR_PTELO		0x3d6	/* .6. Required Physical Address Register */ | |
| 517 | ||
| 518 | #define	SPR_TSR			0x150	/* ..8 Timer Status Register */ | |
| 519 | #define	SPR_TCR			0x154	/* ..8 Timer Control Register */ | |
| 520 | ||
| 521 | #define	 TSR_ENW		 0x80000000 /* Enable Next Watchdog */ | |
| 522 | #define	 TSR_WIS		 0x40000000 /* Watchdog Interrupt Status */ | |
| 523 | #define	 TSR_WRS_MASK		 0x30000000 /* Watchdog Reset Status */ | |
| 524 | #define	 TSR_WRS_NONE		 0x00000000 /* No watchdog reset has occurred */ | |
| 525 | #define	 TSR_WRS_CORE		 0x10000000 /* Core reset was forced by the watchdog */ | |
| 526 | #define	 TSR_WRS_CHIP		 0x20000000 /* Chip reset was forced by the watchdog */ | |
| 527 | #define	 TSR_WRS_SYSTEM	 0x30000000 /* System reset was forced by the watchdog */ | |
| 528 | #define	 TSR_PIS		 0x08000000 /* PIT Interrupt Status */ | |
| 529 | #define	 TSR_DIS		 0x08000000 /* Decrementer Interrupt Status */ | |
| 530 | #define	 TSR_FIS		 0x04000000 /* FIT Interrupt Status */ | |
| 531 | ||
| 532 | #define	 TCR_WP_MASK		 0xc0000000 /* Watchdog Period mask */ | |
| 533 | #define	 TCR_WP_2_17		 0x00000000 /* 2**17 clocks */ | |
| 534 | #define	 TCR_WP_2_21		 0x40000000 /* 2**21 clocks */ | |
| 535 | #define	 TCR_WP_2_25		 0x80000000 /* 2**25 clocks */ | |
| 536 | #define	 TCR_WP_2_29		 0xc0000000 /* 2**29 clocks */ | |
| 537 | #define	 TCR_WRC_MASK		 0x30000000 /* Watchdog Reset Control mask */ | |
| 538 | #define	 TCR_WRC_NONE		 0x00000000 /* No watchdog reset */ | |
| 539 | #define	 TCR_WRC_CORE		 0x10000000 /* Core reset */ | |
| 540 | #define	 TCR_WRC_CHIP		 0x20000000 /* Chip reset */ | |
| 541 | #define	 TCR_WRC_SYSTEM	 0x30000000 /* System reset */ | |
| 542 | #define	 TCR_WIE		 0x08000000 /* Watchdog Interrupt Enable */ | |
| 543 | #define	 TCR_PIE		 0x04000000 /* PIT Interrupt Enable */ | |
| 544 | #define	 TCR_DIE		 0x04000000 /* Pecrementer Interrupt Enable */ | |
| 545 | #define	 TCR_FP_MASK		 0x03000000 /* FIT Period */ | |
| 546 | #define	 TCR_FP_2_9		 0x00000000 /* 2**9 clocks */ | |
| 547 | #define	 TCR_FP_2_13		 0x01000000 /* 2**13 clocks */ | |
| 548 | #define	 TCR_FP_2_17		 0x02000000 /* 2**17 clocks */ | |
| 549 | #define	 TCR_FP_2_21		 0x03000000 /* 2**21 clocks */ | |
| 550 | #define	 TCR_FIE		 0x00800000 /* FIT Interrupt Enable */ | |
| 551 | #define	 TCR_ARE		 0x00400000 /* Auto Reload Enable */ | |
| 552 | ||
| 553 | #define	SPR_HID0		0x3f0	/* ..8 Hardware Implementation Register 0 */ | |
| 554 | #define	SPR_HID1		0x3f1	/* ..8 Hardware Implementation Register 1 */ | |
| 555 | #define	SPR_HID2		0x3f3	/* ..8 Hardware Implementation Register 2 */ | |
| 556 | #define	SPR_HID4		0x3f4	/* ..8 Hardware Implementation Register 4 */ | |
| 557 | #define	SPR_HID5		0x3f6	/* ..8 Hardware Implementation Register 5 */ | |
| 558 | #define	SPR_HID6		0x3f9	/* ..8 Hardware Implementation Register 6 */ | |
| 559 | ||
| 560 | #define	SPR_CELL_TSRL		0x380	/* ... Cell BE Thread Status Register */ | |
| 561 | #define	SPR_CELL_TSCR		0x399	/* ... Cell BE Thread Switch Register */ | |
| 562 | ||
| 563 | #if defined(AIM) | |
| 564 | #define	SPR_PIR			0x3ff	/* .6. Processor Identification Register */ | |
| 565 | #elif defined(BOOKE) | |
| 566 | #define	SPR_PIR			0x11e	/* ..8 Processor Identification Register */ | |
| 567 | #endif | |
| 568 | ||
| 569 | #define	 DBCR0_EDM		 0x80000000 /* External Debug Mode */ | |
| 570 | #define	 DBCR0_IDM		 0x40000000 /* Internal Debug Mode */ | |
| 571 | #define	 DBCR0_RST_MASK	 0x30000000 /* ReSeT */ | |
| 572 | #define	 DBCR0_RST_NONE	 0x00000000 /* No action */ | |
| 573 | #define	 DBCR0_RST_CORE	 0x10000000 /* Core reset */ | |
| 574 | #define	 DBCR0_RST_CHIP	 0x20000000 /* Chip reset */ | |
| 575 | #define	 DBCR0_RST_SYSTEM	 0x30000000 /* System reset */ | |
| 576 | #define	 DBCR0_IC		 0x08000000 /* Instruction Completion debug event */ | |
| 577 | #define	 DBCR0_BT		 0x04000000 /* Branch Taken debug event */ | |
| 578 | #define	 DBCR0_EDE		 0x02000000 /* Exception Debug Event */ | |
| 579 | #define	 DBCR0_TDE		 0x01000000 /* Trap Debug Event */ | |
| 580 | #define	 DBCR0_IA1		 0x00800000 /* IAC (Instruction Address Compare) 1 debug event */ | |
| 581 | #define	 DBCR0_IA2		 0x00400000 /* IAC 2 debug event */ | |
| 582 | #define	 DBCR0_IA12		 0x00200000 /* Instruction Address Range Compare 1-2 */ | |
| 583 | #define	 DBCR0_IA12X		 0x00100000 /* IA12 eXclusive */ | |
| 584 | #define	 DBCR0_IA3		 0x00080000 /* IAC 3 debug event */ | |
| 585 | #define	 DBCR0_IA4		 0x00040000 /* IAC 4 debug event */ | |
| 586 | #define	 DBCR0_IA34		 0x00020000 /* Instruction Address Range Compare 3-4 */ | |
| 587 | #define	 DBCR0_IA34X		 0x00010000 /* IA34 eXclusive */ | |
| 588 | #define	 DBCR0_IA12T		 0x00008000 /* Instruction Address Range Compare 1-2 range Toggle */ | |
| 589 | #define	 DBCR0_IA34T		 0x00004000 /* Instruction Address Range Compare 3-4 range Toggle */ | |
| 590 | #define	 DBCR0_FT		 0x00000001 /* Freeze Timers on debug event */ | |
| 591 | ||
| 592 | #define	SPR_IABR		0x3f2	/* ..8 Instruction Address Breakpoint Register 0 */ | |
| 593 | #define	SPR_DABR		0x3f5	/* .6. Data Address Breakpoint Register */ | |
| 594 | #define	SPR_MSSCR0		0x3f6	/* .6. Memory SubSystem Control Register */ | |
| 595 | #define	 MSSCR0_SHDEN		 0x80000000 /* 0: Shared-state enable */ | |
| 596 | #define	 MSSCR0_SHDPEN3	 0x40000000 /* 1: ~SHD[01] signal enable in MEI mode */ | |
| 597 | #define	 MSSCR0_L1INTVEN	 0x38000000 /* 2-4: L1 data cache ~HIT intervention enable */ | |
| 598 | #define	 MSSCR0_L2INTVEN	 0x07000000 /* 5-7: L2 data cache ~HIT intervention enable*/ | |
| 599 | #define	 MSSCR0_DL1HWF		 0x00800000 /* 8: L1 data cache hardware flush */ | |
| 600 | #define	 MSSCR0_MBO		 0x00400000 /* 9: must be one */ | |
| 601 | #define	 MSSCR0_EMODE		 0x00200000 /* 10: MPX bus mode (read-only) */ | |
| 602 | #define	 MSSCR0_ABD		 0x00100000 /* 11: address bus driven (read-only) */ | |
| 603 | #define	 MSSCR0_MBZ		 0x000fffff /* 12-31: must be zero */ | |
| 604 | #define	 MSSCR0_L2PFE		 0x00000003 /* 30-31: L2 prefetch enable */ | |
| 605 | #define	SPR_MSSSR0		0x3f7	/* .6. Memory Subsystem Status Register (MPC745x) */ | |
| 606 | #define	 MSSSR0_L2TAG		 0x00040000 /* 13: L2 tag parity error */ | |
| 607 | #define	 MSSSR0_L2DAT		 0x00020000 /* 14: L2 data parity error */ | |
| 608 | #define	 MSSSR0_L3TAG		 0x00010000 /* 15: L3 tag parity error */ | |
| 609 | #define	 MSSSR0_L3DAT		 0x00008000 /* 16: L3 data parity error */ | |
| 610 | #define	 MSSSR0_APE		 0x00004000 /* 17: Address parity error */ | |
| 611 | #define	 MSSSR0_DPE		 0x00002000 /* 18: Data parity error */ | |
| 612 | #define	 MSSSR0_TEA		 0x00001000 /* 19: Bus transfer error acknowledge */ | |
| 613 | #define	SPR_LDSTCR		0x3f8	/* .6. Load/Store Control Register */ | |
| 614 | #define	SPR_L2PM		0x3f8	/* .6. L2 Private Memory Control Register */ | |
| 615 | #define	SPR_L2CR		0x3f9	/* .6. L2 Control Register */ | |
| 616 | #define	 L2CR_L2E		 0x80000000 /* 0: L2 enable */ | |
| 617 | #define	 L2CR_L2PE		 0x40000000 /* 1: L2 data parity enable */ | |
| 618 | #define	 L2CR_L2SIZ		 0x30000000 /* 2-3: L2 size */ | |
| 619 | #define	 L2SIZ_2M		 0x00000000 | |
| 620 | #define	 L2SIZ_256K		 0x10000000 | |
| 621 | #define	 L2SIZ_512K		 0x20000000 | |
| 622 | #define	 L2SIZ_1M		 0x30000000 | |
| 623 | #define	 L2CR_L2CLK		 0x0e000000 /* 4-6: L2 clock ratio */ | |
| 624 | #define	 L2CLK_DIS		 0x00000000 /* disable L2 clock */ | |
| 625 | #define	 L2CLK_10		 0x02000000 /* core clock / 1 */ | |
| 626 | #define	 L2CLK_15		 0x04000000 /* / 1.5 */ | |
| 627 | #define	 L2CLK_20		 0x08000000 /* / 2 */ | |
| 628 | #define	 L2CLK_25		 0x0a000000 /* / 2.5 */ | |
| 629 | #define	 L2CLK_30		 0x0c000000 /* / 3 */ | |
| 630 | #define	 L2CR_L2RAM		 0x01800000 /* 7-8: L2 RAM type */ | |
| 631 | #define	 L2RAM_FLOWTHRU_BURST	 0x00000000 | |
| 632 | #define	 L2RAM_PIPELINE_BURST	 0x01000000 | |
| 633 | #define	 L2RAM_PIPELINE_LATE	 0x01800000 | |
| 634 | #define	 L2CR_L2DO		 0x00400000 /* 9: L2 data-only. | |
| 635 | 				 Setting this bit disables instruction | |
| 636 | 				 caching. */ | |
| 637 | #define	 L2CR_L2I		 0x00200000 /* 10: L2 global invalidate. */ | |
| 638 | #define	 L2CR_L2IO_7450	 0x00010000 /* 11: L2 instruction-only (MPC745x). */ | |
| 639 | #define	 L2CR_L2CTL		 0x00100000 /* 11: L2 RAM control (ZZ enable). | |
| 640 | 				 Enables automatic operation of the | |
| 641 | 				 L2ZZ (low-power mode) signal. */ | |
| 642 | #define	 L2CR_L2WT		 0x00080000 /* 12: L2 write-through. */ | |
| 643 | #define	 L2CR_L2TS		 0x00040000 /* 13: L2 test support. */ | |
| 644 | #define	 L2CR_L2OH		 0x00030000 /* 14-15: L2 output hold. */ | |
| 645 | #define	 L2CR_L2DO_7450	 0x00010000 /* 15: L2 data-only (MPC745x). */ | |
| 646 | #define	 L2CR_L2SL		 0x00008000 /* 16: L2 DLL slow. */ | |
| 647 | #define	 L2CR_L2DF		 0x00004000 /* 17: L2 differential clock. */ | |
| 648 | #define	 L2CR_L2BYP		 0x00002000 /* 18: L2 DLL bypass. */ | |
| 649 | #define	 L2CR_L2FA		 0x00001000 /* 19: L2 flush assist (for software flush). */ | |
| 650 | #define	 L2CR_L2HWF		 0x00000800 /* 20: L2 hardware flush. */ | |
| 651 | #define	 L2CR_L2IO		 0x00000400 /* 21: L2 instruction-only. */ | |
| 652 | #define	 L2CR_L2CLKSTP		 0x00000200 /* 22: L2 clock stop. */ | |
| 653 | #define	 L2CR_L2DRO		 0x00000100 /* 23: L2DLL rollover checkstop enable. */ | |
| 654 | #define	 L2CR_L2IP		 0x00000001 /* 31: L2 global invalidate in */ | |
| 655 | 					 /* progress (read only). */ | |
| 656 | #define	SPR_L3CR		0x3fa	/* .6. L3 Control Register */ | |
| 657 | #define	 L3CR_L3E		 0x80000000 /* 0: L3 enable */ | |
| 658 | #define	 L3CR_L3PE		 0x40000000 /* 1: L3 data parity enable */ | |
| 659 | #define	 L3CR_L3APE		 0x20000000 | |
| 660 | #define	 L3CR_L3SIZ		 0x10000000 /* 3: L3 size (0=1MB, 1=2MB) */ | |
| 661 | #define	 L3CR_L3CLKEN		 0x08000000 /* 4: Enables L3_CLK[0:1] */ | |
| 662 | #define	 L3CR_L3CLK		 0x03800000 | |
| 663 | #define	 L3CR_L3IO		 0x00400000 | |
| 664 | #define	 L3CR_L3CLKEXT		 0x00200000 | |
| 665 | #define	 L3CR_L3CKSPEXT	 0x00100000 | |
| 666 | #define	 L3CR_L3OH1		 0x00080000 | |
| 667 | #define	 L3CR_L3SPO		 0x00040000 | |
| 668 | #define	 L3CR_L3CKSP		 0x00030000 | |
| 669 | #define	 L3CR_L3PSP		 0x0000e000 | |
| 670 | #define	 L3CR_L3REP		 0x00001000 | |
| 671 | #define	 L3CR_L3HWF		 0x00000800 | |
| 672 | #define	 L3CR_L3I		 0x00000400 /* 21: L3 global invalidate */ | |
| 673 | #define	 L3CR_L3RT		 0x00000300 | |
| 674 | #define	 L3CR_L3NIRCA		 0x00000080 | |
| 675 | #define	 L3CR_L3DO		 0x00000040 | |
| 676 | #define	 L3CR_PMEN		 0x00000004 | |
| 677 | #define	 L3CR_PMSIZ		 0x00000003 | |
| 678 | ||
| 679 | #define	SPR_THRM1		0x3fc	/* .6. Thermal Management Register */ | |
| 680 | #define	SPR_THRM2		0x3fd	/* .6. Thermal Management Register */ | |
| 681 | #define	 SPR_THRM_TIN		 0x80000000 /* Thermal interrupt bit (RO) */ | |
| 682 | #define	 SPR_THRM_TIV		 0x40000000 /* Thermal interrupt valid (RO) */ | |
| 683 | #define	 SPR_THRM_THRESHOLD(x)	 ((x) << 23) /* Thermal sensor threshold */ | |
| 684 | #define	 SPR_THRM_TID		 0x00000004 /* Thermal interrupt direction */ | |
| 685 | #define	 SPR_THRM_TIE		 0x00000002 /* Thermal interrupt enable */ | |
| 686 | #define	 SPR_THRM_VALID		 0x00000001 /* Valid bit */ | |
| 687 | #define	SPR_THRM3		0x3fe	/* .6. Thermal Management Register */ | |
| 688 | #define	 SPR_THRM_TIMER(x)	 ((x) << 1) /* Sampling interval timer */ | |
| 689 | #define	 SPR_THRM_ENABLE	 0x00000001 /* TAU Enable */ | |
| 690 | #define	SPR_FPECR		0x3fe	/* .6. Floating-Point Exception Cause Register */ | |
| 691 | ||
| 692 | /* Time Base Register declarations */ | |
| 693 | #define	TBR_TBL			0x10c	/* 468 Time Base Lower - read */ | |
| 694 | #define	TBR_TBU			0x10d	/* 468 Time Base Upper - read */ | |
| 695 | #define	TBR_TBWL		0x11c	/* 468 Time Base Lower - supervisor, write */ | |
| 696 | #define	TBR_TBWU		0x11d	/* 468 Time Base Upper - supervisor, write */ | |
| 697 | ||
| 698 | /* Performance counter declarations */ | |
| 699 | #define	PMC_OVERFLOW		0x80000000 /* Counter has overflowed */ | |
| 700 | ||
| 701 | /* The first five countable [non-]events are common to many PMC's */ | |
| 702 | #define	PMCN_NONE		 0 /* Count nothing */ | |
| 703 | #define	PMCN_CYCLES		 1 /* Processor cycles */ | |
| 704 | #define	PMCN_ICOMP		 2 /* Instructions completed */ | |
| 705 | #define	PMCN_TBLTRANS		 3 /* TBL bit transitions */ | |
| 706 | #define	PCMN_IDISPATCH		 4 /* Instructions dispatched */ | |
| 707 | ||
| 708 | /* Similar things for the 970 PMC direct counters */ | |
| 709 | #define	PMC970N_NONE		0x8 /* Count nothing */ | |
| 710 | #define	PMC970N_CYCLES		0xf /* Processor cycles */ | |
| 711 | #define	PMC970N_ICOMP		0x9 /* Instructions completed */ | |
| 712 | ||
| 713 | #if defined(BOOKE) | |
| 714 | ||
| 715 | #define	SPR_MCARU		0x239	/* ..8 Machine Check Address register upper bits */ | |
| 716 | #define	SPR_MCSR		0x23c	/* ..8 Machine Check Syndrome register */ | |
| 717 | #define	 MCSR_MCP		 0x80000000 /* Machine check input signal to core */ | |
| 718 | #define	 MCSR_L2MMU_MHIT	 0x08000000 /* L2 MMU simultaneous hit */ | |
| 719 | #define	 MCSR_NMI		 0x00100000 /* Non-maskable interrupt */ | |
| 720 | #define	 MCSR_MAV		 0x00080000 /* MCAR address valid */ | |
| 721 | #define	 MCSR_MEA		 0x00040000 /* MCAR effective address */ | |
| 722 | #define	 MCSR_IF		 0x00010000 /* Instruction fetch error report */ | |
| 723 | #define	 MCSR_LD		 0x00008000 /* Load instruction error report */ | |
| 724 | #define	 MCSR_ST		 0x00004000 /* Store instruction error report */ | |
| 725 | #define	 MCSR_LDG		 0x00002000 /* Guarded load instruction error report */ | |
| 726 | #define	 MCSR_TLBSYNC		 0x00000002 /* Simultaneous TLBSYNC detected */ | |
| 727 | #define	SPR_MCAR		0x23d	/* ..8 Machine Check Address register */ | |
| 728 | ||
| 729 | #define	SPR_ESR			0x003e	/* ..8 Exception Syndrome Register */ | |
| 730 | #define	 ESR_PIL		 0x08000000 /* Program interrupt - illegal */ | |
| 731 | #define	 ESR_PPR		 0x04000000 /* Program interrupt - privileged */ | |
| 732 | #define	 ESR_PTR		 0x02000000 /* Program interrupt - trap */ | |
| 733 | #define	 ESR_ST		 0x00800000 /* Store operation */ | |
| 734 | #define	 ESR_DLK		 0x00200000 /* Data storage, D cache locking */ | |
| 735 | #define	 ESR_ILK		 0x00100000 /* Data storage, I cache locking */ | |
| 736 | #define	 ESR_BO		 0x00020000 /* Data/instruction storage, byte ordering */ | |
| 737 | #define	 ESR_SPE		 0x00000080 /* SPE exception bit */ | |
| 738 | ||
| 739 | #define	SPR_CSRR0		0x03a	/* ..8 58 Critical SRR0 */ | |
| 740 | #define	SPR_CSRR1		0x03b	/* ..8 59 Critical SRR1 */ | |
| 741 | #define	SPR_MCSRR0		0x23a	/* ..8 570 Machine check SRR0 */ | |
| 742 | #define	SPR_MCSRR1		0x23b	/* ..8 571 Machine check SRR1 */ | |
| 743 | #define	SPR_DSRR0		0x23e	/* ..8 574 Debug SRR0<E.ED> */ | |
| 744 | #define	SPR_DSRR1		0x23f	/* ..8 575 Debug SRR1<E.ED> */ | |
| 745 | ||
| 746 | #define	SPR_MMUCSR0		0x3f4	/* ..8 1012 MMU Control and Status Register 0 */ | |
| 747 | #define	 MMUCSR0_L2TLB0_FI	0x04	/* TLB0 flash invalidate */ | |
| 748 | #define	 MMUCSR0_L2TLB1_FI	0x02	/* TLB1 flash invalidate */ | |
| 749 | ||
| 750 | #define	SPR_SVR			0x3ff	/* ..8 1023 System Version Register */ | |
| 751 | #define	 SVR_MPC8533		 0x8034 | |
| 752 | #define	 SVR_MPC8533E		 0x803c | |
| 753 | #define	 SVR_MPC8541		 0x8072 | |
| 754 | #define	 SVR_MPC8541E		 0x807a | |
| 755 | #define	 SVR_MPC8548		 0x8031 | |
| 756 | #define	 SVR_MPC8548E		 0x8039 | |
| 757 | #define	 SVR_MPC8555		 0x8071 | |
| 758 | #define	 SVR_MPC8555E		 0x8079 | |
| 759 | #define	 SVR_MPC8572		 0x80e0 | |
| 760 | #define	 SVR_MPC8572E		 0x80e8 | |
| 761 | #define	 SVR_P1011		 0x80e5 | |
| 762 | #define	 SVR_P1011E		 0x80ed | |
| 763 | #define	 SVR_P1013		 0x80e7 | |
| 764 | #define	 SVR_P1013E		 0x80ef | |
| 765 | #define	 SVR_P1020		 0x80e4 | |
| 766 | #define	 SVR_P1020E		 0x80ec | |
| 767 | #define	 SVR_P1022		 0x80e6 | |
| 768 | #define	 SVR_P1022E		 0x80ee | |
| 769 | #define	 SVR_P2010		 0x80e3 | |
| 770 | #define	 SVR_P2010E		 0x80eb | |
| 771 | #define	 SVR_P2020		 0x80e2 | |
| 772 | #define	 SVR_P2020E		 0x80ea | |
| 773 | #define	 SVR_P2041		 0x8210 | |
| 774 | #define	 SVR_P2041E		 0x8218 | |
| 775 | #define	 SVR_P3041		 0x8211 | |
| 776 | #define	 SVR_P3041E		 0x8219 | |
| 777 | #define	 SVR_P4040		 0x8200 | |
| 778 | #define	 SVR_P4040E		 0x8208 | |
| 779 | #define	 SVR_P4080		 0x8201 | |
| 780 | #define	 SVR_P4080E		 0x8209 | |
| 781 | #define	 SVR_P5010		 0x8221 | |
| 782 | #define	 SVR_P5010E		 0x8229 | |
| 783 | #define	 SVR_P5020		 0x8220 | |
| 784 | #define	 SVR_P5020E		 0x8228 | |
| 785 | #define	 SVR_P5021		 0x8205 | |
| 786 | #define	 SVR_P5021E		 0x820d | |
| 787 | #define	 SVR_P5040		 0x8204 | |
| 788 | #define	 SVR_P5040E		 0x820c | |
| 789 | #define	SVR_VER(svr)		(((svr) >> 16) & 0xffff) | |
| 790 | ||
| 791 | #define	SPR_PID0		0x030	/* ..8 Process ID Register 0 */ | |
| 792 | #define	SPR_PID1		0x279	/* ..8 Process ID Register 1 */ | |
| 793 | #define	SPR_PID2		0x27a	/* ..8 Process ID Register 2 */ | |
| 794 | ||
| 795 | #define	SPR_TLB0CFG		0x2B0	/* ..8 TLB 0 Config Register */ | |
| 796 | #define	SPR_TLB1CFG		0x2B1	/* ..8 TLB 1 Config Register */ | |
| 797 | #define	 TLBCFG_ASSOC_MASK	0xff000000 /* Associativity of TLB */ | |
| 798 | #define	 TLBCFG_ASSOC_SHIFT	24 | |
| 799 | #define	 TLBCFG_NENTRY_MASK	0x00000fff /* Number of entries in TLB */ | |
| 800 | ||
| 801 | #define	SPR_IVPR		0x03f	/* ..8 Interrupt Vector Prefix Register */ | |
| 802 | #define	SPR_IVOR0		0x190	/* ..8 Critical input */ | |
| 803 | #define	SPR_IVOR1		0x191	/* ..8 Machine check */ | |
| 804 | #define	SPR_IVOR2		0x192 | |
| 805 | #define	SPR_IVOR3		0x193 | |
| 806 | #define	SPR_IVOR4		0x194 | |
| 807 | #define	SPR_IVOR5		0x195 | |
| 808 | #define	SPR_IVOR6		0x196 | |
| 809 | #define	SPR_IVOR7		0x197 | |
| 810 | #define	SPR_IVOR8		0x198 | |
| 811 | #define	SPR_IVOR9		0x199 | |
| 812 | #define	SPR_IVOR10		0x19a | |
| 813 | #define	SPR_IVOR11		0x19b | |
| 814 | #define	SPR_IVOR12		0x19c | |
| 815 | #define	SPR_IVOR13		0x19d | |
| 816 | #define	SPR_IVOR14		0x19e | |
| 817 | #define	SPR_IVOR15		0x19f | |
| 818 | #define	SPR_IVOR32		0x210 | |
| 819 | #define	SPR_IVOR33		0x211 | |
| 820 | #define	SPR_IVOR34		0x212 | |
| 821 | #define	SPR_IVOR35		0x213 | |
| 822 | ||
| 823 | #define	SPR_MAS0		0x270	/* ..8 MMU Assist Register 0 Book-E/e500 */ | |
| 824 | #define	SPR_MAS1		0x271	/* ..8 MMU Assist Register 1 Book-E/e500 */ | |
| 825 | #define	SPR_MAS2		0x272	/* ..8 MMU Assist Register 2 Book-E/e500 */ | |
| 826 | #define	SPR_MAS3		0x273	/* ..8 MMU Assist Register 3 Book-E/e500 */ | |
| 827 | #define	SPR_MAS4		0x274	/* ..8 MMU Assist Register 4 Book-E/e500 */ | |
| 828 | #define	SPR_MAS5		0x275	/* ..8 MMU Assist Register 5 Book-E */ | |
| 829 | #define	SPR_MAS6		0x276	/* ..8 MMU Assist Register 6 Book-E/e500 */ | |
| 830 | #define	SPR_MAS7		0x3B0	/* ..8 MMU Assist Register 7 Book-E/e500 */ | |
| 831 | #define	SPR_MAS8		0x155	/* ..8 MMU Assist Register 8 Book-E/e500 */ | |
| 832 | ||
| 833 | #define	SPR_L1CFG0		0x203	/* ..8 L1 cache configuration register 0 */ | |
| 834 | #define	SPR_L1CFG1		0x204	/* ..8 L1 cache configuration register 1 */ | |
| 835 | ||
| 836 | #define	SPR_CCR1		0x378 | |
| 837 | #define	 CCR1_L2COBE		0x00000040 | |
| 838 | ||
| 839 | #define	DCR_L2DCDCRAI		0x0000	/* L2 D-Cache DCR Address Pointer */ | |
| 840 | #define	DCR_L2DCDCRDI		0x0001	/* L2 D-Cache DCR Data Indirect */ | |
| 841 | #define	DCR_L2CR0		0x00	/* L2 Cache Configuration Register 0 */ | |
| 842 | #define	 L2CR0_AS		0x30000000 | |
| 843 | ||
| 844 | #define	SPR_L1CSR0		0x3F2	/* ..8 L1 Cache Control and Status Register 0 */ | |
| 845 | #define	 L1CSR0_DCPE		0x00010000	/* Data Cache Parity Enable */ | |
| 846 | #define	 L1CSR0_DCLFR		0x00000100	/* Data Cache Lock Bits Flash Reset */ | |
| 847 | #define	 L1CSR0_DCFI		0x00000002	/* Data Cache Flash Invalidate */ | |
| 848 | #define	 L1CSR0_DCE		0x00000001	/* Data Cache Enable */ | |
| 849 | #define	SPR_L1CSR1		0x3F3	/* ..8 L1 Cache Control and Status Register 1 */ | |
| 850 | #define	 L1CSR1_ICPE		0x00010000	/* Instruction Cache Parity Enable */ | |
| 851 | #define	 L1CSR1_ICUL		0x00000400 /* Instr Cache Unable to Lock */ | |
| 852 | #define	 L1CSR1_ICLFR		0x00000100	/* Instruction Cache Lock Bits Flash Reset */ | |
| 853 | #define	 L1CSR1_ICFI		0x00000002	/* Instruction Cache Flash Invalidate */ | |
| 854 | #define	 L1CSR1_ICE		0x00000001	/* Instruction Cache Enable */ | |
| 855 | ||
| 856 | #define	SPR_L2CFG0		0x207	/* ..8 L2 Configuration Register 0 */ | |
| 857 | #define	SPR_L2CSR0		0x3F9	/* ..8 L2 Cache Control and Status Register 0 */ | |
| 858 | #define	 L2CSR0_L2E		0x80000000	/* L2 Cache Enable */ | |
| 859 | #define	 L2CSR0_L2PE		0x40000000	/* L2 Cache Parity Enable */ | |
| 860 | #define	 L2CSR0_L2FI		0x00200000	/* L2 Cache Flash Invalidate */ | |
| 861 | #define	 L2CSR0_L2LFC		0x00000400	/* L2 Cache Lock Flags Clear */ | |
| 862 | ||
| 863 | #define	SPR_BUCSR		0x3F5	/* ..8 Branch Unit Control and Status Register */ | |
| 864 | #define	 BUCSR_BPEN		0x00000001	/* Branch Prediction Enable */ | |
| 865 | #define	 BUCSR_BBFI		0x00000200	/* Branch Buffer Flash Invalidate */ | |
| 866 | ||
| 867 | #endif /* BOOKE */ | |
| 868 | #endif /* !_POWERPC_SPR_H_ */ | |
| \ No newline at end of file |
lib/libc/include/powerpc64-freebsd-none/machine/sr.h created+62| ... | ... | @@ -0,0 +1,62 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-2-Clause | |
| 3 | * | |
| 4 | * Copyright (C) 2002 Benno Rice. | |
| 5 | * All rights reserved. | |
| 6 | * | |
| 7 | * Redistribution and use in source and binary forms, with or without | |
| 8 | * modification, are permitted provided that the following conditions | |
| 9 | * are met: | |
| 10 | * 1. Redistributions of source code must retain the above copyright | |
| 11 | * notice, this list of conditions and the following disclaimer. | |
| 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 13 | * notice, this list of conditions and the following disclaimer in the | |
| 14 | * documentation and/or other materials provided with the distribution. | |
| 15 | * | |
| 16 | * THIS SOFTWARE IS PROVIDED BY Benno Rice ``AS IS'' AND ANY EXPRESS OR | |
| 17 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |
| 18 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | |
| 19 | * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
| 20 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | |
| 21 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; | |
| 22 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | |
| 23 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | |
| 24 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | |
| 25 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 26 | */ | |
| 27 | ||
| 28 | #ifndef _MACHINE_SR_H_ | |
| 29 | #define	_MACHINE_SR_H_ | |
| 30 | ||
| 31 | /* | |
| 32 | * Bit definitions for segment registers. | |
| 33 | * | |
| 34 | * PowerPC Microprocessor Family: The Programming Environments for 32-bit | |
| 35 | * Microprocessors, section 2.3.5 | |
| 36 | */ | |
| 37 | ||
| 38 | #define	SR_TYPE		0x80000000	/* Type selector */ | |
| 39 | #define	SR_KS		0x40000000	/* Supervisor-state protection key */ | |
| 40 | #define	SR_KP		0x20000000	/* User-state protection key */ | |
| 41 | #define	SR_N		0x10000000	/* No-execute protection */ | |
| 42 | #define	SR_VSID_MASK	0x00ffffff	/* Virtual Segment ID mask */ | |
| 43 | ||
| 44 | /* Kernel segment register usage */ | |
| 45 | #define	USER_SR		12 | |
| 46 | #define	KERNEL_SR	13 | |
| 47 | #define	KERNEL2_SR	14 | |
| 48 | #define	KERNEL3_SR	15 | |
| 49 | #define	KERNEL_VSIDBITS	0xfffffUL | |
| 50 | #define	KERNEL_SEGMENT	(0xfffff0 + KERNEL_SR) | |
| 51 | #define	KERNEL2_SEGMENT	(0xfffff0 + KERNEL2_SR) | |
| 52 | #define	EMPTY_SEGMENT	0xfffff0 | |
| 53 | #ifdef __powerpc64__ | |
| 54 | #define	USER_ADDR	0xc00ffffff0000000UL | |
| 55 | #else | |
| 56 | #define	USER_ADDR	((uintptr_t)USER_SR << ADDR_SR_SHFT) | |
| 57 | #endif | |
| 58 | #define	SEGMENT_LENGTH	0x10000000UL | |
| 59 | #define	SEGMENT_INVMASK	0x0fffffffUL | |
| 60 | #define	SEGMENT_MASK	~SEGMENT_INVMASK | |
| 61 | ||
| 62 | #endif /* !_MACHINE_SR_H_ */ | |
| \ No newline at end of file |
lib/libc/include/powerpc64-freebsd-none/machine/stack.h created+54| ... | ... | @@ -0,0 +1,54 @@ |
| 1 | /*- | |
| 2 | * Mach Operating System | |
| 3 | * Copyright (c) 1992 Carnegie Mellon University | |
| 4 | * All Rights Reserved. | |
| 5 | * | |
| 6 | * Permission to use, copy, modify and distribute this software and its | |
| 7 | * documentation is hereby granted, provided that both the copyright | |
| 8 | * notice and this permission notice appear in all copies of the | |
| 9 | * software, derivative works or modified versions, and any portions | |
| 10 | * thereof, and that both notices appear in supporting documentation. | |
| 11 | * | |
| 12 | * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" | |
| 13 | * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR | |
| 14 | * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. | |
| 15 | * | |
| 16 | * Carnegie Mellon requests users of this software to return to | |
| 17 | * | |
| 18 | * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU | |
| 19 | * School of Computer Science | |
| 20 | * Carnegie Mellon University | |
| 21 | * Pittsburgh PA 15213-3890 | |
| 22 | * | |
| 23 | * any improvements or extensions that they make and grant Carnegie Mellon | |
| 24 | * the rights to redistribute these changes. | |
| 25 | */ | |
| 26 | ||
| 27 | #ifndef _MACHINE_STACK_H_ | |
| 28 | #define	_MACHINE_STACK_H_ | |
| 29 | ||
| 30 | extern int trapexit[]; | |
| 31 | extern int asttrapexit[]; | |
| 32 | extern int end[]; | |
| 33 | ||
| 34 | #ifdef _SYS_PROC_H_ | |
| 35 | ||
| 36 | #include <machine/pcb.h> | |
| 37 | ||
| 38 | /* Get the current kernel thread stack usage. */ | |
| 39 | #define	GET_STACK_USAGE(total, used) do {				\ | |
| 40 | 	struct thread *td = curthread;					\ | |
| 41 | 	(total) = td->td_kstack_pages * PAGE_SIZE - sizeof(struct pcb);	\ | |
| 42 | 	(used) = td->td_kstack + (total) - (vm_offset_t)&td;		\ | |
| 43 | } while (0) | |
| 44 | ||
| 45 | static __inline bool | |
| 46 | kstack_contains(struct thread *td, vm_offset_t va, size_t len) | |
| 47 | { | |
| 48 | 	return (va >= td->td_kstack && va + len >= va && | |
| 49 | 	 va + len <= td->td_kstack + td->td_kstack_pages * PAGE_SIZE - | |
| 50 | 	 sizeof(struct pcb)); | |
| 51 | } | |
| 52 | #endif	/* _SYS_PROC_H_ */ | |
| 53 | ||
| 54 | #endif /* !_MACHINE_STACK_H_ */ | |
| \ No newline at end of file |
lib/libc/include/powerpc64-freebsd-none/machine/sysarch.h created+43| ... | ... | @@ -0,0 +1,43 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-3-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 1993 The Regents of the University of California. | |
| 5 | * All rights reserved. | |
| 6 | * | |
| 7 | * Redistribution and use in source and binary forms, with or without | |
| 8 | * modification, are permitted provided that the following conditions | |
| 9 | * are met: | |
| 10 | * 1. Redistributions of source code must retain the above copyright | |
| 11 | * notice, this list of conditions and the following disclaimer. | |
| 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 13 | * notice, this list of conditions and the following disclaimer in the | |
| 14 | * documentation and/or other materials provided with the distribution. | |
| 15 | * 3. Neither the name of the University nor the names of its contributors | |
| 16 | * may be used to endorse or promote products derived from this software | |
| 17 | * without specific prior written permission. | |
| 18 | * | |
| 19 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | |
| 20 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 21 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
| 22 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
| 23 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
| 24 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
| 25 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
| 26 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
| 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
| 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
| 29 | * SUCH DAMAGE. | |
| 30 | */ | |
| 31 | ||
| 32 | #ifndef _MACHINE_SYSARCH_H_ | |
| 33 | #define	_MACHINE_SYSARCH_H_ | |
| 34 | ||
| 35 | #ifndef _KERNEL | |
| 36 | #include <sys/cdefs.h> | |
| 37 | ||
| 38 | __BEGIN_DECLS | |
| 39 | int	sysarch(int, void *); | |
| 40 | __END_DECLS | |
| 41 | #endif | |
| 42 | ||
| 43 | #endif /* !_MACHINE_SYSARCH_H_ */ | |
| \ No newline at end of file |
lib/libc/include/powerpc64-freebsd-none/machine/tlb.h created+181| ... | ... | @@ -0,0 +1,181 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-3-Clause | |
| 3 | * | |
| 4 | * Copyright (C) 2006-2012 Semihalf. | |
| 5 | * All rights reserved. | |
| 6 | * | |
| 7 | * Redistribution and use in source and binary forms, with or without | |
| 8 | * modification, are permitted provided that the following conditions | |
| 9 | * are met: | |
| 10 | * 1. Redistributions of source code must retain the above copyright | |
| 11 | * notice, this list of conditions and the following disclaimer. | |
| 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 13 | * notice, this list of conditions and the following disclaimer in the | |
| 14 | * documentation and/or other materials provided with the distribution. | |
| 15 | * 3. The name of the author may not be used to endorse or promote products | |
| 16 | * derived from this software without specific prior written permission. | |
| 17 | * | |
| 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | |
| 19 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |
| 20 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN | |
| 21 | * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
| 22 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED | |
| 23 | * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | |
| 24 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF | |
| 25 | * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | |
| 26 | * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | |
| 27 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 28 | */ | |
| 29 | ||
| 30 | #ifndef	_MACHINE_TLB_H_ | |
| 31 | #define	_MACHINE_TLB_H_ | |
| 32 | ||
| 33 | #if defined(BOOKE_E500) | |
| 34 | ||
| 35 | /* PowerPC E500 MAS registers */ | |
| 36 | #define MAS0_TLBSEL(x)		((x << 28) & 0x10000000) | |
| 37 | #define MAS0_ESEL(x)		((x << 16) & 0x003F0000) | |
| 38 | ||
| 39 | #define MAS0_TLBSEL1		0x10000000 | |
| 40 | #define MAS0_TLBSEL0		0x00000000 | |
| 41 | #define MAS0_ESEL_TLB1MASK	0x000F0000 | |
| 42 | #define MAS0_ESEL_TLB0MASK	0x00030000 | |
| 43 | #define MAS0_ESEL_SHIFT		16 | |
| 44 | #define MAS0_NV_MASK		0x00000003 | |
| 45 | #define MAS0_NV_SHIFT		0 | |
| 46 | ||
| 47 | #define MAS1_VALID		0x80000000 | |
| 48 | #define MAS1_IPROT		0x40000000 | |
| 49 | #define MAS1_TID_MASK		0x00FF0000 | |
| 50 | #define MAS1_TID_SHIFT		16 | |
| 51 | #define MAS1_TS_MASK		0x00001000 | |
| 52 | #define MAS1_TS_SHIFT		12 | |
| 53 | #define MAS1_TSIZE_MASK		0x00000F00 | |
| 54 | #define MAS1_TSIZE_SHIFT	8 | |
| 55 | ||
| 56 | #define	TLB_SIZE_4K		1 | |
| 57 | #define	TLB_SIZE_16K		2 | |
| 58 | #define	TLB_SIZE_64K		3 | |
| 59 | #define	TLB_SIZE_256K		4 | |
| 60 | #define	TLB_SIZE_1M		5 | |
| 61 | #define	TLB_SIZE_4M		6 | |
| 62 | #define	TLB_SIZE_16M		7 | |
| 63 | #define	TLB_SIZE_64M		8 | |
| 64 | #define	TLB_SIZE_256M		9 | |
| 65 | #define	TLB_SIZE_1G		10 | |
| 66 | #define	TLB_SIZE_4G		11 | |
| 67 | ||
| 68 | #ifdef __powerpc64__ | |
| 69 | #define	MAS2_EPN_MASK		0xFFFFFFFFFFFFF000UL | |
| 70 | #else | |
| 71 | #define	MAS2_EPN_MASK		0xFFFFF000 | |
| 72 | #endif | |
| 73 | #define	MAS2_EPN_SHIFT		12 | |
| 74 | #define	MAS2_X0			0x00000040 | |
| 75 | #define	MAS2_X1			0x00000020 | |
| 76 | #define	MAS2_W			0x00000010 | |
| 77 | #define	MAS2_I			0x00000008 | |
| 78 | #define	MAS2_M			0x00000004 | |
| 79 | #define	MAS2_G			0x00000002 | |
| 80 | #define	MAS2_E			0x00000001 | |
| 81 | #define	MAS2_WIMGE_MASK		0x0000007F | |
| 82 | ||
| 83 | #define	MAS3_RPN		0xFFFFF000 | |
| 84 | #define	MAS3_RPN_SHIFT		12 | |
| 85 | #define	MAS3_U0			0x00000200 | |
| 86 | #define	MAS3_U1			0x00000100 | |
| 87 | #define	MAS3_U2			0x00000080 | |
| 88 | #define	MAS3_U3			0x00000040 | |
| 89 | #define	MAS3_UX			0x00000020 | |
| 90 | #define	MAS3_SX			0x00000010 | |
| 91 | #define	MAS3_UW			0x00000008 | |
| 92 | #define	MAS3_SW			0x00000004 | |
| 93 | #define	MAS3_UR			0x00000002 | |
| 94 | #define	MAS3_SR			0x00000001 | |
| 95 | ||
| 96 | #define MAS4_TLBSELD1		0x10000000 | |
| 97 | #define MAS4_TLBSELD0		0x00000000 | |
| 98 | #define MAS4_TIDSELD_MASK	0x00030000 | |
| 99 | #define MAS4_TIDSELD_SHIFT	16 | |
| 100 | #define MAS4_TSIZED_MASK	0x00000F00 | |
| 101 | #define MAS4_TSIZED_SHIFT	8 | |
| 102 | #define MAS4_X0D		0x00000040 | |
| 103 | #define MAS4_X1D		0x00000020 | |
| 104 | #define MAS4_WD			0x00000010 | |
| 105 | #define MAS4_ID			0x00000008 | |
| 106 | #define MAS4_MD			0x00000004 | |
| 107 | #define MAS4_GD			0x00000002 | |
| 108 | #define MAS4_ED			0x00000001 | |
| 109 | ||
| 110 | #define MAS6_SPID0_MASK		0x00FF0000 | |
| 111 | #define MAS6_SPID0_SHIFT	16 | |
| 112 | #define MAS6_SAS		0x00000001 | |
| 113 | ||
| 114 | #define MAS7_RPN		0x0000000F | |
| 115 | ||
| 116 | #define MAS1_GETTID(mas1)	(((mas1) & MAS1_TID_MASK) >> MAS1_TID_SHIFT) | |
| 117 | ||
| 118 | #define MAS2_TLB0_ENTRY_IDX_MASK	0x0007f000 | |
| 119 | #define MAS2_TLB0_ENTRY_IDX_SHIFT	12 | |
| 120 | ||
| 121 | /* | |
| 122 | * Maximum number of TLB1 entries used for a permanent mapping of kernel | |
| 123 | * region (kernel image plus statically allocated data). | |
| 124 | */ | |
| 125 | #define KERNEL_REGION_MAX_TLB_ENTRIES 4 | |
| 126 | ||
| 127 | /* | |
| 128 | * Use MAS2_X0 to mark entries which will be copied | |
| 129 | * to AP CPUs during SMP bootstrap. As result entries | |
| 130 | * marked with _TLB_ENTRY_SHARED will be shared by all CPUs. | |
| 131 | */ | |
| 132 | #define _TLB_ENTRY_SHARED	(MAS2_X0)	/* XXX under SMP? */ | |
| 133 | #define _TLB_ENTRY_IO	(MAS2_I | MAS2_G) | |
| 134 | #define _TLB_ENTRY_MEM	(MAS2_M) | |
| 135 | ||
| 136 | #define TLB1_MAX_ENTRIES	64 | |
| 137 | ||
| 138 | #if !defined(LOCORE) | |
| 139 | typedef struct tlb_entry { | |
| 140 | 	vm_paddr_t phys; | |
| 141 | 	vm_offset_t virt; | |
| 142 | 	vm_size_t size; | |
| 143 | 	uint32_t mas1; | |
| 144 | #ifdef __powerpc64__ | |
| 145 | 	uint64_t mas2; | |
| 146 | #else | |
| 147 | 	uint32_t mas2; | |
| 148 | #endif | |
| 149 | 	uint32_t mas3; | |
| 150 | 	uint32_t mas7; | |
| 151 | } tlb_entry_t; | |
| 152 | ||
| 153 | void tlb1_inval_entry(unsigned int); | |
| 154 | void tlb1_init(void); | |
| 155 | #endif /* !LOCORE */ | |
| 156 | ||
| 157 | #endif /* BOOKE_E500 */ | |
| 158 | ||
| 159 | #define TID_KERNEL	0	/* TLB TID to use for kernel (shared) translations */ | |
| 160 | #define TID_KRESERVED	1	/* Number of TIDs reserved for kernel */ | |
| 161 | #define TID_URESERVED	0	/* Number of TIDs reserved for user */ | |
| 162 | #define TID_MIN		(TID_KRESERVED + TID_URESERVED) | |
| 163 | #define TID_MAX		255 | |
| 164 | #define TID_NONE	-1 | |
| 165 | ||
| 166 | #define TLB_UNLOCKED	0 | |
| 167 | ||
| 168 | #if !defined(LOCORE) | |
| 169 | ||
| 170 | typedef int tlbtid_t; | |
| 171 | ||
| 172 | struct pmap; | |
| 173 | ||
| 174 | void tlb_lock(uintptr_t *); | |
| 175 | void tlb_unlock(uintptr_t *); | |
| 176 | void tlb1_ap_prep(void); | |
| 177 | int tlb1_set_entry(vm_offset_t, vm_paddr_t, vm_size_t, uint32_t); | |
| 178 | ||
| 179 | #endif /* !LOCORE */ | |
| 180 | ||
| 181 | #endif	/* _MACHINE_TLB_H_ */ | |
| \ No newline at end of file |
lib/libc/include/powerpc64-freebsd-none/machine/tls.h created+66| ... | ... | @@ -0,0 +1,66 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-3-Clause | |
| 3 | * | |
| 4 | * Copyright 2004 by Peter Grehan. All rights reserved. | |
| 5 | * | |
| 6 | * Redistribution and use in source and binary forms, with or without | |
| 7 | * modification, are permitted provided that the following conditions | |
| 8 | * are met: | |
| 9 | * 1. Redistributions of source code must retain the above copyright | |
| 10 | * notice, this list of conditions and the following disclaimer. | |
| 11 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 12 | * notice, this list of conditions and the following disclaimer in the | |
| 13 | * documentation and/or other materials provided with the distribution. | |
| 14 | * 3. The name of the author may not be used to endorse or promote products | |
| 15 | * derived from this software without specific prior written permission. | |
| 16 | * | |
| 17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | |
| 18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |
| 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | |
| 20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | |
| 21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, | |
| 22 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | |
| 23 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED | |
| 24 | * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | |
| 25 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
| 26 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
| 27 | * SUCH DAMAGE. | |
| 28 | */ | |
| 29 | ||
| 30 | #ifndef _MACHINE_TLS_H_ | |
| 31 | #define	_MACHINE_TLS_H_ | |
| 32 | ||
| 33 | #include <sys/_tls_variant_i.h> | |
| 34 | ||
| 35 | #define	TLS_DTV_OFFSET	0x8000 | |
| 36 | #define	TLS_TCB_ALIGN	TLS_TCB_SIZE | |
| 37 | #define	TLS_TP_OFFSET	0x7000 | |
| 38 | ||
| 39 | static __inline void | |
| 40 | _tcb_set(struct tcb *tcb) | |
| 41 | { | |
| 42 | #ifdef __powerpc64__ | |
| 43 | 	__asm __volatile("mr 13,%0" :: | |
| 44 | 	 "r" ((uint8_t *)tcb + TLS_TP_OFFSET + TLS_TCB_SIZE)); | |
| 45 | #else | |
| 46 | 	__asm __volatile("mr 2,%0" :: | |
| 47 | 	 "r" ((uint8_t *)tcb + TLS_TP_OFFSET + TLS_TCB_SIZE)); | |
| 48 | #endif | |
| 49 | } | |
| 50 | ||
| 51 | static __inline struct tcb * | |
| 52 | _tcb_get(void) | |
| 53 | { | |
| 54 | 	struct tcb *tcb; | |
| 55 | ||
| 56 | #ifdef __powerpc64__ | |
| 57 | 	__asm __volatile("addi %0,13,%1" : "=r" (tcb) : | |
| 58 | 	 "i" (-(TLS_TP_OFFSET + TLS_TCB_SIZE))); | |
| 59 | #else | |
| 60 | 	__asm __volatile("addi %0,2,%1" : "=r" (tcb) : | |
| 61 | 	 "i" (-(TLS_TP_OFFSET + TLS_TCB_SIZE))); | |
| 62 | #endif | |
| 63 | 	return (tcb); | |
| 64 | } | |
| 65 | ||
| 66 | #endif /* !_MACHINE_TLS_H_ */ | |
| \ No newline at end of file |
lib/libc/include/powerpc64-freebsd-none/machine/trap.h created+160| ... | ... | @@ -0,0 +1,160 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-4-Clause | |
| 3 | * | |
| 4 | * Copyright (C) 1995, 1996 Wolfgang Solfrank. | |
| 5 | * Copyright (C) 1995, 1996 TooLs GmbH. | |
| 6 | * All rights reserved. | |
| 7 | * | |
| 8 | * Redistribution and use in source and binary forms, with or without | |
| 9 | * modification, are permitted provided that the following conditions | |
| 10 | * are met: | |
| 11 | * 1. Redistributions of source code must retain the above copyright | |
| 12 | * notice, this list of conditions and the following disclaimer. | |
| 13 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 14 | * notice, this list of conditions and the following disclaimer in the | |
| 15 | * documentation and/or other materials provided with the distribution. | |
| 16 | * 3. All advertising materials mentioning features or use of this software | |
| 17 | * must display the following acknowledgement: | |
| 18 | *	This product includes software developed by TooLs GmbH. | |
| 19 | * 4. The name of TooLs GmbH may not be used to endorse or promote products | |
| 20 | * derived from this software without specific prior written permission. | |
| 21 | * | |
| 22 | * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR | |
| 23 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |
| 24 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | |
| 25 | * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
| 26 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | |
| 27 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; | |
| 28 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | |
| 29 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | |
| 30 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | |
| 31 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 32 | * | |
| 33 | * $NetBSD: trap.h,v 1.7 2002/02/22 13:51:40 kleink Exp $ | |
| 34 | */ | |
| 35 | ||
| 36 | #ifndef	_POWERPC_TRAP_H_ | |
| 37 | #define	_POWERPC_TRAP_H_ | |
| 38 | ||
| 39 | #define	EXC_RSVD	0x0000		/* Reserved */ | |
| 40 | #define	EXC_RST		0x0100		/* Reset; all but IBM4xx */ | |
| 41 | #define	EXC_MCHK	0x0200		/* Machine Check */ | |
| 42 | #define	EXC_DSI		0x0300		/* Data Storage Interrupt */ | |
| 43 | #define	EXC_DSE		0x0380		/* Data Segment Interrupt */ | |
| 44 | #define	EXC_ISI		0x0400		/* Instruction Storage Interrupt */ | |
| 45 | #define	EXC_ISE		0x0480		/* Instruction Segment Interrupt */ | |
| 46 | #define	EXC_EXI		0x0500		/* External Interrupt */ | |
| 47 | #define	EXC_ALI		0x0600		/* Alignment Interrupt */ | |
| 48 | #define	EXC_PGM		0x0700		/* Program Interrupt */ | |
| 49 | #define	EXC_FPU		0x0800		/* Floating-point Unavailable */ | |
| 50 | #define	EXC_DECR	0x0900		/* Decrementer Interrupt */ | |
| 51 | #define	EXC_SC		0x0c00		/* System Call */ | |
| 52 | #define	EXC_TRC		0x0d00		/* Trace */ | |
| 53 | #define	EXC_FPA		0x0e00		/* Floating-point Assist */ | |
| 54 | ||
| 55 | /* The following is only available on the 601: */ | |
| 56 | #define	EXC_RUNMODETRC	0x2000		/* Run Mode/Trace Exception */ | |
| 57 | ||
| 58 | /* The following are only available on 970(G5): */ | |
| 59 | #define	EXC_VECAST_G5	0x1700		/* AltiVec Assist */ | |
| 60 | ||
| 61 | /* The following are only available on 7400(G4): */ | |
| 62 | #define	EXC_VEC		0x0f20		/* AltiVec Unavailable */ | |
| 63 | #define	EXC_VECAST_G4	0x1600		/* AltiVec Assist */ | |
| 64 | ||
| 65 | /* The following are only available on 604/750/7400: */ | |
| 66 | #define	EXC_PERF	0x0f00		/* Performance Monitoring */ | |
| 67 | #define	EXC_BPT		0x1300		/* Instruction Breakpoint */ | |
| 68 | #define	EXC_SMI		0x1400		/* System Managment Interrupt */ | |
| 69 | ||
| 70 | /* The following are only available on 750/7400: */ | |
| 71 | #define	EXC_THRM	0x1700		/* Thermal Management Interrupt */ | |
| 72 | ||
| 73 | /* And these are only on the 603: */ | |
| 74 | #define	EXC_IMISS	0x1000		/* Instruction translation miss */ | |
| 75 | #define	EXC_DLMISS	0x1100		/* Data load translation miss */ | |
| 76 | #define	EXC_DSMISS	0x1200		/* Data store translation miss */ | |
| 77 | ||
| 78 | /* Power ISA 2.06+: */ | |
| 79 | #define	EXC_HDSI	0x0e00		/* Hypervisor Data Storage */ | |
| 80 | #define	EXC_HISI	0x0e20		/* Hypervisor Instruction Storage */ | |
| 81 | #define	EXC_HEA		0x0e40		/* Hypervisor Emulation Assistance */ | |
| 82 | #define	EXC_HMI		0x0e60		/* Hypervisor Maintenance */ | |
| 83 | #define	EXC_VSX		0x0f40		/* VSX Unavailable */ | |
| 84 | ||
| 85 | /* Power ISA 2.07+: */ | |
| 86 | #define	EXC_FAC		0x0f60		/* Facility Unavailable */ | |
| 87 | #define	EXC_HFAC	0x0f80		/* Hypervisor Facility Unavailable */ | |
| 88 | ||
| 89 | /* Power ISA 3.0+: */ | |
| 90 | #define	EXC_HVI		0x0ea0		/* Hypervisor Virtualization */ | |
| 91 | ||
| 92 | /* The following are available on 4xx and 85xx */ | |
| 93 | #define	EXC_CRIT	0x0100		/* Critical Input Interrupt */ | |
| 94 | #define	EXC_PIT		0x1000		/* Programmable Interval Timer */ | |
| 95 | #define	EXC_FIT		0x1010		/* Fixed Interval Timer */ | |
| 96 | #define	EXC_WDOG	0x1020		/* Watchdog Timer */ | |
| 97 | #define	EXC_DTMISS	0x1100		/* Data TLB Miss */ | |
| 98 | #define	EXC_ITMISS	0x1200		/* Instruction TLB Miss */ | |
| 99 | #define	EXC_APU		0x1300		/* Auxiliary Processing Unit */ | |
| 100 | #define	EXC_DEBUG	0x2f10		/* Debug trap */ | |
| 101 | #define	EXC_VECAST_E	0x2f20		/* Altivec Assist (Book-E) */ | |
| 102 | #define	EXC_SPFPD	0x2f30		/* SPE Floating-point Data */ | |
| 103 | #define	EXC_SPFPR	0x2f40		/* SPE Floating-point Round */ | |
| 104 | ||
| 105 | /* POWER8 */ | |
| 106 | #define EXC_SOFT_PATCH	0x1500		/* POWER8 Soft Patch Exception */ | |
| 107 | ||
| 108 | #define	EXC_LAST	0x2f00		/* Last possible exception vector */ | |
| 109 | ||
| 110 | #define	EXC_AST		0x3000		/* Fake AST vector */ | |
| 111 | ||
| 112 | /* Trap was in user mode */ | |
| 113 | #define	EXC_USER	0x10000 | |
| 114 | ||
| 115 | /* | |
| 116 | * EXC_ALI sets bits in the DSISR and DAR to provide enough | |
| 117 | * information to recover from the unaligned access without needing to | |
| 118 | * parse the offending instruction. This includes certain bits of the | |
| 119 | * opcode, and information about what registers are used. The opcode | |
| 120 | * indicator values below come from Appendix F of Book III of "The | |
| 121 | * PowerPC Architecture". | |
| 122 | */ | |
| 123 | ||
| 124 | #define EXC_ALI_OPCODE_INDICATOR(dsisr) ((dsisr >> 10) & 0x7f) | |
| 125 | #define EXC_ALI_LFD	0x09 | |
| 126 | #define EXC_ALI_STFD	0x0b | |
| 127 | ||
| 128 | /* Macros to extract register information */ | |
| 129 | #define EXC_ALI_RST(dsisr) ((dsisr >> 5) & 0x1f) /* source or target */ | |
| 130 | #define EXC_ALI_RA(dsisr) (dsisr & 0x1f) | |
| 131 | #define	EXC_ALI_INST_RST(instr)	((instr >> 21) & 0x1f) | |
| 132 | ||
| 133 | /* | |
| 134 | * SRR1 bits for program exception traps. These identify what caused | |
| 135 | * the program exception. See section 6.5.9 of the Power ISA Version | |
| 136 | * 2.05. | |
| 137 | */ | |
| 138 | ||
| 139 | #define	EXC_PGM_FPENABLED	(1UL << 20) | |
| 140 | #define	EXC_PGM_ILLEGAL		(1UL << 19) | |
| 141 | #define	EXC_PGM_PRIV		(1UL << 18) | |
| 142 | #define	EXC_PGM_TRAP		(1UL << 17) | |
| 143 | ||
| 144 | /* DTrace trap opcode. */ | |
| 145 | #define EXC_DTRACE	0x7ffff808 | |
| 146 | ||
| 147 | /* Magic pointer to store TOC base and other info for trap handlers on ppc64 */ | |
| 148 | #define	TRAP_ENTRY	0x1e8 | |
| 149 | #define	TRAP_GENTRAP	0x1f0 | |
| 150 | #define	TRAP_TOCBASE	0x1f8 | |
| 151 | ||
| 152 | #ifndef LOCORE | |
| 153 | struct	trapframe; | |
| 154 | struct	thread; | |
| 155 | extern int	(*hmi_handler)(struct trapframe *); | |
| 156 | void trap(struct trapframe *); | |
| 157 | int	ppc_instr_emulate(struct trapframe *, struct thread *); | |
| 158 | #endif | |
| 159 | ||
| 160 | #endif	/* _POWERPC_TRAP_H_ */ | |
| \ No newline at end of file |
lib/libc/include/powerpc64-freebsd-none/machine/ucontext.h created+93| ... | ... | @@ -0,0 +1,93 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-4-Clause | |
| 3 | * | |
| 4 | * Copyright (C) 1995, 1996 Wolfgang Solfrank. | |
| 5 | * Copyright (C) 1995, 1996 TooLs GmbH. | |
| 6 | * All rights reserved. | |
| 7 | * | |
| 8 | * Redistribution and use in source and binary forms, with or without | |
| 9 | * modification, are permitted provided that the following conditions | |
| 10 | * are met: | |
| 11 | * 1. Redistributions of source code must retain the above copyright | |
| 12 | * notice, this list of conditions and the following disclaimer. | |
| 13 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 14 | * notice, this list of conditions and the following disclaimer in the | |
| 15 | * documentation and/or other materials provided with the distribution. | |
| 16 | * 3. All advertising materials mentioning features or use of this software | |
| 17 | * must display the following acknowledgement: | |
| 18 | *	This product includes software developed by TooLs GmbH. | |
| 19 | * 4. The name of TooLs GmbH may not be used to endorse or promote products | |
| 20 | * derived from this software without specific prior written permission. | |
| 21 | * | |
| 22 | * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR | |
| 23 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |
| 24 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | |
| 25 | * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
| 26 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | |
| 27 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; | |
| 28 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | |
| 29 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | |
| 30 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | |
| 31 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 32 | * | |
| 33 | * $NetBSD: signal.h,v 1.4 1998/09/14 02:48:34 thorpej Exp $ | |
| 34 | */ | |
| 35 | ||
| 36 | #ifndef	_MACHINE_UCONTEXT_H_ | |
| 37 | #define	_MACHINE_UCONTEXT_H_ | |
| 38 | ||
| 39 | typedef struct __mcontext { | |
| 40 | 	int		mc_vers; | |
| 41 | 	int		mc_flags; | |
| 42 | #define _MC_FP_VALID	0x01 | |
| 43 | #define _MC_AV_VALID	0x02 | |
| 44 | #define _MC_VS_VALID	0x04 | |
| 45 | 	int		mc_onstack;	 	/* saved onstack flag */ | |
| 46 | 	int		mc_len;			/* sizeof(__mcontext) */ | |
| 47 | 	__uint64_t	mc_avec[32*2];		/* vector register file */ | |
| 48 | 	__uint32_t	mc_av[2]; | |
| 49 | 	__register_t	mc_frame[42]; | |
| 50 | 	__uint64_t	mc_fpreg[33]; | |
| 51 | 	__uint64_t	mc_vsxfpreg[32];	/* low-order half of VSR0-31 */ | |
| 52 | } mcontext_t __aligned(16); | |
| 53 | ||
| 54 | #if defined(_KERNEL) && defined(__powerpc64__) | |
| 55 | typedef struct __mcontext32 { | |
| 56 | 	int		mc_vers; | |
| 57 | 	int		mc_flags; | |
| 58 | #define _MC_FP_VALID	0x01 | |
| 59 | #define _MC_AV_VALID	0x02 | |
| 60 | #define _MC_VS_VALID	0x04 | |
| 61 | 	int		mc_onstack;	 	/* saved onstack flag */ | |
| 62 | 	int		mc_len;			/* sizeof(__mcontext) */ | |
| 63 | 	uint64_t	mc_avec[32*2];		/* vector register file */ | |
| 64 | 	uint32_t	mc_av[2]; | |
| 65 | 	uint32_t	mc_frame[42]; | |
| 66 | 	uint64_t	mc_fpreg[33]; | |
| 67 | 	uint64_t	mc_vsxfpreg[32];	/* low-order half of VSR0-31 */ | |
| 68 | } mcontext32_t __aligned(16); | |
| 69 | #endif | |
| 70 | ||
| 71 | /* GPRs and supervisor-level regs */ | |
| 72 | #define mc_gpr		mc_frame | |
| 73 | #define mc_lr		mc_frame[32] | |
| 74 | #define mc_cr		mc_frame[33] | |
| 75 | #define mc_xer		mc_frame[34] | |
| 76 | #define	mc_ctr		mc_frame[35] | |
| 77 | #define mc_srr0		mc_frame[36] | |
| 78 | #define mc_srr1		mc_frame[37] | |
| 79 | #define mc_exc		mc_frame[38] | |
| 80 | #define mc_dar		mc_frame[39] | |
| 81 | #define mc_dsisr	mc_frame[40] | |
| 82 | ||
| 83 | /* floating-point state */ | |
| 84 | #define mc_fpscr	mc_fpreg[32] | |
| 85 | ||
| 86 | /* altivec state */ | |
| 87 | #define mc_vscr		mc_av[0] | |
| 88 | #define mc_vrsave	mc_av[1] | |
| 89 | ||
| 90 | #define _MC_VERSION	0x1 | |
| 91 | #define _MC_VERSION_KSE 0xee	/* partial ucontext for libpthread */ | |
| 92 | ||
| 93 | #endif	/* !_MACHINE_UCONTEXT_H_ */ | |
| \ No newline at end of file |
lib/libc/include/powerpc64-freebsd-none/machine/vdso.h created+43| ... | ... | @@ -0,0 +1,43 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-2-Clause | |
| 3 | * | |
| 4 | * Copyright 2012 Konstantin Belousov <kib@FreeBSD.ORG>. | |
| 5 | * All rights reserved. | |
| 6 | * | |
| 7 | * Redistribution and use in source and binary forms, with or without | |
| 8 | * modification, are permitted provided that the following conditions | |
| 9 | * are met: | |
| 10 | * 1. Redistributions of source code must retain the above copyright | |
| 11 | * notice, this list of conditions and the following disclaimer. | |
| 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 13 | * notice, this list of conditions and the following disclaimer in the | |
| 14 | * documentation and/or other materials provided with the distribution. | |
| 15 | * | |
| 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR | |
| 17 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |
| 18 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | |
| 19 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, | |
| 20 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT | |
| 21 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | |
| 22 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | |
| 23 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | |
| 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | |
| 25 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 26 | */ | |
| 27 | ||
| 28 | #ifndef _POWERPC_VDSO_H | |
| 29 | #define	_POWERPC_VDSO_H | |
| 30 | ||
| 31 | #define	VDSO_TIMEHANDS_MD			\ | |
| 32 | 	uint32_t	th_res[8]; | |
| 33 | ||
| 34 | #define	VDSO_TH_ALGO_PPC_TB	VDSO_TH_ALGO_1 | |
| 35 | ||
| 36 | #ifdef _KERNEL | |
| 37 | #ifdef COMPAT_FREEBSD32 | |
| 38 | ||
| 39 | #define	VDSO_TIMEHANDS_MD32	VDSO_TIMEHANDS_MD | |
| 40 | ||
| 41 | #endif | |
| 42 | #endif | |
| 43 | #endif | |
| \ No newline at end of file |
lib/libc/include/powerpc64-freebsd-none/machine/vm.h created+45| ... | ... | @@ -0,0 +1,45 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-2-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 2009 Alan L. Cox <alc@cs.rice.edu> | |
| 5 | * All rights reserved. | |
| 6 | * | |
| 7 | * Redistribution and use in source and binary forms, with or without | |
| 8 | * modification, are permitted provided that the following conditions | |
| 9 | * are met: | |
| 10 | * 1. Redistributions of source code must retain the above copyright | |
| 11 | * notice, this list of conditions and the following disclaimer. | |
| 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 13 | * notice, this list of conditions and the following disclaimer in the | |
| 14 | * documentation and/or other materials provided with the distribution. | |
| 15 | * | |
| 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |
| 17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
| 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | |
| 20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
| 21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
| 22 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
| 23 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
| 24 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
| 25 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
| 26 | * SUCH DAMAGE. | |
| 27 | */ | |
| 28 | ||
| 29 | #ifndef _MACHINE_VM_H_ | |
| 30 | #define	_MACHINE_VM_H_ | |
| 31 | ||
| 32 | #include <machine/pte.h> | |
| 33 | ||
| 34 | /* Memory attributes. */ | |
| 35 | #define	VM_MEMATTR_DEFAULT		0 | |
| 36 | #define	VM_MEMATTR_UNCACHEABLE		0x01 | |
| 37 | #define	VM_MEMATTR_CACHEABLE		0x02 | |
| 38 | #define	VM_MEMATTR_WRITE_COMBINING	0x04 | |
| 39 | #define	VM_MEMATTR_WRITE_BACK		0x08 | |
| 40 | #define	VM_MEMATTR_WRITE_THROUGH	0x10 | |
| 41 | #define	VM_MEMATTR_PREFETCHABLE		0x20 | |
| 42 | ||
| 43 | #define	VM_MEMATTR_DEVICE		VM_MEMATTR_DEFAULT | |
| 44 | ||
| 45 | #endif /* !_MACHINE_VM_H_ */ | |
| \ No newline at end of file |
lib/libc/include/powerpc64-freebsd-none/machine/vmparam.h created+327| ... | ... | @@ -0,0 +1,327 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-4-Clause | |
| 3 | * | |
| 4 | * Copyright (C) 1995, 1996 Wolfgang Solfrank. | |
| 5 | * Copyright (C) 1995, 1996 TooLs GmbH. | |
| 6 | * All rights reserved. | |
| 7 | * | |
| 8 | * Redistribution and use in source and binary forms, with or without | |
| 9 | * modification, are permitted provided that the following conditions | |
| 10 | * are met: | |
| 11 | * 1. Redistributions of source code must retain the above copyright | |
| 12 | * notice, this list of conditions and the following disclaimer. | |
| 13 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 14 | * notice, this list of conditions and the following disclaimer in the | |
| 15 | * documentation and/or other materials provided with the distribution. | |
| 16 | * 3. All advertising materials mentioning features or use of this software | |
| 17 | * must display the following acknowledgement: | |
| 18 | *	This product includes software developed by TooLs GmbH. | |
| 19 | * 4. The name of TooLs GmbH may not be used to endorse or promote products | |
| 20 | * derived from this software without specific prior written permission. | |
| 21 | * | |
| 22 | * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR | |
| 23 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES | |
| 24 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | |
| 25 | * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | |
| 26 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, | |
| 27 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; | |
| 28 | * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, | |
| 29 | * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR | |
| 30 | * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF | |
| 31 | * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | |
| 32 | * | |
| 33 | *	$NetBSD: vmparam.h,v 1.11 2000/02/11 19:25:16 thorpej Exp $ | |
| 34 | */ | |
| 35 | ||
| 36 | #ifndef _MACHINE_VMPARAM_H_ | |
| 37 | #define	_MACHINE_VMPARAM_H_ | |
| 38 | ||
| 39 | #ifndef LOCORE | |
| 40 | #include <machine/md_var.h> | |
| 41 | #endif | |
| 42 | ||
| 43 | #define	USRSTACK	SHAREDPAGE | |
| 44 | ||
| 45 | #ifndef	MAXTSIZ | |
| 46 | #define	MAXTSIZ		(1*1024*1024*1024)		/* max text size */ | |
| 47 | #endif | |
| 48 | ||
| 49 | #ifndef	DFLDSIZ | |
| 50 | #define	DFLDSIZ		(128*1024*1024)		/* default data size */ | |
| 51 | #endif | |
| 52 | ||
| 53 | #ifndef	MAXDSIZ | |
| 54 | #ifdef __powerpc64__ | |
| 55 | #define	MAXDSIZ		(32UL*1024*1024*1024)	/* max data size */ | |
| 56 | #else | |
| 57 | #define	MAXDSIZ		(1*1024*1024*1024)	/* max data size */ | |
| 58 | #endif | |
| 59 | #endif | |
| 60 | ||
| 61 | #ifndef	DFLSSIZ | |
| 62 | #define	DFLSSIZ		(8*1024*1024)		/* default stack size */ | |
| 63 | #endif | |
| 64 | ||
| 65 | #ifndef	MAXSSIZ | |
| 66 | #ifdef __powerpc64__ | |
| 67 | #define	MAXSSIZ		(512*1024*1024)		/* max stack size */ | |
| 68 | #else | |
| 69 | #define	MAXSSIZ		(64*1024*1024)		/* max stack size */ | |
| 70 | #endif | |
| 71 | #endif | |
| 72 | ||
| 73 | #ifdef AIM | |
| 74 | #define	VM_MAXUSER_ADDRESS32	0xfffff000 | |
| 75 | #else | |
| 76 | #define	VM_MAXUSER_ADDRESS32	0x7ffff000 | |
| 77 | #endif | |
| 78 | ||
| 79 | /* | |
| 80 | * Would like to have MAX addresses = 0, but this doesn't (currently) work | |
| 81 | */ | |
| 82 | #ifdef __powerpc64__ | |
| 83 | /* | |
| 84 | * Virtual addresses of things. Derived from the page directory and | |
| 85 | * page table indexes from pmap.h for precision. | |
| 86 | * | |
| 87 | * kernel map should be able to start at 0xc008000000000000 - | |
| 88 | * but at least the functional simulator doesn't like it | |
| 89 | * | |
| 90 | * 0x0000000000000000 - 0x000fffffffffffff user map | |
| 91 | * 0xc000000000000000 - 0xc007ffffffffffff direct map | |
| 92 | * 0xc008000000000000 - 0xc00fffffffffffff kernel map | |
| 93 | * | |
| 94 | */ | |
| 95 | #define	VM_MIN_ADDRESS		0x0000000000000000 | |
| 96 | #define	VM_MAXUSER_ADDRESS	0x000fffffc0000000 | |
| 97 | #define	VM_MAX_ADDRESS		0xc00fffffffffffff | |
| 98 | #define	VM_MIN_KERNEL_ADDRESS	0xc008000000000000 | |
| 99 | #define	VM_MAX_KERNEL_ADDRESS	0xc0080007ffffffff | |
| 100 | #define	VM_MAX_SAFE_KERNEL_ADDRESS	VM_MAX_KERNEL_ADDRESS | |
| 101 | #else | |
| 102 | #define	VM_MIN_ADDRESS		0 | |
| 103 | #define	VM_MAXUSER_ADDRESS	VM_MAXUSER_ADDRESS32 | |
| 104 | #define	VM_MAX_ADDRESS		0xffffffff | |
| 105 | #endif | |
| 106 | ||
| 107 | #define	SHAREDPAGE		(VM_MAXUSER_ADDRESS - PAGE_SIZE) | |
| 108 | ||
| 109 | #define	FREEBSD32_SHAREDPAGE	(VM_MAXUSER_ADDRESS32 - PAGE_SIZE) | |
| 110 | #define	FREEBSD32_USRSTACK	FREEBSD32_SHAREDPAGE | |
| 111 | ||
| 112 | #define	KERNBASE		0x00100100	/* start of kernel virtual */ | |
| 113 | ||
| 114 | #define UMA_MD_SMALL_ALLOC | |
| 115 | ||
| 116 | #ifdef AIM | |
| 117 | #ifndef __powerpc64__ | |
| 118 | #define	VM_MIN_KERNEL_ADDRESS	((vm_offset_t)KERNEL_SR << ADDR_SR_SHFT) | |
| 119 | #define	VM_MAX_SAFE_KERNEL_ADDRESS (VM_MIN_KERNEL_ADDRESS + 2*SEGMENT_LENGTH -1) | |
| 120 | #define	VM_MAX_KERNEL_ADDRESS	(VM_MIN_KERNEL_ADDRESS + 3*SEGMENT_LENGTH - 1) | |
| 121 | #endif | |
| 122 | ||
| 123 | /* | |
| 124 | * Use the direct-mapped BAT registers for UMA small allocs. This | |
| 125 | * takes pressure off the small amount of available KVA. | |
| 126 | */ | |
| 127 | #define UMA_USE_DMAP | |
| 128 | ||
| 129 | #else /* Book-E */ | |
| 130 | ||
| 131 | /* Use the direct map for UMA small allocs on powerpc64. */ | |
| 132 | #ifdef __powerpc64__ | |
| 133 | #define UMA_USE_DMAP | |
| 134 | #else | |
| 135 | #define	VM_MIN_KERNEL_ADDRESS		0xc0000000 | |
| 136 | #define	VM_MAX_KERNEL_ADDRESS		0xffffefff | |
| 137 | #define	VM_MAX_SAFE_KERNEL_ADDRESS	VM_MAX_KERNEL_ADDRESS | |
| 138 | #endif | |
| 139 | ||
| 140 | #endif /* AIM/E500 */ | |
| 141 | ||
| 142 | #if !defined(LOCORE) | |
| 143 | struct pmap_physseg { | |
| 144 | 	struct pv_entry *pvent; | |
| 145 | 	char *attrs; | |
| 146 | }; | |
| 147 | #endif | |
| 148 | ||
| 149 | #ifdef __powerpc64__ | |
| 150 | #define	VM_PHYSSEG_MAX		63	/* 1? */ | |
| 151 | #else | |
| 152 | #define	VM_PHYSSEG_MAX		16	/* 1? */ | |
| 153 | #endif | |
| 154 | ||
| 155 | #define	PHYS_AVAIL_SZ	256	/* Allows up to 16GB Ram on pSeries with | |
| 156 | 				 * logical memory block size of 64MB. | |
| 157 | 				 * For more Ram increase the lmb or this value. | |
| 158 | 				 */ | |
| 159 | ||
| 160 | /* XXX This is non-sensical. Phys avail should hold contiguous regions. */ | |
| 161 | #define	PHYS_AVAIL_ENTRIES	PHYS_AVAIL_SZ | |
| 162 | ||
| 163 | /* | |
| 164 | * The physical address space is densely populated on 32-bit systems, | |
| 165 | * but may not be on 64-bit ones. | |
| 166 | */ | |
| 167 | #ifdef __powerpc64__ | |
| 168 | #define	VM_PHYSSEG_SPARSE | |
| 169 | #else | |
| 170 | #define	VM_PHYSSEG_DENSE | |
| 171 | #endif | |
| 172 | ||
| 173 | /* | |
| 174 | * Create two free page pools: VM_FREEPOOL_DEFAULT is the default pool | |
| 175 | * from which physical pages are allocated and VM_FREEPOOL_DIRECT is | |
| 176 | * the pool from which physical pages for small UMA objects are | |
| 177 | * allocated. | |
| 178 | */ | |
| 179 | #define	VM_NFREEPOOL		2 | |
| 180 | #define	VM_FREEPOOL_DEFAULT	0 | |
| 181 | #define	VM_FREEPOOL_DIRECT	1 | |
| 182 | ||
| 183 | /* | |
| 184 | * Create one free page list. | |
| 185 | */ | |
| 186 | #define	VM_NFREELIST		1 | |
| 187 | #define	VM_FREELIST_DEFAULT	0 | |
| 188 | ||
| 189 | #ifdef __powerpc64__ | |
| 190 | /* The largest allocation size is 16MB. */ | |
| 191 | #define	VM_NFREEORDER		13 | |
| 192 | #else | |
| 193 | /* The largest allocation size is 4MB. */ | |
| 194 | #define	VM_NFREEORDER		11 | |
| 195 | #endif | |
| 196 | ||
| 197 | #ifndef	VM_NRESERVLEVEL | |
| 198 | #ifdef __powerpc64__ | |
| 199 | /* Enable superpage reservations: 1 level. */ | |
| 200 | #define	VM_NRESERVLEVEL		1 | |
| 201 | #else | |
| 202 | /* Disable superpage reservations. */ | |
| 203 | #define	VM_NRESERVLEVEL		0 | |
| 204 | #endif | |
| 205 | #endif | |
| 206 | ||
| 207 | #ifndef	VM_LEVEL_0_ORDER | |
| 208 | /* Level 0 reservations consist of 512 (RPT) or 4096 (HPT) pages. */ | |
| 209 | #define	VM_LEVEL_0_ORDER	vm_level_0_order | |
| 210 | #ifndef	__ASSEMBLER__ | |
| 211 | extern	int vm_level_0_order; | |
| 212 | #endif | |
| 213 | #endif | |
| 214 | ||
| 215 | #ifndef	VM_LEVEL_0_ORDER_MAX | |
| 216 | #define	VM_LEVEL_0_ORDER_MAX	12 | |
| 217 | #endif | |
| 218 | ||
| 219 | #ifndef VM_INITIAL_PAGEIN | |
| 220 | #define	VM_INITIAL_PAGEIN	16 | |
| 221 | #endif | |
| 222 | ||
| 223 | #ifndef SGROWSIZ | |
| 224 | #define	SGROWSIZ	(128UL*1024)		/* amount to grow stack */ | |
| 225 | #endif | |
| 226 | ||
| 227 | /* | |
| 228 | * How many physical pages per kmem arena virtual page. | |
| 229 | */ | |
| 230 | #ifndef VM_KMEM_SIZE_SCALE | |
| 231 | #define	VM_KMEM_SIZE_SCALE	(3) | |
| 232 | #endif | |
| 233 | ||
| 234 | /* | |
| 235 | * Optional floor (in bytes) on the size of the kmem arena. | |
| 236 | */ | |
| 237 | #ifndef VM_KMEM_SIZE_MIN | |
| 238 | #define	VM_KMEM_SIZE_MIN	(12 * 1024 * 1024) | |
| 239 | #endif | |
| 240 | ||
| 241 | /* | |
| 242 | * Optional ceiling (in bytes) on the size of the kmem arena: 40% of the | |
| 243 | * usable KVA space. | |
| 244 | */ | |
| 245 | #ifndef VM_KMEM_SIZE_MAX | |
| 246 | #define VM_KMEM_SIZE_MAX	((VM_MAX_SAFE_KERNEL_ADDRESS - \ | |
| 247 | VM_MIN_KERNEL_ADDRESS + 1) * 2 / 5) | |
| 248 | #endif | |
| 249 | ||
| 250 | #ifdef __powerpc64__ | |
| 251 | #define	ZERO_REGION_SIZE	(2 * 1024 * 1024)	/* 2MB */ | |
| 252 | #else | |
| 253 | #define	ZERO_REGION_SIZE	(64 * 1024)	/* 64KB */ | |
| 254 | #endif | |
| 255 | ||
| 256 | /* | |
| 257 | * On 32-bit OEA, the only purpose for which sf_buf is used is to implement | |
| 258 | * an opaque pointer required by the machine-independent parts of the kernel. | |
| 259 | * That pointer references the vm_page that is "mapped" by the sf_buf. The | |
| 260 | * actual mapping is provided by the direct virtual-to-physical mapping. | |
| 261 | * | |
| 262 | * On OEA64 and Book-E, we need to do something a little more complicated. Use | |
| 263 | * the runtime-detected hw_direct_map to pick between the two cases. Our | |
| 264 | * friends in vm_machdep.c will do the same to ensure nothing gets confused. | |
| 265 | */ | |
| 266 | #define	SFBUF | |
| 267 | #define	SFBUF_NOMD | |
| 268 | ||
| 269 | /* | |
| 270 | * We (usually) have a direct map of all physical memory, so provide | |
| 271 | * a macro to use to get the kernel VA address for a given PA. Check the | |
| 272 | * value of PMAP_HAS_PMAP before using. | |
| 273 | */ | |
| 274 | #ifndef LOCORE | |
| 275 | #ifdef __powerpc64__ | |
| 276 | #define	DMAP_BASE_ADDRESS	0xc000000000000000UL | |
| 277 | #define	DMAP_MIN_ADDRESS	DMAP_BASE_ADDRESS | |
| 278 | #define	DMAP_MAX_ADDRESS	0xc007ffffffffffffUL | |
| 279 | #else | |
| 280 | #define	DMAP_BASE_ADDRESS	0x00000000UL | |
| 281 | #define	DMAP_MAX_ADDRESS	0xbfffffffUL | |
| 282 | #endif | |
| 283 | #endif | |
| 284 | ||
| 285 | #if defined(__powerpc64__) || defined(BOOKE) | |
| 286 | /* | |
| 287 | * powerpc64 and Book-E will provide their own page array allocators. | |
| 288 | * | |
| 289 | * On AIM, this will allocate a single virtual array, with pages from the | |
| 290 | * correct memory domains. | |
| 291 | * On Book-E this will let us put the array in TLB1, removing the need for TLB | |
| 292 | * thrashing. | |
| 293 | * | |
| 294 | * VM_MIN_KERNEL_ADDRESS is just a dummy. It will get set by the MMU driver. | |
| 295 | */ | |
| 296 | #define	PA_MIN_ADDRESS		VM_MIN_KERNEL_ADDRESS | |
| 297 | #define	PMAP_HAS_PAGE_ARRAY	1 | |
| 298 | #endif | |
| 299 | ||
| 300 | #if defined(__powerpc64__) | |
| 301 | /* | |
| 302 | * Need a page dump array for minidump. | |
| 303 | */ | |
| 304 | #define MINIDUMP_PAGE_TRACKING	1 | |
| 305 | #define MINIDUMP_STARTUP_PAGE_TRACKING 1 | |
| 306 | #else | |
| 307 | /* | |
| 308 | * No minidump with 32-bit powerpc. | |
| 309 | */ | |
| 310 | #define MINIDUMP_PAGE_TRACKING	0 | |
| 311 | #define MINIDUMP_STARTUP_PAGE_TRACKING 0 | |
| 312 | #endif | |
| 313 | ||
| 314 | #define	PMAP_HAS_DMAP	(hw_direct_map) | |
| 315 | #define PHYS_TO_DMAP(x) ({						\ | |
| 316 | 	KASSERT(hw_direct_map, ("Direct map not provided by PMAP"));	\ | |
| 317 | 	(x) | DMAP_BASE_ADDRESS; }) | |
| 318 | #define DMAP_TO_PHYS(x) ({						\ | |
| 319 | 	KASSERT(hw_direct_map, ("Direct map not provided by PMAP"));	\ | |
| 320 | 	(x) &~ DMAP_BASE_ADDRESS; }) | |
| 321 | ||
| 322 | /* | |
| 323 | * No non-transparent large page support in the pmap. | |
| 324 | */ | |
| 325 | #define	PMAP_HAS_LARGEPAGES	0 | |
| 326 | ||
| 327 | #endif /* _MACHINE_VMPARAM_H_ */ | |
| \ No newline at end of file |
lib/libc/include/riscv64-freebsd-none/fenv.h+3-28| ... | ... | @@ -36,6 +36,7 @@ |
| 36 | 36 | #ifndef	_FENV_H_ |
| 37 | 37 | #define	_FENV_H_ |
| 38 | 38 | |
| 39 | #include <sys/cdefs.h> | |
| 39 | 40 | #include <sys/_types.h> |
| 40 | 41 | |
| 41 | 42 | #ifndef	__fenv_static |
| ... | ... | @@ -71,32 +72,13 @@ __BEGIN_DECLS |
| 71 | 72 | extern const fenv_t	__fe_dfl_env; |
| 72 | 73 | #define	FE_DFL_ENV	(&__fe_dfl_env) |
| 73 | 74 | |
| 74 | #if !defined(__riscv_float_abi_soft) && !defined(__riscv_float_abi_double) | |
| 75 | #if defined(__riscv_float_abi_single) | |
| 76 | #error single precision floating point ABI not supported | |
| 77 | #else | |
| 78 | #error compiler did not set soft/hard float macros | |
| 79 | #endif | |
| 75 | #ifndef __riscv_float_abi_double | |
| 76 | #error only double hard float ABI supported | |
| 80 | 77 | #endif |
| 81 | 78 | |
| 82 | #ifndef __riscv_float_abi_soft | |
| 83 | 79 | #define	__rfs(__fcsr)	__asm __volatile("csrr %0, fcsr" : "=r" (__fcsr)) |
| 84 | 80 | #define	__wfs(__fcsr)	__asm __volatile("csrw fcsr, %0" :: "r" (__fcsr)) |
| 85 | #endif | |
| 86 | 81 | |
| 87 | #ifdef __riscv_float_abi_soft | |
| 88 | int feclearexcept(int __excepts); | |
| 89 | int fegetexceptflag(fexcept_t *__flagp, int __excepts); | |
| 90 | int fesetexceptflag(const fexcept_t *__flagp, int __excepts); | |
| 91 | int feraiseexcept(int __excepts); | |
| 92 | int fetestexcept(int __excepts); | |
| 93 | int fegetround(void); | |
| 94 | int fesetround(int __round); | |
| 95 | int fegetenv(fenv_t *__envp); | |
| 96 | int feholdexcept(fenv_t *__envp); | |
| 97 | int fesetenv(const fenv_t *__envp); | |
| 98 | int feupdateenv(const fenv_t *__envp); | |
| 99 | #else | |
| 100 | 82 | __fenv_static inline int |
| 101 | 83 | feclearexcept(int __excepts) |
| 102 | 84 | { |
| ... | ... | @@ -212,15 +194,9 @@ feupdateenv(const fenv_t *__envp) |
| 212 | 194 | |
| 213 | 195 | 	return (0); |
| 214 | 196 | } |
| 215 | #endif /* !__riscv_float_abi_soft */ | |
| 216 | 197 | |
| 217 | 198 | #if __BSD_VISIBLE |
| 218 | 199 | |
| 219 | #ifdef __riscv_float_abi_soft | |
| 220 | int feenableexcept(int __mask); | |
| 221 | int fedisableexcept(int __mask); | |
| 222 | int fegetexcept(void); | |
| 223 | #else | |
| 224 | 200 | __fenv_static inline int |
| 225 | 201 | feenableexcept(int __mask __unused) |
| 226 | 202 | { |
| ... | ... | @@ -248,7 +224,6 @@ fegetexcept(void) |
| 248 | 224 | |
| 249 | 225 | 	return (0); |
| 250 | 226 | } |
| 251 | #endif /* !__riscv_float_abi_soft */ | |
| 252 | 227 | |
| 253 | 228 | #endif /* __BSD_VISIBLE */ |
| 254 | 229 |
lib/libc/include/riscv64-freebsd-none/float.h-2| ... | ... | @@ -25,8 +25,6 @@ |
| 25 | 25 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 26 | 26 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 27 | 27 | * SUCH DAMAGE. |
| 28 | * | |
| 29 | *	from: @(#)float.h	7.1 (Berkeley) 5/8/90 | |
| 30 | 28 | */ |
| 31 | 29 | |
| 32 | 30 | #ifndef _MACHINE_FLOAT_H_ |
lib/libc/include/riscv64-freebsd-none/machine/_align.h-2| ... | ... | @@ -25,8 +25,6 @@ |
| 25 | 25 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 26 | 26 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 27 | 27 | * SUCH DAMAGE. |
| 28 | * | |
| 29 | *	from: @(#)param.h	5.8 (Berkeley) 6/28/91 | |
| 30 | 28 | */ |
| 31 | 29 | |
| 32 | 30 | #ifndef _MACHINE__ALIGN_H_ |
lib/libc/include/riscv64-freebsd-none/machine/_bus.h deleted-43| ... | ... | @@ -1,43 +0,0 @@ |
| 1 | /*- | |
| 2 | * Copyright (c) 2005 M. Warner Losh <imp@FreeBSD.org> | |
| 3 | * | |
| 4 | * Redistribution and use in source and binary forms, with or without | |
| 5 | * modification, are permitted provided that the following conditions | |
| 6 | * are met: | |
| 7 | * 1. Redistributions of source code must retain the above copyright | |
| 8 | * notice, this list of conditions, and the following disclaimer, | |
| 9 | * without modification, immediately at the beginning of the file. | |
| 10 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 11 | * notice, this list of conditions and the following disclaimer in | |
| 12 | * the documentation and/or other materials provided with the | |
| 13 | * distribution. | |
| 14 | * | |
| 15 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |
| 16 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 17 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
| 18 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR | |
| 19 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
| 20 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
| 21 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
| 22 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
| 23 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
| 24 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
| 25 | * SUCH DAMAGE. | |
| 26 | */ | |
| 27 | ||
| 28 | #ifndef _MACHINE__BUS_H_ | |
| 29 | #define	_MACHINE__BUS_H_ | |
| 30 | ||
| 31 | /* | |
| 32 | * Addresses (in bus space). | |
| 33 | */ | |
| 34 | typedef u_long bus_addr_t; | |
| 35 | typedef u_long bus_size_t; | |
| 36 | ||
| 37 | /* | |
| 38 | * Access methods for bus space. | |
| 39 | */ | |
| 40 | typedef u_long bus_space_handle_t; | |
| 41 | typedef struct bus_space *bus_space_tag_t; | |
| 42 | ||
| 43 | #endif /* !_MACHINE__BUS_H_ */ | |
| \ No newline at end of file |
lib/libc/include/riscv64-freebsd-none/machine/_limits.h-2| ... | ... | @@ -22,8 +22,6 @@ |
| 22 | 22 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 23 | 23 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 24 | 24 | * SUCH DAMAGE. |
| 25 | * | |
| 26 | *	@(#)limits.h	8.3 (Berkeley) 1/4/94 | |
| 27 | 25 | */ |
| 28 | 26 | |
| 29 | 27 | #ifndef _MACHINE__LIMITS_H_ |
lib/libc/include/riscv64-freebsd-none/machine/_types.h-3| ... | ... | @@ -26,9 +26,6 @@ |
| 26 | 26 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 27 | 27 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 28 | 28 | * SUCH DAMAGE. |
| 29 | * | |
| 30 | *	From: @(#)ansi.h	8.2 (Berkeley) 1/4/94 | |
| 31 | *	From: @(#)types.h	8.3 (Berkeley) 1/5/94 | |
| 32 | 29 | */ |
| 33 | 30 | |
| 34 | 31 | #ifndef _MACHINE__TYPES_H_ |
lib/libc/include/riscv64-freebsd-none/machine/asm.h+5| ... | ... | @@ -69,4 +69,9 @@ |
| 69 | 69 | 	li	tmp, SSTATUS_SUM;					\ |
| 70 | 70 | 	csrc	sstatus, tmp |
| 71 | 71 | |
| 72 | #define	SBI_CALL(ext, func)						\ | |
| 73 | 	li	a7, ext;						\ | |
| 74 | 	li	a6, func;						\ | |
| 75 | 	ecall | |
| 76 | ||
| 72 | 77 | #endif /* _MACHINE_ASM_H_ */ |
| \ No newline at end of file |
lib/libc/include/riscv64-freebsd-none/machine/atomic.h+112-7| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /*- |
| 2 | * Copyright (c) 2015 Ruslan Bukin <br@bsdpad.com> | |
| 2 | * Copyright (c) 2015-2024 Ruslan Bukin <br@bsdpad.com> | |
| 3 | 3 | * All rights reserved. |
| 4 | 4 | * |
| 5 | 5 | * Portions of this software were developed by SRI International and the |
| ... | ... | @@ -105,8 +105,6 @@ atomic_fcmpset_rel_##WIDTH(__volatile uint##WIDTH##_t *p,		\ |
| 105 | 105 | |
| 106 | 106 | ATOMIC_CMPSET_ACQ_REL(8); |
| 107 | 107 | ATOMIC_FCMPSET_ACQ_REL(8); |
| 108 | ATOMIC_CMPSET_ACQ_REL(16); | |
| 109 | ATOMIC_FCMPSET_ACQ_REL(16); | |
| 110 | 108 | |
| 111 | 109 | #define	atomic_cmpset_char		atomic_cmpset_8 |
| 112 | 110 | #define	atomic_cmpset_acq_char		atomic_cmpset_acq_8 |
| ... | ... | @@ -116,11 +114,40 @@ ATOMIC_FCMPSET_ACQ_REL(16); |
| 116 | 114 | #define	atomic_fcmpset_rel_char		atomic_fcmpset_rel_8 |
| 117 | 115 | |
| 118 | 116 | #define	atomic_cmpset_short		atomic_cmpset_16 |
| 119 | #define	atomic_cmpset_acq_short		atomic_cmpset_acq_16 | |
| 120 | #define	atomic_cmpset_rel_short		atomic_cmpset_rel_16 | |
| 121 | 117 | #define	atomic_fcmpset_short		atomic_fcmpset_16 |
| 118 | ||
| 119 | ATOMIC_CMPSET_ACQ_REL(16); | |
| 120 | ATOMIC_FCMPSET_ACQ_REL(16); | |
| 121 | ||
| 122 | #define	atomic_load_acq_16	atomic_load_acq_16 | |
| 123 | static __inline uint16_t | |
| 124 | atomic_load_acq_16(const volatile uint16_t *p) | |
| 125 | { | |
| 126 | 	uint16_t ret; | |
| 127 | ||
| 128 | 	ret = *p; | |
| 129 | ||
| 130 | 	fence(); | |
| 131 | ||
| 132 | 	return (ret); | |
| 133 | } | |
| 134 | ||
| 135 | static __inline void | |
| 136 | atomic_store_rel_16(volatile uint16_t *p, uint16_t val) | |
| 137 | { | |
| 138 | ||
| 139 | 	fence(); | |
| 140 | ||
| 141 | 	*p = val; | |
| 142 | } | |
| 143 | ||
| 144 | #define	atomic_cmpset_acq_short		atomic_cmpset_acq_16 | |
| 122 | 145 | #define	atomic_fcmpset_acq_short	atomic_fcmpset_acq_16 |
| 146 | #define	atomic_load_acq_short		atomic_load_acq_16 | |
| 147 | ||
| 148 | #define	atomic_cmpset_rel_short		atomic_cmpset_rel_16 | |
| 123 | 149 | #define	atomic_fcmpset_rel_short	atomic_fcmpset_rel_16 |
| 150 | #define	atomic_store_rel_short		atomic_store_rel_16 | |
| 124 | 151 | |
| 125 | 152 | static __inline void |
| 126 | 153 | atomic_add_32(volatile uint32_t *p, uint32_t val) |
| ... | ... | @@ -239,6 +266,34 @@ atomic_readandclear_32(volatile uint32_t *p) |
| 239 | 266 | 	return (ret); |
| 240 | 267 | } |
| 241 | 268 | |
| 269 | static __inline int | |
| 270 | atomic_testandclear_32(volatile uint32_t *p, u_int val) | |
| 271 | { | |
| 272 | 	uint32_t mask, old; | |
| 273 | ||
| 274 | 	mask = 1u << (val & 31); | |
| 275 | 	__asm __volatile("amoand.w %0, %2, %1" | |
| 276 | 			: "=&r" (old), "+A" (*p) | |
| 277 | 			: "r" (~mask) | |
| 278 | 			: "memory"); | |
| 279 | ||
| 280 | 	return ((old & mask) != 0); | |
| 281 | } | |
| 282 | ||
| 283 | static __inline int | |
| 284 | atomic_testandset_32(volatile uint32_t *p, u_int val) | |
| 285 | { | |
| 286 | 	uint32_t mask, old; | |
| 287 | ||
| 288 | 	mask = 1u << (val & 31); | |
| 289 | 	__asm __volatile("amoor.w %0, %2, %1" | |
| 290 | 			: "=&r" (old), "+A" (*p) | |
| 291 | 			: "r" (mask) | |
| 292 | 			: "memory"); | |
| 293 | ||
| 294 | 	return ((old & mask) != 0); | |
| 295 | } | |
| 296 | ||
| 242 | 297 | #define	atomic_add_int		atomic_add_32 |
| 243 | 298 | #define	atomic_clear_int	atomic_clear_32 |
| 244 | 299 | #define	atomic_cmpset_int	atomic_cmpset_32 |
| ... | ... | @@ -257,7 +312,7 @@ ATOMIC_CMPSET_ACQ_REL(32); |
| 257 | 312 | ATOMIC_FCMPSET_ACQ_REL(32); |
| 258 | 313 | |
| 259 | 314 | static __inline uint32_t |
| 260 | atomic_load_acq_32(volatile uint32_t *p) | |
| 315 | atomic_load_acq_32(const volatile uint32_t *p) | |
| 261 | 316 | { |
| 262 | 317 | 	uint32_t ret; |
| 263 | 318 | |
| ... | ... | @@ -410,6 +465,48 @@ atomic_readandclear_64(volatile uint64_t *p) |
| 410 | 465 | 	return (ret); |
| 411 | 466 | } |
| 412 | 467 | |
| 468 | static __inline int | |
| 469 | atomic_testandclear_64(volatile uint64_t *p, u_int val) | |
| 470 | { | |
| 471 | 	uint64_t mask, old; | |
| 472 | ||
| 473 | 	mask = 1ul << (val & 63); | |
| 474 | 	__asm __volatile("amoand.d %0, %2, %1" | |
| 475 | 			: "=&r" (old), "+A" (*p) | |
| 476 | 			: "r" (~mask) | |
| 477 | 			: "memory"); | |
| 478 | ||
| 479 | 	return ((old & mask) != 0); | |
| 480 | } | |
| 481 | ||
| 482 | static __inline int | |
| 483 | atomic_testandset_64(volatile uint64_t *p, u_int val) | |
| 484 | { | |
| 485 | 	uint64_t mask, old; | |
| 486 | ||
| 487 | 	mask = 1ul << (val & 63); | |
| 488 | 	__asm __volatile("amoor.d %0, %2, %1" | |
| 489 | 			: "=&r" (old), "+A" (*p) | |
| 490 | 			: "r" (mask) | |
| 491 | 			: "memory"); | |
| 492 | ||
| 493 | 	return ((old & mask) != 0); | |
| 494 | } | |
| 495 | ||
| 496 | static __inline int | |
| 497 | atomic_testandset_acq_64(volatile uint64_t *p, u_int val) | |
| 498 | { | |
| 499 | 	uint64_t mask, old; | |
| 500 | ||
| 501 | 	mask = 1ul << (val & 63); | |
| 502 | 	__asm __volatile("amoor.d.aq %0, %2, %1" | |
| 503 | 			: "=&r" (old), "+A" (*p) | |
| 504 | 			: "r" (mask) | |
| 505 | 			: "memory"); | |
| 506 | ||
| 507 | 	return ((old & mask) != 0); | |
| 508 | } | |
| 509 | ||
| 413 | 510 | static __inline uint32_t |
| 414 | 511 | atomic_swap_32(volatile uint32_t *p, uint32_t val) |
| 415 | 512 | { |
| ... | ... | @@ -447,6 +544,9 @@ atomic_swap_64(volatile uint64_t *p, uint64_t val) |
| 447 | 544 | #define	atomic_set_long			atomic_set_64 |
| 448 | 545 | #define	atomic_subtract_long		atomic_subtract_64 |
| 449 | 546 | #define	atomic_swap_long		atomic_swap_64 |
| 547 | #define	atomic_testandclear_long	atomic_testandclear_64 | |
| 548 | #define	atomic_testandset_long		atomic_testandset_64 | |
| 549 | #define	atomic_testandset_acq_long	atomic_testandset_acq_64 | |
| 450 | 550 | |
| 451 | 551 | #define	atomic_add_ptr			atomic_add_64 |
| 452 | 552 | #define	atomic_clear_ptr		atomic_clear_64 |
| ... | ... | @@ -457,6 +557,8 @@ atomic_swap_64(volatile uint64_t *p, uint64_t val) |
| 457 | 557 | #define	atomic_set_ptr			atomic_set_64 |
| 458 | 558 | #define	atomic_subtract_ptr		atomic_subtract_64 |
| 459 | 559 | #define	atomic_swap_ptr			atomic_swap_64 |
| 560 | #define	atomic_testandclear_ptr		atomic_testandclear_64 | |
| 561 | #define	atomic_testandset_ptr		atomic_testandset_64 | |
| 460 | 562 | |
| 461 | 563 | ATOMIC_ACQ_REL(set, 64) |
| 462 | 564 | ATOMIC_ACQ_REL(clear, 64) |
| ... | ... | @@ -467,7 +569,7 @@ ATOMIC_CMPSET_ACQ_REL(64); |
| 467 | 569 | ATOMIC_FCMPSET_ACQ_REL(64); |
| 468 | 570 | |
| 469 | 571 | static __inline uint64_t |
| 470 | atomic_load_acq_64(volatile uint64_t *p) | |
| 572 | atomic_load_acq_64(const volatile uint64_t *p) | |
| 471 | 573 | { |
| 472 | 574 | 	uint64_t ret; |
| 473 | 575 | |
| ... | ... | @@ -554,4 +656,7 @@ atomic_thread_fence_seq_cst(void) |
| 554 | 656 | |
| 555 | 657 | #include <sys/_atomic_subword.h> |
| 556 | 658 | |
| 659 | #define	atomic_set_short		atomic_set_16 | |
| 660 | #define	atomic_clear_short		atomic_clear_16 | |
| 661 | ||
| 557 | 662 | #endif /* _MACHINE_ATOMIC_H_ */ |
| \ No newline at end of file |
lib/libc/include/riscv64-freebsd-none/machine/bus_dma.h+1-1| ... | ... | @@ -49,7 +49,7 @@ bus_dmamem_alloc(bus_dma_tag_t dmat, void** vaddr, int flags, |
| 49 | 49 | |
| 50 | 50 | /* |
| 51 | 51 | * Free a piece of memory and it's allociated dmamap, that was allocated |
| 52 | * via bus_dmamem_alloc. Make the same choice for free/contigfree. | |
| 52 | * via bus_dmamem_alloc. | |
| 53 | 53 | */ |
| 54 | 54 | static inline void |
| 55 | 55 | bus_dmamem_free(bus_dma_tag_t dmat, void *vaddr, bus_dmamap_t map) |
lib/libc/include/riscv64-freebsd-none/machine/bus_dma_impl.h+3-10| ... | ... | @@ -31,27 +31,22 @@ |
| 31 | 31 | |
| 32 | 32 | struct bus_dma_tag_common { |
| 33 | 33 | 	struct bus_dma_impl *impl; |
| 34 | 	struct bus_dma_tag_common *parent; | |
| 35 | 34 | 	bus_size_t	 alignment; |
| 36 | 35 | 	bus_addr_t	 boundary; |
| 37 | 36 | 	bus_addr_t	 lowaddr; |
| 38 | 37 | 	bus_addr_t	 highaddr; |
| 39 | 	bus_dma_filter_t *filter; | |
| 40 | 	void		 *filterarg; | |
| 41 | 38 | 	bus_size_t	 maxsize; |
| 42 | 39 | 	u_int		 nsegments; |
| 43 | 40 | 	bus_size_t	 maxsegsz; |
| 44 | 41 | 	int		 flags; |
| 45 | 42 | 	bus_dma_lock_t	 *lockfunc; |
| 46 | 43 | 	void		 *lockfuncarg; |
| 47 | 	int		 ref_count; | |
| 48 | 44 | }; |
| 49 | 45 | |
| 50 | 46 | struct bus_dma_impl { |
| 51 | 47 | 	int (*tag_create)(bus_dma_tag_t parent, |
| 52 | 48 | 	 bus_size_t alignment, bus_addr_t boundary, bus_addr_t lowaddr, |
| 53 | 	 bus_addr_t highaddr, bus_dma_filter_t *filter, | |
| 54 | 	 void *filterarg, bus_size_t maxsize, int nsegments, | |
| 49 | 	 bus_addr_t highaddr, bus_size_t maxsize, int nsegments, | |
| 55 | 50 | 	 bus_size_t maxsegsz, int flags, bus_dma_lock_t *lockfunc, |
| 56 | 51 | 	 void *lockfuncarg, bus_dma_tag_t *dmat); |
| 57 | 52 | 	int (*tag_destroy)(bus_dma_tag_t dmat); |
| ... | ... | @@ -79,13 +74,11 @@ struct bus_dma_impl { |
| 79 | 74 | 	 bus_dmasync_op_t op); |
| 80 | 75 | }; |
| 81 | 76 | |
| 82 | int bus_dma_run_filter(struct bus_dma_tag_common *dmat, bus_addr_t paddr); | |
| 83 | 77 | int common_bus_dma_tag_create(struct bus_dma_tag_common *parent, |
| 84 | 78 | bus_size_t alignment, |
| 85 | 79 | bus_addr_t boundary, bus_addr_t lowaddr, bus_addr_t highaddr, |
| 86 | bus_dma_filter_t *filter, void *filterarg, bus_size_t maxsize, | |
| 87 | int nsegments, bus_size_t maxsegsz, int flags, bus_dma_lock_t *lockfunc, | |
| 88 | void *lockfuncarg, size_t sz, void **dmat); | |
| 80 | bus_size_t maxsize, int nsegments, bus_size_t maxsegsz, int flags, | |
| 81 | bus_dma_lock_t *lockfunc, void *lockfuncarg, size_t sz, void **dmat); | |
| 89 | 82 | |
| 90 | 83 | extern struct bus_dma_impl bus_dma_bounce_impl; |
| 91 | 84 |
lib/libc/include/riscv64-freebsd-none/machine/cbo.h created+33| ... | ... | @@ -0,0 +1,33 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-2-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 2025 Ruslan Bukin <br@bsdpad.com> | |
| 5 | * | |
| 6 | * Redistribution and use in source and binary forms, with or without | |
| 7 | * modification, are permitted provided that the following conditions | |
| 8 | * are met: | |
| 9 | * 1. Redistributions of source code must retain the above copyright | |
| 10 | * notice, this list of conditions and the following disclaimer. | |
| 11 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 12 | * notice, this list of conditions and the following disclaimer in the | |
| 13 | * documentation and/or other materials provided with the distribution. | |
| 14 | * | |
| 15 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |
| 16 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 17 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
| 18 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | |
| 19 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
| 20 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
| 21 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
| 22 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
| 23 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
| 24 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
| 25 | * SUCH DAMAGE. | |
| 26 | */ | |
| 27 | ||
| 28 | #ifndef	_RISCV_CBO_H_ | |
| 29 | #define	_RISCV_CBO_H_ | |
| 30 | ||
| 31 | void cbo_zicbom_setup_cache(int cbom_block_size); | |
| 32 | ||
| 33 | #endif	/* _RISCV_CBO_H_ */ | |
| \ No newline at end of file |
lib/libc/include/riscv64-freebsd-none/machine/cpu.h+8-3| ... | ... | @@ -35,9 +35,11 @@ |
| 35 | 35 | #ifndef _MACHINE_CPU_H_ |
| 36 | 36 | #define	_MACHINE_CPU_H_ |
| 37 | 37 | |
| 38 | #ifndef LOCORE | |
| 38 | 39 | #include <machine/atomic.h> |
| 39 | 40 | #include <machine/cpufunc.h> |
| 40 | 41 | #include <machine/frame.h> |
| 42 | #endif | |
| 41 | 43 | |
| 42 | 44 | #define	TRAPF_PC(tfp)		((tfp)->tf_sepc) |
| 43 | 45 | #define	TRAPF_USERMODE(tfp)	(((tfp)->tf_sstatus & SSTATUS_SPP) == 0) |
| ... | ... | @@ -47,8 +49,6 @@ |
| 47 | 49 | #define	cpu_spinwait()		/* nothing */ |
| 48 | 50 | #define	cpu_lock_delay()	DELAY(1) |
| 49 | 51 | |
| 50 | #ifdef _KERNEL | |
| 51 | ||
| 52 | 52 | /* |
| 53 | 53 | * Core manufacturer IDs, as reported by the mvendorid CSR. |
| 54 | 54 | */ |
| ... | ... | @@ -80,6 +80,7 @@ |
| 80 | 80 | |
| 81 | 81 | /* SiFive marchid values */ |
| 82 | 82 | #define	MARCHID_SIFIVE_U7	MARCHID_COMMERCIAL(7) |
| 83 | #define	MARCHID_SIFIVE_P5	MARCHID_COMMERCIAL(8) | |
| 83 | 84 | |
| 84 | 85 | /* |
| 85 | 86 | * MMU virtual-addressing modes. Support for each level implies the previous, |
| ... | ... | @@ -89,6 +90,9 @@ |
| 89 | 90 | #define	MMU_SV48	0x2	/* 4-level paging */ |
| 90 | 91 | #define	MMU_SV57	0x4	/* 5-level paging */ |
| 91 | 92 | |
| 93 | #ifdef _KERNEL | |
| 94 | #ifndef LOCORE | |
| 95 | ||
| 92 | 96 | extern char btext[]; |
| 93 | 97 | extern char etext[]; |
| 94 | 98 | |
| ... | ... | @@ -105,6 +109,7 @@ get_cyclecount(void) |
| 105 | 109 | 	return (rdcycle()); |
| 106 | 110 | } |
| 107 | 111 | |
| 108 | #endif | |
| 112 | #endif /* !LOCORE */ | |
| 113 | #endif /* _KERNEL */ | |
| 109 | 114 | |
| 110 | 115 | #endif /* !_MACHINE_CPU_H_ */ |
| \ No newline at end of file |
lib/libc/include/riscv64-freebsd-none/machine/cpufunc.h+50-7| ... | ... | @@ -44,6 +44,8 @@ breakpoint(void) |
| 44 | 44 | |
| 45 | 45 | #ifdef _KERNEL |
| 46 | 46 | |
| 47 | #include <sys/_null.h> | |
| 48 | ||
| 47 | 49 | #include <machine/riscvreg.h> |
| 48 | 50 | |
| 49 | 51 | static __inline register_t |
| ... | ... | @@ -102,21 +104,62 @@ sfence_vma_page(uintptr_t addr) |
| 102 | 104 | 	__asm __volatile("sfence.vma %0" :: "r" (addr) : "memory"); |
| 103 | 105 | } |
| 104 | 106 | |
| 107 | static __inline void | |
| 108 | sfence_vma_asid(uint64_t asid) | |
| 109 | { | |
| 110 | ||
| 111 | 	__asm __volatile("sfence.vma x0, %0" :: "r" (asid) : "memory"); | |
| 112 | } | |
| 113 | ||
| 114 | static __inline void | |
| 115 | sfence_vma_asid_page(uint64_t asid, uintptr_t addr) | |
| 116 | { | |
| 117 | ||
| 118 | 	__asm __volatile("sfence.vma %0, %1" :: "r" (addr), "r" (asid) | |
| 119 | 	 : "memory"); | |
| 120 | } | |
| 121 | ||
| 105 | 122 | #define	rdcycle()			csr_read64(cycle) |
| 106 | 123 | #define	rdtime()			csr_read64(time) |
| 107 | 124 | #define	rdinstret()			csr_read64(instret) |
| 108 | 125 | #define	rdhpmcounter(n)			csr_read64(hpmcounter##n) |
| 109 | 126 | |
| 127 | /* Cache hooks. */ | |
| 128 | ||
| 110 | 129 | extern int64_t dcache_line_size; |
| 111 | extern int64_t icache_line_size; | |
| 112 | 130 | |
| 113 | #define	cpu_dcache_wbinv_range(a, s) | |
| 114 | #define	cpu_dcache_inv_range(a, s) | |
| 115 | #define	cpu_dcache_wb_range(a, s) | |
| 131 | typedef void (*cache_op_t)(vm_offset_t start, vm_size_t size); | |
| 132 | ||
| 133 | struct riscv_cache_ops { | |
| 134 | 	cache_op_t dcache_wbinv_range; | |
| 135 | 	cache_op_t dcache_inv_range; | |
| 136 | 	cache_op_t dcache_wb_range; | |
| 137 | }; | |
| 138 | ||
| 139 | extern struct riscv_cache_ops cache_ops; | |
| 140 | ||
| 141 | static __inline void | |
| 142 | cpu_dcache_wbinv_range(vm_offset_t addr, vm_size_t size) | |
| 143 | { | |
| 144 | 	if (cache_ops.dcache_wbinv_range != NULL) | |
| 145 | 		cache_ops.dcache_wbinv_range(addr, size); | |
| 146 | } | |
| 147 | ||
| 148 | static __inline void | |
| 149 | cpu_dcache_inv_range(vm_offset_t addr, vm_size_t size) | |
| 150 | { | |
| 151 | 	if (cache_ops.dcache_inv_range != NULL) | |
| 152 | 		cache_ops.dcache_inv_range(addr, size); | |
| 153 | } | |
| 154 | ||
| 155 | static __inline void | |
| 156 | cpu_dcache_wb_range(vm_offset_t addr, vm_size_t size) | |
| 157 | { | |
| 158 | 	if (cache_ops.dcache_wb_range != NULL) | |
| 159 | 		cache_ops.dcache_wb_range(addr, size); | |
| 160 | } | |
| 116 | 161 | |
| 117 | #define	cpu_idcache_wbinv_range(a, s) | |
| 118 | #define	cpu_icache_sync_range(a, s) | |
| 119 | #define	cpu_icache_sync_range_checked(a, s) | |
| 162 | void riscv_cache_install_hooks(struct riscv_cache_ops *, u_int); | |
| 120 | 163 | |
| 121 | 164 | #define	cpufunc_nullop()		riscv_nullop() |
| 122 | 165 |
lib/libc/include/riscv64-freebsd-none/machine/elf.h+2| ... | ... | @@ -80,7 +80,9 @@ __ElfType(Auxinfo); |
| 80 | 80 | #define	HWCAP_ISA_F		HWCAP_ISA_BIT('f') |
| 81 | 81 | #define	HWCAP_ISA_D		HWCAP_ISA_BIT('d') |
| 82 | 82 | #define	HWCAP_ISA_C		HWCAP_ISA_BIT('c') |
| 83 | #define	HWCAP_ISA_H		HWCAP_ISA_BIT('h') | |
| 83 | 84 | #define	HWCAP_ISA_G		\ |
| 84 | 85 | (HWCAP_ISA_I | HWCAP_ISA_M | HWCAP_ISA_A | HWCAP_ISA_F | HWCAP_ISA_D) |
| 86 | #define	HWCAP_ISA_B		HWCAP_ISA_BIT('b') | |
| 85 | 87 | |
| 86 | 88 | #endif /* !_MACHINE_ELF_H_ */ |
| \ No newline at end of file |
lib/libc/include/riscv64-freebsd-none/machine/endian.h-2| ... | ... | @@ -24,8 +24,6 @@ |
| 24 | 24 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 25 | 25 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 26 | 26 | * SUCH DAMAGE. |
| 27 | * | |
| 28 | *	@(#)endian.h	8.1 (Berkeley) 6/10/93 | |
| 29 | 27 | * $NetBSD: endian.h,v 1.7 1999/08/21 05:53:51 simonb Exp $ |
| 30 | 28 | */ |
| 31 | 29 |
lib/libc/include/riscv64-freebsd-none/machine/float.h-2| ... | ... | @@ -25,8 +25,6 @@ |
| 25 | 25 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 26 | 26 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 27 | 27 | * SUCH DAMAGE. |
| 28 | * | |
| 29 | *	from: @(#)float.h	7.1 (Berkeley) 5/8/90 | |
| 30 | 28 | */ |
| 31 | 29 | |
| 32 | 30 | #ifndef _MACHINE_FLOAT_H_ |
lib/libc/include/riscv64-freebsd-none/machine/fpe.h+11-1| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /*- |
| 2 | * Copyright (c) 2016 Ruslan Bukin <br@bsdpad.com> | |
| 2 | * Copyright (c) 2016-2024 Ruslan Bukin <br@bsdpad.com> | |
| 3 | 3 | * All rights reserved. |
| 4 | 4 | * |
| 5 | 5 | * This software was developed by SRI International and the University of |
| ... | ... | @@ -34,4 +34,14 @@ |
| 34 | 34 | void fpe_state_save(struct thread *td); |
| 35 | 35 | void fpe_state_clear(void); |
| 36 | 36 | |
| 37 | struct fpreg *fpu_save_area_alloc(void); | |
| 38 | void fpu_save_area_free(struct fpreg *fsa); | |
| 39 | void fpu_save_area_reset(struct fpreg *fsa); | |
| 40 | ||
| 41 | void fpe_enable(void); | |
| 42 | void fpe_disable(void); | |
| 43 | ||
| 44 | void fpe_store(struct fpreg *state); | |
| 45 | void fpe_restore(struct fpreg *state); | |
| 46 | ||
| 37 | 47 | #endif /* !_MACHINE_FPE_H_ */ |
| \ No newline at end of file |
lib/libc/include/riscv64-freebsd-none/machine/frame.h+14| ... | ... | @@ -57,6 +57,10 @@ struct trapframe { |
| 57 | 57 | 	uint64_t tf_scause; |
| 58 | 58 | }; |
| 59 | 59 | |
| 60 | #ifdef _KERNEL | |
| 61 | #define	TF_SIZE	(roundup2(sizeof(struct trapframe), STACKALIGNBYTES + 1)) | |
| 62 | #endif | |
| 63 | ||
| 60 | 64 | /* |
| 61 | 65 | * Signal frame. Pushed onto user stack before calling sigcode. |
| 62 | 66 | */ |
| ... | ... | @@ -65,6 +69,16 @@ struct sigframe { |
| 65 | 69 | 	ucontext_t	sf_uc;	/* actual saved ucontext */ |
| 66 | 70 | }; |
| 67 | 71 | |
| 72 | #ifdef _KERNEL | |
| 73 | /* | |
| 74 | * Kernel frame. Reserved near the top of kernel stacks for saving kernel | |
| 75 | * state while in userspace. | |
| 76 | */ | |
| 77 | struct kernframe { | |
| 78 | 	register_t	kf_tp; | |
| 79 | }; | |
| 80 | #endif | |
| 81 | ||
| 68 | 82 | #endif /* !LOCORE */ |
| 69 | 83 | |
| 70 | 84 | /* Definitions for syscalls */ |
lib/libc/include/riscv64-freebsd-none/machine/ifunc.h created+49| ... | ... | @@ -0,0 +1,49 @@ |
| 1 | /*- | |
| 2 | * Copyright (c) 2015-2018 The FreeBSD Foundation | |
| 3 | * Copyright (c) 2024 Jessica Clarke <jrtc27@FreeBSD.org> | |
| 4 | * | |
| 5 | * Part of this software was developed by Konstantin Belousov <kib@FreeBSD.org> | |
| 6 | * under sponsorship from the FreeBSD Foundation. | |
| 7 | * | |
| 8 | * Redistribution and use in source and binary forms, with or without | |
| 9 | * modification, are permitted provided that the following conditions | |
| 10 | * are met: | |
| 11 | * 1. Redistributions of source code must retain the above copyright | |
| 12 | * notice, this list of conditions and the following disclaimer. | |
| 13 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 14 | * notice, this list of conditions and the following disclaimer in the | |
| 15 | * documentation and/or other materials provided with the distribution. | |
| 16 | * | |
| 17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |
| 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 19 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
| 20 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | |
| 21 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
| 22 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
| 23 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
| 24 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
| 25 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
| 26 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
| 27 | * SUCH DAMAGE. | |
| 28 | */ | |
| 29 | ||
| 30 | #ifndef __RISCV_IFUNC_H | |
| 31 | #define	__RISCV_IFUNC_H | |
| 32 | ||
| 33 | #define	DEFINE_IFUNC(qual, ret_type, name, args)			\ | |
| 34 | static ret_type (*name##_resolver(void))args __used;		\ | |
| 35 | qual ret_type name args __attribute__((ifunc(#name "_resolver")));	\ | |
| 36 | static ret_type (*name##_resolver(void))args | |
| 37 | ||
| 38 | #define	DEFINE_UIFUNC(qual, ret_type, name, args)			\ | |
| 39 | static ret_type (*name##_resolver(unsigned long, unsigned long,	\ | |
| 40 | 	unsigned long, unsigned long, unsigned long, unsigned long,	\ | |
| 41 | 	unsigned long, unsigned long))args __used;			\ | |
| 42 | qual ret_type name args __attribute__((ifunc(#name "_resolver")));	\ | |
| 43 | static ret_type (*name##_resolver(unsigned long elf_hwcap __unused,	\ | |
| 44 | 	unsigned long _arg2 __unused, unsigned long _arg3 __unused,	\ | |
| 45 | 	unsigned long _arg4 __unused, unsigned long _arg5 __unused,	\ | |
| 46 | 	unsigned long _arg6 __unused, unsigned long _arg7 __unused,	\ | |
| 47 | 	unsigned long _arg8 __unused))args | |
| 48 | ||
| 49 | #endif | |
| \ No newline at end of file |
lib/libc/include/riscv64-freebsd-none/machine/in_cksum.h-1| ... | ... | @@ -27,7 +27,6 @@ |
| 27 | 27 | * SUCH DAMAGE. |
| 28 | 28 | * |
| 29 | 29 | *	from tahoe:	in_cksum.c	1.2	86/01/05 |
| 30 | *	from:		@(#)in_cksum.c	1.3 (Berkeley) 1/19/91 | |
| 31 | 30 | *	from: Id: in_cksum.c,v 1.8 1995/12/03 18:35:19 bde Exp |
| 32 | 31 | */ |
| 33 | 32 |
lib/libc/include/riscv64-freebsd-none/machine/intr.h+5-2| ... | ... | @@ -39,8 +39,7 @@ |
| 39 | 39 | #define	NIRQ			1024 |
| 40 | 40 | #endif |
| 41 | 41 | |
| 42 | #include <sys/intr.h> | |
| 43 | ||
| 42 | #ifndef LOCORE | |
| 44 | 43 | enum { |
| 45 | 44 | 	IRQ_SOFTWARE_USER, |
| 46 | 45 | 	IRQ_SOFTWARE_SUPERVISOR, |
| ... | ... | @@ -55,5 +54,9 @@ enum { |
| 55 | 54 | 	IRQ_EXTERNAL_HYPERVISOR, |
| 56 | 55 | 	IRQ_EXTERNAL_MACHINE, |
| 57 | 56 | }; |
| 57 | #endif /* !LOCORE */ | |
| 58 | ||
| 59 | #define	INTR_ROOT_IRQ	0 | |
| 60 | #define	INTR_ROOT_COUNT	1 | |
| 58 | 61 | |
| 59 | 62 | #endif /* !_MACHINE_INTR_MACHDEP_H_ */ |
| \ No newline at end of file |
lib/libc/include/riscv64-freebsd-none/machine/machdep.h-2| ... | ... | @@ -36,10 +36,8 @@ |
| 36 | 36 | #define	_MACHINE_MACHDEP_H_ |
| 37 | 37 | |
| 38 | 38 | struct riscv_bootparams { |
| 39 | 	vm_offset_t	kern_l1pt;	/* Kernel L1 base */ | |
| 40 | 39 | 	vm_offset_t	kern_phys;	/* Kernel base (physical) addr */ |
| 41 | 40 | 	vm_offset_t	kern_stack; |
| 42 | 	vm_offset_t	dtbp_virt;	/* Device tree blob virtual addr */ | |
| 43 | 41 | 	vm_offset_t	dtbp_phys;	/* Device tree blob physical addr */ |
| 44 | 42 | 	vm_offset_t	modulep;	/* loader(8) metadata */ |
| 45 | 43 | }; |
lib/libc/include/riscv64-freebsd-none/machine/md_var.h+2| ... | ... | @@ -42,8 +42,10 @@ extern register_t mimpid; |
| 42 | 42 | extern u_int mmu_caps; |
| 43 | 43 | |
| 44 | 44 | /* Supervisor-mode extension support */ |
| 45 | extern bool has_hyp; | |
| 45 | 46 | extern bool has_sstc; |
| 46 | 47 | extern bool has_sscofpmf; |
| 48 | extern bool has_svpbmt; | |
| 47 | 49 | |
| 48 | 50 | struct dumperinfo; |
| 49 | 51 | struct minidumpstate; |
lib/libc/include/riscv64-freebsd-none/machine/metadata.h+10-3| ... | ... | @@ -30,11 +30,18 @@ |
| 30 | 30 | |
| 31 | 31 | #define	MODINFOMD_DTBP		0x1001 |
| 32 | 32 | #define	MODINFOMD_EFI_MAP	0x1002 |
| 33 | #define	MODINFOMD_EFI_FB	0x1003 | |
| 34 | #define	MODINFOMD_BOOT_HARTID	0x1004 | |
| 33 | 35 | |
| 36 | /* | |
| 37 | * This is not the same as the UEFI standard EFI_MEMORY_ATTRIBUTES_TABLE, though | |
| 38 | * memory_size / descritpr_size entries of EFI_MEMORY_DESCRIPTORS follow this table | |
| 39 | * starting at a 16-byte alignment. | |
| 40 | */ | |
| 34 | 41 | struct efi_map_header { |
| 35 | 	size_t		memory_size; | |
| 36 | 	size_t		descriptor_size; | |
| 37 | 	uint32_t	descriptor_version; | |
| 42 | 	size_t		memory_size;		/* Numnber of bytes that follow */ | |
| 43 | 	size_t		descriptor_size;	/* Size of each EFI_MEMORY_DESCRIPTOR */ | |
| 44 | 	uint32_t	descriptor_version;	/* Currently '1' */ | |
| 38 | 45 | }; |
| 39 | 46 | |
| 40 | 47 | /* |
lib/libc/include/riscv64-freebsd-none/machine/param.h-12| ... | ... | @@ -25,8 +25,6 @@ |
| 25 | 25 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 26 | 26 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 27 | 27 | * SUCH DAMAGE. |
| 28 | * | |
| 29 | *	from: @(#)param.h	5.8 (Berkeley) 6/28/91 | |
| 30 | 28 | */ |
| 31 | 29 | |
| 32 | 30 | #ifndef _MACHINE_PARAM_H_ |
| ... | ... | @@ -41,8 +39,6 @@ |
| 41 | 39 | #define	STACKALIGNBYTES	(16 - 1) |
| 42 | 40 | #define	STACKALIGN(p)	((uint64_t)(p) & ~STACKALIGNBYTES) |
| 43 | 41 | |
| 44 | #define __PCI_REROUTE_INTERRUPT | |
| 45 | ||
| 46 | 42 | #ifndef MACHINE |
| 47 | 43 | #define	MACHINE		"riscv" |
| 48 | 44 | #endif |
| ... | ... | @@ -95,15 +91,7 @@ |
| 95 | 91 | /* |
| 96 | 92 | * Mach derived conversion macros |
| 97 | 93 | */ |
| 98 | #define	round_page(x)		(((unsigned long)(x) + PAGE_MASK) & ~PAGE_MASK) | |
| 99 | #define	trunc_page(x)		((unsigned long)(x) & ~PAGE_MASK) | |
| 100 | ||
| 101 | #define	atop(x)			((unsigned long)(x) >> PAGE_SHIFT) | |
| 102 | #define	ptoa(x)			((unsigned long)(x) << PAGE_SHIFT) | |
| 103 | ||
| 104 | 94 | #define	riscv_btop(x)		((unsigned long)(x) >> PAGE_SHIFT) |
| 105 | 95 | #define	riscv_ptob(x)		((unsigned long)(x) << PAGE_SHIFT) |
| 106 | 96 | |
| 107 | #define	pgtok(x)		((unsigned long)(x) * (PAGE_SIZE / 1024)) | |
| 108 | ||
| 109 | 97 | #endif /* !_MACHINE_PARAM_H_ */ |
| \ No newline at end of file |
lib/libc/include/riscv64-freebsd-none/machine/pcpu.h+2-1| ... | ... | @@ -46,7 +46,8 @@ |
| 46 | 46 | 	struct pmap *pc_curpmap;	/* Currently active pmap */	\ |
| 47 | 47 | 	uint32_t pc_pending_ipis;	/* IPIs pending to this CPU */	\ |
| 48 | 48 | 	uint32_t pc_hart;		/* Hart ID */			\ |
| 49 | 	char __pad[56]			/* Pad to factor of PAGE_SIZE */ | |
| 49 | 	uint64_t pc_clock;						\ | |
| 50 | 	char __pad[48]			/* Pad to factor of PAGE_SIZE */ | |
| 50 | 51 | |
| 51 | 52 | #ifdef _KERNEL |
| 52 | 53 |
lib/libc/include/riscv64-freebsd-none/machine/pmap.h+9-1| ... | ... | @@ -67,6 +67,12 @@ struct md_page { |
| 67 | 67 | 	vm_memattr_t		pv_memattr; |
| 68 | 68 | }; |
| 69 | 69 | |
| 70 | enum pmap_stage { | |
| 71 | 	PM_INVALID, | |
| 72 | 	PM_STAGE1, | |
| 73 | 	PM_STAGE2, | |
| 74 | }; | |
| 75 | ||
| 70 | 76 | struct pmap { |
| 71 | 77 | 	struct mtx		pm_mtx; |
| 72 | 78 | 	struct pmap_statistics	pm_stats;	/* pmap statictics */ |
| ... | ... | @@ -76,6 +82,7 @@ struct pmap { |
| 76 | 82 | 	TAILQ_HEAD(,pv_chunk)	pm_pvchunk;	/* list of mappings in pmap */ |
| 77 | 83 | 	LIST_ENTRY(pmap)	pm_list;	/* List of all pmaps */ |
| 78 | 84 | 	struct vm_radix		pm_root; |
| 85 | 	enum pmap_stage		pm_stage; | |
| 79 | 86 | }; |
| 80 | 87 | |
| 81 | 88 | typedef struct pmap *pmap_t; |
| ... | ... | @@ -126,7 +133,7 @@ struct thread; |
| 126 | 133 | |
| 127 | 134 | void	pmap_activate_boot(pmap_t); |
| 128 | 135 | void	pmap_activate_sw(struct thread *); |
| 129 | void	pmap_bootstrap(vm_offset_t, vm_paddr_t, vm_size_t); | |
| 136 | void	pmap_bootstrap(vm_paddr_t, vm_size_t); | |
| 130 | 137 | int	pmap_change_attr(vm_offset_t va, vm_size_t size, int mode); |
| 131 | 138 | void	pmap_kenter(vm_offset_t sva, vm_size_t size, vm_paddr_t pa, int mode); |
| 132 | 139 | void	pmap_kenter_device(vm_offset_t, vm_size_t, vm_paddr_t); |
| ... | ... | @@ -134,6 +141,7 @@ vm_paddr_t pmap_kextract(vm_offset_t va); |
| 134 | 141 | void	pmap_kremove(vm_offset_t); |
| 135 | 142 | void	pmap_kremove_device(vm_offset_t, vm_size_t); |
| 136 | 143 | void	*pmap_mapdev_attr(vm_paddr_t pa, vm_size_t size, vm_memattr_t ma); |
| 144 | int	pmap_pinit_stage(pmap_t, enum pmap_stage); | |
| 137 | 145 | bool	pmap_page_is_mapped(vm_page_t m); |
| 138 | 146 | bool	pmap_ps_enabled(pmap_t); |
| 139 | 147 |
lib/libc/include/riscv64-freebsd-none/machine/proc.h-2| ... | ... | @@ -25,8 +25,6 @@ |
| 25 | 25 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 26 | 26 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 27 | 27 | * SUCH DAMAGE. |
| 28 | * | |
| 29 | * from: @(#)proc.h 7.1 (Berkeley) 5/15/91 | |
| 30 | 28 | *	from: FreeBSD: src/sys/i386/include/proc.h,v 1.11 2001/06/29 |
| 31 | 29 | */ |
| 32 | 30 |
lib/libc/include/riscv64-freebsd-none/machine/pte.h+46-3| ... | ... | @@ -83,6 +83,51 @@ typedef	uint64_t	pn_t;			/* page number */ |
| 83 | 83 | #define	PTE_PROMOTE	(PTE_V | PTE_RWX | PTE_D | PTE_G | PTE_U | \ |
| 84 | 84 | 			 PTE_SW_MANAGED | PTE_SW_WIRED) |
| 85 | 85 | |
| 86 | /* | |
| 87 | * Svpbmt Memory Attribute (MA) bits [62:61]. | |
| 88 | * | |
| 89 | * +------+-------+------------------------------------------------------------+ | |
| 90 | * | Mode | Value | Requested Memory Attributes | | |
| 91 | * +------+-------+------------------------------------------------------------+ | |
| 92 | * | PMA | 00 | None, inherited from Physical Memory Attributes (firmware) | | |
| 93 | * | NC | 01 | Non-cacheable, idempotent, weakly-ordered (RVWMO), | | |
| 94 | * | | | main memory | | |
| 95 | * | IO | 10 | Non-cacheable, non-idempotent, strongly-ordered, I/O | | |
| 96 | * | -- | 11 | Reserved | | |
| 97 | * +------+-------+------------------------------------------------------------+ | |
| 98 | */ | |
| 99 | #define	PTE_MA_SHIFT		61 | |
| 100 | #define	PTE_MA_MASK		(0x3ul << PTE_MA_SHIFT) | |
| 101 | #define	PTE_MA_NONE		(0ul) | |
| 102 | #define	PTE_MA_NC		(1ul << PTE_MA_SHIFT) | |
| 103 | #define	PTE_MA_IO		(2ul << PTE_MA_SHIFT) | |
| 104 | ||
| 105 | /* | |
| 106 | * T-HEAD Custom Memory Attribute (MA) bits [63:59]. | |
| 107 | * | |
| 108 | * bit 59: Trustable (relating to TEE) | |
| 109 | * bit 60: Shareable (among CPUs, not configurable) | |
| 110 | * bit 61: Bufferable (writes to device memory) | |
| 111 | * bit 62: Cacheable | |
| 112 | * bit 63: Memory Ordering (1 = strongly ordered (device), 0 = default) | |
| 113 | * | |
| 114 | * +------+-------+------------------------------------------------------------+ | |
| 115 | * | Mode | Value | Requested Memory Attributes | | |
| 116 | * +------+-------+------------------------------------------------------------+ | |
| 117 | * | NC | 00110 | Weakly-ordered, non-cacheable, bufferable, shareable, | | |
| 118 | * | | | non-trustable | | |
| 119 | * | PMA | 01110 | Weakly-ordered, cacheable, bufferable, shareable, | | |
| 120 | * | | | non-trustable | | |
| 121 | * | IO | 10010 | Strongly-ordered, non-cacheable, non-bufferable, | | |
| 122 | * | | | shareable, non-trustable | | |
| 123 | * +------+-------+------------------------------------------------------------+ | |
| 124 | */ | |
| 125 | #define	PTE_THEAD_MA_SHIFT	59 | |
| 126 | #define	PTE_THEAD_MA_MASK	(0x1ful << PTE_THEAD_MA_SHIFT) | |
| 127 | #define	PTE_THEAD_MA_NC		(0x6ul << PTE_THEAD_MA_SHIFT) | |
| 128 | #define	PTE_THEAD_MA_NONE	(0xeul << PTE_THEAD_MA_SHIFT) | |
| 129 | #define	PTE_THEAD_MA_IO		(0x12ul << PTE_THEAD_MA_SHIFT) | |
| 130 | ||
| 86 | 131 | /* Bits 63 - 54 are reserved for future use. */ |
| 87 | 132 | #define PTE_HI_MASK	0xFFC0000000000000ULL |
| 88 | 133 | |
| ... | ... | @@ -92,6 +137,4 @@ typedef	uint64_t	pn_t;			/* page number */ |
| 92 | 137 | #define	PTE_PPN3_S	37 |
| 93 | 138 | #define	PTE_SIZE	8 |
| 94 | 139 | |
| 95 | #endif /* !_MACHINE_PTE_H_ */ | |
| 96 | ||
| 97 | /* End of pte.h */ | |
| \ No newline at end of file | ||
| 140 | #endif /* !_MACHINE_PTE_H_ */ | |
| \ No newline at end of file |
lib/libc/include/riscv64-freebsd-none/machine/resource.h-2| ... | ... | @@ -40,8 +40,6 @@ |
| 40 | 40 | #define	SYS_RES_MEMORY	3	/* i/o memory */ |
| 41 | 41 | #define	SYS_RES_IOPORT	4	/* i/o ports */ |
| 42 | 42 | #define	SYS_RES_GPIO	5	/* general purpose i/o */ |
| 43 | #ifdef NEW_PCIB | |
| 44 | 43 | #define	PCI_RES_BUS	6	/* PCI bus numbers */ |
| 45 | #endif | |
| 46 | 44 | |
| 47 | 45 | #endif /* !_MACHINE_RESOURCE_H_ */ |
| \ No newline at end of file |
lib/libc/include/riscv64-freebsd-none/machine/riscvreg.h+44-5| ... | ... | @@ -1,5 +1,5 @@ |
| 1 | 1 | /*- |
| 2 | * Copyright (c) 2015-2017 Ruslan Bukin <br@bsdpad.com> | |
| 2 | * Copyright (c) 2015-2024 Ruslan Bukin <br@bsdpad.com> | |
| 3 | 3 | * All rights reserved. |
| 4 | 4 | * |
| 5 | 5 | * Portions of this software were developed by SRI International and the |
| ... | ... | @@ -47,9 +47,15 @@ |
| 47 | 47 | #define	SCAUSE_STORE_ACCESS_FAULT	7 |
| 48 | 48 | #define	SCAUSE_ECALL_USER		8 |
| 49 | 49 | #define	SCAUSE_ECALL_SUPERVISOR		9 |
| 50 | #define	SCAUSE_VIRTUAL_SUPERVISOR_ECALL	10 | |
| 51 | #define	SCAUSE_MACHINE_ECALL		11 | |
| 50 | 52 | #define	SCAUSE_INST_PAGE_FAULT		12 |
| 51 | 53 | #define	SCAUSE_LOAD_PAGE_FAULT		13 |
| 52 | 54 | #define	SCAUSE_STORE_PAGE_FAULT		15 |
| 55 | #define	SCAUSE_FETCH_GUEST_PAGE_FAULT	20 | |
| 56 | #define	SCAUSE_LOAD_GUEST_PAGE_FAULT	21 | |
| 57 | #define	SCAUSE_VIRTUAL_INSTRUCTION	22 | |
| 58 | #define	SCAUSE_STORE_GUEST_PAGE_FAULT	23 | |
| 53 | 59 | |
| 54 | 60 | #define	SSTATUS_UIE			(1 << 0) |
| 55 | 61 | #define	SSTATUS_SIE			(1 << 1) |
| ... | ... | @@ -116,6 +122,17 @@ |
| 116 | 122 | #define	MSTATUS_PRV_H			2	/* hypervisor */ |
| 117 | 123 | #define	MSTATUS_PRV_M			3	/* machine */ |
| 118 | 124 | |
| 125 | #define	HSTATUS_VSBE	(1 << 5) | |
| 126 | #define	HSTATUS_GVA	(1 << 6) | |
| 127 | #define	HSTATUS_SPV	(1 << 7) | |
| 128 | #define	HSTATUS_SPVP	(1 << 8) | |
| 129 | #define	HSTATUS_HU	(1 << 9) | |
| 130 | #define	HSTATUS_VGEIN_S	12 | |
| 131 | #define	HSTATUS_VGEIN_M	(0xf << HSTATUS_VGEIN_S) | |
| 132 | #define	HSTATUS_VTVM	(1 << 20) | |
| 133 | #define	HSTATUS_VTW	(1 << 21) | |
| 134 | #define	HSTATUS_VTSR	(1 << 22) | |
| 135 | ||
| 119 | 136 | #define	MIE_USIE	(1 << 0) |
| 120 | 137 | #define	MIE_SSIE	(1 << 1) |
| 121 | 138 | #define	MIE_HSIE	(1 << 2) |
| ... | ... | @@ -143,10 +160,31 @@ |
| 143 | 160 | |
| 144 | 161 | #define	MIP_SEIP	(1 << 9) |
| 145 | 162 | |
| 163 | #define	HVIP_VSSIP	(1 << 2) | |
| 164 | #define	HVIP_VSTIP	(1 << 6) | |
| 165 | #define	HVIP_VSEIP	(1 << 10) | |
| 166 | ||
| 167 | #define	HIE_VSSIE	(1 << 2) | |
| 168 | #define	HIE_VSTIE	(1 << 6) | |
| 169 | #define	HIE_VSEIE	(1 << 10) | |
| 170 | #define	HIE_SGEIE	(1 << 12) | |
| 171 | ||
| 146 | 172 | /* Note: sip register has no SIP_STIP bit in Spike simulator */ |
| 147 | 173 | #define	SIP_SSIP	(1 << 1) |
| 148 | 174 | #define	SIP_STIP	(1 << 5) |
| 149 | 175 | |
| 176 | #define	HENVCFG_STCE	(1UL << 63) | |
| 177 | #define	HENVCFG_PBMTE	(1UL << 62) | |
| 178 | #define	HENVCFG_CBZE	(1UL << 7) | |
| 179 | #define	HENVCFG_CBCFE	(1UL << 6) | |
| 180 | #define	HENVCFG_CBIE_S	4 | |
| 181 | #define	HENVCFG_CBIE_M	(0x3 << HENVCFG_CBIE_S) | |
| 182 | #define	HENVCFG_FIOM	(1UL << 0) | |
| 183 | ||
| 184 | #define	HCOUNTEREN_CY	(1UL << 0) /* Cycle */ | |
| 185 | #define	HCOUNTEREN_TM	(1UL << 1) /* Time */ | |
| 186 | #define	HCOUNTEREN_IR	(1UL << 2) /* Instret */ | |
| 187 | ||
| 150 | 188 | #define	SATP_PPN_S	0 |
| 151 | 189 | #define	SATP_PPN_M	(0xfffffffffffUL << SATP_PPN_S) |
| 152 | 190 | #define	SATP_ASID_S	44 |
| ... | ... | @@ -189,13 +227,14 @@ |
| 189 | 227 | 	(__builtin_constant_p(val) && ((u_long)(val) < 32)) |
| 190 | 228 | |
| 191 | 229 | #define	csr_swap(csr, val)						\ |
| 192 | ({	if (CSR_ZIMM(val)) 						\ | |
| 230 | ({	u_long ret;							\ | |
| 231 | 	if (CSR_ZIMM(val)) 						\ | |
| 193 | 232 | 		__asm __volatile("csrrwi %0, " #csr ", %1"		\ |
| 194 | 				: "=r" (val) : "i" (val));		\ | |
| 233 | 				: "=r" (ret) : "i" (val));		\ | |
| 195 | 234 | 	else 								\ |
| 196 | 235 | 		__asm __volatile("csrrw %0, " #csr ", %1"		\ |
| 197 | 				: "=r" (val) : "r" (val));		\ | |
| 198 | 	val;								\ | |
| 236 | 				: "=r" (ret) : "r" (val));		\ | |
| 237 | 	ret;								\ | |
| 199 | 238 | }) |
| 200 | 239 | |
| 201 | 240 | #define	csr_write(csr, val)						\ |
lib/libc/include/riscv64-freebsd-none/machine/runq.h deleted-44| ... | ... | @@ -1,44 +0,0 @@ |
| 1 | /*- | |
| 2 | * Copyright (c) 2001 Jake Burkholder <jake@FreeBSD.org> | |
| 3 | * All rights reserved. | |
| 4 | * | |
| 5 | * Redistribution and use in source and binary forms, with or without | |
| 6 | * modification, are permitted provided that the following conditions | |
| 7 | * are met: | |
| 8 | * 1. Redistributions of source code must retain the above copyright | |
| 9 | * notice, this list of conditions and the following disclaimer. | |
| 10 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 11 | * notice, this list of conditions and the following disclaimer in the | |
| 12 | * documentation and/or other materials provided with the distribution. | |
| 13 | * | |
| 14 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |
| 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 16 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
| 17 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | |
| 18 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
| 19 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
| 20 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
| 21 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
| 22 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
| 23 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
| 24 | * SUCH DAMAGE. | |
| 25 | */ | |
| 26 | ||
| 27 | #ifndef	_MACHINE_RUNQ_H_ | |
| 28 | #define	_MACHINE_RUNQ_H_ | |
| 29 | ||
| 30 | #define	RQB_LEN		(1)		/* Number of priority status words. */ | |
| 31 | #define	RQB_L2BPW	(6)		/* Log2(sizeof(rqb_word_t) * NBBY)). */ | |
| 32 | #define	RQB_BPW		(1<<RQB_L2BPW)	/* Bits in an rqb_word_t. */ | |
| 33 | ||
| 34 | #define	RQB_BIT(pri)	(1ul << ((pri) & (RQB_BPW - 1))) | |
| 35 | #define	RQB_WORD(pri)	((pri) >> RQB_L2BPW) | |
| 36 | ||
| 37 | #define	RQB_FFS(word)	(ffsl(word) - 1) | |
| 38 | ||
| 39 | /* | |
| 40 | * Type of run queue status word. | |
| 41 | */ | |
| 42 | typedef	unsigned long	rqb_word_t; | |
| 43 | ||
| 44 | #endif | |
| \ No newline at end of file |
lib/libc/include/riscv64-freebsd-none/machine/sbi.h+9| ... | ... | @@ -49,6 +49,12 @@ |
| 49 | 49 | #define	SBI_IMPL_ID_KVM			3 |
| 50 | 50 | #define	SBI_IMPL_ID_RUSTSBI		4 |
| 51 | 51 | #define	SBI_IMPL_ID_DIOSIX		5 |
| 52 | #define	SBI_IMPL_ID_COFFER		6 | |
| 53 | #define	SBI_IMPL_ID_XEN_PROJECT		7 | |
| 54 | #define	SBI_IMPL_ID_POLARFIRE_HSS	8 | |
| 55 | #define	SBI_IMPL_ID_COREBOOT		9 | |
| 56 | #define	SBI_IMPL_ID_OREBOOT		10 | |
| 57 | #define	SBI_IMPL_ID_BHYVE		11 | |
| 52 | 58 | |
| 53 | 59 | /* SBI Error Codes */ |
| 54 | 60 | #define	SBI_SUCCESS			0 |
| ... | ... | @@ -117,6 +123,8 @@ |
| 117 | 123 | #define	SBI_REMOTE_SFENCE_VMA_ASID	7 |
| 118 | 124 | #define	SBI_SHUTDOWN			8 |
| 119 | 125 | |
| 126 | #ifndef LOCORE | |
| 127 | ||
| 120 | 128 | #define	SBI_CALL0(e, f)				SBI_CALL5(e, f, 0, 0, 0, 0, 0) |
| 121 | 129 | #define	SBI_CALL1(e, f, p1)			SBI_CALL5(e, f, p1, 0, 0, 0, 0) |
| 122 | 130 | #define	SBI_CALL2(e, f, p1, p2)			SBI_CALL5(e, f, p1, p2, 0, 0, 0) |
| ... | ... | @@ -236,4 +244,5 @@ sbi_console_getchar(void) |
| 236 | 244 | void sbi_print_version(void); |
| 237 | 245 | void sbi_init(void); |
| 238 | 246 | |
| 247 | #endif /* !LOCORE */ | |
| 239 | 248 | #endif /* !_MACHINE_SBI_H_ */ |
| \ No newline at end of file |
lib/libc/include/riscv64-freebsd-none/machine/sdt_machdep.h created+12| ... | ... | @@ -0,0 +1,12 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-2-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 2024 Mark Johnston <markj@FreeBSD.org> | |
| 5 | */ | |
| 6 | ||
| 7 | #ifndef _SYS_SDT_MACHDEP_H_ | |
| 8 | #define	_SYS_SDT_MACHDEP_H_ | |
| 9 | ||
| 10 | #define	_SDT_ASM_PATCH_INSTR	".option push; .option norvc; nop; .option pop" | |
| 11 | ||
| 12 | #endif /* _SYS_SDT_MACHDEP_H_ */ | |
| \ No newline at end of file |
lib/libc/include/riscv64-freebsd-none/machine/signal.h-2| ... | ... | @@ -25,8 +25,6 @@ |
| 25 | 25 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 26 | 26 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 27 | 27 | * SUCH DAMAGE. |
| 28 | * | |
| 29 | * @(#)signal.h 8.1 (Berkeley) 6/11/93 | |
| 30 | 28 | *	from: FreeBSD: src/sys/i386/include/signal.h,v 1.13 2000/11/09 |
| 31 | 29 | *	from: FreeBSD: src/sys/sparc64/include/signal.h,v 1.6 2001/09/30 18:52:17 |
| 32 | 30 | */ |
lib/libc/include/riscv64-freebsd-none/machine/thead.h created+37| ... | ... | @@ -0,0 +1,37 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-2-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 2024 The FreeBSD Foundation | |
| 5 | * | |
| 6 | * This software was developed by Mitchell Horne <mhorne@FreeBSD.org> under | |
| 7 | * sponsorship from the FreeBSD Foundation. | |
| 8 | * | |
| 9 | * Redistribution and use in source and binary forms, with or without | |
| 10 | * modification, are permitted provided that the following conditions | |
| 11 | * are met: | |
| 12 | * 1. Redistributions of source code must retain the above copyright | |
| 13 | * notice, this list of conditions and the following disclaimer. | |
| 14 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 15 | * notice, this list of conditions and the following disclaimer in the | |
| 16 | * documentation and/or other materials provided with the distribution. | |
| 17 | * | |
| 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |
| 19 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 20 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
| 21 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | |
| 22 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
| 23 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
| 24 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
| 25 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
| 26 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
| 27 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
| 28 | * SUCH DAMAGE. | |
| 29 | */ | |
| 30 | #ifndef _RISCV_THEAD_H_ | |
| 31 | #define	_RISCV_THEAD_H_ | |
| 32 | ||
| 33 | extern bool has_errata_thead_pbmt; | |
| 34 | ||
| 35 | void thead_setup_cache(void); | |
| 36 | ||
| 37 | #endif /* _RISCV_THEAD_H_ */ | |
| \ No newline at end of file |
lib/libc/include/riscv64-freebsd-none/machine/vm.h+7-3| ... | ... | @@ -28,10 +28,14 @@ |
| 28 | 28 | #define	_MACHINE_VM_H_ |
| 29 | 29 | |
| 30 | 30 | /* Memory attribute configuration. */ |
| 31 | #define	VM_MEMATTR_DEVICE	0 | |
| 31 | #define	VM_MEMATTR_PMA		0 | |
| 32 | 32 | #define	VM_MEMATTR_UNCACHEABLE	1 |
| 33 | #define	VM_MEMATTR_WRITE_BACK	2 | |
| 33 | #define	VM_MEMATTR_DEVICE	2 | |
| 34 | 34 | |
| 35 | #define	VM_MEMATTR_DEFAULT	VM_MEMATTR_WRITE_BACK | |
| 35 | #define	VM_MEMATTR_WRITE_BACK	VM_MEMATTR_PMA | |
| 36 | #define	VM_MEMATTR_DEFAULT	VM_MEMATTR_PMA | |
| 37 | ||
| 38 | #define	VM_MEMATTR_LAST		VM_MEMATTR_DEVICE | |
| 39 | #define	VM_MEMATTR_TOTAL	(VM_MEMATTR_LAST + 1) | |
| 36 | 40 | |
| 37 | 41 | #endif /* !_MACHINE_VM_H_ */ |
| \ No newline at end of file |
lib/libc/include/riscv64-freebsd-none/machine/vmm.h created+299| ... | ... | @@ -0,0 +1,299 @@ |
| 1 | /* | |
| 2 | * SPDX-License-Identifier: BSD-2-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 2015 Mihai Carabas <mihai.carabas@gmail.com> | |
| 5 | * Copyright (c) 2024 Ruslan Bukin <br@bsdpad.com> | |
| 6 | * | |
| 7 | * This software was developed by the University of Cambridge Computer | |
| 8 | * Laboratory (Department of Computer Science and Technology) under Innovate | |
| 9 | * UK project 105694, "Digital Security by Design (DSbD) Technology Platform | |
| 10 | * Prototype". | |
| 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 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 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 | #ifndef _VMM_H_ | |
| 35 | #define	_VMM_H_ | |
| 36 | ||
| 37 | #include <sys/param.h> | |
| 38 | #include <sys/cpuset.h> | |
| 39 | #include <vm/vm.h> | |
| 40 | #include <vm/pmap.h> | |
| 41 | ||
| 42 | #include "pte.h" | |
| 43 | #include "pmap.h" | |
| 44 | ||
| 45 | struct vcpu; | |
| 46 | ||
| 47 | enum vm_suspend_how { | |
| 48 | 	VM_SUSPEND_NONE, | |
| 49 | 	VM_SUSPEND_RESET, | |
| 50 | 	VM_SUSPEND_POWEROFF, | |
| 51 | 	VM_SUSPEND_HALT, | |
| 52 | 	VM_SUSPEND_DESTROY, | |
| 53 | 	VM_SUSPEND_LAST | |
| 54 | }; | |
| 55 | ||
| 56 | /* | |
| 57 | * Identifiers for architecturally defined registers. | |
| 58 | */ | |
| 59 | enum vm_reg_name { | |
| 60 | 	VM_REG_GUEST_ZERO = 0, | |
| 61 | 	VM_REG_GUEST_RA, | |
| 62 | 	VM_REG_GUEST_SP, | |
| 63 | 	VM_REG_GUEST_GP, | |
| 64 | 	VM_REG_GUEST_TP, | |
| 65 | 	VM_REG_GUEST_T0, | |
| 66 | 	VM_REG_GUEST_T1, | |
| 67 | 	VM_REG_GUEST_T2, | |
| 68 | 	VM_REG_GUEST_S0, | |
| 69 | 	VM_REG_GUEST_S1, | |
| 70 | 	VM_REG_GUEST_A0, | |
| 71 | 	VM_REG_GUEST_A1, | |
| 72 | 	VM_REG_GUEST_A2, | |
| 73 | 	VM_REG_GUEST_A3, | |
| 74 | 	VM_REG_GUEST_A4, | |
| 75 | 	VM_REG_GUEST_A5, | |
| 76 | 	VM_REG_GUEST_A6, | |
| 77 | 	VM_REG_GUEST_A7, | |
| 78 | 	VM_REG_GUEST_S2, | |
| 79 | 	VM_REG_GUEST_S3, | |
| 80 | 	VM_REG_GUEST_S4, | |
| 81 | 	VM_REG_GUEST_S5, | |
| 82 | 	VM_REG_GUEST_S6, | |
| 83 | 	VM_REG_GUEST_S7, | |
| 84 | 	VM_REG_GUEST_S8, | |
| 85 | 	VM_REG_GUEST_S9, | |
| 86 | 	VM_REG_GUEST_S10, | |
| 87 | 	VM_REG_GUEST_S11, | |
| 88 | 	VM_REG_GUEST_T3, | |
| 89 | 	VM_REG_GUEST_T4, | |
| 90 | 	VM_REG_GUEST_T5, | |
| 91 | 	VM_REG_GUEST_T6, | |
| 92 | 	VM_REG_GUEST_SEPC, | |
| 93 | 	VM_REG_LAST | |
| 94 | }; | |
| 95 | ||
| 96 | #define	VM_INTINFO_VECTOR(info)	((info) & 0xff) | |
| 97 | #define	VM_INTINFO_DEL_ERRCODE	0x800 | |
| 98 | #define	VM_INTINFO_RSVD		0x7ffff000 | |
| 99 | #define	VM_INTINFO_VALID	0x80000000 | |
| 100 | #define	VM_INTINFO_TYPE		0x700 | |
| 101 | #define	VM_INTINFO_HWINTR	(0 << 8) | |
| 102 | #define	VM_INTINFO_NMI		(2 << 8) | |
| 103 | #define	VM_INTINFO_HWEXCEPTION	(3 << 8) | |
| 104 | #define	VM_INTINFO_SWINTR	(4 << 8) | |
| 105 | ||
| 106 | #define	VM_MAX_NAMELEN	32 | |
| 107 | #define VM_MAX_SUFFIXLEN 15 | |
| 108 | ||
| 109 | #ifdef _KERNEL | |
| 110 | ||
| 111 | struct vm; | |
| 112 | struct vm_exception; | |
| 113 | struct vm_exit; | |
| 114 | struct vm_run; | |
| 115 | struct vm_object; | |
| 116 | struct vm_guest_paging; | |
| 117 | struct vm_aplic_descr; | |
| 118 | struct pmap; | |
| 119 | ||
| 120 | struct vm_eventinfo { | |
| 121 | 	void	*rptr;		/* rendezvous cookie */ | |
| 122 | 	int	*sptr;		/* suspend cookie */ | |
| 123 | 	int	*iptr;		/* reqidle cookie */ | |
| 124 | }; | |
| 125 | ||
| 126 | int vm_create(const char *name, struct vm **retvm); | |
| 127 | struct vcpu *vm_alloc_vcpu(struct vm *vm, int vcpuid); | |
| 128 | void vm_disable_vcpu_creation(struct vm *vm); | |
| 129 | void vm_slock_vcpus(struct vm *vm); | |
| 130 | void vm_unlock_vcpus(struct vm *vm); | |
| 131 | void vm_destroy(struct vm *vm); | |
| 132 | int vm_reinit(struct vm *vm); | |
| 133 | const char *vm_name(struct vm *vm); | |
| 134 | ||
| 135 | uint16_t vm_get_maxcpus(struct vm *vm); | |
| 136 | void vm_get_topology(struct vm *vm, uint16_t *sockets, uint16_t *cores, | |
| 137 | uint16_t *threads, uint16_t *maxcpus); | |
| 138 | int vm_set_topology(struct vm *vm, uint16_t sockets, uint16_t cores, | |
| 139 | uint16_t threads, uint16_t maxcpus); | |
| 140 | int vm_get_register(struct vcpu *vcpu, int reg, uint64_t *retval); | |
| 141 | int vm_set_register(struct vcpu *vcpu, int reg, uint64_t val); | |
| 142 | int vm_run(struct vcpu *vcpu); | |
| 143 | int vm_suspend(struct vm *vm, enum vm_suspend_how how); | |
| 144 | void* vm_get_cookie(struct vm *vm); | |
| 145 | int vcpu_vcpuid(struct vcpu *vcpu); | |
| 146 | void *vcpu_get_cookie(struct vcpu *vcpu); | |
| 147 | struct vm *vcpu_vm(struct vcpu *vcpu); | |
| 148 | struct vcpu *vm_vcpu(struct vm *vm, int cpu); | |
| 149 | int vm_get_capability(struct vcpu *vcpu, int type, int *val); | |
| 150 | int vm_set_capability(struct vcpu *vcpu, int type, int val); | |
| 151 | int vm_activate_cpu(struct vcpu *vcpu); | |
| 152 | int vm_suspend_cpu(struct vm *vm, struct vcpu *vcpu); | |
| 153 | int vm_resume_cpu(struct vm *vm, struct vcpu *vcpu); | |
| 154 | int vm_inject_exception(struct vcpu *vcpu, uint64_t scause); | |
| 155 | int vm_attach_aplic(struct vm *vm, struct vm_aplic_descr *descr); | |
| 156 | int vm_assert_irq(struct vm *vm, uint32_t irq); | |
| 157 | int vm_deassert_irq(struct vm *vm, uint32_t irq); | |
| 158 | int vm_raise_msi(struct vm *vm, uint64_t msg, uint64_t addr, int bus, int slot, | |
| 159 | int func); | |
| 160 | struct vm_exit *vm_exitinfo(struct vcpu *vcpu); | |
| 161 | void vm_exit_suspended(struct vcpu *vcpu, uint64_t pc); | |
| 162 | void vm_exit_debug(struct vcpu *vcpu, uint64_t pc); | |
| 163 | void vm_exit_rendezvous(struct vcpu *vcpu, uint64_t pc); | |
| 164 | void vm_exit_astpending(struct vcpu *vcpu, uint64_t pc); | |
| 165 | ||
| 166 | cpuset_t vm_active_cpus(struct vm *vm); | |
| 167 | cpuset_t vm_debug_cpus(struct vm *vm); | |
| 168 | cpuset_t vm_suspended_cpus(struct vm *vm); | |
| 169 | ||
| 170 | static __inline int | |
| 171 | vcpu_rendezvous_pending(struct vm_eventinfo *info) | |
| 172 | { | |
| 173 | ||
| 174 | 	return (*((uintptr_t *)(info->rptr)) != 0); | |
| 175 | } | |
| 176 | ||
| 177 | static __inline int | |
| 178 | vcpu_suspended(struct vm_eventinfo *info) | |
| 179 | { | |
| 180 | ||
| 181 | 	return (*info->sptr); | |
| 182 | } | |
| 183 | ||
| 184 | int vcpu_debugged(struct vcpu *vcpu); | |
| 185 | ||
| 186 | enum vcpu_state { | |
| 187 | 	VCPU_IDLE, | |
| 188 | 	VCPU_FROZEN, | |
| 189 | 	VCPU_RUNNING, | |
| 190 | 	VCPU_SLEEPING, | |
| 191 | }; | |
| 192 | ||
| 193 | int vcpu_set_state(struct vcpu *vcpu, enum vcpu_state state, bool from_idle); | |
| 194 | enum vcpu_state vcpu_get_state(struct vcpu *vcpu, int *hostcpu); | |
| 195 | ||
| 196 | static int __inline | |
| 197 | vcpu_is_running(struct vcpu *vcpu, int *hostcpu) | |
| 198 | { | |
| 199 | 	return (vcpu_get_state(vcpu, hostcpu) == VCPU_RUNNING); | |
| 200 | } | |
| 201 | ||
| 202 | #ifdef _SYS_PROC_H_ | |
| 203 | static int __inline | |
| 204 | vcpu_should_yield(struct vcpu *vcpu) | |
| 205 | { | |
| 206 | 	struct thread *td; | |
| 207 | ||
| 208 | 	td = curthread; | |
| 209 | 	return (td->td_ast != 0 || td->td_owepreempt != 0); | |
| 210 | } | |
| 211 | #endif | |
| 212 | ||
| 213 | void *vcpu_stats(struct vcpu *vcpu); | |
| 214 | void vcpu_notify_event(struct vcpu *vcpu); | |
| 215 | struct vmspace *vm_vmspace(struct vm *vm); | |
| 216 | struct vm_mem *vm_mem(struct vm *vm); | |
| 217 | ||
| 218 | enum vm_reg_name vm_segment_name(int seg_encoding); | |
| 219 | ||
| 220 | #endif	/* _KERNEL */ | |
| 221 | ||
| 222 | #define	VM_DIR_READ	0 | |
| 223 | #define	VM_DIR_WRITE	1 | |
| 224 | ||
| 225 | #define	VM_GP_M_MASK		0x1f | |
| 226 | #define	VM_GP_MMU_ENABLED	(1 << 5) | |
| 227 | ||
| 228 | struct vm_guest_paging { | |
| 229 | 	int		flags; | |
| 230 | 	int		padding; | |
| 231 | }; | |
| 232 | ||
| 233 | struct vie { | |
| 234 | 	uint8_t access_size:4, sign_extend:1, dir:1, unused:2; | |
| 235 | 	enum vm_reg_name reg; | |
| 236 | }; | |
| 237 | ||
| 238 | struct vre { | |
| 239 | 	uint32_t inst_syndrome; | |
| 240 | 	uint8_t dir:1, unused:7; | |
| 241 | 	enum vm_reg_name reg; | |
| 242 | }; | |
| 243 | ||
| 244 | /* | |
| 245 | * Identifiers for optional vmm capabilities | |
| 246 | */ | |
| 247 | enum vm_cap_type { | |
| 248 | 	VM_CAP_UNRESTRICTED_GUEST, | |
| 249 | 	VM_CAP_SSTC, | |
| 250 | 	VM_CAP_MAX | |
| 251 | }; | |
| 252 | ||
| 253 | enum vm_exitcode { | |
| 254 | 	VM_EXITCODE_BOGUS, | |
| 255 | 	VM_EXITCODE_ECALL, | |
| 256 | 	VM_EXITCODE_HYP, | |
| 257 | 	VM_EXITCODE_PAGING, | |
| 258 | 	VM_EXITCODE_SUSPENDED, | |
| 259 | 	VM_EXITCODE_DEBUG, | |
| 260 | 	VM_EXITCODE_INST_EMUL, | |
| 261 | 	VM_EXITCODE_WFI, | |
| 262 | 	VM_EXITCODE_MAX | |
| 263 | }; | |
| 264 | ||
| 265 | struct vm_exit { | |
| 266 | 	uint64_t scause; | |
| 267 | 	uint64_t sepc; | |
| 268 | 	uint64_t stval; | |
| 269 | 	uint64_t htval; | |
| 270 | 	uint64_t htinst; | |
| 271 | 	enum vm_exitcode exitcode; | |
| 272 | 	int inst_length; | |
| 273 | 	uint64_t pc; | |
| 274 | 	union { | |
| 275 | 		struct { | |
| 276 | 			uint64_t gpa; | |
| 277 | 		} paging; | |
| 278 | ||
| 279 | 		struct { | |
| 280 | 			uint64_t gpa; | |
| 281 | 			struct vm_guest_paging paging; | |
| 282 | 			struct vie vie; | |
| 283 | 		} inst_emul; | |
| 284 | ||
| 285 | 		struct { | |
| 286 | 			uint64_t args[8]; | |
| 287 | 		} ecall; | |
| 288 | ||
| 289 | 		struct { | |
| 290 | 			enum vm_suspend_how how; | |
| 291 | 		} suspended; | |
| 292 | ||
| 293 | 		struct { | |
| 294 | 			uint64_t scause; | |
| 295 | 		} hyp; | |
| 296 | 	} u; | |
| 297 | }; | |
| 298 | ||
| 299 | #endif	/* _VMM_H_ */ | |
| \ No newline at end of file |
lib/libc/include/riscv64-freebsd-none/machine/vmm_dev.h created+265| ... | ... | @@ -0,0 +1,265 @@ |
| 1 | /* | |
| 2 | * SPDX-License-Identifier: BSD-2-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 2015 Mihai Carabas <mihai.carabas@gmail.com> | |
| 5 | * Copyright (c) 2024 Ruslan Bukin <br@bsdpad.com> | |
| 6 | * | |
| 7 | * This software was developed by the University of Cambridge Computer | |
| 8 | * Laboratory (Department of Computer Science and Technology) under Innovate | |
| 9 | * UK project 105694, "Digital Security by Design (DSbD) Technology Platform | |
| 10 | * Prototype". | |
| 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 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 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 | #ifndef	_VMM_DEV_H_ | |
| 35 | #define	_VMM_DEV_H_ | |
| 36 | ||
| 37 | #include <sys/domainset.h> | |
| 38 | ||
| 39 | #include <machine/vmm.h> | |
| 40 | ||
| 41 | struct vm_memmap { | |
| 42 | 	vm_paddr_t	gpa; | |
| 43 | 	int		segid;		/* memory segment */ | |
| 44 | 	vm_ooffset_t	segoff;		/* offset into memory segment */ | |
| 45 | 	size_t		len;		/* mmap length */ | |
| 46 | 	int		prot;		/* RWX */ | |
| 47 | 	int		flags; | |
| 48 | }; | |
| 49 | #define	VM_MEMMAP_F_WIRED	0x01 | |
| 50 | ||
| 51 | struct vm_munmap { | |
| 52 | 	vm_paddr_t	gpa; | |
| 53 | 	size_t		len; | |
| 54 | }; | |
| 55 | ||
| 56 | #define	VM_MEMSEG_NAME(m)	((m)->name[0] != '\0' ? (m)->name : NULL) | |
| 57 | struct vm_memseg { | |
| 58 | 	int		segid; | |
| 59 | 	size_t		len; | |
| 60 | 	char		name[VM_MAX_SUFFIXLEN + 1]; | |
| 61 | 	domainset_t	*ds_mask; | |
| 62 | 	size_t		ds_mask_size; | |
| 63 | 	int		ds_policy; | |
| 64 | }; | |
| 65 | ||
| 66 | struct vm_register { | |
| 67 | 	int		cpuid; | |
| 68 | 	int		regnum;		/* enum vm_reg_name */ | |
| 69 | 	uint64_t	regval; | |
| 70 | }; | |
| 71 | ||
| 72 | struct vm_register_set { | |
| 73 | 	int		cpuid; | |
| 74 | 	unsigned int	count; | |
| 75 | 	const int	*regnums;	/* enum vm_reg_name */ | |
| 76 | 	uint64_t	*regvals; | |
| 77 | }; | |
| 78 | ||
| 79 | struct vm_run { | |
| 80 | 	int		cpuid; | |
| 81 | 	cpuset_t	*cpuset;	/* CPU set storage */ | |
| 82 | 	size_t		cpusetsize; | |
| 83 | 	struct vm_exit	*vm_exit; | |
| 84 | }; | |
| 85 | ||
| 86 | struct vm_exception { | |
| 87 | 	int		cpuid; | |
| 88 | 	uint64_t	scause; | |
| 89 | }; | |
| 90 | ||
| 91 | struct vm_msi { | |
| 92 | 	uint64_t	msg; | |
| 93 | 	uint64_t	addr; | |
| 94 | 	int		bus; | |
| 95 | 	int		slot; | |
| 96 | 	int		func; | |
| 97 | }; | |
| 98 | ||
| 99 | struct vm_capability { | |
| 100 | 	int		cpuid; | |
| 101 | 	enum vm_cap_type captype; | |
| 102 | 	int		capval; | |
| 103 | 	int		allcpus; | |
| 104 | }; | |
| 105 | ||
| 106 | #define	MAX_VM_STATS	64 | |
| 107 | struct vm_stats { | |
| 108 | 	int		cpuid;				/* in */ | |
| 109 | 	int		index;				/* in */ | |
| 110 | 	int		num_entries;			/* out */ | |
| 111 | 	struct timeval	tv; | |
| 112 | 	uint64_t	statbuf[MAX_VM_STATS]; | |
| 113 | }; | |
| 114 | struct vm_stat_desc { | |
| 115 | 	int		index;				/* in */ | |
| 116 | 	char		desc[128];			/* out */ | |
| 117 | }; | |
| 118 | ||
| 119 | struct vm_suspend { | |
| 120 | 	enum vm_suspend_how how; | |
| 121 | }; | |
| 122 | ||
| 123 | struct vm_gla2gpa { | |
| 124 | 	int		vcpuid;		/* inputs */ | |
| 125 | 	int 		prot;		/* PROT_READ or PROT_WRITE */ | |
| 126 | 	uint64_t	gla; | |
| 127 | 	struct vm_guest_paging paging; | |
| 128 | 	int		fault;		/* outputs */ | |
| 129 | 	uint64_t	gpa; | |
| 130 | }; | |
| 131 | ||
| 132 | struct vm_activate_cpu { | |
| 133 | 	int		vcpuid; | |
| 134 | }; | |
| 135 | ||
| 136 | struct vm_cpuset { | |
| 137 | 	int		which; | |
| 138 | 	int		cpusetsize; | |
| 139 | 	cpuset_t	*cpus; | |
| 140 | }; | |
| 141 | #define	VM_ACTIVE_CPUS		0 | |
| 142 | #define	VM_SUSPENDED_CPUS	1 | |
| 143 | #define	VM_DEBUG_CPUS		2 | |
| 144 | ||
| 145 | struct vm_aplic_descr { | |
| 146 | 	uint64_t mem_start; | |
| 147 | 	uint64_t mem_size; | |
| 148 | }; | |
| 149 | ||
| 150 | struct vm_irq { | |
| 151 | 	uint32_t irq; | |
| 152 | }; | |
| 153 | ||
| 154 | struct vm_cpu_topology { | |
| 155 | 	uint16_t	sockets; | |
| 156 | 	uint16_t	cores; | |
| 157 | 	uint16_t	threads; | |
| 158 | 	uint16_t	maxcpus; | |
| 159 | }; | |
| 160 | ||
| 161 | enum { | |
| 162 | 	/* general routines */ | |
| 163 | 	IOCNUM_ABIVERS = 0, | |
| 164 | 	IOCNUM_RUN = 1, | |
| 165 | 	IOCNUM_SET_CAPABILITY = 2, | |
| 166 | 	IOCNUM_GET_CAPABILITY = 3, | |
| 167 | 	IOCNUM_SUSPEND = 4, | |
| 168 | 	IOCNUM_REINIT = 5, | |
| 169 | ||
| 170 | 	/* memory apis */ | |
| 171 | 	IOCNUM_GET_GPA_PMAP = 12, | |
| 172 | 	IOCNUM_GLA2GPA_NOFAULT = 13, | |
| 173 | 	IOCNUM_ALLOC_MEMSEG = 14, | |
| 174 | 	IOCNUM_GET_MEMSEG = 15, | |
| 175 | 	IOCNUM_MMAP_MEMSEG = 16, | |
| 176 | 	IOCNUM_MMAP_GETNEXT = 17, | |
| 177 | 	IOCNUM_MUNMAP_MEMSEG = 18, | |
| 178 | ||
| 179 | 	/* register/state accessors */ | |
| 180 | 	IOCNUM_SET_REGISTER = 20, | |
| 181 | 	IOCNUM_GET_REGISTER = 21, | |
| 182 | 	IOCNUM_SET_REGISTER_SET = 24, | |
| 183 | 	IOCNUM_GET_REGISTER_SET = 25, | |
| 184 | ||
| 185 | 	/* statistics */ | |
| 186 | 	IOCNUM_VM_STATS = 50, | |
| 187 | 	IOCNUM_VM_STAT_DESC = 51, | |
| 188 | ||
| 189 | 	/* CPU Topology */ | |
| 190 | 	IOCNUM_SET_TOPOLOGY = 63, | |
| 191 | 	IOCNUM_GET_TOPOLOGY = 64, | |
| 192 | ||
| 193 | 	/* interrupt injection */ | |
| 194 | 	IOCNUM_ASSERT_IRQ = 80, | |
| 195 | 	IOCNUM_DEASSERT_IRQ = 81, | |
| 196 | 	IOCNUM_RAISE_MSI = 82, | |
| 197 | 	IOCNUM_INJECT_EXCEPTION = 83, | |
| 198 | ||
| 199 | 	/* vm_cpuset */ | |
| 200 | 	IOCNUM_ACTIVATE_CPU = 90, | |
| 201 | 	IOCNUM_GET_CPUSET = 91, | |
| 202 | 	IOCNUM_SUSPEND_CPU = 92, | |
| 203 | 	IOCNUM_RESUME_CPU = 93, | |
| 204 | ||
| 205 | 	/* vm_attach_aplic */ | |
| 206 | 	IOCNUM_ATTACH_APLIC = 110, | |
| 207 | }; | |
| 208 | ||
| 209 | #define	VM_RUN		\ | |
| 210 | 	_IOWR('v', IOCNUM_RUN, struct vm_run) | |
| 211 | #define	VM_SUSPEND	\ | |
| 212 | 	_IOW('v', IOCNUM_SUSPEND, struct vm_suspend) | |
| 213 | #define	VM_REINIT	\ | |
| 214 | 	_IO('v', IOCNUM_REINIT) | |
| 215 | #define	VM_ALLOC_MEMSEG	\ | |
| 216 | 	_IOW('v', IOCNUM_ALLOC_MEMSEG, struct vm_memseg) | |
| 217 | #define	VM_GET_MEMSEG	\ | |
| 218 | 	_IOWR('v', IOCNUM_GET_MEMSEG, struct vm_memseg) | |
| 219 | #define	VM_MMAP_MEMSEG	\ | |
| 220 | 	_IOW('v', IOCNUM_MMAP_MEMSEG, struct vm_memmap) | |
| 221 | #define	VM_MMAP_GETNEXT	\ | |
| 222 | 	_IOWR('v', IOCNUM_MMAP_GETNEXT, struct vm_memmap) | |
| 223 | #define	VM_MUNMAP_MEMSEG	\ | |
| 224 | 	_IOW('v', IOCNUM_MUNMAP_MEMSEG, struct vm_munmap) | |
| 225 | #define	VM_SET_REGISTER \ | |
| 226 | 	_IOW('v', IOCNUM_SET_REGISTER, struct vm_register) | |
| 227 | #define	VM_GET_REGISTER \ | |
| 228 | 	_IOWR('v', IOCNUM_GET_REGISTER, struct vm_register) | |
| 229 | #define	VM_SET_REGISTER_SET \ | |
| 230 | 	_IOW('v', IOCNUM_SET_REGISTER_SET, struct vm_register_set) | |
| 231 | #define	VM_GET_REGISTER_SET \ | |
| 232 | 	_IOWR('v', IOCNUM_GET_REGISTER_SET, struct vm_register_set) | |
| 233 | #define	VM_SET_CAPABILITY \ | |
| 234 | 	_IOW('v', IOCNUM_SET_CAPABILITY, struct vm_capability) | |
| 235 | #define	VM_GET_CAPABILITY \ | |
| 236 | 	_IOWR('v', IOCNUM_GET_CAPABILITY, struct vm_capability) | |
| 237 | #define	VM_STATS \ | |
| 238 | 	_IOWR('v', IOCNUM_VM_STATS, struct vm_stats) | |
| 239 | #define	VM_STAT_DESC \ | |
| 240 | 	_IOWR('v', IOCNUM_VM_STAT_DESC, struct vm_stat_desc) | |
| 241 | #define VM_ASSERT_IRQ \ | |
| 242 | 	_IOW('v', IOCNUM_ASSERT_IRQ, struct vm_irq) | |
| 243 | #define VM_DEASSERT_IRQ \ | |
| 244 | 	_IOW('v', IOCNUM_DEASSERT_IRQ, struct vm_irq) | |
| 245 | #define VM_RAISE_MSI \ | |
| 246 | 	_IOW('v', IOCNUM_RAISE_MSI, struct vm_msi) | |
| 247 | #define	VM_INJECT_EXCEPTION	\ | |
| 248 | 	_IOW('v', IOCNUM_INJECT_EXCEPTION, struct vm_exception) | |
| 249 | #define VM_SET_TOPOLOGY \ | |
| 250 | 	_IOW('v', IOCNUM_SET_TOPOLOGY, struct vm_cpu_topology) | |
| 251 | #define VM_GET_TOPOLOGY \ | |
| 252 | 	_IOR('v', IOCNUM_GET_TOPOLOGY, struct vm_cpu_topology) | |
| 253 | #define	VM_GLA2GPA_NOFAULT \ | |
| 254 | 	_IOWR('v', IOCNUM_GLA2GPA_NOFAULT, struct vm_gla2gpa) | |
| 255 | #define	VM_ACTIVATE_CPU	\ | |
| 256 | 	_IOW('v', IOCNUM_ACTIVATE_CPU, struct vm_activate_cpu) | |
| 257 | #define	VM_GET_CPUS	\ | |
| 258 | 	_IOW('v', IOCNUM_GET_CPUSET, struct vm_cpuset) | |
| 259 | #define	VM_SUSPEND_CPU \ | |
| 260 | 	_IOW('v', IOCNUM_SUSPEND_CPU, struct vm_activate_cpu) | |
| 261 | #define	VM_RESUME_CPU \ | |
| 262 | 	_IOW('v', IOCNUM_RESUME_CPU, struct vm_activate_cpu) | |
| 263 | #define	VM_ATTACH_APLIC	\ | |
| 264 | 	_IOW('v', IOCNUM_ATTACH_APLIC, struct vm_aplic_descr) | |
| 265 | #endif | |
| \ No newline at end of file |
lib/libc/include/riscv64-freebsd-none/machine/vmm_instruction_emul.h created+85| ... | ... | @@ -0,0 +1,85 @@ |
| 1 | /* | |
| 2 | * SPDX-License-Identifier: BSD-2-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 2015 Mihai Carabas <mihai.carabas@gmail.com> | |
| 5 | * All rights reserved. | |
| 6 | * | |
| 7 | * Redistribution and use in source and binary forms, with or without | |
| 8 | * modification, are permitted provided that the following conditions | |
| 9 | * are met: | |
| 10 | * 1. Redistributions of source code must retain the above copyright | |
| 11 | * notice, this list of conditions and the following disclaimer. | |
| 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 13 | * notice, this list of conditions and the following disclaimer in the | |
| 14 | * documentation and/or other materials provided with the distribution. | |
| 15 | * | |
| 16 | * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |
| 17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
| 19 | * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE | |
| 20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
| 21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
| 22 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
| 23 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
| 24 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
| 25 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
| 26 | * SUCH DAMAGE. | |
| 27 | */ | |
| 28 | ||
| 29 | #ifndef	_VMM_INSTRUCTION_EMUL_H_ | |
| 30 | #define	_VMM_INSTRUCTION_EMUL_H_ | |
| 31 | ||
| 32 | /* | |
| 33 | * Callback functions to read and write memory regions. | |
| 34 | */ | |
| 35 | typedef int (*mem_region_read_t)(struct vcpu *vcpu, uint64_t gpa, | |
| 36 | 				 uint64_t *rval, int rsize, void *arg); | |
| 37 | typedef int (*mem_region_write_t)(struct vcpu *vcpu, uint64_t gpa, | |
| 38 | 				 uint64_t wval, int wsize, void *arg); | |
| 39 | ||
| 40 | /* | |
| 41 | * Callback functions to read and write registers. | |
| 42 | */ | |
| 43 | typedef int (*reg_read_t)(struct vcpu *vcpu, uint64_t *rval, void *arg); | |
| 44 | typedef int (*reg_write_t)(struct vcpu *vcpu, uint64_t wval, void *arg); | |
| 45 | ||
| 46 | /* | |
| 47 | * Emulate the decoded 'vie' instruction when it contains a memory operation. | |
| 48 | * | |
| 49 | * The callbacks 'mrr' and 'mrw' emulate reads and writes to the memory region | |
| 50 | * containing 'gpa'. 'mrarg' is an opaque argument that is passed into the | |
| 51 | * callback functions. | |
| 52 | * | |
| 53 | * 'void *vm' should be 'struct vm *' when called from kernel context and | |
| 54 | * 'struct vmctx *' when called from user context. | |
| 55 | * | |
| 56 | */ | |
| 57 | int vmm_emulate_instruction(struct vcpu *vcpu, uint64_t gpa, struct vie *vie, | |
| 58 | struct vm_guest_paging *paging, mem_region_read_t mrr, | |
| 59 | mem_region_write_t mrw, void *mrarg); | |
| 60 | ||
| 61 | /* | |
| 62 | * Emulate the decoded 'vre' instruction when it contains a register access. | |
| 63 | * | |
| 64 | * The callbacks 'regread' and 'regwrite' emulate reads and writes to the | |
| 65 | * register from 'vie'. 'regarg' is an opaque argument that is passed into the | |
| 66 | * callback functions. | |
| 67 | * | |
| 68 | * 'void *vm' should be 'struct vm *' when called from kernel context and | |
| 69 | * 'struct vmctx *' when called from user context. | |
| 70 | * | |
| 71 | */ | |
| 72 | int vmm_emulate_register(struct vcpu *vcpu, struct vre *vre, reg_read_t regread, | |
| 73 | reg_write_t regwrite, void *regarg); | |
| 74 | ||
| 75 | #ifdef _KERNEL | |
| 76 | void vm_register_reg_handler(struct vm *vm, uint64_t iss, uint64_t mask, | |
| 77 | reg_read_t reg_read, reg_write_t reg_write, void *arg); | |
| 78 | void vm_deregister_reg_handler(struct vm *vm, uint64_t iss, uint64_t mask); | |
| 79 | ||
| 80 | void vm_register_inst_handler(struct vm *vm, uint64_t start, uint64_t size, | |
| 81 | mem_region_read_t mmio_read, mem_region_write_t mmio_write); | |
| 82 | void vm_deregister_inst_handler(struct vm *vm, uint64_t start, uint64_t size); | |
| 83 | #endif | |
| 84 | ||
| 85 | #endif	/* _VMM_INSTRUCTION_EMUL_H_ */ | |
| \ No newline at end of file |
lib/libc/include/riscv64-freebsd-none/machine/vmparam.h+7-7| ... | ... | @@ -30,8 +30,6 @@ |
| 30 | 30 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 31 | 31 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 32 | 32 | * SUCH DAMAGE. |
| 33 | * | |
| 34 | *	from: @(#)vmparam.h 5.9 (Berkeley) 5/12/91 | |
| 35 | 33 | *	from: FreeBSD: src/sys/i386/include/vmparam.h,v 1.33 2000/03/30 |
| 36 | 34 | */ |
| 37 | 35 | |
| ... | ... | @@ -211,8 +209,6 @@ |
| 211 | 209 | #define	PS_STRINGS_SV39		(USRSTACK_SV39 - sizeof(struct ps_strings)) |
| 212 | 210 | #define	PS_STRINGS_SV48		(USRSTACK_SV48 - sizeof(struct ps_strings)) |
| 213 | 211 | |
| 214 | #define	VM_EARLY_DTB_ADDRESS	(VM_MAX_KERNEL_ADDRESS - (2 * L2_SIZE)) | |
| 215 | ||
| 216 | 212 | /* |
| 217 | 213 | * How many physical pages per kmem arena virtual page. |
| 218 | 214 | */ |
| ... | ... | @@ -236,19 +232,22 @@ |
| 236 | 232 | #define	VM_INITIAL_PAGEIN	16 |
| 237 | 233 | #endif |
| 238 | 234 | |
| 239 | #define	UMA_MD_SMALL_ALLOC | |
| 235 | #define UMA_USE_DMAP | |
| 240 | 236 | |
| 241 | 237 | #ifndef LOCORE |
| 242 | 238 | extern vm_paddr_t dmap_phys_base; |
| 243 | 239 | extern vm_paddr_t dmap_phys_max; |
| 244 | 240 | extern vm_offset_t dmap_max_addr; |
| 245 | extern vm_offset_t init_pt_va; | |
| 246 | 241 | #endif |
| 247 | 242 | |
| 248 | 243 | #define	ZERO_REGION_SIZE	(64 * 1024)	/* 64KB */ |
| 249 | 244 | |
| 245 | /* | |
| 246 | * The top of KVA is reserved for early device mappings. | |
| 247 | */ | |
| 250 | 248 | #define	DEVMAP_MAX_VADDR	VM_MAX_KERNEL_ADDRESS |
| 251 | #define	PMAP_MAPDEV_EARLY_SIZE	L2_SIZE | |
| 249 | #define	DEVMAP_MIN_VADDR	(DEVMAP_MAX_VADDR - PMAP_MAPDEV_EARLY_SIZE) | |
| 250 | #define	PMAP_MAPDEV_EARLY_SIZE	(4 * L2_SIZE) | |
| 252 | 251 | |
| 253 | 252 | /* |
| 254 | 253 | * No non-transparent large page support in the pmap. |
| ... | ... | @@ -259,5 +258,6 @@ extern vm_offset_t init_pt_va; |
| 259 | 258 | * Need a page dump array for minidump. |
| 260 | 259 | */ |
| 261 | 260 | #define MINIDUMP_PAGE_TRACKING	1 |
| 261 | #define MINIDUMP_STARTUP_PAGE_TRACKING 1 | |
| 262 | 262 | |
| 263 | 263 | #endif /* !_MACHINE_VMPARAM_H_ */ |
| \ No newline at end of file |
lib/libc/include/x86-freebsd-none/fenv.h deleted-348| ... | ... | @@ -1,348 +0,0 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-2-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 2004-2005 David Schultz <das@FreeBSD.ORG> | |
| 5 | * All rights reserved. | |
| 6 | * | |
| 7 | * Redistribution and use in source and binary forms, with or without | |
| 8 | * modification, are permitted provided that the following conditions | |
| 9 | * are met: | |
| 10 | * 1. Redistributions of source code must retain the above copyright | |
| 11 | * notice, this list of conditions and the following disclaimer. | |
| 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 13 | * notice, this list of conditions and the following disclaimer in the | |
| 14 | * documentation and/or other materials provided with the distribution. | |
| 15 | * | |
| 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |
| 17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
| 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | |
| 20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
| 21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
| 22 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
| 23 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
| 24 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
| 25 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
| 26 | * SUCH DAMAGE. | |
| 27 | */ | |
| 28 | ||
| 29 | #ifndef	_FENV_H_ | |
| 30 | #define	_FENV_H_ | |
| 31 | ||
| 32 | #include <sys/cdefs.h> | |
| 33 | #include <sys/_types.h> | |
| 34 | #include <ieeefp.h> | |
| 35 | ||
| 36 | #ifndef	__fenv_static | |
| 37 | #define	__fenv_static	static | |
| 38 | #endif | |
| 39 | ||
| 40 | typedef	__uint16_t	fexcept_t; | |
| 41 | ||
| 42 | /* Exception flags */ | |
| 43 | #define	FE_INVALID	0x01 | |
| 44 | #define	FE_DENORMAL	0x02 | |
| 45 | #define	FE_DIVBYZERO	0x04 | |
| 46 | #define	FE_OVERFLOW	0x08 | |
| 47 | #define	FE_UNDERFLOW	0x10 | |
| 48 | #define	FE_INEXACT	0x20 | |
| 49 | #define	FE_ALL_EXCEPT	(FE_DIVBYZERO | FE_DENORMAL | FE_INEXACT | \ | |
| 50 | 			 FE_INVALID | FE_OVERFLOW | FE_UNDERFLOW) | |
| 51 | ||
| 52 | /* Rounding modes */ | |
| 53 | #define	FE_TONEAREST	0x0000 | |
| 54 | #define	FE_DOWNWARD	0x0400 | |
| 55 | #define	FE_UPWARD	0x0800 | |
| 56 | #define	FE_TOWARDZERO	0x0c00 | |
| 57 | #define	_ROUND_MASK	(FE_TONEAREST | FE_DOWNWARD | \ | |
| 58 | 			 FE_UPWARD | FE_TOWARDZERO) | |
| 59 | ||
| 60 | /* | |
| 61 | * As compared to the x87 control word, the SSE unit's control word | |
| 62 | * has the rounding control bits offset by 3 and the exception mask | |
| 63 | * bits offset by 7. | |
| 64 | */ | |
| 65 | #define	_SSE_ROUND_SHIFT	3 | |
| 66 | #define	_SSE_EMASK_SHIFT	7 | |
| 67 | ||
| 68 | #ifdef __i386__ | |
| 69 | /* | |
| 70 | * To preserve binary compatibility with FreeBSD 5.3, we pack the | |
| 71 | * mxcsr into some reserved fields, rather than changing sizeof(fenv_t). | |
| 72 | */ | |
| 73 | typedef struct { | |
| 74 | 	__uint16_t	__control; | |
| 75 | 	__uint16_t __mxcsr_hi; | |
| 76 | 	__uint16_t	__status; | |
| 77 | 	__uint16_t __mxcsr_lo; | |
| 78 | 	__uint32_t	__tag; | |
| 79 | 	char		__other[16]; | |
| 80 | } fenv_t; | |
| 81 | #else /* __amd64__ */ | |
| 82 | typedef struct { | |
| 83 | 	struct { | |
| 84 | 		__uint32_t	__control; | |
| 85 | 		__uint32_t	__status; | |
| 86 | 		__uint32_t	__tag; | |
| 87 | 		char		__other[16]; | |
| 88 | 	} __x87; | |
| 89 | 	__uint32_t		__mxcsr; | |
| 90 | } fenv_t; | |
| 91 | #endif /* __i386__ */ | |
| 92 | ||
| 93 | __BEGIN_DECLS | |
| 94 | ||
| 95 | /* Default floating-point environment */ | |
| 96 | extern const fenv_t	__fe_dfl_env; | |
| 97 | #define	FE_DFL_ENV	(&__fe_dfl_env) | |
| 98 | ||
| 99 | #define	__fldenvx(__env)	__asm __volatile("fldenv %0" : : "m" (__env) \ | |
| 100 | 				: "st", "st(1)", "st(2)", "st(3)", "st(4)", \ | |
| 101 | 				"st(5)", "st(6)", "st(7)") | |
| 102 | #define	__fwait()		__asm __volatile("fwait") | |
| 103 | ||
| 104 | int fegetenv(fenv_t *__envp); | |
| 105 | int feholdexcept(fenv_t *__envp); | |
| 106 | int fesetexceptflag(const fexcept_t *__flagp, int __excepts); | |
| 107 | int feraiseexcept(int __excepts); | |
| 108 | int feupdateenv(const fenv_t *__envp); | |
| 109 | ||
| 110 | __fenv_static inline int | |
| 111 | fegetround(void) | |
| 112 | { | |
| 113 | 	__uint16_t __control; | |
| 114 | ||
| 115 | 	/* | |
| 116 | 	 * We assume that the x87 and the SSE unit agree on the | |
| 117 | 	 * rounding mode. Reading the control word on the x87 turns | |
| 118 | 	 * out to be about 5 times faster than reading it on the SSE | |
| 119 | 	 * unit on an Opteron 244. | |
| 120 | 	 */ | |
| 121 | 	__fnstcw(&__control); | |
| 122 | 	return (__control & _ROUND_MASK); | |
| 123 | } | |
| 124 | ||
| 125 | #if __BSD_VISIBLE | |
| 126 | ||
| 127 | int feenableexcept(int __mask); | |
| 128 | int fedisableexcept(int __mask); | |
| 129 | ||
| 130 | /* We currently provide no external definition of fegetexcept(). */ | |
| 131 | static inline int | |
| 132 | fegetexcept(void) | |
| 133 | { | |
| 134 | 	__uint16_t __control; | |
| 135 | ||
| 136 | 	/* | |
| 137 | 	 * We assume that the masks for the x87 and the SSE unit are | |
| 138 | 	 * the same. | |
| 139 | 	 */ | |
| 140 | 	__fnstcw(&__control); | |
| 141 | 	return (~__control & FE_ALL_EXCEPT); | |
| 142 | } | |
| 143 | ||
| 144 | #endif /* __BSD_VISIBLE */ | |
| 145 | ||
| 146 | #ifdef __i386__ | |
| 147 | ||
| 148 | /* After testing for SSE support once, we cache the result in __has_sse. */ | |
| 149 | enum __sse_support { __SSE_YES, __SSE_NO, __SSE_UNK }; | |
| 150 | extern enum __sse_support __has_sse; | |
| 151 | int __test_sse(void); | |
| 152 | #ifdef __SSE__ | |
| 153 | #define	__HAS_SSE()	1 | |
| 154 | #else | |
| 155 | #define	__HAS_SSE()	(__has_sse == __SSE_YES ||			\ | |
| 156 | 			 (__has_sse == __SSE_UNK && __test_sse())) | |
| 157 | #endif | |
| 158 | ||
| 159 | #define	__get_mxcsr(env)	(((env).__mxcsr_hi << 16) |	\ | |
| 160 | 				 ((env).__mxcsr_lo)) | |
| 161 | #define	__set_mxcsr(env, x)	do {				\ | |
| 162 | 	(env).__mxcsr_hi = (__uint32_t)(x) >> 16;		\ | |
| 163 | 	(env).__mxcsr_lo = (__uint16_t)(x);			\ | |
| 164 | } while (0) | |
| 165 | ||
| 166 | __fenv_static inline int | |
| 167 | feclearexcept(int __excepts) | |
| 168 | { | |
| 169 | 	fenv_t __env; | |
| 170 | 	__uint32_t __mxcsr; | |
| 171 | ||
| 172 | 	if (__excepts == FE_ALL_EXCEPT) { | |
| 173 | 		__fnclex(); | |
| 174 | 	} else { | |
| 175 | 		__fnstenv(&__env); | |
| 176 | 		__env.__status &= ~__excepts; | |
| 177 | 		__fldenv(&__env); | |
| 178 | 	} | |
| 179 | 	if (__HAS_SSE()) { | |
| 180 | 		__stmxcsr(&__mxcsr); | |
| 181 | 		__mxcsr &= ~__excepts; | |
| 182 | 		__ldmxcsr(&__mxcsr); | |
| 183 | 	} | |
| 184 | 	return (0); | |
| 185 | } | |
| 186 | ||
| 187 | __fenv_static inline int | |
| 188 | fegetexceptflag(fexcept_t *__flagp, int __excepts) | |
| 189 | { | |
| 190 | 	__uint32_t __mxcsr; | |
| 191 | 	__uint16_t __status; | |
| 192 | ||
| 193 | 	__fnstsw(&__status); | |
| 194 | 	if (__HAS_SSE()) | |
| 195 | 		__stmxcsr(&__mxcsr); | |
| 196 | 	else | |
| 197 | 		__mxcsr = 0; | |
| 198 | 	*__flagp = (__mxcsr | __status) & __excepts; | |
| 199 | 	return (0); | |
| 200 | } | |
| 201 | ||
| 202 | __fenv_static inline int | |
| 203 | fetestexcept(int __excepts) | |
| 204 | { | |
| 205 | 	__uint32_t __mxcsr; | |
| 206 | 	__uint16_t __status; | |
| 207 | ||
| 208 | 	__fnstsw(&__status); | |
| 209 | 	if (__HAS_SSE()) | |
| 210 | 		__stmxcsr(&__mxcsr); | |
| 211 | 	else | |
| 212 | 		__mxcsr = 0; | |
| 213 | 	return ((__status | __mxcsr) & __excepts); | |
| 214 | } | |
| 215 | ||
| 216 | __fenv_static inline int | |
| 217 | fesetround(int __round) | |
| 218 | { | |
| 219 | 	__uint32_t __mxcsr; | |
| 220 | 	__uint16_t __control; | |
| 221 | ||
| 222 | 	if (__round & ~_ROUND_MASK) | |
| 223 | 		return (-1); | |
| 224 | ||
| 225 | 	__fnstcw(&__control); | |
| 226 | 	__control &= ~_ROUND_MASK; | |
| 227 | 	__control |= __round; | |
| 228 | 	__fldcw(&__control); | |
| 229 | ||
| 230 | 	if (__HAS_SSE()) { | |
| 231 | 		__stmxcsr(&__mxcsr); | |
| 232 | 		__mxcsr &= ~(_ROUND_MASK << _SSE_ROUND_SHIFT); | |
| 233 | 		__mxcsr |= __round << _SSE_ROUND_SHIFT; | |
| 234 | 		__ldmxcsr(&__mxcsr); | |
| 235 | 	} | |
| 236 | ||
| 237 | 	return (0); | |
| 238 | } | |
| 239 | ||
| 240 | __fenv_static inline int | |
| 241 | fesetenv(const fenv_t *__envp) | |
| 242 | { | |
| 243 | 	fenv_t __env = *__envp; | |
| 244 | 	__uint32_t __mxcsr; | |
| 245 | ||
| 246 | 	__mxcsr = __get_mxcsr(__env); | |
| 247 | 	__set_mxcsr(__env, 0xffffffff); | |
| 248 | 	/* | |
| 249 | 	 * XXX Using fldenvx() instead of fldenv() tells the compiler that this | |
| 250 | 	 * instruction clobbers the i387 register stack. This happens because | |
| 251 | 	 * we restore the tag word from the saved environment. Normally, this | |
| 252 | 	 * would happen anyway and we wouldn't care, because the ABI allows | |
| 253 | 	 * function calls to clobber the i387 regs. However, fesetenv() is | |
| 254 | 	 * inlined, so we need to be more careful. | |
| 255 | 	 */ | |
| 256 | 	__fldenvx(__env); | |
| 257 | 	if (__HAS_SSE()) | |
| 258 | 		__ldmxcsr(&__mxcsr); | |
| 259 | 	return (0); | |
| 260 | } | |
| 261 | ||
| 262 | #else /* __amd64__ */ | |
| 263 | ||
| 264 | __fenv_static inline int | |
| 265 | feclearexcept(int __excepts) | |
| 266 | { | |
| 267 | 	fenv_t __env; | |
| 268 | ||
| 269 | 	if (__excepts == FE_ALL_EXCEPT) { | |
| 270 | 		__fnclex(); | |
| 271 | 	} else { | |
| 272 | 		__fnstenv(&__env.__x87); | |
| 273 | 		__env.__x87.__status &= ~__excepts; | |
| 274 | 		__fldenv(&__env.__x87); | |
| 275 | 	} | |
| 276 | 	__stmxcsr(&__env.__mxcsr); | |
| 277 | 	__env.__mxcsr &= ~__excepts; | |
| 278 | 	__ldmxcsr(&__env.__mxcsr); | |
| 279 | 	return (0); | |
| 280 | } | |
| 281 | ||
| 282 | __fenv_static inline int | |
| 283 | fegetexceptflag(fexcept_t *__flagp, int __excepts) | |
| 284 | { | |
| 285 | 	__uint32_t __mxcsr; | |
| 286 | 	__uint16_t __status; | |
| 287 | ||
| 288 | 	__stmxcsr(&__mxcsr); | |
| 289 | 	__fnstsw(&__status); | |
| 290 | 	*__flagp = (__mxcsr | __status) & __excepts; | |
| 291 | 	return (0); | |
| 292 | } | |
| 293 | ||
| 294 | __fenv_static inline int | |
| 295 | fetestexcept(int __excepts) | |
| 296 | { | |
| 297 | 	__uint32_t __mxcsr; | |
| 298 | 	__uint16_t __status; | |
| 299 | ||
| 300 | 	__stmxcsr(&__mxcsr); | |
| 301 | 	__fnstsw(&__status); | |
| 302 | 	return ((__status | __mxcsr) & __excepts); | |
| 303 | } | |
| 304 | ||
| 305 | __fenv_static inline int | |
| 306 | fesetround(int __round) | |
| 307 | { | |
| 308 | 	__uint32_t __mxcsr; | |
| 309 | 	__uint16_t __control; | |
| 310 | ||
| 311 | 	if (__round & ~_ROUND_MASK) | |
| 312 | 		return (-1); | |
| 313 | ||
| 314 | 	__fnstcw(&__control); | |
| 315 | 	__control &= ~_ROUND_MASK; | |
| 316 | 	__control |= __round; | |
| 317 | 	__fldcw(&__control); | |
| 318 | ||
| 319 | 	__stmxcsr(&__mxcsr); | |
| 320 | 	__mxcsr &= ~(_ROUND_MASK << _SSE_ROUND_SHIFT); | |
| 321 | 	__mxcsr |= __round << _SSE_ROUND_SHIFT; | |
| 322 | 	__ldmxcsr(&__mxcsr); | |
| 323 | ||
| 324 | 	return (0); | |
| 325 | } | |
| 326 | ||
| 327 | __fenv_static inline int | |
| 328 | fesetenv(const fenv_t *__envp) | |
| 329 | { | |
| 330 | ||
| 331 | 	/* | |
| 332 | 	 * XXX Using fldenvx() instead of fldenv() tells the compiler that this | |
| 333 | 	 * instruction clobbers the i387 register stack. This happens because | |
| 334 | 	 * we restore the tag word from the saved environment. Normally, this | |
| 335 | 	 * would happen anyway and we wouldn't care, because the ABI allows | |
| 336 | 	 * function calls to clobber the i387 regs. However, fesetenv() is | |
| 337 | 	 * inlined, so we need to be more careful. | |
| 338 | 	 */ | |
| 339 | 	__fldenvx(__envp->__x87); | |
| 340 | 	__ldmxcsr(&__envp->__mxcsr); | |
| 341 | 	return (0); | |
| 342 | } | |
| 343 | ||
| 344 | #endif /* __i386__ */ | |
| 345 | ||
| 346 | __END_DECLS | |
| 347 | ||
| 348 | #endif	/* !_FENV_H_ */ | |
| \ No newline at end of file |
lib/libc/include/x86-freebsd-none/float.h deleted-5| ... | ... | @@ -1,5 +0,0 @@ |
| 1 | /*- | |
| 2 | * This file is in the public domain. | |
| 3 | */ | |
| 4 | ||
| 5 | #include <x86/float.h> | |
| \ No newline at end of file |
lib/libc/include/x86-freebsd-none/floatingpoint.h deleted-44| ... | ... | @@ -1,44 +0,0 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-4-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 1993 Andrew Moore, Talke Studio | |
| 5 | * All rights reserved. | |
| 6 | * | |
| 7 | * Redistribution and use in source and binary forms, with or without | |
| 8 | * modification, are permitted provided that the following conditions | |
| 9 | * are met: | |
| 10 | * 1. Redistributions of source code must retain the above copyright | |
| 11 | * notice, this list of conditions and the following disclaimer. | |
| 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 13 | * notice, this list of conditions and the following disclaimer in the | |
| 14 | * documentation and/or other materials provided with the distribution. | |
| 15 | * 3. All advertising materials mentioning features or use of this software | |
| 16 | * must display the following acknowledgement: | |
| 17 | *	This product includes software developed by the University of | |
| 18 | *	California, Berkeley and its contributors. | |
| 19 | * 4. Neither the name of the University nor the names of its contributors | |
| 20 | * may be used to endorse or promote products derived from this software | |
| 21 | * without specific prior written permission. | |
| 22 | * | |
| 23 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | |
| 24 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 25 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
| 26 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
| 27 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
| 28 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
| 29 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
| 30 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
| 31 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
| 32 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
| 33 | * SUCH DAMAGE. | |
| 34 | * | |
| 35 | *	from: @(#) floatingpoint.h	1.0 (Berkeley) 9/23/93 | |
| 36 | */ | |
| 37 | ||
| 38 | #ifndef _FLOATINGPOINT_H_ | |
| 39 | #define _FLOATINGPOINT_H_ | |
| 40 | ||
| 41 | #include <sys/cdefs.h> | |
| 42 | #include <machine/ieeefp.h> | |
| 43 | ||
| 44 | #endif /* !_FLOATINGPOINT_H_ */ | |
| \ No newline at end of file |
lib/libc/include/x86-freebsd-none/machine/_align.h deleted-5| ... | ... | @@ -1,5 +0,0 @@ |
| 1 | /*- | |
| 2 | * This file is in the public domain. | |
| 3 | */ | |
| 4 | ||
| 5 | #include <x86/_align.h> | |
| \ No newline at end of file |
lib/libc/include/x86-freebsd-none/machine/_bus.h+7-24| ... | ... | @@ -1,30 +1,13 @@ |
| 1 | 1 | /*- |
| 2 | * SPDX-License-Identifier: BSD-2-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 2005 M. Warner Losh <imp@FreeBSD.org> | |
| 2 | * Copyright (c) 2005 The FreeBSD Foundation. | |
| 5 | 3 | * |
| 6 | * Redistribution and use in source and binary forms, with or without | |
| 7 | * modification, are permitted provided that the following conditions | |
| 8 | * are met: | |
| 9 | * 1. Redistributions of source code must retain the above copyright | |
| 10 | * notice, this list of conditions, and the following disclaimer, | |
| 11 | * without modification, immediately at the beginning of the file. | |
| 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 13 | * notice, this list of conditions and the following disclaimer in | |
| 14 | * the documentation and/or other materials provided with the | |
| 15 | * distribution. | |
| 4 | * SPDX-License-Identifier: BSD-2-Clause | |
| 16 | 5 | * |
| 17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |
| 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 19 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
| 20 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR | |
| 21 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
| 22 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
| 23 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
| 24 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
| 25 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
| 26 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
| 27 | * SUCH DAMAGE. | |
| 6 | * Derived in part from NetBSD's bus.h files by (alphabetically): | |
| 7 | *	Christopher G. Demetriou | |
| 8 | *	Charles M. Hannum | |
| 9 | *	Jason Thorpe | |
| 10 | *	The NetBSD Foundation. | |
| 28 | 11 | */ |
| 29 | 12 | |
| 30 | 13 | #ifndef I386_INCLUDE__BUS_H |
lib/libc/include/x86-freebsd-none/machine/_inttypes.h deleted-5| ... | ... | @@ -1,5 +0,0 @@ |
| 1 | /*- | |
| 2 | * This file is in the public domain. | |
| 3 | */ | |
| 4 | ||
| 5 | #include <x86/_inttypes.h> | |
| \ No newline at end of file |
lib/libc/include/x86-freebsd-none/machine/_limits.h deleted-5| ... | ... | @@ -1,5 +0,0 @@ |
| 1 | /*- | |
| 2 | * This file is in the public domain. | |
| 3 | */ | |
| 4 | ||
| 5 | #include <x86/_limits.h> | |
| \ No newline at end of file |
lib/libc/include/x86-freebsd-none/machine/_stdint.h deleted-5| ... | ... | @@ -1,5 +0,0 @@ |
| 1 | /*- | |
| 2 | * This file is in the public domain. | |
| 3 | */ | |
| 4 | ||
| 5 | #include <x86/_stdint.h> | |
| \ No newline at end of file |
lib/libc/include/x86-freebsd-none/machine/_types.h deleted-5| ... | ... | @@ -1,5 +0,0 @@ |
| 1 | /*- | |
| 2 | * This file is in the public domain. | |
| 3 | */ | |
| 4 | ||
| 5 | #include <x86/_types.h> | |
| \ No newline at end of file |
lib/libc/include/x86-freebsd-none/machine/asm.h-2| ... | ... | @@ -30,8 +30,6 @@ |
| 30 | 30 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 31 | 31 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 32 | 32 | * SUCH DAMAGE. |
| 33 | * | |
| 34 | *	from: @(#)DEFS.h	5.1 (Berkeley) 4/23/90 | |
| 35 | 33 | */ |
| 36 | 34 | |
| 37 | 35 | #ifndef _MACHINE_ASM_H_ |
lib/libc/include/x86-freebsd-none/machine/atomic.h+20-27| ... | ... | @@ -49,8 +49,8 @@ static __inline void |
| 49 | 49 | __mbk(void) |
| 50 | 50 | { |
| 51 | 51 | |
| 52 | 	__asm __volatile("lock; addl $0,%%fs:%0" | |
| 53 | 	 : "+m" (*(u_int *)__OFFSETOF_MONITORBUF) : : "memory", "cc"); | |
| 52 | 	__asm __volatile("lock; addl $0,%%fs:%c0" | |
| 53 | 	 : : "i" (__OFFSETOF_MONITORBUF) : "memory", "cc"); | |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | static __inline void |
| ... | ... | @@ -249,7 +249,7 @@ atomic_testandclear_int(volatile u_int *p, u_int v) |
| 249 | 249 | |
| 250 | 250 | #define	ATOMIC_LOAD(TYPE)					\ |
| 251 | 251 | static __inline u_##TYPE					\ |
| 252 | atomic_load_acq_##TYPE(volatile u_##TYPE *p)			\ | |
| 252 | atomic_load_acq_##TYPE(const volatile u_##TYPE *p)		\ | |
| 253 | 253 | {								\ |
| 254 | 254 | 	u_##TYPE res;						\ |
| 255 | 255 | 								\ |
| ... | ... | @@ -299,17 +299,6 @@ atomic_thread_fence_seq_cst(void) |
| 299 | 299 | |
| 300 | 300 | #ifdef _KERNEL |
| 301 | 301 | |
| 302 | #ifdef WANT_FUNCTIONS | |
| 303 | int		atomic_cmpset_64_i386(volatile uint64_t *, uint64_t, uint64_t); | |
| 304 | int		atomic_cmpset_64_i586(volatile uint64_t *, uint64_t, uint64_t); | |
| 305 | uint64_t	atomic_load_acq_64_i386(volatile uint64_t *); | |
| 306 | uint64_t	atomic_load_acq_64_i586(volatile uint64_t *); | |
| 307 | void		atomic_store_rel_64_i386(volatile uint64_t *, uint64_t); | |
| 308 | void		atomic_store_rel_64_i586(volatile uint64_t *, uint64_t); | |
| 309 | uint64_t	atomic_swap_64_i386(volatile uint64_t *, uint64_t); | |
| 310 | uint64_t	atomic_swap_64_i586(volatile uint64_t *, uint64_t); | |
| 311 | #endif | |
| 312 | ||
| 313 | 302 | /* I486 does not support SMP or CMPXCHG8B. */ |
| 314 | 303 | static __inline int |
| 315 | 304 | atomic_cmpset_64_i386(volatile uint64_t *dst, uint64_t expect, uint64_t src) |
| ... | ... | @@ -353,12 +342,12 @@ atomic_fcmpset_64_i386(volatile uint64_t *dst, uint64_t *expect, uint64_t src) |
| 353 | 342 | } |
| 354 | 343 | |
| 355 | 344 | static __inline uint64_t |
| 356 | atomic_load_acq_64_i386(volatile uint64_t *p) | |
| 345 | atomic_load_acq_64_i386(const volatile uint64_t *p) | |
| 357 | 346 | { |
| 358 | 	volatile uint32_t *q; | |
| 347 | 	const volatile uint32_t *q; | |
| 359 | 348 | 	uint64_t res; |
| 360 | 349 | |
| 361 | 	q = (volatile uint32_t *)p; | |
| 350 | 	q = (const volatile uint32_t *)p; | |
| 362 | 351 | 	__asm __volatile( |
| 363 | 352 | 	"	pushfl ;		" |
| 364 | 353 | 	"	cli ;			" |
| ... | ... | @@ -447,8 +436,12 @@ atomic_fcmpset_64_i586(volatile uint64_t *dst, uint64_t *expect, uint64_t src) |
| 447 | 436 | 	return (res); |
| 448 | 437 | } |
| 449 | 438 | |
| 439 | /* | |
| 440 | * Architecturally always writes back some value to '*p' so will trigger | |
| 441 | * a #GP(0) on read-only mappings. | |
| 442 | */ | |
| 450 | 443 | static __inline uint64_t |
| 451 | atomic_load_acq_64_i586(volatile uint64_t *p) | |
| 444 | atomic_load_acq_64_i586(const volatile uint64_t *p) | |
| 452 | 445 | { |
| 453 | 446 | 	uint64_t res; |
| 454 | 447 | |
| ... | ... | @@ -456,9 +449,9 @@ atomic_load_acq_64_i586(volatile uint64_t *p) |
| 456 | 449 | 	"	movl	%%ebx,%%eax ;	" |
| 457 | 450 | 	"	movl	%%ecx,%%edx ;	" |
| 458 | 451 | 	"	lock; cmpxchg8b %1" |
| 459 | 	: "=&A" (res),			/* 0 */ | |
| 460 | 	 "+m" (*p)			/* 1 */ | |
| 461 | 	: : "memory", "cc"); | |
| 452 | 	: "=&A" (res)			/* 0 */ | |
| 453 | 	: "m" (*p)			/* 1 */ | |
| 454 | 	: "memory", "cc"); | |
| 462 | 455 | 	return (res); |
| 463 | 456 | } |
| 464 | 457 | |
| ... | ... | @@ -514,7 +507,7 @@ atomic_fcmpset_64(volatile uint64_t *dst, uint64_t *expect, uint64_t src) |
| 514 | 507 | } |
| 515 | 508 | |
| 516 | 509 | static __inline uint64_t |
| 517 | atomic_load_acq_64(volatile uint64_t *p) | |
| 510 | atomic_load_acq_64(const volatile uint64_t *p) | |
| 518 | 511 | { |
| 519 | 512 | |
| 520 | 513 | 	if ((cpu_feature & CPUID_CX8) == 0) |
| ... | ... | @@ -614,8 +607,6 @@ ATOMIC_LOADSTORE(long); |
| 614 | 607 | #undef ATOMIC_STORE |
| 615 | 608 | #undef ATOMIC_LOADSTORE |
| 616 | 609 | |
| 617 | #ifndef WANT_FUNCTIONS | |
| 618 | ||
| 619 | 610 | static __inline int |
| 620 | 611 | atomic_cmpset_long(volatile u_long *dst, u_long expect, u_long src) |
| 621 | 612 | { |
| ... | ... | @@ -842,7 +833,7 @@ atomic_swap_long(volatile u_long *p, u_long v) |
| 842 | 833 | #define	atomic_subtract_rel_ptr(p, v) \ |
| 843 | 834 | 	atomic_subtract_rel_int((volatile u_int *)(p), (u_int)(v)) |
| 844 | 835 | #define	atomic_load_acq_ptr(p) \ |
| 845 | 	atomic_load_acq_int((volatile u_int *)(p)) | |
| 836 | 	atomic_load_acq_int((const volatile u_int *)(p)) | |
| 846 | 837 | #define	atomic_store_rel_ptr(p, v) \ |
| 847 | 838 | 	atomic_store_rel_int((volatile u_int *)(p), (v)) |
| 848 | 839 | #define	atomic_cmpset_ptr(dst, old, new) \ |
| ... | ... | @@ -865,8 +856,10 @@ atomic_swap_long(volatile u_long *p, u_long v) |
| 865 | 856 | 	atomic_swap_int((volatile u_int *)(p), (u_int)(v)) |
| 866 | 857 | #define	atomic_readandclear_ptr(p) \ |
| 867 | 858 | 	atomic_readandclear_int((volatile u_int *)(p)) |
| 868 | ||
| 869 | #endif /* !WANT_FUNCTIONS */ | |
| 859 | #define	atomic_testandclear_ptr(p, val) \ | |
| 860 | 	atomic_testandclear_int((volatile u_int *)(p), (val)) | |
| 861 | #define	atomic_testandset_ptr(p, val) \ | |
| 862 | 	atomic_testandset_int((volatile u_int *)(p), (val)) | |
| 870 | 863 | |
| 871 | 864 | #if defined(_KERNEL) |
| 872 | 865 | #define	mb()	__mbk() |
lib/libc/include/x86-freebsd-none/machine/bus.h deleted-5| ... | ... | @@ -1,5 +0,0 @@ |
| 1 | /*- | |
| 2 | * This file is in the public domain. | |
| 3 | */ | |
| 4 | ||
| 5 | #include <x86/bus.h> | |
| \ No newline at end of file |
lib/libc/include/x86-freebsd-none/machine/clock.h deleted-5| ... | ... | @@ -1,5 +0,0 @@ |
| 1 | /* | |
| 2 | * This file is in the public domain. | |
| 3 | */ | |
| 4 | ||
| 5 | #include <x86/clock.h> | |
| \ No newline at end of file |
lib/libc/include/x86-freebsd-none/machine/cpu.h-2| ... | ... | @@ -30,8 +30,6 @@ |
| 30 | 30 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 31 | 31 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 32 | 32 | * SUCH DAMAGE. |
| 33 | * | |
| 34 | *	from: @(#)cpu.h	5.4 (Berkeley) 5/9/91 | |
| 35 | 33 | */ |
| 36 | 34 | |
| 37 | 35 | #ifndef _MACHINE_CPU_H_ |
lib/libc/include/x86-freebsd-none/machine/cpufunc.h+1-10| ... | ... | @@ -63,15 +63,6 @@ bsfl(u_int mask) |
| 63 | 63 | 	return (result); |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | static __inline __pure2 u_int | |
| 67 | bsrl(u_int mask) | |
| 68 | { | |
| 69 | 	u_int	result; | |
| 70 | ||
| 71 | 	__asm("bsrl %1,%0" : "=r" (result) : "rm" (mask) : "cc"); | |
| 72 | 	return (result); | |
| 73 | } | |
| 74 | ||
| 75 | 66 | static __inline void |
| 76 | 67 | clflush(u_long addr) |
| 77 | 68 | { |
| ... | ... | @@ -83,7 +74,7 @@ static __inline void |
| 83 | 74 | clflushopt(u_long addr) |
| 84 | 75 | { |
| 85 | 76 | |
| 86 | 	__asm __volatile(".byte 0x66;clflush %0" : : "m" (*(char *)addr)); | |
| 77 | 	__asm __volatile("clflushopt %0" : : "m" (*(char *)addr)); | |
| 87 | 78 | } |
| 88 | 79 | |
| 89 | 80 | static __inline void |
lib/libc/include/x86-freebsd-none/machine/dump.h deleted-5| ... | ... | @@ -1,5 +0,0 @@ |
| 1 | /*- | |
| 2 | * This file is in the public domain. | |
| 3 | */ | |
| 4 | ||
| 5 | #include <x86/dump.h> | |
| \ No newline at end of file |
lib/libc/include/x86-freebsd-none/machine/elf.h deleted-5| ... | ... | @@ -1,5 +0,0 @@ |
| 1 | /*- | |
| 2 | * This file is in the public domain. | |
| 3 | */ | |
| 4 | ||
| 5 | #include <x86/elf.h> | |
| \ No newline at end of file |
lib/libc/include/x86-freebsd-none/machine/endian.h deleted-5| ... | ... | @@ -1,5 +0,0 @@ |
| 1 | /*- | |
| 2 | * This file is in the public domain. | |
| 3 | */ | |
| 4 | ||
| 5 | #include <x86/endian.h> | |
| \ No newline at end of file |
lib/libc/include/x86-freebsd-none/machine/exec.h deleted-39| ... | ... | @@ -1,39 +0,0 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-3-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 1992, 1993 | |
| 5 | *	The Regents of the University of California. All rights reserved. | |
| 6 | * | |
| 7 | * Redistribution and use in source and binary forms, with or without | |
| 8 | * modification, are permitted provided that the following conditions | |
| 9 | * are met: | |
| 10 | * 1. Redistributions of source code must retain the above copyright | |
| 11 | * notice, this list of conditions and the following disclaimer. | |
| 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 13 | * notice, this list of conditions and the following disclaimer in the | |
| 14 | * documentation and/or other materials provided with the distribution. | |
| 15 | * 3. Neither the name of the University nor the names of its contributors | |
| 16 | * may be used to endorse or promote products derived from this software | |
| 17 | * without specific prior written permission. | |
| 18 | * | |
| 19 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | |
| 20 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 21 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
| 22 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
| 23 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
| 24 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
| 25 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
| 26 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
| 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
| 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
| 29 | * SUCH DAMAGE. | |
| 30 | * | |
| 31 | *	@(#)exec.h	8.1 (Berkeley) 6/11/93 | |
| 32 | */ | |
| 33 | ||
| 34 | #ifndef	_MACHINE_EXEC_H_ | |
| 35 | #define	_MACHINE_EXEC_H_ | |
| 36 | ||
| 37 | #define	__LDPGSZ	4096 | |
| 38 | ||
| 39 | #endif /* !_MACHINE_EXEC_H_ */ | |
| \ No newline at end of file |
lib/libc/include/x86-freebsd-none/machine/float.h deleted-5| ... | ... | @@ -1,5 +0,0 @@ |
| 1 | /*- | |
| 2 | * This file is in the public domain. | |
| 3 | */ | |
| 4 | ||
| 5 | #include <x86/float.h> | |
| \ No newline at end of file |
lib/libc/include/x86-freebsd-none/machine/floatingpoint.h deleted-44| ... | ... | @@ -1,44 +0,0 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-4-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 1993 Andrew Moore, Talke Studio | |
| 5 | * All rights reserved. | |
| 6 | * | |
| 7 | * Redistribution and use in source and binary forms, with or without | |
| 8 | * modification, are permitted provided that the following conditions | |
| 9 | * are met: | |
| 10 | * 1. Redistributions of source code must retain the above copyright | |
| 11 | * notice, this list of conditions and the following disclaimer. | |
| 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 13 | * notice, this list of conditions and the following disclaimer in the | |
| 14 | * documentation and/or other materials provided with the distribution. | |
| 15 | * 3. All advertising materials mentioning features or use of this software | |
| 16 | * must display the following acknowledgement: | |
| 17 | *	This product includes software developed by the University of | |
| 18 | *	California, Berkeley and its contributors. | |
| 19 | * 4. Neither the name of the University nor the names of its contributors | |
| 20 | * may be used to endorse or promote products derived from this software | |
| 21 | * without specific prior written permission. | |
| 22 | * | |
| 23 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | |
| 24 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 25 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
| 26 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
| 27 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
| 28 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
| 29 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
| 30 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
| 31 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
| 32 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
| 33 | * SUCH DAMAGE. | |
| 34 | * | |
| 35 | *	from: @(#) floatingpoint.h	1.0 (Berkeley) 9/23/93 | |
| 36 | */ | |
| 37 | ||
| 38 | #ifndef _FLOATINGPOINT_H_ | |
| 39 | #define _FLOATINGPOINT_H_ | |
| 40 | ||
| 41 | #include <sys/cdefs.h> | |
| 42 | #include <machine/ieeefp.h> | |
| 43 | ||
| 44 | #endif /* !_FLOATINGPOINT_H_ */ | |
| \ No newline at end of file |
lib/libc/include/x86-freebsd-none/machine/ieeefp.h-2| ... | ... | @@ -32,8 +32,6 @@ |
| 32 | 32 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 33 | 33 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 34 | 34 | * SUCH DAMAGE. |
| 35 | * | |
| 36 | * 	from: @(#) ieeefp.h 	1.0 (Berkeley) 9/23/93 | |
| 37 | 35 | */ |
| 38 | 36 | |
| 39 | 37 | #ifndef _MACHINE_IEEEFP_H_ |
lib/libc/include/x86-freebsd-none/machine/in_cksum.h-1| ... | ... | @@ -29,7 +29,6 @@ |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | 30 | * |
| 31 | 31 | *	from tahoe:	in_cksum.c	1.2	86/01/05 |
| 32 | *	from:		@(#)in_cksum.c	1.3 (Berkeley) 1/19/91 | |
| 33 | 32 | *	from: Id: in_cksum.c,v 1.8 1995/12/03 18:35:19 bde Exp |
| 34 | 33 | */ |
| 35 | 34 |
lib/libc/include/x86-freebsd-none/machine/metadata.h deleted-5| ... | ... | @@ -1,5 +0,0 @@ |
| 1 | /*- | |
| 2 | * This file is in the public domain. | |
| 3 | */ | |
| 4 | ||
| 5 | #include <x86/metadata.h> | |
| \ No newline at end of file |
lib/libc/include/x86-freebsd-none/machine/npx.h-2| ... | ... | @@ -30,8 +30,6 @@ |
| 30 | 30 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 31 | 31 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 32 | 32 | * SUCH DAMAGE. |
| 33 | * | |
| 34 | *	from: @(#)npx.h	5.3 (Berkeley) 1/18/91 | |
| 35 | 33 | */ |
| 36 | 34 | |
| 37 | 35 | /* |
lib/libc/include/x86-freebsd-none/machine/ofw_machdep.h deleted-5| ... | ... | @@ -1,5 +0,0 @@ |
| 1 | /*- | |
| 2 | * This file is in the public domain. | |
| 3 | */ | |
| 4 | ||
| 5 | #include <x86/ofw_machdep.h> | |
| \ No newline at end of file |
lib/libc/include/x86-freebsd-none/machine/param.h-11| ... | ... | @@ -30,8 +30,6 @@ |
| 30 | 30 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 31 | 31 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 32 | 32 | * SUCH DAMAGE. |
| 33 | * | |
| 34 | *	from: @(#)param.h	5.8 (Berkeley) 6/28/91 | |
| 35 | 33 | */ |
| 36 | 34 | |
| 37 | 35 | #ifndef _I386_INCLUDE_PARAM_H_ |
| ... | ... | @@ -43,9 +41,7 @@ |
| 43 | 41 | * Machine dependent constants for Intel 386. |
| 44 | 42 | */ |
| 45 | 43 | |
| 46 | #define __HAVE_ACPI | |
| 47 | 44 | #define	__HAVE_PIR |
| 48 | #define __PCI_REROUTE_INTERRUPT | |
| 49 | 45 | |
| 50 | 46 | #ifndef MACHINE |
| 51 | 47 | #define MACHINE		"i386" |
| ... | ... | @@ -146,19 +142,12 @@ |
| 146 | 142 | /* |
| 147 | 143 | * Mach derived conversion macros |
| 148 | 144 | */ |
| 149 | #define trunc_page(x)		((x) & ~PAGE_MASK) | |
| 150 | #define round_page(x)		(((x) + PAGE_MASK) & ~PAGE_MASK) | |
| 151 | 145 | #define trunc_4mpage(x)		((x) & ~PDRMASK) |
| 152 | 146 | #define round_4mpage(x)		((((x)) + PDRMASK) & ~PDRMASK) |
| 153 | 147 | |
| 154 | #define atop(x)			((x) >> PAGE_SHIFT) | |
| 155 | #define ptoa(x)			((x) << PAGE_SHIFT) | |
| 156 | ||
| 157 | 148 | #define i386_btop(x)		((x) >> PAGE_SHIFT) |
| 158 | 149 | #define i386_ptob(x)		((x) << PAGE_SHIFT) |
| 159 | 150 | |
| 160 | #define	pgtok(x)		((x) * (PAGE_SIZE / 1024)) | |
| 161 | ||
| 162 | 151 | #define INKERNEL(va)		(TRUE) |
| 163 | 152 | |
| 164 | 153 | #endif /* !_I386_INCLUDE_PARAM_H_ */ |
| \ No newline at end of file |
lib/libc/include/x86-freebsd-none/machine/pcb.h-2| ... | ... | @@ -30,8 +30,6 @@ |
| 30 | 30 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 31 | 31 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 32 | 32 | * SUCH DAMAGE. |
| 33 | * | |
| 34 | *	from: @(#)pcb.h	5.10 (Berkeley) 5/12/91 | |
| 35 | 33 | */ |
| 36 | 34 | |
| 37 | 35 | #ifndef _I386_PCB_H_ |
lib/libc/include/x86-freebsd-none/machine/pcpu.h+20-27| ... | ... | @@ -108,16 +108,8 @@ _Static_assert(sizeof(struct monitorbuf) == 128, "2x cache line"); |
| 108 | 108 | /* |
| 109 | 109 | * Evaluates to the address of the per-cpu variable name. |
| 110 | 110 | */ |
| 111 | #define	__PCPU_PTR(name) __extension__ ({				\ | |
| 112 | 	__pcpu_type(name) *__p;						\ | |
| 113 | 									\ | |
| 114 | 	__asm __volatile("movl %%fs:%1,%0; addl %2,%0"			\ | |
| 115 | 	 : "=r" (__p)						\ | |
| 116 | 	 : "m" (*(struct pcpu *)(__pcpu_offset(pc_prvspace))),	\ | |
| 117 | 	 "i" (__pcpu_offset(name)));				\ | |
| 118 | 									\ | |
| 119 | 	__p;								\ | |
| 120 | }) | |
| 111 | #define	__PCPU_PTR(name)						\ | |
| 112 | 	(&get_pcpu()->name) | |
| 121 | 113 | |
| 122 | 114 | /* |
| 123 | 115 | * Evaluates to the value of the per-cpu variable name. |
| ... | ... | @@ -126,14 +118,13 @@ _Static_assert(sizeof(struct monitorbuf) == 128, "2x cache line"); |
| 126 | 118 | 	__pcpu_type(name) __res;					\ |
| 127 | 119 | 	struct __s {							\ |
| 128 | 120 | 		u_char	__b[MIN(sizeof(__res), 4)];			\ |
| 129 | 	} __s;								\ | |
| 121 | 	};								\ | |
| 130 | 122 | 									\ |
| 131 | 123 | 	if (sizeof(__res) == 1 || sizeof(__res) == 2 ||			\ |
| 132 | 124 | 	 sizeof(__res) == 4) {					\ |
| 133 | 		__asm __volatile("mov %%fs:%1,%0"			\ | |
| 134 | 		 : "=r" (__s)					\ | |
| 135 | 		 : "m" (*(struct __s *)(__pcpu_offset(name))));	\ | |
| 136 | 		*(struct __s *)(void *)&__res = __s;			\ | |
| 125 | 		__asm __volatile("mov %%fs:%c1,%0"			\ | |
| 126 | 		 : "=r" (*(struct __s *)(void *)&__res)		\ | |
| 127 | 		 : "i" (__pcpu_offset(name)));			\ | |
| 137 | 128 | 	} else {							\ |
| 138 | 129 | 		__res = *__PCPU_PTR(name);				\ |
| 139 | 130 | 	}								\ |
| ... | ... | @@ -148,15 +139,16 @@ _Static_assert(sizeof(struct monitorbuf) == 128, "2x cache line"); |
| 148 | 139 | 	__pcpu_type(name) __val;					\ |
| 149 | 140 | 	struct __s {							\ |
| 150 | 141 | 		u_char	__b[MIN(sizeof(__val), 4)];			\ |
| 151 | 	} __s;								\ | |
| 142 | 	};								\ | |
| 152 | 143 | 									\ |
| 153 | 144 | 	__val = (val);							\ |
| 154 | 145 | 	if (sizeof(__val) == 1 || sizeof(__val) == 2 ||			\ |
| 155 | 146 | 	 sizeof(__val) == 4) {					\ |
| 156 | 		__s = *(struct __s *)(void *)&__val;			\ | |
| 157 | 		__asm __volatile("add %1,%%fs:%0"			\ | |
| 158 | 		 : "=m" (*(struct __s *)(__pcpu_offset(name)))	\ | |
| 159 | 		 : "r" (__s));					\ | |
| 147 | 		__asm __volatile("add %1,%%fs:%c0"			\ | |
| 148 | 		 :							\ | |
| 149 | 		 : "i" (__pcpu_offset(name)),			\ | |
| 150 | 		 "r" (*(struct __s *)(void *)&__val)		\ | |
| 151 | 		 : "cc", "memory");					\ | |
| 160 | 152 | 	} else								\ |
| 161 | 153 | 		*__PCPU_PTR(name) += __val;				\ |
| 162 | 154 | } while (0) |
| ... | ... | @@ -168,15 +160,16 @@ _Static_assert(sizeof(struct monitorbuf) == 128, "2x cache line"); |
| 168 | 160 | 	__pcpu_type(name) __val;					\ |
| 169 | 161 | 	struct __s {							\ |
| 170 | 162 | 		u_char	__b[MIN(sizeof(__val), 4)];			\ |
| 171 | 	} __s;								\ | |
| 163 | 	};								\ | |
| 172 | 164 | 									\ |
| 173 | 165 | 	__val = (val);							\ |
| 174 | 166 | 	if (sizeof(__val) == 1 || sizeof(__val) == 2 ||			\ |
| 175 | 167 | 	 sizeof(__val) == 4) {					\ |
| 176 | 		__s = *(struct __s *)(void *)&__val;			\ | |
| 177 | 		__asm __volatile("mov %1,%%fs:%0"			\ | |
| 178 | 		 : "=m" (*(struct __s *)(__pcpu_offset(name)))	\ | |
| 179 | 		 : "r" (__s));					\ | |
| 168 | 		__asm __volatile("mov %1,%%fs:%c0"			\ | |
| 169 | 		 :							\ | |
| 170 | 		 : "i" (__pcpu_offset(name)),			\ | |
| 171 | 		 "r" (*(struct __s *)(void *)&__val)		\ | |
| 172 | 		 : "memory");					\ | |
| 180 | 173 | 	} else {							\ |
| 181 | 174 | 		*__PCPU_PTR(name) = __val;				\ |
| 182 | 175 | 	}								\ |
| ... | ... | @@ -185,9 +178,9 @@ _Static_assert(sizeof(struct monitorbuf) == 128, "2x cache line"); |
| 185 | 178 | #define	get_pcpu() __extension__ ({					\ |
| 186 | 179 | 	struct pcpu *__pc;						\ |
| 187 | 180 | 									\ |
| 188 | 	__asm __volatile("movl %%fs:%1,%0"				\ | |
| 181 | 	__asm __volatile("movl %%fs:%c1,%0"				\ | |
| 189 | 182 | 	 : "=r" (__pc)						\ |
| 190 | 	 : "m" (*(struct pcpu *)(__pcpu_offset(pc_prvspace))));	\ | |
| 183 | 	 : "i" (__pcpu_offset(pc_prvspace)));			\ | |
| 191 | 184 | 	__pc;								\ |
| 192 | 185 | }) |
| 193 | 186 |
lib/libc/include/x86-freebsd-none/machine/pcpu_aux.h+4-4| ... | ... | @@ -49,8 +49,8 @@ __curthread(void) |
| 49 | 49 | { |
| 50 | 50 | 	struct thread *td; |
| 51 | 51 | |
| 52 | 	__asm("movl %%fs:%1,%0" : "=r" (td) | |
| 53 | 	 : "m" (*(char *)offsetof(struct pcpu, pc_curthread))); | |
| 52 | 	__asm("movl %%fs:%c1,%0" : "=r" (td) | |
| 53 | 	 : "i" (offsetof(struct pcpu, pc_curthread))); | |
| 54 | 54 | 	return (td); |
| 55 | 55 | } |
| 56 | 56 | #define	curthread		(__curthread()) |
| ... | ... | @@ -60,8 +60,8 @@ __curpcb(void) |
| 60 | 60 | { |
| 61 | 61 | 	struct pcb *pcb; |
| 62 | 62 | |
| 63 | 	__asm("movl %%fs:%1,%0" : "=r" (pcb) | |
| 64 | 	 : "m" (*(char *)offsetof(struct pcpu, pc_curpcb))); | |
| 63 | 	__asm("movl %%fs:%c1,%0" : "=r" (pcb) | |
| 64 | 	 : "i" (offsetof(struct pcpu, pc_curpcb))); | |
| 65 | 65 | 	return (pcb); |
| 66 | 66 | } |
| 67 | 67 | #define	curpcb		(__curpcb()) |
lib/libc/include/x86-freebsd-none/machine/pmap.h+3-6| ... | ... | @@ -37,9 +37,6 @@ |
| 37 | 37 | * map the page tables using the pagetables themselves. This is done to |
| 38 | 38 | * reduce the impact on kernel virtual memory for lots of sparse address |
| 39 | 39 | * space, and to reduce the cost of memory to each process. |
| 40 | * | |
| 41 | *	from: hp300: @(#)pmap.h	7.2 (Berkeley) 12/16/90 | |
| 42 | *	from: @(#)pmap.h	7.4 (Berkeley) 5/12/91 | |
| 43 | 40 | */ |
| 44 | 41 | |
| 45 | 42 | #ifndef _MACHINE_PMAP_H_ |
| ... | ... | @@ -83,7 +80,7 @@ |
| 83 | 80 | * 4KB (PTE) page mappings have identical settings for the following fields: |
| 84 | 81 | */ |
| 85 | 82 | #define PG_PTE_PROMOTE	(PG_MANAGED | PG_W | PG_G | PG_PTE_PAT | \ |
| 86 | 	 PG_M | PG_A | PG_NC_PCD | PG_NC_PWT | PG_U | PG_RW | PG_V) | |
| 83 | 	 PG_M | PG_NC_PCD | PG_NC_PWT | PG_U | PG_RW | PG_V) | |
| 87 | 84 | |
| 88 | 85 | /* |
| 89 | 86 | * Page Protection Exception bits |
| ... | ... | @@ -221,7 +218,7 @@ void	pmap_basemem_setup(u_int basemem); |
| 221 | 218 | void	*pmap_bios16_enter(void); |
| 222 | 219 | void	pmap_bios16_leave(void *handle); |
| 223 | 220 | void	pmap_bootstrap(vm_paddr_t); |
| 224 | int	pmap_cache_bits(pmap_t, int mode, boolean_t is_pde); | |
| 221 | int	pmap_cache_bits(pmap_t, int mode, bool is_pde); | |
| 225 | 222 | int	pmap_change_attr(vm_offset_t, vm_size_t, int); |
| 226 | 223 | caddr_t	pmap_cmap3(vm_paddr_t pa, u_int pte_bits); |
| 227 | 224 | void	pmap_cp_slow0_map(vm_offset_t kaddr, int plen, vm_page_t *ma); |
| ... | ... | @@ -239,7 +236,7 @@ void	pmap_ksetrw(vm_offset_t va); |
| 239 | 236 | void	*pmap_mapbios(vm_paddr_t, vm_size_t); |
| 240 | 237 | void	*pmap_mapdev(vm_paddr_t, vm_size_t); |
| 241 | 238 | void	*pmap_mapdev_attr(vm_paddr_t, vm_size_t, int); |
| 242 | boolean_t pmap_page_is_mapped(vm_page_t m); | |
| 239 | bool	pmap_page_is_mapped(vm_page_t m); | |
| 243 | 240 | void	pmap_page_set_memattr(vm_page_t m, vm_memattr_t ma); |
| 244 | 241 | vm_paddr_t pmap_pg_frame(vm_paddr_t pa); |
| 245 | 242 | bool	pmap_ps_enabled(pmap_t pmap); |
lib/libc/include/x86-freebsd-none/machine/pmap_base.h+8-8| ... | ... | @@ -58,8 +58,8 @@ struct pmap_methods { |
| 58 | 58 | 	void *(*pm_bios16_enter)(void); |
| 59 | 59 | 	void (*pm_bios16_leave)(void *handle); |
| 60 | 60 | 	void (*pm_bootstrap)(vm_paddr_t firstaddr); |
| 61 | 	boolean_t (*pm_is_valid_memattr)(pmap_t, vm_memattr_t); | |
| 62 | 	int (*pm_cache_bits)(pmap_t, int, boolean_t); | |
| 61 | 	bool (*pm_is_valid_memattr)(pmap_t, vm_memattr_t); | |
| 62 | 	int (*pm_cache_bits)(pmap_t, int, bool); | |
| 63 | 63 | 	bool (*pm_ps_enabled)(pmap_t); |
| 64 | 64 | 	void (*pm_pinit0)(pmap_t); |
| 65 | 65 | 	int (*pm_pinit)(pmap_t); |
| ... | ... | @@ -84,13 +84,13 @@ struct pmap_methods { |
| 84 | 84 | 	void (*pm_object_init_pt)(pmap_t, vm_offset_t, vm_object_t, |
| 85 | 85 | 	 vm_pindex_t, vm_size_t); |
| 86 | 86 | 	void (*pm_unwire)(pmap_t, vm_offset_t, vm_offset_t); |
| 87 | 	boolean_t (*pm_page_exists_quick)(pmap_t, vm_page_t); | |
| 87 | 	bool (*pm_page_exists_quick)(pmap_t, vm_page_t); | |
| 88 | 88 | 	int (*pm_page_wired_mappings)(vm_page_t); |
| 89 | 	boolean_t (*pm_page_is_mapped)(vm_page_t); | |
| 89 | 	bool (*pm_page_is_mapped)(vm_page_t); | |
| 90 | 90 | 	void (*pm_remove_pages)(pmap_t); |
| 91 | 	boolean_t (*pm_is_modified)(vm_page_t); | |
| 92 | 	boolean_t (*pm_is_prefaultable)(pmap_t, vm_offset_t); | |
| 93 | 	boolean_t (*pm_is_referenced)(vm_page_t); | |
| 91 | 	bool (*pm_is_modified)(vm_page_t); | |
| 92 | 	bool (*pm_is_prefaultable)(pmap_t, vm_offset_t); | |
| 93 | 	bool (*pm_is_referenced)(vm_page_t); | |
| 94 | 94 | 	void (*pm_remove_write)(vm_page_t); |
| 95 | 95 | 	int (*pm_ts_referenced)(vm_page_t); |
| 96 | 96 | 	void *(*pm_mapdev_attr)(vm_paddr_t, vm_size_t, int, int); |
| ... | ... | @@ -107,7 +107,7 @@ struct pmap_methods { |
| 107 | 107 | 	void (*pm_remove_all)(vm_page_t); |
| 108 | 108 | 	void (*pm_init)(void); |
| 109 | 109 | 	void (*pm_init_pat)(void); |
| 110 | 	void (*pm_growkernel)(vm_offset_t); | |
| 110 | 	int (*pm_growkernel)(vm_offset_t); | |
| 111 | 111 | 	void (*pm_invalidate_page)(pmap_t, vm_offset_t); |
| 112 | 112 | 	void (*pm_invalidate_range)(pmap_t, vm_offset_t, vm_offset_t); |
| 113 | 113 | 	void (*pm_invalidate_all)(pmap_t); |
lib/libc/include/x86-freebsd-none/machine/pmap_nopae.h-3| ... | ... | @@ -44,9 +44,6 @@ |
| 44 | 44 | * map the page tables using the pagetables themselves. This is done to |
| 45 | 45 | * reduce the impact on kernel virtual memory for lots of sparse address |
| 46 | 46 | * space, and to reduce the cost of memory to each process. |
| 47 | * | |
| 48 | *	from: hp300: @(#)pmap.h	7.2 (Berkeley) 12/16/90 | |
| 49 | *	from: @(#)pmap.h	7.4 (Berkeley) 5/12/91 | |
| 50 | 47 | */ |
| 51 | 48 | |
| 52 | 49 | #ifndef _MACHINE_PMAP_NOPAE_H |
lib/libc/include/x86-freebsd-none/machine/pmap_pae.h-3| ... | ... | @@ -44,9 +44,6 @@ |
| 44 | 44 | * map the page tables using the pagetables themselves. This is done to |
| 45 | 45 | * reduce the impact on kernel virtual memory for lots of sparse address |
| 46 | 46 | * space, and to reduce the cost of memory to each process. |
| 47 | * | |
| 48 | *	from: hp300: @(#)pmap.h	7.2 (Berkeley) 12/16/90 | |
| 49 | *	from: @(#)pmap.h	7.4 (Berkeley) 5/12/91 | |
| 50 | 47 | */ |
| 51 | 48 | |
| 52 | 49 | #ifndef _MACHINE_PMAP_PAE_H |
lib/libc/include/x86-freebsd-none/machine/proc.h-2| ... | ... | @@ -27,8 +27,6 @@ |
| 27 | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | * | |
| 31 | *	from: @(#)proc.h	7.1 (Berkeley) 5/15/91 | |
| 32 | 30 | */ |
| 33 | 31 | |
| 34 | 32 | #ifndef _MACHINE_PROC_H_ |
lib/libc/include/x86-freebsd-none/machine/profile.h-2| ... | ... | @@ -27,8 +27,6 @@ |
| 27 | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | * | |
| 31 | *	@(#)profile.h	8.1 (Berkeley) 6/11/93 | |
| 32 | 30 | */ |
| 33 | 31 | |
| 34 | 32 | #ifndef _MACHINE_PROFILE_H_ |
lib/libc/include/x86-freebsd-none/machine/psl.h deleted-5| ... | ... | @@ -1,5 +0,0 @@ |
| 1 | /*- | |
| 2 | * This file is in the public domain. | |
| 3 | */ | |
| 4 | ||
| 5 | #include <x86/psl.h> | |
| \ No newline at end of file |
lib/libc/include/x86-freebsd-none/machine/ptrace.h deleted-5| ... | ... | @@ -1,5 +0,0 @@ |
| 1 | /*- | |
| 2 | * This file is in the public domain. | |
| 3 | */ | |
| 4 | ||
| 5 | #include <x86/ptrace.h> | |
| \ No newline at end of file |
lib/libc/include/x86-freebsd-none/machine/reg.h deleted-5| ... | ... | @@ -1,5 +0,0 @@ |
| 1 | /*- | |
| 2 | * This file is in the public domain. | |
| 3 | */ | |
| 4 | ||
| 5 | #include <x86/reg.h> | |
| \ No newline at end of file |
lib/libc/include/x86-freebsd-none/machine/reloc.h deleted-50| ... | ... | @@ -1,50 +0,0 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-3-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 1992, 1993 | |
| 5 | *	The Regents of the University of California. All rights reserved. | |
| 6 | * | |
| 7 | * Redistribution and use in source and binary forms, with or without | |
| 8 | * modification, are permitted provided that the following conditions | |
| 9 | * are met: | |
| 10 | * 1. Redistributions of source code must retain the above copyright | |
| 11 | * notice, this list of conditions and the following disclaimer. | |
| 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 13 | * notice, this list of conditions and the following disclaimer in the | |
| 14 | * documentation and/or other materials provided with the distribution. | |
| 15 | * 3. Neither the name of the University nor the names of its contributors | |
| 16 | * may be used to endorse or promote products derived from this software | |
| 17 | * without specific prior written permission. | |
| 18 | * | |
| 19 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | |
| 20 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 21 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
| 22 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
| 23 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
| 24 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
| 25 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
| 26 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
| 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
| 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
| 29 | * SUCH DAMAGE. | |
| 30 | * | |
| 31 | *	@(#)reloc.h	8.1 (Berkeley) 6/10/93 | |
| 32 | */ | |
| 33 | ||
| 34 | #ifndef _I386_MACHINE_RELOC_H_ | |
| 35 | #define _I386_MACHINE_RELOC_H_ | |
| 36 | ||
| 37 | /* Relocation format. */ | |
| 38 | struct relocation_info { | |
| 39 | 	int r_address;			 /* offset in text or data segment */ | |
| 40 | 	unsigned int r_symbolnum : 24, /* ordinal number of add symbol */ | |
| 41 | 			 r_pcrel : 1, /* 1 if value should be pc-relative */ | |
| 42 | 			 r_length : 2, /* log base 2 of value's width */ | |
| 43 | 			 r_extern : 1, /* 1 if need to add symbol to value */ | |
| 44 | 			 r_baserel : 1, /* linkage table relative */ | |
| 45 | 			r_jmptable : 1, /* relocate to jump table */ | |
| 46 | 			r_relative : 1, /* load address relative */ | |
| 47 | 			 r_copy : 1; /* run time copy */ | |
| 48 | }; | |
| 49 | ||
| 50 | #endif | |
| \ No newline at end of file |
lib/libc/include/x86-freebsd-none/machine/resource.h-2| ... | ... | @@ -39,8 +39,6 @@ |
| 39 | 39 | #define	SYS_RES_DRQ	2	/* isa dma lines */ |
| 40 | 40 | #define	SYS_RES_MEMORY	3	/* i/o memory */ |
| 41 | 41 | #define	SYS_RES_IOPORT	4	/* i/o ports */ |
| 42 | #ifdef NEW_PCIB | |
| 43 | 42 | #define	PCI_RES_BUS	5	/* PCI bus numbers */ |
| 44 | #endif | |
| 45 | 43 | |
| 46 | 44 | #endif /* !_MACHINE_RESOURCE_H_ */ |
| \ No newline at end of file |
lib/libc/include/x86-freebsd-none/machine/runq.h deleted-46| ... | ... | @@ -1,46 +0,0 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-2-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 2001 Jake Burkholder <jake@FreeBSD.org> | |
| 5 | * All rights reserved. | |
| 6 | * | |
| 7 | * Redistribution and use in source and binary forms, with or without | |
| 8 | * modification, are permitted provided that the following conditions | |
| 9 | * are met: | |
| 10 | * 1. Redistributions of source code must retain the above copyright | |
| 11 | * notice, this list of conditions and the following disclaimer. | |
| 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 13 | * notice, this list of conditions and the following disclaimer in the | |
| 14 | * documentation and/or other materials provided with the distribution. | |
| 15 | * | |
| 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |
| 17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
| 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | |
| 20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
| 21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
| 22 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
| 23 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
| 24 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
| 25 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
| 26 | * SUCH DAMAGE. | |
| 27 | */ | |
| 28 | ||
| 29 | #ifndef	_MACHINE_RUNQ_H_ | |
| 30 | #define	_MACHINE_RUNQ_H_ | |
| 31 | ||
| 32 | #define	RQB_LEN		(2)		/* Number of priority status words. */ | |
| 33 | #define	RQB_L2BPW	(5)		/* Log2(sizeof(rqb_word_t) * NBBY)). */ | |
| 34 | #define	RQB_BPW		(1<<RQB_L2BPW)	/* Bits in an rqb_word_t. */ | |
| 35 | ||
| 36 | #define	RQB_BIT(pri)	(1 << ((pri) & (RQB_BPW - 1))) | |
| 37 | #define	RQB_WORD(pri)	((pri) >> RQB_L2BPW) | |
| 38 | ||
| 39 | #define	RQB_FFS(word)	(ffs(word) - 1) | |
| 40 | ||
| 41 | /* | |
| 42 | * Type of run queue status word. | |
| 43 | */ | |
| 44 | typedef	u_int32_t	rqb_word_t; | |
| 45 | ||
| 46 | #endif | |
| \ No newline at end of file |
lib/libc/include/x86-freebsd-none/machine/sdt_machdep.h created+19| ... | ... | @@ -0,0 +1,19 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-2-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 2024 Mark Johnston <markj@FreeBSD.org> | |
| 5 | */ | |
| 6 | ||
| 7 | #ifndef _SYS_SDT_MACHDEP_H_ | |
| 8 | #define	_SYS_SDT_MACHDEP_H_ | |
| 9 | ||
| 10 | #define	_SDT_ASM_PATCH_INSTR		"nop; nop; nop; nop; nop" | |
| 11 | ||
| 12 | /* | |
| 13 | * Work around an apparent clang bug or limitation which prevents the use of the | |
| 14 | * "i" (immediate) constraint with the probe structure. | |
| 15 | */ | |
| 16 | #define	_SDT_ASM_PROBE_CONSTRAINT	"Ws" | |
| 17 | #define	_SDT_ASM_PROBE_OPERAND		"p" | |
| 18 | ||
| 19 | #endif | |
| \ No newline at end of file |
lib/libc/include/x86-freebsd-none/machine/segments.h-2| ... | ... | @@ -31,8 +31,6 @@ |
| 31 | 31 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 32 | 32 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 33 | 33 | * SUCH DAMAGE. |
| 34 | * | |
| 35 | *	from: @(#)segments.h	7.1 (Berkeley) 5/9/91 | |
| 36 | 34 | */ |
| 37 | 35 | |
| 38 | 36 | #ifndef _MACHINE_SEGMENTS_H_ |
lib/libc/include/x86-freebsd-none/machine/setjmp.h deleted-5| ... | ... | @@ -1,5 +0,0 @@ |
| 1 | /*- | |
| 2 | * This file is in the public domain. | |
| 3 | */ | |
| 4 | ||
| 5 | #include <x86/setjmp.h> | |
| \ No newline at end of file |
lib/libc/include/x86-freebsd-none/machine/signal.h-2| ... | ... | @@ -27,8 +27,6 @@ |
| 27 | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | * | |
| 31 | *	@(#)signal.h	8.1 (Berkeley) 6/11/93 | |
| 32 | 30 | */ |
| 33 | 31 | |
| 34 | 32 | #ifndef _MACHINE_SIGNAL_H_ |
lib/libc/include/x86-freebsd-none/machine/sysarch.h deleted-5| ... | ... | @@ -1,5 +0,0 @@ |
| 1 | /*- | |
| 2 | * This file is in the public domain. | |
| 3 | */ | |
| 4 | ||
| 5 | #include <x86/sysarch.h> | |
| \ No newline at end of file |
lib/libc/include/x86-freebsd-none/machine/tls.h deleted-5| ... | ... | @@ -1,5 +0,0 @@ |
| 1 | /*- | |
| 2 | * This file is in the public domain. | |
| 3 | */ | |
| 4 | ||
| 5 | #include <x86/tls.h> | |
| \ No newline at end of file |
lib/libc/include/x86-freebsd-none/machine/trap.h deleted-5| ... | ... | @@ -1,5 +0,0 @@ |
| 1 | /*- | |
| 2 | * This file is in the public domain. | |
| 3 | */ | |
| 4 | ||
| 5 | #include <x86/trap.h> | |
| \ No newline at end of file |
lib/libc/include/x86-freebsd-none/machine/tss.h-2| ... | ... | @@ -30,8 +30,6 @@ |
| 30 | 30 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 31 | 31 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 32 | 32 | * SUCH DAMAGE. |
| 33 | * | |
| 34 | *	from: @(#)tss.h	5.4 (Berkeley) 1/18/91 | |
| 35 | 33 | */ |
| 36 | 34 | |
| 37 | 35 | #ifndef _MACHINE_TSS_H_ |
lib/libc/include/x86-freebsd-none/machine/vdso.h deleted-5| ... | ... | @@ -1,5 +0,0 @@ |
| 1 | /*- | |
| 2 | * This file is in the public domain. | |
| 3 | */ | |
| 4 | ||
| 5 | #include <x86/vdso.h> | |
| \ No newline at end of file |
lib/libc/include/x86-freebsd-none/machine/vm.h deleted-46| ... | ... | @@ -1,46 +0,0 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-2-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 2009 Hudson River Trading LLC | |
| 5 | * Written by: John H. Baldwin <jhb@FreeBSD.org> | |
| 6 | * All rights reserved. | |
| 7 | * | |
| 8 | * Redistribution and use in source and binary forms, with or without | |
| 9 | * modification, are permitted provided that the following conditions | |
| 10 | * are met: | |
| 11 | * 1. Redistributions of source code must retain the above copyright | |
| 12 | * notice, this list of conditions and the following disclaimer. | |
| 13 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 14 | * notice, this list of conditions and the following disclaimer in the | |
| 15 | * documentation and/or other materials provided with the distribution. | |
| 16 | * | |
| 17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |
| 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 19 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
| 20 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | |
| 21 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
| 22 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
| 23 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
| 24 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
| 25 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
| 26 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
| 27 | * SUCH DAMAGE. | |
| 28 | */ | |
| 29 | ||
| 30 | #ifndef _MACHINE_VM_H_ | |
| 31 | #define	_MACHINE_VM_H_ | |
| 32 | ||
| 33 | #include <machine/specialreg.h> | |
| 34 | ||
| 35 | /* Memory attributes. */ | |
| 36 | #define	VM_MEMATTR_UNCACHEABLE		((vm_memattr_t)PAT_UNCACHEABLE) | |
| 37 | #define	VM_MEMATTR_WRITE_COMBINING	((vm_memattr_t)PAT_WRITE_COMBINING) | |
| 38 | #define	VM_MEMATTR_WRITE_THROUGH	((vm_memattr_t)PAT_WRITE_THROUGH) | |
| 39 | #define	VM_MEMATTR_WRITE_PROTECTED	((vm_memattr_t)PAT_WRITE_PROTECTED) | |
| 40 | #define	VM_MEMATTR_WRITE_BACK		((vm_memattr_t)PAT_WRITE_BACK) | |
| 41 | #define	VM_MEMATTR_WEAK_UNCACHEABLE	((vm_memattr_t)PAT_UNCACHED) | |
| 42 | ||
| 43 | #define	VM_MEMATTR_DEFAULT		VM_MEMATTR_WRITE_BACK | |
| 44 | #define	VM_MEMATTR_DEVICE		VM_MEMATTR_UNCACHEABLE | |
| 45 | ||
| 46 | #endif /* !_MACHINE_VM_H_ */ | |
| \ No newline at end of file |
lib/libc/include/x86-freebsd-none/machine/vmparam.h+1-2| ... | ... | @@ -32,8 +32,6 @@ |
| 32 | 32 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 33 | 33 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 34 | 34 | * SUCH DAMAGE. |
| 35 | * | |
| 36 | *	from: @(#)vmparam.h	5.9 (Berkeley) 5/12/91 | |
| 37 | 35 | */ |
| 38 | 36 | |
| 39 | 37 | #ifndef _MACHINE_VMPARAM_H_ |
| ... | ... | @@ -248,5 +246,6 @@ |
| 248 | 246 | * Need a page dump array for minidump. |
| 249 | 247 | */ |
| 250 | 248 | #define MINIDUMP_PAGE_TRACKING	1 |
| 249 | #define MINIDUMP_STARTUP_PAGE_TRACKING 0 | |
| 251 | 250 | |
| 252 | 251 | #endif /* _MACHINE_VMPARAM_H_ */ |
| \ No newline at end of file |
lib/libc/include/x86-freebsd-none/stdarg.h deleted-5| ... | ... | @@ -1,5 +0,0 @@ |
| 1 | /*- | |
| 2 | * This file is in the public domain. | |
| 3 | */ | |
| 4 | ||
| 5 | #include <x86/stdarg.h> | |
| \ No newline at end of file |
lib/libc/include/x86_64-freebsd-none/fenv.h deleted-348| ... | ... | @@ -1,348 +0,0 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-2-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 2004-2005 David Schultz <das@FreeBSD.ORG> | |
| 5 | * All rights reserved. | |
| 6 | * | |
| 7 | * Redistribution and use in source and binary forms, with or without | |
| 8 | * modification, are permitted provided that the following conditions | |
| 9 | * are met: | |
| 10 | * 1. Redistributions of source code must retain the above copyright | |
| 11 | * notice, this list of conditions and the following disclaimer. | |
| 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 13 | * notice, this list of conditions and the following disclaimer in the | |
| 14 | * documentation and/or other materials provided with the distribution. | |
| 15 | * | |
| 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |
| 17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
| 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | |
| 20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
| 21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
| 22 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
| 23 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
| 24 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
| 25 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
| 26 | * SUCH DAMAGE. | |
| 27 | */ | |
| 28 | ||
| 29 | #ifndef	_FENV_H_ | |
| 30 | #define	_FENV_H_ | |
| 31 | ||
| 32 | #include <sys/cdefs.h> | |
| 33 | #include <sys/_types.h> | |
| 34 | #include <ieeefp.h> | |
| 35 | ||
| 36 | #ifndef	__fenv_static | |
| 37 | #define	__fenv_static	static | |
| 38 | #endif | |
| 39 | ||
| 40 | typedef	__uint16_t	fexcept_t; | |
| 41 | ||
| 42 | /* Exception flags */ | |
| 43 | #define	FE_INVALID	0x01 | |
| 44 | #define	FE_DENORMAL	0x02 | |
| 45 | #define	FE_DIVBYZERO	0x04 | |
| 46 | #define	FE_OVERFLOW	0x08 | |
| 47 | #define	FE_UNDERFLOW	0x10 | |
| 48 | #define	FE_INEXACT	0x20 | |
| 49 | #define	FE_ALL_EXCEPT	(FE_DIVBYZERO | FE_DENORMAL | FE_INEXACT | \ | |
| 50 | 			 FE_INVALID | FE_OVERFLOW | FE_UNDERFLOW) | |
| 51 | ||
| 52 | /* Rounding modes */ | |
| 53 | #define	FE_TONEAREST	0x0000 | |
| 54 | #define	FE_DOWNWARD	0x0400 | |
| 55 | #define	FE_UPWARD	0x0800 | |
| 56 | #define	FE_TOWARDZERO	0x0c00 | |
| 57 | #define	_ROUND_MASK	(FE_TONEAREST | FE_DOWNWARD | \ | |
| 58 | 			 FE_UPWARD | FE_TOWARDZERO) | |
| 59 | ||
| 60 | /* | |
| 61 | * As compared to the x87 control word, the SSE unit's control word | |
| 62 | * has the rounding control bits offset by 3 and the exception mask | |
| 63 | * bits offset by 7. | |
| 64 | */ | |
| 65 | #define	_SSE_ROUND_SHIFT	3 | |
| 66 | #define	_SSE_EMASK_SHIFT	7 | |
| 67 | ||
| 68 | #ifdef __i386__ | |
| 69 | /* | |
| 70 | * To preserve binary compatibility with FreeBSD 5.3, we pack the | |
| 71 | * mxcsr into some reserved fields, rather than changing sizeof(fenv_t). | |
| 72 | */ | |
| 73 | typedef struct { | |
| 74 | 	__uint16_t	__control; | |
| 75 | 	__uint16_t __mxcsr_hi; | |
| 76 | 	__uint16_t	__status; | |
| 77 | 	__uint16_t __mxcsr_lo; | |
| 78 | 	__uint32_t	__tag; | |
| 79 | 	char		__other[16]; | |
| 80 | } fenv_t; | |
| 81 | #else /* __amd64__ */ | |
| 82 | typedef struct { | |
| 83 | 	struct { | |
| 84 | 		__uint32_t	__control; | |
| 85 | 		__uint32_t	__status; | |
| 86 | 		__uint32_t	__tag; | |
| 87 | 		char		__other[16]; | |
| 88 | 	} __x87; | |
| 89 | 	__uint32_t		__mxcsr; | |
| 90 | } fenv_t; | |
| 91 | #endif /* __i386__ */ | |
| 92 | ||
| 93 | __BEGIN_DECLS | |
| 94 | ||
| 95 | /* Default floating-point environment */ | |
| 96 | extern const fenv_t	__fe_dfl_env; | |
| 97 | #define	FE_DFL_ENV	(&__fe_dfl_env) | |
| 98 | ||
| 99 | #define	__fldenvx(__env)	__asm __volatile("fldenv %0" : : "m" (__env) \ | |
| 100 | 				: "st", "st(1)", "st(2)", "st(3)", "st(4)", \ | |
| 101 | 				"st(5)", "st(6)", "st(7)") | |
| 102 | #define	__fwait()		__asm __volatile("fwait") | |
| 103 | ||
| 104 | int fegetenv(fenv_t *__envp); | |
| 105 | int feholdexcept(fenv_t *__envp); | |
| 106 | int fesetexceptflag(const fexcept_t *__flagp, int __excepts); | |
| 107 | int feraiseexcept(int __excepts); | |
| 108 | int feupdateenv(const fenv_t *__envp); | |
| 109 | ||
| 110 | __fenv_static inline int | |
| 111 | fegetround(void) | |
| 112 | { | |
| 113 | 	__uint16_t __control; | |
| 114 | ||
| 115 | 	/* | |
| 116 | 	 * We assume that the x87 and the SSE unit agree on the | |
| 117 | 	 * rounding mode. Reading the control word on the x87 turns | |
| 118 | 	 * out to be about 5 times faster than reading it on the SSE | |
| 119 | 	 * unit on an Opteron 244. | |
| 120 | 	 */ | |
| 121 | 	__fnstcw(&__control); | |
| 122 | 	return (__control & _ROUND_MASK); | |
| 123 | } | |
| 124 | ||
| 125 | #if __BSD_VISIBLE | |
| 126 | ||
| 127 | int feenableexcept(int __mask); | |
| 128 | int fedisableexcept(int __mask); | |
| 129 | ||
| 130 | /* We currently provide no external definition of fegetexcept(). */ | |
| 131 | static inline int | |
| 132 | fegetexcept(void) | |
| 133 | { | |
| 134 | 	__uint16_t __control; | |
| 135 | ||
| 136 | 	/* | |
| 137 | 	 * We assume that the masks for the x87 and the SSE unit are | |
| 138 | 	 * the same. | |
| 139 | 	 */ | |
| 140 | 	__fnstcw(&__control); | |
| 141 | 	return (~__control & FE_ALL_EXCEPT); | |
| 142 | } | |
| 143 | ||
| 144 | #endif /* __BSD_VISIBLE */ | |
| 145 | ||
| 146 | #ifdef __i386__ | |
| 147 | ||
| 148 | /* After testing for SSE support once, we cache the result in __has_sse. */ | |
| 149 | enum __sse_support { __SSE_YES, __SSE_NO, __SSE_UNK }; | |
| 150 | extern enum __sse_support __has_sse; | |
| 151 | int __test_sse(void); | |
| 152 | #ifdef __SSE__ | |
| 153 | #define	__HAS_SSE()	1 | |
| 154 | #else | |
| 155 | #define	__HAS_SSE()	(__has_sse == __SSE_YES ||			\ | |
| 156 | 			 (__has_sse == __SSE_UNK && __test_sse())) | |
| 157 | #endif | |
| 158 | ||
| 159 | #define	__get_mxcsr(env)	(((env).__mxcsr_hi << 16) |	\ | |
| 160 | 				 ((env).__mxcsr_lo)) | |
| 161 | #define	__set_mxcsr(env, x)	do {				\ | |
| 162 | 	(env).__mxcsr_hi = (__uint32_t)(x) >> 16;		\ | |
| 163 | 	(env).__mxcsr_lo = (__uint16_t)(x);			\ | |
| 164 | } while (0) | |
| 165 | ||
| 166 | __fenv_static inline int | |
| 167 | feclearexcept(int __excepts) | |
| 168 | { | |
| 169 | 	fenv_t __env; | |
| 170 | 	__uint32_t __mxcsr; | |
| 171 | ||
| 172 | 	if (__excepts == FE_ALL_EXCEPT) { | |
| 173 | 		__fnclex(); | |
| 174 | 	} else { | |
| 175 | 		__fnstenv(&__env); | |
| 176 | 		__env.__status &= ~__excepts; | |
| 177 | 		__fldenv(&__env); | |
| 178 | 	} | |
| 179 | 	if (__HAS_SSE()) { | |
| 180 | 		__stmxcsr(&__mxcsr); | |
| 181 | 		__mxcsr &= ~__excepts; | |
| 182 | 		__ldmxcsr(&__mxcsr); | |
| 183 | 	} | |
| 184 | 	return (0); | |
| 185 | } | |
| 186 | ||
| 187 | __fenv_static inline int | |
| 188 | fegetexceptflag(fexcept_t *__flagp, int __excepts) | |
| 189 | { | |
| 190 | 	__uint32_t __mxcsr; | |
| 191 | 	__uint16_t __status; | |
| 192 | ||
| 193 | 	__fnstsw(&__status); | |
| 194 | 	if (__HAS_SSE()) | |
| 195 | 		__stmxcsr(&__mxcsr); | |
| 196 | 	else | |
| 197 | 		__mxcsr = 0; | |
| 198 | 	*__flagp = (__mxcsr | __status) & __excepts; | |
| 199 | 	return (0); | |
| 200 | } | |
| 201 | ||
| 202 | __fenv_static inline int | |
| 203 | fetestexcept(int __excepts) | |
| 204 | { | |
| 205 | 	__uint32_t __mxcsr; | |
| 206 | 	__uint16_t __status; | |
| 207 | ||
| 208 | 	__fnstsw(&__status); | |
| 209 | 	if (__HAS_SSE()) | |
| 210 | 		__stmxcsr(&__mxcsr); | |
| 211 | 	else | |
| 212 | 		__mxcsr = 0; | |
| 213 | 	return ((__status | __mxcsr) & __excepts); | |
| 214 | } | |
| 215 | ||
| 216 | __fenv_static inline int | |
| 217 | fesetround(int __round) | |
| 218 | { | |
| 219 | 	__uint32_t __mxcsr; | |
| 220 | 	__uint16_t __control; | |
| 221 | ||
| 222 | 	if (__round & ~_ROUND_MASK) | |
| 223 | 		return (-1); | |
| 224 | ||
| 225 | 	__fnstcw(&__control); | |
| 226 | 	__control &= ~_ROUND_MASK; | |
| 227 | 	__control |= __round; | |
| 228 | 	__fldcw(&__control); | |
| 229 | ||
| 230 | 	if (__HAS_SSE()) { | |
| 231 | 		__stmxcsr(&__mxcsr); | |
| 232 | 		__mxcsr &= ~(_ROUND_MASK << _SSE_ROUND_SHIFT); | |
| 233 | 		__mxcsr |= __round << _SSE_ROUND_SHIFT; | |
| 234 | 		__ldmxcsr(&__mxcsr); | |
| 235 | 	} | |
| 236 | ||
| 237 | 	return (0); | |
| 238 | } | |
| 239 | ||
| 240 | __fenv_static inline int | |
| 241 | fesetenv(const fenv_t *__envp) | |
| 242 | { | |
| 243 | 	fenv_t __env = *__envp; | |
| 244 | 	__uint32_t __mxcsr; | |
| 245 | ||
| 246 | 	__mxcsr = __get_mxcsr(__env); | |
| 247 | 	__set_mxcsr(__env, 0xffffffff); | |
| 248 | 	/* | |
| 249 | 	 * XXX Using fldenvx() instead of fldenv() tells the compiler that this | |
| 250 | 	 * instruction clobbers the i387 register stack. This happens because | |
| 251 | 	 * we restore the tag word from the saved environment. Normally, this | |
| 252 | 	 * would happen anyway and we wouldn't care, because the ABI allows | |
| 253 | 	 * function calls to clobber the i387 regs. However, fesetenv() is | |
| 254 | 	 * inlined, so we need to be more careful. | |
| 255 | 	 */ | |
| 256 | 	__fldenvx(__env); | |
| 257 | 	if (__HAS_SSE()) | |
| 258 | 		__ldmxcsr(&__mxcsr); | |
| 259 | 	return (0); | |
| 260 | } | |
| 261 | ||
| 262 | #else /* __amd64__ */ | |
| 263 | ||
| 264 | __fenv_static inline int | |
| 265 | feclearexcept(int __excepts) | |
| 266 | { | |
| 267 | 	fenv_t __env; | |
| 268 | ||
| 269 | 	if (__excepts == FE_ALL_EXCEPT) { | |
| 270 | 		__fnclex(); | |
| 271 | 	} else { | |
| 272 | 		__fnstenv(&__env.__x87); | |
| 273 | 		__env.__x87.__status &= ~__excepts; | |
| 274 | 		__fldenv(&__env.__x87); | |
| 275 | 	} | |
| 276 | 	__stmxcsr(&__env.__mxcsr); | |
| 277 | 	__env.__mxcsr &= ~__excepts; | |
| 278 | 	__ldmxcsr(&__env.__mxcsr); | |
| 279 | 	return (0); | |
| 280 | } | |
| 281 | ||
| 282 | __fenv_static inline int | |
| 283 | fegetexceptflag(fexcept_t *__flagp, int __excepts) | |
| 284 | { | |
| 285 | 	__uint32_t __mxcsr; | |
| 286 | 	__uint16_t __status; | |
| 287 | ||
| 288 | 	__stmxcsr(&__mxcsr); | |
| 289 | 	__fnstsw(&__status); | |
| 290 | 	*__flagp = (__mxcsr | __status) & __excepts; | |
| 291 | 	return (0); | |
| 292 | } | |
| 293 | ||
| 294 | __fenv_static inline int | |
| 295 | fetestexcept(int __excepts) | |
| 296 | { | |
| 297 | 	__uint32_t __mxcsr; | |
| 298 | 	__uint16_t __status; | |
| 299 | ||
| 300 | 	__stmxcsr(&__mxcsr); | |
| 301 | 	__fnstsw(&__status); | |
| 302 | 	return ((__status | __mxcsr) & __excepts); | |
| 303 | } | |
| 304 | ||
| 305 | __fenv_static inline int | |
| 306 | fesetround(int __round) | |
| 307 | { | |
| 308 | 	__uint32_t __mxcsr; | |
| 309 | 	__uint16_t __control; | |
| 310 | ||
| 311 | 	if (__round & ~_ROUND_MASK) | |
| 312 | 		return (-1); | |
| 313 | ||
| 314 | 	__fnstcw(&__control); | |
| 315 | 	__control &= ~_ROUND_MASK; | |
| 316 | 	__control |= __round; | |
| 317 | 	__fldcw(&__control); | |
| 318 | ||
| 319 | 	__stmxcsr(&__mxcsr); | |
| 320 | 	__mxcsr &= ~(_ROUND_MASK << _SSE_ROUND_SHIFT); | |
| 321 | 	__mxcsr |= __round << _SSE_ROUND_SHIFT; | |
| 322 | 	__ldmxcsr(&__mxcsr); | |
| 323 | ||
| 324 | 	return (0); | |
| 325 | } | |
| 326 | ||
| 327 | __fenv_static inline int | |
| 328 | fesetenv(const fenv_t *__envp) | |
| 329 | { | |
| 330 | ||
| 331 | 	/* | |
| 332 | 	 * XXX Using fldenvx() instead of fldenv() tells the compiler that this | |
| 333 | 	 * instruction clobbers the i387 register stack. This happens because | |
| 334 | 	 * we restore the tag word from the saved environment. Normally, this | |
| 335 | 	 * would happen anyway and we wouldn't care, because the ABI allows | |
| 336 | 	 * function calls to clobber the i387 regs. However, fesetenv() is | |
| 337 | 	 * inlined, so we need to be more careful. | |
| 338 | 	 */ | |
| 339 | 	__fldenvx(__envp->__x87); | |
| 340 | 	__ldmxcsr(&__envp->__mxcsr); | |
| 341 | 	return (0); | |
| 342 | } | |
| 343 | ||
| 344 | #endif /* __i386__ */ | |
| 345 | ||
| 346 | __END_DECLS | |
| 347 | ||
| 348 | #endif	/* !_FENV_H_ */ | |
| \ No newline at end of file |
lib/libc/include/x86_64-freebsd-none/float.h deleted-5| ... | ... | @@ -1,5 +0,0 @@ |
| 1 | /*- | |
| 2 | * This file is in the public domain. | |
| 3 | */ | |
| 4 | ||
| 5 | #include <x86/float.h> | |
| \ No newline at end of file |
lib/libc/include/x86_64-freebsd-none/floatingpoint.h deleted-44| ... | ... | @@ -1,44 +0,0 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-4-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 1993 Andrew Moore, Talke Studio | |
| 5 | * All rights reserved. | |
| 6 | * | |
| 7 | * Redistribution and use in source and binary forms, with or without | |
| 8 | * modification, are permitted provided that the following conditions | |
| 9 | * are met: | |
| 10 | * 1. Redistributions of source code must retain the above copyright | |
| 11 | * notice, this list of conditions and the following disclaimer. | |
| 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 13 | * notice, this list of conditions and the following disclaimer in the | |
| 14 | * documentation and/or other materials provided with the distribution. | |
| 15 | * 3. All advertising materials mentioning features or use of this software | |
| 16 | * must display the following acknowledgement: | |
| 17 | *	This product includes software developed by the University of | |
| 18 | *	California, Berkeley and its contributors. | |
| 19 | * 4. Neither the name of the University nor the names of its contributors | |
| 20 | * may be used to endorse or promote products derived from this software | |
| 21 | * without specific prior written permission. | |
| 22 | * | |
| 23 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | |
| 24 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 25 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
| 26 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
| 27 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
| 28 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
| 29 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
| 30 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
| 31 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
| 32 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
| 33 | * SUCH DAMAGE. | |
| 34 | * | |
| 35 | *	from: @(#) floatingpoint.h	1.0 (Berkeley) 9/23/93 | |
| 36 | */ | |
| 37 | ||
| 38 | #ifndef _FLOATINGPOINT_H_ | |
| 39 | #define _FLOATINGPOINT_H_ | |
| 40 | ||
| 41 | #include <sys/cdefs.h> | |
| 42 | #include <machine/ieeefp.h> | |
| 43 | ||
| 44 | #endif /* !_FLOATINGPOINT_H_ */ | |
| \ No newline at end of file |
lib/libc/include/x86_64-freebsd-none/i386/asm.h-2| ... | ... | @@ -30,8 +30,6 @@ |
| 30 | 30 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 31 | 31 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 32 | 32 | * SUCH DAMAGE. |
| 33 | * | |
| 34 | *	from: @(#)DEFS.h	5.1 (Berkeley) 4/23/90 | |
| 35 | 33 | */ |
| 36 | 34 | |
| 37 | 35 | #ifndef _MACHINE_ASM_H_ |
lib/libc/include/x86_64-freebsd-none/i386/atomic.h+20-27| ... | ... | @@ -49,8 +49,8 @@ static __inline void |
| 49 | 49 | __mbk(void) |
| 50 | 50 | { |
| 51 | 51 | |
| 52 | 	__asm __volatile("lock; addl $0,%%fs:%0" | |
| 53 | 	 : "+m" (*(u_int *)__OFFSETOF_MONITORBUF) : : "memory", "cc"); | |
| 52 | 	__asm __volatile("lock; addl $0,%%fs:%c0" | |
| 53 | 	 : : "i" (__OFFSETOF_MONITORBUF) : "memory", "cc"); | |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | 56 | static __inline void |
| ... | ... | @@ -249,7 +249,7 @@ atomic_testandclear_int(volatile u_int *p, u_int v) |
| 249 | 249 | |
| 250 | 250 | #define	ATOMIC_LOAD(TYPE)					\ |
| 251 | 251 | static __inline u_##TYPE					\ |
| 252 | atomic_load_acq_##TYPE(volatile u_##TYPE *p)			\ | |
| 252 | atomic_load_acq_##TYPE(const volatile u_##TYPE *p)		\ | |
| 253 | 253 | {								\ |
| 254 | 254 | 	u_##TYPE res;						\ |
| 255 | 255 | 								\ |
| ... | ... | @@ -299,17 +299,6 @@ atomic_thread_fence_seq_cst(void) |
| 299 | 299 | |
| 300 | 300 | #ifdef _KERNEL |
| 301 | 301 | |
| 302 | #ifdef WANT_FUNCTIONS | |
| 303 | int		atomic_cmpset_64_i386(volatile uint64_t *, uint64_t, uint64_t); | |
| 304 | int		atomic_cmpset_64_i586(volatile uint64_t *, uint64_t, uint64_t); | |
| 305 | uint64_t	atomic_load_acq_64_i386(volatile uint64_t *); | |
| 306 | uint64_t	atomic_load_acq_64_i586(volatile uint64_t *); | |
| 307 | void		atomic_store_rel_64_i386(volatile uint64_t *, uint64_t); | |
| 308 | void		atomic_store_rel_64_i586(volatile uint64_t *, uint64_t); | |
| 309 | uint64_t	atomic_swap_64_i386(volatile uint64_t *, uint64_t); | |
| 310 | uint64_t	atomic_swap_64_i586(volatile uint64_t *, uint64_t); | |
| 311 | #endif | |
| 312 | ||
| 313 | 302 | /* I486 does not support SMP or CMPXCHG8B. */ |
| 314 | 303 | static __inline int |
| 315 | 304 | atomic_cmpset_64_i386(volatile uint64_t *dst, uint64_t expect, uint64_t src) |
| ... | ... | @@ -353,12 +342,12 @@ atomic_fcmpset_64_i386(volatile uint64_t *dst, uint64_t *expect, uint64_t src) |
| 353 | 342 | } |
| 354 | 343 | |
| 355 | 344 | static __inline uint64_t |
| 356 | atomic_load_acq_64_i386(volatile uint64_t *p) | |
| 345 | atomic_load_acq_64_i386(const volatile uint64_t *p) | |
| 357 | 346 | { |
| 358 | 	volatile uint32_t *q; | |
| 347 | 	const volatile uint32_t *q; | |
| 359 | 348 | 	uint64_t res; |
| 360 | 349 | |
| 361 | 	q = (volatile uint32_t *)p; | |
| 350 | 	q = (const volatile uint32_t *)p; | |
| 362 | 351 | 	__asm __volatile( |
| 363 | 352 | 	"	pushfl ;		" |
| 364 | 353 | 	"	cli ;			" |
| ... | ... | @@ -447,8 +436,12 @@ atomic_fcmpset_64_i586(volatile uint64_t *dst, uint64_t *expect, uint64_t src) |
| 447 | 436 | 	return (res); |
| 448 | 437 | } |
| 449 | 438 | |
| 439 | /* | |
| 440 | * Architecturally always writes back some value to '*p' so will trigger | |
| 441 | * a #GP(0) on read-only mappings. | |
| 442 | */ | |
| 450 | 443 | static __inline uint64_t |
| 451 | atomic_load_acq_64_i586(volatile uint64_t *p) | |
| 444 | atomic_load_acq_64_i586(const volatile uint64_t *p) | |
| 452 | 445 | { |
| 453 | 446 | 	uint64_t res; |
| 454 | 447 | |
| ... | ... | @@ -456,9 +449,9 @@ atomic_load_acq_64_i586(volatile uint64_t *p) |
| 456 | 449 | 	"	movl	%%ebx,%%eax ;	" |
| 457 | 450 | 	"	movl	%%ecx,%%edx ;	" |
| 458 | 451 | 	"	lock; cmpxchg8b %1" |
| 459 | 	: "=&A" (res),			/* 0 */ | |
| 460 | 	 "+m" (*p)			/* 1 */ | |
| 461 | 	: : "memory", "cc"); | |
| 452 | 	: "=&A" (res)			/* 0 */ | |
| 453 | 	: "m" (*p)			/* 1 */ | |
| 454 | 	: "memory", "cc"); | |
| 462 | 455 | 	return (res); |
| 463 | 456 | } |
| 464 | 457 | |
| ... | ... | @@ -514,7 +507,7 @@ atomic_fcmpset_64(volatile uint64_t *dst, uint64_t *expect, uint64_t src) |
| 514 | 507 | } |
| 515 | 508 | |
| 516 | 509 | static __inline uint64_t |
| 517 | atomic_load_acq_64(volatile uint64_t *p) | |
| 510 | atomic_load_acq_64(const volatile uint64_t *p) | |
| 518 | 511 | { |
| 519 | 512 | |
| 520 | 513 | 	if ((cpu_feature & CPUID_CX8) == 0) |
| ... | ... | @@ -614,8 +607,6 @@ ATOMIC_LOADSTORE(long); |
| 614 | 607 | #undef ATOMIC_STORE |
| 615 | 608 | #undef ATOMIC_LOADSTORE |
| 616 | 609 | |
| 617 | #ifndef WANT_FUNCTIONS | |
| 618 | ||
| 619 | 610 | static __inline int |
| 620 | 611 | atomic_cmpset_long(volatile u_long *dst, u_long expect, u_long src) |
| 621 | 612 | { |
| ... | ... | @@ -842,7 +833,7 @@ atomic_swap_long(volatile u_long *p, u_long v) |
| 842 | 833 | #define	atomic_subtract_rel_ptr(p, v) \ |
| 843 | 834 | 	atomic_subtract_rel_int((volatile u_int *)(p), (u_int)(v)) |
| 844 | 835 | #define	atomic_load_acq_ptr(p) \ |
| 845 | 	atomic_load_acq_int((volatile u_int *)(p)) | |
| 836 | 	atomic_load_acq_int((const volatile u_int *)(p)) | |
| 846 | 837 | #define	atomic_store_rel_ptr(p, v) \ |
| 847 | 838 | 	atomic_store_rel_int((volatile u_int *)(p), (v)) |
| 848 | 839 | #define	atomic_cmpset_ptr(dst, old, new) \ |
| ... | ... | @@ -865,8 +856,10 @@ atomic_swap_long(volatile u_long *p, u_long v) |
| 865 | 856 | 	atomic_swap_int((volatile u_int *)(p), (u_int)(v)) |
| 866 | 857 | #define	atomic_readandclear_ptr(p) \ |
| 867 | 858 | 	atomic_readandclear_int((volatile u_int *)(p)) |
| 868 | ||
| 869 | #endif /* !WANT_FUNCTIONS */ | |
| 859 | #define	atomic_testandclear_ptr(p, val) \ | |
| 860 | 	atomic_testandclear_int((volatile u_int *)(p), (val)) | |
| 861 | #define	atomic_testandset_ptr(p, val) \ | |
| 862 | 	atomic_testandset_int((volatile u_int *)(p), (val)) | |
| 870 | 863 | |
| 871 | 864 | #if defined(_KERNEL) |
| 872 | 865 | #define	mb()	__mbk() |
lib/libc/include/x86_64-freebsd-none/i386/cpufunc.h+1-10| ... | ... | @@ -63,15 +63,6 @@ bsfl(u_int mask) |
| 63 | 63 | 	return (result); |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | static __inline __pure2 u_int | |
| 67 | bsrl(u_int mask) | |
| 68 | { | |
| 69 | 	u_int	result; | |
| 70 | ||
| 71 | 	__asm("bsrl %1,%0" : "=r" (result) : "rm" (mask) : "cc"); | |
| 72 | 	return (result); | |
| 73 | } | |
| 74 | ||
| 75 | 66 | static __inline void |
| 76 | 67 | clflush(u_long addr) |
| 77 | 68 | { |
| ... | ... | @@ -83,7 +74,7 @@ static __inline void |
| 83 | 74 | clflushopt(u_long addr) |
| 84 | 75 | { |
| 85 | 76 | |
| 86 | 	__asm __volatile(".byte 0x66;clflush %0" : : "m" (*(char *)addr)); | |
| 77 | 	__asm __volatile("clflushopt %0" : : "m" (*(char *)addr)); | |
| 87 | 78 | } |
| 88 | 79 | |
| 89 | 80 | static __inline void |
lib/libc/include/x86_64-freebsd-none/i386/pcpu.h+20-27| ... | ... | @@ -108,16 +108,8 @@ _Static_assert(sizeof(struct monitorbuf) == 128, "2x cache line"); |
| 108 | 108 | /* |
| 109 | 109 | * Evaluates to the address of the per-cpu variable name. |
| 110 | 110 | */ |
| 111 | #define	__PCPU_PTR(name) __extension__ ({				\ | |
| 112 | 	__pcpu_type(name) *__p;						\ | |
| 113 | 									\ | |
| 114 | 	__asm __volatile("movl %%fs:%1,%0; addl %2,%0"			\ | |
| 115 | 	 : "=r" (__p)						\ | |
| 116 | 	 : "m" (*(struct pcpu *)(__pcpu_offset(pc_prvspace))),	\ | |
| 117 | 	 "i" (__pcpu_offset(name)));				\ | |
| 118 | 									\ | |
| 119 | 	__p;								\ | |
| 120 | }) | |
| 111 | #define	__PCPU_PTR(name)						\ | |
| 112 | 	(&get_pcpu()->name) | |
| 121 | 113 | |
| 122 | 114 | /* |
| 123 | 115 | * Evaluates to the value of the per-cpu variable name. |
| ... | ... | @@ -126,14 +118,13 @@ _Static_assert(sizeof(struct monitorbuf) == 128, "2x cache line"); |
| 126 | 118 | 	__pcpu_type(name) __res;					\ |
| 127 | 119 | 	struct __s {							\ |
| 128 | 120 | 		u_char	__b[MIN(sizeof(__res), 4)];			\ |
| 129 | 	} __s;								\ | |
| 121 | 	};								\ | |
| 130 | 122 | 									\ |
| 131 | 123 | 	if (sizeof(__res) == 1 || sizeof(__res) == 2 ||			\ |
| 132 | 124 | 	 sizeof(__res) == 4) {					\ |
| 133 | 		__asm __volatile("mov %%fs:%1,%0"			\ | |
| 134 | 		 : "=r" (__s)					\ | |
| 135 | 		 : "m" (*(struct __s *)(__pcpu_offset(name))));	\ | |
| 136 | 		*(struct __s *)(void *)&__res = __s;			\ | |
| 125 | 		__asm __volatile("mov %%fs:%c1,%0"			\ | |
| 126 | 		 : "=r" (*(struct __s *)(void *)&__res)		\ | |
| 127 | 		 : "i" (__pcpu_offset(name)));			\ | |
| 137 | 128 | 	} else {							\ |
| 138 | 129 | 		__res = *__PCPU_PTR(name);				\ |
| 139 | 130 | 	}								\ |
| ... | ... | @@ -148,15 +139,16 @@ _Static_assert(sizeof(struct monitorbuf) == 128, "2x cache line"); |
| 148 | 139 | 	__pcpu_type(name) __val;					\ |
| 149 | 140 | 	struct __s {							\ |
| 150 | 141 | 		u_char	__b[MIN(sizeof(__val), 4)];			\ |
| 151 | 	} __s;								\ | |
| 142 | 	};								\ | |
| 152 | 143 | 									\ |
| 153 | 144 | 	__val = (val);							\ |
| 154 | 145 | 	if (sizeof(__val) == 1 || sizeof(__val) == 2 ||			\ |
| 155 | 146 | 	 sizeof(__val) == 4) {					\ |
| 156 | 		__s = *(struct __s *)(void *)&__val;			\ | |
| 157 | 		__asm __volatile("add %1,%%fs:%0"			\ | |
| 158 | 		 : "=m" (*(struct __s *)(__pcpu_offset(name)))	\ | |
| 159 | 		 : "r" (__s));					\ | |
| 147 | 		__asm __volatile("add %1,%%fs:%c0"			\ | |
| 148 | 		 :							\ | |
| 149 | 		 : "i" (__pcpu_offset(name)),			\ | |
| 150 | 		 "r" (*(struct __s *)(void *)&__val)		\ | |
| 151 | 		 : "cc", "memory");					\ | |
| 160 | 152 | 	} else								\ |
| 161 | 153 | 		*__PCPU_PTR(name) += __val;				\ |
| 162 | 154 | } while (0) |
| ... | ... | @@ -168,15 +160,16 @@ _Static_assert(sizeof(struct monitorbuf) == 128, "2x cache line"); |
| 168 | 160 | 	__pcpu_type(name) __val;					\ |
| 169 | 161 | 	struct __s {							\ |
| 170 | 162 | 		u_char	__b[MIN(sizeof(__val), 4)];			\ |
| 171 | 	} __s;								\ | |
| 163 | 	};								\ | |
| 172 | 164 | 									\ |
| 173 | 165 | 	__val = (val);							\ |
| 174 | 166 | 	if (sizeof(__val) == 1 || sizeof(__val) == 2 ||			\ |
| 175 | 167 | 	 sizeof(__val) == 4) {					\ |
| 176 | 		__s = *(struct __s *)(void *)&__val;			\ | |
| 177 | 		__asm __volatile("mov %1,%%fs:%0"			\ | |
| 178 | 		 : "=m" (*(struct __s *)(__pcpu_offset(name)))	\ | |
| 179 | 		 : "r" (__s));					\ | |
| 168 | 		__asm __volatile("mov %1,%%fs:%c0"			\ | |
| 169 | 		 :							\ | |
| 170 | 		 : "i" (__pcpu_offset(name)),			\ | |
| 171 | 		 "r" (*(struct __s *)(void *)&__val)		\ | |
| 172 | 		 : "memory");					\ | |
| 180 | 173 | 	} else {							\ |
| 181 | 174 | 		*__PCPU_PTR(name) = __val;				\ |
| 182 | 175 | 	}								\ |
| ... | ... | @@ -185,9 +178,9 @@ _Static_assert(sizeof(struct monitorbuf) == 128, "2x cache line"); |
| 185 | 178 | #define	get_pcpu() __extension__ ({					\ |
| 186 | 179 | 	struct pcpu *__pc;						\ |
| 187 | 180 | 									\ |
| 188 | 	__asm __volatile("movl %%fs:%1,%0"				\ | |
| 181 | 	__asm __volatile("movl %%fs:%c1,%0"				\ | |
| 189 | 182 | 	 : "=r" (__pc)						\ |
| 190 | 	 : "m" (*(struct pcpu *)(__pcpu_offset(pc_prvspace))));	\ | |
| 183 | 	 : "i" (__pcpu_offset(pc_prvspace)));			\ | |
| 191 | 184 | 	__pc;								\ |
| 192 | 185 | }) |
| 193 | 186 |
lib/libc/include/x86_64-freebsd-none/i386/pcpu_aux.h+4-4| ... | ... | @@ -49,8 +49,8 @@ __curthread(void) |
| 49 | 49 | { |
| 50 | 50 | 	struct thread *td; |
| 51 | 51 | |
| 52 | 	__asm("movl %%fs:%1,%0" : "=r" (td) | |
| 53 | 	 : "m" (*(char *)offsetof(struct pcpu, pc_curthread))); | |
| 52 | 	__asm("movl %%fs:%c1,%0" : "=r" (td) | |
| 53 | 	 : "i" (offsetof(struct pcpu, pc_curthread))); | |
| 54 | 54 | 	return (td); |
| 55 | 55 | } |
| 56 | 56 | #define	curthread		(__curthread()) |
| ... | ... | @@ -60,8 +60,8 @@ __curpcb(void) |
| 60 | 60 | { |
| 61 | 61 | 	struct pcb *pcb; |
| 62 | 62 | |
| 63 | 	__asm("movl %%fs:%1,%0" : "=r" (pcb) | |
| 64 | 	 : "m" (*(char *)offsetof(struct pcpu, pc_curpcb))); | |
| 63 | 	__asm("movl %%fs:%c1,%0" : "=r" (pcb) | |
| 64 | 	 : "i" (offsetof(struct pcpu, pc_curpcb))); | |
| 65 | 65 | 	return (pcb); |
| 66 | 66 | } |
| 67 | 67 | #define	curpcb		(__curpcb()) |
lib/libc/include/x86_64-freebsd-none/i386/pmap.h+3-6| ... | ... | @@ -37,9 +37,6 @@ |
| 37 | 37 | * map the page tables using the pagetables themselves. This is done to |
| 38 | 38 | * reduce the impact on kernel virtual memory for lots of sparse address |
| 39 | 39 | * space, and to reduce the cost of memory to each process. |
| 40 | * | |
| 41 | *	from: hp300: @(#)pmap.h	7.2 (Berkeley) 12/16/90 | |
| 42 | *	from: @(#)pmap.h	7.4 (Berkeley) 5/12/91 | |
| 43 | 40 | */ |
| 44 | 41 | |
| 45 | 42 | #ifndef _MACHINE_PMAP_H_ |
| ... | ... | @@ -83,7 +80,7 @@ |
| 83 | 80 | * 4KB (PTE) page mappings have identical settings for the following fields: |
| 84 | 81 | */ |
| 85 | 82 | #define PG_PTE_PROMOTE	(PG_MANAGED | PG_W | PG_G | PG_PTE_PAT | \ |
| 86 | 	 PG_M | PG_A | PG_NC_PCD | PG_NC_PWT | PG_U | PG_RW | PG_V) | |
| 83 | 	 PG_M | PG_NC_PCD | PG_NC_PWT | PG_U | PG_RW | PG_V) | |
| 87 | 84 | |
| 88 | 85 | /* |
| 89 | 86 | * Page Protection Exception bits |
| ... | ... | @@ -221,7 +218,7 @@ void	pmap_basemem_setup(u_int basemem); |
| 221 | 218 | void	*pmap_bios16_enter(void); |
| 222 | 219 | void	pmap_bios16_leave(void *handle); |
| 223 | 220 | void	pmap_bootstrap(vm_paddr_t); |
| 224 | int	pmap_cache_bits(pmap_t, int mode, boolean_t is_pde); | |
| 221 | int	pmap_cache_bits(pmap_t, int mode, bool is_pde); | |
| 225 | 222 | int	pmap_change_attr(vm_offset_t, vm_size_t, int); |
| 226 | 223 | caddr_t	pmap_cmap3(vm_paddr_t pa, u_int pte_bits); |
| 227 | 224 | void	pmap_cp_slow0_map(vm_offset_t kaddr, int plen, vm_page_t *ma); |
| ... | ... | @@ -239,7 +236,7 @@ void	pmap_ksetrw(vm_offset_t va); |
| 239 | 236 | void	*pmap_mapbios(vm_paddr_t, vm_size_t); |
| 240 | 237 | void	*pmap_mapdev(vm_paddr_t, vm_size_t); |
| 241 | 238 | void	*pmap_mapdev_attr(vm_paddr_t, vm_size_t, int); |
| 242 | boolean_t pmap_page_is_mapped(vm_page_t m); | |
| 239 | bool	pmap_page_is_mapped(vm_page_t m); | |
| 243 | 240 | void	pmap_page_set_memattr(vm_page_t m, vm_memattr_t ma); |
| 244 | 241 | vm_paddr_t pmap_pg_frame(vm_paddr_t pa); |
| 245 | 242 | bool	pmap_ps_enabled(pmap_t pmap); |
lib/libc/include/x86_64-freebsd-none/i386/proc.h-2| ... | ... | @@ -27,8 +27,6 @@ |
| 27 | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | * | |
| 31 | *	from: @(#)proc.h	7.1 (Berkeley) 5/15/91 | |
| 32 | 30 | */ |
| 33 | 31 | |
| 34 | 32 | #ifndef _MACHINE_PROC_H_ |
lib/libc/include/x86_64-freebsd-none/i386/profile.h-2| ... | ... | @@ -27,8 +27,6 @@ |
| 27 | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | * | |
| 31 | *	@(#)profile.h	8.1 (Berkeley) 6/11/93 | |
| 32 | 30 | */ |
| 33 | 31 | |
| 34 | 32 | #ifndef _MACHINE_PROFILE_H_ |
lib/libc/include/x86_64-freebsd-none/i386/segments.h-2| ... | ... | @@ -31,8 +31,6 @@ |
| 31 | 31 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 32 | 32 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 33 | 33 | * SUCH DAMAGE. |
| 34 | * | |
| 35 | *	from: @(#)segments.h	7.1 (Berkeley) 5/9/91 | |
| 36 | 34 | */ |
| 37 | 35 | |
| 38 | 36 | #ifndef _MACHINE_SEGMENTS_H_ |
lib/libc/include/x86_64-freebsd-none/i386/vmparam.h+1-2| ... | ... | @@ -32,8 +32,6 @@ |
| 32 | 32 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 33 | 33 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 34 | 34 | * SUCH DAMAGE. |
| 35 | * | |
| 36 | *	from: @(#)vmparam.h	5.9 (Berkeley) 5/12/91 | |
| 37 | 35 | */ |
| 38 | 36 | |
| 39 | 37 | #ifndef _MACHINE_VMPARAM_H_ |
| ... | ... | @@ -248,5 +246,6 @@ |
| 248 | 246 | * Need a page dump array for minidump. |
| 249 | 247 | */ |
| 250 | 248 | #define MINIDUMP_PAGE_TRACKING	1 |
| 249 | #define MINIDUMP_STARTUP_PAGE_TRACKING 0 | |
| 251 | 250 | |
| 252 | 251 | #endif /* _MACHINE_VMPARAM_H_ */ |
| \ No newline at end of file |
lib/libc/include/x86_64-freebsd-none/machine/_align.h deleted-5| ... | ... | @@ -1,5 +0,0 @@ |
| 1 | /*- | |
| 2 | * This file is in the public domain. | |
| 3 | */ | |
| 4 | ||
| 5 | #include <x86/_align.h> | |
| \ No newline at end of file |
lib/libc/include/x86_64-freebsd-none/machine/_bus.h+7-24| ... | ... | @@ -1,30 +1,13 @@ |
| 1 | 1 | /*- |
| 2 | * SPDX-License-Identifier: BSD-2-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 2005 M. Warner Losh <imp@FreeBSD.org> | |
| 2 | * Copyright (c) 2005 The FreeBSD Foundation. | |
| 5 | 3 | * |
| 6 | * Redistribution and use in source and binary forms, with or without | |
| 7 | * modification, are permitted provided that the following conditions | |
| 8 | * are met: | |
| 9 | * 1. Redistributions of source code must retain the above copyright | |
| 10 | * notice, this list of conditions, and the following disclaimer, | |
| 11 | * without modification, immediately at the beginning of the file. | |
| 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 13 | * notice, this list of conditions and the following disclaimer in | |
| 14 | * the documentation and/or other materials provided with the | |
| 15 | * distribution. | |
| 4 | * SPDX-License-Identifier: BSD-2-Clause | |
| 16 | 5 | * |
| 17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |
| 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 19 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
| 20 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR | |
| 21 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
| 22 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
| 23 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
| 24 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
| 25 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
| 26 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
| 27 | * SUCH DAMAGE. | |
| 6 | * Derived in part from NetBSD's bus.h files by (alphabetically): | |
| 7 | *	Christopher G. Demetriou | |
| 8 | *	Charles M. Hannum | |
| 9 | *	Jason Thorpe | |
| 10 | *	The NetBSD Foundation. | |
| 28 | 11 | */ |
| 29 | 12 | |
| 30 | 13 | #ifndef AMD64_INCLUDE__BUS_H |
lib/libc/include/x86_64-freebsd-none/machine/_inttypes.h deleted-5| ... | ... | @@ -1,5 +0,0 @@ |
| 1 | /*- | |
| 2 | * This file is in the public domain. | |
| 3 | */ | |
| 4 | ||
| 5 | #include <x86/_inttypes.h> | |
| \ No newline at end of file |
lib/libc/include/x86_64-freebsd-none/machine/_limits.h deleted-5| ... | ... | @@ -1,5 +0,0 @@ |
| 1 | /*- | |
| 2 | * This file is in the public domain. | |
| 3 | */ | |
| 4 | ||
| 5 | #include <x86/_limits.h> | |
| \ No newline at end of file |
lib/libc/include/x86_64-freebsd-none/machine/_stdint.h deleted-5| ... | ... | @@ -1,5 +0,0 @@ |
| 1 | /*- | |
| 2 | * This file is in the public domain. | |
| 3 | */ | |
| 4 | ||
| 5 | #include <x86/_stdint.h> | |
| \ No newline at end of file |
lib/libc/include/x86_64-freebsd-none/machine/_types.h deleted-5| ... | ... | @@ -1,5 +0,0 @@ |
| 1 | /*- | |
| 2 | * This file is in the public domain. | |
| 3 | */ | |
| 4 | ||
| 5 | #include <x86/_types.h> | |
| \ No newline at end of file |
lib/libc/include/x86_64-freebsd-none/machine/asm.h+1-3| ... | ... | @@ -30,8 +30,6 @@ |
| 30 | 30 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 31 | 31 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 32 | 32 | * SUCH DAMAGE. |
| 33 | * | |
| 34 | *	from: @(#)DEFS.h	5.1 (Berkeley) 4/23/90 | |
| 35 | 33 | */ |
| 36 | 34 | |
| 37 | 35 | #ifdef __i386__ |
| ... | ... | @@ -94,7 +92,7 @@ |
| 94 | 92 | |
| 95 | 93 | #define	END(x)		.size x, . - x; .cfi_endproc |
| 96 | 94 | /* |
| 97 | * WEAK_REFERENCE(): create a weak reference alias from sym. | |
| 95 | * WEAK_REFERENCE(): create a weak reference alias from sym. | |
| 98 | 96 | * The macro is not a general asm macro that takes arbitrary names, |
| 99 | 97 | * but one that takes only C names. It does the non-null name |
| 100 | 98 | * translation inside the macro. |
lib/libc/include/x86_64-freebsd-none/machine/atomic.h+6-7| ... | ... | @@ -102,7 +102,7 @@ |
| 102 | 102 | */ |
| 103 | 103 | |
| 104 | 104 | /* |
| 105 | * Always use lock prefixes. The result is slighly less optimal for | |
| 105 | * Always use lock prefixes. The result is slightly less optimal for | |
| 106 | 106 | * UP systems, but it matters less now, and sometimes UP is emulated |
| 107 | 107 | * over SMP. |
| 108 | 108 | * |
| ... | ... | @@ -295,8 +295,8 @@ static __inline void |
| 295 | 295 | __storeload_barrier(void) |
| 296 | 296 | { |
| 297 | 297 | #if defined(_KERNEL) |
| 298 | 	__asm __volatile("lock; addl $0,%%gs:%0" | |
| 299 | 	 : "+m" (*(u_int *)OFFSETOF_MONITORBUF) : : "memory", "cc"); | |
| 298 | 	__asm __volatile("lock; addl $0,%%gs:%c0" | |
| 299 | 	 : : "i" (OFFSETOF_MONITORBUF) : "memory", "cc"); | |
| 300 | 300 | #else /* !_KERNEL */ |
| 301 | 301 | 	__asm __volatile("lock; addl $0,-8(%%rsp)" : : : "memory", "cc"); |
| 302 | 302 | #endif /* _KERNEL*/ |
| ... | ... | @@ -304,7 +304,7 @@ __storeload_barrier(void) |
| 304 | 304 | |
| 305 | 305 | #define	ATOMIC_LOAD(TYPE)					\ |
| 306 | 306 | static __inline u_##TYPE					\ |
| 307 | atomic_load_acq_##TYPE(volatile u_##TYPE *p)			\ | |
| 307 | atomic_load_acq_##TYPE(const volatile u_##TYPE *p)		\ | |
| 308 | 308 | {								\ |
| 309 | 309 | 	u_##TYPE res;						\ |
| 310 | 310 | 								\ |
| ... | ... | @@ -385,7 +385,6 @@ ATOMIC_LOADSTORE(long); |
| 385 | 385 | #undef ATOMIC_LOAD |
| 386 | 386 | #undef ATOMIC_STORE |
| 387 | 387 | #undef ATOMIC_LOADSTORE |
| 388 | #ifndef WANT_FUNCTIONS | |
| 389 | 388 | |
| 390 | 389 | /* Read the current value and store a new value in the destination. */ |
| 391 | 390 | static __inline u_int |
| ... | ... | @@ -589,8 +588,8 @@ atomic_swap_long(volatile u_long *p, u_long v) |
| 589 | 588 | #define	atomic_fcmpset_rel_ptr	atomic_fcmpset_rel_long |
| 590 | 589 | #define	atomic_swap_ptr		atomic_swap_long |
| 591 | 590 | #define	atomic_readandclear_ptr	atomic_readandclear_long |
| 592 | ||
| 593 | #endif /* !WANT_FUNCTIONS */ | |
| 591 | #define	atomic_testandset_ptr	atomic_testandset_long | |
| 592 | #define	atomic_testandclear_ptr	atomic_testandclear_long | |
| 594 | 593 | |
| 595 | 594 | #endif /* !SAN_NEEDS_INTERCEPTORS || SAN_RUNTIME */ |
| 596 | 595 |
lib/libc/include/x86_64-freebsd-none/machine/bus.h deleted-5| ... | ... | @@ -1,5 +0,0 @@ |
| 1 | /*- | |
| 2 | * This file is in the public domain. | |
| 3 | */ | |
| 4 | ||
| 5 | #include <x86/bus.h> | |
| \ No newline at end of file |
lib/libc/include/x86_64-freebsd-none/machine/bus_dma.h+1-1| ... | ... | @@ -29,6 +29,6 @@ |
| 29 | 29 | #ifndef _AMD64_BUS_DMA_H_ |
| 30 | 30 | #define _AMD64_BUS_DMA_H_ |
| 31 | 31 | |
| 32 | #include <x86/bus_dma.h> | |
| 32 | #include <x86/bus_dma.h> | |
| 33 | 33 | |
| 34 | 34 | #endif /* _AMD64_BUS_DMA_H_ */ |
| \ No newline at end of file |
lib/libc/include/x86_64-freebsd-none/machine/clock.h deleted-5| ... | ... | @@ -1,5 +0,0 @@ |
| 1 | /* | |
| 2 | * This file is in the public domain. | |
| 3 | */ | |
| 4 | ||
| 5 | #include <x86/clock.h> | |
| \ No newline at end of file |
lib/libc/include/x86_64-freebsd-none/machine/cpu.h+2-3| ... | ... | @@ -30,8 +30,6 @@ |
| 30 | 30 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 31 | 31 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 32 | 32 | * SUCH DAMAGE. |
| 33 | * | |
| 34 | *	from: @(#)cpu.h	5.4 (Berkeley) 5/9/91 | |
| 35 | 33 | */ |
| 36 | 34 | |
| 37 | 35 | #ifndef _MACHINE_CPU_H_ |
| ... | ... | @@ -72,7 +70,8 @@ extern char	btext[]; |
| 72 | 70 | extern char	_end[]; |
| 73 | 71 | extern char	etext[]; |
| 74 | 72 | |
| 75 | /* Resume hook for VMM. */ | |
| 73 | /* Suspend and resume hook for VMM. */ | |
| 74 | extern	void (*vmm_suspend_p)(void); | |
| 76 | 75 | extern	void (*vmm_resume_p)(void); |
| 77 | 76 | |
| 78 | 77 | void	cpu_halt(void); |
lib/libc/include/x86_64-freebsd-none/machine/cpufunc.h+33-5| ... | ... | @@ -65,10 +65,6 @@ breakpoint(void) |
| 65 | 65 | |
| 66 | 66 | #define	bsfq(mask)	__builtin_ctzl(mask) |
| 67 | 67 | |
| 68 | #define	bsrl(mask)	(__builtin_clz(mask) ^ 0x1f) | |
| 69 | ||
| 70 | #define	bsrq(mask)	(__builtin_clzl(mask) ^ 0x3f) | |
| 71 | ||
| 72 | 68 | static __inline void |
| 73 | 69 | clflush(u_long addr) |
| 74 | 70 | { |
| ... | ... | @@ -80,7 +76,7 @@ static __inline void |
| 80 | 76 | clflushopt(u_long addr) |
| 81 | 77 | { |
| 82 | 78 | |
| 83 | 	__asm __volatile(".byte 0x66;clflush %0" : : "m" (*(char *)addr)); | |
| 79 | 	__asm __volatile("clflushopt %0" : : "m" (*(char *)addr)); | |
| 84 | 80 | } |
| 85 | 81 | |
| 86 | 82 | static __inline void |
| ... | ... | @@ -576,6 +572,15 @@ rss(void) |
| 576 | 572 | 	return (sel); |
| 577 | 573 | } |
| 578 | 574 | |
| 575 | static __inline u_short | |
| 576 | rcs(void) | |
| 577 | { | |
| 578 | 	u_short sel; | |
| 579 | ||
| 580 | 	__asm __volatile("movw %%cs,%0" : "=rm" (sel)); | |
| 581 | 	return (sel); | |
| 582 | } | |
| 583 | ||
| 579 | 584 | static __inline void |
| 580 | 585 | load_ds(u_short sel) |
| 581 | 586 | { |
| ... | ... | @@ -946,6 +951,29 @@ sgx_eremove(void *epc) |
| 946 | 951 | 	return (sgx_encls(SGX_EREMOVE, 0, (uint64_t)epc, 0)); |
| 947 | 952 | } |
| 948 | 953 | |
| 954 | static __inline void | |
| 955 | xrstors(uint8_t *save_area, uint64_t state_bitmap) | |
| 956 | { | |
| 957 | 	uint32_t low, hi; | |
| 958 | ||
| 959 | 	low = state_bitmap; | |
| 960 | 	hi = state_bitmap >> 32; | |
| 961 | 	__asm __volatile("xrstors %0" : : "m"(*save_area), "a"(low), | |
| 962 | 	 "d"(hi)); | |
| 963 | } | |
| 964 | ||
| 965 | static __inline void | |
| 966 | xsaves(uint8_t *save_area, uint64_t state_bitmap) | |
| 967 | { | |
| 968 | 	uint32_t low, hi; | |
| 969 | ||
| 970 | 	low = state_bitmap; | |
| 971 | 	hi = state_bitmap >> 32; | |
| 972 | 	__asm __volatile("xsaves %0" : "=m"(*save_area) : "a"(low), | |
| 973 | 	 "d"(hi) | |
| 974 | 	 : "memory"); | |
| 975 | } | |
| 976 | ||
| 949 | 977 | void	reset_dbregs(void); |
| 950 | 978 | |
| 951 | 979 | #ifdef _KERNEL |
lib/libc/include/x86_64-freebsd-none/machine/dump.h deleted-5| ... | ... | @@ -1,5 +0,0 @@ |
| 1 | /*- | |
| 2 | * This file is in the public domain. | |
| 3 | */ | |
| 4 | ||
| 5 | #include <x86/dump.h> | |
| \ No newline at end of file |
lib/libc/include/x86_64-freebsd-none/machine/efi.h+6| ... | ... | @@ -29,6 +29,8 @@ |
| 29 | 29 | #ifndef __AMD64_INCLUDE_EFI_H_ |
| 30 | 30 | #define __AMD64_INCLUDE_EFI_H_ |
| 31 | 31 | |
| 32 | #include <sys/types.h> | |
| 33 | ||
| 32 | 34 | /* |
| 33 | 35 | * XXX: from gcc 6.2 manual: |
| 34 | 36 | * Note, the ms_abi attribute for Microsoft Windows 64-bit targets |
| ... | ... | @@ -51,6 +53,10 @@ |
| 51 | 53 | #define	EFI_TIME_OWNED()	mtx_assert(&atrtc_time_lock, MA_OWNED) |
| 52 | 54 | |
| 53 | 55 | #define	EFI_RT_HANDLE_FAULTS_DEFAULT	1 |
| 56 | ||
| 57 | #define EFI_MAP_BOOTTYPE_ALLOWED(type) (((efi_map_regs >> (type)) & 1) != 0) | |
| 58 | ||
| 59 | extern uint32_t efi_map_regs; | |
| 54 | 60 | #endif |
| 55 | 61 | |
| 56 | 62 | struct efirt_callinfo { |
lib/libc/include/x86_64-freebsd-none/machine/elf.h deleted-5| ... | ... | @@ -1,5 +0,0 @@ |
| 1 | /*- | |
| 2 | * This file is in the public domain. | |
| 3 | */ | |
| 4 | ||
| 5 | #include <x86/elf.h> | |
| \ No newline at end of file |
lib/libc/include/x86_64-freebsd-none/machine/endian.h deleted-5| ... | ... | @@ -1,5 +0,0 @@ |
| 1 | /*- | |
| 2 | * This file is in the public domain. | |
| 3 | */ | |
| 4 | ||
| 5 | #include <x86/endian.h> | |
| \ No newline at end of file |
lib/libc/include/x86_64-freebsd-none/machine/exec.h deleted-39| ... | ... | @@ -1,39 +0,0 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-3-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 1992, 1993 | |
| 5 | *	The Regents of the University of California. All rights reserved. | |
| 6 | * | |
| 7 | * Redistribution and use in source and binary forms, with or without | |
| 8 | * modification, are permitted provided that the following conditions | |
| 9 | * are met: | |
| 10 | * 1. Redistributions of source code must retain the above copyright | |
| 11 | * notice, this list of conditions and the following disclaimer. | |
| 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 13 | * notice, this list of conditions and the following disclaimer in the | |
| 14 | * documentation and/or other materials provided with the distribution. | |
| 15 | * 3. Neither the name of the University nor the names of its contributors | |
| 16 | * may be used to endorse or promote products derived from this software | |
| 17 | * without specific prior written permission. | |
| 18 | * | |
| 19 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | |
| 20 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 21 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
| 22 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
| 23 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
| 24 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
| 25 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
| 26 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
| 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
| 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
| 29 | * SUCH DAMAGE. | |
| 30 | * | |
| 31 | *	@(#)exec.h	8.1 (Berkeley) 6/11/93 | |
| 32 | */ | |
| 33 | ||
| 34 | #ifndef	_MACHINE_EXEC_H_ | |
| 35 | #define	_MACHINE_EXEC_H_ | |
| 36 | ||
| 37 | #define	__LDPGSZ	4096 | |
| 38 | ||
| 39 | #endif /* !_MACHINE_EXEC_H_ */ | |
| \ No newline at end of file |
lib/libc/include/x86_64-freebsd-none/machine/float.h deleted-5| ... | ... | @@ -1,5 +0,0 @@ |
| 1 | /*- | |
| 2 | * This file is in the public domain. | |
| 3 | */ | |
| 4 | ||
| 5 | #include <x86/float.h> | |
| \ No newline at end of file |
lib/libc/include/x86_64-freebsd-none/machine/floatingpoint.h deleted-44| ... | ... | @@ -1,44 +0,0 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-4-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 1993 Andrew Moore, Talke Studio | |
| 5 | * All rights reserved. | |
| 6 | * | |
| 7 | * Redistribution and use in source and binary forms, with or without | |
| 8 | * modification, are permitted provided that the following conditions | |
| 9 | * are met: | |
| 10 | * 1. Redistributions of source code must retain the above copyright | |
| 11 | * notice, this list of conditions and the following disclaimer. | |
| 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 13 | * notice, this list of conditions and the following disclaimer in the | |
| 14 | * documentation and/or other materials provided with the distribution. | |
| 15 | * 3. All advertising materials mentioning features or use of this software | |
| 16 | * must display the following acknowledgement: | |
| 17 | *	This product includes software developed by the University of | |
| 18 | *	California, Berkeley and its contributors. | |
| 19 | * 4. Neither the name of the University nor the names of its contributors | |
| 20 | * may be used to endorse or promote products derived from this software | |
| 21 | * without specific prior written permission. | |
| 22 | * | |
| 23 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | |
| 24 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 25 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
| 26 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
| 27 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
| 28 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
| 29 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
| 30 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
| 31 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
| 32 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
| 33 | * SUCH DAMAGE. | |
| 34 | * | |
| 35 | *	from: @(#) floatingpoint.h	1.0 (Berkeley) 9/23/93 | |
| 36 | */ | |
| 37 | ||
| 38 | #ifndef _FLOATINGPOINT_H_ | |
| 39 | #define _FLOATINGPOINT_H_ | |
| 40 | ||
| 41 | #include <sys/cdefs.h> | |
| 42 | #include <machine/ieeefp.h> | |
| 43 | ||
| 44 | #endif /* !_FLOATINGPOINT_H_ */ | |
| \ No newline at end of file |
lib/libc/include/x86_64-freebsd-none/machine/fpu.h-2| ... | ... | @@ -30,8 +30,6 @@ |
| 30 | 30 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 31 | 31 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 32 | 32 | * SUCH DAMAGE. |
| 33 | * | |
| 34 | *	from: @(#)npx.h	5.3 (Berkeley) 1/18/91 | |
| 35 | 33 | */ |
| 36 | 34 | |
| 37 | 35 | /* |
lib/libc/include/x86_64-freebsd-none/machine/ieeefp.h-2| ... | ... | @@ -32,8 +32,6 @@ |
| 32 | 32 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 33 | 33 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 34 | 34 | * SUCH DAMAGE. |
| 35 | * | |
| 36 | * 	from: @(#) ieeefp.h 	1.0 (Berkeley) 9/23/93 | |
| 37 | 35 | */ |
| 38 | 36 | |
| 39 | 37 | #ifndef _MACHINE_IEEEFP_H_ |
lib/libc/include/x86_64-freebsd-none/machine/md_var.h+5| ... | ... | @@ -50,6 +50,7 @@ extern vm_paddr_t intel_graphics_stolen_base; |
| 50 | 50 | extern vm_paddr_t intel_graphics_stolen_size; |
| 51 | 51 | |
| 52 | 52 | extern int la57; |
| 53 | extern int prefer_uva_la48; | |
| 53 | 54 | |
| 54 | 55 | extern vm_paddr_t kernphys; |
| 55 | 56 | extern vm_paddr_t KERNend; |
| ... | ... | @@ -98,6 +99,10 @@ void	get_fpcontext(struct thread *td, struct __mcontext *mcp, |
| 98 | 99 | int	set_fpcontext(struct thread *td, struct __mcontext *mcp, |
| 99 | 100 | 	 char *xfpustate, size_t xfpustate_len); |
| 100 | 101 | |
| 102 | void	wrmsr_early_safe_start(void); | |
| 103 | void	wrmsr_early_safe_end(void); | |
| 104 | int	wrmsr_early_safe(u_int msr, uint64_t data); | |
| 105 | ||
| 101 | 106 | #endif /* !_MACHINE_MD_VAR_H_ */ |
| 102 | 107 | |
| 103 | 108 | #endif /* __i386__ */ |
| \ No newline at end of file |
lib/libc/include/x86_64-freebsd-none/machine/metadata.h deleted-5| ... | ... | @@ -1,5 +0,0 @@ |
| 1 | /*- | |
| 2 | * This file is in the public domain. | |
| 3 | */ | |
| 4 | ||
| 5 | #include <x86/metadata.h> | |
| \ No newline at end of file |
lib/libc/include/x86_64-freebsd-none/machine/msan.h+1-1| ... | ... | @@ -81,7 +81,7 @@ kmsan_md_unsupported(vm_offset_t addr) |
| 81 | 81 | 	 * The kernel itself isn't shadowed: for most purposes global variables |
| 82 | 82 | 	 * are always initialized, and because KMSAN kernels are large |
| 83 | 83 | 	 * (GENERIC-KMSAN is ~80MB at the time of writing), shadowing would |
| 84 | 	 * incur signficant memory usage. | |
| 84 | 	 * incur significant memory usage. | |
| 85 | 85 | 	 */ |
| 86 | 86 | 	return (addr < VM_MIN_KERNEL_ADDRESS || addr >= KERNBASE); |
| 87 | 87 | } |
lib/libc/include/x86_64-freebsd-none/machine/ofw_machdep.h deleted-5| ... | ... | @@ -1,5 +0,0 @@ |
| 1 | /*- | |
| 2 | * This file is in the public domain. | |
| 3 | */ | |
| 4 | ||
| 5 | #include <x86/ofw_machdep.h> | |
| \ No newline at end of file |
lib/libc/include/x86_64-freebsd-none/machine/param.h+4-17| ... | ... | @@ -36,8 +36,6 @@ |
| 36 | 36 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 37 | 37 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 38 | 38 | * SUCH DAMAGE. |
| 39 | * | |
| 40 | *	@(#)param.h	8.1 (Berkeley) 6/10/93 | |
| 41 | 39 | */ |
| 42 | 40 | |
| 43 | 41 | #ifndef _AMD64_INCLUDE_PARAM_H_ |
| ... | ... | @@ -49,9 +47,6 @@ |
| 49 | 47 | * Machine dependent constants for AMD64. |
| 50 | 48 | */ |
| 51 | 49 | |
| 52 | #define __HAVE_ACPI | |
| 53 | #define __PCI_REROUTE_INTERRUPT | |
| 54 | ||
| 55 | 50 | #ifndef MACHINE |
| 56 | 51 | #define	MACHINE		"amd64" |
| 57 | 52 | #endif |
| ... | ... | @@ -80,7 +75,7 @@ |
| 80 | 75 | * ALIGNED_POINTER is a boolean macro that checks whether an address |
| 81 | 76 | * is valid to fetch data elements of type t from on this architecture. |
| 82 | 77 | * This does not reflect the optimal alignment, just the possibility |
| 83 | * (within reasonable limits). | |
| 78 | * (within reasonable limits). | |
| 84 | 79 | */ |
| 85 | 80 | #define	ALIGNED_POINTER(p, t)	1 |
| 86 | 81 | |
| ... | ... | @@ -144,25 +139,17 @@ |
| 144 | 139 | /* |
| 145 | 140 | * Mach derived conversion macros |
| 146 | 141 | */ |
| 147 | #define	round_page(x)	((((unsigned long)(x)) + PAGE_MASK) & ~(PAGE_MASK)) | |
| 148 | #define	trunc_page(x)	((unsigned long)(x) & ~(PAGE_MASK)) | |
| 149 | 142 | #define trunc_2mpage(x)	((unsigned long)(x) & ~PDRMASK) |
| 150 | 143 | #define round_2mpage(x)	((((unsigned long)(x)) + PDRMASK) & ~PDRMASK) |
| 151 | 144 | #define trunc_1gpage(x)	((unsigned long)(x) & ~PDPMASK) |
| 152 | 145 | |
| 153 | #define	atop(x)		((unsigned long)(x) >> PAGE_SHIFT) | |
| 154 | #define	ptoa(x)		((unsigned long)(x) << PAGE_SHIFT) | |
| 155 | ||
| 156 | 146 | #define	amd64_btop(x)	((unsigned long)(x) >> PAGE_SHIFT) |
| 157 | 147 | #define	amd64_ptob(x)	((unsigned long)(x) << PAGE_SHIFT) |
| 158 | 148 | |
| 159 | #define	pgtok(x)	((unsigned long)(x) * (PAGE_SIZE / 1024)) | |
| 149 | #define	INKERNEL(va)	\ | |
| 150 | (((va) >= kva_layout.dmap_low && (va) < kva_layout.dmap_high) || \ | |
| 151 | ((va) >= kva_layout.km_low && (va) < kva_layout.km_high)) | |
| 160 | 152 | |
| 161 | #define	INKERNEL(va) (((va) >= DMAP_MIN_ADDRESS && (va) < DMAP_MAX_ADDRESS) \ | |
| 162 | || ((va) >= VM_MIN_KERNEL_ADDRESS && (va) < VM_MAX_KERNEL_ADDRESS)) | |
| 163 | ||
| 164 | #ifdef SMP | |
| 165 | 153 | #define SC_TABLESIZE 1024 /* Must be power of 2. */ |
| 166 | #endif | |
| 167 | 154 | |
| 168 | 155 | #endif /* !_AMD64_INCLUDE_PARAM_H_ */ |
| \ No newline at end of file |
lib/libc/include/x86_64-freebsd-none/machine/pcb.h+3-3| ... | ... | @@ -31,8 +31,6 @@ |
| 31 | 31 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 32 | 32 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 33 | 33 | * SUCH DAMAGE. |
| 34 | * | |
| 35 | *	from: @(#)pcb.h	5.10 (Berkeley) 5/12/91 | |
| 36 | 34 | */ |
| 37 | 35 | |
| 38 | 36 | #ifndef _AMD64_PCB_H_ |
| ... | ... | @@ -86,6 +84,7 @@ struct pcb { |
| 86 | 84 | #define	PCB_KERNFPU_THR	0x0020	/* fpu_kern_thread() */ |
| 87 | 85 | #define	PCB_32BIT	0x0040	/* process has 32 bit context (segs etc) */ |
| 88 | 86 | #define	PCB_FPUNOSAVE	0x0080	/* no save area for current FPU ctx */ |
| 87 | #define	PCB_TLSBASE	0x0100	/* tlsbase was set */ | |
| 89 | 88 | |
| 90 | 89 | 	uint16_t	pcb_initial_fpucw; |
| 91 | 90 | |
| ... | ... | @@ -106,7 +105,8 @@ struct pcb { |
| 106 | 105 | |
| 107 | 106 | 	struct savefpu	*pcb_save; |
| 108 | 107 | |
| 109 | 	uint64_t	pcb_pad[5]; | |
| 108 | 	register_t	pcb_tlsbase;	/* not same as pcb_fsbase */ | |
| 109 | 	uint64_t	pcb_pad[4]; | |
| 110 | 110 | }; |
| 111 | 111 | |
| 112 | 112 | /* Per-CPU state saved during suspend and resume. */ |
lib/libc/include/x86_64-freebsd-none/machine/pcpu.h+22-29| ... | ... | @@ -182,16 +182,8 @@ _Static_assert(sizeof(struct monitorbuf) == 128, "2x cache line"); |
| 182 | 182 | /* |
| 183 | 183 | * Evaluates to the address of the per-cpu variable name. |
| 184 | 184 | */ |
| 185 | #define	__PCPU_PTR(name) __extension__ ({				\ | |
| 186 | 	__pcpu_type(name) *__p;						\ | |
| 187 | 									\ | |
| 188 | 	__asm __volatile("movq %%gs:%1,%0; addq %2,%0"			\ | |
| 189 | 	 : "=r" (__p)						\ | |
| 190 | 	 : "m" (*(struct pcpu *)(__pcpu_offset(pc_prvspace))),	\ | |
| 191 | 	 "i" (__pcpu_offset(name)));				\ | |
| 192 | 									\ | |
| 193 | 	__p;								\ | |
| 194 | }) | |
| 185 | #define	__PCPU_PTR(name)						\ | |
| 186 | 	(&get_pcpu()->name) | |
| 195 | 187 | |
| 196 | 188 | /* |
| 197 | 189 | * Evaluates to the value of the per-cpu variable name. |
| ... | ... | @@ -200,14 +192,13 @@ _Static_assert(sizeof(struct monitorbuf) == 128, "2x cache line"); |
| 200 | 192 | 	__pcpu_type(name) __res;					\ |
| 201 | 193 | 	struct __s {							\ |
| 202 | 194 | 		u_char	__b[MIN(sizeof(__pcpu_type(name)), 8)];		\ |
| 203 | 	} __s;								\ | |
| 195 | 	};								\ | |
| 204 | 196 | 									\ |
| 205 | 197 | 	if (sizeof(__res) == 1 || sizeof(__res) == 2 ||			\ |
| 206 | 198 | 	 sizeof(__res) == 4 || sizeof(__res) == 8) {			\ |
| 207 | 		__asm __volatile("mov %%gs:%1,%0"			\ | |
| 208 | 		 : "=r" (__s)					\ | |
| 209 | 		 : "m" (*(struct __s *)(__pcpu_offset(name))));	\ | |
| 210 | 		*(struct __s *)(void *)&__res = __s;			\ | |
| 199 | 		__asm __volatile("mov %%gs:%c1,%0"			\ | |
| 200 | 		 : "=r" (*(struct __s *)(void *)&__res)		\ | |
| 201 | 		 : "i" (__pcpu_offset(name)));			\ | |
| 211 | 202 | 	} else {							\ |
| 212 | 203 | 		__res = *__PCPU_PTR(name);				\ |
| 213 | 204 | 	}								\ |
| ... | ... | @@ -222,15 +213,16 @@ _Static_assert(sizeof(struct monitorbuf) == 128, "2x cache line"); |
| 222 | 213 | 	__pcpu_type(name) __val;					\ |
| 223 | 214 | 	struct __s {							\ |
| 224 | 215 | 		u_char	__b[MIN(sizeof(__pcpu_type(name)), 8)];		\ |
| 225 | 	} __s;								\ | |
| 216 | 	};								\ | |
| 226 | 217 | 									\ |
| 227 | 218 | 	__val = (val);							\ |
| 228 | 219 | 	if (sizeof(__val) == 1 || sizeof(__val) == 2 ||			\ |
| 229 | 220 | 	 sizeof(__val) == 4 || sizeof(__val) == 8) {			\ |
| 230 | 		__s = *(struct __s *)(void *)&__val;			\ | |
| 231 | 		__asm __volatile("add %1,%%gs:%0"			\ | |
| 232 | 		 : "=m" (*(struct __s *)(__pcpu_offset(name)))	\ | |
| 233 | 		 : "r" (__s));					\ | |
| 221 | 		__asm __volatile("add %1,%%gs:%c0"			\ | |
| 222 | 		 :							\ | |
| 223 | 		 : "i" (__pcpu_offset(name)),			\ | |
| 224 | 		 "r" (*(struct __s *)(void *)&__val)		\ | |
| 225 | 		 : "cc", "memory");					\ | |
| 234 | 226 | 	} else								\ |
| 235 | 227 | 		*__PCPU_PTR(name) += __val;				\ |
| 236 | 228 | } while (0) |
| ... | ... | @@ -238,30 +230,31 @@ _Static_assert(sizeof(struct monitorbuf) == 128, "2x cache line"); |
| 238 | 230 | /* |
| 239 | 231 | * Sets the value of the per-cpu variable name to value val. |
| 240 | 232 | */ |
| 241 | #define	__PCPU_SET(name, val) {						\ | |
| 233 | #define	__PCPU_SET(name, val) do {					\ | |
| 242 | 234 | 	__pcpu_type(name) __val;					\ |
| 243 | 235 | 	struct __s {							\ |
| 244 | 236 | 		u_char	__b[MIN(sizeof(__pcpu_type(name)), 8)];		\ |
| 245 | 	} __s;								\ | |
| 237 | 	};								\ | |
| 246 | 238 | 									\ |
| 247 | 239 | 	__val = (val);							\ |
| 248 | 240 | 	if (sizeof(__val) == 1 || sizeof(__val) == 2 ||			\ |
| 249 | 241 | 	 sizeof(__val) == 4 || sizeof(__val) == 8) {			\ |
| 250 | 		__s = *(struct __s *)(void *)&__val;			\ | |
| 251 | 		__asm __volatile("mov %1,%%gs:%0"			\ | |
| 252 | 		 : "=m" (*(struct __s *)(__pcpu_offset(name)))	\ | |
| 253 | 		 : "r" (__s));					\ | |
| 242 | 		__asm __volatile("mov %1,%%gs:%c0"			\ | |
| 243 | 		 :							\ | |
| 244 | 		 : "i" (__pcpu_offset(name)),			\ | |
| 245 | 		 "r" (*(struct __s *)(void *)&__val)		\ | |
| 246 | 		 : "memory");					\ | |
| 254 | 247 | 	} else {							\ |
| 255 | 248 | 		*__PCPU_PTR(name) = __val;				\ |
| 256 | 249 | 	}								\ |
| 257 | } | |
| 250 | } while (0) | |
| 258 | 251 | |
| 259 | 252 | #define	get_pcpu() __extension__ ({					\ |
| 260 | 253 | 	struct pcpu *__pc;						\ |
| 261 | 254 | 									\ |
| 262 | 	__asm __volatile("movq %%gs:%1,%0"				\ | |
| 255 | 	__asm __volatile("movq %%gs:%c1,%0"				\ | |
| 263 | 256 | 	 : "=r" (__pc)						\ |
| 264 | 	 : "m" (*(struct pcpu *)(__pcpu_offset(pc_prvspace))));	\ | |
| 257 | 	 : "i" (__pcpu_offset(pc_prvspace)));			\ | |
| 265 | 258 | 	__pc;								\ |
| 266 | 259 | }) |
| 267 | 260 | #endif /* !__SEG_GS */ |
lib/libc/include/x86_64-freebsd-none/machine/pcpu_aux.h+2-2| ... | ... | @@ -54,8 +54,8 @@ __curthread(void) |
| 54 | 54 | { |
| 55 | 55 | 	struct thread *td; |
| 56 | 56 | |
| 57 | 	__asm("movq %%gs:%P1,%0" : "=r" (td) : "n" (offsetof(struct pcpu, | |
| 58 | 	 pc_curthread))); | |
| 57 | 	__asm("movq %%gs:%c1,%0" : "=r" (td) | |
| 58 | 	 : "i" (offsetof(struct pcpu, pc_curthread))); | |
| 59 | 59 | 	return (td); |
| 60 | 60 | } |
| 61 | 61 | #define	curthread		(__curthread()) |
lib/libc/include/x86_64-freebsd-none/machine/pmap.h+35-73| ... | ... | @@ -38,9 +38,6 @@ |
| 38 | 38 | * map the page tables using the pagetables themselves. This is done to |
| 39 | 39 | * reduce the impact on kernel virtual memory for lots of sparse address |
| 40 | 40 | * space, and to reduce the cost of memory to each process. |
| 41 | * | |
| 42 | *	from: hp300: @(#)pmap.h	7.2 (Berkeley) 12/16/90 | |
| 43 | *	from: @(#)pmap.h	7.4 (Berkeley) 5/12/91 | |
| 44 | 41 | */ |
| 45 | 42 | |
| 46 | 43 | #ifdef __i386__ |
| ... | ... | @@ -50,48 +47,7 @@ |
| 50 | 47 | #ifndef _MACHINE_PMAP_H_ |
| 51 | 48 | #define	_MACHINE_PMAP_H_ |
| 52 | 49 | |
| 53 | /* | |
| 54 | * Page-directory and page-table entries follow this format, with a few | |
| 55 | * of the fields not present here and there, depending on a lot of things. | |
| 56 | */ | |
| 57 | 				/* ---- Intel Nomenclature ---- */ | |
| 58 | #define	X86_PG_V	0x001	/* P	Valid			*/ | |
| 59 | #define	X86_PG_RW	0x002	/* R/W	Read/Write		*/ | |
| 60 | #define	X86_PG_U	0x004	/* U/S User/Supervisor		*/ | |
| 61 | #define	X86_PG_NC_PWT	0x008	/* PWT	Write through		*/ | |
| 62 | #define	X86_PG_NC_PCD	0x010	/* PCD	Cache disable		*/ | |
| 63 | #define	X86_PG_A	0x020	/* A	Accessed		*/ | |
| 64 | #define	X86_PG_M	0x040	/* D	Dirty			*/ | |
| 65 | #define	X86_PG_PS	0x080	/* PS	Page size (0=4k,1=2M)	*/ | |
| 66 | #define	X86_PG_PTE_PAT	0x080	/* PAT	PAT index		*/ | |
| 67 | #define	X86_PG_G	0x100	/* G	Global			*/ | |
| 68 | #define	X86_PG_AVAIL1	0x200	/* /	Available for system	*/ | |
| 69 | #define	X86_PG_AVAIL2	0x400	/* <	programmers use		*/ | |
| 70 | #define	X86_PG_AVAIL3	0x800	/* \				*/ | |
| 71 | #define	X86_PG_PDE_PAT	0x1000	/* PAT	PAT index		*/ | |
| 72 | #define	X86_PG_PKU(idx)	((pt_entry_t)idx << 59) | |
| 73 | #define	X86_PG_NX	(1ul<<63) /* No-execute */ | |
| 74 | #define	X86_PG_AVAIL(x)	(1ul << (x)) | |
| 75 | ||
| 76 | /* Page level cache control fields used to determine the PAT type */ | |
| 77 | #define	X86_PG_PDE_CACHE (X86_PG_PDE_PAT | X86_PG_NC_PWT | X86_PG_NC_PCD) | |
| 78 | #define	X86_PG_PTE_CACHE (X86_PG_PTE_PAT | X86_PG_NC_PWT | X86_PG_NC_PCD) | |
| 79 | ||
| 80 | /* Protection keys indexes */ | |
| 81 | #define	PMAP_MAX_PKRU_IDX	0xf | |
| 82 | #define	X86_PG_PKU_MASK		X86_PG_PKU(PMAP_MAX_PKRU_IDX) | |
| 83 | ||
| 84 | /* | |
| 85 | * Intel extended page table (EPT) bit definitions. | |
| 86 | */ | |
| 87 | #define	EPT_PG_READ		0x001	/* R	Read		*/ | |
| 88 | #define	EPT_PG_WRITE		0x002	/* W	Write		*/ | |
| 89 | #define	EPT_PG_EXECUTE		0x004	/* X	Execute		*/ | |
| 90 | #define	EPT_PG_IGNORE_PAT	0x040	/* IPAT	Ignore PAT	*/ | |
| 91 | #define	EPT_PG_PS		0x080	/* PS	Page size	*/ | |
| 92 | #define	EPT_PG_A		0x100	/* A	Accessed	*/ | |
| 93 | #define	EPT_PG_M		0x200	/* D	Dirty		*/ | |
| 94 | #define	EPT_PG_MEMORY_TYPE(x)	((x) << 3) /* MT Memory Type	*/ | |
| 50 | #include <machine/pte.h> | |
| 95 | 51 | |
| 96 | 52 | /* |
| 97 | 53 | * Define the PG_xx macros in terms of the bits on x86 PTEs. |
| ... | ... | @@ -120,9 +76,6 @@ |
| 120 | 76 | #define	EPT_PG_EMUL_V	X86_PG_AVAIL(52) |
| 121 | 77 | #define	EPT_PG_EMUL_RW	X86_PG_AVAIL(53) |
| 122 | 78 | #define	PG_PROMOTED	X86_PG_AVAIL(54)	/* PDE only */ |
| 123 | #define	PG_FRAME	(0x000ffffffffff000ul) | |
| 124 | #define	PG_PS_FRAME	(0x000fffffffe00000ul) | |
| 125 | #define	PG_PS_PDP_FRAME	(0x000fffffc0000000ul) | |
| 126 | 79 | |
| 127 | 80 | /* |
| 128 | 81 | * Promotion to a 2MB (PDE) page mapping requires that the corresponding 4KB |
| ... | ... | @@ -132,18 +85,6 @@ |
| 132 | 85 | 	 PG_M | PG_U | PG_RW | PG_V | PG_PKU_MASK) |
| 133 | 86 | |
| 134 | 87 | /* |
| 135 | * Page Protection Exception bits | |
| 136 | */ | |
| 137 | ||
| 138 | #define PGEX_P		0x01	/* Protection violation vs. not present */ | |
| 139 | #define PGEX_W		0x02	/* during a Write cycle */ | |
| 140 | #define PGEX_U		0x04	/* access from User mode (UPL) */ | |
| 141 | #define PGEX_RSV	0x08	/* reserved PTE field is non-zero */ | |
| 142 | #define PGEX_I		0x10	/* during an instruction fetch */ | |
| 143 | #define	PGEX_PK		0x20	/* protection key violation */ | |
| 144 | #define	PGEX_SGX	0x8000	/* SGX-related */ | |
| 145 | ||
| 146 | /* | |
| 147 | 88 | * undef the PG_xx macros that define bits in the regular x86 PTEs that |
| 148 | 89 | * have a different position in nested PTEs. This is done when compiling |
| 149 | 90 | * code that needs to be aware of the differences between regular x86 and |
| ... | ... | @@ -169,12 +110,7 @@ |
| 169 | 110 | * Pte related macros. This is complicated by having to deal with |
| 170 | 111 | * the sign extension of the 48th bit. |
| 171 | 112 | */ |
| 172 | #define KV4ADDR(l4, l3, l2, l1) ( \ | |
| 173 | 	((unsigned long)-1 << 47) | \ | |
| 174 | 	((unsigned long)(l4) << PML4SHIFT) | \ | |
| 175 | 	((unsigned long)(l3) << PDPSHIFT) | \ | |
| 176 | 	((unsigned long)(l2) << PDRSHIFT) | \ | |
| 177 | 	((unsigned long)(l1) << PAGE_SHIFT)) | |
| 113 | #define KV4ADDR(l4, l3, l2, l1)		KV5ADDR(-1, l4, l3, l2, l1) | |
| 178 | 114 | #define KV5ADDR(l5, l4, l3, l2, l1) (		\ |
| 179 | 115 | 	((unsigned long)-1 << 56) | \ |
| 180 | 116 | 	((unsigned long)(l5) << PML5SHIFT) | \ |
| ... | ... | @@ -233,11 +169,12 @@ |
| 233 | 169 | * the recursive page table map. |
| 234 | 170 | */ |
| 235 | 171 | #define	NDMPML4E	8 |
| 172 | #define	NDMPML5E	32 | |
| 236 | 173 | |
| 237 | 174 | /* |
| 238 | * These values control the layout of virtual memory. The starting address | |
| 239 | * of the direct map, which is controlled by DMPML4I, must be a multiple of | |
| 240 | * its size. (See the PHYS_TO_DMAP() and DMAP_TO_PHYS() macros.) | |
| 175 | * These values control the layout of virtual memory. The starting | |
| 176 | * address of the direct map is controlled by DMPML4I on LA48 and | |
| 177 | * DMPML5I on LA57. | |
| 241 | 178 | * |
| 242 | 179 | * Note: KPML4I is the index of the (single) level 4 page that maps |
| 243 | 180 | * the KVA that holds KERNBASE, while KPML4BASE is the index of the |
| ... | ... | @@ -255,6 +192,7 @@ |
| 255 | 192 | |
| 256 | 193 | #define	KPML4BASE	(NPML4EPG-NKPML4E) /* KVM at highest addresses */ |
| 257 | 194 | #define	DMPML4I		rounddown(KPML4BASE-NDMPML4E, NDMPML4E) /* Below KVM */ |
| 195 | #define	DMPML5I		(NPML5EPG / 2 + 1) | |
| 258 | 196 | |
| 259 | 197 | #define	KPML4I		(NPML4EPG-1) |
| 260 | 198 | #define	KPDPI		(NPDPEPG-2)	/* kernbase at -2GB */ |
| ... | ... | @@ -264,9 +202,14 @@ |
| 264 | 202 | #define	KMSANSHADPML4I	(KPML4BASE - NKMSANSHADPML4E) |
| 265 | 203 | #define	KMSANORIGPML4I	(DMPML4I - NKMSANORIGPML4E) |
| 266 | 204 | |
| 267 | /* Large map: index of the first and max last pml4 entry */ | |
| 205 | /* | |
| 206 | * Large map: index of the first and max last pml4/la48 and pml5/la57 | |
| 207 | * entry. | |
| 208 | */ | |
| 268 | 209 | #define	LMSPML4I	(PML4PML4I + 1) |
| 269 | 210 | #define	LMEPML4I	(KASANPML4I - 1) |
| 211 | #define	LMSPML5I	(DMPML5I + NDMPML5E) | |
| 212 | #define	LMEPML5I	(LMSPML5I + 32 - 1)	/* 32 slots for large map */ | |
| 270 | 213 | |
| 271 | 214 | /* |
| 272 | 215 | * XXX doesn't really belong here I guess... |
| ... | ... | @@ -448,10 +391,10 @@ void	pmap_activate_boot(pmap_t pmap); |
| 448 | 391 | void	pmap_activate_sw(struct thread *); |
| 449 | 392 | void	pmap_allow_2m_x_ept_recalculate(void); |
| 450 | 393 | void	pmap_bootstrap(vm_paddr_t *); |
| 451 | int	pmap_cache_bits(pmap_t pmap, int mode, boolean_t is_pde); | |
| 394 | int	pmap_cache_bits(pmap_t pmap, int mode, bool is_pde); | |
| 452 | 395 | int	pmap_change_attr(vm_offset_t, vm_size_t, int); |
| 453 | 396 | int	pmap_change_prot(vm_offset_t, vm_size_t, vm_prot_t); |
| 454 | void	pmap_demote_DMAP(vm_paddr_t base, vm_size_t len, boolean_t invalidate); | |
| 397 | void	pmap_demote_DMAP(vm_paddr_t base, vm_size_t len, bool invalidate); | |
| 455 | 398 | void	pmap_flush_cache_range(vm_offset_t, vm_offset_t); |
| 456 | 399 | void	pmap_flush_cache_phys_range(vm_paddr_t, vm_paddr_t, vm_memattr_t); |
| 457 | 400 | void	pmap_init_pat(void); |
| ... | ... | @@ -467,7 +410,7 @@ void	*pmap_mapdev(vm_paddr_t, vm_size_t); |
| 467 | 410 | void	*pmap_mapdev_attr(vm_paddr_t, vm_size_t, int); |
| 468 | 411 | void	*pmap_mapdev_pciecfg(vm_paddr_t pa, vm_size_t size); |
| 469 | 412 | bool	pmap_not_in_di(void); |
| 470 | boolean_t pmap_page_is_mapped(vm_page_t m); | |
| 413 | bool	pmap_page_is_mapped(vm_page_t m); | |
| 471 | 414 | void	pmap_page_set_memattr(vm_page_t m, vm_memattr_t ma); |
| 472 | 415 | void	pmap_page_set_memattr_noflush(vm_page_t m, vm_memattr_t ma); |
| 473 | 416 | void	pmap_pinit_pml4(vm_page_t); |
| ... | ... | @@ -612,6 +555,25 @@ pmap_pml5e_index(vm_offset_t va) |
| 612 | 555 | 	return ((va >> PML5SHIFT) & ((1ul << NPML5EPGSHIFT) - 1)); |
| 613 | 556 | } |
| 614 | 557 | |
| 558 | struct kva_layout_s { | |
| 559 | 	vm_offset_t kva_min; | |
| 560 | 	vm_offset_t kva_max; | |
| 561 | 	vm_offset_t dmap_low;	/* DMAP_MIN_ADDRESS */ | |
| 562 | 	vm_offset_t dmap_high;	/* DMAP_MAX_ADDRESS */ | |
| 563 | 	vm_offset_t lm_low;	/* LARGEMAP_MIN_ADDRESS */ | |
| 564 | 	vm_offset_t lm_high;	/* LARGEMAP_MAX_ADDRESS */ | |
| 565 | 	vm_offset_t km_low;	/* VM_MIN_KERNEL_ADDRESS */ | |
| 566 | 	vm_offset_t km_high;	/* VM_MAX_KERNEL_ADDRESS */ | |
| 567 | 	vm_offset_t rec_pt; | |
| 568 | 	vm_offset_t kasan_shadow_low;	/* KASAN_MIN_ADDRESS */ | |
| 569 | 	vm_offset_t kasan_shadow_high;	/* KASAN_MAX_ADDRESS */ | |
| 570 | 	vm_offset_t kmsan_shadow_low;	/* KMSAN_SHAD_MIN_ADDRESS */ | |
| 571 | 	vm_offset_t kmsan_shadow_high;	/* KMSAN_SHAD_MAX_ADDRESS */ | |
| 572 | 	vm_offset_t kmsan_origin_low;	/* KMSAN_ORIG_MIN_ADDRESS */ | |
| 573 | 	vm_offset_t kmsan_origin_high;	/* KMSAN_ORIG_MAX_ADDRESS */ | |
| 574 | }; | |
| 575 | extern struct kva_layout_s kva_layout; | |
| 576 | ||
| 615 | 577 | #endif /* !LOCORE */ |
| 616 | 578 | |
| 617 | 579 | #endif /* !_MACHINE_PMAP_H_ */ |
lib/libc/include/x86_64-freebsd-none/machine/proc.h-2| ... | ... | @@ -27,8 +27,6 @@ |
| 27 | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | * | |
| 31 | *	from: @(#)proc.h	7.1 (Berkeley) 5/15/91 | |
| 32 | 30 | */ |
| 33 | 31 | |
| 34 | 32 | #ifdef __i386__ |
lib/libc/include/x86_64-freebsd-none/machine/profile.h-2| ... | ... | @@ -27,8 +27,6 @@ |
| 27 | 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 28 | 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 29 | 29 | * SUCH DAMAGE. |
| 30 | * | |
| 31 | *	@(#)profile.h	8.1 (Berkeley) 6/11/93 | |
| 32 | 30 | */ |
| 33 | 31 | |
| 34 | 32 | #ifdef __i386__ |
lib/libc/include/x86_64-freebsd-none/machine/psl.h deleted-5| ... | ... | @@ -1,5 +0,0 @@ |
| 1 | /*- | |
| 2 | * This file is in the public domain. | |
| 3 | */ | |
| 4 | ||
| 5 | #include <x86/psl.h> | |
| \ No newline at end of file |
lib/libc/include/x86_64-freebsd-none/machine/pte.h created+104| ... | ... | @@ -0,0 +1,104 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-3-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 2003 Peter Wemm. | |
| 5 | * Copyright (c) 1991 Regents of the University of California. | |
| 6 | * All rights reserved. | |
| 7 | * | |
| 8 | * This code is derived from software contributed to Berkeley by | |
| 9 | * the Systems Programming Group of the University of Utah Computer | |
| 10 | * Science Department and William Jolitz of UUNET Technologies Inc. | |
| 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 | * 3. Neither the name of the University nor the names of its contributors | |
| 21 | * may be used to endorse or promote products derived from this software | |
| 22 | * without specific prior written permission. | |
| 23 | * | |
| 24 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | |
| 25 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
| 27 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
| 28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
| 29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
| 30 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
| 31 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
| 32 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
| 33 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
| 34 | * SUCH DAMAGE. | |
| 35 | * | |
| 36 | * Derived from hp300 version by Mike Hibler, this version by William | |
| 37 | * Jolitz uses a recursive map [a pde points to the page directory] to | |
| 38 | * map the page tables using the pagetables themselves. This is done to | |
| 39 | * reduce the impact on kernel virtual memory for lots of sparse address | |
| 40 | * space, and to reduce the cost of memory to each process. | |
| 41 | */ | |
| 42 | ||
| 43 | #ifndef _MACHINE_PTE_H_ | |
| 44 | #define	_MACHINE_PTE_H_ | |
| 45 | ||
| 46 | /* | |
| 47 | * Page-directory and page-table entries follow this format, with a few | |
| 48 | * of the fields not present here and there, depending on a lot of things. | |
| 49 | */ | |
| 50 | 				/* ---- Intel Nomenclature ---- */ | |
| 51 | #define	X86_PG_V	0x001	/* P	Valid			*/ | |
| 52 | #define	X86_PG_RW	0x002	/* R/W	Read/Write		*/ | |
| 53 | #define	X86_PG_U	0x004	/* U/S User/Supervisor		*/ | |
| 54 | #define	X86_PG_NC_PWT	0x008	/* PWT	Write through		*/ | |
| 55 | #define	X86_PG_NC_PCD	0x010	/* PCD	Cache disable		*/ | |
| 56 | #define	X86_PG_A	0x020	/* A	Accessed		*/ | |
| 57 | #define	X86_PG_M	0x040	/* D	Dirty			*/ | |
| 58 | #define	X86_PG_PS	0x080	/* PS	Page size (0=4k,1=2M)	*/ | |
| 59 | #define	X86_PG_PTE_PAT	0x080	/* PAT	PAT index		*/ | |
| 60 | #define	X86_PG_G	0x100	/* G	Global			*/ | |
| 61 | #define	X86_PG_AVAIL1	0x200	/* /	Available for system	*/ | |
| 62 | #define	X86_PG_AVAIL2	0x400	/* <	programmers use		*/ | |
| 63 | #define	X86_PG_AVAIL3	0x800	/* \				*/ | |
| 64 | #define	X86_PG_PDE_PAT	0x1000	/* PAT	PAT index		*/ | |
| 65 | #define	X86_PG_PKU(idx)	((pt_entry_t)idx << 59) | |
| 66 | #define	X86_PG_NX	(1ul<<63) /* No-execute */ | |
| 67 | #define	X86_PG_AVAIL(x)	(1ul << (x)) | |
| 68 | ||
| 69 | /* Page level cache control fields used to determine the PAT type */ | |
| 70 | #define	X86_PG_PDE_CACHE (X86_PG_PDE_PAT | X86_PG_NC_PWT | X86_PG_NC_PCD) | |
| 71 | #define	X86_PG_PTE_CACHE (X86_PG_PTE_PAT | X86_PG_NC_PWT | X86_PG_NC_PCD) | |
| 72 | ||
| 73 | /* Protection keys indexes */ | |
| 74 | #define	PMAP_MAX_PKRU_IDX	0xf | |
| 75 | #define	X86_PG_PKU_MASK		X86_PG_PKU(PMAP_MAX_PKRU_IDX) | |
| 76 | ||
| 77 | /* | |
| 78 | * Intel extended page table (EPT) bit definitions. | |
| 79 | */ | |
| 80 | #define	EPT_PG_READ		0x001	/* R	Read		*/ | |
| 81 | #define	EPT_PG_WRITE		0x002	/* W	Write		*/ | |
| 82 | #define	EPT_PG_EXECUTE		0x004	/* X	Execute		*/ | |
| 83 | #define	EPT_PG_IGNORE_PAT	0x040	/* IPAT	Ignore PAT	*/ | |
| 84 | #define	EPT_PG_PS		0x080	/* PS	Page size	*/ | |
| 85 | #define	EPT_PG_A		0x100	/* A	Accessed	*/ | |
| 86 | #define	EPT_PG_M		0x200	/* D	Dirty		*/ | |
| 87 | #define	EPT_PG_MEMORY_TYPE(x)	((x) << 3) /* MT Memory Type	*/ | |
| 88 | ||
| 89 | #define	PG_FRAME	(0x000ffffffffff000ul) | |
| 90 | #define	PG_PS_FRAME	(0x000fffffffe00000ul) | |
| 91 | #define	PG_PS_PDP_FRAME	(0x000fffffc0000000ul) | |
| 92 | ||
| 93 | /* | |
| 94 | * Page Protection Exception bits | |
| 95 | */ | |
| 96 | #define PGEX_P		0x01	/* Protection violation vs. not present */ | |
| 97 | #define PGEX_W		0x02	/* during a Write cycle */ | |
| 98 | #define PGEX_U		0x04	/* access from User mode (UPL) */ | |
| 99 | #define PGEX_RSV	0x08	/* reserved PTE field is non-zero */ | |
| 100 | #define PGEX_I		0x10	/* during an instruction fetch */ | |
| 101 | #define	PGEX_PK		0x20	/* protection key violation */ | |
| 102 | #define	PGEX_SGX	0x8000	/* SGX-related */ | |
| 103 | ||
| 104 | #endif | |
| \ No newline at end of file |
lib/libc/include/x86_64-freebsd-none/machine/ptrace.h deleted-5| ... | ... | @@ -1,5 +0,0 @@ |
| 1 | /*- | |
| 2 | * This file is in the public domain. | |
| 3 | */ | |
| 4 | ||
| 5 | #include <x86/ptrace.h> | |
| \ No newline at end of file |
lib/libc/include/x86_64-freebsd-none/machine/reg.h deleted-5| ... | ... | @@ -1,5 +0,0 @@ |
| 1 | /*- | |
| 2 | * This file is in the public domain. | |
| 3 | */ | |
| 4 | ||
| 5 | #include <x86/reg.h> | |
| \ No newline at end of file |
lib/libc/include/x86_64-freebsd-none/machine/reloc.h deleted-50| ... | ... | @@ -1,50 +0,0 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-3-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 1992, 1993 | |
| 5 | *	The Regents of the University of California. All rights reserved. | |
| 6 | * | |
| 7 | * Redistribution and use in source and binary forms, with or without | |
| 8 | * modification, are permitted provided that the following conditions | |
| 9 | * are met: | |
| 10 | * 1. Redistributions of source code must retain the above copyright | |
| 11 | * notice, this list of conditions and the following disclaimer. | |
| 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 13 | * notice, this list of conditions and the following disclaimer in the | |
| 14 | * documentation and/or other materials provided with the distribution. | |
| 15 | * 3. Neither the name of the University nor the names of its contributors | |
| 16 | * may be used to endorse or promote products derived from this software | |
| 17 | * without specific prior written permission. | |
| 18 | * | |
| 19 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | |
| 20 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 21 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
| 22 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | |
| 23 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
| 24 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
| 25 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
| 26 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
| 27 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
| 28 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
| 29 | * SUCH DAMAGE. | |
| 30 | * | |
| 31 | *	@(#)reloc.h	8.1 (Berkeley) 6/10/93 | |
| 32 | */ | |
| 33 | ||
| 34 | #ifndef _I386_MACHINE_RELOC_H_ | |
| 35 | #define _I386_MACHINE_RELOC_H_ | |
| 36 | ||
| 37 | /* Relocation format. */ | |
| 38 | struct relocation_info { | |
| 39 | 	int r_address;			 /* offset in text or data segment */ | |
| 40 | 	unsigned int r_symbolnum : 24, /* ordinal number of add symbol */ | |
| 41 | 			 r_pcrel : 1, /* 1 if value should be pc-relative */ | |
| 42 | 			 r_length : 2, /* log base 2 of value's width */ | |
| 43 | 			 r_extern : 1, /* 1 if need to add symbol to value */ | |
| 44 | 			 r_baserel : 1, /* linkage table relative */ | |
| 45 | 			r_jmptable : 1, /* relocate to jump table */ | |
| 46 | 			r_relative : 1, /* load address relative */ | |
| 47 | 			 r_copy : 1; /* run time copy */ | |
| 48 | }; | |
| 49 | ||
| 50 | #endif | |
| \ No newline at end of file |
lib/libc/include/x86_64-freebsd-none/machine/resource.h+1-3| ... | ... | @@ -12,7 +12,7 @@ |
| 12 | 12 | * no representations about the suitability of this software for any |
| 13 | 13 | * purpose. It is provided "as is" without express or implied |
| 14 | 14 | * warranty. |
| 15 | * | |
| 15 | * | |
| 16 | 16 | * THIS SOFTWARE IS PROVIDED BY M.I.T. ``AS IS''. M.I.T. DISCLAIMS |
| 17 | 17 | * ALL EXPRESS OR IMPLIED WARRANTIES WITH REGARD TO THIS SOFTWARE, |
| 18 | 18 | * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
| ... | ... | @@ -39,8 +39,6 @@ |
| 39 | 39 | #define	SYS_RES_DRQ	2	/* isa dma lines */ |
| 40 | 40 | #define	SYS_RES_MEMORY	3	/* i/o memory */ |
| 41 | 41 | #define	SYS_RES_IOPORT	4	/* i/o ports */ |
| 42 | #ifdef NEW_PCIB | |
| 43 | 42 | #define	PCI_RES_BUS	5	/* PCI bus numbers */ |
| 44 | #endif | |
| 45 | 43 | |
| 46 | 44 | #endif /* !_MACHINE_RESOURCE_H_ */ |
| \ No newline at end of file |
lib/libc/include/x86_64-freebsd-none/machine/runq.h deleted-46| ... | ... | @@ -1,46 +0,0 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-2-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 2001 Jake Burkholder <jake@FreeBSD.org> | |
| 5 | * All rights reserved. | |
| 6 | * | |
| 7 | * Redistribution and use in source and binary forms, with or without | |
| 8 | * modification, are permitted provided that the following conditions | |
| 9 | * are met: | |
| 10 | * 1. Redistributions of source code must retain the above copyright | |
| 11 | * notice, this list of conditions and the following disclaimer. | |
| 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 13 | * notice, this list of conditions and the following disclaimer in the | |
| 14 | * documentation and/or other materials provided with the distribution. | |
| 15 | * | |
| 16 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |
| 17 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
| 19 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | |
| 20 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
| 21 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
| 22 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
| 23 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
| 24 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
| 25 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
| 26 | * SUCH DAMAGE. | |
| 27 | */ | |
| 28 | ||
| 29 | #ifndef	_MACHINE_RUNQ_H_ | |
| 30 | #define	_MACHINE_RUNQ_H_ | |
| 31 | ||
| 32 | #define	RQB_LEN		(1)		/* Number of priority status words. */ | |
| 33 | #define	RQB_L2BPW	(6)		/* Log2(sizeof(rqb_word_t) * NBBY)). */ | |
| 34 | #define	RQB_BPW		(1<<RQB_L2BPW)	/* Bits in an rqb_word_t. */ | |
| 35 | ||
| 36 | #define	RQB_BIT(pri)	(1ul << ((pri) & (RQB_BPW - 1))) | |
| 37 | #define	RQB_WORD(pri)	((pri) >> RQB_L2BPW) | |
| 38 | ||
| 39 | #define	RQB_FFS(word)	(bsfq(word)) | |
| 40 | ||
| 41 | /* | |
| 42 | * Type of run queue status word. | |
| 43 | */ | |
| 44 | typedef	u_int64_t	rqb_word_t; | |
| 45 | ||
| 46 | #endif | |
| \ No newline at end of file |
lib/libc/include/x86_64-freebsd-none/machine/sdt_machdep.h created+12| ... | ... | @@ -0,0 +1,12 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-2-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 2024 Mark Johnston <markj@FreeBSD.org> | |
| 5 | */ | |
| 6 | ||
| 7 | #ifndef _SYS_SDT_MACHDEP_H_ | |
| 8 | #define	_SYS_SDT_MACHDEP_H_ | |
| 9 | ||
| 10 | #define	_SDT_ASM_PATCH_INSTR	"nopw 0(%%rax,%%rax,1)" | |
| 11 | ||
| 12 | #endif | |
| \ No newline at end of file |
lib/libc/include/x86_64-freebsd-none/machine/segments.h-2| ... | ... | @@ -31,8 +31,6 @@ |
| 31 | 31 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 32 | 32 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 33 | 33 | * SUCH DAMAGE. |
| 34 | * | |
| 35 | *	from: @(#)segments.h	7.1 (Berkeley) 5/9/91 | |
| 36 | 34 | */ |
| 37 | 35 | |
| 38 | 36 | #ifdef __i386__ |
lib/libc/include/x86_64-freebsd-none/machine/setjmp.h deleted-5| ... | ... | @@ -1,5 +0,0 @@ |
| 1 | /*- | |
| 2 | * This file is in the public domain. | |
| 3 | */ | |
| 4 | ||
| 5 | #include <x86/setjmp.h> | |
| \ No newline at end of file |
lib/libc/include/x86_64-freebsd-none/machine/sf_buf.h+1-1| ... | ... | @@ -34,7 +34,7 @@ |
| 34 | 34 | * On this machine, the only purpose for which sf_buf is used is to implement |
| 35 | 35 | * an opaque pointer required by the machine-independent parts of the kernel. |
| 36 | 36 | * That pointer references the vm_page that is "mapped" by the sf_buf. The |
| 37 | * actual mapping is provided by the direct virtual-to-physical mapping. | |
| 37 | * actual mapping is provided by the direct virtual-to-physical mapping. | |
| 38 | 38 | */ |
| 39 | 39 | static inline vm_offset_t |
| 40 | 40 | sf_buf_kva(struct sf_buf *sf) |
lib/libc/include/x86_64-freebsd-none/machine/smp.h-3| ... | ... | @@ -13,8 +13,6 @@ |
| 13 | 13 | |
| 14 | 14 | #ifdef _KERNEL |
| 15 | 15 | |
| 16 | #ifdef SMP | |
| 17 | ||
| 18 | 16 | #ifndef LOCORE |
| 19 | 17 | |
| 20 | 18 | #include <x86/x86_smp.h> |
| ... | ... | @@ -39,7 +37,6 @@ void	invlop_handler(void); |
| 39 | 37 | int	start_all_aps(void); |
| 40 | 38 | |
| 41 | 39 | #endif /* !LOCORE */ |
| 42 | #endif /* SMP */ | |
| 43 | 40 | |
| 44 | 41 | #endif /* _KERNEL */ |
| 45 | 42 | #endif /* _MACHINE_SMP_H_ */ |
| \ No newline at end of file |
lib/libc/include/x86_64-freebsd-none/machine/sysarch.h deleted-5| ... | ... | @@ -1,5 +0,0 @@ |
| 1 | /*- | |
| 2 | * This file is in the public domain. | |
| 3 | */ | |
| 4 | ||
| 5 | #include <x86/sysarch.h> | |
| \ No newline at end of file |
lib/libc/include/x86_64-freebsd-none/machine/tls.h deleted-5| ... | ... | @@ -1,5 +0,0 @@ |
| 1 | /*- | |
| 2 | * This file is in the public domain. | |
| 3 | */ | |
| 4 | ||
| 5 | #include <x86/tls.h> | |
| \ No newline at end of file |
lib/libc/include/x86_64-freebsd-none/machine/trap.h deleted-5| ... | ... | @@ -1,5 +0,0 @@ |
| 1 | /*- | |
| 2 | * This file is in the public domain. | |
| 3 | */ | |
| 4 | ||
| 5 | #include <x86/trap.h> | |
| \ No newline at end of file |
lib/libc/include/x86_64-freebsd-none/machine/tss.h-2| ... | ... | @@ -30,8 +30,6 @@ |
| 30 | 30 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 31 | 31 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 32 | 32 | * SUCH DAMAGE. |
| 33 | * | |
| 34 | *	from: @(#)tss.h	5.4 (Berkeley) 1/18/91 | |
| 35 | 33 | */ |
| 36 | 34 | |
| 37 | 35 | #ifndef _MACHINE_TSS_H_ |
lib/libc/include/x86_64-freebsd-none/machine/vdso.h deleted-5| ... | ... | @@ -1,5 +0,0 @@ |
| 1 | /*- | |
| 2 | * This file is in the public domain. | |
| 3 | */ | |
| 4 | ||
| 5 | #include <x86/vdso.h> | |
| \ No newline at end of file |
lib/libc/include/x86_64-freebsd-none/machine/vm.h deleted-46| ... | ... | @@ -1,46 +0,0 @@ |
| 1 | /*- | |
| 2 | * SPDX-License-Identifier: BSD-2-Clause | |
| 3 | * | |
| 4 | * Copyright (c) 2009 Hudson River Trading LLC | |
| 5 | * Written by: John H. Baldwin <jhb@FreeBSD.org> | |
| 6 | * All rights reserved. | |
| 7 | * | |
| 8 | * Redistribution and use in source and binary forms, with or without | |
| 9 | * modification, are permitted provided that the following conditions | |
| 10 | * are met: | |
| 11 | * 1. Redistributions of source code must retain the above copyright | |
| 12 | * notice, this list of conditions and the following disclaimer. | |
| 13 | * 2. Redistributions in binary form must reproduce the above copyright | |
| 14 | * notice, this list of conditions and the following disclaimer in the | |
| 15 | * documentation and/or other materials provided with the distribution. | |
| 16 | * | |
| 17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND | |
| 18 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | |
| 19 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | |
| 20 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE | |
| 21 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
| 22 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | |
| 23 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
| 24 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
| 25 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
| 26 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
| 27 | * SUCH DAMAGE. | |
| 28 | */ | |
| 29 | ||
| 30 | #ifndef _MACHINE_VM_H_ | |
| 31 | #define	_MACHINE_VM_H_ | |
| 32 | ||
| 33 | #include <machine/specialreg.h> | |
| 34 | ||
| 35 | /* Memory attributes. */ | |
| 36 | #define	VM_MEMATTR_UNCACHEABLE		((vm_memattr_t)PAT_UNCACHEABLE) | |
| 37 | #define	VM_MEMATTR_WRITE_COMBINING	((vm_memattr_t)PAT_WRITE_COMBINING) | |
| 38 | #define	VM_MEMATTR_WRITE_THROUGH	((vm_memattr_t)PAT_WRITE_THROUGH) | |
| 39 | #define	VM_MEMATTR_WRITE_PROTECTED	((vm_memattr_t)PAT_WRITE_PROTECTED) | |
| 40 | #define	VM_MEMATTR_WRITE_BACK		((vm_memattr_t)PAT_WRITE_BACK) | |
| 41 | #define	VM_MEMATTR_WEAK_UNCACHEABLE	((vm_memattr_t)PAT_UNCACHED) | |
| 42 | ||
| 43 | #define	VM_MEMATTR_DEFAULT		VM_MEMATTR_WRITE_BACK | |
| 44 | #define	VM_MEMATTR_DEVICE		VM_MEMATTR_UNCACHEABLE | |
| 45 | ||
| 46 | #endif /* !_MACHINE_VM_H_ */ | |
| \ No newline at end of file |
lib/libc/include/x86_64-freebsd-none/machine/vmm.h+11-32| ... | ... | @@ -46,6 +46,7 @@ enum vm_suspend_how { |
| 46 | 46 | 	VM_SUSPEND_POWEROFF, |
| 47 | 47 | 	VM_SUSPEND_HALT, |
| 48 | 48 | 	VM_SUSPEND_TRIPLEFAULT, |
| 49 | 	VM_SUSPEND_DESTROY, | |
| 49 | 50 | 	VM_SUSPEND_LAST |
| 50 | 51 | }; |
| 51 | 52 | |
| ... | ... | @@ -124,7 +125,7 @@ enum x2apic_state { |
| 124 | 125 | /* |
| 125 | 126 | * The VM name has to fit into the pathname length constraints of devfs, |
| 126 | 127 | * governed primarily by SPECNAMELEN. The length is the total number of |
| 127 | * characters in the full path, relative to the mount point and not | |
| 128 | * characters in the full path, relative to the mount point and not | |
| 128 | 129 | * including any leading '/' characters. |
| 129 | 130 | * A prefix and a suffix are added to the name specified by the user. |
| 130 | 131 | * The prefix is usually "vmm/" or "vmm.io/", but can be a few characters |
| ... | ... | @@ -150,6 +151,7 @@ CTASSERT(VM_MAX_NAMELEN >= VM_MIN_NAMELEN); |
| 150 | 151 | |
| 151 | 152 | struct vm; |
| 152 | 153 | struct vm_exception; |
| 154 | struct vm_mem; | |
| 153 | 155 | struct seg_desc; |
| 154 | 156 | struct vm_exit; |
| 155 | 157 | struct vm_run; |
| ... | ... | @@ -170,6 +172,7 @@ struct vm_eventinfo { |
| 170 | 172 | |
| 171 | 173 | typedef int	(*vmm_init_func_t)(int ipinum); |
| 172 | 174 | typedef int	(*vmm_cleanup_func_t)(void); |
| 175 | typedef void	(*vmm_suspend_func_t)(void); | |
| 173 | 176 | typedef void	(*vmm_resume_func_t)(void); |
| 174 | 177 | typedef void *	(*vmi_init_func_t)(struct vm *vm, struct pmap *pmap); |
| 175 | 178 | typedef int	(*vmi_run_func_t)(void *vcpui, register_t rip, |
| ... | ... | @@ -194,6 +197,7 @@ typedef int	(*vmi_restore_tsc_t)(void *vcpui, uint64_t now); |
| 194 | 197 | struct vmm_ops { |
| 195 | 198 | 	vmm_init_func_t		modinit;	/* module wide initialization */ |
| 196 | 199 | 	vmm_cleanup_func_t	modcleanup; |
| 200 | 	vmm_resume_func_t	modsuspend; | |
| 197 | 201 | 	vmm_resume_func_t	modresume; |
| 198 | 202 | |
| 199 | 203 | 	vmi_init_func_t		init;		/* vm-specific initialization */ |
| ... | ... | @@ -236,39 +240,11 @@ void vm_get_topology(struct vm *vm, uint16_t *sockets, uint16_t *cores, |
| 236 | 240 | int vm_set_topology(struct vm *vm, uint16_t sockets, uint16_t cores, |
| 237 | 241 | uint16_t threads, uint16_t maxcpus); |
| 238 | 242 | |
| 239 | /* | |
| 240 | * APIs that modify the guest memory map require all vcpus to be frozen. | |
| 241 | */ | |
| 242 | void vm_slock_memsegs(struct vm *vm); | |
| 243 | void vm_xlock_memsegs(struct vm *vm); | |
| 244 | void vm_unlock_memsegs(struct vm *vm); | |
| 245 | int vm_mmap_memseg(struct vm *vm, vm_paddr_t gpa, int segid, vm_ooffset_t off, | |
| 246 | size_t len, int prot, int flags); | |
| 247 | int vm_munmap_memseg(struct vm *vm, vm_paddr_t gpa, size_t len); | |
| 248 | int vm_alloc_memseg(struct vm *vm, int ident, size_t len, bool sysmem); | |
| 249 | void vm_free_memseg(struct vm *vm, int ident); | |
| 250 | 243 | int vm_map_mmio(struct vm *vm, vm_paddr_t gpa, size_t len, vm_paddr_t hpa); |
| 251 | 244 | int vm_unmap_mmio(struct vm *vm, vm_paddr_t gpa, size_t len); |
| 252 | 245 | int vm_assign_pptdev(struct vm *vm, int bus, int slot, int func); |
| 253 | 246 | int vm_unassign_pptdev(struct vm *vm, int bus, int slot, int func); |
| 254 | 247 | |
| 255 | /* | |
| 256 | * APIs that inspect the guest memory map require only a *single* vcpu to | |
| 257 | * be frozen. This acts like a read lock on the guest memory map since any | |
| 258 | * modification requires *all* vcpus to be frozen. | |
| 259 | */ | |
| 260 | int vm_mmap_getnext(struct vm *vm, vm_paddr_t *gpa, int *segid, | |
| 261 | vm_ooffset_t *segoff, size_t *len, int *prot, int *flags); | |
| 262 | int vm_get_memseg(struct vm *vm, int ident, size_t *len, bool *sysmem, | |
| 263 | struct vm_object **objptr); | |
| 264 | vm_paddr_t vmm_sysmem_maxaddr(struct vm *vm); | |
| 265 | void *vm_gpa_hold(struct vcpu *vcpu, vm_paddr_t gpa, size_t len, | |
| 266 | int prot, void **cookie); | |
| 267 | void *vm_gpa_hold_global(struct vm *vm, vm_paddr_t gpa, size_t len, | |
| 268 | int prot, void **cookie); | |
| 269 | void vm_gpa_release(void *cookie); | |
| 270 | bool vm_mem_allocated(struct vcpu *vcpu, vm_paddr_t gpa); | |
| 271 | ||
| 272 | 248 | int vm_get_register(struct vcpu *vcpu, int reg, uint64_t *retval); |
| 273 | 249 | int vm_set_register(struct vcpu *vcpu, int reg, uint64_t val); |
| 274 | 250 | int vm_get_seg_desc(struct vcpu *vcpu, int reg, |
| ... | ... | @@ -399,7 +375,8 @@ vcpu_should_yield(struct vcpu *vcpu) |
| 399 | 375 | |
| 400 | 376 | void *vcpu_stats(struct vcpu *vcpu); |
| 401 | 377 | void vcpu_notify_event(struct vcpu *vcpu, bool lapic_intr); |
| 402 | struct vmspace *vm_get_vmspace(struct vm *vm); | |
| 378 | struct vmspace *vm_vmspace(struct vm *vm); | |
| 379 | struct vm_mem *vm_mem(struct vm *vm); | |
| 403 | 380 | struct vatpic *vm_atpic(struct vm *vm); |
| 404 | 381 | struct vatpit *vm_atpit(struct vm *vm); |
| 405 | 382 | struct vpmtmr *vm_pmtmr(struct vm *vm); |
| ... | ... | @@ -448,7 +425,7 @@ int vm_get_intinfo(struct vcpu *vcpu, uint64_t *info1, uint64_t *info2); |
| 448 | 425 | |
| 449 | 426 | /* |
| 450 | 427 | * Function used to keep track of the guest's TSC offset. The |
| 451 | * offset is used by the virutalization extensions to provide a consistent | |
| 428 | * offset is used by the virtualization extensions to provide a consistent | |
| 452 | 429 | * value for the Time Stamp Counter to the guest. |
| 453 | 430 | */ |
| 454 | 431 | void vm_set_tsc_offset(struct vcpu *vcpu, uint64_t offset); |
| ... | ... | @@ -465,7 +442,7 @@ struct vm_copyinfo { |
| 465 | 442 | /* |
| 466 | 443 | * Set up 'copyinfo[]' to copy to/from guest linear address space starting |
| 467 | 444 | * at 'gla' and 'len' bytes long. The 'prot' should be set to PROT_READ for |
| 468 | * a copyin or PROT_WRITE for a copyout. | |
| 445 | * a copyin or PROT_WRITE for a copyout. | |
| 469 | 446 | * |
| 470 | 447 | * retval	is_fault	Interpretation |
| 471 | 448 | * 0		 0		Success |
| ... | ... | @@ -673,6 +650,8 @@ struct vm_inout_str { |
| 673 | 650 | 	int		addrsize; |
| 674 | 651 | 	enum vm_reg_name seg_name; |
| 675 | 652 | 	struct seg_desc seg_desc; |
| 653 | 	int		cs_d; | |
| 654 | 	uint64_t	cs_base; | |
| 676 | 655 | }; |
| 677 | 656 | |
| 678 | 657 | enum task_switch_reason { |
lib/libc/include/x86_64-freebsd-none/machine/vmm_dev.h+8-18| ... | ... | @@ -29,12 +29,10 @@ |
| 29 | 29 | #ifndef	_VMM_DEV_H_ |
| 30 | 30 | #define	_VMM_DEV_H_ |
| 31 | 31 | |
| 32 | struct vm_snapshot_meta; | |
| 32 | #include <sys/domainset.h> | |
| 33 | 33 | |
| 34 | #ifdef _KERNEL | |
| 35 | void	vmmdev_init(void); | |
| 36 | int	vmmdev_cleanup(void); | |
| 37 | #endif | |
| 34 | #include <machine/vmm.h> | |
| 35 | #include <machine/vmm_snapshot.h> | |
| 38 | 36 | |
| 39 | 37 | struct vm_memmap { |
| 40 | 38 | 	vm_paddr_t	gpa; |
| ... | ... | @@ -56,16 +54,12 @@ struct vm_munmap { |
| 56 | 54 | struct vm_memseg { |
| 57 | 55 | 	int		segid; |
| 58 | 56 | 	size_t		len; |
| 59 | 	char		name[VM_MAX_SUFFIXLEN + 1]; | |
| 57 | 	char 		name[VM_MAX_SUFFIXLEN + 1]; | |
| 58 | 	domainset_t	*ds_mask; | |
| 59 | 	size_t		ds_mask_size; | |
| 60 | 	int 		ds_policy; | |
| 60 | 61 | }; |
| 61 | 62 | |
| 62 | struct vm_memseg_fbsd12 { | |
| 63 | 	int		segid; | |
| 64 | 	size_t		len; | |
| 65 | 	char		name[64]; | |
| 66 | }; | |
| 67 | _Static_assert(sizeof(struct vm_memseg_fbsd12) == 80, "COMPAT_FREEBSD12 ABI"); | |
| 68 | ||
| 69 | 63 | struct vm_register { |
| 70 | 64 | 	int		cpuid; |
| 71 | 65 | 	int		regnum;		/* enum vm_reg_name */ |
| ... | ... | @@ -312,7 +306,7 @@ enum { |
| 312 | 306 | 	IOCNUM_UNMAP_PPTDEV_MMIO = 46, |
| 313 | 307 | |
| 314 | 308 | 	/* statistics */ |
| 315 | 	IOCNUM_VM_STATS = 50, | |
| 309 | 	IOCNUM_VM_STATS = 50, | |
| 316 | 310 | 	IOCNUM_VM_STAT_DESC = 51, |
| 317 | 311 | |
| 318 | 312 | 	/* kernel device state */ |
| ... | ... | @@ -354,12 +348,8 @@ enum { |
| 354 | 348 | 	_IOW('v', IOCNUM_SUSPEND, struct vm_suspend) |
| 355 | 349 | #define	VM_REINIT	\ |
| 356 | 350 | 	_IO('v', IOCNUM_REINIT) |
| 357 | #define	VM_ALLOC_MEMSEG_FBSD12	\ | |
| 358 | 	_IOW('v', IOCNUM_ALLOC_MEMSEG, struct vm_memseg_fbsd12) | |
| 359 | 351 | #define	VM_ALLOC_MEMSEG	\ |
| 360 | 352 | 	_IOW('v', IOCNUM_ALLOC_MEMSEG, struct vm_memseg) |
| 361 | #define	VM_GET_MEMSEG_FBSD12	\ | |
| 362 | 	_IOWR('v', IOCNUM_GET_MEMSEG, struct vm_memseg_fbsd12) | |
| 363 | 353 | #define	VM_GET_MEMSEG	\ |
| 364 | 354 | 	_IOWR('v', IOCNUM_GET_MEMSEG, struct vm_memseg) |
| 365 | 355 | #define	VM_MMAP_MEMSEG	\ |
lib/libc/include/x86_64-freebsd-none/machine/vmm_instruction_emul.h+26-1| ... | ... | @@ -31,6 +31,31 @@ |
| 31 | 31 | |
| 32 | 32 | #include <sys/mman.h> |
| 33 | 33 | |
| 34 | /* struct vie_op.op_type */ | |
| 35 | enum { | |
| 36 | 	VIE_OP_TYPE_NONE = 0, | |
| 37 | 	VIE_OP_TYPE_MOV, | |
| 38 | 	VIE_OP_TYPE_MOVSX, | |
| 39 | 	VIE_OP_TYPE_MOVZX, | |
| 40 | 	VIE_OP_TYPE_AND, | |
| 41 | 	VIE_OP_TYPE_OR, | |
| 42 | 	VIE_OP_TYPE_SUB, | |
| 43 | 	VIE_OP_TYPE_TWO_BYTE, | |
| 44 | 	VIE_OP_TYPE_PUSH, | |
| 45 | 	VIE_OP_TYPE_CMP, | |
| 46 | 	VIE_OP_TYPE_POP, | |
| 47 | 	VIE_OP_TYPE_MOVS, | |
| 48 | 	VIE_OP_TYPE_GROUP1, | |
| 49 | 	VIE_OP_TYPE_STOS, | |
| 50 | 	VIE_OP_TYPE_BITTEST, | |
| 51 | 	VIE_OP_TYPE_TWOB_GRP15, | |
| 52 | 	VIE_OP_TYPE_ADD, | |
| 53 | 	VIE_OP_TYPE_TEST, | |
| 54 | 	VIE_OP_TYPE_BEXTR, | |
| 55 | 	VIE_OP_TYPE_OUTS, | |
| 56 | 	VIE_OP_TYPE_LAST | |
| 57 | }; | |
| 58 | ||
| 34 | 59 | /* |
| 35 | 60 | * Callback functions to read and write memory regions. |
| 36 | 61 | */ |
| ... | ... | @@ -112,7 +137,7 @@ void vie_init(struct vie *vie, const char *inst_bytes, int inst_length); |
| 112 | 137 | * 'gla' is the guest linear address provided by the hardware assist |
| 113 | 138 | * that caused the nested page table fault. It is used to verify that |
| 114 | 139 | * the software instruction decoding is in agreement with the hardware. |
| 115 | * | |
| 140 | * | |
| 116 | 141 | * Some hardware assists do not provide the 'gla' to the hypervisor. |
| 117 | 142 | * To skip the 'gla' verification for this or any other reason pass |
| 118 | 143 | * in VIE_INVALID_GLA instead. |
lib/libc/include/x86_64-freebsd-none/machine/vmparam.h+46-42| ... | ... | @@ -38,8 +38,6 @@ |
| 38 | 38 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 39 | 39 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 40 | 40 | * SUCH DAMAGE. |
| 41 | * | |
| 42 | *	from: @(#)vmparam.h	5.9 (Berkeley) 5/12/91 | |
| 43 | 41 | */ |
| 44 | 42 | |
| 45 | 43 | #ifdef __i386__ |
| ... | ... | @@ -74,12 +72,12 @@ |
| 74 | 72 | #endif |
| 75 | 73 | |
| 76 | 74 | /* |
| 77 | * We provide a machine specific single page allocator through the use | |
| 78 | * of the direct mapped segment. This uses 2MB pages for reduced | |
| 75 | * We provide a single page allocator through the use of the | |
| 76 | * direct mapped segment. This uses 2MB pages for reduced | |
| 79 | 77 | * TLB pressure. |
| 80 | 78 | */ |
| 81 | 79 | #if !defined(KASAN) && !defined(KMSAN) |
| 82 | #define	UMA_MD_SMALL_ALLOC | |
| 80 | #define UMA_USE_DMAP | |
| 83 | 81 | #endif |
| 84 | 82 | |
| 85 | 83 | /* |
| ... | ... | @@ -91,19 +89,21 @@ |
| 91 | 89 | * The number of PHYSSEG entries must be one greater than the number |
| 92 | 90 | * of phys_avail entries because the phys_avail entry that spans the |
| 93 | 91 | * largest physical address that is accessible by ISA DMA is split |
| 94 | * into two PHYSSEG entries. | |
| 92 | * into two PHYSSEG entries. | |
| 95 | 93 | */ |
| 96 | 94 | #define	VM_PHYSSEG_MAX		63 |
| 97 | 95 | |
| 98 | 96 | /* |
| 99 | * Create two free page pools: VM_FREEPOOL_DEFAULT is the default pool | |
| 100 | * from which physical pages are allocated and VM_FREEPOOL_DIRECT is | |
| 101 | * the pool from which physical pages for page tables and small UMA | |
| 102 | * objects are allocated. | |
| 97 | * Create three free page pools: VM_FREEPOOL_DEFAULT is the default pool from | |
| 98 | * which physical pages are allocated and VM_FREEPOOL_DIRECT is the pool from | |
| 99 | * which physical pages for page tables and small UMA objects are allocated. | |
| 100 | * VM_FREEPOOL_LAZYINIT is a special-purpose pool that is populated only during | |
| 101 | * boot and is used to implement deferred initialization of page structures. | |
| 103 | 102 | */ |
| 104 | #define	VM_NFREEPOOL		2 | |
| 105 | #define	VM_FREEPOOL_DEFAULT	0 | |
| 106 | #define	VM_FREEPOOL_DIRECT	1 | |
| 103 | #define	VM_NFREEPOOL		3 | |
| 104 | #define	VM_FREEPOOL_LAZYINIT	0 | |
| 105 | #define	VM_FREEPOOL_DEFAULT	1 | |
| 106 | #define	VM_FREEPOOL_DIRECT	2 | |
| 107 | 107 | |
| 108 | 108 | /* |
| 109 | 109 | * Create up to three free page lists: VM_FREELIST_DMA32 is for physical pages |
| ... | ... | @@ -149,10 +149,6 @@ |
| 149 | 149 | #define	VM_LEVEL_0_ORDER	9 |
| 150 | 150 | #endif |
| 151 | 151 | |
| 152 | #ifdef	SMP | |
| 153 | #define	PA_LOCK_COUNT	256 | |
| 154 | #endif | |
| 155 | ||
| 156 | 152 | /* |
| 157 | 153 | * Kernel physical load address for non-UEFI boot and for legacy UEFI loader. |
| 158 | 154 | * Newer UEFI loader loads kernel anywhere below 4G, with memory allocated |
| ... | ... | @@ -167,6 +163,7 @@ |
| 167 | 163 | * Virtual addresses of things. Derived from the page directory and |
| 168 | 164 | * page table indexes from pmap.h for precision. |
| 169 | 165 | * |
| 166 | * LA48: | |
| 170 | 167 | * 0x0000000000000000 - 0x00007fffffffffff user map |
| 171 | 168 | * 0x0000800000000000 - 0xffff7fffffffffff does not exist (hole) |
| 172 | 169 | * 0xffff800000000000 - 0xffff804020100fff recursive page table (512GB slot) |
| ... | ... | @@ -179,32 +176,38 @@ |
| 179 | 176 | * 0xfffffc0000000000 - 0xfffffdffffffffff 2TB KMSAN shadow map, optional |
| 180 | 177 | * 0xfffffe0000000000 - 0xffffffffffffffff 2TB kernel map |
| 181 | 178 | * |
| 179 | * LA57: | |
| 180 | * 0x0000000000000000 - 0x00ffffffffffffff user map | |
| 181 | * 0x0100000000000000 - 0xf0ffffffffffffff does not exist (hole) | |
| 182 | * 0xff00000000000000 - 0xff00ffffffffffff recursive page table (2048TB slot) | |
| 183 | * 0xff01000000000000 - 0xff20ffffffffffff direct map (32 x 2048TB slots) | |
| 184 | * 0xff21000000000000 - 0xff40ffffffffffff large map | |
| 185 | * 0xff41000000000000 - 0xffff7fffffffffff unused | |
| 186 | * 0xffff800000000000 - 0xfffff5ffffffffff unused (start of kernel pml4 entry) | |
| 187 | * 0xfffff60000000000 - 0xfffff7ffffffffff 2TB KMSAN origin map, optional | |
| 188 | * 0xfffff78000000000 - 0xfffff7bfffffffff 512GB KASAN shadow map, optional | |
| 189 | * 0xfffff80000000000 - 0xfffffbffffffffff 4TB unused | |
| 190 | * 0xfffffc0000000000 - 0xfffffdffffffffff 2TB KMSAN shadow map, optional | |
| 191 | * 0xfffffe0000000000 - 0xffffffffffffffff 2TB kernel map | |
| 192 | * | |
| 182 | 193 | * Within the kernel map: |
| 183 | 194 | * |
| 184 | 195 | * 0xfffffe0000000000 vm_page_array |
| 185 | 196 | * 0xffffffff80000000 KERNBASE |
| 186 | 197 | */ |
| 187 | 198 | |
| 188 | #define	VM_MIN_KERNEL_ADDRESS	KV4ADDR(KPML4BASE, 0, 0, 0) | |
| 189 | #define	VM_MAX_KERNEL_ADDRESS	KV4ADDR(KPML4BASE + NKPML4E - 1, \ | |
| 190 | 					NPDPEPG-1, NPDEPG-1, NPTEPG-1) | |
| 191 | ||
| 192 | #define	DMAP_MIN_ADDRESS	KV4ADDR(DMPML4I, 0, 0, 0) | |
| 193 | #define	DMAP_MAX_ADDRESS	KV4ADDR(DMPML4I + NDMPML4E, 0, 0, 0) | |
| 194 | ||
| 195 | #define	KASAN_MIN_ADDRESS	KV4ADDR(KASANPML4I, 0, 0, 0) | |
| 196 | #define	KASAN_MAX_ADDRESS	KV4ADDR(KASANPML4I + NKASANPML4E, 0, 0, 0) | |
| 199 | #define	VM_MIN_KERNEL_ADDRESS_LA48	KV4ADDR(KPML4BASE, 0, 0, 0) | |
| 200 | #define	VM_MIN_KERNEL_ADDRESS		kva_layout.km_low | |
| 201 | #define	VM_MAX_KERNEL_ADDRESS		kva_layout.km_high | |
| 197 | 202 | |
| 198 | #define	KMSAN_SHAD_MIN_ADDRESS	KV4ADDR(KMSANSHADPML4I, 0, 0, 0) | |
| 199 | #define	KMSAN_SHAD_MAX_ADDRESS	KV4ADDR(KMSANSHADPML4I + NKMSANSHADPML4E, \ | |
| 200 | 					0, 0, 0) | |
| 203 | #define	KASAN_MIN_ADDRESS		(kva_layout.kasan_shadow_low) | |
| 204 | #define	KASAN_MAX_ADDRESS		(kva_layout.kasan_shadow_high) | |
| 201 | 205 | |
| 202 | #define	KMSAN_ORIG_MIN_ADDRESS	KV4ADDR(KMSANORIGPML4I, 0, 0, 0) | |
| 203 | #define	KMSAN_ORIG_MAX_ADDRESS	KV4ADDR(KMSANORIGPML4I + NKMSANORIGPML4E, \ | |
| 204 | 					0, 0, 0) | |
| 206 | #define	KMSAN_SHAD_MIN_ADDRESS		(kva_layout.kmsan_shadow_low) | |
| 207 | #define	KMSAN_SHAD_MAX_ADDRESS		(kva_layout.kmsan_shadow_high) | |
| 205 | 208 | |
| 206 | #define	LARGEMAP_MIN_ADDRESS	KV4ADDR(LMSPML4I, 0, 0, 0) | |
| 207 | #define	LARGEMAP_MAX_ADDRESS	KV4ADDR(LMEPML4I + 1, 0, 0, 0) | |
| 209 | #define	KMSAN_ORIG_MIN_ADDRESS		(kva_layout.kmsan_origin_low) | |
| 210 | #define	KMSAN_ORIG_MAX_ADDRESS		(kva_layout.kmsan_origin_high) | |
| 208 | 211 | |
| 209 | 212 | /* |
| 210 | 213 | * Formally kernel mapping starts at KERNBASE, but kernel linker |
| ... | ... | @@ -243,21 +246,21 @@ |
| 243 | 246 | * vt fb startup needs to be reworked. |
| 244 | 247 | */ |
| 245 | 248 | #define	PHYS_IN_DMAP(pa)	(dmaplimit == 0 || (pa) < dmaplimit) |
| 246 | #define	VIRT_IN_DMAP(va)	((va) >= DMAP_MIN_ADDRESS &&		\ | |
| 247 | (va) < (DMAP_MIN_ADDRESS + dmaplimit)) | |
| 249 | #define	VIRT_IN_DMAP(va)	\ | |
| 250 | ((va) >= kva_layout.dmap_low && (va) < kva_layout.dmap_low + dmaplimit) | |
| 248 | 251 | |
| 249 | 252 | #define	PMAP_HAS_DMAP	1 |
| 250 | #define	PHYS_TO_DMAP(x)	({						\ | |
| 253 | #define	PHYS_TO_DMAP(x)	__extension__ ({				\ | |
| 251 | 254 | 	KASSERT(PHYS_IN_DMAP(x),					\ |
| 252 | 255 | 	 ("physical address %#jx not covered by the DMAP",		\ |
| 253 | 256 | 	 (uintmax_t)x));						\ |
| 254 | 	(x) | DMAP_MIN_ADDRESS; }) | |
| 257 | 	(x) + kva_layout.dmap_low; }) | |
| 255 | 258 | |
| 256 | #define	DMAP_TO_PHYS(x)	({						\ | |
| 259 | #define	DMAP_TO_PHYS(x)	__extension__ ({				\ | |
| 257 | 260 | 	KASSERT(VIRT_IN_DMAP(x),					\ |
| 258 | 261 | 	 ("virtual address %#jx not covered by the DMAP",		\ |
| 259 | 262 | 	 (uintmax_t)x));						\ |
| 260 | 	(x) & ~DMAP_MIN_ADDRESS; }) | |
| 263 | 	(x) - kva_layout.dmap_low; }) | |
| 261 | 264 | |
| 262 | 265 | /* |
| 263 | 266 | * amd64 maps the page array into KVA so that it can be more easily |
| ... | ... | @@ -278,7 +281,7 @@ |
| 278 | 281 | */ |
| 279 | 282 | #ifndef VM_KMEM_SIZE_MAX |
| 280 | 283 | #define	VM_KMEM_SIZE_MAX	((VM_MAX_KERNEL_ADDRESS - \ |
| 281 | VM_MIN_KERNEL_ADDRESS + 1) * 3 / 5) | |
| 284 | kva_layout.km_low + 1) * 3 / 5) | |
| 282 | 285 | #endif |
| 283 | 286 | |
| 284 | 287 | /* initial pagein size of beginning of executable file */ |
| ... | ... | @@ -296,7 +299,8 @@ |
| 296 | 299 | /* |
| 297 | 300 | * Need a page dump array for minidump. |
| 298 | 301 | */ |
| 299 | #define MINIDUMP_PAGE_TRACKING	1 | |
| 302 | #define MINIDUMP_PAGE_TRACKING	 1 | |
| 303 | #define MINIDUMP_STARTUP_PAGE_TRACKING 1 | |
| 300 | 304 | |
| 301 | 305 | #endif /* _MACHINE_VMPARAM_H_ */ |
| 302 | 306 |
lib/libc/include/x86_64-freebsd-none/stdarg.h deleted-5| ... | ... | @@ -1,5 +0,0 @@ |
| 1 | /*- | |
| 2 | * This file is in the public domain. | |
| 3 | */ | |
| 4 | ||
| 5 | #include <x86/stdarg.h> | |
| \ No newline at end of file |
lib/std/Target.zig+1-2| ... | ... | @@ -510,7 +510,7 @@ pub const Os = struct { |
| 510 | 510 | |
| 511 | 511 | break :blk default_min; |
| 512 | 512 | }, |
| 513 | .max = .{ .major = 14, .minor = 3, .patch = 0 }, | |
| 513 | .max = .{ .major = 15, .minor = 0, .patch = 0 }, | |
| 514 | 514 | }, |
| 515 | 515 | }, |
| 516 | 516 | .netbsd => .{ |
| ... | ... | @@ -865,7 +865,6 @@ pub const Abi = enum { |
| 865 | 865 | }, |
| 866 | 866 | .freebsd => switch (arch) { |
| 867 | 867 | .arm, |
| 868 | .powerpc, | |
| 869 | 868 | => .eabihf, |
| 870 | 869 | else => .none, |
| 871 | 870 | }, |
lib/std/zig/target.zig-1| ... | ... | @@ -71,7 +71,6 @@ pub const available_libcs = [_]ArchOsAbi{ |
| 71 | 71 | .{ .arch = .mips64el, .os = .linux, .abi = .gnuabin32, .os_ver = .{ .major = 2, .minor = 6, .patch = 0 }, .glibc_triple = "mips64el-linux-gnu-n32" }, |
| 72 | 72 | .{ .arch = .mips64el, .os = .linux, .abi = .muslabi64, .os_ver = .{ .major = 2, .minor = 3, .patch = 48 } }, |
| 73 | 73 | .{ .arch = .mips64el, .os = .linux, .abi = .muslabin32, .os_ver = .{ .major = 2, .minor = 6, .patch = 0 } }, |
| 74 | .{ .arch = .powerpc, .os = .freebsd, .abi = .eabihf, .os_ver = .{ .major = 7, .minor = 1, .patch = 0 } }, | |
| 75 | 74 | .{ .arch = .powerpc, .os = .linux, .abi = .gnueabi, .os_ver = .{ .major = 1, .minor = 3, .patch = 45 }, .glibc_triple = "powerpc-linux-gnu-soft" }, |
| 76 | 75 | .{ .arch = .powerpc, .os = .linux, .abi = .gnueabihf, .os_ver = .{ .major = 1, .minor = 3, .patch = 45 }, .glibc_triple = "powerpc-linux-gnu" }, |
| 77 | 76 | .{ .arch = .powerpc, .os = .linux, .abi = .musleabi, .os_ver = .{ .major = 1, .minor = 3, .patch = 45 } }, |
src/libs/freebsd.zig+32-13| ... | ... | @@ -139,10 +139,6 @@ pub fn buildCrtFile(comp: *Compilation, crt_file: CrtFile, prog_node: std.Progre |
| 139 | 139 | .path = "common" ++ path.sep_str ++ "crtbrand.S", |
| 140 | 140 | .flags = acflags.items, |
| 141 | 141 | }, |
| 142 | .{ | |
| 143 | .path = "common" ++ path.sep_str ++ "crtend.c", | |
| 144 | .flags = cflags.items, | |
| 145 | }, | |
| 146 | 142 | .{ |
| 147 | 143 | .path = "common" ++ path.sep_str ++ "feature_note.S", |
| 148 | 144 | .flags = acflags.items, |
| ... | ... | @@ -257,6 +253,12 @@ pub fn buildCrtFile(comp: *Compilation, crt_file: CrtFile, prog_node: std.Progre |
| 257 | 253 | pub const Lib = struct { |
| 258 | 254 | name: []const u8, |
| 259 | 255 | sover: u8, |
| 256 | added_in: ?Version = null, | |
| 257 | ||
| 258 | pub fn getSoVersion(lib: Lib, os: *const std.Target.Os) u8 { | |
| 259 | if (std.mem.eql(u8, lib.name, "util") and os.version_range.semver.min.major >= 15) return 10; | |
| 260 | return lib.sover; | |
| 261 | } | |
| 260 | 262 | }; |
| 261 | 263 | |
| 262 | 264 | pub const libs = [_]Lib{ |
| ... | ... | @@ -269,6 +271,7 @@ pub const libs = [_]Lib{ |
| 269 | 271 | .{ .name = "ld", .sover = 1 }, |
| 270 | 272 | .{ .name = "util", .sover = 9 }, |
| 271 | 273 | .{ .name = "execinfo", .sover = 1 }, |
| 274 | .{ .name = "sys", .sover = 7, .added_in = .{ .major = 15, .minor = 0, .patch = 0 } }, | |
| 272 | 275 | }; |
| 273 | 276 | |
| 274 | 277 | pub const ABI = struct { |
| ... | ... | @@ -434,7 +437,8 @@ pub fn buildSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) anye |
| 434 | 437 | |
| 435 | 438 | const target = comp.getTarget(); |
| 436 | 439 | // FreeBSD 7 == FBSD_1.0, ..., FreeBSD 14 == FBSD_1.7 |
| 437 | const target_version: Version = .{ .major = 1, .minor = target.os.version_range.semver.min.major - 7, .patch = 0 }; | |
| 440 | const target_os_version: Version = target.os.version_range.semver.min; | |
| 441 | const target_libc_version: Version = .{ .major = 1, .minor = target_os_version.major - 7, .patch = 0 }; | |
| 438 | 442 | |
| 439 | 443 | // Use the global cache directory. |
| 440 | 444 | var cache: Cache = .{ |
| ... | ... | @@ -452,7 +456,7 @@ pub fn buildSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) anye |
| 452 | 456 | man.hash.addBytes(build_options.version); |
| 453 | 457 | man.hash.add(target.cpu.arch); |
| 454 | 458 | man.hash.add(target.abi); |
| 455 | man.hash.add(target_version); | |
| 459 | man.hash.add(target_os_version); | |
| 456 | 460 | |
| 457 | 461 | const full_abilists_path = try comp.dirs.zig_lib.join(arena, &.{abilists_path}); |
| 458 | 462 | const abilists_index = try man.addFile(full_abilists_path, abilists_max_size); |
| ... | ... | @@ -494,19 +498,19 @@ pub fn buildSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) anye |
| 494 | 498 | }; |
| 495 | 499 | |
| 496 | 500 | const target_ver_index = for (metadata.all_versions, 0..) |ver, i| { |
| 497 | switch (ver.order(target_version)) { | |
| 501 | switch (ver.order(target_libc_version)) { | |
| 498 | 502 | .eq => break i, |
| 499 | 503 | .lt => continue, |
| 500 | 504 | .gt => { |
| 501 | 505 | // TODO Expose via compile error mechanism instead of log. |
| 502 | log.warn("invalid target FreeBSD libc version: {f}", .{target_version}); | |
| 506 | log.warn("invalid target FreeBSD libc version: {f}", .{target_libc_version}); | |
| 503 | 507 | return error.InvalidTargetLibCVersion; |
| 504 | 508 | }, |
| 505 | 509 | } |
| 506 | 510 | } else blk: { |
| 507 | 511 | const latest_index = metadata.all_versions.len - 1; |
| 508 | 512 | log.warn("zig cannot build new FreeBSD libc version {f}; providing instead {f}", .{ |
| 509 | target_version, metadata.all_versions[latest_index], | |
| 513 | target_libc_version, metadata.all_versions[latest_index], | |
| 510 | 514 | }); |
| 511 | 515 | break :blk latest_index; |
| 512 | 516 | }; |
| ... | ... | @@ -524,6 +528,11 @@ pub fn buildSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) anye |
| 524 | 528 | defer stubs_asm.deinit(); |
| 525 | 529 | |
| 526 | 530 | for (libs, 0..) |lib, lib_i| { |
| 531 | if (lib.added_in) |add_in| { | |
| 532 | // Note: Compare OS version, not libc version. | |
| 533 | if (target.os.version_range.semver.min.order(add_in) == .lt) continue; | |
| 534 | } | |
| 535 | ||
| 527 | 536 | stubs_asm.shrinkRetainingCapacity(0); |
| 528 | 537 | |
| 529 | 538 | try stubs_asm.appendSlice(".text\n"); |
| ... | ... | @@ -983,6 +992,9 @@ pub fn buildSharedObjects(comp: *Compilation, prog_node: std.Progress.Node) anye |
| 983 | 992 | } |
| 984 | 993 | |
| 985 | 994 | fn queueSharedObjects(comp: *Compilation, so_files: BuiltSharedObjects) void { |
| 995 | const target = comp.getTarget(); | |
| 996 | const target_os_version = target.os.version_range.semver.min; | |
| 997 | ||
| 986 | 998 | assert(comp.freebsd_so_files == null); |
| 987 | 999 | comp.freebsd_so_files = so_files; |
| 988 | 1000 | |
| ... | ... | @@ -994,10 +1006,14 @@ fn queueSharedObjects(comp: *Compilation, so_files: BuiltSharedObjects) void { |
| 994 | 1006 | defer comp.mutex.unlock(); |
| 995 | 1007 | |
| 996 | 1008 | for (libs) |lib| { |
| 1009 | if (lib.added_in) |add_in| { | |
| 1010 | if (target_os_version.order(add_in) == .lt) continue; | |
| 1011 | } | |
| 1012 | ||
| 997 | 1013 | const so_path: Path = .{ |
| 998 | 1014 | .root_dir = so_files.dir_path.root_dir, |
| 999 | 1015 | .sub_path = std.fmt.allocPrint(comp.arena, "{s}{c}lib{s}.so.{d}", .{ |
| 1000 | so_files.dir_path.sub_path, fs.path.sep, lib.name, lib.sover, | |
| 1016 | so_files.dir_path.sub_path, fs.path.sep, lib.name, lib.getSoVersion(&target.os), | |
| 1001 | 1017 | }) catch return comp.setAllocFailure(), |
| 1002 | 1018 | }; |
| 1003 | 1019 | task_buffer[task_buffer_i] = .{ .load_dso = so_path }; |
| ... | ... | @@ -1019,10 +1035,13 @@ fn buildSharedLib( |
| 1019 | 1035 | const tracy = trace(@src()); |
| 1020 | 1036 | defer tracy.end(); |
| 1021 | 1037 | |
| 1038 | const target = comp.getTarget(); | |
| 1039 | ||
| 1022 | 1040 | const io = comp.io; |
| 1023 | const basename = try std.fmt.allocPrint(arena, "lib{s}.so.{d}", .{ lib.name, lib.sover }); | |
| 1024 | const version: Version = .{ .major = lib.sover, .minor = 0, .patch = 0 }; | |
| 1025 | const ld_basename = path.basename(comp.getTarget().standardDynamicLinkerPath().get().?); | |
| 1041 | const sover = lib.getSoVersion(&target.os); | |
| 1042 | const basename = try std.fmt.allocPrint(arena, "lib{s}.so.{d}", .{ lib.name, sover }); | |
| 1043 | const version: Version = .{ .major = sover, .minor = 0, .patch = 0 }; | |
| 1044 | const ld_basename = path.basename(target.standardDynamicLinkerPath().get().?); | |
| 1026 | 1045 | const soname = if (mem.eql(u8, lib.name, "ld")) ld_basename else basename; |
| 1027 | 1046 | const map_file_path = try path.join(arena, &.{ bin_directory.path.?, all_map_basename }); |
| 1028 | 1047 |
src/link/Lld.zig+5-1| ... | ... | @@ -1190,8 +1190,12 @@ fn elfLink(lld: *Lld, arena: Allocator) !void { |
| 1190 | 1190 | })); |
| 1191 | 1191 | } else if (target.isFreeBSDLibC()) { |
| 1192 | 1192 | for (freebsd.libs) |lib| { |
| 1193 | if (lib.added_in) |add_in| { | |
| 1194 | if (target.os.version_range.semver.min.order(add_in) == .lt) continue; | |
| 1195 | } | |
| 1196 | ||
| 1193 | 1197 | const lib_path = try std.fmt.allocPrint(arena, "{f}{c}lib{s}.so.{d}", .{ |
| 1194 | comp.freebsd_so_files.?.dir_path, fs.path.sep, lib.name, lib.sover, | |
| 1198 | comp.freebsd_so_files.?.dir_path, fs.path.sep, lib.name, lib.getSoVersion(&target.os), | |
| 1195 | 1199 | }); |
| 1196 | 1200 | try argv.append(lib_path); |
| 1197 | 1201 | } |
tools/process_headers.zig-1| ... | ... | @@ -81,7 +81,6 @@ const musl_targets = [_]LibCTarget{ |
| 81 | 81 | const freebsd_targets = [_]LibCTarget{ |
| 82 | 82 | .{ .arch = .arm, .abi = .eabihf }, |
| 83 | 83 | .{ .arch = .aarch64, .abi = .none }, |
| 84 | .{ .arch = .powerpc, .abi = .eabihf }, | |
| 85 | 84 | .{ .arch = .powerpc64, .abi = .none }, |
| 86 | 85 | .{ .arch = .riscv64, .abi = .none }, |
| 87 | 86 | .{ .arch = .x86, .abi = .none }, |