]> git.saurik.com Git - apple/xnu.git/blame - osfmk/kern/misc_protos.h
xnu-344.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 *
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 */
38extern void setbit(
39 int which,
40 int *bitmap);
41
42/* Clear a bit in a bit array */
43extern void clrbit(
44 int which,
45 int *bitmap);
46
47/* Find the first set bit in a bit array */
48extern int ffsbit(
49 int *bitmap);
50extern int ffs(
51 unsigned int mask);
52
53/*
54 * Test if indicated bit is set in bit string.
55 */
56extern int testbit(
57 int which,
58 int *bitmap);
59
60/* Move arbitrarily-aligned data from one array to another */
61extern 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 */
68extern void ovbcopy(
69 const char *from,
70 char *to,
71 vm_size_t nbytes);
72
73extern int bcmp(
74 const char *a,
75 const char *b,
76 vm_size_t len);
77
78/* Zero an arbitrarily aligned array */
79extern void bzero(
80 char *from,
81 vm_size_t nbytes);
82
83/* Move arbitrarily-aligned data from a user space to kernel space */
84extern 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 */
90extern 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 */
97extern 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 */
103extern 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 */
109extern boolean_t copyoutmsg(
110 const char *kernel_addr,
111 char *user_addr,
112 mach_msg_size_t nbytes);
113
114extern int sscanf(const char *input, const char *fmt, ...);
115
116extern integer_t sprintf(char *buf, const char *fmt, ...);
117
118extern void printf(const char *format, ...);
119
9bccf70c
A
120extern void kdp_printf(const char *format, ...);
121
1c79356b
A
122extern void printf_init(void);
123
124extern void panic(const char *string, ...);
125
126extern void panic_init(void);
127
128extern void log(int level, char *fmt, ...);
129
130void
131_doprnt(
132 register const char *fmt,
133 va_list *argp,
134 void (*putc)(char),
135 int radix);
9bccf70c
A
136int
137__doprnt(
138 register const char *fmt,
139 va_list *argp,
140 void (*putc)(int, void *),
141 void *arg,
142 int radix);
1c79356b
A
143
144extern void safe_gets(
145 char *str,
146 int maxlen);
147
148extern void cnputcusr(char);
149
9bccf70c
A
150extern void conslog_putc(char);
151
152extern void consdebug_putc(char);
153
1c79356b
A
154extern void cnputc(char);
155
156extern int cngetc(void);
157
158extern int cnmaygetc(void);
159
160extern int _setjmp(
161 jmp_buf_t *jmp_buf);
162
163extern int _longjmp(
164 jmp_buf_t *jmp_buf,
165 int value);
166
167extern void bootstrap_create(void);
168
169extern void halt_cpu(void);
170
171extern void halt_all_cpus(
172 boolean_t reboot);
173
174extern void Debugger(
175 const char * message);
176
177extern void delay(
178 int n);
179
180extern char *machine_boot_info(
181 char *buf,
182 vm_size_t buf_len);
183
184/*
185 * Machine-dependent routine to fill in an array with up to callstack_max
186 * levels of return pc information.
187 */
188extern void machine_callstack(
189 natural_t *buf,
190 vm_size_t callstack_max);
191
192extern void consider_machine_collect(void);
193
194extern void norma_bootstrap(void);
195
196#if DIPC
197extern boolean_t no_bootstrap_task(void);
198extern ipc_port_t get_root_master_device_port(void);
199#endif /* DIPC */
200
201#endif /* _MISC_PROTOS_H_ */