Created
January 12, 2025 16:00
-
-
Save folkertdev/0fdd8a0ba7d43198bfb8a1300ca2a23c to your computer and use it in GitHub Desktop.
Revisions
-
folkertdev renamed this gist
Jan 12, 2025 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
folkertdev created this gist
Jan 12, 2025 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,9 @@ [build] target = "s390x-unknown-linux-gnu" [target.s390x-unknown-linux-gnu] # runner = "qemu-s390x -cpu max -L /usr/s390x-linux-gnu" runner = "qemu-s390x -cpu qemu,vx=on,vxeh=on,vxeh2=off -L /usr/s390x-linux-gnu" # runner = "qemu-s390x -cpu z10EC -L /usr/s390x-linux-gnu" linker = "s390x-linux-gnu-gcc" This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,27 @@ // 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 } }