[PATCH 5/5] ARM: findbit: add unwinder information

From: Russell King (Oracle)
Date: Fri Oct 28 2022 - 12:48:51 EST


Add unwinder information so oops in the findbit functions can create a
proper backtrace.

Signed-off-by: Russell King (Oracle) <rmk+kernel@xxxxxxxxxxxxxxx>
---
arch/arm/lib/findbit.S | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/arch/arm/lib/findbit.S b/arch/arm/lib/findbit.S
index 6ec584d16d46..b7ac2d3c0748 100644
--- a/arch/arm/lib/findbit.S
+++ b/arch/arm/lib/findbit.S
@@ -12,6 +12,7 @@
*/
#include <linux/linkage.h>
#include <asm/assembler.h>
+#include <asm/unwind.h>
.text

#ifdef __ARMEB__
@@ -22,6 +23,7 @@

.macro find_first, endian, set, name
ENTRY(_find_first_\name\()bit_\endian)
+ UNWIND( .fnstart)
teq r1, #0
beq 3f
mov r2, #0
@@ -41,11 +43,13 @@ ENTRY(_find_first_\name\()bit_\endian)
blo 1b
3: mov r0, r1 @ no more bits
ret lr
+ UNWIND( .fnend)
ENDPROC(_find_first_\name\()bit_\endian)
.endm

.macro find_next, endian, set, name
ENTRY(_find_next_\name\()bit_\endian)
+ UNWIND( .fnstart)
cmp r2, r1
bhs 3b
mov ip, r2, lsr #5 @ word index
@@ -69,6 +73,7 @@ ENTRY(_find_next_\name\()bit_\endian)
orr r2, r2, #31 @ no zero bits
add r2, r2, #1 @ align bit pointer
b 2b @ loop for next bit
+ UNWIND( .fnend)
ENDPROC(_find_next_\name\()bit_\endian)
.endm

@@ -97,6 +102,7 @@ ENDPROC(_find_next_\name\()bit_\endian)
* One or more bits in the LSB of r3 are assumed to be set.
*/
.L_found_swab:
+ UNWIND( .fnstart)
rev_l r3, ip
.L_found:
#if __LINUX_ARM_ARCH__ >= 7
@@ -130,4 +136,4 @@ ENDPROC(_find_next_\name\()bit_\endian)
cmp r1, r0 @ Clamp to maxbit
movlo r0, r1
ret lr
-
+ UNWIND( .fnend)
--
2.30.2