高级C代码的汇编分析--截取struct部分
1:
2: typedef struct {
3: int a;
4: int b;
5: int c;
6: }mystruct;
7:
8: int func(int a,int b)
9: {
0040B800 push ebp
0040B801 mov ebp,esp
0040B803 sub esp,1D8h
0040B809 push ebx
0040B80A push esi
0040B80B push edi
0040B80C lea edi,[ebp-1D8h]
0040B812 mov ecx,76h
0040B817 mov eax,0CCCCCCCCh
0040B81C rep stos dword ptr [edi]
10:
11: unsigned char *buf[100];
12: mystruct *strs = (mystruct *)buf;
0040B81E lea eax,[ebp-190h]
0040B824 mov dword ptr [ebp-194h],eax
13: int i;
14: for(i=0; i<5; i++)
0040B82A mov dword ptr [ebp-198h],0
0040B834 jmp func+45h (0040b845)
0040B836 mov ecx,dword ptr [ebp-198h]
0040B83C add ecx,1
0040B83F mov dword ptr [ebp-198h],ecx
0040B845 cmp dword ptr [ebp-198h],5
0040B84C jge func+94h (0040b894)
15: {
16: strs[i].a=0;
0040B84E mov edx,dword ptr [ebp-198h]
0040B854 imul edx,edx,0Ch
0040B857 mov eax,dword ptr [ebp-194h]
0040B85D mov dword ptr [eax+edx],0
17: strs[i].b=1;
0040B864 mov ecx,dword ptr [ebp-198h]
0040B86A imul ecx,ecx,0Ch
0040B86D mov edx,dword ptr [ebp-194h]
0040B873 mov dword ptr [edx+ecx+4],1
18: strs[i].c=2;
0040B87B mov eax,dword ptr [ebp-198h]
0040B881 imul eax,eax,0Ch
0040B884 mov ecx,dword ptr [ebp-194h]
0040B88A mov dword ptr [ecx+eax+8],2
19: }
0040B892 jmp func+36h (0040b836)
20:
21: return 0;
0040B894 xor eax,eax
22: }
0040B896 pop edi
0040B897 pop esi
0040B898 pop ebx
0040B899 mov esp,ebp
0040B89B pop ebp
0040B89C ret
相关redis源代码:
typedef char *sds;
struct sdshdr {
unsigned int len;
unsigned int free;
char buf[];
};
sds sdsnewlen(const void *init, size_t initlen) {
struct sdshdr *sh;
if (init) {
sh = zmalloc(sizeof(struct sdshdr)+initlen+1);
} else {
sh = zcalloc(sizeof(struct sdshdr)+initlen+1);
}
if (sh == NULL) return NULL;
sh->len = initlen;
sh->free = 0;
if (initlen && init)
memcpy(sh->buf, init, initlen);
sh->buf[initlen] = '\0';
return (char*)sh->buf;
}
from http://www.cnblogs.com/lfsblack/p/3763993.html
相关推荐
推荐一款Java实体映射工具---mapstruct(csdn)————程序
Swift-Class-Struct Swift-Class-Struct
Java 开发--JSP+Struct+MySql基于BBS管理系统设计与实现(源代码+论文+中英资料+开题报告+答辩PPT)
matlab开发-vars2struct。将变量转换为标量结构。
赠送源代码:mapstruct-1.1.0.Final-sources.jar; 赠送Maven依赖信息文件:mapstruct-1.1.0.Final.pom; 包含翻译后的API文档:mapstruct-1.1.0.Final-javadoc-API文档-中文(简体)版.zip; Maven坐标:org.map...
GPU-grid-block-thread-OpenMP-struct,GPU-grid-block-thread-OpenMP-struct
var StructType = require('ref-struct') // define the time types var time_t = ref.types.long var suseconds_t = ref.types.long // define the "timeval" struct type var timeval = StructType({ tv_sec: ...
用于协议缓冲区的Mapstruct SPI实现 这种命名策略有助于在您的域类和protobuf类之间生成有效的映射代码。 无论和类支载。 注意:取决于mapstruct 1.4.0.CR1ProtobufAccessor命名策略扩展...
前端开源库-brisky-struct轻快的结构,可观察的数据结构
rsa加密解密算法C语言代码 #include #include #include <stdlib.h> #include <time.h> #include #include #define MAX 100 #define LEN sizeof(struct slink) void sub(int a[MAX],int b[MAX] ,int c[MAX] ); ...
06.hive数据类型--复合类型--struct结构类型的使用.mp4
②修改生成工具代码(支持linux或mac或windows)如果生成出来的结构不是我们所需要的可以修改automatic.go文件 命令:go run automatic.go -d dbname -path ./models 二,生成单个多个表结构体: 命令(支持linux...
lpeg-0.12.2-struct-0.2两个组合包
赠送源代码:mapstruct-jdk8-1.2.0.Final-sources.jar; 赠送Maven依赖信息文件:mapstruct-jdk8-1.2.0.Final.pom; 包含翻译后的API文档:mapstruct-jdk8-1.2.0.Final-javadoc-API文档-中文(简体)-英语-对照版.zip...
游戏源码struct { int num;/*格子当前处于什么状态,1有雷,0已经显示过数字或者空白格子*/ int roundnum;/*统计格子周围有多少雷*/ int flag;/*右键按下显示红旗的标志,0没有红旗标志,1有红旗标志*/ }Mine[10][10...
matlab开发-xml2struct。mex函数将XML文件转换为matlab结构
结构体操作,实现了如何访问结构体,和如何输出结构体中的元素
赠送源代码:mapstruct-1.3.1.Final-sources.jar; 赠送Maven依赖信息文件:mapstruct-1.3.1.Final.pom; 包含翻译后的API文档:mapstruct-1.3.1.Final-javadoc-API文档-中文(简体)版.zip; Maven坐标:org.map...
赠送源代码:mapstruct-jdk8-1.2.0.Final-sources.jar; 赠送Maven依赖信息文件:mapstruct-jdk8-1.2.0.Final.pom; 包含翻译后的API文档:mapstruct-jdk8-1.2.0.Final-javadoc-API文档-中文(简体)版.zip; Maven...