Loading...
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 | /* * Copyright (c) 2000-2011 Apple Computer, Inc. All rights reserved. * * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ * * This file contains Original Code and/or Modifications of Original Code * as defined in and that are subject to the Apple Public Source License * Version 2.0 (the 'License'). You may not use this file except in * compliance with the License. The rights granted to you under the License * may not be used to create, or enable the creation or redistribution of, * unlawful or unlicensed copies of an Apple operating system, or to * circumvent, violate, or enable the circumvention or violation of, any * terms of an Apple operating system software license agreement. * * Please obtain a copy of the License at * http://www.opensource.apple.com/apsl/ and read it before using this file. * * The Original Code and all software distributed under the License are * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. * Please see the License for the specific language governing rights and * limitations under the License. * * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ */ /* * @OSF_COPYRIGHT@ */ /* * NOTICE: This file was modified by McAfee Research in 2004 to introduce * support for mandatory and extensible security protections. This notice * is included in support of clause 2.2 (b) of the Apple Public License, * Version 2.0. */ #ifndef _MISC_PROTOS_H_ #define _MISC_PROTOS_H_ #include <stdarg.h> #include <string.h> #include <machine/setjmp.h> #include <mach/boolean.h> #include <mach/message.h> #include <mach/machine/vm_types.h> #include <ipc/ipc_types.h> #include <kern/debug.h> #ifndef MIN #define MIN(a,b) (((a)<(b))?(a):(b)) #endif /* MIN */ #ifndef MAX #define MAX(a,b) (((a)>(b))?(a):(b)) #endif /* MAX */ /* Set a bit in a bit array */ extern void setbit( int which, int *bitmap); /* Clear a bit in a bit array */ extern void clrbit( int which, int *bitmap); /* Find the first set bit in a bit array */ extern int ffsbit( int *bitmap); extern int ffs( unsigned int mask); /* * Test if indicated bit is set in bit string. */ extern int testbit( int which, int *bitmap); /* Move arbitrarily-aligned data from a user space to kernel space */ extern int copyin( const user_addr_t user_addr, char *kernel_addr, vm_size_t nbytes); /* Move a NUL-terminated string from a user space to kernel space */ extern int copyinstr( const user_addr_t user_addr, char *kernel_addr, vm_size_t max, vm_size_t *actual); /* Move arbitrarily-aligned data from a user space to kernel space */ extern int copyinmsg( const user_addr_t user_addr, char *kernel_addr, mach_msg_size_t nbytes); /* Move arbitrarily-aligned data from a kernel space to user space */ extern int copyout( const void *kernel_addr, user_addr_t user_addr, vm_size_t nbytes); /* Move arbitrarily-aligned data from a kernel space to user space */ extern int copyoutmsg( const char *kernel_addr, user_addr_t user_addr, mach_msg_size_t nbytes); /* Invalidate copy window(s) cache */ extern void inval_copy_windows(thread_t); extern void copy_window_fault(thread_t, vm_map_t, int); extern int copyin_validate(const user_addr_t, uintptr_t, vm_size_t); extern int copyout_validate(uintptr_t, const user_addr_t, vm_size_t); extern int sscanf(const char *input, const char *fmt, ...) __scanflike(2,3); /* sprintf() is being deprecated. Please use snprintf() instead. */ extern integer_t sprintf(char *buf, const char *fmt, ...) __deprecated; extern int printf(const char *format, ...) __printflike(1,2); #if KERNEL_PRIVATE int _consume_printf_args(int, ...); #endif #if CONFIG_NO_PRINTF_STRINGS #if KERNEL_PRIVATE #define printf(x, ...) _consume_printf_args( 0, ## __VA_ARGS__ ) #else #define printf(x, ...) do {} while (0) #endif #endif extern int kdb_printf(const char *format, ...) __printflike(1,2); extern int kdb_log(const char *format, ...) __printflike(1,2); extern int kdb_printf_unbuffered(const char *format, ...) __printflike(1,2); extern void printf_init(void); extern int snprintf(char *, size_t, const char *, ...) __printflike(3,4); extern void log(int level, char *fmt, ...); void _doprnt( register const char *fmt, va_list *argp, void (*putc)(char), int radix); void _doprnt_log( register const char *fmt, va_list *argp, void (*putc)(char), int radix); int __doprnt( register const char *fmt, va_list argp, void (*putc)(int, void *), void *arg, int radix, int is_log); extern void safe_gets( char *str, int maxlen); extern void cnputcusr(char); extern void conslog_putc(char); extern void cons_putc_locked(char); extern void consdebug_putc(char); extern void consdebug_log(char); extern void consdebug_putc_unbuffered(char); extern void cnputc(char); extern void cnputc_unbuffered(char); extern int cngetc(void); extern int cnmaygetc(void); extern int _setjmp( jmp_buf_t *jmp_buf); extern int _longjmp( jmp_buf_t *jmp_buf, int value); extern void bootstrap_create(void); extern void Debugger( const char * message); extern void DebuggerWithContext( unsigned int reason, void *ctx, const char *message); extern void delay( int n); #if DIPC extern boolean_t no_bootstrap_task(void); extern ipc_port_t get_root_master_device_port(void); #endif /* DIPC */ extern kern_return_t kernel_set_special_port( host_priv_t host_priv, int which, ipc_port_t port); user_addr_t get_useraddr(void); /* symbol lookup */ struct kmod_info_t; extern uint64_t early_random(void); #endif /* _MISC_PROTOS_H_ */ |