I develop the code with x86 gcc.
The C code:
#include <stdio.h>
void test() {
int i;
int array[3] = {0};
for (i = 0; i < 3; i++)
printf("array[%d] = %d\n", i, array[i]);
}
int main(int argc, const char *argv[]) {
test();
return 0;
}
The assembly code:
.file "init.c"
.section .rodata
.LC0:
.string "array[%d] = %d\n"
.text
.globl test
.type test, @function
test:
pushl %ebp
movl %esp, %ebp
subl $40, %esp
# Code for array initialization
movl $0, -24(%ebp)
movl $0, -20(%ebp)
movl $0, -16(%ebp)
movl $0, -12(%ebp)
jmp .L2
.L3:
movl -12(%ebp), %eax
movl -24(%ebp,%eax,4), %edx
movl $.LC0, %eax
movl %edx, 8(%esp)
movl -12(%ebp), %edx
movl %edx, 4(%esp)
movl %eax, (%esp)
call printf
addl $1, -12(%ebp)
.L2:
cmpl $2, -12(%ebp)
jle .L3
leave
ret
.size test, .-test
.globl main
.type main, @function
main:
pushl %ebp
movl %esp, %ebp
andl $-16, %esp
call test
movl $0, %eax
movl %ebp, %esp
popl %ebp
ret
.size main, .-main
.ident "GCC: (Ubuntu 4.4.3-4ubuntu5.1) 4.4.3"
.section .note.GNU-stack,"",@progbits
分享到:
相关推荐
栈(stack)是限制插入和删除只能在一个位置上进行的表,该位置是表的末端,叫做栈的顶(top)。对栈的基本操作有Push(进栈)和Pop(出栈),前者相当于插入,后者则是删除最后插入的元素。 原文:...
stack-code stack-code stack-code stack-code stack-code stack-code
The EtherCAT Slave Stack Code (SSC) is an example source code in ANSI C supporting both the µC and the SPI interface. The code serves as a development base for implementation of EtherCAT in devices ...
EtherCAT Slave Stack Code Tool V5.12 ,,倍福提供的EtherCAT从站开发工具SSC配置工具及工具的使用说明。
EtherCAT Slave Stack Code Tool、EtherCAT 从机代码生成、软件版本512、tool版本 4.13
Code Review Stack Exchange
A C Compiler for Stack Machine
Application Note ET9300 (EtherCAT Slave Stack Code
BECKHOFF(倍福)官方提供EtherCAT从站协议栈代码生成工具 版本:SSC V5.12(Tool 1.4.2)
stack_array.exe
Beckhoff Automation的EtherCAT Slave Stack Code(SSC)是ANSI C中的示例源代码,支持μC和SPI接口。 该代码作为在具有自己的处理器的设备中实现EtherCAT的开发基础。 “对象字典工具”(OD-Tool)已集成到SSC OD...
Beckhoff公司开发从站节点软硬件必备的配置工作和生成驱动用XML文件的工具。
EtherCat Slave Code TOOL(SSC) 5.12版本,最新版, 实测可用! 实测可用! 实测可用! 实测可用!
顺序栈需要实现各项业务功能:创建栈、销毁栈、判断栈是否为空、判断栈是否为满、入栈、出栈、查看栈顶元素。
There is a Source code for BACNet
SmartAssembly can decode obfuscated stack traces in case you need to debug obfuscated assemblies. SmartAssembly can be integrated into build processes using MS Build or the command-line, and supports ...
C语言头文件 STACKC语言头文件 STACKC语言头文件 STACKC语言头文件 STACKC语言头文件 STACKC语言头文件 STACKC语言头文件 STACKC语言头文件 STACKC语言头文件 STACKC语言头文件 STACKC语言头文件 STACKC语言头文件 ...
Assembly Programming and Computer Architecture for Software Engineers By 作者: Brian R. Hall – Kevin J. Slonka ISBN-10 书号: 1943153329 ISBN-13 书号: 9781943153329 Edition 版本: Edition 1.0 出版日期:...