Project overview

To write a command line tool to view page tables. You will need two kernel modifications to get at the page tables. This consists of finding the address of the PDT (top-level page table, called the page directory in i386 architecutres), and being able to read the page consisting of the PDT and the pages comprising the page tables. You user program makes these reads and presents the information compactly (tables are large; you have to decide how to present them compactly).

From context_switch follow the extraction of struct mm_struct and call to switch_mm, where CPU regiser cr3 is loaded.

Page table and page directory entries are in physical. What is the relation between virtual and physical addresses?

For user pages, the mapping requires reference to the page tables. But for the kernel, the linux memory layout maps physical address 0 to virtual address 0xc0000000, and continues byte for byte until the top of kernel virtual memory. Therefore mappng kernel physical to virtual is an addition (subtraction). The layout of the entry is given by defines in pgtable.h and also described here.

Step one

Due: Friday 26 October 2007.

Write a kernel syscall to retrieve the address of the page directory for the current, or arbitrary process. Write a kernel syscall to read a page of memory (in kernel space) or a 32-bit word, whichever you care to.

Steop two

Due: Monday, 5 November 2007.

Use the syscalls to present a processes page tables, and in the clearest way possible. Here is an example.

References to code