i386_vm_init()
function in
kern/pmap.c.
Try to understand from the code what page mappings are being constructed.
You may find the discussion in part 3 of
the lab assignment helpful.
Submit: Draw a diagram of the virtual address space constructed by i386_vm_init(), and identify any instances where multiple regions of virtual memory might be pointing to the same physical memory. Explain why the kernel might want to have different virtual addresses pointing to the same physical memory.
CR0_PG
bit in the %cr0
register.
This operation is surrounded by additional code that first installs and
then removes a mapping for virtual addresses 0 through 4MB, as well as
some assembly instructions that manipulate segmentation registers.
Submit: Explain what would happen if paging was enabled without these additional mappings. How are the segmentation registers modified in the inline assembly in i386_vm_init() to allow these mappings to be removed?