| [bf584ca] | 1 | #ifndef __CIVL_SVCOMP__
|
|---|
| [6109557] | 2 | #define __CIVL_SVCOMP__
|
|---|
| [bf584ca] | 3 | #include <civlc.cvh>
|
|---|
| [7423d6c] | 4 | #include <stdlib.h>
|
|---|
| [addb943] | 5 | #ifndef SVCOM_INT_UPPER
|
|---|
| 6 | #define SVCOM_INT_UPPER 5
|
|---|
| 7 | #endif
|
|---|
| 8 |
|
|---|
| [93f78fe] | 9 | #ifndef SVCOM_INT_LOWER
|
|---|
| 10 | #define SVCOM_INT_LOWER -5
|
|---|
| 11 | #endif
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| [addb943] | 14 | #ifndef SVCOM_UINT_UPPER
|
|---|
| 15 | #define SVCOM_UINT_UPPER 4
|
|---|
| 16 | #endif
|
|---|
| 17 |
|
|---|
| [93f78fe] | 18 | #ifndef SVCOM_LONG_UPPER
|
|---|
| 19 | #define SVCOM_LONG_UPPER 5
|
|---|
| 20 | #endif
|
|---|
| 21 |
|
|---|
| 22 | #ifndef SVCOM_ULONG_UPPER
|
|---|
| 23 | #define SVCOM_ULONG_UPPER 4
|
|---|
| 24 | #endif
|
|---|
| 25 |
|
|---|
| [ac1de0b] | 26 | int _bool_count=0;
|
|---|
| [156d941] | 27 | int _pointer_count=0;
|
|---|
| 28 |
|
|---|
| 29 | void* __VERIFIER_nondet_pointer(){
|
|---|
| [1b29693] | 30 | void* x;
|
|---|
| 31 |
|
|---|
| 32 | $havoc(&x);
|
|---|
| 33 | return x;
|
|---|
| [156d941] | 34 | }
|
|---|
| [ac1de0b] | 35 |
|
|---|
| [93f78fe] | 36 | long __VERIFIER_nondet_long(){
|
|---|
| 37 | long temp;
|
|---|
| 38 |
|
|---|
| 39 | $havoc(&temp);
|
|---|
| 40 | $assume(temp<=SVCOM_LONG_UPPER);
|
|---|
| 41 | return temp;
|
|---|
| 42 | }
|
|---|
| 43 |
|
|---|
| 44 | unsigned long __VERIFIER_nondet_ulong(){
|
|---|
| 45 | unsigned long temp;
|
|---|
| 46 |
|
|---|
| 47 | $havoc(&temp);
|
|---|
| 48 | $assume(temp>=0 && temp<=SVCOM_ULONG_UPPER);
|
|---|
| 49 | return temp;
|
|---|
| 50 | }
|
|---|
| 51 |
|
|---|
| [ac1de0b] | 52 | int __VERIFIER_nondet_int(){
|
|---|
| [addb943] | 53 | int temp;
|
|---|
| 54 |
|
|---|
| 55 | $havoc(&temp);
|
|---|
| [93f78fe] | 56 | $assume(temp<=SVCOM_INT_UPPER && temp>=SVCOM_INT_LOWER);
|
|---|
| [addb943] | 57 | return temp;
|
|---|
| [7423d6c] | 58 | }
|
|---|
| [ac1de0b] | 59 |
|
|---|
| [b9ed95b] | 60 | char __VERIFIER_nondet_char(){
|
|---|
| 61 | char temp;
|
|---|
| 62 |
|
|---|
| 63 | $havoc(&temp);
|
|---|
| 64 | return temp;
|
|---|
| 65 | }
|
|---|
| 66 |
|
|---|
| 67 | double __VERIFIER_nondet_double(){
|
|---|
| 68 | double temp;
|
|---|
| 69 |
|
|---|
| 70 | $havoc(&temp);
|
|---|
| 71 | return temp;
|
|---|
| 72 | }
|
|---|
| 73 |
|
|---|
| 74 | float __VERIFIER_nondet_float(){
|
|---|
| 75 | float temp;
|
|---|
| 76 |
|
|---|
| 77 | $havoc(&temp);
|
|---|
| 78 | return temp;
|
|---|
| 79 | }
|
|---|
| 80 |
|
|---|
| [ac1de0b] | 81 | unsigned int __VERIFIER_nondet_uint(){
|
|---|
| [addb943] | 82 | int temp;
|
|---|
| 83 |
|
|---|
| 84 | $havoc(&temp);
|
|---|
| 85 | $assume(temp>=0 && temp<=SVCOM_UINT_UPPER);
|
|---|
| 86 | return temp;
|
|---|
| [7423d6c] | 87 | }
|
|---|
| [ac1de0b] | 88 |
|
|---|
| [75d1dd8] | 89 | _Bool __VERIFIER_nondet_bool(){
|
|---|
| [1b29693] | 90 | int x;
|
|---|
| [ac1de0b] | 91 |
|
|---|
| [1b29693] | 92 | $havoc(&x);
|
|---|
| 93 | return x != 0;
|
|---|
| [ac1de0b] | 94 | }
|
|---|
| 95 |
|
|---|
| [adb696b] | 96 | void __VERIFIER_error(){
|
|---|
| [ac1de0b] | 97 | $assert($false, "__VERIFIER_error() is called.\n");
|
|---|
| [adb696b] | 98 | }
|
|---|
| [ac1de0b] | 99 |
|
|---|
| [b3803d8] | 100 | void __VERIFIER_assume(int expression) {
|
|---|
| [d829019] | 101 | //$elaborate(expression);
|
|---|
| [a48984f4] | 102 | if (!expression)
|
|---|
| [23c8bc3] | 103 | {
|
|---|
| 104 | LOOP:
|
|---|
| 105 | goto LOOP;
|
|---|
| [4c14156] | 106 | }
|
|---|
| [23c8bc3] | 107 | }
|
|---|
| 108 |
|
|---|
| [aa96fadf] | 109 | void __VERIFIER_atomic_end(){
|
|---|
| 110 | return;
|
|---|
| 111 | }
|
|---|
| 112 |
|
|---|
| [2d51848] | 113 | /*
|
|---|
| [8a9d4cf] | 114 | int _nondet_int(){
|
|---|
| 115 | int result;
|
|---|
| 116 |
|
|---|
| 117 | $havoc(&result);
|
|---|
| 118 | return result;
|
|---|
| 119 | }
|
|---|
| 120 |
|
|---|
| [3d42bae] | 121 | int access_ok(int type, const void *addr, unsigned long size){
|
|---|
| [8a9d4cf] | 122 | return _nondet_int();
|
|---|
| [3d42bae] | 123 | }
|
|---|
| [43dcb221] | 124 |
|
|---|
| [3d42bae] | 125 | int alloc_chrdev_region(unsigned int * a, unsigned b, unsigned c, const char * d) {
|
|---|
| [8a9d4cf] | 126 | return _nondet_int();
|
|---|
| [43dcb221] | 127 | }
|
|---|
| 128 |
|
|---|
| [f8f3bec] | 129 | int printk(const char * fmt, ...){
|
|---|
| 130 | return 0;
|
|---|
| 131 | }
|
|---|
| 132 |
|
|---|
| [93c88bf] | 133 | int register_chrdev_region(unsigned int, unsigned, const char *) {
|
|---|
| [8a9d4cf] | 134 | return _nondet_int();
|
|---|
| [3d42bae] | 135 | }
|
|---|
| 136 |
|
|---|
| [93c88bf] | 137 | void unregister_chrdev_region(unsigned int, unsigned) {
|
|---|
| [3d42bae] | 138 | return;
|
|---|
| 139 | }
|
|---|
| 140 |
|
|---|
| 141 | loff_t no_llseek(struct file *file, loff_t offset, int origin) {
|
|---|
| [8a9d4cf] | 142 | return _nondet_int();
|
|---|
| [3d42bae] | 143 | }
|
|---|
| 144 |
|
|---|
| 145 | int nonseekable_open(struct inode * inode, struct file * filp) {
|
|---|
| [8a9d4cf] | 146 | return _nondet_int();
|
|---|
| [3d42bae] | 147 | }
|
|---|
| 148 |
|
|---|
| 149 | struct resource {
|
|---|
| 150 | unsigned long start, end;
|
|---|
| 151 | const char *name;
|
|---|
| 152 | unsigned long flags;
|
|---|
| 153 | };
|
|---|
| 154 |
|
|---|
| 155 | typedef struct resource resource_type;
|
|---|
| 156 |
|
|---|
| 157 | void __release_region(struct resource * a, resource_size_t b, resource_size_t c) {
|
|---|
| 158 | return;
|
|---|
| 159 | }
|
|---|
| [f8f3bec] | 160 |
|
|---|
| [e51a6a0] | 161 | int __get_user(int size, const void *ptr){
|
|---|
| 162 | return _nondet_int();
|
|---|
| 163 | }
|
|---|
| [2d51848] | 164 | */
|
|---|
| [23c8bc3] | 165 | #endif
|
|---|
| 166 |
|
|---|