| 1 | /* @title: Type aliases */ |
| 2 | #pragma once |
| 3 | #include <stdatomic.h> |
| 4 | #include <stdbool.h> |
| 5 | #include <stddef.h> |
| 6 | #include <stdint.h> |
| 7 | |
| 8 | typedef uint8_t irq_t; |
| 9 | typedef int8_t cpu_perf_t; |
| 10 | typedef uint64_t time_ns_t; |
| 11 | typedef uint64_t time_us_t; |
| 12 | typedef uint64_t time_ms_t; |
| 13 | typedef uint64_t time_s_t; |
| 14 | typedef uint64_t timestamp_t; |
| 15 | typedef uint64_t freq_hz_t; |
| 16 | typedef uint64_t freq_khz_t; |
| 17 | typedef uint64_t freq_mhz_t; |
| 18 | typedef uint64_t freq_ghz_t; |
| 19 | typedef uint32_t inode_t; |
| 20 | typedef uint16_t mode_t; |
| 21 | typedef uint32_t gid_t; |
| 22 | typedef uint32_t uid_t; |
| 23 | typedef struct stack_depot_record *stack_handle_t; |
| 24 | typedef _Atomic uint32_t refcount_t; |
| 25 | typedef _Atomic uint32_t mapcount_t; |
| 26 | typedef uintptr_t paddr_t; |
| 27 | typedef uintptr_t vaddr_t; |
| 28 | typedef uintptr_t pfn_t; |
| 29 | typedef uintptr_t pgoff_t; |
| 30 | typedef uintptr_t iova_t; |
| 31 | typedef size_t cpu_id_t; |
| 32 | typedef size_t domain_id_t; |
| 33 | typedef size_t numa_node_t; |
| 34 | typedef size_t thread_id_t; |
| 35 | typedef uint64_t pte_t; |
| 36 | typedef uint64_t page_flags_t; |
| 37 | typedef uint32_t thread_prio_t; |
| 38 | typedef int64_t fx32_32_t; |
| 39 | typedef int32_t nice_t; |
| 40 | typedef ptrdiff_t ssize_t; |
| 41 | typedef __int128_t int128_t; |
| 42 | typedef __uint128_t uint128_t; |
| 43 | |
| 44 | #define CPU_PERF_MAX INT8_MAX |
| 45 | #define CPU_PERF_MIN INT8_MIN |
| 46 | |
| 47 | #define TIME_NS_MAX UINT64_MAX |
| 48 | #define TIME_NS_MIN 0 |
| 49 | |
| 50 | #define TIME_US_MAX UINT64_MAX |
| 51 | #define TIME_US_MIN 0 |
| 52 | |
| 53 | #define TIME_MS_MAX UINT64_MAX |
| 54 | #define TIME_MS_MIN 0 |
| 55 | |
| 56 | #define TIME_S_MAX UINT64_MAX |
| 57 | #define TIME_S_MIN 0 |
| 58 | |
| 59 | #define FREQ_HZ_MAX UINT64_MAX |
| 60 | #define FREQ_HZ_MIN 0 |
| 61 | |
| 62 | #define FREQ_KHZ_MAX UINT64_MAX |
| 63 | #define FREQ_KHZ_MIN 0 |
| 64 | |
| 65 | #define FREQ_MHZ_MAX UINT64_MAX |
| 66 | #define FREQ_MHZ_MIN 0 |
| 67 | |
| 68 | #define FREQ_GHZ_MAX UINT64_MAX |
| 69 | #define FREQ_GHZ_MIN 0 |
| 70 | |
| 71 | #define INODE_MAX UINT32_MAX |
| 72 | #define INODE_MIN 0 |
| 73 | |
| 74 | #define MODE_MAX UINT16_MAX |
| 75 | #define MODE_MIN 0 |
| 76 | |
| 77 | #define GID_MAX UINT32_MAX |
| 78 | #define GID_MIN 0 |
| 79 | |
| 80 | #define UID_MAX UINT32_MAX |
| 81 | #define UID_MIN 0 |
| 82 | |
| 83 | #define STACK_HANDLE_MAX UINT32_MAX |
| 84 | #define STACK_HANDLE_MIN 0 |
| 85 | |
| 86 | #define REFCOUNT_MAX UINT32_MAX |
| 87 | #define REFCOUNT_MIN 0 |
| 88 | |
| 89 | #define PADDR_MAX UINTPTR_MAX |
| 90 | #define PADDR_MIN 0 |
| 91 | |
| 92 | #define VADDR_MAX UINTPTR_MAX |
| 93 | #define VADDR_MIN 0 |
| 94 | |
| 95 | #define IOVA_MAX UINTPTR_MAX |
| 96 | #define IOVA_MIN 0 |
| 97 | |
| 98 | #define CPU_ID_MAX SIZE_MAX |
| 99 | #define CPU_ID_MIN 0 |
| 100 | #define CPU_ID_NONE CPU_ID_MAX |
| 101 | |
| 102 | #define DOMAIN_ID_MAX SIZE_MAX |
| 103 | #define DOMAIN_ID_MIN 0 |
| 104 | #define DOMAIN_ID_NONE DOMAIN_ID_MAX |
| 105 | |
| 106 | #define THREAD_ID_MAX SIZE_MAX |
| 107 | #define THREAD_ID_MIN 0 |
| 108 | #define THREAD_ID_NONE THREAD_ID_MAX |
| 109 | |
| 110 | #define NUMA_NODE_MAX SIZE_MAX |
| 111 | #define NUMA_NODE_MIN 0 |
| 112 | |
| 113 | #define PTE_MAX UINT64_MAX |
| 114 | #define PTE_MIN 0 |
| 115 | |
| 116 | #define PAGE_FLAGS_MAX UINT64_MAX |
| 117 | #define PAGE_FLAGS_MIN 0 |
| 118 | |
| 119 | #define THREAD_PRIO_MAX UINT32_MAX |
| 120 | #define THREAD_PRIO_MIN 0 |
| 121 | |
| 122 | #define FX32_32_MAX INT64_MAX |
| 123 | #define FX32_32_MIN INT64_MIN |
| 124 | |
| 125 | #define NICE_MAX 19 |
| 126 | #define NICE_MIN -20 |
| 127 | |
| 128 | #define SSIZE_MAX ((ssize_t) (SIZE_MAX >> 1)) |
| 129 | #define SSIZE_MIN ((ssize_t) (-SSIZE_MAX - 1)) |
| 130 | |
| 131 | /* Shift has to come after the complement, because complementing the |
| 132 | * shifted zero yields all ones, turning it into `-1` */ |
| 133 | #define INT128_MAX ((int128_t) (~((uint128_t) 0ULL) >> 1)) |
| 134 | #define INT128_MIN ((int128_t) (-INT128_MAX - 1)) |
| 135 | |
| 136 | #define UINT128_MAX ((uint128_t) (~((uint128_t) 0ULL))) |
| 137 | #define UINT128_MIN ((uint128_t) 0ULL) |
| 138 | |