[PATCH] ARM: bitops
authorRussell King <rmk@dyn-67.arm.linux.org.uk>
Sun, 17 Apr 2005 14:51:02 +0000 (15:51 +0100)
committerRussell King <rmk@dyn-67.arm.linux.org.uk>
Sun, 17 Apr 2005 14:51:02 +0000 (15:51 +0100)
Convert ARM bitop assembly to a macro.  All bitops follow the same
format, so it's silly duplicating the code when only one or two
instructions are different.

Signed-off-by: Russell King <rmk@arm.linux.org.uk>
arch/arm/lib/changebit.S
arch/arm/lib/clearbit.S
arch/arm/lib/setbit.S
arch/arm/lib/testchangebit.S
arch/arm/lib/testclearbit.S
arch/arm/lib/testsetbit.S

index 3af45cab70e1e0c402674362b00738b03b9f44d3..389567c2409026d7d1096e4edf53229241203cb2 100644 (file)
@@ -9,6 +9,7 @@
  */
 #include <linux/linkage.h>
 #include <asm/assembler.h>
+#include "bitops.h"
                 .text
 
 /* Purpose  : Function to change a bit
 ENTRY(_change_bit_be)
                eor     r0, r0, #0x18           @ big endian byte ordering
 ENTRY(_change_bit_le)
-               and     r2, r0, #7
-               mov     r3, #1
-               mov     r3, r3, lsl r2
-               save_and_disable_irqs ip, r2
-               ldrb    r2, [r1, r0, lsr #3]
-               eor     r2, r2, r3
-               strb    r2, [r1, r0, lsr #3]
-               restore_irqs ip
-               RETINSTR(mov,pc,lr)
+       bitop   eor
index 069a2ce413f052e4ed56dde5b13b2f2074dab27f..34751653302559abba02cd82290a2c2f255322d9 100644 (file)
@@ -9,6 +9,7 @@
  */
 #include <linux/linkage.h>
 #include <asm/assembler.h>
+#include "bitops.h"
                 .text
 
 /*
 ENTRY(_clear_bit_be)
                eor     r0, r0, #0x18           @ big endian byte ordering
 ENTRY(_clear_bit_le)
-               and     r2, r0, #7
-               mov     r3, #1
-               mov     r3, r3, lsl r2
-               save_and_disable_irqs ip, r2
-               ldrb    r2, [r1, r0, lsr #3]
-               bic     r2, r2, r3
-               strb    r2, [r1, r0, lsr #3]
-               restore_irqs ip
-               RETINSTR(mov,pc,lr)
-
-
+       bitop   bic
index 8f337df5d99be0de009b469ff72225a321d0bbe2..83bc23d5b0374dd377772aefee4b47cf7841cc85 100644 (file)
@@ -9,6 +9,7 @@
  */
 #include <linux/linkage.h>
 #include <asm/assembler.h>
+#include "bitops.h"
                .text
 
 /*
 ENTRY(_set_bit_be)
                eor     r0, r0, #0x18           @ big endian byte ordering
 ENTRY(_set_bit_le)
-               and     r2, r0, #7
-               mov     r3, #1
-               mov     r3, r3, lsl r2
-               save_and_disable_irqs ip, r2
-               ldrb    r2, [r1, r0, lsr #3]
-               orr     r2, r2, r3
-               strb    r2, [r1, r0, lsr #3]
-               restore_irqs ip
-               RETINSTR(mov,pc,lr)
+       bitop   orr
index 4aba4676b984c9915ed12125a6b0cd27217c107a..b25dcd2be53ec6fc2cba40329890899d35c5a051 100644 (file)
@@ -9,21 +9,10 @@
  */
 #include <linux/linkage.h>
 #include <asm/assembler.h>
+#include "bitops.h"
                 .text
 
 ENTRY(_test_and_change_bit_be)
                eor     r0, r0, #0x18           @ big endian byte ordering
 ENTRY(_test_and_change_bit_le)
-               add     r1, r1, r0, lsr #3
-               and     r3, r0, #7
-               mov     r0, #1
-               save_and_disable_irqs ip, r2
-               ldrb    r2, [r1]
-               tst     r2, r0, lsl r3
-               eor     r2, r2, r0, lsl r3
-               strb    r2, [r1]
-               restore_irqs ip
-               moveq   r0, #0
-               RETINSTR(mov,pc,lr)
-
-
+       testop  eor, strb
index e07c5bd24307152bcb19975168eb32870cf1f33e..2dcc4b16b68ea734da457145ab0718998759d441 100644 (file)
@@ -9,21 +9,10 @@
  */
 #include <linux/linkage.h>
 #include <asm/assembler.h>
+#include "bitops.h"
                 .text
 
 ENTRY(_test_and_clear_bit_be)
                eor     r0, r0, #0x18           @ big endian byte ordering
 ENTRY(_test_and_clear_bit_le)
-               add     r1, r1, r0, lsr #3      @ Get byte offset
-               and     r3, r0, #7              @ Get bit offset
-               mov     r0, #1
-               save_and_disable_irqs ip, r2
-               ldrb    r2, [r1]
-               tst     r2, r0, lsl r3
-               bic     r2, r2, r0, lsl r3
-               strb    r2, [r1]
-               restore_irqs ip
-               moveq   r0, #0
-               RETINSTR(mov,pc,lr)
-
-
+       testop  bicne, strneb
index a570fc74cddd76a2148acaaad5856536d95997a8..9011c969761aa61fec07ccf5298909c85345664c 100644 (file)
@@ -9,21 +9,10 @@
  */
 #include <linux/linkage.h>
 #include <asm/assembler.h>
+#include "bitops.h"
                 .text
 
 ENTRY(_test_and_set_bit_be)
                eor     r0, r0, #0x18           @ big endian byte ordering
 ENTRY(_test_and_set_bit_le)
-               add     r1, r1, r0, lsr #3      @ Get byte offset
-               and     r3, r0, #7              @ Get bit offset
-               mov     r0, #1
-               save_and_disable_irqs ip, r2
-               ldrb    r2, [r1]
-               tst     r2, r0, lsl r3
-               orr     r2, r2, r0, lsl r3
-               strb    r2, [r1]
-               restore_irqs ip
-               moveq   r0, #0
-               RETINSTR(mov,pc,lr)
-
-
+       testop  orreq, streqb