ASM linux helloworld
2013-05-06 17:41
543 查看
Sourcecode:(NASM hello.asm)
Ubuntu:编译执行:
nasm -f elf hello.asm
ld --oformat elf32-i386 -m elf_i386 -o hello hello.o
./hello
结果:Hello, world!
section .data ;section declaration msg db "Hello, world!",0xa ;our dear string len equ $ - msg ;length of our dear string section .text ;section declaration ;we must export the entry point to the ELF linker or global _start ;loader. They conventionally recognize _start as their ;entry point. Use ld -e foo to override the default. _start: ;write our string to stdout mov edx,len ;third argument: message length mov ecx,msg ;second argument: pointer to message to write mov ebx,1 ;first argument: file handle (stdout) mov eax,4 ;system call number (sys_write) int 0x80 ;call kernel ;and exit mov ebx,0 ;first syscall argument: exit code mov eax,1 ;system call number (sys_exit) int 0x80 ;call kernel
Ubuntu:编译执行:
nasm -f elf hello.asm
ld --oformat elf32-i386 -m elf_i386 -o hello hello.o
./hello
结果:Hello, world!
相关文章推荐
- linux nasm helloworld
- Linux设备驱动程序学习(0)-Hello, world!模块
- linux下32位汇编hello, world!
- linux GPU helloworld.
- Linux下G++编译第一个C++程序(Hello, world)
- (转)Linux下编写C程序( GCC )(hello,world)
- Linux设备驱动程序学习(0) -设备驱动介绍& Hello, world!模块
- linux gcc /n Hello world!
- Notes [ Linux Device Drivers, 3rd Edition ( Ch02 ) - The Hello World Module ]
- win32 asm Hello World Demo
- Compile my helloworld cpp program on Ubuntu linux
- 用汇编写的第一个程序---helloworld.asm
- Linux Device Driver1 -- "hello world"
- Bluefish Linux下的web编辑神器-Hello,World
- a hello world module for linux device driver
- linux下的hello_world驱动的Makefile
- Linux设备驱动程序学习(0)-Hello, world!模块
- linux2.6驱动编程第一例:hello,world的实现步骤
- .Linux设备驱动程序学习(0)——设备驱动介绍& Hello, world!模块 内核参数传递
- win32 asm Hello World Demo