diff options
| author | Robert Morris <rtm@csail.mit.edu> | 2020-08-07 05:32:48 -0400 | 
|---|---|---|
| committer | Frans Kaashoek <kaashoek@mit.edu> | 2020-08-10 11:19:10 -0400 | 
| commit | 7f35d7a14efe56905d340a0e318f01c7c514320d (patch) | |
| tree | bc1203ec6dc250f6f9671d9881329e5ab22a069a /kernel | |
| parent | 2ae9c8e2722282d9a619c1745d845fb5d862c518 (diff) | |
| download | xv6-labs-7f35d7a14efe56905d340a0e318f01c7c514320d.tar.gz xv6-labs-7f35d7a14efe56905d340a0e318f01c7c514320d.tar.bz2 xv6-labs-7f35d7a14efe56905d340a0e318f01c7c514320d.zip | |
modify each page in usertests countfree()
get rid of static for walk() and freewalk()
Diffstat (limited to 'kernel')
| -rw-r--r-- | kernel/proc.c | 5 | ||||
| -rw-r--r-- | kernel/proc.h | 2 | ||||
| -rw-r--r-- | kernel/vm.c | 8 | 
3 files changed, 7 insertions, 8 deletions
| diff --git a/kernel/proc.c b/kernel/proc.c index f7652f6..cf7f260 100644 --- a/kernel/proc.c +++ b/kernel/proc.c @@ -20,6 +20,7 @@ static void wakeup1(struct proc *chan);  extern char trampoline[]; // trampoline.S +// initialize the proc table at boot time.  void  procinit(void)  { @@ -145,8 +146,8 @@ freeproc(struct proc *p)    p->state = UNUSED;  } -// Create a page table for a given process, -// with no user pages, but with trampoline pages. +// Create a user page table for a given process, +// with no user memory, but with trampoline pages.  pagetable_t  proc_pagetable(struct proc *p)  { diff --git a/kernel/proc.h b/kernel/proc.h index c257eb7..9c16ea7 100644 --- a/kernel/proc.h +++ b/kernel/proc.h @@ -97,7 +97,7 @@ struct proc {    // these are private to the process, so p->lock need not be held.    uint64 kstack;               // Virtual address of kernel stack    uint64 sz;                   // Size of process memory (bytes) -  pagetable_t pagetable;       // Page table +  pagetable_t pagetable;       // User page table    struct trapframe *trapframe; // data page for trampoline.S    struct context context;      // swtch() here to run process    struct file *ofile[NOFILE];  // Open files diff --git a/kernel/vm.c b/kernel/vm.c index 3004bb3..4f65d4e 100644 --- a/kernel/vm.c +++ b/kernel/vm.c @@ -16,9 +16,7 @@ extern char etext[];  // kernel.ld sets this to end of kernel code.  extern char trampoline[]; // trampoline.S  /* - * create a direct-map page table for the kernel and - * turn on paging. called early, in supervisor mode. - * the page allocator is already initialized. + * create a direct-map page table for the kernel.   */  void  kvminit() @@ -70,7 +68,7 @@ kvminithart()  //   21..39 -- 9 bits of level-1 index.  //   12..20 -- 9 bits of level-0 index.  //    0..12 -- 12 bits of byte offset within the page. -static pte_t * +pte_t *  walk(pagetable_t pagetable, uint64 va, int alloc)  {    if(va >= MAXVA) @@ -278,7 +276,7 @@ uvmdealloc(pagetable_t pagetable, uint64 oldsz, uint64 newsz)  // Recursively free page-table pages.  // All leaf mappings must already have been removed. -static void +void  freewalk(pagetable_t pagetable)  {    // there are 2^9 = 512 PTEs in a page table. | 
