/*
* NOTE!!! memcpy(dest,src,n) assumes ds=es=normal data segment. This
* goes for all kernel functions (ds=es=kernel space, fs=local data,
* gs=null), as well as for all well-behaving user programs (ds=es=
* user data space). This is NOT a bug, as any user program that changes
* es deserves to die if it isn't careful.
*/
/*
* ע!!!memcpy(dest,src,n)μĴds=es=ͨݶΡںʹõ
* кڸü裨ds=es=ں˿ռ䣬fs=ֲݿռ䣬gs=null,
* ΪӦóҲds=es=ûݿռ䣩κûĶ
* es Ĵ򲢲ϵͳɵġ
*/
//// ڴ鸴ơԴַsrc ʼn ֽڵĿĵַdest 
// dest - ƵĿĵַsrc - ƵԴַn - ֽ
// %0 - edi(Ŀĵַdest)%1 - esi(Դַsrc)%2 - ecx(ֽn)
#define memcpy(dest,src,n) ({ \
void * _res = dest; \
__asm__ ( "cld;rep;movsb" \ // ds:[esi]Ƶes:[edi]esi++edi++
// ecx(n)ֽڡ
:: "D" ((long)(_res)), "S" ((long)(src)), "c" ((long) (n)) \
: "di", "si", "cx"); \
_res; \
})

