+#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
+
+/* 2^16 bits (8 kilobytes), one for each possible class/subclass combination */
+#define KDBG_TYPEFILTER_BITMAP_SIZE ( (256 * 256) / 8 )