Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-2-0]: src/sys/arch/sh3/sh3 Pullup rev 1.7 (requested by tsutsui i...
details: https://anonhg.NetBSD.org/src/rev/0a0285dca3a2
branches: netbsd-2-0
changeset: 564661:0a0285dca3a2
user: jmc <jmc%NetBSD.org@localhost>
date: Mon Jan 10 19:00:50 2005 +0000
description:
Pullup rev 1.7 (requested by tsutsui in ticket #1072)
Protect accesses to PTE/TLB registers with
_cpu_exception_suspend()/_cpu_exception_resume() pair. Prevents
spontaneous reboot under heavy load
diffstat:
sys/arch/sh3/sh3/mmu_sh3.c | 20 +++++++++++++++-----
1 files changed, 15 insertions(+), 5 deletions(-)
diffs (93 lines):
diff -r 99af8c963a73 -r 0a0285dca3a2 sys/arch/sh3/sh3/mmu_sh3.c
--- a/sys/arch/sh3/sh3/mmu_sh3.c Mon Jan 10 19:00:48 2005 +0000
+++ b/sys/arch/sh3/sh3/mmu_sh3.c Mon Jan 10 19:00:50 2005 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mmu_sh3.c,v 1.6 2003/07/15 03:35:57 lukem Exp $ */
+/* $NetBSD: mmu_sh3.c,v 1.6.2.1 2005/01/10 19:00:50 jmc Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mmu_sh3.c,v 1.6 2003/07/15 03:35:57 lukem Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mmu_sh3.c,v 1.6.2.1 2005/01/10 19:00:50 jmc Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -63,10 +63,11 @@
sh3_tlb_invalidate_addr(int asid, vaddr_t va)
{
u_int32_t a, d;
- int w;
+ int s, w;
d = (va & SH3_MMUAA_D_VPN_MASK_4K) | asid; /* 4K page */
va = va & SH3_MMU_VPN_MASK; /* [16:12] entry index */
+ s = _cpu_exception_suspend();
/* Probe entry and invalidate it. */
for (w = 0; w < SH3_MMU_WAY; w++) {
@@ -77,14 +78,17 @@
break;
}
}
+
+ _cpu_exception_resume(s);
}
void
sh3_tlb_invalidate_asid(int asid)
{
u_int32_t aw, a;
- int e, w;
+ int s, e, w;
+ s = _cpu_exception_suspend();
/* Invalidate entry attribute to ASID */
for (w = 0; w < SH3_MMU_WAY; w++) {
aw = (w << SH3_MMU_WAY_SHIFT);
@@ -96,14 +100,16 @@
}
}
}
+ _cpu_exception_resume(s);
}
void
sh3_tlb_invalidate_all()
{
u_int32_t aw, a;
- int e, w;
+ int s, e, w;
+ s = _cpu_exception_suspend();
/* Zero clear all TLB entry to avoid unexpected VPN match. */
for (w = 0; w < SH3_MMU_WAY; w++) {
aw = (w << SH3_MMU_WAY_SHIFT);
@@ -113,15 +119,18 @@
_reg_write_4(SH3_MMUDA | a, 0);
}
}
+ _cpu_exception_resume(s);
}
void
sh3_tlb_update(int asid, vaddr_t va, u_int32_t pte)
{
u_int32_t oasid;
+ int s;
KDASSERT(asid < 0x100 && (pte & ~PGOFSET) != 0 && va != 0);
+ s = _cpu_exception_suspend();
/* Save old ASID */
oasid = _reg_read_4(SH3_PTEH) & SH3_PTEH_ASID_MASK;
@@ -136,4 +145,5 @@
/* Restore old ASID */
if (asid != oasid)
_reg_write_4(SH3_PTEH, oasid);
+ _cpu_exception_resume(s);
}
Home |
Main Index |
Thread Index |
Old Index