The width of operations on bit fields greater than 32-bit is implementation defined, and differs between GCC (which uses the bitfield precision) and clang (which uses 64-bit arithmetic), so this is a minefield that is already causing bugs (see patch 1). Remove the bit fields and using manual masking instead. Mostly the same as yesterday's patch, but with constants moved to processor.h and extended to include common idioms such as PAGE_MASK and PAGE_SIZE. Paolo Supersedes: <20220420103624.1143824-1-pbonzini@xxxxxxxxxx> Paolo Bonzini (2): kvm: selftests: do not use bitfields larger than 32-bits for PTEs kvm: selftests: introduce and use more page size-related constants .../selftests/kvm/include/x86_64/processor.h | 17 ++ .../selftests/kvm/lib/x86_64/processor.c | 202 +++++++----------- tools/testing/selftests/kvm/x86_64/amx_test.c | 1 - .../kvm/x86_64/emulator_error_test.c | 1 - tools/testing/selftests/kvm/x86_64/smm_test.c | 2 - .../kvm/x86_64/vmx_tsc_adjust_test.c | 1 - .../selftests/kvm/x86_64/xen_shinfo_test.c | 1 - .../selftests/kvm/x86_64/xen_vmcall_test.c | 1 - 8 files changed, 99 insertions(+), 127 deletions(-) -- 2.31.1