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