Use the new pmap_kprotect() function instead of pmap_changeprot().

The latter is now a pmap internal function; and it wasn't used correctly
in mkclock.c anyway.
This commit is contained in:
pk 2003-03-02 21:42:48 +00:00
parent 22cf03a09f
commit 77accc351e
2 changed files with 9 additions and 11 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: intr.c,v 1.79 2003/01/23 22:33:41 pk Exp $ */
/* $NetBSD: intr.c,v 1.80 2003/03/02 21:42:48 pk Exp $ */
/*
* Copyright (c) 1992, 1993
@ -487,13 +487,12 @@ inst_fasttrap(int level, void (*vec)(void))
s = splhigh();
/* 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);
pmap_kprotect((vaddr_t)tv & -NBPG, NBPG, VM_PROT_READ|VM_PROT_WRITE);
cpuinfo.cache_flush_all();
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);
pmap_kprotect((vaddr_t)tv & -NBPG, NBPG, VM_PROT_READ);
cpuinfo.cache_flush_all();
fastvec |= 1 << level;
splx(s);
@ -516,13 +515,12 @@ uninst_fasttrap(int level)
: &sparc_interrupt44c[0] - &tv->tv_instr[1];
/* 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);
pmap_kprotect((vaddr_t)tv & -NBPG, NBPG, VM_PROT_READ|VM_PROT_WRITE);
cpuinfo.cache_flush_all();
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);
pmap_changeprot(pmap_kernel(), (vaddr_t)tv, VM_PROT_READ, 1);
pmap_kprotect((vaddr_t)tv & -NBPG, NBPG, VM_PROT_READ);
cpuinfo.cache_flush_all();
fastvec &= ~(1 << level);
splx(s);

View File

@ -1,4 +1,4 @@
/* $NetBSD: mkclock.c,v 1.5 2003/02/26 17:39:07 pk Exp $ */
/* $NetBSD: mkclock.c,v 1.6 2003/03/02 21:42:48 pk Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc.
@ -267,8 +267,8 @@ mk_nvram_wenable(onoff)
{
int s;
vm_prot_t prot;/* nonzero => change prot */
int npages;
vaddr_t base;
vsize_t size;
static int writers;
s = splhigh();
@ -278,10 +278,10 @@ mk_nvram_wenable(onoff)
prot = --writers == 0 ? VM_PROT_READ : 0;
splx(s);
npages = round_page((vsize_t)mk_nvram_size) << PAGE_SHIFT;
size = round_page((vsize_t)mk_nvram_size);
base = trunc_page((vaddr_t)mk_nvram_base);
if (prot)
pmap_changeprot(pmap_kernel(), base, prot, npages);
pmap_kprotect(base, size, prot);
return (0);
}