Re: [PATCH v2 2/4] MIPS: VDSO: Add implementation of clock_gettime() fallback
From: Maciej W. Rozycki
Date: Thu Jul 06 2017 - 09:13:02 EST
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
> (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.