diff mbox

[1/6] PPC: Add asm helpers for BE 32bit load/store

Message ID 1402482831-8941-2-git-send-email-agraf@suse.de (mailing list archive)
State New, archived
Headers show

Commit Message

Alexander Graf June 11, 2014, 10:33 a.m. UTC
From assembly code we might not only have to explicitly BE access 64bit values,
but sometimes also 32bit ones. Add helpers that allow for easy use of lwzx/stwx
in their respective byte-reverse or native form.

Signed-off-by: Alexander Graf <agraf@suse.de>
CC: Benjamin Herrenschmidt <benh@kernel.crashing.org>
---
 arch/powerpc/include/asm/asm-compat.h | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Paul Mackerras June 17, 2014, 12:51 a.m. UTC | #1
On Wed, Jun 11, 2014 at 12:33:46PM +0200, Alexander Graf wrote:
> >From assembly code we might not only have to explicitly BE access 64bit values,
> but sometimes also 32bit ones. Add helpers that allow for easy use of lwzx/stwx
> in their respective byte-reverse or native form.
> 
> Signed-off-by: Alexander Graf <agraf@suse.de>
> CC: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> ---
>  arch/powerpc/include/asm/asm-compat.h | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/arch/powerpc/include/asm/asm-compat.h b/arch/powerpc/include/asm/asm-compat.h
> index 4b237aa..21164ff 100644
> --- a/arch/powerpc/include/asm/asm-compat.h
> +++ b/arch/powerpc/include/asm/asm-compat.h
> @@ -34,10 +34,14 @@
>  #define PPC_MIN_STKFRM	112
>  
>  #ifdef __BIG_ENDIAN__
> +#define LWZX_BE	stringify_in_c(lwzx)
>  #define LDX_BE	stringify_in_c(ldx)
> +#define STDX_BE	stringify_in_c(stwx)

This should be STWX_BE, shouldn't it?

>  #define STDX_BE	stringify_in_c(stdx)
>  #else
> +#define LWZX_BE	stringify_in_c(lwbrx)
>  #define LDX_BE	stringify_in_c(ldbrx)
> +#define STWX_BE	stringify_in_c(stwbrx)
>  #define STDX_BE	stringify_in_c(stdbrx)
>  #endif

Paul.
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Alexander Graf June 17, 2014, 8:34 a.m. UTC | #2
On 17.06.14 02:51, Paul Mackerras wrote:
> On Wed, Jun 11, 2014 at 12:33:46PM +0200, Alexander Graf wrote:
>> >From assembly code we might not only have to explicitly BE access 64bit values,
>> but sometimes also 32bit ones. Add helpers that allow for easy use of lwzx/stwx
>> in their respective byte-reverse or native form.
>>
>> Signed-off-by: Alexander Graf <agraf@suse.de>
>> CC: Benjamin Herrenschmidt <benh@kernel.crashing.org>
>> ---
>>   arch/powerpc/include/asm/asm-compat.h | 4 ++++
>>   1 file changed, 4 insertions(+)
>>
>> diff --git a/arch/powerpc/include/asm/asm-compat.h b/arch/powerpc/include/asm/asm-compat.h
>> index 4b237aa..21164ff 100644
>> --- a/arch/powerpc/include/asm/asm-compat.h
>> +++ b/arch/powerpc/include/asm/asm-compat.h
>> @@ -34,10 +34,14 @@
>>   #define PPC_MIN_STKFRM	112
>>   
>>   #ifdef __BIG_ENDIAN__
>> +#define LWZX_BE	stringify_in_c(lwzx)
>>   #define LDX_BE	stringify_in_c(ldx)
>> +#define STDX_BE	stringify_in_c(stwx)
> This should be STWX_BE, shouldn't it?

And there I thought I would get away without anyone noticing it :). Yes, 
of course.


Alex

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/arch/powerpc/include/asm/asm-compat.h b/arch/powerpc/include/asm/asm-compat.h
index 4b237aa..21164ff 100644
--- a/arch/powerpc/include/asm/asm-compat.h
+++ b/arch/powerpc/include/asm/asm-compat.h
@@ -34,10 +34,14 @@ 
 #define PPC_MIN_STKFRM	112
 
 #ifdef __BIG_ENDIAN__
+#define LWZX_BE	stringify_in_c(lwzx)
 #define LDX_BE	stringify_in_c(ldx)
+#define STDX_BE	stringify_in_c(stwx)
 #define STDX_BE	stringify_in_c(stdx)
 #else
+#define LWZX_BE	stringify_in_c(lwbrx)
 #define LDX_BE	stringify_in_c(ldbrx)
+#define STWX_BE	stringify_in_c(stwbrx)
 #define STDX_BE	stringify_in_c(stdbrx)
 #endif