Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 14 Nov 2001 13:06:39 +0100 (CET)
From:      Khaled Daham <khaled@w-arts.com>
To:        <freebsd-alpha@FreeBSD.ORG>
Subject:   Re: Alpha assembler programming.
Message-ID:  <20011114130158.Y22961-100000@fantasy.telia.net>
In-Reply-To: <20011114115912.A42331@cicely8.cicely.de>

index | next in thread | previous in thread | raw e-mail

On Wed, 14 Nov 2001, Bernd Walter wrote:

> I did this "Hello World!" a long time ago.
> IIRC it was based on the hello world in the FreeBSD programmers guide
> for i386.
>
> cc -c -g -x assembler-with-cpp -ffixed-8 hello-world2.s
> ld -o hello-world2 hello-world2.o
>
>
> #include <machine/asm.h>
>         .text
>         .globl _start                           /* must be declared for linker (ld) */
>
> textseq:
> msg:    .ascii          "Hello, world!\n"       /* our dear string */
>         .equ            t12diff, _start-textseq
>         .equ            len, . - msg            /* length of our dear string */
>
> _start:                                         /* tell linker entry point */
>         subq            t12,t12diff,gp          /* get address of .text */
>         addq            zero,1,a0               /* file descriptor (stdout) */
>         addq            gp,textseq-msg,a1       /* message to write */
>         addq            zero,len,a2             /* message length */
>         addq            zero,0x4,v0             /* system call number (sys_write) */
>         call_pal        PAL_OSF1_callsys        /* call kernel - errors returned in a3 */
>         addq            zero,0x0,v0             /* system call number (sys_exit) */
>         call_pal        PAL_OSF1_callsys        /* exit */

I got it all working by including machine/asm.h and using CALL(write)
instead of just jsr write ( which resulted in a SIGSEGV ).

/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



help

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