Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 04 Sep 1999 00:31:44 +0200
From:      Gerald Heinig <gh046171@post.rwth-aachen.de>
To:        Jason <jes@hal-pc.org>
Cc:        freebsd-sparc@FreeBSD.ORG
Subject:   Re: Status of FBSD sparc porting?
Message-ID:  <37D04C4F.C5E1F862@post.rwth-aachen.de>
References:  <199909012314.TAA11490@weedcon1.cropsci.ncsu.edu> <37CFC28D.7063AF7A@post.rwth-aachen.de> <19990903120227.07974@hydrogen.fircrest.net> <008d01bef645$0efb9e60$0500a8c0@local.nullifier.dyn.ml.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Jason wrote:

> > Gerald Heinig scribbled this message on Sep 3:
> > > 1) Is it better/more sensible to use the NetBSD code or even Linux stuff
> > > to find out how to do things or is it better to get your own docs and
> > > solve the problem yourself? Personally, I'd much prefer to "roll our
> > > own", although it's probably far more work and considerably more
> > > difficult. However, we'd all learn more that way. Anyone have any ideas
> > > on this?
> >
> > well, if you followed suite, dfr based the alpha port off of netbsd
> > code...  which seems to of work pretty well...
>
> It would be best if you (Gerald Heinig) use any resources at your disposal.
> It won't prevent anyone, even you, from writing it from scratch.
>
> The only info I've found to a specific MMU is for the ss2 at
> http://choices.cs.uiuc.edu/cs423/sparc/index.html, and then I don't know if
> it is accurate.
>
> > > 3) Is there a rough overview of what happens and where, when the FreeBSD
> > > kernel starts up? I'm looking for something like the description of the
> > > Minix source code in Andrew Tanenbaum's "Operating systems: design and
> > > implementation". The book by Karels/McKusick/Bostic/Quarterman is too
> > > high-level (ie. not enough detail) and the source code is too much
> > > detail.
> > > Does something like this exist?
> >
> > the FreeBSD kernel starts up in sys/kern/init_main.c... the function
> > that starts everything off used to be call main, but it was reciently
> > changed to mi_startup (r1.120)... that function is basicly just a sort
> > function to sort all the sysinit's and then run them...  (hmmm.. that's
> > right, I was going to write a function to start up sysinit's so that we
> > didn't have the code duplicated in the kld loader)...
> >
> > so, REALLY what you need to do is look at the order in which the
> > sysinit's get run...
> > --
> >   John-Mark Gurney Voice: +1 541 684 8449
> >   Cu Networking   P.O. Box 5693, 97405
>
> Actully, it starts in src/sys/ARCH/ARCH/lcore.s::btext, which the loader
> calls. lcore calls src/sys/kern/init_main.c::mi_startup when it is done.
>
> You might as well step through a port starting with its lcore.s. The source
> is reather easy to follow. Besides, you need to anyway if you are thinking
> of writing a port.
>
> I'm missing the step between the boot loader starting the kerenl, but here
> goes a short summary (in other words, 'take with a grain of salt'/look for
> yourself) based on /i386-current.
>
> The boot loader's entry point into the kernel is in
> src/sys/i386/i386/lcore.s. Somewhere the loader calls/steps into the
> function btext. lcore goes through the motions, setting up the machine
> specific things, such as:
>
> init'ing BIOS settings
> setting up the kdb throughout
> getting the boot info from the loader (cookies)
> figures out the cpu vender/model
> starts allocating structs based on KERNBASE
> initial pmap structs (page tables) and sets up the MMU
> sets up the boot stack
> calls src/sys/kern/init_main.c::mi_startup() which starts running
> sysinit/KLD subsystems
>
> You can find the subsystems but a simple 'grep -R SYSINIT *' or better yet,
> set up gtags and do a 'global SYSINIT'. The next thing is the order of
> executions. You can find those in src/sys/sys/kernel.h::sysinit_sub_id.
>
> Of course the first thing its got to do is set up the console, then you see
> the copyright notice, after which it sets any tunable variables, VM, KVM,
> prints cpu info, sets up KLD's, init (proc 0), etc.
>
> That should be enought to get you started. See, the source isn't that hard
> to follow.
>

Fantastic. Thanks very much indeed.
I'll have a look at the lite sources as well (didn't think of that... duh...
:-( ).

Cheers

Gerald



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-sparc" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?37D04C4F.C5E1F862>