A1 Overview

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 layer.

There are basically two categories of architecture-specific code:

□ Components that are used and invoked exclusively by the architecture-specific parts of the kernel. As far as the rest of the code is concerned, the location of this code and the functions that are called are irrelevant.

□ Interface functions that must be defined by every architecture as they are invoked by architecture-independent code. For example, each port must provide a switch_to function to take care of hardware-control details when switching between two processes. The scheduler makes use of this function by deciding — regardless of the architecture — which task runs next and then delegating the actual task switch to processor-specific code.

Memory management also employs a variety of interface functions and definitions — to specify page size or to update caches, for instance.

This chapter is designed to give a brief summary of how various system-specific tasks are performed on the most popular architectures supported by the kernel. This is based on the fact that the kernel must exploit a very large number of hardware features that differ from processor to processor and require in-depth knowledge of the individual architectures. Considering that each processor family is typically accompanied by a reference manual of a thousand pages or more to describe architectural subtleties and oddities, this book cannot even begin to examine every little detail of importance to the kernel. Instead, this chapter sketches out the rough structure that supports the Linux port to a specific architecture. This book also describes various special features of some of the ports.

The build system takes into account the need to resort to architecture-specific defined mechanisms at various points in the generic code. All processor-specific header files are located in include/asm-arch. Once the kernel has been configured for a specific architecture, a symbolic link (named include/asm) to the appropriate machine-specific directory is created; for example, this link would be include/asm -> include/asm-alpha on an Alpha AXP system. This enables the kernel to link in architecture-specific headers by means of #include<asm/file.h>.

This book gives only a brief overview of the standard headers that must be made available by the individual ports and of the functions and definitions these headers must declare (and also implement). It would require another entire book to cover the details of each architecture supported.

Continue reading here: A2 Data Types

Was this article helpful?

0 0