Make the new pmap optional. Use the old (stable!) pmap by default.

This commit is contained in:
tsubai 2001-06-10 11:01:26 +00:00
parent 53e9189ae7
commit fafb5d4bc3
9 changed files with 1708 additions and 10 deletions

View File

@ -1,3 +1,7 @@
/* $NetBSD: pmap.h,v 1.3 2001/06/06 17:50:15 matt Exp $ */
/* $NetBSD: pmap.h,v 1.4 2001/06/10 11:01:28 tsubai Exp $ */
#ifdef NEWPMAP
#include <powerpc/mpc6xx/pmap.h>
#else
#include <powerpc/pmap.h>
#endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: vmparam.h,v 1.17 2001/06/06 17:50:16 matt Exp $ */
/* $NetBSD: vmparam.h,v 1.18 2001/06/10 11:01:28 tsubai Exp $ */
/*-
* Copyright (C) 1995, 1996 Wolfgang Solfrank.
@ -31,9 +31,88 @@
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifdef NEWPMAP
#include <powerpc/mpc6xx/vmparam.h>
#define _MACHINE_VMPARAM_H_
#endif
#ifndef _MACHINE_VMPARAM_H_
#define _MACHINE_VMPARAM_H_
#include <powerpc/mpc6xx/vmparam.h>
#define USRTEXT NBPG
#define USRSTACK VM_MAXUSER_ADDRESS
#ifndef MAXTSIZ
#define MAXTSIZ (64*1024*1024) /* max text size */
#endif
#ifndef DFLDSIZ
#define DFLDSIZ (128*1024*1024) /* default data size */
#endif
#ifndef MAXDSIZ
#define MAXDSIZ (1*1024*1024*1024) /* max data size */
#endif
#ifndef DFLSSIZ
#define DFLSSIZ (2*1024*1024) /* default stack size */
#endif
#ifndef MAXSSIZ
#define MAXSSIZ (32*1024*1024) /* max stack size */
#endif
/*
* Size of shared memory map
*/
#ifndef SHMMAXPGS
#define SHMMAXPGS 1024
#endif
/*
* Size of User Raw I/O map
*/
#define USRIOSIZE 1024
/*
* The time for a process to be blocked before being very swappable.
* This is a number of seconds which the system takes as being a non-trivial
* amount of real time. You probably shouldn't change this;
* it is used in subtle ways (fractions and multiples of it are, that is, like
* half of a ``long time'', almost a long time, etc.)
* It is related to human patience and other factors which don't really
* change over time.
*/
#define MAXSLP 20
/*
* Would like to have MAX addresses = 0, but this doesn't (currently) work
*/
#define VM_MIN_ADDRESS ((vaddr_t)0)
#define VM_MAXUSER_ADDRESS ((vaddr_t)0x7ffff000)
#define VM_MAX_ADDRESS VM_MAXUSER_ADDRESS
#define VM_MIN_KERNEL_ADDRESS ((vaddr_t)(KERNEL_SR << ADDR_SR_SHFT))
#define VM_MAX_KERNEL_ADDRESS (VM_MIN_KERNEL_ADDRESS + SEGMENT_LENGTH - 1)
/* XXX max. amount of KVM to be used by buffers. */
#ifndef VM_MAX_KERNEL_BUF
#define VM_MAX_KERNEL_BUF (SEGMENT_LENGTH / 2)
#endif
#define VM_PHYS_SIZE (USRIOSIZE * NBPG)
#define __HAVE_PMAP_PHYSSEG
struct pmap_physseg {
struct pv_entry *pvent;
char *attrs;
};
#define VM_PHYSSEG_MAX 16 /* 1? */
#define VM_PHYSSEG_STRAT VM_PSTRAT_BSEARCH
#define VM_PHYSSEG_NOADD /* can't add RAM after vm_mem_init */
#define VM_NFREELIST 1
#define VM_FREELIST_DEFAULT 0
#endif /* _MACHINE_VMPARAM_H_ */

View File

@ -1,4 +1,4 @@
/* $NetBSD: locore.S,v 1.39 2001/06/06 17:50:16 matt Exp $ */
/* $NetBSD: locore.S,v 1.40 2001/06/10 11:01:28 tsubai Exp $ */
/*
* Copyright (C) 1995, 1996 Wolfgang Solfrank.
@ -44,7 +44,9 @@
#include <machine/psl.h>
#include <machine/trap.h>
#include <machine/asm.h>
#ifdef NEWPMAP
#include <machine/vmparam.h>
#endif
/*
* Some instructions gas doesn't understand (yet?)

View File

@ -1,4 +1,4 @@
# $NetBSD: files.powerpc,v 1.18 2001/06/06 17:36:01 matt Exp $
# $NetBSD: files.powerpc,v 1.19 2001/06/10 11:01:26 tsubai Exp $
defopt opt_altivec.h ALTIVEC K_ALTIVEC
defopt OPENPIC
defopt opt_ppcarch.h PPC_MPC6XX PPC_MPC8XX PPC_IBM4XX
@ -17,6 +17,7 @@ file netinet/in4_cksum.c inet
file arch/powerpc/powerpc/ipkdb_glue.c ipkdb
file arch/powerpc/powerpc/mem.c
file arch/powerpc/powerpc/openpic.c openpic
file arch/powerpc/powerpc/pmap.c !newpmap
file arch/powerpc/powerpc/powerpc_machdep.c
file arch/powerpc/powerpc/process_machdep.c
file arch/powerpc/powerpc/sig_machdep.c
@ -35,7 +36,7 @@ file arch/powerpc/powerpc/db_trace.c ddb
# MPC (Motorola PowerPC) 6xx Family files (60x,74x,75x,74xx)
#
file arch/powerpc/mpc6xx/pmap.c ppc_mpc6xx
file arch/powerpc/mpc6xx/pmap.c ppc_mpc6xx & newpmap
# Binary compatibility with previous NetBSD releases (COMPAT_XX)
file arch/powerpc/powerpc/compat_13_machdep.c compat_13

View File

@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.20 2001/06/06 17:36:01 matt Exp $
# $NetBSD: Makefile,v 1.21 2001/06/10 11:01:27 tsubai Exp $
KDIR= /sys/arch/powerpc/include
INCSDIR= /usr/include/powerpc
@ -15,7 +15,7 @@ INCS= ansi.h aout_machdep.h asm.h \
kcore.h \
limits.h lock.h \
math.h \
param.h pcb.h pio.h proc.h profile.h psl.h ptrace.h \
param.h pcb.h pio.h pmap.h proc.h profile.h psl.h ptrace.h \
reg.h reloc.h \
setjmp.h signal.h stdarg.h \
trap.h types.h \

View File

@ -1,4 +1,4 @@
/* $NetBSD: param.h,v 1.11 2001/06/10 02:28:57 briggs Exp $ */
/* $NetBSD: param.h,v 1.12 2001/06/10 11:01:27 tsubai Exp $ */
/*-
* Copyright (C) 1995, 1996 Wolfgang Solfrank.
@ -125,4 +125,29 @@
#define dbtob(x) ((x) << DEV_BSHIFT)
#define btodb(x) ((x) >> DEV_BSHIFT)
#ifndef NEWPMAP
/*
* Segment handling stuff
*/
#define SEGMENT_LENGTH 0x10000000
#define SEGMENT_MASK 0xf0000000
/*
* Fixed segments
*/
#define USER_SR 13
#define KERNEL_SR 14
#define KERNEL_SEGMENT (0xf00000 + KERNEL_SR)
#define EMPTY_SEGMENT 0xfffff0
#define USER_ADDR ((void *)(USER_SR << ADDR_SR_SHFT))
/*
* Some system constants
*/
#ifndef NPMAPS
#define NPMAPS 32768 /* Number of pmaps in system */
#endif
#endif /* NEWPMAP */
#endif /* _POWERPC_PARAM_H_ */

View File

@ -0,0 +1,115 @@
/* $NetBSD: pmap.h,v 1.23 2001/06/10 11:01:27 tsubai Exp $ */
/*-
* Copyright (C) 1995, 1996 Wolfgang Solfrank.
* Copyright (C) 1995, 1996 TooLs GmbH.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by TooLs GmbH.
* 4. The name of TooLs GmbH may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _MACHINE_PMAP_H_
#define _MACHINE_PMAP_H_
#include <machine/pte.h>
/*
* Segment registers
*/
#ifndef _LOCORE
typedef u_int sr_t;
#endif /* _LOCORE */
#define SR_TYPE 0x80000000
#define SR_SUKEY 0x40000000
#define SR_PRKEY 0x20000000
#define SR_VSID 0x00ffffff
#ifndef _LOCORE
/*
* Pmap stuff
*/
struct pmap {
sr_t pm_sr[16]; /* segments used in this pmap */
int pm_refs; /* ref count */
struct pmap_statistics pm_stats; /* pmap statistics */
};
typedef struct pmap *pmap_t;
#ifdef _KERNEL
extern struct pmap kernel_pmap_;
#define pmap_kernel() (&kernel_pmap_)
#define pmap_clear_modify(pg) (ptemodify((pg), PTE_CHG, 0))
#define pmap_clear_reference(pg) (ptemodify((pg), PTE_REF, 0))
#define pmap_is_modified(pg) (ptebits((pg), PTE_CHG))
#define pmap_is_referenced(pg) (ptebits((pg), PTE_REF))
#define pmap_unwire(pm, va)
#define pmap_update() /* nothing (yet) */
#define pmap_phys_address(x) (x)
#define pmap_resident_count(pmap) ((pmap)->pm_stats.resident_count)
void pmap_bootstrap __P((u_int kernelstart, u_int kernelend));
boolean_t pmap_extract __P((struct pmap *, vaddr_t, paddr_t *));
boolean_t ptemodify __P((struct vm_page *, u_int, u_int));
int ptebits __P((struct vm_page *, int));
void pmap_real_memory __P((paddr_t *, psize_t *));
void pmap_pinit __P((pmap_t));
#define PMAP_NEED_PROCWR
void pmap_procwr __P((struct proc *, vaddr_t, size_t));
/*
* Alternate mapping hooks for pool pages. Avoids thrashing the TLB.
*
* Note: This won't work if we have more memory than can be direct-mapped
* VA==PA all at once. But pmap_copy_page() and pmap_zero_page() will have
* this problem, too.
*/
#define PMAP_MAP_POOLPAGE(pa) (pa)
#define PMAP_UNMAP_POOLPAGE(pa) (pa)
static __inline paddr_t vtophys __P((vaddr_t));
static __inline paddr_t
vtophys(va)
vaddr_t va;
{
paddr_t pa;
/* XXX should check battable */
if (pmap_extract(pmap_kernel(), va, &pa))
return pa;
return va;
}
#endif /* _KERNEL */
#endif /* _LOCORE */
#endif /* _MACHINE_PMAP_H_ */

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
/* $NetBSD: vm_machdep.c,v 1.27 2001/06/06 17:36:04 matt Exp $ */
/* $NetBSD: vm_machdep.c,v 1.28 2001/06/10 11:01:28 tsubai Exp $ */
/*
* Copyright (C) 1995, 1996 Wolfgang Solfrank.
@ -105,7 +105,12 @@ cpu_fork(p1, p2, stack, stacksize, func, arg)
#endif
pcb->pcb_pm = p2->p_vmspace->vm_map.pmap;
#ifdef NEWPMAP
pcb->pcb_pmreal = pcb->pcb_pm; /* XXX */
#else
(void) pmap_extract(pmap_kernel(), (vaddr_t)pcb->pcb_pm,
(paddr_t *)&pcb->pcb_pmreal);
#endif
/*
* Setup the trap frame for the new process
@ -156,7 +161,12 @@ cpu_swapin(p)
{
struct pcb *pcb = &p->p_addr->u_pcb;
#ifdef NEWPMAP
pcb->pcb_pmreal = pcb->pcb_pm; /* XXX */
#else
(void) pmap_extract(pmap_kernel(), (vaddr_t)pcb->pcb_pm,
(paddr_t *)&pcb->pcb_pmreal);
#endif
}
/*