use sbi_spec::base::impl_id::OPEN_SBI;
pub(crate) fn pmu2_crash(impl_id: usize, version: usize) -> bool {
impl_id == OPEN_SBI && (0x1_0003..=0x1_0006).contains(&version)
}
#[cfg(test)]
mod tests {
use super::pmu2_crash;
use sbi_spec::base::impl_id;
#[test]
fn opensbi_1_3_through_1_6_are_affected() {
assert!(pmu2_crash(impl_id::OPEN_SBI, 0x1_0003));
assert!(pmu2_crash(impl_id::OPEN_SBI, 0x1_0006));
}
#[test]
fn other_versions_and_implementations_are_not_affected() {
assert!(!pmu2_crash(impl_id::OPEN_SBI, 0x1_0002));
assert!(!pmu2_crash(impl_id::OPEN_SBI, 0x1_0007));
assert!(!pmu2_crash(impl_id::RUST_SBI, 0x1_0006));
}
}