aboutsummaryrefslogtreecommitdiff
path: root/arch/x86
diff options
context:
space:
mode:
authorHeinrich Schuchardt <heinrich.schuchardt@canonical.com>2022-10-01 15:00:21 +0200
committerSimon Glass <sjg@chromium.org>2022-10-29 07:36:33 -0600
commitfc872ee84cd5dd3a74bf51ce6519377b0de4940f (patch)
tree728ae66faf9f4463cad57cb5d0c13babd1dc5a28 /arch/x86
parent1fcfadcb82a21af058baa5dea2b20883b8c388b8 (diff)
downloadu-boot-fc872ee84cd5dd3a74bf51ce6519377b0de4940f.zip
u-boot-fc872ee84cd5dd3a74bf51ce6519377b0de4940f.tar.gz
u-boot-fc872ee84cd5dd3a74bf51ce6519377b0de4940f.tar.bz2
x86: fix longjmp() implementation
If longjmp(jmp_buf env, int val) is called with val = 0, the setjmp() macro must return 1. Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'arch/x86')
-rw-r--r--arch/x86/cpu/i386/setjmp.S5
1 files changed, 5 insertions, 0 deletions
diff --git a/arch/x86/cpu/i386/setjmp.S b/arch/x86/cpu/i386/setjmp.S
index 40b10dc..eceeafa 100644
--- a/arch/x86/cpu/i386/setjmp.S
+++ b/arch/x86/cpu/i386/setjmp.S
@@ -49,12 +49,17 @@ longjmp:
xchgl %eax, %edx
#else
movl 4(%esp), %edx /* jmp_ptr address */
+ movl 8(%esp), %eax /* Return value */
#endif
movl (%edx), %ebx
movl 4(%edx), %esp
movl 8(%edx), %ebp
movl 12(%edx), %esi
movl 16(%edx), %edi
+ test %eax, %eax
+ jnz nz
+ inc %eax
+nz:
jmp *20(%edx)
.size longjmp, .-longjmp