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