diff options
author | Brian Behlendorf <[email protected]> | 2020-04-29 17:30:13 -0700 |
---|---|---|
committer | GitHub <[email protected]> | 2020-04-29 17:30:13 -0700 |
commit | ab16c87e5560b5d8554386cfaded72e7f61465b8 (patch) | |
tree | 61317f853596376ed8be3c91e5f910dfd5a59d8e /module/lua/setjmp | |
parent | c14ca1456e6e7b2fdfd7578207c7f1866c852a77 (diff) |
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 #7408
Closes #9957
Closes #9967
Diffstat (limited to 'module/lua/setjmp')
-rw-r--r-- | module/lua/setjmp/setjmp_arm.S | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/module/lua/setjmp/setjmp_arm.S b/module/lua/setjmp/setjmp_arm.S index 8c08f4e6f..78bc3e0b3 100644 --- a/module/lua/setjmp/setjmp_arm.S +++ b/module/lua/setjmp/setjmp_arm.S @@ -31,12 +31,19 @@ #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) \ .text; \ + .syntax unified; \ .align 2; \ .global x; \ .type x,#function; \ - .code 32; \ + _FUNC_MODE; \ x: #define END(x) \ @@ -49,13 +56,23 @@ x: * setjump + longjmp */ ENTRY(setjmp) +#if defined(__thumb2__) + mov ip, sp + stmia r0, {r4-r12,r14} +#else stmia r0, {r4-r14} +#endif mov r0, #0x00000000 RET END(setjmp) ENTRY(longjmp) +#if defined(__thumb2__) + ldmia r0, {r4-r12,r14} + mov sp, ip +#else ldmia r0, {r4-r14} +#endif mov r0, #0x00000001 RET END(longjmp) |