Skip to contentSkip to conversation

Use REV and REV16 for byte swapping on ARMv6+

PATCH New Rabin Vincent 4 participants 7 messages Oct 24, 2009 – Nov 3, 2009 Arm (32-bit)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Use REV and REV16 for byte swapping on ARMv6+

ARMv6 introduced the REV and REV16 instructions that reverse bytes in words and halfwords. Use them for the arch-specific implementation of the byte swapping helpers on ARMv6+.

---
 arch/arm/include/asm/swab.h |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)
arch/arm/include/asm/swab.h +19 -0
index ca2bf2f..9997ad2 100644
@@ -22,6 +22,24 @@
 #  define __SWAB_64_THRU_32__
 #endif
 
+#if defined(__KERNEL__) && __LINUX_ARM_ARCH__ >= 6
+
+static inline __attribute_const__ __u16 __arch_swab16(__u16 x)
+{
+	__asm__ ("rev16 %0, %1" : "=r" (x) : "r" (x));
+	return x;
+}
+#define __arch_swab16 __arch_swab16
+
+static inline __attribute_const__ __u32 __arch_swab32(__u32 x)
+{
+	__asm__ ("rev %0, %1" : "=r" (x) : "r" (x));
+	return x;
+}
+#define __arch_swab32 __arch_swab32
+
+#else
+
 static inline __attribute_const__ __u32 __arch_swab32(__u32 x)
 {
 	__u32 t;
@@ -48,3 +66,4 @@ static inline __attribute_const__ __u32 __arch_swab32(__u32 x)
 
 #endif
 
+#endif
Signature · 1 line
1.6.5
#1 lore raw

PATCH 1/1 Use REV and REV16 for byte swapping on ARMv6+

Quoted 3 lines · Rabin Vincent

ARMv6 introduced the REV and REV16 instructions that reverse bytes in words and halfwords. Use them for the arch-specific implementation of the byte swapping helpers on ARMv6+.

Please submit to the patch system. Note that you can now use this format, and just put the "KernelVersion:" header somewhere in before the 'diff' line.

Quoted 48 lines
---
 arch/arm/include/asm/swab.h |   19 +++++++++++++++++++
 1 files changed, 19 insertions(+), 0 deletions(-)
arch/arm/include/asm/swab.h +19 -0
index ca2bf2f..9997ad2 100644
@@ -22,6 +22,24 @@
 #  define __SWAB_64_THRU_32__
 #endif
 
+#if defined(__KERNEL__) && __LINUX_ARM_ARCH__ >= 6
+
+static inline __attribute_const__ __u16 __arch_swab16(__u16 x)
+{
+	__asm__ ("rev16 %0, %1" : "=r" (x) : "r" (x));
+	return x;
+}
+#define __arch_swab16 __arch_swab16
+
+static inline __attribute_const__ __u32 __arch_swab32(__u32 x)
+{
+	__asm__ ("rev %0, %1" : "=r" (x) : "r" (x));
+	return x;
+}
+#define __arch_swab32 __arch_swab32
+
+#else
+
 static inline __attribute_const__ __u32 __arch_swab32(__u32 x)
 {
 	__u32 t;
@@ -48,3 +66,4 @@ static inline __attribute_const__ __u32 __arch_swab32(__u32 x)
 
 #endif
 
+#endif
Signature · 7 lines
1.6.5


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
#2 lore raw

PATCH 1/1 Use REV and REV16 for byte swapping on ARMv6+

Quoted 8 lines · Russell King - ARM Linux
Quoted 3 lines · Rabin Vincent

ARMv6 introduced the REV and REV16 instructions that reverse bytes in words and halfwords. Use them for the arch-specific implementation of the byte swapping helpers on ARMv6+.

Please submit to the patch system. Note that you can now use this format, and just put the "KernelVersion:" header somewhere in before the 'diff' line.

(OT) Does it also now parse a "From:" line (if the author differs from the sender)?

Signature · 1 line
Catalin
#3 lore raw

PATCH 1/1 Use REV and REV16 for byte swapping on ARMv6+

Quoted 6 lines · Catalin Marinas
Quoted 5 lines · Russell King - ARM Linux
Quoted 3 lines · Rabin Vincent

ARMv6 introduced the REV and REV16 instructions that reverse bytes in words and halfwords. Use them for the arch-specific implementation of the byte swapping helpers on ARMv6+.

Quoted 6 lines
Quoted 3 lines

Please submit to the patch system. Note that you can now use this format, and just put the "KernelVersion:" header somewhere in before the 'diff' line.

(OT) Does it also now parse a "From:" line (if the author differs from the sender)?

No. Reasons explained previously.

#4 lore raw

patch system doesn't parse From: pseudo header (Was: [PATCH] Use REV and REV16 for byte swapping on ARMv6+)

Hello,

Quoted 7 lines · Russell King - ARM Linux
Quoted 6 lines · Catalin Marinas
Quoted 5 lines · Russell King - ARM Linux
Quoted 3 lines · Rabin Vincent

ARMv6 introduced the REV and REV16 instructions that reverse bytes in words and halfwords. Use them for the arch-specific implementation of the byte swapping helpers on ARMv6+.

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

Please submit to the patch system. Note that you can now use this format, and just put the "KernelVersion:" header somewhere in before the 'diff' line.

(OT) Does it also now parse a "From:" line (if the author differs from the sender)?

No. Reasons explained previously.

Hmm, it's hard to search for From: in the archives, so the best hit I found is:

	http://thread.gmane.org/gmane.linux.ports.arm.kernel/32274/focus=32651

Is it that you mean?

I would make use of such a pseudo header, too. From time to time I mainline patches created by colleagues. So in the end it's me who adds the patch even though I'm not the author.

I don't know how your patch system works but if you point me to its source I might have a look how to implement it.

Best regards
Uwe

Signature · 2 lines
Pengutronix e.K.                              | Uwe Kleine-K?nig            |
Industrial Linux Solutions                    | http://www.pengutronix.de/  |
#5 lore raw

patch system doesn't parse From: pseudo header (Was: [PATCH] Use REV and REV16 for byte swapping on ARMv6+)

Quoted 6 lines · Uwe Kleine-K?nig

Hmm, it's hard to search for From: in the archives, so the best hit I found is:

	http://thread.gmane.org/gmane.linux.ports.arm.kernel/32274/focus=32651

Is it that you mean?

Sorry, no idea which you mean, elinks doesn't display any text other than the thread listing for gmane stuff, so no idea which message you're suggesting I look at.

#6 lore raw

patch system doesn't parse From: pseudo header (Was: [PATCH] Use REV and REV16 for byte swapping on ARMv6+)

Quoted 11 lines · Russell King - ARM Linux
Quoted 6 lines · Uwe Kleine-K?nig

Hmm, it's hard to search for From: in the archives, so the best hit I found is:

	http://thread.gmane.org/gmane.linux.ports.arm.kernel/32274/focus=32651

Is it that you mean?

Sorry, no idea which you mean, elinks doesn't display any text other than the thread listing for gmane stuff, so no idea which message you're suggesting I look at.

yeah, you need javascript to see that---quite annoying I know.

http://article.gmane.org/gmane.linux.ports.arm.kernel/32651

Best regards
Uwe

Signature · 2 lines
Pengutronix e.K.                              | Uwe Kleine-K?nig            |
Industrial Linux Solutions                    | http://www.pengutronix.de/  |