Skip to content

Commit b6200e7

Browse files
committed
sys-init: repair proofs for 64-bit-clean spec
The new use of word_bits and "of_nat word_bits" in the spec breaks the system initialiser proofs. Fix that breakage. Does not include general 64-bit cleanup of the proofs. Signed-off-by: Gerwin Klein <gerwin.klein@proofcraft.systems>
1 parent 5f31e8f commit b6200e7

9 files changed

Lines changed: 108 additions & 89 deletions

sys-init/CreateIRQCaps_SI.thy

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@
55
*)
66

77
theory CreateIRQCaps_SI
8-
imports
9-
DSpecProofs.IRQ_DP
10-
ObjectInitialised_SI
11-
RootTask_SI
12-
SysInit_SI
13-
Mapped_Separating_Conjunction
14-
Sep_Algebra.Sep_Fold_Cancel
8+
imports
9+
DSpecProofs.IRQ_DP
10+
ObjectInitialised_SI
11+
RootTask_SI
12+
SysInitSpec.SysInit_SI
13+
Mapped_Separating_Conjunction
14+
Sep_Algebra.Sep_Fold_Cancel
1515
begin
1616

1717
(*****************
@@ -151,7 +151,7 @@ lemma create_irq_cap_sep:
151151
apply (wp add: hoare_drop_imp sep_wp: seL4_IRQHandler_IRQControl_Get, simp)
152152
apply (rule conjI)
153153
apply sep_solve
154-
apply (simp add: offset_slot_si_cnode_size' guard_equal_si_cspace_cap word_bits_def)
154+
apply (simp add: offset_slot_si_cnode_size' guard_equal_si_cspace_cap)
155155
done
156156

157157
lemma well_formed_spec_used_irqs_compute:

sys-init/CreateObjects_SI.thy

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@
55
*)
66

77
theory CreateObjects_SI
8-
imports
9-
StaticDerivations_SI
10-
ObjectInitialised_SI
11-
RootTask_SI
12-
SysInit_SI
13-
Sep_Algebra.Extended_Separation_Algebra
14-
Sep_Algebra.Sep_Util
15-
Sep_Algebra.Sep_Fold_Cancel
16-
Mapped_Separating_Conjunction
8+
imports
9+
StaticDerivations_SI
10+
ObjectInitialised_SI
11+
RootTask_SI
12+
SysInitSpec.SysInit_SI
13+
Sep_Algebra.Extended_Separation_Algebra
14+
Sep_Algebra.Sep_Util
15+
Sep_Algebra.Sep_Fold_Cancel
16+
Mapped_Separating_Conjunction
1717
begin
1818

1919
lemma has_children_map_le:
@@ -65,7 +65,8 @@ lemma retype_untyped_wp_no_children:
6565
root_size=si_cnode_size and
6666
obj = new_object and
6767
obj_range=cover_ids and
68-
tcb="obj_tcb root_tcb"]])
68+
tcb="obj_tcb root_tcb",
69+
folded word_bits_num]])
6970
apply (fastforce)+
7071
apply (assumption
7172
| simp add: unat_of_nat32
@@ -127,7 +128,8 @@ lemma retype_untyped_wp_has_children:
127128
dev = dev and
128129
obj = new_object and
129130
obj_range = cover_ids and
130-
tcb = "obj_tcb root_tcb"]])
131+
tcb = "obj_tcb root_tcb"],
132+
folded word_bits_num])
131133
apply (fastforce)+
132134
apply (simp add: unat_of_nat32 | rule offset_slot'[symmetric] guard_equal_si_cnode_cap)+
133135
apply (clarsimp)

sys-init/DuplicateCaps_SI.thy

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
*)
66

77
theory DuplicateCaps_SI
8-
imports
9-
"DSpecProofs.CNode_DP"
10-
ObjectInitialised_SI
11-
RootTask_SI
12-
SysInit_SI
8+
imports
9+
DSpecProofs.CNode_DP
10+
ObjectInitialised_SI
11+
RootTask_SI
12+
SysInitSpec.SysInit_SI
1313
begin
1414

1515
lemma sep_map_zip_fst:
@@ -67,8 +67,8 @@ lemma seL4_CNode_Copy_sep_helper:
6767
(si_cnode_id, unat cap_ptr) \<mapsto>c default_cap (object_type obj) {kobj_id}
6868
(object_size_bits obj) dev \<and>*
6969
(si_cnode_id, unat free_cptr) \<mapsto>c NullCap \<and>* R\<guillemotright> s\<rbrace>
70-
seL4_CNode_Copy seL4_CapInitThreadCNode free_cptr 32
71-
seL4_CapInitThreadCNode cap_ptr 32 UNIV
70+
seL4_CNode_Copy seL4_CapInitThreadCNode free_cptr (of_nat word_bits)
71+
seL4_CapInitThreadCNode cap_ptr (of_nat word_bits) UNIV
7272
\<lbrace>\<lambda>rv.\<guillemotleft>si_tcb_id \<mapsto>f root_tcb \<and>*
7373
(si_tcb_id, tcb_cspace_slot) \<mapsto>c si_cspace_cap \<and>*
7474
(si_tcb_id, tcb_pending_op_slot) \<mapsto>c RunningCap \<and>*
@@ -90,7 +90,7 @@ lemma seL4_CNode_Copy_sep_helper:
9090
apply (rule conjI)
9191
apply sep_solve
9292
apply (clarsimp simp: guard_equal_si_cspace_cap
93-
guard_equal_si_cnode_cap word_bits_def)
93+
guard_equal_si_cnode_cap)
9494
apply (simp add: well_formed_update_cap_rights_idem derived_cap_default)
9595
apply sep_solve
9696
done

sys-init/InitCSpace_SI.thy

Lines changed: 31 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55
*)
66

77
theory InitCSpace_SI
8-
imports
9-
"DSpecProofs.CNode_DP"
10-
ObjectInitialised_SI
11-
RootTask_SI
12-
SysInit_SI
13-
Mapped_Separating_Conjunction
8+
imports
9+
DSpecProofs.CNode_DP
10+
ObjectInitialised_SI
11+
RootTask_SI
12+
SysInitSpec.SysInit_SI
13+
Mapped_Separating_Conjunction
1414
begin
1515

1616
(*********************
@@ -48,7 +48,7 @@ lemma irqhandler_cap_cap_irq [simp]:
4848

4949
lemma InitThreadCNode_guard_equal[simp]:
5050
"guard_equal si_cspace_cap seL4_CapInitThreadCNode word_bits"
51-
apply (clarsimp simp:seL4_CapInitThreadCNode_def word_bits_def)
51+
apply (clarsimp simp:seL4_CapInitThreadCNode_def)
5252
apply (rule guard_equal_si_cspace_cap)
5353
apply (simp add:si_cnode_size_def)
5454
done
@@ -341,7 +341,7 @@ lemma mint_pre:
341341
src_root = seL4_CapInitThreadCNode;
342342
Some src_index = orig_caps (cap_object spec_cap);
343343
src_index < 2 ^ si_cnode_size;
344-
src_depth = (32::word32);
344+
src_depth = (of_nat word_bits::word32);
345345
346346
rights = cap_rights spec_cap;
347347
@@ -388,8 +388,8 @@ lemma mint_pre:
388388
R\<guillemotright> s \<and>
389389
390390
\<comment> \<open>Cap slots match their cptrs.\<close>
391-
one_lvl_lookup si_cspace_cap 32 si_cnode_size \<and>
392-
one_lvl_lookup si_cspace_cap 32 si_cnode_size \<and>
391+
one_lvl_lookup si_cspace_cap (of_nat word_bits) si_cnode_size \<and>
392+
one_lvl_lookup si_cspace_cap (of_nat word_bits) si_cnode_size \<and>
393393
one_lvl_lookup si_cspace_cap (unat src_depth) si_cnode_size \<and>
394394
one_lvl_lookup dest_root_cap (unat dest_depth) dest_size \<and>
395395
@@ -503,8 +503,8 @@ lemma move_pre_irq_handler:
503503
R\<guillemotright> s \<and>
504504
505505
\<comment> \<open>Cap slots match their cptrs.\<close>
506-
one_lvl_lookup si_cspace_cap 32 si_cnode_size \<and>
507-
one_lvl_lookup si_cspace_cap 32 si_cnode_size \<and>
506+
one_lvl_lookup si_cspace_cap word_bits si_cnode_size \<and>
507+
one_lvl_lookup si_cspace_cap word_bits si_cnode_size \<and>
508508
one_lvl_lookup si_cspace_cap (unat src_depth) si_cnode_size \<and>
509509
one_lvl_lookup dest_root_cap (unat dest_depth) dest_size \<and>
510510
@@ -804,7 +804,7 @@ lemma seL4_CNode_Mutate_object_slot_initialised_sep_helper:
804804
si_cap_at t dup_caps spec dev obj_id \<and>*
805805
object_fields_empty spec t obj_id \<and>* si_objects \<and>* R\<guillemotright> \<rbrace>
806806
seL4_CNode_Mutate dest_root (of_nat slot) (of_nat (object_size_bits spec_obj))
807-
seL4_CapInitThreadCNode src_index 32 data
807+
seL4_CapInitThreadCNode src_index (of_nat word_bits) data
808808
\<lbrace>\<lambda>_.\<guillemotleft>object_slot_initialised spec t obj_id slot \<and>*
809809
si_null_cap_at t orig_caps spec (cap_object spec_cap) \<and>*
810810
si_cap_at t dup_caps spec dev obj_id \<and>*
@@ -815,11 +815,12 @@ lemma seL4_CNode_Mutate_object_slot_initialised_sep_helper:
815815
and dest_root_cap = "default_cap CNodeType {dest_id} (object_size_bits spec_obj) False"
816816
and root_size=si_cnode_size
817817
and src_root=seL4_CapInitThreadCNode
818-
and src_depth=32
818+
and src_depth="of_nat word_bits"
819819
and tcb=root_tcb
820820
and src_cap = "default_cap type {client_object_id} (object_size_bits spec_cap_obj) dev"
821821
in seL4_CNode_Mutate_sep[where
822-
R = "(si_cnode_id, unat seL4_CapIRQControl) \<mapsto>c IrqControlCap \<and>* si_asid \<and>* R"])
822+
R = "(si_cnode_id, unat seL4_CapIRQControl) \<mapsto>c IrqControlCap \<and>* si_asid \<and>* R",
823+
folded word_bits_num])
823824
apply (assumption|simp add: ep_related_cap_default_cap
824825
default_cap_has_type valid_src_cap_if_cnode
825826
get_index_def)+
@@ -832,7 +833,7 @@ lemma seL4_CNode_Mutate_object_slot_initialised_sep_helper:
832833
simp_all add: has_type_default_not_non ep_related_cap_default_cap)
833834
apply (thin_tac "\<guillemotleft>P \<and>* Q \<guillemotright>s" for P Q)
834835
apply sep_solve
835-
apply ((clarsimp simp: si_cnode_cap_def word_bits_def si_cspace_cap_def
836+
apply ((clarsimp simp: si_cnode_cap_def si_cspace_cap_def
836837
dest!: guard_equal_si_cspace_cap |
837838
rule is_cnode_cap_si_cnode_cap)+)[2]
838839
(* it works because si_cnode_cap = si_cspace_cap *)
@@ -869,7 +870,7 @@ lemma seL4_CNode_Move_object_slot_initialised_cap_has_object_sep_helper:
869870
si_cap_at t dup_caps spec dev obj_id \<and>*
870871
object_fields_empty spec t obj_id \<and>* si_objects \<and>* R\<guillemotright> \<rbrace>
871872
seL4_CNode_Move dest_root (of_nat slot) (of_nat (object_size_bits spec_obj))
872-
seL4_CapInitThreadCNode src_index 32
873+
seL4_CapInitThreadCNode src_index (of_nat word_bits)
873874
\<lbrace>\<lambda>_.\<guillemotleft>object_slot_initialised spec t obj_id slot \<and>*
874875
si_null_cap_at t orig_caps spec (cap_object spec_cap) \<and>*
875876
si_cap_at t dup_caps spec dev obj_id \<and>*
@@ -880,7 +881,7 @@ lemma seL4_CNode_Move_object_slot_initialised_cap_has_object_sep_helper:
880881
and dest_root_cap = "default_cap CNodeType {dest_id} (object_size_bits spec_obj) False"
881882
and root_size=si_cnode_size
882883
and src_root=seL4_CapInitThreadCNode
883-
and src_depth=32
884+
and src_depth="of_nat word_bits"
884885
and tcb=root_tcb
885886
and src_cap = "default_cap type {client_object_id} (object_size_bits spec_cap_obj) dev"
886887
in seL4_CNode_Move_sep[where
@@ -896,7 +897,7 @@ lemma seL4_CNode_Move_object_slot_initialised_cap_has_object_sep_helper:
896897
simp_all add:has_type_default_not_non ep_related_cap_default_cap)
897898
apply (thin_tac "\<guillemotleft>P \<and>* Q \<guillemotright>s" for P Q)
898899
apply sep_solve
899-
apply ((clarsimp simp: si_cnode_cap_def word_bits_def si_cspace_cap_def
900+
apply ((clarsimp simp: si_cnode_cap_def si_cspace_cap_def
900901
dest!: guard_equal_si_cspace_cap |
901902
rule is_cnode_cap_si_cnode_cap)+)[2]
902903
(* it works because si_cnode_cap = si_cspace_cap *)
@@ -926,7 +927,7 @@ lemma seL4_CNode_Move_object_slot_initialised_irqhandler_cap_sep_helper:
926927
si_cap_at t dup_caps spec False obj_id \<and>*
927928
object_fields_empty spec t obj_id \<and>* si_objects \<and>* R\<guillemotright> \<rbrace>
928929
seL4_CNode_Move dest_root (of_nat slot) (of_nat (object_size_bits spec_obj))
929-
seL4_CapInitThreadCNode src_index 32
930+
seL4_CapInitThreadCNode src_index (of_nat word_bits)
930931
\<lbrace>\<lambda>_.\<guillemotleft>object_slot_initialised spec t obj_id slot \<and>*
931932
si_null_irq_cap_at irq_caps spec (cap_irq spec_cap) \<and>*
932933
si_cap_at t dup_caps spec dev obj_id \<and>*
@@ -937,7 +938,7 @@ lemma seL4_CNode_Move_object_slot_initialised_irqhandler_cap_sep_helper:
937938
and dest_root_cap = "default_cap CNodeType {dest_id} (object_size_bits spec_obj) False"
938939
and root_size=si_cnode_size
939940
and src_root=seL4_CapInitThreadCNode
940-
and src_depth=32
941+
and src_depth="of_nat word_bits"
941942
and tcb=root_tcb
942943
and src_cap = " IrqHandlerCap (cap_irq spec_cap)"
943944
in seL4_CNode_Move_sep[where
@@ -952,9 +953,9 @@ lemma seL4_CNode_Move_object_slot_initialised_irqhandler_cap_sep_helper:
952953
simp_all add:has_type_default_not_non ep_related_cap_default_cap)
953954
apply (thin_tac "\<guillemotleft>P \<and>* Q \<guillemotright>s" for P Q)
954955
apply (sep_solve add: sep_any_imp)
955-
apply ((clarsimp simp: si_cnode_cap_def word_bits_def si_cspace_cap_def
956+
apply ((clarsimp simp: si_cnode_cap_def si_cspace_cap_def
956957
dest!: guard_equal_si_cspace_cap |
957-
rule is_cnode_cap_si_cnode_cap)+)[2]
958+
rule is_cnode_cap_si_cnode_cap)+)[3]
958959
(* it works because si_cnode_cap = si_cspace_cap *)
959960
apply (drule_tac s=s and dest_root=dest_root and src_index=src_index and R=R
960961
in move_post_irq_handler, (assumption|simp)+)
@@ -977,7 +978,7 @@ lemma seL4_CNode_Move_object_slot_initialised_cap_has_object_sep:
977978
si_cap_at t dup_caps spec dev obj_id \<and>*
978979
object_fields_empty spec t obj_id \<and>* si_objects \<and>* R\<guillemotright> s\<rbrace>
979980
seL4_CNode_Move dest_root (of_nat slot) (of_nat (object_size_bits spec_obj))
980-
seL4_CapInitThreadCNode src_index 32
981+
seL4_CapInitThreadCNode src_index (of_nat word_bits)
981982
\<lbrace>\<lambda>_.\<guillemotleft>object_slot_initialised spec t obj_id slot \<and>*
982983
si_null_cap_at t orig_caps spec (cap_object spec_cap) \<and>*
983984
si_cap_at t dup_caps spec dev obj_id \<and>*
@@ -1014,7 +1015,7 @@ lemma seL4_CNode_Move_object_slot_initialised_irqhandler_cap_sep:
10141015
si_cap_at t dup_caps spec False obj_id \<and>*
10151016
object_fields_empty spec t obj_id \<and>* si_objects \<and>* R\<guillemotright> s\<rbrace>
10161017
seL4_CNode_Move dest_root (of_nat slot) (of_nat (object_size_bits spec_obj))
1017-
seL4_CapInitThreadCNode src_index 32
1018+
seL4_CapInitThreadCNode src_index (of_nat word_bits)
10181019
\<lbrace>\<lambda>_.\<guillemotleft>object_slot_initialised spec t obj_id slot \<and>*
10191020
si_null_irq_cap_at irq_caps spec (cap_irq spec_cap) \<and>*
10201021
si_cap_at t dup_caps spec False obj_id \<and>*
@@ -1043,7 +1044,7 @@ lemma seL4_CNode_Move_object_slot_initialised_irqhandler_cap_sep_new:
10431044
Some dest_root = dup_caps obj_id \<and>
10441045
Some src_index = irq_caps (cap_irq spec_cap))\<rbrace>
10451046
seL4_CNode_Move dest_root (of_nat slot) (of_nat (object_size_bits spec_obj))
1046-
seL4_CapInitThreadCNode src_index 32
1047+
seL4_CapInitThreadCNode src_index (of_nat word_bits)
10471048
\<lbrace>\<lambda>_.\<guillemotleft>object_slot_initialised spec t obj_id slot \<and>*
10481049
si_null_irq_cap_at irq_caps spec (cap_irq spec_cap) \<and>*
10491050
si_cap_at t dup_caps spec False obj_id \<and>*
@@ -1075,7 +1076,7 @@ lemma seL4_CNode_Mutate_object_slot_initialised_sep:
10751076
si_cap_at t dup_caps spec dev obj_id \<and>*
10761077
object_fields_empty spec t obj_id \<and>* si_objects \<and>* R\<guillemotright> s \<rbrace>
10771078
seL4_CNode_Mutate dest_root (of_nat slot) (of_nat (object_size_bits spec_obj))
1078-
seL4_CapInitThreadCNode src_index 32 data
1079+
seL4_CapInitThreadCNode src_index (of_nat word_bits) data
10791080
\<lbrace>\<lambda>_.\<guillemotleft>object_slot_initialised spec t obj_id slot \<and>*
10801081
si_null_cap_at t orig_caps spec (cap_object spec_cap) \<and>*
10811082
si_cap_at t dup_caps spec dev obj_id \<and>*
@@ -1387,7 +1388,7 @@ lemma seL4_CNode_Mint_object_slot_initialised_sep_helper:
13871388
si_cap_at t dup_caps spec dev obj_id \<and>*
13881389
object_fields_empty spec t obj_id \<and>* si_objects \<and>* R\<guillemotright> \<rbrace>
13891390
seL4_CNode_Mint dest_root (of_nat slot) (of_nat (object_size_bits spec_obj))
1390-
seL4_CapInitThreadCNode src_index 32 rights data
1391+
seL4_CapInitThreadCNode src_index (of_nat word_bits) rights data
13911392
\<lbrace>\<lambda>_.\<guillemotleft>object_slot_initialised spec t obj_id slot \<and>*
13921393
si_cap_at t orig_caps spec dev (cap_object spec_cap) \<and>*
13931394
si_cap_at t dup_caps spec dev obj_id \<and>*
@@ -1399,7 +1400,7 @@ lemma seL4_CNode_Mint_object_slot_initialised_sep_helper:
13991400
and dest_root_cap = "default_cap CNodeType {dest_id} (object_size_bits spec_obj) False"
14001401
and root_size=si_cnode_size
14011402
and src_root=seL4_CapInitThreadCNode
1402-
and src_depth=32
1403+
and src_depth="of_nat word_bits"
14031404
and tcb=root_tcb
14041405
and src_cap = "default_cap type {client_object_id} (object_size_bits spec_cap_obj) dev"
14051406
in seL4_CNode_Mint_sep,
@@ -1452,7 +1453,7 @@ lemma seL4_CNode_Mint_object_slot_initialised_sep:
14521453
si_cap_at t dup_caps spec dev obj_id \<and>*
14531454
object_fields_empty spec t obj_id \<and>* si_objects \<and>* R\<guillemotright> s \<rbrace>
14541455
seL4_CNode_Mint dest_root (of_nat slot) (of_nat (object_size_bits spec_obj))
1455-
seL4_CapInitThreadCNode src_index 32 rights data
1456+
seL4_CapInitThreadCNode src_index (of_nat word_bits) rights data
14561457
\<lbrace>\<lambda>_ s. \<guillemotleft>object_slot_initialised spec t obj_id slot \<and>*
14571458
si_cap_at t orig_caps spec dev (cap_object spec_cap) \<and>*
14581459
si_cap_at t dup_caps spec dev obj_id \<and>*

sys-init/InitIRQ_SI.thy

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
*)
66

77
theory InitIRQ_SI
8-
imports
9-
"DSpecProofs.IRQ_DP"
10-
ObjectInitialised_SI
11-
RootTask_SI
12-
SysInit_SI
8+
imports
9+
DSpecProofs.IRQ_DP
10+
ObjectInitialised_SI
11+
RootTask_SI
12+
SysInitSpec.SysInit_SI
1313
begin
1414

1515
lemma seL4_IRQHandler_SetEndpoint_irq_initialised_helper_sep:

sys-init/InitTCB_SI.thy

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,11 @@
55
*)
66

77
theory InitTCB_SI
8-
imports
9-
"DSpecProofs.KHeap_DP"
10-
"DSpecProofs.TCB_DP"
11-
ObjectInitialised_SI
12-
RootTask_SI
13-
SysInit_SI
8+
imports
9+
DSpecProofs.TCB_DP
10+
ObjectInitialised_SI
11+
RootTask_SI
12+
SysInitSpec.SysInit_SI
1413
begin
1514

1615
lemma cap_has_type_cap_has_object [simp]:

0 commit comments

Comments
 (0)