fillmemory_asm.s

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

S
32
字号
/* 
 * COPYRIGHT:       See COPYING in the top level directory
 * PROJECT:         ReactOS kernel
 * FILE:            fillmemory_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  _RtlFillMemory@12          //[4]  (no bug)

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

_RtlFillMemory@12:
    mov ecx,dword [esp + 8 ]     // ecx = Length         
	cmp ecx,0// if (Length==0) goto .zero 
	je  2f	        

    mov edx, dword [esp + 4]     // edx = Destination 
    mov eax, dword [esp + 12]    // eax = fill         	        
1:     
    mov	byte [edx + ecx -1],al   // src[Length - 1] = fill
    dec ecx  // Length = Length - 1
    jnz 1b   // if (Length!=0) goto .loop
2:	 	
    ret 12   // return

⌨️ 快捷键说明

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