linux 32位汇编(hello world;)
#hello.s
.data #data
msg : .string "Hello ,As Compliner!! Linux\n"
len = . - msg
.text
.global _start
_start :
movl $len, %edx
movl $msg, %ecx
movl $1, %ebx
movl $4, %eax
int $0x80
movl $0, %ebx
movl $1, %eax
int $0x80
linux 64 位汇编:
#hello.s
.data #data
msg : .string "Hello ,As Compliner!! Linux\n"
len = . - msg
.text
.global _start
_start :
movq $len, %rdx
movq $msg, %rcx
movq $1, %rbx
movq $4, %rax
int $0x80
movq $0, %rbx
movq $1, %rax
int $0x80
编译 :
$:as -o hello.o hello.s
$:ld -o hello hello.o
$:chmod a+x ./hello
$:./hello