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