tmpmap()

tmpmap()

概要

引数

実装

  871: void*
  872: tmpmap(Page *p)
  873: {
  874:         ulong i;
  875:         ulong *entry;
  876:         
  877:         if(islo())
  878:                 panic("tmpaddr: islo");
  879: 
  880:         if(fasttmp && p->pa < -KZERO)
  881:                 return KADDR(p->pa);
  882: 
  883:         /*
  884:          * PDX(TMPADDR) == PDX(MACHADDR), so this
  885:          * entry is private to the processor and shared 
  886:          * between up->mmupdb (if any) and m->pdb.
  887:          */
  888:         entry = &vpt[VPTX(TMPADDR)];
  889:         if(!(*entry&PTEVALID)){
  890:                 for(i=KZERO; i<=CPU0MACH; i+=BY2PG)
  891:                         print("%.8lux: *%.8lux=%.8lux (vpt=%.8lux index=%.8lux)\n", i, &vpt[VPTX(i)], vpt[VPTX(i)], vpt, VPTX(i));
  892:                 panic("tmpmap: no entry");
  893:         }
  894:         if(PPN(*entry) != PPN(TMPADDR-KZERO))
  • 詳細はPPN()を参照
  895:                 panic("tmpmap: already mapped entry=%#.8lux", *entry);
  896:         *entry = p->pa|PTEWRITE|PTEVALID;
  897:         flushpg(TMPADDR);
  898:         return (void*)TMPADDR;
  899: }