Module Name:    src
Committed By:   jym
Date:           Thu Apr 19 18:07:05 UTC 2012

Modified Files:
        src/sys/arch/i386/i386: locore.S

Log Message:
Mirror what is done for amd64 boot and ACPI wakeup code by setting
CR0_WP (write protection bit) early on boot. Although it is set later via
cpu_init(), this can help tracking down invalid writes to pages mapped
as read only from ring 0.

No regression observed when booting under anita (QEMU) or a P4 host.

Depending on your hardware or setup, you may trigger code paths I have
overlooked. So if your machine does not start properly, or you get
page faults early during boot, please report them to me.


To generate a diff of this commit:
cvs rdiff -u -r1.98 -r1.99 src/sys/arch/i386/i386/locore.S

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/i386/i386/locore.S
diff -u src/sys/arch/i386/i386/locore.S:1.98 src/sys/arch/i386/i386/locore.S:1.99
--- src/sys/arch/i386/i386/locore.S:1.98	Thu Apr 19 18:00:35 2012
+++ src/sys/arch/i386/i386/locore.S	Thu Apr 19 18:07:05 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.S,v 1.98 2012/04/19 18:00:35 jym Exp $	*/
+/*	$NetBSD: locore.S,v 1.99 2012/04/19 18:07:05 jym Exp $	*/
 
 /*
  * Copyright-o-rama!
@@ -129,7 +129,7 @@
  */
 
 #include <machine/asm.h>
-__KERNEL_RCSID(0, "$NetBSD: locore.S,v 1.98 2012/04/19 18:00:35 jym Exp $");
+__KERNEL_RCSID(0, "$NetBSD: locore.S,v 1.99 2012/04/19 18:07:05 jym Exp $");
 
 #include "opt_compat_oldboot.h"
 #include "opt_ddb.h"
@@ -682,7 +682,7 @@ try586:	/* Use the `cpuid' instruction. 
  	 */
 	movl	%cr0,%eax		# get control word
 					# enable paging & NPX emulation
-	orl	$(CR0_PE|CR0_PG|CR0_NE|CR0_TS|CR0_EM|CR0_MP|CR0_AM),%eax
+	orl	$(CR0_PE|CR0_PG|CR0_NE|CR0_TS|CR0_EM|CR0_MP|CR0_WP|CR0_AM),%eax
 	movl	%eax,%cr0		# and page NOW!
 
 	pushl	$begin			# jump to high mem

Reply via email to