mirror of
https://github.com/reactos/reactos.git
synced 2025-08-03 13:35:47 +00:00
Create a branch for cmake bringup.
svn path=/branches/cmake-bringup/; revision=48236
This commit is contained in:
parent
a28e798006
commit
c424146e2c
20602 changed files with 0 additions and 1140137 deletions
32
lib/sdk/crt/mem/i386/memchr_asm.s
Normal file
32
lib/sdk/crt/mem/i386/memchr_asm.s
Normal file
|
@ -0,0 +1,32 @@
|
|||
/* $Id$
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: lib/sdk/crt/mem/i386/memchr.s
|
||||
*/
|
||||
|
||||
/*
|
||||
* void* memchr(const void* s, int c, size_t n)
|
||||
*/
|
||||
|
||||
.globl _memchr
|
||||
|
||||
_memchr:
|
||||
push %ebp
|
||||
mov %esp,%ebp
|
||||
push %edi
|
||||
mov 0x8(%ebp),%edi
|
||||
mov 0xc(%ebp),%eax
|
||||
mov 0x10(%ebp),%ecx
|
||||
cld
|
||||
jecxz .Lnotfound
|
||||
repne scasb
|
||||
je .Lfound
|
||||
.Lnotfound:
|
||||
mov $1,%edi
|
||||
.Lfound:
|
||||
mov %edi,%eax
|
||||
dec %eax
|
||||
pop %edi
|
||||
leave
|
||||
ret
|
114
lib/sdk/crt/mem/i386/memcpy_asm.s
Normal file
114
lib/sdk/crt/mem/i386/memcpy_asm.s
Normal file
|
@ -0,0 +1,114 @@
|
|||
/*
|
||||
* void *memcpy (void *to, const void *from, size_t count)
|
||||
*
|
||||
* NOTE: This code is a duplicate of memmove function from memmove_asm.s
|
||||
*/
|
||||
|
||||
.globl _memcpy
|
||||
|
||||
_memcpy:
|
||||
push %ebp
|
||||
mov %esp,%ebp
|
||||
|
||||
push %esi
|
||||
push %edi
|
||||
|
||||
mov 8(%ebp),%edi
|
||||
mov 12(%ebp),%esi
|
||||
mov 16(%ebp),%ecx
|
||||
|
||||
cmp %esi,%edi
|
||||
jbe .CopyUp
|
||||
mov %ecx,%eax
|
||||
add %esi,%eax
|
||||
cmp %eax,%edi
|
||||
jb .CopyDown
|
||||
|
||||
.CopyUp:
|
||||
cld
|
||||
|
||||
cmp $16,%ecx
|
||||
jb .L1
|
||||
mov %ecx,%edx
|
||||
test $3,%edi
|
||||
je .L2
|
||||
/*
|
||||
* Make the destination dword aligned
|
||||
*/
|
||||
mov %edi,%ecx
|
||||
and $3,%ecx
|
||||
sub $5,%ecx
|
||||
not %ecx
|
||||
sub %ecx,%edx
|
||||
rep movsb
|
||||
mov %edx,%ecx
|
||||
.L2:
|
||||
shr $2,%ecx
|
||||
rep movsl
|
||||
mov %edx,%ecx
|
||||
and $3,%ecx
|
||||
.L1:
|
||||
test %ecx,%ecx
|
||||
je .L3
|
||||
rep movsb
|
||||
.L3:
|
||||
mov 8(%ebp),%eax
|
||||
pop %edi
|
||||
pop %esi
|
||||
leave
|
||||
ret
|
||||
|
||||
.CopyDown:
|
||||
std
|
||||
|
||||
add %ecx,%edi
|
||||
add %ecx,%esi
|
||||
|
||||
cmp $16,%ecx
|
||||
jb .L4
|
||||
mov %ecx,%edx
|
||||
test $3,%edi
|
||||
je .L5
|
||||
|
||||
/*
|
||||
* Make the destination dword aligned
|
||||
*/
|
||||
mov %edi,%ecx
|
||||
and $3,%ecx
|
||||
sub %ecx,%edx
|
||||
dec %esi
|
||||
dec %edi
|
||||
rep movsb
|
||||
mov %edx,%ecx
|
||||
|
||||
sub $3,%esi
|
||||
sub $3,%edi
|
||||
.L6:
|
||||
shr $2,%ecx
|
||||
rep movsl
|
||||
mov %edx,%ecx
|
||||
and $3,%ecx
|
||||
je .L7
|
||||
add $3,%esi
|
||||
add $3,%edi
|
||||
.L8:
|
||||
rep movsb
|
||||
.L7:
|
||||
cld
|
||||
mov 8(%ebp),%eax
|
||||
pop %edi
|
||||
pop %esi
|
||||
leave
|
||||
ret
|
||||
.L5:
|
||||
sub $4,%edi
|
||||
sub $4,%esi
|
||||
jmp .L6
|
||||
|
||||
.L4:
|
||||
test %ecx,%ecx
|
||||
je .L7
|
||||
dec %esi
|
||||
dec %edi
|
||||
jmp .L8
|
||||
|
114
lib/sdk/crt/mem/i386/memmove_asm.s
Normal file
114
lib/sdk/crt/mem/i386/memmove_asm.s
Normal file
|
@ -0,0 +1,114 @@
|
|||
/*
|
||||
* void *memmove (void *to, const void *from, size_t count)
|
||||
*
|
||||
* NOTE: This code is duplicated in memcpy_asm.s
|
||||
*/
|
||||
|
||||
.globl _memmove
|
||||
|
||||
_memmove:
|
||||
push %ebp
|
||||
mov %esp,%ebp
|
||||
|
||||
push %esi
|
||||
push %edi
|
||||
|
||||
mov 8(%ebp),%edi
|
||||
mov 12(%ebp),%esi
|
||||
mov 16(%ebp),%ecx
|
||||
|
||||
cmp %esi,%edi
|
||||
jbe .CopyUp
|
||||
mov %ecx,%eax
|
||||
add %esi,%eax
|
||||
cmp %eax,%edi
|
||||
jb .CopyDown
|
||||
|
||||
.CopyUp:
|
||||
cld
|
||||
|
||||
cmp $16,%ecx
|
||||
jb .L1
|
||||
mov %ecx,%edx
|
||||
test $3,%edi
|
||||
je .L2
|
||||
/*
|
||||
* Make the destination dword aligned
|
||||
*/
|
||||
mov %edi,%ecx
|
||||
and $3,%ecx
|
||||
sub $5,%ecx
|
||||
not %ecx
|
||||
sub %ecx,%edx
|
||||
rep movsb
|
||||
mov %edx,%ecx
|
||||
.L2:
|
||||
shr $2,%ecx
|
||||
rep movsl
|
||||
mov %edx,%ecx
|
||||
and $3,%ecx
|
||||
.L1:
|
||||
test %ecx,%ecx
|
||||
je .L3
|
||||
rep movsb
|
||||
.L3:
|
||||
mov 8(%ebp),%eax
|
||||
pop %edi
|
||||
pop %esi
|
||||
leave
|
||||
ret
|
||||
|
||||
.CopyDown:
|
||||
std
|
||||
|
||||
add %ecx,%edi
|
||||
add %ecx,%esi
|
||||
|
||||
cmp $16,%ecx
|
||||
jb .L4
|
||||
mov %ecx,%edx
|
||||
test $3,%edi
|
||||
je .L5
|
||||
|
||||
/*
|
||||
* Make the destination dword aligned
|
||||
*/
|
||||
mov %edi,%ecx
|
||||
and $3,%ecx
|
||||
sub %ecx,%edx
|
||||
dec %esi
|
||||
dec %edi
|
||||
rep movsb
|
||||
mov %edx,%ecx
|
||||
|
||||
sub $3,%esi
|
||||
sub $3,%edi
|
||||
.L6:
|
||||
shr $2,%ecx
|
||||
rep movsl
|
||||
mov %edx,%ecx
|
||||
and $3,%ecx
|
||||
je .L7
|
||||
add $3,%esi
|
||||
add $3,%edi
|
||||
.L8:
|
||||
rep movsb
|
||||
.L7:
|
||||
cld
|
||||
mov 8(%ebp),%eax
|
||||
pop %edi
|
||||
pop %esi
|
||||
leave
|
||||
ret
|
||||
.L5:
|
||||
sub $4,%edi
|
||||
sub $4,%esi
|
||||
jmp .L6
|
||||
|
||||
.L4:
|
||||
test %ecx,%ecx
|
||||
je .L7
|
||||
dec %esi
|
||||
dec %edi
|
||||
jmp .L8
|
||||
|
47
lib/sdk/crt/mem/i386/memset_asm.s
Normal file
47
lib/sdk/crt/mem/i386/memset_asm.s
Normal file
|
@ -0,0 +1,47 @@
|
|||
/*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
/*
|
||||
* void *memset (void *src, int val, size_t count)
|
||||
*/
|
||||
|
||||
.globl _memset
|
||||
|
||||
_memset:
|
||||
push %ebp
|
||||
mov %esp,%ebp
|
||||
push %edi
|
||||
mov 0x8(%ebp),%edi
|
||||
movzb 0xc(%ebp),%eax
|
||||
mov 0x10(%ebp),%ecx
|
||||
cld
|
||||
cmp $16,%ecx
|
||||
jb .L1
|
||||
mov $0x01010101,%edx
|
||||
mul %edx
|
||||
mov %ecx,%edx
|
||||
test $3,%edi
|
||||
je .L2
|
||||
mov %edi,%ecx
|
||||
and $3,%ecx
|
||||
sub $5,%ecx
|
||||
not %ecx
|
||||
sub %ecx,%edx
|
||||
rep stosb
|
||||
mov %edx,%ecx
|
||||
.L2:
|
||||
shr $2,%ecx
|
||||
rep stosl
|
||||
mov %edx,%ecx
|
||||
and $3,%ecx
|
||||
.L1:
|
||||
test %ecx,%ecx
|
||||
je .L3
|
||||
rep stosb
|
||||
.L3:
|
||||
pop %edi
|
||||
mov 0x8(%ebp),%eax
|
||||
leave
|
||||
ret
|
||||
|
25
lib/sdk/crt/mem/memccpy.c
Normal file
25
lib/sdk/crt/mem/memccpy.c
Normal file
|
@ -0,0 +1,25 @@
|
|||
/*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
|
||||
|
||||
void *
|
||||
_memccpy (void *to, const void *from,int c,size_t count)
|
||||
{
|
||||
char t;
|
||||
size_t i;
|
||||
char *dst=(char*)to;
|
||||
const char *src=(const char*)from;
|
||||
|
||||
for ( i = 0; i < count; i++ )
|
||||
{
|
||||
dst[i] = t = src[i];
|
||||
if ( t == '\0' )
|
||||
break;
|
||||
if ( t == c )
|
||||
return &dst[i+1];
|
||||
}
|
||||
return NULL; /* didn't copy c */
|
||||
}
|
18
lib/sdk/crt/mem/memchr.c
Normal file
18
lib/sdk/crt/mem/memchr.c
Normal file
|
@ -0,0 +1,18 @@
|
|||
/*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
|
||||
void* memchr(const void *s, int c, size_t n)
|
||||
{
|
||||
if (n)
|
||||
{
|
||||
const char *p = s;
|
||||
do {
|
||||
if (*p++ == c)
|
||||
return (void *)(p-1);
|
||||
} while (--n != 0);
|
||||
}
|
||||
return 0;
|
||||
}
|
17
lib/sdk/crt/mem/memcmp.c
Normal file
17
lib/sdk/crt/mem/memcmp.c
Normal file
|
@ -0,0 +1,17 @@
|
|||
/*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
|
||||
int memcmp(const void *s1, const void *s2, size_t n)
|
||||
{
|
||||
if (n != 0) {
|
||||
const unsigned char *p1 = s1, *p2 = s2;
|
||||
do {
|
||||
if (*p1++ != *p2++)
|
||||
return (*--p1 - *--p2);
|
||||
} while (--n != 0);
|
||||
}
|
||||
return 0;
|
||||
}
|
36
lib/sdk/crt/mem/memcpy.c
Normal file
36
lib/sdk/crt/mem/memcpy.c
Normal file
|
@ -0,0 +1,36 @@
|
|||
#include <string.h>
|
||||
|
||||
/* NOTE: This code is a duplicate of memmove implementation! */
|
||||
void* memcpy(void* dest, const void* src, size_t count)
|
||||
{
|
||||
char *char_dest = (char *)dest;
|
||||
char *char_src = (char *)src;
|
||||
|
||||
if ((char_dest <= char_src) || (char_dest >= (char_src+count)))
|
||||
{
|
||||
/* non-overlapping buffers */
|
||||
while(count > 0)
|
||||
{
|
||||
*char_dest = *char_src;
|
||||
char_dest++;
|
||||
char_src++;
|
||||
count--;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* overlaping buffers */
|
||||
char_dest = (char *)dest + count - 1;
|
||||
char_src = (char *)src + count - 1;
|
||||
|
||||
while(count > 0)
|
||||
{
|
||||
*char_dest = *char_src;
|
||||
char_dest--;
|
||||
char_src--;
|
||||
count--;
|
||||
}
|
||||
}
|
||||
|
||||
return dest;
|
||||
}
|
22
lib/sdk/crt/mem/memicmp.c
Normal file
22
lib/sdk/crt/mem/memicmp.c
Normal file
|
@ -0,0 +1,22 @@
|
|||
/* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
|
||||
#include <precomp.h>
|
||||
|
||||
/*
|
||||
* @implemented
|
||||
*/
|
||||
int
|
||||
_memicmp(const void *s1, const void *s2, size_t n)
|
||||
{
|
||||
if (n != 0)
|
||||
{
|
||||
const unsigned char *p1 = s1, *p2 = s2;
|
||||
|
||||
do {
|
||||
if (toupper(*p1) != toupper(*p2))
|
||||
return (*p1 - *p2);
|
||||
p1++;
|
||||
p2++;
|
||||
} while (--n != 0);
|
||||
}
|
||||
return 0;
|
||||
}
|
36
lib/sdk/crt/mem/memmove.c
Normal file
36
lib/sdk/crt/mem/memmove.c
Normal file
|
@ -0,0 +1,36 @@
|
|||
#include <string.h>
|
||||
|
||||
/* NOTE: This code is duplicated in memcpy function */
|
||||
void * memmove(void *dest,const void *src,size_t count)
|
||||
{
|
||||
char *char_dest = (char *)dest;
|
||||
char *char_src = (char *)src;
|
||||
|
||||
if ((char_dest <= char_src) || (char_dest >= (char_src+count)))
|
||||
{
|
||||
/* non-overlapping buffers */
|
||||
while(count > 0)
|
||||
{
|
||||
*char_dest = *char_src;
|
||||
char_dest++;
|
||||
char_src++;
|
||||
count--;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* overlaping buffers */
|
||||
char_dest = (char *)dest + count - 1;
|
||||
char_src = (char *)src + count - 1;
|
||||
|
||||
while(count > 0)
|
||||
{
|
||||
*char_dest = *char_src;
|
||||
char_dest--;
|
||||
char_src--;
|
||||
count--;
|
||||
}
|
||||
}
|
||||
|
||||
return dest;
|
||||
}
|
17
lib/sdk/crt/mem/memset.c
Normal file
17
lib/sdk/crt/mem/memset.c
Normal file
|
@ -0,0 +1,17 @@
|
|||
/*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
|
||||
void* memset(void* src, int val, size_t count)
|
||||
{
|
||||
char *char_src = (char *)src;
|
||||
|
||||
while(count>0) {
|
||||
*char_src = val;
|
||||
char_src++;
|
||||
count--;
|
||||
}
|
||||
return src;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue