From mboxrd@z Thu Jan 1 00:00:00 1970 MIME-Version: 1.0 In-Reply-To: References: Date: Thu, 18 Feb 2016 12:28:45 +0000 Message-ID: From: Charles Forsyth To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> Content-Type: multipart/alternative; boundary=001a114846a6fad67e052c0a818e Subject: Re: [9fans] startboot signature Topicbox-Message-UUID: 8562d150-ead9-11e9-9d60-3106f5b1d025 --001a114846a6fad67e052c0a818e Content-Type: text/plain; charset=UTF-8 On 17 February 2016 at 08:19, Giacomo Tesio wrote: > Out of curiosity, why the startboot function in port/initcode.c is `void > startboot(char *argv0, char **argv)` given the argv0 is ignored? > > I see that this simplify various main() in init9.s but I wonder why not > simply use `void startboot(char **argv)` > There's possibly some historic reason for having argv0 instead of argc (ie, possibly a time when argv0 was used), but it also makes things a little easier on platforms (all but 386) where the first parameter is passed in a register. Since the setup code is machine dependent, it could get that right by setting r0, r3 or bp in the saved Ureg, but it probably isn't worthwhile changing all that now. --001a114846a6fad67e052c0a818e Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable

= On 17 February 2016 at 08:19, Giacomo Tesio <giacomo@tesio.it> wrote:
Out of curiosity, why the= startboot function in port/initcode.c is `void startboot(char *argv0, char= **argv)` given the argv0 is ignored?

I see that this sim= plify various main() in init9.s but I wonder why not simply use `void start= boot(char **argv)`

There's possibly some hi= storic reason for having argv0 instead of argc (ie, possibly a time when ar= gv0 was used),
but it also makes things a l= ittle easier on platforms (all but 386) where the first parameter is passed= in a register.
Since the setup code is mac= hine dependent, it could get that right by setting r0, r3 or bp in the save= d Ureg,
but it probably isn't worthwhil= e changing all that now.
--001a114846a6fad67e052c0a818e--