Question: The v2paddr system call The v2paddr system call will accept a virtual address (in the calling process's address space), and return the corresponding physical address.
The v2paddr system call
The v2paddr system call will accept a virtual address (in the calling process's address space), and return the corresponding physical address. If the virtual address given is invalid, the system call should return -1.
For this exercise we are not providing a test program, so you'll have to write your own and add it to the Makefile (so that it gets compiled and added to the xv6 disk image). Make sure the executable for your test program is named "v2ptest". For help, see how the getcountprogram used in exercise 1 was added. Your test program should demonstrate that the system call works on virtual addresses of user-level instructions and both local and global data. It should also demonstrate that it fails gracefully (returning -1) when an invalid virtual address is specified.
Hints
You should carefully read through walkpgdir in the vm.c file --- it contains just about all the logic you need to implement the meat of the system call. It would also be a good idea to check out the macros defined in mmu.h which deal with paging details.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
