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 <behlendorf1@llnl.gov> Closes #7408 Closes #9957 Closes #9967
This commit is contained in:
parent
c14ca1456e
commit
ab16c87e55
|
@ -31,12 +31,19 @@
|
||||||
|
|
||||||
#if defined(__arm__) && !defined(__aarch64__)
|
#if defined(__arm__) && !defined(__aarch64__)
|
||||||
|
|
||||||
|
#if defined(__thumb2__)
|
||||||
|
#define _FUNC_MODE .code 16; .thumb_func
|
||||||
|
#else
|
||||||
|
#define _FUNC_MODE .code 32
|
||||||
|
#endif
|
||||||
|
|
||||||
#define ENTRY(x) \
|
#define ENTRY(x) \
|
||||||
.text; \
|
.text; \
|
||||||
|
.syntax unified; \
|
||||||
.align 2; \
|
.align 2; \
|
||||||
.global x; \
|
.global x; \
|
||||||
.type x,#function; \
|
.type x,#function; \
|
||||||
.code 32; \
|
_FUNC_MODE; \
|
||||||
x:
|
x:
|
||||||
|
|
||||||
#define END(x) \
|
#define END(x) \
|
||||||
|
@ -49,13 +56,23 @@ x:
|
||||||
* setjump + longjmp
|
* setjump + longjmp
|
||||||
*/
|
*/
|
||||||
ENTRY(setjmp)
|
ENTRY(setjmp)
|
||||||
|
#if defined(__thumb2__)
|
||||||
|
mov ip, sp
|
||||||
|
stmia r0, {r4-r12,r14}
|
||||||
|
#else
|
||||||
stmia r0, {r4-r14}
|
stmia r0, {r4-r14}
|
||||||
|
#endif
|
||||||
mov r0, #0x00000000
|
mov r0, #0x00000000
|
||||||
RET
|
RET
|
||||||
END(setjmp)
|
END(setjmp)
|
||||||
|
|
||||||
ENTRY(longjmp)
|
ENTRY(longjmp)
|
||||||
|
#if defined(__thumb2__)
|
||||||
|
ldmia r0, {r4-r12,r14}
|
||||||
|
mov sp, ip
|
||||||
|
#else
|
||||||
ldmia r0, {r4-r14}
|
ldmia r0, {r4-r14}
|
||||||
|
#endif
|
||||||
mov r0, #0x00000001
|
mov r0, #0x00000001
|
||||||
RET
|
RET
|
||||||
END(longjmp)
|
END(longjmp)
|
||||||
|
|
Loading…
Reference in New Issue