Fri Nov 6 00:40:02 2015 UTC ()
Pull up following revision(s) (requested by nat in ticket #984):
	sys/arch/x86/x86/cpu.c: revision 1.116
Don't disable/re-enable interrupts if they are already disabled.
Addresses PR 48196.
This commit was improved and approved by christos@


(riz)
diff -r1.111.2.1 -r1.111.2.2 src/sys/arch/x86/x86/cpu.c

cvs diff -r1.111.2.1 -r1.111.2.2 src/sys/arch/x86/x86/cpu.c (expand / switch to context diff)
--- src/sys/arch/x86/x86/cpu.c 2015/01/12 21:06:41 1.111.2.1
+++ src/sys/arch/x86/x86/cpu.c 2015/11/06 00:40:02 1.111.2.2
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.c,v 1.111.2.1 2015/01/12 21:06:41 snj Exp $	*/
+/*	$NetBSD: cpu.c,v 1.111.2.2 2015/11/06 00:40:02 riz Exp $	*/
 
 /*-
  * Copyright (c) 2000-2012 NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.111.2.1 2015/01/12 21:06:41 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.111.2.2 2015/11/06 00:40:02 riz Exp $");
 
 #include "opt_ddb.h"
 #include "opt_mpbios.h"		/* for MPDEBUG */
@@ -1278,6 +1278,7 @@
 {
 #ifdef PAE
 	struct cpu_info *ci = curcpu();
+	bool interrupts_enabled;
 	pd_entry_t *l3_pd = ci->ci_pae_l3_pdir;
 	int i;
 
@@ -1286,11 +1287,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));