News for hackers. Stuff that matters.
Re:FreeBSD on the POWER8: it's alive by tiffanyh on Monday February 23, 2015 @05:17PM (#9097424)
I love NetBSD, don't get me wrong, but inevitably you will end up with a messing subsystem if managing multiple architectures because you won't be able to avoid situation like this:

if (x86)

  // do ...
else (Power)

  // do ...
else (PPC)

  // do ...
Re:FreeBSD on the POWER8: it's alive by bch on Monday February 23, 2015 @06:35PM (#9097777)
From 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

[2]: /usr/src/sys/arch/Makefile

EDIT: ws

s/it's be/it'd be/

s/that spec give/that spec gives/