您的位置:首页 > 其它

freebsd at&t 汇编 hello world

2013-07-01 21:58 330 查看
.section .data //数据段
  msg: .ascii "hello world\n\0"
.set len,.-msg //得到字符串长度
.section .text
.globl _start  //入口
  _start:  
  push $len  
  pushl $msg
  pushl $0x01
  pushl $0x00
  movl $0x04,%eax
  int $0x80
  pushl %eax
  pushl $0x00
  movl $01,%eax
  int $0x80

使用as编译链接

$as hello.s -o hello.o
$ld hello.o -o hello.bin
$./hello.bin
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: