comparememory_ulong_asm.s

来自「一个类似windows」· S 代码 · 共 45 行

S
45
字号
/* 
 * COPYRIGHT:       See COPYING in the top level directory
 * PROJECT:         ReactOS kernel
 * FILE:            comparememory_ulong_asm.S
 * PURPOSE:         Memory functions
 * PROGRAMMERS:     Patrick Baggett (baggett.patrick@gmail.com)
 *                  Alex Ionescu (alex@relsoft.net)
 *                  Magnus Olsen (magnusolsen@greatlord.com)
 */

.intel_syntax noprefix

/* GLOBALS ****************************************************************/

.globl  _RtlCompareMemoryUlong@12          // [5]  (no bug)

/* FUNCTIONS ***************************************************************/

_RtlCompareMemoryUlong@12:
     xor eax,eax
     mov ecx, dword [esp + 8 ]   // ecx = Length      
     shr ecx,2         // Length / sizeof(ULONG) 
	 jz 1f   // if (Length==0) goto .zero 
        
     push edi// register that does not to be save eax,ecx,edx to 
     push ebx// the stack for protetion
         
     mov edi, dword [esp + (4 + 8)]        // edx = Destination
     mov eax, dword [esp + (12 + 8)]       // ebx = value       
     mov ebx,ecx
     cld
     repe scasd

     inc ecx
     mov eax,ebx
  
     sub eax,ecx
     shl eax,2
       
     pop ebx
     pop edi

1:
     ret 12

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?