Subject: Re: m68k comman part (was Re: mips ports ...)
To: Guenther Grau <>
From: Jason Thorpe <>
List: current-users
Date: 03/18/1996 13:44:37
On Mon, 18 Mar 1996 15:28:02 +0100 
 Guenther Grau <> wrote:

 > Hmm, Yes, I agree with you, that the Mac and the Atari development are
 > coupled quite closly together from what I read on the src-changes list.
 > But the Amiga is the most common m68k-plattform in use for NetBSD and
 > it does NOT have any FPE emulation built in, i.e. it is not possible to
 > boot NetBSD on an Amiga without FPU. Thus your work is shared beween
 > Mac and Atari, but not the Amiga community. Therefore I was not wrong
 > or incorrect as you say :-)

While it's true that you'll make a fair number of changes, they're not 
that difficult.  I plan on making the same set of changes to the hp300 
port RSN.  Doing so will enable the m68k ports to share Yet More Code 
(like signal handling foo, etc.) since some of the code requires dealing 
with the FPU.

Essentially, every place in src/sys/arch/amiga/*/*.c where you see:


needs to be changed.  Currently, the decision to execute those 
intructions is made at compile time, where it needs to be made at 
run-time.  This is pretty simple to do...your FPU probe code (which 
always "succeeds") tests for the existence of an FPU, and sets the 
"fputype" global variable appropriately, 0 for "emulator", 1 for "68881", 
2 for "68882", and 3 for "68040".  Eventually, I imagine there will be a 
4 for "68060".  To determine if that code should be executed, basically, 

	if (fputype) {
		/* code code code code */

The FPU type constants *should* be defined in an m68k-specific header 
file, not per-port.

 > I agree qith you that some parts are shared between the ports, but there
 > are a lot more things which the ports have in common, for example some
 > of the device drivers. I seecomments on the src-changes list like
 > Mac: taken 5380-driver from Amiga and modified ...
 > Atari: taken 5380-driver from Mac and modified ...
 > Mac: Using MI-5380-driver now ...
 > Amiga: Modified 5380 driver ...

Currently, the Sun 3, SPARC, and pc532 ports use the MI 5380 code.  The 
mac68k port also has a driver for the MI 5380 code, but apparently is 
lacking some of the features of the "other" 5380 driver.

The "other" 5380 driver is one written by Leo Weppleman for the Atari.  
It also has some things that cope with hardware weirdness on some 
versions of the Atari hardware, which will have to be added to the MI 
5380 driver in order for the Atari to use it.

The Amiga 5380 drivers, well, should use the MI 5380 driver, and it 
probably wouldn't be *that* hard to make them do so.  Currently, the 
Amiga has one 5380 back-end ("sci") and N DMA controller front-ends, so 
it's really in the spirit of the MI driver...

 > In pratice all ports should be using the MI-5380-code, but only some
 > of them are actually doing so :-( I'd really like this development
 > more coordinated and I'd like your code living in /sys/arch/m68k and
 > being used in all m68k-ports, really! :-)

Sometimes, for port-masters, it's a matter of priorities.  I haven't been 
terribly visible on the "adding features" or "pulling code into 
sys/arch/m68k" frontiers for the hp300 port lately, for example.  This is 
primarily because I've *re-writing* large portions of the hp300 port for 
new config (which, I'm happy to report, is coming along nicely ... save 
one console bug, I can boot a new config kernel diskless into 
multi-user).  I think that for many other port-masters, this is also the 
case ... trying to fix bugs, or even writing a driver in the first place, 
is taking precedence over moving code into sys/arch/m68k...

However, I think it's fair to say that most port-masters appreciate 
contributions from the user community.  I'm sure if an Amiga user were to 
submit a PR with a set of patches to make the FPU probe code work on the 
amiga (see the sun3 port for an example), the amiga port-master or one of 
the amiga supporting cast would gladly check it in (providing it was the 
Right Thing :-)

Jason R. Thorpe                             
NASA Ames Research Center                               Home: 408.866.1912
NAS: M/S 258-6                                          Work: 415.604.0935
Moffett Field, CA 94035                                Pager: 415.428.6939