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