28.08.2015 Views

The Design and Implementation of the Anykernel and Rump Kernels

1F3KDce

1F3KDce

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

132<br />

into a rump kernel <strong>and</strong> <strong>the</strong> drivers used. This support allows a rump kernel to use<br />

drivers for which source code is not available. Short <strong>of</strong> a full virtual machine (e.g.<br />

QEMU), rump kernels are <strong>the</strong> only form <strong>of</strong> virtualization in NetBSD capable <strong>of</strong><br />

using binary kernel modules without recompilation.<br />

<strong>The</strong>re are two requirements for using binary kernel modules to be possible. First, <strong>the</strong><br />

kernel module must not contain any CPU instructions which cannot be executed<br />

in unprivileged mode. As we examined in Section 3.2.2, drivers do not contain<br />

privileged instructions. Second, <strong>the</strong> rump kernel <strong>and</strong> <strong>the</strong> host kernel must share <strong>the</strong><br />

same binary interface (ABI).<br />

In practical terms, ABI compatibility means that <strong>the</strong> rump kernel code does not<br />

provide its own headers to override system headers <strong>and</strong> <strong>the</strong>refore all <strong>the</strong> data type<br />

definitions are <strong>the</strong> same for a regular kernel <strong>and</strong> a rump kernel. Problematic scenarios<br />

arise because, mainly due to historical reasons, some architecture specific<br />

kernel interfaces are provided as macros or inline functions. This approach does not<br />

produce a clean interface boundary, as at least part <strong>of</strong> <strong>the</strong> implementation is leaked<br />

into <strong>the</strong> caller. From our perspective, this leakage means that providing an alternate<br />

interface is more difficult.<br />

Shortly before we started investigating kernel module compatibility, some x86 CPU<br />

family headers were changed from inline/macro definitions to function interfaces by<br />

ano<strong>the</strong>r NetBSD developer. <strong>The</strong> commit message 13 states that <strong>the</strong> change was done<br />

to avoid ABI instability issues with kernel modules. This change essentially solved<br />

our problem with inlines <strong>and</strong> macros. It also reinforced our belief that <strong>the</strong> anykernel<br />

architecture follows naturally from properly structured code.<br />

A remaining example <strong>of</strong> macro use in an interface is <strong>the</strong> pmap interface. <strong>The</strong><br />

pmap is <strong>the</strong> interface to <strong>the</strong> architecture dependent memory management features.<br />

13 revision 1.146 <strong>of</strong> sys/arch/i386/include/cpu.h

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!