Subject: Re: Can anyone help with NetBSD/Alpha asm code?
To: None <tlb@eecs.harvard.edu>
From: John Birrell <cimaxp1!jb@werple.net.au>
List: port-alpha
Date: 12/05/1995 14:29:26
Trevor,

I tried changing the 'ldiq    v0, -1' to return another number, and this
proved that it wasn't reporting an accurate address. The program was trying
to return.

I found a reference in /usr/include/machine/asm.h to the LEAF() macro stating
that it is not expecting functions to be called (so it doesn't set up a frame).
I changed the code to ....

NESTED(cerror, 0, 8, ra, 0, 0)
    br      t0, 1f
1:  SETGP(t0)
    lda sp, -8(sp)
    stq ra, 0(sp)
    mov     v0, a0
    CALL(__error)
    stl     a0, 0(v0)
    ldiq    v0, -1
    ldq ra, 0(sp)
    lda sp, 8(sp)
    RET

so that the return address wasn't trashed by the call to __error and it
works!

Thanks for your help.

Regards,

-- 
John Birrell                                CIMlogic Pty Ltd
jb@cimlogic.com.au                          119 Cecil Street
Ph  +61  3 9690 9600                        South Melbourne Vic 3205
Fax +61  3 9690 6650                        Australia
Mob +61 18  353  137