x64 linux 下C语言、AT&T格式…
来源:互联网 发布:销售月数据分析表格 编辑:程序博客网 时间:2024/04/28 10:15
1、main.c
#include<stdio.h>
inttest(int x);
intmain ()
{
printf ("调用汇编语言编写的函数test()结果为:%d\n",test(5));
}
2、test.C
.data
.align16
.text
.globaltest
#integer parameters: rdi, rsi, rdx, rcx, r8, r9
#buff -> rdi
#buffSize -> rsi
test:
pushq %rbp # push base pointer of caller to stack
movq %rsp, %rbp # put stack pointer of caller to base pointer
movq %rdi, %rax # return value should be put in rax register
leaveq # mov %rbp, %rsp
# pop %rbp
retq # return
3、编译
$gcc -o test main.c test.S
4、运行
$./test
调用汇编语言编写的函数test()结果为:5
#include
int
int
2、test.C
.data
.align
.text
.global
#
#
#
test:
3、编译
$
4、运行
$
调用汇编语言编写的函数test()结果为:5
0 0
- x64 linux 下C语言、AT&T格式…
- Linux 下使用 NMON&nbsp…
- Linux 下 PHP 对&n…
- Windows7 x64 安装&nbsp…
- 【Objective-C 语言】10&nbsp…
- Win8 x64环境下VS2010 C…
- (转)linux下 gcc&nbsp…
- .Linux 下使用 NMON&nbs…
- Online C++ compilers,&…
- c# vs2010 directsound&…
- c# vs2010 directsound&…
- 【原创】 linux Python&…
- 【转载】 linux Python&…
- C# 如何在 Windows&nbsp…
- Lesson 131 Don't&…
- -Linux Kernel SMP&nbsp…
- -Linux Kernel SMP&nbsp…
- 记录red hat linux&nbsp…
- 倒韩这半年
- 使用Struts标签的基本配置
- linux下opengl
- 关于PHP连接ORACLE问题(06年自己写…
- 关于struts2 和velocity 配置后,t…
- x64 linux 下C语言、AT&T格式…
- Ubuntu环境下FLTK开发OpenGL程序
- Ubuntu环境下FLTK开发OpenGL程序
- 修改当前目录下文件的后缀(如.c文…
- ubuntu下安装宋体simsun
- 《算法4》——补全左括号的问题
- 将当前目录的各子目录下的文件名前…
- 文件编码转换
- UNetbootin for Linux制…