Line data Source code
1 :
2 : struct device;
3 :
4 : void *ldv_dev_get_drvdata(const struct device *dev);
5 : int ldv_dev_set_drvdata(struct device *dev, void *data);
6 :
7 : struct spi_master;
8 : struct device;
9 : struct spi_master *ldv_spi_alloc_master(struct device *host, unsigned size);
10 :
11 : #include <linux/ldv/err.h>
12 :
13 : #include <linux/types.h>
14 : void *ldv_kzalloc(size_t size, gfp_t flags);
15 :
16 : struct clk;
17 :
18 : extern void ldv_clk_disable(struct clk *clk);
19 : extern int ldv_clk_enable(void);
20 :
21 : #include <linux/ldv/common.h>
22 : #include <linux/ldv/irq.h>
23 : #include <verifier/common.h>
24 : #include <verifier/nondet.h>
25 : #include <verifier/memory.h>
26 : #include <verifier/thread.h>
27 :
28 : #include <linux/pci.h>
29 :
30 :
31 : struct ldv_struct_main_2 {
32 : int signal_pending;
33 : };
34 :
35 : /* EMG Function declarations */
36 : void ldv_dispatch_insmod_deregister_2_2(void);
37 : void ldv_dispatch_insmod_register_2_3(void);
38 : void ldv_insmod_1(void *);
39 : void ldv_insmod_hwmon_exit_1_2(void (*)(void));
40 : int ldv_insmod_hwmon_init_1_6(int (*)(void));
41 : void ldv_main_2(void *);
42 : int main(void);
43 :
44 : /* EMG variable declarations */
45 1 : struct ldv_thread ldv_thread_1;
46 1 : struct ldv_thread ldv_thread_2;
47 :
48 : /* EMG variable initialization */
49 :
50 : /* EMG function definitions */
51 : /* AUX_FUNC ldv_dispatch_insmod_deregister_2_2 */
52 : void ldv_dispatch_insmod_deregister_2_2() {
53 : struct ldv_struct_main_2 *cf_arg_1;
54 : /* Skip thread join call */
55 1 : return;
56 : }
57 :
58 : /* AUX_FUNC ldv_dispatch_insmod_register_2_3 */
59 : void ldv_dispatch_insmod_register_2_3() {
60 : struct ldv_struct_main_2 *cf_arg_1;
61 4 : cf_arg_1 = ldv_xmalloc(sizeof(struct ldv_struct_main_2));
62 4 : ldv_insmod_1(cf_arg_1);
63 1 : return;
64 : }
65 :
66 : /* AUX_FUNC ldv_insmod_1 */
67 : void ldv_insmod_1(void *arg0) {
68 : /* LDV {"thread": 1, "type": "CONTROL_FUNCTION_BEGIN", "comment": "Control function 'insmod(artificial)'", "function": "ldv_insmod_1"} */
69 1 : /* LDV {"type": "CONTROL_FUNCTION_INIT_BEGIN", "comment": "Declare auxiliary variables."} */
70 1 : void (*ldv_1_hwmon_exit_default)(void);
71 1 : int (*ldv_1_hwmon_init_default)(void);
72 1 : int ldv_1_ret_default;
73 : /* LDV {"type": "CONTROL_FUNCTION_INIT_END", "comment": "Declare auxiliary variables."} */
74 : /* LDV {"action": "INSMOD_REGISTER", "type": "RECEIVE_BEGIN", "comment": "Trigger module initialization."} */
75 2 : ldv_free(arg0);
76 : /* LDV {"action": "INSMOD_REGISTER", "type": "RECEIVE_END"} */
77 :
78 : /* LDV {"action": "HWMON_INIT", "type": "CALL_BEGIN", "callback": true, "comment": "Initialize the module after insmod with 'hwmon_init' function. Invoke callback hwmon_init from ARTIFICIAL."} */
79 : /* LDV {"type": "CALLBACK", "call": "ldv_1_ret_default = (hwmon_init)();", "comment": "hwmon_init"} */
80 2 : ldv_1_ret_default = ldv_insmod_hwmon_init_1_6(ldv_1_hwmon_init_default);
81 : /* Callback post-call */
82 2 : ldv_1_ret_default = ldv_post_init(ldv_1_ret_default);
83 : /* LDV {"action": "HWMON_INIT", "type": "CALL_END"} */
84 :
85 4 : if (ldv_undef_int()) {
86 : /* LDV {"action": "INIT_FAILED", "type": "CONDITION_BEGIN", "comment": "Failed to initialize the module."} */
87 2 : ldv_assume(ldv_1_ret_default != 0);
88 : /* LDV {"action": "INIT_FAILED", "type": "CONDITION_END"} */
89 :
90 : /* LDV {"action": "INSMOD_DEREGISTER", "type": "RECEIVE_BEGIN", "comment": "Trigger module exit."} */
91 : /* Skip a non-replicative signal receiving */
92 : /* LDV {"action": "INSMOD_DEREGISTER", "type": "RECEIVE_END"} */
93 :
94 : /* Exit function at a terminal state */
95 1 : return;
96 : }
97 : else {
98 : /* LDV {"action": "INIT_SUCCESS", "type": "CONDITION_BEGIN", "comment": "Module has been initialized."} */
99 2 : ldv_assume(ldv_1_ret_default == 0);
100 : /* LDV {"action": "INIT_SUCCESS", "type": "CONDITION_END"} */
101 :
102 : /* LDV {"action": "HWMON_EXIT", "type": "CALL_BEGIN", "callback": true, "comment": "Exit the module before its unloading with 'hwmon_exit' function. Invoke callback hwmon_exit from ARTIFICIAL."} */
103 : /* LDV {"type": "CALLBACK", "call": "(hwmon_exit)();", "comment": "hwmon_exit"} */
104 2 : ldv_insmod_hwmon_exit_1_2(ldv_1_hwmon_exit_default);
105 : /* LDV {"action": "HWMON_EXIT", "type": "CALL_END"} */
106 :
107 : /* LDV {"action": "INSMOD_DEREGISTER", "type": "RECEIVE_BEGIN", "comment": "Trigger module exit."} */
108 : /* Skip a non-replicative signal receiving */
109 : /* LDV {"action": "INSMOD_DEREGISTER", "type": "RECEIVE_END"} */
110 :
111 : /* Exit function at a terminal state */
112 1 : return;
113 : }
114 : /* End of the process */
115 : return;
116 : /* LDV {"comment": "End of control function based on process 'insmod(artificial)'", "type": "CONTROL_FUNCTION_END", "function": "ldv_insmod_1"} */
117 : }
118 :
119 : /* AUX_FUNC_CALLBACK ldv_insmod_hwmon_exit_1_2 */
120 : void ldv_insmod_hwmon_exit_1_2(void (*arg0)(void)) {
121 2 : (hwmon_exit)();
122 1 : }
123 :
124 : /* AUX_FUNC_CALLBACK ldv_insmod_hwmon_init_1_6 */
125 : int ldv_insmod_hwmon_init_1_6(int (*arg0)(void)) {
126 4 : return (hwmon_init)();
127 1 : }
128 :
129 : /* AUX_FUNC ldv_main_2 */
130 : void ldv_main_2(void *arg0) {
131 : /* LDV {"thread": 2, "type": "CONTROL_FUNCTION_BEGIN", "comment": "Control function 'main(main)'", "function": "ldv_main_2"} */
132 : /* LDV {"type": "CONTROL_FUNCTION_INIT_BEGIN", "comment": "Declare auxiliary variables."} */
133 : /* LDV {"type": "CONTROL_FUNCTION_INIT_END", "comment": "Declare auxiliary variables."} */
134 : /* LDV {"action": "INIT", "type": "CONDITION_BEGIN", "comment": "Initialize rule models."} */
135 1 : ldv_initialize();
136 : /* LDV {"action": "INIT", "type": "CONDITION_END"} */
137 :
138 : /* LDV {"action": "INSMOD_REGISTER", "type": "DISPATCH_BEGIN", "comment": "Start environment model scenarios."} */
139 2 : ldv_dispatch_insmod_register_2_3();
140 : /* LDV {"action": "INSMOD_REGISTER", "type": "DISPATCH_END"} */
141 :
142 : /* LDV {"action": "INSMOD_DEREGISTER", "type": "DISPATCH_BEGIN", "comment": "Stop environment model scenarios."} */
143 2 : ldv_dispatch_insmod_deregister_2_2();
144 : /* LDV {"action": "INSMOD_DEREGISTER", "type": "DISPATCH_END"} */
145 :
146 : /* LDV {"action": "FINAL", "type": "CONDITION_BEGIN", "comment": "Check rule model state at the exit."} */
147 1 : ldv_check_final_state();
148 1 : ldv_stop();
149 : /* LDV {"action": "FINAL", "type": "CONDITION_END"} */
150 :
151 : /* Exit function at a terminal state */
152 0 : return;
153 : /* End of the process */
154 : return;
155 : /* LDV {"comment": "End of control function based on process 'main(main)'", "type": "CONTROL_FUNCTION_END", "function": "ldv_main_2"} */
156 : }
157 :
158 : /* AUX_FUNC main */
159 : int main() {
160 1 : ldv_main_2(0);
161 0 : return 0;
162 : }
163 :
164 :
165 : /* AUX_FUNC ERR_PTR */
166 : static inline void *ERR_PTR (long int error)
167 : {
168 0 :
169 0 : return ldv_err_ptr(error);
170 : }
171 :
172 : /* AUX_FUNC PTR_ERR */
173 : static inline long int PTR_ERR (void const *ptr)
174 : {
175 1 :
176 3 : return ldv_ptr_err(ptr);
177 : }
178 :
179 : /* AUX_FUNC IS_ERR */
180 : static inline long int IS_ERR (void const *ptr)
181 : {
182 1 :
183 3 : return ldv_is_err(ptr);
184 : }
185 :
186 : /* AUX_FUNC IS_ERR_OR_NULL */
187 : static inline long int IS_ERR_OR_NULL (void const *ptr)
188 : {
189 :
190 : return ldv_is_err_or_null(ptr);
191 : }
192 :
193 : /* AUX_FUNC kzalloc */
194 : static inline void *kzalloc (size_t size, gfp_t flags)
195 : {
196 :
197 : return ldv_kzalloc(size, flags);
198 : }
199 :
200 : /* AUX_FUNC ldv_dev_get_drvdata_6 */
201 : void *ldv_dev_get_drvdata_6 (struct device const *dev)
202 : {
203 :
204 : return ldv_dev_get_drvdata(dev);
205 : }
|