lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <5F2B0AC8-FE9F-4107-90DA-B2E6A3C262EC@suse.de>
Date:	Fri, 20 Feb 2015 20:21:45 +0100
From:	Alexander Graf <agraf@...e.de>
To:	Michael Mueller <mimu@...ux.vnet.ibm.com>
Cc:	Richard Henderson <rth@...ddle.net>,
	"qemu-devel@...gnu.org" <qemu-devel@...gnu.org>,
	"kvm@...r.kernel.org" <kvm@...r.kernel.org>,
	"linux-s390@...r.kernel.org" <linux-s390@...r.kernel.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	Gleb Natapov <gleb@...nel.org>,
	Christian Borntraeger <borntraeger@...ibm.com>,
	"Jason J. Herne" <jjherne@...ux.vnet.ibm.com>,
	Cornelia Huck <cornelia.huck@...ibm.com>,
	Paolo Bonzini <pbonzini@...hat.com>,
	Andreas Faerber <afaerber@...e.de>
Subject: Re: [Qemu-devel] [RFC PATCH v2 10/15] cpu-model/s390: Add cpu class initialization routines




> Am 20.02.2015 um 19:59 schrieb Michael Mueller <mimu@...ux.vnet.ibm.com>:
> 
> On Fri, 20 Feb 2015 10:11:55 -0800
> Richard Henderson <rth@...ddle.net> 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.

Please make sure to use ULL with constants and uint64_t on variables. Long is almost always wrong in QEMU.

Alex

> 
> Thanks,
> Michael
> 
> <gen-facilities.h>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ