memset汇编实现,跟踪得到的
来源:互联网 发布:淘宝团队管理权限 编辑:程序博客网 时间:2024/06/04 18:21
跟进new就能跟到这里
page ,132 title memset - set sections of memory all to one byte;***;memset.asm - set a section of memory to all one byte;; Copyright (c) 1985-1997, Microsoft Corporation. All rights reserved.;;Purpose:; contains the memset() routine;;******************************************************************************* .xlist include cruntime.inc .listpage;***;char *memset(dst, value, count) - sets "count" bytes at "dst" to "value";;Purpose:; Sets the first "count" bytes of the memory starting; at "dst" to the character value "value".;; Algorithm:; char *; memset (dst, value, count); char *dst;; char value;; unsigned int count;; {; char *start = dst;;; while (count--); *dst++ = value;; return(start);; };;Entry:; char *dst - pointer to memory to fill with value; char value - value to put in dst bytes; int count - number of bytes of dst to fill;;Exit:; returns dst, with filled bytes;;Uses:;;Exceptions:;;******************************************************************************* CODESEG public memsetmemset proc .FPO ( 0, 3, 0, 0, 0, 0 ) mov edx,[esp + 0ch] ; edx = "count" mov ecx,[esp + 4] ; ecx points to "dst" test edx,edx ; 0? jz short toend ; if so, nothing to do xor eax,eax mov al,[esp + 8] ; the byte "value" to be stored; Align address on dword boundary push edi ; preserve edi mov edi,ecx ; edi = dest pointer cmp edx,4 ; if it's less then 4 bytes jb tail ; tail needs edi and edx to be initialized neg ecx and ecx,3 ; ecx = # bytes before dword boundary jz short dwords ; jump if address already aligned sub edx,ecx ; edx = adjusted count (for later)adjust_loop: mov [edi],al inc edi dec ecx jnz adjust_loopdwords:; set all 4 bytes of eax to [value] mov ecx,eax ; ecx=0/0/0/value shl eax,8 ; eax=0/0/value/0 add eax,ecx ; eax=0/0val/val mov ecx,eax ; ecx=0/0/val/val shl eax,10h ; eax=val/val/0/0 add eax,ecx ; eax = all 4 bytes = [value]; Set dword-sized blocks mov ecx,edx ; move original count to ecx and edx,3 ; prepare in edx byte count (for tail loop) shr ecx,2 ; adjust ecx to be dword count jz tail ; jump if it was less then 4 bytes rep stosdmain_loop_tail: test edx,edx ; if there is no tail bytes, jz finish ; we finish, and it's time to leave; Set remaining bytestail: mov [edi],al ; set remaining bytes inc edi dec edx ; if there is some more bytes jnz tail ; continue to fill them; Donefinish: mov eax,[esp + 8] ; return dest pointer pop edi ; restore edi rettoend: mov eax,[esp + 4] ; return dest pointer retmemset endp end
0 0
- memset汇编实现,跟踪得到的
- 汇编实现的 memcpy memset strstr
- 使用汇编实现memset和memcpy感觉汇编的强大
- 汇编实现memcpy,memset,strcat,strlen
- 汇编实现memcpy,memset,strcat,strlen
- memcpy、memset的实现
- 函数memset的实现
- 得到程序的汇编代码
- o7-得到Oracle跟踪文件的文件名
- C#中memset的实现
- memset的实现及改进
- memset & memcpy汇编
- 自己动手写汇编总结得到的
- kalman跟踪的实现
- memset 实现
- memset实现
- strcpy()、memcpy()、memmove()、memset()的实现
- strcpy()、memcpy()、memmove()、memset()的实现
- android如何实现开机自动启动Service或app
- 开源的毕业设计—3D虚拟社区
- Asp.Net MVC4.0 学习之九--为模型添加验证
- (转载)AndroidManifest.xml配置文件详解
- Asp.Net MVC4.0 学习之十--查看Detail和Delete方法
- memset汇编实现,跟踪得到的
- Java线程池的原理及几类线程池的介绍
- hadoop2.4.1在64位Deepin/Ubuntu系统中编译安装
- OpenStack云计算快速入门之二:OpenStack安装与配置
- Linux 文本 查找命令小结之grep
- 腾讯QQ企业邮箱POP3/SMTP设置
- 杭电 1392 Surround the Trees
- MFC六大核心机制之二:运行时类型识别(RTTI)
- POJ 3276(第二篇)开关问题