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