klibc-bot for Thorsten Glaser
2012-Oct-01 13:03 UTC
[klibc] [klibc:master] arm: fix trashing of callee-saved registers in thumb setjmp()
Commit-ID: 9bdffde924573bf1c2f795a4b57a302d9485d248 Gitweb: http://git.kernel.org/?p=libs/klibc/klibc.git;a=commit;h=9bdffde924573bf1c2f795a4b57a302d9485d248 Author: Thorsten Glaser <tg at mirbsd.org> AuthorDate: Sat, 29 Sep 2012 19:20:37 +0000 Committer: maximilian attems <max at stro.at> CommitDate: Mon, 1 Oct 2012 14:54:10 +0200 [klibc] arm: fix trashing of callee-saved registers in thumb setjmp() fixes http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=634890 (although dynamically-linked binaries seem to have another bug) Signed-off-by: Thorsten Glaser <tg at mirbsd.org> Signed-off-by: maximilian attems <max at stro.at> --- usr/klibc/arch/arm/setjmp.S | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/usr/klibc/arch/arm/setjmp.S b/usr/klibc/arch/arm/setjmp.S index d351e0e..92ffc43 100644 --- a/usr/klibc/arch/arm/setjmp.S +++ b/usr/klibc/arch/arm/setjmp.S @@ -70,6 +70,7 @@ longjmp: .type setjmp, #function .thumb_func setjmp: + mov r2, r0 mov r3, lr stmia r0!, {r3, r4, r5, r6, r7} mov r3, r8 @@ -78,6 +79,8 @@ setjmp: mov r6, fp mov r7, sp stmia r0!, {r3, r4, r5, r6, r7} + /* Do not trash r4 .. r7 */ + ldmia r2!, {r3, r4, r5, r6, r7} mov r0, #0 BX(lr) .size setjmp,.-setjmp