about summary refs log tree commit diff
path: root/dlfcn/tststatic.c
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2015-12-17 11:46:49 -0800
committerH.J. Lu <hjl.tools@gmail.com>2015-12-17 11:47:06 -0800
commit8ead7a9b94a085e6fba69b8b22e2ba0e2677f0d5 (patch)
tree8836dfa3fb66beb56c403595a928fc739d01d38c /dlfcn/tststatic.c
parent2094350c9c9c1b87cf34b193ad6541e4a29b62dc (diff)
downloadglibc-8ead7a9b94a085e6fba69b8b22e2ba0e2677f0d5.tar.gz
glibc-8ead7a9b94a085e6fba69b8b22e2ba0e2677f0d5.tar.xz
glibc-8ead7a9b94a085e6fba69b8b22e2ba0e2677f0d5.zip
Provide x32 times
Since times returns 64-bit clock_t on x32, we need to provide x32 times
by redefining INTERNAL_SYSCALL_NCS and INTERNAL_SYSCALL_ERROR_P with
64-bit return type for syscall.  All system calls returning 64-bit
integer, which are lseek, time and times, must be handled specially for
x32.  lseek is handled by x32 lseek.S and time doesn't check syscall
return.  times is the only missed one.  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
                                ^^^^^^^^^^^^^^^^^^^^^ 32-bit compare
  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 08                	jne    15 <__times+0x15>
   d:	48 3d 00 f0 ff ff    	cmp    $0xfffffffffffff000,%rax
  13:	77 13                	ja     28 <__times+0x28>
  15:	48 83 f8 ff          	cmp    $0xffffffffffffffff,%rax
  19:	ba 00 00 00 00       	mov    $0x0,%edx
  1e:	48 0f 44 c2          	cmove  %rdx,%rax
  22:	c3                   	retq

The incorrect signed extension and 32-bit compare are gone.

	[BZ #19363]
	* sysdeps/unix/sysv/linux/x86_64/x32/times.c: New file.
Diffstat (limited to 'dlfcn/tststatic.c')
0 files changed, 0 insertions, 0 deletions