]> git.saurik.com Git - apple/xnu.git/blob - osfmk/kern/misc_protos.h
xnu-792.tar.gz
[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 * 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 #include <kern/debug.h>
37
38 /* Set a bit in a bit array */
39 extern void setbit(
40 int which,
41 int *bitmap);
42
43 /* Clear a bit in a bit array */
44 extern void clrbit(
45 int which,
46 int *bitmap);
47
48 /* Find the first set bit in a bit array */
49 extern int ffsbit(
50 int *bitmap);
51 extern int ffs(
52 unsigned int mask);
53
54 /*
55 * Test if indicated bit is set in bit string.
56 */
57 extern int testbit(
58 int which,
59 int *bitmap);
60
61 /* Move arbitrarily-aligned data from a user space to kernel space */
62 extern int copyin(
63 const user_addr_t user_addr,
64 char *kernel_addr,
65 vm_size_t nbytes);
66
67 /* Move a NUL-terminated string from a user space to kernel space */
68 extern int copyinstr(
69 const user_addr_t user_addr,
70 char *kernel_addr,
71 vm_size_t max,
72 vm_size_t *actual);
73
74 /* Move arbitrarily-aligned data from a user space to kernel space */
75 extern int copyinmsg(
76 const user_addr_t user_addr,
77 char *kernel_addr,
78 mach_msg_size_t nbytes);
79
80 /* Move arbitrarily-aligned data from a kernel space to user space */
81 extern int copyout(
82 const char *kernel_addr,
83 user_addr_t user_addr,
84 vm_size_t nbytes);
85
86 /* Move arbitrarily-aligned data from a kernel space to user space */
87 extern int copyoutmsg(
88 const char *kernel_addr,
89 user_addr_t user_addr,
90 mach_msg_size_t nbytes);
91
92 extern int sscanf(const char *input, const char *fmt, ...);
93
94 extern integer_t sprintf(char *buf, const char *fmt, ...);
95
96 extern void printf(const char *format, ...);
97
98 extern void dbugprintf(const char *format, ...);
99
100 extern void kdp_printf(const char *format, ...);
101
102 extern void printf_init(void);
103
104 extern void log(int level, char *fmt, ...);
105
106 void
107 _doprnt(
108 register const char *fmt,
109 va_list *argp,
110 void (*putc)(char),
111 int radix);
112 int
113 __doprnt(
114 register const char *fmt,
115 va_list *argp,
116 void (*putc)(int, void *),
117 void *arg,
118 int radix);
119
120 extern void safe_gets(
121 char *str,
122 int maxlen);
123
124 extern void cnputcusr(char);
125
126 extern void conslog_putc(char);
127
128 extern void consdebug_putc(char);
129
130 extern void cnputc(char);
131
132 extern int cngetc(void);
133
134 extern int cnmaygetc(void);
135
136 extern int _setjmp(
137 jmp_buf_t *jmp_buf);
138
139 extern int _longjmp(
140 jmp_buf_t *jmp_buf,
141 int value);
142
143 extern void bootstrap_create(void);
144
145 extern void Debugger(
146 const char * message);
147
148 extern void delay(
149 int n);
150
151
152 extern void norma_bootstrap(void);
153
154 #if DIPC
155 extern boolean_t no_bootstrap_task(void);
156 extern ipc_port_t get_root_master_device_port(void);
157 #endif /* DIPC */
158
159 extern kern_return_t kernel_set_special_port(
160 host_priv_t host_priv,
161 int which,
162 ipc_port_t port);
163
164 #endif /* _MISC_PROTOS_H_ */