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: <CAKv+Gu8CrMqwqBOF8rYa3RP1=gfCthwP=1k9kQ73v6+Sxwah4A@mail.gmail.com>
Date:	Wed, 28 Jan 2015 16:17:15 +0000
From:	Ard Biesheuvel <ard.biesheuvel@...aro.org>
To:	Alex Elder <elder@...aro.org>
Cc:	Behan Webster <behanw@...verseincode.com>, bcm@...thebug.org,
	Florian Fainelli <f.fainelli@...il.com>,
	Russell King - ARM Linux <linux@....linux.org.uk>,
	Matt Porter <mporter@...aro.org>,
	bcm-kernel-feedback-list@...adcom.com,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"linux-arm-kernel@...ts.infradead.org" 
	<linux-arm-kernel@...ts.infradead.org>
Subject: Re: [PATCH] bcm: address clang inline asm incompatibility

On 28 January 2015 at 14:11, Alex Elder <elder@...aro.org> wrote:
> On 01/28/2015 05:15 AM, Ard Biesheuvel wrote:
>> On 28 January 2015 at 05:18, Behan Webster <behanw@...verseincode.com> wrote:
>>> From: Alex Elder <elder@...aro.org>
>>>
>>> My GCC-based build environment likes to call register r12 by the
>>> name "ip" in inline asm.  Behan Webster informed me that his Clang-
>>> based build environment likes "r12" instead.
>>>
>>> Try to make them both happy.
>>>
>>> Signed-off-by: Alex Elder <elder@...aro.org>
>>> Signed-off-by: Behan Webster <behanw@...verseincode.com>
>>> ---
>>>  arch/arm/mach-bcm/bcm_kona_smc.c | 9 +++++++--
>>>  1 file changed, 7 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/arch/arm/mach-bcm/bcm_kona_smc.c b/arch/arm/mach-bcm/bcm_kona_smc.c
>>> index a55a7ec..3937bd5 100644
>>> --- a/arch/arm/mach-bcm/bcm_kona_smc.c
>>> +++ b/arch/arm/mach-bcm/bcm_kona_smc.c
>>> @@ -106,9 +106,14 @@ int __init bcm_kona_smc_init(void)
>>>   * request result appropriately.  This result value is found in r0
>>>   * when the "smc" request completes.
>>>   */
>>> +#ifdef __clang__
>>> +#define R12    "r12"
>>> +#else  /* !__clang__ */
>>> +#define R12    "ip"    /* gcc calls r12 "ip" */
>>> +#endif /* !__clang__ */
>>
>> Why not just use r12 for both?
>
> Yes, that would have been an obvious fix.  But the
> assembler (in the GCC environment) doesn't accept that.
>

Mine has no problems with it at all

$ echo 'mov r12, #0' | arm-linux-gnueabihf-gcc -c -x assembler-with-cpp -

and grepping for r12 under arch/arm suggests the same

-- 
Ard.



>>>  static int bcm_kona_do_smc(u32 service_id, u32 buffer_phys)
>>>  {
>>> -       register u32 ip asm("ip");      /* Also called r12 */
>>> +       register u32 ip asm(R12);       /* Also called r12 */
>>>         register u32 r0 asm("r0");
>>>         register u32 r4 asm("r4");
>>>         register u32 r5 asm("r5");
>>> @@ -120,7 +125,7 @@ static int bcm_kona_do_smc(u32 service_id, u32 buffer_phys)
>>>
>>>         asm volatile (
>>>                 /* Make sure we got the registers we want */
>>> -               __asmeq("%0", "ip")
>>> +               __asmeq("%0", R12)
>>>                 __asmeq("%1", "r0")
>>>                 __asmeq("%2", "r4")
>>>                 __asmeq("%3", "r5")
>>> --
>>> 1.9.1
>>>
>>>
>>> _______________________________________________
>>> linux-arm-kernel mailing list
>>> linux-arm-kernel@...ts.infradead.org
>>> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
>
--
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