2010年5月26日

Linux Assembly Hello, world!

Linux Assembly HOWTO
Linux Assembly HOWTO - Chapter 6. Quick start
# hello.S
.text

.globl _start

_start:
movl $len, %edx
movl $msg, %ecx
movl $1, %ebx
movl $4, %eax
int $0x80

xorl %ebx, %ebx
movl $1, %eax
int $0x80

.data

msg:
.ascii "Hello, world!\n"
len = . - msg


# Makefile

all: hello.o
ld -s -o hello hello.o

hello.o: hello.S
as -o hello.o hello.S

clean:
rm -f hello.o hello

run:
./hello


$ make all run

沒有留言:

網誌存檔