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: <00cc71bd-35f5-b0d5-e4fa-8368fe4fe78c@c-s.fr>
Date:   Tue, 27 Aug 2019 20:33:45 +0200
From:   Christophe Leroy <christophe.leroy@....fr>
To:     Segher Boessenkool <segher@...nel.crashing.org>
Cc:     Nicholas Piggin <npiggin@...il.com>,
        Benjamin Herrenschmidt <benh@...nel.crashing.org>,
        Michael Ellerman <mpe@...erman.id.au>,
        Paul Mackerras <paulus@...ba.org>,
        linuxppc-dev@...ts.ozlabs.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/2] powerpc: cleanup hw_irq.h



Le 27/08/2019 à 20:26, Segher Boessenkool a écrit :
> On Tue, Aug 27, 2019 at 07:36:35PM +0200, Christophe Leroy wrote:
>> Le 27/08/2019 à 19:29, Segher Boessenkool a écrit :
>>> On Tue, Aug 27, 2019 at 10:48:24PM +1000, Nicholas Piggin wrote:
>>>> Christophe Leroy's on August 27, 2019 6:13 pm:
>>>>> +#define wrtee(val)	asm volatile("wrtee %0" : : "r" (val) : "memory")
>>>>> +#define wrteei(val)	asm volatile("wrteei %0" : : "i" (val) :
>>>>> "memory")
>>>>
>>>> Can you implement just one macro that uses __builtin_constant_p to
>>>> select between the imm and reg versions? I forgot if there's some
>>>> corner cases that prevent that working with inline asm i constraints.
>>>
>>> static inline void wrtee(long val)
>>> {
>>> 	asm volatile("wrtee%I0 %0" : : "n"(val) : "memory");
>>> }
>>
>> Great, didn't know that possibility.
>>
>> Can it be used with any insn, for instance with add/addi ?
>> Or with mr/li ?
> 
> Any instruction, yes.  %I<n> simply outputs an "i" if operand n is a
> constant integer, and nothing otherwise.

Thinking about it once more, I'm not sure this form is possible, because 
wrteei expect 0 or 1. If someone calls wrtee(MSR_EE); (or any constant 
containing MSR_EE) wrteei 1 is expected. And any constant with MSR_EE 
cleared should result in wrteei 0.

> 
> So
>    asm("add%I2 %0,%1,%2" : "=r"(dst) : "r"(src1), "ri"(src1));

"ri", not "n" as for wrtee ?

Christophe

> works well.  I don't see how you would use it for li/mr...  You can do
>    asm("add%I1 %0,0,%1" : "=r"(dst) : "ri"(src));
> I suppose, but that is not really an mr.
> 
>>> (This output modifier goes back to the dark ages, some 2.4 or something).
>>
>> Hope Clang support it ...
> 
> I don't know, sorry.  But it is used all over the place, see sfp-machine.h
> for example, so maybe?
> 
> 
> Segher
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ