#ifndef BSD_SYS_KDEBUG_H
#define BSD_SYS_KDEBUG_H
#include <sys/appleapiopts.h>
#include <sys/cdefs.h>
__BEGIN_DECLS
#ifdef __APPLE_API_UNSTABLE
#include <mach/clock_types.h>
#include <stdint.h>
#if defined(KERNEL_BUILD)
#include <kdebug.h>
#endif
#ifdef XNU_KERNEL_PRIVATE
#include <stdint.h>
#include <mach/branch_predicates.h>
#endif
typedef enum
{
KD_CALLBACK_KDEBUG_ENABLED, KD_CALLBACK_KDEBUG_DISABLED, KD_CALLBACK_SYNC_FLUSH, KD_CALLBACK_TYPEFILTER_CHANGED, } kd_callback_type;
typedef void (*kd_callback_fn) (void* context, kd_callback_type reason, void* arg);
struct kd_callback {
kd_callback_fn func;
void* context;
char iop_name[8]; };
typedef struct kd_callback kd_callback_t;
extern int kernel_debug_register_callback(kd_callback_t callback);
extern void kernel_debug_enter(
uint32_t coreid,
uint32_t debugid,
uint64_t timestamp,
uintptr_t arg1,
uintptr_t arg2,
uintptr_t arg3,
uintptr_t arg4,
uintptr_t threadid
);
#define DBG_HFS_UPDATE_ACCTIME 0x01
#define DBG_HFS_UPDATE_MODTIME 0x02
#define DBG_HFS_UPDATE_CHGTIME 0x04
#define DBG_HFS_UPDATE_MODIFIED 0x08
#define DBG_HFS_UPDATE_FORCE 0x10
#define DBG_HFS_UPDATE_DATEADDED 0x20
#define DBG_ZERO_FILL_FAULT 1
#define DBG_PAGEIN_FAULT 2
#define DBG_COW_FAULT 3
#define DBG_CACHE_HIT_FAULT 4
#define DBG_NZF_PAGE_FAULT 5
#define DBG_GUARD_FAULT 6
#define DBG_PAGEINV_FAULT 7
#define DBG_PAGEIND_FAULT 8
#define DBG_COMPRESSOR_FAULT 9
#define DBG_COMPRESSOR_SWAPIN_FAULT 10
#define DBG_FUNC_START 1
#define DBG_FUNC_END 2
#define DBG_FUNC_NONE 0
#define DBG_MACH 1
#define DBG_NETWORK 2
#define DBG_FSYSTEM 3
#define DBG_BSD 4
#define DBG_IOKIT 5
#define DBG_DRIVERS 6
#define DBG_TRACE 7
#define DBG_DLIL 8
#define DBG_SECURITY 9
#define DBG_CORESTORAGE 10
#define DBG_CG 11
#define DBG_MISC 20
#define DBG_DYLD 31
#define DBG_QT 32
#define DBG_APPS 33
#define DBG_LAUNCHD 34
#define DBG_PERF 37
#define DBG_IMPORTANCE 38
#define DBG_MIG 255
#define DBG_MACH_EXCP_KTRAP_x86 0x02
#define DBG_MACH_EXCP_DFLT 0x03
#define DBG_MACH_EXCP_IFLT 0x04
#define DBG_MACH_EXCP_INTR 0x05
#define DBG_MACH_EXCP_ALNG 0x06
#define DBG_MACH_EXCP_UTRAP_x86 0x07
#define DBG_MACH_EXCP_FP 0x08
#define DBG_MACH_EXCP_DECI 0x09
#define DBG_MACH_CHUD 0x0A
#define DBG_MACH_EXCP_SC 0x0C
#define DBG_MACH_EXCP_TRACE 0x0D
#define DBG_MACH_EXCP_EMUL 0x0E
#define DBG_MACH_IHDLR 0x10
#define DBG_MACH_IPC 0x20
#define DBG_MACH_VM 0x30
#define DBG_MACH_LEAKS 0x31
#define DBG_MACH_SCHED 0x40
#define DBG_MACH_MSGID_INVALID 0x50
#define DBG_MACH_LOCKS 0x60
#define DBG_MACH_PMAP 0x70
#define DBG_MACH_MP 0x90
#define DBG_MACH_VM_PRESSURE 0xA0
#define DBG_MACH_STACKSHOT 0xA1
#define MACH_SCHED 0x0
#define MACH_STACK_ATTACH 0x1
#define MACH_STACK_HANDOFF 0x2
#define MACH_CALL_CONT 0x3
#define MACH_CALLOUT 0x4
#define MACH_STACK_DETACH 0x5
#define MACH_MAKE_RUNNABLE 0x6
#define MACH_PROMOTE 0x7
#define MACH_DEMOTE 0x8
#define MACH_IDLE 0x9
#define MACH_STACK_DEPTH 0xa
#define MACH_MOVED 0xb
#define MACH_FAIRSHARE_ENTER 0xc
#define MACH_FAIRSHARE_EXIT 0xd
#define MACH_FAILSAFE 0xe
#define MACH_BLOCK 0xf
#define MACH_WAIT 0x10
#define MACH_GET_URGENCY 0x14
#define MACH_URGENCY 0x15
#define MACH_REDISPATCH 0x16
#define MACH_REMOTE_AST 0x17
#define MACH_SCHED_CHOOSE_PROCESSOR 0x18
#define MACH_DEEP_IDLE 0x19
#define MACH_SCHED_DECAY_PRIORITY 0x1a
#define MACH_CPU_THROTTLE_DISABLE 0x1b
#define MACH_RW_PROMOTE 0x1c
#define MACH_RW_DEMOTE 0x1d
#define MACH_TASK_SUSPEND 0x0
#define MACH_TASK_RESUME 0x1
#define PMAP__CREATE 0x0
#define PMAP__DESTROY 0x1
#define PMAP__PROTECT 0x2
#define PMAP__PAGE_PROTECT 0x3
#define PMAP__ENTER 0x4
#define PMAP__REMOVE 0x5
#define PMAP__NEST 0x6
#define PMAP__UNNEST 0x7
#define PMAP__FLUSH_TLBS 0x8
#define PMAP__UPDATE_INTERRUPT 0x9
#define PMAP__ATTRIBUTE_CLEAR 0xa
#define PMAP__REUSABLE 0xb
#define PMAP__QUERY_RESIDENT 0xc
#define PMAP__FLUSH_KERN_TLBS 0xd
#define PMAP__FLUSH_DELAYED_TLBS 0xe
#define MICROSTACKSHOT_RECORD 0x0
#define MICROSTACKSHOT_GATHER 0x1
#define DBG_NETIP 1
#define DBG_NETARP 2
#define DBG_NETUDP 3
#define DBG_NETTCP 4
#define DBG_NETICMP 5
#define DBG_NETIGMP 6
#define DBG_NETRIP 7
#define DBG_NETOSPF 8
#define DBG_NETISIS 9
#define DBG_NETSNMP 10
#define DBG_NETSOCK 11
#define DBG_NETAARP 100
#define DBG_NETDDP 101
#define DBG_NETNBP 102
#define DBG_NETZIP 103
#define DBG_NETADSP 104
#define DBG_NETATP 105
#define DBG_NETASP 106
#define DBG_NETAFP 107
#define DBG_NETRTMP 108
#define DBG_NETAURP 109
#define DBG_NETIPSEC 128
#define DBG_IOINTC 0
#define DBG_IOWORKLOOP 1
#define DBG_IOINTES 2
#define DBG_IOCLKES 3
#define DBG_IOCMDQ 4
#define DBG_IOMCURS 5
#define DBG_IOMDESC 6
#define DBG_IOPOWER 7
#define DBG_IOSERVICE 8
#define DBG_IOSTORAGE 32
#define DBG_IONETWORK 33
#define DBG_IOKEYBOARD 34
#define DBG_IOHID 35
#define DBG_IOAUDIO 36
#define DBG_IOSERIAL 37
#define DBG_IOTTY 38
#define DBG_IOSAM 39
#define DBG_IOPARALLELATA 40
#define DBG_IOPARALLELSCSI 41
#define DBG_IOSATA 42
#define DBG_IOSAS 43
#define DBG_IOFIBRECHANNEL 44
#define DBG_IOUSB 45
#define DBG_IOBLUETOOTH 46
#define DBG_IOFIREWIRE 47
#define DBG_IOINFINIBAND 48
#define DBG_IOCPUPM 49
#define DBG_IOGRAPHICS 50
#define DBG_HIBERNATE 51
#define DBG_IOTHUNDERBOLT 52
#define DBG_IOPOINTING DBG_IOHID
#define DBG_IODISK DBG_IOSTORAGE
#define DBG_DRVSTORAGE 1
#define DBG_DRVNETWORK 2
#define DBG_DRVKEYBOARD 3
#define DBG_DRVHID 4
#define DBG_DRVAUDIO 5
#define DBG_DRVSERIAL 7
#define DBG_DRVSAM 8
#define DBG_DRVPARALLELATA 9
#define DBG_DRVPARALLELSCSI 10
#define DBG_DRVSATA 11
#define DBG_DRVSAS 12
#define DBG_DRVFIBRECHANNEL 13
#define DBG_DRVUSB 14
#define DBG_DRVBLUETOOTH 15
#define DBG_DRVFIREWIRE 16
#define DBG_DRVINFINIBAND 17
#define DBG_DRVGRAPHICS 18
#define DBG_DRVSD 19
#define DBG_DRVNAND 20
#define DBG_SSD 21
#define DBG_DRVSPI 22
#define DBG_DRVPOINTING DBG_DRVHID
#define DBG_DRVDISK DBG_DRVSTORAGE
#define DBG_DLIL_STATIC 1
#define DBG_DLIL_PR_MOD 2
#define DBG_DLIL_IF_MOD 3
#define DBG_DLIL_PR_FLT 4
#define DBG_DLIL_IF_FLT 5
#define DBG_FSRW 1
#define DBG_DKRW 2
#define DBG_FSVN 3
#define DBG_FSLOOOKUP 4
#define DBG_JOURNAL 5
#define DBG_IOCTL 6
#define DBG_BOOTCACHE 7
#define DBG_HFS 8
#define DBG_EXFAT 0xE
#define DBG_MSDOS 0xF
#define DBG_ACFS 0x10
#define DBG_THROTTLE 0x11
#define DBG_BSD_PROC 0x01
#define DBG_BSD_MEMSTAT 0x02
#define DBG_BSD_EXCP_SC 0x0C
#define DBG_BSD_AIO 0x0D
#define DBG_BSD_SC_EXTENDED_INFO 0x0E
#define DBG_BSD_SC_EXTENDED_INFO2 0x0F
#define BSD_PROC_EXIT 1
#define BSD_PROC_FRCEXIT 2
#define BSD_MEMSTAT_SCAN 1
#define BSD_MEMSTAT_JETSAM 2
#define BSD_MEMSTAT_JETSAM_HIWAT 3
#define BSD_MEMSTAT_FREEZE 4
#define BSD_MEMSTAT_LATENCY_COALESCE 5
#define BSD_MEMSTAT_UPDATE 6
#define BSD_MEMSTAT_IDLE_DEMOTE 7
#define BSD_MEMSTAT_CLEAR_ERRORS 8
#define DBG_TRACE_DATA 0
#define DBG_TRACE_STRING 1
#define DBG_TRACE_INFO 2
#define DBG_CS_IO 0
#define DBG_EVENT 0x10
#define DBG_BUFFER 0x20
#define DBG_DYLD_STRING 5
#define DKIO_DONE 0x01
#define DKIO_READ 0x02
#define DKIO_ASYNC 0x04
#define DKIO_META 0x08
#define DKIO_PAGING 0x10
#define DKIO_THROTTLE 0x20
#define DKIO_PASSIVE 0x40
#define DKIO_NOCACHE 0x80
#define DKIO_TIER_MASK 0xF00
#define DKIO_TIER_SHIFT 8
#define DBG_APP_LOGINWINDOW 0x03
#define DBG_APP_AUDIO 0x04
#define DBG_APP_SAMBA 0x80
#define OPEN_THROTTLE_WINDOW 0x1
#define PROCESS_THROTTLED 0x2
#define IO_THROTTLE_DISABLE 0x3
#define IMP_ASSERTION 0x10
#define IMP_BOOST 0x11
#define IMP_MSG 0x12
#define IMP_WATCHPORT 0x13
#define IMP_TASK_SUPPRESSION 0x17
#define IMP_TASK_APPTYPE 0x18
#define IMP_UPDATE 0x19
#define IMP_HOLD 0x2
#define IMP_DROP 0x4
#define IMP_EXTERN 0x8
#define IMP_BOOSTED 0x1
#define IMP_UNBOOSTED 0x2
#define IMP_MSG_SEND 0x1
#define IMP_MSG_DELV 0x2
#define IMP_UPDATE_TASK_CREATE 0x1
#define KDBG_CODE(Class, SubClass, code) (((Class & 0xff) << 24) | ((SubClass & 0xff) << 16) | ((code & 0x3fff) << 2))
#define KDBG_MIGCODE(msgid) ((DBG_MIG << 24) | (((msgid) & 0x3fffff) << 2))
#define MACHDBG_CODE(SubClass, code) KDBG_CODE(DBG_MACH, SubClass, code)
#define NETDBG_CODE(SubClass, code) KDBG_CODE(DBG_NETWORK, SubClass, code)
#define FSDBG_CODE(SubClass, code) KDBG_CODE(DBG_FSYSTEM, SubClass, code)
#define BSDDBG_CODE(SubClass, code) KDBG_CODE(DBG_BSD, SubClass, code)
#define IOKDBG_CODE(SubClass, code) KDBG_CODE(DBG_IOKIT, SubClass, code)
#define DRVDBG_CODE(SubClass, code) KDBG_CODE(DBG_DRIVERS, SubClass, code)
#define TRACEDBG_CODE(SubClass,code) KDBG_CODE(DBG_TRACE, SubClass, code)
#define MISCDBG_CODE(SubClass,code) KDBG_CODE(DBG_MISC, SubClass, code)
#define DLILDBG_CODE(SubClass,code) KDBG_CODE(DBG_DLIL, SubClass, code)
#define SECURITYDBG_CODE(SubClass,code) KDBG_CODE(DBG_SECURITY, SubClass, code)
#define DYLDDBG_CODE(SubClass,code) KDBG_CODE(DBG_DYLD, SubClass, code)
#define QTDBG_CODE(SubClass,code) KDBG_CODE(DBG_QT, SubClass, code)
#define APPSDBG_CODE(SubClass,code) KDBG_CODE(DBG_APPS, SubClass, code)
#define CPUPM_CODE(code) IOKDBG_CODE(DBG_IOCPUPM, code)
#define KMEM_ALLOC_CODE MACHDBG_CODE(DBG_MACH_LEAKS, 0)
#define KMEM_ALLOC_CODE_2 MACHDBG_CODE(DBG_MACH_LEAKS, 1)
#define KMEM_FREE_CODE MACHDBG_CODE(DBG_MACH_LEAKS, 2)
#define KMEM_FREE_CODE_2 MACHDBG_CODE(DBG_MACH_LEAKS, 3)
#define ZALLOC_CODE MACHDBG_CODE(DBG_MACH_LEAKS, 4)
#define ZALLOC_CODE_2 MACHDBG_CODE(DBG_MACH_LEAKS, 5)
#define ZFREE_CODE MACHDBG_CODE(DBG_MACH_LEAKS, 6)
#define ZFREE_CODE_2 MACHDBG_CODE(DBG_MACH_LEAKS, 7)
#define PMAP_CODE(code) MACHDBG_CODE(DBG_MACH_PMAP, code)
#define IMPORTANCE_CODE(SubClass, code) KDBG_CODE(DBG_IMPORTANCE, (SubClass), (code))
extern unsigned int kdebug_enable;
#define KDEBUG_ENABLE_TRACE 0x1
#define KDEBUG_ENABLE_ENTROPY 0x2
#define KDEBUG_ENABLE_CHUD 0x4
#define KDEBUG_ENABLE_PPT 0x8
#define KDEBUG_LEVEL_NONE 0
#define KDEBUG_LEVEL_IST 1
#define KDEBUG_LEVEL_STANDARD 2
#define KDEBUG_LEVEL_FULL 3
#if NO_KDEBUG
#define KDEBUG_LEVEL KDEBUG_LEVEL_NONE
#elif IST_KDEBUG
#define KDEBUG_LEVEL KDEBUG_LEVEL_IST
#elif KDEBUG
#define KDEBUG_LEVEL KDEBUG_LEVEL_FULL
#else
#define KDEBUG_LEVEL KDEBUG_LEVEL_STANDARD
#endif
#if (KDEBUG_LEVEL >= KDEBUG_LEVEL_STANDARD)
#ifdef XNU_KERNEL_PRIVATE
#define KERNEL_DEBUG_CONSTANT(x,a,b,c,d,e) \
do { \
if (__improbable(kdebug_enable & ~KDEBUG_ENABLE_PPT)) \
kernel_debug(x,(uintptr_t)a,(uintptr_t)b,(uintptr_t)c, \
(uintptr_t)d,(uintptr_t)e); \
} while(0)
#define KERNEL_DEBUG_CONSTANT1(x,a,b,c,d,e) \
do { \
if (__improbable(kdebug_enable & ~KDEBUG_ENABLE_PPT)) \
kernel_debug1(x,(uintptr_t)a,(uintptr_t)b,(uintptr_t)c, \
(uintptr_t)d,(uintptr_t)e); \
} while(0)
#else
#define KERNEL_DEBUG_CONSTANT(x,a,b,c,d,e) \
do { \
if (kdebug_enable & ~KDEBUG_ENABLE_PPT) \
kernel_debug(x,(uintptr_t)a,(uintptr_t)b,(uintptr_t)c, \
(uintptr_t)d,(uintptr_t)e); \
} while(0)
#define KERNEL_DEBUG_CONSTANT1(x,a,b,c,d,e) \
do { \
if (kdebug_enable & ~KDEBUG_ENABLE_PPT) \
kernel_debug1(x,(uintptr_t)a,(uintptr_t)b,(uintptr_t)c, \
(uintptr_t)d,(uintptr_t)e); \
} while(0)
#endif
#else
#define KERNEL_DEBUG_CONSTANT(x,a,b,c,d,e) do { } while(0)
#define KERNEL_DEBUG_CONSTANT1(x,a,b,c,d,e) do { } while(0)
#endif
#define KDEBUG_COMMON (KDEBUG_ENABLE_TRACE|KDEBUG_ENABLE_ENTROPY|KDEBUG_ENABLE_CHUD|KDEBUG_ENABLE_PPT)
#define KDEBUG_TRACE (KDEBUG_ENABLE_TRACE|KDEBUG_ENABLE_ENTROPY|KDEBUG_ENABLE_CHUD)
#define KDEBUG_PPT (KDEBUG_ENABLE_PPT)
#if (KDEBUG_LEVEL >= KDEBUG_LEVEL_IST)
#ifdef XNU_KERNEL_PRIVATE
#define KERNEL_DEBUG_CONSTANT_IST(type,x,a,b,c,d,e) \
do { \
if (__improbable(kdebug_enable & type)) \
kernel_debug(x,(uintptr_t)a,(uintptr_t)b,(uintptr_t)c, \
(uintptr_t)d,(uintptr_t)e); \
} while(0)
#else
#define KERNEL_DEBUG_CONSTANT_IST(type,x,a,b,c,d,e) \
do { \
if (kdebug_enable & type) \
kernel_debug(x,(uintptr_t)a,(uintptr_t)b,(uintptr_t)c, \
(uintptr_t)d,(uintptr_t)e); \
} while(0)
#endif
#else
#define KERNEL_DEBUG_CONSTANT_IST(type,x,a,b,c,d,e) do { } while(0)
#endif
#if NO_KDEBUG
#define __kdebug_constant_only __unused
#endif
extern void kernel_debug(
uint32_t debugid,
uintptr_t arg1,
uintptr_t arg2,
uintptr_t arg3,
uintptr_t arg4,
uintptr_t arg5);
extern void kernel_debug1(
uint32_t debugid,
uintptr_t arg1,
uintptr_t arg2,
uintptr_t arg3,
uintptr_t arg4,
uintptr_t arg5);
#if (KDEBUG_LEVEL >= KDEBUG_LEVEL_FULL)
#ifdef XNU_KERNEL_PRIVATE
#define KERNEL_DEBUG(x,a,b,c,d,e) \
do { \
if (__improbable(kdebug_enable & ~KDEBUG_ENABLE_PPT)) \
kernel_debug((uint32_t)x, (uintptr_t)a, (uintptr_t)b, \
(uintptr_t)c, (uintptr_t)d, (uintptr_t)e); \
} while(0)
#define KERNEL_DEBUG1(x,a,b,c,d,e) \
do { \
if (__improbable(kdebug_enable & ~KDEBUG_ENABLE_PPT)) \
kernel_debug1((uint32_t)x, (uintptr_t)a, (uintptr_t)b, \
(uintptr_t)c, (uintptr_t)d, (uintptr_t)e); \
} while(0)
#define __kdebug_only
#else
#define KERNEL_DEBUG(x,a,b,c,d,e) \
do { \
if (kdebug_enable & ~KDEBUG_ENABLE_PPT) \
kernel_debug((uint32_t)x, (uintptr_t)a, (uintptr_t)b, \
(uintptr_t)c, (uintptr_t)d, (uintptr_t)e); \
} while(0)
#define KERNEL_DEBUG1(x,a,b,c,d,e) \
do { \
if (kdebug_enable & ~KDEBUG_ENABLE_PPT) \
kernel_debug1((uint32_t)x, (uintptr_t)a, (uintptr_t)b, \
(uintptr_t)c, (uintptr_t)d, (uintptr_t)e); \
} while(0)
#endif
#else
#define KERNEL_DEBUG(x,a,b,c,d,e) do {} while (0)
#define KERNEL_DEBUG1(x,a,b,c,d,e) do {} while (0)
#define __kdebug_only __unused
#endif
#ifdef KERNEL_PRIVATE
#include <mach/boolean.h>
#define NUMPARMS 23
struct proc;
extern void kdebug_lookup_gen_events(long *dbg_parms, int dbg_namelen, void *dp, boolean_t lookup);
extern void kdbg_trace_data(struct proc *proc, long *arg_pid);
extern void kdbg_trace_string(struct proc *proc, long *arg1, long *arg2, long *arg3, long *arg4);
extern void kdbg_dump_trace_to_file(const char *);
void start_kern_tracing(unsigned int, boolean_t);
struct task;
extern void kdbg_get_task_name(char*, int, struct task *task);
void disable_wrap(uint32_t *old_slowcheck, uint32_t *old_flags);
void enable_wrap(uint32_t old_slowcheck, boolean_t lostevents);
void release_storage_unit(int cpu, uint32_t storage_unit);
int allocate_storage_unit(int cpu);
#define KDBG_CLASS_ENCODE(Class, SubClass) (((Class & 0xff) << 24) | ((SubClass & 0xff) << 16))
#define KDBG_CLASS_DECODE(Debugid) (Debugid & 0xFFFF0000)
#endif
#endif
__END_DECLS
#ifdef PRIVATE
#ifdef __APPLE_API_PRIVATE
typedef struct {
uint64_t timestamp;
uintptr_t arg1;
uintptr_t arg2;
uintptr_t arg3;
uintptr_t arg4;
uintptr_t arg5;
uint32_t debugid;
#if defined(__LP64__)
uint32_t cpuid;
uintptr_t unused;
#endif
} kd_buf;
#if !defined(__LP64__)
#define KDBG_TIMESTAMP_MASK 0x00ffffffffffffffULL
#define KDBG_CPU_MASK 0xff00000000000000ULL
#define KDBG_CPU_SHIFT 56
static inline void
kdbg_set_cpu(kd_buf *kp, int cpu)
{
kp->timestamp = (kp->timestamp & KDBG_TIMESTAMP_MASK) |
(((uint64_t) cpu) << KDBG_CPU_SHIFT);
}
static inline int
kdbg_get_cpu(kd_buf *kp)
{
return (int) (((kp)->timestamp & KDBG_CPU_MASK) >> KDBG_CPU_SHIFT);
}
static inline void
kdbg_set_timestamp(kd_buf *kp, uint64_t thetime)
{
kp->timestamp = thetime & KDBG_TIMESTAMP_MASK;
}
static inline uint64_t
kdbg_get_timestamp(kd_buf *kp)
{
return kp->timestamp & KDBG_TIMESTAMP_MASK;
}
static inline void
kdbg_set_timestamp_and_cpu(kd_buf *kp, uint64_t thetime, int cpu)
{
kp->timestamp = (thetime & KDBG_TIMESTAMP_MASK) |
(((uint64_t) cpu) << KDBG_CPU_SHIFT);
}
#else
#define KDBG_TIMESTAMP_MASK 0xffffffffffffffffULL
static inline void
kdbg_set_cpu(kd_buf *kp, int cpu)
{
kp->cpuid = cpu;
}
static inline int
kdbg_get_cpu(kd_buf *kp)
{
return kp->cpuid;
}
static inline void
kdbg_set_timestamp(kd_buf *kp, uint64_t thetime)
{
kp->timestamp = thetime;
}
static inline uint64_t
kdbg_get_timestamp(kd_buf *kp)
{
return kp->timestamp;
}
static inline void
kdbg_set_timestamp_and_cpu(kd_buf *kp, uint64_t thetime, int cpu)
{
kdbg_set_timestamp(kp, thetime);
kdbg_set_cpu(kp, cpu);
}
#endif
#define KDBG_TYPEFILTER_BITMAP_SIZE ( (256 * 256) / 8 )
#define KDBG_INIT 0x001
#define KDBG_NOWRAP 0x002
#define KDBG_FREERUN 0x004
#define KDBG_WRAPPED 0x008
#define KDBG_USERFLAGS (KDBG_FREERUN|KDBG_NOWRAP|KDBG_INIT)
#define KDBG_PIDCHECK 0x010
#define KDBG_MAPINIT 0x020
#define KDBG_PIDEXCLUDE 0x040
#define KDBG_LOCKINIT 0x080
#define KDBG_LP64 0x100
typedef struct {
unsigned int type;
unsigned int value1;
unsigned int value2;
unsigned int value3;
unsigned int value4;
} kd_regtype;
typedef struct
{
int nkdbufs;
int nolog;
int flags;
int nkdthreads;
int bufid;
} kbufinfo_t;
typedef struct {
uintptr_t thread;
int valid;
char command[20];
} kd_threadmap;
typedef struct {
uint32_t version_no;
uint32_t cpu_count;
} kd_cpumap_header;
#define KDBG_CPUMAP_IS_IOP 0x1
typedef struct {
uint32_t cpu_id;
uint32_t flags;
char name[8];
} kd_cpumap;
typedef struct {
int version_no;
int thread_count;
uint64_t TOD_secs;
uint32_t TOD_usecs;
} RAW_header;
#define RAW_VERSION0 0x55aa0000
#define RAW_VERSION1 0x55aa0101
#define KDBG_CLASSTYPE 0x10000
#define KDBG_SUBCLSTYPE 0x20000
#define KDBG_RANGETYPE 0x40000
#define KDBG_TYPENONE 0x80000
#define KDBG_CKTYPES 0xF0000
#define KDBG_RANGECHECK 0x100000
#define KDBG_VALCHECK 0x200000
#define KDBG_TYPEFILTER_CHECK ((uint32_t) 0x400000)
#define KDBG_BUFINIT 0x80000000
#define KDBG_MINRTCDEC 2500
#endif
#endif
#endif