Skip to content

Commit

Permalink
s390/vdso: use system call functions
Browse files Browse the repository at this point in the history
Use system call functions instead of open-coding svc inline
assemblies. This is mostly to get rid of even more register asm
constructs.
Besides that, it makes the code also a bit easier to understand.
The generated code is identical to what is was before.

Reviewed-by: Sven Schnelle <svens@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
  • Loading branch information
Heiko Carstens committed Jul 27, 2021
1 parent 91f05c2 commit 36af1c5
Showing 1 changed file with 4 additions and 18 deletions.
22 changes: 4 additions & 18 deletions arch/s390/include/asm/vdso/gettimeofday.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

#define VDSO_HAS_CLOCK_GETRES 1

#include <asm/syscall.h>
#include <asm/timex.h>
#include <asm/unistd.h>
#include <linux/compiler.h>
Expand Down Expand Up @@ -35,35 +36,20 @@ static inline u64 __arch_get_hw_counter(s32 clock_mode, const struct vdso_data *
static __always_inline
long clock_gettime_fallback(clockid_t clkid, struct __kernel_timespec *ts)
{
register unsigned long r1 __asm__("r1") = __NR_clock_gettime;
register unsigned long r2 __asm__("r2") = (unsigned long)clkid;
register void *r3 __asm__("r3") = ts;

asm ("svc 0\n" : "+d" (r2) : "d" (r1), "d" (r3) : "cc", "memory");
return r2;
return syscall2(__NR_clock_gettime, (long)clkid, (long)ts);
}

static __always_inline
long gettimeofday_fallback(register struct __kernel_old_timeval *tv,
register struct timezone *tz)
{
register unsigned long r1 __asm__("r1") = __NR_gettimeofday;
register unsigned long r2 __asm__("r2") = (unsigned long)tv;
register void *r3 __asm__("r3") = tz;

asm ("svc 0\n" : "+d" (r2) : "d" (r1), "d" (r3) : "cc", "memory");
return r2;
return syscall2(__NR_gettimeofday, (long)tv, (long)tz);
}

static __always_inline
long clock_getres_fallback(clockid_t clkid, struct __kernel_timespec *ts)
{
register unsigned long r1 __asm__("r1") = __NR_clock_getres;
register unsigned long r2 __asm__("r2") = (unsigned long)clkid;
register void *r3 __asm__("r3") = ts;

asm ("svc 0\n" : "+d" (r2) : "d" (r1), "d" (r3) : "cc", "memory");
return r2;
return syscall2(__NR_clock_getres, (long)clkid, (long)ts);
}

#ifdef CONFIG_TIME_NS
Expand Down

0 comments on commit 36af1c5

Please sign in to comment.