-
Notifications
You must be signed in to change notification settings - Fork 2
/
Spec.v
2344 lines (2094 loc) · 95.1 KB
/
Spec.v
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
Require Import SpecDeps.
Require Import RData.
Require Import EventReplay.
Require Import MoverTypes.
Require Import Constants.
Require Import CommonLib.
Local Open Scope Z_scope.
Section Spec.
Definition assert_cond_spec (b: Z) (adt: RData) : option RData :=
if b =? 0 then None else Some adt.
Definition null_ptr_spec (adt: RData) : option Pointer :=
Some NULL.
Definition is_null_spec (ptr: Pointer) (adt: RData) : option Z :=
if ptr_eq ptr NULL then Some 1 else Some 0.
Definition ptr_eq_spec (p1: Pointer) (p2: Pointer) (adt: RData) : option Z :=
if ptr_eq p1 p2 then Some 1 else Some 0.
Definition ptr_is_err_spec (ptr: Pointer) (adt: RData) : option Z :=
if peq (fst ptr) error_loc then
Some 1
else
Some 0.
Definition shiftl_spec (a: Z64) (s: Z64) (adt: RData) : option Z64 :=
match a, s with
| VZ64 a, VZ64 s =>
rely is_int64 (Z.shiftl a s);
Some (VZ64 (Z.shiftl a s))
end.
Definition granule_lock_spec (g: Pointer) (adt: RData) : option RData :=
let gidx := offset g in
rely (peq (base g) ginfo_loc);
rely is_gidx gidx;
when adt == query_oracle adt;
let gn := (gs (share adt)) @ gidx in
rely prop_dec (glock gn = None);
let e := EVT CPU_ID (ACQ gidx) in
Some adt {log: e :: (log adt)} {share: (share adt) {gs: (gs (share adt)) # gidx == (gn {glock: Some CPU_ID})}}.
Definition granule_unlock_spec (g: Pointer) (adt: RData) : option RData :=
let gidx := offset g in
rely (peq (base g) ginfo_loc);
rely is_gidx gidx;
let gn := (gs (share adt)) @ gidx in
rely prop_dec (glock gn = Some CPU_ID);
let e := EVT CPU_ID (REL gidx gn) in
Some adt {log: e :: (log adt)} {share: (share adt) {gs: (gs (share adt)) # gidx == (gn {glock: None} {gtype: (g_tag (ginfo gn))})}}.
Definition granule_addr_spec (g: Pointer) (adt: RData) : option Z64 :=
let gidx := offset g in
rely (peq (base g) ginfo_loc);
rely is_gidx gidx;
Some (VZ64 (__gidx_to_addr gidx)).
Definition addr_to_granule_spec (addr: Z64) (adt: RData) : option Pointer :=
match addr with
| VZ64 addr =>
rely (GRANULE_ALIGNED addr);
let gidx := __addr_to_gidx addr in
rely is_gidx gidx;
Some (ginfo_loc, gidx)
end.
Definition find_granule_spec (addr: Z64) (adt: RData) : option Pointer :=
match addr with
| VZ64 addr =>
if GRANULE_ALIGNED addr then
let gidx := __addr_to_gidx addr in
if is_gidx gidx then
Some (ginfo_loc, gidx)
else
Some NULL
else
Some NULL
end.
Definition find_lock_granule_spec (addr: Z64) (expected_state: Z64) (adt: RData) : option (RData * Pointer) :=
match addr, expected_state with
| VZ64 addr, VZ64 expected_state =>
let gidx := __addr_to_gidx addr in
match GRANULE_ALIGNED addr, is_gidx gidx with
| true, true =>
when adt == query_oracle adt;
let gn := (gs (share adt)) @ gidx in
rely prop_dec (glock gn = None);
if g_tag (ginfo gn) =? expected_state then
let e := EVT CPU_ID (ACQ gidx) in
let st' := (share adt) {gs: (gs (share adt)) # gidx == (gn {glock: Some CPU_ID})} in
Some (adt {log: e :: (log adt)} {share: st'}, (ginfo_loc, gidx))
else
let e := EVT CPU_ID (ACQ gidx) in
let e' := EVT CPU_ID (REL gidx (gn {glock: Some CPU_ID})) in
let st' := (share adt) {gs: (gs (share adt)) # gidx == gn} in
Some (adt {log: e' :: e :: (log adt)} {share: st'}, NULL)
| _, _ => Some (adt, NULL)
end
end.
Definition find_lock_unused_granule_spec (addr: Z64) (expected_state: Z64) (adt: RData) : option (RData * Pointer) :=
match addr, expected_state with
| VZ64 addr, VZ64 expected_state =>
let gidx := __addr_to_gidx addr in
match GRANULE_ALIGNED addr, is_gidx gidx with
| true, true =>
let lo := oracle adt (log adt) in
when st == repl adt lo (share adt);
let gn := (gs st) @ gidx in
rely prop_dec (glock gn = None);
match g_tag (ginfo gn) =? expected_state, gcnt gn =? 0 with
| true, true =>
let e := EVT CPU_ID (ACQ gidx) in
let st' := st {gs: (gs st) # gidx == (gn {glock: Some CPU_ID})} in
Some (adt {log: e :: lo ++ (log adt)} {share: st'}, (ginfo_loc, gidx))
| _, _ =>
let e := EVT CPU_ID (ACQ gidx) in
let e' := EVT CPU_ID (REL gidx (gn {glock: Some CPU_ID})) in
let st' := st {gs: (gs st) # gidx == gn} in
Some (adt {log: e' :: e :: lo ++ (log adt)} {share: st'}, NULL)
end
| _, _ => Some (adt, NULL)
end
end.
Definition find_lock_three_delegated_granules_spec (addr1: Z64) (addr2: Z64) (addr3: Z64) (adt: RData) : option (RData * Z) :=
match addr1, addr2, addr3 with
| VZ64 addr1, VZ64 addr2, VZ64 addr3 =>
if (negb (addr1 =? addr2)) && (negb (addr1 =? addr3)) && (negb (addr2 =? addr3)) &&
(GRANULE_ALIGNED addr1) && (GRANULE_ALIGNED addr2) && (GRANULE_ALIGNED addr3)
then
let gidx1 := __addr_to_gidx addr1 in
let gidx2 := __addr_to_gidx addr2 in
let gidx3 := __addr_to_gidx addr3 in
when adt == query_oracle adt;
let st := share adt in
let gn1 := (gs st) @ gidx1 in
let gn2 := (gs st) @ gidx2 in
let gn3 := (gs st) @ gidx3 in
rely prop_dec (glock gn1 = None);
rely prop_dec (glock gn2 = None);
rely prop_dec (glock gn3 = None);
let e1 := EVT CPU_ID (ACQ gidx1) in
let e2 := EVT CPU_ID (ACQ gidx2) in
let e3 := EVT CPU_ID (ACQ gidx3) in
if (g_tag (ginfo gn1) =? GRANULE_STATE_DELEGATED) &&
(g_tag (ginfo gn2) =? GRANULE_STATE_DELEGATED) &&
(g_tag (ginfo gn3) =? GRANULE_STATE_DELEGATED)
then
Some (adt {log: e3 :: e2 :: e1 :: (log adt)}
{priv: (priv adt) {locked_g: (locked_g (priv adt)) # 0 == gidx1 # 1 == gidx2 # 2 == gidx3}}
{share: st {gs: (gs st) # gidx1 == (gn1 {glock: Some CPU_ID})
# gidx2 == (gn2 {glock: Some CPU_ID})
# gidx3 == (gn3 {glock: Some CPU_ID})}}, 0)
else
let e1' := EVT CPU_ID (REL gidx1 (gn1 {glock: Some CPU_ID})) in
let e2' := EVT CPU_ID (REL gidx2 (gn2 {glock: Some CPU_ID})) in
let e3' := EVT CPU_ID (REL gidx3 (gn3 {glock: Some CPU_ID})) in
Some (adt {log: e1' :: e2' :: e3' :: e3 :: e2 :: e1 :: (log adt)}, 1)
else
Some (adt, 1)
end.
Definition get_locked_granule_spec (index: Z) (adt: RData) : option Pointer :=
Some (ginfo_loc, (locked_g (priv adt)) @ index).
Definition granule_get_spec (g: Pointer) (adt: RData) : option RData :=
let gidx := offset g in
rely (peq (base g) ginfo_loc);
rely is_gidx gidx;
let gn := (gs (share adt)) @ gidx in
rely prop_dec (glock gn = Some CPU_ID);
let g' := gn {ginfo: (ginfo gn) {g_refcount: (g_refcount (ginfo gn)) + 1}} in
Some adt {share: (share adt) {gs: (gs (share adt)) # gidx == g'}}.
Definition granule_put_spec (g: Pointer) (adt: RData) : option RData :=
let gidx := offset g in
rely (peq (base g) ginfo_loc);
rely is_gidx gidx;
let gn := (gs (share adt)) @ gidx in
rely prop_dec (glock gn = Some CPU_ID);
rely g_refcount (ginfo gn) >? 0;
let g' := gn {ginfo: (ginfo gn) {g_refcount: (g_refcount (ginfo gn)) - 1}} in
Some adt {share: (share adt) {gs: (gs (share adt)) # gidx == g'}}.
Definition atomic_granule_get_spec (g: Pointer) (adt: RData) : option RData :=
let gidx := offset g in
rely (peq (base g) ginfo_loc);
rely is_gidx gidx;
let gn := (gs (share adt)) @ gidx in
rely prop_dec (glock gn = Some CPU_ID);
let e := EVT CPU_ID (INC_GCNT gidx) in
Some adt {log: e :: (log adt)} {share: (share adt) {gs: (gs (share adt)) # gidx == (gn {gcnt: (gcnt gn) + 1})}}.
Definition atomic_granule_put_spec (g: Pointer) (adt: RData) : option RData :=
None.
Definition atomic_granule_put_release_spec (g: Pointer) (adt: RData) : option RData :=
let gidx := offset g in
rely is_gidx gidx;
rely (peq (base g) ginfo_loc);
let gn := (gs (share adt)) @ gidx in
if gtype gn =? GRANULE_STATE_RD then
rely (gcnt gn >? 0);
let e := EVT CPU_ID (DEC_RD_GCNT gidx) in
Some adt {log: e :: (log adt)} {share: (share adt) {gs: (gs (share adt)) # gidx == (gn {gcnt: (gcnt gn) - 1})}}
else
rely (gcnt gn =? 1);
rely prop_dec (gref gn = Some CPU_ID);
let g' := gn {gref: None} {gcnt: 0} in
let e := EVT CPU_ID (DEC_REC_GCNT gidx gn) in
Some adt {log: e :: (log adt)} {share: (share adt) {gs: (gs (share adt)) # gidx == g'}}.
Definition granule_get_state_spec (g: Pointer) (adt: RData) : option (RData * Z) :=
let gidx := offset g in
rely (peq (base g) ginfo_loc);
rely is_gidx gidx;
let gn := (gs (share adt)) @ gidx in
rely prop_dec (glock gn = Some CPU_ID);
Some (adt, g_tag (ginfo gn)).
Definition granule_set_state_spec (g: Pointer) (state: Z) (adt: RData) : option RData :=
let gidx := offset g in
rely (peq (base g) ginfo_loc);
rely is_gidx gidx;
let gn := (gs (share adt)) @ gidx in
rely prop_dec (glock gn = Some CPU_ID);
let g' := gn {ginfo: (ginfo gn) {g_tag: state}} in
Some adt {share: (share adt) {gs: (gs (share adt)) # gidx == g'}}.
Definition granule_map_spec (g: Pointer) (slot: Z) (adt: RData) : option (RData * Pointer) :=
let gidx := offset g in
rely (peq (base g) ginfo_loc);
rely is_gidx gidx;
let priv' := (priv adt) {buffer: (buffer (priv adt)) # slot == (Some gidx)} in
Some (adt {priv: priv'}, (buffer_loc, slot)).
Definition buffer_unmap_spec (buf: Pointer) (adt: RData) : option RData :=
let slot := offset buf in
rely (peq (base buf) buffer_loc);
let priv' := (priv adt) {buffer: (buffer (priv adt)) # slot == None} in
Some adt {priv: priv'}.
Definition granule_memzero_spec (g: Pointer) (slot: Z) (adt: RData) : option RData :=
rely (peq (base g) ginfo_loc);
let gidx := offset g in
rely prop_dec ((buffer (priv adt)) @ slot = None);
let gn := (gs (share adt)) @ gidx in
rely prop_dec (glock gn = Some CPU_ID);
let g' := gn {gnorm: zero_granule_data_normal} {grec: zero_granule_data_rec} in
Some adt {share: (share adt) {gs: (gs (share adt)) # gidx == g'}}.
Definition granule_memzero_mapped_spec (g: Pointer) (adt: RData) : option RData :=
rely (peq (base g) buffer_loc);
when gidx == ((buffer (priv adt)) @ (offset g));
let gn := (gs (share adt)) @ gidx in
rely prop_dec (glock gn = Some CPU_ID);
let g' := gn {gnorm: zero_granule_data_normal} {grec: zero_granule_data_rec} in
Some adt {share: (share adt) {gs: (gs (share adt)) # gidx == g'}}.
Definition get_g_data_rd_spec (g: Pointer) (adt: RData) : option Pointer :=
let gidx := offset g in
rely (peq (base g) ginfo_loc);
rely is_gidx gidx;
let gn := (gs (share adt)) @ gidx in
rely prop_dec (glock gn = Some CPU_ID);
Some (ginfo_loc, g_rd (ginfo gn)).
Definition get_g_rec_rd_spec (g: Pointer) (adt: RData) : option Pointer :=
let gidx := offset g in
rely (peq (base g) ginfo_loc);
rely is_gidx gidx;
let gn := (gs (share adt)) @ gidx in
rely prop_dec (glock gn = Some CPU_ID);
Some (ginfo_loc, g_rd (ginfo gn)).
Definition get_rec_g_rec_list_spec (rec: Pointer) (adt: RData) : option Pointer :=
rely (peq (base rec) buffer_loc);
match (buffer (priv adt)) @ (offset rec) with
| Some gidx =>
let gn := (gs (share adt)) @ gidx in
rely g_tag (ginfo gn) =? GRANULE_STATE_REC;
rely (ref_accessible gn CPU_ID);
Some (ginfo_loc, g_rec_rec_list (grec gn))
| _ => None
end.
Definition get_g_rtt_refcount_spec (g: Pointer) (adt: RData) : option (RData * Z64) :=
let gidx := offset g in
rely (peq (base g) ginfo_loc);
rely is_gidx gidx;
let gn := (gs (share adt)) @ gidx in
rely prop_dec (glock gn = Some CPU_ID);
Some (adt, VZ64 (g_refcount (ginfo gn))).
Definition set_g_rec_rd_spec (g_rec: Pointer) (g_rd: Pointer) (adt: RData) : option RData :=
rely (peq (base g_rec) ginfo_loc);
let gidx_rec := offset g_rec in
rely is_gidx gidx_rec;
let gn := (gs (share adt)) @ gidx_rec in
rely prop_dec (glock gn = Some CPU_ID);
if peq (base g_rd) ginfo_loc then
let g' := gn {ginfo: (ginfo gn) {g_rd: offset g_rd}} in
Some adt {share: (share adt) {gs: (gs (share adt)) # gidx_rec == g'}}
else
if peq (base g_rd) null_loc then
let g' := gn {ginfo: (ginfo gn) {g_rd: 0}} in
Some adt {share: (share adt) {gs: (gs (share adt)) # gidx_rec == g'}}
else None.
Definition set_g_rtt_rd_spec (g_rtt: Pointer) (g_rd: Pointer) (adt: RData) : option RData :=
rely (peq (base g_rtt) ginfo_loc);
let gidx_rtt := offset g_rtt in
rely is_gidx gidx_rtt;
let gn := (gs (share adt)) @ gidx_rtt in
rely prop_dec (glock gn = Some CPU_ID);
if peq (base g_rd) ginfo_loc then
let g' := gn {ginfo: (ginfo gn) {g_rd: offset g_rd}} in
Some adt {share: (share adt) {gs: (gs (share adt)) # gidx_rtt == g'}}
else
if peq (base g_rd) null_loc then
let g' := gn {ginfo: (ginfo gn) {g_rd: 0}} in
Some adt {share: (share adt) {gs: (gs (share adt)) # gidx_rtt == g'}}
else None.
Definition get_rd_g_rtt_spec (rd: Pointer) (adt: RData) : option Pointer :=
rely (peq (base rd) buffer_loc);
match (buffer (priv adt)) @ (offset rd) with
| Some gidx =>
let gn := (gs (share adt)) @ gidx in
rely prop_dec (glock gn = Some CPU_ID);
rely g_tag (ginfo gn) =? GRANULE_STATE_RD;
Some (ginfo_loc, g_rtt (gnorm gn))
| _ => None
end.
Definition get_rd_g_rec_list_spec (rd: Pointer) (adt: RData) : option Pointer :=
rely (peq (base rd) buffer_loc);
match (buffer (priv adt)) @ (offset rd) with
| Some gidx =>
let gn := (gs (share adt)) @ gidx in
rely prop_dec (glock gn = Some CPU_ID);
rely g_tag (ginfo gn) =? GRANULE_STATE_RD;
Some (ginfo_loc, g_rec_list (gnorm gn))
| _ => None
end.
Definition get_rd_state_spec (rd: Pointer) (adt: RData) : option Z :=
rely (peq (base rd) buffer_loc);
match (buffer (priv adt)) @ (offset rd) with
| Some gidx =>
let gn := (gs (share adt)) @ gidx in
rely prop_dec (glock gn = Some CPU_ID);
rely g_tag (ginfo gn) =? GRANULE_STATE_RD;
Some (g_realm_state (gnorm gn))
| _ => None
end.
Definition get_rd_par_base_spec (rd: Pointer) (adt: RData) : option Z64 :=
rely (peq (base rd) buffer_loc);
match (buffer (priv adt)) @ (offset rd) with
| Some gidx =>
let gn := (gs (share adt)) @ gidx in
rely prop_dec (glock gn = Some CPU_ID);
rely g_tag (ginfo gn) =? GRANULE_STATE_RD;
Some (VZ64 (g_par_base (gnorm gn)))
| _ => None
end.
Definition get_rd_par_end_spec (rd: Pointer) (adt: RData) : option Z64 :=
rely (peq (base rd) buffer_loc);
match (buffer (priv adt)) @ (offset rd) with
| Some gidx =>
let gn := (gs (share adt)) @ gidx in
rely prop_dec (glock gn = Some CPU_ID);
rely g_tag (ginfo gn) =? GRANULE_STATE_RD;
Some (VZ64 (g_par_end (gnorm gn)))
| _ => None
end.
Definition get_rd_measurement_spec (rd: Pointer) (idx: Z) (adt: RData) : option Z64 :=
rely (peq (base rd) buffer_loc);
match (buffer (priv adt)) @ (offset rd) with
| Some gidx =>
let gn := (gs (share adt)) @ gidx in
rely prop_dec (glock gn = Some CPU_ID);
rely g_tag (ginfo gn) =? GRANULE_STATE_RD;
Some (VZ64 (g_measurement (gnorm gn)))
| _ => None
end.
Definition set_rd_measurement_algo_spec (rd: Pointer) (algo: Z64) (adt: RData) : option RData :=
match algo with
| VZ64 algo =>
rely (peq (base rd) buffer_loc);
match (buffer (priv adt)) @ (offset rd) with
| Some gidx =>
let gn := (gs (share adt)) @ gidx in
rely prop_dec (glock gn = Some CPU_ID);
rely g_tag (ginfo gn) =? GRANULE_STATE_RD;
let g' := gn {gnorm: (gnorm gn) {g_measurement_algo: algo}} in
Some adt {share: (share adt) {gs: (gs (share adt)) # gidx == g'}}
| _ => None
end
end.
Definition set_rd_state_spec (rd: Pointer) (state: Z) (adt: RData) : option RData :=
rely (peq (base rd) buffer_loc);
match (buffer (priv adt)) @ (offset rd) with
| Some gidx =>
let gn := (gs (share adt)) @ gidx in
rely prop_dec (glock gn = Some CPU_ID);
rely g_tag (ginfo gn) =? GRANULE_STATE_RD;
let g' := gn {gnorm: (gnorm gn) {g_realm_state: state}} in
Some adt {share: (share adt) {gs: (gs (share adt)) # gidx == g'}}
| _ => None
end.
Definition set_rd_par_base_spec (rd: Pointer) (par_base: Z64) (adt: RData) : option RData :=
match par_base with
| VZ64 par_base =>
rely (peq (base rd) buffer_loc);
match (buffer (priv adt)) @ (offset rd) with
| Some gidx =>
let gn := (gs (share adt)) @ gidx in
rely prop_dec (glock gn = Some CPU_ID);
rely g_tag (ginfo gn) =? GRANULE_STATE_RD;
let g' := gn {gnorm: (gnorm gn) {g_par_base: par_base}} in
Some adt {share: (share adt) {gs: (gs (share adt)) # gidx == g'}}
| _ => None
end
end.
Definition set_rd_par_end_spec (rd: Pointer) (par_end: Z64) (adt: RData) : option RData :=
match par_end with
| VZ64 par_end =>
rely (peq (base rd) buffer_loc);
match (buffer (priv adt)) @ (offset rd) with
| Some gidx =>
let gn := (gs (share adt)) @ gidx in
rely prop_dec (glock gn = Some CPU_ID);
rely g_tag (ginfo gn) =? GRANULE_STATE_RD;
let g' := gn {gnorm: (gnorm gn) {g_par_end: par_end}} in
Some adt {share: (share adt) {gs: (gs (share adt)) # gidx == g'}}
| _ => None
end
end.
Definition set_rd_g_rtt_spec (rd: Pointer) (g_rtt: Pointer) (adt: RData) : option RData :=
rely (peq (base rd) buffer_loc);
rely (peq (base g_rtt) ginfo_loc);
let rtt_gidx := offset g_rtt in
match (buffer (priv adt)) @ (offset rd) with
| Some gidx =>
let gn := (gs (share adt)) @ gidx in
rely prop_dec (glock gn = Some CPU_ID);
rely g_tag (ginfo gn) =? GRANULE_STATE_RD;
let g' := gn {gnorm: (gnorm gn) {g_rtt: rtt_gidx}} in
Some adt {share: (share adt) {gs: (gs (share adt)) # gidx == g'}}
| _ => None
end.
Definition set_rd_g_rec_list_spec (rd: Pointer) (g_rec_list: Pointer) (adt: RData) : option RData :=
rely (peq (base rd) buffer_loc);
rely (peq (base g_rec_list) ginfo_loc);
let rec_list_gidx := offset g_rec_list in
match (buffer (priv adt)) @ (offset rd) with
| Some gidx =>
let gn := (gs (share adt)) @ gidx in
rely prop_dec (glock gn = Some CPU_ID);
rely g_tag (ginfo gn) =? GRANULE_STATE_RD;
let g' := gn {gnorm: (gnorm gn) {g_rec_list: rec_list_gidx}} in
Some adt {share: (share adt) {gs: (gs (share adt)) # gidx == g'}}
| _ => None
end.
Definition get_rec_params_flags_spec (adt: RData) : option Z64 :=
Some (VZ64 (rec_params (priv adt)) @ 9).
Definition get_rec_rec_idx_spec (rec: Pointer) (adt: RData) : option Z64 :=
rely (peq (base rec) buffer_loc);
match (buffer (priv adt)) @ (offset rec) with
| Some gidx =>
let gn := (gs (share adt)) @ gidx in
rely gtype gn =? GRANULE_STATE_REC;
rely g_inited (gro gn);
Some (VZ64 (g_rec_idx (gro gn)))
| _ => None
end.
Definition get_rec_dispose_pending_spec (rec: Pointer) (adt: RData) : option Z :=
rely (peq (base rec) buffer_loc);
match (buffer (priv adt)) @ (offset rec) with
| Some gidx =>
let gn := (gs (share adt)) @ gidx in
rely g_tag (ginfo gn) =? GRANULE_STATE_REC;
rely (ref_accessible gn CPU_ID);
Some (g_dispose_pending (grec gn))
| _ => None
end.
Definition get_rec_pc_spec (rec: Pointer) (adt: RData) : option Z64 :=
rely (peq (base rec) buffer_loc);
match (buffer (priv adt)) @ (offset rec) with
| Some gidx =>
let gn := (gs (share adt)) @ gidx in
rely g_tag (ginfo gn) =? GRANULE_STATE_REC;
rely (ref_accessible gn CPU_ID);
Some (VZ64 (g_pc (grec gn)))
| _ => None
end.
Definition get_rec_pstate_spec (rec: Pointer) (adt: RData) : option Z64 :=
rely (peq (base rec) buffer_loc);
match (buffer (priv adt)) @ (offset rec) with
| Some gidx =>
let gn := (gs (share adt)) @ gidx in
rely g_tag (ginfo gn) =? GRANULE_STATE_REC;
rely (ref_accessible gn CPU_ID);
Some (VZ64 (g_pstate (grec gn)))
| _ => None
end.
Definition get_rec_last_run_info_esr_spec (rec: Pointer) (adt: RData) : option Z64 :=
rely (peq (base rec) buffer_loc);
match (buffer (priv adt)) @ (offset rec) with
| Some gidx =>
let gn := (gs (share adt)) @ gidx in
rely g_tag (ginfo gn) =? GRANULE_STATE_REC;
rely (ref_accessible gn CPU_ID);
Some (VZ64 (g_esr (grec gn)))
| _ => None
end.
Definition init_rec_read_only_spec (rec: Pointer) (grec: Pointer) (rec_idx: Z64) (adt: RData) : option RData :=
match rec_idx with
| VZ64 rec_idx =>
rely (peq (base rec) buffer_loc);
rely (peq (base grec) ginfo_loc);
match (buffer (priv adt)) @ (offset rec) with
| Some gidx =>
let gn := (gs (share adt)) @ gidx in
rely prop_dec (glock gn = Some CPU_ID);
rely gtype gn =? GRANULE_STATE_DELEGATED;
rely (negb (g_inited (gro gn)));
let g' := gn {gro: mkRecReadOnly true (offset grec) rec_idx} in
let e := EVT CPU_ID (INIT_RO gidx (offset grec) rec_idx) in
Some (adt {log: e :: (log adt)} {share: (share adt) {gs: (gs (share adt)) # gidx == g'}})
| _ => None
end
end.
Definition set_rec_g_rd_spec (rec: Pointer) (g_rd: Pointer) (adt: RData) : option RData :=
rely (peq (base rec) buffer_loc);
rely (peq (base g_rd) ginfo_loc);
let rd_gidx := offset g_rd in
match (buffer (priv adt)) @ (offset rec) with
| Some gidx =>
let gn := (gs (share adt)) @ gidx in
rely (ref_accessible gn CPU_ID);
rely g_tag (ginfo gn) =? GRANULE_STATE_REC;
let g' := gn {grec: (grec gn) {g_rec_rd: rd_gidx}} in
Some adt {share: (share adt) {gs: (gs (share adt)) # gidx == g'}}
| _ => None
end.
Definition set_rec_g_rec_list_spec (rec: Pointer) (g_rec_list: Pointer) (adt: RData) : option RData :=
rely (peq (base rec) buffer_loc);
rely (peq (base g_rec_list) ginfo_loc);
let rec_list_gidx := offset g_rec_list in
match (buffer (priv adt)) @ (offset rec) with
| Some gidx =>
let gn := (gs (share adt)) @ gidx in
rely (ref_accessible gn CPU_ID);
rely g_tag (ginfo gn) =? GRANULE_STATE_REC;
let g' := gn {grec: (grec gn) {g_rec_rec_list: rec_list_gidx}} in
Some adt {share: (share adt) {gs: (gs (share adt)) # gidx == g'}}
| _ => None
end.
Definition set_rec_par_base_spec (rec: Pointer) (par_base: Z64) (adt: RData) : option RData :=
match par_base with
| VZ64 par_base =>
rely (peq (base rec) buffer_loc);
match (buffer (priv adt)) @ (offset rec) with
| Some gidx =>
let gn := (gs (share adt)) @ gidx in
rely (ref_accessible gn CPU_ID);
rely g_tag (ginfo gn) =? GRANULE_STATE_REC;
let g' := gn {grec: (grec gn) {g_rec_par_base: par_base}} in
Some adt {share: (share adt) {gs: (gs (share adt)) # gidx == g'}}
| _ => None
end
end.
Definition set_rec_par_end_spec (rec: Pointer) (par_end: Z64) (adt: RData) : option RData :=
match par_end with
| VZ64 par_end =>
rely (peq (base rec) buffer_loc);
match (buffer (priv adt)) @ (offset rec) with
| Some gidx =>
let gn := (gs (share adt)) @ gidx in
rely (ref_accessible gn CPU_ID);
rely g_tag (ginfo gn) =? GRANULE_STATE_REC;
let g' := gn {grec: (grec gn) {g_rec_par_base: par_end}} in
Some adt {share: (share adt) {gs: (gs (share adt)) # gidx == g'}}
| _ => None
end
end.
Definition get_rec_runnable_spec (rec: Pointer) (adt: RData) : option Z :=
rely (peq (base rec) buffer_loc);
match (buffer (priv adt)) @ (offset rec) with
| Some gidx =>
let gn := (gs (share adt)) @ gidx in
rely g_tag (ginfo gn) =? GRANULE_STATE_REC;
rely prop_dec (glock gn = Some CPU_ID);
Some (g_runnable (gnorm gn))
| _ => None
end.
Definition set_rec_runnable_spec (rec: Pointer) (val: Z) (adt: RData) : option RData :=
rely (peq (base rec) buffer_loc);
match (buffer (priv adt)) @ (offset rec) with
| Some gidx =>
let gn := (gs (share adt)) @ gidx in
rely g_tag (ginfo gn) =? GRANULE_STATE_REC;
rely prop_dec (glock gn = Some CPU_ID);
let g' := gn {gnorm: (gnorm gn) {g_runnable: val}} in
Some adt {share: (share adt) {gs: (gs (share adt)) # gidx == g'}}
| _ => None
end.
Definition set_rec_regs_spec (rec: Pointer) (reg: Z) (val: Z64) (adt: RData) : option RData :=
match val with
| VZ64 val =>
rely (peq (base rec) buffer_loc);
match (buffer (priv adt)) @ (offset rec) with
| Some gidx =>
let gn := (gs (share adt)) @ gidx in
rely (ref_accessible gn CPU_ID);
rely g_tag (ginfo gn) =? GRANULE_STATE_REC;
let g' := gn {grec: (grec gn) {g_regs: set_reg reg val (g_regs (grec gn))}} in
Some adt {share: (share adt) {gs: (gs (share adt)) # gidx == g'}}
| _ => None
end
end.
Definition set_rec_pc_spec (rec: Pointer) (pc: Z64) (adt: RData) : option RData :=
match pc with
| VZ64 pc =>
rely (peq (base rec) buffer_loc);
match (buffer (priv adt)) @ (offset rec) with
| Some gidx =>
let gn := (gs (share adt)) @ gidx in
rely (ref_accessible gn CPU_ID);
rely g_tag (ginfo gn) =? GRANULE_STATE_REC;
let g' := gn {grec: (grec gn) {g_pc: pc}} in
Some adt {share: (share adt) {gs: (gs (share adt)) # gidx == g'}}
| _ => None
end
end.
Definition set_rec_pstate_spec (rec: Pointer) (pstate: Z64) (adt: RData) : option RData :=
match pstate with
| VZ64 pstate =>
rely (peq (base rec) buffer_loc);
match (buffer (priv adt)) @ (offset rec) with
| Some gidx =>
let gn := (gs (share adt)) @ gidx in
rely (ref_accessible gn CPU_ID);
rely g_tag (ginfo gn) =? GRANULE_STATE_REC;
let g' := gn {grec: (grec gn) {g_pstate: pstate}} in
Some adt {share: (share adt) {gs: (gs (share adt)) # gidx == g'}}
| _ => None
end
end.
Definition set_rvic_mask_bits_spec (rvic: Pointer) (i: Z) (val: Z64) (adt: RData) : option RData :=
match val with
| VZ64 val =>
rely (peq (base rvic) rvic_loc);
match (buffer (priv adt)) @ (offset rvic) with
| Some gidx =>
let gn := (gs (share adt)) @ gidx in
rely g_tag (ginfo gn) =? GRANULE_STATE_REC;
rely prop_dec (glock gn = Some CPU_ID);
let g' := gn {gnorm: (gnorm gn)
{g_rvic: (g_rvic (gnorm gn))
{r_mask_bits: (r_mask_bits (g_rvic (gnorm gn))) # i == val}}} in
Some adt {share: (share adt) {gs: (gs (share adt)) # gidx == g'}}
| _ => None
end
end.
Definition set_rec_sysregs_spec (rec: Pointer) (reg: Z) (val: Z64) (adt: RData) : option RData :=
match val with
| VZ64 val =>
rely (peq (base rec) buffer_loc);
match (buffer (priv adt)) @ (offset rec) with
| Some gidx =>
let gn := (gs (share adt)) @ gidx in
rely (ref_accessible gn CPU_ID);
rely g_tag (ginfo gn) =? GRANULE_STATE_REC;
let g' := gn {grec: (grec gn) {g_regs: set_reg reg val (g_regs (grec gn))}} in
Some adt {share: (share adt) {gs: (gs (share adt)) # gidx == g'}}
| _ => None
end
end.
Definition set_rec_common_sysregs_spec (rec: Pointer) (reg: Z) (val: Z64) (adt: RData) : option RData :=
match val with
| VZ64 val =>
rely (peq (base rec) buffer_loc);
match (buffer (priv adt)) @ (offset rec) with
| Some gidx =>
let gn := (gs (share adt)) @ gidx in
rely (ref_accessible gn CPU_ID);
rely g_tag (ginfo gn) =? GRANULE_STATE_REC;
let g' := gn {grec: (grec gn) {g_regs: set_reg reg val (g_regs (grec gn))}} in
Some adt {share: (share adt) {gs: (gs (share adt)) # gidx == g'}}
| _ => None
end
end.
Definition set_rec_dispose_pending_spec (rec: Pointer) (pending: Z) (adt: RData) : option RData :=
rely (peq (base rec) buffer_loc);
match (buffer (priv adt)) @ (offset rec) with
| Some gidx =>
let gn := (gs (share adt)) @ gidx in
rely (ref_accessible gn CPU_ID);
rely g_tag (ginfo gn) =? GRANULE_STATE_REC;
let g' := gn {grec: (grec gn) {g_dispose_pending: pending}} in
Some adt {share: (share adt) {gs: (gs (share adt)) # gidx == g'}}
| _ => None
end.
Definition set_rec_last_run_info_esr_spec (rec: Pointer) (val: Z64) (adt: RData) : option RData :=
match val with
| VZ64 val =>
rely (peq (base rec) buffer_loc);
match (buffer (priv adt)) @ (offset rec) with
| Some gidx =>
let gn := (gs (share adt)) @ gidx in
rely (ref_accessible gn CPU_ID);
rely g_tag (ginfo gn) =? GRANULE_STATE_REC;
let g' := gn {grec: (grec gn) {g_esr: val}} in
Some adt {share: (share adt) {gs: (gs (share adt)) # gidx == g'}}
| _ => None
end
end.
Definition get_rec_run_gprs_spec (reg: Z) (adt: RData) : option Z64 :=
Some (VZ64 (rec_run (priv adt)) @ (5 + reg)).
Definition get_rec_run_is_emulated_mmio_spec (adt: RData) : option Z64 :=
Some (VZ64 (rec_run (priv adt)) @ 13).
Definition get_rec_run_emulated_read_val_spec (adt: RData) : option Z64 :=
Some (VZ64 (rec_run (priv adt)) @ 14).
Definition pgte_read_spec (table: Pointer) (idx: Z64) (adt: RData) : option Z64 :=
match idx with
| VZ64 idx =>
rely (peq (base table) buffer_loc);
match (buffer (priv adt)) @ (offset table) with
| Some gidx =>
let gn := (gs (share adt)) @ gidx in
rely prop_dec (glock gn = Some CPU_ID);
rely g_tag (ginfo gn) =? GRANULE_STATE_TABLE;
Some (VZ64 ((g_data (gnorm gn)) @ idx))
| _ => None
end
end.
Definition pgte_write_spec (table: Pointer) (idx: Z64) (val: Z64) (adt: RData) : option RData :=
match idx, val with
| VZ64 idx, VZ64 val =>
rely (peq (base table) buffer_loc);
match (buffer (priv adt)) @ (offset table) with
| Some gidx =>
let gn := (gs (share adt)) @ gidx in
rely prop_dec (glock gn = Some CPU_ID);
rely g_tag (ginfo gn) =? GRANULE_STATE_TABLE;
let g' := gn {gnorm: (gnorm gn) {g_data: (g_data (gnorm gn)) # idx == val}} in
Some adt {share: (share adt) {gs: (gs (share adt)) # gidx == g'}}
| _ => None
end
end.
Definition link_table_spec (parent: Pointer) (child: Pointer) (level: Z64) (index: Z64) (adt: RData) : option RData :=
match level, index with
| VZ64 level, VZ64 index =>
rely (peq (base parent) ginfo_loc);
rely (peq (base child) ginfo_loc);
let par_gidx := offset parent in
let ch_gidx := offset child in
let ch := (gs (share adt)) @ ch_gidx in
rely prop_dec (glock ch = Some CPU_ID);
let ch' := ch {gaux: mkAuxillaryVars level index par_gidx} in
Some adt {share: (share adt) {gs: (gs (share adt)) # ch_gidx == ch'}}
end.
Definition set_mapping_spec (map_addr: Z64) (data_addr: Z64) (adt: RData) : option RData :=
match map_addr, data_addr with
| VZ64 map_addr, VZ64 data_addr =>
let gidx := __addr_to_gidx data_addr in
let gn := (gs (share adt)) @ gidx in
rely prop_dec (glock gn = Some CPU_ID);
let g' := gn {gaux: mkAuxillaryVars 0 0 map_addr} in
Some adt {share: (share adt) {gs: (gs (share adt)) # gidx == g'}}
end.
Definition set_retval_spec (retval: Z64) (adt: RData) : option RData :=
match retval with
| VZ64 retval =>
Some adt {priv: (priv adt) {retval: retval}}
end.
Definition realm_get_rec_entry_spec (rec_idx: Z64) (rec_list: Pointer) (adt: RData) : option (RData * Pointer) :=
match rec_idx with
| VZ64 rec_idx =>
rely (peq (base rec_list) buffer_loc);
match (buffer (priv adt)) @ (offset rec_list) with
| Some gidx =>
when adt == query_oracle adt;
let st := share adt in
let gn := (gs st) @ gidx in
rely (gtype gn =? GRANULE_STATE_REC_LIST);
let e := EVT CPU_ID (RECL gidx rec_idx GET_RECL) in
let rec_gidx := (g_data (gnorm gn)) @ rec_idx in
if rec_gidx =? 0 then
Some (adt {log: e :: (log adt)}, NULL)
else
Some (adt {log: e :: (log adt)}, (ginfo_loc, rec_gidx))
| _ => None
end
end.
Definition realm_set_rec_entry_spec (rec_idx: Z64) (rec_list: Pointer) (g_rec: Pointer) (adt: RData) : option RData :=
match rec_idx with
| VZ64 rec_idx =>
rely (peq (base rec_list) buffer_loc);
match (buffer (priv adt)) @ (offset rec_list) with
| Some gidx =>
let st := share adt in
let gn := (gs st) @ gidx in
rely (gtype gn =? GRANULE_STATE_REC_LIST);
if peq (base g_rec) ginfo_loc then
let rec_gidx := offset g_rec in
let e := EVT CPU_ID (RECL gidx rec_idx (SET_RECL rec_gidx)) in
let g' := gn {gnorm: (gnorm gn) {g_data: (g_data (gnorm gn)) # rec_idx == rec_gidx}} in
Some adt {log: e :: (log adt)} {share: (share adt) {gs: (gs (share adt)) # gidx == g'}}
else
if peq (base g_rec) null_loc then
let e := EVT CPU_ID (RECL gidx rec_idx UNSET_RECL) in
let g' := gn {gnorm: (gnorm gn) {g_data: (g_data (gnorm gn)) # rec_idx == 0}} in
Some adt {log: e :: (log adt)} {share: (share adt) {gs: (gs (share adt)) # gidx == g'}}
else None
| _ => None
end
end.
Definition get_wi_g_llt_spec (adt: RData) : option Pointer :=
if (wi_llt (priv adt)) =? 0 then
Some NULL
else
Some (ginfo_loc, (wi_llt (priv adt))).
Definition get_wi_index_spec (adt: RData) : option Z64 :=
Some (VZ64 (wi_index (priv adt))).
Definition set_wi_last_level_spec (last_level: Z64) (adt: RData) : option RData :=
match last_level with
| VZ64 last_level =>
Some adt {priv: (priv adt) {wi_last_level: last_level}}
end.
Definition set_wi_g_llt_spec (g_llt: Pointer) (adt: RData) : option RData :=
if peq (base g_llt) ginfo_loc then
Some adt {priv: (priv adt) {wi_llt: offset g_llt}}
else
if peq (base g_llt) null_loc then
Some adt {priv: (priv adt) {wi_llt: 0}}
else None.
Definition set_wi_index_spec (index: Z64) (adt: RData) : option RData :=
match index with
| VZ64 index =>
Some adt {priv: (priv adt) {wi_index: index}}
end.
Definition get_realm_params_par_base_spec (adt: RData) : option Z64 :=
Some (VZ64 (realm_params (priv adt)) @ 0).
Definition get_realm_params_par_size_spec (adt: RData) : option Z64 :=
Some (VZ64 (realm_params (priv adt)) @ 1).
Definition get_realm_params_rtt_addr_spec (adt: RData) : option Z64 :=
Some (VZ64 (realm_params (priv adt)) @ 3).
Definition get_realm_params_rec_list_addr_spec (adt: RData) : option Z64 :=
Some (VZ64 (realm_params (priv adt)) @ 2).
Definition get_realm_params_measurement_algo_spec (adt: RData) : option Z64 :=
Some (VZ64 (realm_params (priv adt)) @ 4).
Definition get_rec_params_gprs_spec (idx: Z) (adt: RData) : option Z64 :=
Some (VZ64 (rec_params (priv adt)) @ idx).
Definition get_rec_params_pc_spec (adt: RData) : option Z64 :=
Some (VZ64 (rec_params (priv adt)) @ 8).
Definition is_addr_in_par_spec (rd: Pointer) (addr: Z64) (adt: RData) : option Z :=
None.
Definition mpidr_is_valid_spec (mpidr: Z64) (adt: RData) : option Z :=
match mpidr with
| VZ64 mpidr =>
Some (if __mpidr_is_valid mpidr then 1 else 0)
end.
Definition mpidr_to_rec_idx_spec (mpidr: Z64) (adt: RData) : option Z64 :=
match mpidr with
| VZ64 mpidr =>
Some (VZ64 (__mpidr_to_rec_idx mpidr))
end.
Definition addr_to_idx_spec (addr: Z64) (level: Z64) (adt: RData) : option Z64 :=
match addr, level with
| VZ64 addr, VZ64 level =>
Some (VZ64 (__addr_to_idx addr level))
end.
Definition entry_is_table_spec (entry: Z64) (adt: RData) : option Z :=
match entry with
| VZ64 entry =>
if __entry_is_table entry then Some 1 else Some 0
end.
Definition is_rec_valid_spec (rec_idx: Z64) (rec_list: Pointer) (adt: RData) : option (RData * Z) :=
match rec_idx with
| VZ64 rec_idx =>
rely (peq (base rec_list) buffer_loc);
match (buffer (priv adt)) @ (offset rec_list) with
| Some gidx =>
let st := share adt in
let gn := (gs st) @ gidx in
rely (gtype gn =? GRANULE_STATE_REC_LIST);
let rec_gidx := (g_data (gnorm gn)) @ rec_idx in
if rec_gidx =? 0 then
Some (adt, 1)
else
Some (adt, 0)
| _ => None
end
end.
Definition esr_srt_spec (esr: Z64) (adt: RData) : option Z :=
match esr with
| VZ64 esr => Some (__esr_srt esr)
end.
Definition access_mask_spec (esr: Z64) (adt: RData) : option Z64 :=
match esr with
| VZ64 esr => Some (VZ64 (__access_mask esr))
end.
Definition esr_sign_extend_spec (esr: Z64) (adt: RData) : option Z :=
match esr with
| VZ64 esr => Some (__esr_sign_extend esr)
end.
Definition access_len_spec (esr: Z64) (adt: RData) : option Z :=
match esr with
| VZ64 esr => Some (__access_len esr)
end.
Definition esr_sixty_four_spec (esr: Z64) (adt: RData) : option Z :=
match esr with
| VZ64 esr => if __esr_sixty_four esr then Some 1 else Some 0
end.
Definition get_rec_regs_spec (rec: Pointer) (reg: Z) (adt: RData) : option Z64 :=
rely (peq (base rec) buffer_loc);
match (buffer (priv adt)) @ (offset rec) with
| Some gidx =>
let gn := (gs (share adt)) @ gidx in
rely g_tag (ginfo gn) =? GRANULE_STATE_REC;
rely (ref_accessible gn CPU_ID);
Some (VZ64 (get_reg reg (g_regs (grec gn))))
| _ => None
end.
Definition get_rec_par_base_spec (rec: Pointer) (adt: RData) : option Z64 :=