Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1063322
  • 博文数量: 284
  • 博客积分: 8223
  • 博客等级: 中将
  • 技术积分: 3188
  • 用 户 组: 普通用户
  • 注册时间: 2008-12-01 13:26
文章分类

全部博文(284)

文章存档

2012年(18)

2011年(33)

2010年(83)

2009年(147)

2008年(3)

分类: LINUX

2009-09-14 20:34:00

sem.s
 

.section .data

.section .text
.globl _start
_start:
 pushl $5
 call power
 add $4, %esp
 movl %eax, %ebx
 movl $1, %eax
 int $0x80
 
.type power, @function
power:
 pushl %ebp
 movl %esp, %ebp
 
 movl 8(%ebp), %eax
 
 cmpl $1, %eax
 je power_end
 decl %eax
 pushl %eax
 call power
 movl 8(%ebp), %ebx
 imull %ebx, %eax
 
power_end:
 movl %ebp, %esp
 popl %ebp
 ret
 

 

as -o sem.o sem.s

ld -o sem sem.o

echo $?

阅读(745) | 评论(0) | 转发(0) |
0

上一篇:signal练习1

下一篇:汇编练习-读写文件

给主人留下些什么吧!~~