Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions arch/cortex-m/src/mpu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1172,13 +1172,15 @@ impl<const NUM_REGIONS: usize, const MIN_REGION_SIZE: usize> mpu::MPU
}
// cannot have unused regions
if NUM_REGIONS > 8 {
for i in 8..NUM_REGIONS {
flux_support::assume(i < 16); // TODO: extern-spec-iter-range
// TODO:ITERATOR turn this back into `for i in 8..NUM_REGIONS`
let mut i = 8;
while i < NUM_REGIONS {
let region = CortexMRegion::empty(i);
self.registers
.rbar
.write(region.base_address().into_inner());
self.registers.rasr.write(region.attributes().into_inner());
i += 1;
}
}
self.hardware_is_configured_for.set(id);
Expand Down
7 changes: 5 additions & 2 deletions kernel/src/scheduler/mlfq.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,10 @@ impl<'a, A: 'static + time::Alarm<'static>> MLFQSched<'a, A> {
/// This method moves that node to the head of its queue.
#[flux_rs::spec(fn (&Self) -> (Option<&MLFQProcessNode>, usize{v: v < 3}))]
fn get_next_ready_process_node(&self) -> (Option<&MLFQProcessNode<'a>>, usize) {
for (idx, queue) in self.processes.iter().enumerate() {
flux_support::assume(idx < 3); // TODO: extern-spec enumerate
// TODO:ITERATOR turn this back into `for (idx, queue) in self.processes.iter().enumerate()`
let mut idx = 0;
while idx < 3 {
let queue = &self.processes[idx];
let next = queue
.iter()
.find(|node_ref| node_ref.proc.map_or(false, |proc| proc.ready()));
Expand All @@ -129,6 +131,7 @@ impl<'a, A: 'static + time::Alarm<'static>> MLFQSched<'a, A> {
}
}
}
idx += 1;
}
(None, 0)
}
Expand Down
15 changes: 8 additions & 7 deletions kernel/src/utilities/math.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,14 @@ impl PowerOfTwo {
PowerOfTwo(log_base_two(f.into()))
}

/// Converts a number two the nearest `PowerOfTwo` greater-than-or-equal to
/// it.
pub fn ceiling<F: Into<u32>>(f: F) -> PowerOfTwo {
let v = f.into();
assume(v <= u32::MAX / 2);
PowerOfTwo(log_base_two(closest_power_of_two(v)))
}
// /// Converts a number two the nearest `PowerOfTwo` greater-than-or-equal to
// /// it.
// pub fn ceiling<F: Into<u32>>(f: F) -> PowerOfTwo {
// let v = f.into();
// assume(v <= u32::MAX / 2);
// PowerOfTwo(log_base_two(closest_power_of_two(v)))
// }


/// Creates a new `PowerOfTwo` representing the number zero.
pub fn zero() -> PowerOfTwo {
Expand Down
Loading