]> git.saurik.com Git - apple/xnu.git/blob - osfmk/kern/misc_protos.h
c66b385fc7e032a28c0da52640ca7b4f03df86d3
[apple/xnu.git] / osfmk / kern / misc_protos.h
1 /*
2 * Copyright (c) 2000-2004 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_OSREFERENCE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the
10 * License may not be used to create, or enable the creation or
11 * redistribution of, unlawful or unlicensed copies of an Apple operating
12 * system, or to circumvent, violate, or enable the circumvention or
13 * violation of, any terms of an Apple operating system software license
14 * agreement.
15 *
16 * Please obtain a copy of the License at
17 * http://www.opensource.apple.com/apsl/ and read it before using this
18 * file.
19 *
20 * The Original Code and all software distributed under the License are
21 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
22 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
23 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
24 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
25 * Please see the License for the specific language governing rights and
26 * limitations under the License.
27 *
28 * @APPLE_LICENSE_OSREFERENCE_HEADER_END@
29 */
30 /*
31 * @OSF_COPYRIGHT@
32 */
33
34 #ifndef _MISC_PROTOS_H_
35 #define _MISC_PROTOS_H_
36
37 #include <stdarg.h>
38 #include <string.h>
39 #include <machine/setjmp.h>
40 #include <mach/boolean.h>
41 #include <mach/message.h>
42 #include <mach/machine/vm_types.h>
43 #include <ipc/ipc_types.h>
44 #include <kern/debug.h>
45
46 /* Set a bit in a bit array */
47 extern void setbit(
48 int which,
49 int *bitmap);
50
51 /* Clear a bit in a bit array */
52 extern void clrbit(
53 int which,
54 int *bitmap);
55
56 /* Find the first set bit in a bit array */
57 extern int ffsbit(
58 int *bitmap);
59 extern int ffs(
60 unsigned int mask);
61
62 /*
63 * Test if indicated bit is set in bit string.
64 */
65 extern int testbit(
66 int which,
67 int *bitmap);
68
69 /* Move arbitrarily-aligned data from a user space to kernel space */
70 extern int copyin(
71 const user_addr_t user_addr,
72 char *kernel_addr,
73 vm_size_t nbytes);
74
75 /* Move a NUL-terminated string from a user space to kernel space */
76 extern int copyinstr(
77 const user_addr_t user_addr,
78 char *kernel_addr,
79 vm_size_t max,
80 vm_size_t *actual);
81
82 /* Move arbitrarily-aligned data from a user space to kernel space */
83 extern int copyinmsg(
84 const user_addr_t user_addr,
85 char *kernel_addr,
86 mach_msg_size_t nbytes);
87
88 /* Move arbitrarily-aligned data from a kernel space to user space */
89 extern int copyout(
90 const char *kernel_addr,
91 user_addr_t user_addr,
92 vm_size_t nbytes);
93
94 /* Move arbitrarily-aligned data from a kernel space to user space */
95 extern int copyoutmsg(
96 const char *kernel_addr,
97 user_addr_t user_addr,
98 mach_msg_size_t nbytes);
99
100 /* Invalidate copy window(s) cache */
101 extern void inval_copy_windows(thread_t);
102
103
104 extern int sscanf(const char *input, const char *fmt, ...);
105
106 extern integer_t sprintf(char *buf, const char *fmt, ...);
107
108 extern void printf(const char *format, ...);
109
110 extern void dbugprintf(const char *format, ...);
111
112 extern void kdp_printf(const char *format, ...);
113
114 extern void printf_init(void);
115
116 extern void log(int level, char *fmt, ...);
117
118 void
119 _doprnt(
120 register const char *fmt,
121 va_list *argp,
122 void (*putc)(char),
123 int radix);
124 int
125 __doprnt(
126 register const char *fmt,
127 va_list *argp,
128 void (*putc)(int, void *),
129 void *arg,
130 int radix);
131
132 extern void safe_gets(
133 char *str,
134 int maxlen);
135
136 extern void cnputcusr(char);
137
138 extern void conslog_putc(char);
139
140 extern void consdebug_putc(char);
141
142 extern void cnputc(char);
143
144 extern int cngetc(void);
145
146 extern int cnmaygetc(void);
147
148 extern int _setjmp(
149 jmp_buf_t *jmp_buf);
150
151 extern int _longjmp(
152 jmp_buf_t *jmp_buf,
153 int value);
154
155 extern void bootstrap_create(void);
156
157 extern void Debugger(
158 const char * message);
159
160 extern void delay(
161 int n);
162
163
164 extern void norma_bootstrap(void);
165
166 #if DIPC
167 extern boolean_t no_bootstrap_task(void);
168 extern ipc_port_t get_root_master_device_port(void);
169 #endif /* DIPC */
170
171 extern kern_return_t kernel_set_special_port(
172 host_priv_t host_priv,
173 int which,
174 ipc_port_t port);
175
176 #endif /* _MISC_PROTOS_H_ */