This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] Fix x86_64/sched_getcpu.S error code
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: Andreas Jaeger <aj at suse dot com>
- Cc: libc-alpha at sourceware dot org
- Date: Wed, 23 May 2012 06:49:26 -0700
- Subject: Re: [PATCH] Fix x86_64/sched_getcpu.S error code
- References: <87y5okou6t.fsf@x61s-aj.site><4FBC8F64.5040508@suse.com>
n Wed, May 23, 2012 at 12:19 AM, Andreas Jaeger <aj@suse.com> wrote:
>
> 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.
This is the patch I tested and committed.
Thanks.
--
H.J.
---
* sysdeps/unix/sysv/linux/x86_64/x32/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/x32/sched_getcpu.S
b/sysdeps/unix/sysv/linux/x86_64/x32/sched_getcpu.S
index f3ba9f1..789552e 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
--
1.7.6.5