diff options
| author | Frans Kaashoek <kaashoek@Frans-Kaashoeks-MacBook-Pro.local> | 2011-08-15 20:21:14 -0400 | 
|---|---|---|
| committer | Frans Kaashoek <kaashoek@Frans-Kaashoeks-MacBook-Pro.local> | 2011-08-15 20:21:14 -0400 | 
| commit | d9818bdd7d0c3524c51462e6405d7ca9bdaa5411 (patch) | |
| tree | 36f2519f1d372c17068691a7c82c87482d8d1efd | |
| parent | a4b213cf49cccc8287e638badaac10d0521d5886 (diff) | |
| download | xv6-labs-d9818bdd7d0c3524c51462e6405d7ca9bdaa5411.tar.gz xv6-labs-d9818bdd7d0c3524c51462e6405d7ca9bdaa5411.tar.bz2 xv6-labs-d9818bdd7d0c3524c51462e6405d7ca9bdaa5411.zip | |
Make Austin happier
2011
| -rw-r--r-- | README | 2 | ||||
| -rw-r--r-- | vm.c | 24 | 
2 files changed, 13 insertions, 13 deletions
| @@ -26,7 +26,7 @@ In addition, we are grateful for the patches contributed by Greg  Price, Yandong Mao, and Hitoshi Mitake.  The code in the files that constitute xv6 is -Copyright 2006-2007 Frans Kaashoek, Robert Morris, and Russ Cox. +Copyright 2006-2011 Frans Kaashoek, Robert Morris, and Russ Cox.  ERROR REPORTS @@ -18,7 +18,7 @@ seginit(void)  {    struct cpu *c; -  // Map virtual addresses to linear addresses using identity map. +  // Map "logical" addresses to virtual addresses using identity map.    // Cannot share a CODE descriptor for both kernel and user    // because it would have to have DPL_USR, but the CPU forbids    // an interrupt from CPL=0 to DPL=3. @@ -40,7 +40,7 @@ seginit(void)  }  // Return the address of the PTE in page table pgdir -// that corresponds to linear address va.  If alloc!=0, +// that corresponds to virtual address va.  If alloc!=0,  // create any required page table pages.  static pte_t *  walkpgdir(pde_t *pgdir, const void *va, char* (*alloc)(void)) @@ -64,17 +64,17 @@ walkpgdir(pde_t *pgdir, const void *va, char* (*alloc)(void))    return &pgtab[PTX(va)];  } -// Create PTEs for linear addresses starting at la that refer to +// Create PTEs for virtual addresses starting at la that refer to  // physical addresses starting at pa. la and size might not  // be page-aligned.  static int -mappages(pde_t *pgdir, void *la, uint size, uint pa, int perm, char* (*alloc)(void)) +mappages(pde_t *pgdir, void *va, uint size, uint pa, int perm, char* (*alloc)(void))  {    char *a, *last;    pte_t *pte; -  a = PGROUNDDOWN(la); -  last = PGROUNDDOWN(la + size - 1); +  a = PGROUNDDOWN(va); +  last = PGROUNDDOWN(va + size - 1);    for(;;){      pte = walkpgdir(pgdir, a, alloc);      if(pte == 0) @@ -90,7 +90,7 @@ mappages(pde_t *pgdir, void *la, uint size, uint pa, int perm, char* (*alloc)(vo    return 0;  } -// The mappings from logical to linear are one to one (i.e., +// The mappings from logical to virtual are one to one (i.e.,  // segmentation doesn't do anything).  // There is one page table per process, plus one that's used  // when a CPU is not running any process (kpgdir). @@ -98,7 +98,6 @@ mappages(pde_t *pgdir, void *la, uint size, uint pa, int perm, char* (*alloc)(vo  // page protection bits prevent it from using anything other  // than its memory.  //  -//  // setupkvm() and exec() set up every page table like this:  //   0..USERTOP      : user memory (text, data, stack, heap), mapped to some unused phys mem  //   KERNBASE..KERNBASE+1M: mapped to 0..1M @@ -112,9 +111,9 @@ mappages(pde_t *pgdir, void *la, uint size, uint pa, int perm, char* (*alloc)(vo  // (which is inaccessible in user mode).  The user program sits in  // the bottom of the address space, and the kernel at the top at KERNBASE.  static struct kmap { -  void *l; -  uint p; -  uint e; +  void *virt; +  uint phys_start; +  uint phys_end;    int perm;  } kmap[] = {    { P2V(0), 0, 1024*1024, PTE_W},  // First 1Mbyte contains BIOS and some IO devices @@ -135,7 +134,8 @@ setupkvm(char* (*alloc)(void))    memset(pgdir, 0, PGSIZE);    k = kmap;    for(k = kmap; k < &kmap[NELEM(kmap)]; k++) -    if(mappages(pgdir, k->l, k->e - k->p, (uint)k->p, k->perm, alloc) < 0) +    if(mappages(pgdir, k->virt, k->phys_end - k->phys_start, (uint)k->phys_start,  +		k->perm, alloc) < 0)        return 0;    return pgdir; | 
