]> git.saurik.com Git - apple/xnu.git/blobdiff - osfmk/kern/kcdata.h
xnu-4570.71.2.tar.gz
[apple/xnu.git] / osfmk / kern / kcdata.h
index 3e1c76d31dc4513b6aa7c39378195e401fc52747..702bfacbc30ea742facb12a3ce64fba2e4ac6695 100644 (file)
@@ -456,7 +456,7 @@ struct kcdata_type_definition {
 #define STACKSHOT_KCTYPE_DELTA_SINCE_TIMESTAMP 0x912u /* timestamp used for the delta stackshot */
 
 #define STACKSHOT_KCTYPE_TASK_DELTA_SNAPSHOT 0x940u   /* task_delta_snapshot_v2 */
-#define STACKSHOT_KCTYPE_THREAD_DELTA_SNAPSHOT 0x941u /* thread_delta_snapshot_v2 */
+#define STACKSHOT_KCTYPE_THREAD_DELTA_SNAPSHOT 0x941u /* thread_delta_snapshot_v* */
 
 #define STACKSHOT_KCTYPE_KERN_STACKLR 0x913u          /* uint32_t */
 #define STACKSHOT_KCTYPE_KERN_STACKLR64 0x914u        /* uint64_t */
@@ -468,6 +468,14 @@ struct kcdata_type_definition {
 #define STACKSHOT_KCTYPE_STACKSHOT_DURATION 0x91au    /* struct stackshot_duration */
 #define STACKSHOT_KCTYPE_STACKSHOT_FAULT_STATS 0x91bu /* struct stackshot_fault_stats */
 #define STACKSHOT_KCTYPE_KERNELCACHE_LOADINFO  0x91cu /* kernelcache UUID -- same as KCDATA_TYPE_LIBRARY_LOADINFO64 */
+#define STACKSHOT_KCTYPE_THREAD_WAITINFO 0x91du       /* struct stackshot_thread_waitinfo */
+#define STACKSHOT_KCTYPE_THREAD_GROUP_SNAPSHOT 0x91eu /* struct thread_group_snapshot or thread_group_snapshot_v2 */
+#define STACKSHOT_KCTYPE_THREAD_GROUP 0x91fu          /* uint64_t */
+#define STACKSHOT_KCTYPE_JETSAM_COALITION_SNAPSHOT 0x920u /* struct jetsam_coalition_snapshot */
+#define STACKSHOT_KCTYPE_JETSAM_COALITION 0x921u      /* uint64_t */
+#define STACKSHOT_KCTYPE_INSTRS_CYCLES 0x923u         /* struct instrs_cycles_snapshot */
+
+#define STACKSHOT_KCTYPE_THREAD_POLICY_VERSION 0x922u /* THREAD_POLICY_INTERNAL_STRUCT_VERSION in uint32 */
 
 struct stack_snapshot_frame32 {
        uint32_t lr;
@@ -543,6 +551,7 @@ enum thread_snapshot_flags {
        kThreadTriedFaultBT   = 0x400,  /* We tried to fault in thread stack pages as part of BT */
        kThreadOnCore         = 0x800,  /* Thread was on-core when we entered debugger context */
        kThreadIdleWorker     = 0x1000, /* Thread is an idle libpthread worker thread */
+       kThreadMain           = 0x2000, /* Thread is the main thread */
 };
 
 struct mem_and_io_snapshot {
@@ -618,6 +627,68 @@ struct thread_snapshot_v3 {
        uint64_t ths_thread_t;
 } __attribute__((packed));
 
+
+struct thread_snapshot_v4 {
+       uint64_t ths_thread_id;
+       uint64_t ths_wait_event;
+       uint64_t ths_continuation;
+       uint64_t ths_total_syscalls;
+       uint64_t ths_voucher_identifier;
+       uint64_t ths_dqserialnum;
+       uint64_t ths_user_time;
+       uint64_t ths_sys_time;
+       uint64_t ths_ss_flags;
+       uint64_t ths_last_run_time;
+       uint64_t ths_last_made_runnable_time;
+       uint32_t ths_state;
+       uint32_t ths_sched_flags;
+       int16_t ths_base_priority;
+       int16_t ths_sched_priority;
+       uint8_t ths_eqos;
+       uint8_t ths_rqos;
+       uint8_t ths_rqos_override;
+       uint8_t ths_io_tier;
+       uint64_t ths_thread_t;
+       uint64_t ths_requested_policy;
+       uint64_t ths_effective_policy;
+} __attribute__((packed));
+
+
+struct thread_group_snapshot {
+       uint64_t tgs_id;
+       char tgs_name[16];
+} __attribute__((packed));
+
+enum thread_group_flags {
+       kThreadGroupEfficient = 0x1,
+       kThreadGroupUIApp = 0x2
+};
+
+struct thread_group_snapshot_v2 {
+       uint64_t tgs_id;
+       char tgs_name[16];
+       uint64_t tgs_flags;
+} __attribute__((packed));
+
+enum coalition_flags {
+       kCoalitionTermRequested = 0x1,
+       kCoalitionTerminated    = 0x2,
+       kCoalitionReaped        = 0x4,
+       kCoalitionPrivileged    = 0x8,
+};
+
+struct jetsam_coalition_snapshot {
+       uint64_t jcs_id;
+       uint64_t jcs_flags;
+       uint64_t jcs_thread_group;
+       uint64_t jcs_leader_task_uniqueid;
+} __attribute__((packed));
+
+struct instrs_cycles_snapshot {
+       uint64_t ics_instructions;
+       uint64_t ics_cycles;
+} __attribute__((packed));
+
 struct thread_delta_snapshot_v2 {
        uint64_t  tds_thread_id;
        uint64_t  tds_voucher_identifier;
@@ -633,6 +704,23 @@ struct thread_delta_snapshot_v2 {
        uint8_t   tds_io_tier;
 } __attribute__ ((packed));
 
+struct thread_delta_snapshot_v3 {
+       uint64_t  tds_thread_id;
+       uint64_t  tds_voucher_identifier;
+       uint64_t  tds_ss_flags;
+       uint64_t  tds_last_made_runnable_time;
+       uint32_t  tds_state;
+       uint32_t  tds_sched_flags;
+       int16_t   tds_base_priority;
+       int16_t   tds_sched_priority;
+       uint8_t   tds_eqos;
+       uint8_t   tds_rqos;
+       uint8_t   tds_rqos_override;
+       uint8_t   tds_io_tier;
+       uint64_t  tds_requested_policy;
+       uint64_t  tds_effective_policy;
+} __attribute__ ((packed));
+
 struct io_stats_snapshot
 {
        /*
@@ -709,6 +797,22 @@ struct stackshot_fault_stats {
        uint8_t  sfs_stopped_faulting;      /* we stopped decompressing because we hit the limit */
 } __attribute__((packed));
 
+typedef struct stackshot_thread_waitinfo {
+       uint64_t owner;         /* The thread that owns the object */
+       uint64_t waiter;        /* The thread that's waiting on the object */
+       uint64_t context;       /* A context uniquely identifying the object */
+       uint8_t wait_type;      /* The type of object that the thread is waiting on */
+} __attribute__((packed)) thread_waitinfo_t;
+
+#define STACKSHOT_WAITOWNER_KERNEL         (UINT64_MAX - 1)
+#define STACKSHOT_WAITOWNER_PORT_LOCKED    (UINT64_MAX - 2)
+#define STACKSHOT_WAITOWNER_PSET_LOCKED    (UINT64_MAX - 3)
+#define STACKSHOT_WAITOWNER_INTRANSIT      (UINT64_MAX - 4)
+#define STACKSHOT_WAITOWNER_MTXSPIN        (UINT64_MAX - 5)
+#define STACKSHOT_WAITOWNER_THREQUESTED    (UINT64_MAX - 6) /* workloop waiting for a new worker thread */
+#define STACKSHOT_WAITOWNER_SUSPENDED      (UINT64_MAX - 7) /* workloop is suspended */
+
+
 /**************** definitions for crashinfo *********************/
 
 /*
@@ -718,13 +822,22 @@ struct stackshot_fault_stats {
 
 /* FIXME some of these types aren't clean (fixed width,  packed, and defined *here*) */
 
+struct crashinfo_proc_uniqidentifierinfo {
+       uint8_t                 p_uuid[16];             /* UUID of the main executable */
+       uint64_t                p_uniqueid;             /* 64 bit unique identifier for process */
+       uint64_t                p_puniqueid;            /* unique identifier for process's parent */
+       uint64_t                p_reserve2;             /* reserved for future use */
+       uint64_t                p_reserve3;             /* reserved for future use */
+       uint64_t                p_reserve4;             /* reserved for future use */
+} __attribute__((packed));
+
 #define TASK_CRASHINFO_BEGIN                KCDATA_BUFFER_BEGIN_CRASHINFO
 #define TASK_CRASHINFO_STRING_DESC          KCDATA_TYPE_STRING_DESC
 #define TASK_CRASHINFO_UINT32_DESC          KCDATA_TYPE_UINT32_DESC
 #define TASK_CRASHINFO_UINT64_DESC          KCDATA_TYPE_UINT64_DESC
 
 #define TASK_CRASHINFO_EXTMODINFO           0x801
-#define TASK_CRASHINFO_BSDINFOWITHUNIQID    0x802 /* struct proc_uniqidentifierinfo */
+#define TASK_CRASHINFO_BSDINFOWITHUNIQID    0x802 /* struct crashinfo_proc_uniqidentifierinfo */
 #define TASK_CRASHINFO_TASKDYLD_INFO        0x803
 #define TASK_CRASHINFO_UUID                 0x804
 #define TASK_CRASHINFO_PID                  0x805
@@ -761,6 +874,8 @@ struct stackshot_fault_stats {
 #define EXIT_REASON_USER_DESC           0x1002 /* string description of reason */
 #define EXIT_REASON_USER_PAYLOAD        0x1003 /* user payload data */
 #define EXIT_REASON_CODESIGNING_INFO    0x1004
+#define EXIT_REASON_WORKLOOP_ID         0x1005
+#define EXIT_REASON_DISPATCH_QUEUE_NO   0x1006
 
 struct exit_reason_snapshot {
         uint32_t ers_namespace;