Subject: Direct syscall in asm
To: NetBSD/Alpha <port-alpha@netbsd.org>
From: B. James Phillippe <bryan-nospam@darkforest.org>
List: port-alpha
Date: 01/29/2002 14:29:10
Hello,
I'm attempting to overcome a long-time weakness with asm by coding up some
examples, starting with "Hello World". Most of the resources I find are
for either x86, Linux or Microsoft/Intel-style asm. I'd like to learn
using NetBSD/alpha and GNU as, since that is what I use. I have been
reading the Alpha reference material and it appears I need to issue a
call_pal with a value of 0x83 (for syscall). If I'm understanding the
material properly, I need to first push the arguments to the stack
(including the system call number). I guess I'm hoping someone here would
be able to show a minimal example of how this is done under NetBSD.
This is what I have so far, which crashes and burns (sig11) on invocation:
.data
mystr: .asciz "Hello world!\n"
len = . - mystr - 1
.text
.globl __start
__start:
ldgp $29,0($27)
lda $sp,-32($sp)
ldq $19,len
lda $18,mystr
ldl $17,1
ldl $16,4
call_pal 0x83
ret
thanks,
-bp
--
# bryan at darkforest dot org
# Software Engineer