[BACK]Return to pmap.c CVS log [TXT][DIR] Up to [cvs.NetBSD.org] / src / sys / arch / hppa / hppa

Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.

Diff for /src/sys/arch/hppa/hppa/pmap.c between version 1.43.8.2 and 1.43.8.3

version 1.43.8.2, 2008/10/30 10:20:23 version 1.43.8.3, 2008/11/01 12:16:53
Line 1 
Line 1 
 // /*   $NetBSD$        */  /*      $NetBSD$        */
   
 /*-  /*-
  * Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.   * Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
Line 604  pmap_bootstrap(vaddr_t vstart)
Line 604  pmap_bootstrap(vaddr_t vstart)
         int btlb_i;          int btlb_i;
         int btlb_j;          int btlb_j;
         vsize_t btlb_entry_min, btlb_entry_max, btlb_entry_got;          vsize_t btlb_entry_min, btlb_entry_max, btlb_entry_got;
         paddr_t ksro, kero, ksrw, kerw;          paddr_t ksrx, kerx, ksro, kero, ksrw, kerw;
         paddr_t phys_start, phys_end;          paddr_t phys_start, phys_end;
   
         /* Provided by the linker script */          /* Provided by the linker script */
         extern int kernel_text, __data_start, __rodata_end;          extern int kernel_text, etext;
           extern int __rodata_start, __rodata_end;
           extern int __data_start;
   
         DPRINTF(PDB_FOLLOW|PDB_INIT, ("pmap_bootstrap(0x%x)\n", (int)vstart));          DPRINTF(PDB_FOLLOW|PDB_INIT, ("pmap_bootstrap(0x%x)\n", (int)vstart));
   
Line 700  pmap_bootstrap(vaddr_t vstart)
Line 702  pmap_bootstrap(vaddr_t vstart)
         DPRINTF(PDB_INIT, ("pmap_bootstrap: curlwp set as %p\n", &lwp0));          DPRINTF(PDB_INIT, ("pmap_bootstrap: curlwp set as %p\n", &lwp0));
   
         /* kernel virtual is the last gig of the moohicans */          /* kernel virtual is the last gig of the moohicans */
         nkpdes = physmem >> 14; /* at least 16/gig for kmem */          /* at least 16/gig for kmem */
         if (nkpdes < 4)          nkpdes = (VM_MAX_KERNEL_ADDRESS - VM_MIN_KERNEL_ADDRESS) / PDE_SIZE;
                 nkpdes = 4;             /* ... but no less than four */  
         nkpdes += HPPA_IOLEN / PDE_SIZE; /* ... and io space too */          nkpdes += HPPA_IOLEN / PDE_SIZE; /* ... and io space too */
         npdes = nkpdes + (physmem + atop(PDE_SIZE) - 1) / atop(PDE_SIZE);          npdes = nkpdes + (physmem + atop(PDE_SIZE) - 1) / atop(PDE_SIZE);
   
Line 729  pmap_bootstrap(vaddr_t vstart)
Line 730  pmap_bootstrap(vaddr_t vstart)
          */           */
         /* XXXNH */          /* XXXNH */
         resvphysmem = atop(addr);          resvphysmem = atop(addr);
         kerw = addr;  
   
         /*          /*
          * The kernel text, data, and bss must be direct-mapped,           * The kernel text, data, and bss must be direct-mapped,
Line 746  pmap_bootstrap(vaddr_t vstart)
Line 746  pmap_bootstrap(vaddr_t vstart)
          * BTLB entries have a minimum and maximum possible size,           * BTLB entries have a minimum and maximum possible size,
          * and MD code gives us these sizes in units of pages.           * and MD code gives us these sizes in units of pages.
          */           */
         ksro = (paddr_t) &kernel_text;          ksrx = (paddr_t) &kernel_text;
         kero /*XXXNH &__rodata_end??? */ = ksrw = (paddr_t) &__data_start;          kerx = (paddr_t) &etext;
           ksro = (paddr_t) &__rodata_start;
           kero = (paddr_t) &__rodata_end;
           ksrw = (paddr_t) &__data_start;
           kerw = addr;
   
           printf("%s: ksrx = %08x  kerx = %08x\n", __func__, (int)ksrx, (int)kerx);
           printf("%s: ksro = %08x  kero = %08x\n", __func__, (int)ksro, (int)kero);
           printf("%s: ksrw = %08x  kerw = %08x\n", __func__, (int)ksrw, (int)kerw);
   
         btlb_entry_min = (vsize_t) hppa_btlb_size_min * PAGE_SIZE;          btlb_entry_min = (vsize_t) hppa_btlb_size_min * PAGE_SIZE;
         btlb_entry_max = (vsize_t) hppa_btlb_size_max * PAGE_SIZE;          btlb_entry_max = (vsize_t) hppa_btlb_size_max * PAGE_SIZE;
   
   #if 0
         /*          /*
          * We begin by making BTLB entries for the kernel text.           * We begin by making BTLB entries for the kernel text.
          * To keep things simple, we insist that the kernel text           * To keep things simple, we insist that the kernel text
          * be aligned to the minimum BTLB entry size.           * be aligned to the minimum BTLB entry size.
          */           */
   
         if (((vaddr_t) &kernel_text) & (btlb_entry_min - 1))          if (((vaddr_t) &kernel_text) & (btlb_entry_min - 1))
                 panic("kernel text not aligned to BTLB minimum size");                  panic("kernel text not aligned to BTLB minimum size");
   #endif
   
         /*          /*
          * To try to conserve BTLB entries, take a hint from how           * To try to conserve BTLB entries, take a hint from how
Line 782  pmap_bootstrap(vaddr_t vstart)
Line 793  pmap_bootstrap(vaddr_t vstart)
          * BTLB entry for the kernel text may also cover some of           * BTLB entry for the kernel text may also cover some of
          * the data segment, meaning it will have to allow writing.           * the data segment, meaning it will have to allow writing.
          */           */
         addr = ksro;          addr = ksrx;
   
         DPRINTF(PDB_INIT, ("%s: mapping text and rodata @ %p - %p\n",          DPRINTF(PDB_INIT, ("%s: mapping text and rodata @ %p - %p\n",
             __func__, (void *)addr, (void *)&__rodata_end));              __func__, (void *)addr, (void *)&__rodata_end));
   
         btlb_j = 0;          btlb_j = 0;
         while (addr < (vaddr_t) &__rodata_end) {          while (addr < (vaddr_t) kero) {
   
                 /* Set up the next BTLB entry. */                  /* Set up the next BTLB entry. */
                 KASSERT(btlb_j < BTLB_SET_SIZE);                  KASSERT(btlb_j < BTLB_SET_SIZE);
                 btlb_entry_start[btlb_j] = addr;                  btlb_entry_start[btlb_j] = addr;
                 btlb_entry_size[btlb_j] = btlb_entry_min;                  btlb_entry_size[btlb_j] = btlb_entry_min;
                 btlb_entry_vm_prot[btlb_j] = VM_PROT_READ | VM_PROT_EXECUTE;                  btlb_entry_vm_prot[btlb_j] = VM_PROT_READ | VM_PROT_EXECUTE;
                 if (addr + btlb_entry_min > kero) /*XXX &__rodata_end*/                  if (addr + btlb_entry_min > kero)
                         btlb_entry_vm_prot[btlb_j] |= VM_PROT_WRITE;                          btlb_entry_vm_prot[btlb_j] |= VM_PROT_WRITE;
   
                 /* Coalesce BTLB entries whenever possible. */                  /* Coalesce BTLB entries whenever possible. */
Line 889  pmap_bootstrap(vaddr_t vstart)
Line 900  pmap_bootstrap(vaddr_t vstart)
   
         availphysmem = 0;          availphysmem = 0;
   
         /* The first segment runs from [resvmem..kernel_text). */          /* The first segment runs from [resvmem..ksrx). */
         phys_start = resvmem;          phys_start = resvmem;
         phys_end = atop(&kernel_text);          phys_end = atop(ksrx);
   
         DPRINTF(PDB_INIT, ("%s: phys segment 0x%05x 0x%05x\n", __func__,          DPRINTF(PDB_INIT, ("%s: phys segment 0x%05x 0x%05x\n", __func__,
             (u_int)phys_start, (u_int)phys_end));              (u_int)phys_start, (u_int)phys_end));
Line 901  pmap_bootstrap(vaddr_t vstart)
Line 912  pmap_bootstrap(vaddr_t vstart)
                 availphysmem += phys_end - phys_start;                  availphysmem += phys_end - phys_start;
         }          }
   
         /* The second segment runs from [__rodata_end..__data_start). */          /* The second segment runs from [kero..ksrw). */
         phys_start = atop(&__rodata_end);          phys_start = atop(kero);
         phys_end = atop(&__data_start);          phys_end = atop(ksrw);
   
         DPRINTF(PDB_INIT, ("%s: phys segment 0x%05x 0x%05x\n", __func__,          DPRINTF(PDB_INIT, ("%s: phys segment 0x%05x 0x%05x\n", __func__,
             (u_int)phys_start, (u_int)phys_end));              (u_int)phys_start, (u_int)phys_end));
Line 931  pmap_bootstrap(vaddr_t vstart)
Line 942  pmap_bootstrap(vaddr_t vstart)
         for (va = 0; va < ptoa(physmem); va += PAGE_SIZE) {          for (va = 0; va < ptoa(physmem); va += PAGE_SIZE) {
                 int opmapdebug;                  int opmapdebug;
                 vm_prot_t prot = UVM_PROT_RW;                  vm_prot_t prot = UVM_PROT_RW;
   #if 0
                 if (va < kero)                  extern struct user *proc0paddr;
   #endif
                   if (va < resvmem)
                         prot = UVM_PROT_RX;                          prot = UVM_PROT_RX;
                   else if (va >= ksrx && va < kerx)
                           prot = UVM_PROT_RX;
                   else if (va >= ksro && va < kero)
                           prot = UVM_PROT_R;
   #if 0
                   else if (va == (vaddr_t)proc0paddr + USPACE)
                           prot = UVM_PROT_NONE;
   #endif
                 opmapdebug = pmapdebug;                  opmapdebug = pmapdebug;
                 pmapdebug = 0;                  pmapdebug = 0;
                 pmap_kenter_pa(va, va, prot);                  pmap_kenter_pa(va, va, prot);

Legend:
Removed from v.1.43.8.2  
changed lines
  Added in v.1.43.8.3

CVSweb <webmaster@jp.NetBSD.org>