Homework: x86 paging

Read chapters 5 and 6 of the Intel 80386 Reference Manual. These chapters explain the x86 Memory Management Unit (MMU), which we will cover in lecture today and which you need to understand in order to do lab 2.

Hand-In Procedure

You are to turn in this homework during lecture. Please write up your answers to the exercises below and hand them in to a 6.828 staff member at the beginning of lecture.

Assignment

Get the source code for lab 2, and read through the mem_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 mem_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.

At the end of mem_init(), the kernel finally switches from the entry_pgdir set up in kern/entry.S to the newly created kern_pgdir.

Submit: Draw a diagram of the virtual address space represented by entry_pgdir (the definition is in kern/entrypgdir.c). What about the layouts of the entry_pgdir and the kern_pgdir make it safe for the kernel to switch from the former the latter and continue executing?