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

Re: [Xen-devel] [PATCH RFC 05/25] Introduce clear_user



On Wed, 7 Dec 2011, Jan Beulich wrote:
> >>> On 06.12.11 at 19:19, <stefano.stabellini@xxxxxxxxxxxxx> wrote:
> > --- a/xen/arch/x86/usercopy.c
> > +++ b/xen/arch/x86/usercopy.c
> > @@ -110,6 +110,42 @@ copy_to_user(void __user *to, const void *from, 
> > unsigned 
> > n)
> >      return n;
> >  }
> >  
> > +#define __do_clear_user(addr,size)                                 \
> > +do {                                                                       
> > \
> > +   int __d0;                                                       \
> 
> This should be 'long' to be forward compatible (current gcc likely doesn't
> care), and to cope with eventual future compat mode users passing in a
> 32-bit 'addr'.
> 
> > +   __asm__ __volatile__(                                           \
> > +           "0:     rep; stosl\n"                                   \
> > +           "       movl %2,%0\n"                                   \
> > +           "1:     rep; stosb\n"                                   \
> > +           "2:\n"                                                  \
> > +           ".section .fixup,\"ax\"\n"                              \
> > +           "3:     lea 0(%2,%0,4),%0\n"                            \
> > +           "       jmp 2b\n"                                       \
> > +           ".previous\n"                                           \
> > +           _ASM_EXTABLE(0b,3b)                                     \
> > +           _ASM_EXTABLE(1b,2b)                                     \
> > +           : "=&c"(size), "=&D" (__d0)                             \
> > +           : "r"(size & 3), "0"(size / 4), "1"(addr), "a"(0));     \
> 
> For that latter case at least, casting 'addr' to long may also be necessary.

Good points, I'll make the changes

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.