Add u128/s128 integer to ABI
[libside.git] / include / side / abi / type-value.h
1 // SPDX-License-Identifier: MIT
2 /*
3 * Copyright 2022-2023 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
4 */
5
6 #ifndef SIDE_ABI_TYPE_VALUE_H
7 #define SIDE_ABI_TYPE_VALUE_H
8
9 #include <stdint.h>
10 #include <side/macros.h>
11 #include <side/endian.h>
12
13 /*
14 * SIDE ABI for type values.
15 *
16 * The extensibility scheme for the SIDE ABI for type values is as
17 * follows:
18 *
19 * * Existing type values are never changed nor extended. Type values
20 * can be added to the ABI by reserving a label within enum
21 * side_type_label.
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.
27 *
28 * Handling of unknown type values by the tracers:
29 *
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.
35 */
36
37 enum side_type_label_byte_order {
38 SIDE_TYPE_BYTE_ORDER_LE = 0,
39 SIDE_TYPE_BYTE_ORDER_BE = 1,
40 };
41
42 union side_integer_value {
43 uint8_t side_u8;
44 uint16_t side_u16;
45 uint32_t side_u32;
46 uint64_t side_u64;
47 uint64_t side_u128_split[2];
48 int8_t side_s8;
49 int16_t side_s16;
50 int32_t side_s32;
51 int64_t side_s64;
52 int64_t side_s128_split[2];
53 uintptr_t side_uptr;
54 side_padding(32);
55 } SIDE_PACKED;
56 side_check_size(union side_integer_value, 32);
57
58 union side_bool_value {
59 uint8_t side_bool8;
60 uint16_t side_bool16;
61 uint32_t side_bool32;
62 uint64_t side_bool64;
63 side_padding(32);
64 } SIDE_PACKED;
65 side_check_size(union side_bool_value, 32);
66
67 union side_float_value {
68 #if __HAVE_FLOAT16
69 _Float16 side_float_binary16;
70 #endif
71 #if __HAVE_FLOAT32
72 _Float32 side_float_binary32;
73 #endif
74 #if __HAVE_FLOAT64
75 _Float64 side_float_binary64;
76 #endif
77 #if __HAVE_FLOAT128
78 _Float128 side_float_binary128;
79 #endif
80 side_padding(32);
81 } SIDE_PACKED;
82 side_check_size(union side_float_value, 32);
83
84 struct side_type_raw_string {
85 side_ptr_t(const void) p; /* pointer to string */
86 uint8_t unit_size; /* 1, 2, or 4 bytes */
87 side_enum_t(enum side_type_label_byte_order, uint8_t) byte_order;
88 } SIDE_PACKED;
89 side_check_size(struct side_type_raw_string, 18);
90
91 #endif /* SIDE_ABI_TYPE_VALUE_H */
This page took 0.029805 seconds and 4 git commands to generate.