From owner-freebsd-sparc Fri Sep 3 15:32:41 1999 Delivered-To: freebsd-sparc@freebsd.org Received: from mail.rwth-aachen.de (mail.RWTH-Aachen.DE [137.226.144.9]) by hub.freebsd.org (Postfix) with ESMTP id 7C2D415EBB for ; Fri, 3 Sep 1999 15:32:24 -0700 (PDT) (envelope-from gh046171@post.rwth-aachen.de) Received: from post.rwth-aachen.de (s4m145.dialup.RWTH-Aachen.DE) by mail.rwth-aachen.de (PMDF V5.1-12 #D3869) with ESMTP id <01JFJXCRIY6I00121D@mail.rwth-aachen.de> for freebsd-sparc@FreeBSD.ORG; Sat, 4 Sep 1999 00:32:55 +0200 Date: Sat, 04 Sep 1999 00:31:44 +0200 From: Gerald Heinig Subject: Re: Status of FBSD sparc porting? To: Jason Cc: freebsd-sparc@FreeBSD.ORG Reply-To: heinig@hdz-ima.rwth-aachen.de Message-id: <37D04C4F.C5E1F862@post.rwth-aachen.de> Organization: Institute of Computer Science in Mechanical Engineering MIME-version: 1.0 X-Mailer: Mozilla 4.6 [en] (X11; I; FreeBSD 3.1-RELEASE i386) Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7bit X-Accept-Language: en 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> Sender: owner-freebsd-sparc@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org 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