Question: Question 2 : Memory Management ( Max Mark: 2 0 / 1 0 0 ) It is sometimes useful to know which pages in a
Question : Memory Management Max Mark:
It is sometimes useful to know which pages in a user programs virtual address space
have been accessed read or write or both This assignment requires you to write a
system call for xv that checks which page in a processs virtual address space has
been accessed. Note that a good understanding of Task will be helpful. The kernel
function ptableprint could be useful for debugging the code for this assignment.
Therefore you may want to use the same copy of xv that you have used for Task for
this question.
Task: Write a system call named pageAccess that will modify a bitmap that
indicates which of the physical memory pages have been accessed. The function
prototype of this system call for user programs will be:
int pageAccesschar buf, unsigned int npages, unsigned int bmp;
This function should return a negative value if unsuccessful for any reason Any other
returned value indicates success.
buf points to the start address of the virtual address space that needs to be checked
for access.
npages gives the number of pages that should be examined. It should be not larger than
bmp is a pointer to an unsigned integer that acts as a bitmap which indicates if a page
has been accessed. Each bit of the unsigned integer corresponds to a page. Since an
unsigned integer is bits in size, npages is limited to
AUT
As an example, if pages and have been accessed, the lower bits of this
integer should have s only for bits and the rest are s giving a decimal value
of hexadecimal $ as shown below.
This function should return a negative value if unsuccessful for any reason Any other
returned value indicates success.
An example test program for your system call has been provided in the file
pgaccesstest.c This program should be compiled as a user program in xv It also
serves as an example of how the system call is to be used. The bitmap should be set to
the above value for this example test program. But you should check that your system
call returns the values correspondingly if other pages have been accessed.
A skeleton code of your kernel function of this system call, syspageAcess can be
found in the file syspageAccess.c Note that syspageAcess does not take any
arguments. This is because the call to pageAccess is made in the user program in user
mode Therefore, these arguments cannot be passed directly to a kernel function in
kernel mode in the usual way. Instead, you will need to access the arguments in
syspageAcess using argaddr and argint as demonstrated in the skeleton code.
With the bitmap pointer, it is easier to store it in a variable in this function and then copy
it to the user space before returning using copyout The code to do this has also
been provided. The remaining code to implement this kernel function will need to be
supplied by you
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
