Skip to content

Commit 5f55e09

Browse files
committed
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>
1 parent e23d9c0 commit 5f55e09

File tree

3 files changed

+47
-4
lines changed

3 files changed

+47
-4
lines changed

arch/parisc/kernel/vdso64/Makefile

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,25 @@
1-
# List of files in the vdso, has to be asm only for now
1+
# Include the generic Makefile to check the built vdso.
2+
include $(srctree)/lib/vdso/Makefile
3+
4+
KCOV_INSTRUMENT := n
5+
6+
# Disable gcov profiling, ubsan and kasan for VDSO code
7+
GCOV_PROFILE := n
8+
UBSAN_SANITIZE := n
9+
KASAN_SANITIZE := n
10+
KCSAN_SANITIZE := n
211

312
obj-vdso64 = note.o sigtramp.o restart_syscall.o
13+
obj-cvdso64 = vdso64_generic.o
414

515
# Build rules
616

7-
targets := $(obj-vdso64) vdso64.so
8-
obj-vdso64 := $(addprefix $(obj)/, $(obj-vdso64))
17+
targets := $(obj-vdso64) $(obj-cvdso64) vdso64.so
18+
obj-vdso64 := $(addprefix $(obj)/, $(obj-vdso64))
19+
obj-cvdso64 := $(addprefix $(obj)/, $(obj-cvdso64))
920

21+
VDSO_CFLAGS_REMOVE := -pg $(CC_FLAGS_FTRACE)
22+
CFLAGS_REMOVE_vdso64_generic.o = $(VDSO_CFLAGS_REMOVE)
1023

1124
ccflags-y := -shared -fno-common -fno-builtin
1225
ccflags-y += -nostdlib -Wl,-soname=linux-vdso64.so.1 \
@@ -26,18 +39,22 @@ $(obj)/vdso64_wrapper.o : $(obj)/vdso64.so FORCE
2639

2740
# Force dependency (incbin is bad)
2841
# link rule for the .so file, .lds has to be first
29-
$(obj)/vdso64.so: $(obj)/vdso64.lds $(obj-vdso64) $(VDSO_LIBGCC) FORCE
42+
$(obj)/vdso64.so: $(obj)/vdso64.lds $(obj-vdso64) $(obj-cvdso64) $(VDSO_LIBGCC) FORCE
3043
$(call if_changed,vdso64ld)
3144

3245
# assembly rules for the .S files
3346
$(obj-vdso64): %.o: %.S FORCE
3447
$(call if_changed_dep,vdso64as)
48+
$(obj-cvdso64): %.o: %.c FORCE
49+
$(call if_changed_dep,vdso64cc)
3550

3651
# actual build commands
3752
quiet_cmd_vdso64ld = VDSO64L $@
3853
cmd_vdso64ld = $(CC) $(c_flags) -Wl,-T $(filter-out FORCE, $^) -o $@
3954
quiet_cmd_vdso64as = VDSO64A $@
4055
cmd_vdso64as = $(CC) $(a_flags) -c -o $@ $<
56+
quiet_cmd_vdso64cc = VDSO64C $@
57+
cmd_vdso64cc = $(CC) $(c_flags) -c -o $@ $<
4158

4259
# Generate VDSO offsets using helper script
4360
gen-vdsosym := $(src)/gen_vdso_offsets.sh

arch/parisc/kernel/vdso64/vdso64.lds.S

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,8 @@ VERSION
104104
global:
105105
__kernel_sigtramp_rt64;
106106
__kernel_restart_syscall64;
107+
__vdso_gettimeofday;
108+
__vdso_clock_gettime;
107109
local: *;
108110
};
109111
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// SPDX-License-Identifier: GPL-2.0
2+
3+
#include "asm/unistd.h"
4+
#include <linux/types.h>
5+
6+
struct timezone;
7+
struct __kernel_timespec;
8+
struct __kernel_old_timeval;
9+
10+
/* forward declarations */
11+
int __vdso_gettimeofday(struct __kernel_old_timeval *tv, struct timezone *tz);
12+
int __vdso_clock_gettime(clockid_t clock, struct __kernel_timespec *ts);
13+
14+
15+
int __vdso_gettimeofday(struct __kernel_old_timeval *tv,
16+
struct timezone *tz)
17+
{
18+
return syscall2(__NR_gettimeofday, (long)tv, (long)tz);
19+
}
20+
21+
int __vdso_clock_gettime(clockid_t clock, struct __kernel_timespec *ts)
22+
{
23+
return syscall2(__NR_clock_gettime, (long)clock, (long)ts);
24+
}

0 commit comments

Comments
 (0)