]> git.saurik.com Git - apple/xnu.git/blob - osfmk/kern/misc_protos.h
0419d720c5cf398d6ceba1bf56b00687ee6b368e
[apple/xnu.git] / osfmk / kern / misc_protos.h
1 /*
2 * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
7 *
8 * This file contains Original Code and/or Modifications of Original Code
9 * as defined in and that are subject to the Apple Public Source License
10 * Version 2.0 (the 'License'). You may not use this file except in
11 * compliance with the License. Please obtain a copy of the License at
12 * http://www.opensource.apple.com/apsl/ and read it before using this
13 * file.
14 *
15 * The Original Code and all software distributed under the License are
16 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
17 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
18 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
20 * Please see the License for the specific language governing rights and
21 * limitations under the License.
22 *
23 * @APPLE_LICENSE_HEADER_END@
24 */
25 /*
26 * @OSF_COPYRIGHT@
27 */
28
29 #ifndef _MISC_PROTOS_H_
30 #define _MISC_PROTOS_H_
31
32 #include <stdarg.h>
33 #include <string.h>
34 #include <machine/setjmp.h>
35 #include <mach/boolean.h>
36 #include <mach/message.h>
37 #include <mach/machine/vm_types.h>
38 #include <ipc/ipc_types.h>
39
40 /* Set a bit in a bit array */
41 extern void setbit(
42 int which,
43 int *bitmap);
44
45 /* Clear a bit in a bit array */
46 extern void clrbit(
47 int which,
48 int *bitmap);
49
50 /* Find the first set bit in a bit array */
51 extern int ffsbit(
52 int *bitmap);
53 extern int ffs(
54 unsigned int mask);
55
56 /*
57 * Test if indicated bit is set in bit string.
58 */
59 extern int testbit(
60 int which,
61 int *bitmap);
62
63 /* Move arbitrarily-aligned data from one array to another */
64 extern void bcopy(
65 const char *from,
66 char *to,
67 vm_size_t nbytes);
68
69 /* Move overlapping, arbitrarily aligned data from one array to another */
70 /* Not present on all ports */
71 extern void ovbcopy(
72 const char *from,
73 char *to,
74 vm_size_t nbytes);
75
76 extern int bcmp(
77 const char *a,
78 const char *b,
79 vm_size_t len);
80
81 /* Zero an arbitrarily aligned array */
82 extern void bzero(
83 char *from,
84 vm_size_t nbytes);
85
86 /* Move arbitrarily-aligned data from a user space to kernel space */
87 extern boolean_t copyin(
88 const char *user_addr,
89 char *kernel_addr,
90 vm_size_t nbytes);
91
92 /* Move a NUL-terminated string from a user space to kernel space */
93 extern boolean_t copyinstr(
94 const char *user_addr,
95 char *kernel_addr,
96 vm_size_t max,
97 vm_size_t *actual);
98
99 /* Move arbitrarily-aligned data from a user space to kernel space */
100 extern boolean_t copyinmsg(
101 const char *user_addr,
102 char *kernel_addr,
103 mach_msg_size_t nbytes);
104
105 /* Move arbitrarily-aligned data from a kernel space to user space */
106 extern boolean_t copyout(
107 const char *kernel_addr,
108 char *user_addr,
109 vm_size_t nbytes);
110
111 /* Move arbitrarily-aligned data from a kernel space to user space */
112 extern boolean_t copyoutmsg(
113 const char *kernel_addr,
114 char *user_addr,
115 mach_msg_size_t nbytes);
116
117 extern int sscanf(const char *input, const char *fmt, ...);
118
119 extern integer_t sprintf(char *buf, const char *fmt, ...);
120
121 extern void printf(const char *format, ...);
122
123 extern void dbugprintf(const char *format, ...);
124
125 extern void kdp_printf(const char *format, ...);
126
127 extern void printf_init(void);
128
129 extern void panic(const char *string, ...);
130
131 extern void panic_init(void);
132
133 extern void log(int level, char *fmt, ...);
134
135 void
136 _doprnt(
137 register const char *fmt,
138 va_list *argp,
139 void (*putc)(char),
140 int radix);
141 int
142 __doprnt(
143 register const char *fmt,
144 va_list *argp,
145 void (*putc)(int, void *),
146 void *arg,
147 int radix);
148
149 extern void safe_gets(
150 char *str,
151 int maxlen);
152
153 extern void cnputcusr(char);
154
155 extern void conslog_putc(char);
156
157 extern void consdebug_putc(char);
158
159 extern void cnputc(char);
160
161 extern int cngetc(void);
162
163 extern int cnmaygetc(void);
164
165 extern int _setjmp(
166 jmp_buf_t *jmp_buf);
167
168 extern int _longjmp(
169 jmp_buf_t *jmp_buf,
170 int value);
171
172 extern void bootstrap_create(void);
173
174 extern void halt_cpu(void);
175
176 extern void halt_all_cpus(
177 boolean_t reboot);
178
179 extern void Debugger(
180 const char * message);
181
182 extern void delay(
183 int n);
184
185 extern char *machine_boot_info(
186 char *buf,
187 vm_size_t buf_len);
188
189 /*
190 * Machine-dependent routine to fill in an array with up to callstack_max
191 * levels of return pc information.
192 */
193 extern void machine_callstack(
194 natural_t *buf,
195 vm_size_t callstack_max);
196
197 extern void consider_machine_collect(void);
198
199 extern void norma_bootstrap(void);
200
201 #if DIPC
202 extern boolean_t no_bootstrap_task(void);
203 extern ipc_port_t get_root_master_device_port(void);
204 #endif /* DIPC */
205
206 #endif /* _MISC_PROTOS_H_ */