This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix x86_64/sched_getcpu.S error code



HJ, we need the same fix for the x32 version of the file - could you test and commit, please?


Thanks,
Andreas

On 05/22/2012 10:08 PM, Andreas Jaeger wrote:

As discussed with Roland (see sysdep.h) the function is wrong in the static case.

Tested on Linux/x86-64.

Ok to commit?
Andreas

2012-05-22 Andreas Jaeger<aj@suse.de>

	* sysdeps/unix/sysv/linux/x86_64/sched_getcpu.S: Rearrange code so
	that pseudo_end is just ret and the stack pointer is correct also
	for static library in error case.

diff --git a/sysdeps/unix/sysv/linux/x86_64/sched_getcpu.S b/sysdeps/unix/sysv/linux/x86_64/sched_getcpu.S
index 4c3cebe..8ce51b5 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,16 @@ ENTRY (sched_getcpu)
  # endif
  #endif

+	/* Local variable is result if call is successfull.  */
+	movl	(%rsp), %edx
+	/* Restore stack pointer.  */
+	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)



--
 Andreas Jaeger aj@{suse.com,opensuse.org} Twitter/Identica: jaegerandi
  SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 NÃrnberg, Germany
   GF: Jeff Hawn,Jennifer Guild,Felix ImendÃrffer,HRB16746 (AG NÃrnberg)
    GPG fingerprint = 93A3 365E CE47 B889 DF7F  FED1 389A 563C C272 A126


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]