The figure shows the first megabytes of physical memory — how much is exactly required depends on
how big the kernel binary is. The first 4,096 KiB — the first page frame — are omitted because they are
oftenreservedfortheBIOS.Thenext640KiBwouldbeusableinprinciple,butareagainnotusedfor
kernel loading. The reason is that this area is immediately followed by an area reserved for the system
into which various ROM ranges are mapped (typically the system BIOS and the graphic card ROM). It
is not possible to write to these areas. However, the kernel should always be loaded into a contiguous
memory range, and this would be possible only for kernels smaller than 640 KiB if the start address of
RAM memory were used as the start position for the kernel image.
A page contained in a reserved page frame can never be dynamically assigned or swapped to disk.
As a general rule, the Linux kernel is installed in RAM starting from the physical address 0x00100000 i.e., from the second megabyte. The total number of page frames required depends on how the kernel is configured. A typical configuration yields a kernel that can be loaded in less than 3 MB of RAM.
Why isn't the kernel loaded starting with the first available megabyte of RAM? Well, the PC
architecture has several peculiarities that must be taken into account. For example:
Page frame 0 is used by BIOS to store the system hardware configuration detected during the Power-On Self-Test(POST); the BIOS of many laptops, moreover, writes data on this page frame even after the system is initialized.
Physical addresses ranging from 0x000a0000 to 0x000fffff are usually reserved to BIOS
routines and to map the internal memory of ISA graphics cards. This area is the well-known
hole from 640 KB to 1 MB in all IBM-compatible PCs: the physical addresses exist but they are reserved, and the corresponding page frames cannot be used by the operating system.
Additional page frames within the first megabyte may be reserved by specific computer
models. For example, the IBM ThinkPad maps the 0xa0 page frame into the 0x9f one.
In the early stage of the boot sequence (see Appendix A), the kernel queries the BIOS and learns the size of the physical memory. In recent computers, the kernel also invokes a BIOS procedure to build a list of physical address ranges and their corresponding memory types.
Later, the kernel executes the machine_specific_memory_setup( ) function, which builds the physical addresses map (see Table 2-9 for an example). Of course, the kernel builds this table on the basis of the BIOS list, if this is available; otherwise the kernel builds the table following the conservative default setup: all page frames with numbers from 0x9f (LOWMEMSIZE( )) to 0x100 (HIGH_MEMORY) are marked as reserved.