- * In case of array of basic c types in kctype_subtype_t,
- * size is packed in lower 16 bits and
- * count is packed in upper 16 bits of kcs_elem_size field.
- */
-#define KCS_SUBTYPE_PACK_SIZE(e_count,e_size) (((e_count) & 0xffff) << 16 | ((e_size) & 0xffff))
-
-static inline uint32_t
-kcs_get_elem_size(kcdata_subtype_descriptor_t d)
-{
- if (d->kcs_flags & KCS_SUBTYPE_FLAGS_ARRAY) {
- /* size is composed as ((count &0xffff)<<16 | (elem_size & 0xffff)) */
- return (uint32_t)((d->kcs_elem_size & 0xffff) * ((d->kcs_elem_size & 0xffff0000)>>16));
- }
- return d->kcs_elem_size;
-}
-
-static inline uint32_t
-kcs_get_elem_count(kcdata_subtype_descriptor_t d)
-{
- if (d->kcs_flags & KCS_SUBTYPE_FLAGS_ARRAY)
- return (d->kcs_elem_size >> 16) & 0xffff;
- return 1;
-}
-
-static inline kern_return_t
-kcs_set_elem_size(kcdata_subtype_descriptor_t d, uint32_t size, uint32_t count)
-{
- if (count > 1) {
- /* means we are setting up an array */
- if (size > 0xffff || count > 0xffff)
- return KERN_INVALID_ARGUMENT;
- d->kcs_elem_size = ((count & 0xffff) << 16 | (size & 0xffff));
- }
- else
- {
- d->kcs_elem_size = size;
- }
- return KERN_SUCCESS;
-}
-
-struct kcdata_type_definition {
- uint32_t kct_type_identifier;
- uint32_t kct_num_elements;
- char kct_name[KCDATA_DESC_MAXLEN];
-#ifndef KERNEL
- struct kcdata_subtype_descriptor kct_elements[];
-#endif
-};
-
-/* chunk type definitions. 0 - 0x7ff are reserved and defined here
- * NOTE: Please update libkdd/kcdata/kcdtypes.c if you make any changes
- * in STACKSHOT_KCTYPE_* types.
- */
-
-/*
- * Types with description value.
- * these will have KCDATA_DESC_MAXLEN-1 length string description
- * and rest of KCDATA_ITEM_SIZE() - KCDATA_DESC_MAXLEN bytes as data
- */
-#define KCDATA_TYPE_INVALID 0x0
-#define KCDATA_TYPE_STRING_DESC 0x1
-#define KCDATA_TYPE_UINT32_DESC 0x2
-#define KCDATA_TYPE_UINT64_DESC 0x3
-#define KCDATA_TYPE_INT32_DESC 0x4
-#define KCDATA_TYPE_INT64_DESC 0x5
-#define KCDATA_TYPE_BINDATA_DESC 0x6
-
-/*
- * Compound type definitions
- */
-#define KCDATA_TYPE_ARRAY 0x11 /* Array of data */
-#define KCDATA_TYPE_TYPEDEFINTION 0x12 /* Meta type that describes a type on the fly. */
-#define KCDATA_TYPE_CONTAINER_BEGIN 0x13 /* Container type which has corresponding CONTAINER_END header.
- * KCDATA_TYPE_CONTAINER_BEGIN has type in the data segment.
- * Both headers have (uint64_t) ID for matching up nested data.
- */
-#define KCDATA_TYPE_CONTAINER_END 0x14
-
-
-/*
- * Generic data types that are most commonly used