reactos/lib/sdk/crt/mem/i386/memset_asm.s
Timo Kreuzer a3623f23de [CRT]
- Make all x86assembly ML compatible
- Remove memcpy, it was duplicated from memmove, copy the label instead
- Guard some code against compilation on msvc, as these functions are intrinsics on MSVC and cannot be implemented
- Fix some x64 assembly (don't modify stack below rsp)

svn path=/branches/cmake-bringup/; revision=49421
2010-11-02 00:06:33 +00:00

52 lines
565 B
ArmAsm

/*
* $Id$
*/
#include <reactos/asm.h>
/*
* void *memset (void *src, int val, size_t count)
*/
PUBLIC _memset
.code
_memset:
push ebp
mov ebp, esp
push edi
mov edi, [ebp + 8]
movzx eax, byte ptr [ebp + 12]
mov ecx, [ebp + 16]
cld
cmp ecx, 16
jb .L1
mov edx, HEX(01010101)
mul edx
mov edx, ecx
test edi, 3
je .L2
mov ecx, edi
and ecx, 3
sub ecx, 5
not ecx
sub edx, ecx
rep stosb
mov ecx, edx
.L2:
shr ecx, 2
rep stosd
mov ecx, edx
and ecx, 3
.L1:
test ecx, ecx
je .L3
rep stosb
.L3:
pop edi
mov eax, [ebp + 8]
leave
ret
END