Architecture Specific Setup
The initialization of memory management on IA-32 systems is in some aspects a very subtle undertaking that must overcome a few historical obstacles associated with the processor architecture. These include, for example, switching the processor from normal mode to protected mode to grant the CPU access to the 32-bit world — a legacy from the days when compatibility with 16-bit 8086 processors was important. Similarly, paging is not enabled by default and must be activated manually, which, for instance, involves fiddling with the cr0 register of the processor. However, these subtleties are of no interest to us; you are referred to the appropriate reference manuals.
Notice that our focus on the IA-32 architecture does not mean that the things discussed in the following will be completely disconnected from all other architectures supported by the kernel. Quite the opposite is the case: Even if many details will be unique to the IA-32 architecture, many other architectures do things in a similar way. It's just necessary to choose one particular architecture as an example, and since IA-32 has not only been around for quite some time, but was also the architecture initially supported by Linux, this is reflected in the kernel's general design. Although there is a clear tendency of the kernel toward 64-bit platforms, many aspects can still be traced to its IA-32 roots.
Another reason why we pick the IA-32 architecture as an example is for practical purposes: Since the address space is only 4 GiB large, all addresses can be described with comparatively compact hexadecimal numbers, which are simply easier to read and work with than the long values required by 64-bit architectures.
Interestingly, the IA-32 architecture does not exist as a separate architecture starting with kernel 2.6.24 anymore! It was merged with the AMD64 architecture to form a new, unified x86 architecture. Although both are now constrained to the single architecture-specific directory arch/x8 6, a good many differences still remain. This is why many files are available in two variants: file_32.c for IA-32, and file_64.c for AMD64. The existence of two different files for each subarchitecture is something that is only temporarily tough. Future development will ensure that finally a single file will contain code for both architectures.
Since the unified architecture promotes the AMD64 architecture (even more) to one of the most important architectures supported by the kernel, I will also consider how architecture-specific details differ for AMD64 compared to IA-32. Owing to the large number of architectures supported by the kernel, it is not possible to discuss the specific details for all of them here. Considering one 32- and one 64-bit architecture in the following will, however, provide the taste of how Linux does things in both worlds, and lay the fundamentals to understand the approaches by other architectures.
Continue reading here: Arrangement of the Kernel in Memory
Was this article helpful?