]> git.saurik.com Git - apple/xnu.git/blob - osfmk/kern/misc_protos.h
xnu-344.49.tar.gz
[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 kdp_printf(const char *format, ...);
124
125 extern void printf_init(void);
126
127 extern void panic(const char *string, ...);
128
129 extern void panic_init(void);
130
131 extern void log(int level, char *fmt, ...);
132
133 void
134 _doprnt(
135 register const char *fmt,
136 va_list *argp,
137 void (*putc)(char),
138 int radix);
139 int
140 __doprnt(
141 register const char *fmt,
142 va_list *argp,
143 void (*putc)(int, void *),
144 void *arg,
145 int radix);
146
147 extern void safe_gets(
148 char *str,
149 int maxlen);
150
151 extern void cnputcusr(char);
152
153 extern void conslog_putc(char);
154
155 extern void consdebug_putc(char);
156
157 extern void cnputc(char);
158
159 extern int cngetc(void);
160
161 extern int cnmaygetc(void);
162
163 extern int _setjmp(
164 jmp_buf_t *jmp_buf);
165
166 extern int _longjmp(
167 jmp_buf_t *jmp_buf,
168 int value);
169
170 extern void bootstrap_create(void);
171
172 extern void halt_cpu(void);
173
174 extern void halt_all_cpus(
175 boolean_t reboot);
176
177 extern void Debugger(
178 const char * message);
179
180 extern void delay(
181 int n);
182
183 extern char *machine_boot_info(
184 char *buf,
185 vm_size_t buf_len);
186
187 /*
188 * Machine-dependent routine to fill in an array with up to callstack_max
189 * levels of return pc information.
190 */
191 extern void machine_callstack(
192 natural_t *buf,
193 vm_size_t callstack_max);
194
195 extern void consider_machine_collect(void);
196
197 extern void norma_bootstrap(void);
198
199 #if DIPC
200 extern boolean_t no_bootstrap_task(void);
201 extern ipc_port_t get_root_master_device_port(void);
202 #endif /* DIPC */
203
204 #endif /* _MISC_PROTOS_H_ */