about summary refs log tree commit diff
path: root/sysdeps/unix
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2012-05-23 06:48:05 -0700
committerH.J. Lu <hjl.tools@gmail.com>2012-05-23 06:48:05 -0700
commit1c87aba0f2949199382c193ae584fa034b49a0db (patch)
treecd0d9a2053b410751c549065d0a1359adac032b9 /sysdeps/unix
parentc26705334c4f46420fff2d2cad4f3f37b51d7db6 (diff)
downloadglibc-1c87aba0f2949199382c193ae584fa034b49a0db.tar.gz
glibc-1c87aba0f2949199382c193ae584fa034b49a0db.tar.xz
glibc-1c87aba0f2949199382c193ae584fa034b49a0db.zip
Fix x32 sched_getcpu.S error code
Diffstat (limited to 'sysdeps/unix')
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/x32/sched_getcpu.S12
1 files changed, 8 insertions, 4 deletions
diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/sched_getcpu.S b/sysdeps/unix/sysv/linux/x86_64/x32/sched_getcpu.S
index f3ba9f1c9f..789552ebbb 100644
--- a/sysdeps/unix/sysv/linux/x86_64/x32/sched_getcpu.S
+++ b/sysdeps/unix/sysv/linux/x86_64/x32/sched_getcpu.S
@@ -33,14 +33,18 @@ ENTRY (sched_getcpu)
 
 	call	__getcpu
 
+	/* Local variable is result if the call is successful.  */
+	mov	(%rsp), %edx
+	/* Restore stack pointer before we might jump to
+	   SYSCALL_ERROR_LABEL which returns to the caller.  */
+	add	$0x8, %esp
+	cfi_adjust_cfa_offset(-8)
+
 	cmp	$-4095, %eax
 	jae	SYSCALL_ERROR_LABEL
 
-	mov	(%rsp), %eax
-
+	mov	%edx, %eax
 L(pseudo_end):
-	add	$0x8, %esp
-	cfi_adjust_cfa_offset(-8)
 	ret
 PSEUDO_END(sched_getcpu)
 #endif