File tree Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Expand file tree Collapse file tree 1 file changed +9
-6
lines changed Original file line number Diff line number Diff line change 84
84
+ intro H. rewrite H. done.
85
85
Qed .
86
86
87
+ (* Permissions bits are represented in the same order of significance as in the full capability (eg, 1%bv encodes the Global permission) *)
87
88
Module Permissions <: PERMISSIONS.
88
- Definition len:N := 18. (* CAP_PERMS_NUM_BITS = 16 bits of actual perms + 2 bits for Executive and Global *)
89
+ Definition len:N := 18. (* CAP_PERMS_NUM_BITS = 16 bits of actual perms + 2 bits for Executive and Global. *)
89
90
Definition t := bv len.
90
91
91
92
Definition to_Z (perms:t) : Z := bv_to_Z_unsigned perms.
@@ -95,6 +96,13 @@ Module Permissions <: PERMISSIONS.
95
96
Program Definition of_list_bool (l:list bool) `{(N.of_nat (List.length l) = len)%N} : t :=
96
97
MachineWord.N_to_word (List.length l) (Ascii.N_of_digits l).
97
98
Next Obligation . auto. Defined .
99
+
100
+ Program Definition of_list (l : list bool) : option t :=
101
+ match (Nat.eq_dec (List.length l) (N.to_nat len)) with
102
+ | left eq => Some (@of_list_bool l _)
103
+ | right _ => None
104
+ end .
105
+ Next Obligation . intros. rewrite eq. done. Defined .
98
106
99
107
Definition user_perms_len:nat := 4.
100
108
@@ -379,11 +387,6 @@ Module Permissions <: PERMISSIONS.
379
387
380
388
Definition of_raw (z:Z) : t := of_Z z.
381
389
382
- Definition of_list (l : list bool) : option t :=
383
- if ((List.length l) <? (N.to_nat len))%nat then
384
- None
385
- else
386
- Some (@mword_to_bv (Z.of_N len) (of_bools (List.rev (List.firstn (N.to_nat len) l)))).
387
390
388
391
Definition to_list (perms:t) : list bool :=
389
392
bv_to_list_bool perms.
You can’t perform that action at this time.
0 commit comments