Fix powerpc32 __get_clockfreq for non-power4 (bug 17263).
commitd44a052c499a3e2908862cff28cdb85d8aec246f
authorJoseph Myers <joseph@codesourcery.com>
Wed, 13 Aug 2014 16:06:18 +0000 (13 16:06 +0000)
committerJoseph Myers <joseph@codesourcery.com>
Wed, 13 Aug 2014 16:06:18 +0000 (13 16:06 +0000)
treeee2adf31c97746e7e4ae922f0d1903c3c1bfa516
parente44c8b0eb7339787fbc6b1d4a2d1bd5046bc103f
Fix powerpc32 __get_clockfreq for non-power4 (bug 17263).

In my powerpc32 testing I've observed misc/test-gettimebasefreq
failing.

This is a glibc build (soft-float, though that's not relevant here)
without any --with-cpu and without any special configuration of the
default CPU for GCC either.  In particular, it's one not using
sysdeps/powerpc/powerpc32/power4/hp-timing.h (although in fact the
processor I'm using for testing is POWER4-based), so hp_timing_t is
32-bit not 64-bit.  But the VDSO call being used by
INTERNAL_VSYSCALL_NO_SYSCALL_FALLBACK is generating a 64-bit result
(high part in r3, low part in r4).  The code extracting that result,
however, expects a result of the type hp_timing_t as passed to
INTERNAL_VSYSCALL_NO_SYSCALL_FALLBACK, meaning that only r3 (= 0) is
used and the value in r4 is ignored.  This patch fixes this by always
using uint64_t as the type in INTERNAL_VSYSCALL_NO_SYSCALL_FALLBACK -
reflecting the actual ABI (unconditional in the kernel) of that VDSO
call.  This is the minimal change for this issue - no check for
overflow, no change of the type of the timebase_freq variable or the
return type of __get_clockfreq to something other than hp_timing_t
(such a change would simply move the implicit conversions to the over
callers of that function), no change to hp_timing_t itself.

Tested for powerpc32 soft float.

[BZ #17263]
* sysdeps/unix/sysv/linux/powerpc/get_clockfreq.c: Include
<stdint.h>.
(__get_clockfreq): Use uint64_t instead of hp_timing_t in
INTERNAL_VSYSCALL_NO_SYSCALL_FALLBACK call.
ChangeLog
NEWS
sysdeps/unix/sysv/linux/powerpc/get_clockfreq.c