comparememory_asm.s
来自「一个类似windows」· S 代码 · 共 45 行
S
45 行
/*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
* FILE: comparememory_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 _RtlCompareMemory@12 // [4] (no bug)
/* FUNCTIONS ***************************************************************/
_RtlCompareMemory@12:
xor eax,eax // count = 0
mov ecx, dword [esp + 12 ] // ecx = Length
cmp ecx,0 // if (Length==0) goto .zero
je 3f
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)] // edi = Destination
mov edx, dword [esp + (8 + 8)] // edx = Source
1:
mov bl,byte [edi + eax ] // if (src[count]!=des[count]) goto .pop_zero
cmp byte [edx + eax ],bl
jne 2f
inc eax // count = count + 1
dec ecx // Length = Length - 1
jnz 1b // if (Length!=0) goto .loop_1byte
2:
pop ebx // restore regiester
pop edi
3:
ret 12 // return count
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?