[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <alpine.DEB.2.00.1707061405410.3339@tp.orcam.me.uk>
Date: Thu, 6 Jul 2017 14:12:37 +0100
From: "Maciej W. Rozycki" <macro@...tec.com>
To: James Hogan <james.hogan@...tec.com>
CC: Aleksandar Markovic <aleksandar.markovic@...rk.com>,
<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>,
<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 Thu, 6 Jul 2017, James Hogan wrote:
> > > + 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
>
> It should be fine. syscall restart only rewinds one (32-bit)
> instruction, and it preserves the syscall number in pt_regs::regs[0]
> (see handle_signal() / do_signal() and this code in e.g. scall32-o32.S:)
>
> sw t1, PT_R0(sp) # save it for syscall restarting
Fair enough, I just wanted to be sure.
[This user code is bundled with the kernel, so it can assume whatever the
kernel does, however general user code does have to conform to the legacy
restart convention, unless it also requires a kernel version that is new
enough and has a safety check in place.]
> > (and would have to forcibly use the 32-bit encoding in the microMIPS
> > case)?
>
> I don't believe there is a 16-bit SYSCALL encoding in microMIPS, at
> least I can't see one in the 5.04 manual.
I referred to the preceding instruction, presumably LI, that does have a
16-bit variant in the microMIPS instruction set.
Maciej
Powered by blists - more mailing lists