-
Notifications
You must be signed in to change notification settings - Fork 108
/
Copy pathcaseconvs
2094 lines (1883 loc) · 91.9 KB
/
caseconvs
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
case \x of 0 -> 1 -> _ -> ---> if \x = 0
then ->1 else if \x = 1 then ->2 else ->3
case \x of nodeCap@(CNodeCap {}) -> _ -> ---> let nodeCap = \x in
if isCNodeCap nodeCap
then ->1 else ->2
case \x of root@(CNodeCap {}) -> _ -> ---> let root = \x in
if isCNodeCap root
then ->1 else ->2
case \x of rt@(CNodeCap {}) -> _ -> ---> let rt = \x in
if isCNodeCap rt
then ->1 else ->2
case \x of cap@(EndpointCap { capEPCanSend = True }) -> cap@(NotificationCap { capNtfnCanSend = True }) -> cap -> ---> let cap = \x in
if isEndpointCap cap \<and> capEPCanSend cap
then ->1 else if isNotificationCap cap \<and> capNtfnCanSend cap
then ->2 else ->3
case \x of EndpointCap { \v0\EPCanReceive = True } -> NotificationCap { \v0\NtfnCanReceive = True } -> _ -> ---> let \v0\ = \x in
if isEndpointCap \v0\ \<and> \v0\EPCanReceive \v0
then ->1 else if isNotificationCap \v0\ \<and> \v0\NtfnCanReceive \v0
then ->2 else ->3
case \x of (_, _, cap@(ThreadCap {capTCBCanWrite = True})) -> (_, _, cap@(CNodeCap {})) -> (_, capIndex, cap@(UntypedCap {})) -> (blocking, capIndex, cap@(ArchObjectCap {})) -> (True, ptr, cap) -> (False, _, _) -> ---> let (blocking, capIndex, cap) = \x in if isThreadCap cap \<and> capTCBCanWrite cap
then ->1 else if isCNodeCap cap
then ->2 else if isUntypedCap cap
then ->3 else if isArchObjectCap cap
then ->4 else if blocking
then ->5 else ->6
case \x of (index:bits:args, cap@(CNodeCap {capCNodeCanModify=True})) -> (_, CNodeCap {capCNodeCanModify=True}) -> (_, _) -> ---> let (\v0\, cap) = \x in
if length (\v0\) > 1 \<and> isCNodeCap cap \<and> capCNodeCanModify cap then let index = \v0\ !! 0;
bits = \v0\ !! 1;
args = drop 2 \v0
in ->1 else if isCNodeCap cap \<and> capCNodeCanModify cap then ->2 else ->3
case \x of (_, _, cap@(ThreadCap {capTCBCanWrite = True})) -> (_, _, cap@(CNodeCap {capCNodeCanModify = True})) -> (_, capIndex, cap@(UntypedCap {})) -> (blocking, capIndex, cap@(ArchObjectCap {})) -> (True, ptr, cap) -> (False, _, _) -> ---> let (blocking, capIndex, cap) = \x in if isThreadCap cap \<and> capTCBCanWrite cap
then ->1 else if isCNodeCap cap \<and> capCNodeCanModify cap
then ->2 else if isUntypedCap cap
then ->3 else if isArchObjectCap cap
then ->4 else if blocking
then let ptr = capIndex in ->5 else ->6
case \x of (capPtr, cap@(ThreadCap{capTCBCanWrite = True})) -> (_, cap@(CNodeCap {capCNodeCanModify = True})) -> (capIndex, cap@(UntypedCap {})) -> (capIndex, cap@(ArchObjectCap {})) -> (capPtr, cap) -> ---> let (capPtr, cap) = \x; capIndex = capPtr in
if isThreadCap cap \<and> capTCBCanWrite cap
then ->1 else if isCNodeCap cap \<and> capCNodeCanModify cap
then ->2 else if isUntypedCap cap
then ->3 else if isArchObjectCap cap
then ->4 else ->5
case \x of (capPtr, cap@(ThreadCap{capTCBCanWrite = True})) -> (_, cap@(CNodeCap {capCNodeCanModify = True})) -> (_, cap@(UntypedCap {})) -> (capIndex, cap@(ArchObjectCap {})) -> (capPtr, cap) -> ---> let (capPtr, cap) = \x; capIndex = capPtr in
if isThreadCap cap \<and> capTCBCanWrite cap
then ->1 else if isCNodeCap cap \<and> capCNodeCanModify cap
then ->2 else if isUntypedCap cap
then ->3 else if isArchObjectCap cap
then ->4 else ->5
case \x of Just (slot, 0, rights) -> _ -> ---> case \x of
Some \v0\ \<Rightarrow> let (slot, \v1\, rights) = \v0\ in
if \v1\ = 0 then ->1 else ->2 | None \<Rightarrow> ->2
case \x of (slot, 0, rights) -> (_, bitsLeft, _) -> ---> let (slot, bitsLeft, rights) = \x in
if bitsLeft = 0
then ->1 else ->2
case \x of (index:bits:args, cnode@(CNodeCap {})) -> (_, _) -> ---> let (L, cnode) = \x in
if isCNodeCap cnode \<and> length L > 1 then
let index = L !! 0;
bits = L !! 1;
args = drop 2 L
in ->1 else ->2
case \x of (index:bits:args, cnode@(CNodeCap { capCNodeCanModify = True })) -> (_, CNodeCap { capCNodeCanModify = True }) -> (_, _) -> ---> let (L, cnode) = \x in
if isCNodeCap cnode \<and> capCNodeCanModify cnode then
if length L > 1 then
let index = L !! 0;
bits = L !! 1;
args = drop 2 L
in ->1 else ->2 else ->3
case \x of (YieldToCall, _, thread) -> (call@(ThreadControlCall {}), faultep:replyep:priority:cRoot:cRootData:vRoot:vRootData:buffer:_, target) -> (call@(ExchangeRegistersCall {}), src:save:_, dest) -> (_, _, _) -> ---> let (call, L, \v0\) = \x in
if isYieldToCall call
then let thread = \v0\ in ->1 else if isThreadControlCall call \<and> length L > 6
then let target = \v0\;
faultep = L !! 0;
replyep = L !! 1;
priority = L !! 2;
cRoot = L !! 3;
cRootData = L !! 4;
vRoot = L !! 5;
vRootData = L !! 6;
buffer = L !! 7
in ->2 else if isExchangeRegistersCall call \<and> length L > 1
then let dest = \v0\;
src = L !! 0;
save = L !! 1
in ->3 else ->4
case \x of (call@(ThreadControlCall{threadSetCRoot = True}), False) -> (call@(ThreadControlCall{threadSetVRoot = True}), False) -> (_,_) -> ---> let (call, \v0\) = \x in
if isThreadControlCall call \<and> threadSetCRoot call \<and> \<not> \v0
then ->1 else if isThreadControlCall call \<and> threadSetVRoot call \<and> \<not> \v0
then ->2 else ->3
case \x of (call@(ThreadControlCall{threadSetCRoot = True}), False) -> (call@(ThreadControlCall{threadSetVRoot = True}), False) -> _ -> ---> let (call, \v0\) = \x in
if isThreadControlCall call \<and> threadSetCRoot call \<and> \<not> \v0
then ->1 else if isThreadControlCall call \<and> threadSetVRoot call \<and> \<not> \v0
then ->2 else ->3
case \x of untypedCap@(UntypedCap {}) -> _ -> ---> let untypedCap = \x in
if isUntypedCap untypedCap
then ->1
else ->1
case \x of ex2@(UserHandledFault {}) -> ex2 -> ---> let ex2 = \x in
if isUserHandledFault ex2
then ->1 else ->2
case \x of 0 -> size -> ---> let size = \x in if size = 0
then ->1 else ->2
case \x of 0 -> ctePtr -> ---> let ctePtr = \x in if ctePtr = 0
then ->1 else ->2
case \x of (first:rest,_) -> ([], 0) -> ([], _) -> ---> let \v0\ = \x in case fst \v0\ of
first#rest \<Rightarrow> ->1 | [] \<Rightarrow> if snd \v0\ = 0
then ->2 else ->3
case \x of Just x@(CNodeData {}) -> _ -> ---> let \v0\ = \x in
if \v0\ \<noteq> None \<and> isCNodeData (the \v0\)
then let x = the \v0\ in ->1 else ->2
case \x of (Just new, EndpointData 0) -> (Just _, EndpointData _) -> (Just new, AsyncEndpointData 0) -> (Just _, AsyncEndpointData _) -> (Nothing, old@(CNodeData {})) -> (Just new, old@(CNodeData {})) -> (_, old) -> ---> let (\v0\, old) = \x; new = the \v0\; \v1\ = (\v0\ \<noteq> None) in
if \v1\ \<and> old = EndpointData 0
then ->1 else if \v1\ \<and> isEndpointData old
then ->2 else if \v1\ \<and> old = AsyncEndpointData 0
then ->3 else if \v1\ \<and> isAsyncEndpointData old
then ->4 else if (\<not> \v1\) \<and> isCNodeData old
then ->5 else if \v1\ \<and> isCNodeData old
then ->6 else ->7
case \x of 0 -> slot -> ---> let slot = \x in
if slot = 0 then ->1 else ->2
case \x of CTE { cteCap = UntypedCap {} } -> cte@(CTE { cteMDBNode = mdb }) -> ---> let cte = \x in
if isUntypedCap (cteCap cte)
then ->1 else let mdb = cteMDBNode cte
in ->2
case \x of cap@(EndpointCap {}) -> _ -> ---> let cap = \x in
if isEndpointCap cap
then ->1 else ->2
case \x of (a@UntypedCap {}, b@UntypedCap {}) -> (a@EndpointCap {}, b@EndpointCap {}) -> (a@NotificationCap {}, b@NotificationCap {}) -> (a@CNodeCap {}, b@CNodeCap {}) -> (a@ThreadCap {}, b@ThreadCap {}) -> (a@FrameCap {}, b@FrameCap {}) -> (ArchObjectCap a, ArchObjectCap b) -> (_, _) -> ---> let (a, b) = \x in
if isUntypedCap a \<and> isUntypedCap b
then ->1 else if isEndpointCap a \<and> isEndpointCap b
then ->2 else if isNotificationCap a \<and> isNotificationCap b
then ->3 else if isCNodeCap a \<and> isCNodeCap b
then ->4 else if isThreadCap a \<and> isThreadCap b
then ->5 else if isFrameCap a \<and> isFrameCap b
then ->6 else if isArchObjectCap a \<and> isArchObjectCap b
then let a = capCap a; b = capCap b in ->7 else ->8
case \x of cap@(EndpointCap {capEPCanSend=True}) -> cap@(NotificationCap {capNtfnCanSend=True}) -> cap@(ThreadCap {capTCBCanWrite=True}) -> cap@(CNodeCap {capCNodeCanModify=True}) -> cap@(UntypedCap {}) -> cap@(ArchObjectCap {}) -> _ -> ---> let cap = \x in
if isEndpointCap cap \<and> capEPCanSend cap
then ->1 else if isNotificationCap cap \<and> capNtfnCanSend cap
then ->2 else if isThreadCap cap \<and> capTCBCanWrite cap
then ->3 else if isCNodeCap cap \<and> capCNodeCanModify cap
then ->4 else if isUntypedCap cap
then ->5 else if isArchObjectCap cap
then ->6 else ->7
case \x of 0 -> 1 -> 2 -> _ -> ---> let \v0\ = \x in
if \v0\ = 0 then ->1 else if \v0\ = 1 then ->2 else if \v0\ = 2 then ->3 else ->4
case \x of (CTE a@(UntypedCap {}) _, CTE b _) -> (CTE a mdbA, CTE b mdbB) -> ---> let (\v0\, \v1\) = \x in
case \v0\ of CTE a mdbA \<Rightarrow> (
case \v1\ of CTE b mdbB \<Rightarrow> (
if isUntypedCap a
then ->1 else ->2 ))
case \x of EndpointCap { capEPBadge = 0 } -> NotificationCap { capNtfnBadge = 0 } -> EndpointCap {} -> (NotificationCap {}) -> _ -> ---> let \v0\ = \x in
if isEndpointCap \v0\ \<and> capEPBadge \v0\ = 0
then ->1 else if isNotificationCap \v0\ \<and> capNtfnBadge \v0\ = 0
then ->2 else if isEndpointCap \v0
then ->3 else if isNotificationCap \v0
then ->4 else ->5
case \x of (EndpointCap { capEPPtr = ptr }, True, _) -> (NotificationCap { capNtfnPtr = ptr }, True, _) -> (cap@(CNodeCap {}), True, True) -> (ThreadCap { capTCBPtr = tcb }, True, True) -> (CNodeCap { capCNodePtr = cn }, True, False) -> (Zombie { zombieObject = Left (cn, n+1) }, _, False) -> (ThreadCap { capTCBPtr = tcb }, True, False) -> (Zombie { zombieObject = Right tcb }, True, False) -> (Zombie { zombieObject = Left (cn, n+1) }, _, True) -> (Zombie { zombieObject = Left (_, 0) }, True, _) -> (Zombie { zombieObject = Right tcb }, True, True) -> (ArchObjectCap { capCap = cap }, final, exposed) -> (FrameCap {}, _, _) -> (NullCap, _, _) -> (Zombie {}, False, _) -> (_, _, _) -> ---> let (\v0\, \v1\, \v2\) = \x in
if isEndpointCap \v0\ \<and> \v1
then let ptr = capEPPtr \v0
in ->1 else if isNotificationCap \v0\ \<and> \v1
then let ptr = capNtfnPtr \v0
in ->2 else if isCNodeCap \v0\ \<and> \v1\ \<and> \v2
then let cap = \v0
in ->3 else if isThreadCap \v0\ \<and> \v1\ \<and> \v2
then let tcb = capTCBPtr \v0
in ->4 else if isCNodeCap \v0\ \<and> \v1\ \<and> (\<not> \v2\)
then let cn = capCNodePtr \v0
in ->5 else if isZombie \v0\ \<and> (\<not> \v2\) \<and> (\<exists>cn n. zombieObject \v0\ = Left (cn, n + 1))
then let (cn, \v3\) = theLeft (zombieObject \v0\); n = \v3\ - 1
in ->6 else if isThreadCap \v0\ \<and> \v1\ \<and> (\<not> \v2\)
then let tcb = capTCBPtr \v0
in ->7 else if isZombie \v0\ \<and> \v1\ \<and> (\<not> \v2\) \<and> isRight (zombieObject \v0\)
then let tcb = theRight (zombieObject \v0\)
in ->8 else if isZombie \v0\ \<and> \v2\ \<and> (\<exists>cn n. zombieObject \v0\ = Left (cn, n + 1))
then let (cn, \v3\) = theLeft (zombieObject \v0\); n = \v3\ - 1
in ->9 else if isZombie \v0\ \<and> \v1\ \<and> (\<exists>\v3\. zombieObject \v0\ = Left (\v3\, 0))
then ->10 else if isZombie \v0\ \<and> isRight (zombieObject \v0\) \<and> \v1\ \<and> \v2
then let tcb = theRight (zombieObject \v0\)
in ->11 else if isArchObjectCap \v0
then let (cap, final, exposed) = (capCap \v0\, \v1\, \v2\)
in ->12 else if isFrameCap \v0
then ->13 else if isNullCap \v0
then ->14 else if isZombie \v0\ \<and> (\<not> \v1\)
then ->15 else ->16
case \x of (new, cap@(EndpointCap {})) -> (new, cap@(NotificationCap {})) -> (w, cap@(CNodeCap {})) -> (w, ArchObjectCap { capCap = aoCap }) -> (_, cap) -> ---> let (new, cap) = \x;
w = new in
if isEndpointCap cap
then ->1 else if isNotificationCap cap
then ->2 else if isCNodeCap cap
then ->3 else if isArchObjectCap cap
then let aoCap = capCap cap
in ->4 else ->5
case \x of cap@(EndpointCap { capEPCanSend = True }) -> _ -> ---> let cap = \x in
if isEndpointCap cap \<and> capEPCanSend cap
then ->1 else ->2
case \x of (EndpointCap { capEPPtr = ptr }, True, _) -> (NotificationCap { capNtfnPtr = ptr }, True, _) -> (cap@(CNodeCap {}), True, exposed) -> (ThreadCap { capTCBPtr = tcb }, True, exposed) -> (Zombie { capCTEPtr = ptr, capNumber = n+1 }, _, False) -> (Zombie { capCTEPtr = ptr, capNumber = n+1 }, _, True) -> (Zombie { capNumber = 0 }, True, _) -> (ArchObjectCap { capCap = cap }, final, exposed) -> (FrameCap {}, _, _) -> (NullCap, _, _) -> (Zombie {}, False, _) -> (_, _, _) -> ---> let (\v0\, \v1\, \v2\) = \x in
if isEndpointCap \v0\ \<and> \v1
then let ptr = capEPPtr \v0
in ->1 else if isNotificationCap \v0\ \<and> \v1
then let ptr = capNtfnPtr \v0
in ->2 else if isCNodeCap \v0\ \<and> \v1
then let cap = \v0\; exposed = \v2
in ->3 else if isThreadCap \v0\ \<and> \v1
then let tcb = capTCBPtr \v0\; exposed = \v2
in ->4 else if isZombie \v0\ \<and> (\<not> \v2\) \<and> capNumber \v0\ \<noteq> 0
then let ptr = capCTEPtr \v0\;
n = capNumber \v0\ - 1
in ->5 else if isZombie \v0\ \<and> \v2\ \<and> capNumber \v0\ \<noteq> 0
then let ptr = capCTEPtr \v0\;
n = capNumber \v0\ - 1
in ->6 else if isZombie \v0\ \<and> capNumber \v0\ = 0
then ->7 else if isArchObjectCap \v0
then let (cap, final, exposed) = (capCap \v0\, \v1\, \v2\)
in ->8 else if isFrameCap \v0
then ->9 else if isNullCap \v0
then ->10 else if isZombie \v0\ \<and> (\<not> \v1\)
then ->11 else ->12
case \x of (index:bits:args, cap@(CNodeCap {capCNodeCanModify=True})) -> (_, CNodeCap {capCNodeCanModify=False}) -> (_, _) -> ---> let (\v0\, cap) = \x in
if length (\v0\) > 1 \<and> isCNodeCap cap \<and> capCNodeCanModify cap then let index = \v0\ !! 0;
bits = \v0\ !! 1;
args = drop 2 \v0
in ->1 else if isCNodeCap cap \<and> (\<not> capCNodeCanModify cap) then ->2 else ->3
case \x of 32 -> 64 -> _ -> ---> if \x = 32
then ->1 else if \x = 64
then ->2 else ->3
case \x of NullCap -> c@(UntypedCap {}) -> c@(EndpointCap {}) -> c@(NotificationCap {}) -> c@(CNodeCap {}) -> c@(ThreadCap {}) -> c@(FrameCap {}) -> ArchObjectCap {capCap = aoCap} -> c@(Zombie {}) -> ---> let c = \x in
if isNullCap c
then ->1 else if isUntypedCap c
then ->2 else if isEndpointCap c
then ->3 else if isNotificationCap c
then ->4 else if isCNodeCap c
then ->5 else if isThreadCap c
then ->6 else if isFrameCap c
then ->7 else if isArchObjectCap c
then let aoCap = capCap c
in ->8 else (* assuming Zombie *) ->9
case \x of (src@EndpointCap {}, new@EndpointCap {}) -> (src@NotificationCap {}, new@NotificationCap {}) -> (_, _) -> ---> let (src, new) = \x in
if (isEndpointCap src \<and> isEndpointCap new)
then ->1 else if (isNotificationCap src \<and> isNotificationCap new)
then ->2 else ->3
case \x of c2@(Zombie { capCTEPtr = ptr2 }) -> _ -> ---> let c2 = \x;
ptr2 = capCTEPtr c2 in
if isZombie c2
then ->1 else ->2
case \x of (EndpointCap { capEPPtr = ptr }, True, _) -> (NotificationCap { capNtfnPtr = ptr }, True, _) -> (cap@(CNodeCap {}), True, exposed) -> (ThreadCap { capTCBPtr = tcb }, True, exposed) -> (Zombie { capCTEPtr = ptr, capNumber = n+1 }, True, False) -> (Zombie { capCTEPtr = ptr, capNumber = n+1 }, True, True) -> (Zombie { capNumber = 0 }, True, _) -> (ArchObjectCap { capCap = cap }, final, exposed) -> (FrameCap {}, _, _) -> (NullCap, _, _) -> (Zombie {}, False, _) -> (_, _, _) -> ---> let (\v0\, \v1\, \v2\) = \x in
if isEndpointCap \v0\ \<and> \v1
then let ptr = capEPPtr \v0
in ->1 else if isNotificationCap \v0\ \<and> \v1
then let ptr = capNtfnPtr \v0
in ->2 else if isCNodeCap \v0\ \<and> \v1
then let cap = \v0\; exposed = \v2
in ->3 else if isThreadCap \v0\ \<and> \v1
then let tcb = capTCBPtr \v0\; exposed = \v2
in ->4 else if isZombie \v0\ \<and> \v1\ \<and> (\<not> \v2\) \<and> capNumber \v0\ \<noteq> 0
then let ptr = capCTEPtr \v0\;
n = capNumber \v0\ - 1
in ->5 else if isZombie \v0\ \<and> \v1\ \<and> \v2\ \<and> capNumber \v0\ \<noteq> 0
then let ptr = capCTEPtr \v0\;
n = capNumber \v0\ - 1;
c = \v0
in ->6 else if isZombie \v0\ \<and> \v1\ \<and> capNumber \v0\ = 0
then ->7 else if isArchObjectCap \v0
then let (cap, final, exposed) = (capCap \v0\, \v1\, \v2\)
in ->8 else if isFrameCap \v0
then ->9 else if isNullCap \v0
then ->10 else if isZombie \v0\ \<and> (\<not> \v1\)
then ->11 else ->12
case \x of (src@EndpointCap {}, new@EndpointCap {}) -> (src@NotificationCap {}, new@NotificationCap {}) -> (_, _) -> ---> let (src,new) = \x in
if isEndpointCap src & isEndpointCap new
then ->1
else if isNotificationCap src & isNotificationCap new
then ->2
else ->3
case \x of EndpointCap { capEPBadge = 0 } -> NotificationCap { capNtfnBadge = 0 } -> EndpointCap {} -> NotificationCap {} -> _ -> ---> if isEndpointCap \x \<and> capEPBadge \x = 0
then ->1 else if isNotificationCap \x \<and> capNtfnBadge \x = 0
then ->2 else if isEndpointCap \x then ->3 else if isNotificationCap \x
then ->4 else ->5
case \x of (_, cap@(EndpointCap {capEPCanSend=True})) -> (_, cap@(NotificationCap {capNtfnCanSend=True})) -> (sl, cap@(ThreadCap {capTCBCanWrite=True})) -> (_, cap@(CNodeCap {capCNodeCanModify=True})) -> (slot, cap@(UntypedCap {})) -> (slot, cap@(ArchObjectCap {})) -> (_, _) -> ---> let (slot, cap) = \x in
if isEndpointCap cap \<and> capEPCanSend cap
then ->1 else if isNotificationCap cap \<and> capNtfnCanSend cap
then ->2 else if isThreadCap cap \<and> capTCBCanWrite cap
then let sl = slot
in ->3 else if isCNodeCap cap \<and> capCNodeCanModify cap
then ->4 else if isUntypedCap cap
then ->5 else if isArchObjectCap cap
then ->6 else ->7
case \x of EndpointCap { capEPBadge = 0 } -> NotificationCap { capNtfnBadge = 0 } -> EndpointCap { capEPBadge = badge } | badge /= 0 -> NotificationCap { capNtfnBadge = badge } | badge /= 0 -> _ -> ---> if isEndpointCap \x & capEPBadge \x = 0
then ->1
else if isNotificationCap \x & capNtfnBadge \x = 0
then ->2
else if isEndpointCap \x
then let badge = capEPBadge \x in
->3
else if isNotificationCap \x
then let badge = capNtfnBadge \x in
->4
else ->5
case \x of (_, NullCap) -> (a@(UntypedCap {}), b) -> (a@EndpointCap {}, b@EndpointCap {}) -> (a@NotificationCap {}, b@NotificationCap {}) -> (a@CNodeCap {}, b@CNodeCap {}) -> (a@ThreadCap {}, b@ThreadCap {}) -> (a@FrameCap {}, b@FrameCap {}) -> (ArchObjectCap a, ArchObjectCap b) -> (_, _) -> ---> let (a,b) = \x in
if b = NullCap
then ->1
else if isUntypedCap a
then ->2
else if isEndpointCap a & isEndpointCap b
then ->3
else if isNotificationCap a & isNotificationCap b
then ->4
else if isCNodeCap a & isCNodeCap b
then ->5
else if isThreadCap a & isThreadCap b
then ->6
else if isFrameCap a & isFrameCap b
then ->7
else if isArchObjectCap a & isArchObjectCap b
then let a = capCap a; b = capCap b in
->8
else ->9
case \x of EndpointCap { capEPBadge = badge } | badge /= 0 -> NotificationCap { capNtfnBadge = badge } | badge /= 0 -> _ -> ---> if isEndpointCap \x & capEPBadge \x ~= 0
then let badge = capEPBadge \x in
->1
else if isNotificationCap \x & capNtfnBadge \x ~= 0
then let badge = capNtfnBadge \x in
->2
else ->3
case \x of (EndpointCap { capEPPtr = ptr }, True, _) -> (NotificationCap { capNtfnPtr = ptr }, True, _) -> (cap@(CNodeCap {}), True, exposed) -> (ThreadCap { capTCBPtr = tcb }, True, exposed) -> (Zombie { capCTEPtr = ptr, capNumber = n+1 }, True, False) -> (z@(Zombie { capCTEPtr = ptr, capNumber = n+1 }), True, True) -> (Zombie { capNumber = 0 }, True, _) -> (ArchObjectCap { capCap = cap }, final, exposed) -> (FrameCap {}, _, _) -> (NullCap, _, _) -> (Zombie {}, False, _) -> (_, _, _) -> ---> let (\v0\, \v1\, \v2\) = \x in
if isEndpointCap \v0\ \<and> \v1
then let ptr = capEPPtr \v0
in ->1 else if isNotificationCap \v0\ \<and> \v1
then let ptr = capNtfnPtr \v0
in ->2 else if isCNodeCap \v0\ \<and> \v1
then let cap = \v0\; exposed = \v2
in ->3 else if isThreadCap \v0\ \<and> \v1
then let tcb = capTCBPtr \v0\; exposed = \v2
in ->4 else if isZombie \v0\ \<and> \v1\ \<and> (\<not> \v2\) \<and> capNumber \v0\ \<noteq> 0
then let ptr = capCTEPtr \v0\;
n = capNumber \v0\ - 1
in ->5 else if isZombie \v0\ \<and> \v1\ \<and> \v2\ \<and> capNumber \v0\ \<noteq> 0
then let z = \v0\;
ptr = capCTEPtr \v0\;
n = capNumber \v0\ - 1;
c = \v0
in ->6 else if isZombie \v0\ \<and> \v1\ \<and> capNumber \v0\ = 0
then ->7 else if isArchObjectCap \v0
then let (cap, final, exposed) = (capCap \v0\, \v1\, \v2\)
in ->8 else if isFrameCap \v0
then ->9 else if isNullCap \v0
then ->10 else if isZombie \v0\ \<and> (\<not> \v1\)
then ->11 else ->12
case \x of (srcIndex:srcDepth:args, srcRootCap:_) | label < 4 -> (_, _) | label == 4 -> (_, _) | label == 5 -> (pivotNewData:pivotIndex:pivotDepth:srcNewData:srcIndex:srcDepth:_, pivotRootCap:srcRootCap:_) | label == 6 -> (_, _) | label > 6 -> _ -> ---> let (\v0\, \v1\) = \x
in if length \v0\ >= 2 & length \v1\ >= 1 & label < 4 then let srcIndex = \v0\ !! 0; srcDepth = \v0\ !! 1; args = drop 2 \v0\; srcRootCap = \v1\ !! 0 in ->1 else if label = 4 then ->2 else if label = 5 then ->3 else if length \v0\ >= 6 & length \v1\ >= 2 & label = 6 then let pivotNewData = \v0\ !! 0; pivotIndex = \v0\ !! 1; pivotDepth = \v0\ !! 2; srcNewData = \v0\ !! 3; srcIndex = \v0\ !! 4; srcDepth = \v0\ !! 5; pivotRootCap = \v1\ !! 0; srcRootCap = \v1\ !! 1 in ->4 else if label > 6 then ->5 else ->6
case \x of Zombie {} -> cap@(UntypedCap {}) -> ArchObjectCap cap -> cap -> ---> let cap = \x
in case cap of Zombie \v0\ \v1\ \v2\ \<Rightarrow> ->1 | UntypedCap \v0\ \v1\ \<Rightarrow> ->2 | ArchObjectCap cap \<Rightarrow> ->3 | _ \<Rightarrow> ->4
case \x of 0 -> 1 -> 2 -> 3 -> 4 -> 5 -> 6 -> 7 -> _ -> ---> let \v0\ = \x
in if \v0\ = 0 then ->1 else if \v0\ = 1 then ->2 else if \v0\ = 2 then ->3 else if \v0\ = 3 then ->4 else if \v0\ = 4 then ->5 else if \v0\ = 5 then ->6 else if \v0\ = 6 then ->7 else if \v0\ = 7 then ->8 else ->9
case \x of MI { msgExtraCaps = 0 } -> MI { msgExtraCaps = count } -> ---> let \v0\ = \x
in if msgExtraCaps \v0\ = 0 then ->1 else let count = msgExtraCaps \v0\ in ->2
case \x of c@PageTableCap { capPTMappedAddress = Just _ } -> PageTableCap { capPTMappedAddress = Nothing } -> c@PageDirectoryCap { capPDMappedASID = Just _ } -> PageDirectoryCap { capPDMappedASID = Nothing } -> c@PageCap {} -> c@ASIDControlCap -> c@ASIDPoolCap {} -> ---> let c = \x
in case c of
PageTableCap \v0\ \v1\ \<Rightarrow> if \v1\ = None then ->2 else ->1
| PageDirectoryCap \v0\ \v1\ \<Rightarrow> if \v1\ = None then ->4 else ->3
| PageCap \v0\ \v1\ \v2\ \v3\ \<Rightarrow> ->5
| ASIDControlCap \<Rightarrow> ->6
| ASIDPoolCap \v0\ \v1\ \<Rightarrow> ->7
case \x of c@(PageCap {}) -> c -> ---> let c = \x in
if isPageCap c
then ->1
else ->2
case \x of (a@PageCap {}, b@PageCap {}) -> (a@PageTableCap {}, b@PageTableCap {}) -> (a@PageDirectoryCap {}, b@PageDirectoryCap {}) -> (ASIDControlCap, ASIDControlCap) -> (a@ASIDPoolCap {}, b@ASIDPoolCap {}) -> (_, _) -> ---> let (a, b) = \x in
if (isPageCap a & isPageCap b) then ->1 else if (isPageTableCap a & isPageTableCap b) then ->2 else if (isPageDirectoryCap a & isPageDirectoryCap b) then ->3 else if (isASIDControlCap a & isASIDControlCap b) then ->4 else if (isASIDPoolCap a & isASIDPoolCap b) then ->5 else ->6
case \x of Arch.Types.APIObjectType _ -> Arch.Types.SmallPageObject -> Arch.Types.LargePageObject -> Arch.Types.SectionObject -> Arch.Types.SuperSectionObject -> Arch.Types.PageTableObject -> Arch.Types.PageDirectoryObject -> ---> case \x of
Arch.Types.APIObjectType \v0\ \<Rightarrow> ->1 | Arch.Types.SmallPageObject \<Rightarrow> ->2 | Arch.Types.LargePageObject \<Rightarrow> ->3 | Arch.Types.SectionObject \<Rightarrow> ->4 | Arch.Types.SuperSectionObject \<Rightarrow> ->5 | Arch.Types.PageTableObject \<Rightarrow> ->6 | Arch.Types.PageDirectoryObject \<Rightarrow> ->7
case \x of (srcIndex:srcDepth:args, srcRootCap:_) | label < 4 -> (_, _) | label == 4 -> (_, _) | label == 5 -> (_, _) | label == 6 -> (pivotNewData:pivotIndex:pivotDepth:srcNewData:srcIndex:srcDepth:_, pivotRootCap:srcRootCap:_) | label == 7 -> (_, _) | label > 7 -> _ -> ---> let (\v0\, \v1\) = \x
in if length \v0\ >= 2 & length \v1\ >= 1 & label < 4 then let srcIndex = \v0\ !! 0; srcDepth = \v0\ !! 1; args = drop 2 \v0\; srcRootCap = \v1\ !! 0 in ->1 else if label = 4 then ->2 else if label = 5 then ->3 else if label = 6 then ->4 else if length \v0\ >= 6 & length \v1\ >= 2 & label = 7 then let pivotNewData = \v0\ !! 0; pivotIndex = \v0\ !! 1; pivotDepth = \v0\ !! 2; srcNewData = \v0\ !! 3; srcIndex = \v0\ !! 4; srcDepth = \v0\ !! 5; pivotRootCap = \v1\ !! 0; srcRootCap = \v1\ !! 1 in ->5 else if label > 7 then ->6 else ->7
case \x of IdleEP | blocking -> SendEP queue | blocking -> IdleEP -> SendEP _ -> RecvEP (dest:queue) -> RecvEP [] -> ---> case \x of
IdleEP \<Rightarrow> if blocking then ->1 else ->3 | SendEP queue \<Rightarrow> if blocking then ->2 else ->4 | RecvEP \v0\ \<Rightarrow> (case \v0\ of dest # queue \<Rightarrow> ->5 | [] \<Rightarrow> ->6 )
case \x of Zombie {} -> cap@(UntypedCap {}) -> ReplyCap {} -> ArchObjectCap cap -> cap -> ---> let cap = \x
in case cap of
Zombie \v0\ \v1\ \v2\ \<Rightarrow> ->1
| UntypedCap \v0\ \v1\ \<Rightarrow> ->2
| ReplyCap \v0\ \v1\ \<Rightarrow> ->3
| ArchObjectCap cap \<Rightarrow> ->4
| _ \<Rightarrow> ->5
case \x of (EndpointCap { capEPPtr = ptr }, True, _) -> (NotificationCap { capNtfnPtr = ptr }, True, _) -> (cap@(CNodeCap {}), True, exposed) -> (ThreadCap { capTCBPtr = tcb }, True, exposed) -> (Zombie { capCTEPtr = ptr, capNumber = n+1 }, True, False) -> (z@(Zombie { capCTEPtr = ptr, capNumber = n+1 }), True, True) -> (Zombie { capNumber = 0 }, True, _) -> (IRQHandlerCap { capIRQ = irq }, True, _) -> (ArchObjectCap { capCap = cap }, final, exposed) -> (NullCap, _, _) -> (Zombie {}, False, _) -> (_, _, _) -> ---> let (\v0\, \v1\, \v2\) = \x in
if isEndpointCap \v0\ \<and> \v1\
then let ptr = capEPPtr \v0
in ->1
else if isNotificationCap \v0\ \<and> \v1\
then let ptr = capNtfnPtr \v0
in ->2
else if isCNodeCap \v0\ \<and> \v1\
then let cap = \v0\; exposed = \v2\ in ->3
else if isThreadCap \v0\ \<and> \v1\
then let tcb = capTCBPtr \v0\; exposed = \v2\ in ->4
else if isZombie \v0\ \<and> \v1\ \<and> (\<not> \v2\) \<and> capNumber \v0\ \<noteq> 0
then let ptr = capCTEPtr \v0\;
n = capNumber \v0\ - 1
in ->5
else if isZombie \v0\ \<and> \v1\ \<and> \v2\ \<and> capNumber \v0\ \<noteq> 0
then let z = \v0\;
ptr = capCTEPtr \v0\;
n = capNumber \v0\ - 1;
c = \v0\
in ->6
else if isZombie \v0\ \<and> \v1\ \<and> capNumber \v0\ = 0
then ->7
else if isIRQHandlerCap \v0\ \<and> \v1\
then let irq = capIRQ \v0\ in ->8
else if isArchObjectCap \v0\
then let (cap, final, exposed) = (capCap \v0\, \v1\, \v2\) in ->9
else if isNullCap \v0\
then ->10
else if isZombie \v0\ \<and> (\<not> \v1\)
then ->11
else ->12
case \x of (_, NullCap) -> (a@(UntypedCap {}), b) -> (a@EndpointCap {}, b@EndpointCap {}) -> (a@NotificationCap {}, b@NotificationCap {}) -> (a@CNodeCap {}, b@CNodeCap {}) -> (a@ThreadCap {}, b@ThreadCap {}) -> (IRQControlCap, IRQControlCap) -> (IRQHandlerCap a, IRQHandlerCap b) -> (ArchObjectCap a, ArchObjectCap b) -> (_, _) -> --->let (a,b) = \x in
if b = NullCap
then ->1
else if isUntypedCap a
then ->2
else if isEndpointCap a & isEndpointCap b
then ->3
else if isNotificationCap a & isNotificationCap b
then ->4
else if isCNodeCap a & isCNodeCap b
then ->5
else if isThreadCap a & isThreadCap b
then ->6
else if a = IRQControlCap & b = IRQControlCap
then ->7
else if isIRQHandlerCap a & isIRQHandlerCap b
then let a = capIRQ a; b = capIRQ b in ->8
else if isArchObjectCap a & isArchObjectCap b
then let a = capCap a; b = capCap b in
->9
else ->10
case \x of (preserve, new, cap@(EndpointCap {})) -> (preserve, new, cap@(NotificationCap {})) -> (_, w, cap@(CNodeCap {})) -> (p, w, ArchObjectCap { capCap = aoCap }) -> (_, _, cap) -> --->let (\v0\, \v1\, \v2\ ) = \x in
if isEndpointCap \v2\
then let preserve = \v0\; new = \v1\; cap = \v2\ in ->1
else if isNotificationCap \v2\
then let preserve = \v0\; new = \v1\; cap = \v2\ in ->2
else if isCNodeCap \v2\
then let w = \v1\; cap = \v2\ in ->3
else if isArchObjectCap \v2\
then let p = \v0\; w = \v1\; aoCap = capCap \v2\ in ->4
else let cap = \v2\ in ->5
case \x of NullCap -> c@(UntypedCap {}) -> c@(EndpointCap {}) -> c@(NotificationCap {}) -> c@(ReplyCap {}) -> c@(CNodeCap {}) -> c@(ThreadCap {}) -> c@IRQControlCap -> c@(IRQHandlerCap {}) -> ArchObjectCap {capCap = aoCap} -> c@(Zombie {}) -> --->let c = \x in
if isNullCap c then ->1
else if isUntypedCap c then ->2
else if isEndpointCap c then ->3
else if isNotificationCap c then ->4
else if isReplyCap c then ->5
else if isCNodeCap c then ->6
else if isThreadCap c then ->7
else if isIRQControlCap c then ->8
else if isIRQHandlerCap c then ->9
else if isArchObjectCap c then let aoCap = capCap c in ->10
else (* assuming Zombie *) ->11
case \x of 0 -> 1 -> 2 -> 3 -> 4 -> 5 -> 6 -> 7 -> 8 -> 9 -> _ -> --->let \v0\ = \x
in if \v0\ = 0 then ->1 else if \v0\ = 1 then ->2 else if \v0\ = 2 then ->3 else if \v0\ = 3 then ->4 else if \v0\ = 4 then ->5 else if \v0\ = 5 then ->6 else if \v0\ = 6 then ->7 else if \v0\ = 7 then ->8 else if \v0\ = 8 then ->9 else if \v0\ = 9 then ->10 else ->11
case \x of ArchObjectCap (pageCap@PageCap {}) -> _ -> ---> let \v0\ = \x in
if isArchObjectCap \v0\ \<and> isPageCap (capCap \v0\)
then
let pageCap = capCap \v0\
in ->1
else ->2
case \x of ArchObjectCap (frameCap@PageCap {}) -> _ -> ---> let \v0\ = \x in
if isArchObjectCap \v0\ \<and> isPageCap (capCap \v0\)
then
let frameCap = capCap \v0\
in ->1
else ->2
case \x of ((Zombie { capCTEPtr = ptr, capNumber = n+1 }), False) -> (z@(Zombie { capCTEPtr = ptr, capNumber = n+1 }), True) -> (_, _) -> ---> let (\v0\, \v1\) = \x in
if isZombie \v0\ \<and> (\<not> \v1\) \<and> capNumber \v0\ \<noteq> 0
then let ptr = capCTEPtr \v0\;
n = capNumber \v0\ - 1
in ->1
else if isZombie \v0\ \<and> \v1\ \<and> capNumber \v0\ \<noteq> 0
then let z = \v0\;
ptr = capCTEPtr \v0\;
n = capNumber \v0\ - 1
in ->2
else ->3
case \x of (c@PageTableCap { capPTMappedAddress = Just _ }) -> (PageTableCap { capPTMappedAddress = Nothing }) -> (c@PageDirectoryCap { capPDMappedASID = Just _ }) -> (PageDirectoryCap { capPDMappedASID = Nothing }) -> (c@PageCap {}) -> c@ASIDControlCap -> (c@ASIDPoolCap {}) -> ---> let c = \x in
if isPageTableCap c \<and> capPTMappedAddress c \<noteq> None
then ->1
else if isPageTableCap c \<and> capPTMappedAddress c = None
then ->2
else if isPageDirectoryCap c \<and> capPDMappedASID c \<noteq> None
then ->3
else if isPageDirectoryCap c \<and> capPDMappedASID c = None
then ->4
else if isPageCap c
then ->5
else if isASIDControlCap c
then ->6
else if isASIDPoolCap c
then ->7
else undefined
case \x of ((a@PageCap {}), (b@PageCap {})) -> ((a@PageTableCap {}), (b@PageTableCap {})) -> ((a@PageDirectoryCap {}), (b@PageDirectoryCap {})) -> (ASIDControlCap, ASIDControlCap) -> ((a@ASIDPoolCap {}), (b@ASIDPoolCap {})) -> (_, _) -> ---> let (a, b) = \x in
if isPageCap a \<and> isPageCap b
then ->1
else if isPageTableCap a \<and> isPageTableCap b
then ->2
else if isPageDirectoryCap a \<and> isPageDirectoryCap b
then ->3
else if isASIDControlCap a \<and> isASIDControlCap b
then ->4
else if isASIDPoolCap a \<and> isASIDPoolCap b
then ->5
else ->6
case \x of ArchObjectCap (frame@PageCap {}) -> _ -> ---> let \v0\ = \x in
if isArchObjectCap \v0\ \<and> isPageCap (capCap \v0\)
then let frame = capCap \v0\
in ->1
else ->2
case \x of ArchObjectCap (PageDirectoryCap { capPDMappedASID = Just _, capPDBasePtr = cur_pd }) | cur_pd == pd -> _ -> ---> let \v0\ = \x in
if isArchObjectCap \v0\ \<and> isPageDirectoryCap (capCap \v0\) \<and> capPDMappedASID (capCap \v0\) \<noteq> None \<and> capPDBasePtr (capCap \v0\) = pd
then let cur_pd = pd in ->1
else ->2
case \x of (0, vaddr:attr:_, (pdCap,_):_) -> (0, _, _) -> _ -> ---> let (\v0\, \v1\, \v2\) = \x in
if \v0\ = 0 then
if length \v1\ > 1 \<and> length \v2\ > 0
then let vaddr = \v1\ !! 0;
attr = \v1\ !! 1;
pdCap = fst (\v2\ !! 0)
in ->1
else ->2
else ->3
case \x of (0, vaddr:rightsMask:attr:_, (pdCap,_):_) -> (0, _, _) -> (1, rightsMask:attr:_, _) -> (1, _, _) -> (2, _, _) -> (3, _, _) -> _ -> ---> let (\v0\, \v1\, \v2\) = \x in
if \v0\ = 0 then
if length \v1\ > 2 \<and> length \v2\ > 0
then let vaddr = \v1\ !! 0;
rightsMask = \v1\ !! 1;
attr = \v1\ !! 2;
pdCap = fst (\v2\ !! 0)
in ->1
else ->2
else if \v0\ = 1 then
if length \v1\ > 1
then let rightsMask = \v1\ !! 0;
attr = \v1\ !! 1
in ->3
else ->4
else if \v0\ = 2
then ->5
else if \v0\ = 3
then ->6
else ->7
case \x of (0, index:depth:_, (untyped,parentSlot):(croot,_):_) -> (0, _, _) -> _ -> ---> let (\v0\, \v1\, \v2\) = \x in
if \v0\ = 0 then
if length \v1\ > 1 \<and> length \v2\ > 1
then let index = \v1\ !! 0;
depth = \v1\ !! 1;
(untyped, parentSlot) = \v2\ !! 0;
croot = fst (\v2\ !! 1)
in ->1
else ->2
else ->3
case \x of (0, (pdCap,pdCapSlot):_) -> (0, _) -> _ -> ---> let (\v0\, \v1\) = \x in
if \v0\ = 0 then
if length \v1\ > 0
then let (pdCap, pdCapSlot) = \v1\ !! 0
in ->1
else ->2
else ->3
case \x of (PageDirectoryCap {}) -> cap@(PageTableCap {}) -> cap@(PageCap {}) -> ASIDControlCap -> cap@(ASIDPoolCap {}) -> ---> let cap = \x in
if isPageDirectoryCap cap
then ->1
else if isPageTableCap cap
then ->2
else if isPageCap cap
then ->3
else if isASIDControlCap cap
then ->4
else if isASIDPoolCap cap
then ->5
else undefined
case \x of ((index:bits:args), cap@(CNodeCap {capCNodeCanModify=True})) -> (_, (CNodeCap {capCNodeCanModify=True})) -> (_, _) -> ---> let (\v0\, cap) = \x in
if isCNodeCap cap \<and> capCNodeCanModify cap
then
(case \v0\ of
(index # bits # args) \<Rightarrow> ->1
| _ \<Rightarrow> ->2
)
else ->3
case \x of ((src@EndpointCap {}), (new@EndpointCap {})) -> ((src@NotificationCap {}), (new@NotificationCap {})) -> (_, _) -> ---> let (src, new) = \x in
if isEndpointCap src \<and> isEndpointCap new
then ->1
else if isNotificationCap src \<and> isNotificationCap new
then ->2
else ->3
case \x of (CTE { cteCap = UntypedCap {} }) -> cte@(CTE { cteMDBNode = mdb }) -> ---> let \v0\ = \x in
if isUntypedCap (cteCap \v0\)
then ->1
else let cte = \v0\;
mdb = cteMDBNode cte
in ->2
case \x of 0 | length msg >= length syscallMessage -> _ -> ---> if \x = 0 \<and> length msg \<ge> length syscallMessage
then ->1
else ->2
case \x of 0 | length msg >= length exceptionMessage -> _ -> ---> if \x = 0 \<and> length msg \<ge> length exceptionMessage
then ->1
else ->2
case \x of (0,irqW:index:depth:_,cnode:_) -> (0,_,_) -> (1,_,_) -> _ -> ---> let (\v0\, \v1\, \v2\) = \x in
if \v0\ = 0 then
if length \v1\ > 2 \<and> length \v2\ > 0
then let irqW = \v1\ !! 0;
index = \v1\ !! 1;
depth = \v1\ !! 2;
cnode = \v2\ !! 0
in ->1
else ->2
else if \v0\ = 1
then ->3
else ->4
case \x of (0,_) -> (1,(cap,slot):_) -> (1,_) -> (2,_) -> _ -> ---> let (\v0\, \v1\) = \x in
if \v0\ = 0
then ->1
else if \v0\ = 1
then if length \v1\ > 0
then let (cap, slot) = \v1\ !! 0
in ->2
else ->3
else if \v0\ = 2
then ->4
else ->5
case \x of (Zombie {}) -> cap@(UntypedCap {}) -> (ReplyCap {}) -> (ArchObjectCap cap) -> cap -> ---> let cap = \x in
if isZombie cap
then ->1
else if isUntypedCap cap
then ->2
else if isReplyCap cap
then ->3
else if isArchObjectCap cap
then let cap = capCap cap
in ->4
else ->5
case \x of ((EndpointCap { capEPPtr = ptr }), True) -> ((NotificationCap { capNtfnPtr = ptr }), True) -> ((CNodeCap { capCNodePtr = ptr, capCNodeBits = bits }), True) -> ((ThreadCap { capTCBPtr = tcb}), True) -> (z@(Zombie {}), True) -> ((ArchObjectCap { capCap = cap }), final) -> ((IRQHandlerCap { capIRQ = irq }), True) -> (NullCap, _) -> ((Zombie {}), False) -> (_, _) -> ---> let (\v0\, \v1\) = \x in
if isEndpointCap \v0\ \<and> \v1\
then let ptr = capEPPtr \v0\
in ->1
else if isNotificationCap \v0\ \<and> \v1\
then let ptr = capNtfnPtr \v0\
in ->2
else if isCNodeCap \v0\ \<and> \v1\
then let ptr = capCNodePtr \v0\; bits = capCNodeBits \v0\
in ->3
else if isThreadCap \v0\ \<and> \v1\
then let tcb = capTCBPtr \v0\
in ->4
else if isZombie \v0\ \<and> \v1\
then let z = \v0\
in ->5
else if isArchObjectCap \v0\
then let cap = capCap \v0\; final = \v1\
in ->6
else if isIRQHandlerCap \v0\ \<and> \v1\
then let irq = capIRQ \v0\
in ->7
else if isNullCap \v0\
then ->8
else if isZombie \v0\ \<and> \<not> \v1\
then ->9
else ->10
case \x of (_, NullCap) -> (a@(UntypedCap {}), b) -> ((a@EndpointCap {}), (b@EndpointCap {})) -> ((a@NotificationCap {}), (b@NotificationCap {})) -> ((a@CNodeCap {}), (b@CNodeCap {})) -> ((a@ThreadCap {}), (b@ThreadCap {})) -> (IRQControlCap, IRQControlCap) -> ((IRQHandlerCap a), (IRQHandlerCap b)) -> ((ArchObjectCap a), (ArchObjectCap b)) -> (_, _) -> ---> let (a, b) = \x in
if isNullCap b
then ->1
else if isUntypedCap a
then ->2
else if isEndpointCap a \<and> isEndpointCap b
then ->3
else if isNotificationCap a \<and> isNotificationCap b
then ->4
else if isCNodeCap a \<and> isCNodeCap b
then ->5
else if isThreadCap a \<and> isThreadCap b
then ->6
else if isIRQControlCap a \<and> isIRQControlCap b
then ->7
else if isIRQHandlerCap a \<and> isIRQHandlerCap b
then (case (a, b) of
(IRQHandlerCap a, IRQHandlerCap b) \<Rightarrow> ->8
)
else if isArchObjectCap a \<and> isArchObjectCap b
then (case (a, b) of
(ArchObjectCap a, ArchObjectCap b) \<Rightarrow> ->9
)
else ->10
case \x of (preserve, new, cap@(EndpointCap {})) -> (preserve, new, cap@(NotificationCap {})) -> (_, w, cap@(CNodeCap {})) -> (p, w, (ArchObjectCap { capCap = aoCap })) -> (_, _, cap) -> ---> let (\v0\, \v1\, \v2\) = \x in
if isEndpointCap \v2\
then let preserve = \v0\; new = \v1\; cap = \v2\
in ->1
else if isNotificationCap \v2\
then let preserve = \v0\; new = \v1\; cap = \v2\
in ->2
else if isCNodeCap \v2\
then let w = \v1\; cap = \v2\
in ->3
else if isArchObjectCap \v2\
then let p = \v0\; w = \v1\; aoCap = capCap \v2\
in ->4
else let cap = \v2\
in ->5
case \x of NullCap -> c@(UntypedCap {}) -> c@(EndpointCap {}) -> c@(NotificationCap {}) -> c@(ReplyCap {}) -> c@(CNodeCap {}) -> c@(ThreadCap {}) -> c@IRQControlCap -> c@(IRQHandlerCap {}) -> (ArchObjectCap {capCap = aoCap}) -> c@(Zombie {}) -> ---> let c = \x; aoCap = capCap \x in
if isNullCap c
then ->1
else if isUntypedCap c
then ->2
else if isEndpointCap c
then ->3
else if isNotificationCap c
then ->4
else if isReplyCap c
then ->5
else if isCNodeCap c
then ->6
else if isThreadCap c
then ->7
else if isIRQControlCap c
then ->8
else if isIRQHandlerCap c
then ->9
else if isArchObjectCap c
then ->10
else if isZombie c
then ->11
else undefined
case \x of cap@(EndpointCap {capEPCanSend=True}) -> cap@(NotificationCap {capNtfnCanSend=True}) -> cap@(ReplyCap {capReplyMaster=False}) -> cap@(ThreadCap {capTCBCanWrite=True}) -> cap@(CNodeCap {capCNodeCanModify=True}) -> cap@(UntypedCap {}) -> IRQControlCap -> (IRQHandlerCap { capIRQ = irq }) -> (ArchObjectCap cap) -> _ -> ---> let cap = \x in
if isEndpointCap cap \<and> capEPCanSend cap
then ->1
else if isNotificationCap cap \<and> capNtfnCanSend cap
then ->2
else if isReplyCap cap \<and> \<not> capReplyMaster cap
then ->3
else if isThreadCap cap \<and> capTCBCanWrite cap
then ->4
else if isCNodeCap cap \<and> capCNodeCanModify cap
then ->5
else if isUntypedCap cap
then ->6
else if isIRQControlCap cap
then ->7
else if isIRQHandlerCap cap
then let irq = capIRQ cap
in ->8
else if isArchObjectCap cap
then let cap = capCap cap
in ->9
else ->10
case \x of (EndpointCap { capEPPtr = p1 }, Just p2, _) | p1 == p2 -> (_, _, destSlot:slots') -> _ -> ---> let (\v0\, \v1\, \v2\) = \x in
if isEndpointCap \v0\ \<and> \v1\ \<noteq> None \<and> capEPPtr \v0\ = the \v1\
then let p1 = capEPPtr \v0\; p2 = p1
in ->1
else (case \v2\ of
destSlot # slots' \<Rightarrow> ->2
| _ \<Rightarrow> ->3
)
case \x of ((EndpointCap { capEPPtr = ptr }), final, _) -> ((NotificationCap { capNtfnPtr = ptr }), final, _) -> ((ReplyCap {}), _, _) -> (_, _, True) -> ((CNodeCap { capCNodePtr = ptr, capCNodeBits = bits }), True, _) -> ((ThreadCap { capTCBPtr = tcb}), True, _) -> (z@(Zombie {}), True, _) -> ((ArchObjectCap { capCap = cap }), final, _) -> ((IRQHandlerCap { capIRQ = irq }), True, _) -> (NullCap, _, _) -> ((Zombie {}), False, _) -> (_, _, _) -> ---> let (\v0\, \v1\, \v2\) = \x in
if isEndpointCap \v0\
then let ptr = capEPPtr \v0\; final = \v1\
in ->1
else if isNotificationCap \v0\
then let ptr = capNtfnPtr \v0\; final = \v1\
in ->2
else if isReplyCap \v0\
then ->3
else if \v2\
then ->4
else if isCNodeCap \v0\ \<and> \v1\
then let ptr = capCNodePtr \v0\; bits = capCNodeBits \v0\
in ->5
else if isThreadCap \v0\ \<and> \v1\
then let tcb = capTCBPtr \v0\
in ->6
else if isZombie \v0\ \<and> \v1\
then let z = \v0\
in ->7
else if isArchObjectCap \v0\
then let cap = capCap \v0\; final = \v1\
in ->8
else if isIRQHandlerCap \v0\ \<and> \v1\
then let irq = capIRQ \v0\
in ->9
else if isNullCap \v0\
then ->10
else if isZombie \v0\ \<and> \<not> \v1\
then ->11
else ->12
case \x of (cap@PageCap { capVPIsDevice = isDevice }) -> (cap@PageTableCap { capPTBasePtr = ptr }) -> (cap@PageDirectoryCap { capPDBasePtr = ptr }) -> ASIDControlCap -> (cap@ASIDPoolCap { capASIDBase = base, capASIDPool = ptr }) -> ---> let cap = \x in
if isPageCap cap
then let isDevice = capVPIsDevice cap
in ->1
else if isPageTableCap cap
then let ptr = capPTBasePtr cap
in ->2
else if isPageDirectoryCap cap
then let ptr = capPDBasePtr cap
in ->3
else if isASIDControlCap cap
then ->4
else if isASIDPoolCap cap
then let base = capASIDBase cap; ptr = capASIDPool cap
in ->5
else undefined
case \x of ArchObjectCap (frame@PageCap {capVPIsDevice = False}) -> _ -> ---> let cap = \x in
if isPageCap cap \<and> \<not> capVPIsDevice cap
then ->1
else ->2
case \x of (srcIndex:srcDepth:args, srcRootCap:_) | label < 4 -> (_, _) | label == 4 -> (_, _) | label == 5 -> (_, _) | label == 6 -> (_, _) | label == 7 -> (pivotNewData:pivotIndex:pivotDepth:srcNewData:srcIndex:srcDepth:_, pivotRootCap:srcRootCap:_) | label == 8 -> (_, _) | label > 8 -> _ -> ---> let (\v0\, \v1\) = \x in
case (if label < 4 then 1
else if label = 4 then 2
else if label = 5 then 3
else if label = 6 then 4
else if label = 7 then 5
else if label = 8 then 6
else if label > 8 then 7 else 0, \v0\, \v1\) of
(Suc 0, srcIndex # srcDepth # args, srcRootCap # _)
\<Rightarrow> ->1
| (Suc (Suc 0), _, _)
\<Rightarrow> ->2
| (Suc (Suc (Suc 0)), _, _)
\<Rightarrow> ->3
| (Suc (Suc (Suc (Suc 0))), _, _)
\<Rightarrow> ->4
| (Suc (Suc (Suc (Suc (Suc 0)))), _, _)
\<Rightarrow> ->5
| (Suc (Suc (Suc (Suc (Suc (Suc 0))))),
pivotNewData#pivotIndex#pivotDepth#srcNewData#srcIndex#srcDepth#_,
pivotRootCap#srcRootCap#_)
\<Rightarrow> ->6
| (Suc (Suc (Suc (Suc (Suc (Suc (Suc 0)))))), _, _)
\<Rightarrow> ->7
| _ \<Rightarrow> ->8
case \x of c2@(Zombie { capZombiePtr = ptr2 }) -> _ -> ---> let \v0\ = \x in
if isZombie \v0\
then let c2 = \v0\; ptr2 = capZombiePtr c2
in ->1
else ->2
case \x of ((Zombie { capZombieNumber = 0 }), _) -> ((Zombie { capZombiePtr = ptr }), False) -> (z@(Zombie { capZombiePtr = ptr, capZombieNumber = n+1 }), True) -> (_, _) -> ---> let (\v0\, \v1\) = \x in
if isZombie \v0\ \<and> capZombieNumber \v0\ = 0
then ->1
else if isZombie \v0\ \<and> \<not> \v1\
then let ptr = capZombiePtr \v0\
in ->2
else if isZombie \v0\ \<and> \v1\
then let z = \v0\; ptr = capZombiePtr z; n = capZombieNumber z - 1
in ->3
else ->4
case \x of NullCap -> (CNodeCap {}) -> (ThreadCap {}) -> (Zombie { capZombiePtr = ptr, capZombieType = tp, capZombieNumber = n}) -> (cap@EndpointCap { capEPPtr = ep, capEPBadge = b }) -> (ArchObjectCap cap) -> cap -> ---> let cap = \x in
if isNullCap cap
then ->1
else if isCNodeCap cap
then ->2
else if isThreadCap cap
then ->3
else if isZombie cap
then let ptr = capZombiePtr cap; tp = capZombieType cap;
n = capZombieNumber cap
in ->4
else if isEndpointCap cap
then let ep = capEPPtr cap; b = capEPBadge cap
in ->5
else if isArchObjectCap cap
then let cap = capCap cap
in ->6
else ->7
case \x of (_, NullCap) -> (a@(UntypedCap {}), b) -> ((a@EndpointCap {}), (b@EndpointCap {})) -> ((a@NotificationCap {}), (b@NotificationCap {})) -> ((a@CNodeCap {}), (b@CNodeCap {})) -> ((a@ThreadCap {}), (b@ThreadCap {})) -> (IRQControlCap, IRQControlCap) -> (IRQControlCap, (IRQHandlerCap {})) -> ((IRQHandlerCap a), (IRQHandlerCap b)) -> ((ArchObjectCap a), (ArchObjectCap b)) -> (_, _) -> ---> let (a, b) = \x in
if isNullCap b
then ->1
else if isUntypedCap a
then ->2
else if isEndpointCap a \<and> isEndpointCap b
then ->3
else if isNotificationCap a \<and> isNotificationCap b
then ->4
else if isCNodeCap a \<and> isCNodeCap b
then ->5
else if isThreadCap a \<and> isThreadCap b
then ->6
else if isIRQControlCap a \<and> isIRQControlCap b
then ->7
else if isIRQControlCap a \<and> isIRQHandlerCap b
then ->8
else if isIRQHandlerCap a \<and> isIRQHandlerCap b
then (case (a, b) of
(IRQHandlerCap a, IRQHandlerCap b) \<Rightarrow> ->9
)
else if isArchObjectCap a \<and> isArchObjectCap b
then (case (a, b) of
(ArchObjectCap a, ArchObjectCap b) \<Rightarrow> ->10
)
else ->11
case \x of (a@(UntypedCap {}), b) -> ((a@EndpointCap {}), (b@EndpointCap {})) -> ((a@NotificationCap {}), (b@NotificationCap {})) -> ((a@CNodeCap {}), (b@CNodeCap {})) -> ((a@ThreadCap {}), (b@ThreadCap {})) -> ((a@ReplyCap {}), (b@ReplyCap {})) -> (IRQControlCap, IRQControlCap) -> (IRQControlCap, (IRQHandlerCap {})) -> ((IRQHandlerCap a), (IRQHandlerCap b)) -> ((ArchObjectCap a), (ArchObjectCap b)) -> (_, _) -> ---> let (a, b) = \x in
if isUntypedCap a
then ->1
else if isEndpointCap a \<and> isEndpointCap b
then ->2
else if isNotificationCap a \<and> isNotificationCap b
then ->3
else if isCNodeCap a \<and> isCNodeCap b
then ->4