Question: please include screenshot of the code in addtiton copyable code source and output of the code please. if possible explantation is appreciated step by step.

please include screenshot of the code in addtiton copyable code source and output of the code please. if possible explantation is appreciated step by step.

please include screenshot of the code in addtiton
Print a page table To help you visualize RISC-V page tables, and perhaps to aid future debugging, your second task is to write a function that prints the contents of a page table. Define a function called vmprint (). It should take a pagetable_t argument, and print that pagetable in the format described below. Insert if (p->pid==1) vmprint(p->pagetable) in exec.c just before the return argo, to print the first process's page table. You receive full credit for this part of the lab if you pass the pte printout test of make grade. Now when you start xv6 it should print output like this, describing the page table of the first process at the point when it has just finished exec ( )ing init: page table 0x0000000087 f66000 . .0: pte 0x0000000021fd9c01 pa 0x0000000087f67000 . . ..6: pte 0x0000000021fd9801 pa 0x0000000087f66000 . . ..0: pte 0x0000000021fda01b pa 0x0000000087f68000 . .1: pte 0x0000000021fd9417 pa 0x0000000087f65000 . ..2: pte 0x0000000021fd9007 pa 0x0000000087f64000 ..3: pte 0x0000000021fd8c17 pa 0x0000000087f63000 . .255: pte 0x0000000021fda801 pa 0x0000000087f62000 . .511: pte 0x0000000021fda401 pa 0x0000000087f69000 . .509: pte 0x0000000021fdcc13 pa 0x0000000087f73000 . . . .510: pte 0x0000000021 fad007 pa 0x0000000087f74000 . .511: pte 0x0000000020001cob pa 0x0000000080007000 init: starting sh The first line displays the argument to vmprint. After that there is a line for each PTE, including PTEs that refer to page-table pages deeper in the tree. Each PTE line is indented by a number of " .." that indicates its depth in the tree. Each PTE line shows the PTE index in its page-table page, the pte bits, and the physical address extracted from the PTE. Don't print PTEs that are not valid. In the above example, the top-level page-table page has mappings for entries 0 and 255. The next level down for entry 0 has only index 0 mapped, and the bottom-level for that index 0 has entries 0, 1, and 2 mapped. Your code might emit different physical addresses than those shown above. The number of entries and the virtual addresses should be the same. Some hints: You can put vmprint ( ) in kernel/vm. c. Use the macros at the end of the file kernel/riscv.h. The function freewalk may be inspirational. Define the prototype for vmprint in kernel defs.h so that you can call it from exec.c. . Use %p in your printf calls to print out full 64-bit hex PTEs and addresses as shown in the example. Explain the output of vmprint in terms of Fig 3-4 from the text. What does page 0 contain? What is in page 2? When running in user mode, could the process read/write the memory mapped by page 1? What does the third to last page contain

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!