1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-29 11:41:21 +03:00

powerpc: Simplify vsyscall internal macros

This patch simplifies the powerpc internal macros for vDSO calls
by:

  - Removing INTERNAL_VSYSCALL_NO_SYSCALL_FALLBACK, used solely on
    get_timebase_freq.

  - Adjust INTERNAL_VSYSCALL_CALL_TYPE powerpc32 to follow powerpc64
    argument ordering.

  - Use HAVE_*_VSYSCALL instead of explicit strings.

  - Make powerpc libc-vdso.h include generic implementation.

No semantic change expected, checked on powerpc-linux-gnu-power4,
powerpc64-linux-gnu, and powerpc64le-linux-gnu.

	* sysdeps/unix/sysv/linux/libc-vdso.h (VDSO_IFUNC_RET): Define if not
	defined.
	* sysdeps/unix/sysv/linux/powerpc/get_timebase_freq.c
	(__get_timebase_freq): Remove use of
	INTERNAL_VSYSCALL_NO_SYSCALL_FALLBACK.
	(get_timebase_freq_fallback): New symbol.
	* sysdeps/unix/sysv/linux/powerpc/gettimeofday.c (time): Use
	HAVE_GETTIMEOFDAY_VSYSCALL.
	* sysdeps/unix/sysv/linux/powerpc/time.c (gettimeofday): Use
	HAVE_TIME_VSYSCALL.
	* sysdeps/unix/sysv/linux/powerpc/libc-vdso.h: Include generic
	implementation.
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/sysdep.h
	(INTERNAL_VSYSCALL_CALL_TYPE): Make calling convention similar to
	powerpc64.
	(INTERNAL_VSYSCALL_NO_SYSCALL_FALLBACK): Remove macro.
	* .../sysv/linux/powerpc/powerpc64/sysdep.h
	(INTERNAL_VSYSCALL_NO_SYSCALL_FALLBACK): Likewise.
	* sysdeps/unix/sysv/linux/powerpc/sysdep.h
	(HAVE_GETTIMEOFDAY_VSYSCALL): Define.
This commit is contained in:
Adhemerval Zanella
2019-06-03 21:07:25 +00:00
parent b8a7c7da4e
commit 986a506481
6 changed files with 59 additions and 54 deletions

View File

@ -23,17 +23,11 @@
#include <not-cancel.h>
#include <libc-vdso.h>
uint64_t
__get_timebase_freq (void)
static uint64_t
get_timebase_freq_fallback (void)
{
hp_timing_t result = 0L;
#ifdef SHARED
/* The vDSO does not return an error (it clear cr0.so on returning). */
INTERNAL_SYSCALL_DECL (err);
result =
INTERNAL_VSYSCALL_NO_SYSCALL_FALLBACK (get_tbfreq, err, uint64_t, 0);
#else
/* We read the information from the /proc filesystem. /proc/cpuinfo
contains at least one line like:
timebase : 33333333
@ -99,8 +93,20 @@ __get_timebase_freq (void)
}
}
}
#endif
return result;
}
uint64_t
__get_timebase_freq (void)
{
/* The vDSO does not have a fallback mechanism (such calling a syscall). */
__typeof (VDSO_SYMBOL (get_tbfreq)) vdsop = VDSO_SYMBOL (get_tbfreq);
PTR_DEMANGLE (vdsop);
if (vdsop == NULL)
return get_timebase_freq_fallback ();
INTERNAL_SYSCALL_DECL (err);
return INTERNAL_VSYSCALL_CALL_TYPE (vdsop, err, uint64_t, 0);
}
weak_alias (__get_timebase_freq, __ppc_get_timebase_freq)