[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: powerpc dir
ちゅーことで、powerpc->ofppcを行うわけですが、
pmap.cに、以前tsubaiさんが見つけられたbug fixと、
自動ptab_cnt、msgbuf mapを突っ込もうと思います。
以下のpatchをあてて、macppc動きますでしょうか? > tsubaiさん
msgbufのところがちょっと不安。
sakamoto@cec.co.jp
=====powerpc/powerpc====
*** ../../powerpc/powerpc/pmap.c Fri May 22 09:15:44 1998
--- pmap.c Thu May 28 09:43:41 1998
***************
*** 1,4 ****
! /* $NetBSD: pmap.c,v 1.4 1998/05/19 19:00:17 thorpej Exp $ */
/*
* Copyright (C) 1995, 1996 Wolfgang Solfrank.
--- 1,4 ----
! /* $NetBSD: pmap.c,v 1.4 1998/05/19 19:00:15 thorpej Exp $ */
/*
* Copyright (C) 1995, 1996 Wolfgang Solfrank.
***************
*** 44,50 ****
#include <machine/powerpc.h>
pte_t *ptable;
! int ptab_cnt = HTABENTS;
u_int ptab_mask;
#define HTABSIZE (ptab_cnt * 64)
--- 44,50 ----
#include <machine/powerpc.h>
pte_t *ptable;
! int ptab_cnt;
u_int ptab_mask;
#define HTABSIZE (ptab_cnt * 64)
***************
*** 60,65 ****
--- 60,66 ----
int physmem;
static int npgs;
static u_int nextavail;
+ extern vm_offset_t msgbuf_paddr;
static struct mem_region *mem, *avail;
***************
*** 94,100 ****
int pv_pcnt;
static struct pv_entry *pmap_alloc_pv __P((void));
static void pmap_free_pv __P((struct pv_entry *));
-
void pmap_pinit __P((pmap_t));
void pmap_release __P((pmap_t));
--- 95,100 ----
***************
*** 368,373 ****
--- 368,382 ----
mp->size = sz;
}
}
+
+ #ifdef HTABENTS
+ ptab_cnt = HTABENTS;
+ #else /* HTABENTS */
+ ptab_cnt = 1024;
+ while ((HTABSIZE << 7) < ctob(physmem))
+ ptab_cnt <<= 1;
+ #endif /* HTABENTS */
+
/*
* Find suitably aligned memory for HTAB.
*/
***************
*** 401,407 ****
npgs -= btoc(HTABSIZE);
bzero((void *)ptable, HTABSIZE);
ptab_mask = ptab_cnt - 1;
!
/*
* We cannot do pmap_steal_memory here,
* since we don't run with translation enabled yet.
--- 410,416 ----
npgs -= btoc(HTABSIZE);
bzero((void *)ptable, HTABSIZE);
ptab_mask = ptab_cnt - 1;
!
/*
* We cannot do pmap_steal_memory here,
* since we don't run with translation enabled yet.
***************
*** 423,429 ****
for (i = 0; i < ptab_cnt; i++)
LIST_INIT(potable + i);
LIST_INIT(&pv_page_freelist);
!
/*
* Initialize kernel pmap and hardware.
*/
--- 432,455 ----
for (i = 0; i < ptab_cnt; i++)
LIST_INIT(potable + i);
LIST_INIT(&pv_page_freelist);
!
! /*
! * allow for msgbuf
! */
! sz = round_page(MSGBUFSIZE);
! for (mp = avail; mp->size; mp++)
! if (mp->size >= sz)
! break;
! if (!mp->size)
! panic("not enough memory?");
!
! npgs -= btoc(sz);
! msgbuf_paddr = mp->start;
! mp->size -= sz;
! mp->start += sz;
! if (mp->size <= 0)
! bcopy(mp + 1, mp, (cnt - (mp - avail)) * sizeof *mp);
!
/*
* Initialize kernel pmap and hardware.
*/
***************
*** 443,448 ****
--- 469,480 ----
:: "r"((u_int)ptable | (ptab_mask >> 10)));
tlbia();
nextavail = avail->start;
+
+ #if defined(MACHINE_NEW_NONCONTIG)
+ for (mp = avail; mp->size; mp++)
+ vm_page_physload(atop(mp->start), atop(mp->start + mp->size),
+ atop(mp->start), atop(mp->start + mp->size));
+ #endif
}
/*
***************
*** 945,951 ****
* Have to remove any existing mapping first.
*/
pmap_remove(pm, va, va + NBPG - 1);
!
/*
* Compute the HTAB index.
*/
--- 977,983 ----
* Have to remove any existing mapping first.
*/
pmap_remove(pm, va, va + NBPG - 1);
!
/*
* Compute the HTAB index.
*/
***************
*** 968,974 ****
pte.pte_lo |= PTE_RW;
else
pte.pte_lo |= PTE_RO;
!
/*
* Now record mapping for later back-translation.
*/
--- 1000,1006 ----
pte.pte_lo |= PTE_RW;
else
pte.pte_lo |= PTE_RO;
!
/*
* Now record mapping for later back-translation.
*/
***************
*** 979,985 ****
*/
syncicache((void *)pa, NBPG);
}
!
s = splimp();
/*
* Try to insert directly into HTAB.
--- 1011,1017 ----
*/
syncicache((void *)pa, NBPG);
}
!
s = splimp();
/*
* Try to insert directly into HTAB.
***************
*** 988,994 ****
splx(s);
return;
}
!
/*
* Have to allocate overflow entry.
*
--- 1020,1026 ----
splx(s);
return;
}
!
/*
* Have to allocate overflow entry.
*
***************
*** 1283,1288 ****
--- 1315,1321 ----
asm volatile ("sync");
tlbie(va);
tlbsync();
+ goto next;
}
for (ptp = ptable + (idx ^ ptab_mask) * 8, i = 8; --i >= 0; ptp++)
if ((ptp->pte_hi & PTE_VALID)
***************
*** 1292,1297 ****
--- 1325,1331 ----
asm volatile ("sync");
tlbie(va);
tlbsync();
+ goto next;
}
for (po = potable[idx].lh_first; po; po = npo) {
npo = po->po_list.le_next;
***************
*** 1299,1306 ****
--- 1333,1342 ----
pmap_remove_pv(idx, va, pind, &po->po_pte);
LIST_REMOVE(po, po_list);
pofree(po, 1);
+ goto next;
}
}
+ next:
}
splx(s);
}
====macppc=====
*** include/param.h.orig Tue May 26 00:43:00 1998
--- include/param.h Thu May 28 09:59:53 1998
***************
*** 63,68 ****
--- 63,72 ----
#define UPAGES 4
#define USPACE (UPAGES * NBPG)
+ #ifndef MSGBUFSIZE
+ #define MSGBUFSIZE NBPG /* default message buffer size */
+ #endif
+
#define KERNBASE 0x100000
/*
*** macppc/machdep.c.orig Tue May 26 00:43:26 1998
--- macppc/machdep.c Thu May 28 09:56:58 1998
***************
*** 94,102 ****
/*
* We use the page just above the interrupt vector as message buffer
*/
! #define MSGBUFADDR 0x3000
! #define MSGBUFSIZE 4096
! int msgbufmapped = 0;
#ifdef NBUF
int nbuf = NBUF;
--- 94,100 ----
/*
* We use the page just above the interrupt vector as message buffer
*/
! vm_offset_t msgbuf_vaddr, msgbuf_paddr;
#ifdef NBUF
int nbuf = NBUF;
***************
*** 374,382 ****
caddr_t v;
vm_offset_t minaddr, maxaddr;
int base, residual;
!
! initmsgbuf((caddr_t)MSGBUFADDR, round_page(MSGBUFSIZE));
! msgbufmapped = 1;
proc0.p_addr = proc0paddr;
v = (caddr_t)proc0paddr + USPACE;
--- 372,387 ----
caddr_t v;
vm_offset_t minaddr, maxaddr;
int base, residual;
!
! /*
! * Initialize error message buffer (at end of core).
! */
! if (!(msgbuf_vaddr = kmem_alloc(kernel_map, round_page(MSGBUFSIZE))))
! panic("startup: no room for message buffer");
! for (i = 0; i < btoc(MSGBUFSIZE); i++)
! pmap_enter(pmap_kernel(), msgbuf_vaddr + i * NBPG,
! msgbuf_paddr + i * NBPG, VM_PROT_ALL, TRUE);
! initmsgbuf((caddr_t)msgbuf_vaddr, round_page(MSGBUFSIZE));
proc0.p_addr = proc0paddr;
v = (caddr_t)proc0paddr + USPACE;