| @@ -1,761 +1,766 @@ | | | @@ -1,761 +1,766 @@ |
1 | /* $NetBSD: systm.h,v 1.299 2021/03/10 13:27:51 simonb Exp $ */ | | 1 | /* $NetBSD: systm.h,v 1.300 2021/03/14 02:53:57 rin Exp $ */ |
2 | | | 2 | |
3 | /*- | | 3 | /*- |
4 | * Copyright (c) 1982, 1988, 1991, 1993 | | 4 | * Copyright (c) 1982, 1988, 1991, 1993 |
5 | * The Regents of the University of California. All rights reserved. | | 5 | * The Regents of the University of California. All rights reserved. |
6 | * (c) UNIX System Laboratories, Inc. | | 6 | * (c) UNIX System Laboratories, Inc. |
7 | * All or some portions of this file are derived from material licensed | | 7 | * All or some portions of this file are derived from material licensed |
8 | * to the University of California by American Telephone and Telegraph | | 8 | * to the University of California by American Telephone and Telegraph |
9 | * Co. or Unix System Laboratories, Inc. and are reproduced herein with | | 9 | * Co. or Unix System Laboratories, Inc. and are reproduced herein with |
10 | * the permission of UNIX System Laboratories, Inc. | | 10 | * the permission of UNIX System Laboratories, Inc. |
11 | * | | 11 | * |
12 | * Redistribution and use in source and binary forms, with or without | | 12 | * Redistribution and use in source and binary forms, with or without |
13 | * modification, are permitted provided that the following conditions | | 13 | * modification, are permitted provided that the following conditions |
14 | * are met: | | 14 | * are met: |
15 | * 1. Redistributions of source code must retain the above copyright | | 15 | * 1. Redistributions of source code must retain the above copyright |
16 | * notice, this list of conditions and the following disclaimer. | | 16 | * notice, this list of conditions and the following disclaimer. |
17 | * 2. Redistributions in binary form must reproduce the above copyright | | 17 | * 2. Redistributions in binary form must reproduce the above copyright |
18 | * notice, this list of conditions and the following disclaimer in the | | 18 | * notice, this list of conditions and the following disclaimer in the |
19 | * documentation and/or other materials provided with the distribution. | | 19 | * documentation and/or other materials provided with the distribution. |
20 | * 3. Neither the name of the University nor the names of its contributors | | 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 | | 21 | * may be used to endorse or promote products derived from this software |
22 | * without specific prior written permission. | | 22 | * without specific prior written permission. |
23 | * | | 23 | * |
24 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND | | 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 | | 25 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | | 26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
27 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE | | 27 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE |
28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | | 28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS | | 29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
30 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | | 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 | | 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 | | 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 | | 33 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
34 | * SUCH DAMAGE. | | 34 | * SUCH DAMAGE. |
35 | * | | 35 | * |
36 | * @(#)systm.h 8.7 (Berkeley) 3/29/95 | | 36 | * @(#)systm.h 8.7 (Berkeley) 3/29/95 |
37 | */ | | 37 | */ |
38 | | | 38 | |
39 | #ifndef _SYS_SYSTM_H_ | | 39 | #ifndef _SYS_SYSTM_H_ |
40 | #define _SYS_SYSTM_H_ | | 40 | #define _SYS_SYSTM_H_ |
41 | | | 41 | |
42 | #if defined(_KERNEL_OPT) | | 42 | #if defined(_KERNEL_OPT) |
43 | #include "opt_ddb.h" | | 43 | #include "opt_ddb.h" |
44 | #include "opt_multiprocessor.h" | | 44 | #include "opt_multiprocessor.h" |
45 | #include "opt_gprof.h" | | 45 | #include "opt_gprof.h" |
46 | #include "opt_kasan.h" | | 46 | #include "opt_kasan.h" |
47 | #include "opt_kcsan.h" | | 47 | #include "opt_kcsan.h" |
48 | #include "opt_kmsan.h" | | 48 | #include "opt_kmsan.h" |
49 | #include "opt_wsdisplay_compat.h" | | 49 | #include "opt_wsdisplay_compat.h" |
50 | #endif | | 50 | #endif |
51 | #if !defined(_KERNEL) && !defined(_STANDALONE) | | 51 | #if !defined(_KERNEL) && !defined(_STANDALONE) |
52 | #include <stdbool.h> | | 52 | #include <stdbool.h> |
53 | #endif | | 53 | #endif |
54 | | | 54 | |
55 | #include <machine/endian.h> | | 55 | #include <machine/endian.h> |
56 | | | 56 | |
57 | #include <sys/types.h> | | 57 | #include <sys/types.h> |
58 | #include <sys/stdarg.h> | | 58 | #include <sys/stdarg.h> |
59 | | | 59 | |
60 | #include <sys/device_if.h> | | 60 | #include <sys/device_if.h> |
61 | | | 61 | |
62 | struct clockframe; | | 62 | struct clockframe; |
63 | struct lwp; | | 63 | struct lwp; |
64 | struct proc; | | 64 | struct proc; |
65 | struct sysent; | | 65 | struct sysent; |
66 | struct timeval; | | 66 | struct timeval; |
67 | struct tty; | | 67 | struct tty; |
68 | struct uio; | | 68 | struct uio; |
69 | struct vnode; | | 69 | struct vnode; |
70 | struct vmspace; | | 70 | struct vmspace; |
71 | | | 71 | |
72 | extern const char *panicstr; /* panic message */ | | 72 | extern const char *panicstr; /* panic message */ |
73 | extern int doing_shutdown; /* shutting down */ | | 73 | extern int doing_shutdown; /* shutting down */ |
74 | | | 74 | |
75 | extern const char copyright[]; /* system copyright */ | | 75 | extern const char copyright[]; /* system copyright */ |
76 | extern char machine[]; /* machine type */ | | 76 | extern char machine[]; /* machine type */ |
77 | extern char machine_arch[]; /* machine architecture */ | | 77 | extern char machine_arch[]; /* machine architecture */ |
78 | extern const char osrelease[]; /* short system version */ | | 78 | extern const char osrelease[]; /* short system version */ |
79 | extern const char ostype[]; /* system type */ | | 79 | extern const char ostype[]; /* system type */ |
80 | extern const char kernel_ident[];/* kernel configuration ID */ | | 80 | extern const char kernel_ident[];/* kernel configuration ID */ |
81 | extern const char version[]; /* system version */ | | 81 | extern const char version[]; /* system version */ |
82 | extern const char buildinfo[]; /* information from build environment */ | | 82 | extern const char buildinfo[]; /* information from build environment */ |
83 | | | 83 | |
84 | extern int autonicetime; /* time (in seconds) before autoniceval */ | | 84 | extern int autonicetime; /* time (in seconds) before autoniceval */ |
85 | extern int autoniceval; /* proc priority after autonicetime */ | | 85 | extern int autoniceval; /* proc priority after autonicetime */ |
86 | | | 86 | |
87 | extern int selwait; /* select timeout address */ | | 87 | extern int selwait; /* select timeout address */ |
88 | | | 88 | |
89 | extern int maxmem; /* max memory per process */ | | 89 | extern int maxmem; /* max memory per process */ |
90 | extern psize_t physmem; /* physical memory */ | | 90 | extern psize_t physmem; /* physical memory */ |
91 | | | 91 | |
92 | extern dev_t dumpdev; /* dump device */ | | 92 | extern dev_t dumpdev; /* dump device */ |
93 | extern dev_t dumpcdev; /* dump device (character equivalent) */ | | 93 | extern dev_t dumpcdev; /* dump device (character equivalent) */ |
94 | extern long dumplo; /* offset into dumpdev */ | | 94 | extern long dumplo; /* offset into dumpdev */ |
95 | extern int dumpsize; /* size of dump in pages */ | | 95 | extern int dumpsize; /* size of dump in pages */ |
96 | extern const char *dumpspec; /* how dump device was specified */ | | 96 | extern const char *dumpspec; /* how dump device was specified */ |
97 | | | 97 | |
98 | extern dev_t rootdev; /* root device */ | | 98 | extern dev_t rootdev; /* root device */ |
99 | extern struct vnode *rootvp; /* vnode equivalent to above */ | | 99 | extern struct vnode *rootvp; /* vnode equivalent to above */ |
100 | extern device_t root_device; /* device equivalent to above */ | | 100 | extern device_t root_device; /* device equivalent to above */ |
101 | extern const char *rootspec; /* how root device was specified */ | | 101 | extern const char *rootspec; /* how root device was specified */ |
102 | | | 102 | |
103 | extern int ncpu; /* number of CPUs configured */ | | 103 | extern int ncpu; /* number of CPUs configured */ |
104 | extern int ncpuonline; /* number of CPUs online */ | | 104 | extern int ncpuonline; /* number of CPUs online */ |
105 | #if defined(_KERNEL) | | 105 | #if defined(_KERNEL) |
106 | extern bool mp_online; /* secondary processors are started */ | | 106 | extern bool mp_online; /* secondary processors are started */ |
107 | #endif /* defined(_KERNEL) */ | | 107 | #endif /* defined(_KERNEL) */ |
108 | | | 108 | |
109 | extern const char hexdigits[]; /* "0123456789abcdef" in subr_prf.c */ | | 109 | extern const char hexdigits[]; /* "0123456789abcdef" in subr_prf.c */ |
110 | extern const char HEXDIGITS[]; /* "0123456789ABCDEF" in subr_prf.c */ | | 110 | extern const char HEXDIGITS[]; /* "0123456789ABCDEF" in subr_prf.c */ |
111 | | | 111 | |
112 | /* | | 112 | /* |
113 | * These represent the swap pseudo-device (`sw'). This device | | 113 | * These represent the swap pseudo-device (`sw'). This device |
114 | * is used by the swap pager to indirect through the routines | | 114 | * is used by the swap pager to indirect through the routines |
115 | * in sys/vm/vm_swap.c. | | 115 | * in sys/vm/vm_swap.c. |
116 | */ | | 116 | */ |
117 | extern const dev_t swapdev; /* swapping device */ | | 117 | extern const dev_t swapdev; /* swapping device */ |
118 | extern struct vnode *swapdev_vp;/* vnode equivalent to above */ | | 118 | extern struct vnode *swapdev_vp;/* vnode equivalent to above */ |
119 | | | 119 | |
120 | extern const dev_t zerodev; /* /dev/zero */ | | 120 | extern const dev_t zerodev; /* /dev/zero */ |
121 | | | 121 | |
122 | #if defined(_KERNEL) | | 122 | #if defined(_KERNEL) |
123 | typedef int sy_call_t(struct lwp *, const void *, register_t *); | | 123 | typedef int sy_call_t(struct lwp *, const void *, register_t *); |
124 | | | 124 | |
125 | extern struct sysent { /* system call table */ | | 125 | extern struct sysent { /* system call table */ |
126 | short sy_narg; /* number of args */ | | 126 | short sy_narg; /* number of args */ |
127 | short sy_argsize; /* total size of arguments */ | | 127 | short sy_argsize; /* total size of arguments */ |
128 | int sy_flags; /* flags. see below */ | | 128 | int sy_flags; /* flags. see below */ |
129 | sy_call_t *sy_call; /* implementing function */ | | 129 | sy_call_t *sy_call; /* implementing function */ |
130 | uint32_t sy_entry; /* DTrace entry ID for systrace. */ | | 130 | uint32_t sy_entry; /* DTrace entry ID for systrace. */ |
131 | uint32_t sy_return; /* DTrace return ID for systrace. */ | | 131 | uint32_t sy_return; /* DTrace return ID for systrace. */ |
132 | } sysent[]; | | 132 | } sysent[]; |
133 | extern int nsysent; | | 133 | extern int nsysent; |
134 | extern const uint32_t sysent_nomodbits[]; | | 134 | extern const uint32_t sysent_nomodbits[]; |
135 | #endif | | 135 | #endif |
136 | | | 136 | |
137 | #if BYTE_ORDER == BIG_ENDIAN | | 137 | #if BYTE_ORDER == BIG_ENDIAN |
138 | #define SCARG(p,k) ((p)->k.be.datum) /* get arg from args pointer */ | | 138 | #define SCARG(p,k) ((p)->k.be.datum) /* get arg from args pointer */ |
139 | #elif BYTE_ORDER == LITTLE_ENDIAN | | 139 | #elif BYTE_ORDER == LITTLE_ENDIAN |
140 | #define SCARG(p,k) ((p)->k.le.datum) /* get arg from args pointer */ | | 140 | #define SCARG(p,k) ((p)->k.le.datum) /* get arg from args pointer */ |
141 | #else | | 141 | #else |
142 | #error "what byte order is this machine?" | | 142 | #error "what byte order is this machine?" |
143 | #endif | | 143 | #endif |
144 | | | 144 | |
145 | #define SYCALL_INDIRECT 0x0000002 /* indirect (ie syscall() or __syscall()) */ | | 145 | #define SYCALL_INDIRECT 0x0000002 /* indirect (ie syscall() or __syscall()) */ |
146 | #define SYCALL_NARGS64_MASK 0x000f000 /* count of 64bit args */ | | 146 | #define SYCALL_NARGS64_MASK 0x000f000 /* count of 64bit args */ |
147 | #define SYCALL_RET_64 0x0010000 /* retval is a 64bit integer value */ | | 147 | #define SYCALL_RET_64 0x0010000 /* retval is a 64bit integer value */ |
148 | #define SYCALL_ARG0_64 0x0020000 | | 148 | #define SYCALL_ARG0_64 0x0020000 |
149 | #define SYCALL_ARG1_64 0x0040000 | | 149 | #define SYCALL_ARG1_64 0x0040000 |
150 | #define SYCALL_ARG2_64 0x0080000 | | 150 | #define SYCALL_ARG2_64 0x0080000 |
151 | #define SYCALL_ARG3_64 0x0100000 | | 151 | #define SYCALL_ARG3_64 0x0100000 |
152 | #define SYCALL_ARG4_64 0x0200000 | | 152 | #define SYCALL_ARG4_64 0x0200000 |
153 | #define SYCALL_ARG5_64 0x0400000 | | 153 | #define SYCALL_ARG5_64 0x0400000 |
154 | #define SYCALL_ARG6_64 0x0800000 | | 154 | #define SYCALL_ARG6_64 0x0800000 |
155 | #define SYCALL_ARG7_64 0x1000000 | | 155 | #define SYCALL_ARG7_64 0x1000000 |
156 | #define SYCALL_NOSYS 0x2000000 /* permanent nosys in sysent[] */ | | 156 | #define SYCALL_NOSYS 0x2000000 /* permanent nosys in sysent[] */ |
157 | #define SYCALL_ARG_PTR 0x4000000 /* at least one argument is a pointer */ | | 157 | #define SYCALL_ARG_PTR 0x4000000 /* at least one argument is a pointer */ |
158 | #define SYCALL_RET_64_P(sy) ((sy)->sy_flags & SYCALL_RET_64) | | 158 | #define SYCALL_RET_64_P(sy) ((sy)->sy_flags & SYCALL_RET_64) |
159 | #define SYCALL_ARG_64_P(sy, n) ((sy)->sy_flags & (SYCALL_ARG0_64 << (n))) | | 159 | #define SYCALL_ARG_64_P(sy, n) ((sy)->sy_flags & (SYCALL_ARG0_64 << (n))) |
160 | #define SYCALL_ARG_64_MASK(sy) (((sy)->sy_flags >> 17) & 0xff) | | 160 | #define SYCALL_ARG_64_MASK(sy) (((sy)->sy_flags >> 17) & 0xff) |
161 | #define SYCALL_ARG_PTR_P(sy) ((sy)->sy_flags & SYCALL_ARG_PTR) | | 161 | #define SYCALL_ARG_PTR_P(sy) ((sy)->sy_flags & SYCALL_ARG_PTR) |
162 | #define SYCALL_NARGS64(sy) (((sy)->sy_flags >> 12) & 0x0f) | | 162 | #define SYCALL_NARGS64(sy) (((sy)->sy_flags >> 12) & 0x0f) |
163 | #define SYCALL_NARGS64_VAL(n) ((n) << 12) | | 163 | #define SYCALL_NARGS64_VAL(n) ((n) << 12) |
164 | | | 164 | |
165 | extern int boothowto; /* reboot flags, from console subsystem */ | | 165 | extern int boothowto; /* reboot flags, from console subsystem */ |
166 | #define bootverbose (boothowto & AB_VERBOSE) | | 166 | #define bootverbose (boothowto & AB_VERBOSE) |
167 | #define bootquiet (boothowto & AB_QUIET) | | 167 | #define bootquiet (boothowto & AB_QUIET) |
168 | | | 168 | |
169 | extern const char *get_booted_kernel(void); | | 169 | extern const char *get_booted_kernel(void); |
170 | | | 170 | |
171 | extern void (*v_putc)(int); /* Virtual console putc routine */ | | 171 | extern void (*v_putc)(int); /* Virtual console putc routine */ |
172 | | | 172 | |
173 | /* | | 173 | /* |
174 | * General function declarations. | | 174 | * General function declarations. |
175 | */ | | 175 | */ |
176 | void voidop(void); | | 176 | void voidop(void); |
177 | int nullop(void *); | | 177 | int nullop(void *); |
178 | void* nullret(void); | | 178 | void* nullret(void); |
179 | int enodev(void); | | 179 | int enodev(void); |
180 | int enosys(void); | | 180 | int enosys(void); |
181 | int enoioctl(void); | | 181 | int enoioctl(void); |
182 | int enxio(void); | | 182 | int enxio(void); |
183 | int eopnotsupp(void); | | 183 | int eopnotsupp(void); |
184 | | | 184 | |
185 | enum hashtype { | | 185 | enum hashtype { |
186 | HASH_LIST, | | 186 | HASH_LIST, |
187 | HASH_SLIST, | | 187 | HASH_SLIST, |
188 | HASH_TAILQ, | | 188 | HASH_TAILQ, |
189 | HASH_PSLIST | | 189 | HASH_PSLIST |
190 | }; | | 190 | }; |
191 | | | 191 | |
192 | #ifdef _KERNEL | | 192 | #ifdef _KERNEL |
193 | #define COND_SET_STRUCT(dst, src, allow) \ | | 193 | #define COND_SET_STRUCT(dst, src, allow) \ |
194 | do { \ | | 194 | do { \ |
| | | 195 | /* \ |
| | | 196 | * Make sure we don't end up hashing/assigning large \ |
| | | 197 | * structure for performance. Upper-bound is arbitrary, \ |
| | | 198 | * but consider before bumping. \ |
| | | 199 | */ \ |
195 | CTASSERT(sizeof(src) < 32); \ | | 200 | CTASSERT(sizeof(src) < 32); \ |
196 | if (allow) \ | | 201 | if (allow) \ |
197 | dst = src; \ | | 202 | dst = src; \ |
198 | else \ | | 203 | else \ |
199 | hash_value(&dst, sizeof(dst), &src, sizeof(src)); \ | | 204 | hash_value(&dst, sizeof(dst), &src, sizeof(src)); \ |
200 | } while (/*CONSTCOND*/0) | | 205 | } while (/*CONSTCOND*/0) |
201 | | | 206 | |
202 | #define COND_SET_CPTR(dst, src, allow) \ | | 207 | #define COND_SET_CPTR(dst, src, allow) \ |
203 | do { \ | | 208 | do { \ |
204 | if (allow) \ | | 209 | if (allow) \ |
205 | dst = src; \ | | 210 | dst = src; \ |
206 | else { \ | | 211 | else { \ |
207 | void *__v; \ | | 212 | void *__v; \ |
208 | hash_value(&__v, sizeof(__v), &src, sizeof(src)); \ | | 213 | hash_value(&__v, sizeof(__v), &src, sizeof(src)); \ |
209 | dst = __v; \ | | 214 | dst = __v; \ |
210 | } \ | | 215 | } \ |
211 | } while (/*CONSTCOND*/0) | | 216 | } while (/*CONSTCOND*/0) |
212 | | | 217 | |
213 | #define COND_SET_PTR(dst, src, allow) \ | | 218 | #define COND_SET_PTR(dst, src, allow) \ |
214 | do { \ | | 219 | do { \ |
215 | if (allow) \ | | 220 | if (allow) \ |
216 | dst = src; \ | | 221 | dst = src; \ |
217 | else \ | | 222 | else \ |
218 | hash_value(&dst, sizeof(dst), &src, sizeof(src)); \ | | 223 | hash_value(&dst, sizeof(dst), &src, sizeof(src)); \ |
219 | } while (/*CONSTCOND*/0) | | 224 | } while (/*CONSTCOND*/0) |
220 | | | 225 | |
221 | #define COND_SET_VALUE(dst, src, allow) \ | | 226 | #define COND_SET_VALUE(dst, src, allow) \ |
222 | do { \ | | 227 | do { \ |
223 | if (allow) \ | | 228 | if (allow) \ |
224 | dst = src; \ | | 229 | dst = src; \ |
225 | else { \ | | 230 | else { \ |
226 | uint64_t __v = src; \ | | 231 | uint64_t __v = src; \ |
227 | hash_value(&dst, sizeof(dst), &__v, sizeof(__v)); \ | | 232 | hash_value(&dst, sizeof(dst), &__v, sizeof(__v)); \ |
228 | } \ | | 233 | } \ |
229 | } while (/*CONSTCOND*/0) | | 234 | } while (/*CONSTCOND*/0) |
230 | | | 235 | |
231 | void hash_value(void *, size_t, const void *, size_t); | | 236 | void hash_value(void *, size_t, const void *, size_t); |
232 | bool get_expose_address(struct proc *); | | 237 | bool get_expose_address(struct proc *); |
233 | void *hashinit(u_int, enum hashtype, bool, u_long *); | | 238 | void *hashinit(u_int, enum hashtype, bool, u_long *); |
234 | void hashdone(void *, enum hashtype, u_long); | | 239 | void hashdone(void *, enum hashtype, u_long); |
235 | int seltrue(dev_t, int, struct lwp *); | | 240 | int seltrue(dev_t, int, struct lwp *); |
236 | int sys_nosys(struct lwp *, const void *, register_t *); | | 241 | int sys_nosys(struct lwp *, const void *, register_t *); |
237 | int sys_nomodule(struct lwp *, const void *, register_t *); | | 242 | int sys_nomodule(struct lwp *, const void *, register_t *); |
238 | | | 243 | |
239 | void aprint_normal(const char *, ...) __printflike(1, 2); | | 244 | void aprint_normal(const char *, ...) __printflike(1, 2); |
240 | void aprint_error(const char *, ...) __printflike(1, 2); | | 245 | void aprint_error(const char *, ...) __printflike(1, 2); |
241 | void aprint_naive(const char *, ...) __printflike(1, 2); | | 246 | void aprint_naive(const char *, ...) __printflike(1, 2); |
242 | void aprint_verbose(const char *, ...) __printflike(1, 2); | | 247 | void aprint_verbose(const char *, ...) __printflike(1, 2); |
243 | void aprint_debug(const char *, ...) __printflike(1, 2); | | 248 | void aprint_debug(const char *, ...) __printflike(1, 2); |
244 | | | 249 | |
245 | void aprint_normal_dev(device_t, const char *, ...) __printflike(2, 3); | | 250 | void aprint_normal_dev(device_t, const char *, ...) __printflike(2, 3); |
246 | void aprint_error_dev(device_t, const char *, ...) __printflike(2, 3); | | 251 | void aprint_error_dev(device_t, const char *, ...) __printflike(2, 3); |
247 | void aprint_naive_dev(device_t, const char *, ...) __printflike(2, 3); | | 252 | void aprint_naive_dev(device_t, const char *, ...) __printflike(2, 3); |
248 | void aprint_verbose_dev(device_t, const char *, ...) __printflike(2, 3); | | 253 | void aprint_verbose_dev(device_t, const char *, ...) __printflike(2, 3); |
249 | void aprint_debug_dev(device_t, const char *, ...) __printflike(2, 3); | | 254 | void aprint_debug_dev(device_t, const char *, ...) __printflike(2, 3); |
250 | | | 255 | |
251 | void device_printf(device_t, const char *fmt, ...) __printflike(2, 3); | | 256 | void device_printf(device_t, const char *fmt, ...) __printflike(2, 3); |
252 | | | 257 | |
253 | struct ifnet; | | 258 | struct ifnet; |
254 | | | 259 | |
255 | void aprint_normal_ifnet(struct ifnet *, const char *, ...) | | 260 | void aprint_normal_ifnet(struct ifnet *, const char *, ...) |
256 | __printflike(2, 3); | | 261 | __printflike(2, 3); |
257 | void aprint_error_ifnet(struct ifnet *, const char *, ...) | | 262 | void aprint_error_ifnet(struct ifnet *, const char *, ...) |
258 | __printflike(2, 3); | | 263 | __printflike(2, 3); |
259 | void aprint_naive_ifnet(struct ifnet *, const char *, ...) | | 264 | void aprint_naive_ifnet(struct ifnet *, const char *, ...) |
260 | __printflike(2, 3); | | 265 | __printflike(2, 3); |
261 | void aprint_verbose_ifnet(struct ifnet *, const char *, ...) | | 266 | void aprint_verbose_ifnet(struct ifnet *, const char *, ...) |
262 | __printflike(2, 3); | | 267 | __printflike(2, 3); |
263 | void aprint_debug_ifnet(struct ifnet *, const char *, ...) | | 268 | void aprint_debug_ifnet(struct ifnet *, const char *, ...) |
264 | __printflike(2, 3); | | 269 | __printflike(2, 3); |
265 | | | 270 | |
266 | int aprint_get_error_count(void); | | 271 | int aprint_get_error_count(void); |
267 | | | 272 | |
268 | void printf_tolog(const char *, ...) __printflike(1, 2); | | 273 | void printf_tolog(const char *, ...) __printflike(1, 2); |
269 | | | 274 | |
270 | void printf_nolog(const char *, ...) __printflike(1, 2); | | 275 | void printf_nolog(const char *, ...) __printflike(1, 2); |
271 | | | 276 | |
272 | void printf_nostamp(const char *, ...) __printflike(1, 2); | | 277 | void printf_nostamp(const char *, ...) __printflike(1, 2); |
273 | | | 278 | |
274 | void printf(const char *, ...) __printflike(1, 2); | | 279 | void printf(const char *, ...) __printflike(1, 2); |
275 | | | 280 | |
276 | int snprintf(char *, size_t, const char *, ...) __printflike(3, 4); | | 281 | int snprintf(char *, size_t, const char *, ...) __printflike(3, 4); |
277 | | | 282 | |
278 | int vasprintf(char **, const char *, va_list) __printflike(2, 0); | | 283 | int vasprintf(char **, const char *, va_list) __printflike(2, 0); |
279 | | | 284 | |
280 | void vprintf(const char *, va_list) __printflike(1, 0); | | 285 | void vprintf(const char *, va_list) __printflike(1, 0); |
281 | | | 286 | |
282 | int vsnprintf(char *, size_t, const char *, va_list) __printflike(3, 0); | | 287 | int vsnprintf(char *, size_t, const char *, va_list) __printflike(3, 0); |
283 | | | 288 | |
284 | void vprintf_flags(int, const char *, va_list) __printflike(2, 0); | | 289 | void vprintf_flags(int, const char *, va_list) __printflike(2, 0); |
285 | | | 290 | |
286 | void printf_flags(int, const char *, ...) __printflike(2, 3); | | 291 | void printf_flags(int, const char *, ...) __printflike(2, 3); |
287 | | | 292 | |
288 | int humanize_number(char *, size_t, uint64_t, const char *, int); | | 293 | int humanize_number(char *, size_t, uint64_t, const char *, int); |
289 | | | 294 | |
290 | void twiddle(void); | | 295 | void twiddle(void); |
291 | void banner(void); | | 296 | void banner(void); |
292 | #endif /* _KERNEL */ | | 297 | #endif /* _KERNEL */ |
293 | | | 298 | |
294 | void panic(const char *, ...) __dead __printflike(1, 2); | | 299 | void panic(const char *, ...) __dead __printflike(1, 2); |
295 | void vpanic(const char *, va_list) __dead __printflike(1, 0); | | 300 | void vpanic(const char *, va_list) __dead __printflike(1, 0); |
296 | void uprintf(const char *, ...) __printflike(1, 2); | | 301 | void uprintf(const char *, ...) __printflike(1, 2); |
297 | void uprintf_locked(const char *, ...) __printflike(1, 2); | | 302 | void uprintf_locked(const char *, ...) __printflike(1, 2); |
298 | void ttyprintf(struct tty *, const char *, ...) __printflike(2, 3); | | 303 | void ttyprintf(struct tty *, const char *, ...) __printflike(2, 3); |
299 | | | 304 | |
300 | int format_bytes(char *, size_t, uint64_t); | | 305 | int format_bytes(char *, size_t, uint64_t); |
301 | | | 306 | |
302 | void tablefull(const char *, const char *); | | 307 | void tablefull(const char *, const char *); |
303 | | | 308 | |
304 | #if defined(_KERNEL) && defined(KASAN) | | 309 | #if defined(_KERNEL) && defined(KASAN) |
305 | int kasan_kcopy(const void *, void *, size_t); | | 310 | int kasan_kcopy(const void *, void *, size_t); |
306 | #define kcopy kasan_kcopy | | 311 | #define kcopy kasan_kcopy |
307 | #elif defined(_KERNEL) && defined(KCSAN) | | 312 | #elif defined(_KERNEL) && defined(KCSAN) |
308 | int kcsan_kcopy(const void *, void *, size_t); | | 313 | int kcsan_kcopy(const void *, void *, size_t); |
309 | #define kcopy kcsan_kcopy | | 314 | #define kcopy kcsan_kcopy |
310 | #elif defined(_KERNEL) && defined(KMSAN) | | 315 | #elif defined(_KERNEL) && defined(KMSAN) |
311 | int kmsan_kcopy(const void *, void *, size_t); | | 316 | int kmsan_kcopy(const void *, void *, size_t); |
312 | #define kcopy kmsan_kcopy | | 317 | #define kcopy kmsan_kcopy |
313 | #else | | 318 | #else |
314 | int kcopy(const void *, void *, size_t); | | 319 | int kcopy(const void *, void *, size_t); |
315 | #endif | | 320 | #endif |
316 | | | 321 | |
317 | #ifdef _KERNEL | | 322 | #ifdef _KERNEL |
318 | #define bcopy(src, dst, len) memcpy((dst), (src), (len)) | | 323 | #define bcopy(src, dst, len) memcpy((dst), (src), (len)) |
319 | #define bzero(src, len) memset((src), 0, (len)) | | 324 | #define bzero(src, len) memset((src), 0, (len)) |
320 | #define bcmp(a, b, len) memcmp((a), (b), (len)) | | 325 | #define bcmp(a, b, len) memcmp((a), (b), (len)) |
321 | #endif /* KERNEL */ | | 326 | #endif /* KERNEL */ |
322 | | | 327 | |
323 | int copystr(const void *, void *, size_t, size_t *); | | 328 | int copystr(const void *, void *, size_t, size_t *); |
324 | #if defined(_KERNEL) && defined(KASAN) | | 329 | #if defined(_KERNEL) && defined(KASAN) |
325 | int kasan_copyinstr(const void *, void *, size_t, size_t *); | | 330 | int kasan_copyinstr(const void *, void *, size_t, size_t *); |
326 | int kasan_copyoutstr(const void *, void *, size_t, size_t *); | | 331 | int kasan_copyoutstr(const void *, void *, size_t, size_t *); |
327 | int kasan_copyin(const void *, void *, size_t); | | 332 | int kasan_copyin(const void *, void *, size_t); |
328 | int copyout(const void *, void *, size_t); | | 333 | int copyout(const void *, void *, size_t); |
329 | #define copyinstr kasan_copyinstr | | 334 | #define copyinstr kasan_copyinstr |
330 | #define copyoutstr kasan_copyoutstr | | 335 | #define copyoutstr kasan_copyoutstr |
331 | #define copyin kasan_copyin | | 336 | #define copyin kasan_copyin |
332 | #elif defined(_KERNEL) && defined(KCSAN) | | 337 | #elif defined(_KERNEL) && defined(KCSAN) |
333 | int kcsan_copyinstr(const void *, void *, size_t, size_t *); | | 338 | int kcsan_copyinstr(const void *, void *, size_t, size_t *); |
334 | int kcsan_copyoutstr(const void *, void *, size_t, size_t *); | | 339 | int kcsan_copyoutstr(const void *, void *, size_t, size_t *); |
335 | int kcsan_copyin(const void *, void *, size_t); | | 340 | int kcsan_copyin(const void *, void *, size_t); |
336 | int kcsan_copyout(const void *, void *, size_t); | | 341 | int kcsan_copyout(const void *, void *, size_t); |
337 | #define copyinstr kcsan_copyinstr | | 342 | #define copyinstr kcsan_copyinstr |
338 | #define copyoutstr kcsan_copyoutstr | | 343 | #define copyoutstr kcsan_copyoutstr |
339 | #define copyin kcsan_copyin | | 344 | #define copyin kcsan_copyin |
340 | #define copyout kcsan_copyout | | 345 | #define copyout kcsan_copyout |
341 | #elif defined(_KERNEL) && defined(KMSAN) | | 346 | #elif defined(_KERNEL) && defined(KMSAN) |
342 | int kmsan_copyinstr(const void *, void *, size_t, size_t *); | | 347 | int kmsan_copyinstr(const void *, void *, size_t, size_t *); |
343 | int kmsan_copyoutstr(const void *, void *, size_t, size_t *); | | 348 | int kmsan_copyoutstr(const void *, void *, size_t, size_t *); |
344 | int kmsan_copyin(const void *, void *, size_t); | | 349 | int kmsan_copyin(const void *, void *, size_t); |
345 | int kmsan_copyout(const void *, void *, size_t); | | 350 | int kmsan_copyout(const void *, void *, size_t); |
346 | #define copyinstr kmsan_copyinstr | | 351 | #define copyinstr kmsan_copyinstr |
347 | #define copyoutstr kmsan_copyoutstr | | 352 | #define copyoutstr kmsan_copyoutstr |
348 | #define copyin kmsan_copyin | | 353 | #define copyin kmsan_copyin |
349 | #define copyout kmsan_copyout | | 354 | #define copyout kmsan_copyout |
350 | #else | | 355 | #else |
351 | int copyinstr(const void *, void *, size_t, size_t *); | | 356 | int copyinstr(const void *, void *, size_t, size_t *); |
352 | int copyoutstr(const void *, void *, size_t, size_t *); | | 357 | int copyoutstr(const void *, void *, size_t, size_t *); |
353 | int copyin(const void *, void *, size_t); | | 358 | int copyin(const void *, void *, size_t); |
354 | int copyout(const void *, void *, size_t); | | 359 | int copyout(const void *, void *, size_t); |
355 | #endif | | 360 | #endif |
356 | | | 361 | |
357 | #ifdef _KERNEL | | 362 | #ifdef _KERNEL |
358 | typedef int (*copyin_t)(const void *, void *, size_t); | | 363 | typedef int (*copyin_t)(const void *, void *, size_t); |
359 | typedef int (*copyout_t)(const void *, void *, size_t); | | 364 | typedef int (*copyout_t)(const void *, void *, size_t); |
360 | #endif | | 365 | #endif |
361 | | | 366 | |
362 | int copyin_proc(struct proc *, const void *, void *, size_t); | | 367 | int copyin_proc(struct proc *, const void *, void *, size_t); |
363 | int copyout_proc(struct proc *, const void *, void *, size_t); | | 368 | int copyout_proc(struct proc *, const void *, void *, size_t); |
364 | int copyin_pid(pid_t, const void *, void *, size_t); | | 369 | int copyin_pid(pid_t, const void *, void *, size_t); |
365 | int copyin_vmspace(struct vmspace *, const void *, void *, size_t); | | 370 | int copyin_vmspace(struct vmspace *, const void *, void *, size_t); |
366 | int copyout_vmspace(struct vmspace *, const void *, void *, size_t); | | 371 | int copyout_vmspace(struct vmspace *, const void *, void *, size_t); |
367 | | | 372 | |
368 | int ioctl_copyin(int ioctlflags, const void *src, void *dst, size_t len); | | 373 | int ioctl_copyin(int ioctlflags, const void *src, void *dst, size_t len); |
369 | int ioctl_copyout(int ioctlflags, const void *src, void *dst, size_t len); | | 374 | int ioctl_copyout(int ioctlflags, const void *src, void *dst, size_t len); |
370 | | | 375 | |
371 | int ucas_32(volatile uint32_t *, uint32_t, uint32_t, uint32_t *); | | 376 | int ucas_32(volatile uint32_t *, uint32_t, uint32_t, uint32_t *); |
372 | #ifdef _LP64 | | 377 | #ifdef _LP64 |
373 | int ucas_64(volatile uint64_t *, uint64_t, uint64_t, uint64_t *); | | 378 | int ucas_64(volatile uint64_t *, uint64_t, uint64_t, uint64_t *); |
374 | #endif | | 379 | #endif |
375 | int ucas_ptr(volatile void *, void *, void *, void *); | | 380 | int ucas_ptr(volatile void *, void *, void *, void *); |
376 | int ucas_int(volatile unsigned int *, unsigned int, unsigned int, | | 381 | int ucas_int(volatile unsigned int *, unsigned int, unsigned int, |
377 | unsigned int *); | | 382 | unsigned int *); |
378 | int ufetch_8(const uint8_t *, uint8_t *); | | 383 | int ufetch_8(const uint8_t *, uint8_t *); |
379 | int ufetch_16(const uint16_t *, uint16_t *); | | 384 | int ufetch_16(const uint16_t *, uint16_t *); |
380 | int ufetch_32(const uint32_t *, uint32_t *); | | 385 | int ufetch_32(const uint32_t *, uint32_t *); |
381 | #ifdef _LP64 | | 386 | #ifdef _LP64 |
382 | int ufetch_64(const uint64_t *, uint64_t *); | | 387 | int ufetch_64(const uint64_t *, uint64_t *); |
383 | #endif | | 388 | #endif |
384 | int ufetch_char(const unsigned char *, unsigned char *); | | 389 | int ufetch_char(const unsigned char *, unsigned char *); |
385 | int ufetch_short(const unsigned short *, unsigned short *); | | 390 | int ufetch_short(const unsigned short *, unsigned short *); |
386 | int ufetch_int(const unsigned int *, unsigned int *); | | 391 | int ufetch_int(const unsigned int *, unsigned int *); |
387 | int ufetch_long(const unsigned long *, unsigned long *); | | 392 | int ufetch_long(const unsigned long *, unsigned long *); |
388 | int ufetch_ptr(const void **, void **); | | 393 | int ufetch_ptr(const void **, void **); |
389 | int ustore_8(uint8_t *, uint8_t); | | 394 | int ustore_8(uint8_t *, uint8_t); |
390 | int ustore_16(uint16_t *, uint16_t); | | 395 | int ustore_16(uint16_t *, uint16_t); |
391 | int ustore_32(uint32_t *, uint32_t); | | 396 | int ustore_32(uint32_t *, uint32_t); |
392 | #ifdef _LP64 | | 397 | #ifdef _LP64 |
393 | int ustore_64(uint64_t *, uint64_t); | | 398 | int ustore_64(uint64_t *, uint64_t); |
394 | #endif | | 399 | #endif |
395 | int ustore_char(unsigned char *, unsigned char); | | 400 | int ustore_char(unsigned char *, unsigned char); |
396 | int ustore_short(unsigned short *, unsigned short); | | 401 | int ustore_short(unsigned short *, unsigned short); |
397 | int ustore_int(unsigned int *, unsigned int); | | 402 | int ustore_int(unsigned int *, unsigned int); |
398 | int ustore_long(unsigned long *, unsigned long); | | 403 | int ustore_long(unsigned long *, unsigned long); |
399 | int ustore_ptr(void **, void *); | | 404 | int ustore_ptr(void **, void *); |
400 | | | 405 | |
401 | #ifdef __UCAS_PRIVATE | | 406 | #ifdef __UCAS_PRIVATE |
402 | | | 407 | |
403 | #if defined(__HAVE_UCAS_FULL) && defined(KASAN) | | 408 | #if defined(__HAVE_UCAS_FULL) && defined(KASAN) |
404 | int kasan__ucas_32(volatile uint32_t *, uint32_t, uint32_t, uint32_t *); | | 409 | int kasan__ucas_32(volatile uint32_t *, uint32_t, uint32_t, uint32_t *); |
405 | #ifdef __HAVE_UCAS_MP | | 410 | #ifdef __HAVE_UCAS_MP |
406 | int kasan__ucas_32_mp(volatile uint32_t *, uint32_t, uint32_t, uint32_t *); | | 411 | int kasan__ucas_32_mp(volatile uint32_t *, uint32_t, uint32_t, uint32_t *); |
407 | #endif /* __HAVE_UCAS_MP */ | | 412 | #endif /* __HAVE_UCAS_MP */ |
408 | #ifdef _LP64 | | 413 | #ifdef _LP64 |
409 | int kasan__ucas_64(volatile uint64_t *, uint64_t, uint64_t, uint64_t *); | | 414 | int kasan__ucas_64(volatile uint64_t *, uint64_t, uint64_t, uint64_t *); |
410 | #ifdef __HAVE_UCAS_MP | | 415 | #ifdef __HAVE_UCAS_MP |
411 | int kasan__ucas_64_mp(volatile uint64_t *, uint64_t, uint64_t, uint64_t *); | | 416 | int kasan__ucas_64_mp(volatile uint64_t *, uint64_t, uint64_t, uint64_t *); |
412 | #endif /* __HAVE_UCAS_MP */ | | 417 | #endif /* __HAVE_UCAS_MP */ |
413 | #endif /* _LP64 */ | | 418 | #endif /* _LP64 */ |
414 | #define _ucas_32 kasan__ucas_32 | | 419 | #define _ucas_32 kasan__ucas_32 |
415 | #define _ucas_32_mp kasan__ucas_32_mp | | 420 | #define _ucas_32_mp kasan__ucas_32_mp |
416 | #define _ucas_64 kasan__ucas_64 | | 421 | #define _ucas_64 kasan__ucas_64 |
417 | #define _ucas_64_mp kasan__ucas_64_mp | | 422 | #define _ucas_64_mp kasan__ucas_64_mp |
418 | #elif defined(__HAVE_UCAS_FULL) && defined(KMSAN) | | 423 | #elif defined(__HAVE_UCAS_FULL) && defined(KMSAN) |
419 | int kmsan__ucas_32(volatile uint32_t *, uint32_t, uint32_t, uint32_t *); | | 424 | int kmsan__ucas_32(volatile uint32_t *, uint32_t, uint32_t, uint32_t *); |
420 | #ifdef __HAVE_UCAS_MP | | 425 | #ifdef __HAVE_UCAS_MP |
421 | int kmsan__ucas_32_mp(volatile uint32_t *, uint32_t, uint32_t, uint32_t *); | | 426 | int kmsan__ucas_32_mp(volatile uint32_t *, uint32_t, uint32_t, uint32_t *); |
422 | #endif /* __HAVE_UCAS_MP */ | | 427 | #endif /* __HAVE_UCAS_MP */ |
423 | #ifdef _LP64 | | 428 | #ifdef _LP64 |
424 | int kmsan__ucas_64(volatile uint64_t *, uint64_t, uint64_t, uint64_t *); | | 429 | int kmsan__ucas_64(volatile uint64_t *, uint64_t, uint64_t, uint64_t *); |
425 | #ifdef __HAVE_UCAS_MP | | 430 | #ifdef __HAVE_UCAS_MP |
426 | int kmsan__ucas_64_mp(volatile uint64_t *, uint64_t, uint64_t, uint64_t *); | | 431 | int kmsan__ucas_64_mp(volatile uint64_t *, uint64_t, uint64_t, uint64_t *); |
427 | #endif /* __HAVE_UCAS_MP */ | | 432 | #endif /* __HAVE_UCAS_MP */ |
428 | #endif /* _LP64 */ | | 433 | #endif /* _LP64 */ |
429 | #define _ucas_32 kmsan__ucas_32 | | 434 | #define _ucas_32 kmsan__ucas_32 |
430 | #define _ucas_32_mp kmsan__ucas_32_mp | | 435 | #define _ucas_32_mp kmsan__ucas_32_mp |
431 | #define _ucas_64 kmsan__ucas_64 | | 436 | #define _ucas_64 kmsan__ucas_64 |
432 | #define _ucas_64_mp kmsan__ucas_64_mp | | 437 | #define _ucas_64_mp kmsan__ucas_64_mp |
433 | #else | | 438 | #else |
434 | int _ucas_32(volatile uint32_t *, uint32_t, uint32_t, uint32_t *); | | 439 | int _ucas_32(volatile uint32_t *, uint32_t, uint32_t, uint32_t *); |
435 | #ifdef __HAVE_UCAS_MP | | 440 | #ifdef __HAVE_UCAS_MP |
436 | int _ucas_32_mp(volatile uint32_t *, uint32_t, uint32_t, uint32_t *); | | 441 | int _ucas_32_mp(volatile uint32_t *, uint32_t, uint32_t, uint32_t *); |
437 | #endif /* __HAVE_UCAS_MP */ | | 442 | #endif /* __HAVE_UCAS_MP */ |
438 | #ifdef _LP64 | | 443 | #ifdef _LP64 |
439 | int _ucas_64(volatile uint64_t *, uint64_t, uint64_t, uint64_t *); | | 444 | int _ucas_64(volatile uint64_t *, uint64_t, uint64_t, uint64_t *); |
440 | #ifdef __HAVE_UCAS_MP | | 445 | #ifdef __HAVE_UCAS_MP |
441 | int _ucas_64_mp(volatile uint64_t *, uint64_t, uint64_t, uint64_t *); | | 446 | int _ucas_64_mp(volatile uint64_t *, uint64_t, uint64_t, uint64_t *); |
442 | #endif /* __HAVE_UCAS_MP */ | | 447 | #endif /* __HAVE_UCAS_MP */ |
443 | #endif /* _LP64 */ | | 448 | #endif /* _LP64 */ |
444 | #endif | | 449 | #endif |
445 | | | 450 | |
446 | #endif /* __UCAS_PRIVATE */ | | 451 | #endif /* __UCAS_PRIVATE */ |
447 | | | 452 | |
448 | #ifdef __UFETCHSTORE_PRIVATE | | 453 | #ifdef __UFETCHSTORE_PRIVATE |
449 | | | 454 | |
450 | #if defined(KASAN) | | 455 | #if defined(KASAN) |
451 | int kasan__ufetch_8(const uint8_t *, uint8_t *); | | 456 | int kasan__ufetch_8(const uint8_t *, uint8_t *); |
452 | int kasan__ufetch_16(const uint16_t *, uint16_t *); | | 457 | int kasan__ufetch_16(const uint16_t *, uint16_t *); |
453 | int kasan__ufetch_32(const uint32_t *, uint32_t *); | | 458 | int kasan__ufetch_32(const uint32_t *, uint32_t *); |
454 | #ifdef _LP64 | | 459 | #ifdef _LP64 |
455 | int kasan__ufetch_64(const uint64_t *, uint64_t *); | | 460 | int kasan__ufetch_64(const uint64_t *, uint64_t *); |
456 | #endif | | 461 | #endif |
457 | int _ustore_8(uint8_t *, uint8_t); | | 462 | int _ustore_8(uint8_t *, uint8_t); |
458 | int _ustore_16(uint16_t *, uint16_t); | | 463 | int _ustore_16(uint16_t *, uint16_t); |
459 | int _ustore_32(uint32_t *, uint32_t); | | 464 | int _ustore_32(uint32_t *, uint32_t); |
460 | #ifdef _LP64 | | 465 | #ifdef _LP64 |
461 | int _ustore_64(uint64_t *, uint64_t); | | 466 | int _ustore_64(uint64_t *, uint64_t); |
462 | #endif | | 467 | #endif |
463 | #define _ufetch_8 kasan__ufetch_8 | | 468 | #define _ufetch_8 kasan__ufetch_8 |
464 | #define _ufetch_16 kasan__ufetch_16 | | 469 | #define _ufetch_16 kasan__ufetch_16 |
465 | #define _ufetch_32 kasan__ufetch_32 | | 470 | #define _ufetch_32 kasan__ufetch_32 |
466 | #define _ufetch_64 kasan__ufetch_64 | | 471 | #define _ufetch_64 kasan__ufetch_64 |
467 | #elif defined(KMSAN) | | 472 | #elif defined(KMSAN) |
468 | int kmsan__ufetch_8(const uint8_t *, uint8_t *); | | 473 | int kmsan__ufetch_8(const uint8_t *, uint8_t *); |
469 | int kmsan__ufetch_16(const uint16_t *, uint16_t *); | | 474 | int kmsan__ufetch_16(const uint16_t *, uint16_t *); |
470 | int kmsan__ufetch_32(const uint32_t *, uint32_t *); | | 475 | int kmsan__ufetch_32(const uint32_t *, uint32_t *); |
471 | #ifdef _LP64 | | 476 | #ifdef _LP64 |
472 | int kmsan__ufetch_64(const uint64_t *, uint64_t *); | | 477 | int kmsan__ufetch_64(const uint64_t *, uint64_t *); |
473 | #endif | | 478 | #endif |
474 | int kmsan__ustore_8(uint8_t *, uint8_t); | | 479 | int kmsan__ustore_8(uint8_t *, uint8_t); |
475 | int kmsan__ustore_16(uint16_t *, uint16_t); | | 480 | int kmsan__ustore_16(uint16_t *, uint16_t); |
476 | int kmsan__ustore_32(uint32_t *, uint32_t); | | 481 | int kmsan__ustore_32(uint32_t *, uint32_t); |
477 | #ifdef _LP64 | | 482 | #ifdef _LP64 |
478 | int kmsan__ustore_64(uint64_t *, uint64_t); | | 483 | int kmsan__ustore_64(uint64_t *, uint64_t); |
479 | #endif | | 484 | #endif |
480 | #define _ufetch_8 kmsan__ufetch_8 | | 485 | #define _ufetch_8 kmsan__ufetch_8 |
481 | #define _ufetch_16 kmsan__ufetch_16 | | 486 | #define _ufetch_16 kmsan__ufetch_16 |
482 | #define _ufetch_32 kmsan__ufetch_32 | | 487 | #define _ufetch_32 kmsan__ufetch_32 |
483 | #define _ufetch_64 kmsan__ufetch_64 | | 488 | #define _ufetch_64 kmsan__ufetch_64 |
484 | #define _ustore_8 kmsan__ustore_8 | | 489 | #define _ustore_8 kmsan__ustore_8 |
485 | #define _ustore_16 kmsan__ustore_16 | | 490 | #define _ustore_16 kmsan__ustore_16 |
486 | #define _ustore_32 kmsan__ustore_32 | | 491 | #define _ustore_32 kmsan__ustore_32 |
487 | #define _ustore_64 kmsan__ustore_64 | | 492 | #define _ustore_64 kmsan__ustore_64 |
488 | #else | | 493 | #else |
489 | int _ufetch_8(const uint8_t *, uint8_t *); | | 494 | int _ufetch_8(const uint8_t *, uint8_t *); |
490 | int _ufetch_16(const uint16_t *, uint16_t *); | | 495 | int _ufetch_16(const uint16_t *, uint16_t *); |
491 | int _ufetch_32(const uint32_t *, uint32_t *); | | 496 | int _ufetch_32(const uint32_t *, uint32_t *); |
492 | #ifdef _LP64 | | 497 | #ifdef _LP64 |
493 | int _ufetch_64(const uint64_t *, uint64_t *); | | 498 | int _ufetch_64(const uint64_t *, uint64_t *); |
494 | #endif | | 499 | #endif |
495 | int _ustore_8(uint8_t *, uint8_t); | | 500 | int _ustore_8(uint8_t *, uint8_t); |
496 | int _ustore_16(uint16_t *, uint16_t); | | 501 | int _ustore_16(uint16_t *, uint16_t); |
497 | int _ustore_32(uint32_t *, uint32_t); | | 502 | int _ustore_32(uint32_t *, uint32_t); |
498 | #ifdef _LP64 | | 503 | #ifdef _LP64 |
499 | int _ustore_64(uint64_t *, uint64_t); | | 504 | int _ustore_64(uint64_t *, uint64_t); |
500 | #endif | | 505 | #endif |
501 | #endif | | 506 | #endif |
502 | | | 507 | |
503 | #endif /* __UFETCHSTORE_PRIVATE */ | | 508 | #endif /* __UFETCHSTORE_PRIVATE */ |
504 | | | 509 | |
505 | void hardclock(struct clockframe *); | | 510 | void hardclock(struct clockframe *); |
506 | void softclock(void *); | | 511 | void softclock(void *); |
507 | void statclock(struct clockframe *); | | 512 | void statclock(struct clockframe *); |
508 | | | 513 | |
509 | #ifdef NTP | | 514 | #ifdef NTP |
510 | void ntp_init(void); | | 515 | void ntp_init(void); |
511 | #ifdef PPS_SYNC | | 516 | #ifdef PPS_SYNC |
512 | struct timespec; | | 517 | struct timespec; |
513 | void hardpps(struct timespec *, long); | | 518 | void hardpps(struct timespec *, long); |
514 | #endif /* PPS_SYNC */ | | 519 | #endif /* PPS_SYNC */ |
515 | #else | | 520 | #else |
516 | void ntp_init(void); /* also provides adjtime() functionality */ | | 521 | void ntp_init(void); /* also provides adjtime() functionality */ |
517 | #endif /* NTP */ | | 522 | #endif /* NTP */ |
518 | | | 523 | |
519 | void ssp_init(void); | | 524 | void ssp_init(void); |
520 | | | 525 | |
521 | void initclocks(void); | | 526 | void initclocks(void); |
522 | void inittodr(time_t); | | 527 | void inittodr(time_t); |
523 | void resettodr(void); | | 528 | void resettodr(void); |
524 | void cpu_initclocks(void); | | 529 | void cpu_initclocks(void); |
525 | void setrootfstime(time_t); | | 530 | void setrootfstime(time_t); |
526 | | | 531 | |
527 | void startprofclock(struct proc *); | | 532 | void startprofclock(struct proc *); |
528 | void stopprofclock(struct proc *); | | 533 | void stopprofclock(struct proc *); |
529 | void proftick(struct clockframe *); | | 534 | void proftick(struct clockframe *); |
530 | void setstatclockrate(int); | | 535 | void setstatclockrate(int); |
531 | | | 536 | |
532 | /* | | 537 | /* |
533 | * Critical polling hooks. Functions to be run while the kernel stays | | 538 | * Critical polling hooks. Functions to be run while the kernel stays |
534 | * elevated IPL for a "long" time. (watchdogs). | | 539 | * elevated IPL for a "long" time. (watchdogs). |
535 | */ | | 540 | */ |
536 | void *critpollhook_establish(void (*)(void *), void *); | | 541 | void *critpollhook_establish(void (*)(void *), void *); |
537 | void critpollhook_disestablish(void *); | | 542 | void critpollhook_disestablish(void *); |
538 | void docritpollhooks(void); | | 543 | void docritpollhooks(void); |
539 | | | 544 | |
540 | /* | | 545 | /* |
541 | * Shutdown hooks. Functions to be run with all interrupts disabled | | 546 | * Shutdown hooks. Functions to be run with all interrupts disabled |
542 | * immediately before the system is halted or rebooted. | | 547 | * immediately before the system is halted or rebooted. |
543 | */ | | 548 | */ |
544 | void *shutdownhook_establish(void (*)(void *), void *); | | 549 | void *shutdownhook_establish(void (*)(void *), void *); |
545 | void shutdownhook_disestablish(void *); | | 550 | void shutdownhook_disestablish(void *); |
546 | void doshutdownhooks(void); | | 551 | void doshutdownhooks(void); |
547 | | | 552 | |
548 | /* | | 553 | /* |
549 | * Power management hooks. | | 554 | * Power management hooks. |
550 | */ | | 555 | */ |
551 | void *powerhook_establish(const char *, void (*)(int, void *), void *); | | 556 | void *powerhook_establish(const char *, void (*)(int, void *), void *); |
552 | void powerhook_disestablish(void *); | | 557 | void powerhook_disestablish(void *); |
553 | void dopowerhooks(int); | | 558 | void dopowerhooks(int); |
554 | #define PWR_RESUME 0 | | 559 | #define PWR_RESUME 0 |
555 | #define PWR_SUSPEND 1 | | 560 | #define PWR_SUSPEND 1 |
556 | #define PWR_STANDBY 2 | | 561 | #define PWR_STANDBY 2 |
557 | #define PWR_SOFTRESUME 3 | | 562 | #define PWR_SOFTRESUME 3 |
558 | #define PWR_SOFTSUSPEND 4 | | 563 | #define PWR_SOFTSUSPEND 4 |
559 | #define PWR_SOFTSTANDBY 5 | | 564 | #define PWR_SOFTSTANDBY 5 |
560 | #define PWR_NAMES \ | | 565 | #define PWR_NAMES \ |
561 | "resume", /* 0 */ \ | | 566 | "resume", /* 0 */ \ |
562 | "suspend", /* 1 */ \ | | 567 | "suspend", /* 1 */ \ |
563 | "standby", /* 2 */ \ | | 568 | "standby", /* 2 */ \ |
564 | "softresume", /* 3 */ \ | | 569 | "softresume", /* 3 */ \ |
565 | "softsuspend", /* 4 */ \ | | 570 | "softsuspend", /* 4 */ \ |
566 | "softstandby" /* 5 */ | | 571 | "softstandby" /* 5 */ |
567 | | | 572 | |
568 | /* | | 573 | /* |
569 | * Mountroot hooks (and mountroot declaration). Device drivers establish | | 574 | * Mountroot hooks (and mountroot declaration). Device drivers establish |
570 | * these to be executed just before (*mountroot)() if the passed device is | | 575 | * these to be executed just before (*mountroot)() if the passed device is |
571 | * selected as the root device. | | 576 | * selected as the root device. |
572 | */ | | 577 | */ |
573 | | | 578 | |
574 | #define ROOT_FSTYPE_ANY "?" | | 579 | #define ROOT_FSTYPE_ANY "?" |
575 | | | 580 | |
576 | extern const char *rootfstype; | | 581 | extern const char *rootfstype; |
577 | void *mountroothook_establish(void (*)(device_t), device_t); | | 582 | void *mountroothook_establish(void (*)(device_t), device_t); |
578 | void mountroothook_disestablish(void *); | | 583 | void mountroothook_disestablish(void *); |
579 | void mountroothook_destroy(void); | | 584 | void mountroothook_destroy(void); |
580 | void domountroothook(device_t); | | 585 | void domountroothook(device_t); |
581 | | | 586 | |
582 | /* | | 587 | /* |
583 | * Exec hooks. Subsystems may want to do cleanup when a process | | 588 | * Exec hooks. Subsystems may want to do cleanup when a process |
584 | * execs. | | 589 | * execs. |
585 | */ | | 590 | */ |
586 | void *exechook_establish(void (*)(struct proc *, void *), void *); | | 591 | void *exechook_establish(void (*)(struct proc *, void *), void *); |
587 | void exechook_disestablish(void *); | | 592 | void exechook_disestablish(void *); |
588 | void doexechooks(struct proc *); | | 593 | void doexechooks(struct proc *); |
589 | | | 594 | |
590 | /* | | 595 | /* |
591 | * Exit hooks. Subsystems may want to do cleanup when a process exits. | | 596 | * Exit hooks. Subsystems may want to do cleanup when a process exits. |
592 | */ | | 597 | */ |
593 | void *exithook_establish(void (*)(struct proc *, void *), void *); | | 598 | void *exithook_establish(void (*)(struct proc *, void *), void *); |
594 | void exithook_disestablish(void *); | | 599 | void exithook_disestablish(void *); |
595 | void doexithooks(struct proc *); | | 600 | void doexithooks(struct proc *); |
596 | | | 601 | |
597 | /* | | 602 | /* |
598 | * Fork hooks. Subsystems may want to do special processing when a process | | 603 | * Fork hooks. Subsystems may want to do special processing when a process |
599 | * forks. | | 604 | * forks. |
600 | */ | | 605 | */ |
601 | void *forkhook_establish(void (*)(struct proc *, struct proc *)); | | 606 | void *forkhook_establish(void (*)(struct proc *, struct proc *)); |
602 | void forkhook_disestablish(void *); | | 607 | void forkhook_disestablish(void *); |
603 | void doforkhooks(struct proc *, struct proc *); | | 608 | void doforkhooks(struct proc *, struct proc *); |
604 | | | 609 | |
605 | /* | | 610 | /* |
606 | * kernel syscall tracing/debugging hooks. | | 611 | * kernel syscall tracing/debugging hooks. |
607 | */ | | 612 | */ |
608 | #ifdef _KERNEL | | 613 | #ifdef _KERNEL |
609 | bool trace_is_enabled(struct proc *); | | 614 | bool trace_is_enabled(struct proc *); |
610 | int trace_enter(register_t, const struct sysent *, const void *); | | 615 | int trace_enter(register_t, const struct sysent *, const void *); |
611 | void trace_exit(register_t, const struct sysent *, const void *, | | 616 | void trace_exit(register_t, const struct sysent *, const void *, |
612 | register_t [], int); | | 617 | register_t [], int); |
613 | #endif | | 618 | #endif |
614 | | | 619 | |
615 | int uiomove(void *, size_t, struct uio *); | | 620 | int uiomove(void *, size_t, struct uio *); |
616 | int uiomove_frombuf(void *, size_t, struct uio *); | | 621 | int uiomove_frombuf(void *, size_t, struct uio *); |
617 | | | 622 | |
618 | #ifdef _KERNEL | | 623 | #ifdef _KERNEL |
619 | int setjmp(label_t *) __returns_twice; | | 624 | int setjmp(label_t *) __returns_twice; |
620 | void longjmp(label_t *) __dead; | | 625 | void longjmp(label_t *) __dead; |
621 | #endif | | 626 | #endif |
622 | | | 627 | |
623 | void consinit(void); | | 628 | void consinit(void); |
624 | | | 629 | |
625 | void cpu_startup(void); | | 630 | void cpu_startup(void); |
626 | void cpu_configure(void); | | 631 | void cpu_configure(void); |
627 | void cpu_bootconf(void); | | 632 | void cpu_bootconf(void); |
628 | void cpu_rootconf(void); | | 633 | void cpu_rootconf(void); |
629 | void cpu_dumpconf(void); | | 634 | void cpu_dumpconf(void); |
630 | | | 635 | |
631 | #ifdef GPROF | | 636 | #ifdef GPROF |
632 | void kmstartup(void); | | 637 | void kmstartup(void); |
633 | #endif | | 638 | #endif |
634 | | | 639 | |
635 | void machdep_init(void); | | 640 | void machdep_init(void); |
636 | | | 641 | |
637 | #ifdef _KERNEL | | 642 | #ifdef _KERNEL |
638 | #include <lib/libkern/libkern.h> | | 643 | #include <lib/libkern/libkern.h> |
639 | | | 644 | |
640 | /* | | 645 | /* |
641 | * Stuff to handle debugger magic key sequences. | | 646 | * Stuff to handle debugger magic key sequences. |
642 | */ | | 647 | */ |
643 | #define CNS_LEN 128 | | 648 | #define CNS_LEN 128 |
644 | #define CNS_MAGIC_VAL(x) ((x)&0x1ff) | | 649 | #define CNS_MAGIC_VAL(x) ((x)&0x1ff) |
645 | #define CNS_MAGIC_NEXT(x) (((x)>>9)&0x7f) | | 650 | #define CNS_MAGIC_NEXT(x) (((x)>>9)&0x7f) |
646 | #define CNS_TERM 0x7f /* End of sequence */ | | 651 | #define CNS_TERM 0x7f /* End of sequence */ |
647 | | | 652 | |
648 | typedef struct cnm_state { | | 653 | typedef struct cnm_state { |
649 | int cnm_state; | | 654 | int cnm_state; |
650 | u_short *cnm_magic; | | 655 | u_short *cnm_magic; |
651 | } cnm_state_t; | | 656 | } cnm_state_t; |
652 | | | 657 | |
653 | /* Override db_console() in MD headers */ | | 658 | /* Override db_console() in MD headers */ |
654 | #ifndef cn_trap | | 659 | #ifndef cn_trap |
655 | #define cn_trap() console_debugger() | | 660 | #define cn_trap() console_debugger() |
656 | #endif | | 661 | #endif |
657 | #ifndef cn_isconsole | | 662 | #ifndef cn_isconsole |
658 | #ifndef WSDISPLAY_MULTICONS | | 663 | #ifndef WSDISPLAY_MULTICONS |
659 | #define cn_isconsole(d) (cn_tab != NULL && (d) == cn_tab->cn_dev) | | 664 | #define cn_isconsole(d) (cn_tab != NULL && (d) == cn_tab->cn_dev) |
660 | #else | | 665 | #else |
661 | bool wsdisplay_cn_isconsole(dev_t); | | 666 | bool wsdisplay_cn_isconsole(dev_t); |
662 | #define cn_isconsole(d) wsdisplay_cn_isconsole(d) | | 667 | #define cn_isconsole(d) wsdisplay_cn_isconsole(d) |
663 | #endif | | 668 | #endif |
664 | #endif | | 669 | #endif |
665 | | | 670 | |
666 | void cn_init_magic(cnm_state_t *); | | 671 | void cn_init_magic(cnm_state_t *); |
667 | void cn_destroy_magic(cnm_state_t *); | | 672 | void cn_destroy_magic(cnm_state_t *); |
668 | int cn_set_magic(const char *); | | 673 | int cn_set_magic(const char *); |
669 | int cn_get_magic(char *, size_t); | | 674 | int cn_get_magic(char *, size_t); |
670 | /* This should be called for each byte read */ | | 675 | /* This should be called for each byte read */ |
671 | #ifndef cn_check_magic | | 676 | #ifndef cn_check_magic |
672 | #define cn_check_magic(d, k, s) \ | | 677 | #define cn_check_magic(d, k, s) \ |
673 | do { \ | | 678 | do { \ |
674 | if (cn_isconsole(d)) { \ | | 679 | if (cn_isconsole(d)) { \ |
675 | int _v = (s).cnm_magic[(s).cnm_state]; \ | | 680 | int _v = (s).cnm_magic[(s).cnm_state]; \ |
676 | if ((k) == CNS_MAGIC_VAL(_v)) { \ | | 681 | if ((k) == CNS_MAGIC_VAL(_v)) { \ |
677 | (s).cnm_state = CNS_MAGIC_NEXT(_v); \ | | 682 | (s).cnm_state = CNS_MAGIC_NEXT(_v); \ |
678 | if ((s).cnm_state == CNS_TERM) { \ | | 683 | if ((s).cnm_state == CNS_TERM) { \ |
679 | cn_trap(); \ | | 684 | cn_trap(); \ |
680 | (s).cnm_state = 0; \ | | 685 | (s).cnm_state = 0; \ |
681 | } \ | | 686 | } \ |
682 | } else { \ | | 687 | } else { \ |
683 | (s).cnm_state = 0; \ | | 688 | (s).cnm_state = 0; \ |
684 | } \ | | 689 | } \ |
685 | } \ | | 690 | } \ |
686 | } while (/* CONSTCOND */ 0) | | 691 | } while (/* CONSTCOND */ 0) |
687 | #endif | | 692 | #endif |
688 | | | 693 | |
689 | /* Encode out-of-band events this way when passing to cn_check_magic() */ | | 694 | /* Encode out-of-band events this way when passing to cn_check_magic() */ |
690 | #define CNC_BREAK 0x100 | | 695 | #define CNC_BREAK 0x100 |
691 | | | 696 | |
692 | #if defined(DDB) || defined(sun3) || defined(sun2) | | 697 | #if defined(DDB) || defined(sun3) || defined(sun2) |
693 | /* note that cpu_Debugger() is always available on sun[23] */ | | 698 | /* note that cpu_Debugger() is always available on sun[23] */ |
694 | void cpu_Debugger(void); | | 699 | void cpu_Debugger(void); |
695 | #define Debugger cpu_Debugger | | 700 | #define Debugger cpu_Debugger |
696 | #endif | | 701 | #endif |
697 | | | 702 | |
698 | #ifdef DDB | | 703 | #ifdef DDB |
699 | /* | | 704 | /* |
700 | * Enter debugger(s) from console attention if enabled | | 705 | * Enter debugger(s) from console attention if enabled |
701 | */ | | 706 | */ |
702 | extern int db_fromconsole; /* XXX ddb/ddbvar.h */ | | 707 | extern int db_fromconsole; /* XXX ddb/ddbvar.h */ |
703 | #define console_debugger() if (db_fromconsole) Debugger() | | 708 | #define console_debugger() if (db_fromconsole) Debugger() |
704 | #elif defined(Debugger) | | 709 | #elif defined(Debugger) |
705 | #define console_debugger() Debugger() | | 710 | #define console_debugger() Debugger() |
706 | #else | | 711 | #else |
707 | #define console_debugger() do {} while (/* CONSTCOND */ 0) /* NOP */ | | 712 | #define console_debugger() do {} while (/* CONSTCOND */ 0) /* NOP */ |
708 | #endif | | 713 | #endif |
709 | | | 714 | |
710 | /* For SYSCALL_DEBUG */ | | 715 | /* For SYSCALL_DEBUG */ |
711 | void scdebug_init(void); | | 716 | void scdebug_init(void); |
712 | void scdebug_call(register_t, const register_t[]); | | 717 | void scdebug_call(register_t, const register_t[]); |
713 | void scdebug_ret(register_t, int, const register_t[]); | | 718 | void scdebug_ret(register_t, int, const register_t[]); |
714 | | | 719 | |
715 | void kernel_lock_init(void); | | 720 | void kernel_lock_init(void); |
716 | void _kernel_lock(int); | | 721 | void _kernel_lock(int); |
717 | void _kernel_unlock(int, int *); | | 722 | void _kernel_unlock(int, int *); |
718 | bool _kernel_locked_p(void); | | 723 | bool _kernel_locked_p(void); |
719 | | | 724 | |
720 | void kernconfig_lock_init(void); | | 725 | void kernconfig_lock_init(void); |
721 | void kernconfig_lock(void); | | 726 | void kernconfig_lock(void); |
722 | void kernconfig_unlock(void); | | 727 | void kernconfig_unlock(void); |
723 | bool kernconfig_is_held(void); | | 728 | bool kernconfig_is_held(void); |
724 | #endif | | 729 | #endif |
725 | | | 730 | |
726 | #if defined(MULTIPROCESSOR) || defined(_MODULE) | | 731 | #if defined(MULTIPROCESSOR) || defined(_MODULE) |
727 | #define KERNEL_LOCK(count, lwp) \ | | 732 | #define KERNEL_LOCK(count, lwp) \ |
728 | do { \ | | 733 | do { \ |
729 | if ((count) != 0) \ | | 734 | if ((count) != 0) \ |
730 | _kernel_lock((count)); \ | | 735 | _kernel_lock((count)); \ |
731 | } while (/* CONSTCOND */ 0) | | 736 | } while (/* CONSTCOND */ 0) |
732 | #define KERNEL_UNLOCK(all, lwp, p) _kernel_unlock((all), (p)) | | 737 | #define KERNEL_UNLOCK(all, lwp, p) _kernel_unlock((all), (p)) |
733 | #define KERNEL_LOCKED_P() _kernel_locked_p() | | 738 | #define KERNEL_LOCKED_P() _kernel_locked_p() |
734 | #else | | 739 | #else |
735 | #define KERNEL_LOCK(count, lwp) do {(void)(count); (void)(lwp);} while (/* CONSTCOND */ 0) /*NOP*/ | | 740 | #define KERNEL_LOCK(count, lwp) do {(void)(count); (void)(lwp);} while (/* CONSTCOND */ 0) /*NOP*/ |
736 | #define KERNEL_UNLOCK(all, lwp, ptr) do {(void)(all); (void)(lwp); (void)(ptr);} while (/* CONSTCOND */ 0) /*NOP*/ | | 741 | #define KERNEL_UNLOCK(all, lwp, ptr) do {(void)(all); (void)(lwp); (void)(ptr);} while (/* CONSTCOND */ 0) /*NOP*/ |
737 | #define KERNEL_LOCKED_P() (true) | | 742 | #define KERNEL_LOCKED_P() (true) |
738 | #endif | | 743 | #endif |
739 | | | 744 | |
740 | #define KERNEL_UNLOCK_LAST(l) KERNEL_UNLOCK(-1, (l), NULL) | | 745 | #define KERNEL_UNLOCK_LAST(l) KERNEL_UNLOCK(-1, (l), NULL) |
741 | #define KERNEL_UNLOCK_ALL(l, p) KERNEL_UNLOCK(0, (l), (p)) | | 746 | #define KERNEL_UNLOCK_ALL(l, p) KERNEL_UNLOCK(0, (l), (p)) |
742 | #define KERNEL_UNLOCK_ONE(l) KERNEL_UNLOCK(1, (l), NULL) | | 747 | #define KERNEL_UNLOCK_ONE(l) KERNEL_UNLOCK(1, (l), NULL) |
743 | | | 748 | |
744 | #ifdef _KERNEL | | 749 | #ifdef _KERNEL |
745 | /* Preemption control. */ | | 750 | /* Preemption control. */ |
746 | void kpreempt_disable(void); | | 751 | void kpreempt_disable(void); |
747 | void kpreempt_enable(void); | | 752 | void kpreempt_enable(void); |
748 | bool kpreempt_disabled(void); | | 753 | bool kpreempt_disabled(void); |
749 | | | 754 | |
750 | vaddr_t calc_cache_size(vsize_t , int, int); | | 755 | vaddr_t calc_cache_size(vsize_t , int, int); |
751 | #endif | | 756 | #endif |
752 | | | 757 | |
753 | void assert_sleepable(void); | | 758 | void assert_sleepable(void); |
754 | #if defined(DEBUG) | | 759 | #if defined(DEBUG) |
755 | #define ASSERT_SLEEPABLE() assert_sleepable() | | 760 | #define ASSERT_SLEEPABLE() assert_sleepable() |
756 | #else /* defined(DEBUG) */ | | 761 | #else /* defined(DEBUG) */ |
757 | #define ASSERT_SLEEPABLE() do {} while (0) | | 762 | #define ASSERT_SLEEPABLE() do {} while (0) |
758 | #endif /* defined(DEBUG) */ | | 763 | #endif /* defined(DEBUG) */ |
759 | | | 764 | |
760 | | | 765 | |
761 | #endif /* !_SYS_SYSTM_H_ */ | | 766 | #endif /* !_SYS_SYSTM_H_ */ |