From 723428bebe3105ad3c3406e416402d1831b482c4 Mon Sep 17 00:00:00 2001 From: Andrew Lee Date: Sun, 15 Aug 2021 00:16:45 -0400 Subject: Inital commit --- linux/include/asm/memory.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 linux/include/asm/memory.h (limited to 'linux/include/asm/memory.h') diff --git a/linux/include/asm/memory.h b/linux/include/asm/memory.h new file mode 100644 index 0000000..4b0a98e --- /dev/null +++ b/linux/include/asm/memory.h @@ -0,0 +1,14 @@ +/* + * 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. + */ +#define memcpy(dest,src,n) ({ \ +void * _res = dest; \ +__asm__ ("cld;rep;movsb" \ + ::"D" ((long)(_res)),"S" ((long)(src)),"c" ((long) (n)) \ + :"di","si","cx"); \ +_res; \ +}) -- cgit v1.2.3