Next: Bootmem Handling
Up: MM Sub-System initialization.
Previous: Paging start
- File : arch/i386/kernel/setup.c
-
"setup.c" holds the code which completes the E820 memory map setup in setup.S
and starts paging.
For easy understanding the logic used for page frame number (PFN) calculation
is given here.
- Setup the memory region by calling setup_memory_region()
- If E820 query was a success (if number of entries in the E820 map is
greater than 2) then copy the map into a local one. While doing so check weather
the bios claims the 640K to 1MB ram. If it does so reclaim it by adding an entry
for it into the local map.
- If E820 query was a failure then get the
values retrieved using the 801 and 88 queries and use the greatest among them.
Add two entries to the local E820 map structure for "0 to 636 k" and "1MB to
reported memory size".
- Get the lowest and highest PFN.
- If the highest PFN is greater than 229376 (the margin at 896 MB. It is
not at 1024 MB because, 128 MB address space is allocated for vmalloc and
inird), than HIGH_MEMORY is present.
- If the highest PFN is grater than
1048576, then PAE memory is present. (PAE memory is a enhancement provided by
some Intel processors to give 64GB address space, using 36-bit addresses)
- Get the start_pfn as the address of the _end symbol of the kernel. The
address is rounded off to the nearest next page boundary (4kb).
- calculate max_pfn. This is done using the following logic.
- If max_pfn is less than 229376 then proceed.
- If max_pfn is greater than 229376 then max_low_pfn = 229376 and
highstart_pfn = 229377 and highend_pfn = max_pfn
- Call init_bootmem and save the size of the page bitmap. (init_bootmem is
called only with the low memory i.e.start_pfn and max_low_pfn)
- Now
init_bootmem would have reserved all the page frames. So go through all the
page frames and free every region of memory termed as E820_RAM in the E820
memory map.
- Reserve the physical page 0 with the boot memory as it is a bios page
(not on all but some bios). Also Reserve the whole bootmem bitmap.
- call paging_init (of arch/i386/mm/init.c).
Next: Bootmem Handling
Up: MM Sub-System initialization.
Previous: Paging start
2002-09-22