ARM: libroot: fix setjmp/longjmp implementation.

Just a couple of lines of code, but a head full of pain ;-) Finally
got it right and now KDL can properly recover from invalid accesses.
This commit is contained in:
Ithamar R. Adema
2013-09-17 22:26:48 +02:00
parent 7de035619b
commit 740490ba82
2 changed files with 14 additions and 25 deletions
@@ -5,16 +5,13 @@
#include <asm_defs.h> #include <asm_defs.h>
//#include "setjmp_internal.h"
/* int __siglongjmp(jmp_buf buffer, int value) */ /* int __siglongjmp(jmp_buf buffer, int value) */
FUNCTION(siglongjmp): FUNCTION(siglongjmp):
FUNCTION(longjmp): FUNCTION(longjmp):
FUNCTION(_longjmp): FUNCTION(_longjmp):
str r1,[r0] str r1, [r0, #4]
ldmia r0,{r0-r14} ldmia r0, {r0-r14}
bx lr b __longjmp_return
// bl __longjmp_return
FUNCTION_END(siglongjmp) FUNCTION_END(siglongjmp)
FUNCTION_END(longjmp) FUNCTION_END(longjmp)
FUNCTION_END(_longjmp) FUNCTION_END(_longjmp)
+11 -19
View File
@@ -5,33 +5,25 @@
#include <asm_defs.h> #include <asm_defs.h>
//#include "setjmp_internal.h"
/* int sigsetjmp(jmp_buf buffer, int saveMask) */ /* int sigsetjmp(jmp_buf buffer, int saveMask) */
FUNCTION(__sigsetjmp): FUNCTION(__sigsetjmp):
FUNCTION(sigsetjmp): FUNCTION(sigsetjmp):
stmdb sp!, {r4, lr} stmia r0, {r0-r14}
stmia r0, {r0-r14} mrs r1, cpsr
str lr,[r0, #60] str r1, [r0, #64]
mrs r1,cpsr ldr r1, [r0, #4]
str r1,[r0,#64] b __setjmp_save_sigs
ldr r1,[r0,#4]
mov r0, #0
bl __setjmp_save_sigs
ldmia sp!, {r4, pc}
FUNCTION_END(__sigsetjmp)
FUNCTION_END(sigsetjmp) FUNCTION_END(sigsetjmp)
FUNCTION_END(__sigsetjmp)
/* int setjmp(jmp_buf buffer) */ /* int setjmp(jmp_buf buffer) */
FUNCTION(setjmp): FUNCTION(setjmp):
stmia r0, {r0-r14} stmia r0, {r0-r14}
str lr,[r0, #60] mrs r1, cpsr
mrs r1,cpsr str r1, [r0, #64]
str r1,[r0,#64] ldr r1, [r0, #4]
ldr r1,[r0,#4] mov r0, #0
mov r0, #0
bx lr bx lr
FUNCTION_END(setjmp) FUNCTION_END(setjmp)