lkml.org 
[lkml]   [2017]   [Jul]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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

\
 
 \ /
  Last update: 2017-07-06 15:13    [W:0.050 / U:1.272 seconds]
©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site