Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/x86/x86 Don't disable/re-enable interrupts if they ...



details:   https://anonhg.NetBSD.org/src/rev/7a61a8a586fb
branches:  trunk
changeset: 810751:7a61a8a586fb
user:      nat <nat%NetBSD.org@localhost>
date:      Thu Sep 17 23:48:01 2015 +0000

description:
Don't disable/re-enable interrupts if they are already disabled.
Addresses PR 48196.

This commit was improved and approved by christos@

diffstat:

 sys/arch/x86/x86/cpu.c |  14 ++++++++++----
 1 files changed, 10 insertions(+), 4 deletions(-)

diffs (45 lines):

diff -r 8b26aafab523 -r 7a61a8a586fb sys/arch/x86/x86/cpu.c
--- a/sys/arch/x86/x86/cpu.c    Thu Sep 17 14:39:35 2015 +0000
+++ b/sys/arch/x86/x86/cpu.c    Thu Sep 17 23:48:01 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cpu.c,v 1.115 2015/05/18 13:09:55 msaitoh Exp $        */
+/*     $NetBSD: cpu.c,v 1.116 2015/09/17 23:48:01 nat Exp $    */
 
 /*-
  * Copyright (c) 2000-2012 NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.115 2015/05/18 13:09:55 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.116 2015/09/17 23:48:01 nat Exp $");
 
 #include "opt_ddb.h"
 #include "opt_mpbios.h"                /* for MPDEBUG */
@@ -1277,6 +1277,7 @@
 {
 #ifdef PAE
        struct cpu_info *ci = curcpu();
+       bool interrupts_enabled;
        pd_entry_t *l3_pd = ci->ci_pae_l3_pdir;
        int i;
 
@@ -1285,11 +1286,16 @@
         * while this doesn't block NMIs, it's probably ok as NMIs unlikely
         * reload cr3.
         */
-       x86_disable_intr();
+       interrupts_enabled = (x86_read_flags() & PSL_I) != 0;
+       if (interrupts_enabled)
+               x86_disable_intr();
+
        for (i = 0 ; i < PDP_SIZE; i++) {
                l3_pd[i] = pmap->pm_pdirpa[i] | PG_V;
        }
-       x86_enable_intr();
+       
+       if (interrupts_enabled)
+               x86_enable_intr();
        tlbflush();
 #else /* PAE */
        lcr3(pmap_pdirpa(pmap, 0));



Home | Main Index | Thread Index | Old Index