db/fixup_kernel.sh: fix clear_user() handling
[smatch.git] / smatch_constants.h
blobcbd0ac6b80c79c5e44b9cb4729f485c7ab5579d0
1 #include "expression.h"
3 #ifndef SMATCH_CONSTANTS_H_
4 #define SMATCH_CONSTANTS_H_
6 static const sval_t int_zero = { .type = &int_ctype, .value = 0 };
7 static const sval_t int_one = { .type = &int_ctype, .value = 1 };
8 static const sval_t int_minus_one = { .type = &int_ctype, .value = -1 };
9 static const sval_t err_min = { .type = &int_ctype, .value = -4095 };
10 static const sval_t err_max = { .type = &int_ctype, .value = -1 };
11 static const sval_t xa_err_min = { .type = &int_ctype, .value = (((-4095) << 2) | 2) };
12 static const sval_t xa_err_max = { .type = &int_ctype, .value = (((-1) << 2) | 2) };
13 static const sval_t int_max = { .type = &int_ctype, .value = INT_MAX };
15 static const sval_t bool_false = { .type = &bool_ctype, .value = 0 };
16 static const sval_t bool_true = { .type = &bool_ctype, .value = 1 };
18 extern sval_t ptr_err_min;
19 extern sval_t ptr_err_max;
20 extern sval_t ptr_xa_err_min;
21 extern sval_t ptr_xa_err_max;
22 static const sval_t ptr_null = { .type = &ptr_ctype, .value = 0 };
24 static const sval_t ulong_zero = { .type = &ulong_ctype, .value = 0 };
25 static const sval_t ulong_one = { .type = &ulong_ctype, .value = 1 };
26 static const sval_t ulong_INT_MAX = { .type = &ulong_ctype, .value = INT_MAX };
27 extern sval_t ulong_ULONG_MAX;
29 #define MTAG_ALIAS_BIT (1ULL << 63)
30 #define MTAG_OFFSET_MASK 0xfffULL
31 #define MTAG_SEED 0xdead << 12
33 const extern unsigned long valid_ptr_min;
34 extern unsigned long valid_ptr_max;
35 extern const sval_t valid_ptr_min_sval;
36 extern sval_t valid_ptr_max_sval;
37 extern struct range_list *valid_ptr_rl;
38 void alloc_ptr_constants(void);
40 static const sval_t array_min_sval = {
41 .type = &ptr_ctype,
42 {.value = 100000},
44 static const sval_t array_max_sval = {
45 .type = &ptr_ctype,
46 {.value = ULONG_MAX - 4095},
48 static const sval_t text_seg_min = {
49 .type = &ptr_ctype,
50 {.value = 4096},
52 static const sval_t text_seg_max = {
53 .type = &ptr_ctype,
54 {.value = ULONG_MAX - 4095},
56 static const sval_t data_seg_min = {
57 .type = &ptr_ctype,
58 {.value = 4096},
60 static const sval_t data_seg_max = {
61 .type = &ptr_ctype,
62 {.value = ULONG_MAX - 4095},
64 static const sval_t bss_seg_min = {
65 .type = &ptr_ctype,
66 {.value = 4096},
68 static const sval_t bss_seg_max = {
69 .type = &ptr_ctype,
70 {.value = ULONG_MAX - 4095},
72 static const sval_t stack_seg_min = {
73 .type = &ptr_ctype,
74 {.value = 4096},
76 static const sval_t stack_seg_max = {
77 .type = &ptr_ctype,
78 {.value = ULONG_MAX - 4095},
80 static const sval_t kmalloc_seg_min = {
81 .type = &ptr_ctype,
82 {.value = 4096},
84 static const sval_t kmalloc_seg_max = {
85 .type = &ptr_ctype,
86 {.value = ULONG_MAX - 4095},
88 static const sval_t vmalloc_seg_min = {
89 .type = &ptr_ctype,
90 {.value = 4096},
92 static const sval_t vmalloc_seg_max = {
93 .type = &ptr_ctype,
94 {.value = ULONG_MAX - 4095},
96 static const sval_t fn_ptr_min = {
97 .type = &ptr_ctype,
98 {.value = 4096},
100 static const sval_t fn_ptr_max = {
101 .type = &ptr_ctype,
102 {.value = ULONG_MAX - 4095},
105 #endif