Skip to content

Commit f981862

Browse files
behlendorfawehrfritz
authored andcommitted
Add longjmp support for Thumb-2
When a Thumb-2 kernel is being used, then longjmp must be implemented using the Thumb-2 instruction set in module/lua/setjmp/setjmp_arm.S. Original-patch-by: @jsrlabs Reviewed-by: @awehrfritz Signed-off-by: Brian Behlendorf <[email protected]> Closes openzfs#7408 Closes openzfs#9957 Closes openzfs#9967
1 parent 6b18d7d commit f981862

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

module/lua/setjmp/setjmp_arm.S

+18-1
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,19 @@
3131

3232
#if defined(__arm__) && !defined(__aarch64__)
3333

34+
#if defined(__thumb2__)
35+
#define _FUNC_MODE .code 16; .thumb_func
36+
#else
37+
#define _FUNC_MODE .code 32
38+
#endif
39+
3440
#define ENTRY(x) \
3541
.text; \
42+
.syntax unified; \
3643
.align 2; \
3744
.global x; \
3845
.type x,#function; \
39-
.code 32; \
46+
_FUNC_MODE; \
4047
x:
4148

4249
#define END(x) \
@@ -49,13 +56,23 @@ x:
4956
* setjump + longjmp
5057
*/
5158
ENTRY(setjmp)
59+
#if defined(__thumb2__)
60+
mov ip, sp
61+
stmia r0, {r4-r12,r14}
62+
#else
5263
stmia r0, {r4-r14}
64+
#endif
5365
mov r0, #0x00000000
5466
RET
5567
END(setjmp)
5668

5769
ENTRY(longjmp)
70+
#if defined(__thumb2__)
71+
ldmia r0, {r4-r12,r14}
72+
mov sp, ip
73+
#else
5874
ldmia r0, {r4-r14}
75+
#endif
5976
mov r0, #0x00000001
6077
RET
6178
END(longjmp)

0 commit comments

Comments
 (0)