Mac OS X Internals: A Systems Approach
8.5. Virtual Memory Initialization during Bootstrap
We discussed several aspects of virtual memory initialization in Chapter 5. Since we have more context in this chapter, let us briefly revisit how the VM subsystem is brought up. Recall that on the PowerPC, ppc_vm_init() [osfmk/ppc/ppc_vm_init.c] performs hardware-specific initialization of the memory subsystem. In particular, it bootstraps the pmap module and enables address translation, kick-starting virtual memory and the use of page tables. Thereafter, higher-level bootstrap of the kernel is initiated. One of the first steps in this higher-level bootstrap is scheduler initialization, followed by initialization of the hardware-independent parts of the Mach VM subsystem. The latter is depicted in Figure 813, which is a more detailed version of the picture we saw in Chapter 5. Figure 813. Initialization of the hardware-independent part of the Mach VM subsystem
ppc_vm_init() [osfmk/ppc/ppc_vm_init.c] processes the physical memory bank information provided to the kernel by the bootloader and populates the pmap_mem_regions array for the pmap module. An element of this array is a mem_region_t data structure [osfmk/ppc/mappings.c]. Note that although we say that Figure 813 shows a hardware-independent picture, the sequence of functions shown includes pmap_init() [osfmk/ppc/pmap.c], which finishes the pmap module's initialization by calling zinit() to create a zone from which pmaps (pmap_t) are allocated. The function also initializes data structures for tracking free pmapsspecifically, a list of free pmaps, a count of pmaps on this list, and a simple lock. |
Категории