Extraction of some of the HAL code from illumos-gate.