2 ms·
From http://www.netbsd.org/about/portability.html http://www.netbsd.org/about/portability.html: > Every effort is made to keep everything cleanly split into 'M
by bch 12y ago
From http://www.netbsd.org/about/portability.html http://www.netbsd.org/about/portability.html:
> Every effort is made to keep everything cleanly split into 'Machine Dependent' (MD) and 'Machine Independent' (MI) areas. For example, an Ethernet chipset would have a single MI core hardware driver, which would be matched with appropriate MD bus attachment code for a given platform. Not all drivers are as clean as we would like for historical reasons, but any new driver will be, and old drivers are in the process of being converted across.
Machine dependent parts are built to a hardware abstraction layer (HAL)[1] interface, so that spec gives a single abstraction that the hardware-dependant code is built against, and can operate w/ the rest of the OS. As I understand it, this is facilitated by the _build system_ (not a mess of if/then in code) like this[2]:
.if ${ARCHSUBDIR} == "mips64"
ARCHSUBDIR= mips
.endif
.if ${ARCHSUBDIR} == "powerpc64"
ARCHSUBDIR= powerpc
.endif
These are also the sorts of problems that are addressed by considering "lots and lots" of targets -- it'd be unmaintainable otherwise.
[1]: http://en.wikipedia.org/wiki/NetBSD#Portability http://en.wikipedia.org/wiki/NetBSD#Portability
[2]: /usr/src/sys/arch/Makefile
EDIT: ws
s/it's be/it'd be/
s/that spec give/that spec gives/