#ifndef _KCTL_H
#define _KCTL_H
#include <kmdb/kmdb_auxv.h>
#include <kmdb/kmdb_wr.h>
#include <sys/ddi.h>
#include <sys/sunddi.h>
#include <sys/kdi.h>
#include <sys/modctl.h>
#include <sys/ksynch.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef enum {
KCTL_ST_INACTIVE = 0,
KCTL_ST_DSEG_ALLOCED,
KCTL_ST_INITIALIZED,
KCTL_ST_KCTL_PREACTIVATED,
KCTL_ST_MOD_NOTIFIERS,
KCTL_ST_THREAD_STARTED,
KCTL_ST_DBG_ACTIVATED,
KCTL_ST_ACTIVE,
KCTL_ST_DEACTIVATING
} kctl_state_t;
typedef enum {
KCTL_WR_ST_RUN,
KCTL_WR_ST_STOP,
KCTL_WR_ST_STOPPED
} kctl_wr_state_t;
typedef struct kctl {
dev_info_t *kctl_drv_dip;
size_t kctl_memgoalsz;
caddr_t kctl_dseg;
size_t kctl_dseg_size;
caddr_t kctl_mrbase;
size_t kctl_mrsize;
vnode_t kctl_vp;
kctl_state_t kctl_state;
uint_t kctl_boot_loaded;
struct bootops *kctl_boot_ops;
const char *kctl_execname;
uint_t kctl_wr_avail;
ksema_t kctl_wr_avail_sem;
kthread_t *kctl_wr_thr;
kctl_wr_state_t kctl_wr_state;
kmutex_t kctl_lock;
kcondvar_t kctl_wr_cv;
kmutex_t kctl_wr_lock;
uint_t kctl_flags;
#ifdef __sparc
caddr_t kctl_tba;
#endif
} kctl_t;
extern kctl_t kctl;
struct bootops;
extern void kctl_dprintf(const char *, ...);
extern void kctl_warn(const char *, ...);
extern int kctl_preactivate_isadep(void);
extern void kctl_activate_isadep(kdi_debugvec_t *);
extern void kctl_depreactivate_isadep(void);
extern void kctl_cleanup(void);
extern void *kctl_boot_tmpinit(void);
extern void kctl_boot_tmpfini(void *);
extern void kctl_auxv_init(kmdb_auxv_t *, const char *, const char **, void *);
extern void kctl_auxv_init_isadep(kmdb_auxv_t *, void *);
extern void kctl_auxv_fini(kmdb_auxv_t *);
extern void kctl_auxv_fini_isadep(kmdb_auxv_t *);
#ifdef sun4v
extern void kctl_auxv_set_promif(kmdb_auxv_t *);
extern void kctl_switch_promif(void);
#endif
extern void kctl_wrintr(void);
extern void kctl_wrintr_fire(void);
extern void kctl_wr_thr_start(void);
extern void kctl_wr_thr_stop(void);
extern void kctl_wr_thr_join(void);
extern int kctl_mod_decompress(struct modctl *);
extern void kctl_mod_loaded(struct modctl *);
extern void kctl_mod_changed(uint_t, struct modctl *);
extern void kctl_mod_notify_reg(void);
extern void kctl_mod_notify_unreg(void);
extern void kctl_dmod_init(void);
extern void kctl_dmod_fini(void);
extern void kctl_dmod_sync(void);
extern void kctl_dmod_autoload(const char *);
extern void kctl_dmod_unload_all(void);
extern void kctl_dmod_path_reset(void);
extern int kctl_wr_process(void);
extern void kctl_wr_unload(void);
extern char *kctl_basename(char *);
extern char *kctl_strdup(const char *);
extern void kctl_strfree(char *);
#if defined(__sparc)
extern kthread_t *kctl_curthread_set(kthread_t *);
#endif
#ifdef __cplusplus
}
#endif
#endif