[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.00.1707060055470.3339@tp.orcam.me.uk>
Date: Thu, 6 Jul 2017 01:00:34 +0100
From: "Maciej W. Rozycki" <macro@...tec.com>
To: Aleksandar Markovic <aleksandar.markovic@...rk.com>
CC: <linux-mips@...ux-mips.org>,
Goran Ferenc <goran.ferenc@...tec.com>,
Miodrag Dinic <miodrag.dinic@...tec.com>,
Aleksandar Markovic <aleksandar.markovic@...tec.com>,
Douglas Leung <douglas.leung@...tec.com>,
James Hogan <james.hogan@...tec.com>,
<linux-kernel@...r.kernel.org>,
Paul Burton <paul.burton@...tec.com>,
Petar Jovanovic <petar.jovanovic@...tec.com>,
Raghu Gandham <raghu.gandham@...tec.com>,
Ralf Baechle <ralf@...ux-mips.org>
Subject: Re: [PATCH v2 2/4] MIPS: VDSO: Add implementation of clock_gettime()
fallback
On Wed, 28 Jun 2017, Aleksandar Markovic wrote:
> diff --git a/arch/mips/vdso/gettimeofday.c b/arch/mips/vdso/gettimeofday.c
> index fd7d433..5f63375 100644
> --- a/arch/mips/vdso/gettimeofday.c
> +++ b/arch/mips/vdso/gettimeofday.c
> @@ -20,6 +20,24 @@
> #include <asm/unistd.h>
> #include <asm/vdso.h>
>
> +static __always_inline long clock_gettime_fallback(clockid_t _clkid,
> + struct timespec *_ts)
> +{
> + register struct timespec *ts asm("a1") = _ts;
> + register clockid_t clkid asm("a0") = _clkid;
> + register long ret asm("v0");
> + register long nr asm("v0") = __NR_clock_gettime;
> + register long error asm("a3");
> +
> + asm volatile(
> + " syscall\n"
> + : "=r" (ret), "=r" (error)
> + : "r" (clkid), "r" (ts), "r" (nr)
> + : "memory");
> +
> + return error ? -ret : ret;
> +}
Hmm, are you sure it is safe nowadays WRT the syscall restart convention
to leave out the instruction explicitly loading the syscall number that
would normally immediately precede SYSCALL (and would have to forcibly use
the 32-bit encoding in the microMIPS case)?
Maciej
Powered by blists - more mailing lists