Subject: Separation of cpu-specific from machine-specific stuff
To: None <tech-kern@netbsd.org>
From: Wolfgang Solfrank <ws@tools.de>
List: tech-kern
Date: 01/24/2001 17:41:30
Hi,

In light of the occasional reiteration of the plan to separate cpu-specific
from machine-specific stuff, I'd like to offer the following proposal for
discussion:

Assume we want to leave machine-specific stuff in src/sys/arch/...
and move cpu-cpecific stuff to src/sys/cpu/...

For this we need to

	a) modifiy config to get config files from
	arch/$MACHINE/conf/files.$MACHINE and
	cpu/$MACHINE_ARCH/conf/files.$MACHINE_ARCH (probably for a
	limited time, until the transition completes, use
	arch/$MACHINE_ARCH/conf/files.$MACHINE_ARCH instead of the
	latter, if that one doesn't exist)

	b) in the kernel compile directory, similar to the
	machine->../../../../arch/$MACHINE/include link, add a
	cpu->../../../../cpu/$MACHINE_ARCH/include link;
	probably, after the transition period, remove the
	$MACHINE_ARCH->../../../../arch/$MACHINE_ARCH/include link
	(modify config accordingly)

	c) change cpu-dependent includes: currently typically lines
	like #include <$MACHINE_ARCH/foo.h> to #include <cpu/foo.h>.
	This affects only machine-dependent files, mostly include
	files, which often simply include the cpu-dependent
	file from the similarly named machine-dependent file.

	Q: Do we intend to eventually change MI code to include
	cpu-specific files (<cpu/foo.h>) directly instead of the
	machine-specific ones (<machine/foo.h>?

	d) as we currently do with sys/arch/$MACHINE_ARCH/include/*,
	install relevant include files from sys/cpu/$MACHINE_ARCH/include/*
	into /usr/include/$MACHINE_ARCH.

	e) similar to the /usr/include/machine->/usr/include/$MACHINE
	link, add a symlink /usr/include/cpu->/usr/include/$MACHINE_ARCH.

Considerations:

Using sys/arch/... for machine-specific stuff (related to $MACHINE)
vs. sys/cpu/... for cpu-specific stuff (related to $MACHINE_ARCH) might
confuse people.  Maybe we should change the names of the directories?
Like leaving the cpu-specific stuff in sys/arch/... and moving the
machine-specific things to sys/machine/... with appropriate modification
of the scheme above (including the /usr/include symlinks)?

Due to the /usr/include subdirectory structure, we get a single namespace
for both $MACHINE and $MACHINE_ARCH.  I.e. Having cpu-specific and
machine-specific directories with the same name cannot be handled easily.
Is this a problem?

Since this is all mostly a cosmetic change, should we forget about it
alltogether?

Comments?

Ciao,
Wolfgang
-- 
ws@TooLs.DE     Wolfgang Solfrank, TooLs GmbH 	+49-228-985800