Skip to content

Detect and support BLOCK_SMALL_DESCRIPTOR #19

@droe

Description

@droe

Haven't seen that in the wild, but should attempt to detect and handle BLOCK_SMALL_DESCRIPTOR as per libclosure:

/// Large and small block descriptors have the following layout:
///
/// struct Large_block_descriptor {
///   // inline or out-of-line generic helper info.
///   uintptr_t generic_helper_info;
///   uintptr_t reserved; // Reserved or in-descriptor flag field.
///   uintptr_t size;  // size of Block_layout including the captured variables.
///   void *copy_helper_func;  // optional custom copy helper.
///   void *destroy_helper_func;  // optional custom copy helper.
///   void *signature; // pointer to the signature string.
///   void *extended_block_layout; // inline or out-of-line layout string.
/// };
///
/// struct Small_block_descriptor {
///   // inline or out-of-line generic helper info.
///   int32_t generic_helper_info;
///   uint32_t in_descriptor_flags;
///
///   // size of Block_layout including the captured variables.
///   uint32_t size : sizeof(uint32_t) * 8 - 1;
///
///   // A flag indicating the presence of in-descriptor flags.
///   uint32_t has_in_descriptor_flags : 1;
///
///   // the following fields contain relative offsets to pointers.
///   int32_t signature; // pointer to the signature string.
///   int32_t extended_block_layout; //  inline or out-of-line layout string.
///   int32_t copy_helper_func;  // optional custom copy helper.
///   int32_t destroy_helper_func; // optional custom destroy helper.
/// }
///
/// The in-descriptor flag field contains an exact copy of field `flags` of
/// `Block_layout` except that bit 22 (BLOCK_SMALL_DESCRIPTOR) is cleared out.
/// Bit 15_14 are used for generic block helper flags.
///
/// The address points of Large_block_descriptor and Small_block_descriptor are
/// fields `reserved` and `size` respectively.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions