aboutsummaryrefslogtreecommitdiff
path: root/target/s390x/cpu_features.h
diff options
context:
space:
mode:
authorDavid Hildenbrand <david@redhat.com>2017-07-20 14:37:19 +0200
committerCornelia Huck <cohuck@redhat.com>2017-07-25 09:17:42 +0200
commit3d1cfc3c682ffe937526a31a4161735338558985 (patch)
tree7942a3a362d5dc267932f554824f55b7aed4c796 /target/s390x/cpu_features.h
parentcc18f90762412c657a37a17809be9613ac7f0b00 (diff)
target/s390x: introduce (test|set)_be_bit
Using ordinary bitmap operations to set/test bits does not work properly on architectures !s390x. Let's drop (test|set)_bit_inv and introduce (test|set)_be_bit instead. These functions work on uint8_t array, not on unsigned longs arrays and are for now only used in the context of CPU features. Signed-off-by: David Hildenbrand <david@redhat.com> Message-Id: <20170720123721.12366-4-david@redhat.com> Signed-off-by: Cornelia Huck <cohuck@redhat.com>
Diffstat (limited to 'target/s390x/cpu_features.h')
-rw-r--r--target/s390x/cpu_features.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/target/s390x/cpu_features.h b/target/s390x/cpu_features.h
index 770435e0cc..e306aa7ab2 100644
--- a/target/s390x/cpu_features.h
+++ b/target/s390x/cpu_features.h
@@ -93,4 +93,12 @@ const S390FeatGroupDef *s390_feat_group_def(S390FeatGroup group);
#define BE_BIT_NR(BIT) (BIT ^ (BITS_PER_LONG - 1))
+static inline void set_be_bit(unsigned int bit_nr, uint8_t *array)
+{
+ array[bit_nr / 8] |= 0x80 >> (bit_nr % 8);
+}
+static inline bool test_be_bit(unsigned int bit_nr, const uint8_t *array)
+{
+ return array[bit_nr / 8] & (0x80 >> (bit_nr % 8));
+}
#endif /* TARGET_S390X_CPU_FEATURES_H */