about summary refs log tree commit diff
path: root/sysdeps/unix/sysv/linux
diff options
context:
space:
mode:
authorAndreas Jaeger <jaegerandi@gmail.com>2012-05-22 22:35:04 +0200
committerAndreas Jaeger <jaegerandi@gmail.com>2012-05-22 22:35:04 +0200
commit73338355920056d87648c65ccba9a875c289b37e (patch)
tree2aa5dbbe6c8a8b57cda3e21c9f6e05fd734feca7 /sysdeps/unix/sysv/linux
parente2d6cea0a17ecd7ed32b2137e38d44d956d09316 (diff)
downloadglibc-73338355920056d87648c65ccba9a875c289b37e.tar.gz
glibc-73338355920056d87648c65ccba9a875c289b37e.tar.xz
glibc-73338355920056d87648c65ccba9a875c289b37e.zip
Fix x86_64/sched_getcpu.S error code
Rearrange code so that pseudo_end is just ret and the stack pointer
is correct also for static library in error case.
Diffstat (limited to 'sysdeps/unix/sysv/linux')
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/sched_getcpu.S14
1 files changed, 9 insertions, 5 deletions
diff --git a/sysdeps/unix/sysv/linux/x86_64/sched_getcpu.S b/sysdeps/unix/sysv/linux/x86_64/sched_getcpu.S
index 4c3cebe88e..896deb0653 100644
--- a/sysdeps/unix/sysv/linux/x86_64/sched_getcpu.S
+++ b/sysdeps/unix/sysv/linux/x86_64/sched_getcpu.S
@@ -1,4 +1,4 @@
-/* Copyright (C) 2007, 2011 Free Software Foundation, Inc.
+/* Copyright (C) 2007-2012 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -59,13 +59,17 @@ ENTRY (sched_getcpu)
 # endif
 #endif
 
+	/* Local variable is result if the call is successful.  */
+	movl	(%rsp), %edx
+	/* Restore stack pointer before we might jump to
+	SYSCALL_ERROR_LABEL which returns to the caller.  */
+	add	$0x8, %rsp
+	cfi_adjust_cfa_offset(-8)
+
 	cmpq	$-4095, %rax
 	jae	SYSCALL_ERROR_LABEL
 
-	movl	(%rsp), %eax
-
+	movl	%edx, %eax
 L(pseudo_end):
-	add	$0x8, %rsp
-	cfi_adjust_cfa_offset(-8)
 	ret
 PSEUDO_END(sched_getcpu)