parisc: Provide an extru_safe() macro to extract unsigned bits
authorHelge Deller <deller@gmx.de>
Fri, 19 Nov 2021 21:16:37 +0000 (22:16 +0100)
committerHelge Deller <deller@gmx.de>
Mon, 22 Nov 2021 06:37:31 +0000 (07:37 +0100)
The extru instruction leaves the most significant 32 bits of the
target register in an undefined state on PA 2.0 systems.
Provide a macro to safely use extru on 32- and 64-bit machines.

Suggested-by: John David Anglin <dave.anglin@bell.net>
Signed-off-by: Helge Deller <deller@gmx.de>
arch/parisc/include/asm/assembly.h

index 39e7985..6d13ae2 100644 (file)
        extrd,u \r, 63-(\sa), 64-(\sa), \t
        .endm
 
+       /* Extract unsigned for 32- and 64-bit
+        * The extru instruction leaves the most significant 32 bits of the
+        * target register in an undefined state on PA 2.0 systems. */
+       .macro extru_safe r, p, len, t
+#ifdef CONFIG_64BIT
+       extrd,u \r, 32+(\p), \len, \t
+#else
+       extru   \r, \p, \len, \t
+#endif
+       .endm
+
        /* load 32-bit 'value' into 'reg' compensating for the ldil
         * sign-extension when running in wide mode.
         * WARNING!! neither 'value' nor 'reg' can be expressions