Versions 2.0 and later of the Linux kernel are fairly portable across platforms, which means that most of the code runs on all the supported architectures without the need to differentiate among them. Everything we have seen in this tour up to now is completely independent of the hardware platform.
The arch
directory tree is a minor part of the Linux kernel
that contains the platform-specific code. Every
system-dependent function is replicated in each arch
subdirectory, so that the structure of all the subdirectories is
similar. The most important of these subdirectories is
kernel
, which hosts every system-specific function related to the
main kernel
source directory.
There are two assembly sources that are always found under
kernel
. head.S
is the startup code executed at system boot;
it sometimes includes some of the exception-handling code. The other file
is entry.S
, which includes the entry points to kernel space.
In particular, every such file contains the sys_call_table
for its
own architecture; every architecture has a different table to associate
system call numbers to functions.
Other commonly found subdirectories are lib
, which hosts the
optimized checksum routines for network packets and sometimes
includes other low-level operations such as string operations;
mm
, which deals with low-level handling of page faults
(fault.c
) and the initialization code called at system boot
(init.c
); and boot
, which contains the code needed to
bring up the system. As you might imagine, i386/boot
is the most
complex of the boot
subdirectories.
I’m not going to describe the architecture-specific code because it is not very interesting to read and is full of assembly language statements. In order to understand the code, you need to know some of the details of the target architecture. I don’t think that there’s much fun in reading architecture-specific functions, in any case, because they are the dirty part of the system, dealing with a lot of hardware glitches. It’s the rest of the kernel that is interesting.
3.15.206.25