parisc: Add 64-bit gettimeofday() and clock_gettime() vDSO functions

Add 64-bit vDSO implementations for gettimeofday() and clock_gettime().

Signed-off-by: Helge Deller <deller@gmx.de>
This commit is contained in:
Helge Deller 2024-06-21 00:11:58 +02:00
parent e23d9c0b52
commit 5f55e098b8
3 changed files with 47 additions and 4 deletions

View file

@ -1,12 +1,25 @@
# List of files in the vdso, has to be asm only for now
# Include the generic Makefile to check the built vdso.
include $(srctree)/lib/vdso/Makefile
KCOV_INSTRUMENT := n
# Disable gcov profiling, ubsan and kasan for VDSO code
GCOV_PROFILE := n
UBSAN_SANITIZE := n
KASAN_SANITIZE := n
KCSAN_SANITIZE := n
obj-vdso64 = note.o sigtramp.o restart_syscall.o
obj-cvdso64 = vdso64_generic.o
# Build rules
targets := $(obj-vdso64) vdso64.so
obj-vdso64 := $(addprefix $(obj)/, $(obj-vdso64))
targets := $(obj-vdso64) $(obj-cvdso64) vdso64.so
obj-vdso64 := $(addprefix $(obj)/, $(obj-vdso64))
obj-cvdso64 := $(addprefix $(obj)/, $(obj-cvdso64))
VDSO_CFLAGS_REMOVE := -pg $(CC_FLAGS_FTRACE)
CFLAGS_REMOVE_vdso64_generic.o = $(VDSO_CFLAGS_REMOVE)
ccflags-y := -shared -fno-common -fno-builtin
ccflags-y += -nostdlib -Wl,-soname=linux-vdso64.so.1 \
@ -26,18 +39,22 @@ $(obj)/vdso64_wrapper.o : $(obj)/vdso64.so FORCE
# Force dependency (incbin is bad)
# link rule for the .so file, .lds has to be first
$(obj)/vdso64.so: $(obj)/vdso64.lds $(obj-vdso64) $(VDSO_LIBGCC) FORCE
$(obj)/vdso64.so: $(obj)/vdso64.lds $(obj-vdso64) $(obj-cvdso64) $(VDSO_LIBGCC) FORCE
$(call if_changed,vdso64ld)
# assembly rules for the .S files
$(obj-vdso64): %.o: %.S FORCE
$(call if_changed_dep,vdso64as)
$(obj-cvdso64): %.o: %.c FORCE
$(call if_changed_dep,vdso64cc)
# actual build commands
quiet_cmd_vdso64ld = VDSO64L $@
cmd_vdso64ld = $(CC) $(c_flags) -Wl,-T $(filter-out FORCE, $^) -o $@
quiet_cmd_vdso64as = VDSO64A $@
cmd_vdso64as = $(CC) $(a_flags) -c -o $@ $<
quiet_cmd_vdso64cc = VDSO64C $@
cmd_vdso64cc = $(CC) $(c_flags) -c -o $@ $<
# Generate VDSO offsets using helper script
gen-vdsosym := $(src)/gen_vdso_offsets.sh

View file

@ -104,6 +104,8 @@ VERSION
global:
__kernel_sigtramp_rt64;
__kernel_restart_syscall64;
__vdso_gettimeofday;
__vdso_clock_gettime;
local: *;
};
}

View file

@ -0,0 +1,24 @@
// SPDX-License-Identifier: GPL-2.0
#include "asm/unistd.h"
#include <linux/types.h>
struct timezone;
struct __kernel_timespec;
struct __kernel_old_timeval;
/* forward declarations */
int __vdso_gettimeofday(struct __kernel_old_timeval *tv, struct timezone *tz);
int __vdso_clock_gettime(clockid_t clock, struct __kernel_timespec *ts);
int __vdso_gettimeofday(struct __kernel_old_timeval *tv,
struct timezone *tz)
{
return syscall2(__NR_gettimeofday, (long)tv, (long)tz);
}
int __vdso_clock_gettime(clockid_t clock, struct __kernel_timespec *ts)
{
return syscall2(__NR_clock_gettime, (long)clock, (long)ts);
}