Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 13 Nov 2001 23:30:20 +0100 (CET)
From:      Khaled Daham <khaled@w-arts.com>
To:        <freebsd-alpha@freebsd.org>
Subject:   Alpha assembler programming.
Message-ID:  <20011113231429.W97694-100000@fantasy.telia.net>

next in thread | raw e-mail | index | archive | help
Hello!

I have convinced myself to do some assembly coding on alpha for some
reason. I have almost managed to do a simple hello world involving
write(2).

main:
    lda $16, 1
    lda $17, msg
    lda $18, len
    jsr write
    lda $16, 0
    jsr exit

which bombs out on

 45328 a.out    CALL  write(0x1,0x1200107a0,0xc)
 45328 a.out    GIO   fd 1 wrote 12 bytes
       "Hello World!"
 45328 a.out    RET   write 12/0xc
 45328 a.out    PSIG  SIGSEGV SIG_DFL

I am note sure why I get the SIGSEGV, anyone ?

Another thing I noted in /usr/src/sys/alpha/alpha/support.s
is the line

lda     a0, longjmp_botchmsg

where longjmp_botchmsg is a string just like my
lda $16, msg
( $16 == a0 ) but I cannot get gcc to compile if I use
lda a0, msg
gcc returns "Error: inappropriate arguments for opcode `lda'"
I cannot really see why it does not accept it, except that in the
alpha assembler guide's I have seen a0-a5 is used for passing integers,
but howcome the mapping between $16-$21 to a0-a5.

Does anyone know a good site with some alpha assembly examples using C
calling convention ?

680x0 was alot easier :)

/Khaled Daham, w.arts
Mail:    khaled@w-arts.com
Cell:    +46-70-6785492
FreeBSD: The Power to Serve! http://www.FreeBSD.org/

This isn't rocket science -- but it _is_ computer science.



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-alpha" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20011113231429.W97694-100000>