lkml.org 
[lkml]   [2007]   [Jun]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [KJ PATCH] Replacing memcpy(dest,src,PAGE_SIZE) with copy_page(dest,src) in arch/i386/kernel/machine_kexec.c
Eric W. Biederman wrote:
> Shani Moideen <shani.moideen@wipro.com> writes:
>
>> Hi,
>> Replacing memcpy(dest,src,PAGE_SIZE) with copy_page(dest,src) in
>> arch/i386/kernel/machine_kexec.c.
>
> Please no.
>
> People get creative in copy_page (especially mmx_copy_page),
> and this code path need something simple and stupid, that
> will work every time, especially when things are messed up
> elsewhere.
>

memcpy() is pretty creative, too. If you want something really dumb and
robust, you should probably create an inline:

/*
* Eric sez: his code path need something simple and stupid, that
* will work every time, especially when things are messed up
* elsewhere.
*/
static inline void braindead_copy_page(void *dst, void *src)
{
unsigned long ctr = PAGE_SIZE >> 2;

asm volatile("cld; rep; movsl"
: "+D" (dst), "+S" (src), "+c" (ctr)
: : "memory");
}

(FWIW, the "cld" is supposed to be redundant, as DF=0 is supposed to be
guaranteed by the ABI.)

-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: 2007-06-12 18:59    [W:0.039 / U:9.788 seconds]
©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site