bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH gnumach 2/3] i386: specialize `copyinmsg' and `copyoutmsg'


From: Samuel Thibault
Subject: Re: [PATCH gnumach 2/3] i386: specialize `copyinmsg' and `copyoutmsg'
Date: Sat, 20 Dec 2014 23:38:23 +0100
User-agent: Mutt/1.5.21+34 (58baf7c9f32f) (2010-12-30)

Justus Winter, le Fri 19 Dec 2014 02:48:57 +0100, a écrit :
> +ENTRY(copyinmsg)
> +     pushl   %esi
> +     pushl   %edi                    /* save registers */
> +
> +     movl    8+S_ARG0,%esi           /* get user start address */
> +     movl    8+S_ARG1,%edi           /* get kernel destination address */
> +     movl    8+S_ARG2,%ecx           /* get count */
> +
> +     movl    $USER_DS,%eax           /* use user data segment for accesses */
> +     mov     %ax,%ds
> +
> +     /*cld*/                         /* count up: default mode in all GCC 
> code */
> +     shrl    $2,%ecx

I'd rather avoid sharing the recovery pointers with copyin, and thus do
this:

        RECOVER(copyinmsg_fail)

> +     rep
> +     movsl                           /* move longwords */
> +     xorl    %eax,%eax               /* return 0 for success */
> +
copyinmsg_ret:
> +     mov     %ss,%di                 /* restore DS to kernel segment */
> +     mov     %di,%ds
> +
> +     popl    %edi                    /* restore registers */
> +     popl    %esi
> +     ret                             /* and return */

copyinmsg_fail:
        movl    $1,%eax
        jmp     copyinmsg_ret

Same for copyout.

> -     movl    %edx,%eax               /* use count */
>       /*cld*/                         /* count up: always this way in GCC 
> code */
> -     movl    %eax,%ecx               /* move by longwords first */
> +     movl    %edx,%ecx               /* move by longwords first */
>       shrl    $2,%ecx
>       RECOVER(copyout_fail)
>       rep
>       movsl
> -     movl    %eax,%ecx               /* now move remaining bytes */
> +     movl    %edx,%ecx               /* now move remaining bytes */

Please file this fix separately.

Samuel



reply via email to

[Prev in Thread] Current Thread [Next in Thread]