mirror of
https://github.com/reactos/reactos.git
synced 2024-08-28 22:28:36 +00:00
Added memcpy/memset with inline assembler implementation for target i386.
svn path=/trunk/; revision=3418
This commit is contained in:
parent
0f2ad47bfb
commit
9ad20399e9
|
@ -1,4 +1,4 @@
|
|||
# $Id: Makefile,v 1.79 2002/08/10 16:41:17 dwelch Exp $
|
||||
# $Id: Makefile,v 1.80 2002/08/28 07:03:09 hbirr Exp $
|
||||
#
|
||||
# ReactOS Operating System
|
||||
#
|
||||
|
@ -111,6 +111,9 @@ OBJECTS_RTL = \
|
|||
rtl/memcmp.o \
|
||||
rtl/capture.o
|
||||
|
||||
OBJECTS_RTL := $(filter-out $(RTL_EXCLUDE_FILTER), $(OBJECTS_RTL))
|
||||
|
||||
|
||||
# Kernel (Ke)
|
||||
OBJECTS_KE = \
|
||||
ke/apc.o \
|
||||
|
|
|
@ -39,4 +39,12 @@ OBJECTS_MM_I386 := \
|
|||
mm/i386/page.o \
|
||||
mm/i386/pfault.o
|
||||
|
||||
OBJECTS_ARCH = $(OBJECTS_BOOT) $(OBJECTS_EX_I386) $(OBJECTS_KE_I386) $(OBJECTS_MM_I386)
|
||||
OBJECTS_RTL_I386 := \
|
||||
rtl/i386/memset.o \
|
||||
rtl/i386/memcpy.o
|
||||
|
||||
RTL_EXCLUDE_FILTER := \
|
||||
rtl/memset.o \
|
||||
rtl/memcpy.o
|
||||
|
||||
OBJECTS_ARCH = $(OBJECTS_BOOT) $(OBJECTS_EX_I386) $(OBJECTS_KE_I386) $(OBJECTS_MM_I386) $(OBJECTS_RTL_I386)
|
||||
|
|
34
reactos/ntoskrnl/rtl/i386/memcpy.c
Normal file
34
reactos/ntoskrnl/rtl/i386/memcpy.c
Normal file
|
@ -0,0 +1,34 @@
|
|||
/* $Id: memcpy.c,v 1.1 2002/08/28 07:03:10 hbirr Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: ntoskrnl/rtl/i386/memcpy.c
|
||||
* PROGRAMMER: Hartmut Birr
|
||||
* UPDATE HISTORY:
|
||||
*/
|
||||
|
||||
/* INCLUDES *****************************************************************/
|
||||
|
||||
#include <ddk/ntddk.h>
|
||||
#include <string.h>
|
||||
|
||||
#define NDEBUG
|
||||
#include <internal/debug.h>
|
||||
|
||||
/* FUNCTIONS *****************************************************************/
|
||||
|
||||
#undef memcpy
|
||||
void *memcpy (void *to, const void *from, size_t count)
|
||||
{
|
||||
__asm__( \
|
||||
"or %%ecx,%%ecx\n\t"\
|
||||
"jz .L1\n\t" \
|
||||
"cld\n\t" \
|
||||
"rep\n\t" \
|
||||
"movsb\n\t" \
|
||||
".L1:\n\t"
|
||||
:
|
||||
: "D" (to), "S" (from), "c" (count));
|
||||
return to;
|
||||
}
|
||||
|
31
reactos/ntoskrnl/rtl/i386/memset.c
Normal file
31
reactos/ntoskrnl/rtl/i386/memset.c
Normal file
|
@ -0,0 +1,31 @@
|
|||
/* $Id: memset.c,v 1.1 2002/08/28 07:03:10 hbirr Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: ntoskrnl/rtl/i386/memcpy.c
|
||||
* PROGRAMMER: Hartmut Birr
|
||||
* UPDATE HISTORY:
|
||||
*/
|
||||
|
||||
/* INCLUDES *****************************************************************/
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#define NDEBUG
|
||||
#include <internal/debug.h>
|
||||
|
||||
/* FUNCTIONS *****************************************************************/
|
||||
|
||||
void * memset(void *src, int val, size_t count)
|
||||
{
|
||||
__asm__( \
|
||||
"or %%ecx,%%ecx\n\t"\
|
||||
"jz .L1\n\t" \
|
||||
"cld\t\n" \
|
||||
"rep\t\n" \
|
||||
"stosb\t\n" \
|
||||
".L1:\n\t"
|
||||
:
|
||||
: "D" (src), "c" (count), "a" (val));
|
||||
return src;
|
||||
}
|
Loading…
Reference in a new issue