// https://www.ibm.com/support/pages/sites/default/files/2021-05/SA22-7871-10.pdf // https://www.ibm.com/docs/en/SSQ2R2_15.0.0/com.ibm.tpf.toolkit.hlasm.doc/dz9zr006.pdf // https://github.com/lucab/s390-tools/blob/7217903ce44909a230003a3d4dd38c8ddf6bdb9d/include/boot/s390.h#L476 struct ExtendedFacilityList([u64; 4]); impl ExtendedFacilityList { fn new() -> Self { let mut result: [u64; 4] = [0; 4]; unsafe { core::arch::asm!( "lgr %r0, {0}", // Load reg0 with size - 1 // equivalently ".insn s, 0xb2b00000, 0({1})", "stfle 0({1})", in(reg) result.len() as u64 - 1, in(reg_addr) result.as_mut_ptr() , options(nostack, preserves_flags ) ); } Self(result) } const fn get(&self, n: usize) -> bool { // of course they number bits from the left... self.0[n / 64] & (1 << (63 - (n % 64))) != 0 } }