[PATCH v3 17/31] arm64: System calls handling

Al Viro viro at ZenIV.linux.org.uk
Fri Sep 7 15:54:14 EDT 2012


On Fri, Sep 07, 2012 at 07:43:36PM +0000, Arnd Bergmann wrote:
> > +       asm(    "add    x0, %0, %1\n\t"
> > +               "mov    x1, %2\n\t"
> > +               "mov    x2, %3\n\t"
> > +               "bl     memmove\n\t"    /* copy regs to top of stack */
> > +               "mov    x27, #0\n\t"    /* not a syscall */
> > +               "mov    x28, %0\n\t"    /* thread structure */
> > +               "mov    sp, x0\n\t"     /* reposition stack pointer */
> > +               "b      ret_to_user"
> > +               :
> > +               : "r" (current_thread_info()),
> > +                 "Ir" (THREAD_START_SP - sizeof(regs)),
> > +                 "r" (&regs),
> > +                 "Ir" (sizeof(regs))
> > +               : "x0", "x1", "x2", "x27", "x28", "x30", "memory");

This should just become ret_from_kernel_execve(); FWIW, arm variant is
ENTRY(ret_from_kernel_execve)
        mov     why, #0                 @ not a syscall
        str     why, [r1, #S_R0]        @ ... and we want 0 in ->ARM_r0 as well
        mov     r2, #S_FRAME_SIZE
        bl      memmove                 @ copy regs to normal location; return
                                        @ value is in r0 and it's the same as
                                        @ the first argument, so r0 is unchanged.
        get_thread_info tsk             @ thread structure
        mov     sp, r0                  @ stack pointer just under pt_regs
        b       ret_slow_syscall

and AFAICS you want pretty much the same, modulo different registers - 'why'
(aka r8) seems to correspond to your x27, 'tsk' (aka r9) - to x28 and the rest
matches one-to-one: x1.. for arguments in place of r1.. and x0 for return value
(instead of r0)...



More information about the linux-arm-kernel mailing list