Another general cleanup:

Remove the entire idea of fasttrap interrupts since V9 traps are really cheap,
the CPUs are really fast, and the completely different trap frames would make
these handlers really difficult to implement.

pmap_changeprot() was only used by the clock and one other place; deprecate it.

probeget() and probeset() now take 64-bit addresses even in 32-bit mode so we
can probe IO locations by physical addresses.

Some pmap cleanup.

Some more copyright cleanup.
This commit is contained in:
eeh 1999-06-07 05:28:03 +00:00
parent dc611e3e7f
commit 1884f05354
17 changed files with 138 additions and 203 deletions

View File

@ -1,4 +1,4 @@
# $NetBSD: NONPLUS,v 1.14 1999/06/05 20:38:24 eeh Exp $
# $NetBSD: NONPLUS,v 1.15 1999/06/07 05:28:03 eeh Exp $
include "arch/sparc64/conf/std.sparc64"
@ -134,7 +134,7 @@ options COMPAT_SVR4 # SunOS 5.x binary compatibility
options EXEC_ELF32 # Exec module for SunOS 5.x binaries.
#options EXEC_ELF64 # Exec module for SunOS 5.x binaries.
options SYSCALL_DEBUG
options COMPAT_AOUT # NetBSD/sparc compat support
#options COMPAT_AOUT # NetBSD/sparc compat support
options EXEC_AOUT # execve(2) support for a.out binaries
## File systems. You probably need at least one of FFS or NFS.

View File

@ -1,4 +1,4 @@
/* $NetBSD: bwtwo.c,v 1.7 1999/06/05 05:05:11 mrg Exp $ */
/* $NetBSD: bwtwo.c,v 1.8 1999/06/07 05:28:03 eeh Exp $ */
/*
* Copyright (c) 1996 Jason R. Thorpe. All rights reserved.
@ -157,7 +157,7 @@ bwtwomatch(parent, cf, aux)
/*
* Make sure there's hardware there.
*/
if (probeget(ASI_PRIMARY, ra->ra_vaddr, 4) == -1)
if (probeget(ra->ra_vaddr, ASI_PRIMARY, 4) == -1)
return (0);
#if defined(SUN4)

View File

@ -1,4 +1,4 @@
/* $NetBSD: ebus_bus.c,v 1.1 1999/06/04 13:29:13 mrg Exp $ */
/* $NetBSD: ebus_bus.c,v 1.2 1999/06/07 05:28:03 eeh Exp $ */
/*
* Copyright (c) 1999 Matthew R. Green
@ -394,10 +394,7 @@ ebus_intr_establish(t, level, flags, handler, arg)
ih->ih_number = ino;
ih->ih_pil = ino_to_ipl_table[ino];
DPRINTF(EDB_INTR, ("; installing handler %p with ino %u pil %u\n", handler, (u_int)ino, (u_int)ih->ih_pil));
if ((flags & BUS_INTR_ESTABLISH_FASTTRAP) != 0)
intr_fasttrap(ih->ih_pil, (void (*)__P((void)))handler);
else
intr_establish(ih->ih_pil, ih);
intr_establish(ih->ih_pil, ih);
return (ih);
#else
return (0);

View File

@ -1,4 +1,4 @@
/* $NetBSD: fd.c,v 1.7 1999/06/05 21:58:17 eeh Exp $ */
/* $NetBSD: fd.c,v 1.8 1999/06/07 05:28:03 eeh Exp $ */
/*-
* Copyright (c) 1993, 1994, 1995 Charles M. Hannum.
@ -393,14 +393,9 @@ fdcattach(parent, self, aux)
TAILQ_INIT(&fdc->sc_drives);
pri = ca->ca_ra.ra_intr[0].int_pri;
#ifdef FDC_C_HANDLER
fdc->sc_hih.ih_fun = (void *)fdchwintr;
fdc->sc_hih.ih_arg = fdc;
intr_establish(pri, &fdc->sc_hih);
#else
fdciop = &fdc->sc_io;
intr_fasttrap(pri, fdchwintr);
#endif
fdc->sc_sih.ih_fun = (void *)fdcswintr;
fdc->sc_sih.ih_arg = fdc;
intr_establish(PIL_FDSOFT, &fdc->sc_sih);

View File

@ -1,4 +1,4 @@
/* $NetBSD: psycho_bus.c,v 1.1 1999/06/04 13:42:14 mrg Exp $ */
/* $NetBSD: psycho_bus.c,v 1.2 1999/06/07 05:28:03 eeh Exp $ */
/*
* Copyright (c) 1999 Matthew R. Green
@ -501,10 +501,7 @@ psycho_intr_establish(t, level, flags, handler, arg)
ih->ih_number = ino;
ih->ih_pil = ino_to_ipl_table[ino];
DPRINTF(PDB_INTR, ("; installing handler %p with ino %u pil %u\n", handler, (u_int)ino, (u_int)ih->ih_pil));
if ((flags & BUS_INTR_ESTABLISH_FASTTRAP) != 0)
intr_fasttrap(ih->ih_pil, (void (*)__P((void)))handler);
else
intr_establish(ih->ih_pil, ih);
intr_establish(ih->ih_pil, ih);
return (ih);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: sbus.c,v 1.17 1999/06/05 05:30:43 mrg Exp $ */
/* $NetBSD: sbus.c,v 1.18 1999/06/07 05:28:03 eeh Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -80,6 +80,30 @@
* @(#)sbus.c 8.1 (Berkeley) 6/11/93
*/
/*
* Copyright (c) 1999 Eduardo Horvath
*
* 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.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 THE AUTHOR 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.
*
*/
/*
* Sbus stuff.
*/
@ -862,10 +886,7 @@ sbus_intr_establish(t, level, flags, handler, arg)
ih->ih_arg = arg;
ih->ih_number = vec;
ih->ih_pil = (1<<ipl);
if ((flags & BUS_INTR_ESTABLISH_FASTTRAP) != 0)
intr_fasttrap(ipl, (void (*)__P((void)))handler);
else
intr_establish(ipl, ih);
intr_establish(ipl, ih);
return (ih);
}

View File

@ -1,38 +1,18 @@
/* $NetBSD: sbusreg.h,v 1.6 1999/05/24 00:25:31 mrg Exp $ */
/* $NetBSD: sbusreg.h,v 1.7 1999/06/07 05:28:03 eeh Exp $ */
/*
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
*
* This software was developed by the Computer Systems Engineering group
* at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
* contributed to Berkeley.
*
* All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Lawrence Berkeley Laboratory.
* Copyright (c) 1996-1999 Eduardo Horvath
*
* 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 the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 THE REGENTS OR CONTRIBUTORS BE LIABLE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR 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)
@ -41,15 +21,10 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)sbusreg.h 8.1 (Berkeley) 6/11/93
*/
/*
* Sun-4c S-bus definitions. (Should be made generic!)
*
* Sbus slot 0 is not a separate slot; it talks to the onboard I/O devices.
* It is, however, addressed just like any `real' Sbus.
*
* Sbus device addresses are obtained from the FORTH PROMs. They come
* in `absolute' and `relative' address flavors, so we have to handle both.
* Relative addresses do *not* include the slot number.

View File

@ -1,4 +1,4 @@
/* $NetBSD: upa.c,v 1.4 1998/09/05 23:57:25 eeh Exp $ */
/* $NetBSD: upa.c,v 1.5 1999/06/07 05:28:04 eeh Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
@ -810,10 +810,7 @@ upa_intr_establish(t, level, flags, handler, arg)
ih->ih_fun = handler;
ih->ih_arg = arg;
if ((flags & BUS_INTR_ESTABLISH_FASTTRAP) != 0)
intr_fasttrap(ipl, (void (*)__P((void)))handler);
else
intr_establish(ipl, ih);
intr_establish(ipl, ih);
return (ih);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: bus.h,v 1.12 1999/06/05 20:38:25 eeh Exp $ */
/* $NetBSD: bus.h,v 1.13 1999/06/07 05:28:04 eeh Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@ -38,7 +38,7 @@
*/
/*
* Copyright (c) 1997, 1998 Eduardo E. Horvath. All rights reserved.
* Copyright (c) 1997-1999 Eduardo E. Horvath. All rights reserved.
* Copyright (c) 1996 Charles M. Hannum. All rights reserved.
* Copyright (c) 1996 Christopher G. Demetriou. All rights reserved.
*

View File

@ -1,4 +1,4 @@
/* $NetBSD: cpu.h,v 1.9 1999/06/05 21:58:18 eeh Exp $ */
/* $NetBSD: cpu.h,v 1.10 1999/06/07 05:28:04 eeh Exp $ */
/*
* Copyright (c) 1992, 1993
@ -155,15 +155,6 @@ extern struct intrhand *intrlev[MAXINTNUM];
void intr_establish __P((int level, struct intrhand *));
/*
* intr_fasttrap() is a lot like intr_establish, but is used for ``fast''
* interrupt vectors (vectors that are not shared and are handled in the
* trap window). Such functions must be written in assembly.
*
* This should be removed for sun4u.
*/
void intr_fasttrap __P((int level, void (*vec)(void)));
/* disksubr.c */
struct dkbad;
int isbad __P((struct dkbad *bt, int, int, int));

View File

@ -1,7 +1,7 @@
/* $NetBSD: param.h,v 1.10 1999/06/05 21:58:18 eeh Exp $ */
/* $NetBSD: param.h,v 1.11 1999/06/07 05:28:04 eeh Exp $ */
/*
* Copyright (c) 1992-1999
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
*
* This software was developed by the Computer Systems Engineering group
@ -44,6 +44,31 @@
* @(#)param.h 8.1 (Berkeley) 6/11/93
*/
/*
* Copyright (c) 1996-1999 Eduardo Horvath
*
* 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.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 THE AUTHOR 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.
*
*/
#define _MACHINE sparc64
#define MACHINE "sparc64"
#ifdef __arch64__

View File

@ -1,4 +1,4 @@
/* $NetBSD: pmap.h,v 1.9 1999/03/28 19:01:02 eeh Exp $ */
/* $NetBSD: pmap.h,v 1.10 1999/06/07 05:28:04 eeh Exp $ */
/*-
* Copyright (C) 1995, 1996 Wolfgang Solfrank.
@ -163,9 +163,6 @@ int pmap_count_res __P((pmap_t pmap));
void pmap_bootstrap __P((u_long kernelstart, u_long kernelend, u_int numctx));
/* This needs to be implemented when we get a kernel map */
void pmap_changeprot __P((pmap_t pmap, vaddr_t start, vm_prot_t prot, int size));
/* SPARC specific? */
void pmap_redzone __P((void));
int pmap_dumpsize __P((void));

View File

@ -1,38 +1,18 @@
/* $NetBSD: trap.h,v 1.3 1999/06/05 21:58:18 eeh Exp $ */
/* $NetBSD: trap.h,v 1.4 1999/06/07 05:28:04 eeh Exp $ */
/*
* Copyright (c) 1992-1999
* The Regents of the University of California. All rights reserved.
*
* This software was developed by the Computer Systems Engineering group
* at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
* contributed to Berkeley.
*
* All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Lawrence Berkeley Laboratory.
* Copyright (c) 1996-1999 Eduardo Horvath
*
* 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 the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 THE REGENTS OR CONTRIBUTORS BE LIABLE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR 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)
@ -41,9 +21,9 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)trap.h 8.1 (Berkeley) 6/11/93
*/
#ifndef _MACHINE_TRAP_H
#define _MACHINE_TRAP_H

View File

@ -1,4 +1,4 @@
/* $NetBSD: clock.c,v 1.11 1999/06/05 05:10:01 mrg Exp $ */
/* $NetBSD: clock.c,v 1.12 1999/06/07 05:28:04 eeh Exp $ */
/*
* Copyright (c) 1992, 1993
@ -201,8 +201,10 @@ clock_map(bh, model)
char *model;
{
struct clockreg *cl;
paddr_t pa;
pmap_changeprot(pmap_kernel(), (vaddr_t)bh, VM_PROT_READ, 1);
pa = pmap_extract(pmap_kernel(), (vaddr_t)bh);
pmap_enter(pmap_kernel(), (vaddr_t)bh, pa, VM_PROT_READ, 1, VM_PROT_READ);
cl = (struct clockreg *)((long)bh + CLK_MK48T08_OFF);
return (cl);
@ -414,10 +416,13 @@ clk_wenable(onoff)
else
prot = --writers == 0 ? VM_PROT_READ : 0;
splx(s);
if (prot)
pmap_changeprot(pmap_kernel(),
(vaddr_t)clockreg & ~(NBPG-1),
prot, 1);
if (prot) {
vaddr_t va = (vaddr_t)clockreg & ~(NBPG-1);
paddr_t pa;
pa = pmap_extract(pmap_kernel(), va);
pmap_enter(pmap_kernel(), va, pa, prot, 1, prot);
}
}
void

View File

@ -1,4 +1,4 @@
/* $NetBSD: intr.c,v 1.14 1999/05/30 07:36:28 mrg Exp $ */
/* $NetBSD: intr.c,v 1.15 1999/06/07 05:28:04 eeh Exp $ */
/*
* Copyright (c) 1992, 1993
@ -281,51 +281,3 @@ intr_establish(level, ih)
splx(s);
}
/*
* Like intr_establish, but wires a fast trap vector. Only one such fast
* trap is legal for any interrupt, and it must be a hardware interrupt.
*/
void
intr_fasttrap(level, vec)
int level;
void (*vec) __P((void));
{
register struct trapvec *tv;
register u_long hi22, lo10;
#ifdef DIAGNOSTIC
register int displ; /* suspenders, belt, and buttons too */
#endif
int s;
printf("trying to establish a level %d fast interrupt!", level);
panic("intr_fasttrap");
tv = &trapbase[T_L1INT - 1 + level];
hi22 = ((u_long)vec) >> 10;
lo10 = ((u_long)vec) & 0x3ff;
s = splhigh();
if ((fastvec & (1 << level)) != 0 || intrhand[level] != NULL)
panic("intr_fasttrap: already handling level %d interrupts",
level);
#ifdef DIAGNOSTIC
displ = &sparc_interrupt[0] - &tv->tv_instr[1];
/* has to be `mov level,%l3; ba _sparc_interrupt; rdpsr %l0' */
if (tv->tv_instr[0] != I_MOVi(I_L3, level) ||
tv->tv_instr[1] != I_BA(0, displ) ||
tv->tv_instr[2] != I_RDPSR(I_L0))
panic("intr_fasttrap(%d, %p)\n%x %x %x != %x %x %x",
level, vec,
tv->tv_instr[0], tv->tv_instr[1], tv->tv_instr[2],
I_MOVi(I_L3, level), I_BA(0, displ), I_RDPSR(I_L0));
#endif
/* kernel text is write protected -- let us in for a moment */
pmap_changeprot(pmap_kernel(), (vaddr_t)tv,
VM_PROT_READ|VM_PROT_WRITE, 1);
tv->tv_instr[0] = I_SETHI(I_L3, hi22); /* sethi %hi(vec),%l3 */
tv->tv_instr[1] = I_JMPLri(I_G0, I_L3, lo10);/* jmpl %l3+%lo(vec),%g0 */
tv->tv_instr[2] = I_RDPSR(I_L0); /* mov %psr, %l0 */
pmap_changeprot(pmap_kernel(), (vaddr_t)tv, VM_PROT_READ, 1);
fastvec |= 1 << level;
splx(s);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: machdep.c,v 1.46 1999/06/05 21:58:18 eeh Exp $ */
/* $NetBSD: machdep.c,v 1.47 1999/06/07 05:28:04 eeh Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@ -1752,10 +1752,7 @@ sparc_mainbus_intr_establish(t, level, flags, handler, arg)
ih->ih_fun = handler;
ih->ih_arg = arg;
if ((flags & BUS_INTR_ESTABLISH_FASTTRAP) != 0)
intr_fasttrap(level, (void (*)__P((void)))handler);
else
intr_establish(level, ih);
intr_establish(level, ih);
return (ih);
}

View File

@ -1,6 +1,6 @@
/* $NetBSD: pmap.c,v 1.37 1999/05/31 00:14:01 eeh Exp $ */
/* $NetBSD: pmap.c,v 1.38 1999/06/07 05:28:04 eeh Exp $ */
/* #define NO_VCACHE */ /* Don't forget the locked TLB in dostart */
#define HWREF
#define HWREF 1
/* #define BOOT_DEBUG */
/* #define BOOT1_DEBUG */
/*
@ -166,7 +166,7 @@ typedef struct pv_entry {
#define PV_MASK (0x01fLL)
#define PV_VAMASK (~(NBPG-1))
#define PV_MATCH(pv,va) (!((((pv)->pv_va)^(va))&PV_VAMASK))
#define PV_SETVA(pv,va) ((pv)->pv_va = ((va)&PV_VAMASK)|(((pv)->pv_va)&PV_MASK))
#define PV_SETVA(pv,va) ((pv)->pv_va = (((va)&PV_VAMASK)|(((pv)->pv_va)&PV_MASK)))
pv_entry_t pv_table; /* array of entries, one per page */
extern void pmap_remove_pv __P((struct pmap *pm, vaddr_t va, paddr_t pa));
@ -1620,26 +1620,27 @@ pmap_enter(pm, va, pa, prot, wired, access_type)
prom_printf("pmap_enter: va=%08x 64-bit pa=%x:%08x seg=%08x pte=%08x\r\n",
va, (int)(pa>>32), (int)pa, (int)va_to_seg(va), (int)va_to_pte(va));
#endif
/*
* If a mapping at this address already exists, remove it.
*/
if ((tte.data.data = pseg_get(pm, va))<0) {
pmap_remove(pm, va, va+NBPG-1);
}
/*
* Construct the TTE.
*/
if (IS_VM_PHYSADDR(pa)) {
pv = pa_to_pvh(pa);
aliased = (pv->pv_va&(PV_ALIAS|PV_NVC));
if ((tte.data.data = pseg_get(pm, va))<0 &&
((tte.data.data^pa)&TLB_PA_MASK)) {
vaddr_t entry;
/* different mapping for this page exists -- remove it. */
entry = (tte.data.data&TLB_PA_MASK);
pmap_remove_pv(pm, va, entry);
}
#ifndef HWREF
/* If we don't have the traphandler do it set the ref/mod bits now */
pv->pv_va |= PV_REF;
if (VM_PROT_WRITE & prot)
pv->pv_va |= PV_MOD;
#ifdef DIAGNOSTIC
if (access_type & ~prot)
panic("pmap_enter: access_type exceeds prot");
#endif
/* If we don't have the traphandler do it set the ref/mod bits now */
if (access_type & VM_PROT_ALL)
pv->pv_va |= PV_REF;
if (access_type & VM_PROT_WRITE)
pv->pv_va |= PV_MOD;
#ifdef DEBUG
enter_stats.managed ++;
#endif
@ -1657,18 +1658,10 @@ pmap_enter(pm, va, pa, prot, wired, access_type)
enter_stats.ci ++;
#endif
tte.tag.tag = TSB_TAG(0,pm->pm_ctx,va);
#ifndef HWREF
tte.data.data = TSB_DATA(0, size, pa, pm == pmap_kernel(),
(VM_PROT_WRITE & prot),
(access_type & VM_PROT_WRITE),
(!(pa & PMAP_NC)),aliased,1,(pa & PMAP_LITTLE));
if (VM_PROT_WRITE & prot) tte.data.data |= TLB_REAL_W; /* HWREF -- XXXX */
#else
/* Force dmmu_write_fault to be executed */
tte.data.data = TSB_DATA(0, size, pa, pm == pmap_kernel(),
0/*(VM_PROT_WRITE & prot)*/,
(!(pa & PMAP_NC)),aliased,1,(pa & PMAP_LITTLE));
if (VM_PROT_WRITE & prot) tte.data.data |= TLB_REAL_W; /* HWREF -- XXXX */
#endif
if (prot & VM_PROT_WRITE) tte.data.data |= TLB_REAL_W;
if (wired) tte.data.data |= TLB_TSB_LOCK;
ASSERT((tte.data.data & TLB_NFO) == 0);
pg = NULL;
@ -2146,6 +2139,7 @@ pmap_map(va, pa, endpa, prot)
}
#endif
#if 0
/*
* Really change page protections -- used by device drivers
*/
@ -2215,6 +2209,7 @@ int size;
}
pv_check();
}
#endif
/*
* Return the number bytes that pmap_dumpmmu() will dump.
@ -2446,6 +2441,8 @@ pmap_clear_modify(pa)
pv_check();
#if defined(PMAP_NEW)
/* We always return 1 for I/O mappings */
printf("pmap_clear_modify(%p): page unmanaged\n", pa);
Debugger();
return (1);
#else
return;
@ -2551,6 +2548,8 @@ pmap_clear_reference(pa)
if (!IS_VM_PHYSADDR(pa)) {
pv_check();
#if defined(PMAP_NEW)
printf("pmap_clear_reference(%p): page unmanaged\n", pa);
Debugger();
return (1);
#else
return;
@ -2655,7 +2654,7 @@ pmap_is_modified(pa)
#if defined(PMAP_NEW)
paddr_t pa = VM_PAGE_TO_PHYS(pg);
#endif
int i, s;
int i=0, s;
register pv_entry_t pv, npv;
if (!IS_VM_PHYSADDR(pa)) {
@ -2666,7 +2665,7 @@ pmap_is_modified(pa)
s = splimp();
pv = pa_to_pvh(pa);
#ifdef HWREF
i = (pv->pv_va&PV_MOD);
if (pv->pv_va&PV_MOD) i = 1;
#ifdef DEBUG
if (pv->pv_next && !pv->pv_pmap) {
printf("pmap_is_modified: npv but no pmap for pv %p\n", pv);
@ -2678,7 +2677,10 @@ pmap_is_modified(pa)
int64_t data;
data = pseg_get(npv->pv_pmap, npv->pv_va&PV_VAMASK);
i = i || (data & (TLB_MODIFY|TLB_W));
if (data & (TLB_MODIFY|TLB_W)) i = 1;
/* Migrate modify info to head pv */
if (npv->pv_va & PV_MOD) i = 1;
npv->pv_va &= ~PV_MOD;
}
/* Save modify info */
if (i) pv->pv_va |= PV_MOD;
@ -2686,7 +2688,7 @@ pmap_is_modified(pa)
if (i) pv->pv_va |= PV_WE;
#endif
#else
i = (pv->pv_va&PV_MOD);
if (pv->pv_va&PV_MOD) i = 1;
#endif
splx(s);
@ -2713,7 +2715,7 @@ pmap_is_referenced(pa)
#if defined(PMAP_NEW)
paddr_t pa = VM_PAGE_TO_PHYS(pg);
#endif
int i, s;
int i=0, s;
register pv_entry_t pv, npv;
if (!IS_VM_PHYSADDR(pa))
@ -2723,7 +2725,7 @@ pmap_is_referenced(pa)
s = splimp();
pv = pa_to_pvh(pa);
#ifdef HWREF
i = (pv->pv_va&PV_REF);
if (pv->pv_va&PV_REF) i = 1;
#ifdef DEBUG
if (pv->pv_next && !pv->pv_pmap) {
printf("pmap_is_referenced: npv but no pmap for pv %p\n", pv);
@ -2735,11 +2737,15 @@ pmap_is_referenced(pa)
int64_t data;
data = pseg_get(npv->pv_pmap, npv->pv_va&PV_VAMASK);
i = i || (data & TLB_ACCESS);
if (data & TLB_ACCESS) i = 1;
/* Migrate modify info to head pv */
if (npv->pv_va & PV_REF) i = 1;
npv->pv_va &= ~PV_REF;
}
/* Save ref info */
if (i) pv->pv_va |= PV_REF;
#else
i = (pv->pv_va&PV_REF);
if (pv->pv_va&PV_REF) i = 1;
#endif
splx(s);
@ -2784,7 +2790,7 @@ pmap_change_wiring(pmap, va, wired)
* Is this part of the permanent 4MB mapping?
*/
if( pmap == pmap_kernel() && va >= ksegv && va < ksegv+4*MEG ) {
prom_printf("pmap_changeprot: va=%08x in locked TLB\r\n", va);
prom_printf("pmap_change_wiring: va=%08x in locked TLB\r\n", va);
OF_enter();
return;
}
@ -2850,11 +2856,11 @@ pmap_page_protect(pa, prot)
set = TLB_V;
clear = TLB_REAL_W|TLB_W;
if(VM_PROT_EXECUTE & prot)
if (VM_PROT_EXECUTE & prot)
set |= TLB_EXEC;
else
clear |= TLB_EXEC;
if(VM_PROT_EXECUTE == prot)
if (VM_PROT_EXECUTE == prot)
set |= TLB_EXEC_ONLY;
pv = pa_to_pvh(pa);
@ -3184,7 +3190,7 @@ pmap_remove_pv(pmap, va, pa)
} else {
pv->pv_pmap = NULL;
pv->pv_next = NULL;
pv->pv_va &= PV_MASK; /* Only save ref/mod bits */
pv->pv_va &= (PV_REF|PV_MOD); /* Only save ref/mod bits */
}
#ifdef DEBUG
remove_stats.pvfirst++;