[ASM]
[reactos.git] / reactos / lib / sdk / crt / mem / i386 / memset_asm.s
index 4f7c943..8143047 100644 (file)
@@ -2,46 +2,51 @@
  * $Id$
  */
 
+#include <asm.inc>
+#include <ks386.inc>
+
 /*
  * void *memset (void *src, int val, size_t count)
  */
 
-.globl _memset
+PUBLIC _memset
+.code
 
 _memset:
-       push    %ebp
-       mov     %esp,%ebp
-       push    %edi
-       mov     0x8(%ebp),%edi
-       movzb   0xc(%ebp),%eax
-       mov     0x10(%ebp),%ecx
+       push ebp
+       mov ebp, esp
+       push edi
+       mov edi, [ebp + 8]
+       movzx eax, byte ptr [ebp + 12]
+       mov ecx, [ebp + 16]
        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
+       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     $2,%ecx
-       rep     stosl
-       mov     %edx,%ecx
-       and     $3,%ecx
+       shr ecx, 2
+       rep stosd
+       mov ecx, edx
+       and ecx, 3
 .L1:   
-       test    %ecx,%ecx
-       je      .L3
-       rep     stosb
+       test ecx, ecx
+       je .L3
+       rep stosb
 .L3:
-       pop     %edi
-       mov     0x8(%ebp),%eax
+       pop edi
+       mov eax, [ebp + 8]
        leave
        ret
 
+END