#include <stdio.h>
#include <math.h>
#include <side/macros.h>
+#include <side/endian.h>
/* SIDE stands for "Static Instrumentation Dynamically Enabled" */
SIDE_TYPE_S32,
SIDE_TYPE_S64,
SIDE_TYPE_BYTE,
+ SIDE_TYPE_POINTER,
SIDE_TYPE_FLOAT_BINARY16,
SIDE_TYPE_FLOAT_BINARY32,
SIDE_TYPE_FLOAT_BINARY64,
SIDE_TYPE_ARRAY_S32,
SIDE_TYPE_ARRAY_S64,
SIDE_TYPE_ARRAY_BYTE,
+ SIDE_TYPE_ARRAY_POINTER,
SIDE_TYPE_VLA_U8,
SIDE_TYPE_VLA_U16,
SIDE_TYPE_VLA_S32,
SIDE_TYPE_VLA_S64,
SIDE_TYPE_VLA_BYTE,
+ SIDE_TYPE_VLA_POINTER,
/* Enumeration types */
SIDE_TYPE_ENUM,
SIDE_DYNAMIC_TYPE_S32,
SIDE_DYNAMIC_TYPE_S64,
SIDE_DYNAMIC_TYPE_BYTE,
+ SIDE_DYNAMIC_TYPE_POINTER,
SIDE_DYNAMIC_TYPE_FLOAT_BINARY16,
SIDE_DYNAMIC_TYPE_FLOAT_BINARY32,
SIDE_DYNAMIC_TYPE_FLOAT_BINARY64,
SIDE_ATTR_TYPE_S16,
SIDE_ATTR_TYPE_S32,
SIDE_ATTR_TYPE_S64,
+ SIDE_ATTR_TYPE_POINTER,
SIDE_ATTR_TYPE_FLOAT_BINARY16,
SIDE_ATTR_TYPE_FLOAT_BINARY32,
SIDE_ATTR_TYPE_FLOAT_BINARY64,
SIDE_ERROR_EXITING = 5,
};
+enum side_type_byte_order {
+ SIDE_TYPE_BYTE_ORDER_LE = 0,
+ SIDE_TYPE_BYTE_ORDER_BE = 1,
+};
+
+#if (SIDE_BYTE_ORDER == SIDE_LITTLE_ENDIAN)
+# define SIDE_TYPE_BYTE_ORDER_HOST SIDE_TYPE_BYTE_ORDER_LE
+#else
+# define SIDE_TYPE_BYTE_ORDER_HOST SIDE_TYPE_BYTE_ORDER_BE
+#endif
+
+#if (SIDE_FLOAT_WORD_ORDER == SIDE_LITTLE_ENDIAN)
+# define SIDE_TYPE_FLOAT_WORD_ORDER_HOST SIDE_TYPE_BYTE_ORDER_LE
+#else
+# define SIDE_TYPE_FLOAT_WORD_ORDER_HOST SIDE_TYPE_BYTE_ORDER_BE
+#endif
+
typedef enum side_visitor_status (*side_visitor)(
const struct side_tracer_visitor_ctx *tracer_ctx,
void *app_ctx);
int16_t side_s16;
int32_t side_s32;
int64_t side_s64;
+ uintptr_t side_pointer;
#if __HAVE_FLOAT16
_Float16 side_float_binary16;
#endif
struct {
const struct side_attr *attr;
uint32_t nr_attr;
+ uint32_t byte_order; /* enum side_type_byte_order */
} side_basic;
/* Compound types */
};
struct side_event_description {
- uint32_t version;
- uint32_t *enabled;
- uint32_t loglevel; /* enum side_loglevel */
- uint32_t nr_fields;
- uint32_t nr_attr;
- uint32_t _unused;
- uint64_t flags;
+ uintptr_t *enabled;
const char *provider_name;
const char *event_name;
const struct side_event_field *fields;
const struct side_attr *attr;
const struct side_callback *callbacks;
+ uint64_t flags;
+ uint32_t version;
+ uint32_t loglevel; /* enum side_loglevel */
+ uint32_t nr_fields;
+ uint32_t nr_attr;
+ uint32_t nr_callbacks;
};
struct side_arg_dynamic_vec {
struct {
const struct side_attr *attr;
uint32_t nr_attr;
+ uint32_t byte_order; /* enum side_type_byte_order */
union {
uint8_t side_bool;
uint8_t side_u8;
int32_t side_s32;
int64_t side_s64;
uint8_t side_byte;
+ uintptr_t side_pointer;
#if __HAVE_FLOAT16
_Float16 side_float_binary16;
#endif
int32_t side_s32;
int64_t side_s64;
uint8_t side_byte;
+ uintptr_t side_pointer;
#if __HAVE_FLOAT16
_Float16 side_float_binary16;
#endif
#define side_attr_s16(_val) { .type = SIDE_ATTR_TYPE_S16, .u = { .side_s16 = (_val) } }
#define side_attr_s32(_val) { .type = SIDE_ATTR_TYPE_S32, .u = { .side_s32 = (_val) } }
#define side_attr_s64(_val) { .type = SIDE_ATTR_TYPE_S64, .u = { .side_s64 = (_val) } }
+#define side_attr_pointer(_val) { .type = SIDE_ATTR_TYPE_POINTER, .u = { .side_pointer = (uintptr_t) (_val) } }
#define side_attr_float_binary16(_val) { .type = SIDE_ATTR_TYPE_FLOAT_BINARY16, .u = { .side_float_binary16 = (_val) } }
#define side_attr_float_binary32(_val) { .type = SIDE_ATTR_TYPE_FLOAT_BINARY32, .u = { .side_float_binary32 = (_val) } }
#define side_attr_float_binary64(_val) { .type = SIDE_ATTR_TYPE_FLOAT_BINARY64, .u = { .side_float_binary64 = (_val) } }
/* Static field definition */
-#define _side_type_basic(_type, _attr) \
+#define _side_type_basic(_type, _byte_order, _attr) \
{ \
.type = _type, \
.u = { \
.side_basic = { \
.attr = _attr, \
.nr_attr = SIDE_ARRAY_SIZE(SIDE_PARAM(_attr)), \
+ .byte_order = _byte_order, \
}, \
}, \
}
-#define side_type_bool(_attr) _side_type_basic(SIDE_TYPE_BOOL, SIDE_PARAM(_attr))
-#define side_type_u8(_attr) _side_type_basic(SIDE_TYPE_U8, SIDE_PARAM(_attr))
-#define side_type_u16(_attr) _side_type_basic(SIDE_TYPE_U16, SIDE_PARAM(_attr))
-#define side_type_u32(_attr) _side_type_basic(SIDE_TYPE_U32, SIDE_PARAM(_attr))
-#define side_type_u64(_attr) _side_type_basic(SIDE_TYPE_U64, SIDE_PARAM(_attr))
-#define side_type_s8(_attr) _side_type_basic(SIDE_TYPE_S8, SIDE_PARAM(_attr))
-#define side_type_s16(_attr) _side_type_basic(SIDE_TYPE_S16, SIDE_PARAM(_attr))
-#define side_type_s32(_attr) _side_type_basic(SIDE_TYPE_S32, SIDE_PARAM(_attr))
-#define side_type_s64(_attr) _side_type_basic(SIDE_TYPE_S64, SIDE_PARAM(_attr))
-#define side_type_byte(_attr) _side_type_basic(SIDE_TYPE_BYTE, SIDE_PARAM(_attr))
-#define side_type_float_binary16(_attr) _side_type_basic(SIDE_TYPE_FLOAT_BINARY16, SIDE_PARAM(_attr))
-#define side_type_float_binary32(_attr) _side_type_basic(SIDE_TYPE_FLOAT_BINARY32, SIDE_PARAM(_attr))
-#define side_type_float_binary64(_attr) _side_type_basic(SIDE_TYPE_FLOAT_BINARY64, SIDE_PARAM(_attr))
-#define side_type_float_binary128(_attr) _side_type_basic(SIDE_TYPE_FLOAT_BINARY128, SIDE_PARAM(_attr))
-#define side_type_string(_attr) _side_type_basic(SIDE_TYPE_STRING, SIDE_PARAM(_attr))
-#define side_type_dynamic(_attr) _side_type_basic(SIDE_TYPE_DYNAMIC, SIDE_PARAM(_attr))
-
#define _side_field(_name, _type) \
{ \
.field_name = _name, \
.side_type = _type, \
}
+/* Host endian */
+#define side_type_bool(_attr) _side_type_basic(SIDE_TYPE_BOOL, SIDE_TYPE_BYTE_ORDER_HOST, SIDE_PARAM(_attr))
+#define side_type_u8(_attr) _side_type_basic(SIDE_TYPE_U8, SIDE_TYPE_BYTE_ORDER_HOST, SIDE_PARAM(_attr))
+#define side_type_u16(_attr) _side_type_basic(SIDE_TYPE_U16, SIDE_TYPE_BYTE_ORDER_HOST, SIDE_PARAM(_attr))
+#define side_type_u32(_attr) _side_type_basic(SIDE_TYPE_U32, SIDE_TYPE_BYTE_ORDER_HOST, SIDE_PARAM(_attr))
+#define side_type_u64(_attr) _side_type_basic(SIDE_TYPE_U64, SIDE_TYPE_BYTE_ORDER_HOST, SIDE_PARAM(_attr))
+#define side_type_s8(_attr) _side_type_basic(SIDE_TYPE_S8, SIDE_TYPE_BYTE_ORDER_HOST, SIDE_PARAM(_attr))
+#define side_type_s16(_attr) _side_type_basic(SIDE_TYPE_S16, SIDE_TYPE_BYTE_ORDER_HOST, SIDE_PARAM(_attr))
+#define side_type_s32(_attr) _side_type_basic(SIDE_TYPE_S32, SIDE_TYPE_BYTE_ORDER_HOST, SIDE_PARAM(_attr))
+#define side_type_s64(_attr) _side_type_basic(SIDE_TYPE_S64, SIDE_TYPE_BYTE_ORDER_HOST, SIDE_PARAM(_attr))
+#define side_type_byte(_attr) _side_type_basic(SIDE_TYPE_BYTE, SIDE_TYPE_BYTE_ORDER_HOST, SIDE_PARAM(_attr))
+#define side_type_pointer(_attr) _side_type_basic(SIDE_TYPE_POINTER, SIDE_TYPE_BYTE_ORDER_HOST, SIDE_PARAM(_attr))
+#define side_type_float_binary16(_attr) _side_type_basic(SIDE_TYPE_FLOAT_BINARY16, SIDE_TYPE_FLOAT_WORD_ORDER_HOST, SIDE_PARAM(_attr))
+#define side_type_float_binary32(_attr) _side_type_basic(SIDE_TYPE_FLOAT_BINARY32, SIDE_TYPE_FLOAT_WORD_ORDER_HOST, SIDE_PARAM(_attr))
+#define side_type_float_binary64(_attr) _side_type_basic(SIDE_TYPE_FLOAT_BINARY64, SIDE_TYPE_FLOAT_WORD_ORDER_HOST, SIDE_PARAM(_attr))
+#define side_type_float_binary128(_attr) _side_type_basic(SIDE_TYPE_FLOAT_BINARY128, SIDE_TYPE_FLOAT_WORD_ORDER_HOST, SIDE_PARAM(_attr))
+#define side_type_string(_attr) _side_type_basic(SIDE_TYPE_STRING, SIDE_TYPE_BYTE_ORDER_HOST, SIDE_PARAM(_attr))
+#define side_type_dynamic(_attr) _side_type_basic(SIDE_TYPE_DYNAMIC, SIDE_TYPE_BYTE_ORDER_HOST, SIDE_PARAM(_attr))
+
#define side_field_bool(_name, _attr) _side_field(_name, side_type_bool(SIDE_PARAM(_attr)))
#define side_field_u8(_name, _attr) _side_field(_name, side_type_u8(SIDE_PARAM(_attr)))
#define side_field_u16(_name, _attr) _side_field(_name, side_type_u16(SIDE_PARAM(_attr)))
#define side_field_s32(_name, _attr) _side_field(_name, side_type_s32(SIDE_PARAM(_attr)))
#define side_field_s64(_name, _attr) _side_field(_name, side_type_s64(SIDE_PARAM(_attr)))
#define side_field_byte(_name, _attr) _side_field(_name, side_type_byte(SIDE_PARAM(_attr)))
+#define side_field_pointer(_name, _attr) _side_field(_name, side_type_pointer(SIDE_PARAM(_attr)))
#define side_field_float_binary16(_name, _attr) _side_field(_name, side_type_float_binary16(SIDE_PARAM(_attr)))
#define side_field_float_binary32(_name, _attr) _side_field(_name, side_type_float_binary32(SIDE_PARAM(_attr)))
#define side_field_float_binary64(_name, _attr) _side_field(_name, side_type_float_binary64(SIDE_PARAM(_attr)))
#define side_field_string(_name, _attr) _side_field(_name, side_type_string(SIDE_PARAM(_attr)))
#define side_field_dynamic(_name, _attr) _side_field(_name, side_type_dynamic(SIDE_PARAM(_attr)))
+/* Little endian */
+#define side_type_u16_le(_attr) _side_type_basic(SIDE_TYPE_U16, SIDE_TYPE_BYTE_ORDER_LE, SIDE_PARAM(_attr))
+#define side_type_u32_le(_attr) _side_type_basic(SIDE_TYPE_U32, SIDE_TYPE_BYTE_ORDER_LE, SIDE_PARAM(_attr))
+#define side_type_u64_le(_attr) _side_type_basic(SIDE_TYPE_U64, SIDE_TYPE_BYTE_ORDER_LE, SIDE_PARAM(_attr))
+#define side_type_s16_le(_attr) _side_type_basic(SIDE_TYPE_S16, SIDE_TYPE_BYTE_ORDER_LE, SIDE_PARAM(_attr))
+#define side_type_s32_le(_attr) _side_type_basic(SIDE_TYPE_S32, SIDE_TYPE_BYTE_ORDER_LE, SIDE_PARAM(_attr))
+#define side_type_s64_le(_attr) _side_type_basic(SIDE_TYPE_S64, SIDE_TYPE_BYTE_ORDER_LE, SIDE_PARAM(_attr))
+#define side_type_pointer_le(_attr) _side_type_basic(SIDE_TYPE_POINTER, SIDE_TYPE_BYTE_ORDER_LE, SIDE_PARAM(_attr))
+#define side_type_float_binary16_le(_attr) _side_type_basic(SIDE_TYPE_FLOAT_BINARY16, SIDE_TYPE_BYTE_ORDER_LE, SIDE_PARAM(_attr))
+#define side_type_float_binary32_le(_attr) _side_type_basic(SIDE_TYPE_FLOAT_BINARY32, SIDE_TYPE_BYTE_ORDER_LE, SIDE_PARAM(_attr))
+#define side_type_float_binary64_le(_attr) _side_type_basic(SIDE_TYPE_FLOAT_BINARY64, SIDE_TYPE_BYTE_ORDER_LE, SIDE_PARAM(_attr))
+#define side_type_float_binary128_le(_attr) _side_type_basic(SIDE_TYPE_FLOAT_BINARY128, SIDE_TYPE_BYTE_ORDER_LE, SIDE_PARAM(_attr))
+
+#define side_field_u16_le(_name, _attr) _side_field(_name, side_type_u16_le(SIDE_PARAM(_attr)))
+#define side_field_u32_le(_name, _attr) _side_field(_name, side_type_u32_le(SIDE_PARAM(_attr)))
+#define side_field_u64_le(_name, _attr) _side_field(_name, side_type_u64_le(SIDE_PARAM(_attr)))
+#define side_field_s16_le(_name, _attr) _side_field(_name, side_type_s16_le(SIDE_PARAM(_attr)))
+#define side_field_s32_le(_name, _attr) _side_field(_name, side_type_s32_le(SIDE_PARAM(_attr)))
+#define side_field_s64_le(_name, _attr) _side_field(_name, side_type_s64_le(SIDE_PARAM(_attr)))
+#define side_field_pointer_le(_name, _attr) _side_field(_name, side_type_pointer_le(SIDE_PARAM(_attr)))
+#define side_field_float_binary16_le(_name, _attr) _side_field(_name, side_type_float_binary16_le(SIDE_PARAM(_attr)))
+#define side_field_float_binary32_le(_name, _attr) _side_field(_name, side_type_float_binary32_le(SIDE_PARAM(_attr)))
+#define side_field_float_binary64_le(_name, _attr) _side_field(_name, side_type_float_binary64_le(SIDE_PARAM(_attr)))
+#define side_field_float_binary128_le(_name, _attr) _side_field(_name, side_type_float_binary128_le(SIDE_PARAM(_attr)))
+
+/* Big endian */
+#define side_type_u16_be(_attr) _side_type_basic(SIDE_TYPE_U16, SIDE_TYPE_BYTE_ORDER_BE, SIDE_PARAM(_attr))
+#define side_type_u32_be(_attr) _side_type_basic(SIDE_TYPE_U32, SIDE_TYPE_BYTE_ORDER_BE, SIDE_PARAM(_attr))
+#define side_type_u64_be(_attr) _side_type_basic(SIDE_TYPE_U64, SIDE_TYPE_BYTE_ORDER_BE, SIDE_PARAM(_attr))
+#define side_type_s16_be(_attr) _side_type_basic(SIDE_TYPE_S16, SIDE_TYPE_BYTE_ORDER_BE, SIDE_PARAM(_attr))
+#define side_type_s32_be(_attr) _side_type_basic(SIDE_TYPE_S32, SIDE_TYPE_BYTE_ORDER_BE, SIDE_PARAM(_attr))
+#define side_type_s64_be(_attr) _side_type_basic(SIDE_TYPE_S64, SIDE_TYPE_BYTE_ORDER_BE, SIDE_PARAM(_attr))
+#define side_type_pointer_be(_attr) _side_type_basic(SIDE_TYPE_POINTER, SIDE_TYPE_BYTE_ORDER_BE, SIDE_PARAM(_attr))
+#define side_type_float_binary16_be(_attr) _side_type_basic(SIDE_TYPE_FLOAT_BINARY16, SIDE_TYPE_BYTE_ORDER_BE, SIDE_PARAM(_attr))
+#define side_type_float_binary32_be(_attr) _side_type_basic(SIDE_TYPE_FLOAT_BINARY32, SIDE_TYPE_BYTE_ORDER_BE, SIDE_PARAM(_attr))
+#define side_type_float_binary64_be(_attr) _side_type_basic(SIDE_TYPE_FLOAT_BINARY64, SIDE_TYPE_BYTE_ORDER_BE, SIDE_PARAM(_attr))
+#define side_type_float_binary128_be(_attr) _side_type_basic(SIDE_TYPE_FLOAT_BINARY128, SIDE_TYPE_BYTE_ORDER_BE, SIDE_PARAM(_attr))
+
+#define side_field_u16_be(_name, _attr) _side_field(_name, side_type_u16_be(SIDE_PARAM(_attr)))
+#define side_field_u32_be(_name, _attr) _side_field(_name, side_type_u32_be(SIDE_PARAM(_attr)))
+#define side_field_u64_be(_name, _attr) _side_field(_name, side_type_u64_be(SIDE_PARAM(_attr)))
+#define side_field_s16_be(_name, _attr) _side_field(_name, side_type_s16_be(SIDE_PARAM(_attr)))
+#define side_field_s32_be(_name, _attr) _side_field(_name, side_type_s32_be(SIDE_PARAM(_attr)))
+#define side_field_s64_be(_name, _attr) _side_field(_name, side_type_s64_be(SIDE_PARAM(_attr)))
+#define side_field_pointer_be(_name, _attr) _side_field(_name, side_type_pointer_be(SIDE_PARAM(_attr)))
+#define side_field_float_binary16_be(_name, _attr) _side_field(_name, side_type_float_binary16_be(SIDE_PARAM(_attr)))
+#define side_field_float_binary32_be(_name, _attr) _side_field(_name, side_type_float_binary32_be(SIDE_PARAM(_attr)))
+#define side_field_float_binary64_be(_name, _attr) _side_field(_name, side_type_float_binary64_be(SIDE_PARAM(_attr)))
+#define side_field_float_binary128_be(_name, _attr) _side_field(_name, side_type_float_binary128_be(SIDE_PARAM(_attr)))
+
#define side_type_enum(_mappings, _elem_type) \
{ \
.type = SIDE_TYPE_ENUM, \
#define side_arg_s32(_val) { .type = SIDE_TYPE_S32, .u = { .side_s32 = (_val) } }
#define side_arg_s64(_val) { .type = SIDE_TYPE_S64, .u = { .side_s64 = (_val) } }
#define side_arg_byte(_val) { .type = SIDE_TYPE_BYTE, .u = { .side_byte = (_val) } }
+#define side_arg_pointer(_val) { .type = SIDE_TYPE_POINTER, .u = { .side_pointer = (uintptr_t) (_val) } }
#define side_arg_enum_bitmap8(_val) { .type = SIDE_TYPE_ENUM_BITMAP8, .u = { .side_u8 = (_val) } }
#define side_arg_enum_bitmap16(_val) { .type = SIDE_TYPE_ENUM_BITMAP16, .u = { .side_u16 = (_val) } }
#define side_arg_enum_bitmap32(_val) { .type = SIDE_TYPE_ENUM_BITMAP32, .u = { .side_u32 = (_val) } }
#define side_arg_array_s32(_ptr) { .type = SIDE_TYPE_ARRAY_S32, .u = { .side_array_fixint = (_ptr) } }
#define side_arg_array_s64(_ptr) { .type = SIDE_TYPE_ARRAY_S64, .u = { .side_array_fixint = (_ptr) } }
#define side_arg_array_byte(_ptr) { .type = SIDE_TYPE_ARRAY_BYTE, .u = { .side_array_fixint = (_ptr) } }
+#define side_arg_array_pointer(_ptr) { .type = SIDE_TYPE_ARRAY_POINTER, .u = { .side_array_fixint = (_ptr) } }
#define side_arg_vla_u8(_ptr, _length) { .type = SIDE_TYPE_VLA_U8, .u = { .side_vla_fixint = { .p = (_ptr), .length = (_length) } }
#define side_arg_vla_u16(_ptr, _length) { .type = SIDE_TYPE_VLA_U16, .u = { .side_vla_fixint = { .p = (_ptr), .length = (_length) } } }
#define side_arg_vla_s32(_ptr, _length) { .type = SIDE_TYPE_VLA_S32, .u = { .side_vla_fixint = { .p = (_ptr), .length = (_length) } } }
#define side_arg_vla_s64(_ptr, _length) { .type = SIDE_TYPE_VLA_S64, .u = { .side_vla_fixint = { .p = (_ptr), .length = (_length) } } }
#define side_arg_vla_byte(_ptr, _length) { .type = SIDE_TYPE_VLA_BYTE, .u = { .side_vla_fixint = { .p = (_ptr), .length = (_length) } } }
+#define side_arg_vla_pointer(_ptr, _length) { .type = SIDE_TYPE_VLA_POINTER, .u = { .side_vla_fixint = { .p = (_ptr), .length = (_length) } } }
#define side_arg_dynamic(_dynamic_arg_type) \
{ \
.side_basic = { \
.attr = _attr, \
.nr_attr = SIDE_ARRAY_SIZE(SIDE_PARAM(_attr)), \
+ .byte_order = SIDE_TYPE_BYTE_ORDER_HOST, \
}, \
}, \
}
.side_basic = { \
.attr = _attr, \
.nr_attr = SIDE_ARRAY_SIZE(SIDE_PARAM(_attr)), \
+ .byte_order = SIDE_TYPE_BYTE_ORDER_HOST, \
.u = { \
.side_bool = !!(_val), \
}, \
.side_basic = { \
.attr = _attr, \
.nr_attr = SIDE_ARRAY_SIZE(SIDE_PARAM(_attr)), \
+ .byte_order = SIDE_TYPE_BYTE_ORDER_HOST, \
.u = { \
.side_u8 = (_val), \
}, \
}, \
}, \
}
-#define side_arg_dynamic_u16(_val, _attr) \
+#define side_arg_dynamic_s8(_val, _attr) \
{ \
- .dynamic_type = SIDE_DYNAMIC_TYPE_U16, \
+ .dynamic_type = SIDE_DYNAMIC_TYPE_S8, \
.u = { \
.side_basic = { \
.attr = _attr, \
.nr_attr = SIDE_ARRAY_SIZE(SIDE_PARAM(_attr)), \
+ .byte_order = SIDE_TYPE_BYTE_ORDER_HOST, \
.u = { \
- .side_u16 = (_val), \
+ .side_s8 = (_val), \
}, \
}, \
}, \
}
-#define side_arg_dynamic_u32(_val, _attr) \
+#define side_arg_dynamic_byte(_val, _attr) \
{ \
- .dynamic_type = SIDE_DYNAMIC_TYPE_U32, \
+ .dynamic_type = SIDE_DYNAMIC_TYPE_BYTE, \
.u = { \
.side_basic = { \
.attr = _attr, \
.nr_attr = SIDE_ARRAY_SIZE(SIDE_PARAM(_attr)), \
+ .byte_order = SIDE_TYPE_BYTE_ORDER_HOST, \
.u = { \
- .side_u32 = (_val), \
+ .side_byte = (_val), \
}, \
}, \
}, \
}
-#define side_arg_dynamic_u64(_val, _attr) \
+#define side_arg_dynamic_string(_val, _attr) \
{ \
- .dynamic_type = SIDE_DYNAMIC_TYPE_U64, \
+ .dynamic_type = SIDE_DYNAMIC_TYPE_STRING, \
.u = { \
.side_basic = { \
.attr = _attr, \
.nr_attr = SIDE_ARRAY_SIZE(SIDE_PARAM(_attr)), \
+ .byte_order = SIDE_TYPE_BYTE_ORDER_HOST, \
.u = { \
- .side_u64 = (_val), \
+ .string = (_val), \
}, \
}, \
}, \
}
-#define side_arg_dynamic_s8(_val, _attr) \
+#define _side_arg_dynamic_u16(_val, _byte_order, _attr) \
{ \
- .dynamic_type = SIDE_DYNAMIC_TYPE_S8, \
+ .dynamic_type = SIDE_DYNAMIC_TYPE_U16, \
.u = { \
.side_basic = { \
.attr = _attr, \
.nr_attr = SIDE_ARRAY_SIZE(SIDE_PARAM(_attr)), \
+ .byte_order = _byte_order, \
.u = { \
- .side_s8 = (_val), \
+ .side_u16 = (_val), \
}, \
}, \
}, \
}
-#define side_arg_dynamic_s16(_val, _attr) \
+#define _side_arg_dynamic_u32(_val, _byte_order, _attr) \
+ { \
+ .dynamic_type = SIDE_DYNAMIC_TYPE_U32, \
+ .u = { \
+ .side_basic = { \
+ .attr = _attr, \
+ .nr_attr = SIDE_ARRAY_SIZE(SIDE_PARAM(_attr)), \
+ .byte_order = _byte_order, \
+ .u = { \
+ .side_u32 = (_val), \
+ }, \
+ }, \
+ }, \
+ }
+#define _side_arg_dynamic_u64(_val, _byte_order, _attr) \
+ { \
+ .dynamic_type = SIDE_DYNAMIC_TYPE_U64, \
+ .u = { \
+ .side_basic = { \
+ .attr = _attr, \
+ .nr_attr = SIDE_ARRAY_SIZE(SIDE_PARAM(_attr)), \
+ .byte_order = _byte_order, \
+ .u = { \
+ .side_u64 = (_val), \
+ }, \
+ }, \
+ }, \
+ }
+
+#define _side_arg_dynamic_s16(_val, _byte_order, _attr) \
{ \
.dynamic_type = SIDE_DYNAMIC_TYPE_S16, \
.u = { \
.side_basic = { \
.attr = _attr, \
.nr_attr = SIDE_ARRAY_SIZE(SIDE_PARAM(_attr)), \
+ .byte_order = _byte_order, \
.u = { \
.side_s16 = (_val), \
}, \
}, \
}, \
}
-#define side_arg_dynamic_s32(_val, _attr) \
+#define _side_arg_dynamic_s32(_val, _byte_order, _attr) \
{ \
.dynamic_type = SIDE_DYNAMIC_TYPE_S32, \
.u = { \
.side_basic = { \
.attr = _attr, \
.nr_attr = SIDE_ARRAY_SIZE(SIDE_PARAM(_attr)), \
+ .byte_order = _byte_order, \
.u = { \
.side_s32 = (_val), \
}, \
}, \
}, \
}
-#define side_arg_dynamic_s64(_val, _attr) \
+#define _side_arg_dynamic_s64(_val, _byte_order, _attr) \
{ \
.dynamic_type = SIDE_DYNAMIC_TYPE_S64, \
.u = { \
.side_basic = { \
.attr = _attr, \
.nr_attr = SIDE_ARRAY_SIZE(SIDE_PARAM(_attr)), \
+ .byte_order = _byte_order, \
.u = { \
.side_s64 = (_val), \
}, \
}, \
}, \
}
-#define side_arg_dynamic_byte(_val, _attr) \
+#define _side_arg_dynamic_pointer(_val, _byte_order, _attr) \
{ \
- .dynamic_type = SIDE_DYNAMIC_TYPE_BYTE, \
+ .dynamic_type = SIDE_DYNAMIC_TYPE_POINTER, \
.u = { \
.side_basic = { \
.attr = _attr, \
.nr_attr = SIDE_ARRAY_SIZE(SIDE_PARAM(_attr)), \
+ .byte_order = _byte_order, \
.u = { \
- .side_byte = (_val), \
+ .side_pointer = (uintptr_t) (_val), \
}, \
}, \
}, \
}
-
-#define side_arg_dynamic_float_binary16(_val, _attr) \
+#define _side_arg_dynamic_float_binary16(_val, _byte_order, _attr) \
{ \
.dynamic_type = SIDE_DYNAMIC_TYPE_FLOAT_BINARY16, \
.u = { \
.side_basic = { \
.attr = _attr, \
.nr_attr = SIDE_ARRAY_SIZE(SIDE_PARAM(_attr)), \
+ .byte_order = _byte_order, \
.u = { \
.side_float_binary16 = (_val), \
}, \
}, \
}, \
}
-#define side_arg_dynamic_float_binary32(_val, _attr) \
+#define _side_arg_dynamic_float_binary32(_val, _byte_order, _attr) \
{ \
.dynamic_type = SIDE_DYNAMIC_TYPE_FLOAT_BINARY32, \
.u = { \
.side_basic = { \
.attr = _attr, \
.nr_attr = SIDE_ARRAY_SIZE(SIDE_PARAM(_attr)), \
+ .byte_order = _byte_order, \
.u = { \
.side_float_binary32 = (_val), \
}, \
}, \
}, \
}
-#define side_arg_dynamic_float_binary64(_val, _attr) \
+#define _side_arg_dynamic_float_binary64(_val, _byte_order, _attr) \
{ \
.dynamic_type = SIDE_DYNAMIC_TYPE_FLOAT_BINARY64, \
.u = { \
.side_basic = { \
.attr = _attr, \
.nr_attr = SIDE_ARRAY_SIZE(SIDE_PARAM(_attr)), \
+ .byte_order = _byte_order, \
.u = { \
.side_float_binary64 = (_val), \
}, \
}, \
}, \
}
-#define side_arg_dynamic_float_binary128(_val, _attr) \
+#define _side_arg_dynamic_float_binary128(_val, _byte_order, _attr) \
{ \
.dynamic_type = SIDE_DYNAMIC_TYPE_FLOAT_BINARY128, \
.u = { \
.side_basic = { \
.attr = _attr, \
.nr_attr = SIDE_ARRAY_SIZE(SIDE_PARAM(_attr)), \
+ .byte_order = _byte_order, \
.u = { \
.side_float_binary128 = (_val), \
}, \
}, \
}
-#define side_arg_dynamic_string(_val, _attr) \
- { \
- .dynamic_type = SIDE_DYNAMIC_TYPE_STRING, \
- .u = { \
- .side_basic = { \
- .attr = _attr, \
- .nr_attr = SIDE_ARRAY_SIZE(SIDE_PARAM(_attr)), \
- .u = { \
- .string = (_val), \
- }, \
- }, \
- }, \
- }
+/* Host endian */
+#define side_arg_dynamic_u16(_val, _attr) _side_arg_dynamic_u16(_val, SIDE_TYPE_BYTE_ORDER_HOST, SIDE_PARAM(_attr))
+#define side_arg_dynamic_u32(_val, _attr) _side_arg_dynamic_u32(_val, SIDE_TYPE_BYTE_ORDER_HOST, SIDE_PARAM(_attr))
+#define side_arg_dynamic_u64(_val, _attr) _side_arg_dynamic_u64(_val, SIDE_TYPE_BYTE_ORDER_HOST, SIDE_PARAM(_attr))
+#define side_arg_dynamic_s16(_val, _attr) _side_arg_dynamic_s16(_val, SIDE_TYPE_BYTE_ORDER_HOST, SIDE_PARAM(_attr))
+#define side_arg_dynamic_s32(_val, _attr) _side_arg_dynamic_s32(_val, SIDE_TYPE_BYTE_ORDER_HOST, SIDE_PARAM(_attr))
+#define side_arg_dynamic_s64(_val, _attr) _side_arg_dynamic_s64(_val, SIDE_TYPE_BYTE_ORDER_HOST, SIDE_PARAM(_attr))
+#define side_arg_dynamic_pointer(_val, _attr) _side_arg_dynamic_pointer(_val, SIDE_TYPE_BYTE_ORDER_HOST, SIDE_PARAM(_attr))
+#define side_arg_dynamic_float_binary16(_val, _attr) _side_arg_dynamic_float_binary16(_val, SIDE_TYPE_FLOAT_WORD_ORDER_HOST, SIDE_PARAM(_attr))
+#define side_arg_dynamic_float_binary32(_val, _attr) _side_arg_dynamic_float_binary32(_val, SIDE_TYPE_FLOAT_WORD_ORDER_HOST, SIDE_PARAM(_attr))
+#define side_arg_dynamic_float_binary64(_val, _attr) _side_arg_dynamic_float_binary64(_val, SIDE_TYPE_FLOAT_WORD_ORDER_HOST, SIDE_PARAM(_attr))
+#define side_arg_dynamic_float_binary128(_val, _attr) _side_arg_dynamic_float_binary128(_val, SIDE_TYPE_FLOAT_WORD_ORDER_HOST, SIDE_PARAM(_attr))
+
+/* Little endian */
+#define side_arg_dynamic_u16_le(_val, _attr) _side_arg_dynamic_u16(_val, SIDE_TYPE_BYTE_ORDER_LE, SIDE_PARAM(_attr))
+#define side_arg_dynamic_u32_le(_val, _attr) _side_arg_dynamic_u32(_val, SIDE_TYPE_BYTE_ORDER_LE, SIDE_PARAM(_attr))
+#define side_arg_dynamic_u64_le(_val, _attr) _side_arg_dynamic_u64(_val, SIDE_TYPE_BYTE_ORDER_LE, SIDE_PARAM(_attr))
+#define side_arg_dynamic_s16_le(_val, _attr) _side_arg_dynamic_s16(_val, SIDE_TYPE_BYTE_ORDER_LE, SIDE_PARAM(_attr))
+#define side_arg_dynamic_s32_le(_val, _attr) _side_arg_dynamic_s32(_val, SIDE_TYPE_BYTE_ORDER_LE, SIDE_PARAM(_attr))
+#define side_arg_dynamic_s64_le(_val, _attr) _side_arg_dynamic_s64(_val, SIDE_TYPE_BYTE_ORDER_LE, SIDE_PARAM(_attr))
+#define side_arg_dynamic_pointer_le(_val, _attr) _side_arg_dynamic_pointer(_val, SIDE_TYPE_BYTE_ORDER_LE, SIDE_PARAM(_attr))
+#define side_arg_dynamic_float_binary16_le(_val, _attr) _side_arg_dynamic_float_binary16(_val, SIDE_TYPE_BYTE_ORDER_LE, SIDE_PARAM(_attr))
+#define side_arg_dynamic_float_binary32_le(_val, _attr) _side_arg_dynamic_float_binary32(_val, SIDE_TYPE_BYTE_ORDER_LE, SIDE_PARAM(_attr))
+#define side_arg_dynamic_float_binary64_le(_val, _attr) _side_arg_dynamic_float_binary64(_val, SIDE_TYPE_BYTE_ORDER_LE, SIDE_PARAM(_attr))
+#define side_arg_dynamic_float_binary128_le(_val, _attr) _side_arg_dynamic_float_binary128(_val, SIDE_TYPE_BYTE_ORDER_LE, SIDE_PARAM(_attr))
+
+/* Big endian */
+#define side_arg_dynamic_u16_be(_val, _attr) _side_arg_dynamic_u16(_val, SIDE_TYPE_BYTE_ORDER_BE, SIDE_PARAM(_attr))
+#define side_arg_dynamic_u32_be(_val, _attr) _side_arg_dynamic_u32(_val, SIDE_TYPE_BYTE_ORDER_BE, SIDE_PARAM(_attr))
+#define side_arg_dynamic_u64_be(_val, _attr) _side_arg_dynamic_u64(_val, SIDE_TYPE_BYTE_ORDER_BE, SIDE_PARAM(_attr))
+#define side_arg_dynamic_s16_be(_val, _attr) _side_arg_dynamic_s16(_val, SIDE_TYPE_BYTE_ORDER_BE, SIDE_PARAM(_attr))
+#define side_arg_dynamic_s32_be(_val, _attr) _side_arg_dynamic_s32(_val, SIDE_TYPE_BYTE_ORDER_BE, SIDE_PARAM(_attr))
+#define side_arg_dynamic_s64_be(_val, _attr) _side_arg_dynamic_s64(_val, SIDE_TYPE_BYTE_ORDER_BE, SIDE_PARAM(_attr))
+#define side_arg_dynamic_pointer_be(_val, _attr) _side_arg_dynamic_pointer(_val, SIDE_TYPE_BYTE_ORDER_BE, SIDE_PARAM(_attr))
+#define side_arg_dynamic_float_binary16_be(_val, _attr) _side_arg_dynamic_float_binary16(_val, SIDE_TYPE_BYTE_ORDER_BE, SIDE_PARAM(_attr))
+#define side_arg_dynamic_float_binary32_be(_val, _attr) _side_arg_dynamic_float_binary32(_val, SIDE_TYPE_BYTE_ORDER_BE, SIDE_PARAM(_attr))
+#define side_arg_dynamic_float_binary64_be(_val, _attr) _side_arg_dynamic_float_binary64(_val, SIDE_TYPE_BYTE_ORDER_BE, SIDE_PARAM(_attr))
+#define side_arg_dynamic_float_binary128_be(_val, _attr) _side_arg_dynamic_float_binary128(_val, SIDE_TYPE_BYTE_ORDER_BE, SIDE_PARAM(_attr))
#define side_arg_dynamic_vla(_vla) \
{ \
side_event_call_variadic(_identifier, SIDE_PARAM(_sav), SIDE_PARAM(_var), SIDE_PARAM(_attr))
#define _side_define_event(_linkage, _identifier, _provider, _event, _loglevel, _fields, _attr, _flags) \
- _linkage uint32_t side_event_enable__##_identifier __attribute__((section("side_event_enable"))); \
+ _linkage uintptr_t side_event_enable__##_identifier __attribute__((section("side_event_enable"))); \
_linkage struct side_event_description __attribute__((section("side_event_description"))) \
_identifier = { \
.version = 0, \
.loglevel = _loglevel, \
.nr_fields = SIDE_ARRAY_SIZE(SIDE_PARAM(_fields)), \
.nr_attr = SIDE_ARRAY_SIZE(SIDE_PARAM(_attr)), \
- ._unused = 0, \
+ .nr_callbacks = 0, \
.flags = (_flags), \
.provider_name = _provider, \
.event_name = _event, \
SIDE_PARAM(_attr), SIDE_EVENT_FLAG_VARIADIC)
#define side_declare_event(_identifier) \
- extern uint32_t side_event_enable_##_identifier; \
+ extern uintptr_t side_event_enable_##_identifier; \
extern struct side_event_description _identifier
extern const struct side_callback side_empty_callback;