This is the mail archive of the glibc-cvs@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]

GNU C Library master sources branch hjl/pr19363/clobber created. glibc-2.22-606-gbed04d2


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, hjl/pr19363/clobber has been created
        at  bed04d2261bded5888f96a618ed770a4de6dc69a (commit)

- Log -----------------------------------------------------------------
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=bed04d2261bded5888f96a618ed770a4de6dc69a

commit bed04d2261bded5888f96a618ed770a4de6dc69a
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Mon Dec 14 20:35:51 2015 -0800

    Use REGISTERS_CLOBBERED_BY_SYSCALL

diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/times.c b/sysdeps/unix/sysv/linux/x86_64/x32/times.c
index 330315f..f1ab128 100644
--- a/sysdeps/unix/sysv/linux/x86_64/x32/times.c
+++ b/sysdeps/unix/sysv/linux/x86_64/x32/times.c
@@ -17,15 +17,15 @@
    <http://www.gnu.org/licenses/>.  */
 
 /* Inline Linux times system call.  */
-#define INTERNAL_SYSCALL_TIMES(err, buf)				\
-  ({									\
-    unsigned long long int resultvar;					\
-    LOAD_ARGS_1 (buf)							\
-    LOAD_REGS_1								\
-    asm volatile (							\
-    "syscall\n\t"							\
-    : "=a" (resultvar)							\
-    : "0" (__NR_times) ASM_ARGS_1 : "memory", "cc", "r11", "cx");	\
+#define INTERNAL_SYSCALL_TIMES(err, buf)				       \
+  ({									       \
+    unsigned long long int resultvar;					       \
+    LOAD_ARGS_1 (buf)							       \
+    LOAD_REGS_1								       \
+    asm volatile (							       \
+    "syscall\n\t"							       \
+    : "=a" (resultvar)							       \
+    : "0" (__NR_times) ASM_ARGS_1 : "memory", REGISTERS_CLOBBERED_BY_SYSCALL); \
     (long long int) resultvar; })
 
 #include <sysdeps/unix/sysv/linux/times.c>

http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=d4f465df65a5723ede4cf933afee5582312fc603

commit d4f465df65a5723ede4cf933afee5582312fc603
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Mon Dec 14 20:35:40 2015 -0800

    Add REGISTERS_CLOBBERED_BY_SYSCALL

diff --git a/sysdeps/unix/sysv/linux/x86_64/sysdep.h b/sysdeps/unix/sysv/linux/x86_64/sysdep.h
index fc132f6..c364d08 100644
--- a/sysdeps/unix/sysv/linux/x86_64/sysdep.h
+++ b/sysdeps/unix/sysv/linux/x86_64/sysdep.h
@@ -218,6 +218,9 @@
 # undef INTERNAL_SYSCALL_DECL
 # define INTERNAL_SYSCALL_DECL(err) do { } while (0)
 
+/* Registers clobbered by syscall.  */
+# define REGISTERS_CLOBBERED_BY_SYSCALL "cc", "r11", "cx"
+
 # define INTERNAL_SYSCALL_NCS(name, err, nr, args...) \
   ({									      \
     unsigned long int resultvar;					      \
@@ -226,7 +229,7 @@
     asm volatile (							      \
     "syscall\n\t"							      \
     : "=a" (resultvar)							      \
-    : "0" (name) ASM_ARGS_##nr : "memory", "cc", "r11", "cx");		      \
+    : "0" (name) ASM_ARGS_##nr : "memory", REGISTERS_CLOBBERED_BY_SYSCALL);   \
     (long int) resultvar; })
 # undef INTERNAL_SYSCALL
 # define INTERNAL_SYSCALL(name, err, nr, args...) \
@@ -240,7 +243,7 @@
     asm volatile (							      \
     "syscall\n\t"							      \
     : "=a" (resultvar)							      \
-    : "0" (name) ASM_ARGS_##nr : "memory", "cc", "r11", "cx");		      \
+    : "0" (name) ASM_ARGS_##nr : "memory", REGISTERS_CLOBBERED_BY_SYSCALL);   \
     (long int) resultvar; })
 # undef INTERNAL_SYSCALL_TYPES
 # define INTERNAL_SYSCALL_TYPES(name, err, nr, args...) \

http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=8a4f1e5889edc41f97c861af81d0f0354d0bc75a

commit 8a4f1e5889edc41f97c861af81d0f0354d0bc75a
Author: H.J. Lu <hjl.tools@gmail.com>
Date:   Mon Dec 14 19:09:13 2015 -0800

    Use INTERNAL_SYSCALL_TIMES for Linux times
    
    The Linux times function, which returns clock_t, is implemented with
    INTERNAL_SYSCALL.  Since INTERNAL_SYSCALL returns 32-bit integer and
    and clock_t is 64-bit on x32, this is a mismatch on x32.  times is the
    only such function.  This patch replaces INTERNAL_SYSCALL in Linux
    times.c with INTERNAL_SYSCALL_TIMES which is default to INTERNAL_SYSCALL
    and provides x32 times.c with proper INTERNAL_SYSCALL_TIMES.
    
    There is no code change on times for i686 nor x86-64.  For x32, before
    this patch, there are
    
    0000000 <__times>:
       0:	b8 64 00 00 40       	mov    $0x40000064,%eax
       5:	0f 05                	syscall
       7:	48 63 d0             	movslq %eax,%rdx
                                    ^^^^^^^^^^ Incorrect signed extension
       a:	48 83 fa f2          	cmp    $0xfffffffffffffff2,%rdx
       e:	75 07                	jne    17 <__times+0x17>
      10:	3d 00 f0 ff ff       	cmp    $0xfffff000,%eax
      15:	77 11                	ja     28 <__times+0x28>
      17:	48 83 fa ff          	cmp    $0xffffffffffffffff,%rdx
      1b:	b8 00 00 00 00       	mov    $0x0,%eax
      20:	48 0f 45 c2          	cmovne %rdx,%rax
      24:	c3                   	retq
    
    After this patch, there are
    
    00000000 <__times>:
       0:	b8 64 00 00 40       	mov    $0x40000064,%eax
       5:	0f 05                	syscall
       7:	48 83 f8 f2          	cmp    $0xfffffffffffffff2,%rax
       b:	75 07                	jne    14 <__times+0x14>
       d:	3d 00 f0 ff ff       	cmp    $0xfffff000,%eax
      12:	77 14                	ja     28 <__times+0x28>
      14:	48 83 f8 ff          	cmp    $0xffffffffffffffff,%rax
      18:	ba 00 00 00 00       	mov    $0x0,%edx
      1d:	48 0f 44 c2          	cmove  %rdx,%rax
      21:	c3                   	retq
    
    The incorrect signed extension is gone.
    
    	[BZ #19363]
    	* sysdeps/unix/sysv/linux/times.c (INTERNAL_SYSCALL_TIMES): New.
    	(__times): Replace INTERNAL_SYSCALL with INTERNAL_SYSCALL_TIMES.
    	* sysdeps/unix/sysv/linux/x86_64/x32/times.c: New file.
    
    xxx

diff --git a/sysdeps/unix/sysv/linux/times.c b/sysdeps/unix/sysv/linux/times.c
index 19b77cf..9d3beed 100644
--- a/sysdeps/unix/sysv/linux/times.c
+++ b/sysdeps/unix/sysv/linux/times.c
@@ -19,12 +19,16 @@
 #include <sys/times.h>
 #include <sysdep.h>
 
+#ifndef INTERNAL_SYSCALL_TIMES
+# define INTERNAL_SYSCALL_TIMES(err, buf) \
+  INTERNAL_SYSCALL (times, err, 1, buf)
+#endif
 
 clock_t
 __times (struct tms *buf)
 {
   INTERNAL_SYSCALL_DECL (err);
-  clock_t ret = INTERNAL_SYSCALL (times, err, 1, buf);
+  clock_t ret = INTERNAL_SYSCALL_TIMES (err, buf);
   if (INTERNAL_SYSCALL_ERROR_P (ret, err)
       && __builtin_expect (INTERNAL_SYSCALL_ERRNO (ret, err) == EFAULT, 0)
       && buf)
diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/times.c b/sysdeps/unix/sysv/linux/x86_64/x32/times.c
new file mode 100644
index 0000000..330315f
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/x86_64/x32/times.c
@@ -0,0 +1,31 @@
+/* Linux times.  X32 version.
+   Copyright (C) 2015 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
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+/* Inline Linux times system call.  */
+#define INTERNAL_SYSCALL_TIMES(err, buf)				\
+  ({									\
+    unsigned long long int resultvar;					\
+    LOAD_ARGS_1 (buf)							\
+    LOAD_REGS_1								\
+    asm volatile (							\
+    "syscall\n\t"							\
+    : "=a" (resultvar)							\
+    : "0" (__NR_times) ASM_ARGS_1 : "memory", "cc", "r11", "cx");	\
+    (long long int) resultvar; })
+
+#include <sysdeps/unix/sysv/linux/times.c>

-----------------------------------------------------------------------


hooks/post-receive
-- 
GNU C Library master sources


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