Subject: Re: Another Kernel Question
To: None <ijonglin@EE.Princeton.EDU>
From: Ken Nakata <kenn@synap.ne.jp>
List: port-mac68k
Date: 07/22/1998 21:50:25
On Wed, 22 Jul 98 4:08:12 EDT, I-Jong Lin wrote:
> 
> 1.  When the code hits the start symbol, does logical 0 = physical 0
>     as far as memory locations are concerned?  If it doesn't, how
>     can I assure that a mapping like this exists temporarily?

If you boot NetBSD with MacOS Virtual Memory turned OFF (which is
requred), virtual == physical for all addresses, I think.

But I'm not sure how long this assumption wil be valid.  Later on
(e.g. in a device driver), you should convert kernel virtual address
into physical address using kvtop() function, or you should map a
chunk of physical space into kernel virtual space with bus_space_map()
(and unmap it with bus_space_unmap() when you're done with it).

> 2.  If NetBSD is somehow confronted with a Mac IIcx that seems to
>     have an '040 running in it, will kernel be able to handle it?
>     Or will it just crash?

I don't think I fully understand what you really mean...  Anyway,
processor type and machine model are determined separately and stored
into separate variables.  So machine and processor types should be
orthogonal, and 68040 on IIcx should (at least theoretically) Just
Work provided that there's no extra address translation mechanism on
the accelerator logic (i.e. every address is the same for the original
68030 and the accelerator's 68040), if that's what you are asking.

> 3.  The code that I'm adding effectively is just inserted after the
>     start symbol.  I need to somehow debug this code, so is there
>     any way of having some side effect that I can notice so that I know
>     where the code is going?   Someone mentioned GRAYBARS, but I don't
>     think the video is set up by then...

I think it is.  NetBSD/mac68k is bootstrapped by a MacOS application.
All you have to do is refer to a few variables passed by the Booter,
i.e.  videoaddr, videorowbytes, videobitdepth, videosize, etc. (of
course, this assumption will be invalid when we ever support native
bootstrap).

But these variables will not have been initialized yet when program
counter hits `start', so you'll have to initialize them yourself with
the values passed by Booter.  See getenvvars() in machdep.c for how to
obtain values for these variables, and ite.c for their use.

Hope this helps,

Ken