1 ; * base on ntdll/rtl/mem.c v 1.13 2003/07/11 13:50:23
3 ; * COPYRIGHT: See COPYING in the top level directory
4 ; * PROJECT: ReactOS kernel
5 ; * FILE: i386_RtlCompareMemory.asm
6 ; * PURPOSE: Memory functions
7 ; * PROGRAMMER: Magnus Olsen (magnusolsen@greatlord.com)
16 GLOBAL _RtlCompareMemory@12 ; [4] (no bug)
21 ; * [4] ULONG STDCALL RtlCompareMemory(PVOID Source1, PVOID Source2, ULONG Length)
25 xor eax,eax ; count = 0
26 mov ecx, dword [esp + 12 ] ; ecx = Length
27 cmp ecx,0 ; if (Length==0) goto .zero
30 push edi ; register that does not to be save eax,ecx,edx to
31 push ebx ; the stack for protetion
33 mov edi, dword [esp + (4 + 8)] ; edi = Destination
34 mov edx, dword [esp + (8 + 8)] ; edx = Source
37 mov bl,byte [edi + eax ] ; if (src[count]!=des[count]) goto .pop_zero
38 cmp byte [edx + eax ],bl
41 inc eax ; count = count + 1
42 dec ecx ; Length = Length - 1
43 jnz .loop_1byte ; if (Length!=0) goto .loop_1byte
46 pop ebx ; restore regiester