- Add a new system call
void csie_ncu_survey_TT()
to your Linux kernel.
This new system call executes the following functions.
- It prints out the physical address of the Page Directory of current process.
- It checks the contents of entry 992 to entry 1023 of the Page Directory of current process to see whether an entry
points to a 4M page frame or points to a Page Table or does not point to any page frame.
- If an entry points to a 4M page frame, print out "4M" first and then print out the physical address of the first
byte of the 4M page frame, for example,
4M 0x90000000
- If an entry does not point to any page frame, print out NULL.
- If an entry points to a Page Table, which should contains 1024 entries, print out "Page Table" first and then print out
the physical address of the first byte of the Page Table, for example
Page Table 0x90000000
.
Besides, for the 1024 entries in the Page Table,
if an entry points to a 4k page frame, print out the physical address of the first byte of the page frame.
- Write a program
test1.c
as follows:
#include <stdio.h>
main()
{
printf("Hello World!\n");
csie_ncu_survey_TT();
}
- Write a program
test2.c
as follows:
#include <stdio.h>
main()
{
int i,j array[100][100];
for(i=0;i<100;i++)
for(j=0;j<100;j++)
array[i][j]=i*j;
csie_ncu_survey_TT();
}
- Write a program
test3.c
as follows:
#include <stdio.h>
#define GREETING "How are you?\n"
main()
{ char greeting_array[1000];
strcpy(greeting_array, GREETING);
csie_ncu_survey_TT();
}
- Execute the above three programs and compare their results generated by
void csie_ncu_survey_TT()
.