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.

134<br />

sys/arch/x86/include/cpu.h:<br />

#define curlwp<br />

x86_curlwp()<br />

sys/arch/sparc64/include/{cpu,param}.h (simplified for presentation):<br />

#define curlwp<br />

curcpu()->ci_curlwp<br />

#define curcpu() (((struct cpu_info *)CPUINFO_VA)->ci_self)<br />

#define CPUINFO_VA (KERNEND+0x018000)<br />

#define KERNEND 0x0e0000000 /* end <strong>of</strong> kernel virtual space */<br />

Figure 3.19: Comparison <strong>of</strong> curlwp definitions. <strong>The</strong> i386 port definition<br />

results in a function symbol dereference, while <strong>the</strong> sparc64 port definition causes a<br />

dereference to an absolute memory address.<br />

For architectures which do not support <strong>the</strong> st<strong>and</strong>ard kernel ABI, we provide override<br />

machine headers under <strong>the</strong> directory sys/rump/include/machine. This directory<br />

is specified first in <strong>the</strong> include search path for rump kernel compilation, <strong>and</strong> <strong>the</strong>refore<br />

headers contained in <strong>the</strong>re override <strong>the</strong> NetBSD MD headers. <strong>The</strong>refore, definitions<br />

contained in <strong>the</strong> headers for that directory override <strong>the</strong> st<strong>and</strong>ard NetBSD definitions.<br />

This way we can override problematic definitions in machine dependent code.<br />

An example <strong>of</strong> what we consider problematic is SPARC64’s definition <strong>of</strong> curlwp,<br />

which we previously illustrated in Figure 3.19. This approach allows us to support<br />

rump kernels on all NetBSD architectures without having to write machine specific<br />

counterparts or edit <strong>the</strong> existing MD interface definitions. <strong>The</strong> only negative<br />

impact is that architectures which depend on override headers cannot use binary<br />

kernel modules <strong>and</strong> must operate with <strong>the</strong> components compiled specifically for<br />

rump kernels.<br />

Lastly, <strong>the</strong> kernel module must be converted to <strong>the</strong> rump kernel symbol namespace<br />

(Section 3.2.1) before linking. This conversion can be done with <strong>the</strong> objcopy tool<br />

similar to what is done when components are built. However, using objcopy would<br />

require generating ano<strong>the</strong>r copy <strong>of</strong> <strong>the</strong> same module file. Instead <strong>of</strong> <strong>the</strong> objcopy<br />

approach, we modified <strong>the</strong> module load path in sys/kern/subr_kobj.c to contain

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

Saved successfully!

Ooh no, something went wrong!