[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [RFC PATCH v2 10/15] cpu-model/s390: Add cpu class init
From: |
Michael Mueller |
Subject: |
Re: [Qemu-devel] [RFC PATCH v2 10/15] cpu-model/s390: Add cpu class initialization routines |
Date: |
Fri, 20 Feb 2015 19:59:28 +0100 |
On Fri, 20 Feb 2015 10:11:55 -0800
Richard Henderson <address@hidden> wrote:
> > +static inline uint64_t big_endian_bit(unsigned long nr)
> > +{
> > + return 1ul << (BITS_PER_LONG - (nr % BITS_PER_LONG));
> > +};
>
> This is buggy. NR=0 should map to 63, not 64.
I'm sure I was asked to replace my constant 64 and 63 with that defines and at
the end I messed
it up... :-(
>
> > + return !!(*ptr & big_endian_bit(nr));
>
> Personally I dislike !! as an idiom. Given that big_endian_bit isn't used
> anywhere else, can we integrate it and change this to
>
> static inline int test_facility(unsigned long nr, uint64_t *fac_list)
> {
> unsigned long word = nr / BITS_PER_LONG;
> unsigned long be_bit = 63 - (nr % BITS_PER_LONG);
> return (fac_list[word] >> be_bit) & 1;
> }
Yes, I just use it in this context. I will integrate your version.
BTW I changed the whole facility defining code to be generated by an external
helper at compile
time. That is more simple and safe to change. I will send it with v3. See
attachment for an
example of the generated header file.
Thanks,
Michael
gen-facilities.h
Description: Text Data
[Qemu-devel] [RFC PATCH v2 13/15] cpu-model/s390: Add processor property routines, Michael Mueller, 2015/02/17
- Re: [Qemu-devel] [RFC PATCH v2 13/15] cpu-model/s390: Add processor property routines, Alexander Graf, 2015/02/20
- Re: [Qemu-devel] [RFC PATCH v2 13/15] cpu-model/s390: Add processor property routines, Michael Mueller, 2015/02/20
- Re: [Qemu-devel] [RFC PATCH v2 13/15] cpu-model/s390: Add processor property routines, Andreas Färber, 2015/02/20
- Re: [Qemu-devel] [RFC PATCH v2 13/15] cpu-model/s390: Add processor property routines, Michael Mueller, 2015/02/20
- Re: [Qemu-devel] [RFC PATCH v2 13/15] cpu-model/s390: Add processor property routines, Andreas Färber, 2015/02/20
- Re: [Qemu-devel] [RFC PATCH v2 13/15] cpu-model/s390: Add processor property routines, Michael Mueller, 2015/02/20
Re: [Qemu-devel] [RFC PATCH v2 13/15] cpu-model/s390: Add processor property routines, Michael Mueller, 2015/02/20