Subject: Re: Assembly Language Programs
To: Alessandro Coppelli <coppelli@dsea.unipi.it>
From: Ben Collver <collver@peak.org>
List: tech-kern
Date: 04/12/2006 05:29:55
Why tech-kern?

Here is an example:

# as -o foo.o --gstabs foo.s
# ld -m elf_i386 -dc -static foo.o
# ./a.out
hi there

# cat >foo.s <<__EOF__
.section ".note.netbsd.ident", "a"
.long 2f-1f
.long 4f-3f
.long 1
1: .asciz "NetBSD"
2: .p2align 2
3: .long 199905
4: .p2align 2

.text
	.align 4
	.globl _start
_syscall:
	int $0x80
	ret
_start:
	pushl $msglen
	pushl $msg
	pushl $1
	movl $4,%eax
	call _syscall
	addl $12,%esp

	pushl $0
	movl $1,%eax
	call _syscall
	addl $4,%esp

msg:
	.ascii "hi there\n"
	msglen = . - msg
__EOF__