Date: Sat, 27 Oct 2001 18:10:21 +0100 (BST) From: Doug Rabson <dfr@nlsystems.com> To: Peter Wemm <peter@wemm.org> Cc: <ia64@freebsd.org> Subject: Re: ia64 crti.S and crtn.S Message-ID: <20011027180634.B549-100000@salmon.nlsystems.com> In-Reply-To: <20011027081947.A3B56380A@overcee.netplex.com.au>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, 27 Oct 2001, Peter Wemm wrote: > I've discovered there are no crti/crtn implementations in the tree.. I've > hacked together these ultra-trivial crti/crtn implementations: > > .file "crti.S" > > .section .init > .global _init# > .proc _init# > _init: > alloc loc1 = ar.pfs,0,2,0,0 > mov loc0 = b0 /* Save return addr */ > .endp _init# > > .section .fini > .global _fini# > .proc _fini# > _fini: > alloc loc1 = ar.pfs,0,2,0,0 > mov loc0 = b0 /* Save return addr */ > .endp _fini# > > And: > .file "crtn.S" > > .section .init > .regstk 0,2,0,0 > mov b0 = loc0 /* Recover return addr */ > mov ar.pfs = loc1 > br.ret.sptk.many b0 > .endp _init# > > .section .fini > .regstk 0,2,0,0 > mov b0 = loc0 /* Recover return addr */ > mov ar.pfs = loc1 > br.ret.sptk.many b0 > .endp _fini# > > Would anybody care to comment on these? I'm in the process of putting > together a build script to build the working parts of the userland, > libraries and includes in one go, and these files came up. They look fine to me. > > Second question.. Can I use a caller-saved register (eg: r4-r7) for this > to avoid the pfs save/restore? Or would I have to use the register stack > anyway in order to preserve our caller's r4-r7 first, thus defeating > the purpose? > > (This is partly based on gcc output for clues). You can't use r4-r7 to save rp because that would trash your caller's version of r4. The only way to avoid the alloc would be to save rp on the stack: mov r14=rp // copy to general reg ;; st8 [sp]=rp,-16 // save and reserve stack space ... add sp=16,sp ;; ld8 r14=[sp] ;; mov rp=r14 I doubt if it would be better than using alloc though. -- Doug Rabson Mail: dfr@nlsystems.com Phone: +44 20 8348 6160 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-ia64" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20011027180634.B549-100000>