Changeset a68003f in mainline for arch/ia32/include/asm.h
- Timestamp:
- 2005-09-19T20:20:14Z (20 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- b4865e1
- Parents:
- a2dc632
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
arch/ia32/include/asm.h
ra2dc632 ra68003f 1 1 /* 2 2 * Copyright (C) 2001-2004 Jakub Jermar 3 * Copyright (C) 2005 HelenOS project 3 4 * All rights reserved. 4 5 * … … 213 214 } 214 215 215 /** Copy memory216 *217 * Copy a given number of bytes (3rd argument)218 * from the memory location defined by 2nd argument219 * to the memory location defined by 1st argument.220 * The memory areas cannot overlap.221 *222 * @param destination223 * @param source224 * @param number of bytes225 * @return destination226 */227 static inline void * memcpy(void * dst, const void * src, size_t cnt)228 {229 __u32 d0, d1, d2;230 231 __asm__ __volatile__(232 /* copy all full dwords */233 "rep movsl\n\t"234 /* load count again */235 "movl %4, %%ecx\n\t"236 /* ecx = ecx mod 4 */237 "andl $3, %%ecx\n\t"238 /* are there last <=3 bytes? */239 "jz 1f\n\t"240 /* copy last <=3 bytes */241 "rep movsb\n\t"242 /* exit from asm block */243 "1:\n"244 : "=&c" (d0), "=&D" (d1), "=&S" (d2)245 : "0" (cnt / 4), "g" (cnt), "1" ((__u32) dst), "2" ((__u32) src)246 : "memory");247 248 return dst;249 }250 251 252 216 #endif
Note:
See TracChangeset
for help on using the changeset viewer.