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 * Copyright (c) 1992, 1993
@ -487,13 +487,12 @@ inst_fasttrap(int level, void (*vec)(void))
s = splhigh(); s = splhigh();
/* kernel text is write protected -- let us in for a moment */ /* kernel text is write protected -- let us in for a moment */
pmap_changeprot(pmap_kernel(), (vaddr_t)tv, pmap_kprotect((vaddr_t)tv & -NBPG, NBPG, VM_PROT_READ|VM_PROT_WRITE);
VM_PROT_READ|VM_PROT_WRITE, 1);
cpuinfo.cache_flush_all(); cpuinfo.cache_flush_all();
tv->tv_instr[0] = I_SETHI(I_L3, hi22); /* sethi %hi(vec),%l3 */ 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[1] = I_JMPLri(I_G0, I_L3, lo10);/* jmpl %l3+%lo(vec),%g0 */
tv->tv_instr[2] = I_RDPSR(I_L0); /* mov %psr, %l0 */ 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(); cpuinfo.cache_flush_all();
fastvec |= 1 << level; fastvec |= 1 << level;
splx(s); splx(s);
@ -516,13 +515,12 @@ uninst_fasttrap(int level)
: &sparc_interrupt44c[0] - &tv->tv_instr[1]; : &sparc_interrupt44c[0] - &tv->tv_instr[1];
/* kernel text is write protected -- let us in for a moment */ /* kernel text is write protected -- let us in for a moment */
pmap_changeprot(pmap_kernel(), (vaddr_t)tv, pmap_kprotect((vaddr_t)tv & -NBPG, NBPG, VM_PROT_READ|VM_PROT_WRITE);
VM_PROT_READ|VM_PROT_WRITE, 1);
cpuinfo.cache_flush_all(); cpuinfo.cache_flush_all();
tv->tv_instr[0] = I_MOVi(I_L3, level); tv->tv_instr[0] = I_MOVi(I_L3, level);
tv->tv_instr[1] = I_BA(0, displ); tv->tv_instr[1] = I_BA(0, displ);
tv->tv_instr[2] = I_RDPSR(I_L0); 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(); cpuinfo.cache_flush_all();
fastvec &= ~(1 << level); fastvec &= ~(1 << level);
splx(s); 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. * Copyright (c) 2002 The NetBSD Foundation, Inc.
@ -267,8 +267,8 @@ mk_nvram_wenable(onoff)
{ {
int s; int s;
vm_prot_t prot;/* nonzero => change prot */ vm_prot_t prot;/* nonzero => change prot */
int npages;
vaddr_t base; vaddr_t base;
vsize_t size;
static int writers; static int writers;
s = splhigh(); s = splhigh();
@ -278,10 +278,10 @@ mk_nvram_wenable(onoff)
prot = --writers == 0 ? VM_PROT_READ : 0; prot = --writers == 0 ? VM_PROT_READ : 0;
splx(s); 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); base = trunc_page((vaddr_t)mk_nvram_base);
if (prot) if (prot)
pmap_changeprot(pmap_kernel(), base, prot, npages); pmap_kprotect(base, size, prot);
return (0); return (0);
} }