1 // SPDX-License-Identifier: MIT
3 * Copyright 2022-2023 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 #ifndef SIDE_ABI_TYPE_VALUE_H
7 #define SIDE_ABI_TYPE_VALUE_H
10 #include <side/macros.h>
11 #include <side/endian.h>
14 * SIDE ABI for type values.
16 * The extensibility scheme for the SIDE ABI for type values is as
19 * * Existing type values are never changed nor extended. Type values
20 * can be added to the ABI by reserving a label within enum
22 * * Each union part of the ABI has an explicit size defined by a
23 * side_padding() member. Each structure and union have a static
24 * assert validating its size.
25 * * Changing the semantic of the existing type value fields is a
26 * breaking ABI change.
28 * Handling of unknown type values by the tracers:
30 * * A tracer may choose to support only a subset of the type values
31 * supported by libside. When encountering an unknown or unsupported
32 * type value, the tracer has the option to either disallow the entire
33 * event or skip over the unknown type, both at event registration and
34 * when receiving the side_call arguments.
37 enum side_type_label_byte_order
{
38 SIDE_TYPE_BYTE_ORDER_LE
= 0,
39 SIDE_TYPE_BYTE_ORDER_BE
= 1,
42 #if (SIDE_BYTE_ORDER == SIDE_LITTLE_ENDIAN)
43 enum side_integer128_split_index
{
44 SIDE_INTEGER128_SPLIT_LOW
= 0,
45 SIDE_INTEGER128_SPLIT_HIGH
= 1,
46 NR_SIDE_INTEGER128_SPLIT
,
49 enum side_integer128_split_index
{
50 SIDE_INTEGER128_SPLIT_HIGH
= 0,
51 SIDE_INTEGER128_SPLIT_LOW
= 1,
52 NR_SIDE_INTEGER128_SPLIT
,
56 union side_integer_value
{
66 /* Indexed with enum side_integer128_split_index */
67 uint64_t side_u128_split
[NR_SIDE_INTEGER128_SPLIT
];
68 int64_t side_s128_split
[NR_SIDE_INTEGER128_SPLIT
];
69 #ifdef __SIZEOF_INT128__
70 unsigned __int128 side_u128
;
75 side_check_size(union side_integer_value
, 32);
77 union side_bool_value
{
84 side_check_size(union side_bool_value
, 32);
86 union side_float_value
{
88 _Float16 side_float_binary16
;
91 _Float32 side_float_binary32
;
94 _Float64 side_float_binary64
;
97 _Float128 side_float_binary128
;
101 side_check_size(union side_float_value
, 32);
103 struct side_type_raw_string
{
104 side_ptr_t(const void) p
; /* pointer to string */
105 uint8_t unit_size
; /* 1, 2, or 4 bytes */
106 side_enum_t(enum side_type_label_byte_order
, uint8_t) byte_order
;
108 side_check_size(struct side_type_raw_string
, 18);
110 #endif /* SIDE_ABI_TYPE_VALUE_H */