lkml.org 
[lkml]   [2006]   [May]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [patch 2.6.17-rc5 1/2] i386 memcpy: use as few moves as possible for I/O
One concern: this is not the standard return value for memcpy().  It either needs a 
comment to that effect (stating it returns a pointer to the end of the area), or just make
it return void.

Also, the formatting looks nonstandard.

>
> /*
> + * Do memcpy with as few moves as possible (for transfers to/from IO space.)
> + */
> +static inline void * __minimal_memcpy(void * to, const void * from, size_t n)
> +{
> +int d0, d1, d2;
> +__asm__ __volatile__(
> + "rep ; movsl\n\t"
> + "testb $2,%b4\n\t"
> + "jz 1f\n\t"
> + "movsw\n"
> + "1:\n\t"
> + "testb $1,%b4\n\t"
> + "jz 2f\n\t"
> + "movsb\n"
> + "2:"
> + : "=&c" (d0), "=&D" (d1), "=&S" (d2)
> + :"0" (n/4), "q" (n), "1" ((long) to), "2" ((long) from)
> + : "memory");
> +return to;
> +}


-hpa
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2006-05-31 03:39    [W:0.052 / U:0.152 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site