Skip to content

Commit e23d9c0

Browse files
committed
parisc: Add 32-bit gettimeofday() and clock_gettime() vDSO functions
Add vDSO implementations for gettimeofday(), clock_gettime() and clock_gettime64() kernel syscalls. Currently those functions are implemented as pure syscall wrappers. Signed-off-by: Helge Deller <deller@gmx.de>
1 parent af42d25 commit e23d9c0

File tree

4 files changed

+57
-4
lines changed

4 files changed

+57
-4
lines changed

arch/parisc/include/asm/vdso.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@ extern struct vdso_data *vdso_data;
1919
/* Default link addresses for the vDSOs */
2020
#define VDSO_LBASE 0
2121

22-
#define VDSO_VERSION_STRING LINUX_5.18
22+
#define VDSO_VERSION_STRING LINUX_6.11
2323

2424
#endif /* __PARISC_VDSO_H__ */

arch/parisc/kernel/vdso32/Makefile

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +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-vdso32 = note.o sigtramp.o restart_syscall.o
13+
obj-cvdso32 = vdso32_generic.o
414

515
# Build rules
616

7-
targets := $(obj-vdso32) vdso32.so
17+
targets := $(obj-vdso32) $(obj-cvdso32) vdso32.so
818
obj-vdso32 := $(addprefix $(obj)/, $(obj-vdso32))
19+
obj-cvdso32 := $(addprefix $(obj)/, $(obj-cvdso32))
20+
21+
VDSO_CFLAGS_REMOVE := -pg $(CC_FLAGS_FTRACE)
22+
CFLAGS_REMOVE_vdso32_generic.o = $(VDSO_CFLAGS_REMOVE)
923

1024
ccflags-y := -shared -fno-common -fbuiltin -mno-fast-indirect-calls -O2 -mno-long-calls
1125
# -march=1.1 -mschedule=7100LC
@@ -26,18 +40,22 @@ $(obj)/vdso32_wrapper.o : $(obj)/vdso32.so FORCE
2640

2741
# Force dependency (incbin is bad)
2842
# link rule for the .so file, .lds has to be first
29-
$(obj)/vdso32.so: $(obj)/vdso32.lds $(obj-vdso32) $(VDSO_LIBGCC) FORCE
43+
$(obj)/vdso32.so: $(obj)/vdso32.lds $(obj-vdso32) $(obj-cvdso32) $(VDSO_LIBGCC) FORCE
3044
$(call if_changed,vdso32ld)
3145

3246
# assembly rules for the .S files
3347
$(obj-vdso32): %.o: %.S FORCE
3448
$(call if_changed_dep,vdso32as)
49+
$(obj-cvdso32): %.o: %.c FORCE
50+
$(call if_changed_dep,vdso32cc)
3551

3652
# actual build commands
3753
quiet_cmd_vdso32ld = VDSO32L $@
3854
cmd_vdso32ld = $(CROSS32CC) $(c_flags) -Wl,-T $(filter-out FORCE, $^) -o $@
3955
quiet_cmd_vdso32as = VDSO32A $@
4056
cmd_vdso32as = $(CROSS32CC) $(a_flags) -c -o $@ $<
57+
quiet_cmd_vdso32cc = VDSO32C $@
58+
cmd_vdso32cc = $(CROSS32CC) $(c_flags) -c -o $@ $<
4159

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

arch/parisc/kernel/vdso32/vdso32.lds.S

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,9 @@ VERSION
106106
global:
107107
__kernel_sigtramp_rt32;
108108
__kernel_restart_syscall32;
109+
__vdso_gettimeofday;
110+
__vdso_clock_gettime;
111+
__vdso_clock_gettime64;
109112
local: *;
110113
};
111114
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// SPDX-License-Identifier: GPL-2.0
2+
3+
#include "asm/unistd.h"
4+
#include <linux/types.h>
5+
#include <uapi/asm/unistd_32.h>
6+
7+
struct timezone;
8+
struct old_timespec32;
9+
struct __kernel_timespec;
10+
struct __kernel_old_timeval;
11+
12+
/* forward declarations */
13+
int __vdso_gettimeofday(struct __kernel_old_timeval *tv, struct timezone *tz);
14+
int __vdso_clock_gettime(clockid_t clock, struct old_timespec32 *ts);
15+
int __vdso_clock_gettime64(clockid_t clock, struct __kernel_timespec *ts);
16+
17+
18+
int __vdso_gettimeofday(struct __kernel_old_timeval *tv,
19+
struct timezone *tz)
20+
{
21+
return syscall2(__NR_gettimeofday, (long)tv, (long)tz);
22+
}
23+
24+
int __vdso_clock_gettime(clockid_t clock, struct old_timespec32 *ts)
25+
{
26+
return syscall2(__NR_clock_gettime, (long)clock, (long)ts);
27+
}
28+
29+
int __vdso_clock_gettime64(clockid_t clock, struct __kernel_timespec *ts)
30+
{
31+
return syscall2(__NR_clock_gettime64, (long)clock, (long)ts);
32+
}

0 commit comments

Comments
 (0)