jinzhec2 / blog-talks

0 stars 0 forks source link

[Lab Report] MIT 6.S081 Lab: page tables (v2022) #12

Open jinzhec2 opened 1 year ago

jinzhec2 commented 1 year ago

https://jinzhec2.github.io/blog/post/6.s081_2022_lab3/?

Speed up system calls Print a page table Detect which pages have been accessed Speed up system calls According to the hints, we need to map a struct usyscall to the USYSCALL address in kernel/memlayout.h. First, we make the following modification to kernal/proc.h: struct proc { ... struct usyscall *usyscallpage; }; The mapping process is performed through proc_pagetable in kernel/proc.c, which requires the use of the mappages (with read-only permissions for the userspace):

jiangjingzhe commented 1 year ago

Helped me a lot, thanks!

However, why wrote this line if((pte & PTE_V) && (pte & (PTE_R|PTE_W|PTE_X)) == 0) in task two, it seemed useless. I wrote like this.

if(depth==2)
        continue;
        else
        vmprint((pagetable_t)child,depth+1);
Echomo-Xinyu commented 1 year ago

__

Helped me a lot, thanks!

However, why wrote this line if((pte & PTE_V) && (pte & (PTE_R|PTE_W|PTE_X)) == 0) in task two, it seemed useless. I wrote like this.

if(depth==2)
        continue;
        else
        vmprint((pagetable_t)child,depth+1);

I believe this line comes from the freewalk to determine whether the current PTE points to a lower page table and does exactly the same thing as depth==2

jiangjingzhe commented 11 months ago

@Echomo-Xinyu __

Helped me a lot, thanks!

However, why wrote this line if((pte & PTE_V) && (pte & (PTE_R|PTE_W|PTE_X)) == 0) in task two, it seemed useless. I wrote like this.

if(depth==2)
        continue;
        else
        vmprint((pagetable_t)child,depth+1);

I believe this line comes from the freewalk to determine whether the current PTE points to a lower page table and does exactly the same thing as depth==2

I remember feeling that some parts of this judgment were somewhat redundant at the time. However, I have paused my xv6'lab for over a month now due to other commitments, so I have forgotten some details. Thank you for your reply.

Samson-Songare commented 10 months ago

It gave me the below error in the first task of "Speed up system calls"

"kernel/proc.c:187:24: error: ‘USYSCALL’ undeclared (first use in this function) 187 | if(mappages(pagetable, USYSCALL, PGSIZE, | ^~~~ kernel/proc.c:187:24: note: each undeclared identifier is reported only once for each function it appears in make: *** [: kernel/proc.o] Error 1"

Anyone who can help on that error please. Thank you in advance.