🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.amiga.tech
Article #9464

Re: Parameters to Librhcr

#9464
From: Jeff Kelley
Date: Tue, 09 Aug 1988 18:44
37 lines
2431 bytes
[ To reread the original article, use ^P in rn (is this hypertext?) ]

>Can anyone confirm/deny this hunch for me, or better yet tell me exactly 
>how parameters are handled?
>

Exec does not concern itself with the parameters, the mechanism by which
they are passed to the library is purely a convention between the 
assembler routine that you link with and the .library.  Traditionally,
the assembler routine takes the parameters off the stack (where they
were put when you called it from your C code) and puts them into the
registers the .library code is expecting them in (at the back of the
Exec RKM you can find the specifications for 1.1 library functions).
Another convention is that pointers should be passed in address registers,
everything else in data registers, but this isn't always followed (e.g.
dos.library).  Both these conventions were adopted, I presume, to optimize
the speed potential of the library code.

You can, however, define your own convention for passing arguments to your
.library.  If you are writing the .library in C, it may be convenient to decree
that all arguments will be passed on the stack.  Your assembler routine would
then only need to 'JMP' (not 'JSR') to the appropriate .library
vector.  That library vector could then 'JMP' directly to your .library
function written in C.  This avoids the wastage of time (and space) needlessly
taking parameters from the stack and putting them in registers only to push
the register values back on the stack again.

It would be nice if the Lattice C '#pragma libcall' feature would support this
method of passing parameters, as it currently only supports the pass-in-register
model (which is, admittedly, adequate for the system libraries).

--
Jeff Kelley    Graphics Lab, Dept. of Computer Science, University of Waterloo
   uunet!watmath!watcgl!jvkelley  	tel:   (519) 578-4514
"Remember, this is not a competition, only an exhibition. Please, no wagering."
	- David Letterman
Technical Details
Message-ID: <5457@watcgl.waterloo.edu>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!water!watmath!watcgl!jvkelley
References: <3716@hcr.UUCP>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!water!watmath!watcgl!jvkelley
From: jvkelley@watcgl.waterloo.edu (Jeff Kelley)
Newsgroups: comp.sys.amiga.tech
Subject: Re: Parameters to Librhcr
Keywords: .library Lattice 5.0 wish list #pragma libcall
Message-ID: <5457@watcgl.waterloo.edu>
Date: 9 Aug 88 18:44:55 GMT
References: <3716@hcr.UUCP>
Reply-To: jvkelley@watcgl.waterloo.edu (Jeff Kelley)
Organization: U. of Waterloo, Ontario
Lines: 37