Changeset a68003f in mainline


Ignore:
Timestamp:
2005-09-19T20:20:14Z (19 years ago)
Author:
Sergey Bondari <bondari@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
b4865e1
Parents:
a2dc632
Message:

Memory routines per-arch declations for future implementation

Files:
5 added
2 edited

Legend:

Unmodified
Added
Removed
  • arch/ia32/include/asm.h

    ra2dc632 ra68003f  
    11/*
    22 * Copyright (C) 2001-2004 Jakub Jermar
     3 * Copyright (C) 2005 HelenOS project
    34 * All rights reserved.
    45 *
     
    213214}
    214215
    215 /** Copy memory
    216  *
    217  * Copy a given number of bytes (3rd argument)
    218  * from the memory location defined by 2nd argument
    219  * to the memory location defined by 1st argument.
    220  * The memory areas cannot overlap.
    221  *
    222  * @param destination
    223  * @param source
    224  * @param number of bytes
    225  * @return destination
    226  */
    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 
    252216#endif
  • include/memstr.h

    ra2dc632 ra68003f  
    3232#include <typedefs.h>
    3333#include <arch/types.h>
    34 #include <arch/asm.h>
     34#include <arch/memstr.h>
    3535
     36/*
    3637extern void memsetw(__address dst, size_t cnt, __u16 x);
    3738extern void memsetb(__address dst, size_t cnt, __u8 x);
    38 
    3939extern int memcmp(__address src, __address dst, int cnt);
    40 extern void *memcpy(void *dst, const void *src, size_t cnt);
     40extern void * memcpy(void *dst, const void *src, size_t cnt);
     41*/
    4142
    4243/*
Note: See TracChangeset for help on using the changeset viewer.