@@ -28,11 +28,11 @@ static MEMORY_LAYOUT: Once<MemoryLayout> = Once::new();
2828/// non-confidential memory.
2929#[ rr:: refined_by( "ml" : "memory_layout" ) ]
3030/// Invariant: The starts of the region have addresses less-or-equal-to the ends of the regions.
31- #[ rr:: invariant( "ml.(non_conf_start).2 ≤ ml.(non_conf_end).2 " ) ]
32- #[ rr:: invariant( "ml.(conf_start).2 ≤ ml.(conf_end).2 " ) ]
31+ #[ rr:: invariant( "ml.(non_conf_start).(loc_a) ≤ ml.(non_conf_end).(loc_a) " ) ]
32+ #[ rr:: invariant( "ml.(conf_start).(loc_a) ≤ ml.(conf_end).(loc_a) " ) ]
3333/// Invariant: the non-confidential memory region comes before the confidential memory region.
3434// TODO: this could be generalized to the regions being disjoint
35- #[ rr:: invariant( "ml.(non_conf_end).2 ≤ ml.(conf_start).2 " ) ]
35+ #[ rr:: invariant( "ml.(non_conf_end).(loc_a) ≤ ml.(conf_start).(loc_a) " ) ]
3636/// Invariant: the bounds of the confidential memory region are aligned to 4KiB pages
3737#[ rr:: invariant( "ml.(conf_start) `aligned_to` (page_size_in_bytes_nat Size4KiB)" ) ]
3838#[ rr:: invariant( "ml.(conf_end) `aligned_to` (page_size_in_bytes_nat Size4KiB)" ) ]
@@ -68,19 +68,19 @@ impl MemoryLayout {
6868 /// This function must be called only once by the initialization procedure during the boot of the system.
6969 #[ rr:: only_spec]
7070 /// Precondition: The non-confidential memory should have positive size.
71- #[ rr:: requires( "non_confidential_memory_start.2 < non_confidential_memory_end.2 " ) ]
71+ #[ rr:: requires( "non_confidential_memory_start.(loc_a) < non_confidential_memory_end.(loc_a) " ) ]
7272 /// Precondition: The non-condidential memory should preceed and not overlap with confidential memory.
73- #[ rr:: requires( "non_confidential_memory_end.2 ≤ confidential_memory_start.2 " ) ]
73+ #[ rr:: requires( "non_confidential_memory_end.(loc_a) ≤ confidential_memory_start.(loc_a) " ) ]
7474 /// Precondition: The confidential memory should have positive size.
75- #[ rr:: requires( "confidential_memory_start.2 < confidential_memory_end.2 " ) ]
75+ #[ rr:: requires( "confidential_memory_start.(loc_a) < confidential_memory_end.(loc_a) " ) ]
7676 /// Precondition: The global MEMORY_LAYOUT has not been initialized yet.
7777 #[ rr:: requires( #iris "once_initialized π \" MEMORY_LAYOUT\" None" ) ]
7878 /// Postcondition: There exists a result -- failure is always an option
7979 #[ rr:: exists( "res" , "maybe_mem_layout" ) ]
8080 /// Postcondition: failure due to low memory can occur if there is no sufficiently aligned
8181 /// confidential address
8282 #[ rr:: ensures(
83- "if_Err res (λ err, (confidential_memory_start.2 - confidential_memory_end.2 ≤ page_size_in_bytes_Z Size4KiB)%Z ∧ err = error_Error_NotEnoughMemory)"
83+ "if_Err res (λ err, (confidential_memory_start.(loc_a) - confidential_memory_end.(loc_a) ≤ page_size_in_bytes_Z Size4KiB)%Z ∧ err = error_Error_NotEnoughMemory)"
8484 ) ]
8585 /// Postcondition: if we return Ok, we get a new confidential memory range that is correctly
8686 /// aligned for the smallest page size and is a subrange of [conf_start, conf_end)
@@ -90,9 +90,9 @@ impl MemoryLayout {
9090 maybe_mem_layout = Some mem_layout ∧
9191 mem_layout.(conf_start) `aligned_to` (page_size_in_bytes_nat Size4KiB) ∧
9292 mem_layout.(conf_end) `aligned_to` (page_size_in_bytes_nat Size4KiB) ∧
93- confidential_memory_start.2 ≤ mem_layout.(conf_start).2 ∧
94- mem_layout.(conf_end).2 ≤ confidential_memory_end.2 ∧
95- mem_layout.(conf_start).2 ≤ mem_layout.(conf_end).2 ∧
93+ confidential_memory_start.(loc_a) ≤ mem_layout.(conf_start).(loc_a) ∧
94+ mem_layout.(conf_end).(loc_a) ≤ confidential_memory_end.(loc_a) ∧
95+ mem_layout.(conf_start).(loc_a) ≤ mem_layout.(conf_end).(loc_a) ∧
9696 ok = *[ mem_layout.(conf_start); mem_layout.(conf_end)])%Z"
9797 ) ]
9898 /// Postcondition: if we return Ok, the MEMORY_LAYOUT has been initialized.
@@ -138,7 +138,7 @@ impl MemoryLayout {
138138 #[ rr:: only_spec]
139139 #[ rr:: ok]
140140 /// Precondition: The offset address is in confidential memory.
141- #[ rr:: requires( "address.2 + offset_in_bytes < self.(conf_end).2 " ) ]
141+ #[ rr:: requires( "address.(loc_a) + offset_in_bytes < self.(conf_end).(loc_a) " ) ]
142142 /// Postcondition: The offset pointer is in confidential memory.
143143 #[ rr:: ensures( "ret = address +ₗ offset_in_bytes" ) ]
144144 pub fn confidential_address_at_offset (
@@ -152,9 +152,9 @@ impl MemoryLayout {
152152 #[ rr:: only_spec]
153153 #[ rr:: ok]
154154 /// Precondition: The offset address is in confidential memory.
155- #[ rr:: requires( "address.2 + offset_in_bytes < upper_bound.2 " ) ]
155+ #[ rr:: requires( "address.(loc_a) + offset_in_bytes < upper_bound.(loc_a) " ) ]
156156 /// Precondition: The bounds we are checking are within confidential memory.
157- #[ rr:: requires( "upper_bound.2 ≤ self.(conf_end).2 " ) ]
157+ #[ rr:: requires( "upper_bound.(loc_a) ≤ self.(conf_end).(loc_a) " ) ]
158158 /// Postcondition: Then we can correctly offset the address and ensure it is in confidential
159159 /// memory.
160160 #[ rr:: ensures( "ret = address +ₗ offset_in_bytes" ) ]
@@ -170,7 +170,7 @@ impl MemoryLayout {
170170 #[ rr:: only_spec]
171171 #[ rr:: ok]
172172 /// Precondition: The offset address is in non-confidential memory.
173- #[ rr:: requires( "address.2 + offset_in_bytes < self.(non_conf_end).2 " ) ]
173+ #[ rr:: requires( "address.(loc_a) + offset_in_bytes < self.(non_conf_end).(loc_a) " ) ]
174174 /// Postcondition: Then we can correctly offset the address and ensure it is in
175175 /// non-confidential memory.
176176 #[ rr:: ensures( "ret = address +ₗ offset_in_bytes" ) ]
@@ -183,7 +183,7 @@ impl MemoryLayout {
183183
184184 /// Returns true if the raw pointer is inside the non-confidential memory.
185185 #[ rr:: only_spec]
186- #[ rr:: returns( "bool_decide (self.(non_conf_start).2 ≤ address.2 ∧ address.2 < self.(non_conf_end).2 )" ) ]
186+ #[ rr:: returns( "bool_decide (self.(non_conf_start).(loc_a) ≤ address.(loc_a) ∧ address.(loc_a) < self.(non_conf_end).(loc_a) )" ) ]
187187 pub fn is_in_non_confidential_range ( & self , address : * const usize ) -> bool {
188188 self . non_confidential_memory_start as * const usize <= address && address < self . non_confidential_memory_end
189189 }
@@ -219,7 +219,7 @@ impl MemoryLayout {
219219
220220 /// Get the boundaries of confidential memory as a (start, end) tuple.
221221 #[ rr:: only_spec]
222- #[ rr:: returns( " *[self.(conf_start).2 ; self.(conf_end).2 ]" ) ]
222+ #[ rr:: returns( " *[self.(conf_start).(loc_a) ; self.(conf_end).(loc_a) ]" ) ]
223223 pub fn confidential_memory_boundary ( & self ) -> ( usize , usize ) {
224224 ( self . confidential_memory_start as usize , self . confidential_memory_end as usize )
225225 }
0 commit comments