linux下32位汇编hello, world!
2015-09-23 11:07
585 查看
SECTION .data ; section containing initialized data HelMsg: db "Hello World!",10 HelLen: equ $-HelMsg SECTION .bss ; section containing uninitialized data SECTION .text ; section containing code global _start ; linker needs this to find the entry point! _start: mov eax,4 ; specify sys_write syscall mov ebx,1 ; specify file decriptor 1: stdout mov ecx,HelMsg ; pass offset of the message mov edx,HelLen ; pass the length of the message int 80H ; mke syscall to output the text to stdout mov eax,1 ; sepcify exit syscall mov ebx,0 ; return zero int 80H ; make syscall to terminate the program
在32位主机上编译时编译:
makefile
hello: hello.o ld -o $@ $^ hello.o: hello.asm nasm -f elf -g -F stabs $<
在64位的主机上编译时
makefile
hello: hello.o ld -m elf_i386 -o $@ $^ hello.o: hello.asm nasm -f elf32 -g -F stabs $<
相关文章推荐
- Media---I,P,B帧区别
- Linux各个服务的配置命令
- linux运维实战练习-2015年9月13日-9月15日课程作业
- Centos6.5安装与配置JDK-8(简单实用)
- linux /etc/hosts文件作用
- vim使用
- dd if=/dev/zero of=的含义是什么?Linux 下的dd命令使用详解
- centos6.5下Zabbix系列之Zabbix安装搭建及汉化
- CentOS6.5 heartbeat高可用集群的详解及工作流程
- linux下real-only system解决方法
- Linux服务器--1.DNS服务器
- linux c++ 字符串时间格式转unix timestamp
- Android系统启动流程 -- linux kernel
- Creating CentOS images ready for Openstack
- Linux文件权限详解
- Linux下CVS的安装配置与操作命令全解析
- linux centos6 NAT 端口转发
- Centos7搭建集中式日志系统
- linux目录 ~ 和/的区别
- Linux下搭建DNS 服务器