diff options
Diffstat (limited to 'arch/arm/lib/findbit.S')
-rw-r--r-- | arch/arm/lib/findbit.S | 34 |
1 files changed, 26 insertions, 8 deletions
diff --git a/arch/arm/lib/findbit.S b/arch/arm/lib/findbit.S index 8c4defc4f3c4..1e4cbd4e7be9 100644 --- a/arch/arm/lib/findbit.S +++ b/arch/arm/lib/findbit.S | |||
@@ -25,7 +25,10 @@ ENTRY(_find_first_zero_bit_le) | |||
25 | teq r1, #0 | 25 | teq r1, #0 |
26 | beq 3f | 26 | beq 3f |
27 | mov r2, #0 | 27 | mov r2, #0 |
28 | 1: ldrb r3, [r0, r2, lsr #3] | 28 | 1: |
29 | ARM( ldrb r3, [r0, r2, lsr #3] ) | ||
30 | THUMB( lsr r3, r2, #3 ) | ||
31 | THUMB( ldrb r3, [r0, r3] ) | ||
29 | eors r3, r3, #0xff @ invert bits | 32 | eors r3, r3, #0xff @ invert bits |
30 | bne .L_found @ any now set - found zero bit | 33 | bne .L_found @ any now set - found zero bit |
31 | add r2, r2, #8 @ next bit pointer | 34 | add r2, r2, #8 @ next bit pointer |
@@ -44,7 +47,9 @@ ENTRY(_find_next_zero_bit_le) | |||
44 | beq 3b | 47 | beq 3b |
45 | ands ip, r2, #7 | 48 | ands ip, r2, #7 |
46 | beq 1b @ If new byte, goto old routine | 49 | beq 1b @ If new byte, goto old routine |
47 | ldrb r3, [r0, r2, lsr #3] | 50 | ARM( ldrb r3, [r0, r2, lsr #3] ) |
51 | THUMB( lsr r3, r2, #3 ) | ||
52 | THUMB( ldrb r3, [r0, r3] ) | ||
48 | eor r3, r3, #0xff @ now looking for a 1 bit | 53 | eor r3, r3, #0xff @ now looking for a 1 bit |
49 | movs r3, r3, lsr ip @ shift off unused bits | 54 | movs r3, r3, lsr ip @ shift off unused bits |
50 | bne .L_found | 55 | bne .L_found |
@@ -61,7 +66,10 @@ ENTRY(_find_first_bit_le) | |||
61 | teq r1, #0 | 66 | teq r1, #0 |
62 | beq 3f | 67 | beq 3f |
63 | mov r2, #0 | 68 | mov r2, #0 |
64 | 1: ldrb r3, [r0, r2, lsr #3] | 69 | 1: |
70 | ARM( ldrb r3, [r0, r2, lsr #3] ) | ||
71 | THUMB( lsr r3, r2, #3 ) | ||
72 | THUMB( ldrb r3, [r0, r3] ) | ||
65 | movs r3, r3 | 73 | movs r3, r3 |
66 | bne .L_found @ any now set - found zero bit | 74 | bne .L_found @ any now set - found zero bit |
67 | add r2, r2, #8 @ next bit pointer | 75 | add r2, r2, #8 @ next bit pointer |
@@ -80,7 +88,9 @@ ENTRY(_find_next_bit_le) | |||
80 | beq 3b | 88 | beq 3b |
81 | ands ip, r2, #7 | 89 | ands ip, r2, #7 |
82 | beq 1b @ If new byte, goto old routine | 90 | beq 1b @ If new byte, goto old routine |
83 | ldrb r3, [r0, r2, lsr #3] | 91 | ARM( ldrb r3, [r0, r2, lsr #3] ) |
92 | THUMB( lsr r3, r2, #3 ) | ||
93 | THUMB( ldrb r3, [r0, r3] ) | ||
84 | movs r3, r3, lsr ip @ shift off unused bits | 94 | movs r3, r3, lsr ip @ shift off unused bits |
85 | bne .L_found | 95 | bne .L_found |
86 | orr r2, r2, #7 @ if zero, then no bits here | 96 | orr r2, r2, #7 @ if zero, then no bits here |
@@ -95,7 +105,9 @@ ENTRY(_find_first_zero_bit_be) | |||
95 | beq 3f | 105 | beq 3f |
96 | mov r2, #0 | 106 | mov r2, #0 |
97 | 1: eor r3, r2, #0x18 @ big endian byte ordering | 107 | 1: eor r3, r2, #0x18 @ big endian byte ordering |
98 | ldrb r3, [r0, r3, lsr #3] | 108 | ARM( ldrb r3, [r0, r3, lsr #3] ) |
109 | THUMB( lsr r3, #3 ) | ||
110 | THUMB( ldrb r3, [r0, r3] ) | ||
99 | eors r3, r3, #0xff @ invert bits | 111 | eors r3, r3, #0xff @ invert bits |
100 | bne .L_found @ any now set - found zero bit | 112 | bne .L_found @ any now set - found zero bit |
101 | add r2, r2, #8 @ next bit pointer | 113 | add r2, r2, #8 @ next bit pointer |
@@ -111,7 +123,9 @@ ENTRY(_find_next_zero_bit_be) | |||
111 | ands ip, r2, #7 | 123 | ands ip, r2, #7 |
112 | beq 1b @ If new byte, goto old routine | 124 | beq 1b @ If new byte, goto old routine |
113 | eor r3, r2, #0x18 @ big endian byte ordering | 125 | eor r3, r2, #0x18 @ big endian byte ordering |
114 | ldrb r3, [r0, r3, lsr #3] | 126 | ARM( ldrb r3, [r0, r3, lsr #3] ) |
127 | THUMB( lsr r3, #3 ) | ||
128 | THUMB( ldrb r3, [r0, r3] ) | ||
115 | eor r3, r3, #0xff @ now looking for a 1 bit | 129 | eor r3, r3, #0xff @ now looking for a 1 bit |
116 | movs r3, r3, lsr ip @ shift off unused bits | 130 | movs r3, r3, lsr ip @ shift off unused bits |
117 | bne .L_found | 131 | bne .L_found |
@@ -125,7 +139,9 @@ ENTRY(_find_first_bit_be) | |||
125 | beq 3f | 139 | beq 3f |
126 | mov r2, #0 | 140 | mov r2, #0 |
127 | 1: eor r3, r2, #0x18 @ big endian byte ordering | 141 | 1: eor r3, r2, #0x18 @ big endian byte ordering |
128 | ldrb r3, [r0, r3, lsr #3] | 142 | ARM( ldrb r3, [r0, r3, lsr #3] ) |
143 | THUMB( lsr r3, #3 ) | ||
144 | THUMB( ldrb r3, [r0, r3] ) | ||
129 | movs r3, r3 | 145 | movs r3, r3 |
130 | bne .L_found @ any now set - found zero bit | 146 | bne .L_found @ any now set - found zero bit |
131 | add r2, r2, #8 @ next bit pointer | 147 | add r2, r2, #8 @ next bit pointer |
@@ -141,7 +157,9 @@ ENTRY(_find_next_bit_be) | |||
141 | ands ip, r2, #7 | 157 | ands ip, r2, #7 |
142 | beq 1b @ If new byte, goto old routine | 158 | beq 1b @ If new byte, goto old routine |
143 | eor r3, r2, #0x18 @ big endian byte ordering | 159 | eor r3, r2, #0x18 @ big endian byte ordering |
144 | ldrb r3, [r0, r3, lsr #3] | 160 | ARM( ldrb r3, [r0, r3, lsr #3] ) |
161 | THUMB( lsr r3, #3 ) | ||
162 | THUMB( ldrb r3, [r0, r3] ) | ||
145 | movs r3, r3, lsr ip @ shift off unused bits | 163 | movs r3, r3, lsr ip @ shift off unused bits |
146 | bne .L_found | 164 | bne .L_found |
147 | orr r2, r2, #7 @ if zero, then no bits here | 165 | orr r2, r2, #7 @ if zero, then no bits here |