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.8 (requested by tsutsui i...



details:   https://anonhg.NetBSD.org/src/rev/40feaf825dc1
branches:  netbsd-2-0
changeset: 564662:40feaf825dc1
user:      jmc <jmc%NetBSD.org@localhost>
date:      Mon Jan 10 19:00:54 2005 +0000

description:
Pullup rev 1.8 (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_sh4.c |  20 ++++++++++++++++----
 1 files changed, 16 insertions(+), 4 deletions(-)

diffs (92 lines):

diff -r 0a0285dca3a2 -r 40feaf825dc1 sys/arch/sh3/sh3/mmu_sh4.c
--- a/sys/arch/sh3/sh3/mmu_sh4.c        Mon Jan 10 19:00:50 2005 +0000
+++ b/sys/arch/sh3/sh3/mmu_sh4.c        Mon Jan 10 19:00:54 2005 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mmu_sh4.c,v 1.7 2003/07/15 03:35:57 lukem Exp $        */
+/*     $NetBSD: mmu_sh4.c,v 1.7.2.1 2005/01/10 19:00:54 jmc Exp $      */
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mmu_sh4.c,v 1.7 2003/07/15 03:35:57 lukem Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mmu_sh4.c,v 1.7.2.1 2005/01/10 19:00:54 jmc Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -85,7 +85,10 @@
 sh4_tlb_invalidate_addr(int asid, vaddr_t va)
 {
        u_int32_t pteh;
+       int s;
+
        va &= SH4_PTEH_VPN_MASK;
+       s = _cpu_exception_suspend();
 
        /* Save current ASID */
        pteh = _reg_read_4(SH4_PTEH);
@@ -98,14 +101,17 @@
        RUN_P1;
        /* Restore ASID */
        _reg_write_4(SH4_PTEH, pteh);
+
+       _cpu_exception_resume(s);
 }
 
 void
 sh4_tlb_invalidate_asid(int asid)
 {
        u_int32_t a;
-       int e;
+       int e, s;
 
+       s = _cpu_exception_suspend();
        /* Invalidate entry attribute to ASID */
        RUN_P2;
        for (e = 0; e < SH4_UTLB_ENTRY; e++) {
@@ -116,14 +122,16 @@
 
        __sh4_itlb_invalidate_all();
        RUN_P1;
+       _cpu_exception_resume(s);
 }
 
 void
 sh4_tlb_invalidate_all()
 {
        u_int32_t a;
-       int e, eend;
+       int e, eend, s;
 
+       s = _cpu_exception_suspend();
        /* If non-wired entry limit is zero, clear all entry. */
        a = _reg_read_4(SH4_MMUCR) & SH4_MMUCR_URB_MASK;
        eend = a ? (a >> SH4_MMUCR_URB_SHIFT) : SH4_UTLB_ENTRY;
@@ -141,6 +149,7 @@
        _reg_write_4(SH4_ITLB_DA1 | (2 << SH4_ITLB_E_SHIFT), 0);
        _reg_write_4(SH4_ITLB_DA1 | (3 << SH4_ITLB_E_SHIFT), 0);
        RUN_P1;
+       _cpu_exception_resume(s);
 }
 
 void
@@ -148,9 +157,11 @@
 {
        u_int32_t oasid;
        u_int32_t ptel;
+       int s;
 
        KDASSERT(asid < 0x100 && (pte & ~PGOFSET) != 0 && va != 0);
 
+       s = _cpu_exception_suspend();
        /* Save old ASID */
        oasid = _reg_read_4(SH4_PTEH) & SH4_PTEH_ASID_MASK;
 
@@ -173,4 +184,5 @@
        /* Restore old ASID */
        if (asid != oasid)
                _reg_write_4(SH4_PTEH, oasid);
+       _cpu_exception_resume(s);
 }



Home | Main Index | Thread Index | Old Index