Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site hp-pcd.UUCP Path: utzoo!linus!decvax!harpo!seismo!hao!hplabs!hp-pcd!hpfcla!ajs From: ajs@hpfcla.UUCP Newsgroups: net.lang.c Subject: Re: var args - (nf) Message-ID: <2346@hp-pcd.UUCP> Date: Sun, 6-Nov-83 03:37:27 EST Article-I.D.: hp-pcd.2346 Posted: Sun Nov 6 03:37:27 1983 Date-Received: Tue, 8-Nov-83 08:12:14 EST Sender: notes_gateway@hp-pcd.UUCP Organization: Hewlett-Packard, Fort Collins, CO Lines: 29 #R:duke:-363700:hpfcla:1500001:000:1014 hpfcla!ajs Nov 4 15:01:00 1983 The HP9000 Series 500 also has a stack which grows upwards in address space. We attacked the variable-number-of-arguments problem this way: 1: Push the return area first (two words). 2: Push the arguments in reverse order (right to left), so the left-most is highest on the stack, at a known offset from the frame pointer. 3: Push additional information, including a return area pointer and a number-of-arguments word. A C program can't get to the additional information cleanly but it can be done if necessary. Either the return area pointer or number of arguments may be useful. Also, be warned that execl(2), execlp(2), and execlv(2) make assumptions about the order of the arguments (at least for System III). If you reverse that order, you have to correct the intrinsics. (I hope this is of general enough interest to merit posting it instead of responding by mail...) Alan Silverstein, hpfcla!ajs Hewlett-Packard Fort Collins Systems Division, Colorado