This repository has been archived by the owner on Oct 3, 2021. It is now read-only.
/
floppy_simpl4_true-unreach-call_true-valid-memsafety_true-termination.cil.c
1629 lines (1577 loc) · 47.3 KB
/
floppy_simpl4_true-unreach-call_true-valid-memsafety_true-termination.cil.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
extern void __VERIFIER_error() __attribute__ ((__noreturn__));
extern char __VERIFIER_nondet_char(void);
extern int __VERIFIER_nondet_int(void);
extern long __VERIFIER_nondet_long(void);
extern void *__VERIFIER_nondet_pointer(void);
int FlAcpiConfigureFloppy(int DisketteExtension , int FdcInfo );
int FlQueueIrpToThread(int Irp , int DisketteExtension );
int FloppyPnp(int DeviceObject , int Irp );
int FloppyStartDevice(int DeviceObject , int Irp );
int FloppyPnpComplete(int DeviceObject , int Irp , int Context );
int FlFdcDeviceIo(int DeviceObject , int Ioctl , int Data );
int IoBuildDeviceIoControlRequest(int IoControlCode , int DeviceObject , int InputBuffer ,
int InputBufferLength , int OutputBuffer , int OutputBufferLength ,
int InternalDeviceIoControl , int Event , int IoStatusBlock );
int IoDeleteSymbolicLink(int SymbolicLinkName );
int IoQueryDeviceDescription(int BusType , int BusNumber , int ControllerType , int ControllerNumber ,
int PeripheralType , int PeripheralNumber , int CalloutRoutine ,
int Context );
int IoRegisterDeviceInterface(int PhysicalDeviceObject , int InterfaceClassGuid ,
int ReferenceString , int SymbolicLinkName );
int IoSetDeviceInterfaceState(int SymbolicLinkName , int Enable );
int IofCallDriver(int DeviceObject , int Irp );
int KeSetEvent(int Event , int Increment , int Wait );
int KeWaitForSingleObject(int Object , int WaitReason , int WaitMode , int Alertable ,
int Timeout );
int ObReferenceObjectByHandle(int Handle , int DesiredAccess , int ObjectType , int AccessMode ,
int Object , int HandleInformation );
int PsCreateSystemThread(int ThreadHandle , int DesiredAccess , int ObjectAttributes ,
int ProcessHandle , int ClientId , int StartRoutine , int StartContext );
int ZwClose(int Handle );
int FloppyCreateClose(int DeviceObject , int Irp );
int FloppyQueueRequest(int DisketteExtension , int Irp ) ;
int FloppyDeviceControl(int DeviceObject , int Irp );
int FlCheckFormatParameters(int DisketteExtension , int FormatParameters );
int FloppyQueueRequest(int DisketteExtension , int Irp );
void errorFn(void) ;
void IofCompleteRequest(int Irp , int PriorityBoost );
extern int __VERIFIER_nondet_int();
int FloppyThread ;
int KernelMode ;
int Suspended ;
int Executive ;
int DiskController ;
int FloppyDiskPeripheral ;
int FlConfigCallBack ;
int MaximumInterfaceType ;
int MOUNTDEV_MOUNTED_DEVICE_GUID ;
int myStatus ;
int s ;
int UNLOADED ;
int NP ;
int DC ;
int SKIP1 ;
int SKIP2 ;
int MPR1 ;
int MPR3 ;
int IPC ;
int pended ;
int compRegistered ;
int lowerDriverReturn ;
int setEventCalled ;
int customIrp ;
void _BLAST_init(void)
{
{
UNLOADED = 0;
NP = 1;
DC = 2;
SKIP1 = 3;
SKIP2 = 4;
MPR1 = 5;
MPR3 = 6;
IPC = 7;
s = UNLOADED;
pended = 0;
compRegistered = 0;
lowerDriverReturn = 0;
setEventCalled = 0;
customIrp = 0;
return;
}
}
int PagingReferenceCount = 0;
int PagingMutex = 0;
int FlAcpiConfigureFloppy(int DisketteExtension , int FdcInfo )
{
{
return (0);
}
}
int FlQueueIrpToThread(int Irp , int DisketteExtension )
{ int status ;
int threadHandle = __VERIFIER_nondet_int() ;
int DisketteExtension__PoweringDown = __VERIFIER_nondet_int() ;
int DisketteExtension__ThreadReferenceCount = __VERIFIER_nondet_int() ;
int DisketteExtension__FloppyThread = __VERIFIER_nondet_int() ;
int Irp__IoStatus__Status ;
int Irp__IoStatus__Information ;
int Irp__Tail__Overlay__CurrentStackLocation__Control ;
int ObjAttributes = __VERIFIER_nondet_int() ;
int __cil_tmp12 ;
int __cil_tmp13 ;
{
if (DisketteExtension__PoweringDown == 1) {
myStatus = -1073741101;
Irp__IoStatus__Status = -1073741101;
Irp__IoStatus__Information = 0;
return (-1073741101);
}
DisketteExtension__ThreadReferenceCount ++;
if (DisketteExtension__ThreadReferenceCount == 0) {
DisketteExtension__ThreadReferenceCount ++;
PagingReferenceCount ++;
if (PagingReferenceCount == 1) {
}
{
status = PsCreateSystemThread(threadHandle, 0, ObjAttributes, 0, 0, FloppyThread,
DisketteExtension);
}
{
if (status < 0) {
DisketteExtension__ThreadReferenceCount = -1;
PagingReferenceCount --;
if (PagingReferenceCount == 0) {
}
return (status);
}
}
{
status = ObReferenceObjectByHandle(threadHandle, 1048576, 0, KernelMode, DisketteExtension__FloppyThread,
0);
ZwClose(threadHandle);
}
{
if (status < 0) {
return (status);
}
}
}
//Irp__Tail__Overlay__CurrentStackLocation__Control |= 1;
if (pended == 0) {
pended = 1;
} else {
{
errorFn();
}
}
return (259);
}
}
int FloppyPnp(int DeviceObject , int Irp )
{ int DeviceObject__DeviceExtension = __VERIFIER_nondet_int() ;
int Irp__Tail__Overlay__CurrentStackLocation = __VERIFIER_nondet_int() ;
int Irp__IoStatus__Information ;
int Irp__IoStatus__Status ;
int Irp__CurrentLocation = __VERIFIER_nondet_int() ;
int disketteExtension__IsRemoved = __VERIFIER_nondet_int() ;
int disketteExtension__IsStarted = __VERIFIER_nondet_int() ;
int disketteExtension__TargetObject = __VERIFIER_nondet_int() ;
int disketteExtension__HoldNewRequests ;
int disketteExtension__FloppyThread = __VERIFIER_nondet_int() ;
int disketteExtension__InterfaceString__Buffer = __VERIFIER_nondet_int() ;
int disketteExtension__InterfaceString = __VERIFIER_nondet_int() ;
int disketteExtension__ArcName__Length = __VERIFIER_nondet_int() ;
int disketteExtension__ArcName = __VERIFIER_nondet_int() ;
int irpSp__MinorFunction = __VERIFIER_nondet_int() ;
int IoGetConfigurationInformation__FloppyCount = __VERIFIER_nondet_int() ;
int irpSp ;
int disketteExtension ;
int ntStatus ;
int doneEvent = __VERIFIER_nondet_int() ;
int irpSp___0 ;
int nextIrpSp ;
int nextIrpSp__Control ;
int irpSp___1 ;
int irpSp__Context ;
int irpSp__Control ;
long __cil_tmp29 ;
long __cil_tmp30 ;
{
ntStatus = 0;
PagingReferenceCount ++;
if (PagingReferenceCount == 1) {
}
disketteExtension = DeviceObject__DeviceExtension;
irpSp = Irp__Tail__Overlay__CurrentStackLocation;
if (disketteExtension__IsRemoved) {
{
Irp__IoStatus__Information = 0;
Irp__IoStatus__Status = -1073741738;
myStatus = -1073741738;
IofCompleteRequest(Irp, 0);
}
return (-1073741738);
}
if (irpSp__MinorFunction == 0) {
goto switch_0_0;
} else {
if (irpSp__MinorFunction == 5) {
goto switch_0_5;
} else {
if (irpSp__MinorFunction == 1) {
goto switch_0_5;
} else {
if (irpSp__MinorFunction == 6) {
goto switch_0_6;
} else {
if (irpSp__MinorFunction == 3) {
goto switch_0_6;
} else {
if (irpSp__MinorFunction == 4) {
goto switch_0_4;
} else {
if (irpSp__MinorFunction == 2) {
goto switch_0_2;
} else {
goto switch_0_default;
if (0) {
switch_0_0:
{
ntStatus = FloppyStartDevice(DeviceObject, Irp);
}
goto switch_0_break;
switch_0_5:
if (irpSp__MinorFunction == 5) {
}
if (! disketteExtension__IsStarted) {
if (s == NP) {
s = SKIP1;
} else {
{
errorFn();
}
}
{
Irp__CurrentLocation ++;
Irp__Tail__Overlay__CurrentStackLocation ++;
ntStatus = IofCallDriver(disketteExtension__TargetObject, Irp);
}
return (ntStatus);
}
{
disketteExtension__HoldNewRequests = 1;
ntStatus = FlQueueIrpToThread(Irp, disketteExtension);
}
{
__cil_tmp29 = (long )ntStatus;
if (__cil_tmp29 == 259L) {
{
KeWaitForSingleObject(disketteExtension__FloppyThread, Executive,
KernelMode, 0, 0);
}
if (disketteExtension__FloppyThread != 0) {
}
disketteExtension__FloppyThread = 0;
Irp__IoStatus__Status = 0;
myStatus = 0;
if (s == NP) {
s = SKIP1;
} else {
{
errorFn();
}
}
{
Irp__CurrentLocation ++;
Irp__Tail__Overlay__CurrentStackLocation ++;
ntStatus = IofCallDriver(disketteExtension__TargetObject, Irp);
}
} else {
{
ntStatus = -1073741823;
Irp__IoStatus__Status = ntStatus;
myStatus = ntStatus;
Irp__IoStatus__Information = 0;
IofCompleteRequest(Irp, 0);
}
}
}
goto switch_0_break;
switch_0_6:
if (irpSp__MinorFunction == 6) {
}
if (! disketteExtension__IsStarted) {
Irp__IoStatus__Status = 0;
myStatus = 0;
if (s == NP) {
s = SKIP1;
} else {
{
errorFn();
}
}
{
Irp__CurrentLocation ++;
Irp__Tail__Overlay__CurrentStackLocation ++;
ntStatus = IofCallDriver(disketteExtension__TargetObject, Irp);
}
} else {
Irp__IoStatus__Status = 0;
myStatus = 0;
irpSp___0 = Irp__Tail__Overlay__CurrentStackLocation;
nextIrpSp = Irp__Tail__Overlay__CurrentStackLocation - 1;
nextIrpSp__Control = 0;
if (s != NP) {
{
errorFn();
}
} else {
if (compRegistered != 0) {
{
errorFn();
}
} else {
compRegistered = 1;
}
}
{
irpSp___1 = Irp__Tail__Overlay__CurrentStackLocation - 1;
irpSp__Context = doneEvent;
irpSp__Control = 224;
ntStatus = IofCallDriver(disketteExtension__TargetObject, Irp);
}
{
__cil_tmp30 = (long )ntStatus;
if (__cil_tmp30 == 259L) {
{
KeWaitForSingleObject(doneEvent, Executive, KernelMode, 0, 0);
ntStatus = myStatus;
}
}
}
{
disketteExtension__HoldNewRequests = 0;
Irp__IoStatus__Status = ntStatus;
myStatus = ntStatus;
Irp__IoStatus__Information = 0;
IofCompleteRequest(Irp, 0);
}
}
goto switch_0_break;
switch_0_4:
disketteExtension__IsStarted = 0;
Irp__IoStatus__Status = 0;
myStatus = 0;
if (s == NP) {
s = SKIP1;
} else {
{
errorFn();
}
}
{
Irp__CurrentLocation ++;
Irp__Tail__Overlay__CurrentStackLocation ++;
ntStatus = IofCallDriver(disketteExtension__TargetObject, Irp);
}
goto switch_0_break;
switch_0_2:
disketteExtension__HoldNewRequests = 0;
disketteExtension__IsStarted = 0;
disketteExtension__IsRemoved = 1;
if (s == NP) {
s = SKIP1;
} else {
{
errorFn();
}
}
{
Irp__CurrentLocation ++;
Irp__Tail__Overlay__CurrentStackLocation ++;
Irp__IoStatus__Status = 0;
myStatus = 0;
ntStatus = IofCallDriver(disketteExtension__TargetObject, Irp);
}
if (disketteExtension__InterfaceString__Buffer != 0) {
{
IoSetDeviceInterfaceState(disketteExtension__InterfaceString,
0);
}
}
if (disketteExtension__ArcName__Length != 0) {
{
IoDeleteSymbolicLink(disketteExtension__ArcName);
}
}
IoGetConfigurationInformation__FloppyCount --;
goto switch_0_break;
switch_0_default: ;
if (s == NP) {
s = SKIP1;
} else {
{
errorFn();
}
}
{
Irp__CurrentLocation ++;
Irp__Tail__Overlay__CurrentStackLocation ++;
ntStatus = IofCallDriver(disketteExtension__TargetObject, Irp);
}
} else {
switch_0_break: ;
}
}
}
}
}
}
}
}
PagingReferenceCount --;
if (PagingReferenceCount == 0) {
}
return (ntStatus);
}
}
int FloppyStartDevice(int DeviceObject , int Irp )
{ int DeviceObject__DeviceExtension = __VERIFIER_nondet_int() ;
int Irp__Tail__Overlay__CurrentStackLocation = __VERIFIER_nondet_int() ;
int Irp__IoStatus__Status ;
int disketteExtension__TargetObject = __VERIFIER_nondet_int() ;
int disketteExtension__MaxTransferSize ;
int disketteExtension__DriveType = __VERIFIER_nondet_int() ;
int disketteExtension__PerpendicularMode ;
int disketteExtension__DeviceUnit ;
int disketteExtension__DriveOnValue ;
int disketteExtension__UnderlyingPDO = __VERIFIER_nondet_int() ;
int disketteExtension__InterfaceString = __VERIFIER_nondet_int() ;
int disketteExtension__IsStarted ;
int disketteExtension__HoldNewRequests ;
int ntStatus ;
int pnpStatus ;
int doneEvent = __VERIFIER_nondet_int() ;
int fdcInfo = __VERIFIER_nondet_int() ;
int fdcInfo__BufferCount ;
int fdcInfo__BufferSize ;
int fdcInfo__MaxTransferSize = __VERIFIER_nondet_int() ;
int fdcInfo__AcpiBios = __VERIFIER_nondet_int() ;
int fdcInfo__AcpiFdiSupported = __VERIFIER_nondet_int() ;
int fdcInfo__PeripheralNumber = __VERIFIER_nondet_int() ;
int fdcInfo__BusType ;
int fdcInfo__ControllerNumber = __VERIFIER_nondet_int() ;
int fdcInfo__UnitNumber = __VERIFIER_nondet_int() ;
int fdcInfo__BusNumber = __VERIFIER_nondet_int() ;
int Dc ;
int Fp ;
int disketteExtension ;
int irpSp ;
int irpSp___0 ;
int nextIrpSp ;
int nextIrpSp__Control ;
int irpSp___1 ;
int irpSp__Control ;
int irpSp__Context ;
int InterfaceType ;
int KUSER_SHARED_DATA__AlternativeArchitecture_NEC98x86 = __VERIFIER_nondet_int() ;
long __cil_tmp42 ;
int __cil_tmp43 ;
int __cil_tmp44 ;
int __cil_tmp45 ;
int __cil_tmp46 = __VERIFIER_nondet_int() ;
int __cil_tmp47 ;
int __cil_tmp48 ;
int __cil_tmp49 ;
{
Dc = DiskController;
Fp = FloppyDiskPeripheral;
disketteExtension = DeviceObject__DeviceExtension;
irpSp = Irp__Tail__Overlay__CurrentStackLocation;
irpSp___0 = Irp__Tail__Overlay__CurrentStackLocation;
nextIrpSp = Irp__Tail__Overlay__CurrentStackLocation - 1;
nextIrpSp__Control = 0;
if (s != NP) {
{
errorFn();
}
} else {
if (compRegistered != 0) {
{
errorFn();
}
} else {
compRegistered = 1;
}
}
{
irpSp___1 = Irp__Tail__Overlay__CurrentStackLocation - 1;
irpSp__Context = doneEvent;
irpSp__Control = 224;
ntStatus = IofCallDriver(disketteExtension__TargetObject, Irp);
}
{
__cil_tmp42 = (long )ntStatus;
if (__cil_tmp42 == 259L) {
{
ntStatus = KeWaitForSingleObject(doneEvent, Executive, KernelMode, 0, 0);
ntStatus = myStatus;
}
}
}
{
fdcInfo__BufferCount = 0;
fdcInfo__BufferSize = 0;
//__cil_tmp43 = 770 << 2;
//__cil_tmp44 = 7 << 16;
//__cil_tmp45 = __cil_tmp44 | __cil_tmp43;
//__cil_tmp46 = __cil_tmp45 | 3;
ntStatus = FlFdcDeviceIo(disketteExtension__TargetObject, __cil_tmp46, fdcInfo);
}
if (ntStatus >= 0) {
disketteExtension__MaxTransferSize = fdcInfo__MaxTransferSize;
if (fdcInfo__AcpiBios) {
if (fdcInfo__AcpiFdiSupported) {
{
ntStatus = FlAcpiConfigureFloppy(disketteExtension, fdcInfo);
}
if (disketteExtension__DriveType == 4) {
// __cil_tmp47 = 1 << fdcInfo__PeripheralNumber;
//disketteExtension__PerpendicularMode |= __cil_tmp47;
}
} else {
goto _L;
}
} else {
_L:
if (disketteExtension__DriveType == 4) {
// __cil_tmp48 = 1 << fdcInfo__PeripheralNumber;
//disketteExtension__PerpendicularMode |= __cil_tmp48;
}
InterfaceType = 0;
{
while (1) {
while_0_continue: /* CIL Label */ ;
if (InterfaceType >= MaximumInterfaceType) {
goto while_1_break;
}
{
fdcInfo__BusType = InterfaceType;
ntStatus = IoQueryDeviceDescription(fdcInfo__BusType, fdcInfo__BusNumber,
Dc, fdcInfo__ControllerNumber, Fp, fdcInfo__PeripheralNumber,
FlConfigCallBack, disketteExtension);
}
if (ntStatus >= 0) {
goto while_1_break;
}
InterfaceType ++;
}
while_0_break: /* CIL Label */ ;
}
while_1_break: ;
}
if (ntStatus >= 0) {
if (KUSER_SHARED_DATA__AlternativeArchitecture_NEC98x86 != 0) {
disketteExtension__DeviceUnit = fdcInfo__UnitNumber;
disketteExtension__DriveOnValue = fdcInfo__UnitNumber;
} else {
disketteExtension__DeviceUnit = fdcInfo__PeripheralNumber;
//__cil_tmp49 = 16 << fdcInfo__PeripheralNumber;
//disketteExtension__DriveOnValue = fdcInfo__PeripheralNumber | __cil_tmp49;
}
{
pnpStatus = IoRegisterDeviceInterface(disketteExtension__UnderlyingPDO, MOUNTDEV_MOUNTED_DEVICE_GUID,
0, disketteExtension__InterfaceString);
}
if (pnpStatus >= 0) {
{
pnpStatus = IoSetDeviceInterfaceState(disketteExtension__InterfaceString,
1);
}
}
disketteExtension__IsStarted = 1;
disketteExtension__HoldNewRequests = 0;
}
}
{
Irp__IoStatus__Status = ntStatus;
myStatus = ntStatus;
IofCompleteRequest(Irp, 0);
}
return (ntStatus);
}
}
int FloppyPnpComplete(int DeviceObject , int Irp , int Context )
{
{
{
KeSetEvent(Context, 1, 0);
}
return (-1073741802);
}
}
int FlFdcDeviceIo(int DeviceObject , int Ioctl , int Data )
{ int ntStatus ;
int irp ;
int irpStack ;
int doneEvent = __VERIFIER_nondet_int() ;
int ioStatus = __VERIFIER_nondet_int() ;
int irp__Tail__Overlay__CurrentStackLocation = __VERIFIER_nondet_int() ;
int irpStack__Parameters__DeviceIoControl__Type3InputBuffer ;
long __cil_tmp11 ;
{
{
irp = IoBuildDeviceIoControlRequest(Ioctl, DeviceObject, 0, 0, 0, 0, 1, doneEvent,
ioStatus);
}
if (irp == 0) {
return (-1073741670);
}
{
irpStack = irp__Tail__Overlay__CurrentStackLocation - 1;
irpStack__Parameters__DeviceIoControl__Type3InputBuffer = Data;
ntStatus = IofCallDriver(DeviceObject, irp);
}
{
__cil_tmp11 = (long )ntStatus;
if (__cil_tmp11 == 259L) {
{
KeWaitForSingleObject(doneEvent, Suspended, KernelMode, 0, 0);
ntStatus = myStatus;
}
}
}
return (ntStatus);
}
}
void FloppyProcessQueuedRequests(int DisketteExtension )
{
{
return;
}
}
void stub_driver_init(void)
{
{
s = NP;
pended = 0;
compRegistered = 0;
lowerDriverReturn = 0;
setEventCalled = 0;
customIrp = 0;
return;
}
}
int main(void)
{ int status ;
int irp = __VERIFIER_nondet_int() ;
int pirp ;
int pirp__IoStatus__Status ;
int irp_choice = __VERIFIER_nondet_int() ;
int devobj = __VERIFIER_nondet_int() ;
int __cil_tmp8 ;
FloppyThread = 0;
KernelMode = 0;
Suspended = 0;
Executive = 0;
DiskController = 0;
FloppyDiskPeripheral = 0;
FlConfigCallBack = 0;
MaximumInterfaceType = 0;
MOUNTDEV_MOUNTED_DEVICE_GUID = 0;
myStatus = 0;
s = 0;
UNLOADED = 0;
NP = 0;
DC = 0;
SKIP1 = 0;
SKIP2 = 0 ;
MPR1 = 0;
MPR3 = 0;
IPC = 0;
pended = 0;
compRegistered = 0;
lowerDriverReturn = 0;
setEventCalled = 0;
customIrp = 0;
{
{
status = 0;
pirp = irp;
_BLAST_init();
}
if (status >= 0) {
s = NP;
customIrp = 0;
setEventCalled = customIrp;
lowerDriverReturn = setEventCalled;
compRegistered = lowerDriverReturn;
pended = compRegistered;
pirp__IoStatus__Status = 0;
myStatus = 0;
if (irp_choice == 0) {
pirp__IoStatus__Status = -1073741637;
myStatus = -1073741637;
}
{
stub_driver_init();
}
{
if (status < 0) {
return (-1);
}
}
int tmp_ndt_1;
tmp_ndt_1 = __VERIFIER_nondet_int();
if (tmp_ndt_1 == 0) {
goto switch_2_0;
} else {
int tmp_ndt_2;
tmp_ndt_2 = __VERIFIER_nondet_int();
if (tmp_ndt_2 == 1) {
goto switch_2_1;
} else {
int tmp_ndt_3;
tmp_ndt_3 = __VERIFIER_nondet_int();
if (tmp_ndt_3 == 2) {
goto switch_2_2;
} else {
int tmp_ndt_4;
tmp_ndt_4 = __VERIFIER_nondet_int();
if (tmp_ndt_4 == 3) {
goto switch_2_3;
} else {
goto switch_2_default;
if (0) {
switch_2_0:
{
status = FloppyCreateClose(devobj, pirp);
}
goto switch_2_break;
switch_2_1:
{
status = FloppyCreateClose(devobj, pirp);
}
goto switch_2_break;
switch_2_2:
{
status = FloppyDeviceControl(devobj, pirp);
}
goto switch_2_break;
switch_2_3:
{
status = FloppyPnp(devobj, pirp);
}
goto switch_2_break;
switch_2_default: ;
return (-1);
} else {
switch_2_break: ;
}
}
}
}
}
}
if (pended == 1) {
if (s == NP) {
s = NP;
} else {
goto _L___2;
}
} else {
_L___2:
if (pended == 1) {
if (s == MPR3) {
s = MPR3;
} else {
goto _L___1;
}
} else {
_L___1:
if (s != UNLOADED) {
if (status != -1) {
if (s != SKIP2) {
if (s != IPC) {
if (s != DC) {
{
errorFn();
}
} else {
goto _L___0;
}
} else {
goto _L___0;
}
} else {
_L___0:
if (pended == 1) {
if (status != 259) {
status = 0;
}
} else {
if (s == DC) {
if (status == 259) {
{
errorFn();
}
}
} else {
if (status != lowerDriverReturn) {
{
errorFn();
}
}
}
}
}
}
}
}
}
status = 0;
return (status);
}
}
int IoBuildDeviceIoControlRequest(int IoControlCode , int DeviceObject , int InputBuffer ,
int InputBufferLength , int OutputBuffer , int OutputBufferLength ,
int InternalDeviceIoControl , int Event , int IoStatusBlock )
{
int malloc = __VERIFIER_nondet_int() ;
{
customIrp = 1;
int tmp_ndt_5;
tmp_ndt_5 = __VERIFIER_nondet_int();
if (tmp_ndt_5 == 0) {
goto switch_3_0;
} else {
goto switch_3_default;
if (0) {
switch_3_0:
return (malloc);
switch_3_default: ;
return (0);
} else {
}
}
}
}
int IoDeleteSymbolicLink(int SymbolicLinkName )
{
{
int tmp_ndt_6;
tmp_ndt_6 = __VERIFIER_nondet_int();
if (tmp_ndt_6 == 0) {
goto switch_4_0;
} else {
goto switch_4_default;
if (0) {
switch_4_0:
return (0);
switch_4_default: ;
return (-1073741823);
} else {
}
}
}
}
int IoQueryDeviceDescription(int BusType , int BusNumber , int ControllerType , int ControllerNumber ,
int PeripheralType , int PeripheralNumber , int CalloutRoutine ,
int Context )
{
{
int tmp_ndt_7;
tmp_ndt_7 = __VERIFIER_nondet_int();
if (tmp_ndt_7 == 0) {
goto switch_5_0;
} else {
goto switch_5_default;
if (0) {
switch_5_0:
return (0);
switch_5_default: ;
return (-1073741823);
} else {
}
}
}
}
int IoRegisterDeviceInterface(int PhysicalDeviceObject , int InterfaceClassGuid ,
int ReferenceString , int SymbolicLinkName )
{
{
int tmp_ndt_8;
tmp_ndt_8 = __VERIFIER_nondet_int();
if (tmp_ndt_8 == 0) {
goto switch_6_0;
} else {
goto switch_6_default;
if (0) {
switch_6_0:
return (0);
switch_6_default: ;
return (-1073741808);
} else {
}
}
}
}
int IoSetDeviceInterfaceState(int SymbolicLinkName , int Enable )
{
{
int tmp_ndt_9;
tmp_ndt_9 = __VERIFIER_nondet_int();
if (tmp_ndt_9 == 0) {
goto switch_7_0;
} else {
goto switch_7_default;
if (0) {
switch_7_0:
return (0);
switch_7_default: ;
return (-1073741823);
} else {
}
}
}
}
void stubMoreProcessingRequired(void)
{
{
if (s == NP) {
s = MPR1;
} else {
{
errorFn();
}
}
return;
}
}
int IofCallDriver(int DeviceObject , int Irp )
{
int returnVal2 ;
int compRetStatus1 ;
int lcontext = __VERIFIER_nondet_int() ;
unsigned long __cil_tmp7 ;
{
if (compRegistered) {
{
compRetStatus1 = FloppyPnpComplete(DeviceObject, Irp, lcontext);
}
{
__cil_tmp7 = (unsigned long )compRetStatus1;
if (__cil_tmp7 == -1073741802) {
{
stubMoreProcessingRequired();
}
}
}
}
int tmp_ndt_10;
tmp_ndt_10 = __VERIFIER_nondet_int();
if (tmp_ndt_10 == 0) {
goto switch_8_0;
} else {
int tmp_ndt_11;
tmp_ndt_11 = __VERIFIER_nondet_int();
if (tmp_ndt_11 == 1) {
goto switch_8_1;
} else {
goto switch_8_default;
if (0) {
switch_8_0:
returnVal2 = 0;
goto switch_8_break;