#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
#ifndef MAX
#define MAX(a,b) (((a)>(b))?(a):(b))
#endif
extern void setbit(
int which,
int *bitmap);
extern void clrbit(
int which,
int *bitmap);
extern int ffsbit(
int *bitmap);
extern int ffs(
unsigned int mask);
extern int testbit(
int which,
int *bitmap);
extern int copyin(
const user_addr_t user_addr,
char *kernel_addr,
vm_size_t nbytes);
extern int copyinstr(
const user_addr_t user_addr,
char *kernel_addr,
vm_size_t max,
vm_size_t *actual);
extern int copyinmsg(
const user_addr_t user_addr,
char *kernel_addr,
mach_msg_size_t nbytes);
extern int copyout(
const void *kernel_addr,
user_addr_t user_addr,
vm_size_t nbytes);
extern int copyoutmsg(
const char *kernel_addr,
user_addr_t user_addr,
mach_msg_size_t nbytes);
extern void inval_copy_windows(thread_t);
extern int sscanf(const char *input, const char *fmt, ...) __scanflike(2,3);
extern integer_t sprintf(char *buf, const char *fmt, ...) __deprecated;
extern int printf(const char *format, ...) __printflike(1,2);
extern void dbugprintf(const char *format, ...) __printflike(1,2);
extern int kdb_printf(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);
int
__doprnt(
register const char *fmt,
va_list *argp,
void (*putc)(int, void *),
void *arg,
int radix);
extern void safe_gets(
char *str,
int maxlen);
extern void cnputcusr(char);
extern void conslog_putc(char);
extern void consdebug_putc(char);
extern void cnputc(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 delay(
int n);
extern void norma_bootstrap(void);
#if DIPC
extern boolean_t no_bootstrap_task(void);
extern ipc_port_t get_root_master_device_port(void);
#endif
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);
struct kmod_info_t;
extern int syms_formataddr(
vm_offset_t addr,
char *out,
vm_offset_t outsize);
extern const char *syms_nameforaddr(
vm_offset_t addr,
vm_offset_t *ofs,
kmod_info_t **kmod);
#endif