setjmp: fix setjmp returns 0 when calling longjmp with 0 as the second argument
Signed-off-by: Gao Jiawei <gaojiawei@xiaomi.com>
This commit is contained in:
parent
036a0674db
commit
89d6abf3df
|
@ -170,7 +170,21 @@ longjmp:
|
|||
vmsr fpscr, r2 /* Restore the FPSCR */
|
||||
#endif /* CONFIG_ARCH_FPU */
|
||||
|
||||
mov r0, r1 /* return val */
|
||||
/* Check and substitute the given return value to 1 if it's 0 */
|
||||
|
||||
movs r0, r1
|
||||
#ifdef CONFIG_ARCH_ARMV6M
|
||||
/* ARMv6-M only supports branching with condition
|
||||
* So we fall back to not use IT blocks in that case
|
||||
*/
|
||||
|
||||
bne 1f
|
||||
movs r0, #1
|
||||
1:
|
||||
#else
|
||||
it eq
|
||||
moveq r0, #1
|
||||
#endif
|
||||
bx lr
|
||||
|
||||
.size longjmp, .-longjmp
|
||||
|
|
|
@ -85,9 +85,11 @@ SYMBOL(setjmp):
|
|||
SYMBOL(longjmp):
|
||||
movl 4(%esp), %ecx /* jmpbuf in %ecx. */
|
||||
movl 8(%esp), %eax /* Second argument is return value. */
|
||||
|
||||
testl %eax, %eax
|
||||
jnz 1f
|
||||
incl %eax
|
||||
/* Save the return address now. */
|
||||
|
||||
1:
|
||||
movl (JB_PC)(%ecx), %edx
|
||||
|
||||
/* Restore registers. */
|
||||
|
|
|
@ -130,9 +130,12 @@ SYMBOL(longjmp):
|
|||
/* Setup return value */
|
||||
|
||||
movl %esi,%eax
|
||||
testl %eax,%eax
|
||||
jnz 1f
|
||||
incl %eax
|
||||
|
||||
/* Restore registers */
|
||||
|
||||
1:
|
||||
movq JB_RBX(REGS),%rbx /* Load 1: rbx */
|
||||
movq JB_RSP(REGS),%rsp /* Load 2: rsp */
|
||||
movq JB_RBP(REGS),%rbp /* Load 3: rdi */
|
||||
|
|
Loading…
Reference in New Issue