9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: "Russ Cox" <rsc@plan9.bell-labs.com>
To: 9fans@cse.psu.edu
Subject: Re: [9fans] kernel config changes
Date: Fri, 24 Jan 2003 11:52:40 -0500	[thread overview]
Message-ID: <33aa3b4ddd8d675fa801e5870918d68d@plan9.bell-labs.com> (raw)
In-Reply-To: <C2ACD5D6-2F45-11D7-8ECC-000A27AE643E@sockfarm.net>

There's now both port/initcode.c, which does almost
what I posted (I've since noticed that the exec cmd line
args get passed into the main function, now called startboot):

#include <u.h>
#include <libc.h>

char cons[] = "#c/cons";
char boot[] = "/boot/boot";
char dev[] = "/dev";
char c[] = "#c";
char e[] = "#e";
char ec[] = "#ec";
char s[] = "#s";
char srv[] = "/srv";
char env[] = "/env";

void
startboot(char *argv0, char **argv)
{
	open(cons, OREAD);
	open(cons, OWRITE);
	open(cons, OWRITE);
	bind(c, dev, MAFTER);
	bind(ec, env, MAFTER);
	bind(e, env, MCREATE|MAFTER);
	bind(s, srv, MREPL|MCREATE);
	exec(boot, argv);
	for(;;);
}

On the MIPS there is still an assembly stub
that initializes R30 (SB).

TEXT	_main(SB), $8
	MOVW	$setR30(SB), R30
	MOVW	$boot(SB), R1
	ADD	$12, R29, R2	/* get a pointer to 0(FP) */
	MOVW	R1, 4(R29)
	MOVW	R2, 8(R29)
	JAL	startboot(SB)

The 386 uses just the C code -- no assembly required.

You should be able to do almost exactly the same
thing for the bitsy -- SB is R12.

Russ


  reply	other threads:[~2003-01-24 16:52 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-12-13  8:32 Russ Cox
2002-12-13 16:32 ` Jack Johnson
2003-01-24  2:44 ` John Packer
2003-01-24 16:52   ` Russ Cox [this message]
2003-01-26 22:40     ` john

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=33aa3b4ddd8d675fa801e5870918d68d@plan9.bell-labs.com \
    --to=rsc@plan9.bell-labs.com \
    --cc=9fans@cse.psu.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).