One of the key benefits of the kernel is the fact that it is mostly architecture-independent. Because the majority of the sources are written in C, the implemented algorithms are not tied to a particular CPU or computer family but can, in principle, be ported to on any platform with modest effort — assuming that a suitable C compiler is available. Inevitably, the kernel must provide interfaces to the underlying hardware, perform various system-specific tasks that involve countless details, and exploit the special functions of the processors used. These must generally be written in an assembly language. However, there are also some architecture specific data structures that are defined in C, so architecture-specific does not necessarily equate to assembler-specific. This appendix describes some hardware-specific aspects of important Linux ports.
To facilitate extensibility on new architectures, the kernel strictly segregates architecture-dependent and architecture-independent code. The
include/asm-arch/ directory holds header files that contain the definitions and prototypes for processor-specific elements of the kernel, whereas C and assembler source codes that implement the machine-specific part of the kernel reside in
arch/arch/. Together these occupy on average between 1 and 3 MiB in the kernel sources of each architecture. Although this represents a fair amount of code, it is nevertheless relatively compact for a complete abstraction ...