2 * COPYRIGHT: See COPYING in the top level directory
3 * PROJECT: ReactOS kernel
4 * FILE: comparememory_asm.S
5 * PURPOSE: Memory functions
6 * PROGRAMMERS: Patrick Baggett (baggett.patrick@gmail.com)
7 * Alex Ionescu (alex@relsoft.net)
8 * Magnus Olsen (magnusolsen@greatlord.com)
11 .intel_syntax noprefix
13 /* GLOBALS ****************************************************************/
15 .globl _RtlCompareMemory@12 // [4] (no bug)
17 /* FUNCTIONS ***************************************************************/
20 xor eax,eax // count = 0
21 mov ecx, dword [esp + 12 ] // ecx = Length
22 cmp ecx,0 // if (Length==0) goto .zero
25 push edi// register that does not to be save eax,ecx,edx to
26 push ebx// the stack for protetion
28 mov edi, dword [esp + (4 + 8)] // edi = Destination
29 mov edx, dword [esp + (8 + 8)] // edx = Source
32 mov bl,byte [edi + eax ] // if (src[count]!=des[count]) goto .pop_zero
33 cmp byte [edx + eax ],bl
36 inc eax // count = count + 1
37 dec ecx // Length = Length - 1
38 jnz 1b // if (Length!=0) goto .loop_1byte
41 pop ebx // restore regiester
44 ret 12 // return count