reactos/reactos/lib/sdk/crt/setjmp/arm/setjmp.s
Timo Kreuzer febee0a7a2 [CRT]
setjmp is a macro expanding to _setjmp or _setjmpex. In soviet russia and on ARM builds, the compiler will convert invocation of _setjmp back into a call to setjmp. The compiler handles _setjmp and _setjmpex in the same way, generating code where r0 points to the jump_buf and r1 points to the current functions stack frame (sp on function entry). So make setjmp and _setjmp aliases to _setjmpex and make the latter use r1.

svn path=/trunk/; revision=67729
2015-05-14 21:52:45 +00:00

64 lines
1.4 KiB
ArmAsm

/*
* COPYRIGHT: BSD - See COPYING.ARM in the top level directory
* PROJECT: ReactOS CRT library
* PURPOSE: Implementation of _setjmp / longjmp
* PROGRAMMER: Timo Kreuzer (timo.kreuzer@reactos.org)
*/
/* INCLUDES ******************************************************************/
#include <kxarm.h>
/* CODE **********************************************************************/
TEXTAREA
LEAF_ENTRY _setjmpex
/* Store r1 (->Frame) and r4 - r11 */
stmia r0!, {r1,r4-r11}
/* Store sp (->Sp), lr (->Pc), fp (->Fpscr) */
mov r1, sp
stmia r0!, {r1,lr,fp}
/* Store NEON registers */
vst1.64 {d0}, [r0]!
vst1.64 {d1}, [r0]!
vst1.64 {d2}, [r0]!
vst1.64 {d3}, [r0]!
vst1.64 {d4}, [r0]!
vst1.64 {d5}, [r0]!
vst1.64 {d6}, [r0]!
vst1.64 {d7}, [r0]!
/* Return 0 */
mov r0, #0
bx lr
LEAF_END _setjmpex
IMPORT _setjmp, WEAK _setjmpex
IMPORT setjmp, WEAK _setjmpex
LEAF_ENTRY longjmp
ldmia r0!, {r1,r4-r11}
ldmia r0!, {r1,lr,fp}
mov sp, r1
/* Load NEON registers */
vld1.64 {d0}, [r0]!
vld1.64 {d1}, [r0]!
vld1.64 {d2}, [r0]!
vld1.64 {d3}, [r0]!
vld1.64 {d4}, [r0]!
vld1.64 {d5}, [r0]!
vld1.64 {d6}, [r0]!
vld1.64 {d7}, [r0]!
/* Return 1 */
mov r0, #1
bx lr
LEAF_END longjmp
END
/* EOF */